@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,97 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Link } from 'gatsby';
|
|
4
|
+
import NavigationPanel from './nav-panel';
|
|
5
|
+
import { Image } from '../../../../components/layout/image/image';
|
|
6
|
+
import { Button } from '../../../../components/buttons/button/button';
|
|
7
|
+
import { HamburgerIcon } from '../../../../components/icons/hamburger-icon/hamburger-icon';
|
|
8
|
+
import { MenuCloseIcon } from '../../../../components/icons/menu-close-icon/menu-close-icon';
|
|
9
|
+
import styled, { css } from 'styled-components';
|
|
10
|
+
import { rem } from '../../../../styles/units';
|
|
11
|
+
export const NavigationMobile = ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText = {
|
|
12
|
+
ariaLabelHome: "",
|
|
13
|
+
goBack: ""
|
|
14
|
+
}, }) => {
|
|
15
|
+
const { ariaLabelHome, goBack } = localeText;
|
|
16
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
+
const stickyRef = useRef(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
document.body.style.overflow = isOpen ? 'hidden' : '';
|
|
20
|
+
}, [isOpen]);
|
|
21
|
+
// On Unmount, cleanup
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
return () => {
|
|
24
|
+
document.body.style.overflow = '';
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
const scrollToTop = () => {
|
|
28
|
+
stickyRef.current?.scroll({ top: 0, behavior: 'smooth' });
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(Wrapper, { children: _jsxs(StickyContainer, { "$expanded": isOpen, ref: stickyRef, children: [_jsxs(TopBar, { children: [logotype && (_jsx(StyledLogoLink, { "data-test": "nav-logo", to: '/', "aria-label": ariaLabelHome, children: _jsx(Image, { image: logotype?.asset, width: "112", height: "28" }) })), ctaButton && (_jsx(StyledButton, { btnSize: "s", dataTest: "nav-cta", to: ctaButton.externalUrl, href: ctaButton.internalLink?.slug?.current, target: '_blank', children: ctaButton.webUrlName })), _jsx(MenuToggle, { "data-test": !isOpen ? 'nav-menu-closed' : 'nav-menu-open', "aria-label": "Meny", onClick: () => setIsOpen(!isOpen), children: _jsx(IconWrapper, { children: !isOpen ? _jsx(HamburgerIcon, {}) : _jsx(MenuCloseIcon, {}) }) })] }), isOpen && (_jsx(MenuContent, { children: _jsx(NavigationPanel, { mainMenuItems: mainMenuItems, topMenuItems: topMenuItems, scrollToTop: scrollToTop, closeMenu: () => setIsOpen(false), goBackText: goBack }) }))] }) }));
|
|
31
|
+
};
|
|
32
|
+
const Wrapper = styled.nav `
|
|
33
|
+
position: relative;
|
|
34
|
+
height: ${({ theme }) => rem(theme?.mobileNavHeight)};
|
|
35
|
+
width: 100%;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
z-index: 10;
|
|
39
|
+
|
|
40
|
+
a {
|
|
41
|
+
text-decoration: none;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const StickyContainer = styled.div `
|
|
45
|
+
position: fixed;
|
|
46
|
+
width: 100%;
|
|
47
|
+
background: white;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
overflow-y: scroll;
|
|
50
|
+
|
|
51
|
+
${({ $expanded }) => $expanded &&
|
|
52
|
+
css `
|
|
53
|
+
height: 100%;
|
|
54
|
+
`};
|
|
55
|
+
`;
|
|
56
|
+
const TopBar = styled.div `
|
|
57
|
+
height: ${({ theme }) => rem(theme?.mobileNavHeight)};
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
padding: 0;
|
|
61
|
+
padding-left: ${rem(16)};
|
|
62
|
+
`;
|
|
63
|
+
const StyledLogoLink = styled(Link) `
|
|
64
|
+
display: flex;
|
|
65
|
+
align-self: center;
|
|
66
|
+
|
|
67
|
+
img {
|
|
68
|
+
height: ${rem(28)};
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
const StyledButton = styled(Button) `
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
margin-left: auto;
|
|
75
|
+
height: ${rem(32)};
|
|
76
|
+
padding: 0 ${rem(8)};
|
|
77
|
+
`;
|
|
78
|
+
const MenuToggle = styled.button `
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
height: 100%;
|
|
82
|
+
margin: 0;
|
|
83
|
+
padding: 0 ${rem(16)};
|
|
84
|
+
border: none;
|
|
85
|
+
background: none;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
`;
|
|
88
|
+
const IconWrapper = styled.div `
|
|
89
|
+
display: flex;
|
|
90
|
+
width: ${rem(30)};
|
|
91
|
+
justify-content: center;
|
|
92
|
+
`;
|
|
93
|
+
const MenuContent = styled.div `
|
|
94
|
+
width: 100%;
|
|
95
|
+
border-top: 1px solid #ddd;
|
|
96
|
+
-webkit-tap-highlight-color: transparent;
|
|
97
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { NavigationMobile } from "./navigation-mobile";
|
|
3
|
+
declare const meta: Meta<typeof NavigationMobile>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof NavigationMobile>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NavigationMobile } from "./navigation-mobile";
|
|
2
|
+
import { mockNavigation } from '../../../../mocks/navigation-mock';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Modules/Main Navigation (Mobile)",
|
|
5
|
+
component: NavigationMobile,
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
...mockNavigation
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebPageUrl } from '../../../../../models/web-page-url';
|
|
2
|
+
export type NavigationItemProps = {
|
|
3
|
+
model: NavigationItemModel;
|
|
4
|
+
expanded?: boolean;
|
|
5
|
+
parent?: string;
|
|
6
|
+
onToggle: (model: NavigationItemModel) => void;
|
|
7
|
+
onLinkClick?: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type NavigationItemModel = {
|
|
10
|
+
key: string;
|
|
11
|
+
title: string;
|
|
12
|
+
highlight?: boolean;
|
|
13
|
+
slug?: {
|
|
14
|
+
current: string;
|
|
15
|
+
};
|
|
16
|
+
items?: WebPageUrl[];
|
|
17
|
+
};
|
|
18
|
+
export declare const NavigationItem: ({ model, expanded, onToggle, onLinkClick }: NavigationItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from "gatsby";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { media } from "../../../../../styles/mixins";
|
|
5
|
+
import { rem } from "../../../../../styles/units";
|
|
6
|
+
import { ToggableChevron } from "../../../../../components/icons/toggable-chevron/toggable-chevron";
|
|
7
|
+
import { HeartIcon } from "../../../../../components/icons/heart-icon/heart-icon";
|
|
8
|
+
export const NavigationItem = ({ model, expanded, onToggle, onLinkClick }) => {
|
|
9
|
+
const { highlight, title, items, slug } = model;
|
|
10
|
+
return (_jsxs(Wrapper, { "data-test": "nav-item", children: [slug ? (_jsxs(HeaderLink, { to: slug.current, onClick: () => {
|
|
11
|
+
onLinkClick?.();
|
|
12
|
+
}, children: [_jsx(Title, { active: highlight, children: title }), highlight && (_jsx(IconWrapper, { children: _jsx(HeartIcon, {}) }))] })) : (_jsxs(HeaderButton, { onClick: () => {
|
|
13
|
+
onToggle(model);
|
|
14
|
+
}, children: [_jsx(Title, { children: title }), _jsx(StyledToggle, { toggled: expanded, disableCircle: false })] })), (!slug && items) && (_jsx(Expandable, { "data-test": "nav-item-list", active: expanded, children: items.map(({ webUrlName, internalLink }) => (_jsx(StyledListItem, { children: _jsx(StyledLink, { tabIndex: !expanded ? -1 : 0, to: internalLink?.slug?.current ?? "", onClick: () => {
|
|
15
|
+
onLinkClick?.();
|
|
16
|
+
}, children: webUrlName }) }, webUrlName))) }))] }));
|
|
17
|
+
};
|
|
18
|
+
const Wrapper = styled.li `
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
margin-top: ${rem(16)};
|
|
22
|
+
`;
|
|
23
|
+
const HeaderButton = styled.button `
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
padding: 0;
|
|
29
|
+
border: 0;
|
|
30
|
+
background: none;
|
|
31
|
+
`;
|
|
32
|
+
const HeaderLink = styled(Link) `
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
align-items: center;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
text-decoration: none;
|
|
38
|
+
|
|
39
|
+
svg {
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const Title = styled.p `
|
|
44
|
+
font-size: ${rem(16)};
|
|
45
|
+
margin: 0;
|
|
46
|
+
margin-right: ${rem(8)};
|
|
47
|
+
text-align: left;
|
|
48
|
+
|
|
49
|
+
${({ theme }) => css `
|
|
50
|
+
color: ${theme.blackLight};
|
|
51
|
+
font-family: ${theme.valueBold};
|
|
52
|
+
`};
|
|
53
|
+
|
|
54
|
+
${({ active }) => active && css `
|
|
55
|
+
color: ${({ theme }) => theme.red};
|
|
56
|
+
`};
|
|
57
|
+
|
|
58
|
+
${media.L `
|
|
59
|
+
font-size: ${rem(18)};
|
|
60
|
+
margin-right: ${rem(6)};
|
|
61
|
+
`}
|
|
62
|
+
`;
|
|
63
|
+
const IconWrapper = styled.div `
|
|
64
|
+
display: flex;
|
|
65
|
+
|
|
66
|
+
${media.L `
|
|
67
|
+
margin-right: ${rem(20)};
|
|
68
|
+
`}
|
|
69
|
+
`;
|
|
70
|
+
const StyledToggle = styled(ToggableChevron) `
|
|
71
|
+
margin-left: auto;
|
|
72
|
+
|
|
73
|
+
${media.L `
|
|
74
|
+
margin-right: ${rem(20)};
|
|
75
|
+
`}
|
|
76
|
+
`;
|
|
77
|
+
const Expandable = styled.ul `
|
|
78
|
+
position: relative;
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
margin: 0;
|
|
83
|
+
padding: 0;
|
|
84
|
+
display: none;
|
|
85
|
+
|
|
86
|
+
${({ active }) => active && css `
|
|
87
|
+
display: block;
|
|
88
|
+
`};
|
|
89
|
+
`;
|
|
90
|
+
const StyledListItem = styled.li `
|
|
91
|
+
margin-top: ${rem(16)};
|
|
92
|
+
margin-left: ${rem(8)};
|
|
93
|
+
`;
|
|
94
|
+
const StyledLink = styled(Link) `
|
|
95
|
+
font-size: ${rem(16)};
|
|
96
|
+
text-decoration: none;
|
|
97
|
+
|
|
98
|
+
${({ theme }) => css `
|
|
99
|
+
color: ${theme.blackLight};
|
|
100
|
+
font-family: ${theme.valueRegular};
|
|
101
|
+
|
|
102
|
+
${media.L `
|
|
103
|
+
font-family: ${theme.valueMedium};
|
|
104
|
+
`}
|
|
105
|
+
`};
|
|
106
|
+
`;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { WebPageUrl } from '../../../../../models/web-page-url';
|
|
2
|
+
import { SanityImage } from '../../../../../models/sanity-types';
|
|
3
|
+
import { RefObject } from "react";
|
|
4
|
+
export type NavigationItemModel = {
|
|
5
|
+
key: string;
|
|
6
|
+
title: string;
|
|
7
|
+
highlight?: boolean;
|
|
8
|
+
slug?: {
|
|
9
|
+
current: string;
|
|
10
|
+
};
|
|
11
|
+
items?: any;
|
|
12
|
+
};
|
|
13
|
+
export type NavigationSectionModel = {
|
|
14
|
+
key: string;
|
|
15
|
+
title: string;
|
|
16
|
+
column1Title?: string;
|
|
17
|
+
column1Items?: NavigationItemModel[];
|
|
18
|
+
column2Title?: string;
|
|
19
|
+
column2Items?: NavigationItemModel[];
|
|
20
|
+
backgroundColor?: {
|
|
21
|
+
hex: string;
|
|
22
|
+
};
|
|
23
|
+
linkBanners: LinkBanner[];
|
|
24
|
+
};
|
|
25
|
+
export type LinkBanner = {
|
|
26
|
+
title: string;
|
|
27
|
+
text: string;
|
|
28
|
+
image?: SanityImage;
|
|
29
|
+
link?: WebPageUrl;
|
|
30
|
+
};
|
|
31
|
+
export type NavigationModel = {
|
|
32
|
+
topMenuItems?: WebPageUrl[];
|
|
33
|
+
mainMenuItems?: NavigationSectionModel[];
|
|
34
|
+
logotype?: SanityImage;
|
|
35
|
+
ctaButton?: WebPageUrl;
|
|
36
|
+
__typename: string;
|
|
37
|
+
localeText?: {
|
|
38
|
+
ariaLabelHome?: string;
|
|
39
|
+
goBack?: string;
|
|
40
|
+
};
|
|
41
|
+
isMenuVisible?: boolean;
|
|
42
|
+
menuRef?: RefObject<HTMLElement>;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { WebPageUrl } from '../../../models/web-page-url';
|
|
2
|
+
import { SanityImage } from '../../../models/sanity-types';
|
|
3
|
+
export type NavigationItemModel = {
|
|
4
|
+
key: string;
|
|
5
|
+
title: string;
|
|
6
|
+
highlight?: boolean;
|
|
7
|
+
link?: WebPageUrl;
|
|
8
|
+
items?: any;
|
|
9
|
+
};
|
|
10
|
+
export type NavigationSectionModel = {
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
13
|
+
column1Title?: string;
|
|
14
|
+
column1Items?: NavigationItemModel[];
|
|
15
|
+
column2Title?: string;
|
|
16
|
+
column2Items?: NavigationItemModel[];
|
|
17
|
+
backgroundColor?: {
|
|
18
|
+
hex: string;
|
|
19
|
+
};
|
|
20
|
+
linkBanners: LinkBanner[];
|
|
21
|
+
};
|
|
22
|
+
export type LinkBanner = {
|
|
23
|
+
title: string;
|
|
24
|
+
text: string;
|
|
25
|
+
image?: SanityImage;
|
|
26
|
+
link?: WebPageUrl;
|
|
27
|
+
};
|
|
28
|
+
export type NavigationModel = {
|
|
29
|
+
topMenuItems?: WebPageUrl[];
|
|
30
|
+
mainMenuItems?: NavigationSectionModel[];
|
|
31
|
+
logotype?: SanityImage;
|
|
32
|
+
ctaButton?: WebPageUrl;
|
|
33
|
+
__typename: string;
|
|
34
|
+
localeText?: {
|
|
35
|
+
ariaLabelHome?: string;
|
|
36
|
+
goBack?: string;
|
|
37
|
+
};
|
|
38
|
+
isMenuVisible?: boolean;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -3,4 +3,4 @@ export type NavigationCellProps = {
|
|
|
3
3
|
active?: boolean;
|
|
4
4
|
onToggleCell: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const NavigationCell: ({ title, active, onToggleCell }: NavigationCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const NavigationCell: ({ title, active, onToggleCell, }: NavigationCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import styled, { css } from "styled-components";
|
|
|
3
3
|
import { media } from "../../../styles/mixins";
|
|
4
4
|
import { rem } from "../../../styles/units";
|
|
5
5
|
import { ToggableChevron } from "../../../components/icons/toggable-chevron/toggable-chevron";
|
|
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 })] }) }));
|
|
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
7
|
const StyledListItem = styled.li `
|
|
8
8
|
display: inline-block;
|
|
9
9
|
height: 100%;
|
|
@@ -45,12 +45,13 @@ const NavCell = styled.button `
|
|
|
45
45
|
font-family: ${theme.valueBold};
|
|
46
46
|
`};
|
|
47
47
|
|
|
48
|
-
${({ active }) => active &&
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
${({ $active }) => $active &&
|
|
49
|
+
css `
|
|
50
|
+
${({ theme }) => css `
|
|
51
|
+
color: ${theme.red};
|
|
52
|
+
box-shadow: inset 0 -4px 0 ${theme.red};
|
|
53
|
+
`};
|
|
52
54
|
`};
|
|
53
|
-
`};
|
|
54
55
|
`;
|
|
55
56
|
const StyledToggle = styled(ToggableChevron).attrs({
|
|
56
57
|
disableCircle: true,
|
|
@@ -58,10 +59,11 @@ const StyledToggle = styled(ToggableChevron).attrs({
|
|
|
58
59
|
margin-left: ${rem(4)};
|
|
59
60
|
|
|
60
61
|
svg {
|
|
61
|
-
${(props) => props.toggled &&
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
${(props) => props.toggled &&
|
|
63
|
+
css `
|
|
64
|
+
${({ theme }) => css `
|
|
65
|
+
fill: ${theme.red};
|
|
66
|
+
`};
|
|
64
67
|
`};
|
|
65
|
-
`};
|
|
66
68
|
}
|
|
67
69
|
`;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -41,7 +41,7 @@ export const Pagination = ({ numberOfPages, currentPage, isMobile = true, locale
|
|
|
41
41
|
total - 1,
|
|
42
42
|
];
|
|
43
43
|
};
|
|
44
|
-
return (numberOfPages > 0 && (_jsxs(StyledList, { children: [_jsx(StyleListItem, { children: _jsx(PaginationArrow, { isDisabled: isFirstPage, "aria-label": prePage, onClick: (e) => goToPage(e, pageIndex - 1), children: _jsx(ChevronLeftIcon, { width: 12, height: 12, color: isFirstPage ? COLORS.grayDark : COLORS.blackLight }) }) }), getVisiblePages(pageIndex, numberOfPages, isMobile).map((page, index) => (_jsx(StyleListItem, { children: page === "..." ? (_jsx(Ellipsis, { children: "\u2026" })) : (_jsx(PaginationItem, { isSelected: pageIndex === page, onClick: (e) => goToPage(e, page), children: page + 1 })) }, index))), _jsx(StyleListItem, { children: _jsx(PaginationArrow, { isDisabled: isLastPage, "aria-label": nextPage, onClick: (e) => goToPage(e, pageIndex + 1), children: _jsx(ChevronRightIcon, { width: 12, height: 12, color: isLastPage ? COLORS.grayDark : COLORS.blackLight }) }) })] })));
|
|
44
|
+
return (numberOfPages > 0 && (_jsxs(StyledList, { children: [_jsx(StyleListItem, { children: _jsx(PaginationArrow, { "$isDisabled": isFirstPage, "aria-label": prePage, onClick: (e) => goToPage(e, pageIndex - 1), children: _jsx(ChevronLeftIcon, { width: 12, height: 12, color: isFirstPage ? COLORS.grayDark : COLORS.blackLight }) }) }), getVisiblePages(pageIndex, numberOfPages, isMobile).map((page, index) => (_jsx(StyleListItem, { children: page === "..." ? (_jsx(Ellipsis, { children: "\u2026" })) : (_jsx(PaginationItem, { "$isSelected": pageIndex === page, onClick: (e) => goToPage(e, page), children: page + 1 })) }, index))), _jsx(StyleListItem, { children: _jsx(PaginationArrow, { "$isDisabled": isLastPage, "aria-label": nextPage, onClick: (e) => goToPage(e, pageIndex + 1), children: _jsx(ChevronRightIcon, { width: 12, height: 12, color: isLastPage ? COLORS.grayDark : COLORS.blackLight }) }) })] })));
|
|
45
45
|
};
|
|
46
46
|
const StyledList = styled.ul `
|
|
47
47
|
margin: 0 auto;
|
|
@@ -77,7 +77,7 @@ const PaginationItem = styled.button `
|
|
|
77
77
|
border: ${rem(1)} solid ${theme.blackLight};
|
|
78
78
|
`};
|
|
79
79
|
|
|
80
|
-
${({ theme, isSelected }) => isSelected &&
|
|
80
|
+
${({ theme, $isSelected }) => $isSelected &&
|
|
81
81
|
css `
|
|
82
82
|
background-color: ${theme.blackLight};
|
|
83
83
|
border-color: transparent;
|
|
@@ -95,7 +95,7 @@ const PaginationArrow = styled.button `
|
|
|
95
95
|
border-radius: ${rem(5)};
|
|
96
96
|
background-color: ${({ theme }) => theme.white};
|
|
97
97
|
|
|
98
|
-
${({ isDisabled }) => isDisabled &&
|
|
98
|
+
${({ $isDisabled }) => $isDisabled &&
|
|
99
99
|
css `
|
|
100
100
|
pointer-events: none;
|
|
101
101
|
cursor: default;
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { themeColors, themeBorderRadius, themeElevation, } from "../../../styles/mixins/theme-mixins";
|
|
4
4
|
export const Paper = ({ className, children, backgroundColor = "white", borderRadius = "md", elevation = backgroundColor === "#ffffff" ? 1 : 0, }) => {
|
|
5
|
-
return (_jsx(Container, { className: className, backgroundColor: backgroundColor, borderRadius: borderRadius, elevation: elevation, children: children }));
|
|
5
|
+
return (_jsx(Container, { className: className, "$backgroundColor": backgroundColor, "$borderRadius": borderRadius, "$elevation": elevation, children: children }));
|
|
6
6
|
};
|
|
7
7
|
const Container = styled.div `
|
|
8
|
-
background-color: ${({ backgroundColor }) => themeColors(backgroundColor)};
|
|
9
|
-
border-radius: ${({ borderRadius }) => themeBorderRadius(borderRadius)};
|
|
10
|
-
box-shadow: ${({ elevation }) => themeElevation(elevation)};
|
|
8
|
+
background-color: ${({ $backgroundColor }) => themeColors($backgroundColor)};
|
|
9
|
+
border-radius: ${({ $borderRadius }) => themeBorderRadius($borderRadius)};
|
|
10
|
+
box-shadow: ${({ $elevation }) => themeElevation($elevation)};
|
|
11
11
|
`;
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function withDefaultTheme<P>(Component: React.ComponentType<P>): React.FC<P>;
|
|
3
|
+
export declare function withDefaultThemeWithRef<P>(Component: React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<any>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<any>>;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import { THEME_SETTINGS } from "../styles/theme";
|
|
2
|
+
import { useContext, forwardRef } from "react";
|
|
4
3
|
import { ThemeContext, ThemeProvider } from "styled-components";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { THEME_SETTINGS } from "../styles/theme";
|
|
5
|
+
export function withDefaultTheme(Component) {
|
|
6
|
+
const ComponentWithTheme = (props) => {
|
|
7
|
+
const theme = useContext(ThemeContext);
|
|
8
|
+
return theme ? (_jsx(Component, { ...props })) : (_jsx(ThemeProvider, { theme: THEME_SETTINGS, children: _jsx(Component, { ...props }) }));
|
|
9
|
+
};
|
|
10
|
+
return ComponentWithTheme;
|
|
11
|
+
}
|
|
12
|
+
export function withDefaultThemeWithRef(Component) {
|
|
13
|
+
const ComponentWithTheme = forwardRef((props, ref) => {
|
|
14
|
+
const theme = useContext(ThemeContext);
|
|
15
|
+
return theme ? (_jsx(Component, { ...props, ref: ref })) : (_jsx(ThemeProvider, { theme: THEME_SETTINGS, children: _jsx(Component, { ...props, ref: ref }) }));
|
|
16
|
+
});
|
|
17
|
+
return ComponentWithTheme;
|
|
18
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,14 +13,13 @@ import { type EntryListProps, type EntryListItemProps, type EntryListHeadingProp
|
|
|
13
13
|
import { type DropdownProps } from "./components/inputs/dropdown/dropdown";
|
|
14
14
|
import { type PaginationProps } from "./components/navigation/pagination/pagination";
|
|
15
15
|
import { type AccordionItemProps } from "./components/layout/accordion/accordion";
|
|
16
|
-
import { type NavigationCellProps } from "./components/navigation/nav-cell/nav-cell";
|
|
17
|
-
import { type NavigationItemProps } from "./components/navigation/nav-item/nav-item";
|
|
18
16
|
import { type CardBannerProps } from "./components/surfaces/cards/card-banner/card-banner";
|
|
19
17
|
import { type PaperProps } from "./components/surfaces/paper/paper";
|
|
20
18
|
import { type LinkProps } from "./components/typography/link/link";
|
|
21
19
|
import { PortableTextComponentDefault } from "./components/typography/portable-text/portable-text-component-default";
|
|
22
20
|
import { type FooterProps } from "./components/modules/footer/footer";
|
|
23
|
-
|
|
21
|
+
import { type LogoListProps } from "./components/modules/logo-list/logo-list";
|
|
22
|
+
export type { ButtonProps, LoadingButtonProps, TextButtonProps, EmailSignupFormProps, ImageProps, ContainerProps, AlertProps, EntryListHeadingProps, EntryListTextProps, PaginationProps, CardBannerProps, PaperProps, };
|
|
24
23
|
export { CloseIcon } from "./components/icons/close-icon/close-icon";
|
|
25
24
|
export { ExclamationMarkIcon } from "./components/icons/exclamation-mark-icon/exclamation-mark-icon";
|
|
26
25
|
export { WarningIcon } from "./components/icons/warning-icon/warning-icon";
|
|
@@ -39,7 +38,14 @@ export declare const FormLabel: import("react").FC<FormLabelProps>;
|
|
|
39
38
|
export declare const TextField: import("react").FC<TextFieldProps>;
|
|
40
39
|
export declare const EmailSignupForm: import("react").FC<EmailSignupFormProps>;
|
|
41
40
|
export declare const Image: import("react").FC<ImageProps>;
|
|
42
|
-
export declare const Container: import("react").
|
|
41
|
+
export declare const Container: import("react").ForwardRefExoticComponent<{
|
|
42
|
+
children: import("react").ReactNode;
|
|
43
|
+
maxWidth?: "sm" | "lg" | "xl";
|
|
44
|
+
className?: string;
|
|
45
|
+
} & {
|
|
46
|
+
position?: import("csstype").Property.Position | undefined;
|
|
47
|
+
display?: import("csstype").Property.Display | undefined;
|
|
48
|
+
} & import("react").RefAttributes<any>>;
|
|
43
49
|
export declare const EntryList: import("react").FC<EntryListProps>;
|
|
44
50
|
export declare const EntryListItem: import("react").FC<EntryListItemProps>;
|
|
45
51
|
export declare const EntryListText: import("react").FC<EntryListTextProps>;
|
|
@@ -50,8 +56,6 @@ export declare const Accordion: import("react").FC<import("styled-components/dis
|
|
|
50
56
|
disabled?: boolean;
|
|
51
57
|
}>>;
|
|
52
58
|
export declare const AccordionItem: import("react").FC<AccordionItemProps>;
|
|
53
|
-
export declare const NavigationCell: import("react").FC<NavigationCellProps>;
|
|
54
|
-
export declare const NavigationItem: import("react").FC<NavigationItemProps>;
|
|
55
59
|
export declare const CardBanner: import("react").FC<CardBannerProps>;
|
|
56
60
|
export declare const Paper: import("react").FC<PaperProps>;
|
|
57
61
|
export declare const Link: import("react").FC<LinkProps>;
|
|
@@ -66,4 +70,7 @@ export declare const ItalicText: import("react").FC<import("styled-components").
|
|
|
66
70
|
export declare const OrderedList: import("react").FC<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>>;
|
|
67
71
|
export declare const UnorderedList: import("react").FC<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>>;
|
|
68
72
|
export declare const Footer: import("react").FC<FooterProps>;
|
|
73
|
+
export declare const LogoList: import("react").FC<LogoListProps>;
|
|
74
|
+
export declare const NavigationDesktop: import("react").FC<import("./components/modules/navigation/shared/types/types").NavigationModel>;
|
|
75
|
+
export declare const NavigationMobile: import("react").FC<import("./components/modules/navigation/shared/types/types").NavigationModel>;
|
|
69
76
|
export { PortableTextComponentDefault };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withDefaultTheme } from "./hoc/withDefaultTheme";
|
|
1
|
+
import { withDefaultTheme, withDefaultThemeWithRef, } from "./hoc/withDefaultTheme";
|
|
2
2
|
// Buttons
|
|
3
3
|
import { Button as ButtonComponent, } from "./components/buttons/button/button";
|
|
4
4
|
import { TextButton as TextButtonComponent, } from "./components/buttons/text-button/text-button";
|
|
@@ -16,8 +16,6 @@ import { EntryList as EntryListComponent, EntryListItem as EntryListItemComponen
|
|
|
16
16
|
import { Dropdown as DropdownComponent, } from "./components/inputs/dropdown/dropdown";
|
|
17
17
|
import { Pagination as PaginationComponent, } from "./components/navigation/pagination/pagination";
|
|
18
18
|
import { Accordion as AccordionComponent, AccordionItem as AccordionItemComponent, } from "./components/layout/accordion/accordion";
|
|
19
|
-
import { NavigationCell as NavigationCellComponent, } from "./components/navigation/nav-cell/nav-cell";
|
|
20
|
-
import { NavigationItem as NavigationItemComponent, } from "./components/navigation/nav-item/nav-item";
|
|
21
19
|
import { CardBanner as CardBannerComponent, } from "./components/surfaces/cards/card-banner/card-banner";
|
|
22
20
|
import { Paper as PaperComponent, } from "./components/surfaces/paper/paper";
|
|
23
21
|
import { Link as LinkComponent, } from "./components/typography/link/link";
|
|
@@ -26,6 +24,9 @@ import { NormalText as NormalTextComponent, LeadParagraph as LeadParagraphCompon
|
|
|
26
24
|
import { OrderedList as OrderedListComponent, UnorderedList as UnorderedListComponent, } from "./components/typography/list/list";
|
|
27
25
|
import { PortableTextComponentDefault } from "./components/typography/portable-text/portable-text-component-default";
|
|
28
26
|
import { Footer as FooterComponent, } from "./components/modules/footer/footer";
|
|
27
|
+
import { LogoList as LogoListComponent, } from "./components/modules/logo-list/logo-list";
|
|
28
|
+
import { NavigationDesktop as NavigationDesktopComponent, } from "./components/modules/navigation/navigation-desktop/navigation-desktop";
|
|
29
|
+
import { NavigationMobile as NavigationMobileComponent, } from "./components/modules/navigation/navigation-mobile/navigation-mobile";
|
|
29
30
|
// Icons
|
|
30
31
|
export { CloseIcon } from "./components/icons/close-icon/close-icon";
|
|
31
32
|
export { ExclamationMarkIcon } from "./components/icons/exclamation-mark-icon/exclamation-mark-icon";
|
|
@@ -46,7 +47,7 @@ export const FormLabel = withDefaultTheme(FormLabelComponent);
|
|
|
46
47
|
export const TextField = withDefaultTheme(TextFieldComponent);
|
|
47
48
|
export const EmailSignupForm = withDefaultTheme(EmailSignupFormComponent);
|
|
48
49
|
export const Image = withDefaultTheme(ImageComponent);
|
|
49
|
-
export const Container =
|
|
50
|
+
export const Container = withDefaultThemeWithRef(ContainerComponent);
|
|
50
51
|
export const EntryList = withDefaultTheme(EntryListComponent);
|
|
51
52
|
export const EntryListItem = withDefaultTheme(EntryListItemComponent);
|
|
52
53
|
export const EntryListText = withDefaultTheme(EntryListTextComponent);
|
|
@@ -55,8 +56,6 @@ export const Dropdown = withDefaultTheme(DropdownComponent);
|
|
|
55
56
|
export const Pagination = withDefaultTheme(PaginationComponent);
|
|
56
57
|
export const Accordion = withDefaultTheme(AccordionComponent);
|
|
57
58
|
export const AccordionItem = withDefaultTheme(AccordionItemComponent);
|
|
58
|
-
export const NavigationCell = withDefaultTheme(NavigationCellComponent);
|
|
59
|
-
export const NavigationItem = withDefaultTheme(NavigationItemComponent);
|
|
60
59
|
export const CardBanner = withDefaultTheme(CardBannerComponent);
|
|
61
60
|
export const Paper = withDefaultTheme(PaperComponent);
|
|
62
61
|
export const Link = withDefaultTheme(LinkComponent);
|
|
@@ -71,4 +70,7 @@ export const ItalicText = withDefaultTheme(ItalicTextComponent);
|
|
|
71
70
|
export const OrderedList = withDefaultTheme(OrderedListComponent);
|
|
72
71
|
export const UnorderedList = withDefaultTheme(UnorderedListComponent);
|
|
73
72
|
export const Footer = withDefaultTheme(FooterComponent);
|
|
73
|
+
export const LogoList = withDefaultTheme(LogoListComponent);
|
|
74
|
+
export const NavigationDesktop = withDefaultTheme(NavigationDesktopComponent);
|
|
75
|
+
export const NavigationMobile = withDefaultTheme(NavigationMobileComponent);
|
|
74
76
|
export { PortableTextComponentDefault };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NavigationItemModel, NavigationModel, NavigationSectionModel } from '../components/modules/navigation/shared/types/types';
|
|
2
|
+
export declare const mockNavItemsA: NavigationItemModel[];
|
|
3
|
+
export declare const mockNavItemsB: NavigationItemModel[];
|
|
4
|
+
export declare const mockNavSections: NavigationSectionModel[];
|
|
5
|
+
export declare const mockNavigation: NavigationModel;
|