@dnanpm/styleguide 3.12.2 → 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/assets/fonts/fonts.css.js +3 -0
- 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/ButtonCard/ButtonCard.js +3 -5
- 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/globalStyles.js +1 -1
- package/build/cjs/themes/themeComponents/navigation.js +0 -4
- package/build/es/assets/fonts/fonts.css.js +1 -0
- 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/ButtonCard/ButtonCard.js +3 -5
- 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/globalStyles.js +1 -1
- package/build/es/themes/themeComponents/navigation.js +1 -3
- package/package.json +15 -15
- package/build/cjs/build/assets/fonts/fonts.css +0 -129
- 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/build/assets/fonts/fonts.css +0 -129
- 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
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { Props as TabProps } from '../Tab/Tab';
|
|
4
|
-
interface Props extends Omit<TabProps, 'label' | 'children' | 'activeTab' | 'onClick'> {
|
|
4
|
+
interface Props extends Omit<TabProps, 'label' | 'children' | 'activeTab' | 'onClick' | 'tabStyle' | 'isStateless'> {
|
|
5
5
|
/**
|
|
6
6
|
* Content of the component
|
|
7
7
|
*
|
|
@@ -22,20 +22,12 @@ interface Props extends Omit<TabProps, 'label' | 'children' | 'activeTab' | 'onC
|
|
|
22
22
|
* Allows to reduce gap between tabs in `underlined` type
|
|
23
23
|
*/
|
|
24
24
|
isNarrowUnderlined?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* On tab change callback
|
|
27
|
-
*
|
|
28
|
-
* @deprecated Use `onClick` property
|
|
29
|
-
*/
|
|
30
|
-
onChange?: (tab: string) => void;
|
|
31
25
|
/**
|
|
32
26
|
* Allows to pass common mouse click callback to all children
|
|
33
27
|
*/
|
|
34
28
|
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
35
29
|
/**
|
|
36
30
|
* Allows to pass a custom className
|
|
37
|
-
*
|
|
38
|
-
* @deprecated Prefix 'tabs' is deprecated and will be removed in next major version
|
|
39
31
|
*/
|
|
40
32
|
className?: string;
|
|
41
33
|
}
|
|
@@ -29,7 +29,7 @@ const Tablist = styledComponents.styled.ul `
|
|
|
29
29
|
`}
|
|
30
30
|
|
|
31
31
|
${({ $type, $isNarrowUnderlined }) => {
|
|
32
|
-
if ($type === 'box' || $type === '
|
|
32
|
+
if ($type === 'box' || $type === 'panel') {
|
|
33
33
|
return `
|
|
34
34
|
margin: 0;
|
|
35
35
|
|
|
@@ -55,17 +55,12 @@ const Tablist = styledComponents.styled.ul `
|
|
|
55
55
|
border-bottom: 1px solid ${theme.default.color.line.L02};
|
|
56
56
|
`;
|
|
57
57
|
}
|
|
58
|
-
if ($type === 'gray') {
|
|
59
|
-
return `
|
|
60
|
-
gap: 1.25rem;
|
|
61
|
-
`;
|
|
62
|
-
}
|
|
63
58
|
return '';
|
|
64
59
|
}}
|
|
65
60
|
`;
|
|
66
61
|
const ContentContainer = styledComponents.styled.div `
|
|
67
62
|
${({ $type, $isFullWidth }) => {
|
|
68
|
-
if ($type === 'box'
|
|
63
|
+
if ($type === 'box') {
|
|
69
64
|
return `
|
|
70
65
|
border-top-left-radius: 0;
|
|
71
66
|
${$isFullWidth ? 'border-top-right-radius: 0;' : ''}
|
|
@@ -76,7 +71,7 @@ const ContentContainer = styledComponents.styled.div `
|
|
|
76
71
|
border-top: 1px solid ${theme.default.color.line.L03};
|
|
77
72
|
`;
|
|
78
73
|
}
|
|
79
|
-
if ($type === 'underlined'
|
|
74
|
+
if ($type === 'underlined') {
|
|
80
75
|
return `
|
|
81
76
|
margin-top: ${theme.default.grid.gutter};
|
|
82
77
|
`;
|
|
@@ -92,9 +87,6 @@ const Tabs = (_a) => {
|
|
|
92
87
|
const onClickTabItem = (tab, e) => {
|
|
93
88
|
setActiveTab(tab);
|
|
94
89
|
if (tab !== activeTab) {
|
|
95
|
-
if (props.onChange) {
|
|
96
|
-
props.onChange(tab);
|
|
97
|
-
}
|
|
98
90
|
if (props.onClick && e) {
|
|
99
91
|
props.onClick(e);
|
|
100
92
|
}
|
|
@@ -115,16 +107,16 @@ const Tabs = (_a) => {
|
|
|
115
107
|
if (!tabs) {
|
|
116
108
|
return null;
|
|
117
109
|
}
|
|
118
|
-
const outerActiveTab = tabs.find(child => child.props.isActive
|
|
110
|
+
const outerActiveTab = tabs.find(child => child.props.isActive);
|
|
119
111
|
if (!activeTab) {
|
|
120
112
|
setActiveTab((outerActiveTab === null || outerActiveTab === void 0 ? void 0 : outerActiveTab.props.label) || tabs[0].props.label);
|
|
121
113
|
}
|
|
122
|
-
return (React__default.default.createElement("div", { className: props.className
|
|
123
|
-
React__default.default.createElement(Tablist, { role: "tablist", "$type":
|
|
124
|
-
tab.type === Tab.default && (React__default.default.createElement(Tab.default, { id: tab.props.id, key: tab.props.label, label: tab.props.label, type:
|
|
114
|
+
return (React__default.default.createElement("div", { className: props.className, "data-testid": dataTestId },
|
|
115
|
+
React__default.default.createElement(Tablist, { role: "tablist", "$type": type, "$isFullWidth": props.isFullWidth, "$isNarrowUnderlined": props.isNarrowUnderlined, onKeyDown: onKeyDown }, React.Children.map(props.children, tab => React.isValidElement(tab) &&
|
|
116
|
+
tab.type === Tab.default && (React__default.default.createElement(Tab.default, { id: tab.props.id, key: tab.props.label, label: tab.props.label, type: type, isActive: tab.props.isActive
|
|
125
117
|
? tab.props.isActive
|
|
126
|
-
: activeTab === tab.props.label,
|
|
127
|
-
React__default.default.createElement(ContentContainer, { role: "tabpanel", "$type":
|
|
118
|
+
: activeTab === tab.props.label, onClick: onClickTabItem, className: tab.props.className, "data-testid": tab.props['data-testid'] })))),
|
|
119
|
+
React__default.default.createElement(ContentContainer, { role: "tabpanel", "$type": type, "$isFullWidth": props.isFullWidth, as: type === 'box' ? Box.default : undefined }, React.Children.map(props.children, tab => React.isValidElement(tab) &&
|
|
128
120
|
tab.type === Tab.default &&
|
|
129
121
|
(tab.props.isActive || tab.props.label === activeTab) &&
|
|
130
122
|
tab.props.children))));
|
|
@@ -9,7 +9,6 @@ export { default as ButtonCard } from './ButtonCard/ButtonCard';
|
|
|
9
9
|
export { default as ButtonClose } from './ButtonClose/ButtonClose';
|
|
10
10
|
export { default as ButtonIcon } from './ButtonIcon/ButtonIcon';
|
|
11
11
|
export { default as ButtonPrimary } from './ButtonPrimary/ButtonPrimary';
|
|
12
|
-
export { default as ButtonRound } from './ButtonRound/ButtonRound';
|
|
13
12
|
export { default as ButtonSecondary } from './ButtonSecondary/ButtonSecondary';
|
|
14
13
|
export { default as Carousel } from './Carousel/Carousel';
|
|
15
14
|
export { default as Checkbox } from './Checkbox/Checkbox';
|
|
@@ -31,7 +30,6 @@ export { default as Input } from './Input/Input';
|
|
|
31
30
|
export { default as Label } from './Label/Label';
|
|
32
31
|
export { default as LabelText } from './LabelText/LabelText';
|
|
33
32
|
export { default as MainHeaderNavigation } from './MainHeaderNavigation/MainHeaderNavigation';
|
|
34
|
-
export { default as MainNavigation } from './MainNavigation/MainNavigation';
|
|
35
33
|
export { default as Modal } from './Modal/Modal';
|
|
36
34
|
export { default as Notification } from './Notification/Notification';
|
|
37
35
|
export { default as NotificationBadge } from './NotificationBadge/NotificationBadge';
|
|
@@ -45,7 +43,6 @@ export { default as ProgressIndicator } from './ProgressIndicator/ProgressIndica
|
|
|
45
43
|
export { default as RadioButton } from './RadioButton/RadioButton';
|
|
46
44
|
export { default as ReadMore } from './ReadMore/ReadMore';
|
|
47
45
|
export { default as Search } from './Search/Search';
|
|
48
|
-
export { default as SecondaryNavigation } from './SecondaryNavigation/SecondaryNavigation';
|
|
49
46
|
export { default as Selectbox } from './Selectbox/Selectbox';
|
|
50
47
|
export { default as Skeleton } from './Skeleton/Skeleton';
|
|
51
48
|
export { default as Switch } from './Switch/Switch';
|
|
@@ -54,4 +51,3 @@ export { default as Tabs } from './Tabs/Tabs';
|
|
|
54
51
|
export { default as Textarea } from './Textarea/Textarea';
|
|
55
52
|
export { default as Toaster } from './Toaster/Toaster';
|
|
56
53
|
export { default as Tooltip } from './Tooltip/Tooltip';
|
|
57
|
-
export { default as TooltipMenu } from './TooltipMenu/TooltipMenu';
|
|
@@ -23,7 +23,7 @@ const useCloseOutsideOrElementClicked = ({ ref, closeWhenTagClicked }, callback)
|
|
|
23
23
|
return tag === ((_b = target.tagName) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || tag === ((_c = parent.tagName) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
24
24
|
});
|
|
25
25
|
if ((ref.current && !ref.current.contains(target)) ||
|
|
26
|
-
(isElementInList && !target.
|
|
26
|
+
(isElementInList && !target.closest('.no-close'))) {
|
|
27
27
|
callback();
|
|
28
28
|
}
|
|
29
29
|
};
|
package/build/cjs/index.js
CHANGED
|
@@ -11,7 +11,6 @@ var ButtonCard = require('./components/ButtonCard/ButtonCard.js');
|
|
|
11
11
|
var ButtonClose = require('./components/ButtonClose/ButtonClose.js');
|
|
12
12
|
var ButtonIcon = require('./components/ButtonIcon/ButtonIcon.js');
|
|
13
13
|
var ButtonPrimary = require('./components/ButtonPrimary/ButtonPrimary.js');
|
|
14
|
-
var ButtonRound = require('./components/ButtonRound/ButtonRound.js');
|
|
15
14
|
var ButtonSecondary = require('./components/ButtonSecondary/ButtonSecondary.js');
|
|
16
15
|
var Carousel = require('./components/Carousel/Carousel.js');
|
|
17
16
|
var Checkbox = require('./components/Checkbox/Checkbox.js');
|
|
@@ -141,7 +140,6 @@ var Input = require('./components/Input/Input.js');
|
|
|
141
140
|
var Label = require('./components/Label/Label.js');
|
|
142
141
|
var LabelText = require('./components/LabelText/LabelText.js');
|
|
143
142
|
var MainHeaderNavigation = require('./components/MainHeaderNavigation/MainHeaderNavigation.js');
|
|
144
|
-
var MainNavigation = require('./components/MainNavigation/MainNavigation.js');
|
|
145
143
|
var Modal = require('./components/Modal/Modal.js');
|
|
146
144
|
var Notification = require('./components/Notification/Notification.js');
|
|
147
145
|
var NotificationBadge = require('./components/NotificationBadge/NotificationBadge.js');
|
|
@@ -155,7 +153,6 @@ var ProgressIndicator = require('./components/ProgressIndicator/ProgressIndicato
|
|
|
155
153
|
var RadioButton = require('./components/RadioButton/RadioButton.js');
|
|
156
154
|
var ReadMore = require('./components/ReadMore/ReadMore.js');
|
|
157
155
|
var Search = require('./components/Search/Search.js');
|
|
158
|
-
var SecondaryNavigation = require('./components/SecondaryNavigation/SecondaryNavigation.js');
|
|
159
156
|
var Selectbox = require('./components/Selectbox/Selectbox.js');
|
|
160
157
|
var Skeleton = require('./components/Skeleton/Skeleton.js');
|
|
161
158
|
var Switch = require('./components/Switch/Switch.js');
|
|
@@ -164,7 +161,6 @@ var Tabs = require('./components/Tabs/Tabs.js');
|
|
|
164
161
|
var Textarea = require('./components/Textarea/Textarea.js');
|
|
165
162
|
var Toaster = require('./components/Toaster/Toaster.js');
|
|
166
163
|
var Tooltip = require('./components/Tooltip/Tooltip.js');
|
|
167
|
-
var TooltipMenu = require('./components/TooltipMenu/TooltipMenu.js');
|
|
168
164
|
var createStyled = require('./utils/createStyled.js');
|
|
169
165
|
var styledComponents = require('styled-components');
|
|
170
166
|
var theme = require('./themes/theme.js');
|
|
@@ -184,7 +180,6 @@ exports.ButtonCard = ButtonCard.default;
|
|
|
184
180
|
exports.ButtonClose = ButtonClose.default;
|
|
185
181
|
exports.ButtonIcon = ButtonIcon.default;
|
|
186
182
|
exports.ButtonPrimary = ButtonPrimary.default;
|
|
187
|
-
exports.ButtonRound = ButtonRound.default;
|
|
188
183
|
exports.ButtonSecondary = ButtonSecondary.default;
|
|
189
184
|
exports.Carousel = Carousel.default;
|
|
190
185
|
exports.Checkbox = Checkbox.default;
|
|
@@ -315,7 +310,6 @@ exports.Input = Input.default;
|
|
|
315
310
|
exports.Label = Label.default;
|
|
316
311
|
exports.LabelText = LabelText.default;
|
|
317
312
|
exports.MainHeaderNavigation = MainHeaderNavigation.default;
|
|
318
|
-
exports.MainNavigation = MainNavigation.default;
|
|
319
313
|
exports.Modal = Modal.default;
|
|
320
314
|
exports.Notification = Notification.default;
|
|
321
315
|
exports.NotificationBadge = NotificationBadge.default;
|
|
@@ -329,7 +323,6 @@ exports.ProgressIndicator = ProgressIndicator.default;
|
|
|
329
323
|
exports.RadioButton = RadioButton.default;
|
|
330
324
|
exports.ReadMore = ReadMore.default;
|
|
331
325
|
exports.Search = Search.default;
|
|
332
|
-
exports.SecondaryNavigation = SecondaryNavigation.default;
|
|
333
326
|
exports.Selectbox = Selectbox.default;
|
|
334
327
|
exports.Skeleton = Skeleton.default;
|
|
335
328
|
exports.Switch = Switch.default;
|
|
@@ -338,7 +331,6 @@ exports.Tabs = Tabs.default;
|
|
|
338
331
|
exports.Textarea = Textarea.default;
|
|
339
332
|
exports.Toaster = Toaster.default;
|
|
340
333
|
exports.Tooltip = Tooltip.default;
|
|
341
|
-
exports.TooltipMenu = TooltipMenu.default;
|
|
342
334
|
exports.createStyled = createStyled.default;
|
|
343
335
|
Object.defineProperty(exports, 'styled', {
|
|
344
336
|
enumerable: true,
|
|
@@ -14,8 +14,6 @@ const headerLogoSize = '3.75rem';
|
|
|
14
14
|
const mobileLogoSize = '3.75em';
|
|
15
15
|
const desktopLogoSize = '5.25em';
|
|
16
16
|
const menuItemMargin = '1rem';
|
|
17
|
-
const ribbonHeight = '1.5625rem';
|
|
18
|
-
const wideMenuBreakpoint = 1280;
|
|
19
17
|
const IconContainerWidth = '3.75rem'; // 60px
|
|
20
18
|
const IconContainerMinWidth = '2.5rem'; // 40px
|
|
21
19
|
const navMaxHeight = '3.75rem'; // 60px
|
|
@@ -51,7 +49,5 @@ exports.mobileNavMaxWidth = mobileNavMaxWidth;
|
|
|
51
49
|
exports.navIconSize = navIconSize;
|
|
52
50
|
exports.navIconSizeMobile = navIconSizeMobile;
|
|
53
51
|
exports.navMaxHeight = navMaxHeight;
|
|
54
|
-
exports.ribbonHeight = ribbonHeight;
|
|
55
52
|
exports.subMenuWidth = subMenuWidth;
|
|
56
53
|
exports.subMenuWidthXl = subMenuWidthXl;
|
|
57
|
-
exports.wideMenuBreakpoint = wideMenuBreakpoint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="@font-face{font-family:'DNA Text';font-style: normal;font-weight: 400;font-display: swap;src: url('https://www.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAText-Regular.woff') format('woff');}@font-face{font-family:'DNA Text';font-style: normal;font-weight: 500;font-display: swap;src: url('https://www.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAText-Medium.woff') format('woff');}@font-face{font-family:'DNA Text';font-style: normal;font-weight: 700;font-display: swap;src: url('https://www.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAText-Bold.woff') format('woff');}@font-face{font-family:'DNA Heading';font-style: normal;font-weight: 600;font-display: swap;src: url('https://www.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAHeading-DemiBold.woff') format('woff');}@font-face{font-family:'DNA Heading';font-style: normal;font-weight: 700;font-display: swap;src: url('https://www.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAHeading-Bold.woff') format('woff');}@font-face{font-family:'DNA Heading';font-style: normal;font-weight: 900;font-display: swap;src: url('https://www.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAHeading-Black.woff') format('woff');}@font-face{font-family:'DNA Numerals';font-style: normal;font-weight: 700;font-display: swap;src: url('https://www.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNANumerals-Bold.woff') format('woff');}@font-face{font-family:'DNA Text Regular';font-style: normal;font-weight: 400;font-display: swap;src: url('https://www.dna.fi/fonts/DNAText-Regular.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAText-Regular.woff') format('woff');}@font-face{font-family:'DNA Text Medium';font-style: normal;font-weight: 500;font-display: swap;src: url('https://www.dna.fi/fonts/DNAText-Medium.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAText-Medium.woff') format('woff');}@font-face{font-family:'DNA Text Bold';font-style: normal;font-weight: 700;font-display: swap;src: url('https://www.dna.fi/fonts/DNAText-Bold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAText-Bold.woff') format('woff');}@font-face{font-family:'DNA Heading Demi Bold';font-style: normal;font-weight: 600;font-display: swap;src: url('https://www.dna.fi/fonts/DNAHeading-DemiBold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAHeading-DemiBold.woff') format('woff');}@font-face{font-family:'DNA Heading Bold';font-style: normal;font-weight: 700;font-display: swap;src: url('https://www.dna.fi/fonts/DNAHeading-Bold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAHeading-Bold.woff') format('woff');}@font-face{font-family:'DNA Heading Black';font-style: normal;font-weight: 900;font-display: swap;src: url('https://www.dna.fi/fonts/DNAHeading-Black.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNAHeading-Black.woff') format('woff');}@font-face{font-family:'DNA Numerals Bold';font-style: normal;font-weight: 700;font-display: swap;src: url('https://www.dna.fi/fonts/DNANumerals-Bold.woff2') format('woff2'),url('https://www.dna.fi/fonts/DNANumerals-Bold.woff') format('woff');}";
|
|
@@ -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;
|
|
@@ -118,11 +118,11 @@ const Element = styled.button `
|
|
|
118
118
|
/** @visibleName Button */
|
|
119
119
|
const Button = (_a) => {
|
|
120
120
|
var _b;
|
|
121
|
-
var { type = 'submit', 'data-testid': dataTestId, 'data-
|
|
122
|
-
return (React__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-
|
|
121
|
+
var { type = 'submit', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["type", 'data-testid', 'data-track-value', 'aria-label']);
|
|
122
|
+
return (React__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 && {
|
|
123
123
|
name: props.name,
|
|
124
124
|
disabled: props.disabled,
|
|
125
|
-
})), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.plum, label: props.loadingLabel })) : (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text
|
|
125
|
+
})), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.plum, label: props.loadingLabel })) : (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text` }, props.children))));
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
export { Button as default, shade };
|
|
@@ -24,7 +24,7 @@ type Props = ({
|
|
|
24
24
|
*/
|
|
25
25
|
icon: ReactNode;
|
|
26
26
|
direction?: never;
|
|
27
|
-
}) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | '
|
|
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;
|
|
@@ -66,12 +66,12 @@ const ButtonArrow = (_a) => {
|
|
|
66
66
|
let iconElement = null;
|
|
67
67
|
if (props.direction) {
|
|
68
68
|
const IconComponent = iconsMap[props.direction];
|
|
69
|
-
iconElement = React__default.createElement(IconComponent, { size: "1rem" });
|
|
69
|
+
iconElement = React__default.createElement(IconComponent, { icon: iconsMap[props.direction], size: "1rem" });
|
|
70
70
|
}
|
|
71
71
|
else if (isValidElement(props.icon)) {
|
|
72
72
|
iconElement = cloneElement(props.icon, { size: '1rem' });
|
|
73
73
|
}
|
|
74
|
-
return (React__default.createElement(Element, { id: props.id,
|
|
74
|
+
return (React__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));
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
export { ButtonArrow as default };
|
|
@@ -9,7 +9,7 @@ import Icon from '../Icon/Icon.js';
|
|
|
9
9
|
const ButtonCardWrapper = styled.button `
|
|
10
10
|
display: block;
|
|
11
11
|
padding: 0;
|
|
12
|
-
border: 0
|
|
12
|
+
border: 0;
|
|
13
13
|
width: 100%;
|
|
14
14
|
background-color: transparent;
|
|
15
15
|
cursor: pointer;
|
|
@@ -17,6 +17,7 @@ const ButtonCardWrapper = styled.button `
|
|
|
17
17
|
font-size: ${theme.fontSize.default};
|
|
18
18
|
line-height: ${theme.lineHeight.default};
|
|
19
19
|
color: ${theme.color.text.black};
|
|
20
|
+
text-decoration: none;
|
|
20
21
|
|
|
21
22
|
&:focus-visible {
|
|
22
23
|
border: 1px solid ${theme.color.focus.light};
|
|
@@ -25,13 +26,12 @@ const ButtonCardWrapper = styled.button `
|
|
|
25
26
|
outline: none;
|
|
26
27
|
|
|
27
28
|
& > div {
|
|
28
|
-
border: 0
|
|
29
|
+
border: 0;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
&:hover {
|
|
33
34
|
color: ${theme.color.text.black};
|
|
34
|
-
text-decoration: none;
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
const StyledBox = styled(Box) `
|
|
@@ -66,7 +66,6 @@ const Title = styled.div `
|
|
|
66
66
|
font-size: ${theme.fontSize.default};
|
|
67
67
|
line-height: ${theme.lineHeight.default};
|
|
68
68
|
font-weight: ${theme.fontWeight.bold};
|
|
69
|
-
|
|
70
69
|
text-overflow: ellipsis;
|
|
71
70
|
overflow: hidden;
|
|
72
71
|
white-space: nowrap;
|
|
@@ -89,7 +88,6 @@ const Subtitle = styled.div `
|
|
|
89
88
|
font-size: ${theme.fontSize.s};
|
|
90
89
|
line-height: ${theme.lineHeight.s};
|
|
91
90
|
font-weight: ${theme.fontWeight.medium};
|
|
92
|
-
|
|
93
91
|
text-overflow: ellipsis;
|
|
94
92
|
overflow: hidden;
|
|
95
93
|
white-space: nowrap;
|
|
@@ -117,11 +117,11 @@ const ButtonElement = styled.button `
|
|
|
117
117
|
`;
|
|
118
118
|
/** @visibleName Button Icon */
|
|
119
119
|
const ButtonIcon = forwardRef((_a, ref) => {
|
|
120
|
-
var { icon = EditUnderline, 'data-testid': dataTestId, 'data-
|
|
120
|
+
var { icon = EditUnderline, 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = __rest(_a, ["icon", 'data-testid', 'data-track-value']);
|
|
121
121
|
const position = props.isReversed ? 'right' : 'left';
|
|
122
|
-
return (React__default.createElement(ButtonElement, Object.assign({ ref: ref, id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, "$small": props.small, "$darkBg": props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, "$hideChildrenMobile": props.hideChildrenMobile, "$isReversed": props.isReversed, className: props.className, "data-testid": dataTestId, "data-
|
|
122
|
+
return (React__default.createElement(ButtonElement, Object.assign({ ref: ref, id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, "$small": props.small, "$darkBg": props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, "$hideChildrenMobile": props.hideChildrenMobile, "$isReversed": props.isReversed, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded, "aria-label": props.ariaLabel, "$isLinkStyle": props.isLinkStyle }, props.dataAttributes), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.black, label: props.loadingLabel })) : (React__default.createElement(React__default.Fragment, null,
|
|
123
123
|
React__default.createElement(Icon, { icon: icon, color: props.darkBg ? theme.color.default.white : theme.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined, "aria-hidden": true }),
|
|
124
|
-
props.children && (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text
|
|
124
|
+
props.children && (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text` }, props.children))))));
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
export { ButtonIcon as default };
|
|
@@ -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;
|
|
@@ -48,9 +48,9 @@ const Element = styled.div `
|
|
|
48
48
|
}
|
|
49
49
|
`;
|
|
50
50
|
const Chip = (_a) => {
|
|
51
|
-
var { type = 'default',
|
|
51
|
+
var { type = 'default', 'data-testid': dataTestId } = _a, props = __rest(_a, ["type", 'data-testid']);
|
|
52
52
|
const label = props.ariaLabel || (typeof props.children === 'string' ? props.children : undefined);
|
|
53
|
-
return (React__default.createElement(Element, { as: props.onClick ? 'button' : 'div', id: props.id, "$type": type,
|
|
53
|
+
return (React__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));
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export { Chip as default };
|
|
@@ -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
|
*
|
|
@@ -170,7 +170,7 @@ const Drawer = (_a) => {
|
|
|
170
170
|
ReactModal.setAppElement(appElement);
|
|
171
171
|
return (React__default.createElement(React__default.Fragment, null,
|
|
172
172
|
React__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 },
|
|
173
|
-
React__default.createElement(StyledBox, { "data-testid": dataTestId, elevation: "extraHigh",
|
|
173
|
+
React__default.createElement(StyledBox, { "data-testid": dataTestId, elevation: "extraHigh", padding: "0" },
|
|
174
174
|
React__default.createElement(ContentContainer, null,
|
|
175
175
|
React__default.createElement(Header, { "$variant": variant, "data-testid": dataTestId && `${dataTestId}-header` },
|
|
176
176
|
React__default.createElement(Title, { "$size": size, "$variant": variant }, props.title),
|
|
@@ -7,7 +7,6 @@ import ButtonIcon from '../../ButtonIcon/ButtonIcon.js';
|
|
|
7
7
|
import FooterContext from '../context/FooterContext.js';
|
|
8
8
|
import BusinessMenu from '../../MainHeaderNavigation/ChildComponents/BusinessMenu.js';
|
|
9
9
|
|
|
10
|
-
/* eslint-disable react/no-array-index-key */
|
|
11
10
|
const linkHoverStyles = css `
|
|
12
11
|
&:hover,
|
|
13
12
|
&:focus,
|
|
@@ -166,8 +166,9 @@ const renderImage = (ImageComponent, imageProps) => {
|
|
|
166
166
|
if (!imageProps)
|
|
167
167
|
return null;
|
|
168
168
|
if (typeof ImageComponent === 'string') {
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
const { alt } = imageProps, rest = __rest(imageProps, ["alt"]);
|
|
170
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
171
|
+
return React__default.createElement("img", Object.assign({ alt: alt }, rest));
|
|
171
172
|
}
|
|
172
173
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
173
174
|
return React__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;
|
|
@@ -3,9 +3,7 @@ import React__default from 'react';
|
|
|
3
3
|
import { styled } from 'styled-components';
|
|
4
4
|
import theme from '../../themes/theme.js';
|
|
5
5
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
6
|
-
import * as index from '../Icons/index.js';
|
|
7
6
|
|
|
8
|
-
const IconsList = index;
|
|
9
7
|
const IconContainer = styled.span `
|
|
10
8
|
display: inline-flex;
|
|
11
9
|
width: ${({ size }) => size};
|
|
@@ -27,14 +25,9 @@ const IconContainer = styled.span `
|
|
|
27
25
|
}
|
|
28
26
|
`;
|
|
29
27
|
const Icon = (_a) => {
|
|
30
|
-
var {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
34
|
-
RenderIcon && (React__default.createElement(IconContainer, { "$position": props.position, size: size, className: "dnasg-icon", "data-testid": dataTestId },
|
|
35
|
-
React__default.createElement(RenderIcon, Object.assign({}, props, { size: size, color: color })))),
|
|
36
|
-
IconParam && (React__default.createElement(IconContainer, { onClick: props.onClick, "$position": props.position, size: size, className: `dnasg-icon ${props.className || ''}`.trim(), "data-testid": dataTestId, "aria-label": ariaLabel, "aria-hidden": ariaHidden, role: !ariaHidden ? 'img' : undefined },
|
|
37
|
-
React__default.createElement(IconParam, { size: size, color: color })))));
|
|
28
|
+
var { icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden } = _a, props = __rest(_a, ["icon", "color", "size", 'data-testid', 'aria-label', 'aria-hidden']);
|
|
29
|
+
return (React__default.createElement(IconContainer, { onClick: props.onClick, "$position": props.position, size: size, className: `dnasg-icon ${props.className || ''}`.trim(), "data-testid": dataTestId, "aria-label": ariaLabel, "aria-hidden": ariaHidden, role: !ariaHidden ? 'img' : undefined },
|
|
30
|
+
React__default.createElement(IconParam, { size: size, color: color })));
|
|
38
31
|
};
|
|
39
32
|
|
|
40
33
|
export { Icon as default };
|