"use strict";var e=require("react/jsx-runtime"),p=require("../icons/ico-caret-down.js"),o=require("../primitives/button.js");require("../primitives/checkbox.js"),require("../primitives/dropdown-selector.js"),require("../primitives/popover.js"),require("../primitives/radio.js"),require("../primitives/segmented-control.js"),require("../primitives/switch.js");var v=require("../primitives/text.js"),l=require("../../lib/cn.js"),t=require("react");const q=({isOpen:r=!1,title:c,onToggle:a,children:d,showCloseButton:x=!0})=>{const[m,i]=t.useState(r),[f,u]=t.useState(r),s=t.useRef(null);t.useEffect(()=>{let n;return r?(i(!0),n=setTimeout(()=>u(!0),10)):u(!1),()=>clearTimeout(n)},[r]),t.useEffect(()=>{const n=h=>{s.current&&!s.current.contains(h.target)&&a(!1)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[a]);const b=()=>{r||i(!1)},g=t.useCallback(()=>{a(!1)},[a]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.cn("absolute bottom-0 left-0 right-0 h-full bg-[color-mix(in_srgb,var(--color-text-primary)_20%,transparent)] dark:bg-[rgba(0,0,0,0.7)] backdrop-blur-[3px]",r?"block":"hidden")}),m&&e.jsxs("div",{ref:s,className:l.cn("absolute bottom-0 left-0 right-0 bg-surface-primary dark:bg-surface-secondary rounded-t-3xl shadow-[0px_-12px_56px_0px_rgba(119,118,122,0.15)] z-10 transition-transform duration-300",f?"translate-y-0":"translate-y-full"),onTransitionEnd:b,children:[e.jsxs("div",{className:"flex flex-row items-center gap-2.5 justify-between px-6 py-4",children:[e.jsx(v.default,{fontWeight:"medium",children:c}),x&&e.jsx(o.default,{size:"sm",variant:"neutral",onPress:g,children:e.jsx(o.default.LeadingIcon,{children:e.jsx(p.default,{})})})]}),e.jsx("div",{className:"px-6 pb-6",children:d})]})]})};exports.Drawer=q;
//# sourceMappingURL=drawer.js.map
