it-data-nexus-ui-library 2.4.4 → 2.4.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{
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useTheme as i,useMediaQuery as r,AppBar as l,Toolbar as o}from"@mui/material";import{Box as s}from"./_Primitives/Box.mjs";import{Stack as c}from"./_Primitives/Stack.mjs";import{NexusHome as d}from"./NexusHome.mjs";import{ThemeToggle as x}from"./ThemeToggle.mjs";import f from"./NexusLogo.mjs";import{ActionBarTitle as a}from"./Typography.mjs";import{useRef as h,useState as u,useEffect as m}from"react";const p=({title:p,extraLeft:g,extraRight:w,homeHref:y,showHome:v=!0,logo:j})=>{const C=j??e(f,{}),I=i(),b=r(I.breakpoints.up("lg")),B=h(null),[R,k]=u(49),z=h(null),E=h(null),M=h(null),A=h(null),L=h(null),S=h(null),[H,T]=u(null),[$,D]=u(null);return m(()=>{const e=B.current;if(!e)return;const n=()=>k(e.getBoundingClientRect().height);n();const t=window.ResizeObserver;if(!t)return;const i=new t(n);return i.observe(e),()=>i.disconnect()},[]),m(()=>{if(!b)return T(null),void D(null);function e(){const e=E.current,n=M.current,t=z.current,i=A.current,r=L.current,l=S.current;if(!e||!n||!t)return;const o=e.getBoundingClientRect(),s=n.getBoundingClientRect(),c=t.getBoundingClientRect();if(i){const e=i.getBoundingClientRect().width||0,n=(o.right+s.left)/2,t=o.right+e/2+8,r=s.left-e/2-8,l=Math.min(Math.max(n,t),r);T(l-c.left)}else T(null);if(r&&l){const e=r.getBoundingClientRect().width||0,n=l.getBoundingClientRect(),t=(s.right+n.left)/2,i=s.right+e/2+8,o=n.left-e/2-8,d=Math.min(Math.max(t,i),o);D(d-c.left)}else D(null)}e(),window.addEventListener("resize",e);let n=null;const t=window.ResizeObserver;return t&&(n=new t(e),z.current&&n.observe(z.current)),()=>{window.removeEventListener("resize",e),n&&n.disconnect()}},[b,g,w]),n(t,{children:[e(l,{position:"sticky",component:"header",color:"inherit",elevation:0,ref:B,sx:{zIndex:{xs:I.zIndex.appBar,sm:I.zIndex.drawer+1},[I.breakpoints.up("sm")]:{position:"fixed"}},children:n(o,{variant:"dense",sx:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:{lg:"center"},py:{xs:.5,lg:0}},children:[n(c,{sx:{display:{xs:"flex",sm:"none"},width:"100%"},spacing:.25,children:[n(c,{direction:"row",sx:{justifyContent:"flex-end","& .MuiIconButton-root":{padding:"4px"},"& svg":{fontSize:"1.1rem"}},children:[v&&e(d,{href:y}),e(x,{})]}),e(a,{sx:{textAlign:"center",fontSize:"1.1rem"},children:p})]}),(g||w)&&n(c,{direction:"row",sx:{display:{xs:"flex",sm:"none"},justifyContent:"center",alignItems:"center",gap:1,width:"100%",mt:1},children:[g,w]}),n(c,{sx:{display:{xs:"none",sm:"flex",lg:"none"},width:"100%"},spacing:.5,children:[n(c,{direction:"row",sx:{alignItems:"center",width:"100%"},children:[e(s,{sx:{flex:1,display:"flex",alignItems:"center"},children:e(s,{sx:{height:"38px",pt:.5},children:C})}),e(a,{children:p}),n(c,{direction:"row",sx:{flex:1,justifyContent:"flex-end",alignItems:"center",gap:1},children:[v&&e(d,{href:y}),e(x,{})]})]}),(g||w)&&n(c,{direction:"row",sx:{justifyContent:"center",alignItems:"center",gap:2,pb:.5},children:[g&&e(s,{children:g}),w&&e(s,{children:w})]})]}),e(s,{sx:{display:{xs:"none",lg:"block"},width:"100%"},children:n(s,{sx:{display:"flex",flexDirection:"row",alignItems:"center",width:"100%",position:"relative"},ref:z,children:[e(s,{sx:{display:"flex",alignItems:"center",flex:1,justifyContent:"flex-start"},children:e(s,{sx:{height:"38px",pt:.5},ref:E,children:C})}),e(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",left:0,right:0,pointerEvents:"none"},children:e(s,{sx:{pointerEvents:"auto",textAlign:"center"},children:e(s,{ref:M,children:e(a,{children:p})})})}),e(s,{sx:{display:g?"block":"none",position:"absolute",left:null!=H?`${H}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:e(s,{ref:A,children:g})}),e(s,{sx:{display:w?"block":"none",position:"absolute",left:null!=$?`${$}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:e(s,{ref:L,children:w})}),e(s,{sx:{display:"flex",alignItems:"center",flex:1,justifyContent:"flex-end"},children:n(s,{sx:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:1},ref:S,children:[v&&e(d,{href:y}),e(x,{})]})})]})})]})}),e(s,{sx:{display:{xs:"none",sm:"block"},height:`${R}px`,flexShrink:0}})]})};export{p as ActionBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{ToggleButtonGroup as o,ToggleButton as r}from"@mui/material";import{colours as a}from"../theme/tokens.mjs";const i={small:{height:32,px:"14px",fontSize:"0.8125rem"},medium:{height:40,px:"20px",fontSize:"0.9375rem"},large:{height:48,px:"28px",fontSize:"1rem"}};function t({options:t,value:n,onChange:l,ariaLabel:s,size:d="medium",sx:p,...g}){const{height:m,px:x,fontSize:b}=i[d];return e(o,{exclusive:!0,value:n,onChange:(e,o)=>{null!==o&&l(o)},"aria-label":s,sx:[{bgcolor:"rgba(255, 255, 255, 0.85)",borderRadius:"999px",border:"1px solid",borderColor:"divider",boxShadow:"inset 0 1px 2px rgba(10, 22, 34, 0.05)",p:"3px",gap:"2px",minHeight:m,width:"fit-content","& .MuiToggleButton-root":{border:"none",borderRadius:"999px !important",textTransform:"none",fontWeight:600,paddingInline:x,paddingBlock:0,fontSize:b,lineHeight:1,alignSelf:"stretch",color:a.darkGrey,transition:"background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease","&:not(.Mui-selected):hover":{bgcolor:"rgba(0, 0, 0, 0.08)",color:"rgba(0, 0, 0, 0.87)"}},"&& .MuiToggleButton-root.Mui-selected":{bgcolor:"primary.main",color:"primary.contrastText",boxShadow:"0 1px 4px rgba(20, 39, 59, 0.3), inset 0 1px 0 rgba(255,255,255,0.12)","&:hover":{bgcolor:"primary.dark"}}},...Array.isArray(p)?p:p?[p]:[]],...g,children:t.map(o=>e(r,{value:o.value,disabled:o.disabled,"aria-label":o.ariaLabel,children:o.label},o.value))})}export{t as SegmentedControl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="2.4.
|
|
1
|
+
const o="2.4.7";export{o as SAGE_NEXUS_UI_VERSION};
|
package/dist/index.d.ts
CHANGED
|
@@ -486,12 +486,13 @@ interface SegmentedControlOption<T extends string = string> {
|
|
|
486
486
|
ariaLabel?: string;
|
|
487
487
|
disabled?: boolean;
|
|
488
488
|
}
|
|
489
|
-
interface SegmentedControlProps<T extends string = string> extends Omit<ToggleButtonGroupProps, "value" | "onChange" | "exclusive" | "color"> {
|
|
489
|
+
interface SegmentedControlProps<T extends string = string> extends Omit<ToggleButtonGroupProps, "value" | "onChange" | "exclusive" | "color" | "size"> {
|
|
490
490
|
options: SegmentedControlOption<T>[];
|
|
491
491
|
value: T;
|
|
492
492
|
onChange: (value: T) => void;
|
|
493
493
|
/** Accessible group label, e.g. "Level of detail". */
|
|
494
494
|
ariaLabel?: string;
|
|
495
|
+
size?: "small" | "medium" | "large";
|
|
495
496
|
}
|
|
496
497
|
/**
|
|
497
498
|
* Segmented pill-track toggle for switching between a small set of mutually exclusive
|
|
@@ -600,8 +601,9 @@ interface ActionBarProps {
|
|
|
600
601
|
extraRight?: ReactNode;
|
|
601
602
|
homeHref?: string;
|
|
602
603
|
showHome?: boolean;
|
|
604
|
+
logo?: ReactNode;
|
|
603
605
|
}
|
|
604
|
-
declare const ActionBar: ({ title, extraLeft, extraRight, homeHref, showHome, }: ActionBarProps) => ReactElement;
|
|
606
|
+
declare const ActionBar: ({ title, extraLeft, extraRight, homeHref, showHome, logo, }: ActionBarProps) => ReactElement;
|
|
605
607
|
|
|
606
608
|
interface AccordionGroupProps {
|
|
607
609
|
children: ReactNode;
|