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

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 r,useEffect as o,useCallback as n}from"react";import i from"@mui/material/Box";import{Caption as a}from"./Typography.mjs";const s="#main-content",c="h1, h2, h3, h4, h5, h6",l=e=>null===e?null:"string"==typeof e?document.querySelector(e):e??document.querySelector(s),d=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",p=({items:p,"aria-label":u,scrollRoot:m=s,sticky:x=!0,stickyOffset:f=0,sx:h})=>{const[y,v]=t(p[0]?.id),[b,w]=t(!0),g=r(null),k=r(0),S=r(!1),I=r(void 0),T=p.map(e=>e.id).join("\n");o(()=>{const e=T?T.split("\n"):[],t=l(m),r=new Set,o=new IntersectionObserver(t=>{for(const e of t)e.isIntersecting?r.add(e.target.id):r.delete(e.target.id);const o=e.find(e=>r.has(e));o&&v(o)},{root:t,rootMargin:"-35% 0px -60% 0px"});for(const t of e){const e=document.getElementById(t);e&&o.observe(e)}return()=>o.disconnect()},[T,m]),o(()=>{if(!x)return;const e=l(m),t=e??window,r=()=>{const t=e?e.scrollTop:window.scrollY,r=t-k.current;k.current=t,S.current||(t<=0||r<-5?w(!0):t>100&&r>8&&w(!1))};return t.addEventListener("scroll",r,{passive:!0}),()=>{t.removeEventListener("scroll",r),clearTimeout(I.current)}},[x,m]),o(()=>{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:d()})},[y]);const D=n((e,t)=>{if(e.defaultPrevented||0!==e.button)return;if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const r=document.getElementById(t);if(!r)return;e.preventDefault();const o=r.matches(c)?r:r.querySelector(c)??r;o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),w(!0),S.current=!0,clearTimeout(I.current),I.current=setTimeout(()=>{S.current=!1},1e3),r.scrollIntoView({block:"start",behavior:d()}),o.focus({preventScroll:!0}),v(t)},[]);return e(i,{ref:g,component:"nav","aria-label":u,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"},position:x?"sticky":"relative",top:x?f:void 0,zIndex:x?e.zIndex.appBar:void 0,backgroundColor:x?"background.default":void 0,...x&&{opacity:b?1:0,visibility:b?"visible":"hidden",pointerEvents:b?void 0:"none",transition:"opacity 0.2s ease, visibility 0.2s ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}}),...Array.isArray(h)?h:h?[h]:[]],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:p.map(({id:t,label:r})=>{const o=t===y;return e(i,{component:"li",sx:{flex:"none"},children:e(i,{component:"a",href:`#${t}`,"aria-current":o?"location":void 0,onClick:e=>D(e,t),sx:{display:"block",py:1.25,whiteSpace:"nowrap",color:o?"text.primary":"text.secondary",textDecoration:o?"underline":"none",textDecorationColor:e=>e.palette.primary.main,textDecorationThickness:o?"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:r})})},t)})})})};export{p as SectionNav};
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 +1 @@
1
- const o="2.10.6";export{o as SAGE_NEXUS_UI_VERSION};
1
+ const o="2.10.7";export{o as SAGE_NEXUS_UI_VERSION};
package/dist/index.d.ts CHANGED
@@ -1681,9 +1681,8 @@ interface SectionNavProps {
1681
1681
  * a second scroll. Smooth scrolling is turned off under `prefers-reduced-motion`. Without
1682
1682
  * JavaScript the links still work as plain `#fragment` anchors.
1683
1683
  *
1684
- * When `sticky` is true (the default) the nav pins at the top of the scroll root, hides on downward scroll,
1685
- * and reappears on any upward scroll. Clicking a link keeps the nav visible briefly so the
1686
- * user can chain navigations. Give sections a `scroll-margin-top` equal to the nav height.
1684
+ * When `sticky` is true (the default) the nav pins at the top of the scroll root while its sections
1685
+ * scroll underneath. Give sections a `scroll-margin-top` equal to the nav height.
1687
1686
  *
1688
1687
  * Below `sm` the items scroll sideways inside the component instead of wrapping.
1689
1688
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "it-data-nexus-ui-library",
3
- "version": "2.10.6",
3
+ "version": "2.10.7",
4
4
  "description": "Nexus core components",
5
5
  "license": "ISC",
6
6
  "author": "emsmart-sage",