@dnanpm/styleguide 1.7.0 → 1.9.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/Accordion/Accordion.d.ts +38 -0
- package/build/cjs/components/Accordion/Accordion.js +35 -0
- package/build/cjs/components/Accordion/AccordionItem.d.ts +45 -0
- package/build/cjs/components/Accordion/AccordionItem.js +100 -0
- package/build/cjs/components/Accordion/index.d.ts +2 -0
- package/build/cjs/components/AmountSelector/AmountSelector.d.ts +66 -0
- package/build/cjs/components/AmountSelector/AmountSelector.js +84 -0
- package/build/cjs/components/Card/Card.js +1 -2
- package/build/cjs/components/Card/CardRow.js +0 -1
- package/build/cjs/components/Checkbox/Checkbox.d.ts +1 -0
- package/build/cjs/components/Checkbox/Checkbox.js +7 -2
- package/build/cjs/components/Footer/{index.d.ts → Footer.d.ts} +0 -1
- package/build/cjs/components/Footer/{index.js → Footer.js} +3 -2
- package/build/cjs/components/Footer/context/FooterContext.d.ts +1 -1
- package/build/{es/components/Helper/index.d.ts → cjs/components/Helper/Helper.d.ts} +1 -1
- package/build/cjs/components/Helper/{index.js → Helper.js} +0 -0
- package/build/cjs/components/Icon/Icons.d.ts +1 -0
- package/build/cjs/components/Icon/Icons.js +3 -0
- package/build/cjs/components/Image/{index.d.ts → Image.d.ts} +0 -0
- package/build/cjs/components/Image/{index.js → Image.js} +0 -0
- package/build/cjs/components/Input/Input.js +4 -4
- package/build/cjs/components/LabelText/LabelText.d.ts +2 -2
- package/build/cjs/components/LabelText/LabelText.js +1 -1
- package/build/cjs/components/MainNavigation/ChildComponents/BusinessMenu.js +3 -9
- package/build/cjs/components/MainNavigation/ChildComponents/DesktopMenu.js +9 -9
- package/build/cjs/components/MainNavigation/ChildComponents/LinkModifier.js +2 -2
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenu.js +7 -5
- package/build/cjs/components/MainNavigation/ChildComponents/MinicartTooltip.js +6 -6
- package/build/cjs/components/MainNavigation/{index.d.ts → MainNavigation.d.ts} +0 -1
- package/build/cjs/components/MainNavigation/{index.js → MainNavigation.js} +3 -2
- package/build/cjs/components/Notification/Notification.d.ts +40 -17
- package/build/cjs/components/Notification/Notification.js +28 -48
- package/build/cjs/components/NotificationBadge/{index.d.ts → NotificationBadge.d.ts} +0 -0
- package/build/cjs/components/NotificationBadge/{index.js → NotificationBadge.js} +0 -0
- package/build/cjs/components/PixelLoader/PixelLoader.d.ts +1 -1
- package/build/cjs/components/PixelLoader/PixelLoader.js +1 -1
- package/build/cjs/components/ProgressIndicator/{index.d.ts → ProgressIndicator.d.ts} +2 -2
- package/build/cjs/components/ProgressIndicator/{index.js → ProgressIndicator.js} +1 -1
- package/build/cjs/components/RadioButton/RadioButton.d.ts +1 -1
- package/build/cjs/components/RadioButton/RadioButton.js +1 -1
- package/build/{es/components/ReadMore/index.d.ts → cjs/components/ReadMore/ReadMore.d.ts} +1 -1
- package/build/cjs/components/ReadMore/{index.js → ReadMore.js} +1 -1
- package/build/cjs/components/Ribbon/Ribbon.d.ts +57 -0
- package/build/cjs/components/Ribbon/Ribbon.js +80 -0
- package/build/cjs/components/Search/Search.d.ts +44 -5
- package/build/cjs/components/Search/Search.js +3 -3
- package/build/cjs/components/SecondaryNavigation/{index.d.ts → SecondaryNavigation.d.ts} +1 -0
- package/build/cjs/components/SecondaryNavigation/{index.js → SecondaryNavigation.js} +3 -2
- package/build/cjs/components/Selectbox/Selectbox.d.ts +8 -4
- package/build/cjs/components/Selectbox/Selectbox.js +8 -8
- package/build/cjs/components/Textarea/Textarea.d.ts +25 -0
- package/build/cjs/components/Textarea/Textarea.js +83 -0
- package/build/{es/components/Tooltip/index.d.ts → cjs/components/Tooltip/Tooltip.d.ts} +2 -1
- package/build/cjs/components/Tooltip/{index.js → Tooltip.js} +0 -1
- package/build/cjs/components/index.d.ts +14 -10
- package/build/cjs/hooks/useDebounceFunc.d.ts +1 -0
- package/build/cjs/hooks/useDebounceFunc.js +19 -0
- package/build/cjs/hooks/useDocHeight.d.ts +1 -0
- package/build/cjs/hooks/useDocHeight.js +25 -0
- package/build/cjs/hooks/useElementDimensions.d.ts +5 -0
- package/build/cjs/hooks/useElementDimensions.js +37 -0
- package/build/cjs/index.js +28 -18
- package/build/es/components/Accordion/Accordion.d.ts +38 -0
- package/build/es/components/Accordion/Accordion.js +27 -0
- package/build/es/components/Accordion/AccordionItem.d.ts +45 -0
- package/build/es/components/Accordion/AccordionItem.js +91 -0
- package/build/es/components/Accordion/index.d.ts +2 -0
- package/build/es/components/AmountSelector/AmountSelector.d.ts +66 -0
- package/build/es/components/AmountSelector/AmountSelector.js +76 -0
- package/build/es/components/Card/Card.js +1 -2
- package/build/es/components/Card/CardRow.js +0 -1
- package/build/es/components/Checkbox/Checkbox.d.ts +1 -0
- package/build/es/components/Checkbox/Checkbox.js +7 -2
- package/build/es/components/Footer/{index.d.ts → Footer.d.ts} +0 -1
- package/build/es/components/Footer/{index.js → Footer.js} +3 -2
- package/build/es/components/Footer/context/FooterContext.d.ts +1 -1
- package/build/{cjs/components/Helper/index.d.ts → es/components/Helper/Helper.d.ts} +1 -1
- package/build/es/components/Helper/{index.js → Helper.js} +0 -0
- package/build/es/components/Icon/Icons.d.ts +1 -0
- package/build/es/components/Icon/Icons.js +3 -1
- package/build/es/components/Image/{index.d.ts → Image.d.ts} +0 -0
- package/build/es/components/Image/{index.js → Image.js} +0 -0
- package/build/es/components/Input/Input.js +4 -4
- package/build/es/components/LabelText/LabelText.d.ts +2 -2
- package/build/es/components/LabelText/LabelText.js +1 -1
- package/build/es/components/MainNavigation/ChildComponents/BusinessMenu.js +3 -9
- package/build/es/components/MainNavigation/ChildComponents/DesktopMenu.js +9 -9
- package/build/es/components/MainNavigation/ChildComponents/LinkModifier.js +2 -2
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenu.js +7 -5
- package/build/es/components/MainNavigation/ChildComponents/MinicartTooltip.js +5 -5
- package/build/es/components/MainNavigation/{index.d.ts → MainNavigation.d.ts} +0 -1
- package/build/es/components/MainNavigation/{index.js → MainNavigation.js} +3 -2
- package/build/es/components/Notification/Notification.d.ts +40 -17
- package/build/es/components/Notification/Notification.js +28 -48
- package/build/es/components/NotificationBadge/{index.d.ts → NotificationBadge.d.ts} +0 -0
- package/build/es/components/NotificationBadge/{index.js → NotificationBadge.js} +0 -0
- package/build/es/components/PixelLoader/PixelLoader.d.ts +1 -1
- package/build/es/components/PixelLoader/PixelLoader.js +1 -1
- package/build/es/components/ProgressIndicator/{index.d.ts → ProgressIndicator.d.ts} +2 -2
- package/build/es/components/ProgressIndicator/{index.js → ProgressIndicator.js} +1 -1
- package/build/es/components/RadioButton/RadioButton.d.ts +1 -1
- package/build/es/components/RadioButton/RadioButton.js +1 -1
- package/build/{cjs/components/ReadMore/index.d.ts → es/components/ReadMore/ReadMore.d.ts} +1 -1
- package/build/es/components/ReadMore/{index.js → ReadMore.js} +1 -1
- package/build/es/components/Ribbon/Ribbon.d.ts +57 -0
- package/build/es/components/Ribbon/Ribbon.js +71 -0
- package/build/es/components/Search/Search.d.ts +44 -5
- package/build/es/components/Search/Search.js +3 -3
- package/build/es/components/SecondaryNavigation/{index.d.ts → SecondaryNavigation.d.ts} +1 -0
- package/build/es/components/SecondaryNavigation/{index.js → SecondaryNavigation.js} +3 -2
- package/build/es/components/Selectbox/Selectbox.d.ts +8 -4
- package/build/es/components/Selectbox/Selectbox.js +8 -8
- package/build/es/components/Textarea/Textarea.d.ts +25 -0
- package/build/es/components/Textarea/Textarea.js +75 -0
- package/build/{cjs/components/Tooltip/index.d.ts → es/components/Tooltip/Tooltip.d.ts} +2 -1
- package/build/es/components/Tooltip/{index.js → Tooltip.js} +0 -1
- package/build/es/components/index.d.ts +14 -10
- package/build/es/hooks/useDebounceFunc.d.ts +1 -0
- package/build/es/hooks/useDebounceFunc.js +15 -0
- package/build/es/hooks/useDocHeight.d.ts +1 -0
- package/build/es/hooks/useDocHeight.js +21 -0
- package/build/es/hooks/useElementDimensions.d.ts +5 -0
- package/build/es/hooks/useElementDimensions.js +33 -0
- package/build/es/index.js +14 -9
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AccordionItemProps {
|
|
3
|
+
/**
|
|
4
|
+
* Allows to pass a custom className
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The actual content
|
|
9
|
+
*/
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Accordion item title
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* Display close button in the item content
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
hasCloseButton?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Title has color when item is open, hovered or focused
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
highlightSelected?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Label to show for the open icon for accessibility
|
|
27
|
+
*/
|
|
28
|
+
openLabel?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Label to show for the close button in the content
|
|
31
|
+
*/
|
|
32
|
+
closeLabel?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Accordion item is closed from a parent accordion
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
closeFromParent?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* callback to parent accordion when item is expanded
|
|
40
|
+
*/
|
|
41
|
+
onOpen?: () => void;
|
|
42
|
+
}
|
|
43
|
+
declare const AccordionItem: ({ title, children, hasCloseButton, highlightSelected, openLabel, closeLabel, closeFromParent, onOpen, ...props }: AccordionItemProps) => JSX.Element;
|
|
44
|
+
/** @component */
|
|
45
|
+
export default AccordionItem;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import styled__default, { css } from 'styled-components';
|
|
3
|
+
import useResizeObserver from '../../hooks/useElementDimensions.js';
|
|
4
|
+
import { getMultipliedSize, getDividedSize } from '../../utils/styledUtils.js';
|
|
5
|
+
import Icon from '../Icon/Icon.js';
|
|
6
|
+
|
|
7
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
8
|
+
const AccordionItemTitle = styled__default.div `
|
|
9
|
+
font-size: ${p => p.theme.fontSize.defaultFontSize};
|
|
10
|
+
font-weight: ${p => p.theme.fontWeight.bold};
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
color: ${p => p.isExpanded && p.highlightSelected ? p.theme.color.hotPink : p.theme.color.text};
|
|
16
|
+
padding: ${p => `${getMultipliedSize(p.theme.base.baseHeight, 1.6)} ${getMultipliedSize(p.theme.base.baseHeight, 2)}`};
|
|
17
|
+
transition: color 0.2s;
|
|
18
|
+
${p => p.highlightSelected &&
|
|
19
|
+
css `
|
|
20
|
+
&:hover,
|
|
21
|
+
&:active,
|
|
22
|
+
&:focus {
|
|
23
|
+
color: ${p.theme.color.hotPink};
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
}
|
|
26
|
+
`}
|
|
27
|
+
`;
|
|
28
|
+
const AccordionItemContainer = styled__default.div `
|
|
29
|
+
margin: ${p => `0 ${getDividedSize(p.theme.base.baseHeight, 2.5)}}`};
|
|
30
|
+
border-bottom: 1px solid
|
|
31
|
+
${p => (p.isExpanded && p.highlightSelected ? p.theme.color.hotPink : p.theme.color.gray15)};
|
|
32
|
+
`;
|
|
33
|
+
const AccordionItemContent = styled__default.div `
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
color: ${p => p.theme.color.slateGray};
|
|
36
|
+
transition: all 0.2s ease;
|
|
37
|
+
height: ${p => (p.isExpanded ? p.maxHeight / 16 + 1.25 : 0)}rem;
|
|
38
|
+
visibility: ${p => (p.isExpanded ? 'visible' : 'hidden')};
|
|
39
|
+
`;
|
|
40
|
+
const AccordionItemContentInner = styled__default.div `
|
|
41
|
+
padding: ${p => `0 ${getMultipliedSize(p.theme.base.baseHeight, 2)} ${getMultipliedSize(p.theme.base.baseHeight, 2)}`};
|
|
42
|
+
`;
|
|
43
|
+
const CloseAccordionItemWrapper = styled__default.div `
|
|
44
|
+
display: flex;
|
|
45
|
+
flex: 1;
|
|
46
|
+
justify-content: flex-end;
|
|
47
|
+
`;
|
|
48
|
+
const CloseAccordionItem = styled__default.div `
|
|
49
|
+
display: flex;
|
|
50
|
+
gap: ${p => getMultipliedSize(p.theme.base.baseHeight, 1)};
|
|
51
|
+
color: ${p => p.theme.color.text};
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
`;
|
|
54
|
+
const AccordionItem = ({ title, children, hasCloseButton = false, highlightSelected = true, openLabel, closeLabel, closeFromParent = false, onOpen, ...props }) => {
|
|
55
|
+
const [isExpanded, setExpanded] = useState(false);
|
|
56
|
+
const toggleExpanded = () => {
|
|
57
|
+
setExpanded(!isExpanded);
|
|
58
|
+
};
|
|
59
|
+
// get height when element dimensions change
|
|
60
|
+
const { height: contentHeight, ref: contentRef } = useResizeObserver();
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (closeFromParent) {
|
|
63
|
+
setExpanded(false);
|
|
64
|
+
}
|
|
65
|
+
}, [closeFromParent]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (isExpanded && onOpen) {
|
|
68
|
+
onOpen();
|
|
69
|
+
}
|
|
70
|
+
}, [isExpanded]);
|
|
71
|
+
const handleKeyDown = (e) => {
|
|
72
|
+
const key = e.key;
|
|
73
|
+
if (key === 'Enter' || key === ' ') {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
setExpanded(!isExpanded);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return (React.createElement(AccordionItemContainer, { "aria-expanded": isExpanded, className: props.className, isExpanded: isExpanded, highlightSelected: highlightSelected },
|
|
79
|
+
React.createElement(AccordionItemTitle, { tabIndex: 0, onKeyDown: handleKeyDown, isExpanded: isExpanded, highlightSelected: highlightSelected, onClick: toggleExpanded, role: "button" },
|
|
80
|
+
React.createElement("span", null, title),
|
|
81
|
+
isExpanded ? (React.createElement(Icon, { name: "hlChevronUp", size: "1.5rem", right: true, "aria-label": closeLabel })) : (React.createElement(Icon, { name: "hlChevronDown", size: "1.5rem", right: true, "aria-label": openLabel }))),
|
|
82
|
+
React.createElement(AccordionItemContent, { maxHeight: contentHeight, isExpanded: isExpanded },
|
|
83
|
+
React.createElement(AccordionItemContentInner, { ref: contentRef },
|
|
84
|
+
children,
|
|
85
|
+
hasCloseButton && (React.createElement(CloseAccordionItemWrapper, null,
|
|
86
|
+
React.createElement(CloseAccordionItem, { onClick: toggleExpanded, "aria-label": closeLabel, tabIndex: 0, onKeyDown: handleKeyDown, role: "button" },
|
|
87
|
+
React.createElement("span", null, closeLabel),
|
|
88
|
+
React.createElement(Icon, { name: "hlX", size: "1.5rem" }))))))));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default AccordionItem;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* Unique ID for the input element
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* On value change callback
|
|
9
|
+
*/
|
|
10
|
+
onChange: (val: number) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the input element
|
|
13
|
+
*/
|
|
14
|
+
name?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Default value of input element
|
|
17
|
+
*
|
|
18
|
+
* @default 1
|
|
19
|
+
*/
|
|
20
|
+
value?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Allows to set step value for increase or decrease
|
|
23
|
+
*
|
|
24
|
+
* @default 1
|
|
25
|
+
*/
|
|
26
|
+
step?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Allows to set minimum value
|
|
29
|
+
*
|
|
30
|
+
* @default 1
|
|
31
|
+
*/
|
|
32
|
+
min?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Allows to set maximum value
|
|
35
|
+
*/
|
|
36
|
+
max?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Allows to disable the component functionality
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Controls if input element's value can be updated directly
|
|
45
|
+
*
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
readonly?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Allows to pass testid string for testing purposes
|
|
51
|
+
*/
|
|
52
|
+
'data-testid'?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Allows to pass a custom className
|
|
55
|
+
*/
|
|
56
|
+
className?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Allows the `onChange` function to be called even after `min` property value is reached.
|
|
59
|
+
* When defined and `min` property value is reached, the `hlMinus` button changes to `hlTrash` button
|
|
60
|
+
*/
|
|
61
|
+
removable?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** @visibleName Amount Selector */
|
|
64
|
+
declare const AmountSelector: ({ onChange, value, step, min, max, disabled, readonly, "data-testid": dataTestId, ...props }: Props) => JSX.Element;
|
|
65
|
+
/** @component */
|
|
66
|
+
export default AmountSelector;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from '../../themes/styled.js';
|
|
3
|
+
import theme from '../../themes/theme.js';
|
|
4
|
+
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
5
|
+
import '../Buttons/ButtonBasicStyles.js';
|
|
6
|
+
import '../PixelLoader/PixelLoaderStyles.js';
|
|
7
|
+
import '../Buttons/ButtonPrimaryStyles.js';
|
|
8
|
+
import ButtonSecondary from '../Buttons/ButtonSecondary.js';
|
|
9
|
+
import '../Buttons/ButtonTertiaryStyles.js';
|
|
10
|
+
import '../Buttons/ButtonRoundStyles.js';
|
|
11
|
+
import '../Buttons/CloseButton.js';
|
|
12
|
+
import '../Buttons/ButtonIconStyles.js';
|
|
13
|
+
import Icon from '../Icon/Icon.js';
|
|
14
|
+
import '../Buttons/ButtonIconPrimaryStyles.js';
|
|
15
|
+
|
|
16
|
+
const Container = styled.div `
|
|
17
|
+
display: flex;
|
|
18
|
+
width: ${getMultipliedSize(theme.base.baseWidth, 12)};
|
|
19
|
+
|
|
20
|
+
input {
|
|
21
|
+
width: ${getMultipliedSize(theme.base.baseWidth, 4)};
|
|
22
|
+
border: 0 none;
|
|
23
|
+
text-align: center;
|
|
24
|
+
outline: none;
|
|
25
|
+
-webkit-appearance: none;
|
|
26
|
+
-moz-appearance: textfield;
|
|
27
|
+
&::-webkit-outer-spin-button,
|
|
28
|
+
&::-webkit-inner-spin-button {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
const StyledButtonSecondary = styled(ButtonSecondary) `
|
|
34
|
+
min-width: ${getMultipliedSize(theme.base.baseWidth, 4)};
|
|
35
|
+
`;
|
|
36
|
+
/** @visibleName Amount Selector */
|
|
37
|
+
const AmountSelector = ({ onChange, value = 1, step = 1, min = 1, max, disabled = false, readonly = true, 'data-testid': dataTestId, ...props }) => {
|
|
38
|
+
const isMinReached = (val) => val < min;
|
|
39
|
+
const isMaxReached = (val) => Boolean(max && val > max);
|
|
40
|
+
const isInRange = (val) => !isMinReached(val) && !isMaxReached(val);
|
|
41
|
+
const increase = () => {
|
|
42
|
+
const newValue = value + step;
|
|
43
|
+
if (!isMaxReached(newValue) && !disabled) {
|
|
44
|
+
onChange(newValue);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const decrease = () => {
|
|
48
|
+
const newValue = value - step;
|
|
49
|
+
if (!disabled && (!isMinReached(newValue) || props.removable)) {
|
|
50
|
+
onChange(newValue);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const handleChange = (event) => {
|
|
54
|
+
if (event.target.value) {
|
|
55
|
+
const integerInputValue = parseInt(event.target.value, 10);
|
|
56
|
+
if (isInRange(integerInputValue)) {
|
|
57
|
+
onChange(integerInputValue);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
onChange(max && isMaxReached(integerInputValue) ? max : min);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
onChange(min);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return (React.createElement(Container, { disabled: disabled, "data-testid": dataTestId, className: props.className },
|
|
68
|
+
React.createElement(StyledButtonSecondary, { disabled: disabled, onClick: decrease, "data-testid": dataTestId &&
|
|
69
|
+
`${dataTestId}${props.removable && isMinReached(value - step) ? '-remove' : '-decrease'}` },
|
|
70
|
+
React.createElement(Icon, { color: theme.color.black, name: props.removable && isMinReached(value - step) ? 'hlTrash' : 'hlMinus' })),
|
|
71
|
+
React.createElement("input", { id: props.id, name: props.name, type: "number", onChange: handleChange, value: value, readOnly: readonly || disabled, disabled: disabled }),
|
|
72
|
+
React.createElement(StyledButtonSecondary, { disabled: disabled, onClick: increase, "data-testid": dataTestId ? `${dataTestId}-increase` : undefined },
|
|
73
|
+
React.createElement(Icon, { color: theme.color.black, name: "hlPlus" }))));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default AmountSelector;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { media } from '../../utils/styledUtils.js';
|
|
3
2
|
import styled, { keyframes } from '../../themes/styled.js';
|
|
4
3
|
import theme from '../../themes/theme.js';
|
|
4
|
+
import { media } from '../../utils/styledUtils.js';
|
|
5
5
|
|
|
6
|
-
/** @visibleName Cards */
|
|
7
6
|
const showing = keyframes `
|
|
8
7
|
from {
|
|
9
8
|
opacity:0.3;
|
|
@@ -69,7 +69,10 @@ const ErrorMessage = styled.div `
|
|
|
69
69
|
color: ${props => props.theme.color.error};
|
|
70
70
|
margin-top: ${props => getMultipliedSize(props.theme.base.baseHeight, 1)};
|
|
71
71
|
`;
|
|
72
|
-
const
|
|
72
|
+
const Mandatory = styled.span `
|
|
73
|
+
color: ${props => props.theme.color.hotPink};
|
|
74
|
+
`;
|
|
75
|
+
const Checkbox = ({ id, value, onChange, label, disabled, error, errorMessage, className, required, 'data-testid': dataTestId, }) => {
|
|
73
76
|
const handleChange = () => {
|
|
74
77
|
if (onChange && !disabled) {
|
|
75
78
|
onChange(!value);
|
|
@@ -77,7 +80,9 @@ const Checkbox = ({ id, value, onChange, label, disabled, error, errorMessage, c
|
|
|
77
80
|
};
|
|
78
81
|
return (React.createElement(React.Fragment, null,
|
|
79
82
|
React.createElement(Input, { id: id, className: className, type: "checkbox", checked: Boolean(value), onChange: handleChange, disabled: disabled, "data-testid": dataTestId }),
|
|
80
|
-
React.createElement(Label, { htmlFor: id, "data-testid": dataTestId && `${dataTestId}-label` },
|
|
83
|
+
React.createElement(Label, { htmlFor: id, "data-testid": dataTestId && `${dataTestId}-label` },
|
|
84
|
+
label,
|
|
85
|
+
required && React.createElement(Mandatory, null, " *")),
|
|
81
86
|
error && errorMessage && (React.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error` }, errorMessage))));
|
|
82
87
|
};
|
|
83
88
|
|
|
@@ -72,6 +72,7 @@ const initialCollapse = {
|
|
|
72
72
|
1: false,
|
|
73
73
|
2: false,
|
|
74
74
|
};
|
|
75
|
+
/** @visibleName Footer */
|
|
75
76
|
const Footer = ({ items = { businessId: 'NONE', footerNavigation: {} }, language = 'fi', zIndex = 1, isMobileFooter = false, collapseSize = 767, }) => {
|
|
76
77
|
// Resets menu states when menu content alters between mobile and desktop
|
|
77
78
|
const footerChanged = previousValue !== isMobileFooter;
|
|
@@ -117,6 +118,6 @@ const Footer = ({ items = { businessId: 'NONE', footerNavigation: {} }, language
|
|
|
117
118
|
/** @component */
|
|
118
119
|
// TODO: Remove ts-ignore after https://jira.dna.fi/browse/STYLE-232 is done
|
|
119
120
|
// @ts-ignore
|
|
120
|
-
var
|
|
121
|
+
var Footer$1 = withSizes(mapSizesToProps)(Footer);
|
|
121
122
|
|
|
122
|
-
export default
|
|
123
|
+
export default Footer$1;
|
|
File without changes
|
|
@@ -283,6 +283,7 @@ export declare const hlMarker: ({ size, color, ...props }: IconProps) => JSX.Ele
|
|
|
283
283
|
export declare const hlMenu: ({ size, color, ...props }: IconProps) => JSX.Element;
|
|
284
284
|
export declare const hlMemory: ({ size, color, ...props }: IconProps) => JSX.Element;
|
|
285
285
|
export declare const hlMinimize: ({ size, color, ...props }: IconProps) => JSX.Element;
|
|
286
|
+
export declare const hlMinus: ({ size, color, ...props }: IconProps) => JSX.Element;
|
|
286
287
|
export declare const hlMobileData: ({ size, color, ...props }: IconProps) => JSX.Element;
|
|
287
288
|
export declare const hlMobilePayment: ({ size, color, ...props }: IconProps) => JSX.Element;
|
|
288
289
|
export declare const hlModem: ({ size, color, ...props }: IconProps) => JSX.Element;
|
|
@@ -681,6 +681,8 @@ const hlMemory = ({ size, color, ...props }) => (React.createElement("svg", Obje
|
|
|
681
681
|
React.createElement("path", { d: "M7.8 8.4a.6.6 0 0 1-.6-.6V5.4a.6.6 0 1 1 1.2 0v2.4a.6.6 0 0 1-.6.6zM10.8 8.4a.6.6 0 0 1-.6-.6V5.4a.6.6 0 0 1 1.2 0v2.4a.6.6 0 0 1-.6.6zM13.8 8.4a.6.6 0 0 1-.6-.6V5.4a.6.6 0 1 1 1.2 0v2.4a.6.6 0 0 1-.6.6z" })));
|
|
682
682
|
const hlMinimize = ({ size, color, ...props }) => (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: color, width: size, height: size }, props),
|
|
683
683
|
React.createElement("path", { d: "M21 21.6H3a.6.6 0 0 1 0-1.2h18a.6.6 0 0 1 0 1.2z" })));
|
|
684
|
+
const hlMinus = ({ size, color, ...props }) => (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: color, width: size, height: size }, props),
|
|
685
|
+
React.createElement("path", { d: "M21 12.6H3a.6.6 0 0 1 0-1.2h18a.6.6 0 1 1 0 1.2z" })));
|
|
684
686
|
const hlMobileData = ({ size, color, ...props }) => (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: color, width: size, height: size }, props),
|
|
685
687
|
React.createElement("path", { d: "M18 12a.6.6 0 01-.42-1 5.4 5.4 0 000-7.64.601.601 0 11.85-.85 6.6 6.6 0 010 9.33.6.6 0 01-.43.16zM6 12a.6.6 0 01-.42-.18 6.6 6.6 0 010-9.33.601.601 0 11.85.85 5.4 5.4 0 000 7.64A.6.6 0 016 12zM15 10.2a.6.6 0 01-.42-1 2.79 2.79 0 000-4 .601.601 0 11.85-.85 4 4 0 010 5.65.6.6 0 01-.43.2zM9 10.2a.6.6 0 01-.42-.2 4 4 0 010-5.65.601.601 0 11.85.85 2.79 2.79 0 000 4 .6.6 0 01-.42 1H9zM13.2 7.2a1.2 1.2 0 10-1.8 1V21a.6.6 0 101.2 0V8.23a1.19 1.19 0 00.6-1.03z" })));
|
|
686
688
|
const hlMobilePayment = ({ size, color, ...props }) => (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: color, width: size, height: size }, props),
|
|
@@ -777,4 +779,4 @@ const hlWifi = ({ size, color, ...props }) => (React.createElement("svg", Object
|
|
|
777
779
|
const hlX = ({ size, color, ...props }) => (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: color, width: size, height: size }, props),
|
|
778
780
|
React.createElement("path", { d: "M12.85 12l7.38-7.38a.6.6 0 0 0-.85-.85L12 11.15 4.62 3.78a.6.6 0 0 0-.85.85L11.15 12l-7.37 7.38a.6.6 0 1 0 .85.85L12 12.85l7.38 7.38a.6.6 0 0 0 .85-.85z" })));
|
|
779
781
|
|
|
780
|
-
export { action, airplane, anime, antenna, apartmentBuilding1, apartmentBuilding2, apartmentBuilding3, arrows, backward, balloon, basket, book, briefcase, broadbandHome, broadbandHousing, broadbandMobile, browser, bus, cableTv, calculator, calendar1, calendar2, camera, channelPackageL, channelPackageM, channelPackageMix, channelPackageMix4, channelPackageMix8, channelPackageMixPlus, channelPackageNorra, channelPackageRossija, channelPackageS, channelPackageTurk, check, chevronDown, chevronLeft, chevronRight, chevronUp, clapperboard, clipboard, cloud1, cloud2, cogwheel, comedy, cultFilms, culture, curvedArrowLeft, curvedArrowRight, cycle, desktopComputer, devices, diamond, digibox, digiboxRec, dna, dnaTurvapaketti, dnaTv, document1, document2, document3, documentaries, documents1, documents2, door, download, drama, dvbC, dvbT2, dwr, envelope1, envelope2, epg, error, ethernet, eu, euro, exclamationMark, eyeClosed, eyeOpen, facebook, favorites, finland, finnish, folder1, folder2, folder3, forward, fourG, gameConsole, gift, gift2, globe, google, graduation, graph, hardDrive, hd, hdmiCable, headset1, headset2, hl404, hl4gSim, hl5gSim, hlArrowBack, hlArrowForward, hlArrowSmallLeft, hlArrowSmallRight, hlArrowSmallUnder, hlBattery, hlBell, hlCalendar, hlCalendarSmall, hlCall, hlCameraBack, hlCameraFront, hlCart, hlCartEmpty, hlChat, hlCheck, hlChevronDown, hlChevronLeft, hlChevronRight, hlChevronUp, hlClockSmall, hlCompensation, hlCookie, hlCopy, hlCoupon, hlDisplaySize, hlDocument, hlDownload, hlDownloadSmall, hlEnvelope, hlError, hlEuro, hlExpand, hlExternal, hlEyeClosed, hlEyeOpen, hlFaceId, hlFingerprint, hlGlobe, hlHeadphones, hlHeadset, hlHeart, hlHome, hlImage, hlInfo, hlInstallment, hlIotSim, hlLock, hlMagnifyingGlass, hlMarker, hlMemory, hlMenu, hlMinimize, hlMobileData, hlMobilePayment, hlModem, hlMore, hlOs, hlPackage, hlPaperclip, hlPaytime, hlPen, hlPerson, hlPhone, hlPlus, hlPrepaid, hlProcessor, hlServices, hlSettings, hlShield, hlSim, hlSimSimple, hlSmile, hlSpeechBubble, hlSquaretrade, hlStar, hlStarFilled, hlTrash, hlTv, hlUnlock, hlUpload, hlUploadSmall, hlWarning, hlWifi, hlX, hobbies, hotdog, house, hub, idCard, info, instagram, iot1, iot2, iot3, ip, key, kids, laptop, leaf, linkedin, magnifyingGlass, man1, man2, man3, man4, man5, marker, maximize, megaphone, minimize, minus, modem, molecule, money1, money2, mouse, mp3, music, newspaper, next, paperclip, pause, pdf, pen, person, person2, persons1, persons2, persons3, pg18, phone1, phone2, phonePrepaid, phonePrepaid4g, phoneWifiPrepaid, play, plus, power, previous, projector, radioMast, rec, rec2, remoteControl, romantic, router, rss, scale, shield, simCard1, simCard2, simCard4g, simCard4gWifi, simCardInfinity, simCardInfinity4g, simCardWifi, soda, speaker, speechBubble1, speechBubble2, speechBubble3, sports, star, stop, swedish, tablet, target, terrestialTv, thriller, thumbDown, thumbUp, tickets, top10, top50, trademark, trafficCone, trafficLights, train, tv1, tv2, tvCard, tvWithRecording, tvWithRemote1, tvWithRemote2, tvWithRemote3, tvWithRemote4, twitter, upgrade, upload, usb, usbCable, usbModem, van, videocamera, wall, warning, whatsapp, wifi1, wifi2, wifiAccessPoint, woman1, woman2, woman3, world, wrench1, wrench2, x, youtube };
|
|
782
|
+
export { action, airplane, anime, antenna, apartmentBuilding1, apartmentBuilding2, apartmentBuilding3, arrows, backward, balloon, basket, book, briefcase, broadbandHome, broadbandHousing, broadbandMobile, browser, bus, cableTv, calculator, calendar1, calendar2, camera, channelPackageL, channelPackageM, channelPackageMix, channelPackageMix4, channelPackageMix8, channelPackageMixPlus, channelPackageNorra, channelPackageRossija, channelPackageS, channelPackageTurk, check, chevronDown, chevronLeft, chevronRight, chevronUp, clapperboard, clipboard, cloud1, cloud2, cogwheel, comedy, cultFilms, culture, curvedArrowLeft, curvedArrowRight, cycle, desktopComputer, devices, diamond, digibox, digiboxRec, dna, dnaTurvapaketti, dnaTv, document1, document2, document3, documentaries, documents1, documents2, door, download, drama, dvbC, dvbT2, dwr, envelope1, envelope2, epg, error, ethernet, eu, euro, exclamationMark, eyeClosed, eyeOpen, facebook, favorites, finland, finnish, folder1, folder2, folder3, forward, fourG, gameConsole, gift, gift2, globe, google, graduation, graph, hardDrive, hd, hdmiCable, headset1, headset2, hl404, hl4gSim, hl5gSim, hlArrowBack, hlArrowForward, hlArrowSmallLeft, hlArrowSmallRight, hlArrowSmallUnder, hlBattery, hlBell, hlCalendar, hlCalendarSmall, hlCall, hlCameraBack, hlCameraFront, hlCart, hlCartEmpty, hlChat, hlCheck, hlChevronDown, hlChevronLeft, hlChevronRight, hlChevronUp, hlClockSmall, hlCompensation, hlCookie, hlCopy, hlCoupon, hlDisplaySize, hlDocument, hlDownload, hlDownloadSmall, hlEnvelope, hlError, hlEuro, hlExpand, hlExternal, hlEyeClosed, hlEyeOpen, hlFaceId, hlFingerprint, hlGlobe, hlHeadphones, hlHeadset, hlHeart, hlHome, hlImage, hlInfo, hlInstallment, hlIotSim, hlLock, hlMagnifyingGlass, hlMarker, hlMemory, hlMenu, hlMinimize, hlMinus, hlMobileData, hlMobilePayment, hlModem, hlMore, hlOs, hlPackage, hlPaperclip, hlPaytime, hlPen, hlPerson, hlPhone, hlPlus, hlPrepaid, hlProcessor, hlServices, hlSettings, hlShield, hlSim, hlSimSimple, hlSmile, hlSpeechBubble, hlSquaretrade, hlStar, hlStarFilled, hlTrash, hlTv, hlUnlock, hlUpload, hlUploadSmall, hlWarning, hlWifi, hlX, hobbies, hotdog, house, hub, idCard, info, instagram, iot1, iot2, iot3, ip, key, kids, laptop, leaf, linkedin, magnifyingGlass, man1, man2, man3, man4, man5, marker, maximize, megaphone, minimize, minus, modem, molecule, money1, money2, mouse, mp3, music, newspaper, next, paperclip, pause, pdf, pen, person, person2, persons1, persons2, persons3, pg18, phone1, phone2, phonePrepaid, phonePrepaid4g, phoneWifiPrepaid, play, plus, power, previous, projector, radioMast, rec, rec2, remoteControl, romantic, router, rss, scale, shield, simCard1, simCard2, simCard4g, simCard4gWifi, simCardInfinity, simCardInfinity4g, simCardWifi, soda, speaker, speechBubble1, speechBubble2, speechBubble3, sports, star, stop, swedish, tablet, target, terrestialTv, thriller, thumbDown, thumbUp, tickets, top10, top50, trademark, trafficCone, trafficLights, train, tv1, tv2, tvCard, tvWithRecording, tvWithRemote1, tvWithRemote2, tvWithRemote3, tvWithRemote4, twitter, upgrade, upload, usb, usbCable, usbModem, van, videocamera, wall, warning, whatsapp, wifi1, wifi2, wifiAccessPoint, woman1, woman2, woman3, world, wrench1, wrench2, x, youtube };
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '../../themes/styled.js';
|
|
3
3
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
4
|
-
import { LabelText } from '../LabelText/LabelText.js';
|
|
5
4
|
import Icon from '../Icon/Icon.js';
|
|
5
|
+
import { LabelText } from '../LabelText/LabelText.js';
|
|
6
6
|
|
|
7
7
|
const Tag = styled.input `
|
|
8
8
|
position: relative;
|
|
@@ -11,7 +11,7 @@ const Tag = styled.input `
|
|
|
11
11
|
padding: 0 ${props => getMultipliedSize(props.theme.base.baseWidth, 1)};
|
|
12
12
|
font-size: ${props => props.theme.fontSize.defaultFontSize};
|
|
13
13
|
width: 100%;
|
|
14
|
-
height:
|
|
14
|
+
height: ${props => getMultipliedSize(props.theme.base.baseHeight, 4)};
|
|
15
15
|
border: 1px solid ${props => props.theme.color.gray15};
|
|
16
16
|
&::-ms-clear,
|
|
17
17
|
&::-ms-reveal {
|
|
@@ -43,8 +43,8 @@ const FieldWrapper = styled.div `
|
|
|
43
43
|
position: absolute;
|
|
44
44
|
z-index: 1;
|
|
45
45
|
top: 0;
|
|
46
|
-
right:
|
|
47
|
-
height:
|
|
46
|
+
right: ${props => getMultipliedSize(props.theme.base.baseWidth, 1)};
|
|
47
|
+
height: ${props => getMultipliedSize(props.theme.base.baseHeight, 4)};
|
|
48
48
|
}
|
|
49
49
|
`;
|
|
50
50
|
const FieldContainer = styled.div `
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @visibleName Label
|
|
1
|
+
/** @visibleName Label Text */
|
|
2
2
|
export declare const LabelText: import("styled-components").StyledComponent<"label", {
|
|
3
3
|
base: {
|
|
4
4
|
baseHeight: {
|
|
@@ -48,7 +48,7 @@ export declare const LabelText: import("styled-components").StyledComponent<"lab
|
|
|
48
48
|
gray5: string;
|
|
49
49
|
};
|
|
50
50
|
fontFamily: {
|
|
51
|
-
baseFontFamily: string; /** @visibleName Label
|
|
51
|
+
baseFontFamily: string; /** @visibleName Label Text */
|
|
52
52
|
};
|
|
53
53
|
fontSize: {
|
|
54
54
|
defaultFontSize: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from '../../themes/styled.js';
|
|
2
2
|
import { getDividedSize } from '../../utils/styledUtils.js';
|
|
3
3
|
|
|
4
|
-
/** @visibleName Label
|
|
4
|
+
/** @visibleName Label Text */
|
|
5
5
|
const LabelText = styled.label(({ theme, htmlFor }) => ({
|
|
6
6
|
fontSize: theme.fontSize.defaultFontSize,
|
|
7
7
|
display: 'block',
|
|
@@ -31,25 +31,19 @@ const BusinessMenuList = styled.ul `
|
|
|
31
31
|
height: 100%;
|
|
32
32
|
`;
|
|
33
33
|
const BusinessMenu = () => {
|
|
34
|
-
const { items: data, lang: language, isMobileMenu, resetMenuEvents
|
|
34
|
+
const { items: data, lang: language, isMobileMenu, resetMenuEvents } = useContext(NavContext);
|
|
35
35
|
const ref = useRef(null);
|
|
36
36
|
if (!data.businessId || (!data.businessSelector && data.businessSelector.items.length > 0)) {
|
|
37
37
|
return React.createElement(React.Fragment, null);
|
|
38
38
|
}
|
|
39
39
|
const currentBusinessId = data.businessId;
|
|
40
40
|
const businessMenuItems = data.businessSelector.items;
|
|
41
|
-
const getTabIndex = () => {
|
|
42
|
-
if ((scrollPosition && scrollPosition > 0) || !isMobileMenu) {
|
|
43
|
-
return -1;
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
};
|
|
47
41
|
if (!businessMenuItems.length) {
|
|
48
42
|
return React.createElement(React.Fragment, null);
|
|
49
43
|
}
|
|
50
44
|
return (React.createElement(BusinessMenuList, { isMobileMenu: isMobileMenu, ref: ref, role: "menubar", "aria-hidden": "false", "data-testid": "business-menu-ul" }, businessMenuItems.map((item, index) => {
|
|
51
|
-
return (React.createElement(BusinessMenuItem, { className: "menu-item", key: item.businessId, "data-testid": `business-menu-selection-item-${index + 1}
|
|
52
|
-
React.createElement(BusinessMenuLink, { className: "menu-link", href: item.urls[language], onClick: resetMenuEvents,
|
|
45
|
+
return (React.createElement(BusinessMenuItem, { className: "menu-item", key: item.businessId, "data-testid": `business-menu-selection-item-${index + 1}`, role: "none" },
|
|
46
|
+
React.createElement(BusinessMenuLink, { className: "menu-link", href: item.urls[language], onClick: resetMenuEvents, isActive: item.businessId === currentBusinessId, isMobileMenu: isMobileMenu, role: "menuitem" }, item.titles[language])));
|
|
53
47
|
})));
|
|
54
48
|
};
|
|
55
49
|
|
|
@@ -35,7 +35,7 @@ const SubMenuListRight = styled.ul `
|
|
|
35
35
|
: 'none'};
|
|
36
36
|
${({ menuStates }) => menuStates.level2 && menuStates.animate2 ? fadeRightAnimation : noAnimation};
|
|
37
37
|
top: -${p => getMultipliedSize(p.theme.base.baseHeight, 1)};
|
|
38
|
-
margin:
|
|
38
|
+
margin: 0;
|
|
39
39
|
margin-top: -2px;
|
|
40
40
|
margin-left: ${p => getMultipliedSize(p.theme.base.baseHeight, 1)};
|
|
41
41
|
padding: ${p => getMultipliedSize(p.theme.base.baseHeight, 1)};
|
|
@@ -159,7 +159,7 @@ const SubMenuList = styled.ul `
|
|
|
159
159
|
width: ${subMenuWidthXl};
|
|
160
160
|
`};
|
|
161
161
|
li {
|
|
162
|
-
margin:
|
|
162
|
+
margin: 0;
|
|
163
163
|
padding: 0;
|
|
164
164
|
a,
|
|
165
165
|
button {
|
|
@@ -193,13 +193,13 @@ const SubMenuLevel1 = ({ menuItem }) => {
|
|
|
193
193
|
return (React.createElement(SubMenuList, { role: "menu", "aria-hidden": false, menuStates: menuLevel, navItemId: menuItem.id, "data-testid": "desktop-nav-menu-ul-level-2", navZIndex: navZIndex }, menuItem.pages.map((element, index) => {
|
|
194
194
|
const menuUrl = element.urls[language];
|
|
195
195
|
if (element.pages.length) {
|
|
196
|
-
return (React.createElement(SubMenuItem, { key: element.id, role: "
|
|
197
|
-
React.createElement(MenuLinkWithChildren, { isActive: menuLevel.level2 === element.id, isHighlighted: isSelected(currentUrl, menuUrl), onClick: menuClick(element), role: "menuitem", "data-testid": "menu-button-with-children" },
|
|
196
|
+
return (React.createElement(SubMenuItem, { key: element.id, role: "none", "data-testid": `desktop-nav-item-level-2-link-${index + 1}` },
|
|
197
|
+
React.createElement(MenuLinkWithChildren, { isActive: menuLevel.level2 === element.id, isHighlighted: isSelected(currentUrl, menuUrl), onClick: menuClick(element), role: "menuitem", "aria-haspopup": "true", "data-testid": "menu-button-with-children" },
|
|
198
198
|
React.createElement("span", null, element.titles[language]),
|
|
199
199
|
React.createElement(Icon, { name: "chevronRight", size: "0.625rem" })),
|
|
200
200
|
React.createElement(SubMenuLevel2, { menuItem: element })));
|
|
201
201
|
}
|
|
202
|
-
return (React.createElement(SubMenuItem, { key: element.id, isHighlighted: isSelected(currentUrl, menuUrl, true), role: "
|
|
202
|
+
return (React.createElement(SubMenuItem, { key: element.id, isHighlighted: isSelected(currentUrl, menuUrl, true), role: "none", "data-testid": `desktop-nav-item-level-2-link-${index + 1}` },
|
|
203
203
|
React.createElement(LinkModifier, { menuItem: element, tabIndex: false })));
|
|
204
204
|
})));
|
|
205
205
|
};
|
|
@@ -207,7 +207,7 @@ const SubMenuLevel2 = ({ menuItem }) => {
|
|
|
207
207
|
const { lang, menuLevel, currentUrl } = useContext(NavContext);
|
|
208
208
|
return (React.createElement(SubMenuListRight, { role: "menu", menuStates: menuLevel, navItemId: menuItem.id, "data-testid": "desktop-nav-menu-ul-level-3" }, menuItem.pages.map((item, index) => {
|
|
209
209
|
const menuUrl = item.urls[lang];
|
|
210
|
-
return (React.createElement(SubMenuItem, { key: item.id, isHighlighted: isSelected(currentUrl, menuUrl, true), role: "
|
|
210
|
+
return (React.createElement(SubMenuItem, { key: item.id, isHighlighted: isSelected(currentUrl, menuUrl, true), role: "none", "data-testid": `desktop-nav-item-level-3-link-${index + 1}` },
|
|
211
211
|
React.createElement(LinkModifier, { menuItem: item, tabIndex: false })));
|
|
212
212
|
})));
|
|
213
213
|
};
|
|
@@ -218,8 +218,8 @@ const MenuItemWithChildren = ({ menuItem, currentLevel }) => {
|
|
|
218
218
|
handleNavMenuClick(element.id, 'level1');
|
|
219
219
|
};
|
|
220
220
|
const menuUrl = menuItem.urls[language];
|
|
221
|
-
return (React.createElement(DesktopMenuItem, { isActive: menuLevel.level1 === menuItem.id || isSelected(currentUrl, menuUrl), role: "
|
|
222
|
-
React.createElement(MenuLinkWithChildren, { onClick: menuClickMain(menuItem), role: "menuitem", "data-testid": "menu-button-with-children" },
|
|
221
|
+
return (React.createElement(DesktopMenuItem, { isActive: menuLevel.level1 === menuItem.id || isSelected(currentUrl, menuUrl), role: "none", "data-testid": `desktop-nav-item-level-1-link-${currentLevel + 1}` },
|
|
222
|
+
React.createElement(MenuLinkWithChildren, { onClick: menuClickMain(menuItem), role: "menuitem", "aria-haspopup": "true", "data-testid": "menu-button-with-children" },
|
|
223
223
|
React.createElement("span", null, menuItem.titles[language])),
|
|
224
224
|
React.createElement(SubMenuLevel1, { menuItem: menuItem })));
|
|
225
225
|
};
|
|
@@ -240,7 +240,7 @@ const DesktopMenu = () => {
|
|
|
240
240
|
if (menuHasChildren) {
|
|
241
241
|
return (React.createElement(MenuItemWithChildren, { menuItem: navElement, key: navElement.id, currentLevel: index }));
|
|
242
242
|
}
|
|
243
|
-
return (React.createElement(MenuItem, { key: navElement.id, role: "
|
|
243
|
+
return (React.createElement(MenuItem, { key: navElement.id, role: "none", "data-testid": `desktop-nav-item-level-1-link-${index + 1}` },
|
|
244
244
|
React.createElement(LinkModifier, { menuItem: navElement, tabIndex: false })));
|
|
245
245
|
})));
|
|
246
246
|
};
|
|
@@ -17,10 +17,10 @@ const LinkModifier = ({ menuItem, tabIndex }) => {
|
|
|
17
17
|
const menuItemLink = menuItem.urls[lang] || '';
|
|
18
18
|
if (NextJSLinkComponent && !isMenuItemLinkAbsolute(menuItemLink)) {
|
|
19
19
|
return (React.createElement(NextJSLinkComponent, { linkUrl: menuItem.urls[lang] },
|
|
20
|
-
React.createElement(MenuLink, { href: menuItem.urls[lang], onClick: resetMenuEvents, tabIndex: tabIndex ? -1 : undefined, id: menuItem.id },
|
|
20
|
+
React.createElement(MenuLink, { href: menuItem.urls[lang], onClick: resetMenuEvents, tabIndex: tabIndex ? -1 : undefined, id: menuItem.id, role: "menuitem" },
|
|
21
21
|
React.createElement("span", null, menuItem.titles[lang]))));
|
|
22
22
|
}
|
|
23
|
-
return (React.createElement(MenuLink, { href: menuItem.urls[lang], onClick: resetMenuEvents, tabIndex: tabIndex ? -1 : undefined, id: menuItem.id },
|
|
23
|
+
return (React.createElement(MenuLink, { href: menuItem.urls[lang], onClick: resetMenuEvents, tabIndex: tabIndex ? -1 : undefined, id: menuItem.id, role: "menuitem" },
|
|
24
24
|
React.createElement("span", null, menuItem.titles[lang])));
|
|
25
25
|
};
|
|
26
26
|
|