@typed/ui 1.0.0-beta.0 → 1.0.0-beta.10

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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -26
  3. package/dist/Alert.d.ts +72 -0
  4. package/dist/Alert.d.ts.map +1 -0
  5. package/dist/Alert.js +40 -0
  6. package/dist/Button.d.ts +100 -0
  7. package/dist/Button.d.ts.map +1 -0
  8. package/dist/Button.js +42 -0
  9. package/dist/Carousel.d.ts +346 -0
  10. package/dist/Carousel.d.ts.map +1 -0
  11. package/dist/Carousel.js +264 -0
  12. package/dist/Checkbox.d.ts +168 -0
  13. package/dist/Checkbox.d.ts.map +1 -0
  14. package/dist/Checkbox.js +146 -0
  15. package/dist/Collection.d.ts +254 -0
  16. package/dist/Collection.d.ts.map +1 -0
  17. package/dist/Collection.js +218 -0
  18. package/dist/Combobox.d.ts +367 -0
  19. package/dist/Combobox.d.ts.map +1 -0
  20. package/dist/Combobox.js +300 -0
  21. package/dist/Composite.d.ts +823 -0
  22. package/dist/Composite.d.ts.map +1 -0
  23. package/dist/Composite.js +615 -0
  24. package/dist/Dialog.d.ts +544 -0
  25. package/dist/Dialog.d.ts.map +1 -0
  26. package/dist/Dialog.js +357 -0
  27. package/dist/Disclosure.d.ts +219 -0
  28. package/dist/Disclosure.d.ts.map +1 -0
  29. package/dist/Disclosure.js +128 -0
  30. package/dist/Dom/Events.d.ts +122 -0
  31. package/dist/Dom/Events.d.ts.map +1 -0
  32. package/dist/Dom/Events.js +192 -0
  33. package/dist/Dom/Props.d.ts +161 -0
  34. package/dist/Dom/Props.d.ts.map +1 -0
  35. package/dist/Dom/Props.js +110 -0
  36. package/dist/Dom/Refs.d.ts +58 -0
  37. package/dist/Dom/Refs.d.ts.map +1 -0
  38. package/dist/Dom/Refs.js +61 -0
  39. package/dist/Dom/Render.d.ts +59 -0
  40. package/dist/Dom/Render.d.ts.map +1 -0
  41. package/dist/Dom/Render.js +71 -0
  42. package/dist/Dom/Types.d.ts +570 -0
  43. package/dist/Dom/Types.d.ts.map +1 -0
  44. package/dist/Dom/Types.js +1 -0
  45. package/dist/Dom/index.d.ts +20 -0
  46. package/dist/Dom/index.d.ts.map +1 -0
  47. package/dist/Dom/index.js +8 -0
  48. package/dist/Dom.d.ts +14 -0
  49. package/dist/Dom.d.ts.map +1 -0
  50. package/dist/Dom.js +13 -0
  51. package/dist/Focusable.d.ts +85 -0
  52. package/dist/Focusable.d.ts.map +1 -0
  53. package/dist/Focusable.js +35 -0
  54. package/dist/Form.d.ts +1727 -0
  55. package/dist/Form.d.ts.map +1 -0
  56. package/dist/Form.js +1142 -0
  57. package/dist/Grid.d.ts +388 -0
  58. package/dist/Grid.d.ts.map +1 -0
  59. package/dist/Grid.js +284 -0
  60. package/dist/Group.d.ts +128 -0
  61. package/dist/Group.d.ts.map +1 -0
  62. package/dist/Group.js +71 -0
  63. package/dist/Heading.d.ts +87 -0
  64. package/dist/Heading.d.ts.map +1 -0
  65. package/dist/Heading.js +58 -0
  66. package/dist/Hovercard.d.ts +297 -0
  67. package/dist/Hovercard.d.ts.map +1 -0
  68. package/dist/Hovercard.js +188 -0
  69. package/dist/HttpRouter.d.ts +129 -6
  70. package/dist/HttpRouter.d.ts.map +1 -1
  71. package/dist/HttpRouter.js +199 -56
  72. package/dist/Link.d.ts +63 -28
  73. package/dist/Link.d.ts.map +1 -1
  74. package/dist/Link.js +84 -37
  75. package/dist/Listbox.d.ts +305 -0
  76. package/dist/Listbox.d.ts.map +1 -0
  77. package/dist/Listbox.js +245 -0
  78. package/dist/Menu.d.ts +663 -0
  79. package/dist/Menu.d.ts.map +1 -0
  80. package/dist/Menu.js +569 -0
  81. package/dist/Menubar.d.ts +249 -0
  82. package/dist/Menubar.d.ts.map +1 -0
  83. package/dist/Menubar.js +207 -0
  84. package/dist/Meter.d.ts +157 -0
  85. package/dist/Meter.d.ts.map +1 -0
  86. package/dist/Meter.js +87 -0
  87. package/dist/NativeDetails.d.ts +41 -0
  88. package/dist/NativeDetails.d.ts.map +1 -0
  89. package/dist/NativeDetails.js +40 -0
  90. package/dist/NativeDialog.d.ts +66 -0
  91. package/dist/NativeDialog.d.ts.map +1 -0
  92. package/dist/NativeDialog.js +88 -0
  93. package/dist/NativePopover.d.ts +43 -0
  94. package/dist/NativePopover.d.ts.map +1 -0
  95. package/dist/NativePopover.js +84 -0
  96. package/dist/Popover.d.ts +240 -0
  97. package/dist/Popover.d.ts.map +1 -0
  98. package/dist/Popover.js +140 -0
  99. package/dist/RadioGroup.d.ts +330 -0
  100. package/dist/RadioGroup.d.ts.map +1 -0
  101. package/dist/RadioGroup.js +241 -0
  102. package/dist/Role.d.ts +64 -0
  103. package/dist/Role.d.ts.map +1 -0
  104. package/dist/Role.js +27 -0
  105. package/dist/Select.d.ts +418 -0
  106. package/dist/Select.d.ts.map +1 -0
  107. package/dist/Select.js +357 -0
  108. package/dist/Separator.d.ts +58 -0
  109. package/dist/Separator.d.ts.map +1 -0
  110. package/dist/Separator.js +32 -0
  111. package/dist/Slider.d.ts +141 -0
  112. package/dist/Slider.d.ts.map +1 -0
  113. package/dist/Slider.js +101 -0
  114. package/dist/SpinButton.d.ts +141 -0
  115. package/dist/SpinButton.d.ts.map +1 -0
  116. package/dist/SpinButton.js +101 -0
  117. package/dist/Storybook.d.ts +76 -0
  118. package/dist/Storybook.d.ts.map +1 -0
  119. package/dist/Storybook.js +102 -0
  120. package/dist/Switch.d.ts +148 -0
  121. package/dist/Switch.d.ts.map +1 -0
  122. package/dist/Switch.js +110 -0
  123. package/dist/Tab.d.ts +26 -0
  124. package/dist/Tab.d.ts.map +1 -0
  125. package/dist/Tab.js +25 -0
  126. package/dist/Tabs.d.ts +411 -0
  127. package/dist/Tabs.d.ts.map +1 -0
  128. package/dist/Tabs.js +262 -0
  129. package/dist/Toolbar.d.ts +248 -0
  130. package/dist/Toolbar.d.ts.map +1 -0
  131. package/dist/Toolbar.js +187 -0
  132. package/dist/Tooltip.d.ts +296 -0
  133. package/dist/Tooltip.d.ts.map +1 -0
  134. package/dist/Tooltip.js +172 -0
  135. package/dist/Tree.d.ts +405 -0
  136. package/dist/Tree.d.ts.map +1 -0
  137. package/dist/Tree.js +333 -0
  138. package/dist/TreeGrid.d.ts +426 -0
  139. package/dist/TreeGrid.d.ts.map +1 -0
  140. package/dist/TreeGrid.js +308 -0
  141. package/dist/VisuallyHidden.d.ts +68 -0
  142. package/dist/VisuallyHidden.d.ts.map +1 -0
  143. package/dist/VisuallyHidden.js +44 -0
  144. package/dist/WindowSplitter.d.ts +336 -0
  145. package/dist/WindowSplitter.d.ts.map +1 -0
  146. package/dist/WindowSplitter.js +305 -0
  147. package/dist/index.d.ts +48 -0
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +48 -0
  150. package/package.json +47 -14
  151. package/src/HttpRouter.test.ts +0 -294
  152. package/src/HttpRouter.ts +0 -168
  153. package/src/Link.test.ts +0 -85
  154. package/src/Link.ts +0 -107
  155. package/src/index.ts +0 -2
  156. package/tsconfig.json +0 -6
package/dist/Switch.js ADDED
@@ -0,0 +1,110 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { RefSubject } from "@typed/fx";
3
+ import { html } from "@typed/template";
4
+ import * as Dom from "./Dom.js";
5
+ /**
6
+ */
7
+ export const StateSchema = Schema.Struct({ checked: Schema.Boolean });
8
+ /**
9
+ * Creates hydrated switch state independent of rendering.
10
+ * @remarks
11
+ * Domain code and tests can own the state while any renderer consumes it.
12
+ * The caller's Effect Scope owns the returned RefSubject.
13
+ * @example
14
+ * ```ts
15
+ * import { Effect } from "effect"
16
+ * import * as Switch from "@typed/ui/Switch"
17
+ *
18
+ * const program = Effect.gen(function* () {
19
+ * return yield* Switch.makeState({ checked: true })
20
+ * })
21
+ * ```
22
+ * @since 1.0.0
23
+ * @category State construction
24
+ */
25
+ export function makeState(initial = {}) {
26
+ return RefSubject.hydrate(StateSchema, { checked: initial.checked ?? false });
27
+ }
28
+ /**
29
+ * Sets the switch to the requested checked state.
30
+ * @example
31
+ * ```ts
32
+ * import { Effect } from "effect"
33
+ * import * as Switch from "@typed/ui/Switch"
34
+ *
35
+ * const program = Effect.gen(function* () {
36
+ * const state = yield* Switch.makeState()
37
+ * yield* Switch.setChecked(state, true)
38
+ * })
39
+ * ```
40
+ * @since 1.0.0
41
+ * @category State transitions
42
+ */
43
+ export function setChecked(state, checked) {
44
+ return RefSubject.update(state, (current) => ({ ...current, checked }));
45
+ }
46
+ /**
47
+ * Toggles the switch between checked and unchecked.
48
+ * @example
49
+ * ```ts
50
+ * import { Effect } from "effect"
51
+ * import * as Switch from "@typed/ui/Switch"
52
+ *
53
+ * const program = Effect.gen(function* () {
54
+ * const state = yield* Switch.makeState({ checked: true })
55
+ * yield* Switch.toggle(state)
56
+ * })
57
+ * ```
58
+ * @since 1.0.0
59
+ * @category State transitions
60
+ */
61
+ export function toggle(state) {
62
+ return RefSubject.update(state, (current) => ({ ...current, checked: !current.checked }));
63
+ }
64
+ function internalProps(options) {
65
+ return ({ property }) => ({
66
+ type: "button",
67
+ role: "switch",
68
+ "aria-checked": RefSubject.map(options.state, (state) => state.checked),
69
+ "?disabled": property("disabled", false),
70
+ onclick: toggle(options.state),
71
+ ref: options.state,
72
+ });
73
+ }
74
+ /**
75
+ * Renders a button-backed ARIA switch.
76
+ * @remarks
77
+ * The component combines native button activation with a renderer-independent
78
+ * boolean state and real DOM click events.
79
+ * Running the Fx owns listener/state subscriptions in its Effect Scope. A
80
+ * custom host must preserve button type, role, `aria-checked`, click handler,
81
+ * and the single hydration ref owner.
82
+ * @example
83
+ * ```ts
84
+ * import { RefSubject } from "@typed/fx";
85
+ * import { html } from "@typed/template";
86
+ * import { component } from "@typed/template";
87
+ * import * as Switch from "@typed/ui/Switch";
88
+ *
89
+ * export const PreviewSetting = component(function* () {
90
+ * const state = yield* Switch.makeState({ checked: true });
91
+ * const status = RefSubject.map(state, ({ checked }) => checked ? "On" : "Off");
92
+ * return html`<section>
93
+ * ${Switch.Switch({
94
+ * state,
95
+ * content: "Show live preview",
96
+ * props: { class: "preview-switch", "aria-describedby": "preview-setting-help" },
97
+ * })}
98
+ * <span aria-hidden="true">${status}</span>
99
+ * <p id="preview-setting-help">Updates the preview while you edit.</p>
100
+ * </section>`;
101
+ * });
102
+ * ```
103
+ * @since 1.0.0
104
+ * @category Native controls
105
+ */
106
+ export function Switch(options, host) {
107
+ return Dom.renderHost()(options, host, internalProps(options), options.content, (props, content) => {
108
+ return html `<button ...${props}>${content}</button>`;
109
+ });
110
+ }
package/dist/Tab.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Compatibility entrypoint for the Tabs API.
3
+ *
4
+ * @remarks
5
+ * Importing from `@typed/ui/Tab` exposes the same declarations as `@typed/ui/Tabs`; it does not
6
+ * create a second state model or renderer. Prefer whichever public specifier matches the surrounding
7
+ * codebase, and use one shared Tabs state across List, Tab, and Panel.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import * as Effect from "effect/Effect";
12
+ * import * as Tab from "@typed/ui/Tab";
13
+ *
14
+ * const program = Effect.scoped(
15
+ * Effect.gen(function* () {
16
+ * const state = yield* Tab.makeState({ selectedId: "overview" });
17
+ * return yield* state;
18
+ * }),
19
+ * );
20
+ * ```
21
+ * @since 1.0.0
22
+ * @category modules
23
+ * @packageDocumentation
24
+ */
25
+ export * from "./Tabs.js";
26
+ //# sourceMappingURL=Tab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../src/Tab.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,cAAc,WAAW,CAAC"}
package/dist/Tab.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Compatibility entrypoint for the Tabs API.
3
+ *
4
+ * @remarks
5
+ * Importing from `@typed/ui/Tab` exposes the same declarations as `@typed/ui/Tabs`; it does not
6
+ * create a second state model or renderer. Prefer whichever public specifier matches the surrounding
7
+ * codebase, and use one shared Tabs state across List, Tab, and Panel.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import * as Effect from "effect/Effect";
12
+ * import * as Tab from "@typed/ui/Tab";
13
+ *
14
+ * const program = Effect.scoped(
15
+ * Effect.gen(function* () {
16
+ * const state = yield* Tab.makeState({ selectedId: "overview" });
17
+ * return yield* state;
18
+ * }),
19
+ * );
20
+ * ```
21
+ * @since 1.0.0
22
+ * @category modules
23
+ * @packageDocumentation
24
+ */
25
+ export * from "./Tabs.js";
package/dist/Tabs.d.ts ADDED
@@ -0,0 +1,411 @@
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
+ * Learn the interaction in the [Tabs guide](/explore/ui-tabs).
12
+ *
13
+ * @since 1.0.0
14
+ * @category modules
15
+ * @packageDocumentation
16
+ */
17
+ import * as Effect from "effect/Effect";
18
+ import type * as Scope from "effect/Scope";
19
+ import * as Schema from "effect/Schema";
20
+ import type { Fx } from "@typed/fx/Fx";
21
+ import { RefSubject } from "@typed/fx";
22
+ import { EventHandler, type Renderable, type RenderEvent, type RenderTemplate } from "@typed/template";
23
+ import * as Collection from "./Collection.js";
24
+ import * as Composite from "./Composite.js";
25
+ import * as Dom from "./Dom.js";
26
+ import type { HostResult } from "./Dom/Types.js";
27
+ /**
28
+ * Controls whether moving focus also selects a tab.
29
+ *
30
+ * @remarks
31
+ * The public model lets custom composites reuse Tabs's deterministic policy without copying an
32
+ * internal shape.
33
+ *
34
+ * @since 1.0.0
35
+ * @category Panel activation policy
36
+ */
37
+ export type ActivationMode = "automatic" | "manual";
38
+ /**
39
+ * Supported composite movement axes.
40
+ *
41
+ * @remarks
42
+ * The public model lets custom composites reuse Tabs's deterministic policy without copying an
43
+ * internal shape.
44
+ *
45
+ * @since 1.0.0
46
+ * @category Tab navigation
47
+ */
48
+ export type Orientation = "horizontal" | "vertical";
49
+ /**
50
+ * The visible panel selection, focused tab identity, and activation policy.
51
+ * Manual activation allows `activeId` to differ from `selectedId` until the user commits.
52
+ *
53
+ * @since 1.0.0
54
+ * @category Selection and focus
55
+ */
56
+ export interface State extends Omit<Composite.State, "orientation"> {
57
+ /**
58
+ * Axis used to interpret Arrow-key movement.
59
+ * @since 1.0.0
60
+ * @category Keyboard navigation
61
+ */
62
+ readonly orientation: Orientation;
63
+ /**
64
+ * Id whose value is currently selected.
65
+ * @since 1.0.0
66
+ * @category Panel selection
67
+ */
68
+ readonly selectedId: string;
69
+ /**
70
+ * Id currently active for keyboard navigation; null means no active item.
71
+ * @since 1.0.0
72
+ * @category Keyboard focus
73
+ */
74
+ readonly activeId: string;
75
+ /**
76
+ * Whether tab focus also selects automatically or waits for explicit activation.
77
+ * @since 1.0.0
78
+ * @category Panel activation policy
79
+ */
80
+ readonly activationMode: ActivationMode;
81
+ }
82
+ /**
83
+ * Initial Tabs values. The caller supplies value; activeId defaults to value, activation is
84
+ * automatic, orientation horizontal, and loop true.
85
+ *
86
+ * @since 1.0.0
87
+ * @category Selection and focus
88
+ */
89
+ export interface InitialState {
90
+ /**
91
+ * Id whose value is currently selected.
92
+ * @since 1.0.0
93
+ * @category Panel selection
94
+ */
95
+ readonly selectedId: string;
96
+ /**
97
+ * Id currently active for keyboard navigation; null means no active item.
98
+ * @since 1.0.0
99
+ * @category Keyboard focus
100
+ */
101
+ readonly activeId?: string;
102
+ /**
103
+ * Whether tab focus also selects automatically or waits for explicit activation.
104
+ * @since 1.0.0
105
+ * @category Panel activation policy
106
+ */
107
+ readonly activationMode?: ActivationMode;
108
+ /**
109
+ * Axis used to interpret Arrow-key movement.
110
+ * @since 1.0.0
111
+ * @category Keyboard navigation
112
+ */
113
+ readonly orientation?: Orientation;
114
+ /**
115
+ * Whether movement wraps between the first and last enabled items.
116
+ * @since 1.0.0
117
+ * @category Keyboard navigation
118
+ */
119
+ readonly loop?: boolean;
120
+ /**
121
+ * Whether horizontal Arrow-key meaning is reversed for right-to-left layout.
122
+ * @since 1.0.0
123
+ * @category Keyboard navigation
124
+ */
125
+ readonly rtl?: boolean;
126
+ }
127
+ /**
128
+ * Effect Schema used by makeState to encode, decode, and hydrate Tabs state.
129
+ *
130
+ * @remarks
131
+ * @example
132
+ * ```ts
133
+ * import * as Schema from "effect/Schema";
134
+ * import * as Tabs from "@typed/ui/Tabs";
135
+ *
136
+ * const decodeState = Schema.decodeUnknownEffect(Tabs.StateSchema);
137
+ * ```
138
+ * @since 1.0.0
139
+ * @category Selection and focus
140
+ */
141
+ export declare const StateSchema: Schema.Struct<{
142
+ readonly selectedId: Schema.String;
143
+ readonly activeId: Schema.String;
144
+ readonly activationMode: Schema.Literals<readonly ["automatic", "manual"]>;
145
+ readonly orientation: Schema.Literals<readonly ["horizontal", "vertical"]>;
146
+ readonly loop: Schema.Boolean;
147
+ readonly rtl: Schema.Boolean;
148
+ readonly virtualFocus: Schema.Boolean;
149
+ }>;
150
+ /**
151
+ * Creates hydrated Tabs state. The caller supplies value; activeId defaults to value, activation
152
+ * is automatic, orientation horizontal, and loop true.
153
+ *
154
+ * @remarks
155
+ * The returned Effect creates the RefSubject when run. That state is renderer-independent;
156
+ * collection registrations belong to the separate Scope that runs register or ref, not to state
157
+ * creation.
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * import * as Effect from "effect/Effect";
162
+ * import * as Tabs from "@typed/ui/Tabs";
163
+ *
164
+ * const program = Effect.scoped(
165
+ * Effect.gen(function* () {
166
+ * const state = yield* Tabs.makeState({ selectedId: "overview" });
167
+ * const collection = yield* Tabs.makeCollection();
168
+ * return { state: yield* state, collection: yield* collection };
169
+ * }),
170
+ * );
171
+ * ```
172
+ * @since 1.0.0
173
+ * @category Selection and focus
174
+ */
175
+ export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
176
+ readonly selectedId: string;
177
+ readonly activeId: string;
178
+ readonly activationMode: "automatic" | "manual";
179
+ readonly orientation: "horizontal" | "vertical";
180
+ readonly loop: boolean;
181
+ readonly rtl: boolean;
182
+ readonly virtualFocus: boolean;
183
+ }, Schema.SchemaError, never, never>, never, Scope.Scope>;
184
+ /**
185
+ * Creates a scoped Collection for Tabs items.
186
+ *
187
+ * @remarks
188
+ * The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
189
+ * owned by the Scope that runs register, independently of this construction Effect.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * import * as Effect from "effect/Effect";
194
+ * import * as Tabs from "@typed/ui/Tabs";
195
+ *
196
+ * const program = Effect.scoped(
197
+ * Effect.gen(function* () {
198
+ * const collection = yield* Tabs.makeCollection();
199
+ * return yield* collection;
200
+ * }),
201
+ * );
202
+ * ```
203
+ * @since 1.0.0
204
+ * @category Tab registration
205
+ */
206
+ export declare const makeCollection: (initial?: Collection.State<string, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<string, Element>, never, never>, never, Scope.Scope>;
207
+ /**
208
+ * Selects a tab and makes it the active roving-focus item.
209
+ *
210
+ * @remarks
211
+ * The operation exposes Tabs's transition directly so callers can compose it in Effect programs
212
+ * and native event handlers.
213
+ *
214
+ * @since 1.0.0
215
+ * @category Panel activation
216
+ */
217
+ export declare function select<E, R>(state: RefSubject.RefSubject<State, E, R>, selectedId: string): Effect.Effect<State, E, R>;
218
+ /**
219
+ * Moves activeId through registered tabs without selecting under manual activation.
220
+ *
221
+ * @remarks
222
+ * The operation exposes Tabs's transition directly so callers can compose it in Effect programs
223
+ * and native event handlers.
224
+ *
225
+ * @since 1.0.0
226
+ * @category Tab navigation
227
+ */
228
+ export declare function move<E, R>(state: RefSubject.RefSubject<State, E, R>, items: readonly Collection.Item[], direction: Composite.Move): Effect.Effect<State, E, R>;
229
+ /**
230
+ * Inputs accepted by Tabs.List in addition to the shared DOM host options.
231
+ *
232
+ * @since 1.0.0
233
+ * @category Tab list
234
+ */
235
+ export interface ListOptions extends Dom.HostOptions<HTMLDivElement> {
236
+ /**
237
+ * Renderer-independent RefSubject state consumed by this component or operation.
238
+ * @since 1.0.0
239
+ * @category State connection
240
+ */
241
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
242
+ /**
243
+ * Renderable child content for the component host.
244
+ * @since 1.0.0
245
+ * @category Rendered content
246
+ */
247
+ readonly content: Renderable.Any;
248
+ /**
249
+ * Accessible label rendered through aria-label.
250
+ * @since 1.0.0
251
+ * @category Accessible naming
252
+ */
253
+ readonly label?: Renderable.Any<string | null | undefined>;
254
+ /**
255
+ * Renderable tab content placed inside the tablist host.
256
+ * @since 1.0.0
257
+ * @category Item registration
258
+ */
259
+ readonly items?: readonly Collection.Item[];
260
+ /**
261
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
262
+ * @since 1.0.0
263
+ * @category Item registration
264
+ */
265
+ readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
266
+ }
267
+ declare function listInternalProps<const Options extends ListOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
268
+ readonly role: "tablist";
269
+ readonly "aria-label": Exclude<Dom.Property<Options, "label">, Dom.Nullish> | undefined;
270
+ readonly "aria-orientation": RefSubject.Computed<Orientation, Schema.SchemaError, never>;
271
+ readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
272
+ readonly ref: RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>;
273
+ };
274
+ type ListInternalProps<Options extends ListOptions> = ReturnType<ReturnType<typeof listInternalProps<Options>>>;
275
+ /**
276
+ * Renders the tablist and applies orientation-aware movement plus Enter/Space activation in manual
277
+ * mode.
278
+ *
279
+ * @remarks
280
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
281
+ * collection registrations only when rendered. The rendering Scope removes those resources;
282
+ * unrelated nodes and attributes remain caller-owned.
283
+ *
284
+ * @since 1.0.0
285
+ * @category Tab list
286
+ */
287
+ 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>;
288
+ /**
289
+ * Inputs accepted by Tabs.Tab in addition to the shared DOM host options.
290
+ *
291
+ * @since 1.0.0
292
+ * @category Tab controls
293
+ */
294
+ export interface TabOptions extends Dom.HostOptions<HTMLButtonElement> {
295
+ /**
296
+ * Renderer-independent RefSubject state consumed by this component or operation.
297
+ * @since 1.0.0
298
+ * @category State connection
299
+ */
300
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
301
+ /**
302
+ * Stable id used for collection identity and ARIA relationships.
303
+ * @since 1.0.0
304
+ * @category Identity and relationships
305
+ */
306
+ readonly id: string;
307
+ /**
308
+ * Panel id emitted through the tab's aria-controls relationship.
309
+ * @since 1.0.0
310
+ * @category Identity and relationships
311
+ */
312
+ readonly panelId: string;
313
+ /**
314
+ * Renderable child content for the component host.
315
+ * @since 1.0.0
316
+ * @category Rendered content
317
+ */
318
+ readonly content: Renderable.Any;
319
+ /**
320
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
321
+ * @since 1.0.0
322
+ * @category Item registration
323
+ */
324
+ readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
325
+ /**
326
+ * Flag used by collection movement and widget handlers to skip activation by default.
327
+ * @since 1.0.0
328
+ * @category Availability
329
+ */
330
+ readonly disabled?: boolean;
331
+ }
332
+ declare function tabInternalProps<const Options extends TabOptions>(options: Options): () => {
333
+ readonly id: string;
334
+ readonly type: "button";
335
+ readonly role: "tab";
336
+ readonly "aria-controls": string;
337
+ readonly "aria-selected": RefSubject.Computed<boolean, Schema.SchemaError, never>;
338
+ readonly "aria-disabled": boolean;
339
+ readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
340
+ readonly onclick: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
341
+ readonly onfocus: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
342
+ readonly ref: ((element: Element & HTMLButtonElement & RefSubject.HydrationElement) => Effect.Effect<void, any, any>) | undefined;
343
+ };
344
+ type TabInternalProps<Options extends TabOptions> = ReturnType<ReturnType<typeof tabInternalProps<Options>>>;
345
+ /**
346
+ * Renders and optionally registers a tab with stable aria-controls, selected state, and roving
347
+ * tabindex.
348
+ *
349
+ * @remarks
350
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
351
+ * collection registrations only when rendered. The rendering Scope removes those resources;
352
+ * unrelated nodes and attributes remain caller-owned.
353
+ *
354
+ * @since 1.0.0
355
+ * @category Tab controls
356
+ */
357
+ 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>;
358
+ /**
359
+ * Inputs accepted by Tabs.Panel in addition to the shared DOM host options.
360
+ *
361
+ * @since 1.0.0
362
+ * @category Panel visibility
363
+ */
364
+ export interface PanelOptions extends Dom.HostOptions<HTMLDivElement> {
365
+ /**
366
+ * Renderer-independent RefSubject state consumed by this component or operation.
367
+ * @since 1.0.0
368
+ * @category State connection
369
+ */
370
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
371
+ /**
372
+ * Stable id used for collection identity and ARIA relationships.
373
+ * @since 1.0.0
374
+ * @category Identity and relationships
375
+ */
376
+ readonly id: string;
377
+ /**
378
+ * Tab id emitted through the panel's aria-labelledby relationship.
379
+ * @since 1.0.0
380
+ * @category Identity and relationships
381
+ */
382
+ readonly tabId: string;
383
+ /**
384
+ * Renderable child content for the component host.
385
+ * @since 1.0.0
386
+ * @category Rendered content
387
+ */
388
+ readonly content: Renderable.Any;
389
+ }
390
+ declare function panelInternalProps<const Options extends PanelOptions>(options: Options): () => {
391
+ readonly id: string;
392
+ readonly role: "tabpanel";
393
+ readonly "aria-labelledby": string;
394
+ readonly tabindex: 0;
395
+ readonly "?hidden": RefSubject.Computed<boolean, Schema.SchemaError, never>;
396
+ };
397
+ type PanelInternalProps<Options extends PanelOptions> = ReturnType<ReturnType<typeof panelInternalProps<Options>>>;
398
+ /**
399
+ * Renders a labelled tabpanel and hides it reactively when its tab is not selected.
400
+ *
401
+ * @remarks
402
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
403
+ * collection registrations only when rendered. The rendering Scope removes those resources;
404
+ * unrelated nodes and attributes remain caller-owned.
405
+ *
406
+ * @since 1.0.0
407
+ * @category Panel visibility
408
+ */
409
+ 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>;
410
+ export {};
411
+ //# sourceMappingURL=Tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../src/Tabs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,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,iBAAi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