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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/dropdown/index.tsx +18 -1
package/dist/index.mjs
CHANGED
|
@@ -4448,7 +4448,7 @@ function L(e,t){if(!1===e||null==e)throw new Error(t)}function j(e,t){if(!e){"un
|
|
|
4448
4448
|
display: block;
|
|
4449
4449
|
}
|
|
4450
4450
|
}
|
|
4451
|
-
`,vo=i=>{var{children:r,title:n,subTitle:a,$externalWidth:o,$externalMinWidth:d,$internalWidth:c,$area:h,$openPosition:p,$placement:g,$top:x,onClick:m,$alias:u,type:v,portalId:w,$bottom:F,$isPopup:f}=i,y=B(i,["children","title","subTitle","$externalWidth","$externalMinWidth","$internalWidth","$area","$openPosition","$placement","$top","onClick","$alias","type","portalId","$bottom","$isPopup"]);const A=C(null),D=(e,t)=>{const i=Number.parseInt(e||"",10);return Number.isNaN(i)?t:i},b=e=>null==e?void 0:e.querySelector("._refDropdownWrapper"),E=(e,t)=>{if("top"===g)return"top";const i=e.getBoundingClientRect(),r=t.getBoundingClientRect().height||t.offsetHeight,n=D(x,40),a=D(F,35),o=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)-i.bottom,l=i.top,d=r+Math.max(n-i.height,0),C=r+Math.max(a-i.height,0);return o>=d?"bottom":l>=C||l>o?"top":"bottom"},k=(e,t)=>{if("top"===t)return e.style.top="auto",void(e.style.bottom=`${D(F,35)}px`);e.style.top=`${D(x,40)}px`,e.style.bottom="auto"},O=e=>{const t=b(e);t&&(t.style.top="",t.style.bottom="",t.style.left="",t.style.right="",t.style.transform="")},M=e=>{if(!w)return;const t=document.querySelector(`#${w} ._refDropdownPortal`),i=b(t);if(!t||!i)return;const r=e.getBoundingClientRect(),n=E(e,i),a=i.getBoundingClientRect().width||i.offsetWidth,o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;let l=r.left+r.width-a;"left"===p?l=r.left:"center"===p&&(l=r.left+r.width/2-a/2),l=Math.max(0,Math.min(l,Math.max(o-a,0))),i.style.left="0",i.style.right="auto",i.style.transform="none",k(i,n),t.style.left=`${l}px`,t.style.top=`${"top"===n?r.bottom:r.top}px`,t.style.zIndex=f?"101":"8"},
|
|
4451
|
+
`,vo=i=>{var{children:r,title:n,subTitle:a,$externalWidth:o,$externalMinWidth:d,$internalWidth:c,$area:h,$openPosition:p,$placement:g,$top:x,onClick:m,$alias:u,type:v,portalId:w,$bottom:F,$isPopup:f}=i,y=B(i,["children","title","subTitle","$externalWidth","$externalMinWidth","$internalWidth","$area","$openPosition","$placement","$top","onClick","$alias","type","portalId","$bottom","$isPopup"]);const A=C(null),D=(e,t)=>{const i=Number.parseInt(e||"",10);return Number.isNaN(i)?t:i},b=e=>null==e?void 0:e.querySelector("._refDropdownWrapper"),E=(e,t)=>{if("top"===g)return"top";const i=e.getBoundingClientRect(),r=t.getBoundingClientRect().height||t.offsetHeight,n=D(x,40),a=D(F,35),o=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)-i.bottom,l=i.top,d=r+Math.max(n-i.height,0),C=r+Math.max(a-i.height,0);return o>=d?"bottom":l>=C||l>o?"top":"bottom"},k=(e,t)=>{if("top"===t)return e.style.animation="none",e.style.top="auto",void(e.style.bottom=`${D(F,35)}px`);e.style.top=`${D(x,40)}px`,e.style.bottom="auto"},O=e=>{const t=b(e);t&&(t.style.top="",t.style.bottom="",t.style.left="",t.style.right="",t.style.transform="",t.style.visibility="",t.style.animation="")},M=(e,t)=>{const i=b(e);i&&(i.style.visibility=t)},z=e=>{if(!w)return;const t=document.querySelector(`#${w} ._refDropdownPortal`),i=b(t);if(!t||!i)return;const r=e.getBoundingClientRect(),n=E(e,i),a=i.getBoundingClientRect().width||i.offsetWidth,o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;let l=r.left+r.width-a;"left"===p?l=r.left:"center"===p&&(l=r.left+r.width/2-a/2),l=Math.max(0,Math.min(l,Math.max(o-a,0))),i.style.left="0",i.style.right="auto",i.style.transform="none",k(i,n),t.style.left=`${l}px`,t.style.top=`${"top"===n?r.bottom:r.top}px`,t.style.zIndex=f?"101":"8"},I=()=>{const e=document.getElementsByClassName("_refContainer is-shown")[0];e&&w&&z(e)},L=()=>{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"),O(e[t])}}const i=document.querySelector("._refScrollContainer");i&&i.removeEventListener("scroll",I,!0),setTimeout((()=>{if(w){const e=document.getElementsByClassName("_refDropdownPortal is-shown");if(e.length)for(let t=0;t<e.length;t++)O(e[t]),e[t].style.left="0",e[t].style.top="0",e[t].classList.remove("is-shown")}}),10)},j=e=>{const t=A.current;if(t){const i=e.target.closest(`.${t.classList[0]}`);if(!i)return;const r=i.closest("._refContainer"),n=document.getElementsByTagName("BODY")[0];if(r){const t=r.querySelector("._refDropdownOverlay");r.classList.contains("is-shown")?(t.style.display="none",n.classList.remove("is-immuned"),r.classList.remove("is-shown"),setTimeout((()=>{if(w){const e=document.querySelector(`#${w} ._refDropdownPortal`),t=document.querySelector("._refScrollContainer");e&&(O(e),e.classList.remove("is-shown"),e.style.left="0px",e.style.top="0px",t&&t.removeEventListener("scroll",I,!0))}}),10),O(r)):(L(),t.style.display="block",n.classList.add("is-immuned"),w||M(r,"hidden"),r.classList.add("is-shown"),setTimeout((()=>{if(w){const e=document.querySelector(`#${w} ._refDropdownPortal`),t=document.querySelector("._refScrollContainer");e&&(e.classList.add("is-shown"),setTimeout((()=>{z(r),t&&t.addEventListener("scroll",I,!0)}),10))}else e=()=>{(e=>{const t=b(e);if(!t)return;const i=E(e,t);k(t,i)})(r),M(r,"visible")},window.requestAnimationFrame((()=>e()));var e}),10),m&&m(e))}}};l((()=>(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)})),[w]);const Q=a?e(go,{children:a}):null,P=n?t(po,{children:[n," ",Q]}):null,Y=r.filter((e=>s(e)?"control"===e.props["aria-label"]:null)),H=Y&&s(Y[0])?"hover"===v?t(so,{children:[e(co,Object.assign({className:"_refDropdownControl"},w&&{onMouseEnter:e=>{const t=A.current;if(t){const i=e.target.closest(`.${t.classList[0]}`);if(!i)return;const r=document.querySelectorAll("._refDropdownPortal");for(const e of r)e.classList.remove("is-shown"),e.style.left="0",e.style.top="0";const n=i.closest("._refContainer");if(n){const e=document.querySelector(`#${w} ._refDropdownPortal`);e&&(e.classList.add("is-shown"),setTimeout((()=>{z(n)}),10))}}},onMouseLeave:e=>{const t=A.current;if(t){if(!e.target.closest(`.${t.classList[0]}`))return;setTimeout((()=>{const e=document.querySelector(`#${w} ._refDropdownPortal`);e&&!e.classList.contains("unhiddenable")&&(O(e),e.classList.remove("is-shown"),e.style.left="0",e.style.top="0")}),150)}}},{children:Y[0].props.children})),e(co,{className:"_refDropdownControlMobile",ref:A,onClick:j,children:Y[0].props.children})]}):e(co,{ref:A,onClick:j,children:Y[0].props.children}):null,T=r.filter((e=>s(e)?"body"===e.props["aria-label"]:null)),X=T&&s(T[0])?e(xo,{$area:h,children:T[0].props.children}):null,N=r.filter((e=>s(e)?"action"===e.props["aria-label"]:null)),S=N&&s(N[0])?e(mo,{$position:N[0].props["data-position"],className:N[0].props.className,children:N[0].props.children}):null,q=t(lo,Object.assign({className:"_refDropdownWrapper"},c&&{$internalWidth:c},x&&{$top:x},p&&{$openPosition:p},g&&{$placement:g},F&&{$bottom:F},{children:[P,X,S]}));return t(ho,Object.assign({className:"_refContainer "+(v?`_refContainer${v}`:"")},o&&{$externalWidth:o},d&&{$externalMinWidth:d},h&&{$area:h},x&&{$top:x},u&&{$alias:u},p&&{$openPosition:p},g&&{$placement:g},F&&{$bottom:F},y,{children:[H,e(Co,{className:"_refDropdownOverlay",onClick:()=>{L()}}),w?e(oo,{wrapperId:w,children:e(uo,{className:"_refDropdownPortal "+("hover"===v?"_refHover":""),children:q})}):q]}))},wo=n`
|
|
4452
4452
|
background-color: var(--mt-clr-bg__fc);
|
|
4453
4453
|
width: 30px;
|
|
4454
4454
|
height: 30px;
|