@dnanpm/styleguide 3.11.0 → 3.11.2
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/build/cjs/components/Checkbox/Checkbox.js +2 -1
- package/build/cjs/components/Chip/Chip.js +2 -1
- package/build/cjs/components/DateTimePicker/DateTimePicker.d.ts +22 -6
- package/build/cjs/components/DateTimePicker/DateTimePicker.js +61 -29
- package/build/cjs/components/Footer/Components/FooterComponents.js +11 -23
- package/build/cjs/components/Footer/Footer.js +2 -1
- package/build/cjs/components/Input/Input.d.ts +7 -1
- package/build/cjs/components/Input/Input.js +16 -16
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +2 -1
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +13 -13
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +2 -2
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +12 -12
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -3
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +7 -6
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.d.ts +4 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +44 -41
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +3 -1
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.js +14 -10
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.d.ts +2 -0
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.js +4 -2
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.d.ts +8 -8
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.js +29 -24
- package/build/cjs/components/Notification/Notification.js +2 -1
- package/build/cjs/components/Pill/Pill.js +2 -1
- package/build/cjs/components/RadioButton/RadioButton.js +4 -3
- package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.js +3 -1
- package/build/cjs/components/Switch/Switch.js +1 -2
- package/build/cjs/components/Tooltip/Tooltip.js +2 -1
- package/build/cjs/utils/styledUtils.js +4 -4
- package/build/es/components/Checkbox/Checkbox.js +2 -1
- package/build/es/components/Chip/Chip.js +2 -1
- package/build/es/components/DateTimePicker/DateTimePicker.d.ts +22 -6
- package/build/es/components/DateTimePicker/DateTimePicker.js +61 -29
- package/build/es/components/Footer/Components/FooterComponents.js +11 -23
- package/build/es/components/Footer/Footer.js +2 -1
- package/build/es/components/Input/Input.d.ts +7 -1
- package/build/es/components/Input/Input.js +17 -17
- package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +2 -1
- package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +13 -13
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +2 -2
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +12 -12
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -3
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +7 -6
- package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.d.ts +4 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +45 -43
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +3 -1
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.js +14 -10
- package/build/es/components/MainHeaderNavigation/context/NavContext.d.ts +2 -0
- package/build/es/components/MainHeaderNavigation/context/NavContext.js +4 -2
- package/build/es/components/MainHeaderNavigation/globalNavStyles.d.ts +8 -8
- package/build/es/components/MainHeaderNavigation/globalNavStyles.js +29 -24
- package/build/es/components/Notification/Notification.js +2 -1
- package/build/es/components/Pill/Pill.js +2 -1
- package/build/es/components/RadioButton/RadioButton.js +4 -3
- package/build/es/components/SecondaryNavigation/SecondaryNavigation.js +3 -1
- package/build/es/components/Switch/Switch.js +1 -2
- package/build/es/components/Tooltip/Tooltip.js +2 -1
- package/build/es/utils/styledUtils.js +4 -4
- package/package.json +12 -10
- package/build/cjs/components/MainHeaderNavigation/context/MobileMenuContext.d.ts +0 -6
- package/build/cjs/components/MainHeaderNavigation/context/MobileMenuContext.js +0 -11
- package/build/es/components/MainHeaderNavigation/context/MobileMenuContext.d.ts +0 -6
- package/build/es/components/MainHeaderNavigation/context/MobileMenuContext.js +0 -7
|
@@ -13,15 +13,15 @@ const TooltipWrapper = styledComponents.styled.button `
|
|
|
13
13
|
padding: 0;
|
|
14
14
|
overflow: visible;
|
|
15
15
|
background: transparent;
|
|
16
|
-
color: ${p => (p
|
|
16
|
+
color: ${p => (p.$isHighlighted ? theme.default.color.text.pink : 'inherit')};
|
|
17
17
|
font: inherit;
|
|
18
18
|
line-height: normal;
|
|
19
19
|
-webkit-font-smoothing: inherit;
|
|
20
20
|
-moz-osx-font-smoothing: inherit;
|
|
21
21
|
-webkit-appearance: none;
|
|
22
22
|
cursor: pointer;
|
|
23
|
-
width: ${p => (p
|
|
24
|
-
border-left: ${p => (p
|
|
23
|
+
width: ${p => (p.$isLoggedIn ? '6.25rem' : '100%')};
|
|
24
|
+
border-left: ${p => (p.$isLoggedIn ? `2px solid ${theme.default.color.line.L03}` : 'none')};
|
|
25
25
|
&:active,
|
|
26
26
|
&:focus {
|
|
27
27
|
> svg,
|
|
@@ -32,7 +32,8 @@ const TooltipWrapper = styledComponents.styled.button `
|
|
|
32
32
|
&:focus-visible {
|
|
33
33
|
outline: 0;
|
|
34
34
|
border-radius: ${theme.default.radius.s};
|
|
35
|
-
box-shadow:
|
|
35
|
+
box-shadow:
|
|
36
|
+
0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
36
37
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
37
38
|
> svg,
|
|
38
39
|
> span {
|
|
@@ -43,14 +44,14 @@ const TooltipWrapper = styledComponents.styled.button `
|
|
|
43
44
|
align-content: center;
|
|
44
45
|
display: flex;
|
|
45
46
|
margin: 0 auto;
|
|
46
|
-
@media (min-width: ${p => p
|
|
47
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
47
48
|
height: 1.625em;
|
|
48
49
|
width: 1.625em;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
> span {
|
|
52
53
|
display: none;
|
|
53
|
-
@media (min-width: ${p => p
|
|
54
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
54
55
|
font-size: ${theme.default.fontSize.xs};
|
|
55
56
|
font-weight: ${theme.default.fontWeight.medium};
|
|
56
57
|
width: 100%;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { MobileMenuBackLink } from '../types/globalNavProps';
|
|
3
|
+
export declare const MenuItemBackLink: ({ currentLevel, backRef, }: MobileMenuBackLink & {
|
|
4
|
+
backRef?: React.RefObject<HTMLButtonElement>;
|
|
5
|
+
}) => React.JSX.Element;
|
|
2
6
|
declare const RenderMobileMenu: () => React.JSX.Element | null;
|
|
3
7
|
export default RenderMobileMenu;
|
|
@@ -9,7 +9,6 @@ var styledComponents = require('styled-components');
|
|
|
9
9
|
var theme = require('../../../themes/theme.js');
|
|
10
10
|
var navigation = require('../../../themes/themeComponents/navigation.js');
|
|
11
11
|
var styledUtils = require('../../../utils/styledUtils.js');
|
|
12
|
-
var MobileMenuContext = require('../context/MobileMenuContext.js');
|
|
13
12
|
var NavContext = require('../context/NavContext.js');
|
|
14
13
|
var globalNavStyles = require('../globalNavStyles.js');
|
|
15
14
|
var LinkModifier = require('./LinkModifier.js');
|
|
@@ -28,7 +27,7 @@ const MobileMenuWrapper = styledComponents.styled(reactSpring.animated.div) `
|
|
|
28
27
|
`;
|
|
29
28
|
const mobileMenu = `calc(100vh - ${navigation.headerMaxHeight})`;
|
|
30
29
|
const MenuLinkBackLink = styledComponents.styled(globalNavStyles.MenuLink) ``;
|
|
31
|
-
const MobileMenuContainer = styledComponents.styled.
|
|
30
|
+
const MobileMenuContainer = styledComponents.styled.nav `
|
|
32
31
|
width: 100%;
|
|
33
32
|
position: absolute;
|
|
34
33
|
top: ${navigation.navMaxHeight};
|
|
@@ -83,7 +82,7 @@ const MobileMenuContainer = styledComponents.styled.div `
|
|
|
83
82
|
}
|
|
84
83
|
${globalNavStyles.FeaturedBlock} {
|
|
85
84
|
border-bottom: 1px solid ${theme.default.color.line.L04};
|
|
86
|
-
> a {
|
|
85
|
+
section > a {
|
|
87
86
|
font-size: ${theme.default.fontSize.s};
|
|
88
87
|
line-height: ${theme.default.lineHeight.s};
|
|
89
88
|
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1)};
|
|
@@ -91,31 +90,25 @@ const MobileMenuContainer = styledComponents.styled.div `
|
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
`;
|
|
94
|
-
const MenuItemBackLink = ({ currentLevel }) => {
|
|
95
|
-
const { handleNavMenuClick, lang, menuLevel: { scrollPosition }, level1Items, level2Items, getBackLink, } = React.useContext(NavContext.default);
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
const menuElementLevel = `level${currentLevel - 1}Items`;
|
|
101
|
-
const menuElements = levels[menuElementLevel];
|
|
93
|
+
const MenuItemBackLink = ({ currentLevel, backRef, }) => {
|
|
94
|
+
const { backToPreviousCategoryLabel, handleNavMenuClick, lang, menuLevel: { scrollPosition }, level1Items, level2Items, getBackLink, } = React.useContext(NavContext.default);
|
|
95
|
+
const menuElements = currentLevel === 2 ? level1Items : level2Items;
|
|
96
|
+
const tabNavigationDisabled = scrollPosition !== currentLevel - 1;
|
|
97
|
+
const backLink = getBackLink(menuElements, currentLevel - 1);
|
|
102
98
|
const mobileMenuBackClick = () => {
|
|
103
99
|
handleNavMenuClick(null, `level${currentLevel - 1}Mobile`);
|
|
104
100
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return (React__default.default.createElement(globalNavStyles.MenuItem, { key: `back-${backLink.id}`, "data-testid": `mobile-nav-menu-backlink-level-${currentLevel}` },
|
|
108
|
-
React__default.default.createElement(MenuLinkBackLink, { as: "button", onClick: mobileMenuBackClick, tabIndex: tabNavigationDisabled ? -1 : undefined },
|
|
101
|
+
return (React__default.default.createElement(globalNavStyles.MenuItem, { "data-testid": `mobile-nav-menu-backlink-level-${currentLevel}` },
|
|
102
|
+
React__default.default.createElement(MenuLinkBackLink, { as: "button", ref: backRef, onClick: mobileMenuBackClick, tabIndex: tabNavigationDisabled ? -1 : undefined, "aria-label": `${backToPreviousCategoryLabel} ${backLink.titles[lang]}` },
|
|
109
103
|
React__default.default.createElement(icons.ChevronLeft, { size: "1.5rem" }),
|
|
110
104
|
backLink.titles[lang])));
|
|
111
105
|
};
|
|
112
|
-
const
|
|
106
|
+
const SubMenuItem = ({ menuItem, currentLevel, itemIndex, mobileMenuRef, firstItemRef, }) => {
|
|
113
107
|
const { handleNavMenuClick, menuLevel, lang, currentUrl } = React.useContext(NavContext.default);
|
|
114
|
-
const
|
|
115
|
-
const hasChildren = menuItem.pages.length;
|
|
108
|
+
const hasChildren = !!menuItem.pages.length;
|
|
116
109
|
const indexLevel = currentLevel - 1;
|
|
117
110
|
const tabNavigationDisabled = menuLevel.scrollPosition !== indexLevel;
|
|
118
|
-
const menuUrl = menuItem.urls[lang]
|
|
111
|
+
const menuUrl = menuItem.urls[lang];
|
|
119
112
|
const mobileMenuClick = (element) => (e) => {
|
|
120
113
|
var _a, _b;
|
|
121
114
|
(_b = (_a = mobileMenuRef === null || mobileMenuRef === void 0 ? void 0 : mobileMenuRef.current) === null || _a === void 0 ? void 0 : _a.scroll) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
@@ -126,37 +119,50 @@ const CreateSubMenuItem = ({ menuItem, currentLevel, itemIndex }) => {
|
|
|
126
119
|
e.preventDefault();
|
|
127
120
|
handleNavMenuClick(element.id, `level${currentLevel}Mobile`);
|
|
128
121
|
};
|
|
129
|
-
const renderMenuItem = (children) => (React__default.default.createElement(globalNavStyles.MenuItem, { key: menuItem.id, "data-testid": `mobile-menu-level-${currentLevel}-link-${itemIndex + 1}`, isActive: LinkModifier.isSelected(currentUrl, menuUrl, true) }, children));
|
|
122
|
+
const renderMenuItem = (children) => (React__default.default.createElement(globalNavStyles.MenuItem, { key: menuItem.id, "data-testid": `mobile-menu-level-${currentLevel}-link-${itemIndex + 1}`, "$isActive": LinkModifier.isSelected(currentUrl, menuUrl, true) }, children));
|
|
130
123
|
if (hasChildren && currentLevel < 3) {
|
|
131
|
-
return renderMenuItem(React__default.default.createElement(globalNavStyles.MenuLink, { as: "button", onClick: mobileMenuClick(menuItem), tabIndex: tabNavigationDisabled ? -1 : undefined },
|
|
124
|
+
return renderMenuItem(React__default.default.createElement(globalNavStyles.MenuLink, { as: "button", ref: firstItemRef, onClick: mobileMenuClick(menuItem), tabIndex: tabNavigationDisabled ? -1 : undefined },
|
|
132
125
|
menuItem.titles[lang],
|
|
133
126
|
React__default.default.createElement(icons.ChevronRight, { color: theme.default.color.default.pink })));
|
|
134
127
|
}
|
|
135
128
|
return renderMenuItem(React__default.default.createElement(LinkModifier.default, { menuItem: menuItem, disabledTabIndex: tabNavigationDisabled }));
|
|
136
129
|
};
|
|
137
|
-
const SubMenuMobile = ({ currentLevel, menuItem }) => {
|
|
138
|
-
const
|
|
130
|
+
const SubMenuMobile = ({ currentLevel, menuItem, mobileMenuRef }) => {
|
|
131
|
+
const { collapseSize, featuredItemsAriaLabel, menuLevel } = React.useContext(NavContext.default);
|
|
139
132
|
const indexLevel = currentLevel - 1;
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
|
|
133
|
+
const tabNavigationDisabled = menuLevel.scrollPosition !== indexLevel;
|
|
134
|
+
const backRef = React.useRef(null);
|
|
135
|
+
const firstItemRef = React.useRef(null);
|
|
136
|
+
React.useEffect(() => {
|
|
137
|
+
// Delay focus to allow animation to finish
|
|
138
|
+
const timer = setTimeout(() => {
|
|
139
|
+
if (currentLevel === 1 && firstItemRef.current) {
|
|
140
|
+
firstItemRef.current.focus();
|
|
141
|
+
}
|
|
142
|
+
if (currentLevel > 1 && backRef.current) {
|
|
143
|
+
backRef.current.focus();
|
|
144
|
+
}
|
|
145
|
+
}, 300);
|
|
146
|
+
return () => clearTimeout(timer);
|
|
147
|
+
}, [menuItem, currentLevel]);
|
|
148
|
+
if (!(menuItem === null || menuItem === void 0 ? void 0 : menuItem.pages.length)) {
|
|
143
149
|
return null;
|
|
144
150
|
}
|
|
151
|
+
const featuredItems = currentLevel === 2 ? menuItem.pages.filter(subMenuItem => !subMenuItem.pages.length) : [];
|
|
152
|
+
const menuItems = menuItem.pages.filter(subMenuItem => !featuredItems.includes(subMenuItem));
|
|
145
153
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
146
|
-
currentLevel > 1 && React__default.default.createElement(MenuItemBackLink, { currentLevel: currentLevel }),
|
|
147
|
-
featuredItems.length > 0 && (React__default.default.createElement(globalNavStyles.FeaturedBlock, { collapseSize: collapseSize },
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
.map((subMenuItem, index) => (React__default.default.createElement(CreateSubMenuItem, { currentLevel: currentLevel, itemIndex: index, key: subMenuItem.id, menuItem: subMenuItem })))));
|
|
154
|
+
currentLevel > 1 && React__default.default.createElement(MenuItemBackLink, { backRef: backRef, currentLevel: currentLevel }),
|
|
155
|
+
featuredItems.length > 0 && (React__default.default.createElement(globalNavStyles.FeaturedBlock, { "$collapseSize": collapseSize },
|
|
156
|
+
React__default.default.createElement("section", { "aria-label": featuredItemsAriaLabel }, featuredItems.map(subMenuItem => (React__default.default.createElement(LinkModifier.default, { key: subMenuItem.id, menuItem: subMenuItem, showIcon: true, disabledTabIndex: tabNavigationDisabled })))))),
|
|
157
|
+
menuItems.map((subMenuItem, index) => (React__default.default.createElement(SubMenuItem, { currentLevel: currentLevel, itemIndex: index, key: subMenuItem.id, menuItem: subMenuItem, mobileMenuRef: mobileMenuRef, firstItemRef: index === 0 ? firstItemRef : undefined })))));
|
|
151
158
|
};
|
|
152
|
-
const NavigationMenuMobile = () => {
|
|
159
|
+
const NavigationMenuMobile = ({ mobileMenuRef }) => {
|
|
153
160
|
const { items, menuLevel, level1Items, level2Items } = React.useContext(NavContext.default);
|
|
154
161
|
const { mainNavigation } = items;
|
|
155
162
|
if (!(mainNavigation === null || mainNavigation === void 0 ? void 0 : mainNavigation.pages.length)) {
|
|
156
163
|
return null;
|
|
157
164
|
}
|
|
158
|
-
const renderMenuList = (scrollPosition, level, menuItem) => (React__default.default.createElement(globalNavStyles.MenuList, { "aria-hidden": menuLevel.scrollPosition !== scrollPosition, "aria-disabled": menuLevel.scrollPosition !== scrollPosition, "data-testid": `mobile-nav-menu-level-${level}`, isInView: menuLevel.scrollPosition === scrollPosition },
|
|
159
|
-
React__default.default.createElement(SubMenuMobile, { currentLevel: level, menuItem: menuItem })));
|
|
165
|
+
const renderMenuList = (scrollPosition, level, menuItem) => (React__default.default.createElement(globalNavStyles.MenuList, { "aria-hidden": menuLevel.scrollPosition !== scrollPosition, "aria-disabled": menuLevel.scrollPosition !== scrollPosition, "data-testid": `mobile-nav-menu-level-${level}`, "$isInView": menuLevel.scrollPosition === scrollPosition }, menuLevel.scrollPosition === scrollPosition && (React__default.default.createElement(SubMenuMobile, { currentLevel: level, menuItem: menuItem, mobileMenuRef: mobileMenuRef }))));
|
|
160
166
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
161
167
|
renderMenuList(0, 1, mainNavigation),
|
|
162
168
|
menuLevel.level1Mobile !== null &&
|
|
@@ -170,16 +176,13 @@ const RenderMobileMenu = () => {
|
|
|
170
176
|
const slidingMenuAnimation = reactSpring.useSpring({
|
|
171
177
|
transform: `translateX(${(menuLevel.scrollPosition / navigation.menuLevelsAmount) * -100}%)`,
|
|
172
178
|
});
|
|
173
|
-
const mobileMenuContext = React.useMemo(() => ({
|
|
174
|
-
mobileMenuRef,
|
|
175
|
-
}), [mobileMenuRef]);
|
|
176
179
|
if (!isMobileMenuOpen) {
|
|
177
180
|
return null;
|
|
178
181
|
}
|
|
179
|
-
return (React__default.default.createElement(MobileMenuContainer, { ref: mobileMenuRef },
|
|
180
|
-
React__default.default.createElement(
|
|
181
|
-
React__default.default.createElement(
|
|
182
|
-
React__default.default.createElement(NavigationMenuMobile, null)))));
|
|
182
|
+
return (React__default.default.createElement(MobileMenuContainer, { ref: mobileMenuRef, role: "dialog", "aria-modal": "true" },
|
|
183
|
+
React__default.default.createElement(MobileMenuWrapper, { style: slidingMenuAnimation },
|
|
184
|
+
React__default.default.createElement(NavigationMenuMobile, { mobileMenuRef: mobileMenuRef }))));
|
|
183
185
|
};
|
|
184
186
|
|
|
187
|
+
exports.MenuItemBackLink = MenuItemBackLink;
|
|
185
188
|
exports.default = RenderMobileMenu;
|
|
@@ -2,10 +2,12 @@ import type { ComponentType, MouseEvent, ReactNode } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { GlobalNavItems } from './types/globalNavProps';
|
|
4
4
|
export interface MainHeaderNavigationProps {
|
|
5
|
+
backToPreviousCategoryLabel?: string;
|
|
5
6
|
businessMenuAriaLabel?: string;
|
|
6
7
|
categoryCollectionText?: string;
|
|
7
8
|
/** Allows to pass a custom className */
|
|
8
9
|
className?: string;
|
|
10
|
+
featuredItemsAriaLabel?: string;
|
|
9
11
|
items?: GlobalNavItems;
|
|
10
12
|
language?: string;
|
|
11
13
|
zIndex?: number;
|
|
@@ -44,6 +46,6 @@ export interface MainHeaderNavigationProps {
|
|
|
44
46
|
notificationText?: string;
|
|
45
47
|
}
|
|
46
48
|
/** @visibleName MainHeaderNavigation */
|
|
47
|
-
declare const MainHeaderNavigation: ({ businessMenuAriaLabel, categoryCollectionText, closeMainMenuAriaLabel, className, collapseSize, currentUrl, dnaLogoLinkAriaLabel, isLoggedIn, items, language, languageSelector, languageSelectorText, login, loginComponent, loginText, mainMenuAriaLabel, minicart, minicartAmount, minicartAmountLabel, minicartComponent, minicartText, nextJSLinkComponent, notificationText, openMainMenuAriaLabel, search, searchComponent, searchText, showLoginTooltip, showMinicart, zIndex, ...props }: MainHeaderNavigationProps) => React.JSX.Element;
|
|
49
|
+
declare const MainHeaderNavigation: ({ backToPreviousCategoryLabel, businessMenuAriaLabel, categoryCollectionText, closeMainMenuAriaLabel, className, collapseSize, currentUrl, dnaLogoLinkAriaLabel, featuredItemsAriaLabel, isLoggedIn, items, language, languageSelector, languageSelectorText, login, loginComponent, loginText, mainMenuAriaLabel, minicart, minicartAmount, minicartAmountLabel, minicartComponent, minicartText, nextJSLinkComponent, notificationText, openMainMenuAriaLabel, search, searchComponent, searchText, showLoginTooltip, showMinicart, zIndex, ...props }: MainHeaderNavigationProps) => React.JSX.Element;
|
|
48
50
|
/** @component */
|
|
49
51
|
export default MainHeaderNavigation;
|
|
@@ -82,7 +82,7 @@ const PageOverlay = styledComponents.styled.div `
|
|
|
82
82
|
width: 100%;
|
|
83
83
|
height: 100%;
|
|
84
84
|
background: ${theme.default.color.background.plum.default + theme.default.color.transparency.T10};
|
|
85
|
-
z-index: ${({ navZIndex }) => navZIndex - 1};
|
|
85
|
+
z-index: ${({ $navZIndex }) => $navZIndex - 1};
|
|
86
86
|
`;
|
|
87
87
|
const scrollThreshold = 82;
|
|
88
88
|
const checkThreshold = (prevPos, currPos) => {
|
|
@@ -92,7 +92,7 @@ const checkThreshold = (prevPos, currPos) => {
|
|
|
92
92
|
return currPos - prevPos > scrollThreshold;
|
|
93
93
|
};
|
|
94
94
|
const GlobalNavigationContainer = styledComponents.styled.header `
|
|
95
|
-
z-index: ${({ navZIndex }) => navZIndex};
|
|
95
|
+
z-index: ${({ $navZIndex }) => $navZIndex};
|
|
96
96
|
position: sticky;
|
|
97
97
|
top: 0;
|
|
98
98
|
left: 0;
|
|
@@ -117,7 +117,7 @@ const NavigationWrapper = styledComponents.styled.div `
|
|
|
117
117
|
gap: 0;
|
|
118
118
|
background-color: ${theme.default.color.background.white.default};
|
|
119
119
|
border-bottom: 1px solid ${theme.default.color.line.L04};
|
|
120
|
-
@media (min-width: ${p => p
|
|
120
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
121
121
|
flex-wrap: nowrap;
|
|
122
122
|
gap: 0 ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1.5)};
|
|
123
123
|
}
|
|
@@ -134,7 +134,7 @@ const initiateScrollToHeader = (componentRef) => {
|
|
|
134
134
|
/** @visibleName MainHeaderNavigation */
|
|
135
135
|
const MainHeaderNavigation = (_a) => {
|
|
136
136
|
var _b, _c, _d;
|
|
137
|
-
var { businessMenuAriaLabel = 'Sivustot', categoryCollectionText = 'Muut kategoriat', closeMainMenuAriaLabel, className, collapseSize = 767, currentUrl = '', dnaLogoLinkAriaLabel, isLoggedIn = false, items = {}, language = 'fi', languageSelector = false, languageSelectorText = 'Vaihda kieltä', login = true, loginComponent, loginText = 'Kirjaudu', mainMenuAriaLabel = 'Päänavigaatio', minicart = true, minicartAmount = 0, minicartAmountLabel, minicartComponent = false, minicartText = 'Ostoskori', nextJSLinkComponent = false, notificationText = '', openMainMenuAriaLabel, search = true, searchComponent = false, searchText = 'Haku', showLoginTooltip = false, showMinicart = false, zIndex = 1030 } = _a, props = tslib.__rest(_a, ["businessMenuAriaLabel", "categoryCollectionText", "closeMainMenuAriaLabel", "className", "collapseSize", "currentUrl", "dnaLogoLinkAriaLabel", "isLoggedIn", "items", "language", "languageSelector", "languageSelectorText", "login", "loginComponent", "loginText", "mainMenuAriaLabel", "minicart", "minicartAmount", "minicartAmountLabel", "minicartComponent", "minicartText", "nextJSLinkComponent", "notificationText", "openMainMenuAriaLabel", "search", "searchComponent", "searchText", "showLoginTooltip", "showMinicart", "zIndex"]);
|
|
137
|
+
var { backToPreviousCategoryLabel = '', businessMenuAriaLabel = 'Sivustot', categoryCollectionText = 'Muut kategoriat', closeMainMenuAriaLabel, className, collapseSize = 767, currentUrl = '', dnaLogoLinkAriaLabel, featuredItemsAriaLabel = '', isLoggedIn = false, items = {}, language = 'fi', languageSelector = false, languageSelectorText = 'Vaihda kieltä', login = true, loginComponent, loginText = 'Kirjaudu', mainMenuAriaLabel = 'Päänavigaatio', minicart = true, minicartAmount = 0, minicartAmountLabel, minicartComponent = false, minicartText = 'Ostoskori', nextJSLinkComponent = false, notificationText = '', openMainMenuAriaLabel, search = true, searchComponent = false, searchText = 'Haku', showLoginTooltip = false, showMinicart = false, zIndex = 1030 } = _a, props = tslib.__rest(_a, ["backToPreviousCategoryLabel", "businessMenuAriaLabel", "categoryCollectionText", "closeMainMenuAriaLabel", "className", "collapseSize", "currentUrl", "dnaLogoLinkAriaLabel", "featuredItemsAriaLabel", "isLoggedIn", "items", "language", "languageSelector", "languageSelectorText", "login", "loginComponent", "loginText", "mainMenuAriaLabel", "minicart", "minicartAmount", "minicartAmountLabel", "minicartComponent", "minicartText", "nextJSLinkComponent", "notificationText", "openMainMenuAriaLabel", "search", "searchComponent", "searchText", "showLoginTooltip", "showMinicart", "zIndex"]);
|
|
138
138
|
const { isMobile } = useWindowSize.default(collapseSize);
|
|
139
139
|
const navigationEl = React.useRef(null);
|
|
140
140
|
const key = ramda.prop('id');
|
|
@@ -238,10 +238,12 @@ const MainHeaderNavigation = (_a) => {
|
|
|
238
238
|
previousValue = isMobile;
|
|
239
239
|
}
|
|
240
240
|
return {
|
|
241
|
+
backToPreviousCategoryLabel,
|
|
241
242
|
categoryCollectionText,
|
|
242
243
|
collapseSize,
|
|
243
244
|
currentUrl,
|
|
244
245
|
getBackLink,
|
|
246
|
+
featuredItemsAriaLabel,
|
|
245
247
|
handleNavMenuClick,
|
|
246
248
|
isLoggedIn,
|
|
247
249
|
isMobileMenu: isMobile,
|
|
@@ -263,9 +265,11 @@ const MainHeaderNavigation = (_a) => {
|
|
|
263
265
|
tooltipItems,
|
|
264
266
|
};
|
|
265
267
|
}, [
|
|
268
|
+
backToPreviousCategoryLabel,
|
|
266
269
|
categoryCollectionText,
|
|
267
270
|
collapseSize,
|
|
268
271
|
currentUrl,
|
|
272
|
+
featuredItemsAriaLabel,
|
|
269
273
|
isLoggedIn,
|
|
270
274
|
isMobile,
|
|
271
275
|
isMobileMenuOpen,
|
|
@@ -299,23 +303,23 @@ const MainHeaderNavigation = (_a) => {
|
|
|
299
303
|
setIsMobileMenuOpen(!isMobileMenuOpen);
|
|
300
304
|
};
|
|
301
305
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
302
|
-
isPageOverlay && React__default.default.createElement(PageOverlay, { "data-testid": "navigation-overlay", navZIndex: zIndex }),
|
|
303
|
-
React__default.default.createElement(GlobalNavigationContainer, { className: className, collapseSize: collapseSize, "data-testid": "dna-main-header", navZIndex: zIndex, ref: navigationEl },
|
|
306
|
+
isPageOverlay && React__default.default.createElement(PageOverlay, { "data-testid": "navigation-overlay", "$navZIndex": zIndex }),
|
|
307
|
+
React__default.default.createElement(GlobalNavigationContainer, { className: className, "$collapseSize": collapseSize, "data-testid": "dna-main-header", "$navZIndex": zIndex, ref: navigationEl },
|
|
304
308
|
React__default.default.createElement(NavContext.default.Provider, { value: navigationContext },
|
|
305
309
|
React__default.default.createElement(GlobalStyle, null),
|
|
306
310
|
!items.mainNavigation && notificationText && (React__default.default.createElement(Notification.default, { type: "info" }, notificationText)),
|
|
307
311
|
React__default.default.createElement(BusinessMenu.default, { ariaLabel: businessMenuAriaLabel, currentBusinessId: items.businessId, items: (_d = items.businessSelector) === null || _d === void 0 ? void 0 : _d.items, lang: language }),
|
|
308
|
-
React__default.default.createElement(NavigationWrapper, { collapseSize: collapseSize },
|
|
312
|
+
React__default.default.createElement(NavigationWrapper, { "$collapseSize": collapseSize },
|
|
309
313
|
React__default.default.createElement(globalNavStyles.LogoLink, { "data-testid": "dna-logo-link", href: currentBusinessSite === null || currentBusinessSite === void 0 ? void 0 : currentBusinessSite.urls[language], "aria-label": dnaLogoLinkAriaLabel },
|
|
310
314
|
React__default.default.createElement(DnaLogo.default, { size: navigation.headerLogoSize })),
|
|
311
|
-
React__default.default.createElement(globalNavStyles.DesktopMenuContainer, { "aria-label": mainMenuAriaLabel, collapseSize: collapseSize },
|
|
315
|
+
React__default.default.createElement(globalNavStyles.DesktopMenuContainer, { "aria-label": mainMenuAriaLabel, "$collapseSize": collapseSize },
|
|
312
316
|
React__default.default.createElement(DesktopMenu.default, null)),
|
|
313
|
-
React__default.default.createElement(globalNavStyles.HeaderIconContainer, { collapseSize: collapseSize },
|
|
317
|
+
React__default.default.createElement(globalNavStyles.HeaderIconContainer, { "$collapseSize": collapseSize },
|
|
314
318
|
languagesObject && languageSelector && (React__default.default.createElement(LanguageSelector.default, { currentLanguage: language, languagesObject: languagesObject, languageSelectorLabel: languageSelectorText })),
|
|
315
319
|
search && React__default.default.createElement(PageSearch.default, { searchLabel: searchText }),
|
|
316
320
|
minicart && (React__default.default.createElement(MinicartTooltip.default, { minicartAmount: minicartAmount, minicartAmountLabel: minicartAmountLabel !== null && minicartAmountLabel !== void 0 ? minicartAmountLabel : '', minicartLabel: minicartText, onCartButtonClick: props.onCartButtonClick })),
|
|
317
321
|
login && React__default.default.createElement(LoginTooltip.default, { loginLabel: loginText, isLogged: isLoggedIn }),
|
|
318
|
-
React__default.default.createElement(MainNavTooltipMenu.IconContainer, { collapseSize: collapseSize, "data-testid": "header-mobile-menu-container" },
|
|
322
|
+
React__default.default.createElement(MainNavTooltipMenu.IconContainer, { "$collapseSize": collapseSize, "data-testid": "header-mobile-menu-container" },
|
|
319
323
|
React__default.default.createElement(globalNavStyles.MobileMenuButton, { "aria-expanded": isMobileMenuOpen, "aria-label": isMobileMenuOpen
|
|
320
324
|
? closeMainMenuAriaLabel
|
|
321
325
|
: openMainMenuAriaLabel, "data-testid": "header-mobile-menu-toggle", onClick: handleToggleClick }, isMobileMenuOpen ? React__default.default.createElement(icons.Close, null) : React__default.default.createElement(icons.Menu, null)))),
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ComponentType, Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import type { GlobalNavItems, MenuLevelItem, MenuStates, MenuTooltipItems, MobileMenuLevel } from '../types/globalNavProps';
|
|
3
3
|
export interface NavContextProps {
|
|
4
|
+
backToPreviousCategoryLabel: string;
|
|
4
5
|
categoryCollectionText: string;
|
|
5
6
|
collapseSize: number;
|
|
6
7
|
currentUrl: string;
|
|
8
|
+
featuredItemsAriaLabel: string;
|
|
7
9
|
getBackLink: (menuElements: MobileMenuLevel, i: number) => MenuLevelItem;
|
|
8
10
|
handleNavMenuClick: (id: string | null, level: string) => void;
|
|
9
11
|
isLoggedIn: boolean;
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
|
|
7
7
|
const NavContext = React.createContext({
|
|
8
|
-
|
|
8
|
+
backToPreviousCategoryLabel: '',
|
|
9
|
+
categoryCollectionText: '',
|
|
9
10
|
collapseSize: 767,
|
|
10
11
|
currentUrl: '',
|
|
12
|
+
featuredItemsAriaLabel: '',
|
|
11
13
|
getBackLink: () => ({
|
|
12
14
|
id: '',
|
|
13
15
|
pageIsLinkInDesktopNavigation: false,
|
|
@@ -20,7 +22,7 @@ const NavContext = React.createContext({
|
|
|
20
22
|
isMobileMenu: false,
|
|
21
23
|
isMobileMenuOpen: false,
|
|
22
24
|
items: {},
|
|
23
|
-
lang: '
|
|
25
|
+
lang: '',
|
|
24
26
|
level1Items: {
|
|
25
27
|
level1: { id: '', pageIsLinkInDesktopNavigation: false, pages: [], titles: {}, urls: {} },
|
|
26
28
|
},
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export declare const LogoLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
2
2
|
export declare const DesktopMenuContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {
|
|
3
|
-
collapseSize: number;
|
|
3
|
+
$collapseSize: number;
|
|
4
4
|
}>> & string;
|
|
5
5
|
export declare const MobileMenuButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
6
6
|
export declare const HeaderIconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
7
|
-
collapseSize: number;
|
|
7
|
+
$collapseSize: number;
|
|
8
8
|
}>> & string;
|
|
9
9
|
export declare const MenuItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
10
|
-
isActive?: boolean;
|
|
11
|
-
isFeaturedItem?: boolean;
|
|
10
|
+
$isActive?: boolean;
|
|
11
|
+
$isFeaturedItem?: boolean;
|
|
12
12
|
}>> & string;
|
|
13
13
|
export declare const MenuLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {
|
|
14
|
-
isActive?: boolean;
|
|
14
|
+
$isActive?: boolean;
|
|
15
15
|
}>> & string;
|
|
16
16
|
export declare const MenuLinkWithChildren: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {
|
|
17
|
-
isOpen?: boolean;
|
|
17
|
+
$isOpen?: boolean;
|
|
18
18
|
}>> & string;
|
|
19
19
|
export declare const MenuList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {
|
|
20
|
-
isInView?: boolean;
|
|
20
|
+
$isInView?: boolean;
|
|
21
21
|
}>> & string;
|
|
22
22
|
export declare const FeaturedBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
23
|
-
collapseSize: number;
|
|
23
|
+
$collapseSize: number;
|
|
24
24
|
}>> & string;
|
|
@@ -14,7 +14,7 @@ const DesktopMenuContainer = styledComponents.styled.nav `
|
|
|
14
14
|
display: none;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
position: absolute;
|
|
17
|
-
@media (min-width: ${p => p
|
|
17
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
18
18
|
position: initial;
|
|
19
19
|
width: auto;
|
|
20
20
|
max-width: unset;
|
|
@@ -38,7 +38,8 @@ const MobileMenuButton = styledComponents.styled.button `
|
|
|
38
38
|
&:focus-visible {
|
|
39
39
|
outline: 0;
|
|
40
40
|
border-radius: ${theme.default.radius.s};
|
|
41
|
-
box-shadow:
|
|
41
|
+
box-shadow:
|
|
42
|
+
0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
42
43
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
43
44
|
color: ${theme.default.color.text.black};
|
|
44
45
|
}
|
|
@@ -58,31 +59,32 @@ const HeaderIconContainer = styledComponents.styled.div `
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
> div:last-child {
|
|
61
|
-
@media (min-width: ${p => p
|
|
62
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
62
63
|
display: none;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
@media (min-width: ${p => p
|
|
66
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
66
67
|
gap: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
67
68
|
}
|
|
68
69
|
`;
|
|
69
70
|
const MenuItem = styledComponents.styled.li `
|
|
70
|
-
display: ${p => (p
|
|
71
|
+
display: ${p => (p.$isFeaturedItem ? 'grid' : 'flex')};
|
|
71
72
|
align-items: center;
|
|
72
|
-
grid-template-columns: ${p => (p
|
|
73
|
+
grid-template-columns: ${p => (p.$isFeaturedItem ? '1fr 1fr' : '1fr')};
|
|
73
74
|
& > a {
|
|
74
75
|
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)}
|
|
75
76
|
${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 3)};
|
|
76
77
|
}
|
|
77
78
|
> button,
|
|
78
79
|
> a {
|
|
79
|
-
color: ${p => (p
|
|
80
|
-
justify-content: ${p => (p
|
|
80
|
+
color: ${p => (p.$isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
|
|
81
|
+
justify-content: ${p => (p.$isFeaturedItem ? 'flex-start' : 'space-between')};
|
|
81
82
|
font-size: ${theme.default.fontSize.s};
|
|
82
83
|
&:focus-visible {
|
|
83
84
|
outline: 0;
|
|
84
85
|
border-radius: ${theme.default.radius.s};
|
|
85
|
-
box-shadow:
|
|
86
|
+
box-shadow:
|
|
87
|
+
0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
86
88
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
87
89
|
}
|
|
88
90
|
${styledUtils.media.xl `
|
|
@@ -93,7 +95,7 @@ const MenuItem = styledComponents.styled.li `
|
|
|
93
95
|
const MenuLink = styledComponents.styled.a `
|
|
94
96
|
overflow: visible;
|
|
95
97
|
text-decoration: none;
|
|
96
|
-
color: ${p => (p
|
|
98
|
+
color: ${p => (p.$isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
|
|
97
99
|
> svg {
|
|
98
100
|
fill: ${theme.default.color.text.pink};
|
|
99
101
|
height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 2)};
|
|
@@ -106,9 +108,9 @@ const MenuLinkWithChildren = styledComponents.styled.a `
|
|
|
106
108
|
display: block;
|
|
107
109
|
font-family: inherit;
|
|
108
110
|
white-space: normal;
|
|
109
|
-
color: ${p => (p
|
|
111
|
+
color: ${p => (p.$isOpen ? theme.default.color.text.pink : theme.default.color.default.black)};
|
|
110
112
|
> svg {
|
|
111
|
-
transform: rotate( ${p => (p
|
|
113
|
+
transform: rotate( ${p => (p.$isOpen ? '270deg' : '90deg')});
|
|
112
114
|
transition: transform .2s ease-in-out;
|
|
113
115
|
}
|
|
114
116
|
}
|
|
@@ -118,7 +120,7 @@ const MenuList = styledComponents.styled.ul `
|
|
|
118
120
|
display: flex;
|
|
119
121
|
flex-direction: row;
|
|
120
122
|
gap: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.5)};
|
|
121
|
-
max-height: ${p => (typeof p
|
|
123
|
+
max-height: ${p => (typeof p.$isInView !== 'boolean' || p.$isInView ? 'auto' : '5px')};
|
|
122
124
|
margin: 0;
|
|
123
125
|
padding: 0;
|
|
124
126
|
background-color: ${theme.default.color.background.white};
|
|
@@ -143,12 +145,9 @@ const MenuList = styledComponents.styled.ul `
|
|
|
143
145
|
const FeaturedBlock = styledComponents.styled.li `
|
|
144
146
|
background-color: ${theme.default.color.background.sand.E01};
|
|
145
147
|
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1)};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
grid-column: 4;
|
|
150
|
-
grid-row: 1/4;
|
|
151
|
-
@media (min-width: ${p => p.collapseSize + 1}px) {
|
|
148
|
+
list-style: none;
|
|
149
|
+
|
|
150
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
152
151
|
${common.default({ elevation: 'high' })};
|
|
153
152
|
border-radius: 0
|
|
154
153
|
border-width: 0 0 0 1px;
|
|
@@ -157,11 +156,17 @@ const FeaturedBlock = styledComponents.styled.li `
|
|
|
157
156
|
${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)}
|
|
158
157
|
${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 2)}
|
|
159
158
|
${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 3)};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
}
|
|
160
|
+
section {
|
|
161
|
+
display: grid;
|
|
162
|
+
grid-template-columns: 1fr 1fr;
|
|
163
|
+
@media (min-width: ${p => p.$collapseSize + 1}px) {
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
gap: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.5)};
|
|
167
|
+
align-items: stretch;
|
|
168
|
+
justify-content: flex-start;
|
|
169
|
+
}
|
|
165
170
|
}
|
|
166
171
|
a {
|
|
167
172
|
font-weight: ${theme.default.fontWeight.bold};
|
|
@@ -53,7 +53,8 @@ const ButtonCloseStyled = styledComponents.styled(ButtonClose.default) `
|
|
|
53
53
|
|
|
54
54
|
&:focus-visible {
|
|
55
55
|
outline: none;
|
|
56
|
-
box-shadow:
|
|
56
|
+
box-shadow:
|
|
57
|
+
0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
57
58
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
58
59
|
}
|
|
59
60
|
`;
|
|
@@ -76,7 +76,8 @@ const Label = styledComponents.styled.label `
|
|
|
76
76
|
|
|
77
77
|
&:focus-within, *:focus > & {
|
|
78
78
|
outline: none;
|
|
79
|
-
box-shadow:
|
|
79
|
+
box-shadow:
|
|
80
|
+
0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
80
81
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
81
82
|
}
|
|
82
83
|
|
|
@@ -79,7 +79,8 @@ const Input = styledComponents.styled.input `
|
|
|
79
79
|
|
|
80
80
|
&:focus-visible {
|
|
81
81
|
outline: none;
|
|
82
|
-
box-shadow:
|
|
82
|
+
box-shadow:
|
|
83
|
+
0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
83
84
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
84
85
|
}
|
|
85
86
|
`;
|
|
@@ -87,7 +88,7 @@ const Input = styledComponents.styled.input `
|
|
|
87
88
|
const RadioButtonComponent = (_a) => {
|
|
88
89
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
89
90
|
return (React__default.default.createElement(Container, { className: props.className, "data-testid": dataTestId },
|
|
90
|
-
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "radio", checked: props.checked, value: props.value, disabled: props.disabled, onChange: props.onChange, "data-testid": dataTestId && `${dataTestId}-input` }),
|
|
91
|
+
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "radio", checked: props.checked, value: props.value, disabled: props.disabled, onChange: props.onChange, "data-checked": Boolean(props.checked), "data-testid": dataTestId && `${dataTestId}-input` }),
|
|
91
92
|
props.label && (React__default.default.createElement("label", { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label` }, props.label))));
|
|
92
93
|
};
|
|
93
94
|
const StyledFieldset = styledComponents.styled.fieldset `
|
|
@@ -104,7 +105,7 @@ const RadioButtonGroup = ({ label, description, groupName, value, onChange, id,
|
|
|
104
105
|
const descriptionId = `${baseId}-description`;
|
|
105
106
|
const combinedDescribedBy = [description ? descriptionId : undefined].filter(Boolean).join(' ');
|
|
106
107
|
const content = children ||
|
|
107
|
-
(options === null || options === void 0 ? void 0 : options.map(option => (React__default.default.createElement(RadioButtonComponent, { key: option.id, id: option.id, name: groupName, value: option.value, label: option.label, disabled: option.disabled, checked: value === option.value, onChange: onChange, className: option.className, "data-testid": option['data-testid']
|
|
108
|
+
(options === null || options === void 0 ? void 0 : options.map(option => (React__default.default.createElement(RadioButtonComponent, { key: option.id, id: option.id, name: groupName, value: option.value, label: option.label, disabled: option.disabled, checked: value === option.value, onChange: onChange, className: option.className, "data-testid": option['data-testid'] }))));
|
|
108
109
|
const Wrapper = isFieldset ? StyledFieldset : 'div';
|
|
109
110
|
const renderLabel = () => {
|
|
110
111
|
if (!label)
|
|
@@ -76,7 +76,9 @@ const SecondaryNavigationList = styledComponents.styled.ul `
|
|
|
76
76
|
overflow: hidden;
|
|
77
77
|
display: flex;
|
|
78
78
|
flex-direction: column;
|
|
79
|
-
transition:
|
|
79
|
+
transition:
|
|
80
|
+
max-height 0.2s ease-in-out,
|
|
81
|
+
border-bottom 0.2s linear;
|
|
80
82
|
background-color: ${({ isOpen }) => isOpen ? theme.default.color.background.white.default : 'transparent'};
|
|
81
83
|
max-height: ${({ isOpen }) => (isOpen ? '500vh' : '0')};
|
|
82
84
|
border-bottom: ${({ isOpen }) => (isOpen ? `1px solid ${theme.default.color.line.L03}` : 'none')};
|
|
@@ -113,9 +113,8 @@ const Switch = (_a) => {
|
|
|
113
113
|
onChange(!props.isChecked);
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
|
-
const accessibleLabel = props.label ? undefined : ariaLabel || 'Toggle switch';
|
|
117
116
|
return (React__namespace.createElement(Container, { className: props.className, "data-testid": dataTestId },
|
|
118
|
-
React__namespace.createElement(Checkbox, { id: props.id, name: props.name, checked: Boolean(props.isChecked), "aria-label":
|
|
117
|
+
React__namespace.createElement(Checkbox, { id: props.id, name: props.name, checked: Boolean(props.isChecked), "aria-label": ariaLabel, disabled: props.disabled, onChange: handleChange, role: "switch", type: "checkbox", "data-checked": Boolean(props.isChecked) }),
|
|
119
118
|
React__namespace.createElement(LabelWrapper, { htmlFor: props.id },
|
|
120
119
|
React__namespace.createElement(Rail, { "$isChecked": props.isChecked },
|
|
121
120
|
React__namespace.createElement(Button, { "$isChecked": props.isChecked })),
|
|
@@ -33,7 +33,8 @@ const Helper = styledComponents.styled.button `
|
|
|
33
33
|
|
|
34
34
|
&:focus-visible {
|
|
35
35
|
outline: none;
|
|
36
|
-
box-shadow:
|
|
36
|
+
box-shadow:
|
|
37
|
+
0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
37
38
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
38
39
|
border-radius: 100%;
|
|
39
40
|
}
|