"use strict";var e=require("react/jsx-runtime");require("@styled/tokens");var q=require("../icons/ico-menu.js"),f=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"),require("../primitives/text.js");var r=require("@styled/jsx"),i=require("create-slots"),n=require("react");const x=i.createSlot("div"),g=i.createSlot("div"),b=i.createSlot("div"),p=({children:m,placement:h="right",isOpen:u=!1})=>{const[a,s]=n.useState(u),[j,d]=n.useState(a),o=n.useRef(null),c=h==="left";return n.useEffect(()=>{s(u)},[u]),n.useEffect(()=>{let t;return a?t=setTimeout(()=>d(!0),10):d(!1),()=>clearTimeout(t)},[a]),n.useEffect(()=>{const t=l=>{o.current&&!o.current.contains(l.target)&&s(!1)};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[s]),i.createHost(m,t=>e.jsxs(e.Fragment,{children:[e.jsx(f.default,{onPress:()=>s(l=>!l),textStyle:"neutral",variant:"text",children:e.jsx(f.default.TrailingIcon,{children:e.jsx(q.default,{})})}),e.jsx(r.Box,{position:"absolute",display:a?"block":"none",h:"full",bottom:0,left:0,right:0,bg:"text.primary/20",_dark:{bg:"rgba(0, 0, 0, .7)"}}),e.jsxs(r.Stack,{ref:o,position:"absolute",transform:j?"translateX(0)":c?"translateX(-100%)":"translateX(100%)",transition:"transform 0.3s",top:0,bottom:0,...c?{left:0}:{right:0},bg:"surface.primary",_dark:{bg:"surface.secondary"},...c?{roundedRight:"2xl"}:{roundedLeft:"2xl"},zIndex:10,justifyContent:"space-between",p:4,pb:6,w:80,children:[e.jsxs(r.Stack,{gap:6,children:[e.jsx(r.Stack,{h:"full",justifyContent:"space-between",children:t.get(x)}),e.jsx(r.Divider,{color:"surface.quaternary"}),e.jsx(r.Stack,{children:t.get(g)})]}),t.get(b)]})]}))},v=Object.assign(p,{Header:x,Content:g,Footer:b});exports.Menu=v;
//# sourceMappingURL=menu.js.map
