@madie/madie-design-system 1.2.62 → 2.0.1

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 (156) hide show
  1. package/.babelrc +14 -2
  2. package/.eslintrc.js +1 -1
  3. package/.storybook/.babelrc +2 -1
  4. package/.storybook/main.js +3 -11
  5. package/.storybook/preview.js +1 -1
  6. package/components/Accordion/index.jsx +32 -36
  7. package/components/AutoComplete/AutoComplete.jsx +2 -17
  8. package/components/Button/Button.stories.js +0 -7
  9. package/components/Button/index.js +34 -44
  10. package/components/DateField/DateField.jsx +2 -15
  11. package/components/DateField/DateField.stories.jsx +23 -10
  12. package/components/DateTimeField/DateTimeField.jsx +7 -11
  13. package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
  14. package/components/InputLabel/index.jsx +1 -6
  15. package/components/Instant/Instant.stories.js +14 -6
  16. package/components/Instant/index.jsx +0 -16
  17. package/components/Link/index.js +14 -33
  18. package/components/MadieAlert/MadieAlert.stories.js +35 -29
  19. package/components/MadieAlert/index.jsx +5 -44
  20. package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -32
  21. package/components/MadieConfirmDialog/index.jsx +0 -8
  22. package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -24
  23. package/components/MadieDeleteDialog/index.jsx +0 -7
  24. package/components/MadieDialog/MadieDialog.stories.js +45 -121
  25. package/components/MadieDialog/index.jsx +4 -23
  26. package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -12
  27. package/components/MadieDiscardDialog/index.jsx +0 -7
  28. package/components/MadieSpinner/MadieSpinner.stories.js +1 -9
  29. package/components/MadieSpinner/index.jsx +0 -5
  30. package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
  31. package/components/MadieTooltip/index.jsx +0 -6
  32. package/components/MadieTooltipIcon/index.jsx +0 -5
  33. package/components/Modal/Modal.jsx +31 -43
  34. package/components/Modal/Modal.stories.js +18 -89
  35. package/components/Modal/index.jsx +6 -8
  36. package/components/NumberInput/NumberInput.stories.js +50 -67
  37. package/components/NumberInput/index.jsx +0 -13
  38. package/components/Pagination/index.jsx +0 -17
  39. package/components/Popover/Popover.stories.js +6 -14
  40. package/components/Popover/index.js +0 -23
  41. package/components/RadioButton/RadioButton.jsx +5 -15
  42. package/components/RadioButton/RadioButton.stories.jsx +6 -2
  43. package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +3 -8
  44. package/components/ReadOnlyTextField/index.jsx +1 -9
  45. package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
  46. package/components/RichTextEditor/index.jsx +14 -30
  47. package/components/SanitizedContent/index.jsx +0 -8
  48. package/components/Search/Search.stories.js +2 -4
  49. package/components/Search/index.js +26 -40
  50. package/components/Select/Select.stories.js +59 -164
  51. package/components/Select/index.jsx +2 -17
  52. package/components/Tabs/Tab.js +29 -25
  53. package/components/Tabs/TabPanel.js +15 -19
  54. package/components/Tabs/Tabs.stories.js +43 -211
  55. package/components/Tabs/index.js +10 -28
  56. package/components/TextArea/TextArea.stories.js +87 -113
  57. package/components/TextArea/index.jsx +2 -14
  58. package/components/TextField/TextField.stories.js +100 -129
  59. package/components/TextField/index.jsx +2 -17
  60. package/components/TimeField/TimeField.jsx +0 -10
  61. package/components/TimeField/TimeField.stories.js +18 -8
  62. package/components/Toast/Toast.stories.js +42 -102
  63. package/components/Toast/index.jsx +0 -14
  64. package/components/TruncateText/TruncateText.stories.js +22 -17
  65. package/components/TruncateText/index.js +0 -8
  66. package/components/hooks/useGetConfig.js +2 -2
  67. package/components/{index.js → index.mjs} +37 -57
  68. package/dist/index.js +3 -1
  69. package/dist/index.js.LICENSE.txt +16 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/react/index.html +1 -1
  72. package/dist/react/index.mjs +103 -0
  73. package/dist/react/{index.js.LICENSE.txt → index.mjs.LICENSE.txt} +3 -52
  74. package/dist/react/index.mjs.map +1 -0
  75. package/dist/react/package.json +1 -0
  76. package/eslint.config.cjs +59 -0
  77. package/index.js +7 -9
  78. package/jest.config.mjs +10 -0
  79. package/lib/Chevron.jsx +2 -10
  80. package/package.json +57 -82
  81. package/styles/_main.scss +4 -3
  82. package/test/components/Accordion.test.js +1 -1
  83. package/test/components/AutoComplete.test.js +11 -6
  84. package/test/components/Button.test.js +13 -19
  85. package/test/components/DateField.test.js +25 -29
  86. package/test/components/DateTimeField.test.js +21 -25
  87. package/test/components/Instant.test.js +1 -1
  88. package/test/components/MadieAlert.test.js +22 -22
  89. package/test/components/MadieConfirmDialog.test.js +42 -64
  90. package/test/components/MadieDeleteDialog.test.js +51 -69
  91. package/test/components/MadieDialog.test.js +13 -13
  92. package/test/components/MadieDiscardDialog.test.js +28 -45
  93. package/test/components/MadieSpinner.test.js +12 -17
  94. package/test/components/Modal.test.js +115 -0
  95. package/test/components/Pagination.test.js +2 -2
  96. package/test/components/RadioButton.test.js +7 -7
  97. package/test/components/ReadOnlyTextField.test.js +4 -2
  98. package/test/components/RichTextEditor.test.js +90 -6
  99. package/test/components/Search.test.js +75 -0
  100. package/test/components/Select.test.js +97 -107
  101. package/test/components/Tabs.test.js +22 -24
  102. package/test/components/TextArea.test.js +78 -92
  103. package/test/components/TextField.test.js +128 -147
  104. package/test/components/Toast.test.js +67 -78
  105. package/test/components/TruncateText.test.js +75 -0
  106. package/test/components/index.test.js +23 -0
  107. package/webpack.config.mjs +79 -0
  108. package/webpack.config.react.mjs +72 -0
  109. package/.eslintignore +0 -5
  110. package/components/Alert/Alert.stories.js +0 -70
  111. package/components/Alert/index.js +0 -55
  112. package/components/Breadcrumb/Breadcrumb.md +0 -28
  113. package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
  114. package/components/Breadcrumb/index.js +0 -92
  115. package/components/CalloutBox/CalloutBox.stories.js +0 -94
  116. package/components/CalloutBox/index.js +0 -109
  117. package/components/Card/Card.stories.js +0 -163
  118. package/components/Card/index.js +0 -144
  119. package/components/Dropdown/Dropdown.stories.js +0 -94
  120. package/components/Dropdown/index.js +0 -85
  121. package/components/Error/Collapsible.jsx +0 -93
  122. package/components/Error/ErrorUI.jsx +0 -31
  123. package/components/Error/error.js +0 -26
  124. package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
  125. package/components/FlashNotification/index.js +0 -30
  126. package/components/Footer/Footer.stories.js +0 -20
  127. package/components/Footer/FooterUI.jsx +0 -137
  128. package/components/Footer/LegacyFooterUI.jsx +0 -204
  129. package/components/Footer/SocialLinks.jsx +0 -63
  130. package/components/Footer/Subscribe.jsx +0 -34
  131. package/components/Footer/footer.js +0 -30
  132. package/components/Infotip/Infotip.jsx +0 -75
  133. package/components/Infotip/Infotip.stories.js +0 -52
  134. package/components/Infotip/InfotipIcon.jsx +0 -41
  135. package/components/Infotip/index.js +0 -3
  136. package/components/Link/Link.stories.js +0 -82
  137. package/components/NotificationBanner/NotificationBanner.stories.js +0 -23
  138. package/components/NotificationBanner/index.js +0 -279
  139. package/components/Spinner/index.js +0 -9
  140. package/components/TextInput/TextInput.stories.js +0 -118
  141. package/components/TextInput/index.js +0 -137
  142. package/components/Tooltip/Tooltip.jsx +0 -88
  143. package/components/Tooltip/Tooltip.stories.js +0 -80
  144. package/components/Tooltip/index.js +0 -3
  145. package/components/Tooltip/position.js +0 -76
  146. package/components/UnwrappedSpinner/index.js +0 -8
  147. package/dist/browser.js +0 -1
  148. package/dist/react/index.js +0 -185
  149. package/dist/react/index.js.map +0 -1
  150. package/jest.config.js +0 -17
  151. package/test/components/ErrorUI.test.js +0 -32
  152. package/test/components/FooterUI.test.js +0 -122
  153. package/test/components/Infotip.test.js +0 -76
  154. package/test/components/Tooltip.test.js +0 -147
  155. package/webpack.config.js +0 -124
  156. package/webpack.config.react.js +0 -104
@@ -0,0 +1,79 @@
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ import MiniCssExtractPlugin from "mini-css-extract-plugin";
4
+ import TerserPlugin from "terser-webpack-plugin";
5
+ // import pkg from "./package.json" assert { type: "json" };
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ const entry = ["./index.js"];
11
+
12
+ const _module = {
13
+ rules: [
14
+ {
15
+ test: /\.(js|jsx)?$/,
16
+ exclude: /node_modules/,
17
+ use: {
18
+ loader: "babel-loader"
19
+ }
20
+ },
21
+ {
22
+ test: /\.scss$/,
23
+ use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
24
+ exclude: /node_modules/,
25
+ },
26
+ {
27
+ test: /\.(ttf|eot|woff|otf|woff2)$/,
28
+ loader: "file-loader",
29
+ options: {
30
+ name: "fonts/[name].[ext]",
31
+ },
32
+ },
33
+ {
34
+ test: /\.svg$/,
35
+ use: ["raw-loader", "svgo-loader"],
36
+ },
37
+ ],
38
+ };
39
+
40
+ const plugins = [
41
+ new MiniCssExtractPlugin({ filename: "style.css" })
42
+ ];
43
+
44
+ const resolve = {
45
+ extensions: [".js", ".jsx", ".json", ".svg"],
46
+ };
47
+
48
+ const optimization = {
49
+ minimize: true,
50
+ minimizer: [new TerserPlugin()],
51
+ };
52
+
53
+ export default {
54
+ mode: "production",
55
+ entry,
56
+ output: {
57
+ path: path.resolve(__dirname, "dist"),
58
+ filename: "index.js",
59
+ module: true,
60
+ library: {
61
+ type: "module",
62
+ },
63
+ environment: {
64
+ module: true,
65
+ },
66
+ },
67
+ experiments: {
68
+ outputModule: true,
69
+ },
70
+ devtool: "source-map",
71
+ module: _module,
72
+ plugins,
73
+ resolve,
74
+ optimization,
75
+ externals: {
76
+ react: "react",
77
+ "react-dom": "react-dom"
78
+ }
79
+ };
@@ -0,0 +1,72 @@
1
+ import path from "path";
2
+ import MiniCssExtractPlugin from "mini-css-extract-plugin";
3
+ import TerserPlugin from "terser-webpack-plugin";
4
+ import HtmlWebpackPlugin from "html-webpack-plugin";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ const _module = {
11
+ rules: [
12
+ {
13
+ test: /\.(js|jsx)?$/,
14
+ exclude: /node_modules/,
15
+ use: {
16
+ loader: "babel-loader"
17
+ }
18
+ },
19
+ {
20
+ test: /\.scss$/,
21
+ use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
22
+ exclude: /node_modules/,
23
+ },
24
+ {
25
+ test: /\.(ttf|eot|woff|otf|woff2)$/,
26
+ loader: "file-loader",
27
+ options: {
28
+ name: "fonts/[name].[ext]",
29
+ },
30
+ },
31
+ {
32
+ test: /\.svg$/,
33
+ use: ["raw-loader", "svgo-loader"],
34
+ },
35
+ ],
36
+ };
37
+
38
+ export default {
39
+ mode: "production",
40
+ entry: "./components/index.mjs",
41
+ output: {
42
+ filename: "index.mjs",
43
+ path: path.resolve(__dirname, "dist/react"),
44
+ module: true,
45
+ library: {
46
+ type: "module",
47
+ },
48
+ environment: {
49
+ module: true,
50
+ },
51
+ },
52
+ experiments: {
53
+ outputModule: true,
54
+ },
55
+ devtool: "source-map",
56
+ module: _module,
57
+ plugins: [
58
+ new MiniCssExtractPlugin({ filename: "style.css" }),
59
+ new HtmlWebpackPlugin(),
60
+ ],
61
+ resolve: {
62
+ extensions: [".js", ".jsx", ".json", ".svg"],
63
+ },
64
+ optimization: {
65
+ minimize: true,
66
+ minimizer: [new TerserPlugin()],
67
+ },
68
+ externals: {
69
+ react: "react",
70
+ "react-dom": "react-dom"
71
+ }
72
+ };
package/.eslintignore DELETED
@@ -1,5 +0,0 @@
1
- _*
2
- css
3
- dist
4
- node_modules
5
- test
@@ -1,70 +0,0 @@
1
- import React from "react";
2
-
3
- import Alert from "./index";
4
-
5
- export default {
6
- title: "Alert",
7
- component: Alert,
8
- };
9
-
10
- export const Default = () => (
11
- <div className="qpp-u-padding--16">
12
- <h1 className="h3">Information</h1>
13
- <Alert
14
- title="Information Alert"
15
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu eleifend gravida."
16
- />
17
- <h2 className="h3">Warning</h2>
18
- <Alert
19
- variant="warning"
20
- title={{ headingLevel: "h3", text: "Warning Alert" }}
21
- >
22
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
23
- imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu
24
- eleifend gravida.
25
- </Alert>
26
- <h2 className="h3">Error</h2>
27
- <Alert
28
- variant="error"
29
- title={{ headingLevel: "h3", text: "Error Alert" }}
30
- >
31
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
32
- imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu
33
- eleifend gravida.
34
- </Alert>
35
- <h2 className="h3">Success</h2>
36
- <Alert
37
- variant="success"
38
- title={{ headingLevel: "h3", text: "Success Alert" }}
39
- >
40
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
41
- imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu
42
- eleifend gravida.
43
- </Alert>
44
- </div>
45
- );
46
-
47
- export const WithoutHeading = () => (
48
- <div className="qpp-u-padding--16">
49
- <h1 className="h3">Information</h1>
50
- <Alert description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu eleifend gravida." />
51
- <h1 className="h3">Warning</h1>
52
- <Alert variant="warning">
53
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
54
- imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu
55
- eleifend gravida.
56
- </Alert>
57
- <h1 className="h3">Error</h1>
58
- <Alert variant="error">
59
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
60
- imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu
61
- eleifend gravida.
62
- </Alert>
63
- <h1 className="h3">Success</h1>
64
- <Alert variant="success">
65
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
66
- imperdiet consequat ex ut vestibulum. Sed vel erat aliquet arcu
67
- eleifend gravida.
68
- </Alert>
69
- </div>
70
- );
@@ -1,55 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
-
4
- const Alert = ({
5
- title,
6
- children,
7
- description,
8
- variant,
9
- className,
10
- ...rest
11
- }) => {
12
- const HeadingComponent = title?.headingLevel || "h2";
13
- return (
14
- <div
15
- className={`qpp-c-alert qpp-c-alert--${variant} ${className}`}
16
- role="alert"
17
- {...rest}
18
- >
19
- <div className="qpp-c-alert__body">
20
- {title && (
21
- <HeadingComponent className="h4 qpp-c-alert__heading">
22
- {typeof title === "object" ? title.text : title}
23
- </HeadingComponent>
24
- )}
25
- {description && (
26
- <p className="qpp-c-alert__text">{description}</p>
27
- )}
28
- {children}
29
- </div>
30
- </div>
31
- );
32
- };
33
-
34
- Alert.propTypes = {
35
- children: PropTypes.node,
36
- className: PropTypes.string,
37
- description: PropTypes.string,
38
- title: PropTypes.oneOfType([
39
- PropTypes.string,
40
- PropTypes.shape({
41
- text: PropTypes.string,
42
- headingLevel: PropTypes.string,
43
- }),
44
- ]),
45
- variant: PropTypes.oneOf(["info", "warning", "success", "error"]),
46
- };
47
- Alert.defaultProps = {
48
- children: null,
49
- className: "",
50
- description: null,
51
- title: null,
52
- variant: "info",
53
- };
54
-
55
- export default Alert;
@@ -1,28 +0,0 @@
1
- # Breadcrumb Component
2
-
3
- The Breadcrumb component is a secondary navigation scheme that reveals the user's location.
4
-
5
- ### Props
6
-
7
- | Property name | Type | Required | Default Value | Description |
8
- | --------------------- | ---------- | -------- | ------------- | ----------------------------------------- |
9
- | `breadcrumbClass` | `String` | `false` | '' | class to append to Breadcrumb nav element |
10
- | `crumbs` | `Array` | `true` | | array of breadcrumbs |
11
- | `dark` | `Boolean` | `false` | `false` | Use dark mode theme |
12
- | `RouterLink` | `Function` | `false` | `null` | Link component to use instead of `<a>` |
13
- | `routerExcludedLinks` | `Array` | `false` | `[]` | Array of paths to exclude from using Link |
14
-
15
- ### Crumbs
16
-
17
- Each crumb can be a string or an object with the following properties.
18
-
19
- | Property name | Type | Required | Description |
20
- | ------------- | -------- | -------- | -------------------------- |
21
- | `url` | `String` | `true` | url |
22
- | `title` | `String` | `true` | Menu item string displayed |
23
- | `category` | `String` | `true` | Data tracking category |
24
- | `label` | `String` | `true` | Data tracking label |
25
-
26
- ### RouterLink
27
-
28
- The `RouterLink` is only used by the Frontend to enable using push state for navigation. The `routerExcludedLinks` provides a way to opt certain links out of using the RouterLink.
@@ -1,76 +0,0 @@
1
- import React from "react";
2
- import Breadcrumb from "./index";
3
- import { withKnobs, boolean } from "@storybook/addon-knobs";
4
-
5
- export default {
6
- title: "Breadcrumb",
7
- component: Breadcrumb,
8
- decorators: [withKnobs],
9
- };
10
-
11
- export const ExampleLightBreadcrumb = () => (
12
- <div className="qppds qpp-u-padding--16 qpp-u-fill--blue-80">
13
- <Breadcrumb
14
- newBreadcrumb={boolean("newBreadcrumb", true)}
15
- crumbs={[
16
- {
17
- url: "/",
18
- category: "MainContent",
19
- label: "Home",
20
- title: "Home",
21
- },
22
- {
23
- url: "/",
24
- category: "MainContent",
25
- label: "Mips Overview",
26
- title: "Mips Overview",
27
- },
28
- ]}
29
- />
30
- </div>
31
- );
32
-
33
- ExampleLightBreadcrumb.storyName = "Light";
34
-
35
- export const ExampleScreenreaderOnlyBreadcrumb = () => (
36
- <div className="qppds qpp-u-padding--16 qpp-u-fill--blue-80">
37
- <Breadcrumb
38
- newBreadcrumb={boolean("newBreadcrumb", true)}
39
- crumbs={[
40
- {
41
- url: "/",
42
- category: "MainContent",
43
- label: "Home",
44
- title: "Home",
45
- },
46
- "Mips Overview",
47
- ]}
48
- />
49
- </div>
50
- );
51
- ExampleScreenreaderOnlyBreadcrumb.storyName = "SR Only Breadcrumb";
52
-
53
- export const ExampleDarkBreadcrumb = () => (
54
- <div className="qppds qpp-u-padding--16">
55
- <Breadcrumb
56
- newBreadcrumb={boolean("newBreadcrumb", true)}
57
- dark
58
- crumbs={[
59
- {
60
- url: "/",
61
- category: "MainContent",
62
- label: "Home",
63
- title: "Home",
64
- },
65
- {
66
- url: "/",
67
- category: "MainContent",
68
- label: "Mips Overview",
69
- title: "Mips Overview",
70
- },
71
- ]}
72
- />
73
- </div>
74
- );
75
-
76
- ExampleDarkBreadcrumb.storyName = "Dark";
@@ -1,92 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
-
4
- const Breadcrumb = ({
5
- breadcrumbClass,
6
- crumbs,
7
- dark,
8
- RouterLink,
9
- routerExcludedLinks,
10
- }) => {
11
- return (
12
- <nav
13
- className={`qpp-c-breadcrumbs ${
14
- !dark ? "qpp-c-breadcrumbs--light" : ""
15
- } ${breadcrumbClass}`}
16
- aria-label="Breadcrumbs"
17
- >
18
- <ol className="qpp-c-breadcrumbs__list">
19
- {crumbs.map((crumb, i) => {
20
- if (crumb.url) {
21
- if (
22
- RouterLink &&
23
- !routerExcludedLinks.includes(crumb.url)
24
- ) {
25
- return (
26
- <li
27
- className="qpp-c-breadcrumbs__list-item"
28
- key={crumb.title}
29
- >
30
- <RouterLink
31
- className="qpp-c-breadcrumbs__link"
32
- to={crumb.url}
33
- data-track-category={crumb.category}
34
- data-track-action="Click"
35
- data-track-label={crumb.label}
36
- >
37
- <span>{crumb.title}</span>
38
- </RouterLink>
39
- </li>
40
- );
41
- }
42
- return (
43
- <li
44
- className="qpp-c-breadcrumbs__list-item"
45
- key={crumb.title}
46
- >
47
- <a
48
- className="qpp-c-breadcrumbs__link"
49
- href={crumb.url}
50
- data-track-category={crumb.category}
51
- data-track-action="Click"
52
- data-track-label={crumb.label}
53
- >
54
- <span>{crumb.title}</span>
55
- </a>
56
- </li>
57
- );
58
- } else {
59
- return (
60
- <li
61
- key={crumb}
62
- className={`${
63
- i === crumbs.length - 1 ? "sr-only" : ""
64
- } qpp-c-breadcrumbs__list-itemqpp-c-breadcrumbs__list-item--current`}
65
- aria-current="page"
66
- >
67
- <span>{crumb}</span>
68
- </li>
69
- );
70
- }
71
- })}
72
- </ol>
73
- </nav>
74
- );
75
- };
76
-
77
- Breadcrumb.propTypes = {
78
- breadcrumbClass: PropTypes.string,
79
- crumbs: PropTypes.array.isRequired,
80
- dark: PropTypes.bool,
81
- RouterLink: PropTypes.func,
82
- routerExcludedLinks: PropTypes.array,
83
- };
84
-
85
- Breadcrumb.defaultProps = {
86
- breadcrumbClass: "",
87
- dark: false,
88
- RouterLink: null,
89
- routerExcludedLinks: [],
90
- };
91
-
92
- export default Breadcrumb;
@@ -1,94 +0,0 @@
1
- import React, { useState } from "react";
2
- import { withKnobs } from "@storybook/addon-knobs";
3
-
4
- import CalloutBox from "./index";
5
-
6
- export default {
7
- title: "CalloutBox",
8
- component: CalloutBox,
9
- decorators: [withKnobs],
10
- };
11
-
12
- export const Default = () => {
13
- return (
14
- <div className="qpp-u-padding--12" style={{ maxWidth: "80ch" }}>
15
- <CalloutBox
16
- title="Call to Action Heading"
17
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
18
- button={{
19
- text: "Call to Action",
20
- onClick: () => console.log("cta clicked"),
21
- }}
22
- />
23
- </div>
24
- );
25
- };
26
-
27
- export const WithHref = () => {
28
- return (
29
- <div className="qpp-u-padding--12" style={{ maxWidth: "80ch" }}>
30
- <CalloutBox
31
- title="Call to Action Heading"
32
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
33
- button={{
34
- text: "Call to Action",
35
- href: "https://example.com",
36
- }}
37
- />
38
- </div>
39
- );
40
- };
41
-
42
- export const WithTextInput = () => {
43
- const [value, setValue] = useState("");
44
- return (
45
- <div className="qpp-u-padding--12" style={{ maxWidth: "80ch" }}>
46
- <CalloutBox
47
- title="Call to Action Heading"
48
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
49
- input={{
50
- placeholder: "Placeholder",
51
- onChange: (e) => setValue(e.target.value),
52
- value,
53
- }}
54
- button={{
55
- text: "Call to Action",
56
- onClick: () => {
57
- console.log("cta clicked");
58
- console.log("input value --- ", value);
59
- },
60
- }}
61
- />
62
- </div>
63
- );
64
- };
65
-
66
- export const WithHeaderLevel = () => {
67
- return (
68
- <div className="qpp-u-padding--12" style={{ maxWidth: "80ch" }}>
69
- <CalloutBox
70
- title="H5 Heading"
71
- headerLevel={5}
72
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit."
73
- button={{
74
- text: "Call to Action",
75
- href: "https://example.com",
76
- }}
77
- />
78
- </div>
79
- );
80
- };
81
-
82
- export const WithButtonOverride = () => {
83
- const Button = () => <button>My custom button</button>;
84
- return (
85
- <div className="qpp-u-padding--12" style={{ maxWidth: "80ch" }}>
86
- <CalloutBox
87
- title="H5 Heading"
88
- headerLevel={5}
89
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit."
90
- button={<Button />}
91
- />
92
- </div>
93
- );
94
- };
@@ -1,109 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import FeatherIcon from "feather-icons-react";
4
-
5
- import Button from "../Button";
6
-
7
- const getCtaButton = (button) => {
8
- if (button) {
9
- if (React.isValidElement(button)) {
10
- return button;
11
- }
12
- if (button.href) {
13
- const { href, text, ...restLink } = button;
14
- return (
15
- <a
16
- className="qpp-c-button qpp-c-button--secondary qpp-c-button--icon-after"
17
- href={href}
18
- {...restLink}
19
- >
20
- {text}
21
- <FeatherIcon icon="chevron-right" />
22
- </a>
23
- );
24
- }
25
- const { onClick, text, ...restButton } = button;
26
- return (
27
- <Button
28
- variant="secondary"
29
- className="qpp-c-button--icon-after"
30
- onClick={onClick}
31
- {...restButton}
32
- >
33
- {text}
34
- <FeatherIcon icon="chevron-right" />
35
- </Button>
36
- );
37
- }
38
- return null;
39
- };
40
-
41
- const CalloutBox = ({
42
- title,
43
- description,
44
- button,
45
- input,
46
- children,
47
- headerLevel,
48
- }) => {
49
- const Header = `h${headerLevel}`;
50
- return (
51
- <aside className="qppds qpp-u-sm-padding--32 qpp-u-padding--24 qpp-u-fill--blue-70">
52
- {title && (
53
- <Header className="qpp-u-font-size--24 qpp-u-color--white qpp-u-margin-bottom--16 qpp-u-margin-top--0 qpp-u-font-weight--regular">
54
- {title}
55
- </Header>
56
- )}
57
- {description && (
58
- <p className="qpp-u-color--white qpp-u-margin-bottom--0 qpp-u-font-size--18">
59
- {description}
60
- </p>
61
- )}
62
- {children && (
63
- <div className="qpp-u-color--white qpp-u-margin-bottom--0 qpp-u-font-size--18">
64
- {children}
65
- </div>
66
- )}
67
- {(input || button) && (
68
- <div className="qpp-u-display--flex qpp-u-align-items--center qpp-u-flex-wrap--wrap qpp-u-margin-top--24">
69
- {input && (
70
- <input
71
- className="qpp-c-text-input qpp-u-sm-margin-right--16 qpp-u-margin-bottom--16 qpp-u-sm-margin-bottom--0 qpp-u-sm-width--auto qpp-u-width--100"
72
- type="text"
73
- {...input}
74
- />
75
- )}
76
- {getCtaButton(button)}
77
- </div>
78
- )}
79
- </aside>
80
- );
81
- };
82
-
83
- CalloutBox.propTypes = {
84
- title: PropTypes.string,
85
- description: PropTypes.string,
86
- button: PropTypes.shape({
87
- text: PropTypes.string,
88
- onClick: PropTypes.func,
89
- href: PropTypes.string,
90
- }),
91
- input: PropTypes.shape({
92
- value: PropTypes.string,
93
- name: PropTypes.string,
94
- id: PropTypes.string,
95
- }),
96
- children: PropTypes.node,
97
- headerLevel: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
98
- };
99
-
100
- CalloutBox.defaultProps = {
101
- title: null,
102
- description: null,
103
- button: null,
104
- input: null,
105
- children: null,
106
- headerLevel: 2,
107
- };
108
-
109
- export default CalloutBox;