@zag-js/radio-group
Advanced tools
Comparing version
@@ -112,2 +112,6 @@ import * as _zag_js_anatomy from '@zag-js/anatomy'; | ||
indicatorCleanup: VoidFunction | null; | ||
/** | ||
* The value of the radio that has focus visible | ||
*/ | ||
focusVisibleValue: string | null; | ||
} | ||
@@ -114,0 +118,0 @@ interface RadioGroupSchema { |
@@ -56,8 +56,6 @@ 'use strict'; | ||
function connect(service, normalize) { | ||
const { context, send, computed, prop, scope } = service; | ||
const { context, send, computed, prop, scope, refs } = service; | ||
const groupDisabled = computed("isDisabled"); | ||
const readOnly = prop("readOnly"); | ||
function getItemState(props2) { | ||
const focused = context.get("focusedValue") === props2.value; | ||
const focusVisible$1 = focused && focusVisible.isFocusVisible(); | ||
return { | ||
@@ -68,4 +66,4 @@ value: props2.value, | ||
checked: context.get("value") === props2.value, | ||
focused, | ||
focusVisible: focusVisible$1, | ||
focused: context.get("focusedValue") === props2.value, | ||
focusVisible: refs.get("focusVisibleValue") === props2.value, | ||
hovered: context.get("hoveredValue") === props2.value, | ||
@@ -205,3 +203,4 @@ active: context.get("activeValue") === props2.value | ||
onFocus() { | ||
send({ type: "SET_FOCUSED", value: props2.value, focused: true }); | ||
const focusVisible$1 = focusVisible.isFocusVisible(); | ||
send({ type: "SET_FOCUSED", value: props2.value, focused: true, focusVisible: focusVisible$1 }); | ||
}, | ||
@@ -296,3 +295,4 @@ onKeyDown(event) { | ||
return { | ||
indicatorCleanup: null | ||
indicatorCleanup: null, | ||
focusVisibleValue: null | ||
}; | ||
@@ -363,4 +363,5 @@ }, | ||
}, | ||
setFocused({ context, event }) { | ||
setFocused({ context, event, refs }) { | ||
context.set("focusedValue", event.value); | ||
refs.set("focusVisibleValue", event.focusVisible ? event.value : null); | ||
}, | ||
@@ -367,0 +368,0 @@ syncInputElements({ context, scope }) { |
{ | ||
"name": "@zag-js/radio-group", | ||
"version": "1.21.1", | ||
"version": "1.21.2", | ||
"description": "Core logic for the radio group widget implemented as a state machine", | ||
@@ -30,8 +30,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/anatomy": "1.21.1", | ||
"@zag-js/dom-query": "1.21.1", | ||
"@zag-js/focus-visible": "1.21.1", | ||
"@zag-js/utils": "1.21.1", | ||
"@zag-js/core": "1.21.1", | ||
"@zag-js/types": "1.21.1" | ||
"@zag-js/anatomy": "1.21.2", | ||
"@zag-js/dom-query": "1.21.2", | ||
"@zag-js/focus-visible": "1.21.2", | ||
"@zag-js/utils": "1.21.2", | ||
"@zag-js/core": "1.21.2", | ||
"@zag-js/types": "1.21.2" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
43184
1.25%1053
0.57%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated
Updated