Mixins / foldkit-mixins-ui

RadioGroup

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

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

Members

RadioGroup.RadioGroupSlots

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

const RadioGroupSlots: Slots.Contract<{
  readonly group: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly [Attr.AttrToken<'role'>],
    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-selected'>,
      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.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 hiddenInput: Slot.UnnamedSlot<
    Capability.Capability<'Base', readonly []>,
    readonly Slot.EventName[],
    readonly [Attr.AttrToken<'value'>],
    readonly Slot.RequirementName[],
    boolean
  >
}>

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.resolve

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

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:45

interface ResolvedRadioGroup<Value extends string, Message> {
  readonly group: SlotAttributes<Message>
  readonly options: ReadonlyArray<ResolvedRadioOption<Value, 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:35

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

One option with the attached Mixins applied to its bundles.

RadioGroup.toView

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

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.