@madie/madie-design-system 1.2.102 → 1.2.103
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/.babelrc +0 -1
- package/.storybook/main.mjs +38 -0
- package/README.md +18 -0
- package/components/Breadcrumb/Breadcrumb.stories.js +9 -8
- package/components/Button/Button.stories.js +0 -2
- package/components/CalloutBox/CalloutBox.stories.js +0 -2
- package/components/Card/Card.stories.js +0 -2
- package/components/DateField/DateField.stories.jsx +0 -2
- package/components/DateTimeField/DateTimeField.stories.jsx +0 -2
- package/components/Dropdown/Dropdown.stories.js +0 -2
- package/components/Footer/Footer.stories.js +11 -7
- package/components/HowItWorks/HowItWorks.stories.js +0 -2
- package/components/Infotip/Infotip.stories.js +3 -4
- package/components/Instant/Instant.stories.js +0 -2
- package/components/Link/Link.stories.js +0 -2
- package/components/MadieAlert/MadieAlert.stories.js +0 -2
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +0 -2
- package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +0 -2
- package/components/MadieDialog/MadieDialog.stories.js +0 -2
- package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +0 -2
- package/components/MadieSpinner/MadieSpinner.stories.js +0 -2
- package/components/MadieTable/MadieTable.stories.js +93 -0
- package/components/MadieTable/index.jsx +34 -8
- package/components/Modal/Modal.stories.js +19 -25
- package/components/NotificationBanner/NotificationBanner.stories.js +5 -4
- package/components/NumberInput/NumberInput.stories.js +0 -2
- package/components/Popover/Popover.stories.js +0 -2
- package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +0 -2
- package/components/RichTextEditor/RichTextEditor.stories.js +0 -2
- package/components/SearchAndFilter/index.jsx +1 -1
- package/components/Select/Select.stories.js +0 -2
- package/components/Tabs/Tabs.stories.js +0 -2
- package/components/TextArea/TextArea.stories.js +0 -2
- package/components/TextField/TextField.stories.js +0 -2
- package/components/TextInput/TextInput.stories.js +0 -2
- package/components/TimeField/TimeField.jsx +1 -1
- package/components/TimeField/TimeField.stories.js +0 -2
- package/components/Toast/Toast.stories.js +0 -2
- package/components/TruncateText/TruncateText.stories.js +0 -2
- package/components/TruncateText/index.js +12 -1
- package/components/index.js +0 -2
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +5 -5
- package/dist/react/index.js.LICENSE.txt +1 -1
- package/dist/react/index.js.map +1 -1
- package/jest.config.js +0 -4
- package/package.json +15 -25
- package/styles/_main.scss +0 -6
- package/test/components/MadieTable.test.js +38 -0
- package/test/components/TruncateText.test.js +38 -0
- package/.storybook/main.js +0 -61
- package/components/Spinner/index.js +0 -9
- package/components/UnwrappedSpinner/index.js +0 -8
- package/test/__mocks__/styled-components-macro.js +0 -2
- package/test/__mocks__/twin.macro.js +0 -24
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import Modal from "./index";
|
|
3
|
-
import { withKnobs, boolean, text } from "@storybook/addon-knobs";
|
|
4
3
|
import { humanReadable } from "./HumanReadable";
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: "Modal",
|
|
8
7
|
component: Modal,
|
|
9
|
-
|
|
8
|
+
args: {
|
|
9
|
+
isOpen: false,
|
|
10
|
+
titleText: "Title Text",
|
|
11
|
+
bodyText:
|
|
12
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac pulvinar massa, in mattis ligula. Vestibulum enim velit, ullamcorper vitae lorem ullamcorper, blandit fringilla mauris.",
|
|
13
|
+
},
|
|
10
14
|
};
|
|
11
15
|
|
|
12
16
|
const useModal = () => {
|
|
@@ -16,9 +20,9 @@ const useModal = () => {
|
|
|
16
20
|
return [open, openModal, closeModal];
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
export const WithDesignSystem = () => {
|
|
23
|
+
export const WithDesignSystem = (args) => {
|
|
20
24
|
const [open, openModal, closeModal] = useModal();
|
|
21
|
-
const knobIsOpen =
|
|
25
|
+
const knobIsOpen = args.isOpen;
|
|
22
26
|
return (
|
|
23
27
|
<div className="qpp-u-padding--12">
|
|
24
28
|
<button className="qpp-c-button" onClick={openModal}>
|
|
@@ -27,23 +31,18 @@ export const WithDesignSystem = () => {
|
|
|
27
31
|
<Modal
|
|
28
32
|
useDesignSystem
|
|
29
33
|
isOpen={open || knobIsOpen}
|
|
30
|
-
title={
|
|
34
|
+
title={args.titleText}
|
|
31
35
|
onRequestClose={closeModal}
|
|
32
36
|
>
|
|
33
|
-
<p>
|
|
34
|
-
{text(
|
|
35
|
-
"bodyText",
|
|
36
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac pulvinar massa, in mattis ligula. Vestibulum enim velit, ullamcorper vitae lorem ullamcorper, blandit fringilla mauris."
|
|
37
|
-
)}
|
|
38
|
-
</p>
|
|
37
|
+
<p>{args.bodyText}</p>
|
|
39
38
|
</Modal>
|
|
40
39
|
</div>
|
|
41
40
|
);
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
export const WithDesignSystemDialog = () => {
|
|
43
|
+
export const WithDesignSystemDialog = (args) => {
|
|
45
44
|
const [open, openModal, closeModal] = useModal();
|
|
46
|
-
const knobIsOpen =
|
|
45
|
+
const knobIsOpen = args.isOpen;
|
|
47
46
|
return (
|
|
48
47
|
<div className="qpp-u-padding--12">
|
|
49
48
|
<button className="qpp-c-button" onClick={openModal}>
|
|
@@ -52,7 +51,7 @@ export const WithDesignSystemDialog = () => {
|
|
|
52
51
|
<Modal
|
|
53
52
|
useDesignSystem
|
|
54
53
|
isOpen={open || knobIsOpen}
|
|
55
|
-
title={
|
|
54
|
+
title={args.titleText}
|
|
56
55
|
onRequestClose={closeModal}
|
|
57
56
|
primary={{
|
|
58
57
|
title: "Yes, go for it",
|
|
@@ -65,20 +64,15 @@ export const WithDesignSystemDialog = () => {
|
|
|
65
64
|
title: "No, take me back",
|
|
66
65
|
}}
|
|
67
66
|
>
|
|
68
|
-
<p>
|
|
69
|
-
{text(
|
|
70
|
-
"bodyText",
|
|
71
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac pulvinar massa, in mattis ligula. Vestibulum enim velit, ullamcorper vitae lorem ullamcorper, blandit fringilla mauris."
|
|
72
|
-
)}
|
|
73
|
-
</p>
|
|
67
|
+
<p>{args.bodyText}</p>
|
|
74
68
|
</Modal>
|
|
75
69
|
</div>
|
|
76
70
|
);
|
|
77
71
|
};
|
|
78
72
|
|
|
79
|
-
export const WithDesignSystemOverflow = () => {
|
|
73
|
+
export const WithDesignSystemOverflow = (args) => {
|
|
80
74
|
const [open, openModal, closeModal] = useModal();
|
|
81
|
-
const knobIsOpen =
|
|
75
|
+
const knobIsOpen = args.isOpen;
|
|
82
76
|
return (
|
|
83
77
|
<div className="qpp-u-padding--12">
|
|
84
78
|
<button className="qpp-c-button" onClick={openModal}>
|
|
@@ -87,7 +81,7 @@ export const WithDesignSystemOverflow = () => {
|
|
|
87
81
|
<Modal
|
|
88
82
|
useDesignSystem
|
|
89
83
|
isOpen={open || knobIsOpen}
|
|
90
|
-
title={
|
|
84
|
+
title={args.titleText}
|
|
91
85
|
onRequestClose={closeModal}
|
|
92
86
|
primary={{
|
|
93
87
|
title: "Yes, go for it",
|
|
@@ -167,9 +161,9 @@ export const WithDesignSystemOverflow = () => {
|
|
|
167
161
|
);
|
|
168
162
|
};
|
|
169
163
|
|
|
170
|
-
export const WithDesignSystemOverflowForHR = () => {
|
|
164
|
+
export const WithDesignSystemOverflowForHR = (args) => {
|
|
171
165
|
const [open, openModal, closeModal] = useModal();
|
|
172
|
-
const knobIsOpen =
|
|
166
|
+
const knobIsOpen = args.isOpen;
|
|
173
167
|
|
|
174
168
|
const hr = humanReadable();
|
|
175
169
|
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import NotificationBanner from "./index";
|
|
3
|
-
import { withKnobs, boolean } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "NotificationBanner",
|
|
7
6
|
component: NotificationBanner,
|
|
8
|
-
|
|
7
|
+
args: {
|
|
8
|
+
dismissable: false,
|
|
9
|
+
},
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
export const ExampleNotificationBanner = () => (
|
|
12
|
+
export const ExampleNotificationBanner = (args) => (
|
|
12
13
|
<NotificationBanner
|
|
13
14
|
result={{
|
|
14
15
|
content: "CONTENT",
|
|
15
16
|
label: "Label",
|
|
16
17
|
name: "name",
|
|
17
18
|
color: "blue",
|
|
18
|
-
dismissable:
|
|
19
|
+
dismissable: args.dismissable,
|
|
19
20
|
}}
|
|
20
21
|
/>
|
|
21
22
|
);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import NumberInput from "./index";
|
|
4
3
|
import PropTypes from "prop-types";
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: "NumberInput",
|
|
8
7
|
component: NumberInput,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import Popover from "./index";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "Popover",
|
|
7
6
|
component: Popover,
|
|
8
|
-
decorators: [withKnobs],
|
|
9
7
|
};
|
|
10
8
|
|
|
11
9
|
export const PopOver = () => {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import ReadOnlyTextField from "./index";
|
|
5
4
|
import { FormHelperText } from "@mui/material";
|
|
6
5
|
export default {
|
|
7
6
|
title: "ReadOnlyTextField",
|
|
8
7
|
component: ReadOnlyTextField,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import RichTextEditor from "./index";
|
|
4
3
|
export default {
|
|
5
4
|
title: "RichTextEditor",
|
|
6
5
|
component: RichTextEditor,
|
|
7
6
|
decorators: [
|
|
8
|
-
withKnobs,
|
|
9
7
|
(storyFn) => <div style={{ padding: "120px" }}>{storyFn()}</div>,
|
|
10
8
|
],
|
|
11
9
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import Select from "./index";
|
|
5
4
|
import { MenuItem, Box } from "@mui/material";
|
|
6
5
|
|
|
7
6
|
export default {
|
|
8
7
|
title: "Select",
|
|
9
8
|
component: Select,
|
|
10
|
-
decorators: [withKnobs],
|
|
11
9
|
};
|
|
12
10
|
|
|
13
11
|
const Wrapper = ({ children }) => (
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import "./tabs.scss";
|
|
4
3
|
import Tabs from "./index";
|
|
5
4
|
import Tab from "./Tab";
|
|
@@ -7,7 +6,6 @@ import Tab from "./Tab";
|
|
|
7
6
|
export default {
|
|
8
7
|
title: "Tabs",
|
|
9
8
|
component: Tabs,
|
|
10
|
-
decorators: [withKnobs],
|
|
11
9
|
};
|
|
12
10
|
|
|
13
11
|
export const TypeA = () => {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import TextArea from "./index";
|
|
5
4
|
import { FormHelperText } from "@mui/material";
|
|
6
5
|
export default {
|
|
7
6
|
title: "TextArea",
|
|
8
7
|
component: TextArea,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import TextField from "./index";
|
|
5
4
|
import { FormHelperText, IconButton, InputAdornment } from "@mui/material";
|
|
6
5
|
import SearchIcon from "@mui/icons-material/Search";
|
|
@@ -8,7 +7,6 @@ import ClearIcon from "@mui/icons-material/Clear";
|
|
|
8
7
|
export default {
|
|
9
8
|
title: "TextField",
|
|
10
9
|
component: TextField,
|
|
11
|
-
decorators: [withKnobs],
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
const Wrapper = ({ children }) => (
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import TextInput from "./index";
|
|
4
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: "Text Input",
|
|
8
7
|
component: TextInput,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const optionalProps = {
|
|
@@ -6,7 +6,7 @@ import InputLabel from "../InputLabel";
|
|
|
6
6
|
import { kebabCase } from "lodash";
|
|
7
7
|
import PropTypes from "prop-types";
|
|
8
8
|
import dayjs from "dayjs";
|
|
9
|
-
import
|
|
9
|
+
import ReadOnlyTextField from "../ReadOnlyTextField";
|
|
10
10
|
|
|
11
11
|
const timeFieldStyle = {
|
|
12
12
|
width: "170px",
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import TimeField from "./TimeField";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "TimeField",
|
|
7
6
|
component: TimeField,
|
|
8
|
-
decorators: [withKnobs],
|
|
9
7
|
};
|
|
10
8
|
export const TimeFieldComponent = (args) => {
|
|
11
9
|
const [value, setValue] = useState("");
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import TruncateText from "./index";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "Truncate Text",
|
|
7
6
|
component: TruncateText,
|
|
8
|
-
decorators: [withKnobs],
|
|
9
7
|
};
|
|
10
8
|
|
|
11
9
|
export const FullText = () => (
|
|
@@ -3,6 +3,8 @@ import React, { useState } from "react";
|
|
|
3
3
|
import _ from "lodash";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
|
+
let idCounter = 0;
|
|
7
|
+
|
|
6
8
|
const TruncateText = ({
|
|
7
9
|
text,
|
|
8
10
|
maxLength = 120,
|
|
@@ -10,6 +12,7 @@ const TruncateText = ({
|
|
|
10
12
|
fontSize = "1rem",
|
|
11
13
|
}) => {
|
|
12
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
+
const [contentId] = useState(() => `truncate-text-${++idCounter}`);
|
|
13
16
|
|
|
14
17
|
if (!text || _.trim(text) === "") {
|
|
15
18
|
return null;
|
|
@@ -21,10 +24,13 @@ const TruncateText = ({
|
|
|
21
24
|
|
|
22
25
|
return (
|
|
23
26
|
<div data-testid={`${dataTestId}-content`} style={{ fontSize }}>
|
|
24
|
-
<span>{displayedText}</span>
|
|
27
|
+
<span id={contentId}>{displayedText}</span>
|
|
25
28
|
{text.length > maxLength && (
|
|
26
29
|
<IconButton
|
|
30
|
+
type="button"
|
|
27
31
|
onClick={toggleExpanded}
|
|
32
|
+
aria-expanded={isExpanded}
|
|
33
|
+
aria-controls={contentId}
|
|
28
34
|
data-testid={`${dataTestId}-toggle-button`}
|
|
29
35
|
color="primary"
|
|
30
36
|
sx={{
|
|
@@ -33,6 +39,11 @@ const TruncateText = ({
|
|
|
33
39
|
cursor: "pointer",
|
|
34
40
|
textDecoration: "underline",
|
|
35
41
|
fontSize: "inherit",
|
|
42
|
+
borderRadius: "2px",
|
|
43
|
+
"&:focus-visible": {
|
|
44
|
+
outline: "2px solid #0073c8",
|
|
45
|
+
outlineOffset: "2px",
|
|
46
|
+
},
|
|
36
47
|
}}
|
|
37
48
|
>
|
|
38
49
|
{isExpanded ? "Show less" : "Show more"}
|
package/components/index.js
CHANGED
|
@@ -29,7 +29,6 @@ import RadioButton from "./RadioButton/RadioButton";
|
|
|
29
29
|
import ReadOnlyTextField from "./ReadOnlyTextField";
|
|
30
30
|
import RichTextEditor from "./RichTextEditor";
|
|
31
31
|
import Select from "./Select";
|
|
32
|
-
import Spinner from "./UnwrappedSpinner";
|
|
33
32
|
import TabPanel from "./Tabs/TabPanel";
|
|
34
33
|
import Tabs from "./Tabs/index";
|
|
35
34
|
import Tab from "./Tabs/Tab";
|
|
@@ -167,7 +166,6 @@ export {
|
|
|
167
166
|
RichTextEditor,
|
|
168
167
|
SearchAndFilter,
|
|
169
168
|
Select,
|
|
170
|
-
Spinner,
|
|
171
169
|
TabPanel,
|
|
172
170
|
Tabs,
|
|
173
171
|
Tab,
|