import{r as u,j as e,K as b,a4 as k,fu as C,b0 as M,bh as P,R as T,aE as v,a9 as z,O as A,o as m}from"./index-CCv_8omK.js";function B({actions:d=[],size:s="small",...h}){const[r,i]=u.useState(null),f=!!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,{...h,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:f,onClose:o,slotProps:{paper:{}},children:d.map((t,n)=>{if(typeof t=="function")return t({close:o});if(t.separator)return e.jsx(P,{},`separator-${n}`);const{icon:y,text:j,render:a,onClick:g,disabled:E=!1,tip:c,...I}=t,l=a&&typeof a=="function"?a({close:o}):u.createElement(T,{...I,disabled:E,dense:!0,onClick:async p=>{p.stopPropagation(),await g?.(p),o()},key:n,"data-cy":`actions-menu-${n}`},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};
