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