@hlf-fe/pulmo-ui 1.5.1 → 1.5.3
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/dist/components/buttons/button/button.d.ts +4 -4
- package/dist/components/buttons/button/button.js +11 -20
- package/dist/components/buttons/link-button/link-button.d.ts +25 -0
- package/dist/components/buttons/link-button/link-button.js +80 -0
- package/dist/components/buttons/link-button/link-button.stories.d.ts +6 -0
- package/dist/components/buttons/link-button/link-button.stories.js +17 -0
- package/dist/components/data-display/list/text-list/text-list.stories.d.ts +0 -0
- package/dist/components/data-display/list/text-list/text-list.stories.js +0 -0
- package/dist/components/icons/external-icon/external-icon.js +1 -1
- package/dist/components/icons/toggable-chevron/toggable-chevron.js +5 -5
- package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.js +2 -2
- package/dist/components/inputs/dropdown/dropdown.js +5 -5
- package/dist/components/inputs/text-field/text-field.d.ts +1 -1
- package/dist/components/inputs/text-field/text-field.js +2 -2
- package/dist/components/layout/accordion/accordion.js +3 -3
- package/dist/components/layout/container/container.js +2 -2
- package/dist/components/layout/image-list/image-list.d.ts +6 -0
- package/dist/components/layout/image-list/image-list.js +55 -0
- package/dist/components/layout/image-list/image-list.stories.d.ts +6 -0
- package/dist/components/layout/image-list/image-list.stories.js +19 -0
- package/dist/components/modules/entry-list/entry-list.js +6 -6
- package/dist/components/modules/footer/footer.d.ts +1 -0
- package/dist/components/modules/footer/footer.js +4 -4
- package/dist/components/modules/logo-list/logo-list.d.ts +5 -0
- package/dist/components/modules/logo-list/logo-list.js +34 -0
- package/dist/components/modules/logo-list/logo-list.stories.d.ts +6 -0
- package/dist/components/modules/logo-list/logo-list.stories.js +18 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-cell/nav-cell.d.ts +6 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-cell/nav-cell.js +69 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-cell.d.ts +6 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-cell.js +69 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.d.ts +8 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.js +80 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-section.d.ts +8 -0
- package/dist/components/modules/navigation/navigation-desktop/nav-section.js +80 -0
- package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.d.ts +3 -0
- package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.js +136 -0
- package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.stories.d.ts +6 -0
- package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.stories.js +12 -0
- package/dist/components/modules/navigation/navigation-mobile/nav-panel.d.ts +11 -0
- package/dist/components/modules/navigation/navigation-mobile/nav-panel.js +158 -0
- package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.d.ts +3 -0
- package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.js +97 -0
- package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.stories.d.ts +6 -0
- package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.stories.js +12 -0
- package/dist/components/modules/navigation/shared/nav-item/nav-item.d.ts +18 -0
- package/dist/components/modules/navigation/shared/nav-item/nav-item.js +106 -0
- package/dist/components/modules/navigation/shared/types/types.d.ts +43 -0
- package/dist/components/modules/navigation/shared/types/types.js +1 -0
- package/dist/components/modules/navigation/types.d.ts +39 -0
- package/dist/components/modules/navigation/types.js +1 -0
- package/dist/components/navigation/dropdown-menu/dropdown-menu.d.ts +0 -0
- package/dist/components/navigation/dropdown-menu/dropdown-menu.js +0 -0
- package/dist/components/navigation/nav-cell/nav-cell.d.ts +1 -1
- package/dist/components/navigation/nav-cell/nav-cell.js +12 -10
- package/dist/components/navigation/nav-cell/navbar.d.ts +0 -0
- package/dist/components/navigation/nav-cell/navbar.js +0 -0
- package/dist/components/navigation/nav-section/dropdown-menu.d.ts +0 -0
- package/dist/components/navigation/nav-section/dropdown-menu.js +0 -0
- package/dist/components/navigation/nav-section/nav-section.d.ts +0 -0
- package/dist/components/navigation/nav-section/nav-section.js +0 -0
- package/dist/components/navigation/navbar/navbar.d.ts +0 -0
- package/dist/components/navigation/navbar/navbar.js +0 -0
- package/dist/components/navigation/pagination/pagination.js +3 -3
- package/dist/components/surfaces/paper/paper.js +4 -4
- package/dist/hoc/withDefaultTheme.d.ts +3 -1
- package/dist/hoc/withDefaultTheme.js +16 -6
- package/dist/index.d.ts +13 -6
- package/dist/index.js +8 -6
- package/dist/mocks/image-mocks.d.ts +7 -0
- package/dist/mocks/image-mocks.js +7 -0
- package/dist/mocks/navigation-mock.d.ts +5 -0
- package/dist/mocks/navigation-mock.js +153 -0
- package/dist/models/sanity.types.d.ts +9 -0
- package/dist/models/sanity.types.js +1 -0
- package/dist/models/web-page.url.d.ts +10 -0
- package/dist/models/web-page.url.js +1 -0
- package/package.json +1 -1
- package/dist/components/typography/heading/heading.d.ts +0 -4
- package/dist/components/typography/heading/heading.js +0 -47
- package/dist/components/typography/heading/heading.stories.d.ts +0 -7
- package/dist/components/typography/heading/heading.stories.js +0 -26
- package/dist/components/typography/heading/headings.d.ts +0 -4
- package/dist/components/typography/heading/headings.js +0 -47
- package/dist/components/typography/heading/headings.stories.d.ts +0 -7
- package/dist/components/typography/heading/headings.stories.js +0 -26
- package/dist/components/typography/portable-text/portable-text-default.d.ts +0 -39
- package/dist/components/typography/portable-text/portable-text-default.js +0 -23
- package/dist/styles/mixins/theme-mixins/theme-mixins.d.ts +0 -5
- package/dist/styles/mixins/theme-mixins/theme-mixins.js +0 -37
- /package/dist/components/{typography/portable-text/portable-text-component.d.ts → data-display/list/text-list/text-list.d.ts} +0 -0
- /package/dist/components/{typography/portable-text/portable-text-component.js → data-display/list/text-list/text-list.js} +0 -0
- /package/dist/components/layout/image/{image.stories.d.ts → Image.stories.d.ts} +0 -0
- /package/dist/components/layout/image/{image.stories.js → Image.stories.js} +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ToggableChevron } from "../../../../../components/icons/toggable-chevron/toggable-chevron";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { media } from "../../../../../styles/mixins";
|
|
5
|
+
import { rem } from "../../../../../styles/units";
|
|
6
|
+
export const NavigationCell = ({ title, active, onToggleCell, }) => (_jsx(StyledListItem, { children: _jsxs(NavCell, { "data-test": "nav-cell", "$active": active, onClick: onToggleCell, children: [title, _jsx(StyledToggle, { toggled: active })] }) }));
|
|
7
|
+
const StyledListItem = styled.li `
|
|
8
|
+
display: inline-block;
|
|
9
|
+
height: 100%;
|
|
10
|
+
padding-right: ${rem(16)};
|
|
11
|
+
|
|
12
|
+
${media.XL `
|
|
13
|
+
padding-right: ${rem(32)};
|
|
14
|
+
|
|
15
|
+
&:last-of-type {
|
|
16
|
+
padding-right: ${rem(40)};
|
|
17
|
+
}
|
|
18
|
+
`}
|
|
19
|
+
`;
|
|
20
|
+
const NavCell = styled.button `
|
|
21
|
+
padding: 0;
|
|
22
|
+
border: 0;
|
|
23
|
+
background: none;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-columns: 1fr 22px;
|
|
27
|
+
align-items: center;
|
|
28
|
+
height: 100%;
|
|
29
|
+
font-size: ${rem(14)};
|
|
30
|
+
|
|
31
|
+
${media.XL `
|
|
32
|
+
font-size: ${rem(18)};
|
|
33
|
+
`}
|
|
34
|
+
|
|
35
|
+
p {
|
|
36
|
+
font-size: inherit;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${({ theme }) => css `
|
|
44
|
+
color: ${theme.blackLight};
|
|
45
|
+
font-family: ${theme.valueBold};
|
|
46
|
+
`};
|
|
47
|
+
|
|
48
|
+
${({ $active }) => $active &&
|
|
49
|
+
css `
|
|
50
|
+
${({ theme }) => css `
|
|
51
|
+
color: ${theme.red};
|
|
52
|
+
box-shadow: inset 0 -4px 0 ${theme.red};
|
|
53
|
+
`};
|
|
54
|
+
`};
|
|
55
|
+
`;
|
|
56
|
+
const StyledToggle = styled(ToggableChevron).attrs({
|
|
57
|
+
disableCircle: true,
|
|
58
|
+
}) `
|
|
59
|
+
margin-left: ${rem(4)};
|
|
60
|
+
|
|
61
|
+
svg {
|
|
62
|
+
${(props) => props.toggled &&
|
|
63
|
+
css `
|
|
64
|
+
${({ theme }) => css `
|
|
65
|
+
fill: ${theme.red};
|
|
66
|
+
`};
|
|
67
|
+
`};
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ToggableChevron } from "../../../../components/icons/toggable-chevron/toggable-chevron";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { media } from "../../../../styles/mixins";
|
|
5
|
+
import { rem } from "../../../../styles/units";
|
|
6
|
+
export const NavigationCell = ({ title, active, onToggleCell, }) => (_jsx(StyledListItem, { children: _jsxs(NavCell, { "data-test": "nav-cell", "$active": active, onClick: onToggleCell, children: [title, _jsx(StyledToggle, { toggled: active })] }) }));
|
|
7
|
+
const StyledListItem = styled.li `
|
|
8
|
+
display: inline-block;
|
|
9
|
+
height: 100%;
|
|
10
|
+
padding-right: ${rem(16)};
|
|
11
|
+
|
|
12
|
+
${media.XL `
|
|
13
|
+
padding-right: ${rem(32)};
|
|
14
|
+
|
|
15
|
+
&:last-of-type {
|
|
16
|
+
padding-right: ${rem(40)};
|
|
17
|
+
}
|
|
18
|
+
`}
|
|
19
|
+
`;
|
|
20
|
+
const NavCell = styled.button `
|
|
21
|
+
padding: 0;
|
|
22
|
+
border: 0;
|
|
23
|
+
background: none;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-columns: 1fr 22px;
|
|
27
|
+
align-items: center;
|
|
28
|
+
height: 100%;
|
|
29
|
+
font-size: ${rem(14)};
|
|
30
|
+
|
|
31
|
+
${media.XL `
|
|
32
|
+
font-size: ${rem(18)};
|
|
33
|
+
`}
|
|
34
|
+
|
|
35
|
+
p {
|
|
36
|
+
font-size: inherit;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${({ theme }) => css `
|
|
44
|
+
color: ${theme.blackLight};
|
|
45
|
+
font-family: ${theme.valueBold};
|
|
46
|
+
`};
|
|
47
|
+
|
|
48
|
+
${({ $active }) => $active &&
|
|
49
|
+
css `
|
|
50
|
+
${({ theme }) => css `
|
|
51
|
+
color: ${theme.red};
|
|
52
|
+
box-shadow: inset 0 -4px 0 ${theme.red};
|
|
53
|
+
`};
|
|
54
|
+
`};
|
|
55
|
+
`;
|
|
56
|
+
const StyledToggle = styled(ToggableChevron).attrs({
|
|
57
|
+
disableCircle: true,
|
|
58
|
+
}) `
|
|
59
|
+
margin-left: ${rem(4)};
|
|
60
|
+
|
|
61
|
+
svg {
|
|
62
|
+
${(props) => props.toggled &&
|
|
63
|
+
css `
|
|
64
|
+
${({ theme }) => css `
|
|
65
|
+
fill: ${theme.red};
|
|
66
|
+
`};
|
|
67
|
+
`};
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NavigationSectionModel } from "../../shared/types/types";
|
|
2
|
+
type Props = {
|
|
3
|
+
section: NavigationSectionModel;
|
|
4
|
+
className?: string;
|
|
5
|
+
closeSection: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const NavigationSection: ({ section, className, closeSection }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { NavigationItem } from "../../shared/nav-item/nav-item";
|
|
4
|
+
import { CardBanner } from "../../../../../components/surfaces/cards/card-banner/card-banner";
|
|
5
|
+
import styled, { css } from "styled-components";
|
|
6
|
+
import { rem } from '../../../../../styles/units';
|
|
7
|
+
export const NavigationSection = ({ section, className, closeSection }) => {
|
|
8
|
+
const [currentItem, setCurrentItem] = useState();
|
|
9
|
+
const onToggle = (item) => {
|
|
10
|
+
setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
|
|
11
|
+
};
|
|
12
|
+
const renderColumn = (title, items) => (items ? (_jsxs(NavCol, { children: [_jsx(Header, { children: title }), _jsx(StyledList, { children: items.map((item) => (_jsx(NavigationItem, { model: item, expanded: currentItem?.key === item.key, parent: section.title, onToggle: onToggle, onLinkClick: closeSection }, item.key))) })] })) : _jsx("span", {}));
|
|
13
|
+
return (_jsx(Wrapper, { "data-test": "nav-section", className: className, children: _jsxs(Content, { children: [_jsxs(NavWrapper, { "data-test": "nav-block", children: [renderColumn(section.column1Title, section.column1Items), renderColumn(section.column2Title, section.column2Items)] }), _jsx(InfoWrapper, { color: section?.backgroundColor?.hex, children: section?.linkBanners && section?.linkBanners?.map((banner) => (_jsx(CardBanner, { ...banner, externalUrl: banner?.link?.externalUrl, internalLink: banner?.link?.internalLink?.slug?.current, onClick: closeSection }, banner.title.trim()))) })] }) }));
|
|
14
|
+
};
|
|
15
|
+
const Wrapper = styled.div `
|
|
16
|
+
@keyframes fadeIn {
|
|
17
|
+
0% { opacity: 0; }
|
|
18
|
+
100% { opacity: 1; }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
position: absolute;
|
|
22
|
+
width: 100%;
|
|
23
|
+
animation: fadeIn 0.2s;
|
|
24
|
+
`;
|
|
25
|
+
const Content = styled.div `
|
|
26
|
+
position: absolute;
|
|
27
|
+
width: 100%;
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: 55% 45%;
|
|
30
|
+
max-width: 1114px;
|
|
31
|
+
left: 50%;
|
|
32
|
+
transform: translateX(-50%);
|
|
33
|
+
`;
|
|
34
|
+
const NavWrapper = styled.div `
|
|
35
|
+
display: grid;
|
|
36
|
+
grid-template-columns: 1fr 1fr;
|
|
37
|
+
grid-column-gap: ${rem(20)};
|
|
38
|
+
background-color: white;
|
|
39
|
+
padding: ${rem(32)} ${rem(62)} ${rem(56)} ${rem(45)};
|
|
40
|
+
`;
|
|
41
|
+
const InfoWrapper = styled.div `
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
padding: ${rem(45)};
|
|
46
|
+
background-color: white;
|
|
47
|
+
|
|
48
|
+
${({ color }) => color && css `
|
|
49
|
+
background-color: ${color};
|
|
50
|
+
`};
|
|
51
|
+
|
|
52
|
+
> * {
|
|
53
|
+
&:first-child {
|
|
54
|
+
margin-bottom: ${rem(24)};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
const NavCol = styled.div `
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
`;
|
|
63
|
+
const StyledList = styled.ul `
|
|
64
|
+
margin: 0;
|
|
65
|
+
padding: 0;
|
|
66
|
+
`;
|
|
67
|
+
const Header = styled.h2 `
|
|
68
|
+
font-size: ${rem(24)};
|
|
69
|
+
margin: 0;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
border-bottom: 1px solid ${({ theme }) => theme.grayPale};
|
|
74
|
+
padding-bottom: 2px;
|
|
75
|
+
|
|
76
|
+
${({ theme }) => css `
|
|
77
|
+
color: ${theme.blackLight};
|
|
78
|
+
font-family: ${theme.valueBold};
|
|
79
|
+
`};
|
|
80
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NavigationSectionModel } from "../types";
|
|
2
|
+
type Props = {
|
|
3
|
+
section: NavigationSectionModel;
|
|
4
|
+
className?: string;
|
|
5
|
+
closeSection: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const NavigationSection: ({ section, className, closeSection }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { NavigationItem } from "../../../../components/navigation/nav-item/nav-item";
|
|
5
|
+
import { CardBanner } from "../../../../components/surfaces/cards/card-banner/card-banner";
|
|
6
|
+
import { rem } from '../../../../styles/units';
|
|
7
|
+
export const NavigationSection = ({ section, className, closeSection }) => {
|
|
8
|
+
const [currentItem, setCurrentItem] = useState();
|
|
9
|
+
const onToggle = (item) => {
|
|
10
|
+
setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
|
|
11
|
+
};
|
|
12
|
+
const renderColumn = (title, items) => (items ? (_jsxs(NavCol, { children: [_jsx(Header, { children: title }), _jsx(StyledList, { children: items.map((item) => (_jsx(NavigationItem, { model: item, expanded: currentItem?.key === item.key, parent: section.title, onToggle: onToggle, onLinkClick: closeSection }, item.key))) })] })) : _jsx("span", {}));
|
|
13
|
+
return (_jsx(Wrapper, { "data-test": "nav-section", className: className, children: _jsxs(Content, { children: [_jsxs(NavWrapper, { "data-test": "nav-block", children: [renderColumn(section.column1Title, section.column1Items), renderColumn(section.column2Title, section.column2Items)] }), _jsx(InfoWrapper, { color: section?.backgroundColor?.hex, children: section?.linkBanners && section?.linkBanners?.map((banner) => (_jsx(CardBanner, { ...banner, externalUrl: banner?.link?.externalUrl, internalLink: banner?.link?.internalLink?.slug?.current, onClick: closeSection }, banner.title.trim()))) })] }) }));
|
|
14
|
+
};
|
|
15
|
+
const Wrapper = styled.div `
|
|
16
|
+
@keyframes fadeIn {
|
|
17
|
+
0% { opacity: 0; }
|
|
18
|
+
100% { opacity: 1; }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
position: absolute;
|
|
22
|
+
width: 100%;
|
|
23
|
+
animation: fadeIn 0.2s;
|
|
24
|
+
`;
|
|
25
|
+
const Content = styled.div `
|
|
26
|
+
position: absolute;
|
|
27
|
+
width: 100%;
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: 55% 45%;
|
|
30
|
+
max-width: 1114px;
|
|
31
|
+
left: 50%;
|
|
32
|
+
transform: translateX(-50%);
|
|
33
|
+
`;
|
|
34
|
+
const NavWrapper = styled.div `
|
|
35
|
+
display: grid;
|
|
36
|
+
grid-template-columns: 1fr 1fr;
|
|
37
|
+
grid-column-gap: ${rem(20)};
|
|
38
|
+
background-color: white;
|
|
39
|
+
padding: ${rem(32)} ${rem(62)} ${rem(56)} ${rem(45)};
|
|
40
|
+
`;
|
|
41
|
+
const InfoWrapper = styled.div `
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
padding: ${rem(45)};
|
|
46
|
+
background-color: white;
|
|
47
|
+
|
|
48
|
+
${({ color }) => color && css `
|
|
49
|
+
background-color: ${color};
|
|
50
|
+
`};
|
|
51
|
+
|
|
52
|
+
> * {
|
|
53
|
+
&:first-child {
|
|
54
|
+
margin-bottom: ${rem(24)};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
const NavCol = styled.div `
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
`;
|
|
63
|
+
const StyledList = styled.ul `
|
|
64
|
+
margin: 0;
|
|
65
|
+
padding: 0;
|
|
66
|
+
`;
|
|
67
|
+
const Header = styled.h2 `
|
|
68
|
+
font-size: ${rem(24)};
|
|
69
|
+
margin: 0;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
border-bottom: 1px solid ${({ theme }) => theme.grayPale};
|
|
74
|
+
padding-bottom: 2px;
|
|
75
|
+
|
|
76
|
+
${({ theme }) => css `
|
|
77
|
+
color: ${theme.blackLight};
|
|
78
|
+
font-family: ${theme.valueBold};
|
|
79
|
+
`};
|
|
80
|
+
`;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NavigationModel } from '../shared/types/types';
|
|
2
|
+
export type NavigationDesktopProps = NavigationModel;
|
|
3
|
+
export declare const NavigationDesktop: ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText, isMenuVisible, menuRef }: NavigationDesktopProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Link } from 'gatsby';
|
|
4
|
+
import { NavigationSection } from './nav-section/nav-section';
|
|
5
|
+
import { NavigationCell } from './nav-cell/nav-cell';
|
|
6
|
+
import { Image } from '../../../../components/layout/image/image';
|
|
7
|
+
import { Button } from '../../../../components/buttons/button/button';
|
|
8
|
+
import { ExternalIcon } from '../../../../components/icons/external-icon/external-icon';
|
|
9
|
+
import styled, { css } from 'styled-components';
|
|
10
|
+
import { rem } from '../../../../styles/units';
|
|
11
|
+
export const NavigationDesktop = ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText = {
|
|
12
|
+
ariaLabelHome: "",
|
|
13
|
+
}, isMenuVisible, menuRef }) => {
|
|
14
|
+
const [currentSection, setCurrentSection] = useState();
|
|
15
|
+
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
16
|
+
const { ariaLabelHome } = localeText;
|
|
17
|
+
const onOpenSection = (section) => {
|
|
18
|
+
const sectionToShow = currentSection?.key !== section?.key ? section : undefined;
|
|
19
|
+
setCurrentSection(sectionToShow);
|
|
20
|
+
};
|
|
21
|
+
return (_jsxs(Wrapper, { ref: menuRef, children: [_jsxs(MenuContainer, { children: [!!topMenuItems?.length && (_jsx(TopBar, { "data-test": "nav-top-bar", children: topMenuItems.map(({ webUrlName, internalLink, externalUrl }) => (_jsx(StyledTopLink, { to: externalUrl || internalLink?.slug?.current || '/', children: webUrlName }, webUrlName))) })), _jsxs(NavBar, { children: [logotype && (_jsx(StyledLogoLink, { "data-test": "nav-logo", to: '/', "aria-label": ariaLabelHome, children: _jsx(Image, { image: logotype?.asset, width: "142", height: "35" }) })), _jsx(StyledList, { "data-test": "nav-list", children: mainMenuItems?.map(section => (_jsx(NavigationCell, { active: currentSection?.key === section.key, title: section.title, onToggleCell: () => onOpenSection(section) }, section.key))) }), ctaButton && (_jsxs(StyledButton, { dataTest: "nav-cta", to: ctaButton?.externalUrl, href: ctaButton?.internalLink?.slug?.current, children: [ctaButton.webUrlName, _jsx(IconWrapper, { children: _jsx(ExternalIcon, {}) })] }))] })] }), currentSection && (_jsx(StyledNavSection, { section: currentSection, closeSection: () => onOpenSection(undefined) })), (currentSection || isSearchOpen) && (_jsx(Overlay, { "data-test": "nav-overlay", "$isSearchOpen": isSearchOpen, "$playFadeOut": !isMenuVisible, onClick: () => {
|
|
22
|
+
onOpenSection(undefined);
|
|
23
|
+
setIsSearchOpen(false);
|
|
24
|
+
} }))] }));
|
|
25
|
+
};
|
|
26
|
+
const Wrapper = styled.nav `
|
|
27
|
+
position: relative;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
background: white;
|
|
31
|
+
z-index: 10;
|
|
32
|
+
|
|
33
|
+
a {
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
const MenuContainer = styled.div `
|
|
38
|
+
position: relative;
|
|
39
|
+
max-width: ${({ theme }) => theme.siteMaxWidth};
|
|
40
|
+
margin: 0 auto;
|
|
41
|
+
width: 100%;
|
|
42
|
+
`;
|
|
43
|
+
const Overlay = styled.div `
|
|
44
|
+
@keyframes fadeIn {
|
|
45
|
+
0% {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
}
|
|
48
|
+
100% {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes fadeOut {
|
|
54
|
+
0% {
|
|
55
|
+
opacity: 1;
|
|
56
|
+
}
|
|
57
|
+
100% {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
position: fixed;
|
|
64
|
+
left: 0;
|
|
65
|
+
right: 0;
|
|
66
|
+
top: ${rem(128)};
|
|
67
|
+
bottom: 0;
|
|
68
|
+
background: rgba(0, 0, 0, 0.4);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
animation: fadeIn 0.2s forwards;
|
|
71
|
+
|
|
72
|
+
${({ $isSearchOpen }) => $isSearchOpen &&
|
|
73
|
+
css `
|
|
74
|
+
top: ${rem(52)};
|
|
75
|
+
z-index: 2;
|
|
76
|
+
`}
|
|
77
|
+
|
|
78
|
+
${({ $playFadeOut }) => $playFadeOut &&
|
|
79
|
+
css `
|
|
80
|
+
animation: fadeOut 0.2s forwards;
|
|
81
|
+
`}
|
|
82
|
+
`;
|
|
83
|
+
const TopBar = styled.div `
|
|
84
|
+
position: relative;
|
|
85
|
+
display: flex;
|
|
86
|
+
height: 52px;
|
|
87
|
+
justify-content: flex-end;
|
|
88
|
+
align-items: center;
|
|
89
|
+
background: white;
|
|
90
|
+
padding-right: ${rem(56)};
|
|
91
|
+
`;
|
|
92
|
+
const NavBar = styled.div `
|
|
93
|
+
position: relative;
|
|
94
|
+
display: flex;
|
|
95
|
+
height: 76px;
|
|
96
|
+
background: white;
|
|
97
|
+
padding: 0 ${rem(56)};
|
|
98
|
+
`;
|
|
99
|
+
const StyledButton = styled(Button) `
|
|
100
|
+
align-self: center;
|
|
101
|
+
white-space: nowrap;
|
|
102
|
+
`;
|
|
103
|
+
const IconWrapper = styled.span ``;
|
|
104
|
+
const StyledTopLink = styled(Link) `
|
|
105
|
+
font-size: ${rem(16)};
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
margin: 0;
|
|
108
|
+
margin-right: ${rem(32)};
|
|
109
|
+
|
|
110
|
+
${({ theme }) => css `
|
|
111
|
+
color: ${theme.blackLight};
|
|
112
|
+
font-family: ${theme.valueMedium};
|
|
113
|
+
`};
|
|
114
|
+
|
|
115
|
+
&:focus-visible {
|
|
116
|
+
outline: ${rem(2)} solid ${({ theme }) => theme.blackLight};
|
|
117
|
+
outline-offset: ${rem(2)};
|
|
118
|
+
border-radius: ${rem(2)};
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
const StyledLogoLink = styled(Link) `
|
|
122
|
+
display: flex;
|
|
123
|
+
align-self: center;
|
|
124
|
+
margin-right: ${rem(16)};
|
|
125
|
+
`;
|
|
126
|
+
const StyledList = styled.ul `
|
|
127
|
+
margin: 0;
|
|
128
|
+
padding: 0;
|
|
129
|
+
margin-left: auto;
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
`;
|
|
133
|
+
const StyledNavSection = styled(NavigationSection) `
|
|
134
|
+
top: 100%;
|
|
135
|
+
z-index: 1;
|
|
136
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { NavigationDesktop } from "./navigation-desktop";
|
|
3
|
+
declare const meta: Meta<typeof NavigationDesktop>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof NavigationDesktop>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NavigationDesktop } from "./navigation-desktop";
|
|
2
|
+
import { mockNavigation } from '../../../../mocks/navigation-mock';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Modules/Main Navigation (Desktop)",
|
|
5
|
+
component: NavigationDesktop,
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
...mockNavigation
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WebPageUrl } from "../../../../models/web-page-url";
|
|
2
|
+
import { NavigationSectionModel } from "../shared/types/types";
|
|
3
|
+
type Props = {
|
|
4
|
+
mainMenuItems?: NavigationSectionModel[];
|
|
5
|
+
topMenuItems?: WebPageUrl[];
|
|
6
|
+
scrollToTop: () => void;
|
|
7
|
+
closeMenu: () => void;
|
|
8
|
+
goBackText: string;
|
|
9
|
+
};
|
|
10
|
+
declare const NavigationPanel: ({ mainMenuItems, topMenuItems, scrollToTop, closeMenu, goBackText }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default NavigationPanel;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Link } from "gatsby";
|
|
4
|
+
import { ToggableChevron } from "../../../../components/icons/toggable-chevron/toggable-chevron";
|
|
5
|
+
import { CardBanner } from "../../../../components/surfaces/cards/card-banner/card-banner";
|
|
6
|
+
import { NavigationItem } from "../shared/nav-item/nav-item";
|
|
7
|
+
import styled, { css } from "styled-components";
|
|
8
|
+
import { rem } from '../../../../styles/units';
|
|
9
|
+
const NavigationPanel = ({ mainMenuItems, topMenuItems, scrollToTop, closeMenu, goBackText }) => {
|
|
10
|
+
const [currentSection, setCurrentSection] = useState();
|
|
11
|
+
const [currentItem, setCurrentItem] = useState();
|
|
12
|
+
const [isShowingSection, setIsShowingSection] = useState(false);
|
|
13
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
14
|
+
const toggleSection = (section) => {
|
|
15
|
+
if (isAnimating)
|
|
16
|
+
return;
|
|
17
|
+
if (section) {
|
|
18
|
+
setCurrentSection(section);
|
|
19
|
+
}
|
|
20
|
+
setIsShowingSection(!!section);
|
|
21
|
+
setIsAnimating(true);
|
|
22
|
+
scrollToTop();
|
|
23
|
+
};
|
|
24
|
+
const toggleItem = (item) => {
|
|
25
|
+
setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
|
|
26
|
+
};
|
|
27
|
+
const renderColumn = (title, items) => (items && (_jsxs(_Fragment, { children: [_jsx(Header, { children: title }), _jsx(StyledList, { children: items.map((item) => (_jsx(NavigationItem, { model: item, expanded: currentItem?.key === item.key, parent: currentSection?.title, onToggle: toggleItem, onLinkClick: closeMenu }, item.key))) })] })));
|
|
28
|
+
return (_jsxs(Wrapper, { "data-test": "nav-panel-wrapper", toggled: isShowingSection, onTransitionEnd: () => setIsAnimating(false), children: [_jsx(Panel, { visible: true, children: _jsxs(PanelLayout, { children: [_jsx(StyledList, { "data-test": "nav-list", children: mainMenuItems?.map((section) => (_jsx("li", { children: _jsxs(NavCell, { "data-test": "nav-cell", onClick: () => toggleSection(section), children: [_jsx("p", { children: section.title }), _jsx(Chevron, {})] }) }, section.key))) }), !!topMenuItems?.length && (_jsx(LinkContainer, { "data-test": "nav-sub-menu", children: topMenuItems.map(({ webUrlName, internalLink, externalUrl }) => (_jsx(StyledLink, { to: externalUrl || internalLink?.slug?.current || "/", children: webUrlName }, webUrlName))) }))] }) }), _jsxs(Panel, { "data-test": "nav-panel-section", visible: isShowingSection || isAnimating, children: [_jsxs(PanelLayout, { children: [_jsxs(BackCell, { "data-test": "nav-panel-back", onClick: () => toggleSection(undefined), children: [_jsx(BackChevron, { disableCircle: false }), goBackText] }), renderColumn(currentSection?.column1Title, currentSection?.column1Items), renderColumn(currentSection?.column2Title, currentSection?.column2Items)] }), _jsx(InfoWrapper, { color: currentSection?.backgroundColor?.hex, children: currentSection?.linkBanners && currentSection?.linkBanners?.map((banner) => (_jsx(CardBanner, { ...banner, externalUrl: banner?.link?.externalUrl, internalLink: banner?.link?.internalLink?.slug?.current, onClick: closeMenu }, banner.title.trim()))) })] })] }));
|
|
29
|
+
};
|
|
30
|
+
const Wrapper = styled.div `
|
|
31
|
+
width: 100%;
|
|
32
|
+
display: flex;
|
|
33
|
+
transform: translateX(0%);
|
|
34
|
+
transition: transform ease-in-out 0.6s;
|
|
35
|
+
|
|
36
|
+
${({ toggled }) => toggled && css `
|
|
37
|
+
transform: translateX(-100%);
|
|
38
|
+
`}
|
|
39
|
+
`;
|
|
40
|
+
const Panel = styled.div `
|
|
41
|
+
width: 100vw;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
display: none;
|
|
46
|
+
|
|
47
|
+
${({ visible }) => visible && css `
|
|
48
|
+
display: block;
|
|
49
|
+
`}
|
|
50
|
+
`;
|
|
51
|
+
const PanelLayout = styled.div `
|
|
52
|
+
padding: ${rem(24)};
|
|
53
|
+
padding-bottom: ${rem(40)};
|
|
54
|
+
`;
|
|
55
|
+
const StyledList = styled.ul `
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
list-style: none;
|
|
59
|
+
|
|
60
|
+
li {
|
|
61
|
+
margin-bottom: ${rem(16)};
|
|
62
|
+
|
|
63
|
+
&:last-child {
|
|
64
|
+
margin-bottom: 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
const NavCell = styled.button `
|
|
69
|
+
padding: 0;
|
|
70
|
+
border: 0;
|
|
71
|
+
background: none;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
display: grid;
|
|
74
|
+
grid-template-columns: 1fr 22px;
|
|
75
|
+
align-items: center;
|
|
76
|
+
width: 100%;
|
|
77
|
+
font-size: ${rem(20)};
|
|
78
|
+
|
|
79
|
+
p {
|
|
80
|
+
font-size: inherit;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
text-overflow: ellipsis;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
margin: 0;
|
|
85
|
+
text-align: left;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
${({ theme }) => css `
|
|
89
|
+
color: ${theme.blackLight};
|
|
90
|
+
font-family: ${theme.valueBold};
|
|
91
|
+
`};
|
|
92
|
+
`;
|
|
93
|
+
const Chevron = styled(ToggableChevron).attrs({
|
|
94
|
+
rotation: -90,
|
|
95
|
+
}) `
|
|
96
|
+
margin-left: auto;
|
|
97
|
+
`;
|
|
98
|
+
const BackCell = styled(NavCell) `
|
|
99
|
+
display: flex;
|
|
100
|
+
font-size: ${rem(16)};
|
|
101
|
+
width: fit-content;
|
|
102
|
+
`;
|
|
103
|
+
const BackChevron = styled(ToggableChevron).attrs({
|
|
104
|
+
rotation: -270,
|
|
105
|
+
}) `
|
|
106
|
+
margin-right: ${rem(4)};
|
|
107
|
+
`;
|
|
108
|
+
const LinkContainer = styled.div `
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
padding-top: ${rem(32)};
|
|
112
|
+
`;
|
|
113
|
+
const StyledLink = styled(Link) `
|
|
114
|
+
font-size: ${rem(16)};
|
|
115
|
+
font-weight: 500;
|
|
116
|
+
margin: 0;
|
|
117
|
+
|
|
118
|
+
${({ theme }) => css `
|
|
119
|
+
color: ${theme.blackLight};
|
|
120
|
+
font-family: ${theme.valueMedium};
|
|
121
|
+
`};
|
|
122
|
+
|
|
123
|
+
&:not(:last-child) {
|
|
124
|
+
margin-bottom: ${rem(24)};
|
|
125
|
+
};
|
|
126
|
+
`;
|
|
127
|
+
const Header = styled.h2 `
|
|
128
|
+
font-size: ${rem(20)};
|
|
129
|
+
margin: 0;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
text-overflow: ellipsis;
|
|
133
|
+
border-bottom: 1px solid ${({ theme }) => theme.grayPale};
|
|
134
|
+
padding-bottom: ${rem(8)};
|
|
135
|
+
margin-top: ${rem(30)};
|
|
136
|
+
|
|
137
|
+
${({ theme }) => css `
|
|
138
|
+
color: ${theme.blackLight};
|
|
139
|
+
font-family: ${theme.valueBold};
|
|
140
|
+
`};
|
|
141
|
+
`;
|
|
142
|
+
const InfoWrapper = styled.div `
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
padding: ${rem(32)} ${rem(15)};
|
|
147
|
+
|
|
148
|
+
${({ color }) => color && css `
|
|
149
|
+
background-color: ${color};
|
|
150
|
+
`};
|
|
151
|
+
|
|
152
|
+
> * {
|
|
153
|
+
&:first-child {
|
|
154
|
+
margin-bottom: ${rem(16)};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
export default NavigationPanel;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NavigationModel } from '../shared/types/types';
|
|
2
|
+
export type NavigationMobileProps = NavigationModel;
|
|
3
|
+
export declare const NavigationMobile: ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText, }: NavigationMobileProps) => import("react/jsx-runtime").JSX.Element;
|