Mixins / foldkit-mixins-ui

RadioGroup

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

export * as RadioGroup from './radioGroup.js'

In the guides

Members

RadioGroup.configure

function · packages/mixins-ui/src/radioGroup/view.ts:133

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

The application's own RadioGroup: 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.

RadioGroup.RadioGroupPreset

type · packages/mixins-ui/src/radioGroup/view.ts:121

type RadioGroupPreset = Pick<
  RadioGroupView<string, never>,
  'orientation' | 'hideLegend' | 'style'
> & {
  readonly mixins?: MixinList<never>
}

What a RadioGroup is given once: its look and each option that holds no Message, no drawing and nothing of one group's value.

RadioGroup.RadioGroupRow

interface · packages/mixins-ui/src/radioGroup/view.ts:19

interface RadioGroupRow<Value extends string> extends RowContent {
  readonly value: Value
}

One radio: the row's words and marks, and the value it chooses.

RadioGroup.RadioGroupSlots

const · packages/mixins-ui/src/radioGroup/slots.ts:13

const RadioGroupSlots: 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 legend: 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 [Attr.AttrToken<"role">, Attr.AttrToken<"aria-label">, Attr.AttrToken<"aria-invalid">, Attr.AttrToken<"aria-describedby">], readonly Slot.RequirementName[], boolean>; readonly option: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"click">], readonly [Attr.AttrToken<"role">, Attr.AttrToken<"aria-checked">, Attr.AttrToken<"aria-labelledby">, Attr.AttrToken<"disabled">, Attr.AttrToken<"aria-disabled">], readonly Slot.RequirementName[], boolean>; readonly label: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.E …;

RadioGroup is a Submodel: each published bundle is a ChildAttribute group that carries the boundary's dispatcher. The resolver treats those as opaque and preserves their identity, so spreading a resolved bundle into the parent's markup keeps routing through the radio group's toParentMessage.

The base installs OnClick on an enabled, non-readonly option's option bundle, so a Behavior adding its own click handler is a conflict rather than a second silent owner.

RadioGroup.RadioGroupView

interface · packages/mixins-ui/src/radioGroup/view.ts:23

interface RadioGroupView<Value extends string, Outer> {
  readonly model: UiRadioGroup.Model
  readonly onMessage: (message: UiRadioGroup.Message) => Outer
  readonly legend: string
  readonly hideLegend?: boolean | undefined
  readonly options: ReadonlyArray<RadioGroupRow<Value>>
  readonly value: Option.Option<Value>
  readonly orientation?: 'horizontal' | 'vertical' | undefined
  readonly disabled?: boolean | undefined
  readonly readOnly?: boolean | undefined
  readonly invalid?: boolean | undefined
  readonly error?: string | undefined
  readonly name?: string | undefined
  readonly style?: NamedStyle<typeof RadioGroupSlots> | undefined
  readonly mixins?: MixinList<Outer> | undefined
}

RadioGroup.readingKeys

const · packages/mixins-ui/src/radioGroup/readingKeys.ts:56

const readingKeys: Mixin<never>

Arrow keys as the APG asks: Right and Down are both next, Left and Up both previous, in a row or a column, and right to left swaps Left and Right. Upstream's handler on each option binds one pair and knows no direction, and no view option reaches it, so this is a Mount that rewrites the key before that handler reads it: the one keydown owner stays the option's. Pass it beside the style. It is not built in because a Scene test must resolve every Mount with a Message, and this one has none to give.

RadioGroup.resolve

function · packages/mixins-ui/src/radioGroup.ts:44

function resolve<Value extends string, Input, Message>(
  render: RenderInfo<Value>,
  mixins: MixinList<Message>,
  context: ResolveContext<Input, Message>,
): ResolvedRadioGroup<Value, Message>

Resolves every option's bundles alongside the group and hidden input.

RadioGroup.ResolvedRadioGroup

interface · packages/mixins-ui/src/radioGroup.ts:32

interface ResolvedRadioGroup<Value extends string, Message> {
  readonly root: SlotAttributes<Message>
  readonly legend: SlotAttributes<Message>
  readonly group: SlotAttributes<Message>
  readonly options: ReadonlyArray<ResolvedRadioOption<Value, Message>>
  readonly error: SlotAttributes<Message>
  readonly selectedValue: RenderInfo<Value>['selectedValue']
  readonly hiddenInput: SlotAttributes<Message>
}

The radio group's bundles with the attached Mixins applied.

RadioGroup.ResolvedRadioOption

type · packages/mixins-ui/src/radioGroup.ts:18

type ResolvedRadioOption<Value extends string, Message> = Omit<
  OptionInfo<Value>,
  'option' | 'label' | 'description'
> & {
  readonly option: SlotAttributes<Message>
  readonly label: SlotAttributes<Message>
  readonly description: SlotAttributes<Message>
  readonly card: SlotAttributes<Message>
  readonly text: SlotAttributes<Message>
  readonly icon: SlotAttributes<Message>
  readonly trailing: SlotAttributes<Message>
}

One option with the attached Mixins applied to its bundles.

RadioGroup.toView

function · packages/mixins-ui/src/radioGroup.ts:71

function toView<Value extends string, Message>(
  mixins: MixinList<Message>,
  context: ResolveContext<unknown, Message>,
  draw: (resolved: ResolvedRadioGroup<Value, Message>) => Html,
): (render: RenderInfo<Value>) => Html

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

RadioGroup.view

function · packages/mixins-ui/src/radioGroup/view.ts:54

function view<Value extends string, Outer>(
  options: RadioGroupView<Value, Outer>,
  h: HtmlBuilder<Outer>,
): Html