@hlf-fe/pulmo-ui 1.5.3 → 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 (64) 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 → image.stories.js} +1 -1
  11. package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.js +1 -1
  12. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.js +5 -2
  13. package/dist/components/modules/navigation/navigation-mobile/nav-panel.js +1 -1
  14. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.d.ts +1 -1
  15. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.js +16 -18
  16. package/dist/components/typography/heading/heading.d.ts +4 -0
  17. package/dist/components/typography/heading/heading.js +47 -0
  18. package/dist/components/typography/heading/heading.stories.d.ts +7 -0
  19. package/dist/components/typography/heading/heading.stories.js +26 -0
  20. package/dist/components/typography/heading/headings.d.ts +4 -0
  21. package/dist/components/typography/heading/headings.js +47 -0
  22. package/dist/components/typography/heading/headings.stories.d.ts +7 -0
  23. package/dist/components/typography/heading/headings.stories.js +26 -0
  24. package/dist/components/typography/headings/headings.js +4 -0
  25. package/dist/components/typography/headings/headings.stories.js +2 -2
  26. package/dist/components/typography/portable-text/portable-text-default.d.ts +39 -0
  27. package/dist/components/typography/portable-text/portable-text-default.js +23 -0
  28. package/dist/models/sanity-types.d.ts +1 -1
  29. package/dist/styles/mixins/theme-mixins/theme-mixins.d.ts +5 -0
  30. package/dist/styles/mixins/theme-mixins/theme-mixins.js +37 -0
  31. package/package.json +1 -1
  32. package/dist/components/buttons/link-button/link-button.d.ts +0 -25
  33. package/dist/components/buttons/link-button/link-button.js +0 -80
  34. package/dist/components/buttons/link-button/link-button.stories.d.ts +0 -6
  35. package/dist/components/buttons/link-button/link-button.stories.js +0 -17
  36. package/dist/components/data-display/list/text-list/text-list.stories.d.ts +0 -0
  37. package/dist/components/data-display/list/text-list/text-list.stories.js +0 -0
  38. package/dist/components/layout/image-list/image-list.d.ts +0 -6
  39. package/dist/components/layout/image-list/image-list.js +0 -55
  40. package/dist/components/layout/image-list/image-list.stories.d.ts +0 -6
  41. package/dist/components/layout/image-list/image-list.stories.js +0 -19
  42. package/dist/components/modules/navigation/navigation-desktop/nav-cell.d.ts +0 -6
  43. package/dist/components/modules/navigation/navigation-desktop/nav-cell.js +0 -69
  44. package/dist/components/modules/navigation/navigation-desktop/nav-section.d.ts +0 -8
  45. package/dist/components/modules/navigation/navigation-desktop/nav-section.js +0 -80
  46. package/dist/components/modules/navigation/types.d.ts +0 -39
  47. package/dist/components/modules/navigation/types.js +0 -1
  48. package/dist/components/navigation/dropdown-menu/dropdown-menu.d.ts +0 -0
  49. package/dist/components/navigation/dropdown-menu/dropdown-menu.js +0 -0
  50. package/dist/components/navigation/nav-cell/navbar.d.ts +0 -0
  51. package/dist/components/navigation/nav-cell/navbar.js +0 -0
  52. package/dist/components/navigation/nav-section/dropdown-menu.d.ts +0 -0
  53. package/dist/components/navigation/nav-section/dropdown-menu.js +0 -0
  54. package/dist/components/navigation/nav-section/nav-section.d.ts +0 -0
  55. package/dist/components/navigation/nav-section/nav-section.js +0 -0
  56. package/dist/components/navigation/navbar/navbar.d.ts +0 -0
  57. package/dist/components/navigation/navbar/navbar.js +0 -0
  58. package/dist/models/sanity.types.d.ts +0 -9
  59. package/dist/models/sanity.types.js +0 -1
  60. package/dist/models/web-page.url.d.ts +0 -10
  61. package/dist/models/web-page.url.js +0 -1
  62. /package/dist/components/layout/image/{Image.stories.d.ts → image.stories.d.ts} +0 -0
  63. /package/dist/components/{data-display/list/text-list/text-list.d.ts → typography/portable-text/portable-text-component.d.ts} +0 -0
  64. /package/dist/components/{data-display/list/text-list/text-list.js → typography/portable-text/portable-text-component.js} +0 -0
@@ -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
  },
@@ -10,7 +10,7 @@ export const NavigationSection = ({ section, className, closeSection }) => {
10
10
  setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
11
11
  };
12
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()))) })] }) }));
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
14
  };
15
15
  const Wrapper = styled.div `
16
16
  @keyframes fadeIn {
@@ -18,7 +18,7 @@ export const NavigationDesktop = ({ logotype, mainMenuItems, topMenuItems, ctaBu
18
18
  const sectionToShow = currentSection?.key !== section?.key ? section : undefined;
19
19
  setCurrentSection(sectionToShow);
20
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: () => {
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
22
  onOpenSection(undefined);
23
23
  setIsSearchOpen(false);
24
24
  } }))] }));
@@ -100,7 +100,9 @@ const StyledButton = styled(Button) `
100
100
  align-self: center;
101
101
  white-space: nowrap;
102
102
  `;
103
- const IconWrapper = styled.span ``;
103
+ const IconWrapper = styled.span `
104
+ margin-top: ${rem(4)};
105
+ `;
104
106
  const StyledTopLink = styled(Link) `
105
107
  font-size: ${rem(16)};
106
108
  font-weight: 500;
@@ -121,6 +123,7 @@ const StyledTopLink = styled(Link) `
121
123
  const StyledLogoLink = styled(Link) `
122
124
  display: flex;
123
125
  align-self: center;
126
+ max-width: ${rem(264)};
124
127
  margin-right: ${rem(16)};
125
128
  `;
126
129
  const StyledList = styled.ul `
@@ -25,7 +25,7 @@ const NavigationPanel = ({ mainMenuItems, topMenuItems, scrollToTop, closeMenu,
25
25
  setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
26
26
  };
27
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()))) })] })] }));
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, i) => (_jsx(CardBanner, { ...banner, externalUrl: banner?.link?.externalUrl, internalLink: banner?.link?.internalLink?.slug?.current, onClick: closeMenu }, `${banner.title.trim()}-${i}`))) })] })] }));
29
29
  };
30
30
  const Wrapper = styled.div `
31
31
  width: 100%;
@@ -1,3 +1,3 @@
1
- import { NavigationModel } from '../shared/types/types';
1
+ import { NavigationModel } from "../shared/types/types";
2
2
  export type NavigationMobileProps = NavigationModel;
3
3
  export declare const NavigationMobile: ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText, }: NavigationMobileProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,33 +1,34 @@
1
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';
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
11
  export const NavigationMobile = ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText = {
12
12
  ariaLabelHome: "",
13
- goBack: ""
13
+ goBack: "",
14
14
  }, }) => {
15
15
  const { ariaLabelHome, goBack } = localeText;
16
16
  const [isOpen, setIsOpen] = useState(false);
17
17
  const stickyRef = useRef(null);
18
+ const emptyMenuItems = !mainMenuItems?.length && !topMenuItems?.length;
18
19
  useEffect(() => {
19
- document.body.style.overflow = isOpen ? 'hidden' : '';
20
+ document.body.style.overflow = isOpen ? "hidden" : "";
20
21
  }, [isOpen]);
21
22
  // On Unmount, cleanup
22
23
  useEffect(() => {
23
24
  return () => {
24
- document.body.style.overflow = '';
25
+ document.body.style.overflow = "";
25
26
  };
26
27
  }, []);
27
28
  const scrollToTop = () => {
28
- stickyRef.current?.scroll({ top: 0, behavior: 'smooth' });
29
+ stickyRef.current?.scroll({ top: 0, behavior: "smooth" });
29
30
  };
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
+ 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 })), !emptyMenuItems && (_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
  };
32
33
  const Wrapper = styled.nav `
33
34
  position: relative;
@@ -63,10 +64,7 @@ const TopBar = styled.div `
63
64
  const StyledLogoLink = styled(Link) `
64
65
  display: flex;
65
66
  align-self: center;
66
-
67
- img {
68
- height: ${rem(28)};
69
- }
67
+ max-width: ${rem(140)};
70
68
  `;
71
69
  const StyledButton = styled(Button) `
72
70
  display: flex;
@@ -0,0 +1,4 @@
1
+ export declare const H1: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
2
+ export declare const H2: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
3
+ export declare const H3: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
4
+ export declare const H4: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
@@ -0,0 +1,47 @@
1
+ import styled from "styled-components";
2
+ import { media } from "../../../styles/mixins";
3
+ import { rem } from "../../../styles/units";
4
+ export const H1 = styled.h1 `
5
+ font-family: ${({ theme }) => theme.valueBold};
6
+ color: ${({ theme }) => theme.blackLight};
7
+ font-size: ${rem(40)};
8
+ line-height: 1.15;
9
+
10
+ ${media.L `
11
+ font-size: ${rem(64)};
12
+ line-height: 1.09;
13
+ `}
14
+ `;
15
+ export const H2 = styled.h2 `
16
+ font-family: ${({ theme }) => theme.valueBold};
17
+ color: ${({ theme }) => theme.blackLight};
18
+ font-size: ${rem(28)};
19
+ line-height: 1.14;
20
+
21
+ ${media.L `
22
+ font-size: ${rem(32)};
23
+ line-height: 1.5;
24
+ `}
25
+ `;
26
+ export const H3 = styled.h3 `
27
+ font-family: ${({ theme }) => theme.valueBold};
28
+ color: ${({ theme }) => theme.blackLight};
29
+ font-size: ${rem(22)};
30
+ line-height: 1.45;
31
+
32
+ ${media.L `
33
+ font-size: ${rem(28)};
34
+ line-height: 1.43;
35
+ `}
36
+ `;
37
+ export const H4 = styled.h4 `
38
+ font-family: ${({ theme }) => theme.valueBold};
39
+ color: ${({ theme }) => theme.blackLight};
40
+ font-size: ${rem(22)};
41
+ line-height: 1.45;
42
+
43
+ ${media.L `
44
+ font-size: ${rem(28)};
45
+ line-height: 1.43;
46
+ `}
47
+ `;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ export declare const Heading1: StoryObj;
5
+ export declare const Heading2: StoryObj;
6
+ export declare const Heading3: StoryObj;
7
+ export declare const Heading4: StoryObj;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { H1, H2, H3, H4 } from "./heading";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Typography/Headings",
6
+ decorators: [
7
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
8
+ ],
9
+ };
10
+ export default meta;
11
+ export const Heading1 = {
12
+ name: "H1",
13
+ render: () => (_jsx(_Fragment, { children: _jsx(H1, { children: "This is an H1" }) })),
14
+ };
15
+ export const Heading2 = {
16
+ name: "H2",
17
+ render: () => (_jsx(_Fragment, { children: _jsx(H2, { children: "This is an H2" }) })),
18
+ };
19
+ export const Heading3 = {
20
+ name: "H3",
21
+ render: () => (_jsx(_Fragment, { children: _jsx(H3, { children: "This is an H2" }) })),
22
+ };
23
+ export const Heading4 = {
24
+ name: "H4",
25
+ render: () => (_jsx(_Fragment, { children: _jsx(H4, { children: "This is an H2" }) })),
26
+ };
@@ -0,0 +1,4 @@
1
+ export declare const H1: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
2
+ export declare const H2: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
3
+ export declare const H3: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
4
+ export declare const H4: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
@@ -0,0 +1,47 @@
1
+ import styled from "styled-components";
2
+ import { media } from "../../../styles/mixins";
3
+ import { rem } from "../../../styles/units";
4
+ export const H1 = styled.h1 `
5
+ font-family: ${({ theme }) => theme.valueBold};
6
+ color: ${({ theme }) => theme.blackLight};
7
+ font-size: ${rem(40)};
8
+ line-height: 1.15;
9
+
10
+ ${media.L `
11
+ font-size: ${rem(64)};
12
+ line-height: 1.09;
13
+ `}
14
+ `;
15
+ export const H2 = styled.h2 `
16
+ font-family: ${({ theme }) => theme.valueBold};
17
+ color: ${({ theme }) => theme.blackLight};
18
+ font-size: ${rem(28)};
19
+ line-height: 1.14;
20
+
21
+ ${media.L `
22
+ font-size: ${rem(32)};
23
+ line-height: 1.5;
24
+ `}
25
+ `;
26
+ export const H3 = styled.h3 `
27
+ font-family: ${({ theme }) => theme.valueBold};
28
+ color: ${({ theme }) => theme.blackLight};
29
+ font-size: ${rem(22)};
30
+ line-height: 1.45;
31
+
32
+ ${media.L `
33
+ font-size: ${rem(28)};
34
+ line-height: 1.43;
35
+ `}
36
+ `;
37
+ export const H4 = styled.h4 `
38
+ font-family: ${({ theme }) => theme.valueBold};
39
+ color: ${({ theme }) => theme.blackLight};
40
+ font-size: ${rem(22)};
41
+ line-height: 1.45;
42
+
43
+ ${media.L `
44
+ font-size: ${rem(28)};
45
+ line-height: 1.43;
46
+ `}
47
+ `;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ export declare const Heading1: StoryObj;
5
+ export declare const Heading2: StoryObj;
6
+ export declare const Heading3: StoryObj;
7
+ export declare const Heading4: StoryObj;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { H1, H2, H3, H4 } from "./headings";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Typography/Headings",
6
+ decorators: [
7
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
8
+ ],
9
+ };
10
+ export default meta;
11
+ export const Heading1 = {
12
+ name: "H1",
13
+ render: () => (_jsx(_Fragment, { children: _jsx(H1, { children: "This is an H1" }) })),
14
+ };
15
+ export const Heading2 = {
16
+ name: "H2",
17
+ render: () => (_jsx(_Fragment, { children: _jsx(H2, { children: "This is an H2" }) })),
18
+ };
19
+ export const Heading3 = {
20
+ name: "H3",
21
+ render: () => (_jsx(_Fragment, { children: _jsx(H3, { children: "This is an H2" }) })),
22
+ };
23
+ export const Heading4 = {
24
+ name: "H4",
25
+ render: () => (_jsx(_Fragment, { children: _jsx(H4, { children: "This is an H2" }) })),
26
+ };
@@ -6,6 +6,7 @@ export const H1 = styled.h1 `
6
6
  color: ${({ theme }) => theme.blackLight};
7
7
  font-size: ${rem(40)};
8
8
  line-height: 1.15;
9
+ margin-bottom: 0;
9
10
 
10
11
  ${media.L `
11
12
  font-size: ${rem(64)};
@@ -17,6 +18,7 @@ export const H2 = styled.h2 `
17
18
  color: ${({ theme }) => theme.blackLight};
18
19
  font-size: ${rem(28)};
19
20
  line-height: 1.14;
21
+ margin-bottom: 0;
20
22
 
21
23
  ${media.L `
22
24
  font-size: ${rem(32)};
@@ -28,6 +30,7 @@ export const H3 = styled.h3 `
28
30
  color: ${({ theme }) => theme.blackLight};
29
31
  font-size: ${rem(22)};
30
32
  line-height: 1.45;
33
+ margin-bottom: 0;
31
34
 
32
35
  ${media.L `
33
36
  font-size: ${rem(28)};
@@ -39,6 +42,7 @@ export const H4 = styled.h4 `
39
42
  color: ${({ theme }) => theme.blackLight};
40
43
  font-size: ${rem(22)};
41
44
  line-height: 1.45;
45
+ margin-bottom: 0;
42
46
 
43
47
  ${media.L `
44
48
  font-size: ${rem(28)};
@@ -18,9 +18,9 @@ export const Heading2 = {
18
18
  };
19
19
  export const Heading3 = {
20
20
  name: "H3",
21
- render: () => (_jsx(_Fragment, { children: _jsx(H3, { children: "This is an H2" }) })),
21
+ render: () => (_jsx(_Fragment, { children: _jsx(H3, { children: "This is an H3" }) })),
22
22
  };
23
23
  export const Heading4 = {
24
24
  name: "H4",
25
- render: () => (_jsx(_Fragment, { children: _jsx(H4, { children: "This is an H2" }) })),
25
+ render: () => (_jsx(_Fragment, { children: _jsx(H4, { children: "This is an H4" }) })),
26
26
  };
@@ -0,0 +1,39 @@
1
+ export declare const PortableTextDefault: {
2
+ marks: {
3
+ link: any;
4
+ strong: ({ children }: {
5
+ children: any;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ italic: ({ children }: {
8
+ children: any;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ };
11
+ list: {
12
+ bullet: ({ children }: {
13
+ children: any;
14
+ }) => import("react/jsx-runtime").JSX.Element;
15
+ number: ({ children }: {
16
+ children: any;
17
+ }) => import("react/jsx-runtime").JSX.Element;
18
+ };
19
+ block: {
20
+ h1: ({ children }: {
21
+ children: any;
22
+ }) => import("react/jsx-runtime").JSX.Element;
23
+ h2: ({ children }: {
24
+ children: any;
25
+ }) => import("react/jsx-runtime").JSX.Element;
26
+ h3: ({ children }: {
27
+ children: any;
28
+ }) => import("react/jsx-runtime").JSX.Element;
29
+ h4: ({ children }: {
30
+ children: any;
31
+ }) => import("react/jsx-runtime").JSX.Element;
32
+ normal: ({ children }: {
33
+ children: any;
34
+ }) => import("react/jsx-runtime").JSX.Element;
35
+ leadParagraph: ({ children }: {
36
+ children: any;
37
+ }) => import("react/jsx-runtime").JSX.Element;
38
+ };
39
+ };
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BoldText, ItalicText, NormalText, LeadParagraph, } from "../../../components/typography/text/text";
3
+ import { UnorderedList, OrderedList } from "../../../components/typography/list/list";
4
+ import { H1, H2, H3, H4 } from "../../../components/typography/heading/headings";
5
+ export const PortableTextDefault = {
6
+ marks: {
7
+ link: LinkElement,
8
+ strong: ({ children }) => _jsx(BoldText, { children: children }),
9
+ italic: ({ children }) => _jsx(ItalicText, { children: children }),
10
+ },
11
+ list: {
12
+ bullet: ({ children }) => _jsx(UnorderedList, { children: children }),
13
+ number: ({ children }) => _jsx(OrderedList, { children: children }),
14
+ },
15
+ block: {
16
+ h1: ({ children }) => _jsx(H1, { children: children }),
17
+ h2: ({ children }) => _jsx(H2, { children: children }),
18
+ h3: ({ children }) => _jsx(H3, { children: children }),
19
+ h4: ({ children }) => _jsx(H4, { children: children }),
20
+ normal: ({ children }) => _jsx(NormalText, { children: children }),
21
+ leadParagraph: ({ children }) => _jsx(LeadParagraph, { children: children }),
22
+ },
23
+ };
@@ -2,7 +2,7 @@ import { IGatsbyImageData } from 'gatsby-plugin-image';
2
2
  export type SanityImage = {
3
3
  asset: {
4
4
  gatsbyImageData: IGatsbyImageData;
5
- description: string;
5
+ altText?: string;
6
6
  url?: string;
7
7
  extension?: string;
8
8
  };
@@ -0,0 +1,5 @@
1
+ import { THEME_COLORS_BY_HEX, THEME_COLORS_BY_NAME, SIZES } from "../../../models/theme";
2
+ export declare const themeColors: (color: THEME_COLORS_BY_HEX | THEME_COLORS_BY_NAME) => string;
3
+ export declare const themeSpacing: (size: SIZES) => string;
4
+ export declare const themeBorderRadius: (size: "sm" | "md" | "lg") => string;
5
+ export declare const themeElevation: (elevation: 0 | 1) => string;
@@ -0,0 +1,37 @@
1
+ import { COLORS, THEME_SPACING } from "../../../styles/theme";
2
+ import { rem } from "../../../styles/units";
3
+ export const themeColors = (color) => {
4
+ const THEME_COLORS = {
5
+ green: COLORS.mint,
6
+ blue: COLORS.skyBlue,
7
+ purple: COLORS.lavender,
8
+ pink: COLORS.pink,
9
+ white: COLORS.white,
10
+ };
11
+ return THEME_COLORS[color] || color;
12
+ };
13
+ export const themeSpacing = (size) => {
14
+ const THEME_SPACING_SIZES = {
15
+ sm: THEME_SPACING.sm,
16
+ md: THEME_SPACING.md,
17
+ lg: THEME_SPACING.lg,
18
+ xl: THEME_SPACING.xl,
19
+ none: "0",
20
+ };
21
+ return THEME_SPACING_SIZES[size] || THEME_SPACING.md;
22
+ };
23
+ export const themeBorderRadius = (size) => {
24
+ const BORDER_RADIUS = {
25
+ sm: rem(6),
26
+ md: rem(8),
27
+ lg: rem(12),
28
+ };
29
+ return BORDER_RADIUS[size] || BORDER_RADIUS.sm;
30
+ };
31
+ export const themeElevation = (elevation) => {
32
+ const ELEVETION = {
33
+ 0: "none",
34
+ 1: `0 ${rem(4)} ${rem(16)} 0 rgba(0, 0, 0, 0.08)`,
35
+ };
36
+ return ELEVETION[elevation] || ELEVETION[0];
37
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hlf-fe/pulmo-ui",
3
3
  "private": false,
4
- "version": "1.5.3",
4
+ "version": "1.5.4",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -1,25 +0,0 @@
1
- import { ReactNode } from "react";
2
- export type LinkButtonProps = {
3
- type?: "button" | "reset" | "submit";
4
- icon?: ReactNode;
5
- className?: string;
6
- inverted?: boolean;
7
- disabled?: boolean;
8
- onClick?: () => void;
9
- btnSize?: "s" | "m" | "l";
10
- fullWidth?: boolean;
11
- fullWidthMobile?: boolean;
12
- dataTest?: string;
13
- tabIndex?: number;
14
- to?: string;
15
- href?: string;
16
- target?: "_blank" | "_self" | "_parent" | "_top";
17
- children: ReactNode;
18
- };
19
- export type StyledLinkButtonProps = {
20
- inverted?: boolean;
21
- btnSize?: "s" | "m" | "l";
22
- fullWidthMobile?: boolean;
23
- fullWidth?: boolean;
24
- };
25
- export declare const LinkButton: ({ type, onClick, className, inverted, disabled, btnSize, fullWidth, fullWidthMobile, dataTest, tabIndex, children, to, href, target, }: LinkButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,80 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import styled, { css } from "styled-components";
3
- import { media, buttonSize } from "../../../styles/mixins";
4
- import { rem } from "../../../styles/units";
5
- import { Link } from "gatsby";
6
- export const LinkButton = ({ type = "submit", onClick, className = "", inverted = false, disabled = false, btnSize = "m", fullWidth, fullWidthMobile, dataTest, tabIndex, children, to, href, target, }) => {
7
- const commonProps = {
8
- className,
9
- onClick,
10
- inverted,
11
- btnSize,
12
- fullWidth,
13
- fullWidthMobile,
14
- "data-test": dataTest,
15
- tabIndex,
16
- };
17
- const asElement = to ? Link : href ? "a" : "button";
18
- return (_jsx(StyledLinkButton, { as: asElement, ...commonProps, ...(to ? { to } : {}), ...(href
19
- ? {
20
- href,
21
- target,
22
- rel: target === "_blank" ? "noopener noreferrer" : undefined,
23
- }
24
- : {}), ...(!to && !href ? { type, disabled } : {}), children: children }));
25
- };
26
- const StyledLinkButton = styled.button `
27
- display: flex;
28
- justify-content: center;
29
- align-items: center;
30
- gap: ${rem(10)};
31
- font-family: ${({ theme }) => theme.valueBold};
32
- font-weight: 400;
33
- text-decoration: none;
34
- color: ${({ theme, inverted }) => (inverted ? theme.red : theme.white)};
35
- width: ${({ fullWidthMobile }) => (fullWidthMobile ? "100%" : "fit-content")};
36
- background-color: ${({ theme, inverted }) => inverted ? theme.white : theme.red};
37
- line-height: 2.5;
38
- border-radius: ${rem(5)};
39
- border-color: ${({ theme, inverted }) => inverted ? theme.red : "transparent"};
40
- transition: background-color 0.3s ease-out;
41
- border-style: solid;
42
-
43
- &:disabled {
44
- cursor: default;
45
- opacity: 0.6;
46
- }
47
-
48
- ${({ btnSize }) => {
49
- switch (btnSize) {
50
- case "s":
51
- return buttonSize.S;
52
- case "m":
53
- return buttonSize.M;
54
- case "l":
55
- return buttonSize.L;
56
- default:
57
- return buttonSize.M;
58
- }
59
- }}
60
-
61
- ${({ theme, inverted, fullWidth }) => css `
62
- ${media.M `
63
- width: ${fullWidth ? "100%" : "fit-content"};
64
- `}
65
-
66
- &:not(:disabled) {
67
- ${media.L `
68
- &:hover, :active, :focus-visible {
69
- background-color: ${inverted ? theme.red : theme.redHover};
70
- color: ${theme.white};
71
- }
72
-
73
- &:focus-visible {
74
- outline: ${rem(2)} solid ${theme.blackLight};
75
- outline-offset: ${rem(2)};
76
- }
77
- `};
78
- }
79
- `};
80
- `;
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { LinkButton } from "./link-button";
3
- declare const meta: Meta<typeof LinkButton>;
4
- export default meta;
5
- type Story = StoryObj<typeof LinkButton>;
6
- export declare const Default: Story;
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { LinkButton } from "./link-button";
3
- import { Decorator } from "../../../components/decorator/decorator";
4
- const meta = {
5
- title: "Buttons/LinkButton",
6
- component: LinkButton,
7
- decorators: [
8
- (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
- ],
10
- };
11
- export default meta;
12
- export const Default = {
13
- args: {
14
- inverted: false,
15
- children: "Button Text",
16
- },
17
- };
@@ -1,6 +0,0 @@
1
- import { SanityImage } from '../../../models/sanity-types';
2
- export type ImageListProps = {
3
- heading?: string;
4
- images: SanityImage[];
5
- };
6
- export declare const ImageList: ({ heading, images }: ImageListProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,55 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } 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 ImageList = ({ heading, images }) => {
8
- return (_jsx(OuterContainer, { children: _jsxs(StyledContainer, { children: [heading && _jsx(Heading, { children: heading }), _jsx(LogoContainer, { children: images?.map((image, i) => {
9
- return _jsx(Image, { image: image?.asset }, `${image?.asset?.url}-${i}`);
10
- }) })] }) }));
11
- };
12
- const OuterContainer = styled.div `
13
- background-color: ${({ theme }) => theme.white};
14
- `;
15
- const StyledContainer = styled(Container) `
16
- margin-bottom: 0;
17
- `;
18
- const LogoContainer = styled.div `
19
- display: grid;
20
- grid-template-columns: repeat(2, 1fr);
21
- grid-auto-rows: ${rem(110)};
22
- grid-gap: ${rem(20)};
23
- padding: ${rem(32)} 0 ${rem(40)};
24
-
25
- ${media.L `
26
- grid-template-columns: repeat(5, 1fr);
27
- grid-auto-rows: ${rem(135)};
28
- padding: ${rem(32)} 0 ${rem(48)};
29
- `}
30
-
31
- img {
32
- width: 100%;
33
- height: ${rem(110)};
34
- border-radius: ${rem(4)};
35
- box-shadow: 0 ${rem(4)} ${rem(16)} 0 rgba(0, 0, 0, 0.08);
36
- padding: ${rem(10)};
37
-
38
- ${media.L `
39
- height: ${rem(135)};
40
- `}
41
- }
42
- `;
43
- const Heading = styled.h2 `
44
- font-family: ${({ theme }) => theme.valueRegular};
45
- font-size: ${rem(16)};
46
- font-weight: normal;
47
- color: ${({ theme }) => theme.blackLight};
48
- margin: 0;
49
- padding-top: ${rem(32)};
50
-
51
- ${media.M `
52
- font-size: ${rem(18)};
53
- text-align: center;
54
- `}
55
- `;
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { ImageList } from "./image-list";
3
- declare const meta: Meta<typeof ImageList>;
4
- export default meta;
5
- type Story = StoryObj<typeof ImageList>;
6
- export declare const Default: Story;
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ImageList } from "./image-list";
3
- import { Decorator } from "../../../components/decorator/decorator";
4
- import { svgMock } from '../../../mocks/image-mocks';
5
- const meta = {
6
- title: "Layout/ImageList",
7
- component: ImageList,
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
- heading: 'Lorem ipsum dolor sit amet',
17
- images,
18
- },
19
- };
@@ -1,6 +0,0 @@
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;
@@ -1,69 +0,0 @@
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
- `;
@@ -1,8 +0,0 @@
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 {};
@@ -1,80 +0,0 @@
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
- `;
@@ -1,39 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export {};
File without changes
File without changes
File without changes
File without changes
@@ -1,9 +0,0 @@
1
- import { IGatsbyImageData } from 'gatsby-plugin-image';
2
- export type SanityImage = {
3
- asset: {
4
- gatsbyImageData: IGatsbyImageData;
5
- description: string;
6
- url?: string;
7
- extension?: string;
8
- };
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export type WebPageUrl = {
2
- externalUrl?: string;
3
- openInNewWindow?: boolean;
4
- internalLink?: {
5
- slug?: {
6
- current: string;
7
- };
8
- };
9
- webUrlName?: string;
10
- };
@@ -1 +0,0 @@
1
- export {};