import{jsxs as i,Fragment as j,jsx as t}from"react/jsx-runtime";import N 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{cn as f}from"../../lib/cn.js";import{createSlot as s,createHost as w}from"create-slots";import{useState as p,useRef as k,useEffect as c}from"react";const x=s("div"),g=s("div"),b=s("div"),E=({children:h,placement:v="right",isOpen:l=!1})=>{const[r,o]=p(l),[y,m]=p(r),n=k(null),d=v==="left";return c(()=>{o(l)},[l]),c(()=>{let e;return r?e=setTimeout(()=>m(!0),10):m(!1),()=>clearTimeout(e)},[r]),c(()=>{const e=a=>{n.current&&!n.current.contains(a.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[o]),w(h,e=>i(j,{children:[t(u,{onPress:()=>o(a=>!a),textStyle:"neutral",variant:"text",children:t(u.TrailingIcon,{children:t(N,{})})}),t("div",{className:f("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)]",r?"block":"hidden")}),i("div",{ref:n,className:f("absolute top-0 bottom-0 flex flex-col justify-between bg-surface-primary dark:bg-surface-secondary z-10 p-4 pb-6 w-80 transition-transform duration-300",d?"left-0 rounded-r-2xl":"right-0 rounded-l-2xl",y?"translate-x-0":d?"-translate-x-full":"translate-x-full"),children:[i("div",{className:"flex flex-col gap-6",children:[t("div",{className:"flex flex-col h-full justify-between",children:e.get(x)}),t("hr",{className:"border-surface-quaternary"}),t("div",{className:"flex flex-col",children:e.get(g)})]}),e.get(b)]})]}))},O=Object.assign(E,{Header:x,Content:g,Footer:b});export{O as Menu};
//# sourceMappingURL=menu.js.map
