@dnanpm/styleguide 3.9.6 → 3.9.8
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/Button/Button.d.ts +13 -1
- package/build/cjs/components/Button/Button.js +5 -5
- package/build/cjs/components/ButtonArrow/ButtonArrow.d.ts +8 -2
- package/build/cjs/components/ButtonArrow/ButtonArrow.js +2 -2
- package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +17 -1
- package/build/cjs/components/ButtonIcon/ButtonIcon.js +5 -5
- package/build/cjs/components/Checkbox/Checkbox.js +65 -4
- 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/Input/Input.d.ts +14 -0
- package/build/cjs/components/Input/Input.js +22 -5
- package/build/cjs/components/Label/Label.d.ts +7 -0
- package/build/cjs/components/Label/Label.js +3 -1
- 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/Modal/Modal.d.ts +51 -27
- package/build/cjs/components/Modal/Modal.js +92 -16
- 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/RadioButton/RadioButton.js +61 -4
- package/build/cjs/components/Search/Search.d.ts +12 -0
- package/build/cjs/components/Search/Search.js +9 -3
- 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 +5 -162
- package/build/cjs/themes/globalStyles.js +11 -61
- 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/Button/Button.d.ts +13 -1
- package/build/es/components/Button/Button.js +5 -5
- package/build/es/components/ButtonArrow/ButtonArrow.d.ts +8 -2
- package/build/es/components/ButtonArrow/ButtonArrow.js +2 -2
- package/build/es/components/ButtonIcon/ButtonIcon.d.ts +17 -1
- package/build/es/components/ButtonIcon/ButtonIcon.js +6 -6
- package/build/es/components/Checkbox/Checkbox.js +65 -4
- 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/Input/Input.d.ts +14 -0
- package/build/es/components/Input/Input.js +22 -5
- package/build/es/components/Label/Label.d.ts +7 -0
- package/build/es/components/Label/Label.js +3 -1
- 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/Modal/Modal.d.ts +51 -27
- package/build/es/components/Modal/Modal.js +93 -17
- 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/RadioButton/RadioButton.js +61 -4
- package/build/es/components/Search/Search.d.ts +12 -0
- package/build/es/components/Search/Search.js +9 -3
- 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 +5 -162
- package/build/es/themes/globalStyles.js +14 -63
- 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 +10 -9
|
@@ -21,7 +21,7 @@ const AccordionItemTitle = styled__default.div `
|
|
|
21
21
|
display: flex;
|
|
22
22
|
justify-content: space-between;
|
|
23
23
|
flex-direction: row;
|
|
24
|
-
cursor: pointer;
|
|
24
|
+
cursor: ${p => (p.showPointer ? 'pointer' : 'default')};
|
|
25
25
|
padding: ${getMultipliedSize(theme.base.baseHeight, 1.6)}
|
|
26
26
|
${getMultipliedSize(theme.base.baseHeight, 2)};
|
|
27
27
|
color: ${p => p.isExpanded && p.highlightSelected ? theme.color.default.pink : theme.color.default.black};
|
|
@@ -56,17 +56,27 @@ const AccordionItemCloseButton = styled__default.div `
|
|
|
56
56
|
`;
|
|
57
57
|
/** @visibleName Accordion Item */
|
|
58
58
|
const AccordionItem = (_a) => {
|
|
59
|
-
var
|
|
59
|
+
var _b, _c;
|
|
60
|
+
var { 'data-testid': dataTestId = 'accordion-item', type = 'box', hasCloseButton = false, highlightSelected = type === 'panel' } = _a, props = __rest(_a, ['data-testid', "type", "hasCloseButton", "highlightSelected"]);
|
|
60
61
|
const contentRef = useRef(null);
|
|
62
|
+
const accordionButtonRef = useRef(null);
|
|
61
63
|
// Get height when element dimensions change
|
|
62
64
|
const { height: contentHeight } = useResizeObserver(contentRef);
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
+
const accordionContentId = `accordion-content-id-${(_b = props.id) !== null && _b !== void 0 ? _b : ''}`;
|
|
66
|
+
const accordionButtonId = `accordion-button-id-${(_c = props.id) !== null && _c !== void 0 ? _c : ''}`;
|
|
67
|
+
const handleInteraction = (callback, event) => {
|
|
68
|
+
callback === null || callback === void 0 ? void 0 : callback(event);
|
|
69
|
+
if (accordionButtonRef.current)
|
|
70
|
+
accordionButtonRef.current.focus();
|
|
71
|
+
};
|
|
72
|
+
const hasFunctionality = Boolean(props.onClick || props.onKeyDown);
|
|
73
|
+
const itemContent = (React__default.createElement(AccordionItemContainer, { id: props.id, type: type, className: props.className, "data-testid": dataTestId },
|
|
74
|
+
React__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" },
|
|
65
75
|
props.title,
|
|
66
76
|
props.isExpanded ? (React__default.createElement(Icon, { icon: ChevronUp, color: theme.color.default.black, position: "right", "aria-label": props.closeLabel })) : (React__default.createElement(Icon, { icon: ChevronDown, color: theme.color.default.black, position: "right", "aria-label": props.openLabel }))),
|
|
67
|
-
React__default.createElement(AccordionItemContentWrapper, { maxHeight: contentHeight, isExpanded: props.isExpanded },
|
|
68
|
-
React__default.createElement(AccordionItemContent, { ref: contentRef }, props.children)),
|
|
69
|
-
hasCloseButton && props.isExpanded && (React__default.createElement(AccordionItemCloseButton, { tabIndex: 0, onClick: props.onClick, onKeyDown: props.onKeyDown, "aria-label": props.closeLabel, role: "button" },
|
|
77
|
+
React__default.createElement(AccordionItemContentWrapper, { maxHeight: contentHeight, isExpanded: props.isExpanded, "aria-labelledby": accordionButtonId, "aria-hidden": !props.isExpanded, "data-testid": `${dataTestId}-content`, role: "region" },
|
|
78
|
+
React__default.createElement(AccordionItemContent, { id: accordionContentId, ref: contentRef }, props.children)),
|
|
79
|
+
hasCloseButton && props.isExpanded && (React__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" },
|
|
70
80
|
React__default.createElement("span", null, props.closeLabel),
|
|
71
81
|
React__default.createElement(Icon, { icon: Close })))));
|
|
72
82
|
return type === 'box' ? (React__default.createElement(Box, { elevation: props.isExpanded ? 'low' : 'none', padding: "0" }, itemContent)) : (itemContent);
|
|
@@ -78,10 +78,22 @@ export interface Props {
|
|
|
78
78
|
* Allows to pass testid string for testing purposes
|
|
79
79
|
*/
|
|
80
80
|
'data-testid'?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Allows to pass a screen reader label for the button
|
|
83
|
+
*/
|
|
84
|
+
'aria-label'?: string;
|
|
81
85
|
/**
|
|
82
86
|
* Allows to pass any data-* attribute
|
|
83
87
|
*/
|
|
84
88
|
dataAttributes?: Record<`data-${string}`, string>;
|
|
89
|
+
/**
|
|
90
|
+
* Allows to pass a screen reader label for the loading indicator
|
|
91
|
+
*/
|
|
92
|
+
loadingLabel?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Ref for the button element
|
|
95
|
+
*/
|
|
96
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
85
97
|
}
|
|
86
98
|
export declare const shade: {
|
|
87
99
|
pink: {
|
|
@@ -100,6 +112,6 @@ export declare const shade: {
|
|
|
100
112
|
};
|
|
101
113
|
};
|
|
102
114
|
/** @visibleName Button */
|
|
103
|
-
declare const Button: ({ type, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
|
|
115
|
+
declare const Button: ({ type, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
|
|
104
116
|
/** @component */
|
|
105
117
|
export default Button;
|
|
@@ -43,7 +43,7 @@ const Element = styled__default.button `
|
|
|
43
43
|
display: inline-flex;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
&:focus {
|
|
46
|
+
&:focus-visible {
|
|
47
47
|
color: ${({ darkBg }) => (darkBg ? theme.color.text.plum : theme.color.text.white)};
|
|
48
48
|
background-color: ${({ darkBg }) => darkBg ? theme.color.default.white : shade.plum.darker};
|
|
49
49
|
border: 2px solid
|
|
@@ -57,7 +57,7 @@ const Element = styled__default.button `
|
|
|
57
57
|
color: ${({ darkBg }) => (darkBg ? theme.color.text.plum : theme.color.text.white)};
|
|
58
58
|
background-color: ${({ darkBg }) => darkBg ? theme.color.default.white : shade.plum.darker};
|
|
59
59
|
|
|
60
|
-
&:focus {
|
|
60
|
+
&:focus-visible {
|
|
61
61
|
border: 2px solid
|
|
62
62
|
${({ darkBg }) => (darkBg ? theme.color.focus.dark : theme.color.focus.light)};
|
|
63
63
|
box-shadow: 0px 0px 0px 2px
|
|
@@ -113,11 +113,11 @@ const Element = styled__default.button `
|
|
|
113
113
|
`;
|
|
114
114
|
/** @visibleName Button */
|
|
115
115
|
const Button = (_a) => {
|
|
116
|
-
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = __rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
117
|
-
return (React__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 }, props.dataAttributes, (!props.href && {
|
|
116
|
+
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value', 'aria-label']);
|
|
117
|
+
return (React__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 && {
|
|
118
118
|
name: props.name,
|
|
119
119
|
disabled: props.disabled,
|
|
120
|
-
})), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.plum })) : (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
120
|
+
})), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.plum, label: props.loadingLabel })) : (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
export { Button as default, shade };
|
|
@@ -24,7 +24,7 @@ type Props = ({
|
|
|
24
24
|
*/
|
|
25
25
|
icon: ReactNode;
|
|
26
26
|
direction?: never;
|
|
27
|
-
}) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'data-no-close'> & {
|
|
27
|
+
}) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'data-no-close' | 'href' | 'loadingLabel'> & {
|
|
28
28
|
/**
|
|
29
29
|
* Allows to change the styling of component
|
|
30
30
|
*
|
|
@@ -34,8 +34,14 @@ type Props = ({
|
|
|
34
34
|
* @default 'primary'
|
|
35
35
|
*/
|
|
36
36
|
variant?: ButtonArrowVariant;
|
|
37
|
+
/**
|
|
38
|
+
* Allows to change the type of resulting HTML element from button (`<button></button>`) to anchor (`<a href="..."></a>`)
|
|
39
|
+
*
|
|
40
|
+
* @deprecated Use `Button` component for href support
|
|
41
|
+
*/
|
|
42
|
+
href?: string;
|
|
37
43
|
};
|
|
38
44
|
/** @visibleName Button Arrow */
|
|
39
|
-
declare const ButtonArrow: ({ variant, "data-testid": dataTestId, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
|
|
45
|
+
declare const ButtonArrow: ({ variant, "data-testid": dataTestId, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
|
|
40
46
|
/** @component */
|
|
41
47
|
export default ButtonArrow;
|
|
@@ -62,9 +62,9 @@ const buttonsMap = {
|
|
|
62
62
|
};
|
|
63
63
|
/** @visibleName Button Arrow */
|
|
64
64
|
const ButtonArrow = (_a) => {
|
|
65
|
-
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = __rest(_a, ["variant", 'data-testid', 'data-track-value']);
|
|
65
|
+
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["variant", 'data-testid', 'data-track-value', 'aria-label']);
|
|
66
66
|
const Element = buttonsMap[variant];
|
|
67
|
-
return (React__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 }, props.direction ? (React__default.createElement(Icon, { icon: iconsMap[props.direction], size: "1rem" })) : (isValidElement(props.icon) && props.icon.type === Icon && props.icon)));
|
|
67
|
+
return (React__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 }, props.direction ? (React__default.createElement(Icon, { icon: iconsMap[props.direction], size: "1rem", "aria-hidden": true })) : (isValidElement(props.icon) && props.icon.type === Icon && props.icon)));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export { ButtonArrow as default };
|
|
@@ -20,8 +20,24 @@ 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;
|
|
29
|
+
/**
|
|
30
|
+
* Allows to pass aria hidden to the icon element for screen readers
|
|
31
|
+
*
|
|
32
|
+
* @default undefined
|
|
33
|
+
*/
|
|
34
|
+
ariaHidden?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Screen reader label describing the purpose of the ButtonIcon,
|
|
37
|
+
*/
|
|
38
|
+
ariaLabel?: string;
|
|
23
39
|
}
|
|
24
40
|
/** @visibleName Button Icon */
|
|
25
|
-
declare const ButtonIcon:
|
|
41
|
+
declare const ButtonIcon: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
26
42
|
/** @component */
|
|
27
43
|
export default ButtonIcon;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
2
|
import { EditUnderline } from '@dnanpm/icons';
|
|
3
|
-
import React__default from 'react';
|
|
3
|
+
import React__default, { forwardRef } from 'react';
|
|
4
4
|
import styled__default, { css } from 'styled-components';
|
|
5
5
|
import theme from '../../themes/theme.js';
|
|
6
6
|
import { getDividedSize, media } from '../../utils/styledUtils.js';
|
|
@@ -26,7 +26,7 @@ const ButtonElement = styled__default.button `
|
|
|
26
26
|
|
|
27
27
|
${({ isReversed }) => isReversed && `flex-direction: row-reverse;`}
|
|
28
28
|
|
|
29
|
-
&:focus {
|
|
29
|
+
&:focus-visible {
|
|
30
30
|
border-radius: ${theme.radius.s};
|
|
31
31
|
text-decoration: underline;
|
|
32
32
|
border: 2px solid
|
|
@@ -80,12 +80,12 @@ const ButtonElement = styled__default.button `
|
|
|
80
80
|
`}
|
|
81
81
|
`;
|
|
82
82
|
/** @visibleName Button Icon */
|
|
83
|
-
const ButtonIcon = (_a) => {
|
|
83
|
+
const ButtonIcon = forwardRef((_a, ref) => {
|
|
84
84
|
var { icon = EditUnderline, 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = __rest(_a, ["icon", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
85
85
|
const position = props.isReversed ? 'right' : 'left';
|
|
86
|
-
return (React__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.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.black })) : (React__default.createElement(React__default.Fragment, null,
|
|
87
|
-
React__default.createElement(Icon, { icon: icon, color: props.darkBg ? theme.color.default.white : theme.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined }),
|
|
86
|
+
return (React__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.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.black })) : (React__default.createElement(React__default.Fragment, null,
|
|
87
|
+
React__default.createElement(Icon, { icon: icon, color: props.darkBg ? theme.color.default.white : theme.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined, "aria-hidden": props.ariaHidden }),
|
|
88
88
|
props.children && (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
|
|
89
|
-
};
|
|
89
|
+
});
|
|
90
90
|
|
|
91
91
|
export { ButtonIcon as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { CheckboxAndRadioInputCore } from '../../themes/globalStyles.js';
|
|
4
3
|
import styled from '../../themes/styled.js';
|
|
5
4
|
import theme from '../../themes/theme.js';
|
|
6
5
|
import { getMultipliedSize, getDividedSize } from '../../utils/styledUtils.js';
|
|
@@ -18,17 +17,78 @@ const Container = styled.div `
|
|
|
18
17
|
line-height: ${theme.lineHeight.default};
|
|
19
18
|
margin-bottom: ${getMultipliedSize(theme.base.baseHeight, 0.5)};
|
|
20
19
|
`;
|
|
21
|
-
const Input = styled
|
|
20
|
+
const Input = styled.input `
|
|
21
|
+
display: inline-grid;
|
|
22
|
+
appearance: none;
|
|
23
|
+
place-content: center;
|
|
24
|
+
float: left;
|
|
25
|
+
margin: 0;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
font-family: ${theme.fontFamily.default};
|
|
28
|
+
font-size: ${theme.fontSize.default};
|
|
29
|
+
line-height: ${theme.lineHeight.default};
|
|
30
|
+
min-width: ${getMultipliedSize(theme.base.baseWidth, 2)};
|
|
31
|
+
width: ${getMultipliedSize(theme.base.baseWidth, 2)};
|
|
32
|
+
height: ${getMultipliedSize(theme.base.baseWidth, 2)};
|
|
33
|
+
color: ${theme.color.line.L01};
|
|
34
|
+
border: 2px solid ${theme.color.line.L01};
|
|
35
|
+
background-color: ${theme.color.background.white.default};
|
|
22
36
|
position: relative;
|
|
23
37
|
top: ${getDividedSize(theme.base.baseWidth, 5)};
|
|
38
|
+
border-radius: ${theme.radius.s};
|
|
39
|
+
|
|
40
|
+
& + label {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
color: ${theme.color.text.black};
|
|
43
|
+
font-weight: ${theme.fontWeight.medium};
|
|
44
|
+
padding-left: ${getMultipliedSize(theme.base.baseWidth, 1)};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&::before {
|
|
48
|
+
content: '';
|
|
49
|
+
transform: scale(0);
|
|
50
|
+
background-color: currentColor;
|
|
51
|
+
}
|
|
24
52
|
|
|
25
53
|
&:checked {
|
|
54
|
+
color: ${theme.color.default.pink};
|
|
55
|
+
border-color: ${theme.color.default.pink};
|
|
56
|
+
|
|
26
57
|
&::before {
|
|
58
|
+
transform: scale(1);
|
|
27
59
|
width: ${getMultipliedSize(theme.base.baseHeight, 1.6)};
|
|
28
60
|
height: ${getMultipliedSize(theme.base.baseHeight, 1.6)};
|
|
29
61
|
background-image: url('${SVGIconData}');
|
|
30
62
|
}
|
|
31
63
|
}
|
|
64
|
+
|
|
65
|
+
&:disabled {
|
|
66
|
+
cursor: not-allowed;
|
|
67
|
+
color: ${theme.color.text.gray};
|
|
68
|
+
background-color: ${theme.color.line.L02 + theme.color.transparency.T40};
|
|
69
|
+
border-color: ${theme.color.line.L01 + theme.color.transparency.T40};
|
|
70
|
+
|
|
71
|
+
& + label {
|
|
72
|
+
cursor: not-allowed;
|
|
73
|
+
color: ${theme.color.text.gray};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&:disabled:checked {
|
|
78
|
+
color: ${theme.color.background.pink.E02};
|
|
79
|
+
border-color: ${theme.color.background.pink.E02};
|
|
80
|
+
background-color: ${theme.color.background.white.default};
|
|
81
|
+
|
|
82
|
+
&::before {
|
|
83
|
+
background-color: ${theme.color.background.pink.E02};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:focus-visible {
|
|
88
|
+
outline: none;
|
|
89
|
+
box-shadow: 0px 0px 0px 2px ${theme.color.focus.light},
|
|
90
|
+
0px 0px 0px 4px ${theme.color.focus.dark};
|
|
91
|
+
}
|
|
32
92
|
`;
|
|
33
93
|
const Mandatory = styled.span `
|
|
34
94
|
color: ${theme.color.default.pink};
|
|
@@ -42,6 +102,7 @@ const ErrorMessage = styled.div `
|
|
|
42
102
|
`;
|
|
43
103
|
const Checkbox = (_a) => {
|
|
44
104
|
var { 'data-testid': dataTestId } = _a, props = __rest(_a, ['data-testid']);
|
|
105
|
+
const errorId = `${props.id}-error`;
|
|
45
106
|
const handleChange = () => {
|
|
46
107
|
if (props.onChange && !props.disabled) {
|
|
47
108
|
props.onChange(!props.value);
|
|
@@ -49,11 +110,11 @@ const Checkbox = (_a) => {
|
|
|
49
110
|
};
|
|
50
111
|
return (React__default.createElement(React__default.Fragment, null,
|
|
51
112
|
React__default.createElement(Container, null,
|
|
52
|
-
React__default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value),
|
|
113
|
+
React__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 }),
|
|
53
114
|
React__default.createElement("label", { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label` },
|
|
54
115
|
props.label,
|
|
55
116
|
props.required && React__default.createElement(Mandatory, null, "*"))),
|
|
56
|
-
props.error && props.errorMessage && (React__default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error
|
|
117
|
+
props.error && props.errorMessage && (React__default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error`, id: errorId, role: "alert" }, props.errorMessage))));
|
|
57
118
|
};
|
|
58
119
|
|
|
59
120
|
export { Checkbox as default };
|
|
@@ -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;
|
|
@@ -16,9 +16,9 @@ const ContentWrapper = styled.div `
|
|
|
16
16
|
/** @visibleName Empty State */
|
|
17
17
|
const EmptyState = (_a) => {
|
|
18
18
|
var { icon = Info, iconSize = '2rem', 'data-testid': dataTestId } = _a, props = __rest(_a, ["icon", "iconSize", 'data-testid']);
|
|
19
|
-
return (React__default.createElement(Box, { id: props.id, padding: "1.875rem", className: props.className, "data-testid": dataTestId },
|
|
19
|
+
return (React__default.createElement(Box, { id: props.id, padding: "1.875rem", className: props.className, "data-testid": dataTestId, role: "region", ariaLabel: props.ariaLabel },
|
|
20
20
|
React__default.createElement(ContentWrapper, null,
|
|
21
|
-
React__default.createElement(Icon, { icon: icon, size: iconSize, color: theme.color.default.pink }),
|
|
21
|
+
React__default.createElement(Icon, { icon: icon, size: iconSize, color: theme.color.default.pink, "aria-hidden": true }),
|
|
22
22
|
React__default.createElement("div", null, props.children))));
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -32,11 +32,17 @@ const Content = styled.div `
|
|
|
32
32
|
`;
|
|
33
33
|
const Expander = (_a) => {
|
|
34
34
|
var { 'data-testid': dataTestId } = _a, props = __rest(_a, ['data-testid']);
|
|
35
|
+
const handleCloseButtonClick = (e) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
38
|
+
const toggleButton = (_b = e.currentTarget.parentElement) === null || _b === void 0 ? void 0 : _b.previousElementSibling;
|
|
39
|
+
toggleButton === null || toggleButton === void 0 ? void 0 : toggleButton.focus();
|
|
40
|
+
};
|
|
35
41
|
return (React__default.createElement(Container, { id: props.id, className: props.className, "data-testid": dataTestId },
|
|
36
|
-
React__default.createElement(StyledButtonIcon, { icon: props.isExpanded ? ChevronUp : ChevronDown, onClick: props.onClick, isReversed: true }, props.buttonLabel),
|
|
42
|
+
React__default.createElement(StyledButtonIcon, { icon: props.isExpanded ? ChevronUp : ChevronDown, onClick: props.onClick, isReversed: true, ariaExpanded: props.isExpanded }, props.buttonLabel),
|
|
37
43
|
props.isExpanded && (React__default.createElement(ContentWrapper, null,
|
|
38
44
|
React__default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content` }, props.children),
|
|
39
|
-
props.closeButtonLabel && (React__default.createElement(StyledButtonIcon, { icon: Close, onClick:
|
|
45
|
+
props.closeButtonLabel && (React__default.createElement(StyledButtonIcon, { icon: Close, onClick: handleCloseButtonClick, "data-testid": dataTestId && `${dataTestId}-close-button` }, props.closeButtonLabel))))));
|
|
40
46
|
};
|
|
41
47
|
|
|
42
48
|
export { Expander as default };
|
|
@@ -12,6 +12,7 @@ const LinksListEl = styled.li `
|
|
|
12
12
|
a {
|
|
13
13
|
line-height: ${theme.lineHeight.default};
|
|
14
14
|
color: ${theme.color.default.white};
|
|
15
|
+
text-decoration: none;
|
|
15
16
|
&:hover,
|
|
16
17
|
&:focus,
|
|
17
18
|
&:active {
|
|
@@ -145,6 +146,7 @@ const GeneralInformationContainer = styled.div `
|
|
|
145
146
|
`;
|
|
146
147
|
const GeneralInformationLink = styled.a `
|
|
147
148
|
&:after {
|
|
149
|
+
display: inline-block;
|
|
148
150
|
content: '|';
|
|
149
151
|
padding-left: ${getMultipliedSize(theme.base.baseHeight, 1.5)};
|
|
150
152
|
}
|
|
@@ -22,6 +22,7 @@ const TopContainer = styled.div `
|
|
|
22
22
|
gap: ${getMultipliedSize(theme.base.baseHeight, 0.9)};
|
|
23
23
|
font-weight: ${theme.fontWeight.bold};
|
|
24
24
|
line-height: ${theme.lineHeight.default};
|
|
25
|
+
text-decoration: none;
|
|
25
26
|
|
|
26
27
|
&:hover,
|
|
27
28
|
&:focus,
|
|
@@ -60,6 +61,7 @@ const LangLinksContainer = styled.div `
|
|
|
60
61
|
const LangLink = styled.a `
|
|
61
62
|
background: ${({ isActive }) => isActive ? theme.color.background.white.default : 'transparent'};
|
|
62
63
|
color: ${({ isActive }) => (isActive ? theme.color.text.plum : theme.color.text.white)};
|
|
64
|
+
text-decoration: none;
|
|
63
65
|
&:hover,
|
|
64
66
|
&:active,
|
|
65
67
|
&:focus {
|
|
@@ -141,6 +143,7 @@ const FooterContainer = styled.footer `
|
|
|
141
143
|
|
|
142
144
|
nav {
|
|
143
145
|
a {
|
|
146
|
+
text-decoration: none;
|
|
144
147
|
&:not(.active-site) {
|
|
145
148
|
background: transparent;
|
|
146
149
|
}
|
|
@@ -161,6 +164,7 @@ const FooterContainer = styled.footer `
|
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
div > a {
|
|
167
|
+
text-decoration: none;
|
|
164
168
|
&:not(${LangLink}) {
|
|
165
169
|
color: ${theme.color.text.white};
|
|
166
170
|
&: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;
|
|
@@ -27,13 +27,13 @@ const IconContainer = styled.span `
|
|
|
27
27
|
}
|
|
28
28
|
`;
|
|
29
29
|
const Icon = (_a) => {
|
|
30
|
-
var { name, icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId } = _a, props = __rest(_a, ["name", "icon", "color", "size", 'data-testid']);
|
|
30
|
+
var { name, icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden } = _a, props = __rest(_a, ["name", "icon", "color", "size", 'data-testid', 'aria-label', 'aria-hidden']);
|
|
31
31
|
// TODO: Remove once https://jira.dna.fi/browse/STYLE-334 is done
|
|
32
32
|
const RenderIcon = name && IconsList[name];
|
|
33
33
|
return (React__default.createElement(React__default.Fragment, null,
|
|
34
34
|
RenderIcon && (React__default.createElement(IconContainer, { position: props.position, size: size, className: "dnasg-icon", "data-testid": dataTestId },
|
|
35
35
|
React__default.createElement(RenderIcon, Object.assign({}, props, { size: size, color: color })))),
|
|
36
|
-
IconParam && (React__default.createElement(IconContainer, { onClick: props.onClick, position: props.position, size: size, className: `dnasg-icon ${props.className || ''}`.trim(), "data-testid": dataTestId },
|
|
36
|
+
IconParam && (React__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 },
|
|
37
37
|
React__default.createElement(IconParam, { size: size, color: color })))));
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -129,6 +129,20 @@ interface Props {
|
|
|
129
129
|
* Allows to pass a custom className
|
|
130
130
|
*/
|
|
131
131
|
className?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Screen reader label describing the purpose of the Input
|
|
134
|
+
*
|
|
135
|
+
* @default id
|
|
136
|
+
*/
|
|
137
|
+
ariaLabel?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Screen reader label describing the password toggle
|
|
140
|
+
*/
|
|
141
|
+
passwordToggleLabel?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Screen reader label describing the clear button
|
|
144
|
+
*/
|
|
145
|
+
clearButtonLabel?: string;
|
|
132
146
|
/**
|
|
133
147
|
* Allows to pass testid string for testing purposes
|
|
134
148
|
*/
|
|
@@ -24,6 +24,7 @@ const FieldWrapper = styled.div `
|
|
|
24
24
|
height: ${getMultipliedSize(theme.base.baseHeight, 4)};
|
|
25
25
|
padding: 0 ${getMultipliedSize(theme.base.baseWidth, 1)};
|
|
26
26
|
background-color: ${theme.color.background.white.default};
|
|
27
|
+
align-items: center;
|
|
27
28
|
|
|
28
29
|
${({ status }) => status === 'error' &&
|
|
29
30
|
`
|
|
@@ -98,6 +99,11 @@ const StyledInput = styled.input `
|
|
|
98
99
|
color: ${theme.color.text.black}${theme.color.transparency.T40};
|
|
99
100
|
}
|
|
100
101
|
`;
|
|
102
|
+
const StyledButtonIcon = styled(ButtonIcon) `
|
|
103
|
+
.dnasg-icon svg {
|
|
104
|
+
fill: ${theme.color.text.black};
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
101
107
|
const Message = styled.div `
|
|
102
108
|
font-size: ${theme.fontSize.s};
|
|
103
109
|
font-weight: ${theme.fontWeight.book};
|
|
@@ -110,6 +116,7 @@ const ErrorMessage = styled(Message) `
|
|
|
110
116
|
color: ${theme.color.notification.error};
|
|
111
117
|
`;
|
|
112
118
|
const Input = (_a) => {
|
|
119
|
+
var _b;
|
|
113
120
|
var { type = 'text', 'data-testid': dataTestId } = _a, props = __rest(_a, ["type", 'data-testid']);
|
|
114
121
|
const inputRef = useRef(null);
|
|
115
122
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -139,22 +146,32 @@ const Input = (_a) => {
|
|
|
139
146
|
inputRef.current.focus();
|
|
140
147
|
}
|
|
141
148
|
};
|
|
149
|
+
const getDescribedBy = () => {
|
|
150
|
+
if (props.status === 'error' && props.errorMessage) {
|
|
151
|
+
return `${props.id}-error`;
|
|
152
|
+
}
|
|
153
|
+
if (props.status === 'comment' && props.commentMessage) {
|
|
154
|
+
return `${props.id}-comment`;
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
};
|
|
142
158
|
return (React__default.createElement(FieldContainer, { className: props.className },
|
|
143
159
|
props.label && (React__default.createElement(LabelText, { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label`, status: props.status === 'error' ? props.status : undefined, isMandatory: props.required }, props.label)),
|
|
144
160
|
React__default.createElement(FieldWrapper, { status: props.status, "$type": type, "$disabled": props.disabled },
|
|
145
|
-
React__default.createElement(StyledInput, { id: props.id, name: props.name, type: type, value: props.value, placeholder: props.placeholder, onChange: handleChange, onBlur: handleOnBlur, onFocus: props.onFocus, onClick: onClick, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, required: props.required, disabled: props.disabled, autoComplete: props.autocomplete, "aria-disabled": props.disabled, "aria-label": props.id, ref: inputRef, tabIndex: props.tabIndex, "data-testid": dataTestId, readOnly: props.readonly }),
|
|
161
|
+
React__default.createElement(StyledInput, { id: props.id, name: props.name, type: props.readonly ? 'hidden' : type, value: props.value, placeholder: props.placeholder, onChange: handleChange, onBlur: handleOnBlur, onFocus: props.onFocus, onClick: onClick, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, required: props.required, disabled: props.disabled, autoComplete: props.autocomplete, "aria-disabled": props.disabled, "aria-label": !props.label ? (_b = props.ariaLabel) !== null && _b !== void 0 ? _b : props.id : undefined, ref: inputRef, tabIndex: props.tabIndex, "aria-describedby": getDescribedBy(), "data-testid": dataTestId, readOnly: props.readonly }),
|
|
162
|
+
props.readonly && React__default.createElement("div", null, props.value),
|
|
146
163
|
((props.status && props.status !== 'comment') ||
|
|
147
164
|
props.showPasswordToggle ||
|
|
148
165
|
props.disabled ||
|
|
149
166
|
props.onClearableButtonClick) && (React__default.createElement(IconWrapper, null,
|
|
150
|
-
props.showPasswordToggle && (React__default.createElement(
|
|
167
|
+
props.showPasswordToggle && (React__default.createElement(StyledButtonIcon, { icon: showPassword ? EyeOpen : EyeClosed, onClick: togglePasswordVisibility, ariaLabel: props.passwordToggleLabel, ariaHidden: true })),
|
|
151
168
|
(props.status === 'success' || props.status === 'error') && (React__default.createElement(Icon, { icon: iconsMap[props.status], color: theme.color.notification[props.status] })),
|
|
152
169
|
props.disabled && React__default.createElement(Icon, { icon: Lock }),
|
|
153
170
|
props.onClearableButtonClick &&
|
|
154
171
|
Boolean(props.value) &&
|
|
155
|
-
!props.disabled && (React__default.createElement(ButtonIcon, { icon: Close, onClick: props.onClearableButtonClick }))))),
|
|
156
|
-
props.status === 'error' && props.errorMessage && (React__default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage)),
|
|
157
|
-
props.status === 'comment' && props.commentMessage && (React__default.createElement(Message, { "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage))));
|
|
172
|
+
!props.disabled && (React__default.createElement(ButtonIcon, { icon: Close, onClick: props.onClearableButtonClick, ariaLabel: props.clearButtonLabel, ariaHidden: true }))))),
|
|
173
|
+
props.status === 'error' && props.errorMessage && (React__default.createElement(ErrorMessage, { id: `${props.id}-error`, "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage)),
|
|
174
|
+
props.status === 'comment' && props.commentMessage && (React__default.createElement(Message, { id: `${props.id}-comment`, "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage))));
|
|
158
175
|
};
|
|
159
176
|
|
|
160
177
|
export { Input as default };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type LabelType = 'campaign' | 'new' | 'presale' | 'other';
|
|
4
|
+
type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
4
5
|
interface Props {
|
|
6
|
+
/**
|
|
7
|
+
* Enables the Label component to be rendered as a heading element
|
|
8
|
+
*
|
|
9
|
+
* @default 'span'
|
|
10
|
+
*/
|
|
11
|
+
headingLevel?: HeadingLevel;
|
|
5
12
|
/**
|
|
6
13
|
* Allows to change the background color of component
|
|
7
14
|
*/
|
|
@@ -22,10 +22,12 @@ const StyledLabel = styled.span `
|
|
|
22
22
|
text-align: center;
|
|
23
23
|
text-transform: uppercase;
|
|
24
24
|
border-radius: ${theme.radius.pill};
|
|
25
|
+
margin: 0;
|
|
25
26
|
`;
|
|
26
27
|
const Label = (_a) => {
|
|
27
28
|
var { 'data-testid': dataTestId } = _a, props = __rest(_a, ['data-testid']);
|
|
28
|
-
|
|
29
|
+
const HeadingTag = props.headingLevel || 'span';
|
|
30
|
+
return (React__default.createElement(StyledLabel, { as: HeadingTag, type: props.type, className: props.className, "data-testid": dataTestId }, props.children));
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
export { Label as default };
|
|
@@ -11,6 +11,7 @@ const BusinessMenuLink = styled.a `
|
|
|
11
11
|
font-size: ${theme.fontSize.xs};
|
|
12
12
|
line-height: ${theme.lineHeight.s};
|
|
13
13
|
border-radius: ${theme.radius.pill};
|
|
14
|
+
text-decoration: none;
|
|
14
15
|
display: block;
|
|
15
16
|
padding: ${getMultipliedSize(theme.base.baseHeight, 0.5)};
|
|
16
17
|
${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;
|