!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={8619:e=>{e.exports=require("@mui/material")},2015:e=>{e.exports=require("react")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var l=t[r]={exports:{}};return e[r](l,l.exports,o),l.exports}(()=>{o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t}})(),(()=>{o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};o.r(r),o.d(r,{default:()=>c});var n=o(2015),l=o.n(n),a=o(8619);const c=({items:e=[],onChange:t,loadMoreData:o,boxHeight:r="400px",allItemsLabel:c="Select All",noItemsLabel:i="No items found"})=>{const[d,u]=(0,n.useState)([]),[s,p]=(0,n.useState)(!1),m=e.map((e=>e.id));return l().createElement(a.Box,{sx:{width:"100%",height:r,overflow:"auto",border:"1px solid #ccc",padding:2},onScroll:e=>{const{scrollTop:t,scrollHeight:r,clientHeight:n}=e.target;t+n>=r-20&&o&&o()}},0===e.length?l().createElement("p",null,i):l().createElement(a.FormGroup,null,l().createElement(a.FormControlLabel,{control:l().createElement(a.Checkbox,{checked:s,onChange:()=>{u([]),p(!s),t([],!s)}}),label:c}),l().createElement(a.Divider,{sx:{mb:2}}),e.map((e=>l().createElement(a.FormControlLabel,{key:e.id,control:l().createElement(a.Checkbox,{checked:d.includes(e.id)||s,onChange:()=>(e=>{let o=[];o=s?m.filter((t=>t!==e)):d.includes(e)?d.filter((t=>t!==e)):[...d,e],u(o),p(!1),t(o)})(e.id)}),label:e.name})))))};return r})()));
//# sourceMappingURL=checkbox-list.js.map