enjanga-components-library 1.0.35 → 1.0.36
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -20
- package/dist/index.mjs +59 -20
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,7 +11,7 @@ interface AH_propsType {
|
|
|
11
11
|
globalBarItems: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
declare const AppHeader: ({ brand, brandLabel, brandRoute, navigation }: AH_propsType) => react_jsx_runtime.JSX.Element | null;
|
|
14
|
+
declare const AppHeader: ({ brand, brandLabel, brandRoute, navigation, }: AH_propsType) => react_jsx_runtime.JSX.Element | null;
|
|
15
15
|
|
|
16
16
|
declare const BL_roleOpt: readonly ["img", "presentation", "none"];
|
|
17
17
|
type BL_roleOptPropsType = (typeof BL_roleOpt)[number];
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ interface AH_propsType {
|
|
|
11
11
|
globalBarItems: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
declare const AppHeader: ({ brand, brandLabel, brandRoute, navigation }: AH_propsType) => react_jsx_runtime.JSX.Element | null;
|
|
14
|
+
declare const AppHeader: ({ brand, brandLabel, brandRoute, navigation, }: AH_propsType) => react_jsx_runtime.JSX.Element | null;
|
|
15
15
|
|
|
16
16
|
declare const BL_roleOpt: readonly ["img", "presentation", "none"];
|
|
17
17
|
type BL_roleOptPropsType = (typeof BL_roleOpt)[number];
|
package/dist/index.js
CHANGED
|
@@ -1039,20 +1039,19 @@ var breakpoints = {
|
|
|
1039
1039
|
// src/libs/helpers.ts
|
|
1040
1040
|
var calcRemToPx = (remVal) => remVal * 16;
|
|
1041
1041
|
|
|
1042
|
-
// src/libs/
|
|
1043
|
-
var
|
|
1044
|
-
const
|
|
1045
|
-
const [size, setSize] = React4.useState(options?.defaultSize || "max");
|
|
1042
|
+
// src/libs/useWindowBreakpoint.ts
|
|
1043
|
+
var useWindowBreakpoint = (options) => {
|
|
1044
|
+
const [size, setSize] = React4.useState("max");
|
|
1046
1045
|
const effectiveBreakpoints = {
|
|
1047
|
-
sm:
|
|
1048
|
-
md:
|
|
1049
|
-
lg:
|
|
1050
|
-
xlg:
|
|
1046
|
+
sm: calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
1047
|
+
md: calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
1048
|
+
lg: calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
1049
|
+
xlg: calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
1051
1050
|
};
|
|
1052
1051
|
React4.useEffect(() => {
|
|
1053
|
-
if (
|
|
1054
|
-
const
|
|
1055
|
-
const width =
|
|
1052
|
+
if (typeof window === "undefined") return;
|
|
1053
|
+
const updateSize = () => {
|
|
1054
|
+
const width = window.innerWidth;
|
|
1056
1055
|
if (width < effectiveBreakpoints.sm) {
|
|
1057
1056
|
setSize("sm");
|
|
1058
1057
|
} else if (width < effectiveBreakpoints.md) {
|
|
@@ -1064,10 +1063,11 @@ var useContainerSize = (options) => {
|
|
|
1064
1063
|
} else {
|
|
1065
1064
|
setSize("max");
|
|
1066
1065
|
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1066
|
+
};
|
|
1067
|
+
updateSize();
|
|
1068
|
+
window.addEventListener("resize", updateSize);
|
|
1069
1069
|
return () => {
|
|
1070
|
-
|
|
1070
|
+
window.removeEventListener("resize", updateSize);
|
|
1071
1071
|
};
|
|
1072
1072
|
}, [
|
|
1073
1073
|
effectiveBreakpoints.sm,
|
|
@@ -1076,10 +1076,7 @@ var useContainerSize = (options) => {
|
|
|
1076
1076
|
effectiveBreakpoints.xlg
|
|
1077
1077
|
]);
|
|
1078
1078
|
return {
|
|
1079
|
-
containerRef: ref,
|
|
1080
|
-
// Reference to component container
|
|
1081
1079
|
activeBreakpoint: size
|
|
1082
|
-
// Closest possible breakpoint to container's width
|
|
1083
1080
|
};
|
|
1084
1081
|
};
|
|
1085
1082
|
|
|
@@ -1131,7 +1128,7 @@ var AppHeader = ({
|
|
|
1131
1128
|
const labelOpenMenu = "Open menu";
|
|
1132
1129
|
const labelSideNav = "Side navigation";
|
|
1133
1130
|
const [visible, setVisible] = React4.useState(true);
|
|
1134
|
-
const {
|
|
1131
|
+
const { activeBreakpoint } = useWindowBreakpoint();
|
|
1135
1132
|
React4.useEffect(() => {
|
|
1136
1133
|
const handleOpen = () => {
|
|
1137
1134
|
if (activeBreakpoint !== "sm" && activeBreakpoint !== "md") return;
|
|
@@ -1149,7 +1146,7 @@ var AppHeader = ({
|
|
|
1149
1146
|
};
|
|
1150
1147
|
}, [activeBreakpoint]);
|
|
1151
1148
|
if (!visible) return null;
|
|
1152
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1149
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1153
1150
|
react.HeaderContainer,
|
|
1154
1151
|
{
|
|
1155
1152
|
render: ({ isSideNavExpanded, onClickSideNavExpand }) => /* @__PURE__ */ jsxRuntime.jsx(react.Header, { "aria-label": brandLabel, className: "enj-AppHeader", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `header-inner header-inner-${activeBreakpoint}`, children: [
|
|
@@ -1176,7 +1173,7 @@ var AppHeader = ({
|
|
|
1176
1173
|
)
|
|
1177
1174
|
] }) })
|
|
1178
1175
|
}
|
|
1179
|
-
)
|
|
1176
|
+
);
|
|
1180
1177
|
};
|
|
1181
1178
|
var AppHeader_default = AppHeader;
|
|
1182
1179
|
var BrandLogoString = ({ style, className, value, role }) => {
|
|
@@ -2437,6 +2434,48 @@ var FeatureText = ({
|
|
|
2437
2434
|
] });
|
|
2438
2435
|
};
|
|
2439
2436
|
var FeatureText_default = FeatureText;
|
|
2437
|
+
var useContainerSize = (options) => {
|
|
2438
|
+
const ref = React4.useRef(null);
|
|
2439
|
+
const [size, setSize] = React4.useState(options?.defaultSize || "max");
|
|
2440
|
+
const effectiveBreakpoints = {
|
|
2441
|
+
sm: options?.customBreakpoints?.sm ?? calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
2442
|
+
md: options?.customBreakpoints?.md ?? calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
2443
|
+
lg: options?.customBreakpoints?.lg ?? calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
2444
|
+
xlg: options?.customBreakpoints?.xlg ?? calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
2445
|
+
};
|
|
2446
|
+
React4.useEffect(() => {
|
|
2447
|
+
if (!ref.current) return;
|
|
2448
|
+
const observer = new ResizeObserver((entries) => {
|
|
2449
|
+
const width = entries[0].contentRect.width;
|
|
2450
|
+
if (width < effectiveBreakpoints.sm) {
|
|
2451
|
+
setSize("sm");
|
|
2452
|
+
} else if (width < effectiveBreakpoints.md) {
|
|
2453
|
+
setSize("md");
|
|
2454
|
+
} else if (width < effectiveBreakpoints.lg) {
|
|
2455
|
+
setSize("lg");
|
|
2456
|
+
} else if (width < effectiveBreakpoints.xlg) {
|
|
2457
|
+
setSize("xlg");
|
|
2458
|
+
} else {
|
|
2459
|
+
setSize("max");
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
observer.observe(ref.current);
|
|
2463
|
+
return () => {
|
|
2464
|
+
observer.disconnect();
|
|
2465
|
+
};
|
|
2466
|
+
}, [
|
|
2467
|
+
effectiveBreakpoints.sm,
|
|
2468
|
+
effectiveBreakpoints.md,
|
|
2469
|
+
effectiveBreakpoints.lg,
|
|
2470
|
+
effectiveBreakpoints.xlg
|
|
2471
|
+
]);
|
|
2472
|
+
return {
|
|
2473
|
+
containerRef: ref,
|
|
2474
|
+
// Reference to component container
|
|
2475
|
+
activeBreakpoint: size
|
|
2476
|
+
// Closest possible breakpoint to container's width
|
|
2477
|
+
};
|
|
2478
|
+
};
|
|
2440
2479
|
var Banner = ({
|
|
2441
2480
|
id,
|
|
2442
2481
|
className,
|
package/dist/index.mjs
CHANGED
|
@@ -1011,20 +1011,19 @@ var breakpoints = {
|
|
|
1011
1011
|
// src/libs/helpers.ts
|
|
1012
1012
|
var calcRemToPx = (remVal) => remVal * 16;
|
|
1013
1013
|
|
|
1014
|
-
// src/libs/
|
|
1015
|
-
var
|
|
1016
|
-
const
|
|
1017
|
-
const [size, setSize] = useState(options?.defaultSize || "max");
|
|
1014
|
+
// src/libs/useWindowBreakpoint.ts
|
|
1015
|
+
var useWindowBreakpoint = (options) => {
|
|
1016
|
+
const [size, setSize] = useState("max");
|
|
1018
1017
|
const effectiveBreakpoints = {
|
|
1019
|
-
sm:
|
|
1020
|
-
md:
|
|
1021
|
-
lg:
|
|
1022
|
-
xlg:
|
|
1018
|
+
sm: calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
1019
|
+
md: calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
1020
|
+
lg: calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
1021
|
+
xlg: calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
1023
1022
|
};
|
|
1024
1023
|
useEffect(() => {
|
|
1025
|
-
if (
|
|
1026
|
-
const
|
|
1027
|
-
const width =
|
|
1024
|
+
if (typeof window === "undefined") return;
|
|
1025
|
+
const updateSize = () => {
|
|
1026
|
+
const width = window.innerWidth;
|
|
1028
1027
|
if (width < effectiveBreakpoints.sm) {
|
|
1029
1028
|
setSize("sm");
|
|
1030
1029
|
} else if (width < effectiveBreakpoints.md) {
|
|
@@ -1036,10 +1035,11 @@ var useContainerSize = (options) => {
|
|
|
1036
1035
|
} else {
|
|
1037
1036
|
setSize("max");
|
|
1038
1037
|
}
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1038
|
+
};
|
|
1039
|
+
updateSize();
|
|
1040
|
+
window.addEventListener("resize", updateSize);
|
|
1041
1041
|
return () => {
|
|
1042
|
-
|
|
1042
|
+
window.removeEventListener("resize", updateSize);
|
|
1043
1043
|
};
|
|
1044
1044
|
}, [
|
|
1045
1045
|
effectiveBreakpoints.sm,
|
|
@@ -1048,10 +1048,7 @@ var useContainerSize = (options) => {
|
|
|
1048
1048
|
effectiveBreakpoints.xlg
|
|
1049
1049
|
]);
|
|
1050
1050
|
return {
|
|
1051
|
-
containerRef: ref,
|
|
1052
|
-
// Reference to component container
|
|
1053
1051
|
activeBreakpoint: size
|
|
1054
|
-
// Closest possible breakpoint to container's width
|
|
1055
1052
|
};
|
|
1056
1053
|
};
|
|
1057
1054
|
|
|
@@ -1103,7 +1100,7 @@ var AppHeader = ({
|
|
|
1103
1100
|
const labelOpenMenu = "Open menu";
|
|
1104
1101
|
const labelSideNav = "Side navigation";
|
|
1105
1102
|
const [visible, setVisible] = useState(true);
|
|
1106
|
-
const {
|
|
1103
|
+
const { activeBreakpoint } = useWindowBreakpoint();
|
|
1107
1104
|
useEffect(() => {
|
|
1108
1105
|
const handleOpen = () => {
|
|
1109
1106
|
if (activeBreakpoint !== "sm" && activeBreakpoint !== "md") return;
|
|
@@ -1121,7 +1118,7 @@ var AppHeader = ({
|
|
|
1121
1118
|
};
|
|
1122
1119
|
}, [activeBreakpoint]);
|
|
1123
1120
|
if (!visible) return null;
|
|
1124
|
-
return /* @__PURE__ */ jsx(
|
|
1121
|
+
return /* @__PURE__ */ jsx(
|
|
1125
1122
|
HeaderContainer,
|
|
1126
1123
|
{
|
|
1127
1124
|
render: ({ isSideNavExpanded, onClickSideNavExpand }) => /* @__PURE__ */ jsx(Header, { "aria-label": brandLabel, className: "enj-AppHeader", children: /* @__PURE__ */ jsxs("div", { className: `header-inner header-inner-${activeBreakpoint}`, children: [
|
|
@@ -1148,7 +1145,7 @@ var AppHeader = ({
|
|
|
1148
1145
|
)
|
|
1149
1146
|
] }) })
|
|
1150
1147
|
}
|
|
1151
|
-
)
|
|
1148
|
+
);
|
|
1152
1149
|
};
|
|
1153
1150
|
var AppHeader_default = AppHeader;
|
|
1154
1151
|
var BrandLogoString = ({ style, className, value, role }) => {
|
|
@@ -2409,6 +2406,48 @@ var FeatureText = ({
|
|
|
2409
2406
|
] });
|
|
2410
2407
|
};
|
|
2411
2408
|
var FeatureText_default = FeatureText;
|
|
2409
|
+
var useContainerSize = (options) => {
|
|
2410
|
+
const ref = useRef(null);
|
|
2411
|
+
const [size, setSize] = useState(options?.defaultSize || "max");
|
|
2412
|
+
const effectiveBreakpoints = {
|
|
2413
|
+
sm: options?.customBreakpoints?.sm ?? calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
2414
|
+
md: options?.customBreakpoints?.md ?? calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
2415
|
+
lg: options?.customBreakpoints?.lg ?? calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
2416
|
+
xlg: options?.customBreakpoints?.xlg ?? calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
2417
|
+
};
|
|
2418
|
+
useEffect(() => {
|
|
2419
|
+
if (!ref.current) return;
|
|
2420
|
+
const observer = new ResizeObserver((entries) => {
|
|
2421
|
+
const width = entries[0].contentRect.width;
|
|
2422
|
+
if (width < effectiveBreakpoints.sm) {
|
|
2423
|
+
setSize("sm");
|
|
2424
|
+
} else if (width < effectiveBreakpoints.md) {
|
|
2425
|
+
setSize("md");
|
|
2426
|
+
} else if (width < effectiveBreakpoints.lg) {
|
|
2427
|
+
setSize("lg");
|
|
2428
|
+
} else if (width < effectiveBreakpoints.xlg) {
|
|
2429
|
+
setSize("xlg");
|
|
2430
|
+
} else {
|
|
2431
|
+
setSize("max");
|
|
2432
|
+
}
|
|
2433
|
+
});
|
|
2434
|
+
observer.observe(ref.current);
|
|
2435
|
+
return () => {
|
|
2436
|
+
observer.disconnect();
|
|
2437
|
+
};
|
|
2438
|
+
}, [
|
|
2439
|
+
effectiveBreakpoints.sm,
|
|
2440
|
+
effectiveBreakpoints.md,
|
|
2441
|
+
effectiveBreakpoints.lg,
|
|
2442
|
+
effectiveBreakpoints.xlg
|
|
2443
|
+
]);
|
|
2444
|
+
return {
|
|
2445
|
+
containerRef: ref,
|
|
2446
|
+
// Reference to component container
|
|
2447
|
+
activeBreakpoint: size
|
|
2448
|
+
// Closest possible breakpoint to container's width
|
|
2449
|
+
};
|
|
2450
|
+
};
|
|
2412
2451
|
var Banner = ({
|
|
2413
2452
|
id,
|
|
2414
2453
|
className,
|
package/package.json
CHANGED