pmg-ui-kit 0.0.94 → 0.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@ interface AccordionProps {
|
|
|
4
4
|
content: ReactNode;
|
|
5
5
|
defaultOpen?: boolean;
|
|
6
6
|
className?: string;
|
|
7
|
-
onOpen?: () => void
|
|
7
|
+
onOpen?: () => void | Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
export declare const Accordion: ({ title, content, defaultOpen, className, onOpen }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -6,7 +6,7 @@ export const Accordion = ({ title, content, defaultOpen, className, onOpen }) =>
|
|
|
6
6
|
const contentRef = useRef(null);
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
if (isOpen && onOpen) {
|
|
9
|
-
onOpen();
|
|
9
|
+
void onOpen();
|
|
10
10
|
}
|
|
11
11
|
}, [isOpen]);
|
|
12
12
|
useEffect(() => {
|
|
@@ -18,7 +18,7 @@ export const Accordion = ({ title, content, defaultOpen, className, onOpen }) =>
|
|
|
18
18
|
setContentHeight(0);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
}, [isOpen]);
|
|
21
|
+
}, [isOpen, contentRef.current]);
|
|
22
22
|
const toggleAccordion = () => {
|
|
23
23
|
setIsOpen(!isOpen);
|
|
24
24
|
};
|