@typed/ui 1.0.0-beta.6 → 1.0.0-beta.8
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 +1 -1
- package/dist/Alert.d.ts +35 -41
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +23 -20
- package/dist/Button.d.ts +34 -78
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +16 -12
- package/dist/Carousel.d.ts +35 -236
- package/dist/Carousel.d.ts.map +1 -1
- package/dist/Carousel.js +13 -136
- package/dist/Checkbox.d.ts +55 -90
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +44 -38
- package/dist/Collection.d.ts +15 -15
- package/dist/Collection.js +7 -7
- package/dist/Combobox.d.ts +38 -187
- package/dist/Combobox.d.ts.map +1 -1
- package/dist/Combobox.js +9 -80
- package/dist/Component.d.ts +30 -24
- package/dist/Component.d.ts.map +1 -1
- package/dist/Component.js +23 -12
- package/dist/Composite.d.ts +50 -50
- package/dist/Composite.js +20 -20
- package/dist/Dialog.d.ts +34 -34
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +16 -14
- package/dist/Disclosure.d.ts +15 -15
- package/dist/Disclosure.js +6 -6
- package/dist/Dom/Events.d.ts +4 -4
- package/dist/Dom/Events.js +4 -4
- package/dist/Dom/Props.d.ts +9 -9
- package/dist/Dom/Props.js +4 -4
- package/dist/Dom/Refs.d.ts +2 -2
- package/dist/Dom/Refs.js +1 -1
- package/dist/Dom/Render.d.ts +2 -2
- package/dist/Dom/Render.js +2 -2
- package/dist/Dom/Types.d.ts +33 -33
- package/dist/Dom/index.d.ts +5 -5
- package/dist/Dom/index.d.ts.map +1 -1
- package/dist/Dom/index.js +4 -4
- package/dist/Dom.d.ts +1 -1
- package/dist/Dom.js +1 -1
- package/dist/Focusable.d.ts +5 -5
- package/dist/Focusable.js +1 -1
- package/dist/Form.d.ts +565 -533
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +350 -195
- package/dist/Grid.d.ts +39 -220
- package/dist/Grid.d.ts.map +1 -1
- package/dist/Grid.js +12 -107
- package/dist/Group.d.ts +50 -69
- package/dist/Group.d.ts.map +1 -1
- package/dist/Group.js +33 -25
- package/dist/Heading.d.ts +41 -40
- package/dist/Heading.d.ts.map +1 -1
- package/dist/Heading.js +26 -16
- package/dist/Hovercard.d.ts +18 -18
- package/dist/Hovercard.js +6 -6
- package/dist/HttpRouter.d.ts +3 -3
- package/dist/HttpRouter.js +5 -5
- package/dist/Link.d.ts +17 -21
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +11 -0
- package/dist/Listbox.d.ts +31 -163
- package/dist/Listbox.d.ts.map +1 -1
- package/dist/Listbox.js +9 -80
- package/dist/Menu.d.ts +67 -376
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +17 -179
- package/dist/Menubar.d.ts +24 -142
- package/dist/Menubar.d.ts.map +1 -1
- package/dist/Menubar.js +8 -66
- package/dist/Meter.d.ts +72 -132
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +35 -42
- package/dist/NativeDetails.d.ts +1 -1
- package/dist/NativeDetails.js +1 -1
- package/dist/NativeDialog.d.ts +7 -5
- package/dist/NativeDialog.d.ts.map +1 -1
- package/dist/NativeDialog.js +42 -4
- package/dist/NativePopover.d.ts +6 -4
- package/dist/NativePopover.d.ts.map +1 -1
- package/dist/NativePopover.js +43 -5
- package/dist/Popover.d.ts +18 -19
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +7 -8
- package/dist/RadioGroup.d.ts +86 -188
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +55 -105
- package/dist/Role.d.ts +4 -4
- package/dist/Role.js +1 -1
- package/dist/Select.d.ts +109 -220
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +67 -117
- package/dist/Separator.d.ts +30 -26
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +16 -10
- package/dist/Slider.d.ts +64 -111
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +47 -42
- package/dist/SpinButton.d.ts +64 -111
- package/dist/SpinButton.d.ts.map +1 -1
- package/dist/SpinButton.js +47 -42
- package/dist/Storybook.d.ts +2 -2
- package/dist/Storybook.js +1 -1
- package/dist/Switch.d.ts +52 -91
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +30 -36
- package/dist/Tabs.d.ts +44 -224
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +10 -94
- package/dist/Toolbar.d.ts +24 -142
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +8 -66
- package/dist/Tooltip.d.ts +20 -20
- package/dist/Tooltip.js +6 -6
- package/dist/Tree.d.ts +43 -229
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +12 -113
- package/dist/TreeGrid.d.ts +45 -264
- package/dist/TreeGrid.d.ts.map +1 -1
- package/dist/TreeGrid.js +13 -125
- package/dist/VisuallyHidden.d.ts +41 -27
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +27 -10
- package/dist/WindowSplitter.d.ts +68 -108
- package/dist/WindowSplitter.d.ts.map +1 -1
- package/dist/WindowSplitter.js +106 -23
- package/package.json +13 -12
package/dist/Listbox.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* the state and pure operations without mounting UI, or supply custom hosts without replacing native
|
|
9
9
|
* events and browser-owned focus.
|
|
10
10
|
*
|
|
11
|
+
* Learn the interaction in the [Listbox guide](/explore/ui-listbox).
|
|
12
|
+
*
|
|
11
13
|
* @since 1.0.0
|
|
12
14
|
* @category modules
|
|
13
15
|
* @packageDocumentation
|
|
@@ -23,37 +25,23 @@ import * as Composite from "./Composite.js";
|
|
|
23
25
|
import * as Dom from "./Dom.js";
|
|
24
26
|
import type { HostResult } from "./Dom/Types.js";
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @remarks
|
|
29
|
-
* ## Why
|
|
30
|
-
*
|
|
31
|
-
* Applications can inspect, update, and test Listbox behavior without mounting or coupling the
|
|
32
|
-
* state to a renderer.
|
|
33
|
-
*
|
|
34
|
-
* ## Ownership and lifetime
|
|
35
|
-
*
|
|
36
|
-
* This declaration is data or schema metadata and acquires no resources.
|
|
37
|
-
*
|
|
38
|
-
* ## Example
|
|
28
|
+
* The committed single value and the option currently owning keyboard focus.
|
|
29
|
+
* Normal option focus and movement update both values; the DOM ID and saved value may differ.
|
|
39
30
|
*
|
|
40
|
-
* Import with `import type { State } from "@typed/ui/Listbox";` Extend the [Listbox.makeState
|
|
41
|
-
* runnable setup](/reference/%40typed%2Fui%2FListbox%23makeState). Inside the linked program,
|
|
42
|
-
* `const snapshot: State = yield* state` exposes selection and active-option focus separately.
|
|
43
31
|
* @since 1.0.0
|
|
44
|
-
* @category
|
|
32
|
+
* @category Selection and focus
|
|
45
33
|
*/
|
|
46
34
|
export interface State extends Omit<Composite.State, "orientation"> {
|
|
47
35
|
/**
|
|
48
36
|
* Axis used to interpret Arrow-key movement.
|
|
49
37
|
* @since 1.0.0
|
|
50
|
-
* @category
|
|
38
|
+
* @category Keyboard navigation
|
|
51
39
|
*/
|
|
52
40
|
readonly orientation: "vertical";
|
|
53
41
|
/**
|
|
54
42
|
* Current semantic value selected or edited by the widget.
|
|
55
43
|
* @since 1.0.0
|
|
56
|
-
* @category
|
|
44
|
+
* @category Current value
|
|
57
45
|
*/
|
|
58
46
|
readonly value: string | null;
|
|
59
47
|
}
|
|
@@ -61,42 +49,26 @@ export interface State extends Omit<Composite.State, "orientation"> {
|
|
|
61
49
|
* Initial Listbox values. value and activeId default to null, loop defaults to true, and roving
|
|
62
50
|
* focus is used.
|
|
63
51
|
*
|
|
64
|
-
* @remarks
|
|
65
|
-
* ## Why
|
|
66
|
-
*
|
|
67
|
-
* Making initialization explicit documents hydration-sensitive defaults and lets servers and
|
|
68
|
-
* clients construct matching state.
|
|
69
|
-
*
|
|
70
|
-
* ## Ownership and lifetime
|
|
71
|
-
*
|
|
72
|
-
* This declaration is data or schema metadata and acquires no resources.
|
|
73
|
-
*
|
|
74
|
-
* ## Example
|
|
75
|
-
*
|
|
76
|
-
* Import with `import type { InitialState } from "@typed/ui/Listbox";` Extend the
|
|
77
|
-
* [Listbox.makeState runnable setup](/reference/%40typed%2Fui%2FListbox%23makeState). Construct an
|
|
78
|
-
* empty selection with
|
|
79
|
-
* `const initial: InitialState = { value: null, activeId: null }; const state = yield* Listbox.makeState(initial)`.
|
|
80
52
|
* @since 1.0.0
|
|
81
|
-
* @category
|
|
53
|
+
* @category Selection and focus
|
|
82
54
|
*/
|
|
83
55
|
export interface InitialState {
|
|
84
56
|
/**
|
|
85
57
|
* Current semantic value selected or edited by the widget.
|
|
86
58
|
* @since 1.0.0
|
|
87
|
-
* @category
|
|
59
|
+
* @category Current value
|
|
88
60
|
*/
|
|
89
61
|
readonly value?: string | null;
|
|
90
62
|
/**
|
|
91
63
|
* Id currently active for keyboard navigation; null means no active item.
|
|
92
64
|
* @since 1.0.0
|
|
93
|
-
* @category
|
|
65
|
+
* @category Keyboard focus
|
|
94
66
|
*/
|
|
95
67
|
readonly activeId?: string | null;
|
|
96
68
|
/**
|
|
97
69
|
* Whether movement wraps between the first and last enabled items.
|
|
98
70
|
* @since 1.0.0
|
|
99
|
-
* @category
|
|
71
|
+
* @category Keyboard navigation
|
|
100
72
|
*/
|
|
101
73
|
readonly loop?: boolean;
|
|
102
74
|
}
|
|
@@ -104,15 +76,6 @@ export interface InitialState {
|
|
|
104
76
|
* Effect Schema used by makeState to encode, decode, and hydrate Listbox state.
|
|
105
77
|
*
|
|
106
78
|
* @remarks
|
|
107
|
-
* ## Why
|
|
108
|
-
*
|
|
109
|
-
* A public schema makes hydration and serialized state use the same runtime validation as direct
|
|
110
|
-
* construction.
|
|
111
|
-
*
|
|
112
|
-
* ## Ownership and lifetime
|
|
113
|
-
*
|
|
114
|
-
* This declaration is data or schema metadata and acquires no resources.
|
|
115
|
-
*
|
|
116
79
|
* @example
|
|
117
80
|
* ```ts
|
|
118
81
|
* import * as Schema from "effect/Schema";
|
|
@@ -121,7 +84,7 @@ export interface InitialState {
|
|
|
121
84
|
* const decodeState = Schema.decodeUnknownEffect(Listbox.StateSchema);
|
|
122
85
|
* ```
|
|
123
86
|
* @since 1.0.0
|
|
124
|
-
* @category
|
|
87
|
+
* @category Selection and focus
|
|
125
88
|
*/
|
|
126
89
|
export declare const StateSchema: Schema.Struct<{
|
|
127
90
|
readonly value: Schema.NullOr<Schema.String>;
|
|
@@ -136,12 +99,6 @@ export declare const StateSchema: Schema.Struct<{
|
|
|
136
99
|
* roving focus is used.
|
|
137
100
|
*
|
|
138
101
|
* @remarks
|
|
139
|
-
* ## Why
|
|
140
|
-
*
|
|
141
|
-
* State and collection ownership can be composed and tested independently from any renderer.
|
|
142
|
-
*
|
|
143
|
-
* ## Ownership and lifetime
|
|
144
|
-
*
|
|
145
102
|
* The returned Effect creates the RefSubject when run. That state is renderer-independent;
|
|
146
103
|
* collection registrations belong to the separate Scope that runs register or ref, not to state
|
|
147
104
|
* creation.
|
|
@@ -160,7 +117,7 @@ export declare const StateSchema: Schema.Struct<{
|
|
|
160
117
|
* );
|
|
161
118
|
* ```
|
|
162
119
|
* @since 1.0.0
|
|
163
|
-
* @category
|
|
120
|
+
* @category Selection and focus
|
|
164
121
|
*/
|
|
165
122
|
export declare function makeState(initial?: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
|
|
166
123
|
readonly value: string | null;
|
|
@@ -174,12 +131,6 @@ export declare function makeState(initial?: InitialState): Effect.Effect<RefSubj
|
|
|
174
131
|
* Creates a scoped Collection for Listbox items.
|
|
175
132
|
*
|
|
176
133
|
* @remarks
|
|
177
|
-
* ## Why
|
|
178
|
-
*
|
|
179
|
-
* State and collection ownership can be composed and tested independently from any renderer.
|
|
180
|
-
*
|
|
181
|
-
* ## Ownership and lifetime
|
|
182
|
-
*
|
|
183
134
|
* The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
|
|
184
135
|
* owned by the Scope that runs register, independently of this construction Effect.
|
|
185
136
|
*
|
|
@@ -196,31 +147,18 @@ export declare function makeState(initial?: InitialState): Effect.Effect<RefSubj
|
|
|
196
147
|
* );
|
|
197
148
|
* ```
|
|
198
149
|
* @since 1.0.0
|
|
199
|
-
* @category
|
|
150
|
+
* @category Option registration
|
|
200
151
|
*/
|
|
201
152
|
export declare const makeCollection: (initial?: Collection.State<string, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<string, Element>, never, never>, never, Scope.Scope>;
|
|
202
153
|
/**
|
|
203
154
|
* Sets both activeId and selected value in one update.
|
|
204
155
|
*
|
|
205
156
|
* @remarks
|
|
206
|
-
* ## Why
|
|
207
|
-
*
|
|
208
157
|
* The operation exposes Listbox's transition directly so callers can compose it in Effect programs
|
|
209
158
|
* and native event handlers.
|
|
210
159
|
*
|
|
211
|
-
* ## Ownership and lifetime
|
|
212
|
-
*
|
|
213
|
-
* The returned Effect performs the update or DOM side effect only when run, preserves the declared
|
|
214
|
-
* error and service channels, and retains no resources after completion.
|
|
215
|
-
*
|
|
216
|
-
* ## Example
|
|
217
|
-
*
|
|
218
|
-
* Import with `import { select } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
219
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Inside the linked Effect program invoke
|
|
220
|
-
* `yield* select(state, "nyc", "New York")`, then read state to observe selection and active focus
|
|
221
|
-
* update together.
|
|
222
160
|
* @since 1.0.0
|
|
223
|
-
* @category
|
|
161
|
+
* @category Selection and focus
|
|
224
162
|
*/
|
|
225
163
|
export declare function select<E, R>(state: RefSubject.RefSubject<State, E, R>, id: string, value: string): Effect.Effect<State, E, R>;
|
|
226
164
|
/**
|
|
@@ -228,70 +166,42 @@ export declare function select<E, R>(state: RefSubject.RefSubject<State, E, R>,
|
|
|
228
166
|
* and scrolls the active option.
|
|
229
167
|
*
|
|
230
168
|
* @remarks
|
|
231
|
-
* ## Why
|
|
232
|
-
*
|
|
233
169
|
* The operation exposes Listbox's transition directly so callers can compose it in Effect programs
|
|
234
170
|
* and native event handlers.
|
|
235
171
|
*
|
|
236
|
-
* ## Ownership and lifetime
|
|
237
|
-
*
|
|
238
|
-
* The returned Effect performs the update or DOM side effect only when run, preserves the declared
|
|
239
|
-
* error and service channels, and retains no resources after completion.
|
|
240
|
-
*
|
|
241
|
-
* ## Example
|
|
242
|
-
*
|
|
243
|
-
* Import with `import { move } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
244
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Inside the linked Effect program invoke
|
|
245
|
-
* `yield* move(state, collection, "next")`, then read the state snapshot to observe the transition
|
|
246
|
-
* described above.
|
|
247
172
|
* @since 1.0.0
|
|
248
|
-
* @category
|
|
173
|
+
* @category Selection and focus
|
|
249
174
|
*/
|
|
250
175
|
export declare function move(state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>, collection: RefSubject.RefSubject<Collection.State<string>>, direction: Composite.Move): Effect.Effect<State, Schema.SchemaError>;
|
|
251
176
|
/**
|
|
252
177
|
* Inputs accepted by Listbox.Root in addition to the shared DOM host options.
|
|
253
178
|
*
|
|
254
|
-
* @remarks
|
|
255
|
-
* ## Why
|
|
256
|
-
*
|
|
257
|
-
* The options type makes required state, content, accessible relationships, and custom-host inputs
|
|
258
|
-
* visible before rendering.
|
|
259
|
-
*
|
|
260
|
-
* ## Ownership and lifetime
|
|
261
|
-
*
|
|
262
|
-
* This declaration is data or schema metadata and acquires no resources.
|
|
263
|
-
*
|
|
264
|
-
* ## Example
|
|
265
|
-
*
|
|
266
|
-
* Import with `import type { RootOptions } from "@typed/ui/Listbox";` Extend the [Listbox.makeState
|
|
267
|
-
* runnable setup](/reference/%40typed%2Fui%2FListbox%23makeState). Enable collection-driven focus
|
|
268
|
-
* with `const options: RootOptions = { state, collection, label: "City", content: "Options" }`.
|
|
269
179
|
* @since 1.0.0
|
|
270
|
-
* @category
|
|
180
|
+
* @category Listbox surface
|
|
271
181
|
*/
|
|
272
182
|
export interface RootOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
273
183
|
/**
|
|
274
184
|
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
275
185
|
* @since 1.0.0
|
|
276
|
-
* @category
|
|
186
|
+
* @category State connection
|
|
277
187
|
*/
|
|
278
188
|
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
279
189
|
/**
|
|
280
190
|
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
281
191
|
* @since 1.0.0
|
|
282
|
-
* @category
|
|
192
|
+
* @category Item registration
|
|
283
193
|
*/
|
|
284
194
|
readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
|
|
285
195
|
/**
|
|
286
196
|
* Renderable child content for the component host.
|
|
287
197
|
* @since 1.0.0
|
|
288
|
-
* @category
|
|
198
|
+
* @category Rendered content
|
|
289
199
|
*/
|
|
290
200
|
readonly content: Renderable.Any;
|
|
291
201
|
/**
|
|
292
202
|
* Accessible label rendered through aria-label.
|
|
293
203
|
* @since 1.0.0
|
|
294
|
-
* @category
|
|
204
|
+
* @category Accessible naming
|
|
295
205
|
*/
|
|
296
206
|
readonly label?: Renderable.Any<string | null | undefined>;
|
|
297
207
|
}
|
|
@@ -310,90 +220,61 @@ type RootProps<Options extends RootOptions> = ReturnType<ReturnType<typeof rootP
|
|
|
310
220
|
* typeahead in DOM order.
|
|
311
221
|
*
|
|
312
222
|
* @remarks
|
|
313
|
-
* ## Why
|
|
314
|
-
*
|
|
315
|
-
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
316
|
-
* through the shared DOM boundary.
|
|
317
|
-
*
|
|
318
|
-
* ## Ownership and lifetime
|
|
319
|
-
*
|
|
320
223
|
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
321
224
|
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
322
225
|
* unrelated nodes and attributes remain caller-owned.
|
|
323
226
|
*
|
|
324
|
-
* ## Example
|
|
325
|
-
*
|
|
326
|
-
* Import with `import { Root } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
327
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Replace the linked program's final
|
|
328
|
-
* snapshot read with `Root({ state, label: "City", content: "Options" })`; render that Fx before
|
|
329
|
-
* the same Scope closes.
|
|
330
227
|
* @since 1.0.0
|
|
331
|
-
* @category
|
|
228
|
+
* @category Listbox surface
|
|
332
229
|
*/
|
|
333
230
|
export declare function Root<const Options extends RootOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, RootProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
|
|
334
231
|
/**
|
|
335
232
|
* Inputs accepted by Listbox.Option in addition to the shared DOM host options.
|
|
336
233
|
*
|
|
337
|
-
* @remarks
|
|
338
|
-
* ## Why
|
|
339
|
-
*
|
|
340
|
-
* The options type makes required state, content, accessible relationships, and custom-host inputs
|
|
341
|
-
* visible before rendering.
|
|
342
|
-
*
|
|
343
|
-
* ## Ownership and lifetime
|
|
344
|
-
*
|
|
345
|
-
* This declaration is data or schema metadata and acquires no resources.
|
|
346
|
-
*
|
|
347
|
-
* ## Example
|
|
348
|
-
*
|
|
349
|
-
* Import with `import type { OptionOptions } from "@typed/ui/Listbox";` Extend the
|
|
350
|
-
* [Listbox.makeState runnable setup](/reference/%40typed%2Fui%2FListbox%23makeState). A selectable
|
|
351
|
-
* option is
|
|
352
|
-
* `const options: OptionOptions = { state, collection, id: "nyc", value: "New York", content: "New York" }`.
|
|
353
234
|
* @since 1.0.0
|
|
354
|
-
* @category
|
|
235
|
+
* @category Selectable options
|
|
355
236
|
*/
|
|
356
237
|
export interface OptionOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
357
238
|
/**
|
|
358
239
|
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
359
240
|
* @since 1.0.0
|
|
360
|
-
* @category
|
|
241
|
+
* @category State connection
|
|
361
242
|
*/
|
|
362
243
|
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
363
244
|
/**
|
|
364
245
|
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
365
246
|
* @since 1.0.0
|
|
366
|
-
* @category
|
|
247
|
+
* @category Item registration
|
|
367
248
|
*/
|
|
368
249
|
readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
|
|
369
250
|
/**
|
|
370
251
|
* Stable id used for collection identity and ARIA relationships.
|
|
371
252
|
* @since 1.0.0
|
|
372
|
-
* @category
|
|
253
|
+
* @category Identity and relationships
|
|
373
254
|
*/
|
|
374
255
|
readonly id: string;
|
|
375
256
|
/**
|
|
376
257
|
* Current semantic value selected or edited by the widget.
|
|
377
258
|
* @since 1.0.0
|
|
378
|
-
* @category
|
|
259
|
+
* @category Current value
|
|
379
260
|
*/
|
|
380
261
|
readonly value: string;
|
|
381
262
|
/**
|
|
382
263
|
* Renderable child content for the component host.
|
|
383
264
|
* @since 1.0.0
|
|
384
|
-
* @category
|
|
265
|
+
* @category Rendered content
|
|
385
266
|
*/
|
|
386
267
|
readonly content: Renderable.Any;
|
|
387
268
|
/**
|
|
388
269
|
* Search text used by typeahead independently of rendered markup.
|
|
389
270
|
* @since 1.0.0
|
|
390
|
-
* @category
|
|
271
|
+
* @category Text matching
|
|
391
272
|
*/
|
|
392
273
|
readonly textValue?: string;
|
|
393
274
|
/**
|
|
394
275
|
* Flag used by collection movement and widget handlers to skip activation by default.
|
|
395
276
|
* @since 1.0.0
|
|
396
|
-
* @category
|
|
277
|
+
* @category Availability
|
|
397
278
|
*/
|
|
398
279
|
readonly disabled?: boolean;
|
|
399
280
|
}
|
|
@@ -412,25 +293,12 @@ type OptionProps<Options extends OptionOptions> = ReturnType<ReturnType<typeof o
|
|
|
412
293
|
* Renders and optionally registers an option; focus or click selects it unless disabled.
|
|
413
294
|
*
|
|
414
295
|
* @remarks
|
|
415
|
-
* ## Why
|
|
416
|
-
*
|
|
417
|
-
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
418
|
-
* through the shared DOM boundary.
|
|
419
|
-
*
|
|
420
|
-
* ## Ownership and lifetime
|
|
421
|
-
*
|
|
422
296
|
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
423
297
|
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
424
298
|
* unrelated nodes and attributes remain caller-owned.
|
|
425
299
|
*
|
|
426
|
-
* ## Example
|
|
427
|
-
*
|
|
428
|
-
* Import with `import { Option } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
429
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Replace the linked program's final
|
|
430
|
-
* snapshot read with `Option({ state, id: "nyc", value: "New York", content: "New York" })`; render
|
|
431
|
-
* that Fx before the same Scope closes.
|
|
432
300
|
* @since 1.0.0
|
|
433
|
-
* @category
|
|
301
|
+
* @category Selectable options
|
|
434
302
|
*/
|
|
435
303
|
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>;
|
|
436
304
|
export {};
|
package/dist/Listbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Listbox.d.ts","sourceRoot":"","sources":["../src/Listbox.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Listbox.d.ts","sourceRoot":"","sources":["../src/Listbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,KAAK,MAAM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ACD,iBAAS,WAAW,CAAC,KAAK,CAAC,OAAO,SAAS,aAAa,EAAE,OAAO,EAAE,OAAO;aAapE,EAAE;aACF,IAAI,EAAE,QAAQ;aACd,eAAe;aACf,eAAe;aACf,QAAQ;aACR,OAAO;aAEP,OAAO;aAEP,GAAG;EAER;AACD,KAAK,WAAW,CAAC,OAAO,SAAS,aAAa,IAAI,UAAU,CAC1D,UAAU,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,CACxC,CAAC;AACF;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,KAAK,CAAC,OAAO,SAAS,aAAa,EAAE,KAAK,CAAC,IAAI,SAAS,UAAU,GAAG,KAAK,EAC/F,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,GAAG,CAAC,YAAY,CACrB,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,EAClD,OAAO,CAAC,SAAS,CAAC,EAClB,IAAI,CACL,GACA,EAAE,CACH,WAAW,EACX,UAAU,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,EAChC,UAAU,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,GAAG,cAAc,CACnE,CAcA"}
|
package/dist/Listbox.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* the state and pure operations without mounting UI, or supply custom hosts without replacing native
|
|
9
9
|
* events and browser-owned focus.
|
|
10
10
|
*
|
|
11
|
+
* Learn the interaction in the [Listbox guide](/explore/ui-listbox).
|
|
12
|
+
*
|
|
11
13
|
* @since 1.0.0
|
|
12
14
|
* @category modules
|
|
13
15
|
* @packageDocumentation
|
|
@@ -23,15 +25,6 @@ import * as Dom from "./Dom.js";
|
|
|
23
25
|
* Effect Schema used by makeState to encode, decode, and hydrate Listbox state.
|
|
24
26
|
*
|
|
25
27
|
* @remarks
|
|
26
|
-
* ## Why
|
|
27
|
-
*
|
|
28
|
-
* A public schema makes hydration and serialized state use the same runtime validation as direct
|
|
29
|
-
* construction.
|
|
30
|
-
*
|
|
31
|
-
* ## Ownership and lifetime
|
|
32
|
-
*
|
|
33
|
-
* This declaration is data or schema metadata and acquires no resources.
|
|
34
|
-
*
|
|
35
28
|
* @example
|
|
36
29
|
* ```ts
|
|
37
30
|
* import * as Schema from "effect/Schema";
|
|
@@ -40,7 +33,7 @@ import * as Dom from "./Dom.js";
|
|
|
40
33
|
* const decodeState = Schema.decodeUnknownEffect(Listbox.StateSchema);
|
|
41
34
|
* ```
|
|
42
35
|
* @since 1.0.0
|
|
43
|
-
* @category
|
|
36
|
+
* @category Selection and focus
|
|
44
37
|
*/
|
|
45
38
|
export const StateSchema = Schema.Struct({
|
|
46
39
|
value: Schema.NullOr(Schema.String),
|
|
@@ -55,12 +48,6 @@ export const StateSchema = Schema.Struct({
|
|
|
55
48
|
* roving focus is used.
|
|
56
49
|
*
|
|
57
50
|
* @remarks
|
|
58
|
-
* ## Why
|
|
59
|
-
*
|
|
60
|
-
* State and collection ownership can be composed and tested independently from any renderer.
|
|
61
|
-
*
|
|
62
|
-
* ## Ownership and lifetime
|
|
63
|
-
*
|
|
64
51
|
* The returned Effect creates the RefSubject when run. That state is renderer-independent;
|
|
65
52
|
* collection registrations belong to the separate Scope that runs register or ref, not to state
|
|
66
53
|
* creation.
|
|
@@ -79,7 +66,7 @@ export const StateSchema = Schema.Struct({
|
|
|
79
66
|
* );
|
|
80
67
|
* ```
|
|
81
68
|
* @since 1.0.0
|
|
82
|
-
* @category
|
|
69
|
+
* @category Selection and focus
|
|
83
70
|
*/
|
|
84
71
|
export function makeState(initial = {}) {
|
|
85
72
|
return RefSubject.hydrate(StateSchema, {
|
|
@@ -95,12 +82,6 @@ export function makeState(initial = {}) {
|
|
|
95
82
|
* Creates a scoped Collection for Listbox items.
|
|
96
83
|
*
|
|
97
84
|
* @remarks
|
|
98
|
-
* ## Why
|
|
99
|
-
*
|
|
100
|
-
* State and collection ownership can be composed and tested independently from any renderer.
|
|
101
|
-
*
|
|
102
|
-
* ## Ownership and lifetime
|
|
103
|
-
*
|
|
104
85
|
* The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
|
|
105
86
|
* owned by the Scope that runs register, independently of this construction Effect.
|
|
106
87
|
*
|
|
@@ -117,31 +98,18 @@ export function makeState(initial = {}) {
|
|
|
117
98
|
* );
|
|
118
99
|
* ```
|
|
119
100
|
* @since 1.0.0
|
|
120
|
-
* @category
|
|
101
|
+
* @category Option registration
|
|
121
102
|
*/
|
|
122
103
|
export const makeCollection = Collection.makeState;
|
|
123
104
|
/**
|
|
124
105
|
* Sets both activeId and selected value in one update.
|
|
125
106
|
*
|
|
126
107
|
* @remarks
|
|
127
|
-
* ## Why
|
|
128
|
-
*
|
|
129
108
|
* The operation exposes Listbox's transition directly so callers can compose it in Effect programs
|
|
130
109
|
* and native event handlers.
|
|
131
110
|
*
|
|
132
|
-
* ## Ownership and lifetime
|
|
133
|
-
*
|
|
134
|
-
* The returned Effect performs the update or DOM side effect only when run, preserves the declared
|
|
135
|
-
* error and service channels, and retains no resources after completion.
|
|
136
|
-
*
|
|
137
|
-
* ## Example
|
|
138
|
-
*
|
|
139
|
-
* Import with `import { select } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
140
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Inside the linked Effect program invoke
|
|
141
|
-
* `yield* select(state, "nyc", "New York")`, then read state to observe selection and active focus
|
|
142
|
-
* update together.
|
|
143
111
|
* @since 1.0.0
|
|
144
|
-
* @category
|
|
112
|
+
* @category Selection and focus
|
|
145
113
|
*/
|
|
146
114
|
export function select(state, id, value) {
|
|
147
115
|
return RefSubject.update(state, (current) => ({ ...current, activeId: id, value }));
|
|
@@ -151,24 +119,11 @@ export function select(state, id, value) {
|
|
|
151
119
|
* and scrolls the active option.
|
|
152
120
|
*
|
|
153
121
|
* @remarks
|
|
154
|
-
* ## Why
|
|
155
|
-
*
|
|
156
122
|
* The operation exposes Listbox's transition directly so callers can compose it in Effect programs
|
|
157
123
|
* and native event handlers.
|
|
158
124
|
*
|
|
159
|
-
* ## Ownership and lifetime
|
|
160
|
-
*
|
|
161
|
-
* The returned Effect performs the update or DOM side effect only when run, preserves the declared
|
|
162
|
-
* error and service channels, and retains no resources after completion.
|
|
163
|
-
*
|
|
164
|
-
* ## Example
|
|
165
|
-
*
|
|
166
|
-
* Import with `import { move } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
167
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Inside the linked Effect program invoke
|
|
168
|
-
* `yield* move(state, collection, "next")`, then read the state snapshot to observe the transition
|
|
169
|
-
* described above.
|
|
170
125
|
* @since 1.0.0
|
|
171
|
-
* @category
|
|
126
|
+
* @category Selection and focus
|
|
172
127
|
*/
|
|
173
128
|
export function move(state, collection, direction) {
|
|
174
129
|
return Effect.gen(function* () {
|
|
@@ -241,25 +196,12 @@ function rootProps(options) {
|
|
|
241
196
|
* typeahead in DOM order.
|
|
242
197
|
*
|
|
243
198
|
* @remarks
|
|
244
|
-
* ## Why
|
|
245
|
-
*
|
|
246
|
-
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
247
|
-
* through the shared DOM boundary.
|
|
248
|
-
*
|
|
249
|
-
* ## Ownership and lifetime
|
|
250
|
-
*
|
|
251
199
|
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
252
200
|
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
253
201
|
* unrelated nodes and attributes remain caller-owned.
|
|
254
202
|
*
|
|
255
|
-
* ## Example
|
|
256
|
-
*
|
|
257
|
-
* Import with `import { Root } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
258
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Replace the linked program's final
|
|
259
|
-
* snapshot read with `Root({ state, label: "City", content: "Options" })`; render that Fx before
|
|
260
|
-
* the same Scope closes.
|
|
261
203
|
* @since 1.0.0
|
|
262
|
-
* @category
|
|
204
|
+
* @category Listbox surface
|
|
263
205
|
*/
|
|
264
206
|
export function Root(options, host) {
|
|
265
207
|
return Dom.renderHost()(options, host, rootProps(options), options.content, (props, content) => {
|
|
@@ -291,25 +233,12 @@ function optionProps(options) {
|
|
|
291
233
|
* Renders and optionally registers an option; focus or click selects it unless disabled.
|
|
292
234
|
*
|
|
293
235
|
* @remarks
|
|
294
|
-
* ## Why
|
|
295
|
-
*
|
|
296
|
-
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
297
|
-
* through the shared DOM boundary.
|
|
298
|
-
*
|
|
299
|
-
* ## Ownership and lifetime
|
|
300
|
-
*
|
|
301
236
|
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
302
237
|
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
303
238
|
* unrelated nodes and attributes remain caller-owned.
|
|
304
239
|
*
|
|
305
|
-
* ## Example
|
|
306
|
-
*
|
|
307
|
-
* Import with `import { Option } from "@typed/ui/Listbox";` Extend the [Listbox.makeState runnable
|
|
308
|
-
* setup](/reference/%40typed%2Fui%2FListbox%23makeState). Replace the linked program's final
|
|
309
|
-
* snapshot read with `Option({ state, id: "nyc", value: "New York", content: "New York" })`; render
|
|
310
|
-
* that Fx before the same Scope closes.
|
|
311
240
|
* @since 1.0.0
|
|
312
|
-
* @category
|
|
241
|
+
* @category Selectable options
|
|
313
242
|
*/
|
|
314
243
|
export function Option(options, host) {
|
|
315
244
|
return Dom.renderHost()(options, host, optionProps(options), options.content, (props, content) => html `<div ...${props}>${content}</div>`);
|