@madie/madie-design-system 1.2.6 → 1.2.8
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/components/AutoComplete/AutoComplete.jsx +2 -2
- package/components/DateField/DateField.jsx +4 -4
- package/components/DateTimeField/DateTimeField.jsx +11 -6
- package/components/DateTimeField/DateTimeField.stories.jsx +2 -2
- package/components/MadieDialog/MadieDialog.stories.js +113 -0
- package/components/MadieDialog/index.jsx +39 -6
- package/components/MadieTooltip/MadieTooltip.stories.js +28 -0
- package/components/MadieTooltip/index.jsx +48 -0
- package/components/MadieTooltipIcon/MadieTooltipIcon.stories.js +23 -0
- package/components/MadieTooltipIcon/index.jsx +31 -0
- package/components/Popover/index.js +3 -2
- package/components/ReadOnlyTextField/index.jsx +48 -4
- package/components/Search/index.js +1 -1
- package/components/TextArea/index.jsx +1 -1
- package/components/TextField/TextField.stories.js +20 -0
- package/components/TextField/index.jsx +78 -42
- package/components/index.js +4 -0
- package/coverage/clover.xml +53 -0
- package/coverage/coverage-final.json +6 -0
- package/coverage/lcov-report/InputLabel/index.html +116 -0
- package/coverage/lcov-report/InputLabel/index.jsx.html +244 -0
- package/coverage/lcov-report/MadieTooltip/index.html +131 -0
- package/coverage/lcov-report/MadieTooltip/index.jsx.html +229 -0
- package/coverage/lcov-report/MadieTooltip/index.scss.html +274 -0
- package/coverage/lcov-report/MadieTooltipIcon/index.html +116 -0
- package/coverage/lcov-report/MadieTooltipIcon/index.jsx.html +178 -0
- package/coverage/lcov-report/TextField/index.html +116 -0
- package/coverage/lcov-report/TextField/index.jsx.html +556 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/react/components/Accordion/index.html +116 -0
- package/coverage/lcov-report/react/components/Accordion/index.jsx.html +370 -0
- package/coverage/lcov-report/react/components/Button/index.html +116 -0
- package/coverage/lcov-report/react/components/Button/index.js.html +385 -0
- package/coverage/lcov-report/react/components/DateField/DateField.jsx.html +355 -0
- package/coverage/lcov-report/react/components/DateField/index.html +116 -0
- package/coverage/lcov-report/react/components/DateTimeField/DateTimeField.jsx.html +340 -0
- package/coverage/lcov-report/react/components/DateTimeField/index.html +116 -0
- package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +364 -0
- package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +178 -0
- package/coverage/lcov-report/react/components/Error/error.js.html +163 -0
- package/coverage/lcov-report/react/components/Error/index.html +146 -0
- package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +496 -0
- package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +697 -0
- package/coverage/lcov-report/react/components/Footer/footer.js.html +175 -0
- package/coverage/lcov-report/react/components/Footer/index.html +146 -0
- package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +310 -0
- package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +208 -0
- package/coverage/lcov-report/react/components/Infotip/index.html +146 -0
- package/coverage/lcov-report/react/components/Infotip/index.js.html +94 -0
- package/coverage/lcov-report/react/components/InputLabel/index.html +116 -0
- package/coverage/lcov-report/react/components/InputLabel/index.jsx.html +244 -0
- package/coverage/lcov-report/react/components/MadieAlert/index.html +116 -0
- package/coverage/lcov-report/react/components/MadieAlert/index.jsx.html +304 -0
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.html +116 -0
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.jsx.html +247 -0
- package/coverage/lcov-report/react/components/MadieDialog/index.html +116 -0
- package/coverage/lcov-report/react/components/MadieDialog/index.jsx.html +955 -0
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.html +116 -0
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.jsx.html +232 -0
- package/coverage/lcov-report/react/components/MadieSpinner/index.html +116 -0
- package/coverage/lcov-report/react/components/MadieSpinner/index.jsx.html +190 -0
- package/coverage/lcov-report/react/components/MadieTooltip/index.html +131 -0
- package/coverage/lcov-report/react/components/MadieTooltip/index.jsx.html +235 -0
- package/coverage/lcov-report/react/components/MadieTooltip/index.scss.html +274 -0
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.html +116 -0
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.jsx.html +178 -0
- package/coverage/lcov-report/react/components/Pagination/index.html +116 -0
- package/coverage/lcov-report/react/components/Pagination/index.jsx.html +736 -0
- package/coverage/lcov-report/react/components/Popover/index.html +116 -0
- package/coverage/lcov-report/react/components/Popover/index.js.html +478 -0
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.html +116 -0
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.jsx.html +514 -0
- package/coverage/lcov-report/react/components/Select/index.html +116 -0
- package/coverage/lcov-report/react/components/Select/index.jsx.html +646 -0
- package/coverage/lcov-report/react/components/Tabs/Tab.js.html +325 -0
- package/coverage/lcov-report/react/components/Tabs/index.html +131 -0
- package/coverage/lcov-report/react/components/Tabs/index.js.html +370 -0
- package/coverage/lcov-report/react/components/TextArea/index.html +116 -0
- package/coverage/lcov-report/react/components/TextArea/index.jsx.html +436 -0
- package/coverage/lcov-report/react/components/TextField/index.html +116 -0
- package/coverage/lcov-report/react/components/TextField/index.jsx.html +556 -0
- package/coverage/lcov-report/react/components/Toast/index.html +116 -0
- package/coverage/lcov-report/react/components/Toast/index.jsx.html +436 -0
- package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +349 -0
- package/coverage/lcov-report/react/components/Tooltip/index.html +146 -0
- package/coverage/lcov-report/react/components/Tooltip/index.js.html +94 -0
- package/coverage/lcov-report/react/components/Tooltip/position.js.html +313 -0
- package/coverage/lcov-report/react/index.html +116 -0
- package/coverage/lcov-report/react/index.js.html +133 -0
- package/coverage/lcov-report/react/lib/Chevron.jsx.html +181 -0
- package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +1777 -0
- package/coverage/lcov-report/react/lib/index.html +131 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +113 -0
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +11 -11
- package/dist/react/index.js.map +1 -1
- package/jest/mediaFileTransformer.js +7 -7
- package/package.json +2 -2
- package/storybook-static/875.f84e25ca.iframe.bundle.js +103 -0
- package/storybook-static/{173.0b985e58.iframe.bundle.js.map → 875.f84e25ca.iframe.bundle.js.map} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.e57b4407.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/styles/_qpp-style.scss +1 -0
- package/styles/components/_madie-tooltip.scss +63 -0
- package/styles/qppds/components/_madie-tooltip.scss +63 -0
- package/styles/qppds/components/index.scss +1 -0
- package/styles/qppds/settings/variables/_color.scss +2 -0
- package/test/components/TextField.test.js +55 -1
- package/storybook-static/173.0b985e58.iframe.bundle.js +0 -103
- package/storybook-static/main.714d9ab1.iframe.bundle.js +0 -1
- /package/storybook-static/{173.0b985e58.iframe.bundle.js.LICENSE.txt → 875.f84e25ca.iframe.bundle.js.LICENSE.txt} +0 -0
|
@@ -34,7 +34,7 @@ const autoCompleteStyles = {
|
|
|
34
34
|
backgroundColor: "#EDEDED",
|
|
35
35
|
border: "#EDEDED",
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
"& .MuiChip-deleteIcon": {
|
|
38
38
|
color: "#757575",
|
|
39
39
|
},
|
|
40
40
|
};
|
|
@@ -216,7 +216,7 @@ const AutoComplete = ({
|
|
|
216
216
|
: renderOptionSingle(props, option);
|
|
217
217
|
}}
|
|
218
218
|
{...rest}
|
|
219
|
-
onChange={(_event, selectedVal, reason, detail
|
|
219
|
+
onChange={(_event, selectedVal, reason, detail) =>
|
|
220
220
|
onChange(id, selectedVal || "", reason, detail)
|
|
221
221
|
}
|
|
222
222
|
/>
|
|
@@ -5,10 +5,10 @@ import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
|
5
5
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
6
6
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
7
7
|
import { kebabCase } from "lodash";
|
|
8
|
-
import dayjs from
|
|
9
|
-
import utc from
|
|
8
|
+
import dayjs from "dayjs";
|
|
9
|
+
import utc from "dayjs/plugin/utc";
|
|
10
10
|
|
|
11
|
-
dayjs.extend(utc)
|
|
11
|
+
dayjs.extend(utc);
|
|
12
12
|
dayjs.utc();
|
|
13
13
|
export const dateTextFieldStyle = {
|
|
14
14
|
width: "170px",
|
|
@@ -84,7 +84,7 @@ DateField.propTypes = {
|
|
|
84
84
|
label: PropTypes.string.isRequired,
|
|
85
85
|
value: PropTypes.object,
|
|
86
86
|
handleDateChange: PropTypes.func.isRequired,
|
|
87
|
-
disabled:PropTypes.bool
|
|
87
|
+
disabled: PropTypes.bool,
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
export default DateField;
|
|
@@ -4,13 +4,13 @@ import InputLabel from "../InputLabel";
|
|
|
4
4
|
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
|
5
5
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
6
6
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
7
|
-
import dayjs from
|
|
8
|
-
import utc from
|
|
7
|
+
import dayjs from "dayjs";
|
|
8
|
+
import utc from "dayjs/plugin/utc";
|
|
9
9
|
|
|
10
10
|
import { FormControl } from "@mui/material";
|
|
11
11
|
import { kebabCase } from "lodash";
|
|
12
12
|
|
|
13
|
-
dayjs.extend(utc)
|
|
13
|
+
dayjs.extend(utc);
|
|
14
14
|
dayjs.utc();
|
|
15
15
|
export const dateTimeTextFieldStyle = {
|
|
16
16
|
width: "240px",
|
|
@@ -44,7 +44,12 @@ export const dateTimeTextFieldStyle = {
|
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const DateTimeField = ({
|
|
47
|
+
const DateTimeField = ({
|
|
48
|
+
label,
|
|
49
|
+
dateTimeValue,
|
|
50
|
+
handleDateTimeChange,
|
|
51
|
+
disabled,
|
|
52
|
+
}) => {
|
|
48
53
|
return (
|
|
49
54
|
<FormControl>
|
|
50
55
|
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
@@ -74,7 +79,7 @@ DateTimeField.propTypes = {
|
|
|
74
79
|
dateTimeValue: PropTypes.object,
|
|
75
80
|
handleDateTimeChange: PropTypes.func.isRequired,
|
|
76
81
|
label: PropTypes.string.isRequired,
|
|
77
|
-
disabled:PropTypes.bool
|
|
82
|
+
disabled: PropTypes.bool,
|
|
78
83
|
};
|
|
79
84
|
|
|
80
|
-
export default DateTimeField;
|
|
85
|
+
export default DateTimeField;
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
export const TimeDateFieldComponent = (args) => {
|
|
12
12
|
const [value, setValue] = useState("");
|
|
13
13
|
const handleDateTimeChange = (e) => {
|
|
14
|
-
setValue(e.target.value)
|
|
14
|
+
setValue(e.target.value);
|
|
15
15
|
};
|
|
16
16
|
return (
|
|
17
17
|
<div className="qpp-u-padding--16">
|
|
@@ -23,4 +23,4 @@ export const TimeDateFieldComponent = (args) => {
|
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
25
25
|
);
|
|
26
|
-
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
|
+
import MadieDialog from "./index";
|
|
5
|
+
import TextArea from "../TextArea/index";
|
|
6
|
+
import Select from "../Select/index";
|
|
7
|
+
import Button from "../Button";
|
|
8
|
+
import { Switch, FormGroup, FormControlLabel } from "@mui/material";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "MadieDialog",
|
|
12
|
+
component: MadieDialog,
|
|
13
|
+
decorators: [withKnobs],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Wrapper = ({ children }) => (
|
|
17
|
+
<div className="qpp-u-padding--16" style={{ width: 300 }}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
Wrapper.propTypes = {
|
|
22
|
+
className: PropTypes.string,
|
|
23
|
+
children: PropTypes.node,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Dialog = () => {
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
const onClose = () => {
|
|
29
|
+
setOpen(false);
|
|
30
|
+
};
|
|
31
|
+
const onContinue = () => {
|
|
32
|
+
setOpen(false);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const [form, setForm] = useState(false);
|
|
36
|
+
const [required, setRequired] = useState(false);
|
|
37
|
+
return (
|
|
38
|
+
<div className="qpp-u-padding--16" style={{ width: 300 }}>
|
|
39
|
+
<FormGroup>
|
|
40
|
+
<FormControlLabel
|
|
41
|
+
control={
|
|
42
|
+
<Switch
|
|
43
|
+
checked={form}
|
|
44
|
+
onChange={(e) => setForm(e.target.checked)}
|
|
45
|
+
name="Form"
|
|
46
|
+
/>
|
|
47
|
+
}
|
|
48
|
+
label="Form"
|
|
49
|
+
/>
|
|
50
|
+
<FormControlLabel
|
|
51
|
+
control={
|
|
52
|
+
<Switch
|
|
53
|
+
checked={required}
|
|
54
|
+
onChange={(e) => setRequired(e.target.checked)}
|
|
55
|
+
name="Required"
|
|
56
|
+
/>
|
|
57
|
+
}
|
|
58
|
+
label="Required"
|
|
59
|
+
/>
|
|
60
|
+
</FormGroup>
|
|
61
|
+
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
62
|
+
open Dialog
|
|
63
|
+
</Button>
|
|
64
|
+
<MadieDialog
|
|
65
|
+
form={form}
|
|
66
|
+
required={required}
|
|
67
|
+
title="Madie Dialog"
|
|
68
|
+
dialogProps={{
|
|
69
|
+
open,
|
|
70
|
+
onClose,
|
|
71
|
+
onSubmit: onContinue,
|
|
72
|
+
}}
|
|
73
|
+
cancelButtonProps={{
|
|
74
|
+
cancelText: "Discard Changes",
|
|
75
|
+
"data-testid": "cancel-button",
|
|
76
|
+
}}
|
|
77
|
+
continueButtonProps={{
|
|
78
|
+
continueText: "Save",
|
|
79
|
+
"data-testid": "save-button",
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<div>
|
|
83
|
+
<Select
|
|
84
|
+
id={`measure-referenceType`}
|
|
85
|
+
label="Type"
|
|
86
|
+
placeHolder={{ name: "Select", value: "" }}
|
|
87
|
+
inputProps={{
|
|
88
|
+
"data-testid": `measure-referenceType-input`,
|
|
89
|
+
}}
|
|
90
|
+
data-testid={`measure-referenceType`}
|
|
91
|
+
required
|
|
92
|
+
SelectDisplayProps={{
|
|
93
|
+
"aria-required": "true",
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
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":
|
|
106
|
+
"measure-referenceText-helper-text",
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
</MadieDialog>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
@@ -36,6 +36,7 @@ const MadieDialog = ({
|
|
|
36
36
|
}
|
|
37
37
|
*/
|
|
38
38
|
form,
|
|
39
|
+
required,
|
|
39
40
|
title,
|
|
40
41
|
dialogProps,
|
|
41
42
|
cancelButtonProps,
|
|
@@ -96,18 +97,49 @@ const MadieDialog = ({
|
|
|
96
97
|
>
|
|
97
98
|
{title}
|
|
98
99
|
</DialogTitle>
|
|
100
|
+
{required && (
|
|
101
|
+
<Box
|
|
102
|
+
sx={{
|
|
103
|
+
display: "flex",
|
|
104
|
+
flexDirection: "row",
|
|
105
|
+
flexGrow: 1,
|
|
106
|
+
alignSelf: "center",
|
|
107
|
+
marginBottom: "-4px",
|
|
108
|
+
marginLeft: "15px",
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<Typography
|
|
112
|
+
style={{
|
|
113
|
+
fontSize: 16,
|
|
114
|
+
fontWeight: 400,
|
|
115
|
+
fontFamily: "Rubik",
|
|
116
|
+
color: "#515151",
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
<span
|
|
120
|
+
style={{
|
|
121
|
+
color: "#D92F2F",
|
|
122
|
+
marginRight: 3,
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
*
|
|
126
|
+
</span>
|
|
127
|
+
Indicates required field
|
|
128
|
+
</Typography>
|
|
129
|
+
</Box>
|
|
130
|
+
)}
|
|
99
131
|
<div>
|
|
100
132
|
<IconButton onClick={onClose} aria-label="Close">
|
|
101
133
|
<CloseIcon
|
|
102
134
|
sx={{
|
|
103
|
-
color: "#
|
|
135
|
+
color: "#D92F2F",
|
|
104
136
|
}}
|
|
105
137
|
data-testid="close-button"
|
|
106
138
|
/>
|
|
107
139
|
</IconButton>
|
|
108
140
|
</div>
|
|
109
141
|
</Box>
|
|
110
|
-
<Divider sx={{borderColor: "#8c8c8c"}}/>
|
|
142
|
+
<Divider sx={{ borderColor: "#8c8c8c" }} />
|
|
111
143
|
<DialogContent sx={{ padding: "32px" }}>
|
|
112
144
|
{showRequiredFieldMessage && (
|
|
113
145
|
<Box
|
|
@@ -141,7 +173,7 @@ const MadieDialog = ({
|
|
|
141
173
|
|
|
142
174
|
{children}
|
|
143
175
|
</DialogContent>
|
|
144
|
-
<Divider sx={{borderColor: "#8c8c8c"}}/>
|
|
176
|
+
<Divider sx={{ borderColor: "#8c8c8c" }} />
|
|
145
177
|
<DialogActions
|
|
146
178
|
sx={{
|
|
147
179
|
padding: "16px",
|
|
@@ -197,18 +229,18 @@ const MadieDialog = ({
|
|
|
197
229
|
<IconButton onClick={onClose} aria-label="Close">
|
|
198
230
|
<CloseIcon
|
|
199
231
|
sx={{
|
|
200
|
-
color: "#
|
|
232
|
+
color: "#D92F2F",
|
|
201
233
|
}}
|
|
202
234
|
data-testid="close-button"
|
|
203
235
|
/>
|
|
204
236
|
</IconButton>
|
|
205
237
|
</div>
|
|
206
238
|
</Box>
|
|
207
|
-
<Divider sx={{borderColor: "#8c8c8c"}}/>
|
|
239
|
+
<Divider sx={{ borderColor: "#8c8c8c" }} />
|
|
208
240
|
<DialogContent sx={{ padding: "32px" }}>
|
|
209
241
|
{children}
|
|
210
242
|
</DialogContent>
|
|
211
|
-
<Divider sx={{borderColor: "#8c8c8c"}}/>
|
|
243
|
+
<Divider sx={{ borderColor: "#8c8c8c" }} />
|
|
212
244
|
<DialogActions
|
|
213
245
|
sx={{
|
|
214
246
|
padding: "16px",
|
|
@@ -246,6 +278,7 @@ const MadieDialog = ({
|
|
|
246
278
|
};
|
|
247
279
|
|
|
248
280
|
MadieDialog.propTypes = {
|
|
281
|
+
required: PropTypes.bool,
|
|
249
282
|
form: PropTypes.bool,
|
|
250
283
|
title: PropTypes.string,
|
|
251
284
|
dialogProps: PropTypes.object,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import MadieTooltip from "./index";
|
|
3
|
+
|
|
4
|
+
const offsetDecorator = (storyFn) => (
|
|
5
|
+
<div style={{ marginLeft: 120, marginTop: 25 }}>{storyFn()}</div>
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "MadieTooltip",
|
|
10
|
+
component: MadieTooltip,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ExampleTooltip = () => (
|
|
14
|
+
<div>
|
|
15
|
+
<div>
|
|
16
|
+
<MadieTooltip text="Input the new version #" />
|
|
17
|
+
</div>
|
|
18
|
+
<div style={{ marginLeft: 200 }}>
|
|
19
|
+
<MadieTooltip color="#000" />
|
|
20
|
+
</div>
|
|
21
|
+
<div style={{ marginLeft: 350 }}>
|
|
22
|
+
<MadieTooltip color="#000" />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
ExampleTooltip.storyName = "Madie Tooltip example";
|
|
28
|
+
ExampleTooltip.decorators = [offsetDecorator];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import TooltipIcon from "../MadieTooltipIcon";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
|
|
5
|
+
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role
|
|
6
|
+
const MadieToolTip = ({ tooltipText = "informational text", id }) => {
|
|
7
|
+
const [activeTip, setActiveTip] = useState(false);
|
|
8
|
+
return (
|
|
9
|
+
<button
|
|
10
|
+
data-testid={`${id}-button`}
|
|
11
|
+
tabIndex={0}
|
|
12
|
+
onFocus={() => setActiveTip(true)}
|
|
13
|
+
onBlur={() => {
|
|
14
|
+
setActiveTip(false);
|
|
15
|
+
}}
|
|
16
|
+
onMouseEnter={() => {
|
|
17
|
+
setActiveTip(true);
|
|
18
|
+
}}
|
|
19
|
+
onMouseLeave={() => {
|
|
20
|
+
setActiveTip(false);
|
|
21
|
+
}}
|
|
22
|
+
onKeyDown={(e) => {
|
|
23
|
+
if (e.key === "Escape") {
|
|
24
|
+
setActiveTip(false);
|
|
25
|
+
}
|
|
26
|
+
}}
|
|
27
|
+
className="madie-tooltip-button"
|
|
28
|
+
>
|
|
29
|
+
<TooltipIcon />
|
|
30
|
+
<div
|
|
31
|
+
role="tooltip"
|
|
32
|
+
id={id}
|
|
33
|
+
data-testid={id}
|
|
34
|
+
aria-live="polite"
|
|
35
|
+
className={activeTip ? "madie-tooltip" : "madie-tooltip hidden"}
|
|
36
|
+
>
|
|
37
|
+
<p>{tooltipText}</p>
|
|
38
|
+
</div>
|
|
39
|
+
</button>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
MadieToolTip.propTypes = {
|
|
44
|
+
tooltipText: PropTypes.string,
|
|
45
|
+
id: PropTypes.string,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default MadieToolTip;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import MadieToolTipIcon from "./index";
|
|
3
|
+
|
|
4
|
+
const offsetDecorator = (storyFn) => (
|
|
5
|
+
<div style={{ margin: "80px" }}>{storyFn()}</div>
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "MadieToolTipIcon",
|
|
10
|
+
component: MadieToolTipIcon,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ExampleTooltipIcon = () => (
|
|
14
|
+
<div>
|
|
15
|
+
<div>
|
|
16
|
+
{`<TooltipIcon color="#0073C8"/>`}
|
|
17
|
+
<MadieToolTipIcon />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
ExampleTooltipIcon.storyName = "Madie Tooltip Icon example";
|
|
23
|
+
ExampleTooltipIcon.decorators = [offsetDecorator];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
const TooltipIcon = ({ color = "#0073C8", ...props }) => (
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
width="14"
|
|
8
|
+
height="14"
|
|
9
|
+
viewBox="0 0 14 14"
|
|
10
|
+
fill="none"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<g clipPath="url(#clip0_17397_1786)">
|
|
14
|
+
<path
|
|
15
|
+
d="M6.4165 10.5H7.58317V9.33334H6.4165V10.5ZM6.99984 1.16667C3.77984 1.16667 1.1665 3.78001 1.1665 7.00001C1.1665 10.22 3.77984 12.8333 6.99984 12.8333C10.2198 12.8333 12.8332 10.22 12.8332 7.00001C12.8332 3.78001 10.2198 1.16667 6.99984 1.16667ZM6.99984 11.6667C4.42734 11.6667 2.33317 9.57251 2.33317 7.00001C2.33317 4.42751 4.42734 2.33334 6.99984 2.33334C9.57234 2.33334 11.6665 4.42751 11.6665 7.00001C11.6665 9.57251 9.57234 11.6667 6.99984 11.6667ZM6.99984 3.50001C5.71067 3.50001 4.6665 4.54417 4.6665 5.83334H5.83317C5.83317 5.19167 6.35817 4.66667 6.99984 4.66667C7.6415 4.66667 8.1665 5.19167 8.1665 5.83334C8.1665 7.00001 6.4165 6.85417 6.4165 8.75001H7.58317C7.58317 7.43751 9.33317 7.29167 9.33317 5.83334C9.33317 4.54417 8.289 3.50001 6.99984 3.50001Z"
|
|
16
|
+
fill={color}
|
|
17
|
+
/>
|
|
18
|
+
</g>
|
|
19
|
+
<defs>
|
|
20
|
+
<clipPath id="clip0_17397_1786">
|
|
21
|
+
<rect width="14" height="14" fill={color} />
|
|
22
|
+
</clipPath>
|
|
23
|
+
</defs>
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default TooltipIcon;
|
|
28
|
+
|
|
29
|
+
TooltipIcon.propTypes = {
|
|
30
|
+
color: PropTypes.string,
|
|
31
|
+
};
|
|
@@ -44,8 +44,9 @@ const MadiePopover = ({
|
|
|
44
44
|
height: "16px",
|
|
45
45
|
width: "16px",
|
|
46
46
|
background: "#F7F7F7",
|
|
47
|
-
border:
|
|
48
|
-
borderColor:
|
|
47
|
+
border: "solid 1px #8c8c8c",
|
|
48
|
+
borderColor:
|
|
49
|
+
"#8c8c8c transparent transparent #8c8c8c",
|
|
49
50
|
content: '""',
|
|
50
51
|
transform: "rotate(45deg)",
|
|
51
52
|
},
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
FormControl,
|
|
4
|
+
TextField as MUITextField,
|
|
3
5
|
FormHelperText,
|
|
4
|
-
|
|
6
|
+
} from "@mui/material";
|
|
5
7
|
import InputLabel from "../InputLabel";
|
|
6
8
|
import PropTypes from "prop-types";
|
|
7
9
|
|
|
@@ -16,12 +18,53 @@ const ReadOnlyTextField = ({
|
|
|
16
18
|
}) => {
|
|
17
19
|
return (
|
|
18
20
|
<FormControl fullWidth error={error}>
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
width: 1,
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexDirection: "column",
|
|
26
|
+
flexGrow: 1,
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
19
29
|
<InputLabel
|
|
20
30
|
disabled={disabled}
|
|
21
31
|
shrink
|
|
22
32
|
required={required}
|
|
23
33
|
error={error}
|
|
24
34
|
htmlFor={id}
|
|
35
|
+
sx={[
|
|
36
|
+
{
|
|
37
|
+
backgroundColor: "transparent",
|
|
38
|
+
display: "flex",
|
|
39
|
+
flexDirection: "row-reverse",
|
|
40
|
+
alignSelf: "baseline",
|
|
41
|
+
textTransform: "none",
|
|
42
|
+
// force it outside the select box
|
|
43
|
+
position: "initial",
|
|
44
|
+
transform: "translateX(0px) translateY(0px)",
|
|
45
|
+
fontFamily: "Rubik",
|
|
46
|
+
fontWeight: 500,
|
|
47
|
+
fontSize: 14,
|
|
48
|
+
color: "#333",
|
|
49
|
+
"& .MuiInputLabel-asterisk": {
|
|
50
|
+
color: "#AE1C1C !important",
|
|
51
|
+
marginRight: "3px !important",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required && {
|
|
55
|
+
transform: "translateX(-12px) translateY(0px)",
|
|
56
|
+
"& .MuiInputLabel-asterisk": {
|
|
57
|
+
color: "#D92F2",
|
|
58
|
+
marginRight: "3px !important", //this was
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
disabled && {
|
|
62
|
+
color: "rgba(0,0,0,0.6)",
|
|
63
|
+
},
|
|
64
|
+
error && {
|
|
65
|
+
color: "#AE1C1C !important",
|
|
66
|
+
},
|
|
67
|
+
]}
|
|
25
68
|
>
|
|
26
69
|
{label}
|
|
27
70
|
</InputLabel>
|
|
@@ -47,14 +90,15 @@ const ReadOnlyTextField = ({
|
|
|
47
90
|
)}
|
|
48
91
|
<MUITextField
|
|
49
92
|
sx={{
|
|
50
|
-
height: 40, //there's a .13 coming from somewhere.
|
|
51
93
|
border: "none",
|
|
52
94
|
"& .MuiOutlinedInput-root": {
|
|
53
95
|
"& > fieldset": {
|
|
54
96
|
border: "none",
|
|
55
97
|
},
|
|
56
98
|
},
|
|
57
|
-
|
|
99
|
+
"& .MuiInputBase-root": {
|
|
100
|
+
height: "40px",
|
|
101
|
+
},
|
|
58
102
|
"& .MuiInputBase-input": {
|
|
59
103
|
lineHeight: "19px",
|
|
60
104
|
fontFamily: "Rubik",
|
|
@@ -93,6 +93,26 @@ export const Error = () => (
|
|
|
93
93
|
</Wrapper>
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
+
export const WithToolTipText = () => (
|
|
97
|
+
<Wrapper>
|
|
98
|
+
<TextField
|
|
99
|
+
placeholder="Placeholder"
|
|
100
|
+
label="Confirm New Version #"
|
|
101
|
+
data-testid="measure-name-text-field"
|
|
102
|
+
size="small"
|
|
103
|
+
tooltipText="Input the new version # located to the left to confirm."
|
|
104
|
+
helperText="test"
|
|
105
|
+
id="measure-name"
|
|
106
|
+
// previously this was how it was done. it could make more sense to only pass it an id and progrematically determine it. Example:
|
|
107
|
+
// inputProps={{
|
|
108
|
+
// "data-testid": "measure-name-input",
|
|
109
|
+
// "aria-describedby":
|
|
110
|
+
// "measure-name-helper-text measure-name-tooltip",
|
|
111
|
+
// }}
|
|
112
|
+
/>
|
|
113
|
+
</Wrapper>
|
|
114
|
+
);
|
|
115
|
+
|
|
96
116
|
export const VariedHeights = () => (
|
|
97
117
|
<div
|
|
98
118
|
className="qpp-u-padding--16"
|