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