@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,9 +1,8 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import MadieDialog from "./index";
|
|
5
|
-
import TextArea from "../TextArea
|
|
6
|
-
import Select from "../Select
|
|
4
|
+
import TextArea from "../TextArea";
|
|
5
|
+
import Select from "../Select";
|
|
7
6
|
import Button from "../Button";
|
|
8
7
|
import { Switch, FormGroup, FormControlLabel } from "@mui/material";
|
|
9
8
|
import { DialogContent, Typography } from "@mui/material";
|
|
@@ -11,7 +10,6 @@ import { DialogContent, Typography } from "@mui/material";
|
|
|
11
10
|
export default {
|
|
12
11
|
title: "MadieDialog",
|
|
13
12
|
component: MadieDialog,
|
|
14
|
-
decorators: [withKnobs],
|
|
15
13
|
};
|
|
16
14
|
|
|
17
15
|
const Wrapper = ({ children }) => (
|
|
@@ -26,39 +24,29 @@ Wrapper.propTypes = {
|
|
|
26
24
|
|
|
27
25
|
export const Dialog = () => {
|
|
28
26
|
const [open, setOpen] = useState(false);
|
|
29
|
-
const onClose = () => {
|
|
30
|
-
setOpen(false);
|
|
31
|
-
};
|
|
32
|
-
const onContinue = () => {
|
|
33
|
-
setOpen(false);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
27
|
const [form, setForm] = useState(false);
|
|
37
28
|
const [required, setRequired] = useState(false);
|
|
38
29
|
const [showDialogActions, setShowDialogActions] = useState(false);
|
|
39
30
|
|
|
31
|
+
const onClose = () => setOpen(false);
|
|
32
|
+
const onContinue = () => setOpen(false);
|
|
33
|
+
|
|
40
34
|
const cancelButtonProps = showDialogActions
|
|
41
|
-
? {
|
|
42
|
-
cancelText: "Discard Changes",
|
|
43
|
-
"data-testid": "cancel-button",
|
|
44
|
-
}
|
|
35
|
+
? { cancelText: "Discard Changes", "data-testid": "cancel-button" }
|
|
45
36
|
: undefined;
|
|
37
|
+
|
|
46
38
|
const continueButtonProps = showDialogActions
|
|
47
|
-
? {
|
|
48
|
-
continueText: "Save",
|
|
49
|
-
"data-testid": "save-button",
|
|
50
|
-
}
|
|
39
|
+
? { continueText: "Save", "data-testid": "save-button" }
|
|
51
40
|
: undefined;
|
|
52
41
|
|
|
53
42
|
return (
|
|
54
|
-
<
|
|
43
|
+
<Wrapper>
|
|
55
44
|
<FormGroup>
|
|
56
45
|
<FormControlLabel
|
|
57
46
|
control={
|
|
58
47
|
<Switch
|
|
59
48
|
checked={form}
|
|
60
49
|
onChange={(e) => setForm(e.target.checked)}
|
|
61
|
-
name="Form"
|
|
62
50
|
/>
|
|
63
51
|
}
|
|
64
52
|
label="Form"
|
|
@@ -68,7 +56,6 @@ export const Dialog = () => {
|
|
|
68
56
|
<Switch
|
|
69
57
|
checked={required}
|
|
70
58
|
onChange={(e) => setRequired(e.target.checked)}
|
|
71
|
-
name="Required"
|
|
72
59
|
/>
|
|
73
60
|
}
|
|
74
61
|
label="Required"
|
|
@@ -80,10 +67,9 @@ export const Dialog = () => {
|
|
|
80
67
|
onChange={(e) =>
|
|
81
68
|
setShowDialogActions(e.target.checked)
|
|
82
69
|
}
|
|
83
|
-
name="actions"
|
|
84
70
|
/>
|
|
85
71
|
}
|
|
86
|
-
label="
|
|
72
|
+
label="Show Actions"
|
|
87
73
|
/>
|
|
88
74
|
</FormGroup>
|
|
89
75
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
@@ -93,52 +79,40 @@ export const Dialog = () => {
|
|
|
93
79
|
form={form}
|
|
94
80
|
required={required}
|
|
95
81
|
title="Madie Dialog"
|
|
96
|
-
dialogProps={{
|
|
97
|
-
open,
|
|
98
|
-
onClose,
|
|
99
|
-
onSubmit: onContinue,
|
|
100
|
-
}}
|
|
82
|
+
dialogProps={{ open, onClose, onSubmit: onContinue }}
|
|
101
83
|
cancelButtonProps={cancelButtonProps}
|
|
102
84
|
continueButtonProps={continueButtonProps}
|
|
103
85
|
>
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"data-testid": "measure-referenceText-input",
|
|
127
|
-
"aria-describedby":
|
|
128
|
-
"measure-referenceText-helper-text",
|
|
129
|
-
}}
|
|
130
|
-
/>
|
|
131
|
-
</div>
|
|
86
|
+
<Select
|
|
87
|
+
id="measure-referenceType"
|
|
88
|
+
label="Type"
|
|
89
|
+
placeHolder={{ name: "Select", value: "" }}
|
|
90
|
+
inputProps={{
|
|
91
|
+
"data-testid": "measure-referenceType-input",
|
|
92
|
+
}}
|
|
93
|
+
data-testid="measure-referenceType"
|
|
94
|
+
required
|
|
95
|
+
SelectDisplayProps={{ "aria-required": "true" }}
|
|
96
|
+
/>
|
|
97
|
+
<TextArea
|
|
98
|
+
required
|
|
99
|
+
label="Reference"
|
|
100
|
+
placeholder="Enter"
|
|
101
|
+
id="measure-referenceText"
|
|
102
|
+
data-testid="measure-referenceText"
|
|
103
|
+
inputProps={{
|
|
104
|
+
"data-testid": "measure-referenceText-input",
|
|
105
|
+
"aria-describedby": "measure-referenceText-helper-text",
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
132
108
|
</MadieDialog>
|
|
133
|
-
</
|
|
109
|
+
</Wrapper>
|
|
134
110
|
);
|
|
135
111
|
};
|
|
136
112
|
|
|
137
113
|
export const DialogWithActionButtons = () => {
|
|
138
114
|
const [open, setOpen] = useState(false);
|
|
139
|
-
const onClose = () =>
|
|
140
|
-
setOpen(false);
|
|
141
|
-
};
|
|
115
|
+
const onClose = () => setOpen(false);
|
|
142
116
|
|
|
143
117
|
return (
|
|
144
118
|
<>
|
|
@@ -147,19 +121,8 @@ export const DialogWithActionButtons = () => {
|
|
|
147
121
|
</Button>
|
|
148
122
|
<MadieDialog
|
|
149
123
|
title="Human Readable"
|
|
150
|
-
sx={{
|
|
151
|
-
|
|
152
|
-
h2: {
|
|
153
|
-
borderTop: "1px solid black",
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
}}
|
|
157
|
-
dialogProps={{
|
|
158
|
-
onClose,
|
|
159
|
-
open,
|
|
160
|
-
maxWidth: "lg",
|
|
161
|
-
fullWidth: true,
|
|
162
|
-
}}
|
|
124
|
+
sx={{ "#modal-body h2": { borderTop: "1px solid black" } }}
|
|
125
|
+
dialogProps={{ onClose, open, maxWidth: "lg", fullWidth: true }}
|
|
163
126
|
cancelButtonProps={{
|
|
164
127
|
variant: "secondary",
|
|
165
128
|
cancelText: "Cancel",
|
|
@@ -186,9 +149,7 @@ export const DialogWithActionButtons = () => {
|
|
|
186
149
|
|
|
187
150
|
export const DialogWithActionButtonsHideContinueButton = () => {
|
|
188
151
|
const [open, setOpen] = useState(false);
|
|
189
|
-
const onClose = () =>
|
|
190
|
-
setOpen(false);
|
|
191
|
-
};
|
|
152
|
+
const onClose = () => setOpen(false);
|
|
192
153
|
|
|
193
154
|
return (
|
|
194
155
|
<>
|
|
@@ -197,19 +158,8 @@ export const DialogWithActionButtonsHideContinueButton = () => {
|
|
|
197
158
|
</Button>
|
|
198
159
|
<MadieDialog
|
|
199
160
|
title="Human Readable"
|
|
200
|
-
sx={{
|
|
201
|
-
|
|
202
|
-
h2: {
|
|
203
|
-
borderTop: "1px solid black",
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
}}
|
|
207
|
-
dialogProps={{
|
|
208
|
-
onClose,
|
|
209
|
-
open,
|
|
210
|
-
maxWidth: "lg",
|
|
211
|
-
fullWidth: true,
|
|
212
|
-
}}
|
|
161
|
+
sx={{ "#modal-body h2": { borderTop: "1px solid black" } }}
|
|
162
|
+
dialogProps={{ onClose, open, maxWidth: "lg", fullWidth: true }}
|
|
213
163
|
cancelButtonProps={{
|
|
214
164
|
variant: "secondary",
|
|
215
165
|
cancelText: "Cancel",
|
|
@@ -231,9 +181,7 @@ export const DialogWithActionButtonsHideContinueButton = () => {
|
|
|
231
181
|
|
|
232
182
|
export const DialogWithActionButtonsContinueButtonDisabledWithTooltip = () => {
|
|
233
183
|
const [open, setOpen] = useState(false);
|
|
234
|
-
const onClose = () =>
|
|
235
|
-
setOpen(false);
|
|
236
|
-
};
|
|
184
|
+
const onClose = () => setOpen(false);
|
|
237
185
|
|
|
238
186
|
return (
|
|
239
187
|
<>
|
|
@@ -242,19 +190,8 @@ export const DialogWithActionButtonsContinueButtonDisabledWithTooltip = () => {
|
|
|
242
190
|
</Button>
|
|
243
191
|
<MadieDialog
|
|
244
192
|
title="Human Readable"
|
|
245
|
-
sx={{
|
|
246
|
-
|
|
247
|
-
h2: {
|
|
248
|
-
borderTop: "1px solid black",
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
}}
|
|
252
|
-
dialogProps={{
|
|
253
|
-
onClose,
|
|
254
|
-
open,
|
|
255
|
-
maxWidth: "lg",
|
|
256
|
-
fullWidth: true,
|
|
257
|
-
}}
|
|
193
|
+
sx={{ "#modal-body h2": { borderTop: "1px solid black" } }}
|
|
194
|
+
dialogProps={{ onClose, open, maxWidth: "lg", fullWidth: true }}
|
|
258
195
|
cancelButtonProps={{
|
|
259
196
|
variant: "secondary",
|
|
260
197
|
cancelText: "Cancel",
|
|
@@ -283,9 +220,7 @@ export const DialogWithActionButtonsContinueButtonDisabledWithTooltip = () => {
|
|
|
283
220
|
|
|
284
221
|
export const DialogWithPopoverActionButtons = () => {
|
|
285
222
|
const [open, setOpen] = useState(false);
|
|
286
|
-
const onClose = () =>
|
|
287
|
-
setOpen(false);
|
|
288
|
-
};
|
|
223
|
+
const onClose = () => setOpen(false);
|
|
289
224
|
|
|
290
225
|
return (
|
|
291
226
|
<>
|
|
@@ -294,13 +229,7 @@ export const DialogWithPopoverActionButtons = () => {
|
|
|
294
229
|
</Button>
|
|
295
230
|
<MadieDialog
|
|
296
231
|
title="Dialog with popover action buttons"
|
|
297
|
-
sx={{
|
|
298
|
-
"#modal-body": {
|
|
299
|
-
h2: {
|
|
300
|
-
borderTop: "1px solid black",
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
}}
|
|
232
|
+
sx={{ "#modal-body h2": { borderTop: "1px solid black" } }}
|
|
304
233
|
dialogProps={{
|
|
305
234
|
onClose,
|
|
306
235
|
open,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import Draggable from "react-draggable";
|
|
4
4
|
import CloseIcon from "@mui/icons-material/Close";
|
|
@@ -17,14 +17,16 @@ import Button from "../Button";
|
|
|
17
17
|
import Popover from "../Popover";
|
|
18
18
|
|
|
19
19
|
const DraggablePaper = (props) => {
|
|
20
|
+
const nodeRef = useRef(null);
|
|
20
21
|
const { children, ...rest } = props;
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
24
|
<Draggable
|
|
24
25
|
handle="#draggable-dialog-title"
|
|
25
26
|
cancel={'[class*="MuiDialogContent-root"]'} // Prevent dragging when interacting with content
|
|
27
|
+
nodeRef={nodeRef}
|
|
26
28
|
>
|
|
27
|
-
<div style={{ backgroundColor: "#fff" }}
|
|
29
|
+
<div ref={nodeRef} {...rest} style={{ backgroundColor: "#fff" }}>
|
|
28
30
|
{children}
|
|
29
31
|
</div>
|
|
30
32
|
</Draggable>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import MadieDiscardDialog from "./index";
|
|
5
4
|
import Button from "../Button";
|
|
5
|
+
|
|
6
6
|
export default {
|
|
7
7
|
title: "MadieDiscardDialog",
|
|
8
8
|
component: MadieDiscardDialog,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
const Wrapper = ({ children }) => (
|
|
@@ -22,16 +21,15 @@ Wrapper.propTypes = {
|
|
|
22
21
|
export const DiscardDialog = () => {
|
|
23
22
|
const [open, setOpen] = useState(false);
|
|
24
23
|
const [text, setText] = useState("I'm some text that you may discard");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
24
|
+
|
|
25
|
+
const onClose = () => setOpen(false);
|
|
28
26
|
const onContinue = () => {
|
|
29
27
|
setText("");
|
|
30
28
|
setOpen(false);
|
|
31
29
|
};
|
|
32
30
|
|
|
33
31
|
return (
|
|
34
|
-
<
|
|
32
|
+
<Wrapper>
|
|
35
33
|
<p>{text}</p>
|
|
36
34
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
37
35
|
open Dialog
|
|
@@ -41,6 +39,6 @@ export const DiscardDialog = () => {
|
|
|
41
39
|
onContinue={onContinue}
|
|
42
40
|
onClose={onClose}
|
|
43
41
|
/>
|
|
44
|
-
</
|
|
42
|
+
</Wrapper>
|
|
45
43
|
);
|
|
46
44
|
};
|
|
@@ -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 MadieSpinner from "./index";
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: "MadieSpinner",
|
|
8
7
|
component: MadieSpinner,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -26,4 +24,4 @@ export const ExampleSpinner = () => (
|
|
|
26
24
|
</Wrapper>
|
|
27
25
|
);
|
|
28
26
|
|
|
29
|
-
ExampleSpinner.storyName = "
|
|
27
|
+
ExampleSpinner.storyName = "Example Madie Spinner";
|
|
@@ -11,9 +11,14 @@ export default {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export const ExampleTooltip = () => (
|
|
14
|
-
<div
|
|
14
|
+
<div
|
|
15
|
+
style={{
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "row",
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
15
20
|
<div>
|
|
16
|
-
<MadieTooltip
|
|
21
|
+
<MadieTooltip tooltipText="Input the new version #" />
|
|
17
22
|
</div>
|
|
18
23
|
<div style={{ marginLeft: 200 }}>
|
|
19
24
|
<MadieTooltip color="#000" />
|
|
@@ -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,23 +1,29 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const ExampleNotificationBanner = () => (
|
|
12
|
-
<NotificationBanner
|
|
13
|
-
result={{
|
|
7
|
+
args: {
|
|
8
|
+
result: {
|
|
14
9
|
content: "CONTENT",
|
|
15
10
|
label: "Label",
|
|
16
11
|
name: "name",
|
|
17
12
|
color: "blue",
|
|
18
|
-
dismissable:
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
dismissable: false,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
result: {
|
|
18
|
+
control: "object",
|
|
19
|
+
},
|
|
20
|
+
"result.dismissable": {
|
|
21
|
+
control: "boolean",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Template = (args) => <NotificationBanner {...args} />;
|
|
22
27
|
|
|
28
|
+
export const ExampleNotificationBanner = Template.bind({});
|
|
23
29
|
ExampleNotificationBanner.storyName = "example NotificationBanner";
|
|
@@ -38,7 +38,7 @@ class NotificationBanner extends Component {
|
|
|
38
38
|
if (Object.keys(notifications).length > 0) {
|
|
39
39
|
this.setState({
|
|
40
40
|
expanded: this.isNotificationExpanded(
|
|
41
|
-
notifications.content
|
|
41
|
+
notifications.content,
|
|
42
42
|
),
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -110,7 +110,7 @@ class NotificationBanner extends Component {
|
|
|
110
110
|
...storageNotification.content,
|
|
111
111
|
dateDismissed,
|
|
112
112
|
},
|
|
113
|
-
})
|
|
113
|
+
}),
|
|
114
114
|
);
|
|
115
115
|
} else {
|
|
116
116
|
window.localStorage.setItem(
|
|
@@ -121,7 +121,7 @@ class NotificationBanner extends Component {
|
|
|
121
121
|
name: "header-notification",
|
|
122
122
|
dateDismissed,
|
|
123
123
|
},
|
|
124
|
-
})
|
|
124
|
+
}),
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
127
|
}
|