"use strict";var e=require("react/jsx-runtime");require("@styled/tokens");var h=require("../icons/ico-caret-down.js"),l=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 q=require("../primitives/text.js"),o=require("@styled/jsx"),t=require("react");const j=({isOpen:r=!1,title:c,onToggle:s,children:d,showCloseButton:x=!0})=>{const[f,a]=t.useState(r),[p,u]=t.useState(r),i=t.useRef(null);t.useEffect(()=>{let n;return r?(a(!0),n=setTimeout(()=>u(!0),10)):u(!1),()=>clearTimeout(n)},[r]),t.useEffect(()=>{const n=g=>{i.current&&!i.current.contains(g.target)&&s(!1)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[s]);const b=()=>{r||a(!1)},m=t.useCallback(()=>{s(!1)},[s]);return e.jsxs(e.Fragment,{children:[e.jsx(o.Box,{position:"absolute",display:r?"block":"none",h:"full",bottom:0,left:0,right:0,bg:"text.primary/20",_dark:{bg:"rgba(0, 0, 0, .7)"},backdropFilter:"blur(3px)"}),f&&e.jsxs(o.Box,{ref:i,position:"absolute",transform:p?"translateY(0)":"translateY(100%)",transition:"transform 0.3s",bottom:0,left:0,right:0,bg:"surface.primary",_dark:{bg:"surface.secondary"},roundedTop:"3xl",boxShadow:"0px -12px 56px 0px rgba(119, 118, 122, 0.15)",onTransitionEnd:b,zIndex:10,children:[e.jsxs(o.HStack,{justifyContent:"space-between",px:6,py:4,children:[e.jsx(q.default,{fontWeight:"medium",children:c}),x&&e.jsx(l.default,{size:"sm",variant:"neutral",onPress:m,children:e.jsx(l.default.LeadingIcon,{children:e.jsx(h.default,{})})})]}),e.jsx(o.Box,{px:6,pb:6,children:d})]})]})};exports.Drawer=j;
//# sourceMappingURL=drawer.js.map
