{"version":3,"file":"Drawer.cjs","sources":["../../../../src/components/overlay/drawer/Drawer.tsx"],"sourcesContent":["import DrawerActionItem from '@components/overlay/drawer/components/items/drawer-action-item/DrawerActionItem.tsx'\r\nimport DrawerBody from '@components/overlay/drawer/components/blocs/drawer-body/DrawerBody.tsx'\r\nimport DrawerFooter from '@components/overlay/drawer/components/blocs/drawer-footer/DrawerFooter.tsx'\r\nimport DrawerHeader from '@components/overlay/drawer/components/blocs/drawer-header/DrawerHeader.tsx'\r\nimport DrawerInline from '@components/overlay/drawer/components/variants/drawer-inline/DrawerInline.tsx'\r\nimport DrawerMini from '@components/overlay/drawer/components/variants/drawer-mini/DrawerMini.tsx'\r\nimport DrawerNavItem from '@components/overlay/drawer/components/items/drawer-nav-item/DrawerNavItem.tsx'\r\nimport DrawerPortal from '@components/overlay/drawer/components/variants/drawer-portal/DrawerPortal.tsx'\r\nimport DrawerSection from '@components/overlay/drawer/components/blocs/drawer-section/DrawerSection.tsx'\r\nimport DrawerSectionItem from '@components/overlay/drawer/components/items/drawer-section-item/DrawerSectionItem.tsx'\r\nimport { DRAWER_MODES, DRAWER_SIZE_WIDTH } from '@components/overlay/drawer/constants'\r\nimport { DrawerContext } from '@components/overlay/drawer/context/Drawer.context.ts'\r\nimport { useDrawer } from '@components/overlay/drawer/hooks/use-drawer/useDrawer.hook.ts'\r\nimport type {\r\n    DrawerCompound,\r\n    DrawerProps,\r\n} from '@components/overlay/drawer/types'\r\nimport { memo, useId } from 'react'\r\n\r\n/**\r\n * A flexible drawer with three render modes: portal, inline and mini.\r\n *\r\n * Compose with `Drawer.Header`, `Drawer.Body` and `Drawer.Footer`:\r\n *\r\n * @example\r\n * ```tsx\r\n * <Drawer open={open} onOpenChange={setOpen} mode=\"portal\">\r\n *   <Drawer.Header title=\"Settings\" />\r\n *   <Drawer.Body>\r\n *     <Drawer.Section title=\"Navigation\">\r\n *       <Drawer.NavItem label=\"Dashboard\" href=\"/dashboard\" startIcon=\"lucide:home\" />\r\n *     </Drawer.Section>\r\n *     <Drawer.Section title=\"Account\">\r\n *       <Drawer.SectionItem label=\"Account\" startIcon=\"lucide:user\">\r\n *         <Drawer.NavItem label=\"Profile\" href=\"/profile\" />\r\n *         <Drawer.ActionItem label=\"Sign out\" startIcon=\"lucide:log-out\" />\r\n *       </Drawer.SectionItem>\r\n *     </Drawer.Section>\r\n *   </Drawer.Body>\r\n *   <Drawer.Footer>\r\n *     <Button onClick={() => setOpen(false)}>Close</Button>\r\n *   </Drawer.Footer>\r\n * </Drawer>\r\n * ```\r\n */\r\nconst Drawer = memo<DrawerProps>(({\r\n    open: controlledOpen,\r\n    defaultOpen = false,\r\n    onOpenChange,\r\n    mode = DRAWER_MODES.portal,\r\n    position = 'left',\r\n    size = 'md',\r\n    withBackdrop = true,\r\n    collapsedWidth,\r\n    backgroundColor,\r\n    defaultAriaLabel = 'Drawer',\r\n    children,\r\n    className,\r\n    style,\r\n    'aria-label': ariaLabel,\r\n    'aria-labelledby': ariaLabelledBy,\r\n    ...props\r\n}) => {\r\n    const generatedTitleId = useId()\r\n\r\n    const { contextValue, handleOpenChange, commonRendererProps } = useDrawer({\r\n        open: controlledOpen,\r\n        defaultOpen,\r\n        onOpenChange,\r\n        mode,\r\n        position,\r\n        size,\r\n        withBackdrop,\r\n        collapsedWidth,\r\n        backgroundColor,\r\n        defaultAriaLabel,\r\n        children,\r\n        className,\r\n        style,\r\n        'aria-label': ariaLabel,\r\n        'aria-labelledby': ariaLabelledBy,\r\n        titleId: generatedTitleId,\r\n        ...props,\r\n    })\r\n\r\n    const renderer = (() => {\r\n        if (mode === DRAWER_MODES.portal) {\r\n            return (\r\n                <DrawerPortal\r\n                    {...commonRendererProps}\r\n                    onOpenChange={handleOpenChange}\r\n                    withBackdrop={withBackdrop}\r\n                />\r\n            )\r\n        }\r\n\r\n        if (mode === DRAWER_MODES.mini) {\r\n            return (\r\n                <DrawerMini\r\n                    {...commonRendererProps}\r\n                    sizeWidthMap={DRAWER_SIZE_WIDTH}\r\n                    collapsedWidth={collapsedWidth}\r\n                />\r\n            )\r\n        }\r\n\r\n        return (\r\n            <DrawerInline\r\n                {...commonRendererProps}\r\n                sizeWidthMap={DRAWER_SIZE_WIDTH}\r\n            />\r\n        )\r\n    })()\r\n\r\n    return (\r\n        <DrawerContext.Provider value={contextValue}>\r\n            {renderer}\r\n        </DrawerContext.Provider>\r\n    )\r\n}) as unknown as DrawerCompound\r\n\r\nDrawer.displayName = 'Drawer'\r\nDrawer.Header = DrawerHeader\r\nDrawer.Body = DrawerBody\r\nDrawer.Footer = DrawerFooter\r\nDrawer.Section = DrawerSection\r\nDrawer.NavItem = DrawerNavItem\r\nDrawer.ActionItem = DrawerActionItem\r\nDrawer.SectionItem = DrawerSectionItem\r\n\r\nexport { Drawer }\r\n"],"names":["Drawer","memo","controlledOpen","defaultOpen","onOpenChange","mode","DRAWER_MODES","position","size","withBackdrop","collapsedWidth","backgroundColor","defaultAriaLabel","children","className","style","ariaLabel","ariaLabelledBy","props","generatedTitleId","useId","contextValue","handleOpenChange","commonRendererProps","useDrawer","renderer","jsx","DrawerPortal","DrawerMini","DRAWER_SIZE_WIDTH","DrawerInline","DrawerContext","DrawerHeader","DrawerBody","DrawerFooter","DrawerSection","DrawerNavItem","DrawerActionItem","DrawerSectionItem"],"mappings":"m9BA6CMA,EAASC,EAAAA,KAAkB,CAAC,CAC9B,KAAMC,EACN,YAAAC,EAAc,GACd,aAAAC,EACA,KAAAC,EAAOC,EAAAA,aAAa,OACpB,SAAAC,EAAW,OACX,KAAAC,EAAO,KACP,aAAAC,EAAe,GACf,eAAAC,EACA,gBAAAC,EACA,iBAAAC,EAAmB,SACnB,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,aAAcC,EACd,kBAAmBC,EACnB,GAAGC,CACP,IAAM,CACF,MAAMC,EAAmBC,EAAAA,MAAA,EAEnB,CAAE,aAAAC,EAAc,iBAAAC,EAAkB,oBAAAC,CAAA,EAAwBC,EAAAA,UAAU,CACtE,KAAMtB,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