dce-reactkit 3.7.8 → 3.7.10-beta.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/dist/cjs/index.js +27 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +21 -0
- package/dist/cjs/types/components/Modal/ModalForWrapper.d.ts +9 -0
- package/dist/cjs/types/components/{Modal.d.ts → Modal/ModalProps.d.ts} +9 -9
- package/dist/cjs/types/components/Modal/index.d.ts +8 -0
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/esm/index.js +27 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +21 -0
- package/dist/esm/types/components/Modal/ModalForWrapper.d.ts +9 -0
- package/dist/esm/types/components/{Modal.d.ts → Modal/ModalProps.d.ts} +9 -9
- package/dist/esm/types/components/Modal/index.d.ts +8 -0
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/index.d.ts +117 -110
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +125 -1
- package/src/components/IntelliTable.tsx +1 -1
- package/src/components/{Modal.tsx → Modal/ModalForWrapper.tsx} +22 -87
- package/src/components/Modal/ModalProps.ts +72 -0
- package/src/components/Modal/index.tsx +105 -0
- package/src/index.ts +1 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import Variant from '../types/Variant';
|
|
8
|
+
import ModalProps from './Modal/ModalProps';
|
|
8
9
|
type Props = {
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
};
|
|
@@ -61,5 +62,25 @@ export declare const addFatalErrorHandler: (handler: () => void) => void;
|
|
|
61
62
|
* @author Gabe Abrams
|
|
62
63
|
*/
|
|
63
64
|
export declare const showSessionExpiredMessage: () => Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Add a modal to the screen
|
|
67
|
+
* @author Gabe Abrams
|
|
68
|
+
* @param id the uniqueId of the modal
|
|
69
|
+
* @param props the props for the modal
|
|
70
|
+
*/
|
|
71
|
+
export declare const addModal: (id: number, props: ModalProps) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Update a modal on the screen by id (if it exists) with new props
|
|
74
|
+
* @author Gabe Abrams
|
|
75
|
+
* @param id the uniqueId of the modal
|
|
76
|
+
* @param props the new props for the modal
|
|
77
|
+
*/
|
|
78
|
+
export declare const updateModal: (id: number, props: ModalProps) => Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Remove a modal from the screen by id (if it exists)
|
|
81
|
+
* @author Gabe Abrams
|
|
82
|
+
* @param id the uniqueId of the modal
|
|
83
|
+
*/
|
|
84
|
+
export declare const removeModal: (id: number) => Promise<void>;
|
|
64
85
|
declare const AppWrapper: React.FC<Props>;
|
|
65
86
|
export default AppWrapper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The displayable modal component (this is the modal that's added to the
|
|
3
|
+
* wrapper, not the one that the programmer renders)
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import ModalProps from './ModalProps';
|
|
8
|
+
declare const Modal: React.FC<ModalProps>;
|
|
9
|
+
export default Modal;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Variant from '../../types/Variant';
|
|
3
|
+
import ModalButtonType from '../../types/ModalButtonType';
|
|
4
|
+
import ModalSize from '../../types/ModalSize';
|
|
5
|
+
import ModalType from '../../types/ModalType';
|
|
1
6
|
/**
|
|
2
|
-
*
|
|
7
|
+
* Props for the Modal component
|
|
3
8
|
* @author Gabe Abrams
|
|
4
9
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import ModalButtonType from '../types/ModalButtonType';
|
|
8
|
-
import ModalSize from '../types/ModalSize';
|
|
9
|
-
import ModalType from '../types/ModalType';
|
|
10
|
-
type Props = {
|
|
10
|
+
type ModalProps = {
|
|
11
|
+
key?: string;
|
|
11
12
|
type?: ModalType;
|
|
12
13
|
size?: ModalSize;
|
|
13
14
|
title?: React.ReactNode;
|
|
@@ -37,5 +38,4 @@ type Props = {
|
|
|
37
38
|
confirmVariant?: Variant;
|
|
38
39
|
onTopOfOtherModals?: boolean;
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
-
export default Modal;
|
|
41
|
+
export default ModalProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AppWrapper, { alert, confirm, showFatalError, addFatalErrorHandler, leaveToURL } from './components/AppWrapper';
|
|
2
2
|
import LoadingSpinner from './components/LoadingSpinner';
|
|
3
3
|
import ErrorBox from './components/ErrorBox';
|
|
4
|
-
import Modal from './components/Modal';
|
|
4
|
+
import Modal from './components/Modal/ModalForWrapper';
|
|
5
5
|
import TabBox from './components/TabBox';
|
|
6
6
|
import RadioButton from './components/RadioButton';
|
|
7
7
|
import CheckboxButton from './components/CheckboxButton';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React$1 from 'react';
|
|
3
3
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
4
4
|
import express from 'express';
|
|
5
5
|
|
|
@@ -18,14 +18,94 @@ declare enum Variant {
|
|
|
18
18
|
Dark = "dark"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Types of buttons in the modal
|
|
23
|
+
* @author Gabe Abrams
|
|
24
|
+
*/
|
|
25
|
+
declare enum ModalButtonType {
|
|
26
|
+
Okay = "okay",
|
|
27
|
+
Cancel = "cancel",
|
|
28
|
+
Yes = "yes",
|
|
29
|
+
No = "no",
|
|
30
|
+
Abandon = "abandon",
|
|
31
|
+
GoBack = "goBack",
|
|
32
|
+
Continue = "continue",
|
|
33
|
+
ImSure = "imSure",
|
|
34
|
+
Delete = "delete",
|
|
35
|
+
Confirm = "confirm"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Modal sizes
|
|
40
|
+
* @author Gabe Abrams
|
|
41
|
+
*/
|
|
42
|
+
declare enum ModalSize {
|
|
43
|
+
Small = "sm",
|
|
44
|
+
Medium = "md",
|
|
45
|
+
Large = "lg",
|
|
46
|
+
ExtraLarge = "xl"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Types of modals
|
|
51
|
+
* @author Gabe Abrams
|
|
52
|
+
*/
|
|
53
|
+
declare enum ModalType {
|
|
54
|
+
Okay = "okay",
|
|
55
|
+
OkayCancel = "okay-cancel",
|
|
56
|
+
YesNo = "yes-no",
|
|
57
|
+
YesNoCancel = "yes-no-cancel",
|
|
58
|
+
AbandonGoBack = "abandon-goBack",
|
|
59
|
+
ImSureCancel = "imSure-cancel",
|
|
60
|
+
DeleteCancel = "delete-cancel",
|
|
61
|
+
ConfirmCancel = "confirm-cancel",
|
|
62
|
+
NoButtons = "-"
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Props for the Modal component
|
|
67
|
+
* @author Gabe Abrams
|
|
68
|
+
*/
|
|
69
|
+
type ModalProps = {
|
|
70
|
+
key?: string;
|
|
71
|
+
type?: ModalType;
|
|
72
|
+
size?: ModalSize;
|
|
73
|
+
title?: React.ReactNode;
|
|
74
|
+
children?: React.ReactNode;
|
|
75
|
+
onClose?: (type: ModalButtonType) => void;
|
|
76
|
+
dontAllowBackdropExit?: boolean;
|
|
77
|
+
dontShowXButton?: boolean;
|
|
78
|
+
okayLabel?: string;
|
|
79
|
+
okayVariant?: Variant;
|
|
80
|
+
cancelLabel?: string;
|
|
81
|
+
cancelVariant?: Variant;
|
|
82
|
+
yesLabel?: string;
|
|
83
|
+
yesVariant?: Variant;
|
|
84
|
+
noLabel?: string;
|
|
85
|
+
noVariant?: Variant;
|
|
86
|
+
abandonLabel?: string;
|
|
87
|
+
abandonVariant?: Variant;
|
|
88
|
+
goBackLabel?: string;
|
|
89
|
+
goBackVariant?: Variant;
|
|
90
|
+
continueLabel?: string;
|
|
91
|
+
continueVariant?: Variant;
|
|
92
|
+
imSureLabel?: string;
|
|
93
|
+
imSureVariant?: Variant;
|
|
94
|
+
deleteLabel?: string;
|
|
95
|
+
deleteVariant?: Variant;
|
|
96
|
+
confirmLabel?: string;
|
|
97
|
+
confirmVariant?: Variant;
|
|
98
|
+
onTopOfOtherModals?: boolean;
|
|
99
|
+
};
|
|
100
|
+
|
|
21
101
|
/**
|
|
22
102
|
* A wrapper for the entire React app that adds global functionality like
|
|
23
103
|
* handling for fatal error messages, adds bootstrap support
|
|
24
104
|
* @author Gabe Abrams
|
|
25
105
|
*/
|
|
26
106
|
|
|
27
|
-
type Props$
|
|
28
|
-
children: React.ReactNode;
|
|
107
|
+
type Props$k = {
|
|
108
|
+
children: React$1.ReactNode;
|
|
29
109
|
};
|
|
30
110
|
/**
|
|
31
111
|
* Redirect to a new page
|
|
@@ -75,7 +155,7 @@ declare const showFatalError: (error: any, errorTitle?: string) => Promise<void>
|
|
|
75
155
|
* @author Gabe Abrams
|
|
76
156
|
*/
|
|
77
157
|
declare const addFatalErrorHandler: (handler: () => void) => void;
|
|
78
|
-
declare const AppWrapper: React.FC<Props$
|
|
158
|
+
declare const AppWrapper: React$1.FC<Props$k>;
|
|
79
159
|
|
|
80
160
|
/**
|
|
81
161
|
* Loading spinner/indicator
|
|
@@ -88,95 +168,22 @@ declare const LoadingSpinner: () => JSX.Element;
|
|
|
88
168
|
* @author Gabe Abrams
|
|
89
169
|
*/
|
|
90
170
|
|
|
91
|
-
type Props$
|
|
171
|
+
type Props$j = {
|
|
92
172
|
error: any;
|
|
93
173
|
title?: string;
|
|
94
174
|
onClose?: () => void;
|
|
95
175
|
variant?: Variant;
|
|
96
176
|
icon?: IconProp;
|
|
97
177
|
};
|
|
98
|
-
declare const ErrorBox: React.FC<Props$
|
|
178
|
+
declare const ErrorBox: React$1.FC<Props$j>;
|
|
99
179
|
|
|
100
180
|
/**
|
|
101
|
-
*
|
|
181
|
+
* The displayable modal component (this is the modal that's added to the
|
|
182
|
+
* wrapper, not the one that the programmer renders)
|
|
102
183
|
* @author Gabe Abrams
|
|
103
184
|
*/
|
|
104
|
-
declare enum ModalButtonType {
|
|
105
|
-
Okay = "okay",
|
|
106
|
-
Cancel = "cancel",
|
|
107
|
-
Yes = "yes",
|
|
108
|
-
No = "no",
|
|
109
|
-
Abandon = "abandon",
|
|
110
|
-
GoBack = "goBack",
|
|
111
|
-
Continue = "continue",
|
|
112
|
-
ImSure = "imSure",
|
|
113
|
-
Delete = "delete",
|
|
114
|
-
Confirm = "confirm"
|
|
115
|
-
}
|
|
116
185
|
|
|
117
|
-
|
|
118
|
-
* Modal sizes
|
|
119
|
-
* @author Gabe Abrams
|
|
120
|
-
*/
|
|
121
|
-
declare enum ModalSize {
|
|
122
|
-
Small = "sm",
|
|
123
|
-
Medium = "md",
|
|
124
|
-
Large = "lg",
|
|
125
|
-
ExtraLarge = "xl"
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Types of modals
|
|
130
|
-
* @author Gabe Abrams
|
|
131
|
-
*/
|
|
132
|
-
declare enum ModalType {
|
|
133
|
-
Okay = "okay",
|
|
134
|
-
OkayCancel = "okay-cancel",
|
|
135
|
-
YesNo = "yes-no",
|
|
136
|
-
YesNoCancel = "yes-no-cancel",
|
|
137
|
-
AbandonGoBack = "abandon-goBack",
|
|
138
|
-
ImSureCancel = "imSure-cancel",
|
|
139
|
-
DeleteCancel = "delete-cancel",
|
|
140
|
-
ConfirmCancel = "confirm-cancel",
|
|
141
|
-
NoButtons = "-"
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* A generic popup modal
|
|
146
|
-
* @author Gabe Abrams
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
type Props$j = {
|
|
150
|
-
type?: ModalType;
|
|
151
|
-
size?: ModalSize;
|
|
152
|
-
title?: React.ReactNode;
|
|
153
|
-
children?: React.ReactNode;
|
|
154
|
-
onClose?: (type: ModalButtonType) => void;
|
|
155
|
-
dontAllowBackdropExit?: boolean;
|
|
156
|
-
dontShowXButton?: boolean;
|
|
157
|
-
okayLabel?: string;
|
|
158
|
-
okayVariant?: Variant;
|
|
159
|
-
cancelLabel?: string;
|
|
160
|
-
cancelVariant?: Variant;
|
|
161
|
-
yesLabel?: string;
|
|
162
|
-
yesVariant?: Variant;
|
|
163
|
-
noLabel?: string;
|
|
164
|
-
noVariant?: Variant;
|
|
165
|
-
abandonLabel?: string;
|
|
166
|
-
abandonVariant?: Variant;
|
|
167
|
-
goBackLabel?: string;
|
|
168
|
-
goBackVariant?: Variant;
|
|
169
|
-
continueLabel?: string;
|
|
170
|
-
continueVariant?: Variant;
|
|
171
|
-
imSureLabel?: string;
|
|
172
|
-
imSureVariant?: Variant;
|
|
173
|
-
deleteLabel?: string;
|
|
174
|
-
deleteVariant?: Variant;
|
|
175
|
-
confirmLabel?: string;
|
|
176
|
-
confirmVariant?: Variant;
|
|
177
|
-
onTopOfOtherModals?: boolean;
|
|
178
|
-
};
|
|
179
|
-
declare const Modal: React.FC<Props$j>;
|
|
186
|
+
declare const Modal: React$1.FC<ModalProps>;
|
|
180
187
|
|
|
181
188
|
/**
|
|
182
189
|
* A box with a tab on the top that holds buttons and other content
|
|
@@ -184,12 +191,12 @@ declare const Modal: React.FC<Props$j>;
|
|
|
184
191
|
*/
|
|
185
192
|
|
|
186
193
|
type Props$i = {
|
|
187
|
-
title: React.ReactNode;
|
|
188
|
-
children: React.ReactNode;
|
|
194
|
+
title: React$1.ReactNode;
|
|
195
|
+
children: React$1.ReactNode;
|
|
189
196
|
noBottomMargin?: boolean;
|
|
190
197
|
noBottomPadding?: boolean;
|
|
191
198
|
};
|
|
192
|
-
declare const TabBox: React.FC<Props$i>;
|
|
199
|
+
declare const TabBox: React$1.FC<Props$i>;
|
|
193
200
|
|
|
194
201
|
/**
|
|
195
202
|
* A radio selection button
|
|
@@ -208,7 +215,7 @@ type Props$h = {
|
|
|
208
215
|
unselectedVariant?: Variant;
|
|
209
216
|
small?: boolean;
|
|
210
217
|
};
|
|
211
|
-
declare const RadioButton: React.FC<Props$h>;
|
|
218
|
+
declare const RadioButton: React$1.FC<Props$h>;
|
|
212
219
|
|
|
213
220
|
/**
|
|
214
221
|
* A checkbox button
|
|
@@ -229,7 +236,7 @@ type Props$g = {
|
|
|
229
236
|
small?: boolean;
|
|
230
237
|
dashed?: boolean;
|
|
231
238
|
};
|
|
232
|
-
declare const CheckboxButton: React.FC<Props$g>;
|
|
239
|
+
declare const CheckboxButton: React$1.FC<Props$g>;
|
|
233
240
|
|
|
234
241
|
/**
|
|
235
242
|
* Input group with a title and space for buttons
|
|
@@ -239,11 +246,11 @@ declare const CheckboxButton: React.FC<Props$g>;
|
|
|
239
246
|
type Props$f = {
|
|
240
247
|
label: string;
|
|
241
248
|
minLabelWidth?: string;
|
|
242
|
-
children: React.ReactNode;
|
|
249
|
+
children: React$1.ReactNode;
|
|
243
250
|
className?: string;
|
|
244
251
|
wrapButtonsAndAddGaps?: boolean;
|
|
245
252
|
};
|
|
246
|
-
declare const ButtonInputGroup: React.FC<Props$f>;
|
|
253
|
+
declare const ButtonInputGroup: React$1.FC<Props$f>;
|
|
247
254
|
|
|
248
255
|
/**
|
|
249
256
|
* A very simple, lightweight date chooser
|
|
@@ -266,7 +273,7 @@ type Props$e = {
|
|
|
266
273
|
numMonthsToShow?: number;
|
|
267
274
|
chooseFromPast?: boolean;
|
|
268
275
|
};
|
|
269
|
-
declare const SimpleDateChooser: React.FC<Props$e>;
|
|
276
|
+
declare const SimpleDateChooser: React$1.FC<Props$e>;
|
|
270
277
|
|
|
271
278
|
/**
|
|
272
279
|
* Drawer container
|
|
@@ -275,9 +282,9 @@ declare const SimpleDateChooser: React.FC<Props$e>;
|
|
|
275
282
|
|
|
276
283
|
type Props$d = {
|
|
277
284
|
customBackgroundColor?: string;
|
|
278
|
-
children: React.ReactNode;
|
|
285
|
+
children: React$1.ReactNode;
|
|
279
286
|
};
|
|
280
|
-
declare const Drawer: React.FC<Props$d>;
|
|
287
|
+
declare const Drawer: React$1.FC<Props$d>;
|
|
281
288
|
|
|
282
289
|
/**
|
|
283
290
|
* Success checkmark that pops into view
|
|
@@ -289,7 +296,7 @@ type Props$c = {
|
|
|
289
296
|
circleVariant?: string;
|
|
290
297
|
checkVariant?: string;
|
|
291
298
|
};
|
|
292
|
-
declare const PopSuccessMark: React.FC<Props$c>;
|
|
299
|
+
declare const PopSuccessMark: React$1.FC<Props$c>;
|
|
293
300
|
|
|
294
301
|
/**
|
|
295
302
|
* Failure x mark that pops into view
|
|
@@ -301,7 +308,7 @@ type Props$b = {
|
|
|
301
308
|
circleVariant?: string;
|
|
302
309
|
xVariant?: string;
|
|
303
310
|
};
|
|
304
|
-
declare const PopFailureMark: React.FC<Props$b>;
|
|
311
|
+
declare const PopFailureMark: React$1.FC<Props$b>;
|
|
305
312
|
|
|
306
313
|
/**
|
|
307
314
|
* Failure pending that pops into view
|
|
@@ -313,7 +320,7 @@ type Props$a = {
|
|
|
313
320
|
circleVariant?: string;
|
|
314
321
|
hourglassVariant?: string;
|
|
315
322
|
};
|
|
316
|
-
declare const PopPendingMark: React.FC<Props$a>;
|
|
323
|
+
declare const PopPendingMark: React$1.FC<Props$a>;
|
|
317
324
|
|
|
318
325
|
/**
|
|
319
326
|
* Copiable text box
|
|
@@ -332,7 +339,7 @@ type Props$9 = {
|
|
|
332
339
|
textAreaId?: string;
|
|
333
340
|
copyButtonId?: string;
|
|
334
341
|
};
|
|
335
|
-
declare const CopiableBox: React.FC<Props$9>;
|
|
342
|
+
declare const CopiableBox: React$1.FC<Props$9>;
|
|
336
343
|
|
|
337
344
|
/**
|
|
338
345
|
* An item that can be chosen (for use within ItemPicker)
|
|
@@ -366,7 +373,7 @@ type Props$8 = {
|
|
|
366
373
|
onChanged: (updatedItems: PickableItem[]) => void;
|
|
367
374
|
noBottomMargin?: boolean;
|
|
368
375
|
};
|
|
369
|
-
declare const ItemPicker: React.FC<Props$8>;
|
|
376
|
+
declare const ItemPicker: React$1.FC<Props$8>;
|
|
370
377
|
|
|
371
378
|
/**
|
|
372
379
|
* Type of the context map in a LogMetadata file
|
|
@@ -415,7 +422,7 @@ type Props$7 = {
|
|
|
415
422
|
LogMetadata: LogMetadataType;
|
|
416
423
|
onClose: () => void;
|
|
417
424
|
};
|
|
418
|
-
declare const LogReviewer: React.FC<Props$7>;
|
|
425
|
+
declare const LogReviewer: React$1.FC<Props$7>;
|
|
419
426
|
|
|
420
427
|
/**
|
|
421
428
|
* Server-side API param types
|
|
@@ -460,7 +467,7 @@ type Props$6 = {
|
|
|
460
467
|
columns: IntelliTableColumn[];
|
|
461
468
|
csvName?: string;
|
|
462
469
|
};
|
|
463
|
-
declare const IntelliTable: React.FC<Props$6>;
|
|
470
|
+
declare const IntelliTable: React$1.FC<Props$6>;
|
|
464
471
|
|
|
465
472
|
/**
|
|
466
473
|
* Button for downloading a csv file
|
|
@@ -477,9 +484,9 @@ type Props$5 = {
|
|
|
477
484
|
[k: string]: any;
|
|
478
485
|
};
|
|
479
486
|
onClick?: () => void;
|
|
480
|
-
children?: React.ReactNode;
|
|
487
|
+
children?: React$1.ReactNode;
|
|
481
488
|
};
|
|
482
|
-
declare const CSVDownloadButton: React.FC<Props$5>;
|
|
489
|
+
declare const CSVDownloadButton: React$1.FC<Props$5>;
|
|
483
490
|
|
|
484
491
|
/**
|
|
485
492
|
* Generic type for an object
|
|
@@ -581,7 +588,7 @@ type Props$4 = {
|
|
|
581
588
|
[k: string]: any;
|
|
582
589
|
};
|
|
583
590
|
};
|
|
584
|
-
declare const DBEntryManagerPanel: React.FC<Props$4>;
|
|
591
|
+
declare const DBEntryManagerPanel: React$1.FC<Props$4>;
|
|
585
592
|
|
|
586
593
|
/**
|
|
587
594
|
* Simple tooltip component
|
|
@@ -592,7 +599,7 @@ type Props$3 = {
|
|
|
592
599
|
text: string;
|
|
593
600
|
children: JSX.Element;
|
|
594
601
|
};
|
|
595
|
-
declare const Tooltip: React.FC<Props$3>;
|
|
602
|
+
declare const Tooltip: React$1.FC<Props$3>;
|
|
596
603
|
|
|
597
604
|
/**
|
|
598
605
|
* A toggle switch that toggles on or off
|
|
@@ -611,7 +618,7 @@ type Props$2 = {
|
|
|
611
618
|
description: string;
|
|
612
619
|
backgroundVariantWhenOn?: Variant;
|
|
613
620
|
};
|
|
614
|
-
declare const ToggleSwitch: React.FC<Props$2>;
|
|
621
|
+
declare const ToggleSwitch: React$1.FC<Props$2>;
|
|
615
622
|
|
|
616
623
|
/**
|
|
617
624
|
* Container that automatically scrolls when new items are added,
|
|
@@ -626,14 +633,14 @@ type Props$1 = {
|
|
|
626
633
|
itemsName?: string;
|
|
627
634
|
items: AutoScrollItem[];
|
|
628
635
|
jumpToBottomButtonVariant?: Variant;
|
|
629
|
-
messageBeforeItems?: React.ReactNode;
|
|
630
|
-
messageAfterItems?: React.ReactNode;
|
|
636
|
+
messageBeforeItems?: React$1.ReactNode;
|
|
637
|
+
messageAfterItems?: React$1.ReactNode;
|
|
631
638
|
};
|
|
632
639
|
type AutoScrollItem = {
|
|
633
640
|
id: string | number;
|
|
634
|
-
item: React.ReactNode;
|
|
641
|
+
item: React$1.ReactNode;
|
|
635
642
|
};
|
|
636
|
-
declare const AutoscrollToBottomContainer: React.FC<Props$1>;
|
|
643
|
+
declare const AutoscrollToBottomContainer: React$1.FC<Props$1>;
|
|
637
644
|
|
|
638
645
|
/**
|
|
639
646
|
* A switch with multiple options for selection
|
|
@@ -657,7 +664,7 @@ type Option = {
|
|
|
657
664
|
icon: IconProp;
|
|
658
665
|
id: string;
|
|
659
666
|
};
|
|
660
|
-
declare const MultiSwitch: React.FC<Props>;
|
|
667
|
+
declare const MultiSwitch: React$1.FC<Props>;
|
|
661
668
|
|
|
662
669
|
/**
|
|
663
670
|
* An error with a code
|
|
@@ -1436,7 +1443,7 @@ declare const makeLinksClickable: (text: string, opts?: {
|
|
|
1436
1443
|
newTab?: boolean;
|
|
1437
1444
|
preventPropagation?: boolean;
|
|
1438
1445
|
inheritColor?: boolean;
|
|
1439
|
-
}) => React.ReactNode;
|
|
1446
|
+
}) => React$1.ReactNode;
|
|
1440
1447
|
|
|
1441
1448
|
/**
|
|
1442
1449
|
* Merges a list of class names into a class name, intelligently handling spaces
|
package/package.json
CHANGED
|
@@ -19,11 +19,12 @@ import ModalButtonType from '../types/ModalButtonType';
|
|
|
19
19
|
import ModalType from '../types/ModalType';
|
|
20
20
|
import Variant from '../types/Variant';
|
|
21
21
|
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
22
|
+
import ModalProps from './Modal/ModalProps';
|
|
22
23
|
|
|
23
24
|
// Import shared components
|
|
24
25
|
// TODO: fix dependency cycle
|
|
25
26
|
// eslint-disable-next-line import/no-cycle
|
|
26
|
-
import Modal from './Modal';
|
|
27
|
+
import Modal from './Modal/ModalForWrapper';
|
|
27
28
|
|
|
28
29
|
// Import custom errors
|
|
29
30
|
import ErrorWithCode from '../errors/ErrorWithCode';
|
|
@@ -358,6 +359,99 @@ export const showSessionExpiredMessage = async () => {
|
|
|
358
359
|
}
|
|
359
360
|
};
|
|
360
361
|
|
|
362
|
+
/*----------------------------------------*/
|
|
363
|
+
/* --------------- Modals --------------- */
|
|
364
|
+
/*----------------------------------------*/
|
|
365
|
+
|
|
366
|
+
// Modal tuple with id and props
|
|
367
|
+
type ModalTuple = {
|
|
368
|
+
// Unique id
|
|
369
|
+
id: number,
|
|
370
|
+
// Modal props
|
|
371
|
+
props: ModalProps,
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// Stored copies of setters
|
|
375
|
+
let setModals: (modals: ModalTuple[]) => void;
|
|
376
|
+
|
|
377
|
+
// Stored copies of modals
|
|
378
|
+
let modals: ModalTuple[] = [];
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Add a modal to the screen
|
|
382
|
+
* @author Gabe Abrams
|
|
383
|
+
* @param id the uniqueId of the modal
|
|
384
|
+
* @param props the props for the modal
|
|
385
|
+
*/
|
|
386
|
+
export const addModal = async (
|
|
387
|
+
id: number,
|
|
388
|
+
props: ModalProps,
|
|
389
|
+
) => {
|
|
390
|
+
// Wait for helper to exist
|
|
391
|
+
await waitForHelper(() => {
|
|
392
|
+
return !!setModals;
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
// Add modal
|
|
396
|
+
modals.push({
|
|
397
|
+
id,
|
|
398
|
+
props,
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// Update modals
|
|
402
|
+
setModals(modals);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Update a modal on the screen by id (if it exists) with new props
|
|
407
|
+
* @author Gabe Abrams
|
|
408
|
+
* @param id the uniqueId of the modal
|
|
409
|
+
* @param props the new props for the modal
|
|
410
|
+
*/
|
|
411
|
+
export const updateModal = async (
|
|
412
|
+
id: number,
|
|
413
|
+
props: ModalProps,
|
|
414
|
+
) => {
|
|
415
|
+
// Wait for helper to exist
|
|
416
|
+
await waitForHelper(() => {
|
|
417
|
+
return !!setModals;
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
// Update modal
|
|
421
|
+
modals = modals.map((modal) => {
|
|
422
|
+
if (modal.id === id) {
|
|
423
|
+
return {
|
|
424
|
+
id,
|
|
425
|
+
props,
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
return modal;
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
// Update modals
|
|
432
|
+
setModals(modals);
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Remove a modal from the screen by id (if it exists)
|
|
437
|
+
* @author Gabe Abrams
|
|
438
|
+
* @param id the uniqueId of the modal
|
|
439
|
+
*/
|
|
440
|
+
export const removeModal = async (id: number) => {
|
|
441
|
+
// Wait for helper to exist
|
|
442
|
+
await waitForHelper(() => {
|
|
443
|
+
return !!setModals;
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
// Remove modal
|
|
447
|
+
modals = modals.filter((modal) => {
|
|
448
|
+
return modal.id !== id;
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// Update modals
|
|
452
|
+
setModals(modals);
|
|
453
|
+
};
|
|
454
|
+
|
|
361
455
|
/*------------------------------------------------------------------------*/
|
|
362
456
|
/* -------------------------------- Style ------------------------------- */
|
|
363
457
|
/*------------------------------------------------------------------------*/
|
|
@@ -464,6 +558,13 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
464
558
|
] = useState<boolean>(false);
|
|
465
559
|
setSessionHasExpired = setSessionHasExpiredInner;
|
|
466
560
|
|
|
561
|
+
// Modals
|
|
562
|
+
const [
|
|
563
|
+
modalsFromState,
|
|
564
|
+
setModalsInner,
|
|
565
|
+
] = useState<ModalTuple[]>([]);
|
|
566
|
+
setModals = setModalsInner;
|
|
567
|
+
|
|
467
568
|
/*------------------------------------------------------------------------*/
|
|
468
569
|
/* ------------------------------- Render ------------------------------- */
|
|
469
570
|
/*------------------------------------------------------------------------*/
|
|
@@ -522,6 +623,22 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
522
623
|
);
|
|
523
624
|
}
|
|
524
625
|
|
|
626
|
+
/* ---------- Custom Modals --------- */
|
|
627
|
+
|
|
628
|
+
// List of modals added outside reactkit via the Modal component
|
|
629
|
+
const customModals: React.ReactNode[] = [];
|
|
630
|
+
|
|
631
|
+
// Add custom modals
|
|
632
|
+
modalsFromState.forEach((modalTuple) => {
|
|
633
|
+
customModals.push(
|
|
634
|
+
<Modal
|
|
635
|
+
key={String(modalTuple.props.key ?? modalTuple.id)}
|
|
636
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
637
|
+
{...modalTuple.props}
|
|
638
|
+
/>,
|
|
639
|
+
);
|
|
640
|
+
});
|
|
641
|
+
|
|
525
642
|
/*----------------------------------------*/
|
|
526
643
|
/* ---------------- Views --------------- */
|
|
527
644
|
/*----------------------------------------*/
|
|
@@ -641,10 +758,12 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
641
758
|
background-color: white;
|
|
642
759
|
color: black;
|
|
643
760
|
border: 0.1rem solid black;
|
|
761
|
+
pointer-events: none;
|
|
644
762
|
}
|
|
645
763
|
div[data-popper-placement="top"] .tooltip-arrow::before {
|
|
646
764
|
border-top-color: white !important;
|
|
647
765
|
transform: translate(0, -0.05rem);
|
|
766
|
+
pointer-events: none;
|
|
648
767
|
}
|
|
649
768
|
`
|
|
650
769
|
: `
|
|
@@ -652,10 +771,12 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
652
771
|
background-color: black;
|
|
653
772
|
color: black;
|
|
654
773
|
border: 0.1rem solid white;
|
|
774
|
+
pointer-events: none;
|
|
655
775
|
}
|
|
656
776
|
div[data-popper-placement="top"] .tooltip-arrow::before {
|
|
657
777
|
border-top-color: black !important;
|
|
658
778
|
transform: translate(0, -0.05rem);
|
|
779
|
+
pointer-events: none;
|
|
659
780
|
}
|
|
660
781
|
`
|
|
661
782
|
);
|
|
@@ -679,6 +800,9 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
679
800
|
{/* Modal */}
|
|
680
801
|
{modal}
|
|
681
802
|
|
|
803
|
+
{/* Custom Modals */}
|
|
804
|
+
{customModals}
|
|
805
|
+
|
|
682
806
|
{/* Body */}
|
|
683
807
|
{body}
|
|
684
808
|
</>
|