dce-reactkit 3.7.9 → 3.7.10-beta.1

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.
@@ -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
- * A generic popup modal
7
+ * Props for the Modal component
3
8
  * @author Gabe Abrams
4
9
  */
5
- import React from 'react';
6
- import Variant from '../types/Variant';
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
- declare const Modal: React.FC<Props>;
41
- export default Modal;
41
+ export default ModalProps;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * General use modal component
3
+ * @author Gabe Abrams
4
+ */
5
+ import React from 'react';
6
+ import ModalProps from './ModalProps';
7
+ declare const Modal: React.FC<ModalProps>;
8
+ export default Modal;
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$l = {
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$l>;
158
+ declare const AppWrapper: React$1.FC<Props$k>;
79
159
 
80
160
  /**
81
161
  * Loading spinner/indicator
@@ -88,95 +168,21 @@ declare const LoadingSpinner: () => JSX.Element;
88
168
  * @author Gabe Abrams
89
169
  */
90
170
 
91
- type Props$k = {
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$k>;
178
+ declare const ErrorBox: React$1.FC<Props$j>;
99
179
 
100
180
  /**
101
- * Types of buttons in the modal
181
+ * General use modal component
102
182
  * @author Gabe Abrams
103
183
  */
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
184
 
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>;
185
+ declare const Modal: React$1.FC<ModalProps>;
180
186
 
181
187
  /**
182
188
  * A box with a tab on the top that holds buttons and other content
@@ -184,12 +190,12 @@ declare const Modal: React.FC<Props$j>;
184
190
  */
185
191
 
186
192
  type Props$i = {
187
- title: React.ReactNode;
188
- children: React.ReactNode;
193
+ title: React$1.ReactNode;
194
+ children: React$1.ReactNode;
189
195
  noBottomMargin?: boolean;
190
196
  noBottomPadding?: boolean;
191
197
  };
192
- declare const TabBox: React.FC<Props$i>;
198
+ declare const TabBox: React$1.FC<Props$i>;
193
199
 
194
200
  /**
195
201
  * A radio selection button
@@ -208,7 +214,7 @@ type Props$h = {
208
214
  unselectedVariant?: Variant;
209
215
  small?: boolean;
210
216
  };
211
- declare const RadioButton: React.FC<Props$h>;
217
+ declare const RadioButton: React$1.FC<Props$h>;
212
218
 
213
219
  /**
214
220
  * A checkbox button
@@ -229,7 +235,7 @@ type Props$g = {
229
235
  small?: boolean;
230
236
  dashed?: boolean;
231
237
  };
232
- declare const CheckboxButton: React.FC<Props$g>;
238
+ declare const CheckboxButton: React$1.FC<Props$g>;
233
239
 
234
240
  /**
235
241
  * Input group with a title and space for buttons
@@ -239,11 +245,11 @@ declare const CheckboxButton: React.FC<Props$g>;
239
245
  type Props$f = {
240
246
  label: string;
241
247
  minLabelWidth?: string;
242
- children: React.ReactNode;
248
+ children: React$1.ReactNode;
243
249
  className?: string;
244
250
  wrapButtonsAndAddGaps?: boolean;
245
251
  };
246
- declare const ButtonInputGroup: React.FC<Props$f>;
252
+ declare const ButtonInputGroup: React$1.FC<Props$f>;
247
253
 
248
254
  /**
249
255
  * A very simple, lightweight date chooser
@@ -266,7 +272,7 @@ type Props$e = {
266
272
  numMonthsToShow?: number;
267
273
  chooseFromPast?: boolean;
268
274
  };
269
- declare const SimpleDateChooser: React.FC<Props$e>;
275
+ declare const SimpleDateChooser: React$1.FC<Props$e>;
270
276
 
271
277
  /**
272
278
  * Drawer container
@@ -275,9 +281,9 @@ declare const SimpleDateChooser: React.FC<Props$e>;
275
281
 
276
282
  type Props$d = {
277
283
  customBackgroundColor?: string;
278
- children: React.ReactNode;
284
+ children: React$1.ReactNode;
279
285
  };
280
- declare const Drawer: React.FC<Props$d>;
286
+ declare const Drawer: React$1.FC<Props$d>;
281
287
 
282
288
  /**
283
289
  * Success checkmark that pops into view
@@ -289,7 +295,7 @@ type Props$c = {
289
295
  circleVariant?: string;
290
296
  checkVariant?: string;
291
297
  };
292
- declare const PopSuccessMark: React.FC<Props$c>;
298
+ declare const PopSuccessMark: React$1.FC<Props$c>;
293
299
 
294
300
  /**
295
301
  * Failure x mark that pops into view
@@ -301,7 +307,7 @@ type Props$b = {
301
307
  circleVariant?: string;
302
308
  xVariant?: string;
303
309
  };
304
- declare const PopFailureMark: React.FC<Props$b>;
310
+ declare const PopFailureMark: React$1.FC<Props$b>;
305
311
 
306
312
  /**
307
313
  * Failure pending that pops into view
@@ -313,7 +319,7 @@ type Props$a = {
313
319
  circleVariant?: string;
314
320
  hourglassVariant?: string;
315
321
  };
316
- declare const PopPendingMark: React.FC<Props$a>;
322
+ declare const PopPendingMark: React$1.FC<Props$a>;
317
323
 
318
324
  /**
319
325
  * Copiable text box
@@ -332,7 +338,7 @@ type Props$9 = {
332
338
  textAreaId?: string;
333
339
  copyButtonId?: string;
334
340
  };
335
- declare const CopiableBox: React.FC<Props$9>;
341
+ declare const CopiableBox: React$1.FC<Props$9>;
336
342
 
337
343
  /**
338
344
  * An item that can be chosen (for use within ItemPicker)
@@ -366,7 +372,7 @@ type Props$8 = {
366
372
  onChanged: (updatedItems: PickableItem[]) => void;
367
373
  noBottomMargin?: boolean;
368
374
  };
369
- declare const ItemPicker: React.FC<Props$8>;
375
+ declare const ItemPicker: React$1.FC<Props$8>;
370
376
 
371
377
  /**
372
378
  * Type of the context map in a LogMetadata file
@@ -415,7 +421,7 @@ type Props$7 = {
415
421
  LogMetadata: LogMetadataType;
416
422
  onClose: () => void;
417
423
  };
418
- declare const LogReviewer: React.FC<Props$7>;
424
+ declare const LogReviewer: React$1.FC<Props$7>;
419
425
 
420
426
  /**
421
427
  * Server-side API param types
@@ -460,7 +466,7 @@ type Props$6 = {
460
466
  columns: IntelliTableColumn[];
461
467
  csvName?: string;
462
468
  };
463
- declare const IntelliTable: React.FC<Props$6>;
469
+ declare const IntelliTable: React$1.FC<Props$6>;
464
470
 
465
471
  /**
466
472
  * Button for downloading a csv file
@@ -477,9 +483,9 @@ type Props$5 = {
477
483
  [k: string]: any;
478
484
  };
479
485
  onClick?: () => void;
480
- children?: React.ReactNode;
486
+ children?: React$1.ReactNode;
481
487
  };
482
- declare const CSVDownloadButton: React.FC<Props$5>;
488
+ declare const CSVDownloadButton: React$1.FC<Props$5>;
483
489
 
484
490
  /**
485
491
  * Generic type for an object
@@ -581,7 +587,7 @@ type Props$4 = {
581
587
  [k: string]: any;
582
588
  };
583
589
  };
584
- declare const DBEntryManagerPanel: React.FC<Props$4>;
590
+ declare const DBEntryManagerPanel: React$1.FC<Props$4>;
585
591
 
586
592
  /**
587
593
  * Simple tooltip component
@@ -592,7 +598,7 @@ type Props$3 = {
592
598
  text: string;
593
599
  children: JSX.Element;
594
600
  };
595
- declare const Tooltip: React.FC<Props$3>;
601
+ declare const Tooltip: React$1.FC<Props$3>;
596
602
 
597
603
  /**
598
604
  * A toggle switch that toggles on or off
@@ -611,7 +617,7 @@ type Props$2 = {
611
617
  description: string;
612
618
  backgroundVariantWhenOn?: Variant;
613
619
  };
614
- declare const ToggleSwitch: React.FC<Props$2>;
620
+ declare const ToggleSwitch: React$1.FC<Props$2>;
615
621
 
616
622
  /**
617
623
  * Container that automatically scrolls when new items are added,
@@ -626,14 +632,14 @@ type Props$1 = {
626
632
  itemsName?: string;
627
633
  items: AutoScrollItem[];
628
634
  jumpToBottomButtonVariant?: Variant;
629
- messageBeforeItems?: React.ReactNode;
630
- messageAfterItems?: React.ReactNode;
635
+ messageBeforeItems?: React$1.ReactNode;
636
+ messageAfterItems?: React$1.ReactNode;
631
637
  };
632
638
  type AutoScrollItem = {
633
639
  id: string | number;
634
- item: React.ReactNode;
640
+ item: React$1.ReactNode;
635
641
  };
636
- declare const AutoscrollToBottomContainer: React.FC<Props$1>;
642
+ declare const AutoscrollToBottomContainer: React$1.FC<Props$1>;
637
643
 
638
644
  /**
639
645
  * A switch with multiple options for selection
@@ -657,7 +663,7 @@ type Option = {
657
663
  icon: IconProp;
658
664
  id: string;
659
665
  };
660
- declare const MultiSwitch: React.FC<Props>;
666
+ declare const MultiSwitch: React$1.FC<Props>;
661
667
 
662
668
  /**
663
669
  * An error with a code
@@ -1436,7 +1442,7 @@ declare const makeLinksClickable: (text: string, opts?: {
1436
1442
  newTab?: boolean;
1437
1443
  preventPropagation?: boolean;
1438
1444
  inheritColor?: boolean;
1439
- }) => React.ReactNode;
1445
+ }) => React$1.ReactNode;
1440
1446
 
1441
1447
  /**
1442
1448
  * Merges a list of class names into a class name, intelligently handling spaces
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.7.9",
3
+ "version": "3.7.10-beta.1",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",