Documentation navigation

Published API · 0.1.0-rc.1

foldkit-ui · listboxSelect

Published foldkit-ui API declarations for listboxSelect.

./listboxSelect

@wsagency/wseffect-foldkit-ui · MIT · source · MIT license · WS-AGENCY-NOTICE · THIRD-PARTY-NOTICES

This entry point is published in @wsagency/wseffect-foldkit-ui@0.1.0-rc.1. Import it from the package subpath shown below; the signatures and documentation are read from the installed package declarations.

import * as Wseffect from '@wsagency/wseffect-foldkit-ui/listboxSelect'

Exported declarations

Appearance

export type Appearance<Message> = Readonly<{
    triggerClassName?: string;
    contentClassName?: string;
    itemClassName?: string;
    groupClassName?: string;
    labelClassName?: string;
    separatorClassName?: string;
    itemsScrollClassName?: string;
    itemContentClassName?: string;
    itemIndicatorClassName?: string;
    itemIndicatorContent?: Html;
    itemTextClassName?: string;
    contentAttributes?: ReadonlyArray<Attribute<Message> | ChildAttribute>;
    separatorAttributes?: ReadonlyArray<Attribute<Message> | ChildAttribute>;
    triggerAttributes?: ReadonlyArray<Attribute<Message> | ChildAttribute>;
    triggerContent?: Html;
}>;

Bundle

export type Bundle<Value extends string> = Readonly<{
    init(config: Config<Value>): SelectModel;
    update(model: SelectModel, message: SelectMessage): Update.ReturnWithOutMessage<SelectModel, SelectMessage, Listbox.OutMessage<Value>>;
    selectItem(model: SelectModel, value: Value): Update.ReturnWithOutMessage<SelectModel, SelectMessage, Listbox.OutMessage<Value>>;
    open(model: SelectModel): Update.ReturnWithOutMessage<SelectModel, SelectMessage, Listbox.OutMessage<Value>>;
    close(model: SelectModel): Update.ReturnWithOutMessage<SelectModel, SelectMessage, Listbox.OutMessage<Value>>;
    view(model: SelectModel, config: Config<Value>, h: HtmlBuilder<SelectMessage>): Html;
}>;

Config

export type Config<Value extends string> = Readonly<{
    id: string;
    selectedValue: Option.Option<Value>;
    items: ReadonlyArray<SelectItem<Value> | SelectGroup<Value> | SelectSeparator>;
    position: 'popper' | 'item-aligned';
    isModal: false;
    appearance?: Appearance<Listbox.Message>;
}>;

createSelect

createSelect: <Value extends string>() => Bundle<Value>

Message

export type SelectMessage = Listbox.Message;

Message

SelectMessage: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
    readonly Opened: {
        maybeActiveItemIndex: import("effect/Schema").Option<import("effect/Schema").Number>;
    };
    readonly Closed: {};
    readonly BlurredItems: {};
    readonly ActivatedItem: {
        index: import("effect/Schema").Number;
        activationTrigger: import("effect/Schema").Literals<readonly ["Pointer", "Keyboard"]>;
    };
    readonly DeactivatedItem: {};
    readonly SelectedItem: {
        item: import("effect/Schema").String;
    };
    readonly MovedPointerOverItem: {
        index: import("effect/Schema").Number;
        screenX: import("effect/Schema").Number;
        screenY: import("effect/Schema").Number;
    };
    readonly RequestedItemClick: {
        index: import("effect/Schema").Number;
    };
    readonly Searched: {
        key: import("effect/Schema").String;
        maybeTargetIndex: import("effect/Schema").Option<import("effect/Schema").Number>;
    };
    readonly CompletedDelayClearSearch: {
        version: import("effect/Schema").Number;
    };
    readonly CompletedLockScroll: {};
    readonly CompletedUnlockScroll: {};
    readonly CompletedInertOthers: {};
    readonly CompletedRestoreInert: {};
    readonly CompletedFocusButton: {};
    readonly CompletedFocusItems: {};
    readonly CompletedScrollIntoView: {};
    readonly CompletedClickItem: {};
    readonly IgnoredMouseClick: {};
    readonly SuppressedSpaceScroll: {};
    readonly SuppressedItemCommit: {};
    readonly CompletedAnchorListbox: {};
    readonly CompletedPortalListboxBackdrop: {};
    readonly GotAnimationMessage: {
        message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
            readonly Showed: {};
            readonly Hid: {};
            readonly CompletedWaitForPaint: {
                generation: import("effect/Schema").Number;
            };
            readonly EndedAnimation: {
                generation: import("effect/Schema").Number;
            };
        }>;
    };
    readonly PressedPointerOnButton: {
        pointerType: import("effect/Schema").String;
        button: import("effect/Schema").Number;
    };
}>

Model

export type SelectModel = Listbox.Model;

Model

SelectModel: import("effect/Schema").Struct<{
    readonly id: import("effect/Schema").String;
    readonly isOpen: import("effect/Schema").Boolean;
    readonly isAnimated: import("effect/Schema").Boolean;
    readonly isModal: import("effect/Schema").Boolean;
    readonly orientation: import("effect/Schema").Literals<readonly ["Vertical", "Horizontal"]>;
    readonly animation: import("effect/Schema").Struct<{
        readonly id: import("effect/Schema").String;
        readonly isShowing: import("effect/Schema").Boolean;
        readonly transitionState: import("effect/Schema").Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
        readonly transitionGeneration: import("effect/Schema").Number;
    }>;
    readonly maybeActiveItemIndex: import("effect/Schema").Option<import("effect/Schema").Number>;
    readonly activationTrigger: import("effect/Schema").Literals<readonly ["Pointer", "Keyboard"]>;
    readonly searchQuery: import("effect/Schema").String;
    readonly searchVersion: import("effect/Schema").Number;
    readonly maybeLastPointerPosition: import("effect/Schema").Option<import("effect/Schema").Struct<{
        readonly screenX: import("effect/Schema").Number;
        readonly screenY: import("effect/Schema").Number;
    }>>;
    readonly maybeLastButtonPointerType: import("effect/Schema").Option<import("effect/Schema").String>;
    readonly anchorMode: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").Literals<readonly ["Trigger", "SelectedOrActiveItem"]>, never>;
}>

SelectGroup

export type SelectGroup<Value extends string> = Readonly<{
    id: string;
    label: Html;
    items: ReadonlyArray<SelectItem<Value> | SelectSeparator>;
}>;

SelectItem

export type SelectItem<Value extends string> = Readonly<{
    value: Value;
    textValue: string;
    isDisabled: boolean;
    content: Html | string;
}>;

SelectMessage

export type SelectMessage = Listbox.Message;

SelectMessage

SelectMessage: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
    readonly Opened: {
        maybeActiveItemIndex: import("effect/Schema").Option<import("effect/Schema").Number>;
    };
    readonly Closed: {};
    readonly BlurredItems: {};
    readonly ActivatedItem: {
        index: import("effect/Schema").Number;
        activationTrigger: import("effect/Schema").Literals<readonly ["Pointer", "Keyboard"]>;
    };
    readonly DeactivatedItem: {};
    readonly SelectedItem: {
        item: import("effect/Schema").String;
    };
    readonly MovedPointerOverItem: {
        index: import("effect/Schema").Number;
        screenX: import("effect/Schema").Number;
        screenY: import("effect/Schema").Number;
    };
    readonly RequestedItemClick: {
        index: import("effect/Schema").Number;
    };
    readonly Searched: {
        key: import("effect/Schema").String;
        maybeTargetIndex: import("effect/Schema").Option<import("effect/Schema").Number>;
    };
    readonly CompletedDelayClearSearch: {
        version: import("effect/Schema").Number;
    };
    readonly CompletedLockScroll: {};
    readonly CompletedUnlockScroll: {};
    readonly CompletedInertOthers: {};
    readonly CompletedRestoreInert: {};
    readonly CompletedFocusButton: {};
    readonly CompletedFocusItems: {};
    readonly CompletedScrollIntoView: {};
    readonly CompletedClickItem: {};
    readonly IgnoredMouseClick: {};
    readonly SuppressedSpaceScroll: {};
    readonly SuppressedItemCommit: {};
    readonly CompletedAnchorListbox: {};
    readonly CompletedPortalListboxBackdrop: {};
    readonly GotAnimationMessage: {
        message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
            readonly Showed: {};
            readonly Hid: {};
            readonly CompletedWaitForPaint: {
                generation: import("effect/Schema").Number;
            };
            readonly EndedAnimation: {
                generation: import("effect/Schema").Number;
            };
        }>;
    };
    readonly PressedPointerOnButton: {
        pointerType: import("effect/Schema").String;
        button: import("effect/Schema").Number;
    };
}>

SelectModel

export type SelectModel = Listbox.Model;

SelectModel

SelectModel: import("effect/Schema").Struct<{
    readonly id: import("effect/Schema").String;
    readonly isOpen: import("effect/Schema").Boolean;
    readonly isAnimated: import("effect/Schema").Boolean;
    readonly isModal: import("effect/Schema").Boolean;
    readonly orientation: import("effect/Schema").Literals<readonly ["Vertical", "Horizontal"]>;
    readonly animation: import("effect/Schema").Struct<{
        readonly id: import("effect/Schema").String;
        readonly isShowing: import("effect/Schema").Boolean;
        readonly transitionState: import("effect/Schema").Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
        readonly transitionGeneration: import("effect/Schema").Number;
    }>;
    readonly maybeActiveItemIndex: import("effect/Schema").Option<import("effect/Schema").Number>;
    readonly activationTrigger: import("effect/Schema").Literals<readonly ["Pointer", "Keyboard"]>;
    readonly searchQuery: import("effect/Schema").String;
    readonly searchVersion: import("effect/Schema").Number;
    readonly maybeLastPointerPosition: import("effect/Schema").Option<import("effect/Schema").Struct<{
        readonly screenX: import("effect/Schema").Number;
        readonly screenY: import("effect/Schema").Number;
    }>>;
    readonly maybeLastButtonPointerType: import("effect/Schema").Option<import("effect/Schema").String>;
    readonly anchorMode: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").Literals<readonly ["Trigger", "SelectedOrActiveItem"]>, never>;
}>

SelectOption

export type SelectOption<Value extends string> = Readonly<{
    value: Value;
    label: Html;
}>;

SelectSeparator

export type SelectSeparator = Readonly<{
    kind: 'separator';
    id: string;
}>;