import{r as c,j as i,N as h}from"./index-B-YXshIJ.js";const g=({id:a,title:m,className:o,onChange:s,options:l,value:d})=>{const t=c.useRef(null),n=c.useCallback(()=>{var u;if(!t.current)return;const e=document.createElement("select");e.className=o||"";const r=document.createElement("option");r.textContent=((u=t.current.querySelector("option:checked"))==null?void 0:u.textContent)||"",e.append(r),document.body.append(e);const{width:x}=e.getBoundingClientRect();e.remove(),t.current.style.width="calc(".concat(x,"px - 10px - 0.2rem)")},[o]),p=c.useCallback(e=>(n(),s(e.target.value)),[s,n]);return c.useEffect(()=>{n()},[n,l]),i.jsx("select",{title:m,id:a,ref:t,onChange:p,value:d,className:h("inline-block border-0 ring-0 focus:ring-0 bg-transparent","text-theme-highlight text-sm font-medium p-0 m-0 cursor-pointer",o),children:l.map(({value:e,label:r})=>i.jsx("option",{value:e,children:r},e))})};export{g as I};
