@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.
- package/.babelrc +14 -2
- package/.eslintrc.js +1 -1
- package/.storybook/.babelrc +2 -1
- package/.storybook/main.js +3 -11
- package/.storybook/preview.js +1 -1
- package/components/Accordion/index.jsx +32 -36
- package/components/AutoComplete/AutoComplete.jsx +2 -17
- package/components/Button/Button.stories.js +0 -7
- package/components/Button/index.js +34 -44
- package/components/DateField/DateField.jsx +2 -15
- package/components/DateField/DateField.stories.jsx +23 -10
- package/components/DateTimeField/DateTimeField.jsx +7 -11
- package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
- package/components/InputLabel/index.jsx +1 -6
- package/components/Instant/Instant.stories.js +14 -6
- package/components/Instant/index.jsx +0 -16
- package/components/Link/index.js +14 -33
- package/components/MadieAlert/MadieAlert.stories.js +35 -29
- package/components/MadieAlert/index.jsx +5 -44
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -32
- package/components/MadieConfirmDialog/index.jsx +0 -8
- package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -24
- package/components/MadieDeleteDialog/index.jsx +0 -7
- package/components/MadieDialog/MadieDialog.stories.js +45 -121
- package/components/MadieDialog/index.jsx +4 -23
- package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -12
- package/components/MadieDiscardDialog/index.jsx +0 -7
- package/components/MadieSpinner/MadieSpinner.stories.js +1 -9
- package/components/MadieSpinner/index.jsx +0 -5
- package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
- package/components/MadieTooltip/index.jsx +0 -6
- package/components/MadieTooltipIcon/index.jsx +0 -5
- package/components/Modal/Modal.jsx +31 -43
- package/components/Modal/Modal.stories.js +18 -89
- package/components/Modal/index.jsx +6 -8
- package/components/NumberInput/NumberInput.stories.js +50 -67
- package/components/NumberInput/index.jsx +0 -13
- package/components/Pagination/index.jsx +0 -17
- package/components/Popover/Popover.stories.js +6 -14
- package/components/Popover/index.js +0 -23
- package/components/RadioButton/RadioButton.jsx +5 -15
- package/components/RadioButton/RadioButton.stories.jsx +6 -2
- package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +3 -8
- package/components/ReadOnlyTextField/index.jsx +1 -9
- package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
- package/components/RichTextEditor/index.jsx +14 -30
- package/components/SanitizedContent/index.jsx +0 -8
- package/components/Search/Search.stories.js +2 -4
- package/components/Search/index.js +26 -40
- package/components/Select/Select.stories.js +59 -164
- package/components/Select/index.jsx +2 -17
- package/components/Tabs/Tab.js +29 -25
- package/components/Tabs/TabPanel.js +15 -19
- package/components/Tabs/Tabs.stories.js +43 -211
- package/components/Tabs/index.js +10 -28
- package/components/TextArea/TextArea.stories.js +87 -113
- package/components/TextArea/index.jsx +2 -14
- package/components/TextField/TextField.stories.js +100 -129
- package/components/TextField/index.jsx +2 -17
- package/components/TimeField/TimeField.jsx +0 -10
- package/components/TimeField/TimeField.stories.js +18 -8
- package/components/Toast/Toast.stories.js +42 -102
- package/components/Toast/index.jsx +0 -14
- package/components/TruncateText/TruncateText.stories.js +22 -17
- package/components/TruncateText/index.js +0 -8
- package/components/hooks/useGetConfig.js +2 -2
- package/components/{index.js → index.mjs} +37 -57
- package/dist/index.js +3 -1
- package/dist/index.js.LICENSE.txt +16 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.html +1 -1
- package/dist/react/index.mjs +103 -0
- package/dist/react/{index.js.LICENSE.txt → index.mjs.LICENSE.txt} +3 -52
- package/dist/react/index.mjs.map +1 -0
- package/dist/react/package.json +1 -0
- package/eslint.config.cjs +59 -0
- package/index.js +7 -9
- package/jest.config.mjs +10 -0
- package/lib/Chevron.jsx +2 -10
- package/package.json +57 -82
- package/styles/_main.scss +4 -3
- package/test/components/Accordion.test.js +1 -1
- package/test/components/AutoComplete.test.js +11 -6
- package/test/components/Button.test.js +13 -19
- 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.mjs +79 -0
- package/webpack.config.react.mjs +72 -0
- 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/NotificationBanner/NotificationBanner.stories.js +0 -23
- package/components/NotificationBanner/index.js +0 -279
- 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/components/UnwrappedSpinner/index.js +0 -8
- package/dist/browser.js +0 -1
- package/dist/react/index.js +0 -185
- package/dist/react/index.js.map +0 -1
- package/jest.config.js +0 -17
- 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
- package/webpack.config.js +0 -124
- package/webpack.config.react.js +0 -104
|
@@ -1,12 +1,10 @@
|
|
|
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
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const useModal = () => {
|
|
@@ -16,9 +14,12 @@ const useModal = () => {
|
|
|
16
14
|
return [open, openModal, closeModal];
|
|
17
15
|
};
|
|
18
16
|
|
|
17
|
+
const lorem =
|
|
18
|
+
"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.";
|
|
19
|
+
|
|
19
20
|
export const WithDesignSystem = () => {
|
|
20
21
|
const [open, openModal, closeModal] = useModal();
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
return (
|
|
23
24
|
<div className="qpp-u-padding--12">
|
|
24
25
|
<button className="qpp-c-button" onClick={openModal}>
|
|
@@ -26,16 +27,11 @@ export const WithDesignSystem = () => {
|
|
|
26
27
|
</button>
|
|
27
28
|
<Modal
|
|
28
29
|
useDesignSystem
|
|
29
|
-
isOpen={open
|
|
30
|
-
title=
|
|
30
|
+
isOpen={open}
|
|
31
|
+
title="Title Text"
|
|
31
32
|
onRequestClose={closeModal}
|
|
32
33
|
>
|
|
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>
|
|
34
|
+
<p>{lorem}</p>
|
|
39
35
|
</Modal>
|
|
40
36
|
</div>
|
|
41
37
|
);
|
|
@@ -43,7 +39,7 @@ export const WithDesignSystem = () => {
|
|
|
43
39
|
|
|
44
40
|
export const WithDesignSystemDialog = () => {
|
|
45
41
|
const [open, openModal, closeModal] = useModal();
|
|
46
|
-
|
|
42
|
+
|
|
47
43
|
return (
|
|
48
44
|
<div className="qpp-u-padding--12">
|
|
49
45
|
<button className="qpp-c-button" onClick={openModal}>
|
|
@@ -51,8 +47,8 @@ export const WithDesignSystemDialog = () => {
|
|
|
51
47
|
</button>
|
|
52
48
|
<Modal
|
|
53
49
|
useDesignSystem
|
|
54
|
-
isOpen={open
|
|
55
|
-
title=
|
|
50
|
+
isOpen={open}
|
|
51
|
+
title="Title Text"
|
|
56
52
|
onRequestClose={closeModal}
|
|
57
53
|
primary={{
|
|
58
54
|
title: "Yes, go for it",
|
|
@@ -65,12 +61,7 @@ export const WithDesignSystemDialog = () => {
|
|
|
65
61
|
title: "No, take me back",
|
|
66
62
|
}}
|
|
67
63
|
>
|
|
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>
|
|
64
|
+
<p>{lorem}</p>
|
|
74
65
|
</Modal>
|
|
75
66
|
</div>
|
|
76
67
|
);
|
|
@@ -78,7 +69,7 @@ export const WithDesignSystemDialog = () => {
|
|
|
78
69
|
|
|
79
70
|
export const WithDesignSystemOverflow = () => {
|
|
80
71
|
const [open, openModal, closeModal] = useModal();
|
|
81
|
-
|
|
72
|
+
|
|
82
73
|
return (
|
|
83
74
|
<div className="qpp-u-padding--12">
|
|
84
75
|
<button className="qpp-c-button" onClick={openModal}>
|
|
@@ -86,8 +77,8 @@ export const WithDesignSystemOverflow = () => {
|
|
|
86
77
|
</button>
|
|
87
78
|
<Modal
|
|
88
79
|
useDesignSystem
|
|
89
|
-
isOpen={open
|
|
90
|
-
title=
|
|
80
|
+
isOpen={open}
|
|
81
|
+
title="Title Text"
|
|
91
82
|
onRequestClose={closeModal}
|
|
92
83
|
primary={{
|
|
93
84
|
title: "Yes, go for it",
|
|
@@ -100,68 +91,9 @@ export const WithDesignSystemOverflow = () => {
|
|
|
100
91
|
title: "No, take me back",
|
|
101
92
|
}}
|
|
102
93
|
>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
enim velit, ullamcorper vitae lorem ullamcorper, blandit
|
|
107
|
-
fringilla mauris. Aenean odio nulla, dapibus convallis est
|
|
108
|
-
ac, tempor congue lorem. Aliquam facilisis tortor eget
|
|
109
|
-
lectus gravida bibendum. Suspendisse vel posuere risus.
|
|
110
|
-
Etiam condimentum sollicitudin est, eget auctor lectus
|
|
111
|
-
suscipit nec. Duis efficitur vitae risus at malesuada.
|
|
112
|
-
Mauris tempus turpis sed lacus lacinia, et mattis tortor
|
|
113
|
-
eleifend. In sit amet felis vel quam egestas ultricies ac ac
|
|
114
|
-
nisl. Morbi elementum dui libero, non convallis risus ornare
|
|
115
|
-
vel. Maecenas posuere ipsum ut sem aliquet, quis maximus
|
|
116
|
-
dolor cursus. Praesent vulputate orci tellus, sed fringilla
|
|
117
|
-
arcu mollis sit amet. Phasellus eros turpis, consequat sit
|
|
118
|
-
amet placerat sed, mollis ac justo.
|
|
119
|
-
</p>
|
|
120
|
-
<p>
|
|
121
|
-
Cras quis pharetra elit. Mauris lacinia quam quis metus
|
|
122
|
-
mattis lobortis vel nec arcu. Fusce nec tellus vel nunc
|
|
123
|
-
cursus vestibulum. Quisque pretium, arcu at sagittis
|
|
124
|
-
posuere, leo magna tempus nunc, vel malesuada nunc mauris ac
|
|
125
|
-
ante. Donec arcu velit, imperdiet vitae purus nec, imperdiet
|
|
126
|
-
auctor nisi. Cras ornare, elit sit amet viverra bibendum,
|
|
127
|
-
justo dolor congue mi, quis pretium erat orci a lorem. Sed
|
|
128
|
-
rhoncus quam ut tellus hendrerit accumsan.
|
|
129
|
-
</p>
|
|
130
|
-
<p>
|
|
131
|
-
Donec varius elit vitae elit efficitur fermentum. Vestibulum
|
|
132
|
-
ante ipsum primis in faucibus orci luctus et ultrices
|
|
133
|
-
posuere cubilia curae; Nulla facilisi. Ut malesuada
|
|
134
|
-
venenatis varius. Nunc libero massa, luctus sagittis sapien
|
|
135
|
-
ultrices, pulvinar venenatis purus. In nec orci ac nibh
|
|
136
|
-
sagittis lobortis vel sed massa. Morbi pretium odio vitae
|
|
137
|
-
malesuada ullamcorper. Pellentesque facilisis posuere
|
|
138
|
-
consectetur. Nam maximus finibus ante, non eleifend neque
|
|
139
|
-
euismod et.
|
|
140
|
-
</p>
|
|
141
|
-
<p>
|
|
142
|
-
Pellentesque vehicula nec massa nec accumsan. Pellentesque
|
|
143
|
-
non odio eu felis hendrerit pellentesque non sed neque.
|
|
144
|
-
Morbi dui nisl, facilisis id gravida non, vehicula at dui.
|
|
145
|
-
In eleifend suscipit imperdiet. Quisque facilisis augue et
|
|
146
|
-
mi lobortis tristique. Praesent auctor dictum erat, non
|
|
147
|
-
mollis ante tempus id. Integer et libero iaculis, imperdiet
|
|
148
|
-
neque at, pharetra nisl. Suspendisse diam massa, vehicula eu
|
|
149
|
-
varius ullamcorper, semper vel velit. Morbi consequat mattis
|
|
150
|
-
nisi, id dignissim est bibendum non. Suspendisse semper
|
|
151
|
-
laoreet neque, ac tincidunt tortor. Ut posuere urna a
|
|
152
|
-
convallis consectetur. Mauris varius cursus libero sed
|
|
153
|
-
molestie. Duis id dignissim arcu. Mauris tincidunt egestas
|
|
154
|
-
congue.
|
|
155
|
-
</p>
|
|
156
|
-
<p>
|
|
157
|
-
Donec rutrum erat vitae nulla ultricies, quis laoreet orci
|
|
158
|
-
consequat. Nunc et justo volutpat dolor feugiat convallis.
|
|
159
|
-
Vivamus efficitur nisi quis risus eleifend, ut tincidunt
|
|
160
|
-
turpis volutpat. Nam commodo turpis dolor, dapibus rutrum
|
|
161
|
-
erat facilisis a. Ut a dictum urna. Maecenas vel egestas
|
|
162
|
-
odio. Ut venenatis est dolor, eget ullamcorper diam finibus
|
|
163
|
-
et. Proin tincidunt porta pellentesque.
|
|
164
|
-
</p>
|
|
94
|
+
{[...Array(5)].map((_, i) => (
|
|
95
|
+
<p key={i}>{lorem.repeat(5)}</p>
|
|
96
|
+
))}
|
|
165
97
|
</Modal>
|
|
166
98
|
</div>
|
|
167
99
|
);
|
|
@@ -169,8 +101,6 @@ export const WithDesignSystemOverflow = () => {
|
|
|
169
101
|
|
|
170
102
|
export const WithDesignSystemOverflowForHR = () => {
|
|
171
103
|
const [open, openModal, closeModal] = useModal();
|
|
172
|
-
const knobIsOpen = boolean("isOpen", false);
|
|
173
|
-
|
|
174
104
|
const hr = humanReadable();
|
|
175
105
|
|
|
176
106
|
return (
|
|
@@ -178,11 +108,10 @@ export const WithDesignSystemOverflowForHR = () => {
|
|
|
178
108
|
<button className="qpp-c-button" onClick={openModal}>
|
|
179
109
|
Open Modal
|
|
180
110
|
</button>
|
|
181
|
-
|
|
182
111
|
<div data-testid="view-hr-modal">
|
|
183
112
|
<Modal
|
|
184
113
|
useDesignSystem
|
|
185
|
-
isOpen={open
|
|
114
|
+
isOpen={open}
|
|
186
115
|
title="Human Readable"
|
|
187
116
|
onRequestClose={closeModal}
|
|
188
117
|
width="75rem"
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
|
|
4
3
|
import DsModal from "./Modal";
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @param {{
|
|
7
|
+
* useDesignSystem?: boolean
|
|
8
|
+
* } & React.ComponentProps<typeof DsModal>} props
|
|
9
|
+
*/
|
|
10
|
+
const Modal = ({ useDesignSystem = false, ...rest }) => {
|
|
7
11
|
return <DsModal {...rest} />;
|
|
8
12
|
};
|
|
9
13
|
|
|
10
|
-
Modal.propTypes = {
|
|
11
|
-
useDesignSystem: PropTypes.bool,
|
|
12
|
-
};
|
|
13
|
-
Modal.defaultProps = {
|
|
14
|
-
useDesignSystem: false,
|
|
15
|
-
};
|
|
16
14
|
Modal.displayName = "Modal";
|
|
17
15
|
|
|
18
16
|
export default Modal;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import NumberInput from "./index";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
3
|
|
|
6
4
|
export default {
|
|
7
5
|
title: "NumberInput",
|
|
8
6
|
component: NumberInput,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
7
|
};
|
|
11
8
|
|
|
12
9
|
const Wrapper = ({ children }) => (
|
|
@@ -14,72 +11,58 @@ const Wrapper = ({ children }) => (
|
|
|
14
11
|
{children}
|
|
15
12
|
</div>
|
|
16
13
|
);
|
|
17
|
-
Wrapper.propTypes = {
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
children: PropTypes.node,
|
|
20
|
-
};
|
|
21
14
|
|
|
22
|
-
export const BasicNumberInput = () =>
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
};
|
|
15
|
+
export const BasicNumberInput = () => (
|
|
16
|
+
<Wrapper>
|
|
17
|
+
<NumberInput id="basic-number-input" label="Demo number input" />
|
|
18
|
+
</Wrapper>
|
|
19
|
+
);
|
|
29
20
|
|
|
30
|
-
export const NumberInputWithNoNegativeNumbers = () =>
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
);
|
|
42
|
-
};
|
|
21
|
+
export const NumberInputWithNoNegativeNumbers = () => (
|
|
22
|
+
<Wrapper>
|
|
23
|
+
<NumberInput
|
|
24
|
+
id="number-input-non-negative"
|
|
25
|
+
label="Demo number input"
|
|
26
|
+
aria-label="Demo number input"
|
|
27
|
+
placeholder="Type a number…"
|
|
28
|
+
allowNegative={false}
|
|
29
|
+
/>
|
|
30
|
+
</Wrapper>
|
|
31
|
+
);
|
|
43
32
|
|
|
44
|
-
export const NumberInputWithErrorAndHelperText = () =>
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
};
|
|
33
|
+
export const NumberInputWithErrorAndHelperText = () => (
|
|
34
|
+
<Wrapper>
|
|
35
|
+
<NumberInput
|
|
36
|
+
id="number-input-error"
|
|
37
|
+
error={true}
|
|
38
|
+
label="Demo number input"
|
|
39
|
+
aria-label="Demo number input"
|
|
40
|
+
placeholder="Type a number…"
|
|
41
|
+
helperText="Please Enter a valid integer"
|
|
42
|
+
/>
|
|
43
|
+
</Wrapper>
|
|
44
|
+
);
|
|
58
45
|
|
|
59
|
-
export const NumberInputDisabled = () =>
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
};
|
|
46
|
+
export const NumberInputDisabled = () => (
|
|
47
|
+
<Wrapper>
|
|
48
|
+
<NumberInput
|
|
49
|
+
id="number-input-disabled"
|
|
50
|
+
label="Demo number input"
|
|
51
|
+
aria-label="Demo number input"
|
|
52
|
+
placeholder="Type a number…"
|
|
53
|
+
disabled={true}
|
|
54
|
+
/>
|
|
55
|
+
</Wrapper>
|
|
56
|
+
);
|
|
72
57
|
|
|
73
|
-
export const NumberInputWithTooltip = () =>
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
);
|
|
85
|
-
};
|
|
58
|
+
export const NumberInputWithTooltip = () => (
|
|
59
|
+
<Wrapper>
|
|
60
|
+
<NumberInput
|
|
61
|
+
id="number-input-tooltip"
|
|
62
|
+
label="Demo number input"
|
|
63
|
+
aria-label="Demo number input"
|
|
64
|
+
placeholder="Type a number…"
|
|
65
|
+
tooltipText="Provides information"
|
|
66
|
+
/>
|
|
67
|
+
</Wrapper>
|
|
68
|
+
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import TextField from "../TextField";
|
|
4
3
|
|
|
5
4
|
export default function NumberInput({
|
|
@@ -61,15 +60,3 @@ export default function NumberInput({
|
|
|
61
60
|
/>
|
|
62
61
|
);
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
NumberInput.propTypes = {
|
|
66
|
-
id: PropTypes.string,
|
|
67
|
-
error: PropTypes.bool,
|
|
68
|
-
helperText: PropTypes.string,
|
|
69
|
-
required: PropTypes.bool,
|
|
70
|
-
disabled: PropTypes.bool,
|
|
71
|
-
label: PropTypes.string,
|
|
72
|
-
tooltipText: PropTypes.string,
|
|
73
|
-
inputProps: PropTypes.object,
|
|
74
|
-
allowNegative: PropTypes.bool,
|
|
75
|
-
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { visuallyHidden } from "@mui/utils";
|
|
4
3
|
|
|
5
4
|
import {
|
|
@@ -198,20 +197,4 @@ const Pagination = ({
|
|
|
198
197
|
);
|
|
199
198
|
};
|
|
200
199
|
|
|
201
|
-
Pagination.propTypes = {
|
|
202
|
-
totalItems: PropTypes.number,
|
|
203
|
-
visibleItems: PropTypes.number,
|
|
204
|
-
count: PropTypes.number,
|
|
205
|
-
offset: PropTypes.number,
|
|
206
|
-
shape: PropTypes.string,
|
|
207
|
-
limit: PropTypes.number,
|
|
208
|
-
page: PropTypes.number,
|
|
209
|
-
limitOptions: PropTypes.array,
|
|
210
|
-
handlePageChange: PropTypes.func,
|
|
211
|
-
handleLimitChange: PropTypes.func,
|
|
212
|
-
hidePrevButton: PropTypes.bool,
|
|
213
|
-
hideNextButton: PropTypes.bool,
|
|
214
|
-
type: PropTypes.string,
|
|
215
|
-
};
|
|
216
|
-
|
|
217
200
|
export { Pagination };
|
|
@@ -1,37 +1,29 @@
|
|
|
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 = () => {
|
|
12
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
13
11
|
const [optionsOpen, setOptionsOpen] = useState(false);
|
|
14
12
|
|
|
15
|
-
const onClose = () =>
|
|
16
|
-
setOptionsOpen(false);
|
|
17
|
-
};
|
|
13
|
+
const onClose = () => setOptionsOpen(false);
|
|
18
14
|
|
|
19
15
|
const handleOpen = (e) => {
|
|
20
16
|
setAnchorEl(e.currentTarget);
|
|
21
17
|
setOptionsOpen(true);
|
|
22
18
|
};
|
|
23
19
|
|
|
24
|
-
const viewEditredirect = () =>
|
|
25
|
-
setOptionsOpen(false);
|
|
26
|
-
};
|
|
20
|
+
const viewEditredirect = () => setOptionsOpen(false);
|
|
27
21
|
|
|
28
|
-
const zipData = () =>
|
|
29
|
-
setOptionsOpen(false);
|
|
30
|
-
};
|
|
22
|
+
const zipData = () => setOptionsOpen(false);
|
|
31
23
|
|
|
32
24
|
return (
|
|
33
25
|
<div className="qpp-u-padding--12">
|
|
34
|
-
<button className="qpp-c-button" onClick={
|
|
26
|
+
<button className="qpp-c-button" onClick={handleOpen}>
|
|
35
27
|
Open Popover
|
|
36
28
|
</button>
|
|
37
29
|
<Popover
|
|
@@ -42,13 +34,13 @@ export const PopOver = () => {
|
|
|
42
34
|
editViewSelectOptionProps={{
|
|
43
35
|
label: "View",
|
|
44
36
|
toImplementFunction: viewEditredirect,
|
|
45
|
-
dataTestId:
|
|
37
|
+
dataTestId: "edit-measure-1",
|
|
46
38
|
}}
|
|
47
39
|
otherSelectOptionProps={[
|
|
48
40
|
{
|
|
49
41
|
label: "Export",
|
|
50
42
|
toImplementFunction: zipData,
|
|
51
|
-
dataTestId:
|
|
43
|
+
dataTestId: "export-measure-1",
|
|
52
44
|
},
|
|
53
45
|
]}
|
|
54
46
|
/>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import Popover from "@mui/material/Popover";
|
|
4
3
|
|
|
5
4
|
const MadiePopover = ({
|
|
@@ -107,26 +106,4 @@ const MadiePopover = ({
|
|
|
107
106
|
);
|
|
108
107
|
};
|
|
109
108
|
|
|
110
|
-
MadiePopover.propTypes = {
|
|
111
|
-
optionsOpen: PropTypes.bool,
|
|
112
|
-
anchorEl: PropTypes.any,
|
|
113
|
-
handleClose: PropTypes.func,
|
|
114
|
-
canEdit: PropTypes.bool,
|
|
115
|
-
editViewSelectOptionProps: PropTypes.object,
|
|
116
|
-
otherSelectOptionProps: PropTypes.arrayOf(
|
|
117
|
-
PropTypes.shape({
|
|
118
|
-
dataTestId: PropTypes.string,
|
|
119
|
-
label: PropTypes.string,
|
|
120
|
-
toImplementFunction: PropTypes.func,
|
|
121
|
-
})
|
|
122
|
-
),
|
|
123
|
-
additionalSelectOptionProps: PropTypes.arrayOf(
|
|
124
|
-
PropTypes.shape({
|
|
125
|
-
dataTestId: PropTypes.string,
|
|
126
|
-
label: PropTypes.string,
|
|
127
|
-
toImplementFunction: PropTypes.func,
|
|
128
|
-
})
|
|
129
|
-
),
|
|
130
|
-
};
|
|
131
|
-
|
|
132
109
|
export default MadiePopover;
|
|
@@ -6,9 +6,8 @@ import {
|
|
|
6
6
|
Radio,
|
|
7
7
|
RadioGroup,
|
|
8
8
|
} from "@mui/material";
|
|
9
|
-
import PropTypes from "prop-types";
|
|
10
9
|
import InputLabel from "../InputLabel";
|
|
11
|
-
import
|
|
10
|
+
import ReadOnlyTextField from "../ReadOnlyTextField";
|
|
12
11
|
|
|
13
12
|
const RadioButton = ({
|
|
14
13
|
id,
|
|
@@ -22,7 +21,9 @@ const RadioButton = ({
|
|
|
22
21
|
...rest
|
|
23
22
|
}) => {
|
|
24
23
|
if (disabled) {
|
|
25
|
-
const option = options?.find(
|
|
24
|
+
const option = options?.find(
|
|
25
|
+
(option) => String(option.value) === String(rest.value),
|
|
26
|
+
);
|
|
26
27
|
return (
|
|
27
28
|
<ReadOnlyTextField
|
|
28
29
|
required={required}
|
|
@@ -32,7 +33,7 @@ const RadioButton = ({
|
|
|
32
33
|
{...rest}
|
|
33
34
|
value={option?.label}
|
|
34
35
|
/>
|
|
35
|
-
)
|
|
36
|
+
);
|
|
36
37
|
}
|
|
37
38
|
return (
|
|
38
39
|
<FormControl error={error} fullWidth>
|
|
@@ -119,15 +120,4 @@ const RadioButton = ({
|
|
|
119
120
|
);
|
|
120
121
|
};
|
|
121
122
|
|
|
122
|
-
RadioButton.propTypes = {
|
|
123
|
-
id: PropTypes.string,
|
|
124
|
-
dataTestId: PropTypes.string,
|
|
125
|
-
required: PropTypes.bool,
|
|
126
|
-
disabled: PropTypes.bool,
|
|
127
|
-
error: PropTypes.bool,
|
|
128
|
-
label: PropTypes.string,
|
|
129
|
-
helperText: PropTypes.string,
|
|
130
|
-
options: PropTypes.arrayOf(PropTypes.any),
|
|
131
|
-
};
|
|
132
|
-
|
|
133
123
|
export default RadioButton;
|
|
@@ -36,12 +36,16 @@ const TemplateRadioButton = (args) => {
|
|
|
36
36
|
export const RadioButtonWithLabel = TemplateRadioButton.bind({});
|
|
37
37
|
RadioButtonWithLabel.args = {};
|
|
38
38
|
|
|
39
|
-
export const RadioButtonWithLabelDisabledWithNoValue = TemplateRadioButton.bind(
|
|
39
|
+
export const RadioButtonWithLabelDisabledWithNoValue = TemplateRadioButton.bind(
|
|
40
|
+
{},
|
|
41
|
+
);
|
|
40
42
|
RadioButtonWithLabelDisabledWithNoValue.args = {
|
|
41
43
|
disabled: true,
|
|
42
44
|
};
|
|
43
45
|
|
|
44
|
-
export const RadioButtonWithLabelDisabledWithValue = TemplateRadioButton.bind(
|
|
46
|
+
export const RadioButtonWithLabelDisabledWithValue = TemplateRadioButton.bind(
|
|
47
|
+
{},
|
|
48
|
+
);
|
|
45
49
|
RadioButtonWithLabelDisabledWithValue.args = {
|
|
46
50
|
disabled: true,
|
|
47
51
|
value: "options 3",
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
2
|
import ReadOnlyTextField from "./index";
|
|
5
3
|
import { FormHelperText } from "@mui/material";
|
|
4
|
+
|
|
6
5
|
export default {
|
|
7
6
|
title: "ReadOnlyTextField",
|
|
8
7
|
component: ReadOnlyTextField,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -14,10 +12,7 @@ const Wrapper = ({ children }) => (
|
|
|
14
12
|
{children}
|
|
15
13
|
</div>
|
|
16
14
|
);
|
|
17
|
-
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
children: PropTypes.node,
|
|
20
|
-
};
|
|
15
|
+
|
|
21
16
|
export const Textfield = () => (
|
|
22
17
|
<Wrapper>
|
|
23
18
|
<ReadOnlyTextField
|
|
@@ -73,7 +68,7 @@ export const Error = () => (
|
|
|
73
68
|
data-testid="measure-name-text-field"
|
|
74
69
|
size="small"
|
|
75
70
|
helperText={
|
|
76
|
-
<FormHelperText data-testid=
|
|
71
|
+
<FormHelperText data-testid="helper-text" error>
|
|
77
72
|
An error message
|
|
78
73
|
</FormHelperText>
|
|
79
74
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {FormControl, TextareaAutosize} from "@mui/material";
|
|
2
|
+
import { FormControl, TextareaAutosize } from "@mui/material";
|
|
3
3
|
import InputLabel from "../InputLabel";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
4
|
import _ from "lodash";
|
|
6
5
|
|
|
7
6
|
const ReadOnlyTextField = ({
|
|
@@ -77,11 +76,4 @@ const ReadOnlyTextField = ({
|
|
|
77
76
|
);
|
|
78
77
|
};
|
|
79
78
|
|
|
80
|
-
ReadOnlyTextField.propTypes = {
|
|
81
|
-
id: PropTypes.string,
|
|
82
|
-
required: PropTypes.bool,
|
|
83
|
-
disabled: PropTypes.bool,
|
|
84
|
-
placeholder: PropTypes.string, // expects placeholder objects of { name: value } and inserts into the render item function.
|
|
85
|
-
label: PropTypes.string,
|
|
86
|
-
};
|
|
87
79
|
export default ReadOnlyTextField;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import RichTextEditor from "./index";
|
|
3
|
+
|
|
4
4
|
export default {
|
|
5
5
|
title: "RichTextEditor",
|
|
6
6
|
component: RichTextEditor,
|
|
7
7
|
decorators: [
|
|
8
|
-
withKnobs,
|
|
9
8
|
(storyFn) => <div style={{ padding: "120px" }}>{storyFn()}</div>,
|
|
10
9
|
],
|
|
11
10
|
};
|
|
@@ -16,10 +15,11 @@ export const TextEditor = () => {
|
|
|
16
15
|
const handleChange = (selectedVal) => {
|
|
17
16
|
setValue(selectedVal);
|
|
18
17
|
};
|
|
18
|
+
|
|
19
19
|
return (
|
|
20
20
|
<RichTextEditor
|
|
21
|
-
label=
|
|
22
|
-
required
|
|
21
|
+
label="Test Text Editor"
|
|
22
|
+
required
|
|
23
23
|
onChange={handleChange}
|
|
24
24
|
content={value}
|
|
25
25
|
disabled={false}
|
|
@@ -27,22 +27,24 @@ export const TextEditor = () => {
|
|
|
27
27
|
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
TextEditor.storyName = "Rich Text Editor";
|
|
31
|
+
|
|
30
32
|
export const ReadOnlyTextEditor = () => {
|
|
31
33
|
const [value, setValue] = useState(
|
|
32
|
-
"<p>This is <strong>readonly</strong> content</p>"
|
|
34
|
+
"<p>This is <strong>readonly</strong> content</p>",
|
|
33
35
|
);
|
|
34
36
|
|
|
35
37
|
const handleChange = (selectedVal) => {
|
|
36
38
|
setValue(selectedVal);
|
|
37
39
|
};
|
|
40
|
+
|
|
38
41
|
return (
|
|
39
42
|
<RichTextEditor
|
|
40
43
|
label="Test Text Editor"
|
|
41
|
-
required
|
|
44
|
+
required
|
|
42
45
|
onChange={handleChange}
|
|
43
46
|
content={value}
|
|
44
|
-
disabled
|
|
47
|
+
disabled
|
|
45
48
|
/>
|
|
46
49
|
);
|
|
47
50
|
};
|
|
48
|
-
TextEditor.storyName = "Rich Text Editor";
|