!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={6031:e=>{e.exports=require("@babel/runtime/helpers/extends")},2462:e=>{e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},8619:e=>{e.exports=require("@mui/material")},3294:e=>{e.exports=require("formik")},6842:e=>{e.exports=require("i18n-react/dist/i18n-react")},2015:e=>{e.exports=require("react")}},t={};function r(l){var n=t[l];if(void 0!==n)return n.exports;var o=t[l]={exports:{}};return e[l](o,o.exports,r),o.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var l in t)r.o(t,l)&&!r.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var l={};r.r(l),r.d(l,{default:()=>f});var n=r(6031),o=r.n(n),a=r(2462),u=r.n(a),i=r(2015),c=r.n(i),d=r(8619),s=r(3294),p=r(6842),m=r.n(p);const v=["name","options"],f=e=>{let{name:t,options:r}=e,l=u()(e,v);const[n,a,i]=(0,s.useField)(t),p=r.every((({value:e})=>{var t;return null===(t=n.value)||void 0===t?void 0:t.includes(e)}));return c().createElement(d.FormControl,{fullWidth:!0,error:a.touched&&Boolean(a.error)},c().createElement(d.Select,o()({variant:"outlined",name:t,multiple:!0,value:n.value||[],onChange:e=>{const{value:t}=e.target;t.includes("all")?p?i.setValue([]):i.setValue(r.map((e=>e.value))):i.setValue(t)},onBlur:n.onBlur,displayEmpty:!0},l,{renderValue:e=>{if(null==e||!e.length)return l.placeholder||"";if(p)return m().translate("general.all");return r.filter((({value:t})=>null==e?void 0:e.includes(t))).map((({label:e})=>e)).join(", ")}}),c().createElement(d.MenuItem,{key:"all",value:"all"},c().createElement(d.Checkbox,{checked:p}),c().createElement(d.ListItemText,{primary:m().translate("general.all")})),c().createElement(d.Divider,null),r.map((({label:e,value:t})=>{var r;return c().createElement(d.MenuItem,{key:`ckbx-ddl-${t}`,value:t},c().createElement(d.Checkbox,{checked:null===(r=n.value)||void 0===r?void 0:r.includes(t)}),c().createElement(d.ListItemText,{primary:e}))}))))};return l})()));
//# sourceMappingURL=dropdown-checkbox.js.map