@hlf-fe/pulmo-ui 1.0.1 → 1.2.0

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 (166) hide show
  1. package/README.md +21 -54
  2. package/dist/components/buttons/button/button.js +1 -1
  3. package/dist/components/buttons/button/button.stories.js +6 -1
  4. package/dist/components/buttons/loading-button/loading-button.d.ts +14 -0
  5. package/dist/components/buttons/loading-button/loading-button.js +26 -0
  6. package/dist/components/buttons/loading-button/loading-button.stories.d.ts +7 -0
  7. package/dist/components/buttons/loading-button/loading-button.stories.js +23 -0
  8. package/dist/components/buttons/text-button/text-button.d.ts +20 -0
  9. package/dist/components/buttons/text-button/text-button.js +61 -0
  10. package/dist/components/buttons/text-button/text-button.stories.d.ts +6 -0
  11. package/dist/components/buttons/text-button/text-button.stories.js +16 -0
  12. package/dist/components/decorator/decorator.d.ts +7 -0
  13. package/dist/components/decorator/decorator.js +13 -0
  14. package/dist/components/feedback/alert/alert.d.ts +17 -0
  15. package/dist/components/feedback/alert/alert.js +68 -0
  16. package/dist/components/feedback/alert/alert.stories.d.ts +6 -0
  17. package/dist/components/feedback/alert/alert.stories.js +23 -0
  18. package/dist/components/icons/chevron-left-icon/chevron-left-icon.d.ts +7 -0
  19. package/dist/components/icons/chevron-left-icon/chevron-left-icon.js +3 -0
  20. package/dist/components/icons/chevron-left-icon/chevron-left-icon.stories.d.ts +6 -0
  21. package/dist/components/icons/chevron-left-icon/chevron-left-icon.stories.js +14 -0
  22. package/dist/components/icons/chevron-right-icon/chevron-right-icon.d.ts +7 -0
  23. package/dist/components/icons/chevron-right-icon/chevron-right-icon.js +3 -0
  24. package/dist/components/icons/chevron-right-icon/chevron-right-icon.stories.d.ts +6 -0
  25. package/dist/components/icons/chevron-right-icon/chevron-right-icon.stories.js +14 -0
  26. package/dist/components/icons/close-icon/close-icon.d.ts +12 -0
  27. package/dist/components/icons/close-icon/close-icon.js +9 -0
  28. package/dist/components/icons/close-icon/close-icon.stories.d.ts +6 -0
  29. package/dist/components/icons/close-icon/close-icon.stories.js +16 -0
  30. package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.d.ts +3 -0
  31. package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.js +3 -0
  32. package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.stories.d.ts +6 -0
  33. package/dist/components/icons/exclamation-mark-icon/exclamation-mark-icon.stories.js +16 -0
  34. package/dist/components/icons/external-icon/external-icon.d.ts +5 -0
  35. package/dist/components/icons/external-icon/external-icon.js +2 -0
  36. package/dist/components/icons/external-icon/external-icon.stories.d.ts +6 -0
  37. package/dist/components/icons/external-icon/external-icon.stories.js +14 -0
  38. package/dist/components/icons/hamburger-icon/hamburger-icon.d.ts +1 -0
  39. package/dist/components/icons/hamburger-icon/hamburger-icon.js +2 -0
  40. package/dist/components/icons/hamburger-icon/hamburger-icon.stories.d.ts +6 -0
  41. package/dist/components/icons/hamburger-icon/hamburger-icon.stories.js +14 -0
  42. package/dist/components/icons/heart-icon/heart-icon.d.ts +1 -0
  43. package/dist/components/icons/heart-icon/heart-icon.js +2 -0
  44. package/dist/components/icons/heart-icon/heart-icon.stories.d.ts +6 -0
  45. package/dist/components/icons/heart-icon/heart-icon.stories.js +12 -0
  46. package/dist/components/icons/loading-spinner/loading-spinner.d.ts +20 -0
  47. package/dist/components/icons/loading-spinner/loading-spinner.js +32 -0
  48. package/dist/components/icons/loading-spinner/loading-spinner.stories.d.ts +6 -0
  49. package/dist/components/icons/loading-spinner/loading-spinner.stories.js +18 -0
  50. package/dist/components/icons/menu-close-icon/menu-close-icon.d.ts +1 -0
  51. package/dist/components/icons/menu-close-icon/menu-close-icon.js +2 -0
  52. package/dist/components/icons/menu-close-icon/menu-close-icon.stories.d.ts +6 -0
  53. package/dist/components/icons/menu-close-icon/menu-close-icon.stories.js +14 -0
  54. package/dist/components/icons/search-icon/search-icon.d.ts +5 -0
  55. package/dist/components/icons/search-icon/search-icon.js +3 -0
  56. package/dist/components/icons/search-icon/search-icon.stories.d.ts +6 -0
  57. package/dist/components/icons/search-icon/search-icon.stories.js +18 -0
  58. package/dist/components/icons/toggable-chevron/toggable-chevron.d.ts +12 -0
  59. package/dist/components/icons/toggable-chevron/toggable-chevron.js +20 -0
  60. package/dist/components/icons/toggable-chevron/toggable-chevron.stories.d.ts +7 -0
  61. package/dist/components/icons/toggable-chevron/toggable-chevron.stories.js +21 -0
  62. package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.d.ts +6 -0
  63. package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.js +13 -0
  64. package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.stories.d.ts +7 -0
  65. package/dist/components/icons/toggable-plus-minus-icon/toggable-plus-minus-icon.stories.js +21 -0
  66. package/dist/components/icons/warning-icon/warning-icon.d.ts +3 -0
  67. package/dist/components/icons/warning-icon/warning-icon.js +3 -0
  68. package/dist/components/icons/warning-icon/warning-icon.stories.d.ts +6 -0
  69. package/dist/components/icons/warning-icon/warning-icon.stories.js +16 -0
  70. package/dist/components/inputs/dropdown/dropdown-list-item.d.ts +6 -0
  71. package/dist/components/inputs/dropdown/dropdown-list-item.js +33 -0
  72. package/dist/components/inputs/dropdown/dropdown.d.ts +13 -0
  73. package/dist/components/inputs/dropdown/dropdown.js +109 -0
  74. package/dist/components/inputs/dropdown/dropdown.stories.d.ts +7 -0
  75. package/dist/components/inputs/dropdown/dropdown.stories.js +84 -0
  76. package/dist/components/inputs/form-error/form-error.d.ts +11 -0
  77. package/dist/components/inputs/form-error/form-error.js +16 -0
  78. package/dist/components/inputs/form-error/form-error.stories.d.ts +6 -0
  79. package/dist/components/inputs/form-error/form-error.stories.js +22 -0
  80. package/dist/components/inputs/form-label/form-label.d.ts +7 -0
  81. package/dist/components/inputs/form-label/form-label.js +12 -0
  82. package/dist/components/inputs/form-label/form-label.stories.d.ts +6 -0
  83. package/dist/components/inputs/form-label/form-label.stories.js +16 -0
  84. package/dist/components/inputs/text-field/text-field.d.ts +32 -0
  85. package/dist/components/inputs/text-field/text-field.js +65 -0
  86. package/dist/components/inputs/text-field/text-field.stories.d.ts +11 -0
  87. package/dist/components/inputs/text-field/text-field.stories.js +51 -0
  88. package/dist/components/layout/accordion/accordion.d.ts +13 -0
  89. package/dist/components/layout/accordion/accordion.js +115 -0
  90. package/dist/components/layout/accordion/accordion.stories.d.ts +6 -0
  91. package/dist/components/layout/accordion/accordion.stories.js +14 -0
  92. package/dist/components/layout/container/container.d.ts +10 -0
  93. package/dist/components/layout/container/container.js +19 -0
  94. package/dist/components/layout/container/container.stories.d.ts +9 -0
  95. package/dist/components/layout/container/container.stories.js +47 -0
  96. package/dist/components/layout/image/image.d.ts +22 -0
  97. package/dist/components/layout/image/image.js +27 -0
  98. package/dist/components/layout/image/image.stories.d.ts +6 -0
  99. package/dist/components/layout/image/image.stories.js +33 -0
  100. package/dist/components/modules/email-signup-form/email-signup-form.d.ts +16 -0
  101. package/dist/components/modules/email-signup-form/email-signup-form.js +63 -0
  102. package/dist/components/modules/email-signup-form/email-signup-form.stories.d.ts +9 -0
  103. package/dist/components/modules/email-signup-form/email-signup-form.stories.js +51 -0
  104. package/dist/components/modules/entry-list/entry-list.d.ts +27 -0
  105. package/dist/components/modules/entry-list/entry-list.js +54 -0
  106. package/dist/components/modules/entry-list/entry-list.stories.d.ts +6 -0
  107. package/dist/components/modules/entry-list/entry-list.stories.js +14 -0
  108. package/dist/components/navigation/nav-cell/nav-cell.d.ts +6 -0
  109. package/dist/components/navigation/nav-cell/nav-cell.js +67 -0
  110. package/dist/components/navigation/nav-cell/nav-cell.stories.d.ts +7 -0
  111. package/dist/components/navigation/nav-cell/nav-cell.stories.js +23 -0
  112. package/dist/components/navigation/nav-item/nav-item.d.ts +18 -0
  113. package/dist/components/navigation/nav-item/nav-item.js +106 -0
  114. package/dist/components/navigation/nav-item/nav-item.stories.d.ts +9 -0
  115. package/dist/components/navigation/nav-item/nav-item.stories.js +73 -0
  116. package/dist/components/navigation/pagination/pagination.d.ts +12 -0
  117. package/dist/components/navigation/pagination/pagination.js +114 -0
  118. package/dist/components/navigation/pagination/pagination.stories.d.ts +6 -0
  119. package/dist/components/navigation/pagination/pagination.stories.js +21 -0
  120. package/dist/components/surfaces/cards/card-banner/card-banner.d.ts +14 -0
  121. package/dist/components/surfaces/cards/card-banner/card-banner.js +62 -0
  122. package/dist/components/surfaces/cards/card-banner/card-banner.stories.d.ts +6 -0
  123. package/dist/components/surfaces/cards/card-banner/card-banner.stories.js +29 -0
  124. package/dist/constants/general.d.ts +4 -0
  125. package/dist/constants/general.js +5 -0
  126. package/dist/hoc/withDefaultTheme.d.ts +1 -1
  127. package/dist/hoc/withDefaultTheme.js +4 -8
  128. package/dist/index.d.ts +50 -2
  129. package/dist/index.js +52 -2
  130. package/dist/mocks/image-mocks.d.ts +30 -0
  131. package/dist/mocks/image-mocks.js +32 -0
  132. package/dist/models/sanity-types.d.ts +9 -0
  133. package/dist/models/web-page-url.d.ts +10 -0
  134. package/dist/models/web-page-url.js +1 -0
  135. package/dist/styles/mixins.js +8 -4
  136. package/dist/styles/theme.d.ts +11 -9
  137. package/dist/styles/theme.js +12 -11
  138. package/package.json +78 -67
  139. package/dist/App.d.ts +0 -3
  140. package/dist/App.js +0 -10
  141. package/dist/main.d.ts +0 -1
  142. package/dist/main.js +0 -6
  143. package/dist/stories/Button.d.ts +0 -14
  144. package/dist/stories/Button.js +0 -20
  145. package/dist/stories/Button.stories.d.ts +0 -23
  146. package/dist/stories/Button.stories.js +0 -44
  147. package/dist/stories/Header.d.ts +0 -12
  148. package/dist/stories/Header.js +0 -4
  149. package/dist/stories/Header.stories.d.ts +0 -18
  150. package/dist/stories/Header.stories.js +0 -26
  151. package/dist/stories/Page.d.ts +0 -3
  152. package/dist/stories/Page.js +0 -7
  153. package/dist/stories/Page.stories.d.ts +0 -12
  154. package/dist/stories/Page.stories.js +0 -24
  155. package/dist/styles/styles/mixins/theme-mixins.d.ts +0 -5
  156. package/dist/styles/styles/mixins/theme-mixins.js +0 -37
  157. package/dist/styles/styles/mixins/units.d.ts +0 -3
  158. package/dist/styles/styles/mixins/units.js +0 -3
  159. package/dist/styles/styles/mixins.d.ts +0 -48
  160. package/dist/styles/styles/mixins.js +0 -336
  161. package/dist/styles/styles/theme.d.ts +0 -135
  162. package/dist/styles/styles/theme.js +0 -77
  163. package/dist/styles/types.d.ts +0 -3
  164. package/dist/styles/withDefaultTheme.d.ts +0 -1
  165. package/dist/styles/withDefaultTheme.js +0 -12
  166. /package/dist/{styles/types.js → models/sanity-types.js} +0 -0
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const HamburgerIcon = () => (_jsx("svg", { width: "30px", height: "19px", viewBox: "0 0 30 19", fill: "#333333", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: _jsx("g", { transform: "translate(-326.000000, -113.000000)", children: _jsx("g", { transform: "translate(0.000000, 94.000000)", children: _jsx("path", { d: "M326,19 L356,19 L356,22 L326,22 Z M326,27 L356,27 L356,30 L326,30 Z M326,35 L356,35 L356,38 L326,38 Z" }) }) }) }) }));
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { HamburgerIcon } from "./hamburger-icon";
3
+ declare const meta: Meta<typeof HamburgerIcon>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof HamburgerIcon>;
6
+ export declare const Default: Story;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HamburgerIcon } from "./hamburger-icon";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Icons/HamburgerIcon",
6
+ component: HamburgerIcon,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {},
14
+ };
@@ -0,0 +1 @@
1
+ export declare const HeartIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const HeartIcon = () => (_jsx("svg", { width: "20px", height: "18px", viewBox: "0 0 20 18", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: _jsx("g", { id: "navigation_1440_1", transform: "translate(-337.000000, -220.000000)", fill: "#ED1B2F", fillRule: "nonzero", children: _jsx("g", { id: "Group-23", transform: "translate(0.000000, 128.000000)", children: _jsx("g", { id: "Group-16", transform: "translate(128.000000, 0.000000)", children: _jsx("g", { id: "Group-15", transform: "translate(80.000000, 32.000000)", children: _jsx("path", { d: "M143.961126,60.790431 C142.253052,60.6643448 140.432682,61.3962357 139.210237,62.6994547 L139.134389,62.7802287 L139.05854,62.6994547 C137.927704,61.4927704 136.283659,60.7766403 134.690836,60.7766403 C134.562779,60.7766403 134.434723,60.7815655 134.307652,60.790431 C132.310959,60.9381882 130.761478,62.1694987 130.050273,64.1691469 C129.145013,66.7253474 130.275849,69.6056288 133.414213,72.7311873 C135.013394,74.2978159 136.778889,75.6851081 138.679296,76.8683905 L138.954125,77.0319085 C139.065219,77.0979816 139.203558,77.0979816 139.314653,77.0319085 L139.589481,76.8683905 C141.489053,75.6839171 143.254424,74.2967226 144.854565,72.7311873 C147.991944,69.6056288 149.123764,66.7223923 148.21752,64.1691469 C147.5073,62.1694987 145.954864,60.9401583 143.961126,60.790431 Z", id: "heart_icon_red" }) }) }) }) }) }) }));
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { HeartIcon } from "./heart-icon";
3
+ declare const meta: Meta<typeof HeartIcon>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof HeartIcon>;
6
+ export declare const Default: Story;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HeartIcon } from "./heart-icon";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Icons/HeartIcon",
6
+ component: HeartIcon,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {};
@@ -0,0 +1,20 @@
1
+ export type LoadingSpinnerSizes = "s" | "m" | "l";
2
+ export type LoadingSpinnerProps = {
3
+ color?: string;
4
+ size?: LoadingSpinnerSizes;
5
+ className?: string;
6
+ };
7
+ export type StyledLoadingSpinnerProps = {
8
+ size: LoadingSpinnerSizes;
9
+ width: {
10
+ s: string;
11
+ m: string;
12
+ l: string;
13
+ };
14
+ padding: {
15
+ s: string;
16
+ m: string;
17
+ l: string;
18
+ };
19
+ };
20
+ export declare const LoadingSpinner: ({ color, className, size, }: LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styled, { keyframes } from "styled-components";
3
+ import { rem } from "../../../styles/units";
4
+ export const LoadingSpinner = ({ color, className, size = "m", }) => {
5
+ const width = {
6
+ s: rem(16),
7
+ m: rem(32),
8
+ l: rem(64),
9
+ };
10
+ const padding = {
11
+ s: rem(2),
12
+ m: rem(4),
13
+ l: rem(8),
14
+ };
15
+ return (_jsx(Spinner, { className: className, color: color, size: size, width: width, padding: padding }));
16
+ };
17
+ const rotate = keyframes `
18
+ 100% {
19
+ transform: rotate(360deg);
20
+ }
21
+ `;
22
+ const Spinner = styled.div `
23
+ width: ${({ width, size }) => width?.[size]};
24
+ padding: ${({ padding, size }) => padding?.[size]};
25
+ aspect-ratio: 1;
26
+ border-radius: 50%;
27
+ background: ${({ color, theme }) => (color ? color : theme?.blueNavy)};
28
+ mask: conic-gradient(#0000 0, #000), linear-gradient(#000 0 0) content-box;
29
+ mask-composite: source-out;
30
+ -webkit-mask-composite: source-out;
31
+ animation: ${rotate} 1s infinite linear;
32
+ `;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { LoadingSpinner } from "./loading-spinner";
3
+ declare const meta: Meta<typeof LoadingSpinner>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LoadingSpinner>;
6
+ export declare const Default: Story;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LoadingSpinner } from "./loading-spinner";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ import { COLORS } from "../../../styles/theme";
5
+ const meta = {
6
+ title: "Icons/LoadingSpinner",
7
+ component: LoadingSpinner,
8
+ decorators: [
9
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
10
+ ],
11
+ };
12
+ export default meta;
13
+ export const Default = {
14
+ args: {
15
+ size: "m",
16
+ color: COLORS.red,
17
+ },
18
+ };
@@ -0,0 +1 @@
1
+ export declare const MenuCloseIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const MenuCloseIcon = () => (_jsx("svg", { width: "24px", height: "25px", viewBox: "0 0 24 25", version: "1.1", fill: "#333333", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: _jsx("g", { transform: "translate(-329.000000, -110.000000)", children: _jsx("path", { d: "M350.545942,110.832738 L352.667262,112.954058 L343.120738,122.499738 L352.667262,132.045942 L350.545942,134.167262 L340.999738,124.620738 L331.454058,134.167262 L329.332738,132.045942 L338.878738,122.499738 L329.332738,112.954058 L331.454058,110.832738 L340.999738,120.378738 L350.545942,110.832738 Z" }) }) }) }));
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { MenuCloseIcon } from "./menu-close-icon";
3
+ declare const meta: Meta<typeof MenuCloseIcon>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof MenuCloseIcon>;
6
+ export declare const Default: Story;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MenuCloseIcon } from "./menu-close-icon";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Icons/MenuCloseIcon",
6
+ component: MenuCloseIcon,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {},
14
+ };
@@ -0,0 +1,5 @@
1
+ export declare const SearchIcon: ({ color, width, height, }: {
2
+ color?: string;
3
+ width?: number;
4
+ height?: number;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { COLORS } from "../../../styles/theme";
3
+ export const SearchIcon = ({ color = COLORS.blackLight, width = 32, height = 32, }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, viewBox: `0 0 32 32`, children: _jsx("path", { fill: color, d: "M16 6a9 9 0 0 1 7.032 14.617l3.675 3.676a1 1 0 0 1-1.32 1.497l-.094-.083-3.676-3.675A9 9 0 1 1 16 6zm0 2a7 7 0 1 0 4.865 12.033.732.732 0 0 1 .078-.09l.09-.078A7 7 0 0 0 16 8z" }) }));
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { SearchIcon } from "./search-icon";
3
+ declare const meta: Meta<typeof SearchIcon>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof SearchIcon>;
6
+ export declare const Default: Story;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SearchIcon } from "./search-icon";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Icons/SearchIcon",
6
+ component: SearchIcon,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {
14
+ color: "#333",
15
+ width: 32,
16
+ height: 32,
17
+ },
18
+ };
@@ -0,0 +1,12 @@
1
+ type ToggableChevronProps = {
2
+ toggled?: boolean;
3
+ disableCircle?: boolean;
4
+ className?: string;
5
+ rotation?: number;
6
+ };
7
+ type ChevronDownProps = {
8
+ className?: string;
9
+ };
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;
12
+ export {};
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
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, { toggled: toggled, disableCircle: disableCircle, rotation: rotation, className: className, children: _jsx(ChevronDownIcon, {}) }));
5
+ const Chevron = styled.div `
6
+ width: 22px;
7
+ height: 22px;
8
+ border: 1px solid rgba(19, 20, 21, 0.2);
9
+ border-radius: 50%;
10
+ display: flex;
11
+ flex-shrink: 0;
12
+ justify-content: center;
13
+ align-items: center;
14
+
15
+ ${({ toggled, disableCircle, rotation }) => css `
16
+ transform: scaleY(${toggled ? -1 : 1})
17
+ ${rotation && `rotate(${rotation}deg)`};
18
+ border-width: ${toggled || disableCircle ? 0 : 1};
19
+ `};
20
+ `;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { ToggableChevron } from "./toggable-chevron";
3
+ declare const meta: Meta<typeof ToggableChevron>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ToggableChevron>;
6
+ export declare const Default: Story;
7
+ export declare const Toggled: Story;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ToggableChevron } from "./toggable-chevron";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Icons/ToggableChevron",
6
+ component: ToggableChevron,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {
14
+ toggled: false,
15
+ },
16
+ };
17
+ export const Toggled = {
18
+ args: {
19
+ toggled: true,
20
+ },
21
+ };
@@ -0,0 +1,6 @@
1
+ export declare const ToggablePlusMinusIcon: ({ isOpen, width, height, className, }: {
2
+ isOpen?: boolean;
3
+ width?: number;
4
+ height?: number;
5
+ className?: string;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ export const ToggablePlusMinusIcon = ({ isOpen = false, width = 14, height = 14, className = "", }) => {
4
+ return (_jsxs(Svg, { className: className, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 160 160", width: width, height: height, isOpen: isOpen, children: [_jsx(Rect, { isOpen: isOpen, x: "70", width: "20", height: "160" }), _jsx(Rect, { y: "70", width: "160", height: "20" })] }));
5
+ };
6
+ const Svg = styled.svg `
7
+ cursor: pointer;
8
+ `;
9
+ const Rect = styled.rect `
10
+ transition: transform 250ms ease-in-out;
11
+ transform-origin: 50% 50%;
12
+ transform: ${({ isOpen }) => (!isOpen ? "scaleY(1)" : "scaleY(0)")};
13
+ `;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { ToggablePlusMinusIcon } from "./toggable-plus-minus-icon";
3
+ declare const meta: Meta<typeof ToggablePlusMinusIcon>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ToggablePlusMinusIcon>;
6
+ export declare const Default: Story;
7
+ export declare const Toggled: Story;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ToggablePlusMinusIcon } from "./toggable-plus-minus-icon";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Icons/ToggablePlusMinusIcon",
6
+ component: ToggablePlusMinusIcon,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {
14
+ isOpen: false,
15
+ },
16
+ };
17
+ export const Toggled = {
18
+ args: {
19
+ isOpen: true,
20
+ },
21
+ };
@@ -0,0 +1,3 @@
1
+ export declare const WarningIcon: ({ color }: {
2
+ color?: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { COLORS } from "../../../styles/theme";
3
+ export const WarningIcon = ({ color = COLORS.red }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 32, height: 32, children: _jsx("path", { fill: color, fillRule: "nonzero", d: "M16.447 6c1.049 0 2.021.548 2.568 1.449l8.478 14.154a3 3 0 0 1-2.576 4.5H7.966a3 3 0 0 1-2.557-4.514l8.473-14.145A3 3 0 0 1 16.447 6Zm0 2a.998.998 0 0 0-.852.477L7.133 22.603a1 1 0 0 0 .844 1.5h16.929a1 1 0 0 0 .863-1.486L17.302 8.48A1 1 0 0 0 16.447 8Zm.01 12.103a1 1 0 0 1 .117 1.993l-.127.007a1 1 0 0 1-.117-1.994l.127-.006Zm-.01-8a1 1 0 0 1 .993.883l.007.117v4a1 1 0 0 1-1.993.116l-.007-.116v-4a1 1 0 0 1 1-1Z" }) }));
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { WarningIcon } from "./warning-icon";
3
+ declare const meta: Meta<typeof WarningIcon>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof WarningIcon>;
6
+ export declare const Default: Story;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { WarningIcon } from "./warning-icon";
3
+ import { Decorator } from "../../../components/decorator/decorator";
4
+ const meta = {
5
+ title: "Icons/WarningIcon",
6
+ component: WarningIcon,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {
14
+ color: "#333",
15
+ },
16
+ };
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ label: string;
3
+ onClick: () => void;
4
+ };
5
+ export declare const DropdownListItem: ({ label, onClick }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { rem } from "../../../styles/units";
4
+ export const DropdownListItem = ({ label, onClick }) => {
5
+ return (_jsx(ListItem, { children: _jsx(ListElement, { onClick: onClick, children: _jsx(Paragraph, { children: label }) }) }));
6
+ };
7
+ const ListItem = styled.li `
8
+ padding: 0;
9
+ margin: 0;
10
+ margin-bottom: ${rem(1)};
11
+ `;
12
+ const ListElement = styled.button `
13
+ display: flex;
14
+ align-items: center;
15
+ width: 100%;
16
+ text-align: left;
17
+ margin: 0;
18
+ padding: ${rem(12)} ${rem(6)};
19
+ border: none;
20
+ border-radius: ${rem(4)};
21
+ background: white;
22
+ cursor: pointer;
23
+
24
+ &:hover,
25
+ :focus-visible {
26
+ background-color: ${({ theme }) => theme.grayLight};
27
+ }
28
+ `;
29
+ const Paragraph = styled.p `
30
+ font-family: ${({ theme }) => theme.valueRegular};
31
+ font-size: ${rem(16)};
32
+ margin: 0;
33
+ `;
@@ -0,0 +1,13 @@
1
+ export type DropdownItem = {
2
+ label: string;
3
+ value: string | boolean;
4
+ };
5
+ export type DropdownProps = {
6
+ prefix?: string;
7
+ id?: string;
8
+ items: DropdownItem[];
9
+ className?: string;
10
+ onItemSelected: (_: DropdownItem) => void;
11
+ initialValue: DropdownItem;
12
+ };
13
+ export declare const Dropdown: ({ prefix, items, id, className, onItemSelected, initialValue, }: DropdownProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,109 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import styled, { css } from "styled-components";
4
+ import { ToggableChevron } from "../../../components/icons/toggable-chevron/toggable-chevron";
5
+ import { DropdownListItem } from "./dropdown-list-item";
6
+ import { media } from "../../../styles/mixins";
7
+ import { rem } from "../../../styles/units";
8
+ export const Dropdown = ({ prefix, items, id, className, onItemSelected, initialValue, }) => {
9
+ const [isOpen, setIsOpen] = useState(false);
10
+ const [selectedItem, setItem] = useState(initialValue || items?.[0] || undefined);
11
+ const ref = useRef(null);
12
+ useEffect(() => {
13
+ const handleClickOutsideMenu = (e) => {
14
+ if (ref.current && !ref.current.contains(e?.target)) {
15
+ setIsOpen(false);
16
+ document.removeEventListener("click", handleClickOutsideMenu, {
17
+ capture: true,
18
+ });
19
+ }
20
+ };
21
+ if (isOpen) {
22
+ document.addEventListener("click", handleClickOutsideMenu, {
23
+ capture: true,
24
+ });
25
+ }
26
+ else {
27
+ document.removeEventListener("click", handleClickOutsideMenu, {
28
+ capture: true,
29
+ });
30
+ }
31
+ }, [isOpen]);
32
+ return (_jsxs(Container, { className: className, ref: ref, children: [_jsxs(DropdownButton, { id: id, onClick: () => setIsOpen(!isOpen), "aria-haspopup": "menu", "aria-controls": "dropdown-menu", isOpen: isOpen, children: [_jsxs(TextContainer, { children: [prefix && _jsx(Prefix, { children: `${prefix}:` }), _jsx(Label, { children: selectedItem?.label })] }), _jsx(StyledToggle, { toggled: isOpen })] }), _jsx(Content, { id: "dropdown-menu", "aria-expanded": isOpen, "aria-hidden": !isOpen, role: "menu", children: items.map((item, i) => (_jsx(DropdownListItem, { label: item.label, onClick: () => {
33
+ setIsOpen(false);
34
+ setItem(item);
35
+ onItemSelected(item);
36
+ } }, i))) })] }));
37
+ };
38
+ const Container = styled.div `
39
+ width: 100%;
40
+ display: flex;
41
+ flex-direction: column;
42
+ position: relative;
43
+ `;
44
+ const DropdownButton = styled.button `
45
+ display: flex;
46
+ align-items: center;
47
+ height: ${rem(48)};
48
+ font-size: ${rem(16)};
49
+ background-color: ${({ theme }) => theme.white};
50
+ border: ${rem(1)} solid ${({ theme }) => theme.grayTransparent};
51
+ border-radius: ${({ isOpen }) => isOpen ? `${rem(5)} ${rem(5)} 0 0` : rem(5)};
52
+ border-bottom: ${({ isOpen, theme }) => isOpen ? "none" : `$(${rem(1)}) solid ${theme.grayTransparent}`};
53
+ padding: 0 ${rem(14)};
54
+ cursor: pointer;
55
+
56
+ ${({ isOpen, theme }) => {
57
+ return css `
58
+ ${media.M `
59
+ &:hover, :focus-visible {
60
+ border: ${rem(1)} solid ${theme.gray};
61
+ border-bottom: ${isOpen ? "none" : `${rem(1)} solid ${theme.gray}`};
62
+ }
63
+ `}
64
+ `;
65
+ }}
66
+ `;
67
+ const TextContainer = styled.div `
68
+ display: flex;
69
+ overflow: hidden;
70
+ white-space: nowrap;
71
+ `;
72
+ const StyledToggle = styled(ToggableChevron).attrs({
73
+ disableCircle: true,
74
+ }) `
75
+ margin-left: auto;
76
+ padding-left: ${rem(8)};
77
+ `;
78
+ const Content = styled.ul `
79
+ position: absolute;
80
+ width: 100%;
81
+ max-height: ${rem(250)};
82
+ top: ${rem(48)};
83
+ list-style: none;
84
+ background-color: ${({ theme }) => theme.white};
85
+ border: ${rem(1)} solid ${({ theme }) => theme.grayTransparent};
86
+ border-radius: ${rem(5)};
87
+ padding: 0 ${rem(6)};
88
+ margin: 0;
89
+ visibility: hidden;
90
+ overflow-y: scroll;
91
+
92
+ &[aria-expanded="true"] {
93
+ visibility: visible;
94
+ border-radius: 0 0 ${rem(5)} ${rem(5)};
95
+ border-top: 0;
96
+ }
97
+ `;
98
+ const Label = styled.p `
99
+ font-family: ${({ theme }) => theme.valueBold};
100
+ font-size: ${rem(16)};
101
+ margin: 0;
102
+ overflow: hidden;
103
+ text-overflow: ellipsis;
104
+ `;
105
+ const Prefix = styled(Label) `
106
+ font-family: ${({ theme }) => theme.valueRegular};
107
+ margin-right: ${rem(6)};
108
+ overflow: unset;
109
+ `;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Dropdown } from "./dropdown";
3
+ declare const meta: Meta<typeof Dropdown>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Dropdown>;
6
+ export declare const Default: Story;
7
+ export declare const WithPrefix: Story;
@@ -0,0 +1,84 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Decorator } from "../../../components/decorator/decorator";
3
+ import { Dropdown } from "./dropdown";
4
+ const meta = {
5
+ title: "Inputs/Dropdown",
6
+ component: Dropdown,
7
+ decorators: [
8
+ (Story) => (_jsx(Decorator, { maxWidth: "250px", children: _jsx(Story, {}) })),
9
+ ],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {
14
+ items: [
15
+ {
16
+ label: "2025",
17
+ value: "2025",
18
+ },
19
+ {
20
+ label: "2024",
21
+ value: "2024",
22
+ },
23
+ {
24
+ label: "2023",
25
+ value: "2023",
26
+ },
27
+ {
28
+ label: "2022",
29
+ value: "2022",
30
+ },
31
+ {
32
+ label: "2021",
33
+ value: "2021",
34
+ },
35
+ {
36
+ label: "2020",
37
+ value: "2020",
38
+ },
39
+ {
40
+ label: "2019",
41
+ value: "2019",
42
+ },
43
+ {
44
+ label: "2018",
45
+ value: "2018",
46
+ },
47
+ {
48
+ label: "2017",
49
+ value: "2017",
50
+ },
51
+ {
52
+ label: "2016",
53
+ value: "2016",
54
+ },
55
+ {
56
+ label: "2015",
57
+ value: "2015",
58
+ },
59
+ {
60
+ label: "2014",
61
+ value: "2014",
62
+ },
63
+ {
64
+ label: "2013",
65
+ value: "2013",
66
+ },
67
+ ],
68
+ },
69
+ };
70
+ export const WithPrefix = {
71
+ args: {
72
+ prefix: "Sort by",
73
+ items: [
74
+ {
75
+ label: "Latest first",
76
+ value: "newest",
77
+ },
78
+ {
79
+ label: "Oldest first",
80
+ value: "oldest",
81
+ },
82
+ ],
83
+ },
84
+ };
@@ -0,0 +1,11 @@
1
+ import { FieldErrors } from "react-hook-form";
2
+ export type FormErrorProps = {
3
+ errors: FieldErrors;
4
+ name: string;
5
+ className?: string;
6
+ alignLeft?: boolean;
7
+ };
8
+ export type StyledFormErrorProps = {
9
+ alignLeft?: boolean;
10
+ };
11
+ export declare const FormError: ({ errors, name, className, alignLeft, }: FormErrorProps) => import("react/jsx-runtime").JSX.Element;