@yamada-ui/use-disclosure
Advanced tools
Comparing version 0.2.0 to 0.2.1
type UseDisclosureProps = { | ||
isOpen?: boolean; | ||
defaultIsOpen?: boolean; | ||
onClose?: (args?: any) => void; | ||
onOpen?: (args?: any) => void; | ||
onClose?: (...args: any) => void; | ||
onOpen?: (...args: any) => void; | ||
}; | ||
@@ -10,5 +10,5 @@ declare const useDisclosure: (props?: UseDisclosureProps) => UseDisclosureReturn; | ||
isOpen: boolean, | ||
onOpen: () => void, | ||
onClose: () => void, | ||
onToggle: () => void | ||
onOpen: (...args: any) => void, | ||
onClose: (...args: any) => void, | ||
onToggle: (...args: any) => void | ||
]; | ||
@@ -15,0 +15,0 @@ type LazyMode = 'unmount' | 'keepMounted'; |
@@ -37,6 +37,6 @@ "use strict"; | ||
const onOpen = (0, import_react.useCallback)( | ||
(args) => { | ||
(...args) => { | ||
if (!isControlled) | ||
setIsOpen(true); | ||
handleOpen == null ? void 0 : handleOpen(args); | ||
handleOpen == null ? void 0 : handleOpen(...args); | ||
}, | ||
@@ -46,10 +46,13 @@ [isControlled, handleOpen] | ||
const onClose = (0, import_react.useCallback)( | ||
(args) => { | ||
(...args) => { | ||
if (!isControlled) | ||
setIsOpen(false); | ||
handleClose == null ? void 0 : handleClose(args); | ||
handleClose == null ? void 0 : handleClose(...args); | ||
}, | ||
[isControlled, handleClose] | ||
); | ||
const onToggle = (0, import_react.useCallback)(() => !isOpen ? onOpen() : onClose(), [isOpen, onOpen, onClose]); | ||
const onToggle = (0, import_react.useCallback)( | ||
(...args) => !isOpen ? onOpen(...args) : onClose(...args), | ||
[isOpen, onOpen, onClose] | ||
); | ||
return [isOpen, onOpen, onClose, onToggle]; | ||
@@ -56,0 +59,0 @@ }; |
{ | ||
"name": "@yamada-ui/use-disclosure", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Yamada UI useDisclosure custom hook", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
7734
147
41
2
1284
20