@yamada-ui/use-disclosure
Advanced tools
Comparing version 0.0.0-dev-20230606151107 to 0.0.0-dev-20230705143857
type UseDisclosureProps = { | ||
isOpen?: boolean; | ||
defaultIsOpen?: boolean; | ||
onClose?: () => void; | ||
onOpen?: () => void; | ||
onClose?: (args?: any) => void; | ||
onOpen?: (args?: any) => void; | ||
}; | ||
@@ -7,0 +7,0 @@ declare const useDisclosure: (props?: UseDisclosureProps) => UseDisclosureReturn; |
@@ -36,12 +36,18 @@ "use strict"; | ||
const isOpen = props.isOpen !== void 0 ? props.isOpen : defaultIsOpen; | ||
const onOpen = (0, import_react.useCallback)(() => { | ||
if (!isControlled) | ||
setIsOpen(true); | ||
handleOpen == null ? void 0 : handleOpen(); | ||
}, [isControlled, handleOpen]); | ||
const onClose = (0, import_react.useCallback)(() => { | ||
if (!isControlled) | ||
setIsOpen(false); | ||
handleClose == null ? void 0 : handleClose(); | ||
}, [isControlled, handleClose]); | ||
const onOpen = (0, import_react.useCallback)( | ||
(args) => { | ||
if (!isControlled) | ||
setIsOpen(true); | ||
handleOpen == null ? void 0 : handleOpen(args); | ||
}, | ||
[isControlled, handleOpen] | ||
); | ||
const onClose = (0, import_react.useCallback)( | ||
(args) => { | ||
if (!isControlled) | ||
setIsOpen(false); | ||
handleClose == null ? void 0 : handleClose(args); | ||
}, | ||
[isControlled, handleClose] | ||
); | ||
const onToggle = (0, import_react.useCallback)(() => !isOpen ? onOpen() : onClose(), [isOpen, onOpen, onClose]); | ||
@@ -48,0 +54,0 @@ return [isOpen, onOpen, onClose, onToggle]; |
{ | ||
"name": "@yamada-ui/use-disclosure", | ||
"version": "0.0.0-dev-20230606151107", | ||
"version": "0.0.0-dev-20230705143857", | ||
"description": "Yamada UI useDisclosure custom hook", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@yamada-ui/utils": "0.0.0-dev-20230606151107" | ||
"@yamada-ui/utils": "0.1.1" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
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
7623
141
+ Added@yamada-ui/utils@0.1.1(transitive)
- Removed@yamada-ui/utils@0.0.0-dev-20230606151107(transitive)
Updated@yamada-ui/utils@0.1.1