Documentation navigation

Published API · 0.1.0-rc.1

themes · components/select

Published themes API declarations for components/select.

./components/select

@wsagency/wseffect-themes · MIT · source · MIT license · WS-AGENCY-NOTICE

This entry point is published in @wsagency/wseffect-themes@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-themes/components/select'

Exported declarations

Bundle

export type Bundle<Value extends string> = Readonly<{
    Model: typeof Model;
    Message: typeof Message;
    OutMessage: typeof Listbox.OutMessage;
    init(config: Config<Value>): Model;
    update(model: Model, message: Message): Update.ReturnWithOutMessage<Model, Message, OutMessage<Value>>;
    view(model: Model, config: Config<Value>, h: HtmlBuilder<Message>): Html;
    fold<ParentModel, ParentMessage, ParentOutMessage>(config: Omit<Update.ChildFoldWithDerivedParentOutMessage<ParentModel, ParentMessage, Model, Message, Message, OutMessage<Value>, ParentOutMessage>, 'update'>): Update.FoldWithOutMessage<ParentModel, ParentMessage, Message, ParentOutMessage>;
    embed<ParentMessage>(h: HtmlBuilder<ParentMessage>, config: Readonly<{
        slotId: string;
        model: Model;
        toParentMessage(message: Message): ParentMessage;
        viewInputs: Config<Value>;
    }>): Html;
}>;

Config

export type Config<Value extends string> = PrimitiveConfig<Value> & Readonly<{
    props?: Props;
}>;

create

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

Group

export type Group<Value extends string> = SelectGroup<Value>;

Item

export type Item<Value extends string> = SelectItem<Value>;

Message

export type Message = SelectPrimitive.SelectMessage;

Message

Message: 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 Model = SelectPrimitive.SelectModel;

Model

Model: 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>;
}>

OutMessage

export type OutMessage<Value extends string> = Listbox.OutMessage<Value>;

Props

export type Props = typeof Props.Type;

Props

Props: Schema.Struct<{
    readonly size: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly string[]> | Schema.String, Schema.Struct<{
        [k: string]: Schema.optional<Schema.Literals<readonly string[]> | Schema.String>;
    }>]>>;
    readonly variant: Schema.optional<Schema.Literals<readonly ["classic", "surface", "soft", "ghost-offset", "ghost"]>>;
    readonly contentVariant: Schema.optional<Schema.Literals<readonly ["solid", "soft"]>>;
    readonly color: Schema.optional<Schema.Literals<readonly ["gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky", "custom"]>>;
    readonly radius: Schema.optional<Schema.Literals<readonly ["none", "small", "medium", "large", "full"]>>;
    readonly highContrast: Schema.optional<Schema.Boolean>;
    readonly placeholder: Schema.optional<Schema.String>;
}>

Separator

export type Separator = SelectSeparator;

Props

Props exported by @wsagency/wseffect-themes/components/select · Props · source
NameTypeRequiredChoicesDescription
size"1" | "2" | "3" | Responsive<"1" | "2" | "3">No——
variant"classic" | "surface" | "soft" | "ghost-offset" | "ghost"No"classic", "surface", "soft", "ghost-offset", "ghost"—
contentVariant"solid" | "soft"No"solid", "soft"—
color"gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky" | "custom"No"gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky", "custom"—
radius"none" | "small" | "medium" | "large" | "full"No"none", "small", "medium", "large", "full"—
highContrastbooleanNo——
placeholderstringNo——

Rendered component example

Select
Example usage
import * as Themes from '@wsagency/wseffect-themes'
import * as SliderRange from '@wsagency/wseffect-themes/components/slider/range'
import * as Option from 'effect/Option'
import { defineView } from '@wsagency/wseffect-foldkit/submodel'
import { inertHtml, type HtmlBuilder } from '@wsagency/wseffect-foldkit/html'

const example = (h: HtmlBuilder<unknown>) => (() => { const select = Themes.Select.create<'draft' | 'published'>(); const config: Themes.Select.Config<'draft' | 'published'> = { id: 'status-select-example', items: [{ value: 'draft', textValue: 'Draft', isDisabled: false, content: 'Draft' }, { value: 'published', textValue: 'Published', isDisabled: false, content: 'Published' }], selectedValue: Option.some<'draft' | 'published'>('published'), position: 'popper', isModal: false }; return select.embed(h, { slotId: config.id, model: select.init(config), toParentMessage: (message) => message, viewInputs: config }) })()