import"@babel/runtime/helpers/defineProperty";import e from"prop-types";import{withStyles as r,Checkbox as t,FormControl as a,InputLabel as i,Select as l,MenuItem as n,FormHelperText as o}from"@material-ui/core";import d from"classnames";import{jsxs as u,jsx as p}from"react/jsx-runtime";var s=r({root:{paddingLeft:"7px"}})(t);function m(e){var r=e.currentValue,t=e.defaultValue,m=e.options,c=e.placeholder,h=e.onChange,f=e.multiple,x=e.disabled,g=e.classes,v=e.renderValue,b=e.errorText,y=e["data-testid"],V=r||t,C=d(g.menuItem,f&&g.multipleMenuItem);return u(a,{className:g.formControl,error:!!b,children:[p(i,{shrink:void 0!==V,children:c}),p(l,{"data-testid":"".concat(y,"_select"),value:V,onChange:function(e){return h(e.target.value)},multiple:f,disabled:x,renderValue:v,MenuProps:{className:g.selectMenu,anchorOrigin:{vertical:"top"}},autoWidth:!0,displayEmpty:!0,children:m&&m.map((function(e){return u(n,{"data-testid":"".concat(y,"_item_").concat(e.label,"MenuItem"),value:e.value,className:C,children:[f&&p(s,{color:"primary",checked:V&&V.includes(e.value)}),e.label]},e.value)}))}),!!b&&p(o,{children:b})]})}m.propTypes={currentValue:e.oneOfType([e.number,e.string,e.array]),defaultValue:e.oneOfType([e.number,e.string,e.array]),onChange:e.func.isRequired,options:e.arrayOf(e.any).isRequired,placeholder:e.string,multiple:e.bool,disabled:e.bool,classes:e.shape({}).isRequired,renderValue:e.func,errorText:e.string,"data-testid":e.string},m.defaultProps={currentValue:void 0,defaultValue:void 0,multiple:!1,placeholder:"Choose An Option",disabled:!1,renderValue:void 0,errorText:"","data-testid":"DropdownEditor"};var c=r({formControl:{minWidth:"200px",maxWidth:"200px",margin:"10px 20px 10px 0"},selectMenu:{maxHeight:"400px"},menuItem:{minWidth:"200px"},multipleMenuItem:{paddingLeft:"5px",minWidth:"200px"}})(m);export{c as default};
