@zag-js/radio-group 1.21.1 → 1.21.2
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 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -8
- package/dist/index.mjs +9 -8
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -109,6 +109,10 @@ interface Refs {
|
|
|
109
109
|
* Function to clean up the observer for the active tab's rect
|
|
110
110
|
*/
|
|
111
111
|
indicatorCleanup: VoidFunction | null;
|
|
112
|
+
/**
|
|
113
|
+
* The value of the radio that has focus visible
|
|
114
|
+
*/
|
|
115
|
+
focusVisibleValue: string | null;
|
|
112
116
|
}
|
|
113
117
|
interface RadioGroupSchema {
|
|
114
118
|
state: "idle";
|
package/dist/index.d.ts
CHANGED
|
@@ -109,6 +109,10 @@ interface Refs {
|
|
|
109
109
|
* Function to clean up the observer for the active tab's rect
|
|
110
110
|
*/
|
|
111
111
|
indicatorCleanup: VoidFunction | null;
|
|
112
|
+
/**
|
|
113
|
+
* The value of the radio that has focus visible
|
|
114
|
+
*/
|
|
115
|
+
focusVisibleValue: string | null;
|
|
112
116
|
}
|
|
113
117
|
interface RadioGroupSchema {
|
|
114
118
|
state: "idle";
|
package/dist/index.js
CHANGED
|
@@ -53,19 +53,17 @@ var resolveRect = (rect) => ({
|
|
|
53
53
|
|
|
54
54
|
// src/radio-group.connect.ts
|
|
55
55
|
function connect(service, normalize) {
|
|
56
|
-
const { context, send, computed, prop, scope } = service;
|
|
56
|
+
const { context, send, computed, prop, scope, refs } = service;
|
|
57
57
|
const groupDisabled = computed("isDisabled");
|
|
58
58
|
const readOnly = prop("readOnly");
|
|
59
59
|
function getItemState(props2) {
|
|
60
|
-
const focused = context.get("focusedValue") === props2.value;
|
|
61
|
-
const focusVisible$1 = focused && focusVisible.isFocusVisible();
|
|
62
60
|
return {
|
|
63
61
|
value: props2.value,
|
|
64
62
|
invalid: !!props2.invalid,
|
|
65
63
|
disabled: !!props2.disabled || groupDisabled,
|
|
66
64
|
checked: context.get("value") === props2.value,
|
|
67
|
-
focused,
|
|
68
|
-
focusVisible:
|
|
65
|
+
focused: context.get("focusedValue") === props2.value,
|
|
66
|
+
focusVisible: refs.get("focusVisibleValue") === props2.value,
|
|
69
67
|
hovered: context.get("hoveredValue") === props2.value,
|
|
70
68
|
active: context.get("activeValue") === props2.value
|
|
71
69
|
};
|
|
@@ -200,7 +198,8 @@ function connect(service, normalize) {
|
|
|
200
198
|
send({ type: "SET_FOCUSED", value: null, focused: false });
|
|
201
199
|
},
|
|
202
200
|
onFocus() {
|
|
203
|
-
|
|
201
|
+
const focusVisible$1 = focusVisible.isFocusVisible();
|
|
202
|
+
send({ type: "SET_FOCUSED", value: props2.value, focused: true, focusVisible: focusVisible$1 });
|
|
204
203
|
},
|
|
205
204
|
onKeyDown(event) {
|
|
206
205
|
if (event.defaultPrevented) return;
|
|
@@ -290,7 +289,8 @@ var machine = core.createMachine({
|
|
|
290
289
|
},
|
|
291
290
|
refs() {
|
|
292
291
|
return {
|
|
293
|
-
indicatorCleanup: null
|
|
292
|
+
indicatorCleanup: null,
|
|
293
|
+
focusVisibleValue: null
|
|
294
294
|
};
|
|
295
295
|
},
|
|
296
296
|
computed: {
|
|
@@ -356,8 +356,9 @@ var machine = core.createMachine({
|
|
|
356
356
|
setActive({ context, event }) {
|
|
357
357
|
context.set("activeValue", event.value);
|
|
358
358
|
},
|
|
359
|
-
setFocused({ context, event }) {
|
|
359
|
+
setFocused({ context, event, refs }) {
|
|
360
360
|
context.set("focusedValue", event.value);
|
|
361
|
+
refs.set("focusVisibleValue", event.focusVisible ? event.value : null);
|
|
361
362
|
},
|
|
362
363
|
syncInputElements({ context, scope }) {
|
|
363
364
|
const inputs = getInputEls(scope);
|
package/dist/index.mjs
CHANGED
|
@@ -51,19 +51,17 @@ var resolveRect = (rect) => ({
|
|
|
51
51
|
|
|
52
52
|
// src/radio-group.connect.ts
|
|
53
53
|
function connect(service, normalize) {
|
|
54
|
-
const { context, send, computed, prop, scope } = service;
|
|
54
|
+
const { context, send, computed, prop, scope, refs } = service;
|
|
55
55
|
const groupDisabled = computed("isDisabled");
|
|
56
56
|
const readOnly = prop("readOnly");
|
|
57
57
|
function getItemState(props2) {
|
|
58
|
-
const focused = context.get("focusedValue") === props2.value;
|
|
59
|
-
const focusVisible = focused && isFocusVisible();
|
|
60
58
|
return {
|
|
61
59
|
value: props2.value,
|
|
62
60
|
invalid: !!props2.invalid,
|
|
63
61
|
disabled: !!props2.disabled || groupDisabled,
|
|
64
62
|
checked: context.get("value") === props2.value,
|
|
65
|
-
focused,
|
|
66
|
-
focusVisible,
|
|
63
|
+
focused: context.get("focusedValue") === props2.value,
|
|
64
|
+
focusVisible: refs.get("focusVisibleValue") === props2.value,
|
|
67
65
|
hovered: context.get("hoveredValue") === props2.value,
|
|
68
66
|
active: context.get("activeValue") === props2.value
|
|
69
67
|
};
|
|
@@ -198,7 +196,8 @@ function connect(service, normalize) {
|
|
|
198
196
|
send({ type: "SET_FOCUSED", value: null, focused: false });
|
|
199
197
|
},
|
|
200
198
|
onFocus() {
|
|
201
|
-
|
|
199
|
+
const focusVisible = isFocusVisible();
|
|
200
|
+
send({ type: "SET_FOCUSED", value: props2.value, focused: true, focusVisible });
|
|
202
201
|
},
|
|
203
202
|
onKeyDown(event) {
|
|
204
203
|
if (event.defaultPrevented) return;
|
|
@@ -288,7 +287,8 @@ var machine = createMachine({
|
|
|
288
287
|
},
|
|
289
288
|
refs() {
|
|
290
289
|
return {
|
|
291
|
-
indicatorCleanup: null
|
|
290
|
+
indicatorCleanup: null,
|
|
291
|
+
focusVisibleValue: null
|
|
292
292
|
};
|
|
293
293
|
},
|
|
294
294
|
computed: {
|
|
@@ -354,8 +354,9 @@ var machine = createMachine({
|
|
|
354
354
|
setActive({ context, event }) {
|
|
355
355
|
context.set("activeValue", event.value);
|
|
356
356
|
},
|
|
357
|
-
setFocused({ context, event }) {
|
|
357
|
+
setFocused({ context, event, refs }) {
|
|
358
358
|
context.set("focusedValue", event.value);
|
|
359
|
+
refs.set("focusVisibleValue", event.focusVisible ? event.value : null);
|
|
359
360
|
},
|
|
360
361
|
syncInputElements({ context, scope }) {
|
|
361
362
|
const inputs = getInputEls(scope);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/radio-group",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.2",
|
|
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.21.
|
|
31
|
-
"@zag-js/dom-query": "1.21.
|
|
32
|
-
"@zag-js/focus-visible": "1.21.
|
|
33
|
-
"@zag-js/utils": "1.21.
|
|
34
|
-
"@zag-js/core": "1.21.
|
|
35
|
-
"@zag-js/types": "1.21.
|
|
30
|
+
"@zag-js/anatomy": "1.21.2",
|
|
31
|
+
"@zag-js/dom-query": "1.21.2",
|
|
32
|
+
"@zag-js/focus-visible": "1.21.2",
|
|
33
|
+
"@zag-js/utils": "1.21.2",
|
|
34
|
+
"@zag-js/core": "1.21.2",
|
|
35
|
+
"@zag-js/types": "1.21.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"clean-package": "2.2.0"
|