@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
|
@@ -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);
|
|
@@ -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;
|
|
@@ -52,7 +52,7 @@ const Element = styled__default.default.button `
|
|
|
52
52
|
display: inline-flex;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
&:focus {
|
|
55
|
+
&:focus-visible {
|
|
56
56
|
color: ${({ darkBg }) => (darkBg ? theme.default.color.text.plum : theme.default.color.text.white)};
|
|
57
57
|
background-color: ${({ darkBg }) => darkBg ? theme.default.color.default.white : shade.plum.darker};
|
|
58
58
|
border: 2px solid
|
|
@@ -66,7 +66,7 @@ const Element = styled__default.default.button `
|
|
|
66
66
|
color: ${({ darkBg }) => (darkBg ? theme.default.color.text.plum : theme.default.color.text.white)};
|
|
67
67
|
background-color: ${({ darkBg }) => darkBg ? theme.default.color.default.white : shade.plum.darker};
|
|
68
68
|
|
|
69
|
-
&:focus {
|
|
69
|
+
&:focus-visible {
|
|
70
70
|
border: 2px solid
|
|
71
71
|
${({ darkBg }) => (darkBg ? theme.default.color.focus.dark : theme.default.color.focus.light)};
|
|
72
72
|
box-shadow: 0px 0px 0px 2px
|
|
@@ -122,11 +122,11 @@ const Element = styled__default.default.button `
|
|
|
122
122
|
`;
|
|
123
123
|
/** @visibleName Button */
|
|
124
124
|
const Button = (_a) => {
|
|
125
|
-
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
126
|
-
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue }, props.dataAttributes, (!props.href && {
|
|
125
|
+
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value', 'aria-label']);
|
|
126
|
+
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
|
|
127
127
|
name: props.name,
|
|
128
128
|
disabled: props.disabled,
|
|
129
|
-
})), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.plum })) : (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
129
|
+
})), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.plum, label: props.loadingLabel })) : (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
exports.default = Button;
|
|
@@ -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;
|
|
@@ -71,9 +71,9 @@ const buttonsMap = {
|
|
|
71
71
|
};
|
|
72
72
|
/** @visibleName Button Arrow */
|
|
73
73
|
const ButtonArrow = (_a) => {
|
|
74
|
-
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value']);
|
|
74
|
+
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value', 'aria-label']);
|
|
75
75
|
const Element = buttonsMap[variant];
|
|
76
|
-
return (React__default.default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes }, props.direction ? (React__default.default.createElement(Icon.default, { icon: iconsMap[props.direction], size: "1rem" })) : (React.isValidElement(props.icon) && props.icon.type === Icon.default && props.icon)));
|
|
76
|
+
return (React__default.default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes, "aria-label": ariaLabel }, props.direction ? (React__default.default.createElement(Icon.default, { icon: iconsMap[props.direction], size: "1rem", "aria-hidden": true })) : (React.isValidElement(props.icon) && props.icon.type === Icon.default && props.icon)));
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
exports.default = ButtonArrow;
|
|
@@ -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;
|
|
@@ -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
|
|
@@ -89,12 +89,12 @@ const ButtonElement = styled__default.default.button `
|
|
|
89
89
|
`}
|
|
90
90
|
`;
|
|
91
91
|
/** @visibleName Button Icon */
|
|
92
|
-
const ButtonIcon = (_a) => {
|
|
92
|
+
const ButtonIcon = React.forwardRef((_a, ref) => {
|
|
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,
|
|
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 }),
|
|
95
|
+
return (React__default.default.createElement(ButtonElement, Object.assign({ ref: ref, id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, hideChildrenMobile: props.hideChildrenMobile, isReversed: props.isReversed, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded, "aria-label": props.ariaLabel }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
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, "aria-hidden": props.ariaHidden }),
|
|
97
97
|
props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
|
|
98
|
-
};
|
|
98
|
+
});
|
|
99
99
|
|
|
100
100
|
exports.default = ButtonIcon;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var globalStyles = require('../../themes/globalStyles.js');
|
|
8
7
|
var styled = require('../../themes/styled.js');
|
|
9
8
|
var theme = require('../../themes/theme.js');
|
|
10
9
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
@@ -26,17 +25,78 @@ const Container = styled.default.div `
|
|
|
26
25
|
line-height: ${theme.default.lineHeight.default};
|
|
27
26
|
margin-bottom: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)};
|
|
28
27
|
`;
|
|
29
|
-
const Input = styled.default
|
|
28
|
+
const Input = styled.default.input `
|
|
29
|
+
display: inline-grid;
|
|
30
|
+
appearance: none;
|
|
31
|
+
place-content: center;
|
|
32
|
+
float: left;
|
|
33
|
+
margin: 0;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
font-family: ${theme.default.fontFamily.default};
|
|
36
|
+
font-size: ${theme.default.fontSize.default};
|
|
37
|
+
line-height: ${theme.default.lineHeight.default};
|
|
38
|
+
min-width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
39
|
+
width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
40
|
+
height: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
41
|
+
color: ${theme.default.color.line.L01};
|
|
42
|
+
border: 2px solid ${theme.default.color.line.L01};
|
|
43
|
+
background-color: ${theme.default.color.background.white.default};
|
|
30
44
|
position: relative;
|
|
31
45
|
top: ${styledUtils.getDividedSize(theme.default.base.baseWidth, 5)};
|
|
46
|
+
border-radius: ${theme.default.radius.s};
|
|
47
|
+
|
|
48
|
+
& + label {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
color: ${theme.default.color.text.black};
|
|
51
|
+
font-weight: ${theme.default.fontWeight.medium};
|
|
52
|
+
padding-left: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&::before {
|
|
56
|
+
content: '';
|
|
57
|
+
transform: scale(0);
|
|
58
|
+
background-color: currentColor;
|
|
59
|
+
}
|
|
32
60
|
|
|
33
61
|
&:checked {
|
|
62
|
+
color: ${theme.default.color.default.pink};
|
|
63
|
+
border-color: ${theme.default.color.default.pink};
|
|
64
|
+
|
|
34
65
|
&::before {
|
|
66
|
+
transform: scale(1);
|
|
35
67
|
width: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.6)};
|
|
36
68
|
height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.6)};
|
|
37
69
|
background-image: url('${SVGIconData}');
|
|
38
70
|
}
|
|
39
71
|
}
|
|
72
|
+
|
|
73
|
+
&:disabled {
|
|
74
|
+
cursor: not-allowed;
|
|
75
|
+
color: ${theme.default.color.text.gray};
|
|
76
|
+
background-color: ${theme.default.color.line.L02 + theme.default.color.transparency.T40};
|
|
77
|
+
border-color: ${theme.default.color.line.L01 + theme.default.color.transparency.T40};
|
|
78
|
+
|
|
79
|
+
& + label {
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
color: ${theme.default.color.text.gray};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:disabled:checked {
|
|
86
|
+
color: ${theme.default.color.background.pink.E02};
|
|
87
|
+
border-color: ${theme.default.color.background.pink.E02};
|
|
88
|
+
background-color: ${theme.default.color.background.white.default};
|
|
89
|
+
|
|
90
|
+
&::before {
|
|
91
|
+
background-color: ${theme.default.color.background.pink.E02};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:focus-visible {
|
|
96
|
+
outline: none;
|
|
97
|
+
box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
98
|
+
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
99
|
+
}
|
|
40
100
|
`;
|
|
41
101
|
const Mandatory = styled.default.span `
|
|
42
102
|
color: ${theme.default.color.default.pink};
|
|
@@ -50,6 +110,7 @@ const ErrorMessage = styled.default.div `
|
|
|
50
110
|
`;
|
|
51
111
|
const Checkbox = (_a) => {
|
|
52
112
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
113
|
+
const errorId = `${props.id}-error`;
|
|
53
114
|
const handleChange = () => {
|
|
54
115
|
if (props.onChange && !props.disabled) {
|
|
55
116
|
props.onChange(!props.value);
|
|
@@ -57,11 +118,11 @@ const Checkbox = (_a) => {
|
|
|
57
118
|
};
|
|
58
119
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
59
120
|
React__default.default.createElement(Container, null,
|
|
60
|
-
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value),
|
|
121
|
+
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId, "aria-required": props.required, "aria-invalid": props.error ? 'true' : undefined, "aria-errormessage": props.error && props.errorMessage ? errorId : undefined }),
|
|
61
122
|
React__default.default.createElement("label", { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label` },
|
|
62
123
|
props.label,
|
|
63
124
|
props.required && React__default.default.createElement(Mandatory, null, "*"))),
|
|
64
|
-
props.error && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error
|
|
125
|
+
props.error && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error`, id: errorId, role: "alert" }, props.errorMessage))));
|
|
65
126
|
};
|
|
66
127
|
|
|
67
128
|
exports.default = Checkbox;
|
|
@@ -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
|
|
|
@@ -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
|
*/
|
|
@@ -32,6 +32,7 @@ const FieldWrapper = styled.default.div `
|
|
|
32
32
|
height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 4)};
|
|
33
33
|
padding: 0 ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
|
|
34
34
|
background-color: ${theme.default.color.background.white.default};
|
|
35
|
+
align-items: center;
|
|
35
36
|
|
|
36
37
|
${({ status }) => status === 'error' &&
|
|
37
38
|
`
|
|
@@ -106,6 +107,11 @@ const StyledInput = styled.default.input `
|
|
|
106
107
|
color: ${theme.default.color.text.black}${theme.default.color.transparency.T40};
|
|
107
108
|
}
|
|
108
109
|
`;
|
|
110
|
+
const StyledButtonIcon = styled.default(ButtonIcon.default) `
|
|
111
|
+
.dnasg-icon svg {
|
|
112
|
+
fill: ${theme.default.color.text.black};
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
109
115
|
const Message = styled.default.div `
|
|
110
116
|
font-size: ${theme.default.fontSize.s};
|
|
111
117
|
font-weight: ${theme.default.fontWeight.book};
|
|
@@ -118,6 +124,7 @@ const ErrorMessage = styled.default(Message) `
|
|
|
118
124
|
color: ${theme.default.color.notification.error};
|
|
119
125
|
`;
|
|
120
126
|
const Input = (_a) => {
|
|
127
|
+
var _b;
|
|
121
128
|
var { type = 'text', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", 'data-testid']);
|
|
122
129
|
const inputRef = React.useRef(null);
|
|
123
130
|
const [showPassword, setShowPassword] = React.useState(false);
|
|
@@ -147,22 +154,32 @@ const Input = (_a) => {
|
|
|
147
154
|
inputRef.current.focus();
|
|
148
155
|
}
|
|
149
156
|
};
|
|
157
|
+
const getDescribedBy = () => {
|
|
158
|
+
if (props.status === 'error' && props.errorMessage) {
|
|
159
|
+
return `${props.id}-error`;
|
|
160
|
+
}
|
|
161
|
+
if (props.status === 'comment' && props.commentMessage) {
|
|
162
|
+
return `${props.id}-comment`;
|
|
163
|
+
}
|
|
164
|
+
return undefined;
|
|
165
|
+
};
|
|
150
166
|
return (React__default.default.createElement(FieldContainer, { className: props.className },
|
|
151
167
|
props.label && (React__default.default.createElement(LabelText.default, { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label`, status: props.status === 'error' ? props.status : undefined, isMandatory: props.required }, props.label)),
|
|
152
168
|
React__default.default.createElement(FieldWrapper, { status: props.status, "$type": type, "$disabled": props.disabled },
|
|
153
|
-
React__default.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 }),
|
|
169
|
+
React__default.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 }),
|
|
170
|
+
props.readonly && React__default.default.createElement("div", null, props.value),
|
|
154
171
|
((props.status && props.status !== 'comment') ||
|
|
155
172
|
props.showPasswordToggle ||
|
|
156
173
|
props.disabled ||
|
|
157
174
|
props.onClearableButtonClick) && (React__default.default.createElement(IconWrapper, null,
|
|
158
|
-
props.showPasswordToggle && (React__default.default.createElement(
|
|
175
|
+
props.showPasswordToggle && (React__default.default.createElement(StyledButtonIcon, { icon: showPassword ? icons.EyeOpen : icons.EyeClosed, onClick: togglePasswordVisibility, ariaLabel: props.passwordToggleLabel, ariaHidden: true })),
|
|
159
176
|
(props.status === 'success' || props.status === 'error') && (React__default.default.createElement(Icon.default, { icon: iconsMap[props.status], color: theme.default.color.notification[props.status] })),
|
|
160
177
|
props.disabled && React__default.default.createElement(Icon.default, { icon: icons.Lock }),
|
|
161
178
|
props.onClearableButtonClick &&
|
|
162
179
|
Boolean(props.value) &&
|
|
163
|
-
!props.disabled && (React__default.default.createElement(ButtonIcon.default, { icon: icons.Close, onClick: props.onClearableButtonClick }))))),
|
|
164
|
-
props.status === 'error' && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage)),
|
|
165
|
-
props.status === 'comment' && props.commentMessage && (React__default.default.createElement(Message, { "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage))));
|
|
180
|
+
!props.disabled && (React__default.default.createElement(ButtonIcon.default, { icon: icons.Close, onClick: props.onClearableButtonClick, ariaLabel: props.clearButtonLabel, ariaHidden: true }))))),
|
|
181
|
+
props.status === 'error' && props.errorMessage && (React__default.default.createElement(ErrorMessage, { id: `${props.id}-error`, "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage)),
|
|
182
|
+
props.status === 'comment' && props.commentMessage && (React__default.default.createElement(Message, { id: `${props.id}-comment`, "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage))));
|
|
166
183
|
};
|
|
167
184
|
|
|
168
185
|
exports.default = Input;
|
|
@@ -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
|
*/
|
|
@@ -30,10 +30,12 @@ const StyledLabel = styled.default.span `
|
|
|
30
30
|
text-align: center;
|
|
31
31
|
text-transform: uppercase;
|
|
32
32
|
border-radius: ${theme.default.radius.pill};
|
|
33
|
+
margin: 0;
|
|
33
34
|
`;
|
|
34
35
|
const Label = (_a) => {
|
|
35
36
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
36
|
-
|
|
37
|
+
const HeadingTag = props.headingLevel || 'span';
|
|
38
|
+
return (React__default.default.createElement(StyledLabel, { as: HeadingTag, type: props.type, className: props.className, "data-testid": dataTestId }, props.children));
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
exports.default = Label;
|
|
@@ -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 `
|