@typed/ui 1.0.0-beta.1 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +54 -10
- package/dist/Alert.d.ts +72 -0
- package/dist/Alert.d.ts.map +1 -0
- package/dist/Alert.js +40 -0
- package/dist/Button.d.ts +100 -0
- package/dist/Button.d.ts.map +1 -0
- package/dist/Button.js +42 -0
- package/dist/Carousel.d.ts +346 -0
- package/dist/Carousel.d.ts.map +1 -0
- package/dist/Carousel.js +264 -0
- package/dist/Checkbox.d.ts +168 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox.js +146 -0
- package/dist/Collection.d.ts +254 -0
- package/dist/Collection.d.ts.map +1 -0
- package/dist/Collection.js +218 -0
- package/dist/Combobox.d.ts +367 -0
- package/dist/Combobox.d.ts.map +1 -0
- package/dist/Combobox.js +300 -0
- package/dist/Composite.d.ts +823 -0
- package/dist/Composite.d.ts.map +1 -0
- package/dist/Composite.js +615 -0
- package/dist/Dialog.d.ts +544 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +357 -0
- package/dist/Disclosure.d.ts +219 -0
- package/dist/Disclosure.d.ts.map +1 -0
- package/dist/Disclosure.js +128 -0
- package/dist/Dom/Events.d.ts +122 -0
- package/dist/Dom/Events.d.ts.map +1 -0
- package/dist/Dom/Events.js +192 -0
- package/dist/Dom/Props.d.ts +161 -0
- package/dist/Dom/Props.d.ts.map +1 -0
- package/dist/Dom/Props.js +110 -0
- package/dist/Dom/Refs.d.ts +58 -0
- package/dist/Dom/Refs.d.ts.map +1 -0
- package/dist/Dom/Refs.js +61 -0
- package/dist/Dom/Render.d.ts +59 -0
- package/dist/Dom/Render.d.ts.map +1 -0
- package/dist/Dom/Render.js +71 -0
- package/dist/Dom/Types.d.ts +570 -0
- package/dist/Dom/Types.d.ts.map +1 -0
- package/dist/Dom/Types.js +1 -0
- package/dist/Dom/index.d.ts +20 -0
- package/dist/Dom/index.d.ts.map +1 -0
- package/dist/Dom/index.js +8 -0
- package/dist/Dom.d.ts +14 -0
- package/dist/Dom.d.ts.map +1 -0
- package/dist/Dom.js +13 -0
- package/dist/Focusable.d.ts +85 -0
- package/dist/Focusable.d.ts.map +1 -0
- package/dist/Focusable.js +35 -0
- package/dist/Form.d.ts +1727 -0
- package/dist/Form.d.ts.map +1 -0
- package/dist/Form.js +1142 -0
- package/dist/Grid.d.ts +388 -0
- package/dist/Grid.d.ts.map +1 -0
- package/dist/Grid.js +284 -0
- package/dist/Group.d.ts +128 -0
- package/dist/Group.d.ts.map +1 -0
- package/dist/Group.js +71 -0
- package/dist/Heading.d.ts +87 -0
- package/dist/Heading.d.ts.map +1 -0
- package/dist/Heading.js +58 -0
- package/dist/Hovercard.d.ts +297 -0
- package/dist/Hovercard.d.ts.map +1 -0
- package/dist/Hovercard.js +188 -0
- package/dist/HttpRouter.d.ts +129 -6
- package/dist/HttpRouter.d.ts.map +1 -1
- package/dist/HttpRouter.js +198 -55
- package/dist/Link.d.ts +63 -28
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +84 -37
- package/dist/Listbox.d.ts +305 -0
- package/dist/Listbox.d.ts.map +1 -0
- package/dist/Listbox.js +245 -0
- package/dist/Menu.d.ts +663 -0
- package/dist/Menu.d.ts.map +1 -0
- package/dist/Menu.js +569 -0
- package/dist/Menubar.d.ts +249 -0
- package/dist/Menubar.d.ts.map +1 -0
- package/dist/Menubar.js +207 -0
- package/dist/Meter.d.ts +157 -0
- package/dist/Meter.d.ts.map +1 -0
- package/dist/Meter.js +87 -0
- package/dist/NativeDetails.d.ts +41 -0
- package/dist/NativeDetails.d.ts.map +1 -0
- package/dist/NativeDetails.js +40 -0
- package/dist/NativeDialog.d.ts +66 -0
- package/dist/NativeDialog.d.ts.map +1 -0
- package/dist/NativeDialog.js +88 -0
- package/dist/NativePopover.d.ts +43 -0
- package/dist/NativePopover.d.ts.map +1 -0
- package/dist/NativePopover.js +84 -0
- package/dist/Popover.d.ts +240 -0
- package/dist/Popover.d.ts.map +1 -0
- package/dist/Popover.js +140 -0
- package/dist/RadioGroup.d.ts +330 -0
- package/dist/RadioGroup.d.ts.map +1 -0
- package/dist/RadioGroup.js +241 -0
- package/dist/Role.d.ts +64 -0
- package/dist/Role.d.ts.map +1 -0
- package/dist/Role.js +27 -0
- package/dist/Select.d.ts +418 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Select.js +357 -0
- package/dist/Separator.d.ts +58 -0
- package/dist/Separator.d.ts.map +1 -0
- package/dist/Separator.js +32 -0
- package/dist/Slider.d.ts +141 -0
- package/dist/Slider.d.ts.map +1 -0
- package/dist/Slider.js +101 -0
- package/dist/SpinButton.d.ts +141 -0
- package/dist/SpinButton.d.ts.map +1 -0
- package/dist/SpinButton.js +101 -0
- package/dist/Storybook.d.ts +76 -0
- package/dist/Storybook.d.ts.map +1 -0
- package/dist/Storybook.js +102 -0
- package/dist/Switch.d.ts +148 -0
- package/dist/Switch.d.ts.map +1 -0
- package/dist/Switch.js +110 -0
- package/dist/Tab.d.ts +26 -0
- package/dist/Tab.d.ts.map +1 -0
- package/dist/Tab.js +25 -0
- package/dist/Tabs.d.ts +411 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Tabs.js +262 -0
- package/dist/Toolbar.d.ts +248 -0
- package/dist/Toolbar.d.ts.map +1 -0
- package/dist/Toolbar.js +187 -0
- package/dist/Tooltip.d.ts +296 -0
- package/dist/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip.js +172 -0
- package/dist/Tree.d.ts +405 -0
- package/dist/Tree.d.ts.map +1 -0
- package/dist/Tree.js +333 -0
- package/dist/TreeGrid.d.ts +426 -0
- package/dist/TreeGrid.d.ts.map +1 -0
- package/dist/TreeGrid.js +308 -0
- package/dist/VisuallyHidden.d.ts +68 -0
- package/dist/VisuallyHidden.d.ts.map +1 -0
- package/dist/VisuallyHidden.js +44 -0
- package/dist/WindowSplitter.d.ts +336 -0
- package/dist/WindowSplitter.d.ts.map +1 -0
- package/dist/WindowSplitter.js +305 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -0
- package/package.json +48 -20
- package/src/HttpRouter.test.ts +0 -294
- package/src/HttpRouter.ts +0 -168
- package/src/Link.test.ts +0 -84
- package/src/Link.ts +0 -107
- package/src/index.ts +0 -2
package/dist/Select.d.ts
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A native popover-backed listbox with separate selection, focus, and visibility.
|
|
3
|
+
* Unlike Form.Select, these options are divs rather than native select options.
|
|
4
|
+
* Pass one collection to Content and its Options for registered keyboard navigation.
|
|
5
|
+
*
|
|
6
|
+
* Read the [Select guide](/explore/ui-select) for a complete example.
|
|
7
|
+
*
|
|
8
|
+
* [APG interaction reference](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/).
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
* @category Overview
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Scope from "effect/Scope";
|
|
15
|
+
import * as Schema from "effect/Schema";
|
|
16
|
+
import type { Fx } from "@typed/fx/Fx";
|
|
17
|
+
import { RefSubject } from "@typed/fx";
|
|
18
|
+
import { EventHandler, type Renderable, type RenderEvent, type RenderTemplate } from "@typed/template";
|
|
19
|
+
import * as Collection from "./Collection.js";
|
|
20
|
+
import * as Composite from "./Composite.js";
|
|
21
|
+
import * as Dom from "./Dom.js";
|
|
22
|
+
import type { HostResult } from "./Dom/Types.js";
|
|
23
|
+
/**
|
|
24
|
+
* Popup identity, committed value, visibility, and active option.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* value and activeId are independent: keyboard movement can change activeId before selection
|
|
28
|
+
* commits a value. Vertical real-focus navigation is fixed by makeState.
|
|
29
|
+
* @since 1.0.0
|
|
30
|
+
* @category State models
|
|
31
|
+
*/
|
|
32
|
+
export interface State extends Omit<Composite.State, "orientation"> {
|
|
33
|
+
/**
|
|
34
|
+
* Axis used to interpret Arrow-key movement.
|
|
35
|
+
* @since 1.0.0
|
|
36
|
+
* @category Keyboard navigation
|
|
37
|
+
*/
|
|
38
|
+
readonly orientation: "vertical";
|
|
39
|
+
/**
|
|
40
|
+
* Stable id used for collection identity and ARIA relationships.
|
|
41
|
+
* @since 1.0.0
|
|
42
|
+
* @category Identity and relationships
|
|
43
|
+
*/
|
|
44
|
+
readonly id: string;
|
|
45
|
+
/**
|
|
46
|
+
* Current semantic value selected or edited by the widget.
|
|
47
|
+
* @since 1.0.0
|
|
48
|
+
* @category Value state
|
|
49
|
+
*/
|
|
50
|
+
readonly value: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the associated native popover is open.
|
|
53
|
+
* @since 1.0.0
|
|
54
|
+
* @category Visibility
|
|
55
|
+
*/
|
|
56
|
+
readonly open: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Required popup ID with optional initial selection, visibility, focus, and wrap policy.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* value and activeId default to null, open to false, and loop to true. Use a stable
|
|
63
|
+
* document-unique ID so the native invoker relationship survives hydration.
|
|
64
|
+
* @since 1.0.0
|
|
65
|
+
* @category State models
|
|
66
|
+
*/
|
|
67
|
+
export interface InitialState {
|
|
68
|
+
/**
|
|
69
|
+
* Stable id used for collection identity and ARIA relationships.
|
|
70
|
+
* @since 1.0.0
|
|
71
|
+
* @category Identity and relationships
|
|
72
|
+
*/
|
|
73
|
+
readonly id: string;
|
|
74
|
+
/**
|
|
75
|
+
* Current semantic value selected or edited by the widget.
|
|
76
|
+
* @since 1.0.0
|
|
77
|
+
* @category Value state
|
|
78
|
+
*/
|
|
79
|
+
readonly value?: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the associated native popover is open.
|
|
82
|
+
* @since 1.0.0
|
|
83
|
+
* @category Visibility
|
|
84
|
+
*/
|
|
85
|
+
readonly open?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Id currently active for keyboard navigation; null means no active item.
|
|
88
|
+
* @since 1.0.0
|
|
89
|
+
* @category Keyboard focus
|
|
90
|
+
*/
|
|
91
|
+
readonly activeId?: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* Whether movement wraps between the first and last enabled items.
|
|
94
|
+
* @since 1.0.0
|
|
95
|
+
* @category Keyboard navigation
|
|
96
|
+
*/
|
|
97
|
+
readonly loop?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Effect Schema used by makeState to encode, decode, and hydrate Select state.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* A public schema makes hydration and serialized state use the same runtime validation as direct
|
|
104
|
+
* construction.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* import * as Schema from "effect/Schema";
|
|
109
|
+
* import * as Select from "@typed/ui/Select";
|
|
110
|
+
*
|
|
111
|
+
* const decodeState = Schema.decodeUnknownEffect(Select.StateSchema);
|
|
112
|
+
* ```
|
|
113
|
+
* @since 1.0.0
|
|
114
|
+
* @category Hydration schemas
|
|
115
|
+
*/
|
|
116
|
+
export declare const StateSchema: Schema.Struct<{
|
|
117
|
+
readonly id: Schema.String;
|
|
118
|
+
readonly value: Schema.NullOr<Schema.String>;
|
|
119
|
+
readonly open: Schema.Boolean;
|
|
120
|
+
readonly activeId: Schema.NullOr<Schema.String>;
|
|
121
|
+
readonly orientation: Schema.Literals<readonly ["vertical"]>;
|
|
122
|
+
readonly loop: Schema.Boolean;
|
|
123
|
+
readonly rtl: Schema.Boolean;
|
|
124
|
+
readonly virtualFocus: Schema.Boolean;
|
|
125
|
+
}>;
|
|
126
|
+
/**
|
|
127
|
+
* Creates hydrated Select state. The caller supplies id; value and activeId default null, open
|
|
128
|
+
* false, and loop true.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* State and collection ownership can be composed and tested independently from any renderer.
|
|
132
|
+
*
|
|
133
|
+
* The returned Effect creates the RefSubject when run. That state is renderer-independent;
|
|
134
|
+
* collection registrations belong to the separate Scope that runs register or ref, not to state
|
|
135
|
+
* creation.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* import * as Effect from "effect/Effect";
|
|
140
|
+
* import * as Select from "@typed/ui/Select";
|
|
141
|
+
*
|
|
142
|
+
* const program = Effect.scoped(
|
|
143
|
+
* Effect.gen(function* () {
|
|
144
|
+
* const state = yield* Select.makeState({ id: "timezone" });
|
|
145
|
+
* const collection = yield* Select.makeCollection();
|
|
146
|
+
* return { state: yield* state, collection: yield* collection };
|
|
147
|
+
* }),
|
|
148
|
+
* );
|
|
149
|
+
* ```
|
|
150
|
+
* @since 1.0.0
|
|
151
|
+
* @category State construction
|
|
152
|
+
*/
|
|
153
|
+
export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
|
|
154
|
+
readonly id: string;
|
|
155
|
+
readonly value: string | null;
|
|
156
|
+
readonly open: boolean;
|
|
157
|
+
readonly activeId: string | null;
|
|
158
|
+
readonly orientation: "vertical";
|
|
159
|
+
readonly loop: boolean;
|
|
160
|
+
readonly rtl: boolean;
|
|
161
|
+
readonly virtualFocus: boolean;
|
|
162
|
+
}, Schema.SchemaError, never, never>, never, Scope.Scope>;
|
|
163
|
+
/**
|
|
164
|
+
* Creates a scoped Collection for Select items.
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* State and collection ownership can be composed and tested independently from any renderer.
|
|
168
|
+
*
|
|
169
|
+
* The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
|
|
170
|
+
* owned by the Scope that runs register, independently of this construction Effect.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* import * as Effect from "effect/Effect";
|
|
175
|
+
* import * as Select from "@typed/ui/Select";
|
|
176
|
+
*
|
|
177
|
+
* const program = Effect.scoped(
|
|
178
|
+
* Effect.gen(function* () {
|
|
179
|
+
* const collection = yield* Select.makeCollection();
|
|
180
|
+
* return yield* collection;
|
|
181
|
+
* }),
|
|
182
|
+
* );
|
|
183
|
+
* ```
|
|
184
|
+
* @since 1.0.0
|
|
185
|
+
* @category State construction
|
|
186
|
+
*/
|
|
187
|
+
export declare const makeCollection: (initial?: Collection.State<string, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<string, Element>, never, never>, never, Scope.Scope>;
|
|
188
|
+
/**
|
|
189
|
+
* Commits an option ID and value, then marks the popup closed.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* This Effect changes state only. It does not check collection membership or move focus itself;
|
|
193
|
+
* the mounted popover observes the visibility change. Keep id and value consistent with the
|
|
194
|
+
* option being selected.
|
|
195
|
+
* @since 1.0.0
|
|
196
|
+
* @category State transitions
|
|
197
|
+
*/
|
|
198
|
+
export declare function select<E, R>(state: RefSubject.RefSubject<State, E, R>, id: string, value: string): Effect.Effect<State, E, R>;
|
|
199
|
+
/**
|
|
200
|
+
* Shared select state and the button content that names the current choice.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* The trigger derives its IDs and popover target from state.id. Content may be reactive; selecting
|
|
204
|
+
* a value does not automatically replace the label.
|
|
205
|
+
* @since 1.0.0
|
|
206
|
+
* @category Component options
|
|
207
|
+
*/
|
|
208
|
+
export interface TriggerOptions extends Dom.HostOptions<HTMLButtonElement> {
|
|
209
|
+
/**
|
|
210
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
211
|
+
* @since 1.0.0
|
|
212
|
+
* @category State connection
|
|
213
|
+
*/
|
|
214
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
215
|
+
/**
|
|
216
|
+
* Renderable child content for the component host.
|
|
217
|
+
* @since 1.0.0
|
|
218
|
+
* @category Rendered content
|
|
219
|
+
*/
|
|
220
|
+
readonly content: Renderable.Any;
|
|
221
|
+
}
|
|
222
|
+
declare function triggerProps<const Options extends TriggerOptions>(options: Options): () => {
|
|
223
|
+
readonly id: RefSubject.Computed<string, Schema.SchemaError, never>;
|
|
224
|
+
readonly type: "button";
|
|
225
|
+
readonly popovertarget: RefSubject.Computed<string, Schema.SchemaError, never>;
|
|
226
|
+
readonly popovertargetaction: "toggle";
|
|
227
|
+
readonly "aria-haspopup": "listbox";
|
|
228
|
+
readonly "aria-expanded": RefSubject.Computed<boolean, Schema.SchemaError, never>;
|
|
229
|
+
readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, never, never>;
|
|
230
|
+
readonly ref: import("./Dom/Refs.js").ComposedRef<RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>, (element: globalThis.Element) => Effect.Effect<void, never, Scope.Scope>> | undefined;
|
|
231
|
+
};
|
|
232
|
+
type TriggerProps<Options extends TriggerOptions> = ReturnType<ReturnType<typeof triggerProps<Options>>>;
|
|
233
|
+
/**
|
|
234
|
+
* Renders the native button that toggles the select listbox popover.
|
|
235
|
+
*
|
|
236
|
+
* @remarks
|
|
237
|
+
* The generated button ID labels Content; popovertarget points to state.id. ArrowDown invokes
|
|
238
|
+
* the native button click. Content synchronizes native toggle events with open state. Render a
|
|
239
|
+
* useful name containing the current choice; the trigger does not format selected values for
|
|
240
|
+
* you.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* import { RefSubject } from "@typed/fx";
|
|
245
|
+
* import { html } from "@typed/template";
|
|
246
|
+
* import { component } from "@typed/template";
|
|
247
|
+
* import * as Select from "@typed/ui/Select";
|
|
248
|
+
*
|
|
249
|
+
* export const DensityPicker = component(function* () {
|
|
250
|
+
* const state = yield* Select.makeState({ id: "density-options", value: "comfortable" });
|
|
251
|
+
* const collection = yield* Select.makeCollection();
|
|
252
|
+
* const label = RefSubject.map(state, ({ value }) =>
|
|
253
|
+
* value === "compact" ? "Density: compact" : "Density: comfortable",
|
|
254
|
+
* );
|
|
255
|
+
* return html`<div class="density-picker">
|
|
256
|
+
* ${Select.Trigger({ state, content: label })}
|
|
257
|
+
* ${Select.Content({
|
|
258
|
+
* state, collection,
|
|
259
|
+
* content: [
|
|
260
|
+
* Select.Option({
|
|
261
|
+
* state, collection, id: "density-comfortable", value: "comfortable",
|
|
262
|
+
* textValue: "Comfortable", content: "Comfortable",
|
|
263
|
+
* }),
|
|
264
|
+
* Select.Option({
|
|
265
|
+
* state, collection, id: "density-compact", value: "compact",
|
|
266
|
+
* textValue: "Compact", content: "Compact",
|
|
267
|
+
* }),
|
|
268
|
+
* ],
|
|
269
|
+
* })}
|
|
270
|
+
* </div>`;
|
|
271
|
+
* });
|
|
272
|
+
* ```
|
|
273
|
+
* @since 1.0.0
|
|
274
|
+
* @category Controls
|
|
275
|
+
*/
|
|
276
|
+
export declare function Trigger<const Options extends TriggerOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, TriggerProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
|
|
277
|
+
/**
|
|
278
|
+
* Alias of Trigger.
|
|
279
|
+
*
|
|
280
|
+
* @remarks
|
|
281
|
+
* Calling Select alone creates only the invoker button. Compose Content and Option for the popup
|
|
282
|
+
* choice surface; use Form.Select for a native select element.
|
|
283
|
+
* @since 1.0.0
|
|
284
|
+
* @category Controls
|
|
285
|
+
*/
|
|
286
|
+
export declare const Select: typeof Trigger;
|
|
287
|
+
/**
|
|
288
|
+
* Shared state, registered option collection, and listbox content.
|
|
289
|
+
*
|
|
290
|
+
* @remarks
|
|
291
|
+
* The collection is optional in the type but required for this host’s keyboard navigation and
|
|
292
|
+
* selected-item focus on opening. Render the same registered options represented by that
|
|
293
|
+
* collection.
|
|
294
|
+
* @since 1.0.0
|
|
295
|
+
* @category Component options
|
|
296
|
+
*/
|
|
297
|
+
export interface ContentOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
298
|
+
/**
|
|
299
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
300
|
+
* @since 1.0.0
|
|
301
|
+
* @category State connection
|
|
302
|
+
*/
|
|
303
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
304
|
+
/**
|
|
305
|
+
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
306
|
+
* @since 1.0.0
|
|
307
|
+
* @category Item registration
|
|
308
|
+
*/
|
|
309
|
+
readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
|
|
310
|
+
/**
|
|
311
|
+
* Renderable child content for the component host.
|
|
312
|
+
* @since 1.0.0
|
|
313
|
+
* @category Rendered content
|
|
314
|
+
*/
|
|
315
|
+
readonly content: Renderable.Any;
|
|
316
|
+
}
|
|
317
|
+
declare function contentProps<const Options extends ContentOptions>(options: Options): () => {
|
|
318
|
+
readonly id: RefSubject.Computed<string, Schema.SchemaError, never>;
|
|
319
|
+
readonly role: "listbox";
|
|
320
|
+
readonly "aria-labelledby": RefSubject.Computed<string, Schema.SchemaError, never>;
|
|
321
|
+
readonly popover: "manual";
|
|
322
|
+
readonly "aria-activedescendant": RefSubject.Computed<string | undefined, Schema.SchemaError, never>;
|
|
323
|
+
readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
|
|
324
|
+
readonly ontoggle: EventHandler.EventHandler<Event, Schema.SchemaError, never>;
|
|
325
|
+
readonly ref: import("./Dom/Refs.js").ComposedRef<RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>, (element: HTMLElement) => Effect.Effect<void, Schema.SchemaError, Scope.Scope>> | undefined;
|
|
326
|
+
};
|
|
327
|
+
type ContentProps<Options extends ContentOptions> = ReturnType<ReturnType<typeof contentProps<Options>>>;
|
|
328
|
+
/**
|
|
329
|
+
* Renders the manual-popover listbox and coordinates registered keyboard movement.
|
|
330
|
+
*
|
|
331
|
+
* @remarks
|
|
332
|
+
* With a collection, arrows and Home/End move focus, buffered typeahead locates options,
|
|
333
|
+
* Enter/Space commits the active choice, and Escape closes with invoker focus restoration.
|
|
334
|
+
* Opening focuses a registered option matching the selected value; an unmatched or null value
|
|
335
|
+
* does not choose the first option. Manual popover mode does not imply auto-mode outside-click
|
|
336
|
+
* dismissal.
|
|
337
|
+
* @since 1.0.0
|
|
338
|
+
* @category Controls
|
|
339
|
+
*/
|
|
340
|
+
export declare function Content<const Options extends ContentOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, ContentProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
|
|
341
|
+
/**
|
|
342
|
+
* Stable option identity, selection value, rendered content, and optional typeahead text.
|
|
343
|
+
*
|
|
344
|
+
* @remarks
|
|
345
|
+
* Share state and collection with Content. textValue should be the human-readable label when value
|
|
346
|
+
* is an internal code; disabled suppresses activation and participates in navigation.
|
|
347
|
+
* @since 1.0.0
|
|
348
|
+
* @category Component options
|
|
349
|
+
*/
|
|
350
|
+
export interface OptionOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
351
|
+
/**
|
|
352
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
353
|
+
* @since 1.0.0
|
|
354
|
+
* @category State connection
|
|
355
|
+
*/
|
|
356
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
357
|
+
/**
|
|
358
|
+
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
359
|
+
* @since 1.0.0
|
|
360
|
+
* @category Item registration
|
|
361
|
+
*/
|
|
362
|
+
readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
|
|
363
|
+
/**
|
|
364
|
+
* Stable id used for collection identity and ARIA relationships.
|
|
365
|
+
* @since 1.0.0
|
|
366
|
+
* @category Identity and relationships
|
|
367
|
+
*/
|
|
368
|
+
readonly id: string;
|
|
369
|
+
/**
|
|
370
|
+
* Current semantic value selected or edited by the widget.
|
|
371
|
+
* @since 1.0.0
|
|
372
|
+
* @category Value state
|
|
373
|
+
*/
|
|
374
|
+
readonly value: string;
|
|
375
|
+
/**
|
|
376
|
+
* Renderable child content for the component host.
|
|
377
|
+
* @since 1.0.0
|
|
378
|
+
* @category Rendered content
|
|
379
|
+
*/
|
|
380
|
+
readonly content: Renderable.Any;
|
|
381
|
+
/**
|
|
382
|
+
* Search text used by typeahead independently of rendered markup.
|
|
383
|
+
* @since 1.0.0
|
|
384
|
+
* @category Keyboard navigation
|
|
385
|
+
*/
|
|
386
|
+
readonly textValue?: string;
|
|
387
|
+
/**
|
|
388
|
+
* Flag used by collection movement and widget handlers to skip activation by default.
|
|
389
|
+
* @since 1.0.0
|
|
390
|
+
* @category Availability
|
|
391
|
+
*/
|
|
392
|
+
readonly disabled?: boolean;
|
|
393
|
+
}
|
|
394
|
+
declare function optionProps<const Options extends OptionOptions>(options: Options): () => {
|
|
395
|
+
readonly id: string;
|
|
396
|
+
readonly role: "option";
|
|
397
|
+
readonly "aria-selected": RefSubject.Computed<boolean, Schema.SchemaError, never>;
|
|
398
|
+
readonly "aria-disabled": boolean;
|
|
399
|
+
readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
|
|
400
|
+
readonly onclick: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
|
|
401
|
+
readonly onfocus: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
|
|
402
|
+
readonly ref: ((element: Element & HTMLDivElement & RefSubject.HydrationElement) => Effect.Effect<void, any, any>) | undefined;
|
|
403
|
+
};
|
|
404
|
+
type OptionProps<Options extends OptionOptions> = ReturnType<ReturnType<typeof optionProps<Options>>>;
|
|
405
|
+
/**
|
|
406
|
+
* Renders a selectable listbox option with distinct active and selected state.
|
|
407
|
+
*
|
|
408
|
+
* @remarks
|
|
409
|
+
* Click commits value and closes the popup; focus updates activeId without committing a new
|
|
410
|
+
* value. Register every option with the same collection used by Content for keyboard navigation.
|
|
411
|
+
* Supply textValue for readable typeahead when value is an internal code. This div is not a
|
|
412
|
+
* native form field.
|
|
413
|
+
* @since 1.0.0
|
|
414
|
+
* @category Controls
|
|
415
|
+
*/
|
|
416
|
+
export declare function Option<const Options extends OptionOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, OptionProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
|
|
417
|
+
export {};
|
|
418
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../src/Select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,YAAY,EAEZ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;;;;;;;GAQG;AACH,MAAM,WAAW,KAAM,SAAQ,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC;IACjE;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,UAAU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