@madie/madie-design-system 1.2.52 → 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.
@@ -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
+ }
@@ -20,4 +20,5 @@
20
20
  @import "./header";
21
21
  @import "./sidebar";
22
22
  @import "./pagination";
23
+ @import "./rich-text-editor";
23
24
  @import "./toast";
@@ -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 inivislbe", async () => {
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
- expect(screen.findByTestId("alert-dialog")).toBeNull;
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
  });
@@ -176,4 +176,212 @@ describe("Madie Dialog", () => {
176
176
  expect(cancelButton).toBeInTheDocument();
177
177
  expect(submitButton).not.toBeInTheDocument();
178
178
  });
179
+
180
+ it("It renders of type form with required components and tooltips for continue button when it's disabled", async () => {
181
+ const { getByTestId, queryByText, queryByTestId } = render(
182
+ <div>
183
+ <MadieDialog
184
+ form={true}
185
+ title="Basic Form"
186
+ dialogProps={{
187
+ open: true,
188
+ onClose: onFormCancel,
189
+ onSubmit: onFormSubmit,
190
+ maxWidth: "sm",
191
+ showRequiredFieldMessage: true,
192
+ }}
193
+ cancelButtonProps={{
194
+ id: "cancelBtn",
195
+ "data-testid": "form-cancel-button",
196
+ variant: "secondary",
197
+ cancelText: "Cancel",
198
+ }}
199
+ continueButtonProps={{
200
+ type: "submit",
201
+ "data-testid": "form-continue-button",
202
+ disabled: true,
203
+ continueText: "Continue",
204
+ tooltipText: "Continue button is disabled",
205
+ }}
206
+ >
207
+ <div>this is a form message</div>
208
+ </MadieDialog>
209
+ </div>
210
+ );
211
+ expect(getByTestId("dialog-form")).toBeInTheDocument();
212
+ expect(queryByText("Indicates required field")).toBeInTheDocument();
213
+ const cancelButton = getByTestId("close-button");
214
+ const submitButton = queryByTestId("form-continue-button");
215
+ expect(cancelButton).toBeInTheDocument();
216
+ expect(submitButton).toBeInTheDocument();
217
+
218
+ fireEvent.mouseOver(submitButton);
219
+ await waitFor(() => {
220
+ expect(
221
+ queryByText("Continue button is disabled")
222
+ ).toBeInTheDocument();
223
+ });
224
+ });
225
+
226
+ it("It does not show tooltips for continue button when it's enabled", async () => {
227
+ const { getByTestId, queryByText, queryByTestId } = render(
228
+ <div>
229
+ <MadieDialog
230
+ form={true}
231
+ title="Basic Form"
232
+ dialogProps={{
233
+ open: true,
234
+ onClose: onFormCancel,
235
+ onSubmit: onFormSubmit,
236
+ maxWidth: "sm",
237
+ showRequiredFieldMessage: true,
238
+ }}
239
+ cancelButtonProps={{
240
+ id: "cancelBtn",
241
+ "data-testid": "form-cancel-button",
242
+ variant: "secondary",
243
+ cancelText: "Cancel",
244
+ }}
245
+ continueButtonProps={{
246
+ type: "submit",
247
+ "data-testid": "form-continue-button",
248
+ disabled: false,
249
+ continueText: "Continue",
250
+ tooltipText: "Continue button is disabled",
251
+ }}
252
+ >
253
+ <div>this is a form message</div>
254
+ </MadieDialog>
255
+ </div>
256
+ );
257
+ expect(getByTestId("dialog-form")).toBeInTheDocument();
258
+ expect(queryByText("Indicates required field")).toBeInTheDocument();
259
+ const cancelButton = getByTestId("close-button");
260
+ const submitButton = queryByTestId("form-continue-button");
261
+ expect(cancelButton).toBeInTheDocument();
262
+ expect(submitButton).toBeInTheDocument();
263
+
264
+ fireEvent.mouseOver(submitButton);
265
+ await waitFor(() => {
266
+ expect(
267
+ queryByText("Continue button is disabled")
268
+ ).not.toBeInTheDocument();
269
+ });
270
+ });
271
+
272
+ it("It does not show tooltips for continue button when there is no tooltip text", async () => {
273
+ const { getByTestId, queryByText, queryByTestId } = render(
274
+ <div>
275
+ <MadieDialog
276
+ form={true}
277
+ title="Basic Form"
278
+ dialogProps={{
279
+ open: true,
280
+ onClose: onFormCancel,
281
+ onSubmit: onFormSubmit,
282
+ maxWidth: "sm",
283
+ showRequiredFieldMessage: true,
284
+ }}
285
+ cancelButtonProps={{
286
+ id: "cancelBtn",
287
+ "data-testid": "form-cancel-button",
288
+ variant: "secondary",
289
+ cancelText: "Cancel",
290
+ }}
291
+ continueButtonProps={{
292
+ type: "submit",
293
+ "data-testid": "form-continue-button",
294
+ continueText: "Continue",
295
+ }}
296
+ >
297
+ <div>this is a form message</div>
298
+ </MadieDialog>
299
+ </div>
300
+ );
301
+ expect(getByTestId("dialog-form")).toBeInTheDocument();
302
+ expect(queryByText("Indicates required field")).toBeInTheDocument();
303
+ const cancelButton = getByTestId("close-button");
304
+ const submitButton = queryByTestId("form-continue-button");
305
+ expect(cancelButton).toBeInTheDocument();
306
+ expect(submitButton).toBeInTheDocument();
307
+
308
+ fireEvent.mouseOver(submitButton);
309
+ await waitFor(() => {
310
+ expect(
311
+ queryByText("Continue button is disabled")
312
+ ).not.toBeInTheDocument();
313
+ });
314
+ });
315
+
316
+ it("It renders popover button", async () => {
317
+ const onClose = jest.fn();
318
+ const open = true;
319
+ const setOpen = jest.fn();
320
+ const { getByTestId, queryByText } = render(
321
+ <div>
322
+ <MadieDialog
323
+ form={true}
324
+ title="Basic Form"
325
+ dialogProps={{
326
+ onClose,
327
+ open,
328
+ maxWidth: "lg",
329
+ fullWidth: true,
330
+ onSubmit: () => {
331
+ console.log("Submitted");
332
+ setOpen(false);
333
+ },
334
+ }}
335
+ cancelButtonProps={{
336
+ variant: "secondary",
337
+ cancelText: "Cancel",
338
+ "data-testid": "cancel-button",
339
+ }}
340
+ continueButtonProps={{
341
+ variant: "cyan",
342
+ type: "submit",
343
+ "data-testid": "continue-button",
344
+ continueText: "Continue",
345
+ popoverOptions: [
346
+ {
347
+ label: "Export",
348
+ dataTestId: "export-option",
349
+ toImplementFunction: () =>
350
+ console.log("Export clicked"),
351
+ },
352
+ {
353
+ label: "Export for Publishing",
354
+ dataTestId: "export-publishing-option",
355
+ toImplementFunction: () =>
356
+ console.log(
357
+ "Export for Publishing clicked"
358
+ ),
359
+ },
360
+ ],
361
+ }}
362
+ >
363
+ <div>this is a form message</div>
364
+ </MadieDialog>
365
+ </div>
366
+ );
367
+
368
+ const cancelButton = getByTestId("cancel-button");
369
+ const submitButton = getByTestId("continue-button");
370
+ expect(cancelButton).toBeInTheDocument();
371
+ expect(submitButton).toBeInTheDocument();
372
+
373
+ fireEvent.click(submitButton);
374
+ await waitFor(() => {
375
+ expect(queryByText("Export")).toBeInTheDocument();
376
+ expect(queryByText("Export for Publishing")).toBeInTheDocument();
377
+ });
378
+ const exportOption = getByTestId("export-option");
379
+ const exportPublishingOption = getByTestId("export-publishing-option");
380
+ expect(exportOption).toBeInTheDocument();
381
+ expect(exportPublishingOption).toBeInTheDocument();
382
+ fireEvent.click(exportOption);
383
+ await waitFor(() => {
384
+ expect(setOpen).toHaveBeenCalledTimes(1);
385
+ });
386
+ });
179
387
  });