it-data-nexus-ui-library 2.10.7 → 2.10.9

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.
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as t,useRef as o,useEffect as r,useCallback as n}from"react";import i from"@mui/material/Box";import{Caption as a}from"./Typography.mjs";const l="#main-content",c="h1, h2, h3, h4, h5, h6",s=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",d=({items:d,"aria-label":p,scrollRoot:m=l,sticky:u=!0,stickyOffset:x=0,sx:f})=>{const[h,y]=t(d[0]?.id),b=o(null),v=d.map(e=>e.id).join("\n");r(()=>{const e=v?v.split("\n"):[],t=(e=>null===e?null:"string"==typeof e?document.querySelector(e):e??document.querySelector(l))(m),o=new Set,r=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?o.add(e.target.id):o.delete(e.target.id);const r=e.find(e=>o.has(e));r&&y(r)},{root:t,rootMargin:"-35% 0px -60% 0px"});for(const t of e){const e=document.getElementById(t);e&&r.observe(e)}return()=>r.disconnect()},[v,m]),r(()=>{const e=b.current,t=e?.querySelector('[aria-current="location"]');!e||!t||e.scrollWidth<=e.clientWidth||e.scrollTo({left:t.offsetLeft-(e.clientWidth-t.offsetWidth)/2,behavior:s()})},[h]);const g=n((e,t)=>{if(e.defaultPrevented||0!==e.button)return;if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const o=document.getElementById(t);if(!o)return;e.preventDefault();const r=o.matches(c)?o:o.querySelector(c)??o;r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),o.scrollIntoView({block:"start",behavior:s()}),r.focus({preventScroll:!0}),y(t)},[]);return e(i,{ref:b,component:"nav","aria-label":p,sx:[e=>({width:"100%",boxSizing:"border-box",overflowX:{xs:"auto",sm:"visible"},overscrollBehaviorX:"contain",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},px:{xs:"16px",sm:u?"16px":0},maskImage:{xs:"linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent)",sm:"none"},position:u?"sticky":"relative",top:u?x:void 0,zIndex:u?e.zIndex.appBar:void 0,backgroundColor:u?"background.default":void 0}),...Array.isArray(f)?f:f?[f]:[]],children:e(i,{component:"ul",role:"list",sx:{listStyle:"none",m:0,p:0,display:"flex",flexWrap:{xs:"nowrap",sm:"wrap"},columnGap:{xs:2.5,sm:3}},children:d.map(({id:t,label:o})=>{const r=t===h;return e(i,{component:"li",sx:{flex:"none"},children:e(i,{component:"a",href:`#${t}`,"aria-current":r?"location":void 0,onClick:e=>g(e,t),sx:{display:"block",py:1.25,whiteSpace:"nowrap",color:r?"text.primary":"text.secondary",textDecoration:r?"underline":"none",textDecorationColor:e=>e.palette.primary.main,textDecorationThickness:r?"2px":void 0,textUnderlineOffset:"7px",borderRadius:.5,"&:hover":{color:"text.primary",textDecoration:"underline",textDecorationColor:e=>e.palette.primary.main},"&:focus-visible":{outline:e=>`2px solid ${e.palette.primary.main}`,outlineOffset:2}},children:e(a,{component:"span",sx:{color:"inherit",letterSpacing:"0.015em"},children:o})})},t)})})})};export{d as SectionNav};
1
+ import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useState as n,useRef as r,useEffect as i,useCallback as l}from"react";import s from"@mui/material/Box";import{Caption as c}from"./Typography.mjs";const a="#main-content",d="h1, h2, h3, h4, h5, h6",p=e=>null===e?null:"string"==typeof e?document.querySelector(e):e??document.querySelector(a),u=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",y=({items:y,"aria-label":m,scrollRoot:f=a,sticky:x=!0,stickyOffset:h=0,sx:b})=>{const[v,w]=n(y[0]?.id),g=r(null),S=r(null),k=r(!1),$=r(void 0),E=y.map(e=>e.id).join("\n");i(()=>{const e=E?E.split("\n"):[],t=p(f),o=new Set,n=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?o.add(e.target.id):o.delete(e.target.id);const n=e.find(e=>o.has(e));n&&w(n)},{root:t,rootMargin:"-35% 0px -60% 0px"});for(const t of e){const e=document.getElementById(t);e&&n.observe(e)}return()=>n.disconnect()},[E,f]),i(()=>{if(!x)return;const e=g.current,t=S.current,o=p(f);if(!e||!t)return;let n=!1,r=o?o.scrollTop:window.scrollY;const i=()=>{const e=(o??document.documentElement).getBoundingClientRect();return{top:e.top+h,left:e.left,width:o?o.clientWidth:window.innerWidth}},l=()=>{t.style.display="none",e.style.position="",e.style.top="",e.style.left="",e.style.width="",e.style.boxSizing=""},s=()=>{e.style.opacity="",e.style.visibility="",e.style.pointerEvents=""},c=()=>{const c=o?o.scrollTop:window.scrollY,a=c-r;if(r=c,c>h&&!n)(()=>{const{top:o,left:n,width:r}=i();t.style.height=`${e.offsetHeight}px`,t.style.display="block",e.style.position="fixed",e.style.top=`${o}px`,e.style.left=`${n}px`,e.style.width=`${r}px`,e.style.boxSizing="border-box"})(),n=!0;else if(c<=h&&n)l(),n=!1;else if(n){const{top:t,left:o,width:n}=i();e.style.top=`${t}px`,e.style.left=`${o}px`,e.style.width=`${n}px`}k.current||(c<=h||a<-5?s():c>100&&a>8&&(e.style.opacity="0",e.style.visibility="hidden",e.style.pointerEvents="none"))},a=o??window;a.addEventListener("scroll",c,{passive:!0});const d=new ResizeObserver(()=>{if(n){const{top:t,left:o,width:n}=i();e.style.top=`${t}px`,e.style.left=`${o}px`,e.style.width=`${n}px`}});return d.observe(o??document.documentElement),()=>{a.removeEventListener("scroll",c),d.disconnect(),l(),s(),clearTimeout($.current)}},[x,f,h]),i(()=>{const e=g.current,t=e?.querySelector('[aria-current="location"]');!e||!t||e.scrollWidth<=e.clientWidth||e.scrollTo({left:t.offsetLeft-(e.clientWidth-t.offsetWidth)/2,behavior:u()})},[v]);const I=l((e,t)=>{if(e.defaultPrevented||0!==e.button)return;if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const o=document.getElementById(t);if(!o)return;e.preventDefault();const n=o.matches(d)?o:o.querySelector(d)??o;n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1");const r=g.current;r&&(r.style.opacity="",r.style.visibility="",r.style.pointerEvents=""),k.current=!0,clearTimeout($.current),$.current=setTimeout(()=>{k.current=!1},1e3),o.scrollIntoView({block:"start",behavior:u()}),n.focus({preventScroll:!0}),w(t)},[]);return e(t,{children:[o("div",{ref:S,"aria-hidden":"true",style:{display:"none",flexShrink:0}}),o(s,{ref:g,component:"nav","aria-label":m,sx:[e=>({width:"100%",boxSizing:"border-box",overflowX:{xs:"auto",sm:"visible"},overscrollBehaviorX:"contain",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},px:{xs:"16px",sm:x?"16px":0},maskImage:{xs:"linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent)",sm:"none"},zIndex:x?e.zIndex.appBar:void 0,backgroundColor:x?"background.default":void 0,...x&&{transition:"opacity 0.2s ease, visibility 0.2s ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}}),...Array.isArray(b)?b:b?[b]:[]],children:o(s,{component:"ul",role:"list",sx:{listStyle:"none",m:0,p:0,display:"flex",flexWrap:{xs:"nowrap",sm:"wrap"},columnGap:{xs:2.5,sm:3}},children:y.map(({id:e,label:t})=>{const n=e===v;return o(s,{component:"li",sx:{flex:"none"},children:o(s,{component:"a",href:`#${e}`,"aria-current":n?"location":void 0,onClick:t=>I(t,e),sx:{display:"block",py:1.25,whiteSpace:"nowrap",color:n?"text.primary":"text.secondary",textDecoration:n?"underline":"none",textDecorationColor:e=>e.palette.primary.main,textDecorationThickness:n?"2px":void 0,textUnderlineOffset:"7px",borderRadius:.5,"&:hover":{color:"text.primary",textDecoration:"underline",textDecorationColor:e=>e.palette.primary.main},"&:focus-visible":{outline:e=>`2px solid ${e.palette.primary.main}`,outlineOffset:2}},children:o(c,{component:"span",sx:{color:"inherit",letterSpacing:"0.015em"},children:t})})},e)})})})]})};export{y as SectionNav};
@@ -1 +1 @@
1
- const o="2.10.7";export{o as SAGE_NEXUS_UI_VERSION};
1
+ const o="2.10.9";export{o as SAGE_NEXUS_UI_VERSION};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "it-data-nexus-ui-library",
3
- "version": "2.10.7",
3
+ "version": "2.10.9",
4
4
  "description": "Nexus core components",
5
5
  "license": "ISC",
6
6
  "author": "emsmart-sage",