it-data-nexus-ui-library 2.10.5 → 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 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=!
|
|
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.
|
|
1
|
+
const o="2.10.7";export{o as SAGE_NEXUS_UI_VERSION};
|
package/dist/index.d.ts
CHANGED
|
@@ -1632,20 +1632,13 @@ declare const ProcessSteps: {
|
|
|
1632
1632
|
};
|
|
1633
1633
|
|
|
1634
1634
|
interface NexusOrbitProps {
|
|
1635
|
-
/** Node labels in order, spaced evenly around the orbit. Designed for 3 to 6; anything past 6 is ignored. */
|
|
1636
1635
|
labels: string[];
|
|
1637
|
-
/** Replaces the centre graphic. Defaults to `NexusNodeIcon` (lg, brand). */
|
|
1638
1636
|
core?: ReactNode;
|
|
1639
|
-
/**
|
|
1640
|
-
* Makes the orbit meaningful to assistive tech: the root becomes an image named
|
|
1641
|
-
* `<aria-label>: <label>, <label>, ...`. Omit it and the orbit is decorative (`aria-hidden`).
|
|
1642
|
-
*/
|
|
1643
1637
|
"aria-label"?: string;
|
|
1644
1638
|
sx?: SxProps<Theme>;
|
|
1645
1639
|
}
|
|
1646
1640
|
/**
|
|
1647
|
-
* A square, container-scaled orbit graphic: a soft halo and three concentric rings around a
|
|
1648
|
-
* rotated rounded-square core, with labelled nodes that circle slowly while their text stays upright.
|
|
1641
|
+
* A square, container-scaled orbit graphic: a soft halo and three concentric rings around a rotated rounded-square core, with labelled nodes that circle slowly while their text stays upright.
|
|
1649
1642
|
*
|
|
1650
1643
|
* Under `prefers-reduced-motion: reduce` nothing animates; nodes sit at their angles.
|
|
1651
1644
|
* There is no pause control, so keep it to a single decorative hero use.
|
|
@@ -1660,14 +1653,12 @@ declare const NexusOrbit: {
|
|
|
1660
1653
|
};
|
|
1661
1654
|
|
|
1662
1655
|
interface SectionNavItem {
|
|
1663
|
-
/** `id` of the section element on the page; also the link's `#fragment`. */
|
|
1664
1656
|
id: string;
|
|
1665
1657
|
label: string;
|
|
1666
1658
|
}
|
|
1667
1659
|
interface SectionNavProps {
|
|
1668
1660
|
/** Ordered sections. Each `id` must match an element on the page. */
|
|
1669
1661
|
items: SectionNavItem[];
|
|
1670
|
-
/** Accessible name of the `nav` landmark, e.g. "About Nexus sections". */
|
|
1671
1662
|
"aria-label": string;
|
|
1672
1663
|
/**
|
|
1673
1664
|
* The element the page scrolls inside: a CSS selector or an element. Defaults to the
|
|
@@ -1675,7 +1666,7 @@ interface SectionNavProps {
|
|
|
1675
1666
|
* `null`, or a selector that matches nothing, falls back to the window.
|
|
1676
1667
|
*/
|
|
1677
1668
|
scrollRoot?: string | HTMLElement | null;
|
|
1678
|
-
/** Pin the nav to the top of the scroll root while its sections scroll underneath. Defaults to
|
|
1669
|
+
/** Pin the nav to the top of the scroll root while its sections scroll underneath. Defaults to `true`. */
|
|
1679
1670
|
sticky?: boolean;
|
|
1680
1671
|
/** Distance in px from the top of the scroll root when `sticky`. Defaults to 0. */
|
|
1681
1672
|
stickyOffset?: number;
|
|
@@ -1690,8 +1681,8 @@ interface SectionNavProps {
|
|
|
1690
1681
|
* a second scroll. Smooth scrolling is turned off under `prefers-reduced-motion`. Without
|
|
1691
1682
|
* JavaScript the links still work as plain `#fragment` anchors.
|
|
1692
1683
|
*
|
|
1693
|
-
*
|
|
1694
|
-
* a `scroll-margin-top`
|
|
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.
|
|
1695
1686
|
*
|
|
1696
1687
|
* Below `sm` the items scroll sideways inside the component instead of wrapping.
|
|
1697
1688
|
*
|