Skip to main content
On this pageConstants

Ui/Listbox/test

Constants

AnchorListbox

constsource
/**
 * The anchor-positioning Mount this Listbox renders on its items panel.
 *  The panel is always anchored to the button via Floating UI and portaled
 *  to the document body, or into the enclosing `<dialog>` when there is one
 *  (opt out of portaling with `anchor.portal: false`), so it escapes ancestor
 *  stacking contexts and overflow clipping.
 * 
 *  It also carries the open-focus for the anchored panel. An anchored panel
 *  renders `visibility: hidden` until Floating UI resolves its first position,
 *  and `.focus()` does not land on a hidden element, so `FocusListboxItems` alone
 *  cannot focus it. `focusAfterPosition` focuses the panel as part of that
 *  first reveal. `FocusListboxItems` still focuses the panel when no anchor is
 *  configured, where the panel is visible as soon as the render commits.
 * 
 *  Exposed so Scene tests can call
 *  `Scene.Mount.resolve(AnchorListbox, CompletedAnchorListbox())`.
 */
const AnchorListbox: LayeredMountDefinitionWithArgs<"Listbox/AnchorListbox", {
  anchor: Struct<{
    gap: optional<Number>
    isPlacementLocked: optional<Boolean>
    offset: optional<Number>
    padding: optional<Union<readonly [
      Number,
      Struct<{
        bottom: optionalKey<unknown>
        left: optionalKey<unknown>
        right: optionalKey<unknown>
        top: optionalKey<unknown>
      }>
    ]>>
    placement: optional<Literals<readonly ["top", "right", "bottom", "left", "top-start", "top-end", "right-start", "right-end", "bottom-start", "bottom-end", "left-start", "left-end"]>>
    portal: optional<Boolean>
  }>
  buttonId: String
}, {
  _tag: "CompletedAnchorListbox"
}> & Readonly<{
  layer: Layer<Handler<"Listbox/AnchorListbox", Readonly<{
    element: Element
    viewStateChanges: Stream<"Live" | "Paused">
  }> & {
    anchor: Anchor.AnchorConfig
    buttonId: string
  }, {
    _tag: "CompletedAnchorListbox"
  }>, never, never>
}>

ClickListboxItem

constsource
/** Programmatically clicks the active listbox item's DOM element. */
const ClickListboxItem: LayeredCommandDefinitionWithArgs<"Listbox/ClickListboxItem", {
  id: String
  index: Number
}, {
  _tag: "CompletedClickListboxItem"
}> | DefinitionWithArgsNameKeyed<"Listbox/ClickListboxItem", {
  id: String
  index: Number
}, Effect<{
  _tag: "CompletedClickListboxItem"
}, never, Handler<"Listbox/ClickListboxItem", {
  id: string
  index: number
}, {
  _tag: "CompletedClickListboxItem"
}>>> | DefinitionWithArgs<"Listbox/ClickListboxItem", {
  id: String
  index: Number
}, Pick<{
  id: string
  index: number
}, "id" | "index">, Effect<{
  _tag: "CompletedClickListboxItem"
}, never, Handler<"Listbox/ClickListboxItem", {
  id: string
  index: number
}, {
  _tag: "CompletedClickListboxItem"
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/ClickListboxItem", {
    id: string
    index: number
  }, {
    _tag: "CompletedClickListboxItem"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/ClickListboxItem", {
    id: string
    index: number
  }, {
    _tag: "CompletedClickListboxItem"
  }>
}>

DelayClearListboxSearch

constsource
/** Waits for the typeahead search debounce period before clearing the query. */
const DelayClearListboxSearch: LayeredCommandDefinitionWithArgs<"Listbox/DelayClearListboxSearch", {
  version: Number
}, {
  _tag: "CompletedDelayClearListboxSearch"
  version: number
}> | DefinitionWithArgsNameKeyed<"Listbox/DelayClearListboxSearch", {
  version: Number
}, Effect<{
  _tag: "CompletedDelayClearListboxSearch"
  version: number
}, never, Handler<"Listbox/DelayClearListboxSearch", {
  version: number
}, {
  _tag: "CompletedDelayClearListboxSearch"
  version: number
}>>> | DefinitionWithArgs<"Listbox/DelayClearListboxSearch", {
  version: Number
}, Pick<{
  version: number
}, "version">, Effect<{
  _tag: "CompletedDelayClearListboxSearch"
  version: number
}, never, Handler<"Listbox/DelayClearListboxSearch", {
  version: number
}, {
  _tag: "CompletedDelayClearListboxSearch"
  version: number
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/DelayClearListboxSearch", {
    version: number
  }, {
    _tag: "CompletedDelayClearListboxSearch"
    version: number
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/DelayClearListboxSearch", {
    version: number
  }, {
    _tag: "CompletedDelayClearListboxSearch"
    version: number
  }>
}>

DetectListboxMovementOrAnimationEnd

constsource
/** Detects whether the listbox button moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation block that leave is complete. */
const DetectListboxMovementOrAnimationEnd: LayeredCommandDefinitionWithArgs<"Listbox/DetectListboxMovementOrAnimationEnd", {
  generation: Number
  id: String
}, {
  _tag: "CompletedDetectListboxMovementOrAnimationEnd"
  generation: number
}> | DefinitionWithArgsNameKeyed<"Listbox/DetectListboxMovementOrAnimationEnd", {
  generation: Number
  id: String
}, Effect<{
  _tag: "CompletedDetectListboxMovementOrAnimationEnd"
  generation: number
}, never, Handler<"Listbox/DetectListboxMovementOrAnimationEnd", {
  generation: number
  id: string
}, {
  _tag: "CompletedDetectListboxMovementOrAnimationEnd"
  generation: number
}>>> | DefinitionWithArgs<"Listbox/DetectListboxMovementOrAnimationEnd", {
  generation: Number
  id: String
}, Pick<{
  generation: number
  id: string
}, "id" | "generation">, Effect<{
  _tag: "CompletedDetectListboxMovementOrAnimationEnd"
  generation: number
}, never, Handler<"Listbox/DetectListboxMovementOrAnimationEnd", {
  generation: number
  id: string
}, {
  _tag: "CompletedDetectListboxMovementOrAnimationEnd"
  generation: number
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/DetectListboxMovementOrAnimationEnd", {
    generation: number
    id: string
  }, {
    _tag: "CompletedDetectListboxMovementOrAnimationEnd"
    generation: number
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/DetectListboxMovementOrAnimationEnd", {
    generation: number
    id: string
  }, {
    _tag: "CompletedDetectListboxMovementOrAnimationEnd"
    generation: number
  }>
}>

FocusListboxButton

constsource
/** Moves focus back to the listbox button after closing. */
const FocusListboxButton: LayeredCommandDefinitionWithArgs<"Listbox/FocusListboxButton", {
  id: String
}, {
  _tag: "CompletedFocusListboxButton"
}> | DefinitionWithArgsNameKeyed<"Listbox/FocusListboxButton", {
  id: String
}, Effect<{
  _tag: "CompletedFocusListboxButton"
}, never, Handler<"Listbox/FocusListboxButton", {
  id: string
}, {
  _tag: "CompletedFocusListboxButton"
}>>> | DefinitionWithArgs<"Listbox/FocusListboxButton", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedFocusListboxButton"
}, never, Handler<"Listbox/FocusListboxButton", {
  id: string
}, {
  _tag: "CompletedFocusListboxButton"
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/FocusListboxButton", {
    id: string
  }, {
    _tag: "CompletedFocusListboxButton"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/FocusListboxButton", {
    id: string
  }, {
    _tag: "CompletedFocusListboxButton"
  }>
}>

FocusListboxItems

constsource
/** Moves focus to the listbox items container after opening. */
const FocusListboxItems: LayeredCommandDefinitionWithArgs<"Listbox/FocusListboxItems", {
  id: String
}, {
  _tag: "CompletedFocusListboxItems"
}> | DefinitionWithArgsNameKeyed<"Listbox/FocusListboxItems", {
  id: String
}, Effect<{
  _tag: "CompletedFocusListboxItems"
}, never, Handler<"Listbox/FocusListboxItems", {
  id: string
}, {
  _tag: "CompletedFocusListboxItems"
}>>> | DefinitionWithArgs<"Listbox/FocusListboxItems", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedFocusListboxItems"
}, never, Handler<"Listbox/FocusListboxItems", {
  id: string
}, {
  _tag: "CompletedFocusListboxItems"
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/FocusListboxItems", {
    id: string
  }, {
    _tag: "CompletedFocusListboxItems"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/FocusListboxItems", {
    id: string
  }, {
    _tag: "CompletedFocusListboxItems"
  }>
}>

InertListboxOthers

constsource
/** Marks all elements outside the listbox as inert for modal behavior. */
const InertListboxOthers: LayeredCommandDefinitionWithArgs<"Listbox/InertListboxOthers", {
  id: String
}, {
  _tag: "CompletedInertListboxOthers"
}> | DefinitionWithArgsNameKeyed<"Listbox/InertListboxOthers", {
  id: String
}, Effect<{
  _tag: "CompletedInertListboxOthers"
}, never, Handler<"Listbox/InertListboxOthers", {
  id: string
}, {
  _tag: "CompletedInertListboxOthers"
}>>> | DefinitionWithArgs<"Listbox/InertListboxOthers", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedInertListboxOthers"
}, never, Handler<"Listbox/InertListboxOthers", {
  id: string
}, {
  _tag: "CompletedInertListboxOthers"
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/InertListboxOthers", {
    id: string
  }, {
    _tag: "CompletedInertListboxOthers"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/InertListboxOthers", {
    id: string
  }, {
    _tag: "CompletedInertListboxOthers"
  }>
}>

LockListboxScroll

constsource
/** Prevents page scrolling while the listbox is open in modal mode. */
const LockListboxScroll: LayeredCommandDefinitionNoArgs<"Listbox/LockListboxScroll", {
  _tag: "CompletedLockListboxScroll"
}> | DefinitionNoArgs<"Listbox/LockListboxScroll", Effect<{
  _tag: "CompletedLockListboxScroll"
}, never, Handler<"Listbox/LockListboxScroll", void, {
  _tag: "CompletedLockListboxScroll"
}>>> & Readonly<{
  toLayer: ToLayer<"Listbox/LockListboxScroll", void, {
    _tag: "CompletedLockListboxScroll"
  }>
}> & Readonly<{
  layer: Layer<Handler<"Listbox/LockListboxScroll", void, {
    _tag: "CompletedLockListboxScroll"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/LockListboxScroll", void, {
    _tag: "CompletedLockListboxScroll"
  }>
}>

PortalListboxBackdrop

constsource
/**
 * The backdrop-portaling Mount this Listbox renders. Exposed so Scene tests can
 *  call `Scene.Mount.resolve(PortalListboxBackdrop, CompletedPortalListboxBackdrop())` to
 *  acknowledge the mount produced by the rendered backdrop.
 */
const PortalListboxBackdrop: LayeredMountDefinitionNoArgs<"Listbox/PortalListboxBackdrop", {
  _tag: "CompletedPortalListboxBackdrop"
}> & Readonly<{
  layer: Layer<Handler<"Listbox/PortalListboxBackdrop", Readonly<{
    element: Element
    viewStateChanges: Stream<"Live" | "Paused">
  }>, {
    _tag: "CompletedPortalListboxBackdrop"
  }>, never, never>
}>

RestoreListboxInert

constsource
/** Removes the inert attribute from elements outside the listbox. */
const RestoreListboxInert: LayeredCommandDefinitionWithArgs<"Listbox/RestoreListboxInert", {
  id: String
}, {
  _tag: "CompletedRestoreListboxInert"
}> | DefinitionWithArgsNameKeyed<"Listbox/RestoreListboxInert", {
  id: String
}, Effect<{
  _tag: "CompletedRestoreListboxInert"
}, never, Handler<"Listbox/RestoreListboxInert", {
  id: string
}, {
  _tag: "CompletedRestoreListboxInert"
}>>> | DefinitionWithArgs<"Listbox/RestoreListboxInert", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedRestoreListboxInert"
}, never, Handler<"Listbox/RestoreListboxInert", {
  id: string
}, {
  _tag: "CompletedRestoreListboxInert"
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/RestoreListboxInert", {
    id: string
  }, {
    _tag: "CompletedRestoreListboxInert"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/RestoreListboxInert", {
    id: string
  }, {
    _tag: "CompletedRestoreListboxInert"
  }>
}>

ScrollListboxItemIntoView

constsource
/** Scrolls the active listbox item into view after keyboard navigation. */
const ScrollListboxItemIntoView: LayeredCommandDefinitionWithArgs<"Listbox/ScrollListboxItemIntoView", {
  id: String
  index: Number
}, {
  _tag: "CompletedScrollListboxItemIntoView"
}> | DefinitionWithArgsNameKeyed<"Listbox/ScrollListboxItemIntoView", {
  id: String
  index: Number
}, Effect<{
  _tag: "CompletedScrollListboxItemIntoView"
}, never, Handler<"Listbox/ScrollListboxItemIntoView", {
  id: string
  index: number
}, {
  _tag: "CompletedScrollListboxItemIntoView"
}>>> | DefinitionWithArgs<"Listbox/ScrollListboxItemIntoView", {
  id: String
  index: Number
}, Pick<{
  id: string
  index: number
}, "id" | "index">, Effect<{
  _tag: "CompletedScrollListboxItemIntoView"
}, never, Handler<"Listbox/ScrollListboxItemIntoView", {
  id: string
  index: number
}, {
  _tag: "CompletedScrollListboxItemIntoView"
}>>> & Readonly<{
  layer: Layer<Handler<"Listbox/ScrollListboxItemIntoView", {
    id: string
    index: number
  }, {
    _tag: "CompletedScrollListboxItemIntoView"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/ScrollListboxItemIntoView", {
    id: string
    index: number
  }, {
    _tag: "CompletedScrollListboxItemIntoView"
  }>
}>

UnlockListboxScroll

constsource
/** Re-enables page scrolling after the listbox closes. */
const UnlockListboxScroll: LayeredCommandDefinitionNoArgs<"Listbox/UnlockListboxScroll", {
  _tag: "CompletedUnlockListboxScroll"
}> | DefinitionNoArgs<"Listbox/UnlockListboxScroll", Effect<{
  _tag: "CompletedUnlockListboxScroll"
}, never, Handler<"Listbox/UnlockListboxScroll", void, {
  _tag: "CompletedUnlockListboxScroll"
}>>> & Readonly<{
  toLayer: ToLayer<"Listbox/UnlockListboxScroll", void, {
    _tag: "CompletedUnlockListboxScroll"
  }>
}> & Readonly<{
  layer: Layer<Handler<"Listbox/UnlockListboxScroll", void, {
    _tag: "CompletedUnlockListboxScroll"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Listbox/UnlockListboxScroll", void, {
    _tag: "CompletedUnlockListboxScroll"
  }>
}>