@typed/ui 1.0.0-beta.4 → 1.0.0-beta.5

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.
Files changed (157) hide show
  1. package/README.md +53 -9
  2. package/dist/Alert.d.ts +78 -0
  3. package/dist/Alert.d.ts.map +1 -0
  4. package/dist/Alert.js +37 -0
  5. package/dist/Button.d.ts +144 -0
  6. package/dist/Button.d.ts.map +1 -0
  7. package/dist/Button.js +38 -0
  8. package/dist/Carousel.d.ts +547 -0
  9. package/dist/Carousel.d.ts.map +1 -0
  10. package/dist/Carousel.js +387 -0
  11. package/dist/Checkbox.d.ts +203 -0
  12. package/dist/Checkbox.d.ts.map +1 -0
  13. package/dist/Checkbox.js +140 -0
  14. package/dist/Collection.d.ts +254 -0
  15. package/dist/Collection.d.ts.map +1 -0
  16. package/dist/Collection.js +218 -0
  17. package/dist/Combobox.d.ts +516 -0
  18. package/dist/Combobox.d.ts.map +1 -0
  19. package/dist/Combobox.js +371 -0
  20. package/dist/Component.d.ts +127 -0
  21. package/dist/Component.d.ts.map +1 -0
  22. package/dist/Component.js +60 -0
  23. package/dist/Composite.d.ts +823 -0
  24. package/dist/Composite.d.ts.map +1 -0
  25. package/dist/Composite.js +615 -0
  26. package/dist/Dialog.d.ts +544 -0
  27. package/dist/Dialog.d.ts.map +1 -0
  28. package/dist/Dialog.js +355 -0
  29. package/dist/Disclosure.d.ts +219 -0
  30. package/dist/Disclosure.d.ts.map +1 -0
  31. package/dist/Disclosure.js +128 -0
  32. package/dist/Dom/Events.d.ts +122 -0
  33. package/dist/Dom/Events.d.ts.map +1 -0
  34. package/dist/Dom/Events.js +192 -0
  35. package/dist/Dom/Props.d.ts +161 -0
  36. package/dist/Dom/Props.d.ts.map +1 -0
  37. package/dist/Dom/Props.js +110 -0
  38. package/dist/Dom/Refs.d.ts +58 -0
  39. package/dist/Dom/Refs.d.ts.map +1 -0
  40. package/dist/Dom/Refs.js +61 -0
  41. package/dist/Dom/Render.d.ts +59 -0
  42. package/dist/Dom/Render.d.ts.map +1 -0
  43. package/dist/Dom/Render.js +71 -0
  44. package/dist/Dom/Types.d.ts +570 -0
  45. package/dist/Dom/Types.d.ts.map +1 -0
  46. package/dist/Dom/Types.js +1 -0
  47. package/dist/Dom/index.d.ts +20 -0
  48. package/dist/Dom/index.d.ts.map +1 -0
  49. package/dist/Dom/index.js +8 -0
  50. package/dist/Dom.d.ts +14 -0
  51. package/dist/Dom.d.ts.map +1 -0
  52. package/dist/Dom.js +13 -0
  53. package/dist/Focusable.d.ts +85 -0
  54. package/dist/Focusable.d.ts.map +1 -0
  55. package/dist/Focusable.js +35 -0
  56. package/dist/Form.d.ts +1695 -0
  57. package/dist/Form.d.ts.map +1 -0
  58. package/dist/Form.js +987 -0
  59. package/dist/Grid.d.ts +569 -0
  60. package/dist/Grid.d.ts.map +1 -0
  61. package/dist/Grid.js +379 -0
  62. package/dist/Group.d.ts +147 -0
  63. package/dist/Group.d.ts.map +1 -0
  64. package/dist/Group.js +63 -0
  65. package/dist/Heading.d.ts +86 -0
  66. package/dist/Heading.d.ts.map +1 -0
  67. package/dist/Heading.js +48 -0
  68. package/dist/Hovercard.d.ts +297 -0
  69. package/dist/Hovercard.d.ts.map +1 -0
  70. package/dist/Hovercard.js +188 -0
  71. package/dist/HttpRouter.d.ts +129 -6
  72. package/dist/HttpRouter.d.ts.map +1 -1
  73. package/dist/HttpRouter.js +196 -53
  74. package/dist/Link.d.ts +67 -28
  75. package/dist/Link.d.ts.map +1 -1
  76. package/dist/Link.js +91 -37
  77. package/dist/Listbox.d.ts +437 -0
  78. package/dist/Listbox.d.ts.map +1 -0
  79. package/dist/Listbox.js +316 -0
  80. package/dist/Menu.d.ts +972 -0
  81. package/dist/Menu.d.ts.map +1 -0
  82. package/dist/Menu.js +731 -0
  83. package/dist/Menubar.d.ts +367 -0
  84. package/dist/Menubar.d.ts.map +1 -0
  85. package/dist/Menubar.js +265 -0
  86. package/dist/Meter.d.ts +217 -0
  87. package/dist/Meter.d.ts.map +1 -0
  88. package/dist/Meter.js +94 -0
  89. package/dist/NativeDetails.d.ts +41 -0
  90. package/dist/NativeDetails.d.ts.map +1 -0
  91. package/dist/NativeDetails.js +40 -0
  92. package/dist/NativeDialog.d.ts +64 -0
  93. package/dist/NativeDialog.d.ts.map +1 -0
  94. package/dist/NativeDialog.js +50 -0
  95. package/dist/NativePopover.d.ts +41 -0
  96. package/dist/NativePopover.d.ts.map +1 -0
  97. package/dist/NativePopover.js +46 -0
  98. package/dist/Popover.d.ts +241 -0
  99. package/dist/Popover.d.ts.map +1 -0
  100. package/dist/Popover.js +141 -0
  101. package/dist/RadioGroup.d.ts +432 -0
  102. package/dist/RadioGroup.d.ts.map +1 -0
  103. package/dist/RadioGroup.js +291 -0
  104. package/dist/Role.d.ts +64 -0
  105. package/dist/Role.d.ts.map +1 -0
  106. package/dist/Role.js +27 -0
  107. package/dist/Select.d.ts +529 -0
  108. package/dist/Select.d.ts.map +1 -0
  109. package/dist/Select.js +407 -0
  110. package/dist/Separator.d.ts +54 -0
  111. package/dist/Separator.d.ts.map +1 -0
  112. package/dist/Separator.js +26 -0
  113. package/dist/Slider.d.ts +188 -0
  114. package/dist/Slider.d.ts.map +1 -0
  115. package/dist/Slider.js +96 -0
  116. package/dist/SpinButton.d.ts +188 -0
  117. package/dist/SpinButton.d.ts.map +1 -0
  118. package/dist/SpinButton.js +96 -0
  119. package/dist/Storybook.d.ts +76 -0
  120. package/dist/Storybook.d.ts.map +1 -0
  121. package/dist/Storybook.js +102 -0
  122. package/dist/Switch.d.ts +187 -0
  123. package/dist/Switch.d.ts.map +1 -0
  124. package/dist/Switch.js +116 -0
  125. package/dist/Tab.d.ts +26 -0
  126. package/dist/Tab.d.ts.map +1 -0
  127. package/dist/Tab.js +25 -0
  128. package/dist/Tabs.d.ts +591 -0
  129. package/dist/Tabs.d.ts.map +1 -0
  130. package/dist/Tabs.js +346 -0
  131. package/dist/Toolbar.d.ts +366 -0
  132. package/dist/Toolbar.d.ts.map +1 -0
  133. package/dist/Toolbar.js +245 -0
  134. package/dist/Tooltip.d.ts +296 -0
  135. package/dist/Tooltip.d.ts.map +1 -0
  136. package/dist/Tooltip.js +172 -0
  137. package/dist/Tree.d.ts +591 -0
  138. package/dist/Tree.d.ts.map +1 -0
  139. package/dist/Tree.js +434 -0
  140. package/dist/TreeGrid.d.ts +645 -0
  141. package/dist/TreeGrid.d.ts.map +1 -0
  142. package/dist/TreeGrid.js +420 -0
  143. package/dist/VisuallyHidden.d.ts +54 -0
  144. package/dist/VisuallyHidden.d.ts.map +1 -0
  145. package/dist/VisuallyHidden.js +27 -0
  146. package/dist/WindowSplitter.d.ts +376 -0
  147. package/dist/WindowSplitter.d.ts.map +1 -0
  148. package/dist/WindowSplitter.js +222 -0
  149. package/dist/index.d.ts +49 -0
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +49 -0
  152. package/package.json +45 -18
  153. package/src/HttpRouter.test.ts +0 -256
  154. package/src/HttpRouter.ts +0 -165
  155. package/src/Link.test.ts +0 -84
  156. package/src/Link.ts +0 -107
  157. package/src/index.ts +0 -2
package/dist/Tabs.d.ts ADDED
@@ -0,0 +1,591 @@
1
+ /**
2
+ * Tabs separates active focus from selected tab and supports automatic or manual activation. List
3
+ * handles orientation-aware movement; Tab publishes stable aria-controls state; Panel retains its
4
+ * node while hidden.
5
+ *
6
+ * @remarks
7
+ * The module keeps policy, state transitions, and DOM rendering separable so applications can use
8
+ * the state and pure operations without mounting UI, or supply custom hosts without replacing native
9
+ * events and browser-owned focus.
10
+ *
11
+ * @since 1.0.0
12
+ * @category modules
13
+ * @packageDocumentation
14
+ */
15
+ import * as Effect from "effect/Effect";
16
+ import type * as Scope from "effect/Scope";
17
+ import * as Schema from "effect/Schema";
18
+ import type { Fx } from "@typed/fx/Fx";
19
+ import { RefSubject } from "@typed/fx";
20
+ import { EventHandler, type Renderable, type RenderEvent, type RenderTemplate } from "@typed/template";
21
+ import * as Collection from "./Collection.js";
22
+ import * as Composite from "./Composite.js";
23
+ import * as Dom from "./Dom.js";
24
+ import type { HostResult } from "./Dom/Types.js";
25
+ /**
26
+ * Controls whether moving focus also selects a tab.
27
+ *
28
+ * @remarks
29
+ * ## Why
30
+ *
31
+ * The public model lets custom composites reuse Tabs's deterministic policy without copying an
32
+ * internal shape.
33
+ *
34
+ * ## Ownership and lifetime
35
+ *
36
+ * This declaration is data or schema metadata and acquires no resources.
37
+ *
38
+ * ## Example
39
+ *
40
+ * Import with `import type { ActivationMode } from "@typed/ui/Tabs";` Extend the [Tabs.makeState
41
+ * runnable setup](/reference/%40typed%2Fui%2FTabs%23makeState). Choose the focus-to-selection
42
+ * policy explicitly: `const mode: ActivationMode = "manual"`.
43
+ * @since 1.0.0
44
+ * @category models
45
+ */
46
+ export type ActivationMode = "automatic" | "manual";
47
+ /**
48
+ * Supported composite movement axes.
49
+ *
50
+ * @remarks
51
+ * ## Why
52
+ *
53
+ * The public model lets custom composites reuse Tabs's deterministic policy without copying an
54
+ * internal shape.
55
+ *
56
+ * ## Ownership and lifetime
57
+ *
58
+ * This declaration is data or schema metadata and acquires no resources.
59
+ *
60
+ * ## Example
61
+ *
62
+ * Import with `import type { Orientation } from "@typed/ui/Tabs";` Extend the [Tabs.makeState
63
+ * runnable setup](/reference/%40typed%2Fui%2FTabs%23makeState). Choose the tab-list axis
64
+ * explicitly: `const orientation: Orientation = "horizontal"`.
65
+ * @since 1.0.0
66
+ * @category models
67
+ */
68
+ export type Orientation = "horizontal" | "vertical";
69
+ /**
70
+ * Complete renderer-independent state for Tabs.
71
+ *
72
+ * @remarks
73
+ * ## Why
74
+ *
75
+ * Applications can inspect, update, and test Tabs behavior without mounting or coupling the state
76
+ * to a renderer.
77
+ *
78
+ * ## Ownership and lifetime
79
+ *
80
+ * This declaration is data or schema metadata and acquires no resources.
81
+ *
82
+ * ## Example
83
+ *
84
+ * Import with `import type { State } from "@typed/ui/Tabs";` Extend the [Tabs.makeState runnable
85
+ * setup](/reference/%40typed%2Fui%2FTabs%23makeState). Inside the linked program,
86
+ * `const snapshot: State = yield* state` exposes selected and focused tabs as separate ids.
87
+ * @since 1.0.0
88
+ * @category models
89
+ */
90
+ export interface State extends Omit<Composite.State, "orientation"> {
91
+ /**
92
+ * Axis used to interpret Arrow-key movement.
93
+ * @since 1.0.0
94
+ * @category models
95
+ */
96
+ readonly orientation: Orientation;
97
+ /**
98
+ * Id whose value is currently selected.
99
+ * @since 1.0.0
100
+ * @category models
101
+ */
102
+ readonly selectedId: string;
103
+ /**
104
+ * Id currently active for keyboard navigation; null means no active item.
105
+ * @since 1.0.0
106
+ * @category models
107
+ */
108
+ readonly activeId: string;
109
+ /**
110
+ * Whether tab focus also selects automatically or waits for explicit activation.
111
+ * @since 1.0.0
112
+ * @category models
113
+ */
114
+ readonly activationMode: ActivationMode;
115
+ }
116
+ /**
117
+ * Initial Tabs values. The caller supplies value; activeId defaults to value, activation is
118
+ * automatic, orientation horizontal, and loop true.
119
+ *
120
+ * @remarks
121
+ * ## Why
122
+ *
123
+ * Making initialization explicit documents hydration-sensitive defaults and lets servers and
124
+ * clients construct matching state.
125
+ *
126
+ * ## Ownership and lifetime
127
+ *
128
+ * This declaration is data or schema metadata and acquires no resources.
129
+ *
130
+ * ## Example
131
+ *
132
+ * Import with `import type { InitialState } from "@typed/ui/Tabs";` Extend the [Tabs.makeState
133
+ * runnable setup](/reference/%40typed%2Fui%2FTabs%23makeState). Construct state with
134
+ * `const initial: InitialState = { selectedId: "overview", activationMode: "manual" }; const state = yield* Tabs.makeState(initial)`.
135
+ * @since 1.0.0
136
+ * @category models
137
+ */
138
+ export interface InitialState {
139
+ /**
140
+ * Id whose value is currently selected.
141
+ * @since 1.0.0
142
+ * @category models
143
+ */
144
+ readonly selectedId: string;
145
+ /**
146
+ * Id currently active for keyboard navigation; null means no active item.
147
+ * @since 1.0.0
148
+ * @category models
149
+ */
150
+ readonly activeId?: string;
151
+ /**
152
+ * Whether tab focus also selects automatically or waits for explicit activation.
153
+ * @since 1.0.0
154
+ * @category models
155
+ */
156
+ readonly activationMode?: ActivationMode;
157
+ /**
158
+ * Axis used to interpret Arrow-key movement.
159
+ * @since 1.0.0
160
+ * @category models
161
+ */
162
+ readonly orientation?: Orientation;
163
+ /**
164
+ * Whether movement wraps between the first and last enabled items.
165
+ * @since 1.0.0
166
+ * @category models
167
+ */
168
+ readonly loop?: boolean;
169
+ /**
170
+ * Whether horizontal Arrow-key meaning is reversed for right-to-left layout.
171
+ * @since 1.0.0
172
+ * @category models
173
+ */
174
+ readonly rtl?: boolean;
175
+ }
176
+ /**
177
+ * Effect Schema used by makeState to encode, decode, and hydrate Tabs state.
178
+ *
179
+ * @remarks
180
+ * ## Why
181
+ *
182
+ * A public schema makes hydration and serialized state use the same runtime validation as direct
183
+ * construction.
184
+ *
185
+ * ## Ownership and lifetime
186
+ *
187
+ * This declaration is data or schema metadata and acquires no resources.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import * as Schema from "effect/Schema";
192
+ * import * as Tabs from "@typed/ui/Tabs";
193
+ *
194
+ * const decodeState = Schema.decodeUnknownEffect(Tabs.StateSchema);
195
+ * ```
196
+ * @since 1.0.0
197
+ * @category schemas
198
+ */
199
+ export declare const StateSchema: Schema.Struct<{
200
+ readonly selectedId: Schema.String;
201
+ readonly activeId: Schema.String;
202
+ readonly activationMode: Schema.Literals<readonly ["automatic", "manual"]>;
203
+ readonly orientation: Schema.Literals<readonly ["horizontal", "vertical"]>;
204
+ readonly loop: Schema.Boolean;
205
+ readonly rtl: Schema.Boolean;
206
+ readonly virtualFocus: Schema.Boolean;
207
+ }>;
208
+ /**
209
+ * Creates hydrated Tabs state. The caller supplies value; activeId defaults to value, activation
210
+ * is automatic, orientation horizontal, and loop true.
211
+ *
212
+ * @remarks
213
+ * ## Why
214
+ *
215
+ * State and collection ownership can be composed and tested independently from any renderer.
216
+ *
217
+ * ## Ownership and lifetime
218
+ *
219
+ * The returned Effect creates the RefSubject when run. That state is renderer-independent;
220
+ * collection registrations belong to the separate Scope that runs register or ref, not to state
221
+ * creation.
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * import * as Effect from "effect/Effect";
226
+ * import * as Tabs from "@typed/ui/Tabs";
227
+ *
228
+ * const program = Effect.scoped(
229
+ * Effect.gen(function* () {
230
+ * const state = yield* Tabs.makeState({ selectedId: "overview" });
231
+ * const collection = yield* Tabs.makeCollection();
232
+ * return { state: yield* state, collection: yield* collection };
233
+ * }),
234
+ * );
235
+ * ```
236
+ * @since 1.0.0
237
+ * @category constructors
238
+ */
239
+ export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
240
+ readonly selectedId: string;
241
+ readonly activeId: string;
242
+ readonly activationMode: "automatic" | "manual";
243
+ readonly orientation: "horizontal" | "vertical";
244
+ readonly loop: boolean;
245
+ readonly rtl: boolean;
246
+ readonly virtualFocus: boolean;
247
+ }, Schema.SchemaError, never, never>, never, Scope.Scope>;
248
+ /**
249
+ * Creates a scoped Collection for Tabs items.
250
+ *
251
+ * @remarks
252
+ * ## Why
253
+ *
254
+ * State and collection ownership can be composed and tested independently from any renderer.
255
+ *
256
+ * ## Ownership and lifetime
257
+ *
258
+ * The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
259
+ * owned by the Scope that runs register, independently of this construction Effect.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * import * as Effect from "effect/Effect";
264
+ * import * as Tabs from "@typed/ui/Tabs";
265
+ *
266
+ * const program = Effect.scoped(
267
+ * Effect.gen(function* () {
268
+ * const collection = yield* Tabs.makeCollection();
269
+ * return yield* collection;
270
+ * }),
271
+ * );
272
+ * ```
273
+ * @since 1.0.0
274
+ * @category constructors
275
+ */
276
+ export declare const makeCollection: (initial?: Collection.State<string, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<string, Element>, never, never>, never, Scope.Scope>;
277
+ /**
278
+ * Selects a tab and makes it the active roving-focus item.
279
+ *
280
+ * @remarks
281
+ * ## Why
282
+ *
283
+ * The operation exposes Tabs's transition directly so callers can compose it in Effect programs
284
+ * and native event handlers.
285
+ *
286
+ * ## Ownership and lifetime
287
+ *
288
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
289
+ * error and service channels, and retains no resources after completion.
290
+ *
291
+ * ## Example
292
+ *
293
+ * Import with `import { select } from "@typed/ui/Tabs";` Extend the [Tabs.makeState runnable
294
+ * setup](/reference/%40typed%2Fui%2FTabs%23makeState). Inside the linked Effect program invoke
295
+ * `yield* select(state, "settings")`, then read state to observe both `selectedId` and `activeId`
296
+ * become `"settings"`.
297
+ * @since 1.0.0
298
+ * @category combinators
299
+ */
300
+ export declare function select<E, R>(state: RefSubject.RefSubject<State, E, R>, selectedId: string): Effect.Effect<State, E, R>;
301
+ /**
302
+ * Moves activeId through registered tabs without selecting under manual activation.
303
+ *
304
+ * @remarks
305
+ * ## Why
306
+ *
307
+ * The operation exposes Tabs's transition directly so callers can compose it in Effect programs
308
+ * and native event handlers.
309
+ *
310
+ * ## Ownership and lifetime
311
+ *
312
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
313
+ * error and service channels, and retains no resources after completion.
314
+ *
315
+ * ## Example
316
+ *
317
+ * Import with `import { move } from "@typed/ui/Tabs";` Extend the [Tabs.makeState runnable
318
+ * setup](/reference/%40typed%2Fui%2FTabs%23makeState). Inside the linked Effect program invoke
319
+ * `yield* move(state, yield* collection, "next")`, then read state to observe focus move—and, in
320
+ * automatic mode, selection move—to the next enabled tab.
321
+ * @since 1.0.0
322
+ * @category combinators
323
+ */
324
+ export declare function move<E, R>(state: RefSubject.RefSubject<State, E, R>, items: readonly Collection.Item[], direction: Composite.Move): Effect.Effect<State, E, R>;
325
+ /**
326
+ * Inputs accepted by Tabs.List in addition to the shared DOM host options.
327
+ *
328
+ * @remarks
329
+ * ## Why
330
+ *
331
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
332
+ * visible before rendering.
333
+ *
334
+ * ## Ownership and lifetime
335
+ *
336
+ * This declaration is data or schema metadata and acquires no resources.
337
+ *
338
+ * ## Example
339
+ *
340
+ * Import with `import type { ListOptions } from "@typed/ui/Tabs";` Extend the [Tabs.makeState
341
+ * runnable setup](/reference/%40typed%2Fui%2FTabs%23makeState). Enable collection-driven keys with
342
+ * `const options: ListOptions = { state, collection, label: "Account", content: "Tabs" }`.
343
+ * @since 1.0.0
344
+ * @category models
345
+ */
346
+ export interface ListOptions extends Dom.HostOptions<HTMLDivElement> {
347
+ /**
348
+ * Renderer-independent RefSubject state consumed by this component or operation.
349
+ * @since 1.0.0
350
+ * @category models
351
+ */
352
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
353
+ /**
354
+ * Renderable child content for the component host.
355
+ * @since 1.0.0
356
+ * @category models
357
+ */
358
+ readonly content: Renderable.Any;
359
+ /**
360
+ * Accessible label rendered through aria-label.
361
+ * @since 1.0.0
362
+ * @category models
363
+ */
364
+ readonly label?: Renderable.Any<string | null | undefined>;
365
+ /**
366
+ * Renderable tab content placed inside the tablist host.
367
+ * @since 1.0.0
368
+ * @category models
369
+ */
370
+ readonly items?: readonly Collection.Item[];
371
+ /**
372
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
373
+ * @since 1.0.0
374
+ * @category models
375
+ */
376
+ readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
377
+ }
378
+ declare function listInternalProps<const Options extends ListOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
379
+ readonly role: "tablist";
380
+ readonly "aria-label": Exclude<Dom.Property<Options, "label">, Dom.Nullish> | undefined;
381
+ readonly "aria-orientation": RefSubject.Computed<Orientation, Schema.SchemaError, never>;
382
+ readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
383
+ readonly ref: RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>;
384
+ };
385
+ type ListInternalProps<Options extends ListOptions> = ReturnType<ReturnType<typeof listInternalProps<Options>>>;
386
+ /**
387
+ * Renders the tablist and applies orientation-aware movement plus Enter/Space activation in manual
388
+ * mode.
389
+ *
390
+ * @remarks
391
+ * ## Why
392
+ *
393
+ * The component applies the family behavior while leaving callers free to supply a custom host
394
+ * through the shared DOM boundary.
395
+ *
396
+ * ## Ownership and lifetime
397
+ *
398
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
399
+ * collection registrations only when rendered. The rendering Scope removes those resources;
400
+ * unrelated nodes and attributes remain caller-owned.
401
+ *
402
+ * ## Example
403
+ *
404
+ * Import with `import { List } from "@typed/ui/Tabs";` Extend the [Tabs.makeState runnable
405
+ * setup](/reference/%40typed%2Fui%2FTabs%23makeState). Replace the linked program's final snapshot
406
+ * read with `List({ state, label: "Account", content: "Tabs" })`; render that Fx before the same
407
+ * Scope closes.
408
+ * @since 1.0.0
409
+ * @category components
410
+ */
411
+ export declare function List<const Options extends ListOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, ListInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
412
+ /**
413
+ * Inputs accepted by Tabs.Tab in addition to the shared DOM host options.
414
+ *
415
+ * @remarks
416
+ * ## Why
417
+ *
418
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
419
+ * visible before rendering.
420
+ *
421
+ * ## Ownership and lifetime
422
+ *
423
+ * This declaration is data or schema metadata and acquires no resources.
424
+ *
425
+ * ## Example
426
+ *
427
+ * Import with `import type { TabOptions } from "@typed/ui/Tabs";` Extend the [Tabs.makeState
428
+ * runnable setup](/reference/%40typed%2Fui%2FTabs%23makeState). Relate a tab to its panel with
429
+ * `const options: TabOptions = { state, collection, id: "overview", panelId: "overview-panel", content: "Overview" }`.
430
+ * @since 1.0.0
431
+ * @category models
432
+ */
433
+ export interface TabOptions extends Dom.HostOptions<HTMLButtonElement> {
434
+ /**
435
+ * Renderer-independent RefSubject state consumed by this component or operation.
436
+ * @since 1.0.0
437
+ * @category models
438
+ */
439
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
440
+ /**
441
+ * Stable id used for collection identity and ARIA relationships.
442
+ * @since 1.0.0
443
+ * @category models
444
+ */
445
+ readonly id: string;
446
+ /**
447
+ * Panel id emitted through the tab's aria-controls relationship.
448
+ * @since 1.0.0
449
+ * @category models
450
+ */
451
+ readonly panelId: string;
452
+ /**
453
+ * Renderable child content for the component host.
454
+ * @since 1.0.0
455
+ * @category models
456
+ */
457
+ readonly content: Renderable.Any;
458
+ /**
459
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
460
+ * @since 1.0.0
461
+ * @category models
462
+ */
463
+ readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
464
+ /**
465
+ * Flag used by collection movement and widget handlers to skip activation by default.
466
+ * @since 1.0.0
467
+ * @category models
468
+ */
469
+ readonly disabled?: boolean;
470
+ }
471
+ declare function tabInternalProps<const Options extends TabOptions>(options: Options): () => {
472
+ readonly id: string;
473
+ readonly type: "button";
474
+ readonly role: "tab";
475
+ readonly "aria-controls": string;
476
+ readonly "aria-selected": RefSubject.Computed<boolean, Schema.SchemaError, never>;
477
+ readonly "aria-disabled": boolean;
478
+ readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
479
+ readonly onclick: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
480
+ readonly onfocus: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
481
+ readonly ref: ((element: Element & HTMLButtonElement & RefSubject.HydrationElement) => Effect.Effect<void, any, any>) | undefined;
482
+ };
483
+ type TabInternalProps<Options extends TabOptions> = ReturnType<ReturnType<typeof tabInternalProps<Options>>>;
484
+ /**
485
+ * Renders and optionally registers a tab with stable aria-controls, selected state, and roving
486
+ * tabindex.
487
+ *
488
+ * @remarks
489
+ * ## Why
490
+ *
491
+ * The component applies the family behavior while leaving callers free to supply a custom host
492
+ * through the shared DOM boundary.
493
+ *
494
+ * ## Ownership and lifetime
495
+ *
496
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
497
+ * collection registrations only when rendered. The rendering Scope removes those resources;
498
+ * unrelated nodes and attributes remain caller-owned.
499
+ *
500
+ * ## Example
501
+ *
502
+ * Import with `import { Tab } from "@typed/ui/Tabs";` Extend the [Tabs.makeState runnable
503
+ * setup](/reference/%40typed%2Fui%2FTabs%23makeState). Replace the linked program's final snapshot
504
+ * read with `Tab({ state, id: "overview", panelId: "overview-panel", content: "Overview" })`;
505
+ * render that Fx before the same Scope closes.
506
+ * @since 1.0.0
507
+ * @category components
508
+ */
509
+ export declare function Tab<const Options extends TabOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, TabInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
510
+ /**
511
+ * Inputs accepted by Tabs.Panel in addition to the shared DOM host options.
512
+ *
513
+ * @remarks
514
+ * ## Why
515
+ *
516
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
517
+ * visible before rendering.
518
+ *
519
+ * ## Ownership and lifetime
520
+ *
521
+ * This declaration is data or schema metadata and acquires no resources.
522
+ *
523
+ * ## Example
524
+ *
525
+ * Import with `import type { PanelOptions } from "@typed/ui/Tabs";` Extend the [Tabs.makeState
526
+ * runnable setup](/reference/%40typed%2Fui%2FTabs%23makeState). Relate a panel back to its tab with
527
+ * `const options: PanelOptions = { state, id: "overview-panel", tabId: "overview", content: "Account overview" }`.
528
+ * @since 1.0.0
529
+ * @category models
530
+ */
531
+ export interface PanelOptions extends Dom.HostOptions<HTMLDivElement> {
532
+ /**
533
+ * Renderer-independent RefSubject state consumed by this component or operation.
534
+ * @since 1.0.0
535
+ * @category models
536
+ */
537
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
538
+ /**
539
+ * Stable id used for collection identity and ARIA relationships.
540
+ * @since 1.0.0
541
+ * @category models
542
+ */
543
+ readonly id: string;
544
+ /**
545
+ * Tab id emitted through the panel's aria-labelledby relationship.
546
+ * @since 1.0.0
547
+ * @category models
548
+ */
549
+ readonly tabId: string;
550
+ /**
551
+ * Renderable child content for the component host.
552
+ * @since 1.0.0
553
+ * @category models
554
+ */
555
+ readonly content: Renderable.Any;
556
+ }
557
+ declare function panelInternalProps<const Options extends PanelOptions>(options: Options): () => {
558
+ readonly id: string;
559
+ readonly role: "tabpanel";
560
+ readonly "aria-labelledby": string;
561
+ readonly tabindex: 0;
562
+ readonly "?hidden": RefSubject.Computed<boolean, Schema.SchemaError, never>;
563
+ };
564
+ type PanelInternalProps<Options extends PanelOptions> = ReturnType<ReturnType<typeof panelInternalProps<Options>>>;
565
+ /**
566
+ * Renders a labelled tabpanel and hides it reactively when its tab is not selected.
567
+ *
568
+ * @remarks
569
+ * ## Why
570
+ *
571
+ * The component applies the family behavior while leaving callers free to supply a custom host
572
+ * through the shared DOM boundary.
573
+ *
574
+ * ## Ownership and lifetime
575
+ *
576
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
577
+ * collection registrations only when rendered. The rendering Scope removes those resources;
578
+ * unrelated nodes and attributes remain caller-owned.
579
+ *
580
+ * ## Example
581
+ *
582
+ * Import with `import { Panel } from "@typed/ui/Tabs";` Extend the [Tabs.makeState runnable
583
+ * setup](/reference/%40typed%2Fui%2FTabs%23makeState). Replace the linked program's final snapshot
584
+ * read with `Panel({ state, id: "overview-panel", tabId: "overview", content: "Account overview"
585
+ * })`; render that Fx before the same Scope closes.
586
+ * @since 1.0.0
587
+ * @category components
588
+ */
589
+ export declare function Panel<const Options extends PanelOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, PanelInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
590
+ export {};
591
+ //# sourceMappingURL=Tabs.d.ts.map
@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