forstok-ui-lib 8.5.6 → 8.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4448,7 +4448,7 @@ function M(e,t){if(!1===e||null==e)throw new Error(t)}function L(e,t){if(!e){"un
4448
4448
  display: block;
4449
4449
  }
4450
4450
  }
4451
- `,ha=t=>{var{children:i,title:n,subTitle:a,$externalWidth:o,$externalMinWidth:l,$internalWidth:s,$area:d,$openPosition:C,$placement:c,$top:p,onClick:h,$alias:g,type:x,portalId:m,$bottom:u,$isPopup:v}=t,w=D(t,["children","title","subTitle","$externalWidth","$externalMinWidth","$internalWidth","$area","$openPosition","$placement","$top","onClick","$alias","type","portalId","$bottom","$isPopup"]);const f=r.useRef(null),F=(e,t)=>{const r=Number.parseInt(e||"",10);return Number.isNaN(r)?t:r},y=e=>null==e?void 0:e.querySelector("._refDropdownWrapper"),A=(e,t)=>{if("top"===c)return"top";const r=e.getBoundingClientRect(),i=t.getBoundingClientRect().height||t.offsetHeight,n=F(p,40),a=F(u,35),o=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)-r.bottom,l=r.top,s=i+Math.max(n-r.height,0),d=i+Math.max(a-r.height,0);return o>=s?"bottom":l>=d||l>o?"top":"bottom"},b=(e,t)=>{if("top"===t)return e.style.top="auto",void(e.style.bottom=`${F(u,35)}px`);e.style.top=`${F(p,40)}px`,e.style.bottom="auto"},E=e=>{const t=y(e);t&&(t.style.top="",t.style.bottom="",t.style.left="",t.style.right="",t.style.transform="")},B=e=>{if(!m)return;const t=document.querySelector(`#${m} ._refDropdownPortal`),r=y(t);if(!t||!r)return;const i=e.getBoundingClientRect(),n=A(e,r),a=r.getBoundingClientRect().width||r.offsetWidth,o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;let l=i.left+i.width-a;"left"===C?l=i.left:"center"===C&&(l=i.left+i.width/2-a/2),l=Math.max(0,Math.min(l,Math.max(o-a,0))),r.style.left="0",r.style.right="auto",r.style.transform="none",b(r,n),t.style.left=`${l}px`,t.style.top=`${"top"===n?i.bottom:i.top}px`,t.style.zIndex=v?"101":"8"},j=()=>{const e=document.getElementsByClassName("_refContainer is-shown")[0];e&&m&&B(e)},k=()=>{const e=document.getElementsByClassName("_refContainer is-shown"),t=document.getElementsByTagName("BODY")[0];if(e.length){t.classList.remove("is-immuned");for(let t=0;t<e.length;t++){e[t].querySelector("._refDropdownOverlay").style.display="none",e[t].classList.remove("is-shown"),E(e[t])}}const r=document.querySelector("._refScrollContainer");r&&r.removeEventListener("scroll",j,!0),setTimeout((()=>{if(m){const e=document.getElementsByClassName("_refDropdownPortal is-shown");if(e.length)for(let t=0;t<e.length;t++)E(e[t]),e[t].style.left="0",e[t].style.top="0",e[t].classList.remove("is-shown")}}),10)},M=e=>{const t=f.current;if(t){const r=e.target.closest(`.${t.classList[0]}`);if(!r)return;const i=r.closest("._refContainer"),n=document.getElementsByTagName("BODY")[0];if(i){const t=i.querySelector("._refDropdownOverlay");i.classList.contains("is-shown")?(t.style.display="none",n.classList.remove("is-immuned"),i.classList.remove("is-shown"),setTimeout((()=>{if(m){const e=document.querySelector(`#${m} ._refDropdownPortal`),t=document.querySelector("._refScrollContainer");e&&(E(e),e.classList.remove("is-shown"),e.style.left="0px",e.style.top="0px",t&&t.removeEventListener("scroll",j,!0))}}),10),E(i)):(k(),t.style.display="block",n.classList.add("is-immuned"),i.classList.add("is-shown"),setTimeout((()=>{if(m){const e=document.querySelector(`#${m} ._refDropdownPortal`),t=document.querySelector("._refScrollContainer");e&&(e.classList.add("is-shown"),setTimeout((()=>{B(i),t&&t.addEventListener("scroll",j,!0)}),10))}else(e=>{const t=y(e);if(!t)return;const r=A(e,t);b(t,r)})(i)}),10),h&&h(e))}}};r.useEffect((()=>(setTimeout((()=>{const e=document.querySelectorAll("._refDropdownPortal._refHover");for(let t of e)t&&t.addEventListener("mouseenter",(e=>{const t=e.target;t.classList.add("is-shown"),t.classList.add("unhiddenable")})),t&&t.addEventListener("mouseleave",(e=>{const t=e.target;t.classList.remove("is-shown"),t.classList.remove("unhiddenable"),t.style.left="0",t.style.top="0"}))}),1),()=>{const e=document.querySelectorAll("._refDropdownPortal._refHover");for(let t of e)t&&t.removeEventListener("mouseenter",(e=>{const t=e.target;t.classList.add("is-shown"),t.classList.add("unhiddenable")}),!0),t&&t.removeEventListener("mouseleave",(e=>{const t=e.target;t.classList.remove("is-shown"),t.classList.remove("unhiddenable"),t.style.left="0",t.style.top="0"}),!0)})),[m]);const L=a?e.jsx(da,{children:a}):null,O=n?e.jsxs(sa,{children:[n," ",L]}):null,z=i.filter((e=>r.isValidElement(e)?"control"===e.props["aria-label"]:null)),I=z&&r.isValidElement(z[0])?"hover"===x?e.jsxs(oa,{children:[e.jsx(aa,Object.assign({className:"_refDropdownControl"},m&&{onMouseEnter:e=>{const t=f.current;if(t){const r=e.target.closest(`.${t.classList[0]}`);if(!r)return;const i=document.querySelectorAll("._refDropdownPortal");for(const e of i)e.classList.remove("is-shown"),e.style.left="0",e.style.top="0";const n=r.closest("._refContainer");if(n){const e=document.querySelector(`#${m} ._refDropdownPortal`);e&&(e.classList.add("is-shown"),setTimeout((()=>{B(n)}),10))}}},onMouseLeave:e=>{const t=f.current;if(t){if(!e.target.closest(`.${t.classList[0]}`))return;setTimeout((()=>{const e=document.querySelector(`#${m} ._refDropdownPortal`);e&&!e.classList.contains("unhiddenable")&&(E(e),e.classList.remove("is-shown"),e.style.left="0",e.style.top="0")}),150)}}},{children:z[0].props.children})),e.jsx(aa,{className:"_refDropdownControlMobile",ref:f,onClick:M,children:z[0].props.children})]}):e.jsx(aa,{ref:f,onClick:M,children:z[0].props.children}):null,P=i.filter((e=>r.isValidElement(e)?"body"===e.props["aria-label"]:null)),Q=P&&r.isValidElement(P[0])?e.jsx(Ca,{$area:d,children:P[0].props.children}):null,T=i.filter((e=>r.isValidElement(e)?"action"===e.props["aria-label"]:null)),S=T&&r.isValidElement(T[0])?e.jsx(ca,{$position:T[0].props["data-position"],className:T[0].props.className,children:T[0].props.children}):null,H=e.jsxs(ia,Object.assign({className:"_refDropdownWrapper"},s&&{$internalWidth:s},p&&{$top:p},C&&{$openPosition:C},c&&{$placement:c},u&&{$bottom:u},{children:[O,Q,S]}));return e.jsxs(la,Object.assign({className:"_refContainer "+(x?`_refContainer${x}`:"")},o&&{$externalWidth:o},l&&{$externalMinWidth:l},d&&{$area:d},p&&{$top:p},g&&{$alias:g},C&&{$openPosition:C},c&&{$placement:c},u&&{$bottom:u},w,{children:[I,e.jsx(na,{className:"_refDropdownOverlay",onClick:()=>{k()}}),m?e.jsx(ra,{wrapperId:m,children:e.jsx(pa,{className:"_refDropdownPortal "+("hover"===x?"_refHover":""),children:H})}):H]}))},ga=t.css`
4451
+ `,ha=t=>{var{children:i,title:n,subTitle:a,$externalWidth:o,$externalMinWidth:l,$internalWidth:s,$area:d,$openPosition:C,$placement:c,$top:p,onClick:h,$alias:g,type:x,portalId:m,$bottom:u,$isPopup:v}=t,w=D(t,["children","title","subTitle","$externalWidth","$externalMinWidth","$internalWidth","$area","$openPosition","$placement","$top","onClick","$alias","type","portalId","$bottom","$isPopup"]);const f=r.useRef(null),F=(e,t)=>{const r=Number.parseInt(e||"",10);return Number.isNaN(r)?t:r},y=e=>null==e?void 0:e.querySelector("._refDropdownWrapper"),A=(e,t)=>{if("top"===c)return"top";const r=e.getBoundingClientRect(),i=t.getBoundingClientRect().height||t.offsetHeight,n=F(p,40),a=F(u,35),o=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)-r.bottom,l=r.top,s=i+Math.max(n-r.height,0),d=i+Math.max(a-r.height,0);return o>=s?"bottom":l>=d||l>o?"top":"bottom"},b=(e,t)=>{if("top"===t)return e.style.animation="none",e.style.top="auto",void(e.style.bottom=`${F(u,35)}px`);e.style.top=`${F(p,40)}px`,e.style.bottom="auto"},E=e=>{const t=y(e);t&&(t.style.top="",t.style.bottom="",t.style.left="",t.style.right="",t.style.transform="",t.style.visibility="",t.style.animation="")},B=(e,t)=>{const r=y(e);r&&(r.style.visibility=t)},j=e=>{if(!m)return;const t=document.querySelector(`#${m} ._refDropdownPortal`),r=y(t);if(!t||!r)return;const i=e.getBoundingClientRect(),n=A(e,r),a=r.getBoundingClientRect().width||r.offsetWidth,o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;let l=i.left+i.width-a;"left"===C?l=i.left:"center"===C&&(l=i.left+i.width/2-a/2),l=Math.max(0,Math.min(l,Math.max(o-a,0))),r.style.left="0",r.style.right="auto",r.style.transform="none",b(r,n),t.style.left=`${l}px`,t.style.top=`${"top"===n?i.bottom:i.top}px`,t.style.zIndex=v?"101":"8"},k=()=>{const e=document.getElementsByClassName("_refContainer is-shown")[0];e&&m&&j(e)},M=()=>{const e=document.getElementsByClassName("_refContainer is-shown"),t=document.getElementsByTagName("BODY")[0];if(e.length){t.classList.remove("is-immuned");for(let t=0;t<e.length;t++){e[t].querySelector("._refDropdownOverlay").style.display="none",e[t].classList.remove("is-shown"),E(e[t])}}const r=document.querySelector("._refScrollContainer");r&&r.removeEventListener("scroll",k,!0),setTimeout((()=>{if(m){const e=document.getElementsByClassName("_refDropdownPortal is-shown");if(e.length)for(let t=0;t<e.length;t++)E(e[t]),e[t].style.left="0",e[t].style.top="0",e[t].classList.remove("is-shown")}}),10)},L=e=>{const t=f.current;if(t){const r=e.target.closest(`.${t.classList[0]}`);if(!r)return;const i=r.closest("._refContainer"),n=document.getElementsByTagName("BODY")[0];if(i){const t=i.querySelector("._refDropdownOverlay");i.classList.contains("is-shown")?(t.style.display="none",n.classList.remove("is-immuned"),i.classList.remove("is-shown"),setTimeout((()=>{if(m){const e=document.querySelector(`#${m} ._refDropdownPortal`),t=document.querySelector("._refScrollContainer");e&&(E(e),e.classList.remove("is-shown"),e.style.left="0px",e.style.top="0px",t&&t.removeEventListener("scroll",k,!0))}}),10),E(i)):(M(),t.style.display="block",n.classList.add("is-immuned"),m||B(i,"hidden"),i.classList.add("is-shown"),setTimeout((()=>{if(m){const e=document.querySelector(`#${m} ._refDropdownPortal`),t=document.querySelector("._refScrollContainer");e&&(e.classList.add("is-shown"),setTimeout((()=>{j(i),t&&t.addEventListener("scroll",k,!0)}),10))}else e=()=>{(e=>{const t=y(e);if(!t)return;const r=A(e,t);b(t,r)})(i),B(i,"visible")},window.requestAnimationFrame((()=>e()));var e}),10),h&&h(e))}}};r.useEffect((()=>(setTimeout((()=>{const e=document.querySelectorAll("._refDropdownPortal._refHover");for(let t of e)t&&t.addEventListener("mouseenter",(e=>{const t=e.target;t.classList.add("is-shown"),t.classList.add("unhiddenable")})),t&&t.addEventListener("mouseleave",(e=>{const t=e.target;t.classList.remove("is-shown"),t.classList.remove("unhiddenable"),t.style.left="0",t.style.top="0"}))}),1),()=>{const e=document.querySelectorAll("._refDropdownPortal._refHover");for(let t of e)t&&t.removeEventListener("mouseenter",(e=>{const t=e.target;t.classList.add("is-shown"),t.classList.add("unhiddenable")}),!0),t&&t.removeEventListener("mouseleave",(e=>{const t=e.target;t.classList.remove("is-shown"),t.classList.remove("unhiddenable"),t.style.left="0",t.style.top="0"}),!0)})),[m]);const O=a?e.jsx(da,{children:a}):null,z=n?e.jsxs(sa,{children:[n," ",O]}):null,I=i.filter((e=>r.isValidElement(e)?"control"===e.props["aria-label"]:null)),P=I&&r.isValidElement(I[0])?"hover"===x?e.jsxs(oa,{children:[e.jsx(aa,Object.assign({className:"_refDropdownControl"},m&&{onMouseEnter:e=>{const t=f.current;if(t){const r=e.target.closest(`.${t.classList[0]}`);if(!r)return;const i=document.querySelectorAll("._refDropdownPortal");for(const e of i)e.classList.remove("is-shown"),e.style.left="0",e.style.top="0";const n=r.closest("._refContainer");if(n){const e=document.querySelector(`#${m} ._refDropdownPortal`);e&&(e.classList.add("is-shown"),setTimeout((()=>{j(n)}),10))}}},onMouseLeave:e=>{const t=f.current;if(t){if(!e.target.closest(`.${t.classList[0]}`))return;setTimeout((()=>{const e=document.querySelector(`#${m} ._refDropdownPortal`);e&&!e.classList.contains("unhiddenable")&&(E(e),e.classList.remove("is-shown"),e.style.left="0",e.style.top="0")}),150)}}},{children:I[0].props.children})),e.jsx(aa,{className:"_refDropdownControlMobile",ref:f,onClick:L,children:I[0].props.children})]}):e.jsx(aa,{ref:f,onClick:L,children:I[0].props.children}):null,Q=i.filter((e=>r.isValidElement(e)?"body"===e.props["aria-label"]:null)),T=Q&&r.isValidElement(Q[0])?e.jsx(Ca,{$area:d,children:Q[0].props.children}):null,S=i.filter((e=>r.isValidElement(e)?"action"===e.props["aria-label"]:null)),H=S&&r.isValidElement(S[0])?e.jsx(ca,{$position:S[0].props["data-position"],className:S[0].props.className,children:S[0].props.children}):null,Y=e.jsxs(ia,Object.assign({className:"_refDropdownWrapper"},s&&{$internalWidth:s},p&&{$top:p},C&&{$openPosition:C},c&&{$placement:c},u&&{$bottom:u},{children:[z,T,H]}));return e.jsxs(la,Object.assign({className:"_refContainer "+(x?`_refContainer${x}`:"")},o&&{$externalWidth:o},l&&{$externalMinWidth:l},d&&{$area:d},p&&{$top:p},g&&{$alias:g},C&&{$openPosition:C},c&&{$placement:c},u&&{$bottom:u},w,{children:[P,e.jsx(na,{className:"_refDropdownOverlay",onClick:()=>{M()}}),m?e.jsx(ra,{wrapperId:m,children:e.jsx(pa,{className:"_refDropdownPortal "+("hover"===x?"_refHover":""),children:Y})}):Y]}))},ga=t.css`
4452
4452
  background-color: var(--mt-clr-bg__fc);
4453
4453
  width: 30px;
4454
4454
  height: 30px;