Mixins / foldkit-mixins-ui

Select

namespace · packages/mixins-ui/src/select.ts:1

export * as Select from './select.js'

In the guides

Members

Select.configure

function · packages/mixins-ui/src/select/view.ts:126

function configure<const Names extends string = never>(
  config: Presets<SelectPreset, Names>,
): {
  readonly view: <Outer>(
    options: SelectView<Outer> & PresetOption<Names>,
    h: HtmlBuilder<Outer>,
  ) => Html
}

The application's own Select: base for every use, presets chosen at a use with preset, and the call over both. mixins concatenate in that order; any other option given at the call replaces the preset's.

Select.resolve

function · packages/mixins-ui/src/select.ts:23

function resolve<Input, Message>(
  attributes: SelectAttributes<Message>,
  mixins: MixinList<Message>,
  context: ResolveContext<Input, Message>,
): ResolvedSelect<Message>

Applies mixins to the select's bundles.

Select.ResolvedSelect

type · packages/mixins-ui/src/select.ts:16

type ResolvedSelect<Message> = Resolved<
  SelectAttributes<Message>,
  typeof SelectSlots,
  Message
>

The select's bundles with the attached Mixins applied.

Select.SelectOption

interface · packages/mixins-ui/src/select/view.ts:16

interface SelectOption {
  readonly value: string
  readonly label: string
  readonly group?: string | undefined
  readonly disabled?: boolean | undefined
}

Select.SelectPreset

type · packages/mixins-ui/src/select/view.ts:117

type SelectPreset = Pick<SelectView<never>, 'placeholder' | 'style'> & {
  readonly mixins?: MixinList<never>
}

What a Select is given once: its look and each option that holds no Message and nothing of one field.

Select.SelectSlots

const · packages/mixins-ui/src/select/slots.ts:8

const SelectSlots: 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 select: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"change">], readonly [Attr.AttrToken<"aria-label">, Attr.AttrToken<"aria-invalid">, Attr.AttrToken<"disabled">, Attr.AttrToken<"value">], readonly Slot.RequirementName[], boolean>; readonly option: 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 group: 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 label: 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.Ca …;

The base bundle installs OnChange only when onChange is configured and the control is enabled, so a Behavior that adds its own handler is a conflict rather than a second silent owner.

Select.SelectView

interface · packages/mixins-ui/src/select/view.ts:25

interface SelectView<Outer> {
  readonly id: string
  readonly label: string
  readonly options: ReadonlyArray<SelectOption>
  readonly value?: string | undefined
  readonly onChange?: ((value: string) => NoInfer<Outer>) | undefined
  readonly placeholder?: string | undefined
  readonly description?: string | undefined
  readonly disabled?: boolean | undefined
  readonly invalid?: boolean | undefined
  readonly name?: string | undefined
  readonly style?: NamedStyle<typeof SelectSlots> | undefined
  readonly mixins?: MixinList<Outer> | undefined
}

Select.toView

function · packages/mixins-ui/src/select.ts:30

function toView<Message>(
  mixins: MixinList<Message>,
  context: ResolveContext<unknown, Message>,
  draw: (resolved: ResolvedSelect<Message>) => Html,
): (attributes: SelectAttributes<Message>) => Html

The select's toView: draw receives its bundles with mixins applied.

Select.view

function · packages/mixins-ui/src/select/view.ts:47

function view<Outer>(options: SelectView<Outer>, h: HtmlBuilder<Outer>): Html