@dnanpm/ui-components 0.8.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 +9 -2
- package/dist/components/AccordionItem/AccordionItem.cjs +4 -4
- package/dist/components/AccordionItem/AccordionItem.cjs.map +1 -1
- package/dist/components/AccordionItem/AccordionItem.css +8 -2
- 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 +20 -17
- 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 +76 -30
- 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 +62 -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 +97 -0
- package/dist/components/ContentCard/ContentCard.cjs.map +1 -0
- package/dist/components/ContentCard/ContentCard.css +254 -0
- package/dist/components/ContentCard/ContentCard.d.ts +3 -0
- package/dist/components/ContentCard/ContentCard.d.ts.map +1 -0
- package/dist/components/ContentCard/ContentCard.js +97 -0
- package/dist/components/ContentCard/ContentCard.js.map +1 -0
- package/dist/components/ContentCard/ContentCard.module.css.cjs +24 -0
- package/dist/components/ContentCard/ContentCard.module.css.cjs.map +1 -0
- package/dist/components/ContentCard/ContentCard.module.css.js +25 -0
- package/dist/components/ContentCard/ContentCard.module.css.js.map +1 -0
- package/dist/components/ContentCard/ContentCard.types.d.ts +100 -0
- package/dist/components/ContentCard/ContentCard.types.d.ts.map +1 -0
- package/dist/components/ContentCard/index.d.ts +3 -0
- package/dist/components/ContentCard/index.d.ts.map +1 -0
- package/dist/components/Drawer/Drawer.cjs +15 -7
- package/dist/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.css +47 -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 +91 -84
- 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 -2
- package/dist/components/FunctionButton/FunctionButton.js +1 -1
- package/dist/components/FunctionButton/FunctionButton.js.map +1 -1
- package/dist/components/Hero/Hero.cjs +30 -29
- package/dist/components/Hero/Hero.cjs.map +1 -1
- package/dist/components/Hero/Hero.css +86 -74
- 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 -29
- package/dist/components/Hero/Hero.js.map +1 -1
- package/dist/components/Hero/Hero.module.css.cjs +20 -17
- package/dist/components/Hero/Hero.module.css.cjs.map +1 -1
- package/dist/components/Hero/Hero.module.css.js +20 -17
- package/dist/components/Hero/Hero.module.css.js.map +1 -1
- 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 -2
- 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 -2
- package/dist/components/MainNavigation/MainNavigation.cjs +556 -191
- package/dist/components/MainNavigation/MainNavigation.cjs.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.css +297 -170
- 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 +526 -161
- package/dist/components/MainNavigation/MainNavigation.js.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.module.css.cjs +80 -68
- package/dist/components/MainNavigation/MainNavigation.module.css.cjs.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.module.css.js +80 -68
- package/dist/components/MainNavigation/MainNavigation.module.css.js.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.types.d.ts +55 -21
- package/dist/components/MainNavigation/MainNavigation.types.d.ts.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.utils.cjs +28 -4
- package/dist/components/MainNavigation/MainNavigation.utils.cjs.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.utils.d.ts +11 -1
- package/dist/components/MainNavigation/MainNavigation.utils.d.ts.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.utils.js +28 -4
- package/dist/components/MainNavigation/MainNavigation.utils.js.map +1 -1
- package/dist/components/MainNavigation/index.d.ts +1 -1
- package/dist/components/MainNavigation/index.d.ts.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 +43 -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 +20 -12
- 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 +9 -2
- package/dist/components/Pictograph/PictographItem.css +9 -2
- package/dist/components/Quote/Quote.css +5 -2
- package/dist/components/Spinner/Spinner.css +9 -2
- 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 +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/utilities.css +6 -0
- package/dist/styles/utils/elevation.css +34 -26
- package/dist/styles/utils/focus.css +63 -65
- 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 -28
- package/dist/styles/utils/text-decoration.css +19 -12
- package/dist/styles.css +46 -12
- 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,14 +3,12 @@ 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");
|
|
13
10
|
const Button = require("../Button/Button.cjs");
|
|
11
|
+
const Drawer = require("../Drawer/Drawer.cjs");
|
|
14
12
|
const IconButton = require("../IconButton/IconButton.cjs");
|
|
15
13
|
const defaultOrganizations = [];
|
|
16
14
|
const defaultItems = [];
|
|
@@ -19,33 +17,33 @@ const defaultLogoSrc = `data:image/svg+xml,${encodeURIComponent(defaultLogoSvg)}
|
|
|
19
17
|
const mobilePanelAnimationDurationMs = 200;
|
|
20
18
|
const mobileBodyScrollLockClass = "dds-un-scrollable";
|
|
21
19
|
const defaultOverflowCategoryLabel = "Muut kategoriat";
|
|
22
|
-
const desktopMinWidthMediaQuery = "(min-width: 1024px)";
|
|
23
20
|
const defaultRenderLink = (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props });
|
|
21
|
+
const defaultRenderLanguageLink = (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props });
|
|
24
22
|
const MainNavigation = ({
|
|
25
23
|
organizations = defaultOrganizations,
|
|
26
24
|
items = defaultItems,
|
|
27
|
-
loginHref = "#",
|
|
28
25
|
loginLabel = "Kirjaudu",
|
|
29
26
|
logoHref = "/",
|
|
30
|
-
|
|
27
|
+
languages,
|
|
28
|
+
renderLanguageLink = defaultRenderLanguageLink,
|
|
31
29
|
searchLabel = "Haku",
|
|
32
30
|
cartLabel = "Ostoskori",
|
|
33
|
-
showLanguageSelector = false,
|
|
34
|
-
showSearch = false,
|
|
35
|
-
showCart = false,
|
|
36
31
|
cartCounter,
|
|
37
32
|
cartCounterLabel = "tuotetta ostoskorissa",
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
cartOpen,
|
|
34
|
+
onCartOpenChange,
|
|
35
|
+
onSearchOpenChange,
|
|
36
|
+
onLanguageOpenChange,
|
|
37
|
+
onLoginOpenChange,
|
|
38
|
+
searchDropdownContent,
|
|
39
|
+
loginDropdownContent,
|
|
40
|
+
cartContent,
|
|
41
|
+
mobileMenuOpenAriaLabel = "Avaa päävalikko",
|
|
42
|
+
mobileMenuCloseAriaLabel = "Sulje päävalikko",
|
|
43
43
|
organizationStripAriaLabel = "Sivustot",
|
|
44
44
|
logoAriaLabel = "Siirry etusivulle",
|
|
45
45
|
mobilePrimaryNavigationAriaLabel = "Päävalikko",
|
|
46
46
|
externalLinkAriaLabel = "avautuu uuteen välilehteen",
|
|
47
|
-
defaultMobileMenuOpen = false,
|
|
48
|
-
defaultOpenItemIndex = null,
|
|
49
47
|
currentPathname,
|
|
50
48
|
overflowCategoryLabel = defaultOverflowCategoryLabel,
|
|
51
49
|
onMobileMenuToggle,
|
|
@@ -56,13 +54,24 @@ const MainNavigation = ({
|
|
|
56
54
|
ref,
|
|
57
55
|
...props
|
|
58
56
|
}) => {
|
|
59
|
-
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);
|
|
60
65
|
const [isMobileMenuClosing, setIsMobileMenuClosing] = react.useState(false);
|
|
61
|
-
const [openTopLevelItemIndex, setOpenTopLevelItemIndex] = react.useState(
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
const [isDesktopHeaderOpen, setIsDesktopHeaderOpen] = react.useState(true);
|
|
66
|
+
const [openTopLevelItemIndex, setOpenTopLevelItemIndex] = react.useState(null);
|
|
67
|
+
const [isHeaderOpen, setIsHeaderOpen] = react.useState(true);
|
|
65
68
|
const [mobileActiveCategoryIndex, setMobileActiveCategoryIndex] = react.useState(null);
|
|
69
|
+
const [internalCartOpen, setInternalCartOpen] = react.useState(false);
|
|
70
|
+
const isCartOpen = cartOpen ?? internalCartOpen;
|
|
71
|
+
const [openUtilityDropdown, setOpenUtilityDropdown] = react.useState(null);
|
|
72
|
+
const searchDropdownId = react.useId();
|
|
73
|
+
const languageDropdownId = react.useId();
|
|
74
|
+
const loginDropdownId = react.useId();
|
|
66
75
|
const [isMobileSecondPanelClosing, setIsMobileSecondPanelClosing] = react.useState(false);
|
|
67
76
|
const [isMobileThirdPanelClosing, setIsMobileThirdPanelClosing] = react.useState(false);
|
|
68
77
|
const mobileSecondPanelCloseTimeoutRef = react.useRef(null);
|
|
@@ -78,6 +87,9 @@ const MainNavigation = ({
|
|
|
78
87
|
);
|
|
79
88
|
const headerElementRef = react.useRef(null);
|
|
80
89
|
const desktopPanelTriggerButtonRefs = react.useRef([]);
|
|
90
|
+
const searchTriggerRef = react.useRef(null);
|
|
91
|
+
const languageTriggerRef = react.useRef(null);
|
|
92
|
+
const loginTriggerRef = react.useRef(null);
|
|
81
93
|
const mobilePrimaryNavRef = react.useRef(null);
|
|
82
94
|
const mobileMenuToggleButtonRef = react.useRef(null);
|
|
83
95
|
const mobileModalPanelRef = react.useRef(null);
|
|
@@ -87,9 +99,18 @@ const MainNavigation = ({
|
|
|
87
99
|
const mobileLevelTwoCategoryButtonRefs = react.useRef([]);
|
|
88
100
|
const focusMobilePanelBackOnOpenRef = react.useRef(false);
|
|
89
101
|
const focusMobileThirdPanelBackOnOpenRef = react.useRef(false);
|
|
102
|
+
const lastInteractionWasKeyboardRef = react.useRef(false);
|
|
90
103
|
const focusReturnToMobileCategoryTimeoutRef = react.useRef(
|
|
91
104
|
null
|
|
92
105
|
);
|
|
106
|
+
const notifyRef = react.useRef({
|
|
107
|
+
mobileMenu: false,
|
|
108
|
+
desktopItem: null,
|
|
109
|
+
search: false,
|
|
110
|
+
language: false,
|
|
111
|
+
login: false,
|
|
112
|
+
cart: false
|
|
113
|
+
});
|
|
93
114
|
const setHeaderRef = react.useCallback(
|
|
94
115
|
(node) => {
|
|
95
116
|
headerElementRef.current = node;
|
|
@@ -128,23 +149,22 @@ const MainNavigation = ({
|
|
|
128
149
|
return;
|
|
129
150
|
}
|
|
130
151
|
const headerElement = headerElementRef.current;
|
|
131
|
-
const desktopQuery = window.matchMedia(desktopMinWidthMediaQuery);
|
|
152
|
+
const desktopQuery = window.matchMedia(MainNavigation_utils.desktopMinWidthMediaQuery);
|
|
132
153
|
let previousScrollY = window.pageYOffset;
|
|
133
154
|
let headerHeight = parseFloat(window.getComputedStyle(headerElement).height.replace("px", "")) || headerElement.offsetHeight;
|
|
134
155
|
const openHeader = () => {
|
|
135
|
-
|
|
156
|
+
setIsHeaderOpen(true);
|
|
136
157
|
};
|
|
137
158
|
const closeHeader = () => {
|
|
138
|
-
|
|
159
|
+
setIsHeaderOpen(false);
|
|
160
|
+
};
|
|
161
|
+
const headerHasVisibleFocus = () => {
|
|
162
|
+
const active = document.activeElement;
|
|
163
|
+
return lastInteractionWasKeyboardRef.current && active instanceof HTMLElement && headerElement.contains(active);
|
|
139
164
|
};
|
|
140
165
|
const handleScroll = () => {
|
|
141
166
|
const currentScrollY = window.pageYOffset;
|
|
142
|
-
if (
|
|
143
|
-
openHeader();
|
|
144
|
-
previousScrollY = currentScrollY;
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (mobileMenuOpen || openTopLevelItemIndex != null) {
|
|
167
|
+
if (mobileMenuOpen || openTopLevelItemIndex != null || openUtilityDropdown != null || headerHasVisibleFocus()) {
|
|
148
168
|
openHeader();
|
|
149
169
|
previousScrollY = currentScrollY;
|
|
150
170
|
return;
|
|
@@ -158,6 +178,11 @@ const MainNavigation = ({
|
|
|
158
178
|
}
|
|
159
179
|
previousScrollY = currentScrollY;
|
|
160
180
|
};
|
|
181
|
+
const handleFocusIn = () => {
|
|
182
|
+
if (headerHasVisibleFocus()) {
|
|
183
|
+
openHeader();
|
|
184
|
+
}
|
|
185
|
+
};
|
|
161
186
|
const handleViewportChange = () => {
|
|
162
187
|
openHeader();
|
|
163
188
|
previousScrollY = window.pageYOffset;
|
|
@@ -165,14 +190,33 @@ const MainNavigation = ({
|
|
|
165
190
|
};
|
|
166
191
|
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
167
192
|
window.addEventListener("resize", handleViewportChange);
|
|
193
|
+
document.addEventListener("focusin", handleFocusIn);
|
|
168
194
|
desktopQuery.addEventListener("change", handleViewportChange);
|
|
169
195
|
handleScroll();
|
|
170
196
|
return () => {
|
|
171
197
|
window.removeEventListener("scroll", handleScroll);
|
|
172
198
|
window.removeEventListener("resize", handleViewportChange);
|
|
199
|
+
document.removeEventListener("focusin", handleFocusIn);
|
|
173
200
|
desktopQuery.removeEventListener("change", handleViewportChange);
|
|
174
201
|
};
|
|
175
|
-
}, [mobileMenuOpen, openTopLevelItemIndex]);
|
|
202
|
+
}, [mobileMenuOpen, openTopLevelItemIndex, openUtilityDropdown]);
|
|
203
|
+
react.useEffect(() => {
|
|
204
|
+
if (typeof document === "undefined") {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const handleKeyDown = () => {
|
|
208
|
+
lastInteractionWasKeyboardRef.current = true;
|
|
209
|
+
};
|
|
210
|
+
const handlePointerDown = () => {
|
|
211
|
+
lastInteractionWasKeyboardRef.current = false;
|
|
212
|
+
};
|
|
213
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
214
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
215
|
+
return () => {
|
|
216
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
217
|
+
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
218
|
+
};
|
|
219
|
+
}, []);
|
|
176
220
|
react.useEffect(() => {
|
|
177
221
|
const browserWindow = globalThis.window;
|
|
178
222
|
const browserDocument = globalThis.document;
|
|
@@ -208,8 +252,8 @@ const MainNavigation = ({
|
|
|
208
252
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
209
253
|
return;
|
|
210
254
|
}
|
|
211
|
-
const desktopQuery = window.matchMedia(desktopMinWidthMediaQuery);
|
|
212
|
-
const
|
|
255
|
+
const desktopQuery = window.matchMedia(MainNavigation_utils.desktopMinWidthMediaQuery);
|
|
256
|
+
const handleViewportModeChange = ({ matches: isDesktopViewport2 }) => {
|
|
213
257
|
if (isDesktopViewport2) {
|
|
214
258
|
clearTimeout(mobileSecondPanelCloseTimeoutRef.current ?? void 0);
|
|
215
259
|
mobileSecondPanelCloseTimeoutRef.current = null;
|
|
@@ -217,28 +261,25 @@ const MainNavigation = ({
|
|
|
217
261
|
mobileThirdPanelCloseTimeoutRef.current = null;
|
|
218
262
|
clearTimeout(resetMobileThirdPanelScrollTimeoutRef.current ?? void 0);
|
|
219
263
|
resetMobileThirdPanelScrollTimeoutRef.current = null;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
264
|
+
if (notifyRef.current.mobileMenu) {
|
|
265
|
+
notifyRef.current.mobileMenu = false;
|
|
266
|
+
onMobileMenuToggle?.(false);
|
|
267
|
+
}
|
|
268
|
+
setMobileMenuOpen(false);
|
|
226
269
|
setMobileActiveCategoryIndex(null);
|
|
227
270
|
setIsMobileSecondPanelClosing(false);
|
|
228
271
|
setIsMobileThirdPanelClosing(false);
|
|
229
272
|
return;
|
|
230
273
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
});
|
|
274
|
+
if (notifyRef.current.desktopItem !== null) {
|
|
275
|
+
notifyRef.current.desktopItem = null;
|
|
276
|
+
onDesktopItemToggle?.(null);
|
|
277
|
+
}
|
|
278
|
+
setOpenTopLevelItemIndex(null);
|
|
237
279
|
};
|
|
238
|
-
|
|
239
|
-
desktopQuery.addEventListener("change", applyViewportModeChange);
|
|
280
|
+
desktopQuery.addEventListener("change", handleViewportModeChange);
|
|
240
281
|
return () => {
|
|
241
|
-
desktopQuery.removeEventListener("change",
|
|
282
|
+
desktopQuery.removeEventListener("change", handleViewportModeChange);
|
|
242
283
|
};
|
|
243
284
|
}, [onDesktopItemToggle, onMobileMenuToggle]);
|
|
244
285
|
const resetMobilePanelState = react.useCallback(() => {
|
|
@@ -258,20 +299,18 @@ const MainNavigation = ({
|
|
|
258
299
|
return;
|
|
259
300
|
}
|
|
260
301
|
const shouldAnimateMobileClose = mobileMenuOpen;
|
|
302
|
+
if (mobileMenuOpen) {
|
|
303
|
+
notifyRef.current.mobileMenu = false;
|
|
304
|
+
onMobileMenuToggle?.(false);
|
|
305
|
+
}
|
|
306
|
+
if (openTopLevelItemIndex !== null) {
|
|
307
|
+
notifyRef.current.desktopItem = null;
|
|
308
|
+
onDesktopItemToggle?.(null);
|
|
309
|
+
}
|
|
261
310
|
clearTimeout(mobileMenuCloseResetTimeoutRef.current ?? void 0);
|
|
262
311
|
setIsMobileMenuClosing(shouldAnimateMobileClose);
|
|
263
|
-
setMobileMenuOpen(
|
|
264
|
-
|
|
265
|
-
onMobileMenuToggle?.(false);
|
|
266
|
-
}
|
|
267
|
-
return false;
|
|
268
|
-
});
|
|
269
|
-
setOpenTopLevelItemIndex((previous) => {
|
|
270
|
-
if (previous !== null) {
|
|
271
|
-
onDesktopItemToggle?.(null);
|
|
272
|
-
}
|
|
273
|
-
return null;
|
|
274
|
-
});
|
|
312
|
+
setMobileMenuOpen(false);
|
|
313
|
+
setOpenTopLevelItemIndex(null);
|
|
275
314
|
if (shouldAnimateMobileClose) {
|
|
276
315
|
mobileMenuCloseResetTimeoutRef.current = setTimeout(() => {
|
|
277
316
|
resetMobilePanelState();
|
|
@@ -294,19 +333,21 @@ const MainNavigation = ({
|
|
|
294
333
|
closeMobileMenu();
|
|
295
334
|
return;
|
|
296
335
|
}
|
|
336
|
+
closeUtilityDropdown();
|
|
337
|
+
notifyRef.current.mobileMenu = true;
|
|
297
338
|
setMobileMenuOpen(true);
|
|
298
339
|
setIsMobileMenuClosing(false);
|
|
299
340
|
onMobileMenuToggle?.(true);
|
|
300
341
|
};
|
|
301
|
-
const toggleTopLevelItem = (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
342
|
+
const toggleTopLevelItem = (index2) => {
|
|
343
|
+
closeUtilityDropdown();
|
|
344
|
+
const next = openTopLevelItemIndex === index2 ? null : index2;
|
|
345
|
+
notifyRef.current.desktopItem = next;
|
|
346
|
+
setOpenTopLevelItemIndex(next);
|
|
347
|
+
setMobileActiveCategoryIndex(null);
|
|
348
|
+
setIsMobileSecondPanelClosing(false);
|
|
349
|
+
setIsMobileThirdPanelClosing(false);
|
|
350
|
+
onDesktopItemToggle?.(next);
|
|
310
351
|
};
|
|
311
352
|
const isDesktopViewport = react.useCallback(() => {
|
|
312
353
|
return MainNavigation_utils.isDesktopViewportByEnvironment(globalThis.window);
|
|
@@ -358,6 +399,23 @@ const MainNavigation = ({
|
|
|
358
399
|
},
|
|
359
400
|
[getDesktopPanelInteractiveElements, isFocusable]
|
|
360
401
|
);
|
|
402
|
+
const getUtilityDropdownFocusLoopElements = react.useCallback(
|
|
403
|
+
(kind) => {
|
|
404
|
+
const focusLoopElements = /* @__PURE__ */ new Set();
|
|
405
|
+
const triggerButton = kind === "search" ? searchTriggerRef.current : kind === "language" ? languageTriggerRef.current : loginTriggerRef.current;
|
|
406
|
+
if (triggerButton != null && isFocusable(triggerButton)) {
|
|
407
|
+
focusLoopElements.add(triggerButton);
|
|
408
|
+
}
|
|
409
|
+
getFocusableElements(
|
|
410
|
+
headerElementRef.current,
|
|
411
|
+
`.${MainNavigation_module["main-navigation__dropdown"]} a[href], .${MainNavigation_module["main-navigation__dropdown"]} button:not([disabled]), .${MainNavigation_module["main-navigation__dropdown"]} input:not([disabled]), .${MainNavigation_module["main-navigation__dropdown"]} select:not([disabled]), .${MainNavigation_module["main-navigation__dropdown"]} textarea:not([disabled]), .${MainNavigation_module["main-navigation__dropdown"]} [tabindex]:not([tabindex="-1"])`
|
|
412
|
+
).forEach((element) => {
|
|
413
|
+
focusLoopElements.add(element);
|
|
414
|
+
});
|
|
415
|
+
return Array.from(focusLoopElements);
|
|
416
|
+
},
|
|
417
|
+
[getFocusableElements, isFocusable]
|
|
418
|
+
);
|
|
361
419
|
const getMobileFocusableElements = react.useCallback(() => {
|
|
362
420
|
const focusableElements = [];
|
|
363
421
|
const addFocusableElements = (elements) => {
|
|
@@ -392,15 +450,35 @@ const MainNavigation = ({
|
|
|
392
450
|
);
|
|
393
451
|
return Array.from(new Set(focusableElements));
|
|
394
452
|
}, [getFocusableElements, isFocusable, mobileActiveCategoryIndex, openTopLevelItemIndex]);
|
|
395
|
-
const openMobileCategoryPanel = react.useCallback((
|
|
453
|
+
const openMobileCategoryPanel = react.useCallback((index2) => {
|
|
396
454
|
clearTimeout(resetMobileThirdPanelScrollTimeoutRef.current ?? void 0);
|
|
397
455
|
setIsMobileThirdPanelClosing(false);
|
|
398
|
-
setMobileActiveCategoryIndex(
|
|
456
|
+
setMobileActiveCategoryIndex(index2);
|
|
399
457
|
resetMobileThirdPanelScrollTimeoutRef.current = setTimeout(() => {
|
|
400
458
|
(mobileThirdPanelRef.current ?? { scrollTop: 0 }).scrollTop = 0;
|
|
401
459
|
resetMobileThirdPanelScrollTimeoutRef.current = null;
|
|
402
460
|
}, 0);
|
|
403
461
|
}, []);
|
|
462
|
+
const notifyUtilityOpenChange = react.useCallback(
|
|
463
|
+
(kind, open) => {
|
|
464
|
+
if (kind === "search") {
|
|
465
|
+
onSearchOpenChange?.(open);
|
|
466
|
+
} else if (kind === "language") {
|
|
467
|
+
onLanguageOpenChange?.(open);
|
|
468
|
+
} else {
|
|
469
|
+
onLoginOpenChange?.(open);
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
[onLanguageOpenChange, onLoginOpenChange, onSearchOpenChange]
|
|
473
|
+
);
|
|
474
|
+
const closeUtilityDropdown = react.useCallback(() => {
|
|
475
|
+
const openDropdown = notifyRef.current.search ? "search" : notifyRef.current.language ? "language" : notifyRef.current.login ? "login" : null;
|
|
476
|
+
if (openDropdown != null) {
|
|
477
|
+
notifyRef.current[openDropdown] = false;
|
|
478
|
+
notifyUtilityOpenChange(openDropdown, false);
|
|
479
|
+
}
|
|
480
|
+
setOpenUtilityDropdown(null);
|
|
481
|
+
}, [notifyUtilityOpenChange]);
|
|
404
482
|
const closeMenus = react.useCallback(() => {
|
|
405
483
|
clearTimeout(mobileSecondPanelCloseTimeoutRef.current ?? void 0);
|
|
406
484
|
mobileSecondPanelCloseTimeoutRef.current = null;
|
|
@@ -408,16 +486,24 @@ const MainNavigation = ({
|
|
|
408
486
|
mobileThirdPanelCloseTimeoutRef.current = null;
|
|
409
487
|
clearTimeout(focusMobileSecondPanelTimeoutRef.current ?? void 0);
|
|
410
488
|
focusMobileSecondPanelTimeoutRef.current = null;
|
|
489
|
+
focusMobilePanelBackOnOpenRef.current = false;
|
|
411
490
|
clearTimeout(focusMobileThirdPanelTimeoutRef.current ?? void 0);
|
|
412
491
|
focusMobileThirdPanelTimeoutRef.current = null;
|
|
492
|
+
focusMobileThirdPanelBackOnOpenRef.current = false;
|
|
413
493
|
clearTimeout(resetMobileThirdPanelScrollTimeoutRef.current ?? void 0);
|
|
414
494
|
resetMobileThirdPanelScrollTimeoutRef.current = null;
|
|
415
495
|
clearTimeout(focusReturnToMobileTopLevelItemTimeoutRef.current ?? void 0);
|
|
416
496
|
focusReturnToMobileTopLevelItemTimeoutRef.current = null;
|
|
417
497
|
clearTimeout(focusReturnToMobileCategoryTimeoutRef.current ?? void 0);
|
|
418
498
|
focusReturnToMobileCategoryTimeoutRef.current = null;
|
|
499
|
+
const openDropdown = notifyRef.current.search ? "search" : notifyRef.current.language ? "language" : notifyRef.current.login ? "login" : null;
|
|
500
|
+
if (openDropdown != null) {
|
|
501
|
+
notifyRef.current[openDropdown] = false;
|
|
502
|
+
notifyUtilityOpenChange(openDropdown, false);
|
|
503
|
+
}
|
|
504
|
+
setOpenUtilityDropdown(null);
|
|
419
505
|
closeMobileMenu();
|
|
420
|
-
}, [closeMobileMenu]);
|
|
506
|
+
}, [closeMobileMenu, notifyUtilityOpenChange]);
|
|
421
507
|
const closeMobilePanel = react.useCallback(
|
|
422
508
|
({
|
|
423
509
|
isClosing,
|
|
@@ -466,9 +552,133 @@ const MainNavigation = ({
|
|
|
466
552
|
const openItem = openTopLevelItemIndex != null ? items[openTopLevelItemIndex] : void 0;
|
|
467
553
|
const openPanel = openItem?.panel;
|
|
468
554
|
const isMobilePanelClosingOut = isMobileMenuClosing && !mobileMenuOpen;
|
|
469
|
-
const showPageOverlay = mobileMenuOpen || openPanel != null || isMobilePanelClosingOut;
|
|
470
555
|
const isOverlayClosingOut = isMobilePanelClosingOut && openPanel == null;
|
|
471
556
|
const cartAccessibleLabel = cartCounter != null ? `${cartLabel} ${cartCounter} ${cartCounterLabel}` : cartLabel;
|
|
557
|
+
const languageAnnouncements = currentLanguage != null ? MainNavigation_utils.getLanguageToggleAnnouncements(
|
|
558
|
+
(languages ?? []).map((language) => language.code),
|
|
559
|
+
currentLanguage.code
|
|
560
|
+
) : [];
|
|
561
|
+
const activeUtilityDropdown = openUtilityDropdown === "search" && showSearch ? "search" : openUtilityDropdown === "language" && showLanguage ? "language" : openUtilityDropdown === "login" && showLogin ? "login" : null;
|
|
562
|
+
const isSearchOpen = activeUtilityDropdown === "search";
|
|
563
|
+
const isLanguageOpen = activeUtilityDropdown === "language";
|
|
564
|
+
const isLoginOpen = activeUtilityDropdown === "login";
|
|
565
|
+
const effectiveCartOpen = isCartOpen && showCart;
|
|
566
|
+
const showPageOverlay = mobileMenuOpen || openPanel != null || isMobilePanelClosingOut || activeUtilityDropdown != null;
|
|
567
|
+
const toggleUtilityDropdown = (kind) => {
|
|
568
|
+
const previous = openUtilityDropdown;
|
|
569
|
+
const next = previous === kind ? null : kind;
|
|
570
|
+
if (previous != null && previous !== next) {
|
|
571
|
+
notifyRef.current[previous] = false;
|
|
572
|
+
notifyUtilityOpenChange(previous, false);
|
|
573
|
+
}
|
|
574
|
+
if (next != null) {
|
|
575
|
+
notifyRef.current[next] = true;
|
|
576
|
+
notifyUtilityOpenChange(next, true);
|
|
577
|
+
closeMobileMenu();
|
|
578
|
+
if (isCartOpen) {
|
|
579
|
+
if (!isCartControlled) {
|
|
580
|
+
notifyRef.current.cart = false;
|
|
581
|
+
setInternalCartOpen(false);
|
|
582
|
+
}
|
|
583
|
+
onCartOpenChange?.(false);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
setOpenUtilityDropdown(next);
|
|
587
|
+
};
|
|
588
|
+
const handleLanguageClick = () => {
|
|
589
|
+
toggleUtilityDropdown("language");
|
|
590
|
+
};
|
|
591
|
+
const handleSearchClick = () => {
|
|
592
|
+
toggleUtilityDropdown("search");
|
|
593
|
+
};
|
|
594
|
+
const handleLoginClick = () => {
|
|
595
|
+
toggleUtilityDropdown("login");
|
|
596
|
+
};
|
|
597
|
+
const handleCartClick = () => {
|
|
598
|
+
const next = !isCartOpen;
|
|
599
|
+
if (next) {
|
|
600
|
+
closeMenus();
|
|
601
|
+
}
|
|
602
|
+
if (!isCartControlled) {
|
|
603
|
+
notifyRef.current.cart = next && showCart;
|
|
604
|
+
setInternalCartOpen(next);
|
|
605
|
+
}
|
|
606
|
+
onCartOpenChange?.(next);
|
|
607
|
+
};
|
|
608
|
+
const handleCartOpenChange = (open) => {
|
|
609
|
+
if (!isCartControlled) {
|
|
610
|
+
notifyRef.current.cart = open && showCart;
|
|
611
|
+
setInternalCartOpen(open);
|
|
612
|
+
}
|
|
613
|
+
onCartOpenChange?.(open);
|
|
614
|
+
};
|
|
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();
|
|
627
|
+
}
|
|
628
|
+
} else if (openUtilityDropdown !== null && activeUtilityDropdown === null) {
|
|
629
|
+
setOpenUtilityDropdown(null);
|
|
630
|
+
}
|
|
631
|
+
if (!isCartControlled && internalCartOpen && !showCart) {
|
|
632
|
+
setInternalCartOpen(false);
|
|
633
|
+
}
|
|
634
|
+
react.useEffect(() => {
|
|
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);
|
|
643
|
+
}
|
|
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
|
+
});
|
|
659
|
+
react.useEffect(() => {
|
|
660
|
+
if (!effectiveCartOpen) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
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]);
|
|
472
682
|
react.useEffect(() => {
|
|
473
683
|
if (!showPageOverlay) {
|
|
474
684
|
return;
|
|
@@ -533,11 +743,11 @@ const MainNavigation = ({
|
|
|
533
743
|
}
|
|
534
744
|
const hasFeatureLinks = openPanel.featureLinks != null && openPanel.featureLinks.length > 0;
|
|
535
745
|
const panelColumns = openPanel.columns ?? [];
|
|
536
|
-
const lastDesktopVisibleColumnIndex = panelColumns.reduce((lastIndex, column,
|
|
746
|
+
const lastDesktopVisibleColumnIndex = panelColumns.reduce((lastIndex, column, index2) => {
|
|
537
747
|
if (column.mobileOnly) {
|
|
538
748
|
return lastIndex;
|
|
539
749
|
}
|
|
540
|
-
return
|
|
750
|
+
return index2;
|
|
541
751
|
}, -1);
|
|
542
752
|
const mobilePanelColumns = panelColumns.filter((column) => !column.desktopOnly);
|
|
543
753
|
const getColumnHeading = (heading, isOverflow) => {
|
|
@@ -568,7 +778,7 @@ const MainNavigation = ({
|
|
|
568
778
|
type: "button",
|
|
569
779
|
className: cn.cn(
|
|
570
780
|
MainNavigation_module["main-navigation__mobile-back-item"],
|
|
571
|
-
|
|
781
|
+
index.focusStyles.focusableInset
|
|
572
782
|
),
|
|
573
783
|
onClick: () => closeMobilePanel({
|
|
574
784
|
isClosing: isMobileSecondPanelClosing,
|
|
@@ -576,6 +786,7 @@ const MainNavigation = ({
|
|
|
576
786
|
closeTimeoutRef: mobileSecondPanelCloseTimeoutRef,
|
|
577
787
|
onClosed: () => {
|
|
578
788
|
const closedTopLevelItemIndex = openTopLevelItemIndex;
|
|
789
|
+
notifyRef.current.desktopItem = null;
|
|
579
790
|
setOpenTopLevelItemIndex(null);
|
|
580
791
|
setMobileActiveCategoryIndex(null);
|
|
581
792
|
onDesktopItemToggle?.(null);
|
|
@@ -603,7 +814,7 @@ const MainNavigation = ({
|
|
|
603
814
|
"ul",
|
|
604
815
|
{
|
|
605
816
|
className: MainNavigation_module["main-navigation__mobile-level-2-feature-list"],
|
|
606
|
-
children: openPanel.featureLinks.map((link,
|
|
817
|
+
children: openPanel.featureLinks.map((link, index2) => {
|
|
607
818
|
const href = MainNavigation_utils.toNavigableHref(link.href);
|
|
608
819
|
const isExternalFeatureLink = MainNavigation_utils.isExternalTarget(link.target);
|
|
609
820
|
const MobileFeatureIcon = isExternalFeatureLink ? icons.Open : icons.ArrowRight;
|
|
@@ -637,7 +848,7 @@ const MainNavigation = ({
|
|
|
637
848
|
}
|
|
638
849
|
)
|
|
639
850
|
},
|
|
640
|
-
`mobile-feature-${
|
|
851
|
+
`mobile-feature-${index2}`
|
|
641
852
|
);
|
|
642
853
|
})
|
|
643
854
|
}
|
|
@@ -649,39 +860,49 @@ const MainNavigation = ({
|
|
|
649
860
|
{
|
|
650
861
|
className: MainNavigation_module["main-navigation__mobile-level-2-category-list"],
|
|
651
862
|
"aria-hidden": shouldHideLevelTwoFromAssistiveTech || void 0,
|
|
652
|
-
children: mobilePanelColumns.map((column, index) =>
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
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
|
+
})
|
|
685
906
|
}
|
|
686
907
|
),
|
|
687
908
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -701,7 +922,7 @@ const MainNavigation = ({
|
|
|
701
922
|
type: "button",
|
|
702
923
|
className: cn.cn(
|
|
703
924
|
MainNavigation_module["main-navigation__mobile-back-item"],
|
|
704
|
-
|
|
925
|
+
index.focusStyles.focusableInset
|
|
705
926
|
),
|
|
706
927
|
onClick: () => closeMobilePanel({
|
|
707
928
|
isClosing: isMobileThirdPanelClosing,
|
|
@@ -736,21 +957,29 @@ const MainNavigation = ({
|
|
|
736
957
|
]
|
|
737
958
|
}
|
|
738
959
|
),
|
|
739
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__mobile-level-3-list"], children: selectedColumn.links.map((link, index) =>
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
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
|
+
}) })
|
|
754
983
|
] })
|
|
755
984
|
}
|
|
756
985
|
)
|
|
@@ -771,7 +1000,7 @@ const MainNavigation = ({
|
|
|
771
1000
|
),
|
|
772
1001
|
children: [
|
|
773
1002
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: MainNavigation_module["main-navigation__panel-heading"], children: getColumnHeading(column.heading, column.overflow) }),
|
|
774
|
-
/* @__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) => {
|
|
775
1004
|
const isInCurrentPage = MainNavigation_utils.isLinkInCurrentPage(
|
|
776
1005
|
link,
|
|
777
1006
|
currentPathname
|
|
@@ -784,15 +1013,15 @@ const MainNavigation = ({
|
|
|
784
1013
|
link,
|
|
785
1014
|
className: cn.cn(
|
|
786
1015
|
MainNavigation_module["main-navigation__panel-link"],
|
|
787
|
-
|
|
788
|
-
|
|
1016
|
+
index.focusStyles.focusableInset,
|
|
1017
|
+
index.textDecorationStyles.underlineLinkOnHover,
|
|
789
1018
|
isInCurrentPage && MainNavigation_module["main-navigation__panel-link--current"]
|
|
790
1019
|
),
|
|
791
1020
|
ariaCurrent: isInCurrentPage ? "page" : void 0,
|
|
792
1021
|
children: link.label
|
|
793
1022
|
})
|
|
794
1023
|
},
|
|
795
|
-
`${column.heading}-${index}`
|
|
1024
|
+
`${column.heading}-${index$1}`
|
|
796
1025
|
);
|
|
797
1026
|
}) })
|
|
798
1027
|
]
|
|
@@ -803,14 +1032,14 @@ const MainNavigation = ({
|
|
|
803
1032
|
"aside",
|
|
804
1033
|
{
|
|
805
1034
|
className: cn.cn(
|
|
806
|
-
|
|
1035
|
+
index.elevationStyles.elevationHigh,
|
|
807
1036
|
MainNavigation_module["main-navigation__panel-column"],
|
|
808
1037
|
MainNavigation_module["main-navigation__feature-links"],
|
|
809
1038
|
MainNavigation_module["main-navigation__panel-column--last"],
|
|
810
1039
|
openPanel.featureLinksHighlighted && MainNavigation_module["main-navigation__panel-column--highlighted"],
|
|
811
1040
|
!hasFeatureLinks && MainNavigation_module["main-navigation__feature-links--empty"]
|
|
812
1041
|
),
|
|
813
|
-
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) => {
|
|
814
1043
|
const href = MainNavigation_utils.toNavigableHref(link.href);
|
|
815
1044
|
const isExternalFeatureLink = MainNavigation_utils.isExternalTarget(link.target);
|
|
816
1045
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -821,8 +1050,8 @@ const MainNavigation = ({
|
|
|
821
1050
|
link: { ...link, href },
|
|
822
1051
|
className: cn.cn(
|
|
823
1052
|
MainNavigation_module["main-navigation__feature-link"],
|
|
824
|
-
|
|
825
|
-
|
|
1053
|
+
index.textDecorationStyles.underlineLinkOnHover,
|
|
1054
|
+
index.focusStyles.focusableInset
|
|
826
1055
|
),
|
|
827
1056
|
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
828
1057
|
isExternalFeatureLink ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -853,32 +1082,33 @@ const MainNavigation = ({
|
|
|
853
1082
|
] })
|
|
854
1083
|
})
|
|
855
1084
|
},
|
|
856
|
-
`feature-${index}`
|
|
1085
|
+
`feature-${index$1}`
|
|
857
1086
|
);
|
|
858
1087
|
}) })
|
|
859
1088
|
}
|
|
860
1089
|
)
|
|
861
1090
|
] }) });
|
|
862
1091
|
};
|
|
863
|
-
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) => {
|
|
864
1093
|
const hasPanel = item.panel != null;
|
|
865
|
-
const isOpen = openTopLevelItemIndex === index;
|
|
1094
|
+
const isOpen = openTopLevelItemIndex === index$1;
|
|
866
1095
|
const isCurrentPathItem = MainNavigation_utils.isItemInCurrentPath(item, currentPathname);
|
|
867
1096
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: MainNavigation_module["main-navigation__item"], children: hasPanel ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
868
1097
|
"button",
|
|
869
1098
|
{
|
|
870
1099
|
ref: (node) => {
|
|
871
|
-
desktopPanelTriggerButtonRefs.current[index] = node;
|
|
1100
|
+
desktopPanelTriggerButtonRefs.current[index$1] = node;
|
|
872
1101
|
},
|
|
873
1102
|
type: "button",
|
|
874
1103
|
className: cn.cn(
|
|
875
1104
|
MainNavigation_module["main-navigation__item-toggle"],
|
|
876
|
-
|
|
1105
|
+
index.focusStyles.focusableInset,
|
|
877
1106
|
isCurrentPathItem && MainNavigation_module["main-navigation__item-toggle--current"],
|
|
878
1107
|
isOpen && MainNavigation_module["main-navigation__item-toggle--open"]
|
|
879
1108
|
),
|
|
1109
|
+
"aria-current": isCurrentPathItem ? "true" : void 0,
|
|
880
1110
|
"aria-expanded": isOpen,
|
|
881
|
-
onClick: () => toggleTopLevelItem(index),
|
|
1111
|
+
onClick: () => toggleTopLevelItem(index$1),
|
|
882
1112
|
onKeyDown: (event) => {
|
|
883
1113
|
if (event.key === "Enter" && !isDesktopViewport()) {
|
|
884
1114
|
focusMobilePanelBackOnOpenRef.current = true;
|
|
@@ -898,7 +1128,7 @@ const MainNavigation = ({
|
|
|
898
1128
|
link: item,
|
|
899
1129
|
className: cn.cn(
|
|
900
1130
|
MainNavigation_module["main-navigation__item-link"],
|
|
901
|
-
|
|
1131
|
+
index.focusStyles.focusableInset,
|
|
902
1132
|
isCurrentPathItem && MainNavigation_module["main-navigation__item-link--current"]
|
|
903
1133
|
),
|
|
904
1134
|
ariaCurrent: isCurrentPathItem ? "page" : void 0,
|
|
@@ -911,16 +1141,31 @@ const MainNavigation = ({
|
|
|
911
1141
|
ref: setHeaderRef,
|
|
912
1142
|
className: cn.cn(
|
|
913
1143
|
MainNavigation_module["main-navigation"],
|
|
914
|
-
|
|
1144
|
+
isHeaderOpen && MainNavigation_module["main-navigation--open"],
|
|
915
1145
|
mobileMenuOpen && MainNavigation_module["main-navigation--menu-open"],
|
|
916
1146
|
isMobileMenuClosing && MainNavigation_module["main-navigation--menu-closing"],
|
|
917
1147
|
showPageOverlay && MainNavigation_module["main-navigation--overlay"],
|
|
918
|
-
showPageOverlay &&
|
|
919
|
-
isOverlayClosingOut &&
|
|
1148
|
+
showPageOverlay && index.overlayStyles.overlayStrong,
|
|
1149
|
+
isOverlayClosingOut && index.overlayStyles.overlayClosing,
|
|
920
1150
|
className
|
|
921
1151
|
),
|
|
922
1152
|
...props,
|
|
923
1153
|
onKeyDown: (event) => {
|
|
1154
|
+
if (event.key === "Tab" && activeUtilityDropdown != null) {
|
|
1155
|
+
const focusLoopElements = getUtilityDropdownFocusLoopElements(activeUtilityDropdown);
|
|
1156
|
+
if (focusLoopElements.length > 1) {
|
|
1157
|
+
event.preventDefault();
|
|
1158
|
+
const currentIndex = focusLoopElements.indexOf(
|
|
1159
|
+
document.activeElement
|
|
1160
|
+
);
|
|
1161
|
+
const direction = event.shiftKey ? -1 : 1;
|
|
1162
|
+
const nextIndex = currentIndex === -1 ? event.shiftKey ? focusLoopElements.length - 1 : 0 : (currentIndex + direction + focusLoopElements.length) % focusLoopElements.length;
|
|
1163
|
+
focusLoopElements[nextIndex]?.focus();
|
|
1164
|
+
} else {
|
|
1165
|
+
closeUtilityDropdown();
|
|
1166
|
+
}
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
924
1169
|
if (event.key === "Tab" && mobileMenuOpen && !isDesktopViewport()) {
|
|
925
1170
|
const focusableElements = getMobileFocusableElements();
|
|
926
1171
|
if (focusableElements.length > 0) {
|
|
@@ -948,7 +1193,12 @@ const MainNavigation = ({
|
|
|
948
1193
|
}
|
|
949
1194
|
}
|
|
950
1195
|
if (event.key === "Escape") {
|
|
1196
|
+
const utilityDropdownToRestore = activeUtilityDropdown;
|
|
951
1197
|
closeMenus();
|
|
1198
|
+
if (utilityDropdownToRestore != null) {
|
|
1199
|
+
const triggerButton = utilityDropdownToRestore === "search" ? searchTriggerRef.current : utilityDropdownToRestore === "language" ? languageTriggerRef.current : loginTriggerRef.current;
|
|
1200
|
+
triggerButton?.focus();
|
|
1201
|
+
}
|
|
952
1202
|
}
|
|
953
1203
|
props.onKeyDown?.(event);
|
|
954
1204
|
},
|
|
@@ -962,7 +1212,7 @@ const MainNavigation = ({
|
|
|
962
1212
|
link: organization,
|
|
963
1213
|
className: cn.cn(
|
|
964
1214
|
MainNavigation_module["main-navigation__organization-link"],
|
|
965
|
-
|
|
1215
|
+
index.focusStyles.focusable,
|
|
966
1216
|
organization.current && MainNavigation_module["main-navigation__organization-link--current"]
|
|
967
1217
|
),
|
|
968
1218
|
ariaCurrent: organization.current ? "page" : void 0,
|
|
@@ -973,7 +1223,7 @@ const MainNavigation = ({
|
|
|
973
1223
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: MainNavigation_module["main-navigation__navbar"], children: [
|
|
974
1224
|
renderUtilityLink({
|
|
975
1225
|
href: MainNavigation_utils.toNavigableHref(logoHref),
|
|
976
|
-
className: cn.cn(MainNavigation_module["main-navigation__logo"],
|
|
1226
|
+
className: cn.cn(MainNavigation_module["main-navigation__logo"], index.focusStyles.focusable),
|
|
977
1227
|
"aria-label": logoAriaLabel,
|
|
978
1228
|
children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: defaultLogoSrc, alt: "", "aria-hidden": "true" })
|
|
979
1229
|
}),
|
|
@@ -1000,48 +1250,116 @@ const MainNavigation = ({
|
|
|
1000
1250
|
}
|
|
1001
1251
|
),
|
|
1002
1252
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: MainNavigation_module["main-navigation__icon-nav"], children: [
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1253
|
+
showLanguage && currentLanguage != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: MainNavigation_module["main-navigation__utility"], children: [
|
|
1254
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1255
|
+
"button",
|
|
1256
|
+
{
|
|
1257
|
+
ref: languageTriggerRef,
|
|
1258
|
+
type: "button",
|
|
1259
|
+
className: cn.cn(
|
|
1260
|
+
MainNavigation_module["main-navigation__icon-nav-item"],
|
|
1261
|
+
isLanguageOpen && MainNavigation_module["main-navigation__icon-nav-item--active"],
|
|
1262
|
+
index.focusStyles.focusableInset
|
|
1263
|
+
),
|
|
1264
|
+
"aria-expanded": isLanguageOpen,
|
|
1265
|
+
"aria-controls": isLanguageOpen ? languageDropdownId : void 0,
|
|
1266
|
+
onClick: handleLanguageClick,
|
|
1267
|
+
children: [
|
|
1268
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Globe, { "aria-hidden": "true" }),
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1270
|
+
"span",
|
|
1271
|
+
{
|
|
1272
|
+
"aria-hidden": "true",
|
|
1273
|
+
className: MainNavigation_module["main-navigation__icon-nav-label"],
|
|
1274
|
+
children: currentLanguage.code.toUpperCase()
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
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,
|
|
1279
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { lang: announcement.lang, children: announcement.text })
|
|
1280
|
+
] }, announcement.lang)) })
|
|
1281
|
+
]
|
|
1282
|
+
}
|
|
1283
|
+
),
|
|
1284
|
+
isLanguageOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1285
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1286
|
+
"span",
|
|
1287
|
+
{
|
|
1288
|
+
"aria-hidden": "true",
|
|
1289
|
+
className: MainNavigation_module["main-navigation__dropdown-caret"]
|
|
1290
|
+
}
|
|
1026
1291
|
),
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1292
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1293
|
+
"div",
|
|
1294
|
+
{
|
|
1295
|
+
id: languageDropdownId,
|
|
1296
|
+
className: cn.cn(
|
|
1297
|
+
MainNavigation_module["main-navigation__dropdown"],
|
|
1298
|
+
MainNavigation_module["main-navigation__dropdown--language"],
|
|
1299
|
+
index.elevationStyles.elevationMedium
|
|
1300
|
+
),
|
|
1301
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: MainNavigation_module["main-navigation__language-list"], children: alternativeLanguages.map((language) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1302
|
+
"li",
|
|
1303
|
+
{
|
|
1304
|
+
className: MainNavigation_module["main-navigation__language-list-item"],
|
|
1305
|
+
children: renderLanguageLink({
|
|
1306
|
+
href: MainNavigation_utils.toNavigableHref(language.href),
|
|
1307
|
+
lang: language.code,
|
|
1308
|
+
"aria-label": language.ariaLabel ?? MainNavigation_utils.languageLinkAriaLabels[language.code],
|
|
1309
|
+
className: cn.cn(
|
|
1310
|
+
MainNavigation_module["main-navigation__language-link"],
|
|
1311
|
+
index.focusStyles.focusable
|
|
1312
|
+
),
|
|
1313
|
+
children: language.code.toUpperCase()
|
|
1314
|
+
})
|
|
1315
|
+
},
|
|
1316
|
+
language.code
|
|
1317
|
+
)) })
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
] })
|
|
1321
|
+
] }),
|
|
1322
|
+
showSearch && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: MainNavigation_module["main-navigation__utility"], children: [
|
|
1323
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1324
|
+
"button",
|
|
1325
|
+
{
|
|
1326
|
+
ref: searchTriggerRef,
|
|
1327
|
+
type: "button",
|
|
1328
|
+
className: cn.cn(
|
|
1329
|
+
MainNavigation_module["main-navigation__icon-nav-item"],
|
|
1330
|
+
isSearchOpen && MainNavigation_module["main-navigation__icon-nav-item--active"],
|
|
1331
|
+
index.focusStyles.focusableInset
|
|
1332
|
+
),
|
|
1333
|
+
"aria-label": searchLabel,
|
|
1334
|
+
"aria-expanded": isSearchOpen,
|
|
1335
|
+
"aria-controls": isSearchOpen ? searchDropdownId : void 0,
|
|
1336
|
+
onClick: handleSearchClick,
|
|
1337
|
+
children: [
|
|
1338
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Search, {}),
|
|
1339
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: MainNavigation_module["main-navigation__icon-nav-label"], children: searchLabel })
|
|
1340
|
+
]
|
|
1341
|
+
}
|
|
1342
|
+
),
|
|
1343
|
+
isSearchOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1344
|
+
"span",
|
|
1345
|
+
{
|
|
1346
|
+
"aria-hidden": "true",
|
|
1347
|
+
className: MainNavigation_module["main-navigation__dropdown-caret"]
|
|
1348
|
+
}
|
|
1349
|
+
)
|
|
1350
|
+
] }),
|
|
1035
1351
|
showCart && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1036
1352
|
"button",
|
|
1037
1353
|
{
|
|
1038
1354
|
type: "button",
|
|
1039
1355
|
className: cn.cn(
|
|
1040
1356
|
MainNavigation_module["main-navigation__icon-nav-item"],
|
|
1041
|
-
|
|
1357
|
+
isCartOpen && MainNavigation_module["main-navigation__icon-nav-item--active"],
|
|
1358
|
+
index.focusStyles.focusableInset
|
|
1042
1359
|
),
|
|
1043
1360
|
"aria-label": cartAccessibleLabel,
|
|
1044
|
-
|
|
1361
|
+
"aria-expanded": isCartOpen,
|
|
1362
|
+
onClick: handleCartClick,
|
|
1045
1363
|
children: [
|
|
1046
1364
|
/* @__PURE__ */ jsxRuntime.jsx(icons.Cart, {}),
|
|
1047
1365
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: MainNavigation_module["main-navigation__icon-nav-label"], children: cartLabel }),
|
|
@@ -1056,16 +1374,53 @@ const MainNavigation = ({
|
|
|
1056
1374
|
]
|
|
1057
1375
|
}
|
|
1058
1376
|
),
|
|
1059
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1377
|
+
showLogin && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: MainNavigation_module["main-navigation__utility"], children: [
|
|
1378
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1379
|
+
Button.Button,
|
|
1380
|
+
{
|
|
1381
|
+
ref: loginTriggerRef,
|
|
1382
|
+
size: "small",
|
|
1383
|
+
"aria-expanded": isLoginOpen,
|
|
1384
|
+
"aria-controls": isLoginOpen ? loginDropdownId : void 0,
|
|
1385
|
+
onClick: handleLoginClick,
|
|
1386
|
+
children: loginLabel
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1389
|
+
isLoginOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1390
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1391
|
+
"span",
|
|
1392
|
+
{
|
|
1393
|
+
"aria-hidden": "true",
|
|
1394
|
+
className: MainNavigation_module["main-navigation__dropdown-caret"]
|
|
1395
|
+
}
|
|
1396
|
+
),
|
|
1397
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1398
|
+
"div",
|
|
1399
|
+
{
|
|
1400
|
+
id: loginDropdownId,
|
|
1401
|
+
className: cn.cn(
|
|
1402
|
+
MainNavigation_module["main-navigation__dropdown"],
|
|
1403
|
+
MainNavigation_module["main-navigation__dropdown--login"],
|
|
1404
|
+
index.elevationStyles.elevationMedium
|
|
1405
|
+
),
|
|
1406
|
+
children: loginDropdownContent
|
|
1407
|
+
}
|
|
1408
|
+
)
|
|
1409
|
+
] })
|
|
1410
|
+
] })
|
|
1068
1411
|
] }),
|
|
1412
|
+
showSearch && isSearchOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1413
|
+
"div",
|
|
1414
|
+
{
|
|
1415
|
+
id: searchDropdownId,
|
|
1416
|
+
className: cn.cn(
|
|
1417
|
+
MainNavigation_module["main-navigation__dropdown"],
|
|
1418
|
+
MainNavigation_module["main-navigation__dropdown--search"],
|
|
1419
|
+
index.elevationStyles.elevationMedium
|
|
1420
|
+
),
|
|
1421
|
+
children: searchDropdownContent
|
|
1422
|
+
}
|
|
1423
|
+
),
|
|
1069
1424
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1070
1425
|
"button",
|
|
1071
1426
|
{
|
|
@@ -1074,7 +1429,7 @@ const MainNavigation = ({
|
|
|
1074
1429
|
className: cn.cn(
|
|
1075
1430
|
MainNavigation_module["main-navigation__menu-toggle"],
|
|
1076
1431
|
mobileMenuOpen && MainNavigation_module["main-navigation__menu-toggle--open"],
|
|
1077
|
-
|
|
1432
|
+
index.focusStyles.focusableInset
|
|
1078
1433
|
),
|
|
1079
1434
|
"aria-label": mobileMenuOpen ? mobileMenuCloseAriaLabel : mobileMenuOpenAriaLabel,
|
|
1080
1435
|
"aria-expanded": mobileMenuOpen,
|
|
@@ -1085,6 +1440,16 @@ const MainNavigation = ({
|
|
|
1085
1440
|
] }),
|
|
1086
1441
|
!mobileMenuOpen && renderPanel(
|
|
1087
1442
|
cn.cn(MainNavigation_module["main-navigation__panel"], MainNavigation_module["main-navigation__panel--desktop"])
|
|
1443
|
+
),
|
|
1444
|
+
showCart && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1445
|
+
Drawer.Drawer,
|
|
1446
|
+
{
|
|
1447
|
+
open: isCartOpen,
|
|
1448
|
+
onOpenChange: handleCartOpenChange,
|
|
1449
|
+
title: cartLabel,
|
|
1450
|
+
size: "small",
|
|
1451
|
+
children: cartContent
|
|
1452
|
+
}
|
|
1088
1453
|
)
|
|
1089
1454
|
]
|
|
1090
1455
|
}
|