@typed/ui 1.0.0-beta.4 → 1.0.0-beta.6
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/README.md +53 -9
- package/dist/Alert.d.ts +78 -0
- package/dist/Alert.d.ts.map +1 -0
- package/dist/Alert.js +37 -0
- package/dist/Button.d.ts +144 -0
- package/dist/Button.d.ts.map +1 -0
- package/dist/Button.js +38 -0
- package/dist/Carousel.d.ts +547 -0
- package/dist/Carousel.d.ts.map +1 -0
- package/dist/Carousel.js +387 -0
- package/dist/Checkbox.d.ts +203 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox.js +140 -0
- package/dist/Collection.d.ts +254 -0
- package/dist/Collection.d.ts.map +1 -0
- package/dist/Collection.js +218 -0
- package/dist/Combobox.d.ts +516 -0
- package/dist/Combobox.d.ts.map +1 -0
- package/dist/Combobox.js +371 -0
- package/dist/Component.d.ts +127 -0
- package/dist/Component.d.ts.map +1 -0
- package/dist/Component.js +60 -0
- package/dist/Composite.d.ts +823 -0
- package/dist/Composite.d.ts.map +1 -0
- package/dist/Composite.js +615 -0
- package/dist/Dialog.d.ts +544 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +355 -0
- package/dist/Disclosure.d.ts +219 -0
- package/dist/Disclosure.d.ts.map +1 -0
- package/dist/Disclosure.js +128 -0
- package/dist/Dom/Events.d.ts +122 -0
- package/dist/Dom/Events.d.ts.map +1 -0
- package/dist/Dom/Events.js +192 -0
- package/dist/Dom/Props.d.ts +161 -0
- package/dist/Dom/Props.d.ts.map +1 -0
- package/dist/Dom/Props.js +110 -0
- package/dist/Dom/Refs.d.ts +58 -0
- package/dist/Dom/Refs.d.ts.map +1 -0
- package/dist/Dom/Refs.js +61 -0
- package/dist/Dom/Render.d.ts +59 -0
- package/dist/Dom/Render.d.ts.map +1 -0
- package/dist/Dom/Render.js +71 -0
- package/dist/Dom/Types.d.ts +570 -0
- package/dist/Dom/Types.d.ts.map +1 -0
- package/dist/Dom/Types.js +1 -0
- package/dist/Dom/index.d.ts +20 -0
- package/dist/Dom/index.d.ts.map +1 -0
- package/dist/Dom/index.js +8 -0
- package/dist/Dom.d.ts +14 -0
- package/dist/Dom.d.ts.map +1 -0
- package/dist/Dom.js +13 -0
- package/dist/Focusable.d.ts +85 -0
- package/dist/Focusable.d.ts.map +1 -0
- package/dist/Focusable.js +35 -0
- package/dist/Form.d.ts +1695 -0
- package/dist/Form.d.ts.map +1 -0
- package/dist/Form.js +987 -0
- package/dist/Grid.d.ts +569 -0
- package/dist/Grid.d.ts.map +1 -0
- package/dist/Grid.js +379 -0
- package/dist/Group.d.ts +147 -0
- package/dist/Group.d.ts.map +1 -0
- package/dist/Group.js +63 -0
- package/dist/Heading.d.ts +86 -0
- package/dist/Heading.d.ts.map +1 -0
- package/dist/Heading.js +48 -0
- package/dist/Hovercard.d.ts +297 -0
- package/dist/Hovercard.d.ts.map +1 -0
- package/dist/Hovercard.js +188 -0
- package/dist/HttpRouter.d.ts +129 -6
- package/dist/HttpRouter.d.ts.map +1 -1
- package/dist/HttpRouter.js +196 -53
- package/dist/Link.d.ts +67 -28
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +91 -37
- package/dist/Listbox.d.ts +437 -0
- package/dist/Listbox.d.ts.map +1 -0
- package/dist/Listbox.js +316 -0
- package/dist/Menu.d.ts +972 -0
- package/dist/Menu.d.ts.map +1 -0
- package/dist/Menu.js +731 -0
- package/dist/Menubar.d.ts +367 -0
- package/dist/Menubar.d.ts.map +1 -0
- package/dist/Menubar.js +265 -0
- package/dist/Meter.d.ts +217 -0
- package/dist/Meter.d.ts.map +1 -0
- package/dist/Meter.js +94 -0
- package/dist/NativeDetails.d.ts +41 -0
- package/dist/NativeDetails.d.ts.map +1 -0
- package/dist/NativeDetails.js +40 -0
- package/dist/NativeDialog.d.ts +64 -0
- package/dist/NativeDialog.d.ts.map +1 -0
- package/dist/NativeDialog.js +50 -0
- package/dist/NativePopover.d.ts +41 -0
- package/dist/NativePopover.d.ts.map +1 -0
- package/dist/NativePopover.js +46 -0
- package/dist/Popover.d.ts +241 -0
- package/dist/Popover.d.ts.map +1 -0
- package/dist/Popover.js +141 -0
- package/dist/RadioGroup.d.ts +432 -0
- package/dist/RadioGroup.d.ts.map +1 -0
- package/dist/RadioGroup.js +291 -0
- package/dist/Role.d.ts +64 -0
- package/dist/Role.d.ts.map +1 -0
- package/dist/Role.js +27 -0
- package/dist/Select.d.ts +529 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Select.js +407 -0
- package/dist/Separator.d.ts +54 -0
- package/dist/Separator.d.ts.map +1 -0
- package/dist/Separator.js +26 -0
- package/dist/Slider.d.ts +188 -0
- package/dist/Slider.d.ts.map +1 -0
- package/dist/Slider.js +96 -0
- package/dist/SpinButton.d.ts +188 -0
- package/dist/SpinButton.d.ts.map +1 -0
- package/dist/SpinButton.js +96 -0
- package/dist/Storybook.d.ts +76 -0
- package/dist/Storybook.d.ts.map +1 -0
- package/dist/Storybook.js +102 -0
- package/dist/Switch.d.ts +187 -0
- package/dist/Switch.d.ts.map +1 -0
- package/dist/Switch.js +116 -0
- package/dist/Tab.d.ts +26 -0
- package/dist/Tab.d.ts.map +1 -0
- package/dist/Tab.js +25 -0
- package/dist/Tabs.d.ts +591 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Tabs.js +346 -0
- package/dist/Toolbar.d.ts +366 -0
- package/dist/Toolbar.d.ts.map +1 -0
- package/dist/Toolbar.js +245 -0
- package/dist/Tooltip.d.ts +296 -0
- package/dist/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip.js +172 -0
- package/dist/Tree.d.ts +591 -0
- package/dist/Tree.d.ts.map +1 -0
- package/dist/Tree.js +434 -0
- package/dist/TreeGrid.d.ts +645 -0
- package/dist/TreeGrid.d.ts.map +1 -0
- package/dist/TreeGrid.js +420 -0
- package/dist/VisuallyHidden.d.ts +54 -0
- package/dist/VisuallyHidden.d.ts.map +1 -0
- package/dist/VisuallyHidden.js +27 -0
- package/dist/WindowSplitter.d.ts +376 -0
- package/dist/WindowSplitter.d.ts.map +1 -0
- package/dist/WindowSplitter.js +222 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -0
- package/package.json +45 -18
- package/src/HttpRouter.test.ts +0 -256
- package/src/HttpRouter.ts +0 -165
- package/src/Link.test.ts +0 -84
- package/src/Link.ts +0 -107
- package/src/index.ts +0 -2
|
@@ -0,0 +1,432 @@
|
|
|
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.
|
|
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
|
+
* Complete renderer-independent state for RadioGroup.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* ## Why
|
|
30
|
+
*
|
|
31
|
+
* Applications can inspect, update, and test RadioGroup 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
|
|
39
|
+
*
|
|
40
|
+
* Import with `import type { State } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
|
|
41
|
+
* runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Inside the linked program,
|
|
42
|
+
* `const snapshot: State = yield* state` exposes the checked value and roving-focus id.
|
|
43
|
+
* @since 1.0.0
|
|
44
|
+
* @category models
|
|
45
|
+
*/
|
|
46
|
+
export interface State extends Omit<Composite.State, "orientation"> {
|
|
47
|
+
/**
|
|
48
|
+
* Axis used to interpret Arrow-key movement.
|
|
49
|
+
* @since 1.0.0
|
|
50
|
+
* @category models
|
|
51
|
+
*/
|
|
52
|
+
readonly orientation: "vertical";
|
|
53
|
+
/**
|
|
54
|
+
* Current semantic value selected or edited by the widget.
|
|
55
|
+
* @since 1.0.0
|
|
56
|
+
* @category models
|
|
57
|
+
*/
|
|
58
|
+
readonly value: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Initial RadioGroup values. The caller supplies value; activeId defaults to that value and loop
|
|
62
|
+
* defaults true.
|
|
63
|
+
*
|
|
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/RadioGroup";` Extend the
|
|
77
|
+
* [RadioGroup.makeState runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState).
|
|
78
|
+
* Construct state with
|
|
79
|
+
* `const initial: InitialState = { value: "email", activeId: "email" }; const state = yield* RadioGroup.makeState(initial)`.
|
|
80
|
+
* @since 1.0.0
|
|
81
|
+
* @category models
|
|
82
|
+
*/
|
|
83
|
+
export interface InitialState {
|
|
84
|
+
/**
|
|
85
|
+
* Current semantic value selected or edited by the widget.
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
* @category models
|
|
88
|
+
*/
|
|
89
|
+
readonly value: string;
|
|
90
|
+
/**
|
|
91
|
+
* Id currently active for keyboard navigation; null means no active item.
|
|
92
|
+
* @since 1.0.0
|
|
93
|
+
* @category models
|
|
94
|
+
*/
|
|
95
|
+
readonly activeId?: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Whether movement wraps between the first and last enabled items.
|
|
98
|
+
* @since 1.0.0
|
|
99
|
+
* @category models
|
|
100
|
+
*/
|
|
101
|
+
readonly loop?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Effect Schema used by makeState to encode, decode, and hydrate RadioGroup state.
|
|
105
|
+
*
|
|
106
|
+
* @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
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* import * as Schema from "effect/Schema";
|
|
119
|
+
* import * as RadioGroup from "@typed/ui/RadioGroup";
|
|
120
|
+
*
|
|
121
|
+
* const decodeState = Schema.decodeUnknownEffect(RadioGroup.StateSchema);
|
|
122
|
+
* ```
|
|
123
|
+
* @since 1.0.0
|
|
124
|
+
* @category schemas
|
|
125
|
+
*/
|
|
126
|
+
export declare const StateSchema: Schema.Struct<{
|
|
127
|
+
readonly value: Schema.String;
|
|
128
|
+
readonly activeId: Schema.NullOr<Schema.String>;
|
|
129
|
+
readonly orientation: Schema.Literals<readonly ["vertical"]>;
|
|
130
|
+
readonly loop: Schema.Boolean;
|
|
131
|
+
readonly rtl: Schema.Boolean;
|
|
132
|
+
readonly virtualFocus: Schema.Boolean;
|
|
133
|
+
}>;
|
|
134
|
+
/**
|
|
135
|
+
* Creates hydrated RadioGroup state. The caller supplies value; activeId defaults to that value
|
|
136
|
+
* and loop defaults true.
|
|
137
|
+
*
|
|
138
|
+
* @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
|
+
* The returned Effect creates the RefSubject when run. That state is renderer-independent;
|
|
146
|
+
* collection registrations belong to the separate Scope that runs register or ref, not to state
|
|
147
|
+
* creation.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import * as Effect from "effect/Effect";
|
|
152
|
+
* import * as RadioGroup from "@typed/ui/RadioGroup";
|
|
153
|
+
*
|
|
154
|
+
* const program = Effect.scoped(
|
|
155
|
+
* Effect.gen(function* () {
|
|
156
|
+
* const state = yield* RadioGroup.makeState({ value: "email" });
|
|
157
|
+
* const collection = yield* RadioGroup.makeCollection();
|
|
158
|
+
* return { state: yield* state, collection: yield* collection };
|
|
159
|
+
* }),
|
|
160
|
+
* );
|
|
161
|
+
* ```
|
|
162
|
+
* @since 1.0.0
|
|
163
|
+
* @category constructors
|
|
164
|
+
*/
|
|
165
|
+
export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
|
|
166
|
+
readonly value: string;
|
|
167
|
+
readonly activeId: string | null;
|
|
168
|
+
readonly orientation: "vertical";
|
|
169
|
+
readonly loop: boolean;
|
|
170
|
+
readonly rtl: boolean;
|
|
171
|
+
readonly virtualFocus: boolean;
|
|
172
|
+
}, Schema.SchemaError, never, never>, never, Scope.Scope>;
|
|
173
|
+
/**
|
|
174
|
+
* Creates a scoped Collection for RadioGroup items.
|
|
175
|
+
*
|
|
176
|
+
* @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
|
+
* The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
|
|
184
|
+
* owned by the Scope that runs register, independently of this construction Effect.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```ts
|
|
188
|
+
* import * as Effect from "effect/Effect";
|
|
189
|
+
* import * as RadioGroup from "@typed/ui/RadioGroup";
|
|
190
|
+
*
|
|
191
|
+
* const program = Effect.scoped(
|
|
192
|
+
* Effect.gen(function* () {
|
|
193
|
+
* const collection = yield* RadioGroup.makeCollection();
|
|
194
|
+
* return yield* collection;
|
|
195
|
+
* }),
|
|
196
|
+
* );
|
|
197
|
+
* ```
|
|
198
|
+
* @since 1.0.0
|
|
199
|
+
* @category constructors
|
|
200
|
+
*/
|
|
201
|
+
export declare const makeCollection: (initial?: Collection.State<string, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<string, Element>, never, never>, never, Scope.Scope>;
|
|
202
|
+
/**
|
|
203
|
+
* Sets selected value and activeId to the same registered radio id.
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* ## Why
|
|
207
|
+
*
|
|
208
|
+
* The operation exposes RadioGroup's transition directly so callers can compose it in Effect
|
|
209
|
+
* programs and native event handlers.
|
|
210
|
+
*
|
|
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 { setValue } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
|
|
219
|
+
* runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Inside the linked Effect
|
|
220
|
+
* program invoke `yield* setValue(state, "phone", "phone")`, then read state to observe the checked
|
|
221
|
+
* value and active roving-focus id update together.
|
|
222
|
+
* @since 1.0.0
|
|
223
|
+
* @category combinators
|
|
224
|
+
*/
|
|
225
|
+
export declare function setValue<E, R>(state: RefSubject.RefSubject<State, E, R>, value: string, activeId?: string): Effect.Effect<State, E, R>;
|
|
226
|
+
/**
|
|
227
|
+
* Inputs accepted by RadioGroup.Root in addition to the shared DOM host options.
|
|
228
|
+
*
|
|
229
|
+
* @remarks
|
|
230
|
+
* ## Why
|
|
231
|
+
*
|
|
232
|
+
* The options type makes required state, content, accessible relationships, and custom-host inputs
|
|
233
|
+
* visible before rendering.
|
|
234
|
+
*
|
|
235
|
+
* ## Ownership and lifetime
|
|
236
|
+
*
|
|
237
|
+
* This declaration is data or schema metadata and acquires no resources.
|
|
238
|
+
*
|
|
239
|
+
* ## Example
|
|
240
|
+
*
|
|
241
|
+
* Import with `import type { RootOptions } from "@typed/ui/RadioGroup";` Extend the
|
|
242
|
+
* [RadioGroup.makeState runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Enable
|
|
243
|
+
* Arrow-key selection with
|
|
244
|
+
* `const options: RootOptions = { state, collection, label: "Contact method", content: "Choices" }`.
|
|
245
|
+
* @since 1.0.0
|
|
246
|
+
* @category models
|
|
247
|
+
*/
|
|
248
|
+
export interface RootOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
249
|
+
/**
|
|
250
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
251
|
+
* @since 1.0.0
|
|
252
|
+
* @category models
|
|
253
|
+
*/
|
|
254
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
255
|
+
/**
|
|
256
|
+
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
257
|
+
* @since 1.0.0
|
|
258
|
+
* @category models
|
|
259
|
+
*/
|
|
260
|
+
readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
|
|
261
|
+
/**
|
|
262
|
+
* Renderable child content for the component host.
|
|
263
|
+
* @since 1.0.0
|
|
264
|
+
* @category models
|
|
265
|
+
*/
|
|
266
|
+
readonly content: Renderable.Any;
|
|
267
|
+
/**
|
|
268
|
+
* Accessible label rendered through aria-label.
|
|
269
|
+
* @since 1.0.0
|
|
270
|
+
* @category models
|
|
271
|
+
*/
|
|
272
|
+
readonly label?: Renderable.Any<string | null | undefined>;
|
|
273
|
+
}
|
|
274
|
+
declare function rootInternalProps<const Options extends RootOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
|
|
275
|
+
readonly role: "radiogroup";
|
|
276
|
+
readonly "aria-label": Exclude<Dom.Property<Options, "label">, Dom.Nullish> | undefined;
|
|
277
|
+
readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
|
|
278
|
+
readonly ref: RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>;
|
|
279
|
+
};
|
|
280
|
+
type RootInternalProps<Options extends RootOptions> = ReturnType<ReturnType<typeof rootInternalProps<Options>>>;
|
|
281
|
+
/**
|
|
282
|
+
* Renders the radiogroup and maps Arrow keys to selection and focus movement.
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* ## Why
|
|
286
|
+
*
|
|
287
|
+
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
288
|
+
* through the shared DOM boundary.
|
|
289
|
+
*
|
|
290
|
+
* ## Ownership and lifetime
|
|
291
|
+
*
|
|
292
|
+
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
293
|
+
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
294
|
+
* unrelated nodes and attributes remain caller-owned.
|
|
295
|
+
*
|
|
296
|
+
* ## Example
|
|
297
|
+
*
|
|
298
|
+
* Import with `import { Root } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
|
|
299
|
+
* runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Replace the linked program's
|
|
300
|
+
* final snapshot read with `Root({ state, label: "Contact method", content: "Choices" })`; render
|
|
301
|
+
* that Fx before the same Scope closes.
|
|
302
|
+
* @since 1.0.0
|
|
303
|
+
* @category components
|
|
304
|
+
*/
|
|
305
|
+
export declare function Root<const Options extends RootOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, RootInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
|
|
306
|
+
/**
|
|
307
|
+
* Inputs accepted by RadioGroup.Item in addition to the shared DOM host options.
|
|
308
|
+
*
|
|
309
|
+
* @remarks
|
|
310
|
+
* ## Why
|
|
311
|
+
*
|
|
312
|
+
* The options type makes required state, content, accessible relationships, and custom-host inputs
|
|
313
|
+
* visible before rendering.
|
|
314
|
+
*
|
|
315
|
+
* ## Ownership and lifetime
|
|
316
|
+
*
|
|
317
|
+
* This declaration is data or schema metadata and acquires no resources.
|
|
318
|
+
*
|
|
319
|
+
* ## Example
|
|
320
|
+
*
|
|
321
|
+
* Import with `import type { ItemOptions } from "@typed/ui/RadioGroup";` Extend the
|
|
322
|
+
* [RadioGroup.makeState runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). A
|
|
323
|
+
* native radio input is
|
|
324
|
+
* `const options: ItemOptions = { state, collection, id: "email", value: "email", name: "contact" }`.
|
|
325
|
+
* @since 1.0.0
|
|
326
|
+
* @category models
|
|
327
|
+
*/
|
|
328
|
+
export interface ItemOptions extends Dom.HostOptions<HTMLInputElement> {
|
|
329
|
+
/**
|
|
330
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
331
|
+
* @since 1.0.0
|
|
332
|
+
* @category models
|
|
333
|
+
*/
|
|
334
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
335
|
+
/**
|
|
336
|
+
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
337
|
+
* @since 1.0.0
|
|
338
|
+
* @category models
|
|
339
|
+
*/
|
|
340
|
+
readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
|
|
341
|
+
/**
|
|
342
|
+
* Stable id used for collection identity and ARIA relationships.
|
|
343
|
+
* @since 1.0.0
|
|
344
|
+
* @category models
|
|
345
|
+
*/
|
|
346
|
+
readonly id: string;
|
|
347
|
+
/**
|
|
348
|
+
* Current semantic value selected or edited by the widget.
|
|
349
|
+
* @since 1.0.0
|
|
350
|
+
* @category models
|
|
351
|
+
*/
|
|
352
|
+
readonly value: string;
|
|
353
|
+
/**
|
|
354
|
+
* Native radio-group form name shared by related input items.
|
|
355
|
+
* @since 1.0.0
|
|
356
|
+
* @category models
|
|
357
|
+
*/
|
|
358
|
+
readonly name?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Flag used by collection movement and widget handlers to skip activation by default.
|
|
361
|
+
* @since 1.0.0
|
|
362
|
+
* @category models
|
|
363
|
+
*/
|
|
364
|
+
readonly disabled?: boolean;
|
|
365
|
+
}
|
|
366
|
+
declare function itemInternalProps<const Options extends ItemOptions>(options: Options): () => {
|
|
367
|
+
readonly id: string;
|
|
368
|
+
readonly type: "radio";
|
|
369
|
+
readonly role: "radio";
|
|
370
|
+
readonly name: string | undefined;
|
|
371
|
+
readonly value: string;
|
|
372
|
+
readonly "?disabled": boolean;
|
|
373
|
+
readonly "aria-checked": RefSubject.Computed<boolean, Schema.SchemaError, never>;
|
|
374
|
+
readonly "aria-disabled": boolean;
|
|
375
|
+
readonly "?checked": RefSubject.Computed<boolean, Schema.SchemaError, never>;
|
|
376
|
+
readonly ".checked": RefSubject.Computed<boolean, Schema.SchemaError, never>;
|
|
377
|
+
readonly onchange: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
|
|
378
|
+
readonly ref: ((element: Element & HTMLInputElement & RefSubject.HydrationElement) => Effect.Effect<void, any, any>) | undefined;
|
|
379
|
+
};
|
|
380
|
+
type ItemInternalProps<Options extends ItemOptions> = ReturnType<ReturnType<typeof itemInternalProps<Options>>>;
|
|
381
|
+
/**
|
|
382
|
+
* Renders and optionally registers a native radio input synchronized with selected value.
|
|
383
|
+
*
|
|
384
|
+
* @remarks
|
|
385
|
+
* ## Why
|
|
386
|
+
*
|
|
387
|
+
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
388
|
+
* through the shared DOM boundary.
|
|
389
|
+
*
|
|
390
|
+
* ## Ownership and lifetime
|
|
391
|
+
*
|
|
392
|
+
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
393
|
+
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
394
|
+
* unrelated nodes and attributes remain caller-owned.
|
|
395
|
+
*
|
|
396
|
+
* ## Example
|
|
397
|
+
*
|
|
398
|
+
* Import with `import { Item } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
|
|
399
|
+
* runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Replace the linked program's
|
|
400
|
+
* final snapshot read with `Item({ state, id: "email", value: "email", name: "contact" })`; render
|
|
401
|
+
* that Fx before the same Scope closes.
|
|
402
|
+
* @since 1.0.0
|
|
403
|
+
* @category components
|
|
404
|
+
*/
|
|
405
|
+
export declare function Item<const Options extends ItemOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, ItemInternalProps<Options>>, "", Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
|
|
406
|
+
/**
|
|
407
|
+
* Consumer-facing alias of the canonical RadioGroup component with identical behavior and
|
|
408
|
+
* lifetime.
|
|
409
|
+
*
|
|
410
|
+
* @remarks
|
|
411
|
+
* ## Why
|
|
412
|
+
*
|
|
413
|
+
* The component applies the family behavior while leaving callers free to supply a custom host
|
|
414
|
+
* through the shared DOM boundary.
|
|
415
|
+
*
|
|
416
|
+
* ## Ownership and lifetime
|
|
417
|
+
*
|
|
418
|
+
* The alias acquires nothing. Rendering it has exactly the canonical component's Scope and DOM
|
|
419
|
+
* ownership contract.
|
|
420
|
+
*
|
|
421
|
+
* ## Example
|
|
422
|
+
*
|
|
423
|
+
* Import with `import { RadioGroup } from "@typed/ui/RadioGroup";` Extend the [RadioGroup.makeState
|
|
424
|
+
* runnable setup](/reference/%40typed%2Fui%2FRadioGroup%23makeState). Replace the linked program's
|
|
425
|
+
* final snapshot read with `RadioGroup({ state, label: "Contact method", content: "Choices" })`;
|
|
426
|
+
* render that Fx before the same Scope closes.
|
|
427
|
+
* @since 1.0.0
|
|
428
|
+
* @category components
|
|
429
|
+
*/
|
|
430
|
+
export declare const RadioGroup: typeof Root;
|
|
431
|
+
export {};
|
|
432
|
+
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../src/RadioGroup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;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,iBAAiB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;;;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