@zag-js/radio-group 1.28.0 → 1.29.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 +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -5
- package/dist/index.mjs +9 -5
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -70,6 +70,10 @@ interface PrivateContext {
|
|
|
70
70
|
* The id of the focused radio
|
|
71
71
|
*/
|
|
72
72
|
focusedValue: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* The id of the radio that has focus-visible
|
|
75
|
+
*/
|
|
76
|
+
focusVisibleValue: string | null;
|
|
73
77
|
/**
|
|
74
78
|
* The id of the hovered radio
|
|
75
79
|
*/
|
|
@@ -99,10 +103,6 @@ interface Refs {
|
|
|
99
103
|
* Function to clean up the observer for the active tab's rect
|
|
100
104
|
*/
|
|
101
105
|
indicatorCleanup: VoidFunction | null;
|
|
102
|
-
/**
|
|
103
|
-
* The value of the radio that has focus visible
|
|
104
|
-
*/
|
|
105
|
-
focusVisibleValue: string | null;
|
|
106
106
|
}
|
|
107
107
|
interface RadioGroupSchema {
|
|
108
108
|
state: "idle";
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,10 @@ interface PrivateContext {
|
|
|
70
70
|
* The id of the focused radio
|
|
71
71
|
*/
|
|
72
72
|
focusedValue: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* The id of the radio that has focus-visible
|
|
75
|
+
*/
|
|
76
|
+
focusVisibleValue: string | null;
|
|
73
77
|
/**
|
|
74
78
|
* The id of the hovered radio
|
|
75
79
|
*/
|
|
@@ -99,10 +103,6 @@ interface Refs {
|
|
|
99
103
|
* Function to clean up the observer for the active tab's rect
|
|
100
104
|
*/
|
|
101
105
|
indicatorCleanup: VoidFunction | null;
|
|
102
|
-
/**
|
|
103
|
-
* The value of the radio that has focus visible
|
|
104
|
-
*/
|
|
105
|
-
focusVisibleValue: string | null;
|
|
106
106
|
}
|
|
107
107
|
interface RadioGroupSchema {
|
|
108
108
|
state: "idle";
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var getOffsetRect = (el) => ({
|
|
|
47
47
|
|
|
48
48
|
// src/radio-group.connect.ts
|
|
49
49
|
function connect(service, normalize) {
|
|
50
|
-
const { context, send, computed, prop, scope
|
|
50
|
+
const { context, send, computed, prop, scope } = service;
|
|
51
51
|
const groupDisabled = computed("isDisabled");
|
|
52
52
|
const readOnly = prop("readOnly");
|
|
53
53
|
function getItemState(props2) {
|
|
@@ -57,7 +57,7 @@ function connect(service, normalize) {
|
|
|
57
57
|
disabled: !!props2.disabled || groupDisabled,
|
|
58
58
|
checked: context.get("value") === props2.value,
|
|
59
59
|
focused: context.get("focusedValue") === props2.value,
|
|
60
|
-
focusVisible:
|
|
60
|
+
focusVisible: context.get("focusVisibleValue") === props2.value,
|
|
61
61
|
hovered: context.get("hoveredValue") === props2.value,
|
|
62
62
|
active: context.get("activeValue") === props2.value
|
|
63
63
|
};
|
|
@@ -189,7 +189,7 @@ function connect(service, normalize) {
|
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
onBlur() {
|
|
192
|
-
send({ type: "SET_FOCUSED", value: null, focused: false });
|
|
192
|
+
send({ type: "SET_FOCUSED", value: null, focused: false, focusVisible: false });
|
|
193
193
|
},
|
|
194
194
|
onFocus() {
|
|
195
195
|
const focusVisible$1 = focusVisible.isFocusVisible();
|
|
@@ -264,6 +264,9 @@ var machine = core.createMachine({
|
|
|
264
264
|
focusedValue: bindable(() => ({
|
|
265
265
|
defaultValue: null
|
|
266
266
|
})),
|
|
267
|
+
focusVisibleValue: bindable(() => ({
|
|
268
|
+
defaultValue: null
|
|
269
|
+
})),
|
|
267
270
|
hoveredValue: bindable(() => ({
|
|
268
271
|
defaultValue: null
|
|
269
272
|
})),
|
|
@@ -347,9 +350,10 @@ var machine = core.createMachine({
|
|
|
347
350
|
setActive({ context, event }) {
|
|
348
351
|
context.set("activeValue", event.value);
|
|
349
352
|
},
|
|
350
|
-
setFocused({ context, event
|
|
353
|
+
setFocused({ context, event }) {
|
|
351
354
|
context.set("focusedValue", event.value);
|
|
352
|
-
|
|
355
|
+
const focusVisibleValue = event.value != null && event.focusVisible ? event.value : null;
|
|
356
|
+
context.set("focusVisibleValue", focusVisibleValue);
|
|
353
357
|
},
|
|
354
358
|
syncInputElements({ context, scope }) {
|
|
355
359
|
const inputs = getInputEls(scope);
|
package/dist/index.mjs
CHANGED
|
@@ -45,7 +45,7 @@ var getOffsetRect = (el) => ({
|
|
|
45
45
|
|
|
46
46
|
// src/radio-group.connect.ts
|
|
47
47
|
function connect(service, normalize) {
|
|
48
|
-
const { context, send, computed, prop, scope
|
|
48
|
+
const { context, send, computed, prop, scope } = service;
|
|
49
49
|
const groupDisabled = computed("isDisabled");
|
|
50
50
|
const readOnly = prop("readOnly");
|
|
51
51
|
function getItemState(props2) {
|
|
@@ -55,7 +55,7 @@ function connect(service, normalize) {
|
|
|
55
55
|
disabled: !!props2.disabled || groupDisabled,
|
|
56
56
|
checked: context.get("value") === props2.value,
|
|
57
57
|
focused: context.get("focusedValue") === props2.value,
|
|
58
|
-
focusVisible:
|
|
58
|
+
focusVisible: context.get("focusVisibleValue") === props2.value,
|
|
59
59
|
hovered: context.get("hoveredValue") === props2.value,
|
|
60
60
|
active: context.get("activeValue") === props2.value
|
|
61
61
|
};
|
|
@@ -187,7 +187,7 @@ function connect(service, normalize) {
|
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
onBlur() {
|
|
190
|
-
send({ type: "SET_FOCUSED", value: null, focused: false });
|
|
190
|
+
send({ type: "SET_FOCUSED", value: null, focused: false, focusVisible: false });
|
|
191
191
|
},
|
|
192
192
|
onFocus() {
|
|
193
193
|
const focusVisible = isFocusVisible();
|
|
@@ -262,6 +262,9 @@ var machine = createMachine({
|
|
|
262
262
|
focusedValue: bindable(() => ({
|
|
263
263
|
defaultValue: null
|
|
264
264
|
})),
|
|
265
|
+
focusVisibleValue: bindable(() => ({
|
|
266
|
+
defaultValue: null
|
|
267
|
+
})),
|
|
265
268
|
hoveredValue: bindable(() => ({
|
|
266
269
|
defaultValue: null
|
|
267
270
|
})),
|
|
@@ -345,9 +348,10 @@ var machine = createMachine({
|
|
|
345
348
|
setActive({ context, event }) {
|
|
346
349
|
context.set("activeValue", event.value);
|
|
347
350
|
},
|
|
348
|
-
setFocused({ context, event
|
|
351
|
+
setFocused({ context, event }) {
|
|
349
352
|
context.set("focusedValue", event.value);
|
|
350
|
-
|
|
353
|
+
const focusVisibleValue = event.value != null && event.focusVisible ? event.value : null;
|
|
354
|
+
context.set("focusVisibleValue", focusVisibleValue);
|
|
351
355
|
},
|
|
352
356
|
syncInputElements({ context, scope }) {
|
|
353
357
|
const inputs = getInputEls(scope);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/radio-group",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "Core logic for the radio group widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@zag-js/anatomy": "1.
|
|
31
|
-
"@zag-js/dom-query": "1.
|
|
32
|
-
"@zag-js/focus-visible": "1.
|
|
33
|
-
"@zag-js/utils": "1.
|
|
34
|
-
"@zag-js/core": "1.
|
|
35
|
-
"@zag-js/types": "1.
|
|
30
|
+
"@zag-js/anatomy": "1.29.0",
|
|
31
|
+
"@zag-js/dom-query": "1.29.0",
|
|
32
|
+
"@zag-js/focus-visible": "1.29.0",
|
|
33
|
+
"@zag-js/utils": "1.29.0",
|
|
34
|
+
"@zag-js/core": "1.29.0",
|
|
35
|
+
"@zag-js/types": "1.29.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"clean-package": "2.2.0"
|