@hlf-fe/pulmo-ui 1.5.6 → 1.5.7

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 (51) hide show
  1. package/dist/components/buttons/link-button/link-button.d.ts +25 -0
  2. package/dist/components/buttons/link-button/link-button.js +80 -0
  3. package/dist/components/buttons/link-button/link-button.stories.d.ts +6 -0
  4. package/dist/components/buttons/link-button/link-button.stories.js +17 -0
  5. package/dist/components/data-display/list/text-list/text-list.stories.d.ts +0 -0
  6. package/dist/components/data-display/list/text-list/text-list.stories.js +0 -0
  7. package/dist/components/layout/image-list/image-list.d.ts +6 -0
  8. package/dist/components/layout/image-list/image-list.js +55 -0
  9. package/dist/components/layout/image-list/image-list.stories.d.ts +6 -0
  10. package/dist/components/layout/image-list/image-list.stories.js +19 -0
  11. package/dist/components/modules/navigation/navigation-desktop/nav-cell.d.ts +6 -0
  12. package/dist/components/modules/navigation/navigation-desktop/nav-cell.js +69 -0
  13. package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.js +1 -1
  14. package/dist/components/modules/navigation/navigation-desktop/nav-section.d.ts +8 -0
  15. package/dist/components/modules/navigation/navigation-desktop/nav-section.js +80 -0
  16. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.js +1 -1
  17. package/dist/components/modules/navigation/navigation-mobile/nav-panel.js +1 -1
  18. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.js +1 -1
  19. package/dist/components/modules/navigation/types.d.ts +39 -0
  20. package/dist/components/modules/navigation/types.js +1 -0
  21. package/dist/components/navigation/dropdown-menu/dropdown-menu.d.ts +0 -0
  22. package/dist/components/navigation/dropdown-menu/dropdown-menu.js +0 -0
  23. package/dist/components/navigation/nav-cell/navbar.d.ts +0 -0
  24. package/dist/components/navigation/nav-cell/navbar.js +0 -0
  25. package/dist/components/navigation/nav-section/dropdown-menu.d.ts +0 -0
  26. package/dist/components/navigation/nav-section/dropdown-menu.js +0 -0
  27. package/dist/components/navigation/nav-section/nav-section.d.ts +0 -0
  28. package/dist/components/navigation/nav-section/nav-section.js +0 -0
  29. package/dist/components/navigation/navbar/navbar.d.ts +0 -0
  30. package/dist/components/navigation/navbar/navbar.js +0 -0
  31. package/dist/models/sanity.types.d.ts +9 -0
  32. package/dist/models/sanity.types.js +1 -0
  33. package/dist/models/web-page.url.d.ts +10 -0
  34. package/dist/models/web-page.url.js +1 -0
  35. package/package.json +1 -1
  36. package/dist/components/typography/heading/heading.d.ts +0 -4
  37. package/dist/components/typography/heading/heading.js +0 -47
  38. package/dist/components/typography/heading/heading.stories.d.ts +0 -7
  39. package/dist/components/typography/heading/heading.stories.js +0 -26
  40. package/dist/components/typography/heading/headings.d.ts +0 -4
  41. package/dist/components/typography/heading/headings.js +0 -47
  42. package/dist/components/typography/heading/headings.stories.d.ts +0 -7
  43. package/dist/components/typography/heading/headings.stories.js +0 -26
  44. package/dist/components/typography/portable-text/portable-text-default.d.ts +0 -39
  45. package/dist/components/typography/portable-text/portable-text-default.js +0 -23
  46. package/dist/styles/mixins/theme-mixins/theme-mixins.d.ts +0 -5
  47. package/dist/styles/mixins/theme-mixins/theme-mixins.js +0 -37
  48. /package/dist/components/{typography/portable-text/portable-text-component.d.ts → data-display/list/text-list/text-list.d.ts} +0 -0
  49. /package/dist/components/{typography/portable-text/portable-text-component.js → data-display/list/text-list/text-list.js} +0 -0
  50. /package/dist/components/layout/image/{image.stories.d.ts → Image.stories.d.ts} +0 -0
  51. /package/dist/components/layout/image/{image.stories.js → Image.stories.js} +0 -0
@@ -0,0 +1,25 @@
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;
@@ -0,0 +1,80 @@
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
+ `;
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,17 @@
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
+ };
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,55 @@
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
+ `;
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,19 @@
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
+ };
@@ -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
+ `;
@@ -9,7 +9,7 @@ export const NavigationSection = ({ section, className, closeSection }) => {
9
9
  const onToggle = (item) => {
10
10
  setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
11
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", {}));
12
+ const renderColumn = (title, items) => (items ? (_jsxs(NavCol, { children: [title && _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
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 `
@@ -0,0 +1,8 @@
1
+ import { NavigationSectionModel } from "../types";
2
+ type Props = {
3
+ section: NavigationSectionModel;
4
+ className?: string;
5
+ closeSection: () => void;
6
+ };
7
+ export declare const NavigationSection: ({ section, className, closeSection }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import styled, { css } from "styled-components";
4
+ import { NavigationItem } from "../../../../components/navigation/nav-item/nav-item";
5
+ import { CardBanner } from "../../../../components/surfaces/cards/card-banner/card-banner";
6
+ import { rem } from '../../../../styles/units';
7
+ export const NavigationSection = ({ section, className, closeSection }) => {
8
+ const [currentItem, setCurrentItem] = useState();
9
+ const onToggle = (item) => {
10
+ setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
11
+ };
12
+ const renderColumn = (title, items) => (items ? (_jsxs(NavCol, { children: [_jsx(Header, { children: title }), _jsx(StyledList, { children: items.map((item) => (_jsx(NavigationItem, { model: item, expanded: currentItem?.key === item.key, parent: section.title, onToggle: onToggle, onLinkClick: closeSection }, item.key))) })] })) : _jsx("span", {}));
13
+ return (_jsx(Wrapper, { "data-test": "nav-section", className: className, children: _jsxs(Content, { children: [_jsxs(NavWrapper, { "data-test": "nav-block", children: [renderColumn(section.column1Title, section.column1Items), renderColumn(section.column2Title, section.column2Items)] }), _jsx(InfoWrapper, { color: section?.backgroundColor?.hex, children: section?.linkBanners && section?.linkBanners?.map((banner) => (_jsx(CardBanner, { ...banner, externalUrl: banner?.link?.externalUrl, internalLink: banner?.link?.internalLink?.slug?.current, onClick: closeSection }, banner.title.trim()))) })] }) }));
14
+ };
15
+ const Wrapper = styled.div `
16
+ @keyframes fadeIn {
17
+ 0% { opacity: 0; }
18
+ 100% { opacity: 1; }
19
+ }
20
+
21
+ position: absolute;
22
+ width: 100%;
23
+ animation: fadeIn 0.2s;
24
+ `;
25
+ const Content = styled.div `
26
+ position: absolute;
27
+ width: 100%;
28
+ display: grid;
29
+ grid-template-columns: 55% 45%;
30
+ max-width: 1114px;
31
+ left: 50%;
32
+ transform: translateX(-50%);
33
+ `;
34
+ const NavWrapper = styled.div `
35
+ display: grid;
36
+ grid-template-columns: 1fr 1fr;
37
+ grid-column-gap: ${rem(20)};
38
+ background-color: white;
39
+ padding: ${rem(32)} ${rem(62)} ${rem(56)} ${rem(45)};
40
+ `;
41
+ const InfoWrapper = styled.div `
42
+ display: flex;
43
+ flex-direction: column;
44
+ justify-content: center;
45
+ padding: ${rem(45)};
46
+ background-color: white;
47
+
48
+ ${({ color }) => color && css `
49
+ background-color: ${color};
50
+ `};
51
+
52
+ > * {
53
+ &:first-child {
54
+ margin-bottom: ${rem(24)};
55
+ }
56
+ }
57
+ `;
58
+ const NavCol = styled.div `
59
+ display: flex;
60
+ flex-direction: column;
61
+ overflow: hidden;
62
+ `;
63
+ const StyledList = styled.ul `
64
+ margin: 0;
65
+ padding: 0;
66
+ `;
67
+ const Header = styled.h2 `
68
+ font-size: ${rem(24)};
69
+ margin: 0;
70
+ overflow: hidden;
71
+ white-space: nowrap;
72
+ text-overflow: ellipsis;
73
+ border-bottom: 1px solid ${({ theme }) => theme.grayPale};
74
+ padding-bottom: 2px;
75
+
76
+ ${({ theme }) => css `
77
+ color: ${theme.blackLight};
78
+ font-family: ${theme.valueBold};
79
+ `};
80
+ `;
@@ -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: "127", height: "32" }) })), _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: () => {
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: "127", height: "32" }) })), _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, target: ctaButton?.openInNewWindow ? "_blank" : "_self", 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
  } }))] }));
@@ -24,7 +24,7 @@ const NavigationPanel = ({ mainMenuItems, topMenuItems, scrollToTop, closeMenu,
24
24
  const toggleItem = (item) => {
25
25
  setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
26
26
  };
27
- const renderColumn = (title, items) => (items && (_jsxs(_Fragment, { children: [_jsx(Header, { children: title }), _jsx(StyledList, { children: items.map((item) => (_jsx(NavigationItem, { model: item, expanded: currentItem?.key === item.key, parent: currentSection?.title, onToggle: toggleItem, onLinkClick: closeMenu }, item.key))) })] })));
27
+ const renderColumn = (title, items) => (items && (_jsxs(_Fragment, { children: [title && _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
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 `
@@ -28,7 +28,7 @@ export const NavigationMobile = ({ logotype, mainMenuItems, topMenuItems, ctaBut
28
28
  const scrollToTop = () => {
29
29
  stickyRef.current?.scroll({ top: 0, behavior: "smooth" });
30
30
  };
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: "95", height: "24" }) })), ctaButton && (_jsx(StyledButton, { btnSize: "s", dataTest: "nav-cta", to: ctaButton.externalUrl, href: ctaButton.internalLink?.slug?.current, target: "_blank", marginRight: emptyMenuItems, 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
+ 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: "95", height: "24" }) })), ctaButton && (_jsx(StyledButton, { btnSize: "s", dataTest: "nav-cta", to: ctaButton?.internalLink?.slug?.current, href: ctaButton?.externalUrl, target: ctaButton?.openInNewWindow ? "_blank" : "_self", marginRight: emptyMenuItems, 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 }) }))] }) }));
32
32
  };
33
33
  const Wrapper = styled.nav `
34
34
  position: relative;
@@ -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
File without changes
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ export type WebPageUrl = {
2
+ externalUrl?: string;
3
+ openInNewWindow?: boolean;
4
+ internalLink?: {
5
+ slug?: {
6
+ current: string;
7
+ };
8
+ };
9
+ webUrlName?: string;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
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.6",
4
+ "version": "1.5.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -1,4 +0,0 @@
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;
@@ -1,47 +0,0 @@
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
- `;
@@ -1,7 +0,0 @@
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;
@@ -1,26 +0,0 @@
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
- };
@@ -1,4 +0,0 @@
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;
@@ -1,47 +0,0 @@
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
- `;
@@ -1,7 +0,0 @@
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;
@@ -1,26 +0,0 @@
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
- };
@@ -1,39 +0,0 @@
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
- };
@@ -1,23 +0,0 @@
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
- };
@@ -1,5 +0,0 @@
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;
@@ -1,37 +0,0 @@
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
- };