@dnanpm/styleguide 3.9.13 → 3.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/build/cjs/components/Box/Box.d.ts +4 -0
- package/build/cjs/components/Box/Box.js +1 -1
- package/build/cjs/components/Button/Button.d.ts +4 -0
- package/build/cjs/components/Button/Button.js +1 -1
- package/build/cjs/components/ButtonArrow/ButtonArrow.js +9 -2
- package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +4 -0
- package/build/cjs/components/ButtonIcon/ButtonIcon.js +49 -13
- package/build/cjs/components/Carousel/Carousel.js +4 -1
- package/build/cjs/components/Checkbox/Checkbox.js +1 -1
- package/build/cjs/components/EnergyLabel/EnergyLabel.d.ts +65 -0
- package/build/cjs/components/EnergyLabel/EnergyLabel.js +98 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +2 -3
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +15 -16
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +1 -2
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.d.ts +2 -2
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +5 -7
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +3 -5
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +5 -5
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +4 -4
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.d.ts +3 -2
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +6 -10
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +3 -3
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/PageSearch.js +3 -5
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -1
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.js +7 -7
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.js +6 -0
- package/build/cjs/components/Notification/Notification.js +3 -3
- package/build/cjs/components/Overlay/Overlay.d.ts +64 -3
- package/build/cjs/components/Overlay/Overlay.js +11 -8
- package/build/cjs/components/Pill/Pill.js +1 -1
- package/build/cjs/components/PriorityNavigation/PriorityNavigation.d.ts +0 -4
- package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +18 -9
- package/build/cjs/components/RadioButton/RadioButton.js +1 -1
- package/build/cjs/components/Switch/Switch.js +1 -1
- package/build/cjs/components/index.d.ts +1 -0
- package/build/cjs/index.js +2 -0
- package/build/es/components/Box/Box.d.ts +4 -0
- package/build/es/components/Box/Box.js +1 -1
- package/build/es/components/Button/Button.d.ts +4 -0
- package/build/es/components/Button/Button.js +1 -1
- package/build/es/components/ButtonArrow/ButtonArrow.js +10 -3
- package/build/es/components/ButtonIcon/ButtonIcon.d.ts +4 -0
- package/build/es/components/ButtonIcon/ButtonIcon.js +49 -13
- package/build/es/components/Carousel/Carousel.js +4 -1
- package/build/es/components/Checkbox/Checkbox.js +1 -1
- package/build/es/components/EnergyLabel/EnergyLabel.d.ts +65 -0
- package/build/es/components/EnergyLabel/EnergyLabel.js +90 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +2 -3
- package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +15 -16
- package/build/es/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +1 -2
- package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.d.ts +2 -2
- package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +5 -7
- package/build/es/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +3 -5
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +5 -5
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +4 -4
- package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.d.ts +3 -2
- package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +6 -10
- package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +3 -3
- package/build/es/components/MainHeaderNavigation/ChildComponents/PageSearch.js +3 -5
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -1
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.js +8 -8
- package/build/es/components/MainHeaderNavigation/globalNavStyles.js +6 -0
- package/build/es/components/Notification/Notification.js +3 -3
- package/build/es/components/Overlay/Overlay.d.ts +64 -3
- package/build/es/components/Overlay/Overlay.js +11 -8
- package/build/es/components/Pill/Pill.js +1 -1
- package/build/es/components/PriorityNavigation/PriorityNavigation.d.ts +0 -4
- package/build/es/components/PriorityNavigation/PriorityNavigation.js +18 -9
- package/build/es/components/RadioButton/RadioButton.js +1 -1
- package/build/es/components/Switch/Switch.js +1 -1
- package/build/es/components/index.d.ts +1 -0
- package/build/es/index.js +1 -0
- package/package.json +2 -2
|
@@ -65,6 +65,10 @@ interface Props {
|
|
|
65
65
|
* e.g., "important information" or "example."
|
|
66
66
|
*/
|
|
67
67
|
ariaLabel?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Screen reader live region policy for the box content
|
|
70
|
+
*/
|
|
71
|
+
ariaLive?: 'off' | 'polite' | 'assertive';
|
|
68
72
|
/**
|
|
69
73
|
* Allows to pass a role to the component
|
|
70
74
|
*/
|
|
@@ -26,7 +26,7 @@ const BoxWrapper = styled__default.default.div `
|
|
|
26
26
|
`;
|
|
27
27
|
const Box = (_a) => {
|
|
28
28
|
var { elevation = 'none', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["elevation", 'data-testid']);
|
|
29
|
-
return (React__default.default.createElement(BoxWrapper, { id: props.id, "$elevation": elevation, shadow: props.shadow, width: props.width, height: props.height, margin: props.margin, padding: props.padding, className: props.className, "data-testid": dataTestId, role: props.role, "aria-label": props.ariaLabel }, props.children));
|
|
29
|
+
return (React__default.default.createElement(BoxWrapper, { id: props.id, "$elevation": elevation, shadow: props.shadow, width: props.width, height: props.height, margin: props.margin, padding: props.padding, className: props.className, "data-testid": dataTestId, role: props.role, "aria-label": props.ariaLabel, "aria-live": props.ariaLive }, props.children));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
exports.default = Box;
|
|
@@ -24,6 +24,10 @@ export interface Props {
|
|
|
24
24
|
* Allows to change the type of resulting HTML element from button (`<button></button>`) to anchor (`<a href="..."></a>`)
|
|
25
25
|
*/
|
|
26
26
|
href?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Allows to set the target attribute for the link
|
|
29
|
+
*/
|
|
30
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
|
27
31
|
/**
|
|
28
32
|
* Content of Button component
|
|
29
33
|
*/
|
|
@@ -123,7 +123,7 @@ const Element = styled__default.default.button `
|
|
|
123
123
|
/** @visibleName Button */
|
|
124
124
|
const Button = (_a) => {
|
|
125
125
|
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value', 'aria-label']);
|
|
126
|
-
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
|
|
126
|
+
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, target: props.href ? props.target : undefined, rel: props.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
|
|
127
127
|
name: props.name,
|
|
128
128
|
disabled: props.disabled,
|
|
129
129
|
})), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.plum, label: props.loadingLabel })) : (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
@@ -10,7 +10,6 @@ var theme = require('../../themes/theme.js');
|
|
|
10
10
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
11
|
var ButtonPrimary = require('../ButtonPrimary/ButtonPrimary.js');
|
|
12
12
|
var ButtonSecondary = require('../ButtonSecondary/ButtonSecondary.js');
|
|
13
|
-
var Icon = require('../Icon/Icon.js');
|
|
14
13
|
|
|
15
14
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
15
|
|
|
@@ -73,7 +72,15 @@ const buttonsMap = {
|
|
|
73
72
|
const ButtonArrow = (_a) => {
|
|
74
73
|
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value', 'aria-label']);
|
|
75
74
|
const Element = buttonsMap[variant];
|
|
76
|
-
|
|
75
|
+
let iconElement = null;
|
|
76
|
+
if (props.direction) {
|
|
77
|
+
const IconComponent = iconsMap[props.direction];
|
|
78
|
+
iconElement = React__default.default.createElement(IconComponent, { size: "1rem" });
|
|
79
|
+
}
|
|
80
|
+
else if (React.isValidElement(props.icon)) {
|
|
81
|
+
iconElement = React.cloneElement(props.icon, { size: '1rem' });
|
|
82
|
+
}
|
|
83
|
+
return (React__default.default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes, "aria-label": ariaLabel }, iconElement));
|
|
77
84
|
};
|
|
78
85
|
|
|
79
86
|
exports.default = ButtonArrow;
|
|
@@ -30,6 +30,10 @@ interface Props extends Omit<ButtonProps, 'fullWidth'> {
|
|
|
30
30
|
* Screen reader label describing the purpose of the ButtonIcon,
|
|
31
31
|
*/
|
|
32
32
|
ariaLabel?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Show the element with link color (pink)
|
|
35
|
+
*/
|
|
36
|
+
isLinkStyle?: boolean;
|
|
33
37
|
}
|
|
34
38
|
/** @visibleName Button Icon */
|
|
35
39
|
declare const ButtonIcon: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -16,6 +16,47 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
17
|
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
18
18
|
|
|
19
|
+
const getStandardStyle = ({ isLinkStyle }) => {
|
|
20
|
+
const colorValue = isLinkStyle ? theme.default.color.default.pink : theme.default.color.text.black;
|
|
21
|
+
const colorHoverValue = isLinkStyle ? theme.default.color.hover.pink : theme.default.color.text.black;
|
|
22
|
+
return `
|
|
23
|
+
color: ${colorValue};
|
|
24
|
+
&:focus-visible {
|
|
25
|
+
border: 2px solid ${theme.default.color.focus.light};
|
|
26
|
+
box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.dark};
|
|
27
|
+
}
|
|
28
|
+
&:hover {
|
|
29
|
+
color: ${colorHoverValue};
|
|
30
|
+
}
|
|
31
|
+
&:active {
|
|
32
|
+
color: ${theme.default.color.text.black + theme.default.color.transparency.T80};
|
|
33
|
+
}
|
|
34
|
+
&:disabled,
|
|
35
|
+
&[disabled] {
|
|
36
|
+
color: ${theme.default.color.text.gray};
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
};
|
|
40
|
+
const getDarkBgStyle = () => {
|
|
41
|
+
const colorValue = theme.default.color.text.white;
|
|
42
|
+
return `
|
|
43
|
+
color: ${colorValue};
|
|
44
|
+
&:focus-visible {
|
|
45
|
+
border: 2px solid ${theme.default.color.focus.dark};
|
|
46
|
+
box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.light};
|
|
47
|
+
}
|
|
48
|
+
&:hover {
|
|
49
|
+
color: ${colorValue};
|
|
50
|
+
}
|
|
51
|
+
&:active {
|
|
52
|
+
color: ${colorValue + theme.default.color.transparency.T90};
|
|
53
|
+
}
|
|
54
|
+
&:disabled,
|
|
55
|
+
&[disabled] {
|
|
56
|
+
color: ${colorValue + theme.default.color.transparency.T70};
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
};
|
|
19
60
|
const ButtonElement = styled__default.default.button `
|
|
20
61
|
display: inline-flex;
|
|
21
62
|
align-items: center;
|
|
@@ -24,10 +65,11 @@ const ButtonElement = styled__default.default.button `
|
|
|
24
65
|
font-size: ${({ small }) => (small ? theme.default.fontSize.s : theme.default.fontSize.default)};
|
|
25
66
|
line-height: ${({ small }) => (small ? theme.default.lineHeight.xs : theme.default.lineHeight.default)};
|
|
26
67
|
cursor: pointer;
|
|
27
|
-
color: ${({ darkBg }) => (darkBg ? theme.default.color.text.white : theme.default.color.text.black)};
|
|
28
68
|
background-color: transparent;
|
|
29
69
|
border: 2px solid transparent;
|
|
30
70
|
padding: ${styledUtils.getDividedSize(theme.default.base.baseWidth, 5)} 0;
|
|
71
|
+
text-align: left;
|
|
72
|
+
transition: all 0.2s ease-in-out;
|
|
31
73
|
|
|
32
74
|
& svg {
|
|
33
75
|
pointer-events: none;
|
|
@@ -35,29 +77,23 @@ const ButtonElement = styled__default.default.button `
|
|
|
35
77
|
|
|
36
78
|
${({ isReversed }) => isReversed && `flex-direction: row-reverse;`}
|
|
37
79
|
|
|
80
|
+
${({ darkBg, isLinkStyle }) => (darkBg ? getDarkBgStyle() : getStandardStyle({ isLinkStyle }))}
|
|
81
|
+
|
|
38
82
|
&:focus-visible {
|
|
39
83
|
border-radius: ${theme.default.radius.s};
|
|
40
84
|
text-decoration: underline;
|
|
41
|
-
border: 2px solid
|
|
42
|
-
${({ darkBg }) => (darkBg ? theme.default.color.focus.dark : theme.default.color.focus.light)};
|
|
43
|
-
box-shadow: 0px 0px 0px 2px
|
|
44
|
-
${({ darkBg }) => (darkBg ? theme.default.color.focus.light : theme.default.color.focus.dark)};
|
|
45
85
|
outline: none;
|
|
46
86
|
}
|
|
47
87
|
|
|
48
88
|
&:hover {
|
|
49
89
|
text-decoration: underline;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
color: ${({ darkBg }) => darkBg
|
|
54
|
-
? theme.default.color.text.white + theme.default.color.transparency.T90
|
|
55
|
-
: theme.default.color.text.black + theme.default.color.transparency.T80};
|
|
90
|
+
text-underline-offset: 0.2em;
|
|
91
|
+
text-decoration-skip-ink: auto;
|
|
92
|
+
text-decoration-thickness: from-font;
|
|
56
93
|
}
|
|
57
94
|
|
|
58
95
|
&:disabled,
|
|
59
96
|
&[disabled] {
|
|
60
|
-
color: ${({ darkBg }) => darkBg ? theme.default.color.text.white + theme.default.color.transparency.T70 : theme.default.color.text.gray};
|
|
61
97
|
pointer-events: none;
|
|
62
98
|
}
|
|
63
99
|
|
|
@@ -92,7 +128,7 @@ const ButtonElement = styled__default.default.button `
|
|
|
92
128
|
const ButtonIcon = React.forwardRef((_a, ref) => {
|
|
93
129
|
var { icon = icons.EditUnderline, 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["icon", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
94
130
|
const position = props.isReversed ? 'right' : 'left';
|
|
95
|
-
return (React__default.default.createElement(ButtonElement, Object.assign({ ref: ref, id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, hideChildrenMobile: props.hideChildrenMobile, isReversed: props.isReversed, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded, "aria-label": props.ariaLabel }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black, label: props.loadingLabel })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
131
|
+
return (React__default.default.createElement(ButtonElement, Object.assign({ ref: ref, id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, hideChildrenMobile: props.hideChildrenMobile, isReversed: props.isReversed, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded, "aria-label": props.ariaLabel, isLinkStyle: props.isLinkStyle }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black, label: props.loadingLabel })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
96
132
|
React__default.default.createElement(Icon.default, { icon: icon, color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined, "aria-hidden": true }),
|
|
97
133
|
props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
|
|
98
134
|
});
|
|
@@ -184,7 +184,8 @@ const Carousel = (_a) => {
|
|
|
184
184
|
};
|
|
185
185
|
const visibleItems = props.visibleItems || calculatedItems;
|
|
186
186
|
const slidesWrapperGapSizePx = 20;
|
|
187
|
-
const
|
|
187
|
+
const slidesCount = React.Children.count(props.children);
|
|
188
|
+
const slideScreensCount = Math.max(1, slidesCount - Math.floor(visibleItems) + 1);
|
|
188
189
|
const step = getStep((_b = props.swipeStep) !== null && _b !== void 0 ? _b : 1, visibleItems);
|
|
189
190
|
const currentStepIndex = Math.ceil(currentIndex / step);
|
|
190
191
|
const totalSwipeSteps = Math.ceil(slideScreensCount / step + ((slideScreensCount - 1) % step !== 0 ? 1 : 0));
|
|
@@ -306,6 +307,8 @@ const Carousel = (_a) => {
|
|
|
306
307
|
setIsSwiping(false);
|
|
307
308
|
};
|
|
308
309
|
const handleSlidesPointerDown = (e) => {
|
|
310
|
+
if (e.button !== 0)
|
|
311
|
+
return;
|
|
309
312
|
if (slidesWrapperRef.current && scrollbarRef.current && knobRef.current) {
|
|
310
313
|
data.startX = e.pageX;
|
|
311
314
|
data.startTime = Date.now();
|
|
@@ -118,7 +118,7 @@ const Checkbox = (_a) => {
|
|
|
118
118
|
};
|
|
119
119
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
120
120
|
React__default.default.createElement(Container, null,
|
|
121
|
-
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId, "aria-required": props.required, "aria-invalid": props.error ? 'true' : undefined, "aria-errormessage": props.error && props.errorMessage ? errorId : undefined }),
|
|
121
|
+
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId, "aria-required": props.required, "aria-invalid": props.error ? 'true' : undefined, "aria-errormessage": props.error && props.errorMessage ? errorId : undefined, "data-checked": Boolean(props.value) }),
|
|
122
122
|
React__default.default.createElement("label", { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label` },
|
|
123
123
|
props.label,
|
|
124
124
|
props.required && React__default.default.createElement(Mandatory, null, "*"))),
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* Unique ID for the component
|
|
5
|
+
*/
|
|
6
|
+
id?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Allows to pass a custom className
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Allows to pass testid string for testing purposes
|
|
13
|
+
*/
|
|
14
|
+
'data-testid'?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Allows to pass a screen reader label to the component
|
|
17
|
+
*/
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Allows to set property `aria-label` for `ButtonClose` element
|
|
21
|
+
*/
|
|
22
|
+
closeButtonLabel?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Allows to set the source of the badge image
|
|
25
|
+
*/
|
|
26
|
+
badgeSrc: string;
|
|
27
|
+
/**
|
|
28
|
+
* Allows to set the title of the modal
|
|
29
|
+
*/
|
|
30
|
+
modalTitle?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Allows to set the source of the image in the modal
|
|
33
|
+
*/
|
|
34
|
+
modalImageSrc?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Allows to set the label of the modal
|
|
37
|
+
*/
|
|
38
|
+
modalLabel?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Allows to set the label of the button that opens the PDF
|
|
41
|
+
*/
|
|
42
|
+
pdfButtonLabel?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Allows to set the href of the PDF file
|
|
45
|
+
*/
|
|
46
|
+
pdfHref?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Allows to set the label for the error state
|
|
49
|
+
*/
|
|
50
|
+
errorLabel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Allows to set the title for the error state
|
|
53
|
+
*/
|
|
54
|
+
errorTitle?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Allows to hide application from assistive screenreaders and other assistive technologies while the modal is open
|
|
57
|
+
*
|
|
58
|
+
* @default '#__next'
|
|
59
|
+
*/
|
|
60
|
+
modalAppElement?: string;
|
|
61
|
+
}
|
|
62
|
+
/** @visibleName Energy Label */
|
|
63
|
+
declare const EnergyLabel: ({ "data-testid": dataTestId, modalAppElement, ...props }: Props) => React.JSX.Element | null;
|
|
64
|
+
/** @component */
|
|
65
|
+
export default EnergyLabel;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var icons = require('@dnanpm/icons');
|
|
8
|
+
var Modal = require('../Modal/Modal.js');
|
|
9
|
+
var styled = require('../../themes/styled.js');
|
|
10
|
+
var styledUtils = require('../../utils/styledUtils.js');
|
|
11
|
+
var Button = require('../Button/Button.js');
|
|
12
|
+
var theme = require('../../themes/theme.js');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
+
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
|
+
|
|
18
|
+
const ERROR_IMAGE = 'https://res.cloudinary.com/dnaoyj/image/upload/v1731073400/Assets/KLT/Enriched%20icons/enriched-error-state.png';
|
|
19
|
+
const ButtonElement = styled.default.button `
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
border: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
`;
|
|
28
|
+
const StyledModal = styled.default(Modal.default) `
|
|
29
|
+
> div > div {
|
|
30
|
+
max-height: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
width: 100%;
|
|
33
|
+
margin: 0;
|
|
34
|
+
|
|
35
|
+
${styledUtils.media.xs `
|
|
36
|
+
width: 23.438rem;
|
|
37
|
+
height: 50rem;
|
|
38
|
+
border-radius: ${theme.default.radius.default};
|
|
39
|
+
`};
|
|
40
|
+
|
|
41
|
+
> div {
|
|
42
|
+
border-radius: 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const ModalLabel = styled.default.p `
|
|
47
|
+
font-size: ${theme.default.fontSize.s};
|
|
48
|
+
margin: 0;
|
|
49
|
+
`;
|
|
50
|
+
const ButtonContent = styled.default.span `
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 0.5)};
|
|
54
|
+
`;
|
|
55
|
+
const ErrorContainer = styled.default.div `
|
|
56
|
+
display: flex;
|
|
57
|
+
padding-top: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 2)};
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
text-align: center;
|
|
60
|
+
align-items: center;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 3)};
|
|
63
|
+
`;
|
|
64
|
+
const Image = styled.default.img `
|
|
65
|
+
width: ${p => p.imgWidth};
|
|
66
|
+
`;
|
|
67
|
+
/** @visibleName Energy Label */
|
|
68
|
+
const EnergyLabel = (_a) => {
|
|
69
|
+
var { 'data-testid': dataTestId, modalAppElement = '#__next' } = _a, props = tslib.__rest(_a, ['data-testid', "modalAppElement"]);
|
|
70
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
71
|
+
const [hasError, setHasError] = React.useState(false);
|
|
72
|
+
const [imgError, setImgError] = React.useState(false);
|
|
73
|
+
const handleOpen = () => {
|
|
74
|
+
setIsOpen(true);
|
|
75
|
+
};
|
|
76
|
+
const handleClose = () => {
|
|
77
|
+
setIsOpen(false);
|
|
78
|
+
};
|
|
79
|
+
const renderFooter = () => (React__default.default.createElement(Button.default, { fullWidth: true, href: props.pdfHref, target: "_blank" },
|
|
80
|
+
React__default.default.createElement(ButtonContent, null,
|
|
81
|
+
props.pdfButtonLabel,
|
|
82
|
+
" ",
|
|
83
|
+
React__default.default.createElement(icons.Open, null))));
|
|
84
|
+
if (imgError) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
88
|
+
React__default.default.createElement(ButtonElement, { onClick: handleOpen, "aria-label": props.ariaLabel, "data-testid": dataTestId, id: props.id, className: props.className },
|
|
89
|
+
React__default.default.createElement(Image, { src: props.badgeSrc, alt: "", "aria-hidden": true, imgWidth: "55px", onError: () => setImgError(true) })),
|
|
90
|
+
React__default.default.createElement(StyledModal, { appElement: modalAppElement, isOpen: isOpen, onRequestClose: handleClose, title: props.modalTitle, closeLabel: props.closeButtonLabel, footer: renderFooter() }, hasError || !props.modalImageSrc ? (React__default.default.createElement(ErrorContainer, null,
|
|
91
|
+
React__default.default.createElement("h3", null, props.errorTitle),
|
|
92
|
+
React__default.default.createElement(Image, { src: ERROR_IMAGE, alt: "", imgWidth: "160px" }),
|
|
93
|
+
React__default.default.createElement("p", null, props.errorLabel))) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
94
|
+
React__default.default.createElement(Image, { src: props.modalImageSrc, alt: "", imgWidth: "100%", onError: () => setHasError(true) }),
|
|
95
|
+
React__default.default.createElement(ModalLabel, null, props.modalLabel))))));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.default = EnergyLabel;
|
|
@@ -47,8 +47,7 @@ const BusinessMenuLink = styled.default.a `
|
|
|
47
47
|
const BusinessMenuList = styled.default.nav `
|
|
48
48
|
display: flex;
|
|
49
49
|
gap: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
|
|
50
|
-
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)}
|
|
51
|
-
${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
|
|
50
|
+
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)} ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
|
|
52
51
|
${styledUtils.media.md `
|
|
53
52
|
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1)} ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1.5)};
|
|
54
53
|
`};
|
|
@@ -57,7 +56,7 @@ const BusinessMenu = ({ ariaLabel, currentBusinessId, items, lang }) => {
|
|
|
57
56
|
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
58
57
|
return null;
|
|
59
58
|
}
|
|
60
|
-
return (React__default.default.createElement(BusinessMenuList, { "aria-label": ariaLabel, "data-testid": "business-menu"
|
|
59
|
+
return (React__default.default.createElement(BusinessMenuList, { "aria-label": ariaLabel, "data-testid": "business-menu" }, items.map(item => (React__default.default.createElement(BusinessMenuLink, { className: `menu-link ${item.businessId === currentBusinessId ? 'active-site' : ''}`, href: item.urls[lang], isActive: item.businessId === currentBusinessId, key: item.businessId }, item.titles[lang])))));
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
exports.default = BusinessMenu;
|
|
@@ -36,13 +36,12 @@ const noAnimation = styled.css `
|
|
|
36
36
|
const MegaMenuContent = styled.default.ul `
|
|
37
37
|
display: grid;
|
|
38
38
|
grid-template-columns: 25% 25% 25% 25%;
|
|
39
|
-
padding-left: 0;
|
|
40
39
|
`;
|
|
41
|
-
const CategoryTitle = styled.default.
|
|
40
|
+
const CategoryTitle = styled.default.h2 `
|
|
42
41
|
display: flex;
|
|
43
42
|
font-size: ${theme.default.fontSize.default};
|
|
44
43
|
line-height: ${theme.default.lineHeight.default};
|
|
45
|
-
|
|
44
|
+
margin: 0;
|
|
46
45
|
padding: 0 ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 2)}
|
|
47
46
|
${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
|
|
48
47
|
${styledUtils.media.xl `
|
|
@@ -129,21 +128,21 @@ const SubMenuLevel1 = ({ menuItem }) => {
|
|
|
129
128
|
const pagesWithSubItems = menuItem.pages.filter(element => element.pages.length > 0);
|
|
130
129
|
// Helper function to render a sub menu item
|
|
131
130
|
const renderSubMenuItem = (element, index, currUrl) => (React__default.default.createElement(SubMenuItem, { key: element.id, isHighlighted: LinkModifier.isSelected(currUrl, element.urls[lang], true), "data-testid": `desktop-nav-item-level-2-${index + 1}` },
|
|
132
|
-
React__default.default.createElement(LinkModifier.default, { menuItem: element,
|
|
131
|
+
React__default.default.createElement(LinkModifier.default, { menuItem: element, disabledTabIndex: false })));
|
|
133
132
|
if (!level1HasElements) {
|
|
134
133
|
return null;
|
|
135
134
|
}
|
|
136
135
|
return (React__default.default.createElement(SubMenuList, { "aria-hidden": false, menuStates: menuLevel, navItemId: menuItem.id, navZIndex: navZIndex },
|
|
137
|
-
React__default.default.createElement(MegaMenuContent,
|
|
136
|
+
React__default.default.createElement(MegaMenuContent, { "aria-labelledby": `menu-id-${menuItem.id}` },
|
|
138
137
|
pagesWithSubItems.slice(0, 5).map(element => (React__default.default.createElement(CategoryBlock, { key: element.id },
|
|
139
|
-
React__default.default.createElement(CategoryTitle,
|
|
140
|
-
React__default.default.createElement("ul", { "data-testid": "desktop-nav-menu-ul-level-2" }, element.pages.map((subElement, index) => renderSubMenuItem(subElement, index, currentUrl)))))),
|
|
138
|
+
React__default.default.createElement(CategoryTitle, { id: `menu-id-${element.id}` }, element.titles[lang]),
|
|
139
|
+
React__default.default.createElement("ul", { "aria-labelledby": `menu-id-${element.id}`, "data-testid": "desktop-nav-menu-ul-level-2" }, element.pages.map((subElement, index) => renderSubMenuItem(subElement, index, currentUrl)))))),
|
|
141
140
|
pagesWithSubItems.length > 5 && (React__default.default.createElement(CategoryCollectionBlock, null,
|
|
142
|
-
React__default.default.createElement(CategoryTitle,
|
|
143
|
-
React__default.default.createElement("ul", { "data-testid": "desktop-nav-menu-ul-level-2" }, pagesWithSubItems
|
|
141
|
+
React__default.default.createElement(CategoryTitle, { id: "misc-categories" }, categoryCollectionText),
|
|
142
|
+
React__default.default.createElement("ul", { "aria-labelledby": "misc-categories", "data-testid": "desktop-nav-menu-ul-level-2" }, pagesWithSubItems
|
|
144
143
|
.slice(5)
|
|
145
144
|
.map((element, index) => renderSubMenuItem(element, index, currentUrl))))),
|
|
146
|
-
React__default.default.createElement(globalNavStyles.FeaturedBlock, { collapseSize: collapseSize, "data-testid": "desktop-nav-menu-level-2-featured" }, menuItem.pages.map(element => element.pages.length ? null : (React__default.default.createElement(LinkModifier.default, { key: element.id, showIcon: true, menuItem: element,
|
|
145
|
+
React__default.default.createElement(globalNavStyles.FeaturedBlock, { collapseSize: collapseSize, "data-testid": "desktop-nav-menu-level-2-featured" }, menuItem.pages.map(element => element.pages.length ? null : (React__default.default.createElement(LinkModifier.default, { key: element.id, showIcon: true, menuItem: element, disabledTabIndex: false })))))));
|
|
147
146
|
};
|
|
148
147
|
const MenuItemWithChildren = ({ menuItem, currentLevel }) => {
|
|
149
148
|
const { lang, handleNavMenuClick, currentUrl, menuLevel } = React.useContext(NavContext.default);
|
|
@@ -152,9 +151,9 @@ const MenuItemWithChildren = ({ menuItem, currentLevel }) => {
|
|
|
152
151
|
e.preventDefault();
|
|
153
152
|
handleNavMenuClick(element.id, 'level1');
|
|
154
153
|
};
|
|
155
|
-
return (React__default.default.createElement(DesktopMenuItem, { isActive: LinkModifier.isSelected(currentUrl,
|
|
156
|
-
React__default.default.createElement(globalNavStyles.MenuLinkWithChildren, { isOpen: menuLevel.level1 === menuItem.id, onClick: menuClickMain(menuItem), "data-testid": "menu-button-with-children", href: linkUrl },
|
|
157
|
-
React__default.default.createElement("span",
|
|
154
|
+
return (React__default.default.createElement(DesktopMenuItem, { isActive: LinkModifier.isSelected(currentUrl, linkUrl), "data-testid": `desktop-nav-item-level-1-${currentLevel + 1}` },
|
|
155
|
+
React__default.default.createElement(globalNavStyles.MenuLinkWithChildren, { isOpen: menuLevel.level1 === menuItem.id, onClick: menuClickMain(menuItem), "data-testid": "menu-button-with-children", "aria-current": LinkModifier.isSelected(currentUrl, linkUrl) ? 'true' : undefined, "aria-expanded": menuLevel.level1 === menuItem.id, href: linkUrl },
|
|
156
|
+
React__default.default.createElement("span", { id: `menu-id-${menuItem.id}` }, menuItem.titles[lang]),
|
|
158
157
|
React__default.default.createElement(icons.ChevronRight, { size: "1rem" })),
|
|
159
158
|
React__default.default.createElement(SubMenuLevel1, { menuItem: menuItem })));
|
|
160
159
|
};
|
|
@@ -174,10 +173,10 @@ const DesktopMenu = () => {
|
|
|
174
173
|
return (React__default.default.createElement(globalNavStyles.MenuList, { "aria-hidden": false, ref: ref, "data-testid": "desktop-nav-menu-ul" }, mainNavigation.map((navElement, index) => {
|
|
175
174
|
const displaySubMenu = !navElement.pageIsLinkInDesktopNavigation && !!navElement.pages.length;
|
|
176
175
|
if (displaySubMenu) {
|
|
177
|
-
return (React__default.default.createElement(MenuItemWithChildren, {
|
|
176
|
+
return (React__default.default.createElement(MenuItemWithChildren, { currentLevel: index, key: navElement.id, menuItem: navElement }));
|
|
178
177
|
}
|
|
179
|
-
return (React__default.default.createElement(DesktopMenuItem, {
|
|
180
|
-
React__default.default.createElement(LinkModifier.default, { menuItem: navElement,
|
|
178
|
+
return (React__default.default.createElement(DesktopMenuItem, { "data-testid": `desktop-nav-item-level-1-${index + 1}`, isActive: LinkModifier.isSelected(currentUrl, navElement.urls[lang]), key: navElement.id },
|
|
179
|
+
React__default.default.createElement(LinkModifier.default, { menuItem: navElement, disabledTabIndex: false })));
|
|
181
180
|
})));
|
|
182
181
|
};
|
|
183
182
|
|
|
@@ -8,7 +8,6 @@ var styled = require('../../../themes/styled.js');
|
|
|
8
8
|
var theme = require('../../../themes/theme.js');
|
|
9
9
|
var navigation = require('../../../themes/themeComponents/navigation.js');
|
|
10
10
|
var styledUtils = require('../../../utils/styledUtils.js');
|
|
11
|
-
var Icon = require('../../Icon/Icon.js');
|
|
12
11
|
var NavContext = require('../context/NavContext.js');
|
|
13
12
|
var globalNavStyles = require('../globalNavStyles.js');
|
|
14
13
|
var MainNavTooltipMenu = require('./MainNavTooltipMenu.js');
|
|
@@ -32,7 +31,7 @@ const LanguageSelector = ({ currentLanguage, languagesObject, languageSelectorLa
|
|
|
32
31
|
return null;
|
|
33
32
|
}
|
|
34
33
|
return (React__default.default.createElement(MainNavTooltipMenu.default, { ariaLabel: languageSelectorLabel, closeWhenTagClicked: ['a'], contentComponent: LngComponent, contentWidth: "5rem", globalStateString: "lang", tooltipRight: isMobileMenu ? '13.8rem' : '11.8rem', zIndex: navZIndex + 1 },
|
|
35
|
-
React__default.default.createElement(
|
|
34
|
+
React__default.default.createElement(icons.Globe, { size: navigation.navIconSize }),
|
|
36
35
|
React__default.default.createElement("span", { "data-testid": "header-lang-label" }, currentLanguage.toUpperCase())));
|
|
37
36
|
};
|
|
38
37
|
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import type { MenuLevelItem } from '../types/globalNavProps';
|
|
3
3
|
interface LinkModifierProps {
|
|
4
4
|
menuItem: MenuLevelItem;
|
|
5
|
-
|
|
5
|
+
disabledTabIndex?: boolean;
|
|
6
6
|
showIcon?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare const isSelected: (currentUrl: string, linkUrl: string, exactMatch?: boolean) => boolean;
|
|
9
|
-
declare const LinkModifier: ({ menuItem,
|
|
9
|
+
declare const LinkModifier: ({ menuItem, disabledTabIndex, showIcon }: LinkModifierProps) => React.JSX.Element;
|
|
10
10
|
export default LinkModifier;
|
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var icons = require('@dnanpm/icons');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var theme = require('../../../themes/theme.js');
|
|
8
|
-
var Icon = require('../../Icon/Icon.js');
|
|
9
7
|
var NavContext = require('../context/NavContext.js');
|
|
10
8
|
var globalNavStyles = require('../globalNavStyles.js');
|
|
11
9
|
|
|
@@ -24,12 +22,12 @@ const isSelected = (currentUrl, linkUrl, exactMatch = false) => {
|
|
|
24
22
|
return false;
|
|
25
23
|
};
|
|
26
24
|
const isMenuItemLinkAbsolute = (menuItemLink) => menuItemLink.includes('http');
|
|
27
|
-
const LinkModifier = ({ menuItem,
|
|
28
|
-
const { lang, nextJSLinkComponent, resetMenuEvents } = React.useContext(NavContext.default);
|
|
29
|
-
const menuItemLink = menuItem.urls[lang]
|
|
25
|
+
const LinkModifier = ({ menuItem, disabledTabIndex, showIcon }) => {
|
|
26
|
+
const { lang, currentUrl, nextJSLinkComponent, resetMenuEvents } = React.useContext(NavContext.default);
|
|
27
|
+
const menuItemLink = menuItem.urls[lang];
|
|
30
28
|
const isExternalLink = menuItem.target === '_blank';
|
|
31
|
-
const MenuLinkComponent = (React__default.default.createElement(globalNavStyles.MenuLink, { href: menuItemLink, id: menuItem.id, onClick: resetMenuEvents, tabIndex:
|
|
32
|
-
showIcon && (React__default.default.createElement(
|
|
29
|
+
const MenuLinkComponent = (React__default.default.createElement(globalNavStyles.MenuLink, { "aria-current": isSelected(currentUrl, menuItemLink) ? 'page' : undefined, href: menuItemLink, id: menuItem.id, onClick: resetMenuEvents, tabIndex: disabledTabIndex ? -1 : undefined, target: isExternalLink ? '_blank' : '_self' },
|
|
30
|
+
showIcon && (isExternalLink ? React__default.default.createElement(icons.Open, null) : React__default.default.createElement(icons.ArrowRight, null)),
|
|
33
31
|
React__default.default.createElement("span", null, menuItem.titles[lang])));
|
|
34
32
|
if (nextJSLinkComponent && !isMenuItemLinkAbsolute(menuItemLink)) {
|
|
35
33
|
const NextJSLinkComponent = nextJSLinkComponent;
|
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var icons = require('@dnanpm/icons');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var navigation = require('../../../themes/themeComponents/navigation.js');
|
|
8
|
-
var Icon = require('../../Icon/Icon.js');
|
|
9
7
|
var NavContext = require('../context/NavContext.js');
|
|
10
8
|
var MainNavTooltipMenu = require('./MainNavTooltipMenu.js');
|
|
11
9
|
|
|
@@ -14,9 +12,9 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
12
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
13
|
|
|
16
14
|
const LoginTooltip = ({ isLogged, loginLabel }) => {
|
|
17
|
-
const { navZIndex, isMobileMenu, loginComponent
|
|
18
|
-
return (React__default.default.createElement(MainNavTooltipMenu.default, { ariaLabel: loginLabel, closeWhenTagClicked: ['a', 'button'], contentComponent:
|
|
19
|
-
React__default.default.createElement(
|
|
15
|
+
const { navZIndex, isMobileMenu, loginComponent } = React.useContext(NavContext.default);
|
|
16
|
+
return (React__default.default.createElement(MainNavTooltipMenu.default, { ariaLabel: loginLabel, closeWhenTagClicked: ['a', 'button'], contentComponent: loginComponent, globalStateString: "login", tooltipRight: isMobileMenu ? '3rem' : '1rem', zIndex: navZIndex + 1 }, !isLogged ? (loginLabel) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
17
|
+
React__default.default.createElement(icons.User, null),
|
|
20
18
|
React__default.default.createElement("span", { "data-testid": "header-login-label" }, loginLabel)))));
|
|
21
19
|
};
|
|
22
20
|
|
|
@@ -28,19 +28,19 @@ const IconContainer = styled.default.div `
|
|
|
28
28
|
min-width: ${navigation.IconContainerMinWidth};
|
|
29
29
|
transition: color 0.2s ease-in-out;
|
|
30
30
|
|
|
31
|
-
>
|
|
31
|
+
> svg {
|
|
32
32
|
display: block;
|
|
33
33
|
height: ${navigation.navIconSize};
|
|
34
34
|
width: ${navigation.navIconSize};
|
|
35
35
|
}
|
|
36
|
-
>
|
|
37
|
-
|
|
36
|
+
> svg,
|
|
37
|
+
+ span {
|
|
38
38
|
color: ${p => (p.isActive ? theme.default.color.text.pink : 'inherit')};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@media (min-width: ${p => p.collapseSize + 1}px) {
|
|
42
42
|
min-width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 6)};
|
|
43
|
-
|
|
43
|
+
+ span {
|
|
44
44
|
display: block;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -111,7 +111,7 @@ const MainNavTooltipMenu = (_a) => {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
return (React__default.default.createElement(IconContainer, { "data-testid": `header-${globalStateKey}-container`, collapseSize: collapseSize, ref: ref },
|
|
114
|
-
globalStateKey === 'login' && !isLoggedIn ? (React__default.default.createElement(ButtonPrimary.default, { onClick: ContentComponent ? toggleState : undefined, small: true }, children)) : (React__default.default.createElement(MainNavTooltipMenuExportedStyles.default, { "aria-label": ariaLabel, isLoggedIn: isLoginItemAndLoggedIn, collapseSize: collapseSize, isHighlighted: tooltipItems[globalStateKey] || isLoginItemAndLoggedIn, onClick: props.onCartButtonClick || (ContentComponent ? toggleState : undefined) }, children)),
|
|
114
|
+
globalStateKey === 'login' && !isLoggedIn ? (React__default.default.createElement(ButtonPrimary.default, { onClick: ContentComponent ? toggleState : undefined, small: true }, children)) : (React__default.default.createElement(MainNavTooltipMenuExportedStyles.default, { "aria-label": ariaLabel, "aria-expanded": tooltipItems[globalStateKey], isLoggedIn: isLoginItemAndLoggedIn, collapseSize: collapseSize, isHighlighted: tooltipItems[globalStateKey] || isLoginItemAndLoggedIn, onClick: props.onCartButtonClick || (ContentComponent ? toggleState : undefined) }, children)),
|
|
115
115
|
tooltipItems[globalStateKey] && ContentComponent && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
116
116
|
React__default.default.createElement(Caret, { zIndex: zIndex, collapseSize: collapseSize }),
|
|
117
117
|
React__default.default.createElement(Tooltip, { zIndex: zIndex, tooltipRight: tooltipRight, contentWidth: contentWidth, collapseSize: collapseSize, fullWidthDesktop: fullWidthDesktop, fullWidthBreakpoint: fullWidthBreakpoint },
|
|
@@ -24,7 +24,7 @@ const TooltipWrapper = styled.default.button `
|
|
|
24
24
|
border-left: ${p => (p.isLoggedIn ? `2px solid ${theme.default.color.line.L03}` : 'none')};
|
|
25
25
|
&:active,
|
|
26
26
|
&:focus {
|
|
27
|
-
|
|
27
|
+
> svg,
|
|
28
28
|
> span {
|
|
29
29
|
color: ${theme.default.color.text.pink};
|
|
30
30
|
}
|
|
@@ -34,12 +34,12 @@ const TooltipWrapper = styled.default.button `
|
|
|
34
34
|
border-radius: ${theme.default.radius.s};
|
|
35
35
|
box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
36
36
|
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
37
|
-
|
|
37
|
+
> svg,
|
|
38
38
|
> span {
|
|
39
39
|
color: ${theme.default.color.text.black};
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
> svg {
|
|
43
43
|
align-content: center;
|
|
44
44
|
display: flex;
|
|
45
45
|
margin: 0 auto;
|
|
@@ -48,7 +48,7 @@ const TooltipWrapper = styled.default.button `
|
|
|
48
48
|
width: 1.625em;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
> span {
|
|
52
52
|
display: none;
|
|
53
53
|
@media (min-width: ${p => p.collapseSize + 1}px) {
|
|
54
54
|
font-size: ${theme.default.fontSize.xs};
|