import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import s,{forwardRef as n,useRef as t,useMemo as r}from"react";import"prop-types";import o from"classnames";import i from"../../hooks/useMergeRefs.js";import a from"../MenuButton/MenuButton.js";import"./ResponsiveList.scss.js";import l from"../../hooks/useElementsOverflowingIndex.js";var m=[],u=n((function(n,u){var p=n.id,d=n.className,c=n.rootClassName,v=n.children,f=n.menuButtonSize,g=n.paddingSize,N=n.dialogZIndex,z=n.dialogClassName,C=n.menuButtonClassName,B=n.resizeDebounceTime,b=n.menuButtonAriaLabel,h=n.menuButtonProps,x=t(null),L=i({refs:[u,x]}),E=l({ref:x,children:v,paddingSize:g,resizeDebounceTime:B,ignoreLast:!0}),S=r((function(){return-1===E?v:s.Children.toArray(v).slice(0,E)}),[v,E]),A=r((function(){if(-1===E)return m;var e=s.Children.toArray(v);return e.slice(E,e.length)}),[v,E]),j=r((function(){return s.Children.toArray(v).map((function(e){var s;return(null==e||null===(s=e.props)||void 0===s?void 0:s.responsiveListPlaceholder)||e}))}),[v]);return s.createElement("div",{className:o("responsive-list--root",c),id:p},null!==E&&s.createElement("div",{className:o("responsive-list--wrapper",d)},S,!!A.length&&s.createElement(a,e({componentClassName:o("responsive-list-menu-button",C),size:f,openDialogComponentClassName:o("responsive-list--menu-button-dialog",z),zIndex:N,ariaLabel:b},h),s.createElement("div",{className:"responsive-list-menu-wrapper-flex"},A))),s.createElement("div",{ref:L,className:o("responsive-list--wrapper responsive-list--dummy",d)},j,s.createElement(a,e({componentClassName:o("responsive-list-menu-button",C),size:f,openDialogComponentClassName:o("responsive-list--menu-button-dialog",z),zIndex:N,ariaLabel:b},h),s.createElement("div",{className:"responsive-list-menu-wrapper-flex"}))))}));u.menuButtonSizes=a.sizes,u.defaultProps={id:"",className:"",dialogClassName:"",menuButtonClassName:"",rootClassName:"",menuButtonAriaLabel:"More Actions",menuButtonProps:{},menuButtonSize:u.menuButtonSizes.SMALL,paddingSize:32,dialogZIndex:9999,resizeDebounceTime:0};var p=u;export{p as default};
