@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
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React__default, { useContext, useRef, useEffect } from 'react';
|
|
2
|
-
import useCloseOutsideOrElementClicked from '../../../hooks/useCloseOutsideOrElementClicked.js';
|
|
3
|
-
import useDocHeight from '../../../hooks/useDocHeight.js';
|
|
4
|
-
import { styled } from 'styled-components';
|
|
5
|
-
import theme from '../../../themes/theme.js';
|
|
6
|
-
import { mobileNavMaxHeight, ribbonHeight, desktopNavMaxHeight } from '../../../themes/themeComponents/navigation.js';
|
|
7
|
-
import { getMultipliedSize, media } from '../../../utils/styledUtils.js';
|
|
8
|
-
import Box from '../../Box/Box.js';
|
|
9
|
-
import NavContext from '../context/NavContext.js';
|
|
10
|
-
import TooltipWrapper from './MainNavTooltipMenuExportedStyles.js';
|
|
11
|
-
|
|
12
|
-
const Container = styled.div `
|
|
13
|
-
width: 100%;
|
|
14
|
-
`;
|
|
15
|
-
const Tooltip = styled.div `
|
|
16
|
-
min-height: ${getMultipliedSize(theme.base.baseHeight, 5)};
|
|
17
|
-
max-height: calc(var(--vh100, 100vh) - ${mobileNavMaxHeight});
|
|
18
|
-
width: 100%;
|
|
19
|
-
position: absolute;
|
|
20
|
-
right: 0;
|
|
21
|
-
top: ${mobileNavMaxHeight};
|
|
22
|
-
z-index: ${p => p.zIndex};
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: row;
|
|
25
|
-
|
|
26
|
-
@media (min-width: ${p => p.fullWidthBreakpoint}px) {
|
|
27
|
-
width: ${p => p.contentWidth};
|
|
28
|
-
right: ${p => (p.fullWidthDesktop ? 0 : p.tooltipRight)};
|
|
29
|
-
}
|
|
30
|
-
${media.md `
|
|
31
|
-
max-height: calc(var(--vh100, 100vh) - (${mobileNavMaxHeight} + ${ribbonHeight}));
|
|
32
|
-
top: calc(${mobileNavMaxHeight} + ${ribbonHeight});
|
|
33
|
-
`};
|
|
34
|
-
@media (min-width: ${p => p.collapseSize + 1}px) {
|
|
35
|
-
max-height: calc(var(--vh100, 100vh) - (${desktopNavMaxHeight} + ${ribbonHeight}));
|
|
36
|
-
top: calc(${desktopNavMaxHeight} + ${ribbonHeight});
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
const TooltipBox = styled(Box) `
|
|
40
|
-
border-top-left-radius: 0 !important;
|
|
41
|
-
border-top-right-radius: 0 !important;
|
|
42
|
-
min-height: inherit;
|
|
43
|
-
max-height: inherit;
|
|
44
|
-
`;
|
|
45
|
-
const Caret = styled.div `
|
|
46
|
-
position: absolute;
|
|
47
|
-
z-index: ${p => p.zIndex + 1};
|
|
48
|
-
top: ${mobileNavMaxHeight};
|
|
49
|
-
transform: translate3d(50%, -50%, 0) rotate(-45deg);
|
|
50
|
-
width: ${getMultipliedSize(theme.base.baseWidth, 1.2)};
|
|
51
|
-
height: ${getMultipliedSize(theme.base.baseWidth, 1.2)};
|
|
52
|
-
background-color: ${theme.color.default.white};
|
|
53
|
-
border: 1px solid ${theme.color.line.L03};
|
|
54
|
-
border-width: 1px 1px 0 0;
|
|
55
|
-
margin-left: ${getMultipliedSize(theme.base.baseWidth, 1.85)};
|
|
56
|
-
${media.md `
|
|
57
|
-
top: calc(${mobileNavMaxHeight} + ${ribbonHeight});
|
|
58
|
-
`};
|
|
59
|
-
@media (min-width: ${p => p.collapseSize + 1}px) {
|
|
60
|
-
max-height: calc(var(--vh100, 100vh) - ${desktopNavMaxHeight});
|
|
61
|
-
top: calc(${desktopNavMaxHeight} + ${ribbonHeight});
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
const MainNavTooltipMenu = ({ children, zIndex = 1, tooltipRight = '-1rem', contentWidth = '20rem', contentComponent, closeWhenTagClicked = [], globalStateString, fullWidthDesktop = false, fullWidthBreakpoint = theme.breakpoints.xs, }) => {
|
|
65
|
-
const { collapseSize, isMobileMenu, isLoggedIn, resetMenuEvents, setTooltipItems, showLoginTooltip, showMinicart, tooltipItems, } = useContext(NavContext);
|
|
66
|
-
const ref = useRef(null);
|
|
67
|
-
const globalStateKey = globalStateString;
|
|
68
|
-
const ContentComponent = contentComponent;
|
|
69
|
-
useDocHeight();
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
setTooltipItems({
|
|
72
|
-
minicart: showMinicart,
|
|
73
|
-
login: showLoginTooltip,
|
|
74
|
-
search: false,
|
|
75
|
-
});
|
|
76
|
-
}, [showMinicart, showLoginTooltip, setTooltipItems]);
|
|
77
|
-
const toggleState = () => {
|
|
78
|
-
resetMenuEvents();
|
|
79
|
-
setTimeout(() => {
|
|
80
|
-
setTooltipItems(prevItems => (Object.assign(Object.assign({}, prevItems), { [globalStateKey]: !tooltipItems[globalStateKey] })));
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
useCloseOutsideOrElementClicked({ ref, closeWhenTagClicked }, () => {
|
|
84
|
-
if (tooltipItems[globalStateKey]) {
|
|
85
|
-
setTooltipItems(prevItems => (Object.assign(Object.assign({}, prevItems), { [globalStateKey]: false })));
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return (React__default.createElement(Container, { ref: ref },
|
|
89
|
-
React__default.createElement(TooltipWrapper, { collapseSize: collapseSize, isHighlighted: tooltipItems[globalStateKey] || (globalStateKey === 'login' && isLoggedIn), onClick: ContentComponent ? toggleState : undefined }, children),
|
|
90
|
-
tooltipItems[globalStateKey] && React__default.createElement(Caret, { zIndex: zIndex, collapseSize: collapseSize }),
|
|
91
|
-
tooltipItems[globalStateKey] && ContentComponent && (React__default.createElement(Tooltip, { zIndex: zIndex, tooltipRight: tooltipRight, contentWidth: contentWidth, collapseSize: collapseSize, fullWidthDesktop: fullWidthDesktop, fullWidthBreakpoint: fullWidthBreakpoint },
|
|
92
|
-
React__default.createElement(TooltipBox, { elevation: "high", padding: "0", width: "100%" },
|
|
93
|
-
React__default.createElement(ContentComponent, { mobileView: isMobileMenu }))))));
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export { MainNavTooltipMenu as default };
|
package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
declare const TooltipWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
2
|
-
collapseSize: number;
|
|
3
|
-
isHighlighted?: boolean;
|
|
4
|
-
}>> & string;
|
|
5
|
-
export default TooltipWrapper;
|
|
6
|
-
export { TooltipWrapper };
|
package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { styled } from 'styled-components';
|
|
2
|
-
import theme from '../../../themes/theme.js';
|
|
3
|
-
import { IconContainerWidth } from '../../../themes/themeComponents/navigation.js';
|
|
4
|
-
|
|
5
|
-
const TooltipWrapper = styled.button `
|
|
6
|
-
position: relative;
|
|
7
|
-
border: none;
|
|
8
|
-
margin: 0;
|
|
9
|
-
padding: 0;
|
|
10
|
-
overflow: visible;
|
|
11
|
-
background: transparent;
|
|
12
|
-
color: ${p => (p.isHighlighted ? theme.color.text.pink : 'inherit')};
|
|
13
|
-
font: inherit;
|
|
14
|
-
line-height: normal;
|
|
15
|
-
-webkit-font-smoothing: inherit;
|
|
16
|
-
-moz-osx-font-smoothing: inherit;
|
|
17
|
-
-webkit-appearance: none;
|
|
18
|
-
width: 100%;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
&:hover {
|
|
21
|
-
span.dnasg-icon > svg,
|
|
22
|
-
> span {
|
|
23
|
-
color: ${p => (p.isHighlighted ? theme.color.text.pink : theme.color.text.black)};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
&:active,
|
|
27
|
-
&:focus {
|
|
28
|
-
span.dnasg-icon > svg,
|
|
29
|
-
> span {
|
|
30
|
-
color: ${theme.color.text.pink};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
span.dnasg-icon > svg {
|
|
34
|
-
align-content: center;
|
|
35
|
-
display: flex;
|
|
36
|
-
@media (min-width: ${p => p.collapseSize + 1}px) {
|
|
37
|
-
height: 1.625em;
|
|
38
|
-
width: 1.625em;
|
|
39
|
-
}
|
|
40
|
-
margin: 0 auto;
|
|
41
|
-
}
|
|
42
|
-
span.dnasg-icon + span {
|
|
43
|
-
width: 100%;
|
|
44
|
-
display: none;
|
|
45
|
-
@media (min-width: ${p => p.collapseSize + 1}px) {
|
|
46
|
-
display: block;
|
|
47
|
-
text-overflow: ellipsis;
|
|
48
|
-
white-space: nowrap;
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
max-width: ${IconContainerWidth};
|
|
51
|
-
}
|
|
52
|
-
font-size: ${theme.fontSize.xs};
|
|
53
|
-
font-weight: ${theme.fontWeight.book};
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
export { TooltipWrapper, TooltipWrapper as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Cart } from '@dnanpm/icons';
|
|
2
|
-
import React__default, { useContext } from 'react';
|
|
3
|
-
import theme from '../../../themes/theme.js';
|
|
4
|
-
import Icon from '../../Icon/Icon.js';
|
|
5
|
-
import NotificationBadge from '../../NotificationBadge/NotificationBadge.js';
|
|
6
|
-
import NavContext from '../context/NavContext.js';
|
|
7
|
-
import MainNavTooltipMenu from './MainNavTooltipMenu.js';
|
|
8
|
-
|
|
9
|
-
const MinicartTooltip = ({ minicartAmount, minicartLabel }) => {
|
|
10
|
-
const globalStateString = 'minicart';
|
|
11
|
-
const { navZIndex, minicartComponent: MinicartComponent } = useContext(NavContext);
|
|
12
|
-
return (React__default.createElement(MainNavTooltipMenu, { zIndex: navZIndex + 1, contentWidth: "35rem", tooltipRight: "5rem", contentComponent: MinicartComponent, globalStateString: globalStateString, fullWidthBreakpoint: theme.breakpoints.md, closeWhenTagClicked: ['a', 'button'] },
|
|
13
|
-
React__default.createElement(Icon, { icon: Cart, size: "2rem" }),
|
|
14
|
-
React__default.createElement("span", null, minicartLabel),
|
|
15
|
-
minicartAmount > 0 && (React__default.createElement(NotificationBadge, { top: "-5px", right: "5px", "data-testid": "header-minicart-amount" }, minicartAmount))));
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { MinicartTooltip as default };
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { ChevronLeft, ChevronRight } from '@dnanpm/icons';
|
|
2
|
-
import React__default, { useContext, useRef, useMemo } from 'react';
|
|
3
|
-
import { useSpring, animated } from 'react-spring';
|
|
4
|
-
import { styled } from 'styled-components';
|
|
5
|
-
import theme from '../../../themes/theme.js';
|
|
6
|
-
import { menuLevelsAmount, mobileNavMaxHeight, ribbonHeight } from '../../../themes/themeComponents/navigation.js';
|
|
7
|
-
import { media, getMultipliedSize } from '../../../utils/styledUtils.js';
|
|
8
|
-
import Icon from '../../Icon/Icon.js';
|
|
9
|
-
import MobileMenuContext from '../context/MobileMenuContext.js';
|
|
10
|
-
import NavContext from '../context/NavContext.js';
|
|
11
|
-
import { MenuLink, MenuList, MenuItem, MenuLinkWithChildren } from '../globalNavStyles.js';
|
|
12
|
-
import BusinessMenu from './BusinessMenu.js';
|
|
13
|
-
import LinkModifier, { isSelected } from './LinkModifier.js';
|
|
14
|
-
|
|
15
|
-
const MobileMenuWrapper = styled.div `
|
|
16
|
-
width: ${100 * menuLevelsAmount}%;
|
|
17
|
-
`;
|
|
18
|
-
const mobileMenuWithRibbon = `calc(100vh - ${mobileNavMaxHeight} - ${ribbonHeight})`;
|
|
19
|
-
const mobileMenuNoRibbon = `calc(100vh - ${mobileNavMaxHeight})`;
|
|
20
|
-
const MobileMenuContainer = styled.div `
|
|
21
|
-
width: 100%;
|
|
22
|
-
position: absolute;
|
|
23
|
-
top: ${mobileNavMaxHeight};
|
|
24
|
-
left: 0;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
overflow-y: auto;
|
|
27
|
-
transition: max-height 0.2s ease-in-out;
|
|
28
|
-
background: ${theme.color.background.white.default};
|
|
29
|
-
max-height: ${mobileMenuNoRibbon};
|
|
30
|
-
height: ${mobileMenuNoRibbon};
|
|
31
|
-
${media.md `
|
|
32
|
-
top: calc(${mobileNavMaxHeight} + ${ribbonHeight});
|
|
33
|
-
max-height: ${mobileMenuWithRibbon};
|
|
34
|
-
height: ${mobileMenuWithRibbon};
|
|
35
|
-
`};
|
|
36
|
-
`;
|
|
37
|
-
const MenuLinkBackLink = styled(MenuLink) ``;
|
|
38
|
-
const MobileMenu = styled.div `
|
|
39
|
-
background: ${theme.color.background.white.default};
|
|
40
|
-
${MenuList} {
|
|
41
|
-
display: block;
|
|
42
|
-
float: left;
|
|
43
|
-
width: ${100 / menuLevelsAmount}%;
|
|
44
|
-
position: relative;
|
|
45
|
-
min-height: ${mobileMenuNoRibbon};
|
|
46
|
-
${media.md `
|
|
47
|
-
min-height: ${mobileMenuWithRibbon};
|
|
48
|
-
`};
|
|
49
|
-
&:first-of-type {
|
|
50
|
-
background: ${theme.color.background.white.default};
|
|
51
|
-
> ${MenuItem} > ${MenuLink} {
|
|
52
|
-
font-weight: ${theme.fontWeight.medium};
|
|
53
|
-
border-bottom: 1px solid ${theme.color.line.L04};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
&:not(:first-of-type) {
|
|
57
|
-
background: ${theme.color.background.sand.default};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
${MenuItem} {
|
|
61
|
-
display: block;
|
|
62
|
-
&:last-of-type {
|
|
63
|
-
margin-bottom: 2rem;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
${MenuLink}, ${MenuLinkWithChildren} {
|
|
68
|
-
line-height: ${theme.lineHeight.default};
|
|
69
|
-
padding: ${getMultipliedSize(theme.base.baseHeight, 1.75)}
|
|
70
|
-
${getMultipliedSize(theme.base.baseWidth, 1.5)}
|
|
71
|
-
${getMultipliedSize(theme.base.baseHeight, 1.75)}
|
|
72
|
-
${getMultipliedSize(theme.base.baseWidth, 2)};
|
|
73
|
-
font-size: ${theme.fontSize.default};
|
|
74
|
-
display: flex;
|
|
75
|
-
flex-grow: 1;
|
|
76
|
-
align-items: center;
|
|
77
|
-
justify-content: space-between;
|
|
78
|
-
}
|
|
79
|
-
${MenuLinkBackLink} {
|
|
80
|
-
font-weight: ${theme.fontWeight.medium};
|
|
81
|
-
background: ${theme.color.background.white.default};
|
|
82
|
-
color: ${theme.color.text.pink};
|
|
83
|
-
justify-content: flex-start;
|
|
84
|
-
span.dnasg-icon {
|
|
85
|
-
margin-right: ${getMultipliedSize(theme.base.baseWidth, 4)};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
${MenuLink}:hover {
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
const MenuItemBackLink = ({ currentLevel }) => {
|
|
93
|
-
const { handleNavMenuClick, lang, menuLevel: { scrollPosition }, level1Items, level2Items, getBackLink, } = useContext(NavContext);
|
|
94
|
-
const levels = {
|
|
95
|
-
level1Items,
|
|
96
|
-
level2Items,
|
|
97
|
-
};
|
|
98
|
-
const menuElementLevel = `level${currentLevel - 1}Items`;
|
|
99
|
-
const menuElements = levels[menuElementLevel];
|
|
100
|
-
const mobileMenuBackClick = (e) => {
|
|
101
|
-
e.preventDefault();
|
|
102
|
-
handleNavMenuClick(null, `level${currentLevel - 1}Mobile`);
|
|
103
|
-
};
|
|
104
|
-
const tabNavigationDisabled = scrollPosition !== currentLevel - 1;
|
|
105
|
-
const backLink = getBackLink(menuElements, currentLevel - 1);
|
|
106
|
-
return (React__default.createElement(MenuItem, { key: `back-${backLink.id}`, "data-testid": `mobile-nav-menu-backlink-level-${currentLevel}` },
|
|
107
|
-
React__default.createElement(MenuLinkBackLink, { role: "menuitem", as: "button", onClick: mobileMenuBackClick, tabIndex: tabNavigationDisabled ? -1 : undefined },
|
|
108
|
-
React__default.createElement(Icon, { icon: ChevronLeft, size: "1rem" }),
|
|
109
|
-
backLink.titles[lang])));
|
|
110
|
-
};
|
|
111
|
-
const CreateSubMenuItem = ({ menuItem, currentLevel, itemIndex }) => {
|
|
112
|
-
var _a;
|
|
113
|
-
const { handleNavMenuClick, menuLevel: { scrollPosition }, lang, currentUrl, } = useContext(NavContext);
|
|
114
|
-
const { mobileMenuRef } = useContext(MobileMenuContext);
|
|
115
|
-
const hasChildren = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.pages) === null || _a === void 0 ? void 0 : _a.length;
|
|
116
|
-
const indexLevel = currentLevel - 1;
|
|
117
|
-
const tabNavigationDisabled = () => scrollPosition !== indexLevel;
|
|
118
|
-
const menuUrl = menuItem.urls[lang] || '';
|
|
119
|
-
const mobileMenuClick = (element) => (e) => {
|
|
120
|
-
var _a;
|
|
121
|
-
if (typeof ((_a = mobileMenuRef === null || mobileMenuRef === void 0 ? void 0 : mobileMenuRef.current) === null || _a === void 0 ? void 0 : _a.scroll) === 'function') {
|
|
122
|
-
mobileMenuRef.current.scroll({
|
|
123
|
-
top: 0,
|
|
124
|
-
left: 0,
|
|
125
|
-
behavior: 'smooth',
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
e.preventDefault();
|
|
129
|
-
handleNavMenuClick(element.id, `level${currentLevel}Mobile`);
|
|
130
|
-
};
|
|
131
|
-
if (hasChildren && currentLevel < 3) {
|
|
132
|
-
return (React__default.createElement(MenuItem, { key: menuItem.id, "aria-haspopup": "true", "data-testid": `mobile-menu-level-${currentLevel}-link-${itemIndex + 1}`, isActive: isSelected(currentUrl, menuUrl) },
|
|
133
|
-
React__default.createElement(MenuLink, { as: "button", onClick: mobileMenuClick(menuItem), role: "menuitem", tabIndex: tabNavigationDisabled() ? -1 : undefined },
|
|
134
|
-
menuItem.titles[lang],
|
|
135
|
-
React__default.createElement(Icon, { icon: ChevronRight, size: "1rem" }))));
|
|
136
|
-
}
|
|
137
|
-
return (React__default.createElement(MenuItem, { key: menuItem.id, role: "menuitem", "data-testid": `mobile-menu-level-${currentLevel}-link-${itemIndex + 1}`, isActive: isSelected(currentUrl, menuUrl, true) },
|
|
138
|
-
React__default.createElement(LinkModifier, { menuItem: menuItem, tabIndex: tabNavigationDisabled() })));
|
|
139
|
-
};
|
|
140
|
-
const SubMenuMobile = ({ currentLevel, menuItem }) => {
|
|
141
|
-
const navElements = menuItem.pages;
|
|
142
|
-
if (!navElements.length) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
146
|
-
currentLevel > 1 && React__default.createElement(MenuItemBackLink, { currentLevel: currentLevel }),
|
|
147
|
-
navElements.map((subMenuItem, index) => (React__default.createElement(CreateSubMenuItem, { menuItem: subMenuItem, currentLevel: currentLevel, key: subMenuItem.id, itemIndex: index })))));
|
|
148
|
-
};
|
|
149
|
-
const NavigationMenuMobile = () => {
|
|
150
|
-
const { items, menuLevel, level1Items, level2Items } = useContext(NavContext);
|
|
151
|
-
const { mainNavigation } = items;
|
|
152
|
-
if (!(mainNavigation === null || mainNavigation === void 0 ? void 0 : mainNavigation.pages.length)) {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
156
|
-
React__default.createElement(MenuList, { role: "menu", "aria-hidden": menuLevel.scrollPosition !== 0, "aria-disabled": menuLevel.scrollPosition !== 0, "data-testid": "mobile-nav-menu-level-1", isInView: menuLevel.scrollPosition === 0 },
|
|
157
|
-
React__default.createElement(SubMenuMobile, { currentLevel: 1, menuItem: mainNavigation }),
|
|
158
|
-
React__default.createElement(MenuItem, { key: "business-item", "aria-hidden": menuLevel.scrollPosition !== 0, role: "menuitem" },
|
|
159
|
-
React__default.createElement(BusinessMenu, null))),
|
|
160
|
-
menuLevel.level1Mobile !== null && (React__default.createElement(MenuList, { role: "menu", "aria-hidden": menuLevel.scrollPosition !== 1, "aria-disabled": menuLevel.scrollPosition !== 1, "data-testid": "mobile-nav-menu-level-2", isInView: menuLevel.scrollPosition === 1 },
|
|
161
|
-
React__default.createElement(SubMenuMobile, { currentLevel: 2, menuItem: level1Items[menuLevel.level1Mobile] }))),
|
|
162
|
-
menuLevel.level2Mobile !== null && (React__default.createElement(MenuList, { role: "menu", "aria-hidden": menuLevel.scrollPosition !== 2, "aria-disabled": menuLevel.scrollPosition !== 2, "data-testid": "mobile-nav-menu-level-3", isInView: menuLevel.scrollPosition === 2 },
|
|
163
|
-
React__default.createElement(SubMenuMobile, { currentLevel: 3, menuItem: level2Items[menuLevel.level2Mobile] })))));
|
|
164
|
-
};
|
|
165
|
-
const RenderMobileMenu = () => {
|
|
166
|
-
const { menuLevel, isMobileMenuOpen } = useContext(NavContext);
|
|
167
|
-
const mobileMenuRef = useRef(null);
|
|
168
|
-
const slidingMenuAnimation = useSpring({
|
|
169
|
-
transform: `translateX(${(menuLevel.scrollPosition / menuLevelsAmount) * -100}%)`,
|
|
170
|
-
});
|
|
171
|
-
const mobileMenuContext = useMemo(() => ({
|
|
172
|
-
mobileMenuRef,
|
|
173
|
-
}), [mobileMenuRef]);
|
|
174
|
-
if (!isMobileMenuOpen) {
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
return (React__default.createElement(MobileMenuContainer, { ref: mobileMenuRef },
|
|
178
|
-
React__default.createElement(MobileMenuContext.Provider, { value: mobileMenuContext },
|
|
179
|
-
React__default.createElement(MobileMenu, null,
|
|
180
|
-
React__default.createElement(MobileMenuWrapper, null,
|
|
181
|
-
React__default.createElement(animated.div, { style: slidingMenuAnimation },
|
|
182
|
-
React__default.createElement(NavigationMenuMobile, null)))))));
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
export { RenderMobileMenu as default };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Search } from '@dnanpm/icons';
|
|
2
|
-
import React__default, { useContext } from 'react';
|
|
3
|
-
import Icon from '../../Icon/Icon.js';
|
|
4
|
-
import NavContext from '../context/NavContext.js';
|
|
5
|
-
import MainNavTooltipMenu from './MainNavTooltipMenu.js';
|
|
6
|
-
|
|
7
|
-
const PageSearch = ({ searchLabel }) => {
|
|
8
|
-
const globalStateString = 'search';
|
|
9
|
-
const { navZIndex, searchComponent: SearchComponent } = useContext(NavContext);
|
|
10
|
-
return (React__default.createElement(MainNavTooltipMenu, { zIndex: navZIndex + 1, tooltipRight: "0", contentComponent: SearchComponent, contentWidth: "100%", globalStateString: globalStateString, fullWidthDesktop: true, closeWhenTagClicked: ['a'] },
|
|
11
|
-
React__default.createElement(Icon, { icon: Search, size: "2rem" }),
|
|
12
|
-
React__default.createElement("span", null, searchLabel)));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { PageSearch as default };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LangProps } from '../../../types/language';
|
|
3
|
-
export interface RibbonDataProps {
|
|
4
|
-
ribbonLink: LangProps;
|
|
5
|
-
ribbonIcon: string;
|
|
6
|
-
ribbonTexts: LangProps;
|
|
7
|
-
}
|
|
8
|
-
interface Props {
|
|
9
|
-
ribbonData: RibbonDataProps[];
|
|
10
|
-
lang?: string;
|
|
11
|
-
}
|
|
12
|
-
declare const Ribbon: ({ ribbonData, lang }: Props) => React.JSX.Element;
|
|
13
|
-
export default Ribbon;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { styled } from 'styled-components';
|
|
3
|
-
import theme from '../../../themes/theme.js';
|
|
4
|
-
import { ribbonHeight } from '../../../themes/themeComponents/navigation.js';
|
|
5
|
-
import { media, getMultipliedSize } from '../../../utils/styledUtils.js';
|
|
6
|
-
import Icon from '../../Icon/Icon.js';
|
|
7
|
-
|
|
8
|
-
const RibbonContainer = styled.div `
|
|
9
|
-
display: none;
|
|
10
|
-
${media.md `
|
|
11
|
-
background: ${theme.color.background.sand.E01};
|
|
12
|
-
display: block;
|
|
13
|
-
`};
|
|
14
|
-
`;
|
|
15
|
-
const RibbonItems = styled.div `
|
|
16
|
-
max-width: 1290px;
|
|
17
|
-
height: ${ribbonHeight};
|
|
18
|
-
padding: 0 ${getMultipliedSize(theme.base.baseHeight, 2)};
|
|
19
|
-
margin: 0 auto;
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
align-items: center;
|
|
23
|
-
`;
|
|
24
|
-
const RibbonColumn = styled.div `
|
|
25
|
-
flex: 1 1 auto;
|
|
26
|
-
display: flex;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
align-items: center;
|
|
29
|
-
color: ${theme.color.text.gray};
|
|
30
|
-
font-size: ${theme.fontSize.xs};
|
|
31
|
-
border-right: 2px solid ${theme.color.line.L03};
|
|
32
|
-
&:last-of-type {
|
|
33
|
-
border: none;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
span.dnasg-icon {
|
|
37
|
-
margin-right: ${getMultipliedSize(theme.base.baseWidth, 0.5)};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
a {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
color: ${theme.color.text.gray};
|
|
44
|
-
&:hover,
|
|
45
|
-
&:focus,
|
|
46
|
-
&:active {
|
|
47
|
-
text-decoration: none;
|
|
48
|
-
color: ${theme.color.text.pink};
|
|
49
|
-
border: none;
|
|
50
|
-
outline: none;
|
|
51
|
-
}
|
|
52
|
-
&:focus {
|
|
53
|
-
text-decoration: underline;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
const Ribbon = ({ ribbonData, lang = 'fi' }) => (React__default.createElement(RibbonContainer, null,
|
|
58
|
-
React__default.createElement(RibbonItems, null, ribbonData.map(ribbon => (React__default.createElement(RibbonColumn, { key: `ribbon-${ribbon.ribbonIcon}` },
|
|
59
|
-
ribbon.ribbonLink[lang] && (React__default.createElement("a", { href: ribbon.ribbonLink[lang] },
|
|
60
|
-
React__default.createElement(Icon, { name: ribbon.ribbonIcon, size: "1rem" }),
|
|
61
|
-
React__default.createElement("span", null, ribbon.ribbonTexts[lang]))),
|
|
62
|
-
!ribbon.ribbonLink[lang] && (React__default.createElement(React__default.Fragment, null,
|
|
63
|
-
React__default.createElement(Icon, { name: ribbon.ribbonIcon, size: "1rem" }),
|
|
64
|
-
React__default.createElement("span", null, ribbon.ribbonTexts[lang])))))))));
|
|
65
|
-
|
|
66
|
-
export { Ribbon as default };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { RibbonDataProps } from './ChildComponents/Ribbon';
|
|
4
|
-
import type { GlobalNavItems } from './types/globalNavProps';
|
|
5
|
-
export interface MainNavigationProps {
|
|
6
|
-
/** Allows to pass a custom className */
|
|
7
|
-
className?: string;
|
|
8
|
-
items?: GlobalNavItems;
|
|
9
|
-
language?: string;
|
|
10
|
-
zIndex?: number;
|
|
11
|
-
search?: boolean;
|
|
12
|
-
searchText?: string;
|
|
13
|
-
searchComponent?: ReactNode | boolean;
|
|
14
|
-
minicart?: boolean;
|
|
15
|
-
minicartText?: string;
|
|
16
|
-
minicartAmount?: number;
|
|
17
|
-
minicartComponent?: ReactNode | boolean;
|
|
18
|
-
showMinicart?: boolean;
|
|
19
|
-
showLoginTooltip?: boolean;
|
|
20
|
-
login?: boolean;
|
|
21
|
-
loginText?: string;
|
|
22
|
-
loginComponent?: ReactNode | boolean;
|
|
23
|
-
isLoggedIn?: boolean;
|
|
24
|
-
collapseSize?: number;
|
|
25
|
-
languageSelector?: boolean;
|
|
26
|
-
nextJSLinkComponent: ReactNode | boolean;
|
|
27
|
-
ribbon?: boolean;
|
|
28
|
-
ribbonData?: RibbonDataProps[];
|
|
29
|
-
currentUrl?: string;
|
|
30
|
-
notificationText?: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @visibleName Main Navigation
|
|
34
|
-
* @deprecated Use `MainHeaderNavigation` component
|
|
35
|
-
*/
|
|
36
|
-
declare const MainNavigation: ({ items, language, zIndex, languageSelector, search, searchText, searchComponent, minicart, minicartText, minicartComponent, minicartAmount, showMinicart, showLoginTooltip, login, loginText, loginComponent, isLoggedIn, collapseSize, nextJSLinkComponent, ribbon, ribbonData, className, currentUrl, notificationText, }: MainNavigationProps) => React.JSX.Element;
|
|
37
|
-
/** @component */
|
|
38
|
-
export default MainNavigation;
|