import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t,{forwardRef as i}from"react";import l from"../BaseListItem/BaseListItem.js";import r from"./BaseList.module.scss.js";import o from"../Text/Text.js";import n from"classnames";import s from"../Divider/Divider.js";import a from"../../../components/layout/dist/Flex/Flex.js";var m=i((function(i,m){var d=i.options,u=i.selectedItems,p=i.highlightedIndex,v=i.menuAriaLabel,c=i.getMenuProps,f=i.getItemProps,g=i.size,h=void 0===g?"medium":g,x=i.withGroupDivider,y=void 0!==x&&x,b=i.dir,E=void 0===b?"ltr":b,j=i.itemRenderer,I=i.menuRenderer,O=i.noOptionsMessage,P=void 0===O?"No results":O,k=i.stickyGroupTitle,B=void 0!==k&&k,L=i.renderOptions,T=void 0===L||L,z=i.onScroll,D=i.maxMenuHeight,F=void 0===D?300:D,H="small"===h?"text2":"text1",M=T?d.every((function(e){var t;return 0===(null===(t=e.options)||void 0===t?void 0:t.length)}))?t.createElement("div",{role:"status"},"string"==typeof P?t.createElement(a,{justify:"center"},t.createElement(l,{component:"div",item:{label:P,value:""},size:h,readOnly:!0})):P):d.map((function(i,a){var m;return t.createElement(t.Fragment,{key:null!==(m=i.label)&&void 0!==m?m:a},i.label&&t.createElement("li",{className:n(r.groupTitle,e({},r.sticky,B))},t.createElement(o,{type:H,color:"inherit"},i.label)),i.options.map((function(e,i){var r,o=null!==(r=null==f?void 0:f({item:e,index:e.index}))&&void 0!==r?r:{},n=void 0!==p&&p===e.index&&!e.disabled,s=(null==u?void 0:u.some((function(t){return(null==t?void 0:t.value)===e.value})))&&!e.disabled;return t.createElement(l,{itemProps:o,key:"string"==typeof e.value?e.value:i,size:h,highlighted:n,selected:s,itemRenderer:j,item:e,role:"option"})})),y&&d.length-1>a&&t.createElement(s,null))})):null;return t.createElement("ul",Object.assign({ref:m,dir:E,className:r.wrapper},null==c?void 0:c({"aria-label":v}),{onScroll:z,style:{maxHeight:F}}),I&&T?I({children:M,filteredOptions:d,selectedItem:(null==u?void 0:u[0])||null,selectedItems:u||[]}):M)}));export{m as default};
//# sourceMappingURL=BaseList.js.map
