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{Flex as o}from"@vibe/layout/mockedClassNames";import n from"../Text/Text.js";import s from"classnames";import a from"../Divider/Divider.js";var m=i((function(i,m){var d=i.options,u=i.selectedItems,v=i.highlightedIndex,c=i.menuAriaLabel,p=i.getMenuProps,f=i.getItemProps,g=i.size,h=void 0===g?"medium":g,y=i.withGroupDivider,b=void 0!==y&&y,x=i.dir,E=void 0===x?"ltr":x,j=i.itemRenderer,I=i.menuRenderer,k=i.noOptionsMessage,O=void 0===k?"No results":k,P=i.stickyGroupTitle,B=void 0!==P&&P,L=i.renderOptions,N=void 0===L||L,T=i.onScroll,z=i.maxMenuHeight,D=void 0===z?300:z,H="small"===h?"text2":"text1",M=N?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 O?t.createElement(o,{justify:"center"},t.createElement(l,{component:"div",item:{label:O,value:""},size:h,readOnly:!0})):O):d.map((function(i,o){var m;return t.createElement(t.Fragment,{key:null!==(m=i.label)&&void 0!==m?m:o},i.label&&t.createElement("li",{className:s(r.groupTitle,e({},r.sticky,B))},t.createElement(n,{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!==v&&v===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"})})),b&&d.length-1>o&&t.createElement(a,null))})):null;return t.createElement("ul",Object.assign({ref:m,dir:E,className:r.wrapper},null==p?void 0:p({"aria-label":c}),{onScroll:T,style:{maxHeight:D}}),I&&N?I({children:M,filteredOptions:d,selectedItem:(null==u?void 0:u[0])||null,selectedItems:u||[]}):M)}));export{m as default};
//# sourceMappingURL=BaseList.js.map
