Mixins / foldkit-mixins-ui

DatePicker

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

export * as DatePicker from './datePicker.js'

In the guides

Members

DatePicker.DatePickerSlots

const · packages/mixins-ui/src/datePicker.ts:18

const DatePickerSlots: Slots.Contract<{
  readonly trigger: Slot.UnnamedSlot<
    Capability.Capability<
      'Interactive',
      readonly [Capability.Capability<'Base', readonly []>]
    >,
    readonly [Event.EventToken<'click'>],
    readonly [Attr.AttrToken<'aria-expanded'>],
    readonly Slot.RequirementName[],
    boolean
  >
  readonly panel: 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 backdrop: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly [Event.EventToken<'click'>],
    readonly Slot.AttributeName[],
    readonly Slot.RequirementName[],
    boolean
  >
}>

DatePicker is a small composed Submodel: a trigger button plus a panel/backdrop pair around the embedded calendar. The resolver runs once per bundle and each base attribute passes through by identity. The wrapper and hidden form inputs are drawn outside the popover assembly and pass through untouched.

The trigger owns click while enabled. A Behavior adding its own handler is a conflict, not a second silent owner. The backdrop owns click while the popover shows it.

DatePicker.resolve

function · packages/mixins-ui/src/datePicker.ts:41

function resolve<Input>(
  render: DatePickerRenderInfo,
  mixins: MixinList<Message>,
  context: ResolveContext<Input, Message>,
): ResolvedDatePicker

Resolves the date picker's popover bundles. Concrete over the date picker's own Message: unlike the wrapped forks, these bundles mix the popover's pre-bound groups with plain date-picker attributes, so they cannot promise any other universe. Message-free Mixins (the styling case) and date-picker-message Behaviors attach unchanged.

DatePicker.ResolvedDatePicker

type · packages/mixins-ui/src/datePicker.ts:28

type ResolvedDatePicker = Omit<
  DatePickerRenderInfo,
  'trigger' | 'panel' | 'backdrop'
> & {
  readonly trigger: SlotAttributes<Message>
  readonly panel: SlotAttributes<Message> | undefined
  readonly backdrop: SlotAttributes<Message> | undefined
}

DatePicker.toView

function · packages/mixins-ui/src/datePicker.ts:63

function toView(
  mixins: MixinList<Message>,
  draw?: (resolved: ResolvedDatePicker, h: HtmlBuilder<Message>) => Html,
): (render: DatePickerRenderInfo, h: HtmlBuilder<Message>) => Html

The date picker's toView: draw receives its bundles with mixins applied, and the date picker's builder to draw them with; without one, they are drawn as upstream draws them. Unlike the other adapters' it takes no builder of the application's, which could not draw these bundles.