@zag-js/radio-group 0.53.0 → 0.54.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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +464 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +431 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/radio-group.connect.ts +56 -49
- package/src/radio-group.types.ts +3 -3
|
@@ -53,32 +53,37 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
|
|
|
53
53
|
clearValue() {
|
|
54
54
|
send({ type: "SET_VALUE", value: null, isTrusted: false })
|
|
55
55
|
},
|
|
56
|
-
getItemState,
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
...parts.label.attrs,
|
|
74
|
-
dir: state.context.dir,
|
|
75
|
-
"data-orientation": state.context.orientation,
|
|
76
|
-
"data-disabled": dataAttr(groupDisabled),
|
|
77
|
-
id: dom.getLabelId(state.context),
|
|
78
|
-
onClick: focus,
|
|
79
|
-
}),
|
|
57
|
+
getRootProps() {
|
|
58
|
+
return normalize.element({
|
|
59
|
+
...parts.root.attrs,
|
|
60
|
+
role: "radiogroup",
|
|
61
|
+
id: dom.getRootId(state.context),
|
|
62
|
+
"aria-labelledby": dom.getLabelId(state.context),
|
|
63
|
+
"data-orientation": state.context.orientation,
|
|
64
|
+
"data-disabled": dataAttr(groupDisabled),
|
|
65
|
+
"aria-orientation": state.context.orientation,
|
|
66
|
+
dir: state.context.dir,
|
|
67
|
+
style: {
|
|
68
|
+
position: "relative",
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
},
|
|
80
72
|
|
|
81
|
-
|
|
73
|
+
getLabelProps() {
|
|
74
|
+
return normalize.element({
|
|
75
|
+
...parts.label.attrs,
|
|
76
|
+
dir: state.context.dir,
|
|
77
|
+
"data-orientation": state.context.orientation,
|
|
78
|
+
"data-disabled": dataAttr(groupDisabled),
|
|
79
|
+
id: dom.getLabelId(state.context),
|
|
80
|
+
onClick: focus,
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
getItemState,
|
|
85
|
+
|
|
86
|
+
getItemProps(props) {
|
|
82
87
|
const itemState = getItemState(props)
|
|
83
88
|
|
|
84
89
|
return normalize.label({
|
|
@@ -112,7 +117,7 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
|
|
|
112
117
|
})
|
|
113
118
|
},
|
|
114
119
|
|
|
115
|
-
getItemTextProps(props
|
|
120
|
+
getItemTextProps(props) {
|
|
116
121
|
return normalize.element({
|
|
117
122
|
...parts.itemText.attrs,
|
|
118
123
|
dir: state.context.dir,
|
|
@@ -121,7 +126,7 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
|
|
|
121
126
|
})
|
|
122
127
|
},
|
|
123
128
|
|
|
124
|
-
getItemControlProps(props
|
|
129
|
+
getItemControlProps(props) {
|
|
125
130
|
const controlState = getItemState(props)
|
|
126
131
|
|
|
127
132
|
return normalize.element({
|
|
@@ -134,7 +139,7 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
|
|
|
134
139
|
})
|
|
135
140
|
},
|
|
136
141
|
|
|
137
|
-
getItemHiddenInputProps(props
|
|
142
|
+
getItemHiddenInputProps(props) {
|
|
138
143
|
const inputState = getItemState(props)
|
|
139
144
|
|
|
140
145
|
return normalize.input({
|
|
@@ -178,27 +183,29 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
|
|
|
178
183
|
})
|
|
179
184
|
},
|
|
180
185
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
state.context.orientation === "horizontal" ? "
|
|
201
|
-
|
|
202
|
-
|
|
186
|
+
getIndicatorProps() {
|
|
187
|
+
return normalize.element({
|
|
188
|
+
id: dom.getIndicatorId(state.context),
|
|
189
|
+
...parts.indicator.attrs,
|
|
190
|
+
dir: state.context.dir,
|
|
191
|
+
hidden: state.context.value == null,
|
|
192
|
+
"data-disabled": dataAttr(groupDisabled),
|
|
193
|
+
"data-orientation": state.context.orientation,
|
|
194
|
+
style: {
|
|
195
|
+
"--transition-property": "left, top, width, height",
|
|
196
|
+
"--left": state.context.indicatorRect?.left,
|
|
197
|
+
"--top": state.context.indicatorRect?.top,
|
|
198
|
+
"--width": state.context.indicatorRect?.width,
|
|
199
|
+
"--height": state.context.indicatorRect?.height,
|
|
200
|
+
position: "absolute",
|
|
201
|
+
willChange: "var(--transition-property)",
|
|
202
|
+
transitionProperty: "var(--transition-property)",
|
|
203
|
+
transitionDuration: state.context.canIndicatorTransition ? "var(--transition-duration, 150ms)" : "0ms",
|
|
204
|
+
transitionTimingFunction: "var(--transition-timing-function)",
|
|
205
|
+
[state.context.orientation === "horizontal" ? "left" : "top"]:
|
|
206
|
+
state.context.orientation === "horizontal" ? "var(--left)" : "var(--top)",
|
|
207
|
+
},
|
|
208
|
+
})
|
|
209
|
+
},
|
|
203
210
|
}
|
|
204
211
|
}
|
package/src/radio-group.types.ts
CHANGED
|
@@ -177,11 +177,11 @@ export interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
177
177
|
*/
|
|
178
178
|
getItemState(props: ItemProps): ItemState
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
getRootProps(): T["element"]
|
|
181
|
+
getLabelProps(): T["element"]
|
|
182
182
|
getItemProps(props: ItemProps): T["label"]
|
|
183
183
|
getItemTextProps(props: ItemProps): T["element"]
|
|
184
184
|
getItemControlProps(props: ItemProps): T["element"]
|
|
185
185
|
getItemHiddenInputProps(props: ItemProps): T["input"]
|
|
186
|
-
|
|
186
|
+
getIndicatorProps(): T["element"]
|
|
187
187
|
}
|