@zag-js/checkbox
Advanced tools
Comparing version 0.0.0-dev-20220617101836 to 0.0.0-dev-20220625180418
@@ -218,3 +218,3 @@ "use strict"; | ||
setIndeterminate(indeterminate) { | ||
send({ type: "SET_INDETERMINATE", indeterminate }); | ||
send({ type: "SET_INDETERMINATE", value: indeterminate }); | ||
}, | ||
@@ -233,3 +233,3 @@ rootProps: normalize.element({ | ||
return; | ||
send({ type: "SET_HOVERED", hovered: true }); | ||
send({ type: "SET_HOVERED", value: true }); | ||
}, | ||
@@ -239,3 +239,3 @@ onPointerLeave() { | ||
return; | ||
send({ type: "SET_HOVERED", hovered: false }); | ||
send({ type: "SET_HOVERED", value: false }); | ||
}, | ||
@@ -245,6 +245,5 @@ onPointerDown(event) { | ||
return; | ||
if (isFocused) { | ||
if (isFocused) | ||
event.preventDefault(); | ||
} | ||
send({ type: "SET_ACTIVE", active: true }); | ||
send({ type: "SET_ACTIVE", value: true }); | ||
}, | ||
@@ -254,3 +253,3 @@ onPointerUp() { | ||
return; | ||
send({ type: "SET_ACTIVE", active: false }); | ||
send({ type: "SET_ACTIVE", value: false }); | ||
} | ||
@@ -305,14 +304,14 @@ }), | ||
style: visuallyHiddenStyle, | ||
onChange(event) { | ||
send({ type: "TOGGLE", event }); | ||
onChange() { | ||
send({ type: "TOGGLE" }); | ||
}, | ||
onBlur() { | ||
send({ type: "SET_FOCUSED", focused: false }); | ||
send({ type: "SET_FOCUSED", value: false }); | ||
}, | ||
onFocus() { | ||
send({ type: "SET_FOCUSED", focused: true }); | ||
send({ type: "SET_FOCUSED", value: true }); | ||
}, | ||
onKeyDown(event) { | ||
if (event.key === " ") { | ||
send({ type: "SET_ACTIVE", active: true }); | ||
send({ type: "SET_ACTIVE", value: true }); | ||
} | ||
@@ -322,3 +321,3 @@ }, | ||
if (event.key === " ") { | ||
send({ type: "SET_ACTIVE", active: false }); | ||
send({ type: "SET_ACTIVE", value: false }); | ||
} | ||
@@ -350,4 +349,3 @@ } | ||
computed: { | ||
isInteractive: (ctx2) => !(ctx2.readonly || ctx2.disabled), | ||
isRtl: (ctx2) => ctx2.dir === "rtl" | ||
isInteractive: (ctx2) => !(ctx2.readonly || ctx2.disabled) | ||
}, | ||
@@ -358,10 +356,10 @@ activities: ["trackFormReset", "trackFieldsetDisabled"], | ||
{ | ||
guard: and("shouldCheck", "canToggle"), | ||
guard: and("shouldCheck", "isInteractive"), | ||
target: "checked", | ||
actions: ["dispatchChangeEvent"] | ||
actions: "dispatchChangeEvent" | ||
}, | ||
{ | ||
guard: "canToggle", | ||
guard: "isInteractive", | ||
target: "unchecked", | ||
actions: ["dispatchChangeEvent"] | ||
actions: "dispatchChangeEvent" | ||
} | ||
@@ -395,3 +393,3 @@ ], | ||
target: "unchecked", | ||
guard: "canToggle", | ||
guard: "isInteractive", | ||
actions: ["invokeOnChange"] | ||
@@ -405,3 +403,3 @@ } | ||
target: "checked", | ||
guard: "canToggle", | ||
guard: "isInteractive", | ||
actions: ["invokeOnChange"] | ||
@@ -415,3 +413,3 @@ } | ||
shouldCheck: (_, evt) => evt.checked, | ||
canToggle: (ctx2) => !ctx2.readonly | ||
isInteractive: (ctx2) => ctx2.isInteractive | ||
}, | ||
@@ -456,24 +454,18 @@ activities: { | ||
setActive(ctx2, evt) { | ||
ctx2.active = evt.active; | ||
ctx2.active = evt.value; | ||
}, | ||
setDisabled(ctx2, evt) { | ||
ctx2.disabled = evt.disabled; | ||
}, | ||
setHovered(ctx2, evt) { | ||
ctx2.hovered = evt.hovered; | ||
ctx2.hovered = evt.value; | ||
}, | ||
setFocused(ctx2, evt) { | ||
ctx2.focused = evt.focused; | ||
ctx2.focused = evt.value; | ||
}, | ||
setIndeterminate(ctx2, evt) { | ||
ctx2.indeterminate = evt.indeterminate; | ||
ctx2.indeterminate = evt.value; | ||
}, | ||
setReadOnly(ctx2, evt) { | ||
ctx2.readonly = evt.readonly; | ||
}, | ||
syncInputIndeterminate(ctx2) { | ||
const inputEl = dom.getInputEl(ctx2); | ||
if (!inputEl) | ||
const el = dom.getInputEl(ctx2); | ||
if (!el) | ||
return; | ||
inputEl.indeterminate = Boolean(ctx2.indeterminate); | ||
el.indeterminate = Boolean(ctx2.indeterminate); | ||
}, | ||
@@ -483,6 +475,6 @@ dispatchChangeEvent(ctx2, evt) { | ||
return; | ||
const inputEl = dom.getInputEl(ctx2); | ||
if (!inputEl) | ||
const el = dom.getInputEl(ctx2); | ||
if (!el) | ||
return; | ||
dispatchInputCheckedEvent(inputEl, evt.checked); | ||
dispatchInputCheckedEvent(el, evt.checked); | ||
}, | ||
@@ -489,0 +481,0 @@ removeFocusIfNeeded(ctx2) { |
{ | ||
"name": "@zag-js/checkbox", | ||
"version": "0.0.0-dev-20220617101836", | ||
"version": "0.0.0-dev-20220625180418", | ||
"description": "Core logic for the checkbox widget implemented as a state machine", | ||
@@ -41,7 +41,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/core": "0.1.6", | ||
"@zag-js/dom-utils": "0.0.0-dev-20220617101836", | ||
"@zag-js/types": "0.0.0-dev-20220617101836", | ||
"@zag-js/core": "0.0.0-dev-20220625180418", | ||
"@zag-js/types": "0.2.0" | ||
}, | ||
"devDependencies": { | ||
"@zag-js/dom-utils": "0.1.5", | ||
"@zag-js/utils": "0.1.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
34712
2
1059
+ Added@zag-js/core@0.0.0-dev-20220625180418(transitive)
+ Added@zag-js/store@0.0.0-dev-20220625180418(transitive)
+ Added@zag-js/types@0.2.0(transitive)
+ Addedklona@2.0.5(transitive)
+ Addedproxy-compare@2.2.0(transitive)
- Removed@zag-js/utils@0.1.2
- Removed@types/prop-types@15.7.13(transitive)
- Removed@types/react@18.0.13(transitive)
- Removed@types/scheduler@0.23.0(transitive)
- Removed@zag-js/core@0.1.6(transitive)
- Removed@zag-js/dom-utils@0.0.0-dev-20220617101836(transitive)
- Removed@zag-js/types@0.0.0-dev-20220617101836(transitive)
- Removedcsstype@3.1.3(transitive)
- Removedderive-valtio@0.1.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedklona@2.0.6(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedproxy-compare@2.6.0(transitive)
- Removedreact@18.3.1(transitive)
- Removeduse-sync-external-store@1.2.0(transitive)
- Removedvaltio@1.13.2(transitive)
Updated@zag-js/types@0.2.0