@madie/madie-design-system 1.2.62 → 2.0.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.
- package/.eslintrc.js +1 -1
- package/.storybook/.babelrc +2 -1
- package/.storybook/main.js +3 -11
- package/components/AutoComplete/AutoComplete.jsx +1 -1
- package/components/Button/Button.stories.js +0 -2
- package/components/DateField/DateField.jsx +1 -1
- package/components/DateField/DateField.stories.jsx +23 -10
- package/components/DateTimeField/DateTimeField.jsx +6 -2
- package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
- package/components/Instant/Instant.stories.js +14 -6
- package/components/MadieAlert/MadieAlert.stories.js +35 -29
- package/components/MadieAlert/index.jsx +5 -5
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -27
- package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -18
- package/components/MadieDialog/MadieDialog.stories.js +45 -116
- package/components/MadieDialog/index.jsx +4 -2
- package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -7
- package/components/MadieSpinner/MadieSpinner.stories.js +1 -3
- package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
- package/components/Modal/Modal.stories.js +18 -89
- package/components/NotificationBanner/NotificationBanner.stories.js +17 -11
- package/components/NotificationBanner/index.js +3 -3
- package/components/NumberInput/NumberInput.stories.js +51 -63
- package/components/Popover/Popover.stories.js +6 -14
- package/components/Popover/index.js +2 -2
- package/components/RadioButton/RadioButton.jsx +4 -2
- package/components/RadioButton/RadioButton.stories.jsx +6 -2
- package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +4 -3
- package/components/ReadOnlyTextField/index.jsx +1 -1
- package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
- package/components/RichTextEditor/index.jsx +14 -15
- package/components/Search/Search.stories.js +2 -4
- package/components/Select/Select.stories.js +59 -160
- package/components/Select/index.jsx +1 -1
- package/components/Tabs/Tabs.stories.js +78 -210
- package/components/TextArea/TextArea.stories.js +88 -108
- package/components/TextArea/index.jsx +1 -1
- package/components/TextField/TextField.stories.js +101 -124
- package/components/TextField/index.jsx +1 -1
- package/components/TimeField/TimeField.stories.js +18 -8
- package/components/Toast/Toast.stories.js +42 -102
- package/components/TruncateText/TruncateText.stories.js +22 -17
- package/components/hooks/useGetConfig.js +2 -2
- package/components/index.js +0 -24
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +182 -51
- package/dist/react/index.js.LICENSE.txt +27 -24
- package/dist/react/index.js.map +1 -1
- package/eslint.config.js +56 -0
- package/index.js +7 -9
- package/package.json +43 -75
- package/test/components/Accordion.test.js +1 -1
- package/test/components/AutoComplete.test.js +11 -6
- package/test/components/Button.test.js +7 -3
- package/test/components/DateField.test.js +25 -29
- package/test/components/DateTimeField.test.js +21 -25
- package/test/components/Instant.test.js +1 -1
- package/test/components/MadieAlert.test.js +22 -22
- package/test/components/MadieConfirmDialog.test.js +42 -64
- package/test/components/MadieDeleteDialog.test.js +51 -69
- package/test/components/MadieDialog.test.js +13 -13
- package/test/components/MadieDiscardDialog.test.js +28 -45
- package/test/components/MadieSpinner.test.js +12 -17
- package/test/components/Modal.test.js +115 -0
- package/test/components/Pagination.test.js +2 -2
- package/test/components/RadioButton.test.js +7 -7
- package/test/components/ReadOnlyTextField.test.js +4 -2
- package/test/components/RichTextEditor.test.js +90 -6
- package/test/components/Search.test.js +75 -0
- package/test/components/Select.test.js +97 -107
- package/test/components/Tabs.test.js +22 -24
- package/test/components/TextArea.test.js +78 -92
- package/test/components/TextField.test.js +128 -147
- package/test/components/Toast.test.js +67 -78
- package/test/components/TruncateText.test.js +75 -0
- package/test/components/index.test.js +23 -0
- package/webpack.config.js +0 -1
- package/.eslintignore +0 -5
- package/components/Alert/Alert.stories.js +0 -70
- package/components/Alert/index.js +0 -55
- package/components/Breadcrumb/Breadcrumb.md +0 -28
- package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
- package/components/Breadcrumb/index.js +0 -92
- package/components/CalloutBox/CalloutBox.stories.js +0 -94
- package/components/CalloutBox/index.js +0 -109
- package/components/Card/Card.stories.js +0 -163
- package/components/Card/index.js +0 -144
- package/components/Dropdown/Dropdown.stories.js +0 -94
- package/components/Dropdown/index.js +0 -85
- package/components/Error/Collapsible.jsx +0 -93
- package/components/Error/ErrorUI.jsx +0 -31
- package/components/Error/error.js +0 -26
- package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
- package/components/FlashNotification/index.js +0 -30
- package/components/Footer/Footer.stories.js +0 -20
- package/components/Footer/FooterUI.jsx +0 -137
- package/components/Footer/LegacyFooterUI.jsx +0 -204
- package/components/Footer/SocialLinks.jsx +0 -63
- package/components/Footer/Subscribe.jsx +0 -34
- package/components/Footer/footer.js +0 -30
- package/components/Infotip/Infotip.jsx +0 -75
- package/components/Infotip/Infotip.stories.js +0 -52
- package/components/Infotip/InfotipIcon.jsx +0 -41
- package/components/Infotip/index.js +0 -3
- package/components/Link/Link.stories.js +0 -82
- package/components/Link/index.js +0 -61
- package/components/Spinner/index.js +0 -9
- package/components/TextInput/TextInput.stories.js +0 -118
- package/components/TextInput/index.js +0 -137
- package/components/Tooltip/Tooltip.jsx +0 -88
- package/components/Tooltip/Tooltip.stories.js +0 -80
- package/components/Tooltip/index.js +0 -3
- package/components/Tooltip/position.js +0 -76
- package/test/components/ErrorUI.test.js +0 -32
- package/test/components/FooterUI.test.js +0 -122
- package/test/components/Infotip.test.js +0 -76
- package/test/components/Tooltip.test.js +0 -147
|
@@ -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;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
|
-
|
|
4
|
-
import Card from "./index";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Card",
|
|
8
|
-
component: Card,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const Default = () => {
|
|
13
|
-
return (
|
|
14
|
-
<div className="qpp-u-padding--12 qpp-u-width--33">
|
|
15
|
-
<Card
|
|
16
|
-
title="Card Heading"
|
|
17
|
-
eyebrow="Eyebrow"
|
|
18
|
-
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
|
|
19
|
-
cta={{
|
|
20
|
-
text: "Call to Action",
|
|
21
|
-
href: "#",
|
|
22
|
-
}}
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const CustomButton = () => (
|
|
29
|
-
<div className="qpp-u-padding--12 qpp-u-width--33">
|
|
30
|
-
<Card
|
|
31
|
-
title="Card Heading"
|
|
32
|
-
eyebrow="Eyebrow"
|
|
33
|
-
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
|
|
34
|
-
cta={
|
|
35
|
-
<button
|
|
36
|
-
className="qpp-c-button"
|
|
37
|
-
onClick={() => console.log("I've been clicked")}
|
|
38
|
-
style={{
|
|
39
|
-
padding: "0.75rem 1rem",
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
Click me
|
|
43
|
-
</button>
|
|
44
|
-
}
|
|
45
|
-
/>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
export const Image = () => (
|
|
50
|
-
<div className="qpp-u-padding--12 qpp-u-width--33">
|
|
51
|
-
<Card
|
|
52
|
-
title="Card Heading"
|
|
53
|
-
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
|
|
54
|
-
eyebrow="Eyebrow"
|
|
55
|
-
cta={{
|
|
56
|
-
text: "Call to Action",
|
|
57
|
-
href: "#",
|
|
58
|
-
}}
|
|
59
|
-
img={{
|
|
60
|
-
url: "https://qpp.cms.gov/images/public/images/resource-data-submission-mips.png",
|
|
61
|
-
alt: "Card image alt",
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
export const SmallImageCard = () => (
|
|
68
|
-
<div className="qpp-u-padding--12 wrap qpp-u-width--25">
|
|
69
|
-
<Card
|
|
70
|
-
title="Card Heading"
|
|
71
|
-
eyebrow="Eyebrow"
|
|
72
|
-
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
|
|
73
|
-
size="small"
|
|
74
|
-
cta={{
|
|
75
|
-
text: "Call to Action",
|
|
76
|
-
href: "#",
|
|
77
|
-
}}
|
|
78
|
-
img={{
|
|
79
|
-
url: "https://qpp.cms.gov/images/public/images/resource-data-submission-mips.png",
|
|
80
|
-
alt: "Card image alt",
|
|
81
|
-
}}
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
export const MediumImageCard = () => (
|
|
87
|
-
<div className="qpp-u-padding--12 wrap qpp-u-width--33">
|
|
88
|
-
<Card
|
|
89
|
-
title="Card Heading"
|
|
90
|
-
eyebrow="Eyebrow"
|
|
91
|
-
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
|
|
92
|
-
size="medium"
|
|
93
|
-
cta={{
|
|
94
|
-
text: "Call to Action",
|
|
95
|
-
href: "#",
|
|
96
|
-
}}
|
|
97
|
-
img={{
|
|
98
|
-
url: "https://qpp.cms.gov/images/public/images/resource-data-submission-mips.png",
|
|
99
|
-
alt: "Card image alt",
|
|
100
|
-
}}
|
|
101
|
-
/>
|
|
102
|
-
</div>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export const LargeImageCard = () => (
|
|
106
|
-
<div className="qpp-u-padding--12 wrap qpp-u-width--100">
|
|
107
|
-
<Card
|
|
108
|
-
title="Card Heading"
|
|
109
|
-
eyebrow="Eyebrow"
|
|
110
|
-
variant="flag"
|
|
111
|
-
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
|
|
112
|
-
size="large"
|
|
113
|
-
cta={{
|
|
114
|
-
text: "Call to Action",
|
|
115
|
-
href: "#",
|
|
116
|
-
}}
|
|
117
|
-
img={{
|
|
118
|
-
url: "https://qpp.cms.gov/images/public/images/resource-data-submission-mips.png",
|
|
119
|
-
alt: "Card image alt",
|
|
120
|
-
}}
|
|
121
|
-
/>
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
export const ResponsiveFlagCard = () => (
|
|
126
|
-
<div className="qpp-u-padding--12 wrap qpp-u-width--100">
|
|
127
|
-
<Card
|
|
128
|
-
title="Card Heading"
|
|
129
|
-
eyebrow="Eyebrow"
|
|
130
|
-
responsive
|
|
131
|
-
variant="flag"
|
|
132
|
-
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet justo et lacus lacinia tristique. Nulla dignissim ipsum sit amet posuere interdum."
|
|
133
|
-
size="large"
|
|
134
|
-
cta={{
|
|
135
|
-
text: "Call to Action",
|
|
136
|
-
href: "#",
|
|
137
|
-
}}
|
|
138
|
-
img={{
|
|
139
|
-
url: "https://qpp.cms.gov/images/public/images/resource-data-submission-mips.png",
|
|
140
|
-
alt: "Card image alt",
|
|
141
|
-
}}
|
|
142
|
-
/>
|
|
143
|
-
</div>
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
export const BackgroundImageCard = () => (
|
|
147
|
-
<div className="qpp-u-padding--12 wrap qpp-u-width--33">
|
|
148
|
-
<Card
|
|
149
|
-
className="qpp-c-card--medium qpp-c-card--image qpp-c-xs-card--flag qpp-c-sm-card--default qpp-u-flex--auto qpp-u-sm-flex--1"
|
|
150
|
-
title="QPP Access User Guide"
|
|
151
|
-
description="Download zip file"
|
|
152
|
-
cta={{
|
|
153
|
-
text: "Call to Action",
|
|
154
|
-
href: "#",
|
|
155
|
-
}}
|
|
156
|
-
img={{
|
|
157
|
-
url: "https://qpp.cms.gov/images/public/images/resource-pdf.png",
|
|
158
|
-
alt: "Card image alt",
|
|
159
|
-
useBgImage: true,
|
|
160
|
-
}}
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
);
|