@dnanpm/styleguide 3.12.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/components/Button/Button.d.ts +1 -7
- package/build/cjs/components/Button/Button.js +3 -3
- package/build/cjs/components/ButtonArrow/ButtonArrow.d.ts +1 -7
- package/build/cjs/components/ButtonArrow/ButtonArrow.js +2 -2
- package/build/cjs/components/ButtonIcon/ButtonIcon.js +3 -3
- package/build/cjs/components/Chip/Chip.d.ts +2 -18
- package/build/cjs/components/Chip/Chip.js +2 -2
- package/build/cjs/components/Drawer/Drawer.d.ts +0 -7
- package/build/cjs/components/Drawer/Drawer.js +1 -1
- package/build/cjs/components/Footer/Components/FooterComponents.js +0 -1
- package/build/cjs/components/Hero/Hero.js +3 -2
- package/build/cjs/components/Icon/Icon.d.ts +2 -8
- package/build/cjs/components/Icon/Icon.js +3 -10
- package/build/cjs/components/Input/Input.d.ts +1 -10
- package/build/cjs/components/LabelText/LabelText.d.ts +1 -6
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +1 -1
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +2 -2
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +1 -7
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.js +1 -3
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.d.ts +0 -1
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.js +0 -1
- package/build/cjs/components/Modal/Modal.d.ts +0 -5
- package/build/cjs/components/ReadMore/ReadMore.d.ts +0 -20
- package/build/cjs/components/ReadMore/ReadMore.js +2 -8
- package/build/cjs/components/Tab/Tab.d.ts +2 -30
- package/build/cjs/components/Tab/Tab.js +2 -33
- package/build/cjs/components/Tabs/Tabs.d.ts +1 -9
- package/build/cjs/components/Tabs/Tabs.js +9 -17
- package/build/cjs/components/index.d.ts +0 -4
- package/build/cjs/hooks/useCloseOutsideOrElementClicked.js +1 -1
- package/build/cjs/index.js +0 -8
- package/build/cjs/themes/themeComponents/navigation.js +0 -4
- package/build/es/components/Button/Button.d.ts +1 -7
- package/build/es/components/Button/Button.js +3 -3
- package/build/es/components/ButtonArrow/ButtonArrow.d.ts +1 -7
- package/build/es/components/ButtonArrow/ButtonArrow.js +2 -2
- package/build/es/components/ButtonIcon/ButtonIcon.js +3 -3
- package/build/es/components/Chip/Chip.d.ts +2 -18
- package/build/es/components/Chip/Chip.js +2 -2
- package/build/es/components/Drawer/Drawer.d.ts +0 -7
- package/build/es/components/Drawer/Drawer.js +1 -1
- package/build/es/components/Footer/Components/FooterComponents.js +0 -1
- package/build/es/components/Hero/Hero.js +3 -2
- package/build/es/components/Icon/Icon.d.ts +2 -8
- package/build/es/components/Icon/Icon.js +3 -10
- package/build/es/components/Input/Input.d.ts +1 -10
- package/build/es/components/LabelText/LabelText.d.ts +1 -6
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +1 -1
- package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +2 -2
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +1 -7
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.js +1 -3
- package/build/es/components/MainHeaderNavigation/context/NavContext.d.ts +0 -1
- package/build/es/components/MainHeaderNavigation/context/NavContext.js +0 -1
- package/build/es/components/Modal/Modal.d.ts +0 -5
- package/build/es/components/ReadMore/ReadMore.d.ts +0 -20
- package/build/es/components/ReadMore/ReadMore.js +2 -8
- package/build/es/components/Tab/Tab.d.ts +2 -30
- package/build/es/components/Tab/Tab.js +2 -33
- package/build/es/components/Tabs/Tabs.d.ts +1 -9
- package/build/es/components/Tabs/Tabs.js +9 -17
- package/build/es/components/index.d.ts +0 -4
- package/build/es/hooks/useCloseOutsideOrElementClicked.js +1 -1
- package/build/es/index.js +0 -4
- package/build/es/themes/themeComponents/navigation.js +1 -3
- package/package.json +12 -12
- package/build/cjs/components/ButtonRound/ButtonRound.d.ts +0 -10
- package/build/cjs/components/ButtonRound/ButtonRound.js +0 -37
- package/build/cjs/components/Icons/index.js +0 -224
- package/build/cjs/components/MainNavigation/ChildComponents/BusinessMenu.d.ts +0 -3
- package/build/cjs/components/MainNavigation/ChildComponents/BusinessMenu.js +0 -59
- package/build/cjs/components/MainNavigation/ChildComponents/DesktopMenu.d.ts +0 -3
- package/build/cjs/components/MainNavigation/ChildComponents/DesktopMenu.js +0 -259
- package/build/cjs/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +0 -10
- package/build/cjs/components/MainNavigation/ChildComponents/HeaderNavigationElements.js +0 -168
- package/build/cjs/components/MainNavigation/ChildComponents/LanguageSelector.d.ts +0 -4
- package/build/cjs/components/MainNavigation/ChildComponents/LanguageSelector.js +0 -38
- package/build/cjs/components/MainNavigation/ChildComponents/LinkModifier.d.ts +0 -9
- package/build/cjs/components/MainNavigation/ChildComponents/LinkModifier.js +0 -38
- package/build/cjs/components/MainNavigation/ChildComponents/LoginTooltip.d.ts +0 -6
- package/build/cjs/components/MainNavigation/ChildComponents/LoginTooltip.js +0 -23
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenu.d.ts +0 -24
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenu.js +0 -104
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +0 -6
- package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +0 -62
- package/build/cjs/components/MainNavigation/ChildComponents/MinicartTooltip.d.ts +0 -7
- package/build/cjs/components/MainNavigation/ChildComponents/MinicartTooltip.js +0 -26
- package/build/cjs/components/MainNavigation/ChildComponents/MobileMenu.d.ts +0 -3
- package/build/cjs/components/MainNavigation/ChildComponents/MobileMenu.js +0 -193
- package/build/cjs/components/MainNavigation/ChildComponents/PageSearch.d.ts +0 -6
- package/build/cjs/components/MainNavigation/ChildComponents/PageSearch.js +0 -23
- package/build/cjs/components/MainNavigation/ChildComponents/Ribbon.d.ts +0 -13
- package/build/cjs/components/MainNavigation/ChildComponents/Ribbon.js +0 -74
- package/build/cjs/components/MainNavigation/MainNavigation.d.ts +0 -38
- package/build/cjs/components/MainNavigation/MainNavigation.js +0 -319
- package/build/cjs/components/MainNavigation/context/MobileMenuContext.d.ts +0 -6
- package/build/cjs/components/MainNavigation/context/MobileMenuContext.js +0 -11
- package/build/cjs/components/MainNavigation/context/NavContext.d.ts +0 -29
- package/build/cjs/components/MainNavigation/context/NavContext.js +0 -46
- package/build/cjs/components/MainNavigation/globalNavStyles.d.ts +0 -13
- package/build/cjs/components/MainNavigation/globalNavStyles.js +0 -94
- package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.d.ts +0 -90
- package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.js +0 -207
- package/build/cjs/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +0 -10
- package/build/cjs/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.js +0 -34
- package/build/cjs/components/TooltipMenu/TooltipMenu.d.ts +0 -45
- package/build/cjs/components/TooltipMenu/TooltipMenu.js +0 -76
- package/build/es/components/ButtonRound/ButtonRound.d.ts +0 -10
- package/build/es/components/ButtonRound/ButtonRound.js +0 -29
- package/build/es/components/Icons/index.js +0 -109
- package/build/es/components/MainNavigation/ChildComponents/BusinessMenu.d.ts +0 -3
- package/build/es/components/MainNavigation/ChildComponents/BusinessMenu.js +0 -51
- package/build/es/components/MainNavigation/ChildComponents/DesktopMenu.d.ts +0 -3
- package/build/es/components/MainNavigation/ChildComponents/DesktopMenu.js +0 -251
- package/build/es/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +0 -10
- package/build/es/components/MainNavigation/ChildComponents/HeaderNavigationElements.js +0 -159
- package/build/es/components/MainNavigation/ChildComponents/LanguageSelector.d.ts +0 -4
- package/build/es/components/MainNavigation/ChildComponents/LanguageSelector.js +0 -30
- package/build/es/components/MainNavigation/ChildComponents/LinkModifier.d.ts +0 -9
- package/build/es/components/MainNavigation/ChildComponents/LinkModifier.js +0 -29
- package/build/es/components/MainNavigation/ChildComponents/LoginTooltip.d.ts +0 -6
- package/build/es/components/MainNavigation/ChildComponents/LoginTooltip.js +0 -15
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenu.d.ts +0 -24
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenu.js +0 -96
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +0 -6
- package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +0 -57
- package/build/es/components/MainNavigation/ChildComponents/MinicartTooltip.d.ts +0 -7
- package/build/es/components/MainNavigation/ChildComponents/MinicartTooltip.js +0 -18
- package/build/es/components/MainNavigation/ChildComponents/MobileMenu.d.ts +0 -3
- package/build/es/components/MainNavigation/ChildComponents/MobileMenu.js +0 -185
- package/build/es/components/MainNavigation/ChildComponents/PageSearch.d.ts +0 -6
- package/build/es/components/MainNavigation/ChildComponents/PageSearch.js +0 -15
- package/build/es/components/MainNavigation/ChildComponents/Ribbon.d.ts +0 -13
- package/build/es/components/MainNavigation/ChildComponents/Ribbon.js +0 -66
- package/build/es/components/MainNavigation/MainNavigation.d.ts +0 -38
- package/build/es/components/MainNavigation/MainNavigation.js +0 -311
- package/build/es/components/MainNavigation/context/MobileMenuContext.d.ts +0 -6
- package/build/es/components/MainNavigation/context/MobileMenuContext.js +0 -7
- package/build/es/components/MainNavigation/context/NavContext.d.ts +0 -29
- package/build/es/components/MainNavigation/context/NavContext.js +0 -42
- package/build/es/components/MainNavigation/globalNavStyles.d.ts +0 -13
- package/build/es/components/MainNavigation/globalNavStyles.js +0 -89
- package/build/es/components/SecondaryNavigation/SecondaryNavigation.d.ts +0 -90
- package/build/es/components/SecondaryNavigation/SecondaryNavigation.js +0 -199
- package/build/es/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +0 -10
- package/build/es/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.js +0 -31
- package/build/es/components/TooltipMenu/TooltipMenu.d.ts +0 -45
- package/build/es/components/TooltipMenu/TooltipMenu.js +0 -68
|
@@ -75,12 +75,6 @@ export interface Props {
|
|
|
75
75
|
* Allows to pass a custom className
|
|
76
76
|
*/
|
|
77
77
|
className?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Adds data attribute `data-no-close` to button and children wrapper
|
|
80
|
-
*
|
|
81
|
-
* @deprecated Nominated for removal due to proposed changes in functionality (https://jira.dna.fi/browse/STYLE-233)
|
|
82
|
-
*/
|
|
83
|
-
'data-no-close'?: string;
|
|
84
78
|
/**
|
|
85
79
|
* Adds data attribute `data-track-value` to button
|
|
86
80
|
*/
|
|
@@ -123,6 +117,6 @@ export declare const shade: {
|
|
|
123
117
|
};
|
|
124
118
|
};
|
|
125
119
|
/** @visibleName Button */
|
|
126
|
-
declare const Button: ({ type, "data-testid": dataTestId, "data-
|
|
120
|
+
declare const Button: ({ type, "data-testid": dataTestId, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
|
|
127
121
|
/** @component */
|
|
128
122
|
export default Button;
|
|
@@ -126,11 +126,11 @@ const Element = styledComponents.styled.button `
|
|
|
126
126
|
/** @visibleName Button */
|
|
127
127
|
const Button = (_a) => {
|
|
128
128
|
var _b;
|
|
129
|
-
var { type = 'submit', 'data-testid': dataTestId, 'data-
|
|
130
|
-
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: (_b = props.nextLink) !== null && _b !== void 0 ? _b : (props.href ? 'a' : undefined), type: props.href ? undefined : type, href: props.href, target: props.href ? props.target : undefined, rel: props.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: props.onClick, onMouseDown: props.onMouseDown, "$small": props.small, "$darkBg": props.darkBg, "$fullWidth": props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-
|
|
129
|
+
var { type = 'submit', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-track-value', 'aria-label']);
|
|
130
|
+
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: (_b = props.nextLink) !== null && _b !== void 0 ? _b : (props.href ? 'a' : undefined), type: props.href ? undefined : type, href: props.href, target: props.href ? props.target : undefined, rel: props.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: props.onClick, onMouseDown: props.onMouseDown, "$small": props.small, "$darkBg": props.darkBg, "$fullWidth": props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
|
|
131
131
|
name: props.name,
|
|
132
132
|
disabled: props.disabled,
|
|
133
|
-
})), 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
|
|
133
|
+
})), 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` }, props.children))));
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
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' | '
|
|
27
|
+
}) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'href' | 'nextLink' | 'loadingLabel'> & {
|
|
28
28
|
/**
|
|
29
29
|
* Allows to change the styling of component
|
|
30
30
|
*
|
|
@@ -34,12 +34,6 @@ 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;
|
|
43
37
|
};
|
|
44
38
|
/** @visibleName Button Arrow */
|
|
45
39
|
declare const ButtonArrow: ({ variant, "data-testid": dataTestId, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
|
|
@@ -74,12 +74,12 @@ const ButtonArrow = (_a) => {
|
|
|
74
74
|
let iconElement = null;
|
|
75
75
|
if (props.direction) {
|
|
76
76
|
const IconComponent = iconsMap[props.direction];
|
|
77
|
-
iconElement = React__default.default.createElement(IconComponent, { size: "1rem" });
|
|
77
|
+
iconElement = React__default.default.createElement(IconComponent, { icon: iconsMap[props.direction], size: "1rem" });
|
|
78
78
|
}
|
|
79
79
|
else if (React.isValidElement(props.icon)) {
|
|
80
80
|
iconElement = React.cloneElement(props.icon, { size: '1rem' });
|
|
81
81
|
}
|
|
82
|
-
return (React__default.default.createElement(Element, { id: props.id,
|
|
82
|
+
return (React__default.default.createElement(Element, { id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes, "aria-label": ariaLabel }, iconElement));
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
exports.default = ButtonArrow;
|
|
@@ -125,11 +125,11 @@ const ButtonElement = styledComponents.styled.button `
|
|
|
125
125
|
`;
|
|
126
126
|
/** @visibleName Button Icon */
|
|
127
127
|
const ButtonIcon = React.forwardRef((_a, ref) => {
|
|
128
|
-
var { icon = icons.EditUnderline, 'data-testid': dataTestId, 'data-
|
|
128
|
+
var { icon = icons.EditUnderline, 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["icon", 'data-testid', 'data-track-value']);
|
|
129
129
|
const position = props.isReversed ? 'right' : 'left';
|
|
130
|
-
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-
|
|
130
|
+
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-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded, "aria-label": props.ariaLabel, "$isLinkStyle": props.isLinkStyle }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black, label: props.loadingLabel })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
131
131
|
React__default.default.createElement(Icon.default, { icon: icon, color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined, "aria-hidden": true }),
|
|
132
|
-
props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text
|
|
132
|
+
props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text` }, props.children))))));
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
exports.default = ButtonIcon;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
type ChipType = 'default' | '
|
|
4
|
-
type ChipVariant = 'outlined' | 'filled';
|
|
3
|
+
type ChipType = 'default' | 'success' | 'error';
|
|
5
4
|
interface Props {
|
|
6
5
|
/**
|
|
7
6
|
* Unique ID for the component
|
|
@@ -11,27 +10,12 @@ interface Props {
|
|
|
11
10
|
* Allows to change the color styling of component, depending on the passed type
|
|
12
11
|
*
|
|
13
12
|
* @param {ChipType} default Uses default color: `theme.color.line.L01`
|
|
14
|
-
* @param {ChipType} info Changes color to default color (this type will be deprecated in the future)
|
|
15
13
|
* @param {ChipType} success Uses `theme.color.notification.success` color for styling
|
|
16
|
-
* @param {ChipType} warning Changes color to default color (this type will be deprecated in the future)
|
|
17
14
|
* @param {ChipType} error Uses `theme.color.notification.error` color for styling
|
|
18
15
|
*
|
|
19
|
-
* @deprecated The 'info' and 'warning' types will be deprecated and removed in the next major release.
|
|
20
|
-
*
|
|
21
16
|
* @default 'default'
|
|
22
17
|
*/
|
|
23
18
|
type?: ChipType;
|
|
24
|
-
/**
|
|
25
|
-
* Allows to change the appearance styling of component, depending on passed variant
|
|
26
|
-
*
|
|
27
|
-
* @param {ChipVariant} outlined
|
|
28
|
-
* @param {ChipVariant} filled
|
|
29
|
-
*
|
|
30
|
-
* @deprecated The styles are now encapsulated within the component. The 'variant' prop will be removed in the next major release.
|
|
31
|
-
*
|
|
32
|
-
* @default 'outlined'
|
|
33
|
-
*/
|
|
34
|
-
variant?: ChipVariant;
|
|
35
19
|
/**
|
|
36
20
|
* Content of the component
|
|
37
21
|
*/
|
|
@@ -58,6 +42,6 @@ interface Props {
|
|
|
58
42
|
*/
|
|
59
43
|
ariaDescribedBy?: string;
|
|
60
44
|
}
|
|
61
|
-
declare const Chip: ({ type,
|
|
45
|
+
declare const Chip: ({ type, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
62
46
|
/** @component */
|
|
63
47
|
export default Chip;
|
|
@@ -56,9 +56,9 @@ const Element = styledComponents.styled.div `
|
|
|
56
56
|
}
|
|
57
57
|
`;
|
|
58
58
|
const Chip = (_a) => {
|
|
59
|
-
var { type = 'default',
|
|
59
|
+
var { type = 'default', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", 'data-testid']);
|
|
60
60
|
const label = props.ariaLabel || (typeof props.children === 'string' ? props.children : undefined);
|
|
61
|
-
return (React__default.default.createElement(Element, { as: props.onClick ? 'button' : 'div', id: props.id, "$type": type,
|
|
61
|
+
return (React__default.default.createElement(Element, { as: props.onClick ? 'button' : 'div', id: props.id, "$type": type, onClick: props.onClick, className: props.className, "data-testid": dataTestId, "aria-label": label, "aria-describedby": props.ariaDescribedBy, tabIndex: 0 }, props.children));
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
exports.default = Chip;
|
|
@@ -60,13 +60,6 @@ interface Props {
|
|
|
60
60
|
* @default 'right'
|
|
61
61
|
*/
|
|
62
62
|
side?: Side;
|
|
63
|
-
/**
|
|
64
|
-
* Allows to pass a custom margin
|
|
65
|
-
*
|
|
66
|
-
* @default '0'
|
|
67
|
-
* @deprecated Will be removed in the next major version
|
|
68
|
-
*/
|
|
69
|
-
margin?: string;
|
|
70
63
|
/**
|
|
71
64
|
* Allows to pass a custom padding
|
|
72
65
|
*
|
|
@@ -179,7 +179,7 @@ const Drawer = (_a) => {
|
|
|
179
179
|
ReactModal__default.default.setAppElement(appElement);
|
|
180
180
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
181
181
|
React__default.default.createElement(StyledReactModal, { id: props.id, isOpen: props.isOpen, overlayElement: ModalOverlay, contentElement: ModalContent, onRequestClose: props.onRequestClose, portalClassName: props.className, contentLabel: props.contentLabel, shouldCloseOnEsc: isClosable, shouldCloseOnOverlayClick: isClosable, closeTimeoutMS: 300, "$size": size, "$side": side },
|
|
182
|
-
React__default.default.createElement(StyledBox, { "data-testid": dataTestId, elevation: "extraHigh",
|
|
182
|
+
React__default.default.createElement(StyledBox, { "data-testid": dataTestId, elevation: "extraHigh", padding: "0" },
|
|
183
183
|
React__default.default.createElement(ContentContainer, null,
|
|
184
184
|
React__default.default.createElement(Header, { "$variant": variant, "data-testid": dataTestId && `${dataTestId}-header` },
|
|
185
185
|
React__default.default.createElement(Title, { "$size": size, "$variant": variant }, props.title),
|
|
@@ -13,7 +13,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
|
|
14
14
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
15
|
|
|
16
|
-
/* eslint-disable react/no-array-index-key */
|
|
17
16
|
const linkHoverStyles = styledComponents.css `
|
|
18
17
|
&:hover,
|
|
19
18
|
&:focus,
|
|
@@ -174,8 +174,9 @@ const renderImage = (ImageComponent, imageProps) => {
|
|
|
174
174
|
if (!imageProps)
|
|
175
175
|
return null;
|
|
176
176
|
if (typeof ImageComponent === 'string') {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
const { alt } = imageProps, rest = tslib.__rest(imageProps, ["alt"]);
|
|
178
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
179
|
+
return React__default.default.createElement("img", Object.assign({ alt: alt }, rest));
|
|
179
180
|
}
|
|
180
181
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
181
182
|
return React__default.default.createElement(ImageComponent, Object.assign({}, imageProps));
|
|
@@ -23,13 +23,7 @@ export interface Props extends Partial<IconProps> {
|
|
|
23
23
|
*
|
|
24
24
|
* @type Icon
|
|
25
25
|
*/
|
|
26
|
-
icon
|
|
27
|
-
/**
|
|
28
|
-
* Icon name
|
|
29
|
-
*
|
|
30
|
-
* @deprecated Use property `icon`
|
|
31
|
-
*/
|
|
32
|
-
name?: string;
|
|
26
|
+
icon: ComponentType<IconType>;
|
|
33
27
|
/**
|
|
34
28
|
* On Icon click callback
|
|
35
29
|
*/
|
|
@@ -61,6 +55,6 @@ export interface Props extends Partial<IconProps> {
|
|
|
61
55
|
*/
|
|
62
56
|
'aria-hidden'?: boolean;
|
|
63
57
|
}
|
|
64
|
-
declare const Icon: ({
|
|
58
|
+
declare const Icon: ({ icon: IconParam, color, size, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-hidden": ariaHidden, ...props }: Props) => React.JSX.Element;
|
|
65
59
|
/** @component */
|
|
66
60
|
export default Icon;
|
|
@@ -7,13 +7,11 @@ var React = require('react');
|
|
|
7
7
|
var styledComponents = require('styled-components');
|
|
8
8
|
var theme = require('../../themes/theme.js');
|
|
9
9
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
10
|
-
var index = require('../Icons/index.js');
|
|
11
10
|
|
|
12
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
12
|
|
|
14
13
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
14
|
|
|
16
|
-
const IconsList = index;
|
|
17
15
|
const IconContainer = styledComponents.styled.span `
|
|
18
16
|
display: inline-flex;
|
|
19
17
|
width: ${({ size }) => size};
|
|
@@ -35,14 +33,9 @@ const IconContainer = styledComponents.styled.span `
|
|
|
35
33
|
}
|
|
36
34
|
`;
|
|
37
35
|
const Icon = (_a) => {
|
|
38
|
-
var {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
42
|
-
RenderIcon && (React__default.default.createElement(IconContainer, { "$position": props.position, size: size, className: "dnasg-icon", "data-testid": dataTestId },
|
|
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, "aria-label": ariaLabel, "aria-hidden": ariaHidden, role: !ariaHidden ? 'img' : undefined },
|
|
45
|
-
React__default.default.createElement(IconParam, { size: size, color: color })))));
|
|
36
|
+
var { icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden } = _a, props = tslib.__rest(_a, ["icon", "color", "size", 'data-testid', 'aria-label', 'aria-hidden']);
|
|
37
|
+
return (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 },
|
|
38
|
+
React__default.default.createElement(IconParam, { size: size, color: color })));
|
|
46
39
|
};
|
|
47
40
|
|
|
48
41
|
exports.default = Icon;
|
|
@@ -2,10 +2,6 @@ import type { ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type InputStatus = 'none' | 'success' | 'error' | 'comment';
|
|
4
4
|
type InputType = 'email' | 'hidden' | 'number' | 'password' | 'range' | 'search' | 'tel' | 'text' | 'url';
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated Use `DateTimePicker` component
|
|
7
|
-
*/
|
|
8
|
-
type InputTypeDeprecated = 'date' | 'month' | 'time' | 'week';
|
|
9
5
|
interface Props {
|
|
10
6
|
/**
|
|
11
7
|
* Unique ID for the input element
|
|
@@ -28,14 +24,9 @@ interface Props {
|
|
|
28
24
|
* @param {InputType} text Single-line text field
|
|
29
25
|
* @param {InputType} url Used for entering a URL and supported with browser validation
|
|
30
26
|
*
|
|
31
|
-
* @param {InputTypeDeprecated} date DEPRECATED Use `DateTimePicker` component
|
|
32
|
-
* @param {InputTypeDeprecated} month DEPRECATED Use `DateTimePicker` component
|
|
33
|
-
* @param {InputTypeDeprecated} time DEPRECATED Use `DateTimePicker` component
|
|
34
|
-
* @param {InputTypeDeprecated} week DEPRECATED Use `DateTimePicker` component
|
|
35
|
-
*
|
|
36
27
|
* @default 'text'
|
|
37
28
|
*/
|
|
38
|
-
type?: InputType
|
|
29
|
+
type?: InputType;
|
|
39
30
|
/**
|
|
40
31
|
* Default value of input element
|
|
41
32
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
type LabelTextStatus = '
|
|
3
|
+
type LabelTextStatus = 'error';
|
|
4
4
|
interface Props {
|
|
5
5
|
/**
|
|
6
6
|
* Unique ID for the component
|
|
@@ -18,12 +18,7 @@ interface Props {
|
|
|
18
18
|
* Styling of `label` element changes depending on the passed status
|
|
19
19
|
*
|
|
20
20
|
* @param {LabelTextStatus} undefined Default styling
|
|
21
|
-
* @param {LabelTextStatus} info Changes color to default color (this type will be deprecated in the future)
|
|
22
|
-
* @param {LabelTextStatus} success Changes color to default color (this type will be deprecated in the future)
|
|
23
|
-
* @param {LabelTextStatus} warning Changes color to default color (this type will be deprecated in the future)
|
|
24
21
|
* @param {LabelTextStatus} error Changes color to `theme.color.notification.error`
|
|
25
|
-
*
|
|
26
|
-
* @deprecated info, success and warning are deprecated, please switch to default or error status
|
|
27
22
|
*/
|
|
28
23
|
status?: LabelTextStatus;
|
|
29
24
|
/**
|
|
@@ -12,7 +12,7 @@ interface MainNavTooltipMenuProps<ContentProps extends object = object> extends
|
|
|
12
12
|
tooltipRight?: string;
|
|
13
13
|
/** Mandatory Component provided as login content */
|
|
14
14
|
contentComponent?: ComponentType<ContentProps> | ReactNode | boolean;
|
|
15
|
-
/** Array of tags (lowercase) that will close menu if they are inside the dropdown tooltip menu. default []. THIS CAN BE OVERRIDEN WITH
|
|
15
|
+
/** Array of tags (lowercase) that will close menu if they are inside the dropdown tooltip menu. default []. THIS CAN BE OVERRIDEN WITH className="no-close" in element */
|
|
16
16
|
closeWhenTagClicked?: string[];
|
|
17
17
|
/** Width of the opened menu content. default 20rem. */
|
|
18
18
|
contentWidth?: string;
|
|
@@ -14,8 +14,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
15
|
|
|
16
16
|
const MinicartTooltip = ({ minicartAmount, minicartAmountLabel, minicartLabel, onCartButtonClick, }) => {
|
|
17
|
-
const { navZIndex
|
|
18
|
-
return (React__default.default.createElement(MainNavTooltipMenu.default, { closeWhenTagClicked: ['a', 'button'], onCartButtonClick: onCartButtonClick,
|
|
17
|
+
const { navZIndex } = React.useContext(NavContext.default);
|
|
18
|
+
return (React__default.default.createElement(MainNavTooltipMenu.default, { closeWhenTagClicked: ['a', 'button'], onCartButtonClick: onCartButtonClick, contentWidth: "35rem", fullWidthBreakpoint: theme.default.breakpoints.md, globalStateString: "minicart", tooltipRight: "5rem", zIndex: navZIndex + 1 },
|
|
19
19
|
React__default.default.createElement(icons.Cart, null),
|
|
20
20
|
React__default.default.createElement("span", { "aria-hidden": !!minicartAmountLabel }, minicartLabel),
|
|
21
21
|
minicartAmount > 0 && (React__default.default.createElement(NotificationBadge.default, { "data-testid": "header-minicart-amount", right: "5px", top: "-5px", visuallyHiddenText: minicartAmountLabel }, minicartAmount))));
|
|
@@ -19,12 +19,6 @@ export interface MainHeaderNavigationProps {
|
|
|
19
19
|
minicartText?: string;
|
|
20
20
|
minicartAmount?: number;
|
|
21
21
|
minicartAmountLabel?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Defines MinicartComponent when used. If minicart is true but component is not provided, shown as disabled element.
|
|
24
|
-
*
|
|
25
|
-
* @deprecated Use `onCartButtonClick` property instead
|
|
26
|
-
*/
|
|
27
|
-
minicartComponent?: ComponentType | ReactNode | boolean;
|
|
28
22
|
showMinicart?: boolean;
|
|
29
23
|
/**
|
|
30
24
|
* On Cart button click callback
|
|
@@ -47,6 +41,6 @@ export interface MainHeaderNavigationProps {
|
|
|
47
41
|
notificationText?: string;
|
|
48
42
|
}
|
|
49
43
|
/** @visibleName MainHeaderNavigation */
|
|
50
|
-
declare const MainHeaderNavigation: ({ backToPreviousCategoryLabel, businessMenuAriaLabel, categoryCollectionText, closeMainMenuAriaLabel, className, collapseSize, currentUrl, dnaLogoLinkAriaLabel, featuredItemsAriaLabel, isLoggedIn, items, language, languageSelector, languageSelectorText, login, loginComponent, loginText, mainMenuAriaLabel, minicart, minicartAmount, minicartAmountLabel,
|
|
44
|
+
declare const MainHeaderNavigation: ({ backToPreviousCategoryLabel, businessMenuAriaLabel, categoryCollectionText, closeMainMenuAriaLabel, className, collapseSize, currentUrl, dnaLogoLinkAriaLabel, featuredItemsAriaLabel, isLoggedIn, items, language, languageSelector, languageSelectorText, login, loginComponent, loginText, mainMenuAriaLabel, minicart, minicartAmount, minicartAmountLabel, minicartText, nextJSLinkComponent, nextJSLinkLegacyBehavior, notificationText, openMainMenuAriaLabel, search, searchComponent, searchText, showLoginTooltip, showMinicart, zIndex, ...props }: MainHeaderNavigationProps) => React.JSX.Element;
|
|
51
45
|
/** @component */
|
|
52
46
|
export default MainHeaderNavigation;
|
|
@@ -134,7 +134,7 @@ const initiateScrollToHeader = (componentRef) => {
|
|
|
134
134
|
/** @visibleName MainHeaderNavigation */
|
|
135
135
|
const MainHeaderNavigation = (_a) => {
|
|
136
136
|
var _b, _c, _d;
|
|
137
|
-
var { backToPreviousCategoryLabel = '', businessMenuAriaLabel = 'Sivustot', categoryCollectionText = 'Muut kategoriat', closeMainMenuAriaLabel, className, collapseSize = 767, currentUrl = '', dnaLogoLinkAriaLabel, featuredItemsAriaLabel = '', isLoggedIn = false, items = {}, language = 'fi', languageSelector = false, languageSelectorText = 'Vaihda kieltä', login = true, loginComponent, loginText = 'Kirjaudu', mainMenuAriaLabel = 'Päänavigaatio', minicart = true, minicartAmount = 0, minicartAmountLabel,
|
|
137
|
+
var { backToPreviousCategoryLabel = '', businessMenuAriaLabel = 'Sivustot', categoryCollectionText = 'Muut kategoriat', closeMainMenuAriaLabel, className, collapseSize = 767, currentUrl = '', dnaLogoLinkAriaLabel, featuredItemsAriaLabel = '', isLoggedIn = false, items = {}, language = 'fi', languageSelector = false, languageSelectorText = 'Vaihda kieltä', login = true, loginComponent, loginText = 'Kirjaudu', mainMenuAriaLabel = 'Päänavigaatio', minicart = true, minicartAmount = 0, minicartAmountLabel, minicartText = 'Ostoskori', nextJSLinkComponent = false, nextJSLinkLegacyBehavior = true, notificationText = '', openMainMenuAriaLabel, search = true, searchComponent = false, searchText = 'Haku', showLoginTooltip = false, showMinicart = false, zIndex = 1030 } = _a, props = tslib.__rest(_a, ["backToPreviousCategoryLabel", "businessMenuAriaLabel", "categoryCollectionText", "closeMainMenuAriaLabel", "className", "collapseSize", "currentUrl", "dnaLogoLinkAriaLabel", "featuredItemsAriaLabel", "isLoggedIn", "items", "language", "languageSelector", "languageSelectorText", "login", "loginComponent", "loginText", "mainMenuAriaLabel", "minicart", "minicartAmount", "minicartAmountLabel", "minicartText", "nextJSLinkComponent", "nextJSLinkLegacyBehavior", "notificationText", "openMainMenuAriaLabel", "search", "searchComponent", "searchText", "showLoginTooltip", "showMinicart", "zIndex"]);
|
|
138
138
|
const { isMobile } = useWindowSize.default(collapseSize);
|
|
139
139
|
const navigationEl = React.useRef(null);
|
|
140
140
|
const key = ramda.prop('id');
|
|
@@ -254,7 +254,6 @@ const MainHeaderNavigation = (_a) => {
|
|
|
254
254
|
level2Items,
|
|
255
255
|
loginComponent,
|
|
256
256
|
menuLevel,
|
|
257
|
-
minicartComponent,
|
|
258
257
|
navZIndex: zIndex,
|
|
259
258
|
nextJSLinkComponent,
|
|
260
259
|
nextJSLinkLegacyBehavior,
|
|
@@ -280,7 +279,6 @@ const MainHeaderNavigation = (_a) => {
|
|
|
280
279
|
level2Items,
|
|
281
280
|
loginComponent,
|
|
282
281
|
menuLevel,
|
|
283
|
-
minicartComponent,
|
|
284
282
|
nextJSLinkComponent,
|
|
285
283
|
nextJSLinkLegacyBehavior,
|
|
286
284
|
searchComponent,
|
|
@@ -17,7 +17,6 @@ export interface NavContextProps {
|
|
|
17
17
|
lang: string;
|
|
18
18
|
loginComponent?: ComponentType | ReactNode | boolean;
|
|
19
19
|
menuLevel: MenuStates;
|
|
20
|
-
minicartComponent?: ComponentType | ReactNode | boolean;
|
|
21
20
|
navZIndex: number;
|
|
22
21
|
nextJSLinkComponent: ComponentType | ReactNode | boolean;
|
|
23
22
|
nextJSLinkLegacyBehavior?: boolean;
|
|
@@ -63,11 +63,6 @@ interface Props {
|
|
|
63
63
|
* Allows to set property `aria-label` for content element
|
|
64
64
|
*/
|
|
65
65
|
contentLabel?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Allows changing CSS property `max-width` for Modal content wrapper element.
|
|
68
|
-
* @deprecated Replaced with 'size' property
|
|
69
|
-
*/
|
|
70
|
-
maxWidth?: string;
|
|
71
66
|
/**
|
|
72
67
|
* Allows to change the size of the component.
|
|
73
68
|
* Size in mobile view is always 100% of the window size
|
|
@@ -17,12 +17,6 @@ interface Props {
|
|
|
17
17
|
* @default false
|
|
18
18
|
*/
|
|
19
19
|
isExpanded?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Allows to show component in expanded state on init and immediately close after load
|
|
22
|
-
*
|
|
23
|
-
* @deprecated Use `isExpanded` property
|
|
24
|
-
*/
|
|
25
|
-
seoInitExpanded?: boolean;
|
|
26
20
|
/**
|
|
27
21
|
* On ButtonIcon mouse click callback.
|
|
28
22
|
*/
|
|
@@ -46,20 +40,6 @@ interface Props {
|
|
|
46
40
|
* @default '10rem'
|
|
47
41
|
*/
|
|
48
42
|
collapsedSize?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Allows to change the label of ButtonIcon.
|
|
51
|
-
* Note: Ignored when `isStateless` is set to true
|
|
52
|
-
*
|
|
53
|
-
* @deprecated Use `buttonLabel` property
|
|
54
|
-
*/
|
|
55
|
-
showMoreText?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Allows to change the label of ButtonIcon.
|
|
58
|
-
* Note: Ignored when `isStateless` is set to true
|
|
59
|
-
*
|
|
60
|
-
* @deprecated Use `buttonLabel` property
|
|
61
|
-
*/
|
|
62
|
-
showLessText?: string;
|
|
63
43
|
/**
|
|
64
44
|
* Allows to pass a custom className
|
|
65
45
|
*/
|
|
@@ -44,14 +44,13 @@ const StyledButtonIcon = styledComponents.styled(ButtonIcon.default) `
|
|
|
44
44
|
/** @visibleName Read More */
|
|
45
45
|
const ReadMore = (_a) => {
|
|
46
46
|
var { collapsedSize = '10rem', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["collapsedSize", 'data-testid']);
|
|
47
|
-
const [expanded, setExpanded] = React.useState(
|
|
47
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
48
48
|
const contentRef = React.useRef(null);
|
|
49
49
|
const buttonRef = React.useRef(null);
|
|
50
50
|
const userInteractedRef = React.useRef(false);
|
|
51
51
|
// TODO: Remove once https://jira.dna.fi/browse/STYLE-662 is done
|
|
52
52
|
const temporaryIsStatelessFlag = typeof props.isExpanded !== 'undefined';
|
|
53
53
|
const temporaryStateManagement = temporaryIsStatelessFlag ? props.isExpanded : expanded;
|
|
54
|
-
const temporaryButtonLabel = temporaryStateManagement ? props.showLessText : props.showMoreText;
|
|
55
54
|
const handleOnClick = (event) => {
|
|
56
55
|
if (props.onClick) {
|
|
57
56
|
props.onClick(event);
|
|
@@ -61,11 +60,6 @@ const ReadMore = (_a) => {
|
|
|
61
60
|
}
|
|
62
61
|
userInteractedRef.current = true;
|
|
63
62
|
};
|
|
64
|
-
React.useEffect(() => {
|
|
65
|
-
if (props.seoInitExpanded) {
|
|
66
|
-
setExpanded(false);
|
|
67
|
-
}
|
|
68
|
-
}, [props.seoInitExpanded]);
|
|
69
63
|
React.useEffect(() => {
|
|
70
64
|
var _a, _b;
|
|
71
65
|
if (userInteractedRef.current) {
|
|
@@ -92,7 +86,7 @@ const ReadMore = (_a) => {
|
|
|
92
86
|
return (React__default.default.createElement(Container, { id: props.id, className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "region" },
|
|
93
87
|
React__default.default.createElement(Content, { ref: contentRef, "$isExpanded": temporaryStateManagement, "$collapsedSize": collapsedSize, "data-testid": dataTestId && `${dataTestId}-content`, "aria-hidden": temporaryStateManagement ? 'false' : 'true', tabIndex: temporaryStateManagement ? 0 : -1 }, React.Children.map(props.children, forceTabIndexOnTextLinks)),
|
|
94
88
|
React__default.default.createElement(ButtonWrapper, { "$buttonPosition": props.buttonPosition },
|
|
95
|
-
React__default.default.createElement(StyledButtonIcon, { ref: buttonRef, icon: temporaryStateManagement ? icons.ChevronUp : icons.ChevronDown, onClick: handleOnClick, "aria-expanded": temporaryStateManagement },
|
|
89
|
+
React__default.default.createElement(StyledButtonIcon, { ref: buttonRef, icon: temporaryStateManagement ? icons.ChevronUp : icons.ChevronDown, onClick: handleOnClick, "aria-expanded": temporaryStateManagement }, props.buttonLabel))));
|
|
96
90
|
};
|
|
97
91
|
|
|
98
92
|
exports.default = ReadMore;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type Type = 'box' | 'panel' | 'underlined';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use `box`, `panel` or `underlined` types
|
|
6
|
-
*/
|
|
7
|
-
type TypeDeprecated = 'default' | 'gray';
|
|
8
4
|
export interface Props {
|
|
9
5
|
/**
|
|
10
6
|
* Unique ID for the component
|
|
@@ -21,45 +17,21 @@ export interface Props {
|
|
|
21
17
|
* @param {Type} panel Content container remains unstyled
|
|
22
18
|
* @param {Type} underlined Tab label is visually similar to anchor, with content container unstyled
|
|
23
19
|
*
|
|
24
|
-
* @param {TypeDeprecated} default DEPRECATED Use `box` type
|
|
25
|
-
* @param {TypeDeprecated} gray DEPRECATED Use `box`, `panel` or `underlined` types
|
|
26
|
-
*
|
|
27
20
|
* @default 'box'
|
|
28
21
|
*/
|
|
29
|
-
type?: Type
|
|
30
|
-
/**
|
|
31
|
-
* Style of the tab
|
|
32
|
-
*
|
|
33
|
-
* @deprecated Use `type` property
|
|
34
|
-
*/
|
|
35
|
-
tabStyle?: Type;
|
|
22
|
+
type?: Type;
|
|
36
23
|
/**
|
|
37
24
|
* Content of the component
|
|
38
25
|
*/
|
|
39
26
|
children?: ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* Allows to define currently active tab
|
|
42
|
-
*
|
|
43
|
-
* @deprecated Use `isActive` property
|
|
44
|
-
*/
|
|
45
|
-
activeTab?: string;
|
|
46
27
|
/**
|
|
47
28
|
* Allows to set tab as active
|
|
48
29
|
*/
|
|
49
30
|
isActive?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Allows to enable updated internal state management.
|
|
52
|
-
* Note: In updated internal state management, this component acts as truly stateless and can be controlled with `isActive` property.
|
|
53
|
-
*
|
|
54
|
-
* @deprecated Will be removed in next major release
|
|
55
|
-
*/
|
|
56
|
-
isStateless?: boolean;
|
|
57
31
|
/**
|
|
58
32
|
* On tab label click callback
|
|
59
|
-
*
|
|
60
|
-
* @deprecated Parameter `tab` has been deprecated. Use `e` parameter instead
|
|
61
33
|
*/
|
|
62
|
-
onClick?: (
|
|
34
|
+
onClick?: (label: string, e?: MouseEvent<HTMLElement>) => void;
|
|
63
35
|
/**
|
|
64
36
|
* Allows to pass testid string for testing purposes
|
|
65
37
|
*/
|
|
@@ -7,8 +7,6 @@ var React = require('react');
|
|
|
7
7
|
var styledComponents = require('styled-components');
|
|
8
8
|
var theme = require('../../themes/theme.js');
|
|
9
9
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
10
|
-
var Box = require('../Box/Box.js');
|
|
11
|
-
var Divider = require('../Divider/Divider.js');
|
|
12
10
|
|
|
13
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
12
|
|
|
@@ -64,26 +62,6 @@ const TabStyle = styledComponents.styled.li `
|
|
|
64
62
|
background-color: transparent;
|
|
65
63
|
`}
|
|
66
64
|
`;
|
|
67
|
-
const ContentContainer = styledComponents.styled.div `
|
|
68
|
-
${({ $type }) => {
|
|
69
|
-
if ($type === 'box' || $type === 'default') {
|
|
70
|
-
return `
|
|
71
|
-
border-top-left-radius: 0;
|
|
72
|
-
`;
|
|
73
|
-
}
|
|
74
|
-
if ($type === 'panel') {
|
|
75
|
-
return `
|
|
76
|
-
border-top: 1px solid ${theme.default.color.line.L03};
|
|
77
|
-
`;
|
|
78
|
-
}
|
|
79
|
-
if ($type === 'underlined' || $type === 'gray') {
|
|
80
|
-
return `
|
|
81
|
-
margin-top: ${theme.default.grid.gutter};
|
|
82
|
-
`;
|
|
83
|
-
}
|
|
84
|
-
return '';
|
|
85
|
-
}}
|
|
86
|
-
`;
|
|
87
65
|
/** @visibleName Tab */
|
|
88
66
|
const Tab = (_a) => {
|
|
89
67
|
var { type = 'box', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", 'data-testid']);
|
|
@@ -92,17 +70,8 @@ const Tab = (_a) => {
|
|
|
92
70
|
props.onClick(props.label, e);
|
|
93
71
|
}
|
|
94
72
|
};
|
|
95
|
-
const isActive = props
|
|
96
|
-
return type === 'box' || type === '
|
|
97
|
-
React__default.default.createElement(TabLabel, { role: "tab", id: props.id, "$type": type, "aria-selected": isActive, "$isActive": isActive, onClick: onClickHandler, tabIndex: isActive ? 0 : -1 }, props.label),
|
|
98
|
-
props.isStateless &&
|
|
99
|
-
(props.children && (props.activeTab === props.label || props.isActive) ? (React__default.default.createElement(ContentContainer, { role: "tabpanel", "$type": props.tabStyle || type, as: (type === 'box' || type === 'default') && !props.tabStyle
|
|
100
|
-
? Box.default
|
|
101
|
-
: undefined }, props.children)) : (React__default.default.createElement(Divider.default, { margin: "0" }))))) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
102
|
-
React__default.default.createElement(TabStyle, { role: "tab", id: props.id, "$type": props.tabStyle || type, "aria-selected": isActive, "$isActive": isActive, onClick: onClickHandler, tabIndex: isActive ? 0 : -1 }, props.label),
|
|
103
|
-
props.isStateless &&
|
|
104
|
-
props.children &&
|
|
105
|
-
(props.activeTab === props.label || props.isActive) && (React__default.default.createElement(ContentContainer, { role: "tabpanel", "$type": props.tabStyle || type }, props.children))));
|
|
73
|
+
const { isActive } = props;
|
|
74
|
+
return type === 'box' || type === 'panel' ? (React__default.default.createElement(TabLabel, { role: "tab", "data-testid": dataTestId, id: props.id, "$type": type, "aria-selected": isActive, "$isActive": isActive, onClick: onClickHandler, tabIndex: isActive ? 0 : -1 }, props.label)) : (React__default.default.createElement(TabStyle, { role: "tab", "data-testid": dataTestId, id: props.id, "$type": type, "aria-selected": isActive, "$isActive": isActive, onClick: onClickHandler, tabIndex: isActive ? 0 : -1 }, props.label));
|
|
106
75
|
};
|
|
107
76
|
|
|
108
77
|
exports.default = Tab;
|