@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
|
@@ -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
|
*/
|
|
@@ -36,14 +36,13 @@ const StyledButtonIcon = styled(ButtonIcon) `
|
|
|
36
36
|
/** @visibleName Read More */
|
|
37
37
|
const ReadMore = (_a) => {
|
|
38
38
|
var { collapsedSize = '10rem', 'data-testid': dataTestId } = _a, props = __rest(_a, ["collapsedSize", 'data-testid']);
|
|
39
|
-
const [expanded, setExpanded] = useState(
|
|
39
|
+
const [expanded, setExpanded] = useState(false);
|
|
40
40
|
const contentRef = useRef(null);
|
|
41
41
|
const buttonRef = useRef(null);
|
|
42
42
|
const userInteractedRef = useRef(false);
|
|
43
43
|
// TODO: Remove once https://jira.dna.fi/browse/STYLE-662 is done
|
|
44
44
|
const temporaryIsStatelessFlag = typeof props.isExpanded !== 'undefined';
|
|
45
45
|
const temporaryStateManagement = temporaryIsStatelessFlag ? props.isExpanded : expanded;
|
|
46
|
-
const temporaryButtonLabel = temporaryStateManagement ? props.showLessText : props.showMoreText;
|
|
47
46
|
const handleOnClick = (event) => {
|
|
48
47
|
if (props.onClick) {
|
|
49
48
|
props.onClick(event);
|
|
@@ -53,11 +52,6 @@ const ReadMore = (_a) => {
|
|
|
53
52
|
}
|
|
54
53
|
userInteractedRef.current = true;
|
|
55
54
|
};
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (props.seoInitExpanded) {
|
|
58
|
-
setExpanded(false);
|
|
59
|
-
}
|
|
60
|
-
}, [props.seoInitExpanded]);
|
|
61
55
|
useEffect(() => {
|
|
62
56
|
var _a, _b;
|
|
63
57
|
if (userInteractedRef.current) {
|
|
@@ -84,7 +78,7 @@ const ReadMore = (_a) => {
|
|
|
84
78
|
return (React__default.createElement(Container, { id: props.id, className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "region" },
|
|
85
79
|
React__default.createElement(Content, { ref: contentRef, "$isExpanded": temporaryStateManagement, "$collapsedSize": collapsedSize, "data-testid": dataTestId && `${dataTestId}-content`, "aria-hidden": temporaryStateManagement ? 'false' : 'true', tabIndex: temporaryStateManagement ? 0 : -1 }, Children.map(props.children, forceTabIndexOnTextLinks)),
|
|
86
80
|
React__default.createElement(ButtonWrapper, { "$buttonPosition": props.buttonPosition },
|
|
87
|
-
React__default.createElement(StyledButtonIcon, { ref: buttonRef, icon: temporaryStateManagement ? ChevronUp : ChevronDown, onClick: handleOnClick, "aria-expanded": temporaryStateManagement },
|
|
81
|
+
React__default.createElement(StyledButtonIcon, { ref: buttonRef, icon: temporaryStateManagement ? ChevronUp : ChevronDown, onClick: handleOnClick, "aria-expanded": temporaryStateManagement }, props.buttonLabel))));
|
|
88
82
|
};
|
|
89
83
|
|
|
90
84
|
export { ReadMore as default };
|
|
@@ -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
|
*/
|
|
@@ -3,8 +3,6 @@ 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 Box from '../Box/Box.js';
|
|
7
|
-
import Divider from '../Divider/Divider.js';
|
|
8
6
|
|
|
9
7
|
// TODO: Change to button HTML element as a part of https://jira.dna.fi/browse/STYLE-622
|
|
10
8
|
const TabLabel = styled.li `
|
|
@@ -56,26 +54,6 @@ const TabStyle = styled.li `
|
|
|
56
54
|
background-color: transparent;
|
|
57
55
|
`}
|
|
58
56
|
`;
|
|
59
|
-
const ContentContainer = styled.div `
|
|
60
|
-
${({ $type }) => {
|
|
61
|
-
if ($type === 'box' || $type === 'default') {
|
|
62
|
-
return `
|
|
63
|
-
border-top-left-radius: 0;
|
|
64
|
-
`;
|
|
65
|
-
}
|
|
66
|
-
if ($type === 'panel') {
|
|
67
|
-
return `
|
|
68
|
-
border-top: 1px solid ${theme.color.line.L03};
|
|
69
|
-
`;
|
|
70
|
-
}
|
|
71
|
-
if ($type === 'underlined' || $type === 'gray') {
|
|
72
|
-
return `
|
|
73
|
-
margin-top: ${theme.grid.gutter};
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
return '';
|
|
77
|
-
}}
|
|
78
|
-
`;
|
|
79
57
|
/** @visibleName Tab */
|
|
80
58
|
const Tab = (_a) => {
|
|
81
59
|
var { type = 'box', 'data-testid': dataTestId } = _a, props = __rest(_a, ["type", 'data-testid']);
|
|
@@ -84,17 +62,8 @@ const Tab = (_a) => {
|
|
|
84
62
|
props.onClick(props.label, e);
|
|
85
63
|
}
|
|
86
64
|
};
|
|
87
|
-
const isActive = props
|
|
88
|
-
return type === 'box' || type === '
|
|
89
|
-
React__default.createElement(TabLabel, { role: "tab", id: props.id, "$type": type, "aria-selected": isActive, "$isActive": isActive, onClick: onClickHandler, tabIndex: isActive ? 0 : -1 }, props.label),
|
|
90
|
-
props.isStateless &&
|
|
91
|
-
(props.children && (props.activeTab === props.label || props.isActive) ? (React__default.createElement(ContentContainer, { role: "tabpanel", "$type": props.tabStyle || type, as: (type === 'box' || type === 'default') && !props.tabStyle
|
|
92
|
-
? Box
|
|
93
|
-
: undefined }, props.children)) : (React__default.createElement(Divider, { margin: "0" }))))) : (React__default.createElement(React__default.Fragment, null,
|
|
94
|
-
React__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),
|
|
95
|
-
props.isStateless &&
|
|
96
|
-
props.children &&
|
|
97
|
-
(props.activeTab === props.label || props.isActive) && (React__default.createElement(ContentContainer, { role: "tabpanel", "$type": props.tabStyle || type }, props.children))));
|
|
65
|
+
const { isActive } = props;
|
|
66
|
+
return type === 'box' || type === 'panel' ? (React__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.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));
|
|
98
67
|
};
|
|
99
68
|
|
|
100
69
|
export { Tab as default };
|
|
@@ -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
|
}
|
|
@@ -21,7 +21,7 @@ const Tablist = styled.ul `
|
|
|
21
21
|
`}
|
|
22
22
|
|
|
23
23
|
${({ $type, $isNarrowUnderlined }) => {
|
|
24
|
-
if ($type === 'box' || $type === '
|
|
24
|
+
if ($type === 'box' || $type === 'panel') {
|
|
25
25
|
return `
|
|
26
26
|
margin: 0;
|
|
27
27
|
|
|
@@ -47,17 +47,12 @@ const Tablist = styled.ul `
|
|
|
47
47
|
border-bottom: 1px solid ${theme.color.line.L02};
|
|
48
48
|
`;
|
|
49
49
|
}
|
|
50
|
-
if ($type === 'gray') {
|
|
51
|
-
return `
|
|
52
|
-
gap: 1.25rem;
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
50
|
return '';
|
|
56
51
|
}}
|
|
57
52
|
`;
|
|
58
53
|
const ContentContainer = styled.div `
|
|
59
54
|
${({ $type, $isFullWidth }) => {
|
|
60
|
-
if ($type === 'box'
|
|
55
|
+
if ($type === 'box') {
|
|
61
56
|
return `
|
|
62
57
|
border-top-left-radius: 0;
|
|
63
58
|
${$isFullWidth ? 'border-top-right-radius: 0;' : ''}
|
|
@@ -68,7 +63,7 @@ const ContentContainer = styled.div `
|
|
|
68
63
|
border-top: 1px solid ${theme.color.line.L03};
|
|
69
64
|
`;
|
|
70
65
|
}
|
|
71
|
-
if ($type === 'underlined'
|
|
66
|
+
if ($type === 'underlined') {
|
|
72
67
|
return `
|
|
73
68
|
margin-top: ${theme.grid.gutter};
|
|
74
69
|
`;
|
|
@@ -84,9 +79,6 @@ const Tabs = (_a) => {
|
|
|
84
79
|
const onClickTabItem = (tab, e) => {
|
|
85
80
|
setActiveTab(tab);
|
|
86
81
|
if (tab !== activeTab) {
|
|
87
|
-
if (props.onChange) {
|
|
88
|
-
props.onChange(tab);
|
|
89
|
-
}
|
|
90
82
|
if (props.onClick && e) {
|
|
91
83
|
props.onClick(e);
|
|
92
84
|
}
|
|
@@ -107,16 +99,16 @@ const Tabs = (_a) => {
|
|
|
107
99
|
if (!tabs) {
|
|
108
100
|
return null;
|
|
109
101
|
}
|
|
110
|
-
const outerActiveTab = tabs.find(child => child.props.isActive
|
|
102
|
+
const outerActiveTab = tabs.find(child => child.props.isActive);
|
|
111
103
|
if (!activeTab) {
|
|
112
104
|
setActiveTab((outerActiveTab === null || outerActiveTab === void 0 ? void 0 : outerActiveTab.props.label) || tabs[0].props.label);
|
|
113
105
|
}
|
|
114
|
-
return (React__default.createElement("div", { className: props.className
|
|
115
|
-
React__default.createElement(Tablist, { role: "tablist", "$type":
|
|
116
|
-
tab.type === Tab && (React__default.createElement(Tab, { id: tab.props.id, key: tab.props.label, label: tab.props.label, type:
|
|
106
|
+
return (React__default.createElement("div", { className: props.className, "data-testid": dataTestId },
|
|
107
|
+
React__default.createElement(Tablist, { role: "tablist", "$type": type, "$isFullWidth": props.isFullWidth, "$isNarrowUnderlined": props.isNarrowUnderlined, onKeyDown: onKeyDown }, Children.map(props.children, tab => isValidElement(tab) &&
|
|
108
|
+
tab.type === Tab && (React__default.createElement(Tab, { id: tab.props.id, key: tab.props.label, label: tab.props.label, type: type, isActive: tab.props.isActive
|
|
117
109
|
? tab.props.isActive
|
|
118
|
-
: activeTab === tab.props.label,
|
|
119
|
-
React__default.createElement(ContentContainer, { role: "tabpanel", "$type":
|
|
110
|
+
: activeTab === tab.props.label, onClick: onClickTabItem, className: tab.props.className, "data-testid": tab.props['data-testid'] })))),
|
|
111
|
+
React__default.createElement(ContentContainer, { role: "tabpanel", "$type": type, "$isFullWidth": props.isFullWidth, as: type === 'box' ? Box : undefined }, Children.map(props.children, tab => isValidElement(tab) &&
|
|
120
112
|
tab.type === Tab &&
|
|
121
113
|
(tab.props.isActive || tab.props.label === activeTab) &&
|
|
122
114
|
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';
|
|
@@ -19,7 +19,7 @@ const useCloseOutsideOrElementClicked = ({ ref, closeWhenTagClicked }, callback)
|
|
|
19
19
|
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());
|
|
20
20
|
});
|
|
21
21
|
if ((ref.current && !ref.current.contains(target)) ||
|
|
22
|
-
(isElementInList && !target.
|
|
22
|
+
(isElementInList && !target.closest('.no-close'))) {
|
|
23
23
|
callback();
|
|
24
24
|
}
|
|
25
25
|
};
|
package/build/es/index.js
CHANGED
|
@@ -9,7 +9,6 @@ export { default as ButtonCard } from './components/ButtonCard/ButtonCard.js';
|
|
|
9
9
|
export { default as ButtonClose } from './components/ButtonClose/ButtonClose.js';
|
|
10
10
|
export { default as ButtonIcon } from './components/ButtonIcon/ButtonIcon.js';
|
|
11
11
|
export { default as ButtonPrimary } from './components/ButtonPrimary/ButtonPrimary.js';
|
|
12
|
-
export { default as ButtonRound } from './components/ButtonRound/ButtonRound.js';
|
|
13
12
|
export { default as ButtonSecondary } from './components/ButtonSecondary/ButtonSecondary.js';
|
|
14
13
|
export { default as Carousel } from './components/Carousel/Carousel.js';
|
|
15
14
|
export { default as Checkbox } from './components/Checkbox/Checkbox.js';
|
|
@@ -139,7 +138,6 @@ export { default as Input } from './components/Input/Input.js';
|
|
|
139
138
|
export { default as Label } from './components/Label/Label.js';
|
|
140
139
|
export { default as LabelText } from './components/LabelText/LabelText.js';
|
|
141
140
|
export { default as MainHeaderNavigation } from './components/MainHeaderNavigation/MainHeaderNavigation.js';
|
|
142
|
-
export { default as MainNavigation } from './components/MainNavigation/MainNavigation.js';
|
|
143
141
|
export { default as Modal } from './components/Modal/Modal.js';
|
|
144
142
|
export { default as Notification } from './components/Notification/Notification.js';
|
|
145
143
|
export { default as NotificationBadge } from './components/NotificationBadge/NotificationBadge.js';
|
|
@@ -153,7 +151,6 @@ export { default as ProgressIndicator } from './components/ProgressIndicator/Pro
|
|
|
153
151
|
export { default as RadioButton } from './components/RadioButton/RadioButton.js';
|
|
154
152
|
export { default as ReadMore } from './components/ReadMore/ReadMore.js';
|
|
155
153
|
export { default as Search } from './components/Search/Search.js';
|
|
156
|
-
export { default as SecondaryNavigation } from './components/SecondaryNavigation/SecondaryNavigation.js';
|
|
157
154
|
export { default as Selectbox } from './components/Selectbox/Selectbox.js';
|
|
158
155
|
export { default as Skeleton } from './components/Skeleton/Skeleton.js';
|
|
159
156
|
export { default as Switch } from './components/Switch/Switch.js';
|
|
@@ -162,7 +159,6 @@ export { default as Tabs } from './components/Tabs/Tabs.js';
|
|
|
162
159
|
export { default as Textarea } from './components/Textarea/Textarea.js';
|
|
163
160
|
export { default as Toaster } from './components/Toaster/Toaster.js';
|
|
164
161
|
export { default as Tooltip } from './components/Tooltip/Tooltip.js';
|
|
165
|
-
export { default as TooltipMenu } from './components/TooltipMenu/TooltipMenu.js';
|
|
166
162
|
export { default as createStyled } from './utils/createStyled.js';
|
|
167
163
|
export { styled } from 'styled-components';
|
|
168
164
|
export { default as theme } from './themes/theme.js';
|
|
@@ -10,8 +10,6 @@ const headerLogoSize = '3.75rem';
|
|
|
10
10
|
const mobileLogoSize = '3.75em';
|
|
11
11
|
const desktopLogoSize = '5.25em';
|
|
12
12
|
const menuItemMargin = '1rem';
|
|
13
|
-
const ribbonHeight = '1.5625rem';
|
|
14
|
-
const wideMenuBreakpoint = 1280;
|
|
15
13
|
const IconContainerWidth = '3.75rem'; // 60px
|
|
16
14
|
const IconContainerMinWidth = '2.5rem'; // 40px
|
|
17
15
|
const navMaxHeight = '3.75rem'; // 60px
|
|
@@ -32,4 +30,4 @@ const navigation = {
|
|
|
32
30
|
headerMaxHeight,
|
|
33
31
|
};
|
|
34
32
|
|
|
35
|
-
export { IconContainerMinWidth, IconContainerWidth, navigation as default, desktopLogoSize, desktopNavMaxHeight, headerLogoSize, headerMaxHeight, menuItemMargin, menuLevelsAmount, mobileLogoSize, mobileNavMaxHeight, mobileNavMaxWidth, navIconSize, navIconSizeMobile, navMaxHeight,
|
|
33
|
+
export { IconContainerMinWidth, IconContainerWidth, navigation as default, desktopLogoSize, desktopNavMaxHeight, headerLogoSize, headerMaxHeight, menuItemMargin, menuLevelsAmount, mobileLogoSize, mobileNavMaxHeight, mobileNavMaxWidth, navIconSize, navIconSizeMobile, navMaxHeight, subMenuWidth, subMenuWidthXl };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnanpm/styleguide",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "v4.0.0",
|
|
5
5
|
"main": "build/cjs/index.js",
|
|
6
6
|
"module": "build/es/index.js",
|
|
7
7
|
"jsnext:main": "build/es/index.js",
|
|
@@ -49,9 +49,12 @@
|
|
|
49
49
|
"@babel/preset-react": "^7.26.3",
|
|
50
50
|
"@babel/preset-typescript": "^7.28.5",
|
|
51
51
|
"@dnanpm/icons": "^2.0.9",
|
|
52
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
53
|
+
"@eslint/js": "^9.39.1",
|
|
52
54
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
53
55
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
54
56
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
57
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
55
58
|
"@testing-library/jest-dom": "^6.6.3",
|
|
56
59
|
"@testing-library/react": "^16.3.0",
|
|
57
60
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -62,21 +65,18 @@
|
|
|
62
65
|
"@types/react-dom": "^18.3.1",
|
|
63
66
|
"@types/react-modal": "^3.13.1",
|
|
64
67
|
"@types/resize-observer-browser": "^0.1.8",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
66
|
-
"@typescript-eslint/parser": "^
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
69
|
+
"@typescript-eslint/parser": "^8.46.4",
|
|
67
70
|
"babel-loader": "^9.2.1",
|
|
68
71
|
"cross-env": "^10.0.0",
|
|
69
72
|
"css-loader": "^6.11.0",
|
|
70
|
-
"eslint": "^
|
|
71
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
72
|
-
"eslint-config-airbnb-typescript": "^17.1.0",
|
|
73
|
+
"eslint": "^9.39.1",
|
|
73
74
|
"eslint-config-prettier": "^10.1.8",
|
|
74
|
-
"eslint-plugin-import": "2.32.0",
|
|
75
|
-
"eslint-plugin-jsdoc": "^61.
|
|
75
|
+
"eslint-plugin-import": "^2.32.0",
|
|
76
|
+
"eslint-plugin-jsdoc": "^61.2.0",
|
|
76
77
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
77
|
-
"eslint-plugin-
|
|
78
|
-
"eslint-plugin-react": "^7.
|
|
79
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
78
|
+
"eslint-plugin-react": "^7.37.5",
|
|
79
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
80
80
|
"eslint-plugin-transient-props": "file:eslint-plugins/eslint-plugin-transient-props",
|
|
81
81
|
"jest": "^30.0.5",
|
|
82
82
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"ramda": "^0.32.0",
|
|
103
|
-
"react-datepicker": "8.
|
|
103
|
+
"react-datepicker": "8.9.0",
|
|
104
104
|
"react-modal": "^3.16.1",
|
|
105
105
|
"react-select": "^5.8.1",
|
|
106
106
|
"react-spring": "^8.0.27",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Props as ButtonProps } from '../Button/Button';
|
|
3
|
-
type Props = Omit<ButtonProps, 'small' | 'fullWidth' | 'loading'>;
|
|
4
|
-
/**
|
|
5
|
-
* @visibleName Button Round
|
|
6
|
-
* @deprecated Use `ButtonArrow` component
|
|
7
|
-
*/
|
|
8
|
-
declare const ButtonRound: ({ "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
|
|
9
|
-
/** @component */
|
|
10
|
-
export default ButtonRound;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var styledComponents = require('styled-components');
|
|
8
|
-
var theme = require('../../themes/theme.js');
|
|
9
|
-
var styledUtils = require('../../utils/styledUtils.js');
|
|
10
|
-
var ButtonPrimary = require('../ButtonPrimary/ButtonPrimary.js');
|
|
11
|
-
|
|
12
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
-
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
|
-
|
|
16
|
-
const ButtonElement = styledComponents.styled(ButtonPrimary.default) `
|
|
17
|
-
display: flex;
|
|
18
|
-
min-width: initial;
|
|
19
|
-
width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 3.2)};
|
|
20
|
-
height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 3.2)};
|
|
21
|
-
border-radius: ${theme.default.radius.circle};
|
|
22
|
-
padding: initial;
|
|
23
|
-
text-align: center;
|
|
24
|
-
vertical-align: middle;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
align-items: center;
|
|
27
|
-
`;
|
|
28
|
-
/**
|
|
29
|
-
* @visibleName Button Round
|
|
30
|
-
* @deprecated Use `ButtonArrow` component
|
|
31
|
-
*/
|
|
32
|
-
const ButtonRound = (_a) => {
|
|
33
|
-
var { 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ['data-testid', 'data-no-close', 'data-track-value']);
|
|
34
|
-
return (React__default.default.createElement(ButtonElement, { 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-no-close": dataNoClose, "data-track-value": dataTrackValue }, props.children));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
exports.default = ButtonRound;
|