@dnanpm/styleguide 3.9.6 → 3.9.7
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/AccordionItem/AccordionItem.d.ts +5 -1
- package/build/cjs/components/AccordionItem/AccordionItem.js +17 -7
- package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +6 -0
- package/build/cjs/components/ButtonIcon/ButtonIcon.js +2 -2
- package/build/cjs/components/EmptyState/EmptyState.d.ts +4 -0
- package/build/cjs/components/EmptyState/EmptyState.js +2 -2
- package/build/cjs/components/Expander/Expander.js +8 -2
- package/build/cjs/components/Footer/Components/FooterComponents.js +2 -0
- package/build/cjs/components/Footer/Footer.js +4 -0
- package/build/cjs/components/Icon/Icon.d.ts +9 -1
- package/build/cjs/components/Icon/Icon.js +2 -2
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +1 -0
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +7 -4
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -5
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.d.ts +5 -5
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.d.ts +27 -0
- package/build/cjs/components/MainNavigation/ChildComponents/BusinessMenu.js +1 -0
- package/build/cjs/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +3 -0
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
- package/build/cjs/components/MainNavigation/globalNavStyles.d.ts +12 -0
- package/build/cjs/components/PixelLoader/PixelLoader.d.ts +4 -0
- package/build/cjs/components/PixelLoader/PixelLoader.js +1 -0
- package/build/cjs/components/PriorityNavigationItem/PriorityNavigationItem.js +1 -0
- package/build/cjs/components/ProgressIndicator/ProgressIndicator.d.ts +8 -0
- package/build/cjs/components/ProgressIndicator/ProgressIndicator.js +12 -5
- package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.js +1 -0
- package/build/cjs/components/Selectbox/Selectbox.d.ts +18 -1
- package/build/cjs/components/Selectbox/Selectbox.js +18 -11
- package/build/cjs/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +6 -0
- package/build/cjs/themes/globalStyles.d.ts +9 -0
- package/build/cjs/themes/globalStyles.js +13 -4
- package/build/cjs/themes/styled.d.ts +21 -0
- package/build/cjs/themes/theme.d.ts +3 -0
- package/build/cjs/themes/themeComponents/color.d.ts +3 -0
- package/build/cjs/themes/themeComponents/color.js +3 -0
- package/build/es/components/AccordionItem/AccordionItem.d.ts +5 -1
- package/build/es/components/AccordionItem/AccordionItem.js +17 -7
- package/build/es/components/ButtonIcon/ButtonIcon.d.ts +6 -0
- package/build/es/components/ButtonIcon/ButtonIcon.js +2 -2
- package/build/es/components/EmptyState/EmptyState.d.ts +4 -0
- package/build/es/components/EmptyState/EmptyState.js +2 -2
- package/build/es/components/Expander/Expander.js +8 -2
- package/build/es/components/Footer/Components/FooterComponents.js +2 -0
- package/build/es/components/Footer/Footer.js +4 -0
- package/build/es/components/Icon/Icon.d.ts +9 -1
- package/build/es/components/Icon/Icon.js +2 -2
- package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +1 -0
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +7 -4
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -5
- package/build/es/components/MainHeaderNavigation/context/NavContext.d.ts +5 -5
- package/build/es/components/MainHeaderNavigation/globalNavStyles.d.ts +27 -0
- package/build/es/components/MainNavigation/ChildComponents/BusinessMenu.js +1 -0
- package/build/es/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +3 -0
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
- package/build/es/components/MainNavigation/globalNavStyles.d.ts +12 -0
- package/build/es/components/PixelLoader/PixelLoader.d.ts +4 -0
- package/build/es/components/PixelLoader/PixelLoader.js +1 -0
- package/build/es/components/PriorityNavigationItem/PriorityNavigationItem.js +1 -0
- package/build/es/components/ProgressIndicator/ProgressIndicator.d.ts +8 -0
- package/build/es/components/ProgressIndicator/ProgressIndicator.js +12 -5
- package/build/es/components/SecondaryNavigation/SecondaryNavigation.js +1 -0
- package/build/es/components/Selectbox/Selectbox.d.ts +18 -1
- package/build/es/components/Selectbox/Selectbox.js +18 -11
- package/build/es/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +6 -0
- package/build/es/themes/globalStyles.d.ts +9 -0
- package/build/es/themes/globalStyles.js +13 -4
- package/build/es/themes/styled.d.ts +21 -0
- package/build/es/themes/theme.d.ts +3 -0
- package/build/es/themes/themeComponents/color.d.ts +3 -0
- package/build/es/themes/themeComponents/color.js +3 -0
- package/package.json +5 -5
|
@@ -65,8 +65,12 @@ export interface Props {
|
|
|
65
65
|
* Allows to pass a custom className
|
|
66
66
|
*/
|
|
67
67
|
className?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Allows to pass testid string for testing purposes
|
|
70
|
+
*/
|
|
71
|
+
'data-testid'?: string;
|
|
68
72
|
}
|
|
69
73
|
/** @visibleName Accordion Item */
|
|
70
|
-
declare const AccordionItem: ({ type, hasCloseButton, highlightSelected, ...props }: Props) => React.JSX.Element;
|
|
74
|
+
declare const AccordionItem: ({ "data-testid": dataTestId, type, hasCloseButton, highlightSelected, ...props }: Props) => React.JSX.Element;
|
|
71
75
|
/** @component */
|
|
72
76
|
export default AccordionItem;
|
|
@@ -30,7 +30,7 @@ const AccordionItemTitle = styled__default.default.div `
|
|
|
30
30
|
display: flex;
|
|
31
31
|
justify-content: space-between;
|
|
32
32
|
flex-direction: row;
|
|
33
|
-
cursor: pointer;
|
|
33
|
+
cursor: ${p => (p.showPointer ? 'pointer' : 'default')};
|
|
34
34
|
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.6)}
|
|
35
35
|
${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 2)};
|
|
36
36
|
color: ${p => p.isExpanded && p.highlightSelected ? theme.default.color.default.pink : theme.default.color.default.black};
|
|
@@ -65,17 +65,27 @@ const AccordionItemCloseButton = styled__default.default.div `
|
|
|
65
65
|
`;
|
|
66
66
|
/** @visibleName Accordion Item */
|
|
67
67
|
const AccordionItem = (_a) => {
|
|
68
|
-
var
|
|
68
|
+
var _b, _c;
|
|
69
|
+
var { 'data-testid': dataTestId = 'accordion-item', type = 'box', hasCloseButton = false, highlightSelected = type === 'panel' } = _a, props = tslib.__rest(_a, ['data-testid', "type", "hasCloseButton", "highlightSelected"]);
|
|
69
70
|
const contentRef = React.useRef(null);
|
|
71
|
+
const accordionButtonRef = React.useRef(null);
|
|
70
72
|
// Get height when element dimensions change
|
|
71
73
|
const { height: contentHeight } = useResizeObserver.default(contentRef);
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
+
const accordionContentId = `accordion-content-id-${(_b = props.id) !== null && _b !== void 0 ? _b : ''}`;
|
|
75
|
+
const accordionButtonId = `accordion-button-id-${(_c = props.id) !== null && _c !== void 0 ? _c : ''}`;
|
|
76
|
+
const handleInteraction = (callback, event) => {
|
|
77
|
+
callback === null || callback === void 0 ? void 0 : callback(event);
|
|
78
|
+
if (accordionButtonRef.current)
|
|
79
|
+
accordionButtonRef.current.focus();
|
|
80
|
+
};
|
|
81
|
+
const hasFunctionality = Boolean(props.onClick || props.onKeyDown);
|
|
82
|
+
const itemContent = (React__default.default.createElement(AccordionItemContainer, { id: props.id, type: type, className: props.className, "data-testid": dataTestId },
|
|
83
|
+
React__default.default.createElement(AccordionItemTitle, { ref: accordionButtonRef, id: accordionButtonId, tabIndex: hasFunctionality ? 0 : -1, onClick: props.onClick, onKeyDown: props.onKeyDown, isExpanded: Boolean(props.isExpanded), highlightSelected: highlightSelected, "aria-expanded": Boolean(props.isExpanded), "aria-controls": accordionContentId, showPointer: hasFunctionality, "data-testid": `${dataTestId}-title`, role: "button" },
|
|
74
84
|
props.title,
|
|
75
85
|
props.isExpanded ? (React__default.default.createElement(Icon.default, { icon: icons.ChevronUp, color: theme.default.color.default.black, position: "right", "aria-label": props.closeLabel })) : (React__default.default.createElement(Icon.default, { icon: icons.ChevronDown, color: theme.default.color.default.black, position: "right", "aria-label": props.openLabel }))),
|
|
76
|
-
React__default.default.createElement(AccordionItemContentWrapper, { maxHeight: contentHeight, isExpanded: props.isExpanded },
|
|
77
|
-
React__default.default.createElement(AccordionItemContent, { ref: contentRef }, props.children)),
|
|
78
|
-
hasCloseButton && props.isExpanded && (React__default.default.createElement(AccordionItemCloseButton, { tabIndex: 0, onClick: props.onClick, onKeyDown: props.onKeyDown, "aria-label": props.closeLabel, role: "button" },
|
|
86
|
+
React__default.default.createElement(AccordionItemContentWrapper, { maxHeight: contentHeight, isExpanded: props.isExpanded, "aria-labelledby": accordionButtonId, "aria-hidden": !props.isExpanded, "data-testid": `${dataTestId}-content`, role: "region" },
|
|
87
|
+
React__default.default.createElement(AccordionItemContent, { id: accordionContentId, ref: contentRef }, props.children)),
|
|
88
|
+
hasCloseButton && props.isExpanded && (React__default.default.createElement(AccordionItemCloseButton, { tabIndex: 0, onClick: e => handleInteraction(props.onClick, e), onKeyDown: e => handleInteraction(props.onKeyDown, e), "aria-label": props.closeLabel, "data-testid": `${dataTestId}-close-button`, role: "button" },
|
|
79
89
|
React__default.default.createElement("span", null, props.closeLabel),
|
|
80
90
|
React__default.default.createElement(Icon.default, { icon: icons.Close })))));
|
|
81
91
|
return type === 'box' ? (React__default.default.createElement(Box.default, { elevation: props.isExpanded ? 'low' : 'none', padding: "0" }, itemContent)) : (itemContent);
|
|
@@ -20,6 +20,12 @@ interface Props extends Omit<ButtonProps, 'fullWidth'> {
|
|
|
20
20
|
* @default false
|
|
21
21
|
*/
|
|
22
22
|
isReversed?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Aria-expanded for screen readers
|
|
25
|
+
*
|
|
26
|
+
* @default undefined
|
|
27
|
+
*/
|
|
28
|
+
ariaExpanded?: boolean;
|
|
23
29
|
}
|
|
24
30
|
/** @visibleName Button Icon */
|
|
25
31
|
declare const ButtonIcon: ({ icon, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
|
|
@@ -35,7 +35,7 @@ const ButtonElement = styled__default.default.button `
|
|
|
35
35
|
|
|
36
36
|
${({ isReversed }) => isReversed && `flex-direction: row-reverse;`}
|
|
37
37
|
|
|
38
|
-
&:focus {
|
|
38
|
+
&:focus-visible {
|
|
39
39
|
border-radius: ${theme.default.radius.s};
|
|
40
40
|
text-decoration: underline;
|
|
41
41
|
border: 2px solid
|
|
@@ -92,7 +92,7 @@ const ButtonElement = styled__default.default.button `
|
|
|
92
92
|
const ButtonIcon = (_a) => {
|
|
93
93
|
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
94
|
const position = props.isReversed ? 'right' : 'left';
|
|
95
|
-
return (React__default.default.createElement(ButtonElement, Object.assign({ 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 }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
95
|
+
return (React__default.default.createElement(ButtonElement, Object.assign({ 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 }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
96
96
|
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 }),
|
|
97
97
|
props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
|
|
98
98
|
};
|
|
@@ -30,6 +30,10 @@ interface Props {
|
|
|
30
30
|
* Allows to pass a custom className
|
|
31
31
|
*/
|
|
32
32
|
className?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Screen reader label describing the purpose of the EmptyState,
|
|
35
|
+
*/
|
|
36
|
+
ariaLabel?: string;
|
|
33
37
|
}
|
|
34
38
|
/** @visibleName Empty State */
|
|
35
39
|
declare const EmptyState: ({ icon, iconSize, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
@@ -24,9 +24,9 @@ const ContentWrapper = styled.default.div `
|
|
|
24
24
|
/** @visibleName Empty State */
|
|
25
25
|
const EmptyState = (_a) => {
|
|
26
26
|
var { icon = icons.Info, iconSize = '2rem', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["icon", "iconSize", 'data-testid']);
|
|
27
|
-
return (React__default.default.createElement(Box.default, { id: props.id, padding: "1.875rem", className: props.className, "data-testid": dataTestId },
|
|
27
|
+
return (React__default.default.createElement(Box.default, { id: props.id, padding: "1.875rem", className: props.className, "data-testid": dataTestId, role: "region", ariaLabel: props.ariaLabel },
|
|
28
28
|
React__default.default.createElement(ContentWrapper, null,
|
|
29
|
-
React__default.default.createElement(Icon.default, { icon: icon, size: iconSize, color: theme.default.color.default.pink }),
|
|
29
|
+
React__default.default.createElement(Icon.default, { icon: icon, size: iconSize, color: theme.default.color.default.pink, "aria-hidden": true }),
|
|
30
30
|
React__default.default.createElement("div", null, props.children))));
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -40,11 +40,17 @@ const Content = styled.default.div `
|
|
|
40
40
|
`;
|
|
41
41
|
const Expander = (_a) => {
|
|
42
42
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
43
|
+
const handleCloseButtonClick = (e) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
46
|
+
const toggleButton = (_b = e.currentTarget.parentElement) === null || _b === void 0 ? void 0 : _b.previousElementSibling;
|
|
47
|
+
toggleButton === null || toggleButton === void 0 ? void 0 : toggleButton.focus();
|
|
48
|
+
};
|
|
43
49
|
return (React__default.default.createElement(Container, { id: props.id, className: props.className, "data-testid": dataTestId },
|
|
44
|
-
React__default.default.createElement(StyledButtonIcon, { icon: props.isExpanded ? icons.ChevronUp : icons.ChevronDown, onClick: props.onClick, isReversed: true }, props.buttonLabel),
|
|
50
|
+
React__default.default.createElement(StyledButtonIcon, { icon: props.isExpanded ? icons.ChevronUp : icons.ChevronDown, onClick: props.onClick, isReversed: true, ariaExpanded: props.isExpanded }, props.buttonLabel),
|
|
45
51
|
props.isExpanded && (React__default.default.createElement(ContentWrapper, null,
|
|
46
52
|
React__default.default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content` }, props.children),
|
|
47
|
-
props.closeButtonLabel && (React__default.default.createElement(StyledButtonIcon, { icon: icons.Close, onClick:
|
|
53
|
+
props.closeButtonLabel && (React__default.default.createElement(StyledButtonIcon, { icon: icons.Close, onClick: handleCloseButtonClick, "data-testid": dataTestId && `${dataTestId}-close-button` }, props.closeButtonLabel))))));
|
|
48
54
|
};
|
|
49
55
|
|
|
50
56
|
exports.default = Expander;
|
|
@@ -18,6 +18,7 @@ const LinksListEl = styled.default.li `
|
|
|
18
18
|
a {
|
|
19
19
|
line-height: ${theme.default.lineHeight.default};
|
|
20
20
|
color: ${theme.default.color.default.white};
|
|
21
|
+
text-decoration: none;
|
|
21
22
|
&:hover,
|
|
22
23
|
&:focus,
|
|
23
24
|
&:active {
|
|
@@ -151,6 +152,7 @@ const GeneralInformationContainer = styled.default.div `
|
|
|
151
152
|
`;
|
|
152
153
|
const GeneralInformationLink = styled.default.a `
|
|
153
154
|
&:after {
|
|
155
|
+
display: inline-block;
|
|
154
156
|
content: '|';
|
|
155
157
|
padding-left: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.5)};
|
|
156
158
|
}
|
|
@@ -30,6 +30,7 @@ const TopContainer = styled.default.div `
|
|
|
30
30
|
gap: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.9)};
|
|
31
31
|
font-weight: ${theme.default.fontWeight.bold};
|
|
32
32
|
line-height: ${theme.default.lineHeight.default};
|
|
33
|
+
text-decoration: none;
|
|
33
34
|
|
|
34
35
|
&:hover,
|
|
35
36
|
&:focus,
|
|
@@ -68,6 +69,7 @@ const LangLinksContainer = styled.default.div `
|
|
|
68
69
|
const LangLink = styled.default.a `
|
|
69
70
|
background: ${({ isActive }) => isActive ? theme.default.color.background.white.default : 'transparent'};
|
|
70
71
|
color: ${({ isActive }) => (isActive ? theme.default.color.text.plum : theme.default.color.text.white)};
|
|
72
|
+
text-decoration: none;
|
|
71
73
|
&:hover,
|
|
72
74
|
&:active,
|
|
73
75
|
&:focus {
|
|
@@ -149,6 +151,7 @@ const FooterContainer = styled.default.footer `
|
|
|
149
151
|
|
|
150
152
|
nav {
|
|
151
153
|
a {
|
|
154
|
+
text-decoration: none;
|
|
152
155
|
&:not(.active-site) {
|
|
153
156
|
background: transparent;
|
|
154
157
|
}
|
|
@@ -169,6 +172,7 @@ const FooterContainer = styled.default.footer `
|
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
div > a {
|
|
175
|
+
text-decoration: none;
|
|
172
176
|
&:not(${LangLink}) {
|
|
173
177
|
color: ${theme.default.color.text.white};
|
|
174
178
|
&:not(.service-button):hover,
|
|
@@ -52,7 +52,15 @@ export interface Props extends Partial<IconProps> {
|
|
|
52
52
|
* Allows to pass testid string for testing purposes
|
|
53
53
|
*/
|
|
54
54
|
'data-testid'?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Allows to pass aria label for accessibility purposes
|
|
57
|
+
*/
|
|
58
|
+
'aria-label'?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Allows to pass aria hidden for accessibility purposes
|
|
61
|
+
*/
|
|
62
|
+
'aria-hidden'?: boolean;
|
|
55
63
|
}
|
|
56
|
-
declare const Icon: ({ name, icon: IconParam, color, size, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
64
|
+
declare const Icon: ({ name, icon: IconParam, color, size, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-hidden": ariaHidden, ...props }: Props) => React.JSX.Element;
|
|
57
65
|
/** @component */
|
|
58
66
|
export default Icon;
|
|
@@ -35,13 +35,13 @@ const IconContainer = styled.default.span `
|
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
const Icon = (_a) => {
|
|
38
|
-
var { name, icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["name", "icon", "color", "size", 'data-testid']);
|
|
38
|
+
var { name, icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden } = _a, props = tslib.__rest(_a, ["name", "icon", "color", "size", 'data-testid', 'aria-label', 'aria-hidden']);
|
|
39
39
|
// TODO: Remove once https://jira.dna.fi/browse/STYLE-334 is done
|
|
40
40
|
const RenderIcon = name && IconsList[name];
|
|
41
41
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
42
42
|
RenderIcon && (React__default.default.createElement(IconContainer, { position: props.position, size: size, className: "dnasg-icon", "data-testid": dataTestId },
|
|
43
43
|
React__default.default.createElement(RenderIcon, Object.assign({}, props, { size: size, color: color })))),
|
|
44
|
-
IconParam && (React__default.default.createElement(IconContainer, { onClick: props.onClick, position: props.position, size: size, className: `dnasg-icon ${props.className || ''}`.trim(), "data-testid": dataTestId },
|
|
44
|
+
IconParam && (React__default.default.createElement(IconContainer, { onClick: props.onClick, position: props.position, size: size, className: `dnasg-icon ${props.className || ''}`.trim(), "data-testid": dataTestId, "aria-label": ariaLabel, "aria-hidden": ariaHidden, role: !ariaHidden ? 'img' : undefined },
|
|
45
45
|
React__default.default.createElement(IconParam, { size: size, color: color })))));
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -19,6 +19,7 @@ const BusinessMenuLink = styled.default.a `
|
|
|
19
19
|
font-size: ${theme.default.fontSize.xs};
|
|
20
20
|
line-height: ${theme.default.lineHeight.s};
|
|
21
21
|
border-radius: ${theme.default.radius.pill};
|
|
22
|
+
text-decoration: none;
|
|
22
23
|
display: block;
|
|
23
24
|
padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)};
|
|
24
25
|
${styledUtils.media.md `
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { MainHeaderNavigationProps } from '../MainHeaderNavigation';
|
|
4
|
-
interface MainNavTooltipMenuProps extends Pick<MainHeaderNavigationProps, 'onCartButtonClick'> {
|
|
4
|
+
interface MainNavTooltipMenuProps<ContentProps extends object = object> extends Pick<MainHeaderNavigationProps, 'onCartButtonClick'> {
|
|
5
5
|
/** Aria-label for screen readers in mobile */
|
|
6
6
|
ariaLabel?: string;
|
|
7
7
|
/** Tooltip menu content */
|
|
@@ -11,7 +11,7 @@ interface MainNavTooltipMenuProps extends Pick<MainHeaderNavigationProps, 'onCar
|
|
|
11
11
|
/** Tooltip position from right. Default: 1.25rem */
|
|
12
12
|
tooltipRight?: string;
|
|
13
13
|
/** Mandatory Component provided as login content */
|
|
14
|
-
contentComponent?: ReactNode | boolean;
|
|
14
|
+
contentComponent?: ComponentType<ContentProps> | ReactNode | boolean;
|
|
15
15
|
/** Array of tags (lowercase) that will close menu if they are inside the dropdown tooltip menu. default []. THIS CAN BE OVERRIDEN WITH data-no-close="true" in element */
|
|
16
16
|
closeWhenTagClicked?: string[];
|
|
17
17
|
/** Width of the opened menu content. default 20rem. */
|
|
@@ -47,6 +47,9 @@ export declare const IconContainer: import("styled-components").StyledComponent<
|
|
|
47
47
|
sky: string;
|
|
48
48
|
orange: string;
|
|
49
49
|
};
|
|
50
|
+
active: {
|
|
51
|
+
pink: string;
|
|
52
|
+
};
|
|
50
53
|
hover: {
|
|
51
54
|
pink: string;
|
|
52
55
|
};
|
|
@@ -189,5 +192,5 @@ export declare const IconContainer: import("styled-components").StyledComponent<
|
|
|
189
192
|
isActive?: boolean;
|
|
190
193
|
collapseSize: number;
|
|
191
194
|
}, never>;
|
|
192
|
-
declare const MainNavTooltipMenu: ({ ariaLabel, children, closeWhenTagClicked, contentComponent, contentWidth, fullWidthBreakpoint, fullWidthDesktop, globalStateString, tooltipRight, zIndex, ...props }: MainNavTooltipMenuProps) => React.JSX.Element;
|
|
195
|
+
declare const MainNavTooltipMenu: <ContentProps extends object = object>({ ariaLabel, children, closeWhenTagClicked, contentComponent, contentWidth, fullWidthBreakpoint, fullWidthDesktop, globalStateString, tooltipRight, zIndex, ...props }: MainNavTooltipMenuProps<ContentProps>) => React.JSX.Element;
|
|
193
196
|
export default MainNavTooltipMenu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MouseEvent, ReactNode } from 'react';
|
|
1
|
+
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 {
|
|
@@ -11,7 +11,7 @@ export interface MainHeaderNavigationProps {
|
|
|
11
11
|
zIndex?: number;
|
|
12
12
|
search?: boolean;
|
|
13
13
|
searchText?: string;
|
|
14
|
-
searchComponent?: ReactNode | boolean;
|
|
14
|
+
searchComponent?: ComponentType | ReactNode | boolean;
|
|
15
15
|
mainMenuAriaLabel?: string;
|
|
16
16
|
minicart?: boolean;
|
|
17
17
|
minicartText?: string;
|
|
@@ -21,7 +21,7 @@ export interface MainHeaderNavigationProps {
|
|
|
21
21
|
*
|
|
22
22
|
* @deprecated Use `onCartButtonClick` property instead
|
|
23
23
|
*/
|
|
24
|
-
minicartComponent?: ReactNode | boolean;
|
|
24
|
+
minicartComponent?: ComponentType | ReactNode | boolean;
|
|
25
25
|
showMinicart?: boolean;
|
|
26
26
|
/**
|
|
27
27
|
* On Cart button click callback
|
|
@@ -32,10 +32,10 @@ export interface MainHeaderNavigationProps {
|
|
|
32
32
|
languageSelectorText?: string;
|
|
33
33
|
login?: boolean;
|
|
34
34
|
loginText?: string;
|
|
35
|
-
loginComponent?: ReactNode | boolean;
|
|
35
|
+
loginComponent?: ComponentType | ReactNode | boolean;
|
|
36
36
|
isLoggedIn?: boolean;
|
|
37
37
|
collapseSize?: number;
|
|
38
|
-
nextJSLinkComponent: ReactNode | boolean;
|
|
38
|
+
nextJSLinkComponent: ComponentType | ReactNode | boolean;
|
|
39
39
|
currentUrl?: string;
|
|
40
40
|
notificationText?: string;
|
|
41
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
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
4
|
categoryCollectionText: string;
|
|
@@ -13,13 +13,13 @@ export interface NavContextProps {
|
|
|
13
13
|
level1Items: MobileMenuLevel;
|
|
14
14
|
level2Items: MobileMenuLevel;
|
|
15
15
|
lang: string;
|
|
16
|
-
loginComponent?:
|
|
16
|
+
loginComponent?: ComponentType | ReactNode | boolean;
|
|
17
17
|
menuLevel: MenuStates;
|
|
18
|
-
minicartComponent?:
|
|
18
|
+
minicartComponent?: ComponentType | ReactNode | boolean;
|
|
19
19
|
navZIndex: number;
|
|
20
|
-
nextJSLinkComponent: ReactNode | boolean;
|
|
20
|
+
nextJSLinkComponent: ComponentType | ReactNode | boolean;
|
|
21
21
|
resetMenuEvents: () => void;
|
|
22
|
-
searchComponent?:
|
|
22
|
+
searchComponent?: ComponentType | ReactNode | boolean;
|
|
23
23
|
setTooltipItems: Dispatch<SetStateAction<MenuTooltipItems>>;
|
|
24
24
|
showLoginTooltip: boolean;
|
|
25
25
|
showMinicart: boolean;
|
|
@@ -22,6 +22,9 @@ export declare const LogoLink: import("styled-components").StyledComponent<"a",
|
|
|
22
22
|
sky: string;
|
|
23
23
|
orange: string;
|
|
24
24
|
};
|
|
25
|
+
active: {
|
|
26
|
+
pink: string;
|
|
27
|
+
};
|
|
25
28
|
hover: {
|
|
26
29
|
pink: string;
|
|
27
30
|
};
|
|
@@ -185,6 +188,9 @@ export declare const DesktopMenuContainer: import("styled-components").StyledCom
|
|
|
185
188
|
sky: string;
|
|
186
189
|
orange: string;
|
|
187
190
|
};
|
|
191
|
+
active: {
|
|
192
|
+
pink: string;
|
|
193
|
+
};
|
|
188
194
|
hover: {
|
|
189
195
|
pink: string;
|
|
190
196
|
};
|
|
@@ -350,6 +356,9 @@ export declare const MobileMenuButton: import("styled-components").StyledCompone
|
|
|
350
356
|
sky: string;
|
|
351
357
|
orange: string;
|
|
352
358
|
};
|
|
359
|
+
active: {
|
|
360
|
+
pink: string;
|
|
361
|
+
};
|
|
353
362
|
hover: {
|
|
354
363
|
pink: string;
|
|
355
364
|
};
|
|
@@ -513,6 +522,9 @@ export declare const HeaderIconContainer: import("styled-components").StyledComp
|
|
|
513
522
|
sky: string;
|
|
514
523
|
orange: string;
|
|
515
524
|
};
|
|
525
|
+
active: {
|
|
526
|
+
pink: string;
|
|
527
|
+
};
|
|
516
528
|
hover: {
|
|
517
529
|
pink: string;
|
|
518
530
|
};
|
|
@@ -678,6 +690,9 @@ export declare const MenuItem: import("styled-components").StyledComponent<"li",
|
|
|
678
690
|
sky: string;
|
|
679
691
|
orange: string;
|
|
680
692
|
};
|
|
693
|
+
active: {
|
|
694
|
+
pink: string;
|
|
695
|
+
};
|
|
681
696
|
hover: {
|
|
682
697
|
pink: string;
|
|
683
698
|
};
|
|
@@ -844,6 +859,9 @@ export declare const MenuLink: import("styled-components").StyledComponent<"a",
|
|
|
844
859
|
sky: string;
|
|
845
860
|
orange: string;
|
|
846
861
|
};
|
|
862
|
+
active: {
|
|
863
|
+
pink: string;
|
|
864
|
+
};
|
|
847
865
|
hover: {
|
|
848
866
|
pink: string;
|
|
849
867
|
};
|
|
@@ -1009,6 +1027,9 @@ export declare const MenuLinkWithChildren: import("styled-components").StyledCom
|
|
|
1009
1027
|
sky: string;
|
|
1010
1028
|
orange: string;
|
|
1011
1029
|
};
|
|
1030
|
+
active: {
|
|
1031
|
+
pink: string;
|
|
1032
|
+
};
|
|
1012
1033
|
hover: {
|
|
1013
1034
|
pink: string;
|
|
1014
1035
|
};
|
|
@@ -1174,6 +1195,9 @@ export declare const MenuList: import("styled-components").StyledComponent<"ul",
|
|
|
1174
1195
|
sky: string;
|
|
1175
1196
|
orange: string;
|
|
1176
1197
|
};
|
|
1198
|
+
active: {
|
|
1199
|
+
pink: string;
|
|
1200
|
+
};
|
|
1177
1201
|
hover: {
|
|
1178
1202
|
pink: string;
|
|
1179
1203
|
};
|
|
@@ -1339,6 +1363,9 @@ export declare const FeaturedBlock: import("styled-components").StyledComponent<
|
|
|
1339
1363
|
sky: string;
|
|
1340
1364
|
orange: string;
|
|
1341
1365
|
};
|
|
1366
|
+
active: {
|
|
1367
|
+
pink: string;
|
|
1368
|
+
};
|
|
1342
1369
|
hover: {
|
|
1343
1370
|
pink: string;
|
|
1344
1371
|
};
|
|
@@ -15,6 +15,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
15
15
|
const BusinessMenuLink = styled.default.a `
|
|
16
16
|
color: ${p => (p.isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
|
|
17
17
|
display: block;
|
|
18
|
+
text-decoration: none;
|
|
18
19
|
margin: ${p => !p.isMobileMenu
|
|
19
20
|
? `0 ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)}`
|
|
20
21
|
: `${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1.25)} ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)} `};
|
|
@@ -22,6 +22,9 @@ export declare const MenuItem: import("styled-components").StyledComponent<"li",
|
|
|
22
22
|
sky: string;
|
|
23
23
|
orange: string;
|
|
24
24
|
};
|
|
25
|
+
active: {
|
|
26
|
+
pink: string;
|
|
27
|
+
};
|
|
25
28
|
hover: {
|
|
26
29
|
pink: string;
|
|
27
30
|
};
|
|
@@ -187,6 +190,9 @@ export declare const MenuLink: import("styled-components").StyledComponent<"a",
|
|
|
187
190
|
sky: string;
|
|
188
191
|
orange: string;
|
|
189
192
|
};
|
|
193
|
+
active: {
|
|
194
|
+
pink: string;
|
|
195
|
+
};
|
|
190
196
|
hover: {
|
|
191
197
|
pink: string;
|
|
192
198
|
};
|
|
@@ -352,6 +358,9 @@ export declare const MenuLinkWithChildren: import("styled-components").StyledCom
|
|
|
352
358
|
sky: string;
|
|
353
359
|
orange: string;
|
|
354
360
|
};
|
|
361
|
+
active: {
|
|
362
|
+
pink: string;
|
|
363
|
+
};
|
|
355
364
|
hover: {
|
|
356
365
|
pink: string;
|
|
357
366
|
};
|
|
@@ -518,6 +527,9 @@ export declare const MenuList: import("styled-components").StyledComponent<"ul",
|
|
|
518
527
|
sky: string;
|
|
519
528
|
orange: string;
|
|
520
529
|
};
|
|
530
|
+
active: {
|
|
531
|
+
pink: string;
|
|
532
|
+
};
|
|
521
533
|
hover: {
|
|
522
534
|
pink: string;
|
|
523
535
|
};
|
|
@@ -14,6 +14,10 @@ interface Props {
|
|
|
14
14
|
* Allows to pass testid string for testing purposes
|
|
15
15
|
*/
|
|
16
16
|
'data-testid'?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Allows to pass a label for screen readers
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
17
21
|
}
|
|
18
22
|
/** @visibleName Pixel Loader */
|
|
19
23
|
declare const PixelLoader: ({ className, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
@@ -41,6 +41,7 @@ const Pixel = styled.default.div `
|
|
|
41
41
|
const PixelLoader = (_a) => {
|
|
42
42
|
var { className, 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["className", 'data-testid']);
|
|
43
43
|
return (React__default.default.createElement(PixelLoaderWrapper, { className: className, "data-testid": dataTestId },
|
|
44
|
+
props.label && React__default.default.createElement("span", { className: "visually-hidden" }, props.label),
|
|
44
45
|
React__default.default.createElement(Pixel, { color: props.color, delay: "-0.27" }),
|
|
45
46
|
React__default.default.createElement(Pixel, { color: props.color, delay: "-0.18" }),
|
|
46
47
|
React__default.default.createElement(Pixel, { color: props.color, delay: "-0.09" }),
|
|
@@ -34,6 +34,14 @@ interface Props {
|
|
|
34
34
|
* Allows to pass testid string for testing purposes
|
|
35
35
|
*/
|
|
36
36
|
'data-testid'?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Screen reader label describing the purpose of the ProgressIndicator,
|
|
39
|
+
*/
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Screen reader label describing the completed step,
|
|
43
|
+
*/
|
|
44
|
+
completedStepLabel?: string;
|
|
37
45
|
}
|
|
38
46
|
/** @visibleName Progress Indicator */
|
|
39
47
|
declare const ProgressIndicator: ({ activeStep, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
@@ -94,14 +94,19 @@ const ProgressIndicatorItemNumber = styled.default.div `
|
|
|
94
94
|
${({ isActive, isError }) => getBackgroundColor({ isActive, isError })}
|
|
95
95
|
`;
|
|
96
96
|
const ProgressIndicatorItemLabel = styled.default.div `
|
|
97
|
-
display: none;
|
|
98
97
|
font-size: ${({ small }) => (small ? theme.default.fontSize.xs : theme.default.fontSize.s)};
|
|
99
98
|
line-height: ${({ small }) => (small ? theme.default.lineHeight.xs : theme.default.lineHeight.s)};
|
|
100
99
|
font-weight: ${theme.default.fontWeight.bold};
|
|
101
100
|
color: ${({ isActive }) => (isActive ? theme.default.color.text.black : theme.default.color.text.gray)};
|
|
102
101
|
|
|
103
102
|
${styledUtils.media.sm `
|
|
104
|
-
|
|
103
|
+
&.visually-hidden {
|
|
104
|
+
width: auto;
|
|
105
|
+
height: auto;
|
|
106
|
+
overflow: visible;
|
|
107
|
+
clip: auto;
|
|
108
|
+
opacity: 1;
|
|
109
|
+
}
|
|
105
110
|
`}
|
|
106
111
|
`;
|
|
107
112
|
/** @visibleName Progress Indicator */
|
|
@@ -123,10 +128,12 @@ const ProgressIndicator = (_a) => {
|
|
|
123
128
|
};
|
|
124
129
|
return (React__default.default.createElement(ProgressIndicatorItem, { key: id, small: props.small, "aria-current": isActive ? 'step' : 'false' },
|
|
125
130
|
index > 0 && (React__default.default.createElement(ProgressIndicatorItemConnector, { small: props.small, isActive: isActive, isCompleted: isCompleted })),
|
|
126
|
-
React__default.default.createElement(ProgressIndicatorItemNumber, { small: props.small, onClick: handleClick, isActive: isActive, isCompleted: isCompleted, isError: isError, isClickable: isCompleted && Boolean(props.onStepClick) }, isCompleted || isError ? (React__default.default.createElement(
|
|
127
|
-
|
|
131
|
+
React__default.default.createElement(ProgressIndicatorItemNumber, { small: props.small, onClick: handleClick, isActive: isActive, isCompleted: isCompleted, isError: isError, isClickable: isCompleted && Boolean(props.onStepClick) }, isCompleted || isError ? (React__default.default.createElement(React__default.default.Fragment, null,
|
|
132
|
+
isCompleted && props.completedStepLabel && (React__default.default.createElement("span", { className: "visually-hidden" }, props.completedStepLabel)),
|
|
133
|
+
React__default.default.createElement(Icon.default, { icon: isError ? icons.Warning : icons.Check, color: isError ? theme.default.color.text.white : theme.default.color.text.pink, size: "1rem" }))) : (stepNumber)),
|
|
134
|
+
label && (React__default.default.createElement(ProgressIndicatorItemLabel, { small: props.small, onClick: handleClick, isActive: isActive, className: "visually-hidden" }, label))));
|
|
128
135
|
});
|
|
129
|
-
return (React__default.default.createElement(ProgressIndicatorWrapper, { className: props.className, "data-testid": dataTestId }, progressIndicatorItems));
|
|
136
|
+
return (React__default.default.createElement(ProgressIndicatorWrapper, { className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "list" }, progressIndicatorItems));
|
|
130
137
|
};
|
|
131
138
|
|
|
132
139
|
exports.default = ProgressIndicator;
|
|
@@ -96,6 +96,7 @@ const SecondaryNavigationListElement = styled.default.li `
|
|
|
96
96
|
margin: 0 ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
97
97
|
|
|
98
98
|
a {
|
|
99
|
+
text-decoration: none;
|
|
99
100
|
padding: 1rem 0;
|
|
100
101
|
justify-content: start;
|
|
101
102
|
color: ${({ isActive }) => (isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import type { GroupBase, OptionsOrGroups, Props as ReactSelectProps } from 'react-select';
|
|
3
|
+
import type { GroupBase, OptionProps, OptionsOrGroups, Props as ReactSelectProps } from 'react-select';
|
|
3
4
|
interface SelectboxOption {
|
|
4
5
|
label: string;
|
|
5
6
|
value: string;
|
|
@@ -114,6 +115,22 @@ interface Props<Option extends SelectboxOption = SelectboxOption, IsMulti extend
|
|
|
114
115
|
* Allows to pass testid string for testing purposes
|
|
115
116
|
*/
|
|
116
117
|
'data-testid'?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Screen reader label describing the purpose of the SelectBox,
|
|
120
|
+
*/
|
|
121
|
+
ariaLabel?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Allows to pass a screen reader label for the loading indicator
|
|
124
|
+
*/
|
|
125
|
+
loadingLabel?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Allows to pass custom styles
|
|
128
|
+
*/
|
|
129
|
+
styles?: ReactSelectProps<Option, IsMulti, Group>['styles'];
|
|
130
|
+
/**
|
|
131
|
+
* Allows to pass custom option component
|
|
132
|
+
*/
|
|
133
|
+
optionComponent?: ComponentType<OptionProps<Option, IsMulti, Group>>;
|
|
117
134
|
}
|
|
118
135
|
declare const SelectBox: <Option extends SelectboxOption = SelectboxOption, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ noOptionsText, "data-testid": dataTestId, ...props }: Props<Option, IsMulti, Group>) => React.JSX.Element;
|
|
119
136
|
export default SelectBox;
|