@hlf-fe/pulmo-ui 1.5.2 → 1.5.4

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.
Files changed (42) hide show
  1. package/dist/components/buttons/button/button.js +0 -1
  2. package/dist/components/icons/toggable-chevron/toggable-chevron.d.ts +6 -2
  3. package/dist/components/icons/toggable-chevron/toggable-chevron.js +2 -2
  4. package/dist/components/layout/accordion/accordion.d.ts +2 -1
  5. package/dist/components/layout/accordion/accordion.js +19 -3
  6. package/dist/components/layout/accordion/accordion.stories.d.ts +1 -0
  7. package/dist/components/layout/accordion/accordion.stories.js +3 -0
  8. package/dist/components/layout/image/image.d.ts +1 -1
  9. package/dist/components/layout/image/image.js +3 -3
  10. package/dist/components/layout/image/image.stories.js +1 -1
  11. package/dist/components/modules/logo-list/logo-list.d.ts +5 -0
  12. package/dist/components/modules/logo-list/logo-list.js +34 -0
  13. package/dist/components/modules/logo-list/logo-list.stories.d.ts +6 -0
  14. package/dist/components/modules/logo-list/logo-list.stories.js +18 -0
  15. package/dist/components/modules/navigation/navigation-desktop/nav-cell/nav-cell.d.ts +6 -0
  16. package/dist/components/modules/navigation/navigation-desktop/nav-cell/nav-cell.js +69 -0
  17. package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.d.ts +8 -0
  18. package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.js +80 -0
  19. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.d.ts +3 -0
  20. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.js +139 -0
  21. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.stories.d.ts +6 -0
  22. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.stories.js +12 -0
  23. package/dist/components/modules/navigation/navigation-mobile/nav-panel.d.ts +11 -0
  24. package/dist/components/modules/navigation/navigation-mobile/nav-panel.js +158 -0
  25. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.d.ts +3 -0
  26. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.js +95 -0
  27. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.stories.d.ts +6 -0
  28. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.stories.js +12 -0
  29. package/dist/components/modules/navigation/shared/nav-item/nav-item.d.ts +18 -0
  30. package/dist/components/modules/navigation/shared/nav-item/nav-item.js +106 -0
  31. package/dist/components/modules/navigation/shared/types/types.d.ts +43 -0
  32. package/dist/components/modules/navigation/shared/types/types.js +1 -0
  33. package/dist/components/typography/headings/headings.js +4 -0
  34. package/dist/components/typography/headings/headings.stories.js +2 -2
  35. package/dist/index.d.ts +5 -5
  36. package/dist/index.js +6 -4
  37. package/dist/mocks/image-mocks.d.ts +7 -0
  38. package/dist/mocks/image-mocks.js +7 -0
  39. package/dist/mocks/navigation-mock.d.ts +5 -0
  40. package/dist/mocks/navigation-mock.js +153 -0
  41. package/dist/models/sanity-types.d.ts +1 -1
  42. package/package.json +1 -1
@@ -52,7 +52,6 @@ const StyledButton = styled.button `
52
52
  ${({ theme, $inverted, $fullWidth }) => css `
53
53
  ${media.M `
54
54
  width: ${$fullWidth ? "100%" : "fit-content"};
55
- font-size: ${rem(18)};
56
55
  `}
57
56
 
58
57
  &:not(:disabled) {
@@ -3,10 +3,14 @@ type ToggableChevronProps = {
3
3
  disableCircle?: boolean;
4
4
  className?: string;
5
5
  rotation?: number;
6
+ width?: number;
7
+ height?: number;
6
8
  };
7
9
  type ChevronDownProps = {
8
10
  className?: string;
11
+ width?: number;
12
+ height?: number;
9
13
  };
10
- export declare const ChevronDownIcon: ({ className }: ChevronDownProps) => import("react/jsx-runtime").JSX.Element;
11
- export declare const ToggableChevron: ({ toggled, disableCircle, rotation, className, }: ToggableChevronProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const ChevronDownIcon: ({ className, width, height }: ChevronDownProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const ToggableChevron: ({ toggled, disableCircle, rotation, className, width, height }: ToggableChevronProps) => import("react/jsx-runtime").JSX.Element;
12
16
  export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import styled, { css } from "styled-components";
3
- export const ChevronDownIcon = ({ className }) => (_jsx("svg", { width: "16px", height: "16px", viewBox: "0 0 16 16", version: "1.1", xmlns: "http://www.w3.org/2000/svg", fill: "#333333", className: className, children: _jsx("path", { d: "M2.29289322,5.29289322 C2.65337718,4.93240926 3.22060824,4.90467972 3.61289944,5.20970461 L3.70710678,5.29289322 L8,9.585 L12.2928932,5.29289322 C12.6533772,4.93240926 13.2206082,4.90467972 13.6128994,5.20970461 L13.7071068,5.29289322 C14.0675907,5.65337718 14.0953203,6.22060824 13.7902954,6.61289944 L13.7071068,6.70710678 L8.70710678,11.7071068 C8.34662282,12.0675907 7.77939176,12.0953203 7.38710056,11.7902954 L7.29289322,11.7071068 L2.29289322,6.70710678 C1.90236893,6.31658249 1.90236893,5.68341751 2.29289322,5.29289322 Z" }) }));
4
- export const ToggableChevron = ({ toggled, disableCircle = true, rotation, className, }) => (_jsx(Chevron, { "$isToggled": toggled, "$disableCircle": disableCircle, "$rotation": rotation, className: className, children: _jsx(ChevronDownIcon, {}) }));
3
+ export const ChevronDownIcon = ({ className, width = 16, height = 16 }) => (_jsx("svg", { width: width, height: height, viewBox: "0 0 16 16", version: "1.1", xmlns: "http://www.w3.org/2000/svg", fill: "#333333", className: className, children: _jsx("path", { d: "M2.29289322,5.29289322 C2.65337718,4.93240926 3.22060824,4.90467972 3.61289944,5.20970461 L3.70710678,5.29289322 L8,9.585 L12.2928932,5.29289322 C12.6533772,4.93240926 13.2206082,4.90467972 13.6128994,5.20970461 L13.7071068,5.29289322 C14.0675907,5.65337718 14.0953203,6.22060824 13.7902954,6.61289944 L13.7071068,6.70710678 L8.70710678,11.7071068 C8.34662282,12.0675907 7.77939176,12.0953203 7.38710056,11.7902954 L7.29289322,11.7071068 L2.29289322,6.70710678 C1.90236893,6.31658249 1.90236893,5.68341751 2.29289322,5.29289322 Z" }) }));
4
+ export const ToggableChevron = ({ toggled, disableCircle = true, rotation, className, width, height }) => (_jsx(Chevron, { "$isToggled": toggled, "$disableCircle": disableCircle, "$rotation": rotation, className: className, children: _jsx(ChevronDownIcon, { width: width, height: height }) }));
5
5
  const Chevron = styled.div `
6
6
  width: 22px;
7
7
  height: 22px;
@@ -4,10 +4,11 @@ export type AccordionItemProps = {
4
4
  panelId: string;
5
5
  regionId: string;
6
6
  initiallyExpanded?: boolean;
7
+ expandIcon?: string;
7
8
  children?: ReactNode;
8
9
  headingLevel?: "h2" | "h3";
9
10
  };
10
- export declare const AccordionItem: ({ heading, headingLevel, panelId, regionId, initiallyExpanded, children, }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const AccordionItem: ({ heading, headingLevel, panelId, regionId, initiallyExpanded, expandIcon, children, }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
11
12
  export declare const Accordion: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
12
13
  disabled?: boolean;
13
14
  }>> & string;
@@ -4,6 +4,7 @@ import styled, { css } from "styled-components";
4
4
  import { media } from "../../../styles/mixins";
5
5
  import { rem } from "../../../styles/units";
6
6
  import { ToggablePlusMinusIcon } from "../../../components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon";
7
+ import { ToggableChevron } from "../../../components/icons/toggable-chevron/toggable-chevron";
7
8
  var PanelState;
8
9
  (function (PanelState) {
9
10
  PanelState[PanelState["CLOSED"] = 0] = "CLOSED";
@@ -11,7 +12,7 @@ var PanelState;
11
12
  PanelState[PanelState["OPENED"] = 2] = "OPENED";
12
13
  PanelState[PanelState["CLOSING"] = 3] = "CLOSING";
13
14
  })(PanelState || (PanelState = {}));
14
- export const AccordionItem = ({ heading, headingLevel, panelId, regionId, initiallyExpanded, children, }) => {
15
+ export const AccordionItem = ({ heading, headingLevel, panelId, regionId, initiallyExpanded, expandIcon, children, }) => {
15
16
  const [height, setHeight] = useState(0);
16
17
  const [panelState, setPanelState] = useState(!initiallyExpanded ? PanelState.CLOSED : PanelState.OPENING);
17
18
  const ref = useRef(null);
@@ -39,7 +40,16 @@ export const AccordionItem = ({ heading, headingLevel, panelId, regionId, initia
39
40
  setPanelState(isClosed ? PanelState.OPENING : PanelState.CLOSING);
40
41
  };
41
42
  const isExpanded = panelState !== PanelState.CLOSED;
42
- return (_jsxs(AccordionPanel, { children: [_jsx(StyledHeading, { as: headingLevel, children: _jsxs(StyledButton, { "data-test": `accordion-header${isExpanded ? "-expanded" : ""}`, id: panelId, "aria-expanded": isExpanded, "aria-controls": regionId, onClick: togglePanel, children: [_jsx(Text, { children: heading }), _jsx(StyledToggablePlusMinusIcon, { isOpen: isExpanded })] }) }), _jsx(AccodrionContent, { "data-test": "accordion-content", ref: ref, id: regionId, role: "region", "aria-labelledby": panelId, "$contentHeight": height, "$useAutoHeight": panelState === PanelState.OPENED, onTransitionEnd: onAnimationComplete, children: _jsx(Content, { hidden: !isExpanded, children: children }) })] }));
43
+ const icon = () => {
44
+ switch (expandIcon) {
45
+ case 'arrow':
46
+ return _jsx(StyledToggableChevron, { toggled: isExpanded, width: 20, height: 20 });
47
+ default:
48
+ return _jsx(StyledToggablePlusMinusIcon, { isOpen: isExpanded });
49
+ ;
50
+ }
51
+ };
52
+ return (_jsxs(AccordionPanel, { children: [_jsx(StyledHeading, { as: headingLevel, children: _jsxs(StyledButton, { "data-test": `accordion-header${isExpanded ? "-expanded" : ""}`, id: panelId, "aria-expanded": isExpanded, "aria-controls": regionId, onClick: togglePanel, children: [_jsx(Text, { children: heading }), icon()] }) }), _jsx(AccodrionContent, { "data-test": "accordion-content", ref: ref, id: regionId, role: "region", "aria-labelledby": panelId, "$contentHeight": height, "$useAutoHeight": panelState === PanelState.OPENED, onTransitionEnd: onAnimationComplete, children: _jsx(Content, { hidden: !isExpanded, children: children }) })] }));
43
53
  };
44
54
  const AccodrionContent = styled.div `
45
55
  overflow: hidden;
@@ -97,11 +107,17 @@ const StyledButton = styled.button `
97
107
  padding: ${rem(25)} 0;
98
108
  `}
99
109
  `;
100
- const StyledToggablePlusMinusIcon = styled(ToggablePlusMinusIcon) `
110
+ const iconStyles = css `
101
111
  cursor: pointer;
102
112
  margin-left: auto;
103
113
  margin-right: ${rem(10)};
104
114
  `;
115
+ const StyledToggablePlusMinusIcon = styled(ToggablePlusMinusIcon) `
116
+ ${iconStyles}
117
+ `;
118
+ const StyledToggableChevron = styled(ToggableChevron) `
119
+ ${iconStyles}
120
+ `;
105
121
  export const Accordion = styled.div `
106
122
  border-bottom: 1px solid rgba(51, 51, 51, 0.2);
107
123
  width: 100%;
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof Accordion>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Accordion>;
6
6
  export declare const Default: Story;
7
+ export declare const WithArrowIcon: Story;
@@ -12,3 +12,6 @@ export default meta;
12
12
  export const Default = {
13
13
  render: () => (_jsxs(Accordion, { children: [_jsx(AccordionItem, { heading: "In volutpat est eu dolor efficitur", panelId: "1", regionId: "1", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper elit. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." }), _jsx(AccordionItem, { heading: "Vestibulum eget ullamcorper,\r\n Praesent mattis arcu ante", panelId: "2", regionId: "2", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper, Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." }), _jsx(AccordionItem, { heading: "In volutpat est eu dolor efficitur", panelId: "3", regionId: "3", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper elit. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." }), _jsx(AccordionItem, { heading: "Vestibulum eget ullamcorper,\r\n Praesent mattis arcu ante", panelId: "4", regionId: "4", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper, Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." })] })),
14
14
  };
15
+ export const WithArrowIcon = {
16
+ render: () => (_jsxs(Accordion, { children: [_jsx(AccordionItem, { heading: "In volutpat est eu dolor efficitur", panelId: "1", regionId: "1", expandIcon: "arrow", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper elit. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." }), _jsx(AccordionItem, { heading: "Vestibulum eget ullamcorper,\r\n Praesent mattis arcu ante", panelId: "2", regionId: "2", expandIcon: "arrow", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper, Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." }), _jsx(AccordionItem, { heading: "In volutpat est eu dolor efficitur", panelId: "3", regionId: "3", expandIcon: "arrow", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper elit. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." }), _jsx(AccordionItem, { heading: "Vestibulum eget ullamcorper,\r\n Praesent mattis arcu ante", panelId: "4", regionId: "4", expandIcon: "arrow", children: "Aliquam erat volutpat. Nulla facilisi. Vestibulum eget ullamcorper, Praesent mattis arcu ante, in gravida eros pharetra sit amet. Etiam ac enim lorem. Proin euismod vulputate faucibus." })] })),
17
+ };
@@ -1,8 +1,8 @@
1
1
  import { IGatsbyImageData } from "gatsby-plugin-image";
2
2
  export type ImageProps = {
3
3
  image: {
4
- description: string;
5
4
  gatsbyImageData: IGatsbyImageData;
5
+ altText?: string;
6
6
  url?: string;
7
7
  extension?: string;
8
8
  };
@@ -4,7 +4,7 @@ import { BREAKPOINT_VALUES } from "../../../styles/theme";
4
4
  import { em } from "../../../styles/units";
5
5
  const SVG = "svg";
6
6
  export const Image = ({ image, imageSmall, className = "", imgClassName = "", width = "auto", height = "auto", bpSmallDevice = BREAKPOINT_VALUES.M, objectPosition = "50% 50%", loading = "lazy", onLoad, }) => {
7
- const desc = image?.description;
7
+ const altText = image?.altText;
8
8
  const contentType = image?.extension;
9
9
  const fileUrl = image?.url;
10
10
  const gatsbyImageData = getImage(image?.gatsbyImageData);
@@ -20,8 +20,8 @@ export const Image = ({ image, imageSmall, className = "", imgClassName = "", wi
20
20
  ])
21
21
  : gatsbyImageData;
22
22
  if (contentType === SVG && fileUrl)
23
- return (_jsx("img", { width: width, height: height, className: className, src: fileUrl, alt: desc }));
23
+ return (_jsx("img", { width: width, height: height, className: className, src: fileUrl, alt: altText }));
24
24
  if (images)
25
- return (_jsx(GatsbyImage, { className: className, imgClassName: imgClassName, image: images, loading: loading, alt: desc ?? "", objectPosition: objectPosition, onLoad: onLoad }));
25
+ return (_jsx(GatsbyImage, { className: className, imgClassName: imgClassName, image: images, loading: loading, alt: altText ?? "", objectPosition: objectPosition, onLoad: onLoad }));
26
26
  return null;
27
27
  };
@@ -26,7 +26,7 @@ export default meta;
26
26
  export const Default = {
27
27
  args: {
28
28
  image: {
29
- description: "Exempelbild",
29
+ altText: "Exempelbild",
30
30
  gatsbyImageData: mockGatsbyImageData,
31
31
  },
32
32
  },
@@ -0,0 +1,5 @@
1
+ import { SanityImage } from '../../../models/sanity-types';
2
+ export type LogoListProps = {
3
+ images: SanityImage[];
4
+ };
5
+ export declare const LogoList: ({ images }: LogoListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Image } from "../../../components/layout/image/image";
3
+ import { Container } from "../../../components/layout/container/container";
4
+ import styled from 'styled-components';
5
+ import { media } from '../../../styles/mixins';
6
+ import { rem } from '../../../styles/units';
7
+ export const LogoList = ({ images }) => {
8
+ return (_jsx(Container, { children: _jsx(LogoContainer, { children: images?.map((image, i) => {
9
+ return _jsx(Image, { image: image?.asset }, `${image?.asset?.url}-${i}`);
10
+ }) }) }));
11
+ };
12
+ const LogoContainer = styled.div `
13
+ display: grid;
14
+ grid-template-columns: repeat(2, 1fr);
15
+ grid-auto-rows: ${rem(110)};
16
+ grid-gap: ${rem(20)};
17
+
18
+ ${media.L `
19
+ grid-template-columns: repeat(5, 1fr);
20
+ grid-auto-rows: ${rem(135)};
21
+ `}
22
+
23
+ img {
24
+ width: 100%;
25
+ height: ${rem(110)};
26
+ border-radius: ${rem(4)};
27
+ box-shadow: 0 ${rem(4)} ${rem(16)} 0 rgba(0, 0, 0, 0.08);
28
+ padding: ${rem(10)};
29
+
30
+ ${media.L `
31
+ height: ${rem(135)};
32
+ `}
33
+ }
34
+ `;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { LogoList } from "./logo-list";
3
+ declare const meta: Meta<typeof LogoList>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LogoList>;
6
+ export declare const Default: Story;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LogoList } from "./logo-list";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ import { svgMock } from '../../../mocks/image-mocks';
5
+ const meta = {
6
+ title: "Modules/LogoList",
7
+ component: LogoList,
8
+ decorators: [
9
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
10
+ ],
11
+ };
12
+ export default meta;
13
+ const images = Array(10).fill(svgMock);
14
+ export const Default = {
15
+ args: {
16
+ images,
17
+ },
18
+ };
@@ -0,0 +1,6 @@
1
+ export type NavigationCellProps = {
2
+ title: string;
3
+ active?: boolean;
4
+ onToggleCell: () => void;
5
+ };
6
+ export declare const NavigationCell: ({ title, active, onToggleCell, }: NavigationCellProps) => import("react/jsx-runtime").JSX.Element;
@@ -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, i) => (_jsx(CardBanner, { ...banner, externalUrl: banner?.link?.externalUrl, internalLink: banner?.link?.internalLink?.slug?.current, onClick: closeSection }, `${banner.title.trim()}-${i}`))) })] }) }));
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,139 @@
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?.internalLink?.slug?.current, href: ctaButton?.externalUrl, 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
+ margin-top: ${rem(4)};
105
+ `;
106
+ const StyledTopLink = styled(Link) `
107
+ font-size: ${rem(16)};
108
+ font-weight: 500;
109
+ margin: 0;
110
+ margin-right: ${rem(32)};
111
+
112
+ ${({ theme }) => css `
113
+ color: ${theme.blackLight};
114
+ font-family: ${theme.valueMedium};
115
+ `};
116
+
117
+ &:focus-visible {
118
+ outline: ${rem(2)} solid ${({ theme }) => theme.blackLight};
119
+ outline-offset: ${rem(2)};
120
+ border-radius: ${rem(2)};
121
+ }
122
+ `;
123
+ const StyledLogoLink = styled(Link) `
124
+ display: flex;
125
+ align-self: center;
126
+ max-width: ${rem(264)};
127
+ margin-right: ${rem(16)};
128
+ `;
129
+ const StyledList = styled.ul `
130
+ margin: 0;
131
+ padding: 0;
132
+ margin-left: auto;
133
+ display: flex;
134
+ align-items: center;
135
+ `;
136
+ const StyledNavSection = styled(NavigationSection) `
137
+ top: 100%;
138
+ z-index: 1;
139
+ `;
@@ -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;