import { t as usePrevious } from "./usePrevious.js";
import { useEffect, useState } from "react";
const useExpand = (expanded, onExpand) => {
	const [isExpanded, setIsExpanded] = useState(expanded);
	const previousIsExpanded = usePrevious(isExpanded);
	useEffect(() => {
		if (expanded !== isExpanded) setIsExpanded(expanded);
	}, [expanded]);
	useEffect(() => {
		if (onExpand && isExpanded !== !!previousIsExpanded) onExpand(isExpanded);
	}, [isExpanded, onExpand]);
	return [isExpanded, setIsExpanded];
};
export { useExpand as t };

//# sourceMappingURL=useExpand.js.map