@zag-js/radio-group 1.46.0 → 1.48.0
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/dist/index.d.mts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +14 -38
- package/dist/index.mjs +2 -7
- package/dist/radio-group.anatomy.d.mts +2 -6
- package/dist/radio-group.anatomy.d.ts +2 -6
- package/dist/radio-group.anatomy.js +8 -40
- package/dist/radio-group.anatomy.mjs +4 -14
- package/dist/radio-group.connect.d.mts +3 -7
- package/dist/radio-group.connect.d.ts +3 -7
- package/dist/radio-group.connect.js +247 -250
- package/dist/radio-group.connect.mjs +241 -213
- package/dist/radio-group.dom.d.mts +26 -29
- package/dist/radio-group.dom.d.ts +26 -29
- package/dist/radio-group.dom.js +48 -86
- package/dist/radio-group.dom.mjs +29 -46
- package/dist/radio-group.machine.d.mts +2 -7
- package/dist/radio-group.machine.d.ts +2 -7
- package/dist/radio-group.machine.js +155 -217
- package/dist/radio-group.machine.mjs +150 -181
- package/dist/radio-group.props.d.mts +5 -10
- package/dist/radio-group.props.d.ts +5 -10
- package/dist/radio-group.props.js +32 -54
- package/dist/radio-group.props.mjs +25 -26
- package/dist/radio-group.types.d.mts +185 -187
- package/dist/radio-group.types.d.ts +185 -187
- package/dist/radio-group.types.js +4 -18
- package/dist/radio-group.types.mjs +1 -0
- package/package.json +9 -9
|
@@ -1,201 +1,199 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: string | null;
|
|
1
|
+
import { EventObject, Machine, Service } from "@zag-js/core";
|
|
2
|
+
import { CommonProperties, DirectionProperty, PropTypes, Rect, RequiredBy } from "@zag-js/types";
|
|
3
|
+
export interface ValueChangeDetails {
|
|
4
|
+
value: string | null;
|
|
6
5
|
}
|
|
7
|
-
interface ElementIds {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
export interface ElementIds {
|
|
7
|
+
root?: string | undefined;
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
indicator?: string | undefined;
|
|
10
|
+
item?: ((value: string) => string) | undefined;
|
|
11
|
+
itemLabel?: ((value: string) => string) | undefined;
|
|
12
|
+
itemControl?: ((value: string) => string) | undefined;
|
|
13
|
+
itemHiddenInput?: ((value: string) => string) | undefined;
|
|
15
14
|
}
|
|
16
|
-
interface RadioGroupProps extends DirectionProperty, CommonProperties {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
export interface RadioGroupProps extends DirectionProperty, CommonProperties {
|
|
16
|
+
/**
|
|
17
|
+
* The ids of the elements in the radio. Useful for composition.
|
|
18
|
+
*/
|
|
19
|
+
ids?: ElementIds | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The controlled value of the radio group
|
|
22
|
+
*/
|
|
23
|
+
value?: string | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The initial value of the checked radio when rendered.
|
|
26
|
+
* Use when you don't need to control the value of the radio group.
|
|
27
|
+
*/
|
|
28
|
+
defaultValue?: string | null | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The name of the input fields in the radio
|
|
31
|
+
* (Useful for form submission).
|
|
32
|
+
*/
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The associate form of the underlying input.
|
|
36
|
+
*/
|
|
37
|
+
form?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* If `true`, the radio group will be disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* If `true`, the radio group is marked as invalid.
|
|
44
|
+
*/
|
|
45
|
+
invalid?: boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* If `true`, the radio group is marked as required.
|
|
48
|
+
*/
|
|
49
|
+
required?: boolean | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the radio group is read-only
|
|
52
|
+
*/
|
|
53
|
+
readOnly?: boolean | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Function called once a radio is checked
|
|
56
|
+
*/
|
|
57
|
+
onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Orientation of the radio group
|
|
60
|
+
*/
|
|
61
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
63
62
|
}
|
|
64
63
|
interface PrivateContext {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
64
|
+
/**
|
|
65
|
+
* The value of the checked radio
|
|
66
|
+
*/
|
|
67
|
+
value: string | null;
|
|
68
|
+
/**
|
|
69
|
+
* The id of the active radio
|
|
70
|
+
*/
|
|
71
|
+
activeValue: string | null;
|
|
72
|
+
/**
|
|
73
|
+
* The id of the focused radio
|
|
74
|
+
*/
|
|
75
|
+
focusedValue: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* The id of the radio that has focus-visible
|
|
78
|
+
*/
|
|
79
|
+
focusVisibleValue: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* The id of the hovered radio
|
|
82
|
+
*/
|
|
83
|
+
hoveredValue: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* The active tab indicator's dom rect
|
|
86
|
+
*/
|
|
87
|
+
indicatorRect: Rect | null;
|
|
88
|
+
/**
|
|
89
|
+
* Whether indicator transitions should be animated
|
|
90
|
+
*/
|
|
91
|
+
animateIndicator: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the radio group's fieldset is disabled
|
|
94
|
+
*/
|
|
95
|
+
fieldsetDisabled: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the radio group is in server-side rendering
|
|
98
|
+
*/
|
|
99
|
+
ssr: boolean;
|
|
101
100
|
}
|
|
102
101
|
type PropsWithDefault = "orientation";
|
|
103
102
|
type ComputedContext = Readonly<{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Whether the radio group is disabled
|
|
105
|
+
*/
|
|
106
|
+
isDisabled: boolean;
|
|
108
107
|
}>;
|
|
109
108
|
interface Refs {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Function to clean up the observer for the active tab's rect
|
|
111
|
+
*/
|
|
112
|
+
indicatorCleanup: VoidFunction | null;
|
|
113
|
+
/**
|
|
114
|
+
* Previous selected value, used to detect real value transitions
|
|
115
|
+
*/
|
|
116
|
+
prevValue: string | null;
|
|
118
117
|
}
|
|
119
|
-
interface RadioGroupSchema {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
118
|
+
export interface RadioGroupSchema {
|
|
119
|
+
state: "idle";
|
|
120
|
+
props: RequiredBy<RadioGroupProps, PropsWithDefault>;
|
|
121
|
+
context: PrivateContext;
|
|
122
|
+
computed: ComputedContext;
|
|
123
|
+
refs: Refs;
|
|
124
|
+
event: EventObject;
|
|
125
|
+
action: string;
|
|
126
|
+
effect: string;
|
|
127
|
+
guard: string;
|
|
129
128
|
}
|
|
130
|
-
type RadioGroupService = Service<RadioGroupSchema>;
|
|
131
|
-
type RadioGroupMachine = Machine<RadioGroupSchema>;
|
|
132
|
-
interface ItemProps {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
export type RadioGroupService = Service<RadioGroupSchema>;
|
|
130
|
+
export type RadioGroupMachine = Machine<RadioGroupSchema>;
|
|
131
|
+
export interface ItemProps {
|
|
132
|
+
value: string;
|
|
133
|
+
disabled?: boolean | undefined;
|
|
134
|
+
invalid?: boolean | undefined;
|
|
136
135
|
}
|
|
137
|
-
interface ItemState {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
136
|
+
export interface ItemState {
|
|
137
|
+
/**
|
|
138
|
+
* The value of the item
|
|
139
|
+
*/
|
|
140
|
+
value: string;
|
|
141
|
+
/**
|
|
142
|
+
* Whether the item is invalid
|
|
143
|
+
*/
|
|
144
|
+
invalid: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the item is disabled
|
|
147
|
+
*/
|
|
148
|
+
disabled: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Whether the item is checked
|
|
151
|
+
*/
|
|
152
|
+
checked: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Whether the item is focused
|
|
155
|
+
*/
|
|
156
|
+
focused: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Whether the item is focused and the focus is visible
|
|
159
|
+
*/
|
|
160
|
+
focusVisible: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Whether the item is hovered
|
|
163
|
+
*/
|
|
164
|
+
hovered: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Whether the item is active or pressed
|
|
167
|
+
*/
|
|
168
|
+
active: boolean;
|
|
170
169
|
}
|
|
171
|
-
interface RadioGroupApi<T extends PropTypes = PropTypes> {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
170
|
+
export interface RadioGroupApi<T extends PropTypes = PropTypes> {
|
|
171
|
+
/**
|
|
172
|
+
* The current value of the radio group
|
|
173
|
+
*/
|
|
174
|
+
value: string | null;
|
|
175
|
+
/**
|
|
176
|
+
* Function to set the value of the radio group
|
|
177
|
+
*/
|
|
178
|
+
setValue: (value: string) => void;
|
|
179
|
+
/**
|
|
180
|
+
* Function to clear the value of the radio group
|
|
181
|
+
*/
|
|
182
|
+
clearValue: VoidFunction;
|
|
183
|
+
/**
|
|
184
|
+
* Function to focus the radio group
|
|
185
|
+
*/
|
|
186
|
+
focus: VoidFunction;
|
|
187
|
+
/**
|
|
188
|
+
* Returns the state details of a radio input
|
|
189
|
+
*/
|
|
190
|
+
getItemState: (props: ItemProps) => ItemState;
|
|
191
|
+
getRootProps: () => T["element"];
|
|
192
|
+
getLabelProps: () => T["element"];
|
|
193
|
+
getItemProps: (props: ItemProps) => T["label"];
|
|
194
|
+
getItemTextProps: (props: ItemProps) => T["element"];
|
|
195
|
+
getItemControlProps: (props: ItemProps) => T["element"];
|
|
196
|
+
getItemHiddenInputProps: (props: ItemProps) => T["input"];
|
|
197
|
+
getIndicatorProps: () => T["element"];
|
|
199
198
|
}
|
|
200
|
-
|
|
201
|
-
export type { ElementIds, ItemProps, ItemState, RadioGroupApi, RadioGroupMachine, RadioGroupProps, RadioGroupSchema, RadioGroupService, ValueChangeDetails };
|
|
199
|
+
export {};
|