@yamada-ui/use-controllable-state
Advanced tools
Comparing version 1.0.26-dev-20241214144625 to 1.0.26-dev-20241215203956
@@ -30,10 +30,10 @@ "use client" | ||
function useControllableState({ | ||
defaultValue: defaultValueProp, | ||
value, | ||
...rest | ||
onChange: onChangeProp, | ||
onUpdate: onUpdateProp = (prev, next) => prev !== next | ||
}) { | ||
var _a; | ||
(_a = rest.onUpdate) != null ? _a : rest.onUpdate = (prev, next) => prev !== next; | ||
const onChange = (0, import_utils.useCallbackRef)(rest.onChange); | ||
const onUpdate = (0, import_utils.useCallbackRef)(rest.onUpdate); | ||
const [defaultValue, setDefaultValue] = (0, import_react.useState)(rest.defaultValue); | ||
const onChange = (0, import_utils.useCallbackRef)(onChangeProp); | ||
const onUpdate = (0, import_utils.useCallbackRef)(onUpdateProp); | ||
const [defaultValue, setDefaultValue] = (0, import_react.useState)(defaultValueProp); | ||
const controlled = value !== void 0; | ||
@@ -40,0 +40,0 @@ const resolvedValue = controlled ? value : defaultValue; |
{ | ||
"name": "@yamada-ui/use-controllable-state", | ||
"version": "1.0.26-dev-20241214144625", | ||
"version": "1.0.26-dev-20241215203956", | ||
"description": "Yamada UI useControllableState custom hook", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@yamada-ui/utils": "1.6.2-dev-20241214144625" | ||
"@yamada-ui/utils": "1.6.2-dev-20241215203956" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13251
+ Added@yamada-ui/utils@1.6.2-dev-20241215203956(transitive)
- Removed@yamada-ui/utils@1.6.2-dev-20241214144625(transitive)