Reorganise the visual lab and mythic variations around a Holo and Particles panel
The visual lab becomes a single bench: one thumbnail per holographic effect picks the effect, and a large card sits beside the shared customisation panel. The mythic editor shows its variations as a row of thumbnails above the settings of the selected one, with a large card preview, and saves them with a single Enregistrer / Annuler pair instead of saving each slider. Formats and effects whose files a card lacks stay in their menu, disabled at the bottom with the missing files listed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
808adadc0c
commit
9f70bea523
13 changed files with 621 additions and 343 deletions
|
|
@ -3,7 +3,7 @@ import { useRef } from "react";
|
|||
import { CompactDropdown } from "./CompactDropdown.jsx";
|
||||
|
||||
function moveFocus(event) {
|
||||
const options = [...event.currentTarget.querySelectorAll('[role="option"]')];
|
||||
const options = [...event.currentTarget.querySelectorAll('[role="option"]:not(:disabled)')];
|
||||
const current = options.indexOf(globalThis.document.activeElement);
|
||||
const targets = { ArrowDown: options[current + 1], ArrowUp: options[current - 1], Home: options[0], End: options.at(-1) };
|
||||
if (!(event.key in targets)) return;
|
||||
|
|
@ -11,12 +11,13 @@ function moveFocus(event) {
|
|||
targets[event.key]?.focus();
|
||||
}
|
||||
|
||||
// `options` : [{ value, label }]. `hideLabel` masque l'intitulé visible en conservant le nom accessible ; `align="end"` ouvre le menu vers la gauche, près du bord droit.
|
||||
// `options` : [{ value, label, disabled?, hint? }] ; une option désactivée reste visible, grisée, avec son explication (`hint`)
|
||||
// sous le libellé, et le clavier la saute. `hideLabel` masque l'intitulé visible en conservant le nom accessible ; `align="end"` ouvre le menu vers la gauche, près du bord droit.
|
||||
export function SelectDropdown({ label, hideLabel = false, value, options, onChange, placeholder = "", disabled = false, size = "md", align = "start", className = "" }) {
|
||||
const triggerElement = useRef(null);
|
||||
const selected = options.find((option) => option.value === value);
|
||||
const text = selected?.label ?? placeholder;
|
||||
const focusedValue = selected ? value : options[0]?.value;
|
||||
const focusedValue = selected && !selected.disabled ? value : options.find((option) => !option.disabled)?.value;
|
||||
|
||||
return <div className={`nds-select-field ${className}`.trim()} data-align={align}>
|
||||
{!hideLabel && <span aria-hidden="true">{label}</span>}
|
||||
|
|
@ -44,13 +45,14 @@ export function SelectDropdown({ label, hideLabel = false, value, options, onCha
|
|||
type="button"
|
||||
role="option"
|
||||
aria-selected={option.value === value}
|
||||
disabled={option.disabled}
|
||||
autoFocus={option.value === focusedValue}
|
||||
onClick={() => {
|
||||
onChange(option.value);
|
||||
close();
|
||||
triggerElement.current?.focus();
|
||||
}}
|
||||
>{option.label}</button>)}
|
||||
>{option.label}{option.hint && <small className="nds-select-option-hint">{option.hint}</small>}</button>)}
|
||||
</CompactDropdown>
|
||||
</div>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue