import{j as e,P as y,Q as S,S as O,R as x,K as n,bq as I,eO as T,T as f,ff as z,bj as W,o as r}from"./index-CCv_8omK.js";function B({fullWidth:j=!1,multiple:a=!1,required:o=!1,label:c="",placeholer:m="",options:s=[],helperText:b="",error:v=!1,margin:p="",size:u,...h}){const g=s.find(l=>l.value===h.value)?.title;return e.jsxs(y,{margin:p,fullWidth:j,error:v,children:[e.jsx(S,{size:u,children:`${c}${o?"*":""}`}),e.jsxs(O,{multiple:a,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},input:e.jsx(z,{defaultValue:g,sx:{flex:1},required:o,label:c,inputProps:{margin:p},size:u}),renderValue:l=>{if(a)return e.jsx(n,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:l.map(i=>{const d=s.find(w=>w.value===i);return d&&d.title&&e.jsx(T,{size:"small",label:d.title},i)})});const t=s.find(i=>i.value===l);return t&&t.title&&e.jsxs(n,{children:[e.jsx(f,{component:"span",children:t.title}),e.jsx(f,{component:"span",variant:"body2",sx:{marginLeft:1,color:"text.secondary"},children:t.description})]})},IconComponent:l=>e.jsx(I,{...l,width:20,height:20}),...h,children:[e.jsx(x,{disabled:!0,children:e.jsx("em",{children:m})}),!o&&!a&&e.jsx(x,{value:"",children:"None"}),s.map(l=>l&&l.value&&e.jsx(x,{value:l.value,children:e.jsxs(n,{children:[e.jsx("span",{children:l.title}),l.description&&e.jsx(n,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:l.description})]})},l.value))]}),e.jsx(W,{children:b})]})}B.propTypes={error:r.bool,required:r.bool,multiple:r.bool,fullWidth:r.bool,label:r.string,placeholer:r.string,options:r.array,helperText:r.string,margin:r.string,size:r.string,textDirection:r.oneOf("row","column")};export{B as S};
