@zag-js/toggle-group
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,3 +5,3 @@ import * as _zag_js_anatomy from '@zag-js/anatomy'; | ||
import * as _zag_js_core from '@zag-js/core'; | ||
import { Service, EventObject } from '@zag-js/core'; | ||
import { Service, Machine, EventObject } from '@zag-js/core'; | ||
@@ -97,2 +97,3 @@ declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "item">; | ||
type ToggleGroupService = Service<ToggleGroupSchema>; | ||
type ToggleGroupMachine = Machine<ToggleGroupSchema>; | ||
interface ItemProps { | ||
@@ -139,3 +140,3 @@ value: string; | ||
declare const machine: _zag_js_core.MachineConfig<ToggleGroupSchema>; | ||
declare const machine: _zag_js_core.Machine<ToggleGroupSchema>; | ||
@@ -147,2 +148,2 @@ declare const props: (keyof ToggleGroupProps)[]; | ||
export { type ToggleGroupApi as Api, type ElementIds, type ItemProps, type ItemState, type ToggleGroupProps as Props, type ToggleGroupService as Service, type ValueChangeDetails, anatomy, connect, itemProps, machine, props, splitItemProps, splitProps }; | ||
export { type ToggleGroupApi as Api, type ElementIds, type ItemProps, type ItemState, type ToggleGroupMachine as Machine, type ToggleGroupProps as Props, type ToggleGroupService as Service, type ValueChangeDetails, anatomy, connect, itemProps, machine, props, splitItemProps, splitProps }; |
@@ -64,4 +64,5 @@ 'use strict'; | ||
if (disabled) return; | ||
const evt = event.nativeEvent || event; | ||
if (!domQuery.isSelfTarget(evt) || !!context.get("isClickFocus") || context.get("isTabbingBackward")) return; | ||
if (event.currentTarget !== domQuery.getEventTarget(event)) return; | ||
if (context.get("isClickFocus")) return; | ||
if (context.get("isTabbingBackward")) return; | ||
send({ type: "ROOT.FOCUS" }); | ||
@@ -221,3 +222,3 @@ }, | ||
target: "idle", | ||
actions: ["clearIsTabbingBackward"] | ||
actions: ["clearIsTabbingBackward", "clearFocusedId"] | ||
}, | ||
@@ -239,6 +240,12 @@ "TOGGLE.FOCUS": { | ||
}, | ||
"TOGGLE.SHIFT_TAB": { | ||
target: "idle", | ||
actions: ["setIsTabbingBackward"] | ||
} | ||
"TOGGLE.SHIFT_TAB": [ | ||
{ | ||
guard: not("isFirstToggleFocused"), | ||
target: "idle", | ||
actions: ["setIsTabbingBackward"] | ||
}, | ||
{ | ||
actions: ["setIsTabbingBackward"] | ||
} | ||
] | ||
} | ||
@@ -250,3 +257,4 @@ } | ||
isClickFocus: ({ context }) => context.get("isClickFocus"), | ||
isTabbingBackward: ({ context }) => context.get("isTabbingBackward") | ||
isTabbingBackward: ({ context }) => context.get("isTabbingBackward"), | ||
isFirstToggleFocused: ({ context, scope }) => context.get("focusedId") === getFirstEl(scope)?.id | ||
}, | ||
@@ -253,0 +261,0 @@ actions: { |
{ | ||
"name": "@zag-js/toggle-group", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Core logic for the toggle widget implemented as a state machine", | ||
@@ -29,7 +29,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/anatomy": "1.0.0", | ||
"@zag-js/dom-query": "1.0.0", | ||
"@zag-js/core": "1.0.0", | ||
"@zag-js/types": "1.0.0", | ||
"@zag-js/utils": "1.0.0" | ||
"@zag-js/anatomy": "1.0.1", | ||
"@zag-js/dom-query": "1.0.1", | ||
"@zag-js/utils": "1.0.1", | ||
"@zag-js/core": "1.0.1", | ||
"@zag-js/types": "1.0.1" | ||
}, | ||
@@ -36,0 +36,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33338
808
+ Added@zag-js/anatomy@1.0.1(transitive)
+ Added@zag-js/core@1.0.1(transitive)
+ Added@zag-js/dom-query@1.0.1(transitive)
+ Added@zag-js/types@1.0.1(transitive)
+ Added@zag-js/utils@1.0.1(transitive)
- Removed@zag-js/anatomy@1.0.0(transitive)
- Removed@zag-js/core@1.0.0(transitive)
- Removed@zag-js/dom-query@1.0.0(transitive)
- Removed@zag-js/types@1.0.0(transitive)
- Removed@zag-js/utils@1.0.0(transitive)
Updated@zag-js/anatomy@1.0.1
Updated@zag-js/core@1.0.1
Updated@zag-js/dom-query@1.0.1
Updated@zag-js/types@1.0.1
Updated@zag-js/utils@1.0.1