@yamada-ui/use-controllable-state
Advanced tools
Comparing version 1.0.21 to 1.0.22-dev-20241006000212
import { Dispatch, SetStateAction } from 'react'; | ||
interface UseControllableStateProps<T> { | ||
value?: T; | ||
defaultValue?: T | (() => T); | ||
onChange?: (value: T) => void; | ||
onUpdate?: (prev: T, next: T) => boolean; | ||
interface UseControllableStateMethods<Y> { | ||
onChange?: (value: Y) => void; | ||
onUpdate?: (prev: Y, next: Y) => boolean; | ||
} | ||
declare const useControllableState: <T>({ value, ...rest }: UseControllableStateProps<T>) => [T, Dispatch<SetStateAction<T>>]; | ||
interface UseControllableStateProps<Y> extends UseControllableStateMethods<Y> { | ||
defaultValue?: (() => Y) | Y; | ||
value?: Y; | ||
} | ||
declare function useControllableState<Y>(props: { | ||
value: Y; | ||
defaultValue?: (() => Y) | Y; | ||
} & UseControllableStateMethods<Y>): [Y, Dispatch<SetStateAction<Y>>]; | ||
declare function useControllableState<Y>(props: { | ||
defaultValue: (() => Y) | Y; | ||
value?: Y; | ||
} & UseControllableStateMethods<Y>): [Y, Dispatch<SetStateAction<Y>>]; | ||
declare function useControllableState<Y>(props: UseControllableStateProps<Y>): [Y, Dispatch<SetStateAction<Y>>]; | ||
export { type UseControllableStateProps, useControllableState }; |
@@ -29,6 +29,6 @@ "use client" | ||
var import_react = require("react"); | ||
var useControllableState = ({ | ||
function useControllableState({ | ||
value, | ||
...rest | ||
}) => { | ||
}) { | ||
var _a; | ||
@@ -52,3 +52,3 @@ (_a = rest.onUpdate) != null ? _a : rest.onUpdate = (prev, next) => prev !== next; | ||
return [resolvedValue, setValue]; | ||
}; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -55,0 +55,0 @@ 0 && (module.exports = { |
{ | ||
"name": "@yamada-ui/use-controllable-state", | ||
"version": "1.0.21", | ||
"version": "1.0.22-dev-20241006000212", | ||
"description": "Yamada UI useControllableState custom hook", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@yamada-ui/utils": "1.5.2" | ||
"@yamada-ui/utils": "1.5.3-dev-20241006000212" | ||
}, | ||
@@ -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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13147
108
1
+ Added@yamada-ui/utils@1.5.3-dev-20241006000212(transitive)
- Removed@yamada-ui/utils@1.5.2(transitive)