@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
package/package.json CHANGED
@@ -1,67 +1,78 @@
1
- {
2
- "name": "@hlf-fe/pulmo-ui",
3
- "private": false,
4
- "version": "1.0.1",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "files": [
10
- "dist"
11
- ],
12
- "scripts": {
13
- "dev": "npm-run-all --parallel storybook watch",
14
- "build": "tsc -b tsconfig.app.json",
15
- "watch": "tsc -b tsconfig.app.json --watch",
16
- "lint": "eslint .",
17
- "preview": "vite preview",
18
- "storybook": "storybook dev -p 6006",
19
- "build-storybook": "storybook build"
20
- },
21
- "dependencies": {
22
- "gatsby": "^5.14.3",
23
- "npm-run-all": "^4.1.5",
24
- "react": "^18.2.0",
25
- "react-dom": "^18.2.0",
26
- "styled-components": "^6.1.0"
27
- },
28
- "peerDependencies": {
29
- "gatsby": "^5.14.3",
30
- "react": "^18.2.0",
31
- "react-dom": "^18.2.0",
32
- "styled-components": "^6.1.0"
33
- },
34
- "devDependencies": {
35
- "@chromatic-com/storybook": "^3.2.6",
36
- "@eslint/js": "^9.25.0",
37
- "@storybook/addon-essentials": "^8.6.12",
38
- "@storybook/addon-onboarding": "^8.6.12",
39
- "@storybook/blocks": "^8.6.12",
40
- "@storybook/experimental-addon-test": "^8.6.12",
41
- "@storybook/react": "^8.6.12",
42
- "@storybook/react-vite": "^8.6.12",
43
- "@storybook/test": "^8.6.12",
44
- "@types/node": "^22.15.17",
45
- "@types/react": "^18.3.21",
46
- "@types/react-dom": "^18.3.7",
47
- "@vitejs/plugin-react": "^4.4.1",
48
- "@vitest/browser": "^3.1.3",
49
- "@vitest/coverage-v8": "^3.1.3",
50
- "eslint": "^9.25.0",
51
- "eslint-plugin-react-hooks": "^5.2.0",
52
- "eslint-plugin-react-refresh": "^0.4.19",
53
- "eslint-plugin-storybook": "^0.12.0",
54
- "globals": "^16.0.0",
55
- "playwright": "^1.52.0",
56
- "storybook": "^8.6.12",
57
- "typescript": "~5.8.3",
58
- "typescript-eslint": "^8.30.1",
59
- "vite": "^6.3.5",
60
- "vitest": "^3.1.3"
61
- },
62
- "eslintConfig": {
63
- "extends": [
64
- "plugin:storybook/recommended"
65
- ]
66
- }
67
- }
1
+ {
2
+ "name": "@hlf-fe/pulmo-ui",
3
+ "private": false,
4
+ "version": "1.2.0",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "dev": "npm-run-all --parallel storybook watch",
14
+ "build": "tsc -p tsconfig.app.json && tsc-alias -p tsconfig.app.json",
15
+ "watch": "nodemon --watch src --ext ts,tsx --exec \"tsc -p tsconfig.app.json && tsc-alias -p tsconfig.app.json\"",
16
+ "lint": "eslint .",
17
+ "preview": "vite preview",
18
+ "storybook": "storybook dev -p 6006",
19
+ "build-storybook": "storybook build",
20
+ "release:npm": "npm run build && npm publish --access public"
21
+ },
22
+ "dependencies": {
23
+ "@hookform/resolvers": "^5.0.1",
24
+ "gatsby": "^5.14.3",
25
+ "gatsby-plugin-image": "^3.14.0",
26
+ "i": "^0.3.7",
27
+ "nodemon": "^3.1.10",
28
+ "npm": "^11.3.0",
29
+ "npm-run-all": "^4.1.5",
30
+ "react": "^18.2.0",
31
+ "react-dom": "^18.2.0",
32
+ "react-hook-form": "^7.56.3",
33
+ "styled-components": "^6.1.0",
34
+ "vite-tsconfig-paths": "^5.1.4",
35
+ "yup": "^1.6.1"
36
+ },
37
+ "peerDependencies": {
38
+ "gatsby": "^5.14.3",
39
+ "react": "^18.2.0",
40
+ "react-dom": "^18.2.0",
41
+ "styled-components": "^6.1.0"
42
+ },
43
+ "devDependencies": {
44
+ "@chromatic-com/storybook": "^3.2.6",
45
+ "@eslint/js": "^9.25.0",
46
+ "@storybook/addon-essentials": "^8.6.12",
47
+ "@storybook/addon-onboarding": "^8.6.12",
48
+ "@storybook/blocks": "^8.6.12",
49
+ "@storybook/experimental-addon-test": "^8.6.12",
50
+ "@storybook/react": "^8.6.12",
51
+ "@storybook/react-vite": "^8.6.12",
52
+ "@storybook/test": "^8.6.12",
53
+ "@types/node": "^22.15.17",
54
+ "@types/react": "^18.3.21",
55
+ "@types/react-dom": "^18.3.7",
56
+ "@vitejs/plugin-react": "^4.4.1",
57
+ "@vitest/browser": "^3.1.3",
58
+ "@vitest/coverage-v8": "^3.1.3",
59
+ "concurrently": "^9.1.2",
60
+ "eslint": "^9.25.0",
61
+ "eslint-plugin-react-hooks": "^5.2.0",
62
+ "eslint-plugin-react-refresh": "^0.4.19",
63
+ "eslint-plugin-storybook": "^0.12.0",
64
+ "globals": "^16.0.0",
65
+ "playwright": "^1.52.0",
66
+ "storybook": "^8.6.12",
67
+ "tsc-alias": "^1.8.16",
68
+ "typescript": "~5.8.3",
69
+ "typescript-eslint": "^8.30.1",
70
+ "vite": "^6.3.5",
71
+ "vitest": "^3.1.3"
72
+ },
73
+ "eslintConfig": {
74
+ "extends": [
75
+ "plugin:storybook/recommended"
76
+ ]
77
+ }
78
+ }
package/dist/App.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import './App.css';
2
- declare function App(): import("react/jsx-runtime").JSX.Element;
3
- export default App;
package/dist/App.js DELETED
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import reactLogo from './assets/react.svg';
4
- import viteLogo from '/vite.svg';
5
- import './App.css';
6
- function App() {
7
- const [count, setCount] = useState(0);
8
- return (_jsxs(_Fragment, { children: [_jsxs("div", { children: [_jsx("a", { href: "https://vite.dev", target: "_blank", children: _jsx("img", { src: viteLogo, className: "logo", alt: "Vite logo" }) }), _jsx("a", { href: "https://react.dev", target: "_blank", children: _jsx("img", { src: reactLogo, className: "logo react", alt: "React logo" }) })] }), _jsx("h1", { children: "Vite + React" }), _jsxs("div", { className: "card", children: [_jsxs("button", { onClick: () => setCount((count) => count + 1), children: ["count is ", count] }), _jsxs("p", { children: ["Edit ", _jsx("code", { children: "src/App.tsx" }), " and save to test HMR"] })] }), _jsx("p", { className: "read-the-docs", children: "Click on the Vite and React logos to learn more" })] }));
9
- }
10
- export default App;
package/dist/main.d.ts DELETED
@@ -1 +0,0 @@
1
- import "./index.css";
package/dist/main.js DELETED
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { StrictMode } from "react";
3
- import { createRoot } from "react-dom/client";
4
- import "./index.css";
5
- import App from "./App";
6
- createRoot(document.getElementById("root")).render(_jsx(StrictMode, { children: _jsx(App, {}) }));
@@ -1,14 +0,0 @@
1
- export interface ButtonProps {
2
- /** Is this the principal call to action on the page? */
3
- primary?: boolean;
4
- /** What background color to use */
5
- backgroundColor?: string;
6
- /** How large should the button be? */
7
- size?: "small" | "medium" | "large";
8
- /** Button contents */
9
- label: string;
10
- /** Optional click handler */
11
- onClick?: () => void;
12
- }
13
- /** Primary UI component for user interaction */
14
- export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,20 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- /** Primary UI component for user interaction */
14
- export const Button = (_a) => {
15
- var { primary = false, size = "medium", backgroundColor = "purple", label } = _a, props = __rest(_a, ["primary", "size", "backgroundColor", "label"]);
16
- const mode = primary
17
- ? "storybook-button--primary"
18
- : "storybook-button--secondary";
19
- return (_jsx("button", Object.assign({ type: "button", className: ["storybook-button", `storybook-button--${size}`, mode].join(" "), style: { backgroundColor } }, props, { children: label })));
20
- };
@@ -1,23 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: ({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => import("react/jsx-runtime").JSX.Element;
5
- parameters: {
6
- layout: string;
7
- };
8
- tags: string[];
9
- argTypes: {
10
- backgroundColor: {
11
- control: "color";
12
- };
13
- };
14
- args: {
15
- onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
16
- };
17
- };
18
- export default meta;
19
- type Story = StoryObj<typeof meta>;
20
- export declare const Primary: Story;
21
- export declare const Secondary: Story;
22
- export declare const Large: Story;
23
- export declare const Small: Story;
@@ -1,44 +0,0 @@
1
- import { fn } from '@storybook/test';
2
- import { Button } from './Button';
3
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
4
- const meta = {
5
- title: 'Example/Button',
6
- component: Button,
7
- parameters: {
8
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
9
- layout: 'centered',
10
- },
11
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
12
- tags: ['autodocs'],
13
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
14
- argTypes: {
15
- backgroundColor: { control: 'color' },
16
- },
17
- // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
18
- args: { onClick: fn() },
19
- };
20
- export default meta;
21
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
22
- export const Primary = {
23
- args: {
24
- primary: true,
25
- label: 'Button',
26
- },
27
- };
28
- export const Secondary = {
29
- args: {
30
- label: 'Button',
31
- },
32
- };
33
- export const Large = {
34
- args: {
35
- size: 'large',
36
- label: 'Button',
37
- },
38
- };
39
- export const Small = {
40
- args: {
41
- size: 'small',
42
- label: 'Button',
43
- },
44
- };
@@ -1,12 +0,0 @@
1
- import "./header.css";
2
- type User = {
3
- name: string;
4
- };
5
- export interface HeaderProps {
6
- user?: User;
7
- onLogin?: () => void;
8
- onLogout?: () => void;
9
- onCreateAccount?: () => void;
10
- }
11
- export declare const Header: ({ user, onLogin, onLogout, onCreateAccount, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button } from "./Button";
3
- import "./header.css";
4
- export const Header = ({ user, onLogin, onLogout, onCreateAccount, }) => (_jsx("header", { children: _jsxs("div", { className: "storybook-header", children: [_jsxs("div", { children: [_jsx("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsx("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }), _jsx("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }), _jsx("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })] }) }), _jsx("h1", { children: "Acme" })] }), _jsx("div", { children: user ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "welcome", children: ["Welcome, ", _jsx("b", { children: user.name }), "!"] }), _jsx(Button, { size: "small", onClick: onLogout, label: "Log out" })] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", onClick: onLogin, label: "Log in" }), _jsx(Button, { primary: true, size: "small", onClick: onCreateAccount, label: "Sign up" })] })) })] }) }));
@@ -1,18 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: ({ user, onLogin, onLogout, onCreateAccount, }: import("./Header").HeaderProps) => import("react/jsx-runtime").JSX.Element;
5
- tags: string[];
6
- parameters: {
7
- layout: string;
8
- };
9
- args: {
10
- onLogin: import("@vitest/spy").Mock<(...args: any[]) => any>;
11
- onLogout: import("@vitest/spy").Mock<(...args: any[]) => any>;
12
- onCreateAccount: import("@vitest/spy").Mock<(...args: any[]) => any>;
13
- };
14
- };
15
- export default meta;
16
- type Story = StoryObj<typeof meta>;
17
- export declare const LoggedIn: Story;
18
- export declare const LoggedOut: Story;
@@ -1,26 +0,0 @@
1
- import { fn } from '@storybook/test';
2
- import { Header } from './Header';
3
- const meta = {
4
- title: 'Example/Header',
5
- component: Header,
6
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
7
- tags: ['autodocs'],
8
- parameters: {
9
- // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
10
- layout: 'fullscreen',
11
- },
12
- args: {
13
- onLogin: fn(),
14
- onLogout: fn(),
15
- onCreateAccount: fn(),
16
- },
17
- };
18
- export default meta;
19
- export const LoggedIn = {
20
- args: {
21
- user: {
22
- name: 'Jane Doe',
23
- },
24
- },
25
- };
26
- export const LoggedOut = {};
@@ -1,3 +0,0 @@
1
- import React from "react";
2
- import "./page.css";
3
- export declare const Page: React.FC;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from "react";
3
- import "./page.css";
4
- export const Page = () => {
5
- const [user, setUser] = React.useState();
6
- return (_jsxs("article", { children: [_jsx(Header, { user: user, onLogin: () => setUser({ name: "Jane Doe" }), onLogout: () => setUser(undefined), onCreateAccount: () => setUser({ name: "Jane Doe" }) }), _jsxs("section", { className: "storybook-page", children: [_jsx("h2", { children: "Pages in Storybook" }), _jsxs("p", { children: ["We recommend building UIs with a", " ", _jsx("a", { href: "https://componentdriven.org", target: "_blank", rel: "noopener noreferrer", children: _jsx("strong", { children: "component-driven" }) }), " ", "process starting with atomic components and ending with pages."] }), _jsx("p", { children: "Render pages with mock data. This makes it easy to build and review page states without needing to navigate to them in your app. Here are some handy patterns for managing page data in Storybook:" }), _jsxs("ul", { children: [_jsx("li", { children: "Use a higher-level connected component. Storybook helps you compose such data from the \"args\" of child component stories" }), _jsx("li", { children: "Assemble data in the page component from your services. You can mock these services out using Storybook." })] }), _jsxs("p", { children: ["Get a guided tutorial on component-driven development at", " ", _jsx("a", { href: "https://storybook.js.org/tutorials/", target: "_blank", rel: "noopener noreferrer", children: "Storybook tutorials" }), ". Read more in the", " ", _jsx("a", { href: "https://storybook.js.org/docs", target: "_blank", rel: "noopener noreferrer", children: "docs" }), "."] }), _jsxs("div", { className: "tip-wrapper", children: [_jsx("span", { className: "tip", children: "Tip" }), " Adjust the width of the canvas with the", " ", _jsx("svg", { width: "10", height: "10", viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { fill: "none", fillRule: "evenodd", children: _jsx("path", { d: "M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z", id: "a", fill: "#999" }) }) }), "Viewports addon in the toolbar"] })] })] }));
7
- };
@@ -1,12 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: import("react").FC<{}>;
5
- parameters: {
6
- layout: string;
7
- };
8
- };
9
- export default meta;
10
- type Story = StoryObj<typeof meta>;
11
- export declare const LoggedOut: Story;
12
- export declare const LoggedIn: Story;
@@ -1,24 +0,0 @@
1
- import { expect, userEvent, within } from '@storybook/test';
2
- import { Page } from './Page';
3
- const meta = {
4
- title: 'Example/Page',
5
- component: Page,
6
- parameters: {
7
- // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
8
- layout: 'fullscreen',
9
- },
10
- };
11
- export default meta;
12
- export const LoggedOut = {};
13
- // More on component testing: https://storybook.js.org/docs/writing-tests/component-testing
14
- export const LoggedIn = {
15
- play: async ({ canvasElement }) => {
16
- const canvas = within(canvasElement);
17
- const loginButton = canvas.getByRole('button', { name: /Log in/i });
18
- await expect(loginButton).toBeInTheDocument();
19
- await userEvent.click(loginButton);
20
- await expect(loginButton).not.toBeInTheDocument();
21
- const logoutButton = canvas.getByRole('button', { name: /Log out/i });
22
- await expect(logoutButton).toBeInTheDocument();
23
- },
24
- };
@@ -1,5 +0,0 @@
1
- import { SIZES, THEME_COLORS_BY_HEX, THEME_COLORS_BY_NAME } from '../../models/theme';
2
- export declare const themeColors: (color: THEME_COLORS_BY_HEX | THEME_COLORS_BY_NAME) => any;
3
- export declare const themeSpacing: (size: SIZES) => any;
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 '../theme';
2
- import { rem } from './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
- };
@@ -1,3 +0,0 @@
1
- export declare const relUnit: (absoluteUnit: number) => number;
2
- export declare const rem: (absoluteUnit: number) => string;
3
- export declare const em: (absoluteUnit: number) => string;
@@ -1,3 +0,0 @@
1
- export const relUnit = (absoluteUnit) => absoluteUnit / 16;
2
- export const rem = (absoluteUnit) => `${relUnit(absoluteUnit)}rem`;
3
- export const em = (absoluteUnit) => `${relUnit(absoluteUnit)}em`;
@@ -1,48 +0,0 @@
1
- import { css } from 'styled-components';
2
- import { em, rem } from './mixins/units';
3
- import { themeColors, themeSpacing, themeBorderRadius, themeElevation } from './mixins/theme-mixins';
4
- export { themeColors, themeSpacing, themeBorderRadius, themeElevation, em, rem };
5
- export declare const media: {
6
- XS: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
7
- S: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
8
- S_ALT: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
9
- M: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
10
- L: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
11
- XL: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
12
- XXL: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
13
- IOS: (styles: import("styled-components/dist/types").Styles<object>, ...interpolations: import("styled-components").Interpolation<object>[]) => import("styled-components").RuleSet<object>;
14
- };
15
- export declare const siteWidthRowS: () => import("styled-components").RuleSet<object>;
16
- export declare const siteWidthRow: () => import("styled-components").RuleSet<object>;
17
- export declare const siteWidthRowXL: () => import("styled-components").RuleSet<object>;
18
- export declare const fullWidthRow: () => import("styled-components").RuleSet<object>;
19
- export declare const fontSize: {
20
- XS: () => import("styled-components").RuleSet<object>;
21
- S: () => import("styled-components").RuleSet<object>;
22
- M: () => import("styled-components").RuleSet<object>;
23
- L: () => import("styled-components").RuleSet<object>;
24
- XL: () => import("styled-components").RuleSet<object>;
25
- XXL: () => import("styled-components").RuleSet<object>;
26
- };
27
- export declare const buttonSize: {
28
- S: () => import("styled-components").RuleSet<object>;
29
- M: () => import("styled-components").RuleSet<object>;
30
- L: () => import("styled-components").RuleSet<object>;
31
- };
32
- export declare const alertTheme: {
33
- error: () => import("styled-components").RuleSet<object>;
34
- warning: () => import("styled-components").RuleSet<object>;
35
- info: () => import("styled-components").RuleSet<object>;
36
- success: () => import("styled-components").RuleSet<object>;
37
- default: () => import("styled-components").RuleSet<object>;
38
- };
39
- export declare const boxShadow: {
40
- default: () => import("styled-components").RuleSet<object>;
41
- };
42
- export declare const buttonLinkStyling: {
43
- inverted: () => import("styled-components").RuleSet<object>;
44
- text: () => import("styled-components").RuleSet<object>;
45
- };
46
- export declare const linkStyling: ({ fontSize }: {
47
- fontSize?: number;
48
- }) => import("styled-components").RuleSet<object>;