import{r as u,j as e,J as k,a4 as C,gq as P,a$ as b,bg as M,U as T,aE as v,a9 as z,P as A,o as m}from"./index-DQhyMeoV.js";function B({actions:d=[],size:s="small",...h}){const[r,i]=u.useState(null),x=!!r,f=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(t.currentTarget)},o=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(null)};return e.jsxs(k,{...h,children:[e.jsx(C,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:f,size:s,children:e.jsx(P,{fontSize:s})}),e.jsx(b,{id:"actions-menu","data-cy":"actions-menu",anchorEl:r,keepMounted:!0,open:x,onClose:o,slotProps:{paper:{}},children:d.map((t,a)=>{if(typeof t=="function")return t({close:o});if(t.separator)return e.jsx(M,{},`separator-${a}`);const{icon:y,text:j,render:n,onClick:g,disabled:E=!1,tip:c,...I}=t,l=n&&typeof n=="function"?n({close:o}):u.createElement(T,{...I,disabled:E,dense:!0,onClick:async p=>{p.stopPropagation(),await g?.(p),o()},key:a,"data-cy":`actions-menu-${a}`},e.jsx(v,{style:{minWidth:24,marginRight:8},children:y}),e.jsx(z,{primary:j}));return c?e.jsx(A,{title:c,children:e.jsx("span",{children:l})}):l})})]})}B.propTypes={actions:m.array,size:m.oneOf(["small","medium","large"])};export{B as A};
