@zag-js/react
Advanced tools
@@ -78,2 +78,14 @@ "use client"; | ||
} | ||
useBindable.cleanup = (fn) => { | ||
React.useEffect(() => fn, []); | ||
}; | ||
useBindable.ref = (defaultValue) => { | ||
const value = React.useRef(defaultValue); | ||
return { | ||
get: () => value.current, | ||
set: (next) => { | ||
value.current = next; | ||
} | ||
}; | ||
}; | ||
function useRefs(refs) { | ||
@@ -227,3 +239,3 @@ const ref = React.useRef(refs); | ||
const computed = (key) => { | ||
utils.ensure(machine.computed, `[zag-js] No computed object found on machine`); | ||
utils.ensure(machine.computed, () => `[zag-js] No computed object found on machine`); | ||
const fn = machine.computed[key]; | ||
@@ -230,0 +242,0 @@ return fn({ |
{ | ||
"name": "@zag-js/react", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "The react wrapper for zag", | ||
@@ -28,6 +28,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/core": "1.7.0", | ||
"@zag-js/store": "1.7.0", | ||
"@zag-js/types": "1.7.0", | ||
"@zag-js/utils": "1.7.0" | ||
"@zag-js/core": "1.8.0", | ||
"@zag-js/store": "1.8.0", | ||
"@zag-js/types": "1.8.0", | ||
"@zag-js/utils": "1.8.0" | ||
}, | ||
@@ -38,6 +38,6 @@ "devDependencies": { | ||
"@types/jsdom": "^21.1.7", | ||
"react": "19.0.0", | ||
"react-dom": "19.0.0", | ||
"react": "19.1.0", | ||
"react-dom": "19.1.0", | ||
"clean-package": "2.2.0", | ||
"@testing-library/react": "^16.2.0", | ||
"@testing-library/react": "^16.3.0", | ||
"@testing-library/jest-dom": "^6.6.3", | ||
@@ -44,0 +44,0 @@ "@vitejs/plugin-react": "^4.3.4", |
Sorry, the diff of this file is not supported yet
25841
2.01%724
3.43%