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

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 (128) hide show
  1. package/dist/Alert.d.ts +35 -41
  2. package/dist/Alert.d.ts.map +1 -1
  3. package/dist/Alert.js +23 -20
  4. package/dist/Button.d.ts +34 -78
  5. package/dist/Button.d.ts.map +1 -1
  6. package/dist/Button.js +16 -12
  7. package/dist/Carousel.d.ts +35 -236
  8. package/dist/Carousel.d.ts.map +1 -1
  9. package/dist/Carousel.js +13 -136
  10. package/dist/Checkbox.d.ts +55 -90
  11. package/dist/Checkbox.d.ts.map +1 -1
  12. package/dist/Checkbox.js +44 -38
  13. package/dist/Collection.d.ts +15 -15
  14. package/dist/Collection.js +7 -7
  15. package/dist/Combobox.d.ts +38 -187
  16. package/dist/Combobox.d.ts.map +1 -1
  17. package/dist/Combobox.js +9 -80
  18. package/dist/Component.d.ts +30 -24
  19. package/dist/Component.d.ts.map +1 -1
  20. package/dist/Component.js +23 -12
  21. package/dist/Composite.d.ts +50 -50
  22. package/dist/Composite.js +20 -20
  23. package/dist/Dialog.d.ts +34 -34
  24. package/dist/Dialog.d.ts.map +1 -1
  25. package/dist/Dialog.js +16 -14
  26. package/dist/Disclosure.d.ts +15 -15
  27. package/dist/Disclosure.js +6 -6
  28. package/dist/Dom/Events.d.ts +4 -4
  29. package/dist/Dom/Events.js +4 -4
  30. package/dist/Dom/Props.d.ts +9 -9
  31. package/dist/Dom/Props.js +4 -4
  32. package/dist/Dom/Refs.d.ts +2 -2
  33. package/dist/Dom/Refs.js +1 -1
  34. package/dist/Dom/Render.d.ts +2 -2
  35. package/dist/Dom/Render.js +2 -2
  36. package/dist/Dom/Types.d.ts +33 -33
  37. package/dist/Dom/index.d.ts +5 -5
  38. package/dist/Dom/index.d.ts.map +1 -1
  39. package/dist/Dom/index.js +4 -4
  40. package/dist/Dom.d.ts +1 -1
  41. package/dist/Dom.js +1 -1
  42. package/dist/Focusable.d.ts +5 -5
  43. package/dist/Focusable.js +1 -1
  44. package/dist/Form.d.ts +565 -533
  45. package/dist/Form.d.ts.map +1 -1
  46. package/dist/Form.js +350 -195
  47. package/dist/Grid.d.ts +39 -220
  48. package/dist/Grid.d.ts.map +1 -1
  49. package/dist/Grid.js +12 -107
  50. package/dist/Group.d.ts +50 -69
  51. package/dist/Group.d.ts.map +1 -1
  52. package/dist/Group.js +33 -25
  53. package/dist/Heading.d.ts +41 -40
  54. package/dist/Heading.d.ts.map +1 -1
  55. package/dist/Heading.js +26 -16
  56. package/dist/Hovercard.d.ts +18 -18
  57. package/dist/Hovercard.js +6 -6
  58. package/dist/HttpRouter.d.ts +3 -3
  59. package/dist/HttpRouter.js +5 -5
  60. package/dist/Link.d.ts +17 -21
  61. package/dist/Link.d.ts.map +1 -1
  62. package/dist/Link.js +11 -0
  63. package/dist/Listbox.d.ts +31 -163
  64. package/dist/Listbox.d.ts.map +1 -1
  65. package/dist/Listbox.js +9 -80
  66. package/dist/Menu.d.ts +67 -376
  67. package/dist/Menu.d.ts.map +1 -1
  68. package/dist/Menu.js +17 -179
  69. package/dist/Menubar.d.ts +24 -142
  70. package/dist/Menubar.d.ts.map +1 -1
  71. package/dist/Menubar.js +8 -66
  72. package/dist/Meter.d.ts +72 -132
  73. package/dist/Meter.d.ts.map +1 -1
  74. package/dist/Meter.js +35 -42
  75. package/dist/NativeDetails.d.ts +1 -1
  76. package/dist/NativeDetails.js +1 -1
  77. package/dist/NativeDialog.d.ts +7 -5
  78. package/dist/NativeDialog.d.ts.map +1 -1
  79. package/dist/NativeDialog.js +42 -4
  80. package/dist/NativePopover.d.ts +6 -4
  81. package/dist/NativePopover.d.ts.map +1 -1
  82. package/dist/NativePopover.js +43 -5
  83. package/dist/Popover.d.ts +18 -19
  84. package/dist/Popover.d.ts.map +1 -1
  85. package/dist/Popover.js +7 -8
  86. package/dist/RadioGroup.d.ts +86 -188
  87. package/dist/RadioGroup.d.ts.map +1 -1
  88. package/dist/RadioGroup.js +55 -105
  89. package/dist/Role.d.ts +4 -4
  90. package/dist/Role.js +1 -1
  91. package/dist/Select.d.ts +109 -220
  92. package/dist/Select.d.ts.map +1 -1
  93. package/dist/Select.js +67 -117
  94. package/dist/Separator.d.ts +30 -26
  95. package/dist/Separator.d.ts.map +1 -1
  96. package/dist/Separator.js +16 -10
  97. package/dist/Slider.d.ts +64 -111
  98. package/dist/Slider.d.ts.map +1 -1
  99. package/dist/Slider.js +47 -42
  100. package/dist/SpinButton.d.ts +64 -111
  101. package/dist/SpinButton.d.ts.map +1 -1
  102. package/dist/SpinButton.js +47 -42
  103. package/dist/Storybook.d.ts +2 -2
  104. package/dist/Storybook.js +1 -1
  105. package/dist/Switch.d.ts +52 -91
  106. package/dist/Switch.d.ts.map +1 -1
  107. package/dist/Switch.js +30 -36
  108. package/dist/Tabs.d.ts +44 -224
  109. package/dist/Tabs.d.ts.map +1 -1
  110. package/dist/Tabs.js +10 -94
  111. package/dist/Toolbar.d.ts +24 -142
  112. package/dist/Toolbar.d.ts.map +1 -1
  113. package/dist/Toolbar.js +8 -66
  114. package/dist/Tooltip.d.ts +20 -20
  115. package/dist/Tooltip.js +6 -6
  116. package/dist/Tree.d.ts +43 -229
  117. package/dist/Tree.d.ts.map +1 -1
  118. package/dist/Tree.js +12 -113
  119. package/dist/TreeGrid.d.ts +45 -264
  120. package/dist/TreeGrid.d.ts.map +1 -1
  121. package/dist/TreeGrid.js +13 -125
  122. package/dist/VisuallyHidden.d.ts +41 -27
  123. package/dist/VisuallyHidden.d.ts.map +1 -1
  124. package/dist/VisuallyHidden.js +27 -10
  125. package/dist/WindowSplitter.d.ts +68 -108
  126. package/dist/WindowSplitter.d.ts.map +1 -1
  127. package/dist/WindowSplitter.js +106 -23
  128. package/package.json +9 -8
@@ -1,15 +1,12 @@
1
1
  /**
2
- * RadioGroup keeps a selected value and active id in explicit state. Arrow movement skips disabled
3
- * registered items, updates selection, and moves focus; each item renders a real radio input with
4
- * ARIA state.
2
+ * Native radio selection with optional registered keyboard movement.
3
+ * Choice values, element IDs, and shared native names have distinct responsibilities.
5
4
  *
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.
5
+ * Read the [RadioGroup guide](/explore/ui-radio-group) for a complete example.
10
6
  *
7
+ * [APG interaction reference](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
11
8
  * @since 1.0.0
12
- * @category modules
9
+ * @category Overview
13
10
  * @packageDocumentation
14
11
  */
15
12
  import * as Effect from "effect/Effect";
@@ -23,15 +20,9 @@ import * as Dom from "./Dom.js";
23
20
  * Effect Schema used by makeState to encode, decode, and hydrate RadioGroup state.
24
21
  *
25
22
  * @remarks
26
- * ## Why
27
- *
28
23
  * A public schema makes hydration and serialized state use the same runtime validation as direct
29
24
  * construction.
30
25
  *
31
- * ## Ownership and lifetime
32
- *
33
- * This declaration is data or schema metadata and acquires no resources.
34
- *
35
26
  * @example
36
27
  * ```ts
37
28
  * import * as Schema from "effect/Schema";
@@ -40,7 +31,7 @@ import * as Dom from "./Dom.js";
40
31
  * const decodeState = Schema.decodeUnknownEffect(RadioGroup.StateSchema);
41
32
  * ```
42
33
  * @since 1.0.0
43
- * @category schemas
34
+ * @category Hydration schemas
44
35
  */
45
36
  export const StateSchema = Schema.Struct({
46
37
  value: Schema.String,
@@ -51,19 +42,13 @@ export const StateSchema = Schema.Struct({
51
42
  virtualFocus: Schema.Boolean,
52
43
  });
53
44
  /**
54
- * Creates hydrated RadioGroup state. The caller supplies value; activeId defaults to that value
55
- * and loop defaults true.
45
+ * Creates hydrated radio selection with a required value, null active ID, and looping enabled by
46
+ * default.
56
47
  *
57
48
  * @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
- * The returned Effect creates the RefSubject when run. That state is renderer-independent;
65
- * collection registrations belong to the separate Scope that runs register or ref, not to state
66
- * creation.
49
+ * The selected value and element ID are separate. The first keyboard movement can resolve the
50
+ * selected value against the mounted collection. Creation requires Scope; renderers borrow the
51
+ * returned subject.
67
52
  *
68
53
  * @example
69
54
  * ```ts
@@ -79,7 +64,7 @@ export const StateSchema = Schema.Struct({
79
64
  * );
80
65
  * ```
81
66
  * @since 1.0.0
82
- * @category constructors
67
+ * @category State construction
83
68
  */
84
69
  export function makeState(initial) {
85
70
  return RefSubject.hydrate(StateSchema, {
@@ -95,12 +80,8 @@ export function makeState(initial) {
95
80
  * Creates a scoped Collection for RadioGroup items.
96
81
  *
97
82
  * @remarks
98
- * ## Why
99
- *
100
83
  * State and collection ownership can be composed and tested independently from any renderer.
101
84
  *
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,17 @@ export function makeState(initial) {
117
98
  * );
118
99
  * ```
119
100
  * @since 1.0.0
120
- * @category constructors
101
+ * @category State construction
121
102
  */
122
103
  export const makeCollection = Collection.makeState;
123
104
  /**
124
- * Sets selected value and activeId to the same registered radio id.
105
+ * Sets the selected value and optionally the active element ID.
125
106
  *
126
107
  * @remarks
127
- * ## Why
128
- *
129
- * The operation exposes RadioGroup's transition directly so callers can compose it in Effect
130
- * programs and native event handlers.
131
- *
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 { setValue } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
140
- * runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Inside the linked Effect
141
- * program invoke `yield* setValue(state, "phone", "phone")`, then read state to observe the checked
142
- * value and active roving-focus id update together.
108
+ * Omitting activeId preserves the previous active ID. This state update does not look up an
109
+ * item, move DOM focus, or verify that the value belongs to the group.
143
110
  * @since 1.0.0
144
- * @category combinators
111
+ * @category State transitions
145
112
  */
146
113
  export function setValue(state, value, activeId) {
147
114
  return RefSubject.update(state, (current) => ({
@@ -182,28 +149,40 @@ function rootInternalProps(options) {
182
149
  });
183
150
  }
184
151
  /**
185
- * Renders the radiogroup and maps Arrow keys to selection and focus movement.
152
+ * Renders a named radiogroup around native radio items.
186
153
  *
187
154
  * @remarks
188
- * ## Why
189
- *
190
- * The component applies the family behavior while leaving callers free to supply a custom host
191
- * through the shared DOM boundary.
155
+ * Pass the same state to every item and the same native name to items in one group. With a
156
+ * collection, the root handles vertical arrow movement and Home/End, skips disabled
157
+ * registrations, updates selection, and moves real focus. Without a collection, native input
158
+ * behavior remains the keyboard boundary.
192
159
  *
193
- * ## Ownership and lifetime
194
- *
195
- * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
196
- * collection registrations only when rendered. The rendering Scope removes those resources;
197
- * unrelated nodes and attributes remain caller-owned.
198
- *
199
- * ## Example
160
+ * @example
161
+ * ```ts
162
+ * import { html } from "@typed/template";
163
+ * import { component } from "@typed/ui/Component";
164
+ * import * as RadioGroup from "@typed/ui/RadioGroup";
200
165
  *
201
- * Import with `import { Root } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
202
- * runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Replace the linked program's
203
- * final snapshot read with `Root({ state, label: "Contact method", content: "Choices" })`; render
204
- * that Fx before the same Scope closes.
166
+ * export const DeliveryChoice = component(function* () {
167
+ * const state = yield* RadioGroup.makeState({ value: "standard" });
168
+ * const collection = yield* RadioGroup.makeCollection();
169
+ * return RadioGroup.Root({
170
+ * state,
171
+ * collection,
172
+ * label: "Delivery speed",
173
+ * content: html`
174
+ * <label>${RadioGroup.Item({
175
+ * state, collection, id: "delivery-standard", name: "delivery", value: "standard",
176
+ * })} Standard delivery</label>
177
+ * <label>${RadioGroup.Item({
178
+ * state, collection, id: "delivery-express", name: "delivery", value: "express",
179
+ * })} Express delivery</label>
180
+ * `,
181
+ * });
182
+ * });
183
+ * ```
205
184
  * @since 1.0.0
206
- * @category components
185
+ * @category Native controls
207
186
  */
208
187
  export function Root(options, host) {
209
188
  return Dom.renderHost()(options, host, rootInternalProps(options), options.content, (props, content) => {
@@ -238,54 +217,25 @@ function itemInternalProps(options) {
238
217
  });
239
218
  }
240
219
  /**
241
- * Renders and optionally registers a native radio input synchronized with selected value.
220
+ * Renders one native radio input and optionally registers it for group navigation.
242
221
  *
243
222
  * @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
- * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
252
- * collection registrations only when rendered. The rendering Scope removes those resources;
253
- * unrelated nodes and attributes remain caller-owned.
254
- *
255
- * ## Example
256
- *
257
- * Import with `import { Item } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
258
- * runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Replace the linked program's
259
- * final snapshot read with `Item({ state, id: "email", value: "email", name: "contact" })`; render
260
- * that Fx before the same Scope closes.
223
+ * id identifies the element; value identifies the choice; name establishes the native browser
224
+ * group. A native change updates the selected value and active ID. Supply a wrapping label or an
225
+ * external label linked to id. Registration ends with the rendered Scope.
261
226
  * @since 1.0.0
262
- * @category components
227
+ * @category Native controls
263
228
  */
264
229
  export function Item(options, host) {
265
230
  return Dom.renderHost()(options, host, itemInternalProps(options), "", (props) => html `<input ...${props} />`);
266
231
  }
267
232
  /**
268
- * Consumer-facing alias of the canonical RadioGroup component with identical behavior and
269
- * lifetime.
233
+ * Alias of Root.
270
234
  *
271
235
  * @remarks
272
- * ## Why
273
- *
274
- * The component applies the family behavior while leaving callers free to supply a custom host
275
- * through the shared DOM boundary.
276
- *
277
- * ## Ownership and lifetime
278
- *
279
- * The alias acquires nothing. Rendering it has exactly the canonical component's Scope and DOM
280
- * ownership contract.
281
- *
282
- * ## Example
283
- *
284
- * Import with `import { RadioGroup } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
285
- * runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Replace the linked program's
286
- * final snapshot read with `RadioGroup({ state, label: "Contact method", content: "Choices" })`;
287
- * render that Fx before the same Scope closes.
236
+ * The alias exposes the same native-input grouping and optional collection behavior; it introduces
237
+ * no additional state or focus policy.
288
238
  * @since 1.0.0
289
- * @category components
239
+ * @category Native controls
290
240
  */
291
241
  export const RadioGroup = Root;
package/dist/Role.d.ts CHANGED
@@ -12,7 +12,7 @@ import type { HostResult } from "./Dom/Types.js";
12
12
  * ## Ownership and lifetime
13
13
  * The model acquires no resources; dynamic values follow the rendered Scope.
14
14
  * @since 1.0.0
15
- * @category models
15
+ * @category Semantic hosts
16
16
  */
17
17
  export interface RoleOptions extends Dom.HostOptions<HTMLDivElement> {
18
18
  /** Content rendered inside the semantic host.
@@ -22,7 +22,7 @@ export interface RoleOptions extends Dom.HostOptions<HTMLDivElement> {
22
22
  * ## Ownership and lifetime
23
23
  * Dynamic content follows the component Scope.
24
24
  * @since 1.0.0
25
- * @category content
25
+ * @category Rendered content
26
26
  */
27
27
  readonly content: Renderable.Any;
28
28
  /** The explicit ARIA role.
@@ -32,7 +32,7 @@ export interface RoleOptions extends Dom.HostOptions<HTMLDivElement> {
32
32
  * ## Ownership and lifetime
33
33
  * The reflected value retains no resources.
34
34
  * @since 1.0.0
35
- * @category accessibility
35
+ * @category Semantic roles
36
36
  */
37
37
  readonly role: Renderable.Any<string | null | undefined>;
38
38
  }
@@ -57,7 +57,7 @@ type RoleInternalProps<Options extends RoleOptions> = ReturnType<typeof internal
57
57
  * const status = Role({ role: "status", content: "Ready" })
58
58
  * ```
59
59
  * @since 1.0.0
60
- * @category components
60
+ * @category Semantic hosts
61
61
  */
62
62
  export declare function Role<const Options extends RoleOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, RoleInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
63
63
  export {};
package/dist/Role.js CHANGED
@@ -20,7 +20,7 @@ function internalProps({ property, }) {
20
20
  * const status = Role({ role: "status", content: "Ready" })
21
21
  * ```
22
22
  * @since 1.0.0
23
- * @category components
23
+ * @category Semantic hosts
24
24
  */
25
25
  export function Role(options, host) {
26
26
  return Dom.renderHost()(options, host, internalProps, options.content, (props, content) => html `<div ...${props}>${content}</div>`);