Mixins / foldkit-mixins-ui
FileInputSlots
const · packages/mixins-ui/src/fileInput.ts:32
const FileInputSlots: Slots.Contract<{ readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly input: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"change">], readonly [Attr.AttrToken<"aria-invalid">, Attr.AttrToken<"aria-describedby">, Attr.AttrToken<"disabled">], readonly Slot.RequirementName[], boolean>; readonly trigger: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly description: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly list: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly item: Slot.UnnamedSlot<Capability.Capability<"Container", …;A file picker: a native type="file" input, hidden but still the one
focusable control, and a trigger drawn as a button that is its label, so
the browser opens its dialog for a press on the button and for Enter or Space
on the input, with no script between. The chosen files are listed in a list
of items, each with a remove button.
The application owns the list. The input forgets what it was given (Foldkit
empties it after each pick, so the same file can be chosen again), which
would leave a surrounding form with no file; answer onChange and onRemove
with Sync, which writes the list back into the input, so a form submits
exactly what the list shows. A removed row takes its button and the focus it
held: answer onRemove with Focus as well, which puts focus on the input.