@natoora-libs/core 0.2.42 → 0.2.43
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/components/index.cjs +104 -12
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +109 -17
- package/dist/components/index.js.map +1 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDynamicScroll
|
|
3
|
+
} from "../chunk-IXEF6LYV.js";
|
|
1
4
|
import {
|
|
2
5
|
Loading_default,
|
|
3
6
|
colors,
|
|
4
7
|
isDarkModeEnabled
|
|
5
8
|
} from "../chunk-CKW5LT7K.js";
|
|
6
|
-
import {
|
|
7
|
-
useDynamicScroll
|
|
8
|
-
} from "../chunk-IXEF6LYV.js";
|
|
9
9
|
import {
|
|
10
10
|
getFlattenedFiltersLabels,
|
|
11
11
|
getSelectOptionFromKeyPress
|
|
@@ -10639,8 +10639,8 @@ var ThemedDateRangePicker = ({
|
|
|
10639
10639
|
var ThemedDateRangePicker_default = ThemedDateRangePicker;
|
|
10640
10640
|
|
|
10641
10641
|
// src/components/TheToolbar/TheToolbar.tsx
|
|
10642
|
-
import { memo as memo24 } from "react";
|
|
10643
|
-
import { AppBar, Box as Box50, Toolbar } from "@mui/material";
|
|
10642
|
+
import { memo as memo24, useLayoutEffect as useLayoutEffect2, useRef as useRef12, useState as useState28 } from "react";
|
|
10643
|
+
import { AppBar, Box as Box50, Toolbar, useMediaQuery, useTheme as useTheme3 } from "@mui/material";
|
|
10644
10644
|
import { makeStyles as makeStyles49 } from "tss-react/mui";
|
|
10645
10645
|
import { jsx as jsx145, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
10646
10646
|
var useStyles49 = makeStyles49()((theme) => ({
|
|
@@ -10656,6 +10656,8 @@ var useStyles49 = makeStyles49()((theme) => ({
|
|
|
10656
10656
|
}
|
|
10657
10657
|
}
|
|
10658
10658
|
}));
|
|
10659
|
+
var CENTER_MIN_WIDTH = 320;
|
|
10660
|
+
var SAFETY_BUFFER = 24;
|
|
10659
10661
|
var TheToolbar = ({
|
|
10660
10662
|
imageLogoDarkSmall,
|
|
10661
10663
|
imageLogoLightSmall,
|
|
@@ -10667,9 +10669,48 @@ var TheToolbar = ({
|
|
|
10667
10669
|
isAuthenticated = true
|
|
10668
10670
|
}) => {
|
|
10669
10671
|
const { classes } = useStyles49();
|
|
10672
|
+
const theme = useTheme3();
|
|
10673
|
+
const belowXl = useMediaQuery(theme.breakpoints.down("xl"));
|
|
10674
|
+
const toolbarRef = useRef12(null);
|
|
10675
|
+
const leftSectionMeasureRef = useRef12(null);
|
|
10676
|
+
const rightSectionMeasureRef = useRef12(null);
|
|
10677
|
+
const logoRef = useRef12(null);
|
|
10678
|
+
const rightSectionRef = useRef12(null);
|
|
10679
|
+
const menuButtonRef = useRef12(null);
|
|
10680
|
+
const [hideLeftSection, setHideLeftSection] = useState28(false);
|
|
10681
|
+
const [hideRightSection, setHideRightSection] = useState28(false);
|
|
10682
|
+
useLayoutEffect2(() => {
|
|
10683
|
+
if (belowXl) {
|
|
10684
|
+
setHideLeftSection(true);
|
|
10685
|
+
}
|
|
10686
|
+
const toolbar = toolbarRef.current;
|
|
10687
|
+
const leftMeasure = leftSectionMeasureRef.current;
|
|
10688
|
+
const rightMeasure = rightSectionMeasureRef.current;
|
|
10689
|
+
if (!toolbar) return void 0;
|
|
10690
|
+
const update = () => {
|
|
10691
|
+
const toolbarWidth = toolbar.clientWidth;
|
|
10692
|
+
const leftWidth = leftMeasure?.scrollWidth ?? 0;
|
|
10693
|
+
const rightWidth = rightMeasure?.scrollWidth ?? 0;
|
|
10694
|
+
const logoWidth = logoRef.current?.offsetWidth ?? 0;
|
|
10695
|
+
const menuWidth = menuButtonRef.current?.offsetWidth ?? 0;
|
|
10696
|
+
const availableWithoutLeft = toolbarWidth - logoWidth - menuWidth - CENTER_MIN_WIDTH - SAFETY_BUFFER;
|
|
10697
|
+
const nextHideRight = rightWidth > availableWithoutLeft;
|
|
10698
|
+
setHideRightSection(nextHideRight);
|
|
10699
|
+
if (!belowXl) {
|
|
10700
|
+
const effectiveRightWidth = nextHideRight ? 0 : rightWidth;
|
|
10701
|
+
setHideLeftSection(leftWidth > availableWithoutLeft - effectiveRightWidth);
|
|
10702
|
+
}
|
|
10703
|
+
};
|
|
10704
|
+
update();
|
|
10705
|
+
const observer = new ResizeObserver(update);
|
|
10706
|
+
observer.observe(toolbar);
|
|
10707
|
+
if (leftMeasure) observer.observe(leftMeasure);
|
|
10708
|
+
if (rightMeasure) observer.observe(rightMeasure);
|
|
10709
|
+
return () => observer.disconnect();
|
|
10710
|
+
}, [belowXl, leftSection, rightSection]);
|
|
10670
10711
|
return /* @__PURE__ */ jsxs97(Box50, { children: [
|
|
10671
|
-
/* @__PURE__ */ jsx145(AppBar, { children: /* @__PURE__ */ jsxs97(Toolbar, { className: classes.topBar, children: [
|
|
10672
|
-
isAuthenticated ? /* @__PURE__ */ jsx145(
|
|
10712
|
+
/* @__PURE__ */ jsx145(AppBar, { children: /* @__PURE__ */ jsxs97(Toolbar, { className: classes.topBar, ref: toolbarRef, children: [
|
|
10713
|
+
isAuthenticated ? /* @__PURE__ */ jsx145(Box50, { ref: menuButtonRef, sx: { flexShrink: 0, display: "flex" }, children: /* @__PURE__ */ jsx145(
|
|
10673
10714
|
RoundButton_default,
|
|
10674
10715
|
{
|
|
10675
10716
|
className: classes.menuButton,
|
|
@@ -10677,21 +10718,31 @@ var TheToolbar = ({
|
|
|
10677
10718
|
noStrokes: true,
|
|
10678
10719
|
onClick: handleOpen
|
|
10679
10720
|
}
|
|
10680
|
-
) : null,
|
|
10681
|
-
/* @__PURE__ */ jsx145(
|
|
10682
|
-
|
|
10721
|
+
) }) : null,
|
|
10722
|
+
/* @__PURE__ */ jsx145(
|
|
10723
|
+
Box50,
|
|
10683
10724
|
{
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10725
|
+
ref: logoRef,
|
|
10726
|
+
sx: { display: { xs: "none", lg: "block" }, flexShrink: 0 },
|
|
10727
|
+
children: /* @__PURE__ */ jsx145(
|
|
10728
|
+
CompanyLogo_default,
|
|
10729
|
+
{
|
|
10730
|
+
size: "small",
|
|
10731
|
+
color: "light",
|
|
10732
|
+
imageLogoDarkSmall,
|
|
10733
|
+
imageLogoLightSmall
|
|
10734
|
+
}
|
|
10735
|
+
)
|
|
10688
10736
|
}
|
|
10689
|
-
)
|
|
10737
|
+
),
|
|
10690
10738
|
/* @__PURE__ */ jsx145(
|
|
10691
10739
|
Box50,
|
|
10692
10740
|
{
|
|
10693
10741
|
ml: { xs: 0, lg: 2 },
|
|
10694
|
-
sx: {
|
|
10742
|
+
sx: {
|
|
10743
|
+
display: hideLeftSection ? "none" : "block",
|
|
10744
|
+
flexShrink: 0
|
|
10745
|
+
},
|
|
10695
10746
|
children: leftSection
|
|
10696
10747
|
}
|
|
10697
10748
|
),
|
|
@@ -10707,8 +10758,49 @@ var TheToolbar = ({
|
|
|
10707
10758
|
children: centerSection
|
|
10708
10759
|
}
|
|
10709
10760
|
) : /* @__PURE__ */ jsx145(Box50, { sx: { flexGrow: 1 } }),
|
|
10710
|
-
/* @__PURE__ */ jsx145(
|
|
10761
|
+
/* @__PURE__ */ jsx145(
|
|
10762
|
+
Box50,
|
|
10763
|
+
{
|
|
10764
|
+
ref: rightSectionRef,
|
|
10765
|
+
sx: { flexShrink: 0, display: hideRightSection ? "none" : "block" },
|
|
10766
|
+
children: rightSection
|
|
10767
|
+
}
|
|
10768
|
+
)
|
|
10711
10769
|
] }) }),
|
|
10770
|
+
/* @__PURE__ */ jsx145(
|
|
10771
|
+
Box50,
|
|
10772
|
+
{
|
|
10773
|
+
ref: leftSectionMeasureRef,
|
|
10774
|
+
"aria-hidden": true,
|
|
10775
|
+
sx: {
|
|
10776
|
+
position: "fixed",
|
|
10777
|
+
top: 0,
|
|
10778
|
+
left: 0,
|
|
10779
|
+
visibility: "hidden",
|
|
10780
|
+
pointerEvents: "none",
|
|
10781
|
+
whiteSpace: "nowrap",
|
|
10782
|
+
display: "inline-flex"
|
|
10783
|
+
},
|
|
10784
|
+
children: leftSection
|
|
10785
|
+
}
|
|
10786
|
+
),
|
|
10787
|
+
/* @__PURE__ */ jsx145(
|
|
10788
|
+
Box50,
|
|
10789
|
+
{
|
|
10790
|
+
ref: rightSectionMeasureRef,
|
|
10791
|
+
"aria-hidden": true,
|
|
10792
|
+
sx: {
|
|
10793
|
+
position: "fixed",
|
|
10794
|
+
top: 0,
|
|
10795
|
+
left: 0,
|
|
10796
|
+
visibility: "hidden",
|
|
10797
|
+
pointerEvents: "none",
|
|
10798
|
+
whiteSpace: "nowrap",
|
|
10799
|
+
display: "inline-flex"
|
|
10800
|
+
},
|
|
10801
|
+
children: rightSection
|
|
10802
|
+
}
|
|
10803
|
+
),
|
|
10712
10804
|
LeftDrawer
|
|
10713
10805
|
] });
|
|
10714
10806
|
};
|