import{r as u,j as e,K as b,a5 as k,fw as C,b1 as M,bi as P,R as T,aF as v,aa as z,O as A,o as m}from"./index-Y-QvttbJ.js";function B({actions:d=[],size:s="small",...f}){const[r,i]=u.useState(null),h=!!r,x=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(t.currentTarget)},o=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(null)};return e.jsxs(b,{...f,children:[e.jsx(k,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:x,size:s,children:e.jsx(C,{fontSize:s})}),e.jsx(M,{id:"actions-menu","data-cy":"actions-menu",anchorEl:r,keepMounted:!0,open:h,onClose:o,slotProps:{paper:{}},children:d.map((t,a)=>{if(typeof t=="function")return t({close:o});if(t.separator)return e.jsx(P,{},`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};
