mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 09:00:57 +00:00
2 lines
813 B
JavaScript
2 lines
813 B
JavaScript
import{r,j as s,b8 as f}from"./index-7T7TTikv.js";import{P as d}from"./Popover-BSKEfTKH.js";const x=r.createContext({open:!1,setOpen:()=>{}});function P({children:o,open:t,onOpenChange:e,defaultOpen:i=!1}){const[n,u]=r.useState(i),a=t!==void 0,p=a?t:n,l=r.useCallback(c=>{a||u(c),e==null||e(c)},[a,e]);return s.jsx(x.Provider,{value:{open:p,setOpen:l},children:s.jsx(d,{opened:p,onChange:l,withinPortal:!0,shadow:"md",radius:"md",children:o})})}function j({children:o,asChild:t}){return s.jsx(d.Target,{children:t&&r.isValidElement(o)?o:s.jsx("span",{style:{display:"contents"},children:o})})}function b({children:o,className:t,align:e,sideOffset:i,...n}){return s.jsx(d.Dropdown,{className:f("bg-popover text-popover-foreground z-50 w-72 rounded-md border p-4 shadow-md",t),...n,children:o})}export{P,j as a,b};
|