@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
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { __rest } from 'tslib';
|
|
2
|
-
import { ChevronDown, Check } from '@dnanpm/icons';
|
|
3
|
-
import React__default, { useState, useRef } from 'react';
|
|
4
|
-
import useOutsideClick from '../../hooks/useOutsideClick.js';
|
|
5
|
-
import { styled } from 'styled-components';
|
|
6
|
-
import theme from '../../themes/theme.js';
|
|
7
|
-
import { media, getMultipliedSize } from '../../utils/styledUtils.js';
|
|
8
|
-
import Icon from '../Icon/Icon.js';
|
|
9
|
-
|
|
10
|
-
const SecondaryNavigationWrapper = styled.nav `
|
|
11
|
-
font-size: ${theme.fontSize.default};
|
|
12
|
-
padding: 0;
|
|
13
|
-
background-color: ${({ $whiteBg }) => $whiteBg ? theme.color.background.white.default : 'transparent'};
|
|
14
|
-
|
|
15
|
-
${({ $mobileOnly }) => media.sm `
|
|
16
|
-
display: ${$mobileOnly ? 'none' : 'inherit'};
|
|
17
|
-
`};
|
|
18
|
-
|
|
19
|
-
@media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
|
|
20
|
-
border-bottom: 1px solid ${theme.color.line.L03};
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
const MobileSelector = styled.button `
|
|
24
|
-
display: flex;
|
|
25
|
-
align-items: center;
|
|
26
|
-
justify-content: space-between;
|
|
27
|
-
line-height: ${theme.lineHeight.default};
|
|
28
|
-
color: ${theme.color.text.pink};
|
|
29
|
-
padding: 1rem ${getMultipliedSize(theme.base.baseWidth, 2)};
|
|
30
|
-
background: transparent;
|
|
31
|
-
border: 0;
|
|
32
|
-
border-bottom: 1px solid ${theme.color.default.pink};
|
|
33
|
-
width: 100%;
|
|
34
|
-
font-size: ${theme.fontSize.default};
|
|
35
|
-
|
|
36
|
-
&:hover {
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
|
|
41
|
-
display: none;
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
const MobileSelectorTitleWrapper = styled.div `
|
|
45
|
-
display: flex;
|
|
46
|
-
`;
|
|
47
|
-
const MobileSelectorArrow = styled.span `
|
|
48
|
-
display: flex;
|
|
49
|
-
|
|
50
|
-
.dnasg-icon svg {
|
|
51
|
-
transition: transform 0.15s ease-in-out;
|
|
52
|
-
transform: rotate(${({ $isOpen }) => ($isOpen ? '180deg' : '0deg')});
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
const MobileSelectorCheck = styled.span `
|
|
56
|
-
margin-left: auto;
|
|
57
|
-
|
|
58
|
-
.dnasg-icon {
|
|
59
|
-
@media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
|
|
60
|
-
display: none;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
const SecondaryNavigationList = styled.ul `
|
|
65
|
-
padding: 0;
|
|
66
|
-
list-style-type: none;
|
|
67
|
-
margin: 0;
|
|
68
|
-
overflow: hidden;
|
|
69
|
-
display: flex;
|
|
70
|
-
flex-direction: column;
|
|
71
|
-
transition:
|
|
72
|
-
max-height 0.2s ease-in-out,
|
|
73
|
-
border-bottom 0.2s linear;
|
|
74
|
-
background-color: ${({ $isOpen }) => $isOpen ? theme.color.background.white.default : 'transparent'};
|
|
75
|
-
max-height: ${({ $isOpen }) => ($isOpen ? '500vh' : '0')};
|
|
76
|
-
border-bottom: ${({ $isOpen }) => ($isOpen ? `1px solid ${theme.color.line.L03}` : 'none')};
|
|
77
|
-
|
|
78
|
-
@media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
|
|
79
|
-
padding: 0 ${getMultipliedSize(theme.base.baseWidth, 2)};
|
|
80
|
-
max-height: none;
|
|
81
|
-
position: static;
|
|
82
|
-
flex-direction: row;
|
|
83
|
-
overflow: auto;
|
|
84
|
-
height: auto;
|
|
85
|
-
border-bottom: none;
|
|
86
|
-
max-width: ${({ 'max-width': maxWidth }) => (maxWidth ? `${maxWidth}px` : 'none')};
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
const SecondaryNavigationListElement = styled.li `
|
|
90
|
-
margin: 0 ${getMultipliedSize(theme.base.baseWidth, 2)};
|
|
91
|
-
|
|
92
|
-
a {
|
|
93
|
-
text-decoration: none;
|
|
94
|
-
padding: 1rem 0;
|
|
95
|
-
justify-content: start;
|
|
96
|
-
color: ${({ $isActive }) => ($isActive ? theme.color.text.pink : theme.color.text.black)};
|
|
97
|
-
font-weight: ${({ $isActive }) => $isActive ? theme.fontWeight.bold : theme.fontWeight.book};
|
|
98
|
-
display: flex;
|
|
99
|
-
align-items: center;
|
|
100
|
-
|
|
101
|
-
&:hover {
|
|
102
|
-
color: ${theme.color.text.pink};
|
|
103
|
-
text-decoration: none;
|
|
104
|
-
cursor: ${({ $isActive }) => ($isActive ? 'auto' : 'pointer')};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
|
|
108
|
-
padding: ${getMultipliedSize(theme.base.baseHeight, 1.5)} 0;
|
|
109
|
-
font-weight: ${theme.fontWeight.book};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
|
|
114
|
-
margin: 0 ${getMultipliedSize(theme.base.baseWidth, 1.5)};
|
|
115
|
-
white-space: nowrap;
|
|
116
|
-
transition: border-bottom 0.2s linear;
|
|
117
|
-
border-bottom: ${({ $isActive }) => $isActive ? `1px solid ${theme.color.default.pink}` : 'none'};
|
|
118
|
-
|
|
119
|
-
&:first-of-type {
|
|
120
|
-
margin-left: 0;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
`;
|
|
124
|
-
const IconWrapper = styled.span `
|
|
125
|
-
position: relative;
|
|
126
|
-
display: flex;
|
|
127
|
-
margin-right: ${getMultipliedSize(theme.base.baseWidth, 1)};
|
|
128
|
-
|
|
129
|
-
&:after {
|
|
130
|
-
display: ${({ $showNotification }) => ($showNotification ? 'inline' : 'none')};
|
|
131
|
-
content: '';
|
|
132
|
-
position: absolute;
|
|
133
|
-
border-radius: ${theme.radius.circle};
|
|
134
|
-
width: ${getMultipliedSize(theme.base.baseWidth, 1)};
|
|
135
|
-
height: ${getMultipliedSize(theme.base.baseHeight, 1)};
|
|
136
|
-
right: -${getMultipliedSize(theme.base.baseWidth, 0.2)};
|
|
137
|
-
top: -${getMultipliedSize(theme.base.baseHeight, 0.2)};
|
|
138
|
-
border: 1px solid ${theme.color.default.white};
|
|
139
|
-
background-color: ${theme.color.default.pink};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
|
|
143
|
-
display: none;
|
|
144
|
-
}
|
|
145
|
-
`;
|
|
146
|
-
/**
|
|
147
|
-
* @visibleName Secondary Navigation
|
|
148
|
-
* @deprecated Use `PriorityNavigation` component
|
|
149
|
-
*/
|
|
150
|
-
const SecondaryNavigation = (_a) => {
|
|
151
|
-
var _b, _c, _d, _e;
|
|
152
|
-
var { currentUrl = '', lang = 'fi', nextJSSecondaryNavLink: NextJSSecondaryNavLink, collapseSize = 767, 'max-width': maxWidth, matchFullUrl = true, highlightIds = [], className, 'data-testid': dataTestId } = _a, props = __rest(_a, ["currentUrl", "lang", "nextJSSecondaryNavLink", "collapseSize", 'max-width', "matchFullUrl", "highlightIds", "className", 'data-testid']);
|
|
153
|
-
const [isSecondaryNavOpen, setIsSecondaryNavOpen] = useState(false);
|
|
154
|
-
const toggleNav = () => {
|
|
155
|
-
setIsSecondaryNavOpen(!isSecondaryNavOpen);
|
|
156
|
-
};
|
|
157
|
-
const closeNav = () => {
|
|
158
|
-
if (isSecondaryNavOpen) {
|
|
159
|
-
setIsSecondaryNavOpen(false);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
const ref = useRef(null);
|
|
163
|
-
useOutsideClick(ref, () => {
|
|
164
|
-
if (isSecondaryNavOpen) {
|
|
165
|
-
setIsSecondaryNavOpen(false);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
const selectedElement = (_b = props.data.pages) === null || _b === void 0 ? void 0 : _b.find(listElement => currentUrl === listElement.urls[lang]);
|
|
169
|
-
const shouldHighlightSelectedElement = (_c = (selectedElement && highlightIds.some(el => el === selectedElement.id))) !== null && _c !== void 0 ? _c : false;
|
|
170
|
-
const checkIsMenuItemLinkAbsolute = (menuItemLink) => menuItemLink.includes('http');
|
|
171
|
-
return (React__default.createElement(SecondaryNavigationWrapper, { ref: ref, "data-testid": dataTestId, className: className, "$collapseSize": collapseSize, "$mobileOnly": props.mobileOnly, "$whiteBg": props.whiteBg },
|
|
172
|
-
selectedElement && (React__default.createElement(MobileSelector, { onClick: toggleNav, "$collapseSize": collapseSize, "data-testid": "secondary-navigation-dropdown-selector" },
|
|
173
|
-
React__default.createElement(MobileSelectorTitleWrapper, null,
|
|
174
|
-
(selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.icon) && (React__default.createElement(IconWrapper, { "$showNotification": shouldHighlightSelectedElement, "$collapseSize": collapseSize },
|
|
175
|
-
React__default.createElement(Icon, { name: selectedElement.icon }))),
|
|
176
|
-
React__default.createElement("span", null, selectedElement.titles[lang])),
|
|
177
|
-
React__default.createElement(MobileSelectorArrow, { "$isOpen": isSecondaryNavOpen },
|
|
178
|
-
React__default.createElement(Icon, { icon: ChevronDown })))),
|
|
179
|
-
React__default.createElement(SecondaryNavigationList, { id: props.data.name ||
|
|
180
|
-
`secondary-navigation-category-${(_d = props.data.categoryId) !== null && _d !== void 0 ? _d : ''}`, "$isOpen": isSecondaryNavOpen, "$collapseSize": collapseSize, "max-width": maxWidth, "data-testid": "secondary-nav-menu-ul" }, (_e = props.data.pages) === null || _e === void 0 ? void 0 : _e.map((listElement, index) => {
|
|
181
|
-
const linkUrl = listElement.urls[lang];
|
|
182
|
-
const linkTitle = listElement.titles[lang];
|
|
183
|
-
const iconName = listElement.icon || '';
|
|
184
|
-
const isActive = matchFullUrl
|
|
185
|
-
? currentUrl === linkUrl
|
|
186
|
-
: currentUrl.indexOf(linkUrl) > -1;
|
|
187
|
-
const showNotification = highlightIds.some(el => el === listElement.id);
|
|
188
|
-
const isMenuItemLinkAbsolute = checkIsMenuItemLinkAbsolute(linkUrl);
|
|
189
|
-
return (React__default.createElement(SecondaryNavigationListElement, { key: listElement.id, onClick: closeNav, "$isActive": isActive, "$collapseSize": collapseSize }, NextJSSecondaryNavLink && !isMenuItemLinkAbsolute ? (React__default.createElement(NextJSSecondaryNavLink, { linkUrl: linkUrl, linkTitle: linkTitle, iconName: iconName, showNotification: showNotification, collapseSize: collapseSize, "data-testid": `secondary-nav-item-link-${index + 1}` }, isActive && (React__default.createElement(MobileSelectorCheck, { "$collapseSize": collapseSize },
|
|
190
|
-
React__default.createElement(Icon, { icon: Check }))))) : (React__default.createElement("a", { href: linkUrl, "data-testid": `secondary-nav-item-link-${index + 1}` },
|
|
191
|
-
iconName && (React__default.createElement(IconWrapper, { "$showNotification": showNotification, "$collapseSize": collapseSize },
|
|
192
|
-
React__default.createElement(Icon, { name: iconName }))),
|
|
193
|
-
React__default.createElement("span", null, linkTitle),
|
|
194
|
-
isActive && (React__default.createElement(MobileSelectorCheck, { "$collapseSize": collapseSize },
|
|
195
|
-
React__default.createElement(Icon, { icon: Check })))))));
|
|
196
|
-
}))));
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export { SecondaryNavigation as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const Tail: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
|
-
tooltipTop: string;
|
|
3
|
-
zIndex: string;
|
|
4
|
-
arrowPosition: string;
|
|
5
|
-
}>> & string;
|
|
6
|
-
export declare const TailShadow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
7
|
-
tooltipTop: string;
|
|
8
|
-
zIndex: string;
|
|
9
|
-
arrowPosition: string;
|
|
10
|
-
}>> & string;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { styled } from 'styled-components';
|
|
2
|
-
import theme from '../../../themes/theme.js';
|
|
3
|
-
|
|
4
|
-
// Tooltip corner tail
|
|
5
|
-
const Tail = styled.div `
|
|
6
|
-
position: absolute;
|
|
7
|
-
width: 0;
|
|
8
|
-
height: 0;
|
|
9
|
-
right: ${p => p.arrowPosition};
|
|
10
|
-
margin-top: -17.5px;
|
|
11
|
-
top: ${p => p.tooltipTop};
|
|
12
|
-
z-index: ${p => Number(p.zIndex) + 1};
|
|
13
|
-
border: 10px solid transparent;
|
|
14
|
-
border-right-color: white;
|
|
15
|
-
transform: rotate(90deg);
|
|
16
|
-
`;
|
|
17
|
-
// Box shadow of the tooltip tail
|
|
18
|
-
const TailShadow = styled.div `
|
|
19
|
-
position: absolute;
|
|
20
|
-
width: 0.25rem;
|
|
21
|
-
height: 0.25rem;
|
|
22
|
-
margin-top: -5px;
|
|
23
|
-
margin-right: 8.5px;
|
|
24
|
-
top: ${p => p.tooltipTop};
|
|
25
|
-
z-index: ${p => Number(p.zIndex) + 1};
|
|
26
|
-
right: ${p => p.arrowPosition};
|
|
27
|
-
background-color: transparent;
|
|
28
|
-
box-shadow: 0 0 5px 0 ${theme.color.default.black};
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
export { Tail, TailShadow };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { Props as IconProps } from '../Icon/Icon';
|
|
4
|
-
export interface TooltipMenuProps {
|
|
5
|
-
/** Text selector */
|
|
6
|
-
selector: string;
|
|
7
|
-
/** Allows to pass a custom className */
|
|
8
|
-
className?: string;
|
|
9
|
-
/** Tooltip menu content */
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
/** Text selector color.Default: #121212 */
|
|
12
|
-
color?: string;
|
|
13
|
-
/** Text selector active color. Default: #121212 */
|
|
14
|
-
activeColor?: string;
|
|
15
|
-
/** Size of chevron icon. Default: 1.5rem */
|
|
16
|
-
iconSize?: string;
|
|
17
|
-
/** Overlap other elements */
|
|
18
|
-
zIndex?: string;
|
|
19
|
-
/** Tooltip position from top. Default: 2rem */
|
|
20
|
-
tooltipTop?: string;
|
|
21
|
-
/** Tooltip position from right. Default: 1.25rem */
|
|
22
|
-
tooltipRight?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Tooltip icon for selector. Default: ''
|
|
25
|
-
*
|
|
26
|
-
* @deprecated Use property `tooltipIcon`
|
|
27
|
-
*/
|
|
28
|
-
tooltipIconName?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Tooltip icon for selector
|
|
31
|
-
*/
|
|
32
|
-
tooltipIcon?: IconProps['icon'];
|
|
33
|
-
/** Tooltip icon size for selector. Default: '1.5rem' */
|
|
34
|
-
tooltipIconSize?: string;
|
|
35
|
-
/** Show hide animated chevron. Default: '' */
|
|
36
|
-
tooltipChevron?: boolean;
|
|
37
|
-
/** Arrow position if needed some adjust. Defaul: -0.25rem. */
|
|
38
|
-
arrowPosition?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @visibleName Tooltip Menu
|
|
42
|
-
* @deprecated Use `Tooltip` component
|
|
43
|
-
*/
|
|
44
|
-
declare const TooltipMenu: ({ selector, className, color, children, iconSize, zIndex, tooltipTop, tooltipRight, activeColor, tooltipIconName, tooltipIcon, tooltipIconSize, tooltipChevron, arrowPosition, }: TooltipMenuProps) => React.JSX.Element;
|
|
45
|
-
export default TooltipMenu;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ChevronDown } from '@dnanpm/icons';
|
|
2
|
-
import React__default, { useState, useRef } from 'react';
|
|
3
|
-
import useOutsideClick from '../../hooks/useOutsideClick.js';
|
|
4
|
-
import { styled } from 'styled-components';
|
|
5
|
-
import theme from '../../themes/theme.js';
|
|
6
|
-
import Icon from '../Icon/Icon.js';
|
|
7
|
-
import { TailShadow, Tail } from './ChildComponents/TooltipMenuExportedStyles.js';
|
|
8
|
-
|
|
9
|
-
const Selector = styled.div `
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: flex-end;
|
|
13
|
-
color: ${p => p.color || theme.color.text.white};
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
|
|
16
|
-
span + span.dnasg-icon > svg {
|
|
17
|
-
transform: ${p => (p.showDropdown ? 'rotate(180deg)' : 'rotate(0deg)')};
|
|
18
|
-
transition: transform 0.15s linear;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
const Container = styled.div `
|
|
22
|
-
position: relative;
|
|
23
|
-
`;
|
|
24
|
-
const Tooltip = styled.div `
|
|
25
|
-
background-color: ${theme.color.background.white.default};
|
|
26
|
-
padding: 0.5rem;
|
|
27
|
-
min-height: 3rem;
|
|
28
|
-
min-width: 4rem;
|
|
29
|
-
position: absolute;
|
|
30
|
-
right: ${p => p.tooltipRight};
|
|
31
|
-
top: ${p => p.tooltipTop};
|
|
32
|
-
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.48);
|
|
33
|
-
z-index: ${p => p.zIndex};
|
|
34
|
-
`;
|
|
35
|
-
const ChildrenWrapper = styled.span `
|
|
36
|
-
> * {
|
|
37
|
-
white-space: nowrap;
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
/**
|
|
41
|
-
* @visibleName Tooltip Menu
|
|
42
|
-
* @deprecated Use `Tooltip` component
|
|
43
|
-
*/
|
|
44
|
-
const TooltipMenu = ({ selector, className, color = theme.color.text.black, children, iconSize = '1.5rem', zIndex = '1', tooltipTop = '2rem', tooltipRight = '-1.25rem', activeColor = color, tooltipIconName, tooltipIcon, tooltipIconSize = '1.5rem', tooltipChevron = true, arrowPosition = '-0.25rem', }) => {
|
|
45
|
-
const [showDropdown, setShowDropdown] = useState(false);
|
|
46
|
-
const ref = useRef(null);
|
|
47
|
-
const toggleState = () => {
|
|
48
|
-
setShowDropdown(!showDropdown);
|
|
49
|
-
};
|
|
50
|
-
useOutsideClick(ref, () => {
|
|
51
|
-
if (showDropdown) {
|
|
52
|
-
setShowDropdown(false);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return (React__default.createElement(Container, { className: className, ref: ref },
|
|
56
|
-
React__default.createElement(Selector, { color: showDropdown ? activeColor : color, onClick: toggleState, showDropdown: showDropdown },
|
|
57
|
-
tooltipIcon && React__default.createElement(Icon, { icon: tooltipIcon, size: tooltipIconSize, position: "left" }),
|
|
58
|
-
tooltipIconName && (React__default.createElement(Icon, { name: tooltipIconName, size: tooltipIconSize, position: "left" })),
|
|
59
|
-
React__default.createElement("span", null, selector),
|
|
60
|
-
tooltipChevron && React__default.createElement(Icon, { icon: ChevronDown, size: iconSize, position: "right" })),
|
|
61
|
-
showDropdown && (React__default.createElement(React__default.Fragment, null,
|
|
62
|
-
React__default.createElement(TailShadow, { zIndex: zIndex, tooltipTop: tooltipTop, arrowPosition: arrowPosition }),
|
|
63
|
-
React__default.createElement(Tail, { zIndex: zIndex, tooltipTop: tooltipTop, arrowPosition: arrowPosition }))),
|
|
64
|
-
showDropdown && (React__default.createElement(Tooltip, { zIndex: zIndex, tooltipTop: tooltipTop, tooltipRight: tooltipRight },
|
|
65
|
-
React__default.createElement(ChildrenWrapper, null, children)))));
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export { TooltipMenu as default };
|