@dnanpm/ui-components 0.9.0 → 0.10.0
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/README.md +13 -0
- package/dist/components/Accordion/Accordion.css +5 -1
- package/dist/components/AccordionItem/AccordionItem.cjs +4 -4
- package/dist/components/AccordionItem/AccordionItem.cjs.map +1 -1
- package/dist/components/AccordionItem/AccordionItem.css +4 -1
- package/dist/components/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/dist/components/AccordionItem/AccordionItem.js +2 -2
- package/dist/components/AccordionItem/AccordionItem.js.map +1 -1
- package/dist/components/Avatar/Avatar.cjs +83 -0
- package/dist/components/Avatar/Avatar.cjs.map +1 -0
- package/dist/components/Avatar/Avatar.css +188 -0
- package/dist/components/Avatar/Avatar.d.ts +3 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +83 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/Avatar.module.css.cjs +40 -0
- package/dist/components/Avatar/Avatar.module.css.cjs.map +1 -0
- package/dist/components/Avatar/Avatar.module.css.js +40 -0
- package/dist/components/Avatar/Avatar.module.css.js.map +1 -0
- package/dist/components/Avatar/Avatar.types.d.ts +66 -0
- package/dist/components/Avatar/Avatar.types.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.utils.cjs +17 -0
- package/dist/components/Avatar/Avatar.utils.cjs.map +1 -0
- package/dist/components/Avatar/Avatar.utils.d.ts +6 -0
- package/dist/components/Avatar/Avatar.utils.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.utils.js +17 -0
- package/dist/components/Avatar/Avatar.utils.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs +9 -12
- package/dist/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.css +16 -16
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +2 -5
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs +5 -8
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js +5 -8
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js.map +1 -1
- package/dist/components/Button/Button.cjs +29 -3
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.css +78 -31
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +28 -2
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.module.css.cjs +19 -11
- package/dist/components/Button/Button.module.css.cjs.map +1 -1
- package/dist/components/Button/Button.module.css.js +19 -11
- package/dist/components/Button/Button.module.css.js.map +1 -1
- package/dist/components/Button/Button.types.d.ts +20 -3
- package/dist/components/Button/Button.types.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/ButtonCard/ButtonCard.cjs +19 -14
- package/dist/components/ButtonCard/ButtonCard.cjs.map +1 -1
- package/dist/components/ButtonCard/ButtonCard.css +63 -20
- package/dist/components/ButtonCard/ButtonCard.d.ts +2 -1
- package/dist/components/ButtonCard/ButtonCard.d.ts.map +1 -1
- package/dist/components/ButtonCard/ButtonCard.js +17 -12
- package/dist/components/ButtonCard/ButtonCard.js.map +1 -1
- package/dist/components/ButtonCard/ButtonCard.module.css.cjs +14 -12
- package/dist/components/ButtonCard/ButtonCard.module.css.cjs.map +1 -1
- package/dist/components/ButtonCard/ButtonCard.module.css.js +14 -12
- package/dist/components/ButtonCard/ButtonCard.module.css.js.map +1 -1
- package/dist/components/ButtonCard/ButtonCard.types.d.ts +3 -2
- package/dist/components/ButtonCard/ButtonCard.types.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +105 -0
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.css +323 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +105 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.module.css.cjs +35 -0
- package/dist/components/Checkbox/Checkbox.module.css.cjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.module.css.js +35 -0
- package/dist/components/Checkbox/Checkbox.module.css.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +47 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/ContentCard/ContentCard.cjs +8 -7
- package/dist/components/ContentCard/ContentCard.cjs.map +1 -1
- package/dist/components/ContentCard/ContentCard.css +39 -34
- package/dist/components/ContentCard/ContentCard.d.ts.map +1 -1
- package/dist/components/ContentCard/ContentCard.js +3 -2
- package/dist/components/ContentCard/ContentCard.js.map +1 -1
- package/dist/components/ContentCard/ContentCard.module.css.cjs +18 -18
- package/dist/components/ContentCard/ContentCard.module.css.js +18 -18
- package/dist/components/ContentCard/ContentCard.types.d.ts +2 -1
- package/dist/components/ContentCard/ContentCard.types.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.cjs +15 -7
- package/dist/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.css +48 -45
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.js +12 -4
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.module.css.cjs +16 -16
- package/dist/components/Drawer/Drawer.module.css.js +16 -16
- package/dist/components/Footer/Footer.cjs +8 -9
- package/dist/components/Footer/Footer.cjs.map +1 -1
- package/dist/components/Footer/Footer.css +87 -83
- package/dist/components/Footer/Footer.d.ts.map +1 -1
- package/dist/components/Footer/Footer.js +1 -2
- package/dist/components/Footer/Footer.js.map +1 -1
- package/dist/components/Footer/Footer.module.css.cjs +39 -39
- package/dist/components/Footer/Footer.module.css.js +39 -39
- package/dist/components/FunctionButton/FunctionButton.cjs +2 -2
- package/dist/components/FunctionButton/FunctionButton.cjs.map +1 -1
- package/dist/components/FunctionButton/FunctionButton.css +5 -1
- package/dist/components/FunctionButton/FunctionButton.js +1 -1
- package/dist/components/FunctionButton/FunctionButton.js.map +1 -1
- package/dist/components/Hero/Hero.cjs +30 -27
- package/dist/components/Hero/Hero.cjs.map +1 -1
- package/dist/components/Hero/Hero.css +49 -44
- package/dist/components/Hero/Hero.d.ts +1 -1
- package/dist/components/Hero/Hero.d.ts.map +1 -1
- package/dist/components/Hero/Hero.js +30 -27
- package/dist/components/Hero/Hero.js.map +1 -1
- package/dist/components/Hero/Hero.module.css.cjs +18 -18
- package/dist/components/Hero/Hero.module.css.js +18 -18
- package/dist/components/Hero/Hero.types.d.ts +2 -6
- package/dist/components/Hero/Hero.types.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.cjs +3 -4
- package/dist/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.css +5 -1
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.js +1 -2
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Label/Label.css +5 -1
- package/dist/components/MainNavigation/MainNavigation.cjs +216 -162
- package/dist/components/MainNavigation/MainNavigation.cjs.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.css +206 -183
- package/dist/components/MainNavigation/MainNavigation.d.ts +1 -1
- package/dist/components/MainNavigation/MainNavigation.d.ts.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.js +177 -123
- package/dist/components/MainNavigation/MainNavigation.js.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.module.css.cjs +80 -78
- package/dist/components/MainNavigation/MainNavigation.module.css.cjs.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.module.css.js +80 -78
- package/dist/components/MainNavigation/MainNavigation.module.css.js.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.types.d.ts +0 -13
- package/dist/components/MainNavigation/MainNavigation.types.d.ts.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.utils.cjs +8 -4
- package/dist/components/MainNavigation/MainNavigation.utils.cjs.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.utils.d.ts +1 -0
- package/dist/components/MainNavigation/MainNavigation.utils.d.ts.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.utils.js +8 -4
- package/dist/components/MainNavigation/MainNavigation.utils.js.map +1 -1
- package/dist/components/Modal/Modal.cjs +14 -6
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.css +44 -40
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +12 -4
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/Modal.module.css.cjs +18 -18
- package/dist/components/Modal/Modal.module.css.js +18 -18
- package/dist/components/Notification/Notification.cjs +3 -2
- package/dist/components/Notification/Notification.cjs.map +1 -1
- package/dist/components/Notification/Notification.css +16 -11
- package/dist/components/Notification/Notification.d.ts.map +1 -1
- package/dist/components/Notification/Notification.js +2 -1
- package/dist/components/Notification/Notification.js.map +1 -1
- package/dist/components/Notification/Notification.module.css.cjs +9 -9
- package/dist/components/Notification/Notification.module.css.js +9 -9
- package/dist/components/Pagination/Pagination.cjs +142 -0
- package/dist/components/Pagination/Pagination.cjs.map +1 -0
- package/dist/components/Pagination/Pagination.css +256 -0
- package/dist/components/Pagination/Pagination.d.ts +3 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.js +142 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/Pagination.module.css.cjs +34 -0
- package/dist/components/Pagination/Pagination.module.css.cjs.map +1 -0
- package/dist/components/Pagination/Pagination.module.css.js +34 -0
- package/dist/components/Pagination/Pagination.module.css.js.map +1 -0
- package/dist/components/Pagination/Pagination.types.d.ts +20 -0
- package/dist/components/Pagination/Pagination.types.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.utils.cjs +76 -0
- package/dist/components/Pagination/Pagination.utils.cjs.map +1 -0
- package/dist/components/Pagination/Pagination.utils.d.ts +21 -0
- package/dist/components/Pagination/Pagination.utils.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.utils.js +76 -0
- package/dist/components/Pagination/Pagination.utils.js.map +1 -0
- package/dist/components/Pagination/index.d.ts +3 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/Pictograph/Pictograph.css +5 -1
- package/dist/components/Pictograph/PictographItem.css +5 -1
- package/dist/components/Quote/Quote.css +5 -1
- package/dist/components/Spinner/Spinner.css +5 -1
- package/dist/design-tokens/dist/tokens.cjs +5 -0
- package/dist/design-tokens/dist/tokens.cjs.map +1 -0
- package/dist/design-tokens/dist/tokens.js +5 -0
- package/dist/design-tokens/dist/tokens.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/utilities.css +6 -0
- package/dist/styles/utils/elevation.css +35 -26
- package/dist/styles/utils/focus.css +63 -68
- package/dist/styles/utils/index.cjs +33 -0
- package/dist/styles/utils/index.cjs.map +1 -0
- package/dist/styles/utils/index.d.ts +20 -0
- package/dist/styles/utils/index.d.ts.map +1 -0
- package/dist/styles/utils/index.js +33 -0
- package/dist/styles/utils/index.js.map +1 -0
- package/dist/styles/utils/overlay.css +35 -27
- package/dist/styles/utils/text-decoration.css +20 -12
- package/dist/styles.css +27 -3
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/isRenderable/index.d.ts +2 -0
- package/dist/utils/isRenderable/index.d.ts.map +1 -0
- package/dist/utils/isRenderable/isRenderable.cjs +5 -0
- package/dist/utils/isRenderable/isRenderable.cjs.map +1 -0
- package/dist/utils/isRenderable/isRenderable.d.ts +4 -0
- package/dist/utils/isRenderable/isRenderable.d.ts.map +1 -0
- package/dist/utils/isRenderable/isRenderable.js +5 -0
- package/dist/utils/isRenderable/isRenderable.js.map +1 -0
- package/package.json +12 -4
- package/dist/styles/utils/elevation.module.css.cjs +0 -16
- package/dist/styles/utils/elevation.module.css.cjs.map +0 -1
- package/dist/styles/utils/elevation.module.css.js +0 -16
- package/dist/styles/utils/elevation.module.css.js.map +0 -1
- package/dist/styles/utils/focus.module.css.cjs +0 -16
- package/dist/styles/utils/focus.module.css.cjs.map +0 -1
- package/dist/styles/utils/focus.module.css.js +0 -16
- package/dist/styles/utils/focus.module.css.js.map +0 -1
- package/dist/styles/utils/overlay.module.css.cjs +0 -13
- package/dist/styles/utils/overlay.module.css.cjs.map +0 -1
- package/dist/styles/utils/overlay.module.css.js +0 -13
- package/dist/styles/utils/overlay.module.css.js.map +0 -1
- package/dist/styles/utils/text-decoration.module.css.cjs +0 -13
- package/dist/styles/utils/text-decoration.module.css.cjs.map +0 -1
- package/dist/styles/utils/text-decoration.module.css.js +0 -13
- package/dist/styles/utils/text-decoration.module.css.js.map +0 -1
|
@@ -3,10 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
5
|
const icons = require("@dnanpm/icons");
|
|
6
|
-
const
|
|
7
|
-
const overlay_module = require("../../styles/utils/overlay.module.css.cjs");
|
|
8
|
-
const elevation_module = require("../../styles/utils/elevation.module.css.cjs");
|
|
9
|
-
const textDecoration_module = require("../../styles/utils/text-decoration.module.css.cjs");
|
|
6
|
+
const index = require("../../styles/utils/index.cjs");
|
|
10
7
|
const MainNavigation_module = require("./MainNavigation.module.css.cjs");
|
|
11
8
|
const MainNavigation_utils = require("./MainNavigation.utils.cjs");
|
|
12
9
|
const cn = require("../../utils/cn/cn.cjs");
|
|
@@ -20,7 +17,6 @@ const defaultLogoSrc = `data:image/svg+xml,${encodeURIComponent(defaultLogoSvg)}
|
|
|
20
17
|
const mobilePanelAnimationDurationMs = 200;
|
|
21
18
|
const mobileBodyScrollLockClass = "dds-un-scrollable";
|
|
22
19
|
const defaultOverflowCategoryLabel = "Muut kategoriat";
|
|
23
|
-
const desktopMinWidthMediaQuery = "(min-width: 1024px)";
|
|
24
20
|
const defaultRenderLink = (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props });
|
|
25
21
|
const defaultRenderLanguageLink = (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props });
|
|
26
22
|
const MainNavigation = ({
|
|
@@ -34,10 +30,8 @@ const MainNavigation = ({
|
|
|
34
30
|
cartLabel = "Ostoskori",
|
|
35
31
|
cartCounter,
|
|
36
32
|
cartCounterLabel = "tuotetta ostoskorissa",
|
|
37
|
-
defaultCartOpen = false,
|
|
38
33
|
cartOpen,
|
|
39
34
|
onCartOpenChange,
|
|
40
|
-
defaultOpenDropdown,
|
|
41
35
|
onSearchOpenChange,
|
|
42
36
|
onLanguageOpenChange,
|
|
43
37
|
onLoginOpenChange,
|
|
@@ -50,8 +44,6 @@ const MainNavigation = ({
|
|
|
50
44
|
logoAriaLabel = "Siirry etusivulle",
|
|
51
45
|
mobilePrimaryNavigationAriaLabel = "Päävalikko",
|
|
52
46
|
externalLinkAriaLabel = "avautuu uuteen välilehteen",
|
|
53
|
-
defaultMobileMenuOpen = false,
|
|
54
|
-
defaultOpenItemIndex = null,
|
|
55
47
|
currentPathname,
|
|
56
48
|
overflowCategoryLabel = defaultOverflowCategoryLabel,
|
|
57
49
|
onMobileMenuToggle,
|
|
@@ -62,19 +54,21 @@ const MainNavigation = ({
|
|
|
62
54
|
ref,
|
|
63
55
|
...props
|
|
64
56
|
}) => {
|
|
65
|
-
const
|
|
57
|
+
const isCartControlled = cartOpen !== void 0;
|
|
58
|
+
const showSearch = searchDropdownContent != null && typeof searchDropdownContent !== "boolean";
|
|
59
|
+
const showLogin = loginDropdownContent != null && typeof loginDropdownContent !== "boolean";
|
|
60
|
+
const showCart = cartContent != null && typeof cartContent !== "boolean";
|
|
61
|
+
const currentLanguage = languages?.find((language) => language.current) ?? languages?.[0];
|
|
62
|
+
const alternativeLanguages = currentLanguage != null ? (languages ?? []).filter((language) => language.code !== currentLanguage.code) : [];
|
|
63
|
+
const showLanguage = currentLanguage != null && alternativeLanguages.length > 0;
|
|
64
|
+
const [mobileMenuOpen, setMobileMenuOpen] = react.useState(false);
|
|
66
65
|
const [isMobileMenuClosing, setIsMobileMenuClosing] = react.useState(false);
|
|
67
|
-
const [openTopLevelItemIndex, setOpenTopLevelItemIndex] = react.useState(
|
|
68
|
-
defaultOpenItemIndex
|
|
69
|
-
);
|
|
66
|
+
const [openTopLevelItemIndex, setOpenTopLevelItemIndex] = react.useState(null);
|
|
70
67
|
const [isHeaderOpen, setIsHeaderOpen] = react.useState(true);
|
|
71
68
|
const [mobileActiveCategoryIndex, setMobileActiveCategoryIndex] = react.useState(null);
|
|
72
|
-
const [internalCartOpen, setInternalCartOpen] = react.useState(
|
|
73
|
-
const isCartControlled = cartOpen !== void 0;
|
|
69
|
+
const [internalCartOpen, setInternalCartOpen] = react.useState(false);
|
|
74
70
|
const isCartOpen = cartOpen ?? internalCartOpen;
|
|
75
|
-
const
|
|
76
|
-
const [openUtilityDropdown, setOpenUtilityDropdown] = react.useState(hasInitialNavigationSurface ? null : defaultOpenDropdown ?? null);
|
|
77
|
-
const openUtilityDropdownRef = react.useRef(openUtilityDropdown);
|
|
71
|
+
const [openUtilityDropdown, setOpenUtilityDropdown] = react.useState(null);
|
|
78
72
|
const searchDropdownId = react.useId();
|
|
79
73
|
const languageDropdownId = react.useId();
|
|
80
74
|
const loginDropdownId = react.useId();
|
|
@@ -109,10 +103,14 @@ const MainNavigation = ({
|
|
|
109
103
|
const focusReturnToMobileCategoryTimeoutRef = react.useRef(
|
|
110
104
|
null
|
|
111
105
|
);
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
const notifyRef = react.useRef({
|
|
107
|
+
mobileMenu: false,
|
|
108
|
+
desktopItem: null,
|
|
109
|
+
search: false,
|
|
110
|
+
language: false,
|
|
111
|
+
login: false,
|
|
112
|
+
cart: false
|
|
113
|
+
});
|
|
116
114
|
const setHeaderRef = react.useCallback(
|
|
117
115
|
(node) => {
|
|
118
116
|
headerElementRef.current = node;
|
|
@@ -151,7 +149,7 @@ const MainNavigation = ({
|
|
|
151
149
|
return;
|
|
152
150
|
}
|
|
153
151
|
const headerElement = headerElementRef.current;
|
|
154
|
-
const desktopQuery = window.matchMedia(desktopMinWidthMediaQuery);
|
|
152
|
+
const desktopQuery = window.matchMedia(MainNavigation_utils.desktopMinWidthMediaQuery);
|
|
155
153
|
let previousScrollY = window.pageYOffset;
|
|
156
154
|
let headerHeight = parseFloat(window.getComputedStyle(headerElement).height.replace("px", "")) || headerElement.offsetHeight;
|
|
157
155
|
const openHeader = () => {
|
|
@@ -254,13 +252,8 @@ const MainNavigation = ({
|
|
|
254
252
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
255
253
|
return;
|
|
256
254
|
}
|
|
257
|
-
const desktopQuery = window.matchMedia(desktopMinWidthMediaQuery);
|
|
258
|
-
const
|
|
259
|
-
const viewportMode = isDesktopViewport2 ? "desktop" : "mobile";
|
|
260
|
-
if (lastAppliedViewportModeRef.current === viewportMode) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
lastAppliedViewportModeRef.current = viewportMode;
|
|
255
|
+
const desktopQuery = window.matchMedia(MainNavigation_utils.desktopMinWidthMediaQuery);
|
|
256
|
+
const handleViewportModeChange = ({ matches: isDesktopViewport2 }) => {
|
|
264
257
|
if (isDesktopViewport2) {
|
|
265
258
|
clearTimeout(mobileSecondPanelCloseTimeoutRef.current ?? void 0);
|
|
266
259
|
mobileSecondPanelCloseTimeoutRef.current = null;
|
|
@@ -268,9 +261,8 @@ const MainNavigation = ({
|
|
|
268
261
|
mobileThirdPanelCloseTimeoutRef.current = null;
|
|
269
262
|
clearTimeout(resetMobileThirdPanelScrollTimeoutRef.current ?? void 0);
|
|
270
263
|
resetMobileThirdPanelScrollTimeoutRef.current = null;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (wasMobileMenuOpen) {
|
|
264
|
+
if (notifyRef.current.mobileMenu) {
|
|
265
|
+
notifyRef.current.mobileMenu = false;
|
|
274
266
|
onMobileMenuToggle?.(false);
|
|
275
267
|
}
|
|
276
268
|
setMobileMenuOpen(false);
|
|
@@ -279,21 +271,18 @@ const MainNavigation = ({
|
|
|
279
271
|
setIsMobileThirdPanelClosing(false);
|
|
280
272
|
return;
|
|
281
273
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (hadOpenDesktopItem) {
|
|
274
|
+
if (notifyRef.current.desktopItem !== null) {
|
|
275
|
+
notifyRef.current.desktopItem = null;
|
|
285
276
|
onDesktopItemToggle?.(null);
|
|
286
277
|
}
|
|
287
278
|
setOpenTopLevelItemIndex(null);
|
|
288
279
|
};
|
|
289
|
-
|
|
290
|
-
desktopQuery.addEventListener("change", applyViewportModeChange);
|
|
280
|
+
desktopQuery.addEventListener("change", handleViewportModeChange);
|
|
291
281
|
return () => {
|
|
292
|
-
desktopQuery.removeEventListener("change",
|
|
282
|
+
desktopQuery.removeEventListener("change", handleViewportModeChange);
|
|
293
283
|
};
|
|
294
284
|
}, [onDesktopItemToggle, onMobileMenuToggle]);
|
|
295
285
|
const resetMobilePanelState = react.useCallback(() => {
|
|
296
|
-
openTopLevelItemIndexRef.current = null;
|
|
297
286
|
setOpenTopLevelItemIndex(null);
|
|
298
287
|
setMobileActiveCategoryIndex(null);
|
|
299
288
|
setIsMobileSecondPanelClosing(false);
|
|
@@ -310,14 +299,12 @@ const MainNavigation = ({
|
|
|
310
299
|
return;
|
|
311
300
|
}
|
|
312
301
|
const shouldAnimateMobileClose = mobileMenuOpen;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
mobileMenuOpenRef.current = false;
|
|
316
|
-
openTopLevelItemIndexRef.current = null;
|
|
317
|
-
if (wasMobileMenuOpen) {
|
|
302
|
+
if (mobileMenuOpen) {
|
|
303
|
+
notifyRef.current.mobileMenu = false;
|
|
318
304
|
onMobileMenuToggle?.(false);
|
|
319
305
|
}
|
|
320
|
-
if (
|
|
306
|
+
if (openTopLevelItemIndex !== null) {
|
|
307
|
+
notifyRef.current.desktopItem = null;
|
|
321
308
|
onDesktopItemToggle?.(null);
|
|
322
309
|
}
|
|
323
310
|
clearTimeout(mobileMenuCloseResetTimeoutRef.current ?? void 0);
|
|
@@ -347,15 +334,15 @@ const MainNavigation = ({
|
|
|
347
334
|
return;
|
|
348
335
|
}
|
|
349
336
|
closeUtilityDropdown();
|
|
350
|
-
|
|
337
|
+
notifyRef.current.mobileMenu = true;
|
|
351
338
|
setMobileMenuOpen(true);
|
|
352
339
|
setIsMobileMenuClosing(false);
|
|
353
340
|
onMobileMenuToggle?.(true);
|
|
354
341
|
};
|
|
355
|
-
const toggleTopLevelItem = (
|
|
342
|
+
const toggleTopLevelItem = (index2) => {
|
|
356
343
|
closeUtilityDropdown();
|
|
357
|
-
const next = openTopLevelItemIndex ===
|
|
358
|
-
|
|
344
|
+
const next = openTopLevelItemIndex === index2 ? null : index2;
|
|
345
|
+
notifyRef.current.desktopItem = next;
|
|
359
346
|
setOpenTopLevelItemIndex(next);
|
|
360
347
|
setMobileActiveCategoryIndex(null);
|
|
361
348
|
setIsMobileSecondPanelClosing(false);
|
|
@@ -463,10 +450,10 @@ const MainNavigation = ({
|
|
|
463
450
|
);
|
|
464
451
|
return Array.from(new Set(focusableElements));
|
|
465
452
|
}, [getFocusableElements, isFocusable, mobileActiveCategoryIndex, openTopLevelItemIndex]);
|
|
466
|
-
const openMobileCategoryPanel = react.useCallback((
|
|
453
|
+
const openMobileCategoryPanel = react.useCallback((index2) => {
|
|
467
454
|
clearTimeout(resetMobileThirdPanelScrollTimeoutRef.current ?? void 0);
|
|
468
455
|
setIsMobileThirdPanelClosing(false);
|
|
469
|
-
setMobileActiveCategoryIndex(
|
|
456
|
+
setMobileActiveCategoryIndex(index2);
|
|
470
457
|
resetMobileThirdPanelScrollTimeoutRef.current = setTimeout(() => {
|
|
471
458
|
(mobileThirdPanelRef.current ?? { scrollTop: 0 }).scrollTop = 0;
|
|
472
459
|
resetMobileThirdPanelScrollTimeoutRef.current = null;
|
|
@@ -485,9 +472,9 @@ const MainNavigation = ({
|
|
|
485
472
|
[onLanguageOpenChange, onLoginOpenChange, onSearchOpenChange]
|
|
486
473
|
);
|
|
487
474
|
const closeUtilityDropdown = react.useCallback(() => {
|
|
488
|
-
const openDropdown =
|
|
475
|
+
const openDropdown = notifyRef.current.search ? "search" : notifyRef.current.language ? "language" : notifyRef.current.login ? "login" : null;
|
|
489
476
|
if (openDropdown != null) {
|
|
490
|
-
|
|
477
|
+
notifyRef.current[openDropdown] = false;
|
|
491
478
|
notifyUtilityOpenChange(openDropdown, false);
|
|
492
479
|
}
|
|
493
480
|
setOpenUtilityDropdown(null);
|
|
@@ -499,17 +486,19 @@ const MainNavigation = ({
|
|
|
499
486
|
mobileThirdPanelCloseTimeoutRef.current = null;
|
|
500
487
|
clearTimeout(focusMobileSecondPanelTimeoutRef.current ?? void 0);
|
|
501
488
|
focusMobileSecondPanelTimeoutRef.current = null;
|
|
489
|
+
focusMobilePanelBackOnOpenRef.current = false;
|
|
502
490
|
clearTimeout(focusMobileThirdPanelTimeoutRef.current ?? void 0);
|
|
503
491
|
focusMobileThirdPanelTimeoutRef.current = null;
|
|
492
|
+
focusMobileThirdPanelBackOnOpenRef.current = false;
|
|
504
493
|
clearTimeout(resetMobileThirdPanelScrollTimeoutRef.current ?? void 0);
|
|
505
494
|
resetMobileThirdPanelScrollTimeoutRef.current = null;
|
|
506
495
|
clearTimeout(focusReturnToMobileTopLevelItemTimeoutRef.current ?? void 0);
|
|
507
496
|
focusReturnToMobileTopLevelItemTimeoutRef.current = null;
|
|
508
497
|
clearTimeout(focusReturnToMobileCategoryTimeoutRef.current ?? void 0);
|
|
509
498
|
focusReturnToMobileCategoryTimeoutRef.current = null;
|
|
510
|
-
const openDropdown =
|
|
499
|
+
const openDropdown = notifyRef.current.search ? "search" : notifyRef.current.language ? "language" : notifyRef.current.login ? "login" : null;
|
|
511
500
|
if (openDropdown != null) {
|
|
512
|
-
|
|
501
|
+
notifyRef.current[openDropdown] = false;
|
|
513
502
|
notifyUtilityOpenChange(openDropdown, false);
|
|
514
503
|
}
|
|
515
504
|
setOpenUtilityDropdown(null);
|
|
@@ -564,13 +553,7 @@ const MainNavigation = ({
|
|
|
564
553
|
const openPanel = openItem?.panel;
|
|
565
554
|
const isMobilePanelClosingOut = isMobileMenuClosing && !mobileMenuOpen;
|
|
566
555
|
const isOverlayClosingOut = isMobilePanelClosingOut && openPanel == null;
|
|
567
|
-
const showSearch = searchDropdownContent != null && typeof searchDropdownContent !== "boolean";
|
|
568
|
-
const showLogin = loginDropdownContent != null && typeof loginDropdownContent !== "boolean";
|
|
569
|
-
const showCart = cartContent != null && typeof cartContent !== "boolean";
|
|
570
556
|
const cartAccessibleLabel = cartCounter != null ? `${cartLabel} ${cartCounter} ${cartCounterLabel}` : cartLabel;
|
|
571
|
-
const currentLanguage = languages?.find((language) => language.current) ?? languages?.[0];
|
|
572
|
-
const alternativeLanguages = currentLanguage != null ? (languages ?? []).filter((language) => language.code !== currentLanguage.code) : [];
|
|
573
|
-
const showLanguage = currentLanguage != null && alternativeLanguages.length > 0;
|
|
574
557
|
const languageAnnouncements = currentLanguage != null ? MainNavigation_utils.getLanguageToggleAnnouncements(
|
|
575
558
|
(languages ?? []).map((language) => language.code),
|
|
576
559
|
currentLanguage.code
|
|
@@ -579,25 +562,27 @@ const MainNavigation = ({
|
|
|
579
562
|
const isSearchOpen = activeUtilityDropdown === "search";
|
|
580
563
|
const isLanguageOpen = activeUtilityDropdown === "language";
|
|
581
564
|
const isLoginOpen = activeUtilityDropdown === "login";
|
|
565
|
+
const effectiveCartOpen = isCartOpen && showCart;
|
|
582
566
|
const showPageOverlay = mobileMenuOpen || openPanel != null || isMobilePanelClosingOut || activeUtilityDropdown != null;
|
|
583
567
|
const toggleUtilityDropdown = (kind) => {
|
|
584
568
|
const previous = openUtilityDropdown;
|
|
585
569
|
const next = previous === kind ? null : kind;
|
|
586
570
|
if (previous != null && previous !== next) {
|
|
571
|
+
notifyRef.current[previous] = false;
|
|
587
572
|
notifyUtilityOpenChange(previous, false);
|
|
588
573
|
}
|
|
589
574
|
if (next != null) {
|
|
575
|
+
notifyRef.current[next] = true;
|
|
590
576
|
notifyUtilityOpenChange(next, true);
|
|
591
577
|
closeMobileMenu();
|
|
592
578
|
if (isCartOpen) {
|
|
593
579
|
if (!isCartControlled) {
|
|
594
|
-
|
|
580
|
+
notifyRef.current.cart = false;
|
|
595
581
|
setInternalCartOpen(false);
|
|
596
582
|
}
|
|
597
583
|
onCartOpenChange?.(false);
|
|
598
584
|
}
|
|
599
585
|
}
|
|
600
|
-
openUtilityDropdownRef.current = next;
|
|
601
586
|
setOpenUtilityDropdown(next);
|
|
602
587
|
};
|
|
603
588
|
const handleLanguageClick = () => {
|
|
@@ -615,35 +600,85 @@ const MainNavigation = ({
|
|
|
615
600
|
closeMenus();
|
|
616
601
|
}
|
|
617
602
|
if (!isCartControlled) {
|
|
618
|
-
|
|
603
|
+
notifyRef.current.cart = next && showCart;
|
|
619
604
|
setInternalCartOpen(next);
|
|
620
605
|
}
|
|
621
606
|
onCartOpenChange?.(next);
|
|
622
607
|
};
|
|
623
608
|
const handleCartOpenChange = (open) => {
|
|
624
609
|
if (!isCartControlled) {
|
|
625
|
-
|
|
610
|
+
notifyRef.current.cart = open && showCart;
|
|
626
611
|
setInternalCartOpen(open);
|
|
627
612
|
}
|
|
628
613
|
onCartOpenChange?.(open);
|
|
629
614
|
};
|
|
630
|
-
|
|
631
|
-
if (
|
|
632
|
-
|
|
615
|
+
if (effectiveCartOpen) {
|
|
616
|
+
if (openUtilityDropdown !== null) {
|
|
617
|
+
setOpenUtilityDropdown(null);
|
|
618
|
+
}
|
|
619
|
+
if (mobileMenuOpen) {
|
|
620
|
+
setMobileMenuOpen(false);
|
|
621
|
+
}
|
|
622
|
+
if (isMobileMenuClosing) {
|
|
623
|
+
setIsMobileMenuClosing(false);
|
|
624
|
+
}
|
|
625
|
+
if (openTopLevelItemIndex !== null || mobileActiveCategoryIndex !== null || isMobileSecondPanelClosing || isMobileThirdPanelClosing) {
|
|
626
|
+
resetMobilePanelState();
|
|
633
627
|
}
|
|
634
|
-
}
|
|
628
|
+
} else if (openUtilityDropdown !== null && activeUtilityDropdown === null) {
|
|
629
|
+
setOpenUtilityDropdown(null);
|
|
630
|
+
}
|
|
631
|
+
if (!isCartControlled && internalCartOpen && !showCart) {
|
|
632
|
+
setInternalCartOpen(false);
|
|
633
|
+
}
|
|
635
634
|
react.useEffect(() => {
|
|
636
|
-
|
|
637
|
-
|
|
635
|
+
const lastNotified = notifyRef.current;
|
|
636
|
+
if (mobileMenuOpen !== lastNotified.mobileMenu) {
|
|
637
|
+
lastNotified.mobileMenu = mobileMenuOpen;
|
|
638
|
+
onMobileMenuToggle?.(mobileMenuOpen);
|
|
639
|
+
}
|
|
640
|
+
if (openTopLevelItemIndex !== lastNotified.desktopItem) {
|
|
641
|
+
lastNotified.desktopItem = openTopLevelItemIndex;
|
|
642
|
+
onDesktopItemToggle?.(openTopLevelItemIndex);
|
|
638
643
|
}
|
|
639
|
-
|
|
644
|
+
["search", "language", "login"].forEach((kind) => {
|
|
645
|
+
const open = activeUtilityDropdown === kind;
|
|
646
|
+
if (open !== lastNotified[kind]) {
|
|
647
|
+
lastNotified[kind] = open;
|
|
648
|
+
notifyUtilityOpenChange(kind, open);
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
if (!isCartControlled) {
|
|
652
|
+
const open = internalCartOpen && showCart;
|
|
653
|
+
if (open !== lastNotified.cart) {
|
|
654
|
+
lastNotified.cart = open;
|
|
655
|
+
onCartOpenChange?.(open);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
});
|
|
640
659
|
react.useEffect(() => {
|
|
641
|
-
if (!
|
|
642
|
-
|
|
643
|
-
setInternalCartOpen(false);
|
|
644
|
-
onCartOpenChange?.(false);
|
|
660
|
+
if (!effectiveCartOpen) {
|
|
661
|
+
return;
|
|
645
662
|
}
|
|
646
|
-
|
|
663
|
+
clearTimeout(mobileSecondPanelCloseTimeoutRef.current ?? void 0);
|
|
664
|
+
mobileSecondPanelCloseTimeoutRef.current = null;
|
|
665
|
+
clearTimeout(mobileThirdPanelCloseTimeoutRef.current ?? void 0);
|
|
666
|
+
mobileThirdPanelCloseTimeoutRef.current = null;
|
|
667
|
+
clearTimeout(mobileMenuCloseResetTimeoutRef.current ?? void 0);
|
|
668
|
+
mobileMenuCloseResetTimeoutRef.current = null;
|
|
669
|
+
clearTimeout(focusMobileSecondPanelTimeoutRef.current ?? void 0);
|
|
670
|
+
focusMobileSecondPanelTimeoutRef.current = null;
|
|
671
|
+
focusMobilePanelBackOnOpenRef.current = false;
|
|
672
|
+
clearTimeout(focusMobileThirdPanelTimeoutRef.current ?? void 0);
|
|
673
|
+
focusMobileThirdPanelTimeoutRef.current = null;
|
|
674
|
+
focusMobileThirdPanelBackOnOpenRef.current = false;
|
|
675
|
+
clearTimeout(resetMobileThirdPanelScrollTimeoutRef.current ?? void 0);
|
|
676
|
+
resetMobileThirdPanelScrollTimeoutRef.current = null;
|
|
677
|
+
clearTimeout(focusReturnToMobileTopLevelItemTimeoutRef.current ?? void 0);
|
|
678
|
+
focusReturnToMobileTopLevelItemTimeoutRef.current = null;
|
|
679
|
+
clearTimeout(focusReturnToMobileCategoryTimeoutRef.current ?? void 0);
|
|
680
|
+
focusReturnToMobileCategoryTimeoutRef.current = null;
|
|
681
|
+
}, [effectiveCartOpen]);
|
|
647
682
|
react.useEffect(() => {
|
|
648
683
|
if (!showPageOverlay) {
|
|
649
684
|
return;
|
|
@@ -708,11 +743,11 @@ const MainNavigation = ({
|
|
|
708
743
|
}
|
|
709
744
|
const hasFeatureLinks = openPanel.featureLinks != null && openPanel.featureLinks.length > 0;
|
|
710
745
|
const panelColumns = openPanel.columns ?? [];
|
|
711
|
-
const lastDesktopVisibleColumnIndex = panelColumns.reduce((lastIndex, column,
|
|
746
|
+
const lastDesktopVisibleColumnIndex = panelColumns.reduce((lastIndex, column, index2) => {
|
|
712
747
|
if (column.mobileOnly) {
|
|
713
748
|
return lastIndex;
|
|
714
749
|
}
|
|
715
|
-
return
|
|
750
|
+
return index2;
|
|
716
751
|
}, -1);
|
|
717
752
|
const mobilePanelColumns = panelColumns.filter((column) => !column.desktopOnly);
|
|
718
753
|
const getColumnHeading = (heading, isOverflow) => {
|
|
@@ -743,7 +778,7 @@ const MainNavigation = ({
|
|
|
743
778
|
type: "button",
|
|
744
779
|
className: cn.cn(
|
|
745
780
|
MainNavigation_module["main-navigation__mobile-back-item"],
|
|
746
|
-
|
|
781
|
+
index.focusStyles.focusableInset
|
|
747
782
|
),
|
|
748
783
|
onClick: () => closeMobilePanel({
|
|
749
784
|
isClosing: isMobileSecondPanelClosing,
|
|
@@ -751,7 +786,7 @@ const MainNavigation = ({
|
|
|
751
786
|
closeTimeoutRef: mobileSecondPanelCloseTimeoutRef,
|
|
752
787
|
onClosed: () => {
|
|
753
788
|
const closedTopLevelItemIndex = openTopLevelItemIndex;
|
|
754
|
-
|
|
789
|
+
notifyRef.current.desktopItem = null;
|
|
755
790
|
setOpenTopLevelItemIndex(null);
|
|
756
791
|
setMobileActiveCategoryIndex(null);
|
|
757
792
|
onDesktopItemToggle?.(null);
|
|
@@ -779,7 +814,7 @@ const MainNavigation = ({
|
|
|
779
814
|
"ul",
|
|
780
815
|
{
|
|
781
816
|
className: MainNavigation_module["main-navigation__mobile-level-2-feature-list"],
|
|
782
|
-
children: openPanel.featureLinks.map((link,
|
|
817
|
+
children: openPanel.featureLinks.map((link, index2) => {
|
|
783
818
|
const href = MainNavigation_utils.toNavigableHref(link.href);
|
|
784
819
|
const isExternalFeatureLink = MainNavigation_utils.isExternalTarget(link.target);
|
|
785
820
|
const MobileFeatureIcon = isExternalFeatureLink ? icons.Open : icons.ArrowRight;
|
|
@@ -813,7 +848,7 @@ const MainNavigation = ({
|
|
|
813
848
|
}
|
|
814
849
|
)
|
|
815
850
|
},
|
|
816
|
-
`mobile-feature-${
|
|
851
|
+
`mobile-feature-${index2}`
|
|
817
852
|
);
|
|
818
853
|
})
|
|
819
854
|
}
|
|
@@ -825,39 +860,49 @@ const MainNavigation = ({
|
|
|
825
860
|
{
|
|
826
861
|
className: MainNavigation_module["main-navigation__mobile-level-2-category-list"],
|
|
827
862
|
"aria-hidden": shouldHideLevelTwoFromAssistiveTech || void 0,
|
|
828
|
-
children: mobilePanelColumns.map((column, index) =>
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
863
|
+
children: mobilePanelColumns.map((column, index$1) => {
|
|
864
|
+
const isInCurrentPath = column.links.some(
|
|
865
|
+
(link) => MainNavigation_utils.isLinkInCurrentPath(link, currentPathname)
|
|
866
|
+
);
|
|
867
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
868
|
+
"li",
|
|
869
|
+
{
|
|
870
|
+
className: MainNavigation_module["main-navigation__mobile-level-2-category-item"],
|
|
871
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
872
|
+
"button",
|
|
873
|
+
{
|
|
874
|
+
ref: (node) => {
|
|
875
|
+
mobileLevelTwoCategoryButtonRefs.current[index$1] = node;
|
|
876
|
+
},
|
|
877
|
+
type: "button",
|
|
878
|
+
className: cn.cn(
|
|
879
|
+
MainNavigation_module["main-navigation__mobile-level-2-category-button"],
|
|
880
|
+
isInCurrentPath && MainNavigation_module["main-navigation__mobile-level-2-category-button--current"],
|
|
881
|
+
index.focusStyles.focusableInset
|
|
882
|
+
),
|
|
883
|
+
"aria-current": isInCurrentPath ? "true" : void 0,
|
|
884
|
+
onClick: () => openMobileCategoryPanel(index$1),
|
|
885
|
+
onKeyDown: (event) => {
|
|
886
|
+
if (event.key !== "Enter" || isDesktopViewport()) {
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
event.preventDefault();
|
|
890
|
+
focusMobileThirdPanelBackOnOpenRef.current = true;
|
|
891
|
+
openMobileCategoryPanel(index$1);
|
|
892
|
+
},
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: getColumnHeading(
|
|
895
|
+
column.heading,
|
|
896
|
+
column.overflow
|
|
897
|
+
) }),
|
|
898
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRight, {})
|
|
899
|
+
]
|
|
900
|
+
}
|
|
901
|
+
)
|
|
902
|
+
},
|
|
903
|
+
`mobile-category-${column.heading}-${index$1}`
|
|
904
|
+
);
|
|
905
|
+
})
|
|
861
906
|
}
|
|
862
907
|
),
|
|
863
908
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -877,7 +922,7 @@ const MainNavigation = ({
|
|
|
877
922
|
type: "button",
|
|
878
923
|
className: cn.cn(
|
|
879
924
|
MainNavigation_module["main-navigation__mobile-back-item"],
|
|
880
|
-
|
|
925
|
+
index.focusStyles.focusableInset
|
|
881
926
|
),
|
|
882
927
|
onClick: () => closeMobilePanel({
|
|
883
928
|
isClosing: isMobileThirdPanelClosing,
|
|
@@ -912,21 +957,29 @@ const MainNavigation = ({
|
|
|
912
957
|
]
|
|
913
958
|
}
|
|
914
959
|
),
|
|
915
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__mobile-level-3-list"], children: selectedColumn.links.map((link, index) =>
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__mobile-level-3-list"], children: selectedColumn.links.map((link, index$1) => {
|
|
961
|
+
const isInCurrentPage = MainNavigation_utils.isLinkInCurrentPage(
|
|
962
|
+
link,
|
|
963
|
+
currentPathname
|
|
964
|
+
);
|
|
965
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
966
|
+
"li",
|
|
967
|
+
{
|
|
968
|
+
className: MainNavigation_module["main-navigation__mobile-level-3-item"],
|
|
969
|
+
children: renderNavigationLink({
|
|
970
|
+
link,
|
|
971
|
+
className: cn.cn(
|
|
972
|
+
MainNavigation_module["main-navigation__mobile-level-3-link"],
|
|
973
|
+
isInCurrentPage && MainNavigation_module["main-navigation__mobile-level-3-link--current"],
|
|
974
|
+
index.focusStyles.focusableInset
|
|
975
|
+
),
|
|
976
|
+
ariaCurrent: isInCurrentPage ? "page" : void 0,
|
|
977
|
+
children: link.label
|
|
978
|
+
})
|
|
979
|
+
},
|
|
980
|
+
`${selectedColumn.heading}-${index$1}`
|
|
981
|
+
);
|
|
982
|
+
}) })
|
|
930
983
|
] })
|
|
931
984
|
}
|
|
932
985
|
)
|
|
@@ -947,7 +1000,7 @@ const MainNavigation = ({
|
|
|
947
1000
|
),
|
|
948
1001
|
children: [
|
|
949
1002
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: MainNavigation_module["main-navigation__panel-heading"], children: getColumnHeading(column.heading, column.overflow) }),
|
|
950
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__panel-list"], children: column.links.map((link, index) => {
|
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__panel-list"], children: column.links.map((link, index$1) => {
|
|
951
1004
|
const isInCurrentPage = MainNavigation_utils.isLinkInCurrentPage(
|
|
952
1005
|
link,
|
|
953
1006
|
currentPathname
|
|
@@ -960,15 +1013,15 @@ const MainNavigation = ({
|
|
|
960
1013
|
link,
|
|
961
1014
|
className: cn.cn(
|
|
962
1015
|
MainNavigation_module["main-navigation__panel-link"],
|
|
963
|
-
|
|
964
|
-
|
|
1016
|
+
index.focusStyles.focusableInset,
|
|
1017
|
+
index.textDecorationStyles.underlineLinkOnHover,
|
|
965
1018
|
isInCurrentPage && MainNavigation_module["main-navigation__panel-link--current"]
|
|
966
1019
|
),
|
|
967
1020
|
ariaCurrent: isInCurrentPage ? "page" : void 0,
|
|
968
1021
|
children: link.label
|
|
969
1022
|
})
|
|
970
1023
|
},
|
|
971
|
-
`${column.heading}-${index}`
|
|
1024
|
+
`${column.heading}-${index$1}`
|
|
972
1025
|
);
|
|
973
1026
|
}) })
|
|
974
1027
|
]
|
|
@@ -979,14 +1032,14 @@ const MainNavigation = ({
|
|
|
979
1032
|
"aside",
|
|
980
1033
|
{
|
|
981
1034
|
className: cn.cn(
|
|
982
|
-
|
|
1035
|
+
index.elevationStyles.elevationHigh,
|
|
983
1036
|
MainNavigation_module["main-navigation__panel-column"],
|
|
984
1037
|
MainNavigation_module["main-navigation__feature-links"],
|
|
985
1038
|
MainNavigation_module["main-navigation__panel-column--last"],
|
|
986
1039
|
openPanel.featureLinksHighlighted && MainNavigation_module["main-navigation__panel-column--highlighted"],
|
|
987
1040
|
!hasFeatureLinks && MainNavigation_module["main-navigation__feature-links--empty"]
|
|
988
1041
|
),
|
|
989
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__feature-list"], children: (openPanel.featureLinks ?? []).map((link, index) => {
|
|
1042
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__feature-list"], children: (openPanel.featureLinks ?? []).map((link, index$1) => {
|
|
990
1043
|
const href = MainNavigation_utils.toNavigableHref(link.href);
|
|
991
1044
|
const isExternalFeatureLink = MainNavigation_utils.isExternalTarget(link.target);
|
|
992
1045
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -997,8 +1050,8 @@ const MainNavigation = ({
|
|
|
997
1050
|
link: { ...link, href },
|
|
998
1051
|
className: cn.cn(
|
|
999
1052
|
MainNavigation_module["main-navigation__feature-link"],
|
|
1000
|
-
|
|
1001
|
-
|
|
1053
|
+
index.textDecorationStyles.underlineLinkOnHover,
|
|
1054
|
+
index.focusStyles.focusableInset
|
|
1002
1055
|
),
|
|
1003
1056
|
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1004
1057
|
isExternalFeatureLink ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1029,32 +1082,33 @@ const MainNavigation = ({
|
|
|
1029
1082
|
] })
|
|
1030
1083
|
})
|
|
1031
1084
|
},
|
|
1032
|
-
`feature-${index}`
|
|
1085
|
+
`feature-${index$1}`
|
|
1033
1086
|
);
|
|
1034
1087
|
}) })
|
|
1035
1088
|
}
|
|
1036
1089
|
)
|
|
1037
1090
|
] }) });
|
|
1038
1091
|
};
|
|
1039
|
-
const renderPrimaryList = () => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__primary-list"], children: items.map((item, index) => {
|
|
1092
|
+
const renderPrimaryList = () => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__primary-list"], children: items.map((item, index$1) => {
|
|
1040
1093
|
const hasPanel = item.panel != null;
|
|
1041
|
-
const isOpen = openTopLevelItemIndex === index;
|
|
1094
|
+
const isOpen = openTopLevelItemIndex === index$1;
|
|
1042
1095
|
const isCurrentPathItem = MainNavigation_utils.isItemInCurrentPath(item, currentPathname);
|
|
1043
1096
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: MainNavigation_module["main-navigation__item"], children: hasPanel ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1044
1097
|
"button",
|
|
1045
1098
|
{
|
|
1046
1099
|
ref: (node) => {
|
|
1047
|
-
desktopPanelTriggerButtonRefs.current[index] = node;
|
|
1100
|
+
desktopPanelTriggerButtonRefs.current[index$1] = node;
|
|
1048
1101
|
},
|
|
1049
1102
|
type: "button",
|
|
1050
1103
|
className: cn.cn(
|
|
1051
1104
|
MainNavigation_module["main-navigation__item-toggle"],
|
|
1052
|
-
|
|
1105
|
+
index.focusStyles.focusableInset,
|
|
1053
1106
|
isCurrentPathItem && MainNavigation_module["main-navigation__item-toggle--current"],
|
|
1054
1107
|
isOpen && MainNavigation_module["main-navigation__item-toggle--open"]
|
|
1055
1108
|
),
|
|
1109
|
+
"aria-current": isCurrentPathItem ? "true" : void 0,
|
|
1056
1110
|
"aria-expanded": isOpen,
|
|
1057
|
-
onClick: () => toggleTopLevelItem(index),
|
|
1111
|
+
onClick: () => toggleTopLevelItem(index$1),
|
|
1058
1112
|
onKeyDown: (event) => {
|
|
1059
1113
|
if (event.key === "Enter" && !isDesktopViewport()) {
|
|
1060
1114
|
focusMobilePanelBackOnOpenRef.current = true;
|
|
@@ -1074,7 +1128,7 @@ const MainNavigation = ({
|
|
|
1074
1128
|
link: item,
|
|
1075
1129
|
className: cn.cn(
|
|
1076
1130
|
MainNavigation_module["main-navigation__item-link"],
|
|
1077
|
-
|
|
1131
|
+
index.focusStyles.focusableInset,
|
|
1078
1132
|
isCurrentPathItem && MainNavigation_module["main-navigation__item-link--current"]
|
|
1079
1133
|
),
|
|
1080
1134
|
ariaCurrent: isCurrentPathItem ? "page" : void 0,
|
|
@@ -1091,8 +1145,8 @@ const MainNavigation = ({
|
|
|
1091
1145
|
mobileMenuOpen && MainNavigation_module["main-navigation--menu-open"],
|
|
1092
1146
|
isMobileMenuClosing && MainNavigation_module["main-navigation--menu-closing"],
|
|
1093
1147
|
showPageOverlay && MainNavigation_module["main-navigation--overlay"],
|
|
1094
|
-
showPageOverlay &&
|
|
1095
|
-
isOverlayClosingOut &&
|
|
1148
|
+
showPageOverlay && index.overlayStyles.overlayStrong,
|
|
1149
|
+
isOverlayClosingOut && index.overlayStyles.overlayClosing,
|
|
1096
1150
|
className
|
|
1097
1151
|
),
|
|
1098
1152
|
...props,
|
|
@@ -1158,7 +1212,7 @@ const MainNavigation = ({
|
|
|
1158
1212
|
link: organization,
|
|
1159
1213
|
className: cn.cn(
|
|
1160
1214
|
MainNavigation_module["main-navigation__organization-link"],
|
|
1161
|
-
|
|
1215
|
+
index.focusStyles.focusable,
|
|
1162
1216
|
organization.current && MainNavigation_module["main-navigation__organization-link--current"]
|
|
1163
1217
|
),
|
|
1164
1218
|
ariaCurrent: organization.current ? "page" : void 0,
|
|
@@ -1169,7 +1223,7 @@ const MainNavigation = ({
|
|
|
1169
1223
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: MainNavigation_module["main-navigation__navbar"], children: [
|
|
1170
1224
|
renderUtilityLink({
|
|
1171
1225
|
href: MainNavigation_utils.toNavigableHref(logoHref),
|
|
1172
|
-
className: cn.cn(MainNavigation_module["main-navigation__logo"],
|
|
1226
|
+
className: cn.cn(MainNavigation_module["main-navigation__logo"], index.focusStyles.focusable),
|
|
1173
1227
|
"aria-label": logoAriaLabel,
|
|
1174
1228
|
children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: defaultLogoSrc, alt: "", "aria-hidden": "true" })
|
|
1175
1229
|
}),
|
|
@@ -1205,7 +1259,7 @@ const MainNavigation = ({
|
|
|
1205
1259
|
className: cn.cn(
|
|
1206
1260
|
MainNavigation_module["main-navigation__icon-nav-item"],
|
|
1207
1261
|
isLanguageOpen && MainNavigation_module["main-navigation__icon-nav-item--active"],
|
|
1208
|
-
|
|
1262
|
+
index.focusStyles.focusableInset
|
|
1209
1263
|
),
|
|
1210
1264
|
"aria-expanded": isLanguageOpen,
|
|
1211
1265
|
"aria-controls": isLanguageOpen ? languageDropdownId : void 0,
|
|
@@ -1220,8 +1274,8 @@ const MainNavigation = ({
|
|
|
1220
1274
|
children: currentLanguage.code.toUpperCase()
|
|
1221
1275
|
}
|
|
1222
1276
|
),
|
|
1223
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: MainNavigation_module["main-navigation__sr-only"], children: languageAnnouncements.map((announcement,
|
|
1224
|
-
|
|
1277
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: MainNavigation_module["main-navigation__sr-only"], children: languageAnnouncements.map((announcement, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
1278
|
+
index2 > 0 ? " " : null,
|
|
1225
1279
|
/* @__PURE__ */ jsxRuntime.jsx("span", { lang: announcement.lang, children: announcement.text })
|
|
1226
1280
|
] }, announcement.lang)) })
|
|
1227
1281
|
]
|
|
@@ -1242,7 +1296,7 @@ const MainNavigation = ({
|
|
|
1242
1296
|
className: cn.cn(
|
|
1243
1297
|
MainNavigation_module["main-navigation__dropdown"],
|
|
1244
1298
|
MainNavigation_module["main-navigation__dropdown--language"],
|
|
1245
|
-
|
|
1299
|
+
index.elevationStyles.elevationMedium
|
|
1246
1300
|
),
|
|
1247
1301
|
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__language-list"], children: alternativeLanguages.map((language) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1248
1302
|
"li",
|
|
@@ -1254,7 +1308,7 @@ const MainNavigation = ({
|
|
|
1254
1308
|
"aria-label": language.ariaLabel ?? MainNavigation_utils.languageLinkAriaLabels[language.code],
|
|
1255
1309
|
className: cn.cn(
|
|
1256
1310
|
MainNavigation_module["main-navigation__language-link"],
|
|
1257
|
-
|
|
1311
|
+
index.focusStyles.focusable
|
|
1258
1312
|
),
|
|
1259
1313
|
children: language.code.toUpperCase()
|
|
1260
1314
|
})
|
|
@@ -1274,7 +1328,7 @@ const MainNavigation = ({
|
|
|
1274
1328
|
className: cn.cn(
|
|
1275
1329
|
MainNavigation_module["main-navigation__icon-nav-item"],
|
|
1276
1330
|
isSearchOpen && MainNavigation_module["main-navigation__icon-nav-item--active"],
|
|
1277
|
-
|
|
1331
|
+
index.focusStyles.focusableInset
|
|
1278
1332
|
),
|
|
1279
1333
|
"aria-label": searchLabel,
|
|
1280
1334
|
"aria-expanded": isSearchOpen,
|
|
@@ -1301,7 +1355,7 @@ const MainNavigation = ({
|
|
|
1301
1355
|
className: cn.cn(
|
|
1302
1356
|
MainNavigation_module["main-navigation__icon-nav-item"],
|
|
1303
1357
|
isCartOpen && MainNavigation_module["main-navigation__icon-nav-item--active"],
|
|
1304
|
-
|
|
1358
|
+
index.focusStyles.focusableInset
|
|
1305
1359
|
),
|
|
1306
1360
|
"aria-label": cartAccessibleLabel,
|
|
1307
1361
|
"aria-expanded": isCartOpen,
|
|
@@ -1347,7 +1401,7 @@ const MainNavigation = ({
|
|
|
1347
1401
|
className: cn.cn(
|
|
1348
1402
|
MainNavigation_module["main-navigation__dropdown"],
|
|
1349
1403
|
MainNavigation_module["main-navigation__dropdown--login"],
|
|
1350
|
-
|
|
1404
|
+
index.elevationStyles.elevationMedium
|
|
1351
1405
|
),
|
|
1352
1406
|
children: loginDropdownContent
|
|
1353
1407
|
}
|
|
@@ -1362,7 +1416,7 @@ const MainNavigation = ({
|
|
|
1362
1416
|
className: cn.cn(
|
|
1363
1417
|
MainNavigation_module["main-navigation__dropdown"],
|
|
1364
1418
|
MainNavigation_module["main-navigation__dropdown--search"],
|
|
1365
|
-
|
|
1419
|
+
index.elevationStyles.elevationMedium
|
|
1366
1420
|
),
|
|
1367
1421
|
children: searchDropdownContent
|
|
1368
1422
|
}
|
|
@@ -1375,7 +1429,7 @@ const MainNavigation = ({
|
|
|
1375
1429
|
className: cn.cn(
|
|
1376
1430
|
MainNavigation_module["main-navigation__menu-toggle"],
|
|
1377
1431
|
mobileMenuOpen && MainNavigation_module["main-navigation__menu-toggle--open"],
|
|
1378
|
-
|
|
1432
|
+
index.focusStyles.focusableInset
|
|
1379
1433
|
),
|
|
1380
1434
|
"aria-label": mobileMenuOpen ? mobileMenuCloseAriaLabel : mobileMenuOpenAriaLabel,
|
|
1381
1435
|
"aria-expanded": mobileMenuOpen,
|