@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,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,222 +6,55 @@ import Tab from "./Tab";
|
|
|
7
6
|
export default {
|
|
8
7
|
title: "Tabs",
|
|
9
8
|
component: Tabs,
|
|
10
|
-
|
|
9
|
+
argTypes: {
|
|
10
|
+
type: {
|
|
11
|
+
control: { type: "select" },
|
|
12
|
+
options: ["A", "B", "C", "D"],
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
control: { type: "select" },
|
|
16
|
+
options: ["standard", "large"],
|
|
17
|
+
},
|
|
18
|
+
orientation: {
|
|
19
|
+
control: { type: "radio" },
|
|
20
|
+
options: ["horizontal", "vertical"],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
11
23
|
};
|
|
12
24
|
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @param {{
|
|
27
|
+
* type: "A" | "B" | "C" | "D",
|
|
28
|
+
* size: "standard" | "large",
|
|
29
|
+
* orientation: "horizontal" | "vertical"
|
|
30
|
+
* }} props
|
|
31
|
+
*/
|
|
32
|
+
const Template = ({ type, size, orientation }) => {
|
|
15
33
|
const [selected, setSelected] = useState(1);
|
|
34
|
+
const handleChange = (_, value) => setSelected(value);
|
|
16
35
|
|
|
17
|
-
const
|
|
18
|
-
// 1,2,3
|
|
19
|
-
setSelected(v);
|
|
20
|
-
};
|
|
36
|
+
const tabProps = { type, size, orientation };
|
|
21
37
|
|
|
22
38
|
return (
|
|
23
|
-
<div
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
type="A"
|
|
36
|
-
size="standard"
|
|
37
|
-
label="Item Three"
|
|
38
|
-
value={3}
|
|
39
|
-
/>
|
|
40
|
-
<Tab
|
|
41
|
-
type="A"
|
|
42
|
-
size="standard"
|
|
43
|
-
label="disabled"
|
|
44
|
-
value={4}
|
|
45
|
-
disabled
|
|
46
|
-
/>
|
|
47
|
-
</Tabs>
|
|
48
|
-
</div>
|
|
49
|
-
<div style={{ width: "fit-content" }}>
|
|
50
|
-
Large: A
|
|
51
|
-
<Tabs
|
|
52
|
-
type="A"
|
|
53
|
-
size="large"
|
|
54
|
-
value={selected}
|
|
55
|
-
onChange={handleChange}
|
|
56
|
-
>
|
|
57
|
-
<Tab type="A" size="large" label="Item One" value={1} />
|
|
58
|
-
<Tab type="A" size="large" label="Item Two" value={2} />
|
|
59
|
-
<Tab type="A" size="large" label="Item Three" value={3} />
|
|
60
|
-
<Tab
|
|
61
|
-
type="A"
|
|
62
|
-
size="large"
|
|
63
|
-
label="disabled"
|
|
64
|
-
value={4}
|
|
65
|
-
disabled
|
|
66
|
-
/>
|
|
67
|
-
</Tabs>
|
|
68
|
-
</div>
|
|
69
|
-
<div style={{ width: "fit-content" }}>
|
|
70
|
-
Standard: B
|
|
71
|
-
<Tabs
|
|
72
|
-
type="B"
|
|
73
|
-
size="standard"
|
|
74
|
-
value={selected}
|
|
75
|
-
onChange={handleChange}
|
|
76
|
-
>
|
|
77
|
-
<Tab type="B" size="standard" label="Item One" value={1} />
|
|
78
|
-
<Tab type="B" size="standard" label="Item Two" value={2} />
|
|
79
|
-
<Tab
|
|
80
|
-
type="B"
|
|
81
|
-
size="standard"
|
|
82
|
-
label="Item Three"
|
|
83
|
-
value={3}
|
|
84
|
-
/>
|
|
85
|
-
<Tab
|
|
86
|
-
type="B"
|
|
87
|
-
size="standard"
|
|
88
|
-
label="disabled"
|
|
89
|
-
value={4}
|
|
90
|
-
disabled
|
|
91
|
-
/>
|
|
92
|
-
</Tabs>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<div style={{ width: "fit-content" }}>
|
|
96
|
-
Large: B
|
|
97
|
-
<Tabs
|
|
98
|
-
type="B"
|
|
99
|
-
size="large"
|
|
100
|
-
value={selected}
|
|
101
|
-
onChange={handleChange}
|
|
102
|
-
>
|
|
103
|
-
<Tab type="B" size="large" label="Item One" value={1} />
|
|
104
|
-
<Tab type="B" size="large" label="Item Two" value={2} />
|
|
105
|
-
<Tab type="B" size="large" label="Item Three" value={3} />
|
|
106
|
-
<Tab
|
|
107
|
-
type="B"
|
|
108
|
-
size="large"
|
|
109
|
-
label="disabled"
|
|
110
|
-
value={4}
|
|
111
|
-
disabled
|
|
112
|
-
/>
|
|
113
|
-
</Tabs>
|
|
114
|
-
</div>
|
|
115
|
-
<div style={{ width: "fit-content" }}>
|
|
116
|
-
Standard: C
|
|
117
|
-
<Tabs type="C" value={selected} onChange={handleChange}>
|
|
118
|
-
<Tab type="C" size="standard" label="Item One" value={1} />
|
|
119
|
-
<Tab type="C" size="standard" label="Item Two" value={2} />
|
|
120
|
-
<Tab
|
|
121
|
-
type="C"
|
|
122
|
-
size="standard"
|
|
123
|
-
label="Item Three"
|
|
124
|
-
value={3}
|
|
125
|
-
/>
|
|
126
|
-
<Tab
|
|
127
|
-
type="C"
|
|
128
|
-
size="standard"
|
|
129
|
-
label="disabled"
|
|
130
|
-
value={4}
|
|
131
|
-
disabled
|
|
132
|
-
/>
|
|
133
|
-
</Tabs>
|
|
134
|
-
</div>
|
|
135
|
-
<div style={{ width: "fit-content" }}>
|
|
136
|
-
Large: C
|
|
137
|
-
<Tabs type="C" value={selected} onChange={handleChange}>
|
|
138
|
-
<Tab type="C" size="large" label="Item One" value={1} />
|
|
139
|
-
<Tab type="C" size="large" label="Item Two" value={2} />
|
|
140
|
-
<Tab type="C" size="large" label="Item Three" value={3} />
|
|
141
|
-
<Tab
|
|
142
|
-
type="C"
|
|
143
|
-
size="large"
|
|
144
|
-
label="disabled"
|
|
145
|
-
value={4}
|
|
146
|
-
disabled
|
|
147
|
-
/>
|
|
148
|
-
</Tabs>
|
|
149
|
-
</div>
|
|
150
|
-
<div className={"vertical-standard-type-c-wrapper"}>
|
|
151
|
-
<div className={"vertical-standard-type-c"}>
|
|
152
|
-
<h4>Vertical Standard: C</h4>
|
|
153
|
-
<Tabs
|
|
154
|
-
type="C"
|
|
155
|
-
value={selected}
|
|
156
|
-
onChange={handleChange}
|
|
157
|
-
orientation="vertical"
|
|
158
|
-
>
|
|
159
|
-
<Tab
|
|
160
|
-
type="C"
|
|
161
|
-
size="standard"
|
|
162
|
-
label="Item One"
|
|
163
|
-
value={1}
|
|
164
|
-
orientation="vertical"
|
|
165
|
-
/>
|
|
166
|
-
<Tab
|
|
167
|
-
type="C"
|
|
168
|
-
size="standard"
|
|
169
|
-
label="Item Two"
|
|
170
|
-
value={2}
|
|
171
|
-
orientation="vertical"
|
|
172
|
-
/>
|
|
173
|
-
<Tab
|
|
174
|
-
type="C"
|
|
175
|
-
size="standard"
|
|
176
|
-
label="Item Three"
|
|
177
|
-
value={3}
|
|
178
|
-
orientation="vertical"
|
|
179
|
-
/>
|
|
180
|
-
<Tab
|
|
181
|
-
type="C"
|
|
182
|
-
size="standard"
|
|
183
|
-
label="disabled"
|
|
184
|
-
value={4}
|
|
185
|
-
disabled
|
|
186
|
-
orientation="vertical"
|
|
187
|
-
/>
|
|
188
|
-
</Tabs>
|
|
189
|
-
</div>
|
|
190
|
-
</div>
|
|
191
|
-
<div style={{ width: "fit-content" }}>
|
|
192
|
-
Standard: D
|
|
193
|
-
<Tabs type="D" value={selected} onChange={handleChange}>
|
|
194
|
-
<Tab type="D" size="standard" label="Item One" value={1} />
|
|
195
|
-
<Tab type="D" size="standard" label="Item Two" value={2} />
|
|
196
|
-
<Tab
|
|
197
|
-
type="D"
|
|
198
|
-
size="standard"
|
|
199
|
-
label="Item Three"
|
|
200
|
-
value={3}
|
|
201
|
-
/>
|
|
202
|
-
<Tab
|
|
203
|
-
type="D"
|
|
204
|
-
size="standard"
|
|
205
|
-
label="disabled"
|
|
206
|
-
value={4}
|
|
207
|
-
disabled
|
|
208
|
-
/>
|
|
209
|
-
</Tabs>
|
|
210
|
-
</div>
|
|
211
|
-
<div style={{ width: "fit-content" }}>
|
|
212
|
-
Large: D
|
|
213
|
-
<Tabs type="D" value={selected} onChange={handleChange}>
|
|
214
|
-
<Tab type="D" size="large" label="Item One" value={1} />
|
|
215
|
-
<Tab type="D" size="large" label="Item Two" value={2} />
|
|
216
|
-
<Tab type="D" size="large" label="Item Three" value={3} />
|
|
217
|
-
<Tab
|
|
218
|
-
type="D"
|
|
219
|
-
size="large"
|
|
220
|
-
label="disabled"
|
|
221
|
-
value={4}
|
|
222
|
-
disabled
|
|
223
|
-
/>
|
|
224
|
-
</Tabs>
|
|
225
|
-
</div>
|
|
39
|
+
<div
|
|
40
|
+
style={{
|
|
41
|
+
margin: "25px",
|
|
42
|
+
width: orientation === "vertical" ? 200 : "fit-content",
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Tabs {...tabProps} value={selected} onChange={handleChange}>
|
|
46
|
+
<Tab {...tabProps} label="Item One" value={1} />
|
|
47
|
+
<Tab {...tabProps} label="Item Two" value={2} />
|
|
48
|
+
<Tab {...tabProps} label="Item Three" value={3} />
|
|
49
|
+
<Tab {...tabProps} label="disabled" value={4} disabled />
|
|
50
|
+
</Tabs>
|
|
226
51
|
</div>
|
|
227
52
|
);
|
|
228
53
|
};
|
|
54
|
+
|
|
55
|
+
export const InteractiveTabs = Template.bind({});
|
|
56
|
+
InteractiveTabs.args = {
|
|
57
|
+
type: "A",
|
|
58
|
+
size: "standard",
|
|
59
|
+
orientation: "horizontal",
|
|
60
|
+
};
|
package/components/Tabs/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { Tabs as MuiTabs } from "@mui/material";
|
|
4
3
|
|
|
5
4
|
const typeA = {
|
|
@@ -63,7 +62,12 @@ const baseStyle = {
|
|
|
63
62
|
},
|
|
64
63
|
};
|
|
65
64
|
|
|
66
|
-
const Tabs = ({
|
|
65
|
+
const Tabs = ({
|
|
66
|
+
type = "A",
|
|
67
|
+
size = "standard",
|
|
68
|
+
orientation = "horizontal",
|
|
69
|
+
...rest
|
|
70
|
+
}) => {
|
|
67
71
|
let style = { ...baseStyle };
|
|
68
72
|
|
|
69
73
|
switch (type) {
|
|
@@ -74,11 +78,10 @@ const Tabs = ({ type, size, orientation, ...rest }) => {
|
|
|
74
78
|
style = { ...style, ...typeB };
|
|
75
79
|
break;
|
|
76
80
|
case "C":
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
81
|
+
style =
|
|
82
|
+
orientation === "vertical"
|
|
83
|
+
? { ...style, ...typeC, ...typeCVerticalSelected }
|
|
84
|
+
: { ...style, ...typeC };
|
|
82
85
|
break;
|
|
83
86
|
case "D":
|
|
84
87
|
style = { ...style, ...typeD };
|
|
@@ -92,25 +95,4 @@ const Tabs = ({ type, size, orientation, ...rest }) => {
|
|
|
92
95
|
);
|
|
93
96
|
};
|
|
94
97
|
|
|
95
|
-
Tabs.propTypes = {
|
|
96
|
-
orientation: PropTypes.string,
|
|
97
|
-
type: PropTypes.oneOf(["A", "B", "C", "D"]),
|
|
98
|
-
size: PropTypes.oneOf(["standard", "large"]),
|
|
99
|
-
ariaLabel: PropTypes.string,
|
|
100
|
-
selected: PropTypes.string,
|
|
101
|
-
defaultSelectedId: PropTypes.string,
|
|
102
|
-
onChange: PropTypes.func,
|
|
103
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.array]),
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
Tabs.defaultProps = {
|
|
107
|
-
orientation: "horizontal",
|
|
108
|
-
type: "A",
|
|
109
|
-
size: "standard",
|
|
110
|
-
selected: null,
|
|
111
|
-
defaultSelectedId: null,
|
|
112
|
-
onChange: null,
|
|
113
|
-
children: null,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
98
|
export default Tabs;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
2
|
import TextArea from "./index";
|
|
5
3
|
import { FormHelperText } from "@mui/material";
|
|
4
|
+
|
|
6
5
|
export default {
|
|
7
6
|
title: "TextArea",
|
|
8
7
|
component: TextArea,
|
|
9
|
-
|
|
8
|
+
argTypes: {
|
|
9
|
+
disabled: { control: "boolean" },
|
|
10
|
+
error: { control: "boolean" },
|
|
11
|
+
required: { control: "boolean" },
|
|
12
|
+
size: {
|
|
13
|
+
control: { type: "select" },
|
|
14
|
+
options: ["small", "medium", "large"], // adjust if needed
|
|
15
|
+
},
|
|
16
|
+
helperText: { control: "text" },
|
|
17
|
+
value: { control: "text" },
|
|
18
|
+
},
|
|
10
19
|
};
|
|
11
20
|
|
|
12
21
|
const Wrapper = ({ children }) => (
|
|
@@ -14,148 +23,113 @@ const Wrapper = ({ children }) => (
|
|
|
14
23
|
{children}
|
|
15
24
|
</div>
|
|
16
25
|
);
|
|
17
|
-
Wrapper.propTypes = {
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
children: PropTypes.node,
|
|
20
|
-
};
|
|
21
|
-
export const Textarea = () => (
|
|
22
|
-
<Wrapper>
|
|
23
|
-
<TextArea
|
|
24
|
-
placeholder="Placeholder"
|
|
25
|
-
label="Text Label"
|
|
26
|
-
id="measureName"
|
|
27
|
-
inputProps={{ "data-testid": "measure-name-input" }}
|
|
28
|
-
data-testid="measure-name-text-field"
|
|
29
|
-
size="small"
|
|
30
|
-
/>
|
|
31
|
-
</Wrapper>
|
|
32
|
-
);
|
|
33
26
|
|
|
34
|
-
|
|
27
|
+
const Template = (args) => (
|
|
35
28
|
<Wrapper>
|
|
36
29
|
<TextArea
|
|
37
|
-
|
|
38
|
-
label="Text Label"
|
|
30
|
+
{...args}
|
|
39
31
|
id="measureName"
|
|
40
32
|
inputProps={{ "data-testid": "measure-name-input" }}
|
|
41
33
|
data-testid="measure-name-text-field"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<FormHelperText data-testid={`helper-text`} error={false}>
|
|
45
|
-
a descriptive message
|
|
46
|
-
</FormHelperText>
|
|
47
|
-
}
|
|
34
|
+
label="Text Label"
|
|
35
|
+
placeholder="Placeholder"
|
|
48
36
|
/>
|
|
49
37
|
</Wrapper>
|
|
50
38
|
);
|
|
51
39
|
|
|
52
|
-
export const
|
|
53
|
-
|
|
40
|
+
export const Interactive = Template.bind({});
|
|
41
|
+
Interactive.args = {
|
|
42
|
+
size: "small",
|
|
43
|
+
disabled: false,
|
|
44
|
+
error: false,
|
|
45
|
+
required: false,
|
|
46
|
+
helperText: "",
|
|
47
|
+
value: "",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const WithHelperText = Template.bind({});
|
|
51
|
+
WithHelperText.args = {
|
|
52
|
+
...Interactive.args,
|
|
53
|
+
helperText: (
|
|
54
|
+
<FormHelperText data-testid="helper-text" error={false}>
|
|
55
|
+
a descriptive message
|
|
56
|
+
</FormHelperText>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const DisabledWithValue = Template.bind({});
|
|
61
|
+
DisabledWithValue.args = {
|
|
62
|
+
...Interactive.args,
|
|
63
|
+
value: "This is a disabled text area",
|
|
64
|
+
disabled: true,
|
|
65
|
+
required: true,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const DisabledWithNoValue = Template.bind({});
|
|
69
|
+
DisabledWithNoValue.args = {
|
|
70
|
+
...Interactive.args,
|
|
71
|
+
disabled: true,
|
|
72
|
+
required: true,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const Required = Template.bind({});
|
|
76
|
+
Required.args = {
|
|
77
|
+
...Interactive.args,
|
|
78
|
+
required: true,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Error = Template.bind({});
|
|
82
|
+
Error.args = {
|
|
83
|
+
...Interactive.args,
|
|
84
|
+
error: true,
|
|
85
|
+
required: true,
|
|
86
|
+
helperText: "An error message",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const VariedHeights = () => (
|
|
90
|
+
<div
|
|
91
|
+
className="qpp-u-padding--16"
|
|
92
|
+
style={{ width: 900, marginBottom: "16px", display: "flex", gap: 16 }}
|
|
93
|
+
>
|
|
54
94
|
<TextArea
|
|
55
95
|
placeholder="Placeholder"
|
|
96
|
+
required
|
|
56
97
|
label="Text Label"
|
|
57
|
-
id="
|
|
58
|
-
inputProps={{ "data-testid": "measure-name-
|
|
59
|
-
data-testid="measure-name-text-
|
|
98
|
+
id="measureName1"
|
|
99
|
+
inputProps={{ "data-testid": "measure-name-input1" }}
|
|
100
|
+
data-testid="measure-name-text-field1"
|
|
60
101
|
size="small"
|
|
61
|
-
|
|
62
|
-
disabled
|
|
63
|
-
required
|
|
102
|
+
helperText="An error message"
|
|
64
103
|
/>
|
|
65
|
-
</Wrapper>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
export const DisabledWithNoValue = () => (
|
|
69
|
-
<Wrapper>
|
|
70
104
|
<TextArea
|
|
71
105
|
placeholder="Placeholder"
|
|
106
|
+
required
|
|
72
107
|
label="Text Label"
|
|
73
|
-
id="
|
|
74
|
-
inputProps={{ "data-testid": "measure-name-
|
|
75
|
-
data-testid="measure-name-text-
|
|
108
|
+
id="measureName2"
|
|
109
|
+
inputProps={{ "data-testid": "measure-name-input2" }}
|
|
110
|
+
data-testid="measure-name-text-field2"
|
|
76
111
|
size="small"
|
|
77
|
-
|
|
78
|
-
required
|
|
112
|
+
helperText="An error message"
|
|
79
113
|
/>
|
|
80
|
-
</Wrapper>
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
export const Required = () => (
|
|
84
|
-
<Wrapper>
|
|
85
114
|
<TextArea
|
|
86
115
|
placeholder="Placeholder"
|
|
87
|
-
required
|
|
88
116
|
label="Text Label"
|
|
89
|
-
id="
|
|
90
|
-
inputProps={{ "data-testid": "measure-name-
|
|
91
|
-
data-testid="measure-name-text-
|
|
117
|
+
id="measureName3"
|
|
118
|
+
inputProps={{ "data-testid": "measure-name-input3" }}
|
|
119
|
+
data-testid="measure-name-text-field3"
|
|
92
120
|
size="small"
|
|
121
|
+
helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner"
|
|
93
122
|
/>
|
|
94
|
-
</Wrapper>
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
export const Error = () => (
|
|
98
|
-
<Wrapper>
|
|
99
123
|
<TextArea
|
|
100
124
|
placeholder="Placeholder"
|
|
101
125
|
error
|
|
102
126
|
required
|
|
103
127
|
label="Text Label"
|
|
104
|
-
id="
|
|
105
|
-
inputProps={{ "data-testid": "measure-name-
|
|
106
|
-
data-testid="measure-name-text-
|
|
128
|
+
id="measureName4"
|
|
129
|
+
inputProps={{ "data-testid": "measure-name-input4" }}
|
|
130
|
+
data-testid="measure-name-text-field4"
|
|
107
131
|
size="small"
|
|
108
132
|
helperText="An error message"
|
|
109
133
|
/>
|
|
110
|
-
</Wrapper>
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
export const VariedHeights = () => (
|
|
114
|
-
<div
|
|
115
|
-
className="qpp-u-padding--16"
|
|
116
|
-
style={{ width: 900, marginBottom: "16px" }}
|
|
117
|
-
>
|
|
118
|
-
<div style={{ display: "flex", flexDirection: "row" }}>
|
|
119
|
-
<TextArea
|
|
120
|
-
placeholder="Placeholder"
|
|
121
|
-
required
|
|
122
|
-
label="Text Label"
|
|
123
|
-
id="measureName"
|
|
124
|
-
inputProps={{ "data-testid": "measure-name-input" }}
|
|
125
|
-
data-testid="measure-name-text-field"
|
|
126
|
-
size="small"
|
|
127
|
-
helperText="An error message"
|
|
128
|
-
/>
|
|
129
|
-
<TextArea
|
|
130
|
-
placeholder="Placeholder"
|
|
131
|
-
required
|
|
132
|
-
label="Text Label"
|
|
133
|
-
id="measureName"
|
|
134
|
-
inputProps={{ "data-testid": "measure-name-input" }}
|
|
135
|
-
data-testid="measure-name-text-field"
|
|
136
|
-
size="small"
|
|
137
|
-
helperText="An error message"
|
|
138
|
-
/>
|
|
139
|
-
<TextArea
|
|
140
|
-
placeholder="Placeholder"
|
|
141
|
-
label="Text Label"
|
|
142
|
-
id="measureName"
|
|
143
|
-
inputProps={{ "data-testid": "measure-name-input" }}
|
|
144
|
-
data-testid="measure-name-text-field"
|
|
145
|
-
size="small"
|
|
146
|
-
helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner "
|
|
147
|
-
/>
|
|
148
|
-
<TextArea
|
|
149
|
-
placeholder="Placeholder"
|
|
150
|
-
error
|
|
151
|
-
required
|
|
152
|
-
label="Text Label"
|
|
153
|
-
id="measureName"
|
|
154
|
-
inputProps={{ "data-testid": "measure-name-input" }}
|
|
155
|
-
data-testid="measure-name-text-field"
|
|
156
|
-
size="small"
|
|
157
|
-
helperText="An error message"
|
|
158
|
-
/>
|
|
159
|
-
</div>
|
|
160
134
|
</div>
|
|
161
135
|
);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FormControl, FormHelperText, TextareaAutosize } from "@mui/material";
|
|
3
3
|
import InputLabel from "../InputLabel";
|
|
4
|
-
import
|
|
5
|
-
import { ReadOnlyTextField } from "../index";
|
|
4
|
+
import ReadOnlyTextField from "../ReadOnlyTextField";
|
|
6
5
|
|
|
7
6
|
const TextArea = ({
|
|
8
7
|
id,
|
|
@@ -24,7 +23,7 @@ const TextArea = ({
|
|
|
24
23
|
size="small"
|
|
25
24
|
{...rest}
|
|
26
25
|
/>
|
|
27
|
-
)
|
|
26
|
+
);
|
|
28
27
|
}
|
|
29
28
|
// coerce this to avoid issue passing props to dom.
|
|
30
29
|
// text area autosize is deprecated and only takes style rules
|
|
@@ -131,15 +130,4 @@ const TextArea = ({
|
|
|
131
130
|
);
|
|
132
131
|
};
|
|
133
132
|
|
|
134
|
-
TextArea.propTypes = {
|
|
135
|
-
id: PropTypes.string,
|
|
136
|
-
error: PropTypes.bool,
|
|
137
|
-
helperText: PropTypes.string,
|
|
138
|
-
required: PropTypes.bool,
|
|
139
|
-
disabled: PropTypes.bool,
|
|
140
|
-
placeholder: PropTypes.string, // expects placeholder objects of { name: value } and inserts into the render item function.
|
|
141
|
-
label: PropTypes.string,
|
|
142
|
-
inputProps: PropTypes.any,
|
|
143
|
-
maxLength: PropTypes.number,
|
|
144
|
-
};
|
|
145
133
|
export default TextArea;
|