{"version":3,"file":"useResponsiveWidth.cjs","sources":["../../../../src/lib/Carousel/useResponsiveWidth.ts"],"sourcesContent":["import type {MutableRefObject} from 'react';\nimport {useState, useEffect} from 'react';\n\nimport {useResizeObserver} from '@/internal/hooks/useResizeObserverNew.ts';\n\nexport type Props = {\n    width: number;\n    ref: MutableRefObject<HTMLElement | null>;\n};\n\nexport const useResponsiveWidth = ({width, ref}: Props) => {\n    const [responsiveWidth, setResponsiveWidth] = useState(width);\n    const rect = useResizeObserver(ref);\n    useEffect(() => {\n        typeof rect?.width === 'number' && setResponsiveWidth(rect?.width);\n    }, [rect?.width]);\n    return responsiveWidth;\n};\n"],"names":["useResponsiveWidth","width","ref","responsiveWidth","setResponsiveWidth","useState","rect","useResizeObserver","useEffect"],"mappings":"iLAUaA,EAAqB,CAAC,CAAC,MAAAC,EAAO,IAAAC,KAAgB,CACvD,KAAM,CAACC,EAAiBC,CAAkB,EAAIC,EAAAA,SAASJ,CAAK,EACtDK,EAAOC,EAAAA,kBAAkBL,CAAG,EAClCM,OAAAA,EAAAA,UAAU,IAAM,CACZ,OAAOF,GAAM,OAAU,UAAYF,EAAmBE,GAAM,KAAK,CACrE,EAAG,CAACA,GAAM,KAAK,CAAC,EACTH,CACX"}