@madie/madie-design-system 1.2.53 → 1.2.55
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/MadieAlert/index.jsx +46 -10
- package/components/RichTextEditor/RichTextEditor.stories.js +28 -0
- package/components/RichTextEditor/index.jsx +263 -0
- package/components/index.js +4 -2
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +32 -32
- package/dist/react/index.js.map +1 -1
- package/package.json +156 -145
- package/styles/_qpp-style.scss +1 -0
- package/styles/components/_rich-text-editor.scss +199 -0
- package/styles/qppds/components/_rich-text-editor.scss +200 -0
- package/styles/qppds/components/index.scss +1 -0
- package/test/components/MadieAlert.test.js +65 -2
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
.control-group {
|
|
2
|
+
border: solid 1px #9c9c9c;
|
|
3
|
+
border-top-left-radius: 3px;
|
|
4
|
+
border-top-right-radius: 3px;
|
|
5
|
+
background-color: #ededed;
|
|
6
|
+
padding-left: 4px;
|
|
7
|
+
padding-right: 4px;
|
|
8
|
+
|
|
9
|
+
.button-group > button {
|
|
10
|
+
padding: 18px;
|
|
11
|
+
border-radius: 0;
|
|
12
|
+
height: 24px;
|
|
13
|
+
width: 24px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/* Basic editor styles */
|
|
17
|
+
.tiptap {
|
|
18
|
+
border: solid 1px #9c9c9c;
|
|
19
|
+
border-top: 0;
|
|
20
|
+
border-bottom-left-radius: 3px;
|
|
21
|
+
border-bottom-right-radius: 3px;
|
|
22
|
+
padding-left: 4px;
|
|
23
|
+
padding-right: 4px;
|
|
24
|
+
|
|
25
|
+
:first-child {
|
|
26
|
+
margin-top: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* List styles */
|
|
30
|
+
ul,
|
|
31
|
+
ol {
|
|
32
|
+
padding: 0 1rem;
|
|
33
|
+
margin: 1.25rem 1rem 1.25rem 0.4rem;
|
|
34
|
+
|
|
35
|
+
li p {
|
|
36
|
+
margin-top: 0.25em;
|
|
37
|
+
margin-bottom: 0.25em;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//unorder
|
|
41
|
+
ul {
|
|
42
|
+
list-style: disc;
|
|
43
|
+
li {
|
|
44
|
+
margin-bottom: 5px;
|
|
45
|
+
}
|
|
46
|
+
li:before {
|
|
47
|
+
margin-right: 10px;
|
|
48
|
+
color: #000;
|
|
49
|
+
text-align: center;
|
|
50
|
+
display: inline-block;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//order
|
|
55
|
+
ol {
|
|
56
|
+
counter-reset: item;
|
|
57
|
+
list-style: decimal;
|
|
58
|
+
|
|
59
|
+
li {
|
|
60
|
+
counter-increment: item;
|
|
61
|
+
margin-bottom: 5px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Heading styles */
|
|
66
|
+
h1,
|
|
67
|
+
h2,
|
|
68
|
+
h3,
|
|
69
|
+
h4,
|
|
70
|
+
h5,
|
|
71
|
+
h6 {
|
|
72
|
+
line-height: 1.1;
|
|
73
|
+
margin-top: 2.5rem;
|
|
74
|
+
text-wrap: pretty;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
h1,
|
|
78
|
+
h2 {
|
|
79
|
+
margin-top: 3.5rem;
|
|
80
|
+
margin-bottom: 1.5rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
h1 {
|
|
84
|
+
font-size: 1.4rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
h2 {
|
|
88
|
+
font-size: 1.2rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
h3 {
|
|
92
|
+
font-size: 1.1rem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
h4,
|
|
96
|
+
h5,
|
|
97
|
+
h6 {
|
|
98
|
+
font-size: 1rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Code and preformatted text styles */
|
|
102
|
+
code {
|
|
103
|
+
background-color: var(--purple-light);
|
|
104
|
+
border-radius: 0.4rem;
|
|
105
|
+
color: var(--black);
|
|
106
|
+
font-size: 0.85rem;
|
|
107
|
+
padding: 0.25em 0.3em;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
pre {
|
|
111
|
+
background: var(--black);
|
|
112
|
+
border-radius: 0.5rem;
|
|
113
|
+
color: var(--white);
|
|
114
|
+
font-family: "JetBrainsMono", monospace;
|
|
115
|
+
margin: 1.5rem 0;
|
|
116
|
+
padding: 0.75rem 1rem;
|
|
117
|
+
|
|
118
|
+
code {
|
|
119
|
+
background: none;
|
|
120
|
+
color: inherit;
|
|
121
|
+
font-size: 0.8rem;
|
|
122
|
+
padding: 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
blockquote {
|
|
127
|
+
border-left: 3px solid var(--gray-3);
|
|
128
|
+
margin: 1.5rem 0;
|
|
129
|
+
padding-left: 1rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
hr {
|
|
133
|
+
border: none;
|
|
134
|
+
border-top: 1px solid var(--gray-2);
|
|
135
|
+
margin: 2rem 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Bubble menu */
|
|
140
|
+
.bubble-menu {
|
|
141
|
+
background-color: var(--white);
|
|
142
|
+
border: 1px solid var(--gray-1);
|
|
143
|
+
border-radius: 0.7rem;
|
|
144
|
+
box-shadow: var(--shadow);
|
|
145
|
+
display: flex;
|
|
146
|
+
padding: 0.2rem;
|
|
147
|
+
|
|
148
|
+
button {
|
|
149
|
+
background-color: unset;
|
|
150
|
+
|
|
151
|
+
&:hover {
|
|
152
|
+
background-color: var(--gray-3);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&.is-active {
|
|
156
|
+
background-color: var(--purple);
|
|
157
|
+
|
|
158
|
+
&:hover {
|
|
159
|
+
background-color: var(--purple-contrast);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Floating menu */
|
|
166
|
+
.floating-menu {
|
|
167
|
+
display: flex;
|
|
168
|
+
background-color: var(--gray-3);
|
|
169
|
+
padding: 0.1rem;
|
|
170
|
+
border-radius: 0.5rem;
|
|
171
|
+
|
|
172
|
+
button {
|
|
173
|
+
background-color: unset;
|
|
174
|
+
padding: 0.275rem 0.425rem;
|
|
175
|
+
border-radius: 0.3rem;
|
|
176
|
+
|
|
177
|
+
&:hover {
|
|
178
|
+
background-color: var(--gray-3);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&.is-active {
|
|
182
|
+
background-color: var(--white);
|
|
183
|
+
color: var(--purple);
|
|
184
|
+
|
|
185
|
+
&:hover {
|
|
186
|
+
color: var(--purple-contrast);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
table {
|
|
193
|
+
border: solid 1px #000;
|
|
194
|
+
tr {
|
|
195
|
+
border: solid 1px #000;
|
|
196
|
+
td {
|
|
197
|
+
border: solid 1px #000;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -191,7 +191,7 @@ Row: 6, Col:0: VSAC: 0:87 | Request failed with status code 404 for oid = 1.16.8
|
|
|
191
191
|
expect(copySuccess).not.toBeInTheDocument();
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
-
it("It does not render when
|
|
194
|
+
it("It does not render when invisible", async () => {
|
|
195
195
|
render(
|
|
196
196
|
<MadieAlert
|
|
197
197
|
type="warning"
|
|
@@ -206,6 +206,69 @@ Row: 6, Col:0: VSAC: 0:87 | Request failed with status code 404 for oid = 1.16.8
|
|
|
206
206
|
}}
|
|
207
207
|
/>
|
|
208
208
|
);
|
|
209
|
-
|
|
209
|
+
await waitFor(() => {
|
|
210
|
+
expect(screen.queryByTestId("alert-dialog")).toBeNull();
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it("renders minimize button when minimizeAlerts is true", () => {
|
|
215
|
+
const { getByTestId } = render(
|
|
216
|
+
<MadieAlert
|
|
217
|
+
type="warning"
|
|
218
|
+
visible={true}
|
|
219
|
+
canClose={false}
|
|
220
|
+
minimizeAlerts={true}
|
|
221
|
+
content={<h1>Test content</h1>}
|
|
222
|
+
alertProps={{
|
|
223
|
+
"data-testid": "alert-dialog",
|
|
224
|
+
}}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
expect(getByTestId("alert-dialog")).toBeInTheDocument();
|
|
229
|
+
expect(getByTestId("FullscreenExitRoundedIcon")).toBeInTheDocument();
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it("hides alert when minimize button is clicked", async () => {
|
|
233
|
+
const { getByTestId, queryByTestId } = render(
|
|
234
|
+
<MadieAlert
|
|
235
|
+
type="warning"
|
|
236
|
+
visible={true}
|
|
237
|
+
canClose={false}
|
|
238
|
+
minimizeAlerts={true}
|
|
239
|
+
content={<h1>Test content</h1>}
|
|
240
|
+
alertProps={{
|
|
241
|
+
"data-testid": "alert-dialog",
|
|
242
|
+
}}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
expect(getByTestId("alert-dialog")).toBeInTheDocument();
|
|
247
|
+
const minimizeButton = getByTestId("FullscreenExitRoundedIcon");
|
|
248
|
+
|
|
249
|
+
fireEvent.click(minimizeButton);
|
|
250
|
+
|
|
251
|
+
// After clicking minimize, the alert should not be in the document
|
|
252
|
+
await waitFor(() => {
|
|
253
|
+
expect(queryByTestId("alert-dialog")).not.toBeInTheDocument();
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it("does not render minimize button when minimizeAlerts is false", () => {
|
|
258
|
+
const { getByTestId, queryByTestId } = render(
|
|
259
|
+
<MadieAlert
|
|
260
|
+
type="warning"
|
|
261
|
+
visible={true}
|
|
262
|
+
canClose={false}
|
|
263
|
+
minimizeAlerts={false}
|
|
264
|
+
content={<h1>Test content</h1>}
|
|
265
|
+
alertProps={{
|
|
266
|
+
"data-testid": "alert-dialog",
|
|
267
|
+
}}
|
|
268
|
+
/>
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
expect(getByTestId("alert-dialog")).toBeInTheDocument();
|
|
272
|
+
expect(queryByTestId("FullscreenExitRoundedIcon")).toBeNull();
|
|
210
273
|
});
|
|
211
274
|
});
|