dce-reactkit 3.8.7 → 3.9.0-beta-loading-modal.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.
Files changed (39) hide show
  1. package/dist/cjs/index.js +254 -386
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/Modal/ModalProps.d.ts +2 -0
  4. package/dist/cjs/types/index.d.ts +1 -3
  5. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +1 -4
  6. package/dist/esm/index.js +256 -386
  7. package/dist/esm/index.js.map +1 -1
  8. package/dist/esm/types/components/Modal/ModalProps.d.ts +2 -0
  9. package/dist/esm/types/index.d.ts +1 -3
  10. package/dist/esm/types/types/ReactKitErrorCode.d.ts +1 -4
  11. package/dist/index.d.ts +46 -83
  12. package/package.json +1 -2
  13. package/src/components/Modal/ModalProps.ts +4 -0
  14. package/src/components/Modal/index.tsx +49 -21
  15. package/src/components/MultiSwitch.tsx +1 -1
  16. package/src/index.ts +0 -4
  17. package/src/types/ReactKitErrorCode.tsx +1 -6
  18. package/dist/cjs/types/components/Dropdown.d.ts +0 -32
  19. package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
  20. package/dist/cjs/types/helpers/validators/validURL.d.ts +0 -8
  21. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -22
  22. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
  23. package/dist/cjs/types/types/DropdownItemType.d.ts +0 -6
  24. package/dist/esm/types/components/Dropdown.d.ts +0 -32
  25. package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
  26. package/dist/esm/types/helpers/validators/validURL.d.ts +0 -8
  27. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -22
  28. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
  29. package/dist/esm/types/types/DropdownItemType.d.ts +0 -6
  30. package/src/components/Dropdown.tsx +0 -317
  31. package/src/helpers/validators/ChicagoTitleCase.test.ts +0 -85
  32. package/src/helpers/validators/ChicagoTitleCase.ts +0 -32
  33. package/src/helpers/validators/findURL.test.ts +0 -83
  34. package/src/helpers/validators/findURL.ts +0 -43
  35. package/src/helpers/validators/validURL.test.ts +0 -90
  36. package/src/helpers/validators/validURL.ts +0 -18
  37. package/src/helpers/visitEndpointOnAnotherServer/index.ts +0 -90
  38. package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +0 -164
  39. package/src/types/DropdownItemType.ts +0 -11
@@ -38,5 +38,7 @@ type ModalProps = {
38
38
  confirmLabel?: string;
39
39
  confirmVariant?: Variant;
40
40
  onTopOfOtherModals?: boolean;
41
+ isLoading?: boolean;
42
+ isLoadingCancelable?: boolean;
41
43
  };
42
44
  export default ModalProps;
@@ -21,7 +21,6 @@ import Tooltip from './components/Tooltip';
21
21
  import ToggleSwitch from './components/ToggleSwitch';
22
22
  import AutoscrollToBottomContainer from './components/AutoscrollToBottomContainer';
23
23
  import MultiSwitch from './components/MultiSwitch';
24
- import Dropdown from './components/Dropdown';
25
24
  import ErrorWithCode from './errors/ErrorWithCode';
26
25
  import MINUTE_IN_MS from './constants/MINUTE_IN_MS';
27
26
  import HOUR_IN_MS from './constants/HOUR_IN_MS';
@@ -93,9 +92,8 @@ import LogBuiltInMetadata from './types/LogBuiltInMetadata';
93
92
  import LogMetadataType from './types/LogMetadataType';
94
93
  import LogFunction from './types/LogFunction';
95
94
  import IntelliTableColumn from './types/IntelliTableColumn';
96
- import DropdownItemType from './types/DropdownItemType';
97
95
  import PickableItem from './components/ItemPicker/types/PickableItem';
98
96
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
99
97
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
100
98
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
101
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
99
+ export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
@@ -15,9 +15,6 @@ declare enum ReactKitErrorCode {
15
15
  NotAdmin = "DRK10",
16
16
  NotAllowedToReviewLogs = "DRK11",
17
17
  ThemeCheckedBeforeReactKitReady = "DRK12",
18
- SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
19
- NotConnected = "DRK14",
20
- SelfSigned = "DRK15",
21
- ResponseParseError = "DRK16"
18
+ SessionExpiredMessageGottenBeforeReactKitReady = "DRK13"
22
19
  }
23
20
  export default ReactKitErrorCode;
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ declare enum Variant {
24
24
  * @author Gabe Abrams
25
25
  */
26
26
 
27
- type Props$l = {
27
+ type Props$k = {
28
28
  children: React$1.ReactNode;
29
29
  };
30
30
  /**
@@ -75,7 +75,7 @@ declare const showFatalError: (error: any, errorTitle?: string) => Promise<void>
75
75
  * @author Gabe Abrams
76
76
  */
77
77
  declare const addFatalErrorHandler: (handler: () => void) => void;
78
- declare const AppWrapper: React$1.FC<Props$l>;
78
+ declare const AppWrapper: React$1.FC<Props$k>;
79
79
 
80
80
  /**
81
81
  * Loading spinner/indicator
@@ -88,14 +88,14 @@ declare const LoadingSpinner: () => JSX.Element;
88
88
  * @author Gabe Abrams
89
89
  */
90
90
 
91
- type Props$k = {
91
+ type Props$j = {
92
92
  error: any;
93
93
  title?: string;
94
94
  onClose?: () => void;
95
95
  variant?: Variant;
96
96
  icon?: IconProp;
97
97
  };
98
- declare const ErrorBox: React$1.FC<Props$k>;
98
+ declare const ErrorBox: React$1.FC<Props$j>;
99
99
 
100
100
  /**
101
101
  * Types of buttons in the modal
@@ -176,6 +176,8 @@ type ModalProps = {
176
176
  confirmLabel?: string;
177
177
  confirmVariant?: Variant;
178
178
  onTopOfOtherModals?: boolean;
179
+ isLoading?: boolean;
180
+ isLoadingCancelable?: boolean;
179
181
  };
180
182
 
181
183
  /**
@@ -191,20 +193,20 @@ declare const Modal: React$1.FC<ModalProps>;
191
193
  * @author Gabe Abrams
192
194
  */
193
195
 
194
- type Props$j = {
196
+ type Props$i = {
195
197
  title: React$1.ReactNode;
196
198
  children: React$1.ReactNode;
197
199
  noBottomMargin?: boolean;
198
200
  noBottomPadding?: boolean;
199
201
  };
200
- declare const TabBox: React$1.FC<Props$j>;
202
+ declare const TabBox: React$1.FC<Props$i>;
201
203
 
202
204
  /**
203
205
  * A radio selection button
204
206
  * @author Gabe Abrams
205
207
  */
206
208
 
207
- type Props$i = {
209
+ type Props$h = {
208
210
  text: React$1.ReactNode;
209
211
  onSelected: () => void;
210
212
  ariaLabel: string;
@@ -216,14 +218,14 @@ type Props$i = {
216
218
  unselectedVariant?: Variant;
217
219
  small?: boolean;
218
220
  };
219
- declare const RadioButton: React$1.FC<Props$i>;
221
+ declare const RadioButton: React$1.FC<Props$h>;
220
222
 
221
223
  /**
222
224
  * A checkbox button
223
225
  * @author Gabe Abrams
224
226
  */
225
227
 
226
- type Props$h = {
228
+ type Props$g = {
227
229
  text: React$1.ReactNode;
228
230
  onChanged: (checked: boolean) => void;
229
231
  ariaLabel: string;
@@ -237,14 +239,14 @@ type Props$h = {
237
239
  small?: boolean;
238
240
  dashed?: boolean;
239
241
  };
240
- declare const CheckboxButton: React$1.FC<Props$h>;
242
+ declare const CheckboxButton: React$1.FC<Props$g>;
241
243
 
242
244
  /**
243
245
  * Input group with a title and space for buttons
244
246
  * @author Gabe Abrams
245
247
  */
246
248
 
247
- type Props$g = {
249
+ type Props$f = {
248
250
  label: React$1.ReactNode;
249
251
  minLabelWidth?: string;
250
252
  children: React$1.ReactNode;
@@ -253,14 +255,14 @@ type Props$g = {
253
255
  isAdminFeature?: boolean;
254
256
  noMarginOnBottom?: boolean;
255
257
  };
256
- declare const ButtonInputGroup: React$1.FC<Props$g>;
258
+ declare const ButtonInputGroup: React$1.FC<Props$f>;
257
259
 
258
260
  /**
259
261
  * A very simple, lightweight date chooser
260
262
  * @author Gabe Abrams
261
263
  */
262
264
 
263
- type Props$f = {
265
+ type Props$e = {
264
266
  ariaLabel: string;
265
267
  name: string;
266
268
  month: number;
@@ -276,62 +278,62 @@ type Props$f = {
276
278
  numMonthsToShow?: number;
277
279
  chooseFromPast?: boolean;
278
280
  };
279
- declare const SimpleDateChooser: React$1.FC<Props$f>;
281
+ declare const SimpleDateChooser: React$1.FC<Props$e>;
280
282
 
281
283
  /**
282
284
  * Drawer container
283
285
  * @author Gabe Abrams
284
286
  */
285
287
 
286
- type Props$e = {
288
+ type Props$d = {
287
289
  grayBackground?: boolean;
288
290
  customBackgroundColor?: string;
289
291
  children: React$1.ReactNode;
290
292
  };
291
- declare const Drawer: React$1.FC<Props$e>;
293
+ declare const Drawer: React$1.FC<Props$d>;
292
294
 
293
295
  /**
294
296
  * Success checkmark that pops into view
295
297
  * @author Gabe Abrams
296
298
  */
297
299
 
298
- type Props$d = {
300
+ type Props$c = {
299
301
  sizeRem?: number;
300
302
  circleVariant?: string;
301
303
  checkVariant?: string;
302
304
  };
303
- declare const PopSuccessMark: React$1.FC<Props$d>;
305
+ declare const PopSuccessMark: React$1.FC<Props$c>;
304
306
 
305
307
  /**
306
308
  * Failure x mark that pops into view
307
309
  * @author Gabe Abrams
308
310
  */
309
311
 
310
- type Props$c = {
312
+ type Props$b = {
311
313
  sizeRem?: number;
312
314
  circleVariant?: string;
313
315
  xVariant?: string;
314
316
  };
315
- declare const PopFailureMark: React$1.FC<Props$c>;
317
+ declare const PopFailureMark: React$1.FC<Props$b>;
316
318
 
317
319
  /**
318
320
  * Failure pending that pops into view
319
321
  * @author Gabe Abrams
320
322
  */
321
323
 
322
- type Props$b = {
324
+ type Props$a = {
323
325
  sizeRem?: number;
324
326
  circleVariant?: string;
325
327
  hourglassVariant?: string;
326
328
  };
327
- declare const PopPendingMark: React$1.FC<Props$b>;
329
+ declare const PopPendingMark: React$1.FC<Props$a>;
328
330
 
329
331
  /**
330
332
  * Copiable text box
331
333
  * @author Gabe Abrams
332
334
  */
333
335
 
334
- type Props$a = {
336
+ type Props$9 = {
335
337
  text: string;
336
338
  maxTextWidthRem?: number;
337
339
  label?: string;
@@ -343,7 +345,7 @@ type Props$a = {
343
345
  textAreaId?: string;
344
346
  copyButtonId?: string;
345
347
  };
346
- declare const CopiableBox: React$1.FC<Props$a>;
348
+ declare const CopiableBox: React$1.FC<Props$9>;
347
349
 
348
350
  /**
349
351
  * An item that can be chosen (for use within ItemPicker)
@@ -366,7 +368,7 @@ type PickableItem = ({
366
368
  * @author Yuen Ler Chow
367
369
  */
368
370
 
369
- type Props$9 = {
371
+ type Props$8 = {
370
372
  title: string;
371
373
  items: PickableItem[];
372
374
  /**
@@ -377,7 +379,7 @@ type Props$9 = {
377
379
  onChanged: (updatedItems: PickableItem[]) => void;
378
380
  noBottomMargin?: boolean;
379
381
  };
380
- declare const ItemPicker: React$1.FC<Props$9>;
382
+ declare const ItemPicker: React$1.FC<Props$8>;
381
383
 
382
384
  /**
383
385
  * Type of the context map in a LogMetadata file
@@ -422,11 +424,11 @@ type LogMetadataType = {
422
424
  * @author Gabe Abrams
423
425
  */
424
426
 
425
- type Props$8 = {
427
+ type Props$7 = {
426
428
  LogMetadata: LogMetadataType;
427
429
  onClose: () => void;
428
430
  };
429
- declare const LogReviewer: React$1.FC<Props$8>;
431
+ declare const LogReviewer: React$1.FC<Props$7>;
430
432
 
431
433
  /**
432
434
  * Server-side API param types
@@ -461,7 +463,7 @@ type IntelliTableColumn = {
461
463
  * @author Gabe Abrams
462
464
  */
463
465
 
464
- type Props$7 = {
466
+ type Props$6 = {
465
467
  title: string;
466
468
  id: string;
467
469
  data: {
@@ -471,14 +473,14 @@ type Props$7 = {
471
473
  columns: IntelliTableColumn[];
472
474
  csvName?: string;
473
475
  };
474
- declare const IntelliTable: React$1.FC<Props$7>;
476
+ declare const IntelliTable: React$1.FC<Props$6>;
475
477
 
476
478
  /**
477
479
  * Button for downloading a csv file
478
480
  * @author Gabe Abrams
479
481
  */
480
482
 
481
- type Props$6 = {
483
+ type Props$5 = {
482
484
  filename: string;
483
485
  csv: string;
484
486
  id?: string;
@@ -490,7 +492,7 @@ type Props$6 = {
490
492
  onClick?: () => void;
491
493
  children?: React$1.ReactNode;
492
494
  };
493
- declare const CSVDownloadButton: React$1.FC<Props$6>;
495
+ declare const CSVDownloadButton: React$1.FC<Props$5>;
494
496
 
495
497
  /**
496
498
  * Generic type for an object
@@ -566,7 +568,7 @@ type DBEntryField = ({
566
568
  * @author Gabe Abrams
567
569
  */
568
570
 
569
- type Props$5 = {
571
+ type Props$4 = {
570
572
  entryFields: DBEntryField[];
571
573
  idPropName: string;
572
574
  titlePropName: string;
@@ -592,18 +594,18 @@ type Props$5 = {
592
594
  [k: string]: any;
593
595
  };
594
596
  };
595
- declare const DBEntryManagerPanel: React$1.FC<Props$5>;
597
+ declare const DBEntryManagerPanel: React$1.FC<Props$4>;
596
598
 
597
599
  /**
598
600
  * Simple tooltip component
599
601
  * @author Gabe Abrams
600
602
  */
601
603
 
602
- type Props$4 = {
604
+ type Props$3 = {
603
605
  text: string;
604
606
  children: JSX.Element;
605
607
  };
606
- declare const Tooltip: React$1.FC<Props$4>;
608
+ declare const Tooltip: React$1.FC<Props$3>;
607
609
 
608
610
  /**
609
611
  * A toggle switch that toggles on or off
@@ -611,7 +613,7 @@ declare const Tooltip: React$1.FC<Props$4>;
611
613
  * @author Gabe Abrams
612
614
  */
613
615
 
614
- type Props$3 = {
616
+ type Props$2 = {
615
617
  isOn: boolean;
616
618
  /**
617
619
  * A handler to call when the switch is toggled
@@ -623,7 +625,7 @@ type Props$3 = {
623
625
  description: string;
624
626
  backgroundVariantWhenOn?: Variant;
625
627
  };
626
- declare const ToggleSwitch: React$1.FC<Props$3>;
628
+ declare const ToggleSwitch: React$1.FC<Props$2>;
627
629
 
628
630
  /**
629
631
  * Container that automatically scrolls when new items are added,
@@ -634,7 +636,7 @@ declare const ToggleSwitch: React$1.FC<Props$3>;
634
636
  * @author Gabe Abrams
635
637
  */
636
638
 
637
- type Props$2 = {
639
+ type Props$1 = {
638
640
  itemsName?: string;
639
641
  items: AutoScrollItem[];
640
642
  jumpToBottomButtonVariant?: Variant;
@@ -645,7 +647,7 @@ type AutoScrollItem = {
645
647
  id: string | number;
646
648
  item: React$1.ReactNode;
647
649
  };
648
- declare const AutoscrollToBottomContainer: React$1.FC<Props$2>;
650
+ declare const AutoscrollToBottomContainer: React$1.FC<Props$1>;
649
651
 
650
652
  /**
651
653
  * A switch with multiple options for selection
@@ -654,7 +656,7 @@ declare const AutoscrollToBottomContainer: React$1.FC<Props$2>;
654
656
  * @author Austen Money
655
657
  */
656
658
 
657
- type Props$1 = {
659
+ type Props = {
658
660
  options: Option[];
659
661
  selectedOptionId: string;
660
662
  /**
@@ -669,43 +671,7 @@ type Option = {
669
671
  icon: IconProp;
670
672
  id: string;
671
673
  };
672
- declare const MultiSwitch: React$1.FC<Props$1>;
673
-
674
- declare enum DropdownItemType {
675
- Header = "Header",
676
- Divider = "Divider",
677
- Item = "Item"
678
- }
679
-
680
- /**
681
- * A simple dropdown menu
682
- * @author Alessandra De Lucas
683
- * @author Yuen Ler Chow
684
- * @author Gabe Abrams
685
- */
686
-
687
- type Props = {
688
- items: DropdownItem[];
689
- dropdownButton: {
690
- ariaLabel: string;
691
- id: string;
692
- content?: React$1.ReactNode;
693
- variant?: Variant;
694
- };
695
- };
696
- type DropdownItem = ({
697
- type: DropdownItemType.Header;
698
- content: React$1.ReactNode;
699
- } | {
700
- type: DropdownItemType.Divider;
701
- } | {
702
- type: DropdownItemType.Item;
703
- content: React$1.ReactNode;
704
- ariaLabel: string;
705
- id: string;
706
- onClick: () => void;
707
- });
708
- declare const Dropdown: React$1.FC<Props>;
674
+ declare const MultiSwitch: React$1.FC<Props>;
709
675
 
710
676
  /**
711
677
  * An error with a code
@@ -1620,10 +1586,7 @@ declare enum ReactKitErrorCode {
1620
1586
  NotAdmin = "DRK10",
1621
1587
  NotAllowedToReviewLogs = "DRK11",
1622
1588
  ThemeCheckedBeforeReactKitReady = "DRK12",
1623
- SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
1624
- NotConnected = "DRK14",
1625
- SelfSigned = "DRK15",
1626
- ResponseParseError = "DRK16"
1589
+ SessionExpiredMessageGottenBeforeReactKitReady = "DRK13"
1627
1590
  }
1628
1591
 
1629
1592
  /**
@@ -1656,4 +1619,4 @@ declare const LogBuiltInMetadata: {
1656
1619
  };
1657
1620
  };
1658
1621
 
1659
- export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, Dropdown, DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
1622
+ export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.8.7",
3
+ "version": "3.9.0-beta-loading-modal.1",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -24,7 +24,6 @@
24
24
  },
25
25
  "homepage": "https://github.com/harvard-edtech/dce-reactkit#readme",
26
26
  "dependencies": {
27
- "qs": "^6.x.x",
28
27
  "react-select": "^5.7.3"
29
28
  },
30
29
  "peerDependencies": {
@@ -69,6 +69,10 @@ type ModalProps = {
69
69
  confirmVariant?: Variant,
70
70
  // True if modal should be on top of other modals
71
71
  onTopOfOtherModals?: boolean,
72
+ // If true, the modal is loading
73
+ isLoading?: boolean,
74
+ // If true, the loading is cancelable
75
+ isLoadingCancelable?: boolean,
72
76
  };
73
77
 
74
78
  export default ModalProps;
@@ -14,6 +14,9 @@ import React, { useState, useEffect, useRef } from 'react';
14
14
  import ReactDOM from 'react-dom';
15
15
 
16
16
  // Import other components
17
+ import LoadingSpinner from '../LoadingSpinner';
18
+
19
+ // Import helpers
17
20
  import waitMs from '../../helpers/waitMs';
18
21
 
19
22
  // Import types
@@ -41,6 +44,7 @@ const BASE_Z_INDEX_ON_TOP = 2000000000;
41
44
 
42
45
  // Constants
43
46
  const MS_TO_ANIMATE = 200; // Animation duration
47
+ const MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR = 1000;
44
48
 
45
49
  // Modal type to list of buttons
46
50
  const modalTypeToModalButtonTypes: {
@@ -253,6 +257,8 @@ const Modal: React.FC<ModalProps> = (props) => {
253
257
  dontAllowBackdropExit,
254
258
  dontShowXButton,
255
259
  onTopOfOtherModals,
260
+ isLoading,
261
+ isLoadingCancelable,
256
262
  } = props;
257
263
 
258
264
  // Determine if no header either
@@ -263,6 +269,7 @@ const Modal: React.FC<ModalProps> = (props) => {
263
269
  // True if animation is in use
264
270
  const [animatingIn, setAnimatingIn] = useState(true);
265
271
  const [animatingPop, setAnimatingPop] = useState(false);
272
+ const [showModal, setShowModal] = useState(false);
266
273
 
267
274
  /* -------------- Refs -------------- */
268
275
 
@@ -295,6 +302,13 @@ const Modal: React.FC<ModalProps> = (props) => {
295
302
  if (mounted.current) {
296
303
  setAnimatingIn(false);
297
304
  }
305
+ if (isLoading) {
306
+ // wait before showing modal
307
+ await waitMs(MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR);
308
+ setShowModal(true);
309
+ } else {
310
+ setShowModal(true);
311
+ }
298
312
  })();
299
313
 
300
314
  return () => {
@@ -397,6 +411,10 @@ const Modal: React.FC<ModalProps> = (props) => {
397
411
  animationClass = 'Modal-animating-pop';
398
412
  }
399
413
 
414
+ // default to show close button when not loading and not show close button when loading
415
+ // unless downShowXButton or isLoadingCancelable
416
+ const showCloseButton = onClose && !dontShowXButton && !(isLoading && !isLoadingCancelable);
417
+
400
418
  // Render the modal
401
419
  const contentToRender = (
402
420
  <div
@@ -433,6 +451,8 @@ const Modal: React.FC<ModalProps> = (props) => {
433
451
  handleClose(ModalButtonType.Cancel);
434
452
  }}
435
453
  />
454
+
455
+ { showModal && (
436
456
  <div
437
457
  className={`modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`}
438
458
  style={{
@@ -440,7 +460,7 @@ const Modal: React.FC<ModalProps> = (props) => {
440
460
  // Override sizes for even larger for XL
441
461
  width: (
442
462
  size === ModalSize.ExtraLarge
443
- ? 'calc(100vw - 1rem)'
463
+ ? 'calc(100vw - 3rem)'
444
464
  : undefined
445
465
  ),
446
466
  maxWidth: (
@@ -495,7 +515,7 @@ const Modal: React.FC<ModalProps> = (props) => {
495
515
  {title}
496
516
  </h5>
497
517
 
498
- {(onClose && !dontShowXButton) && (
518
+ {showCloseButton && (
499
519
  <button
500
520
  type="button"
501
521
  className="Modal-x-button btn-close"
@@ -515,25 +535,32 @@ const Modal: React.FC<ModalProps> = (props) => {
515
535
  )}
516
536
  </div>
517
537
  )}
518
- {children && (
519
- <div
520
- className="modal-body"
521
- style={{
522
- color: (
523
- isDarkModeOn()
524
- ? 'white'
525
- : undefined
526
- ),
527
- backgroundColor: (
528
- isDarkModeOn()
529
- ? '#444'
530
- : undefined
531
- ),
532
- }}
533
- >
534
- {children}
535
- </div>
536
- )}
538
+
539
+ <div
540
+ className="modal-body"
541
+ style={{
542
+ color: (
543
+ isDarkModeOn()
544
+ ? 'white'
545
+ : undefined
546
+ ),
547
+ backgroundColor: (
548
+ isDarkModeOn()
549
+ ? '#444'
550
+ : undefined
551
+ ),
552
+ }}
553
+ >
554
+ {isLoading && !children ? (
555
+ <>
556
+ <LoadingSpinner />
557
+ <span className="sr-only">Content loading</span>
558
+ </>
559
+ ) : (
560
+ children
561
+ )}
562
+ </div>
563
+
537
564
  {footer && (
538
565
  <div
539
566
  className="modal-footer pt-1 pb-1"
@@ -560,6 +587,7 @@ const Modal: React.FC<ModalProps> = (props) => {
560
587
  )}
561
588
  </div>
562
589
  </div>
590
+ )}
563
591
  </div>
564
592
  );
565
593
 
@@ -153,7 +153,7 @@ const MultiSwitch: React.FC<Props> = (props) => {
153
153
 
154
154
  // Constants
155
155
  const gutterRems = heightRem * 0.1;
156
- const itemWidthRems = heightRem * 2.2;
156
+ const itemWidthRems = heightRem * 1.3;
157
157
  const textFontSize = heightRem / 3.5;
158
158
  const iconFontSize = heightRem / 2;
159
159
  const borderWidthRems = 0.05;
package/src/index.ts CHANGED
@@ -28,7 +28,6 @@ import Tooltip from './components/Tooltip';
28
28
  import ToggleSwitch from './components/ToggleSwitch';
29
29
  import AutoscrollToBottomContainer from './components/AutoscrollToBottomContainer';
30
30
  import MultiSwitch from './components/MultiSwitch';
31
- import Dropdown from './components/Dropdown';
32
31
 
33
32
  // Import errors
34
33
  import ErrorWithCode from './errors/ErrorWithCode';
@@ -110,7 +109,6 @@ import LogBuiltInMetadata from './types/LogBuiltInMetadata';
110
109
  import LogMetadataType from './types/LogMetadataType';
111
110
  import LogFunction from './types/LogFunction';
112
111
  import IntelliTableColumn from './types/IntelliTableColumn';
113
- import DropdownItemType from './types/DropdownItemType';
114
112
 
115
113
  // Component-specific-types
116
114
  import PickableItem from './components/ItemPicker/types/PickableItem';
@@ -144,7 +142,6 @@ export {
144
142
  ToggleSwitch,
145
143
  AutoscrollToBottomContainer,
146
144
  MultiSwitch,
147
- Dropdown,
148
145
  // Global functions
149
146
  alert,
150
147
  confirm,
@@ -229,7 +226,6 @@ export {
229
226
  LogMetadataType,
230
227
  LogFunction,
231
228
  IntelliTableColumn,
232
- DropdownItemType,
233
229
  // Component-specific-types
234
230
  PickableItem,
235
231
  DBEntry,
@@ -1,4 +1,4 @@
1
- // Highest error code = DRK16
1
+ // Highest error code = DRK13
2
2
 
3
3
  /**
4
4
  * List of error codes built into the react kit
@@ -18,11 +18,6 @@ enum ReactKitErrorCode {
18
18
  NotAllowedToReviewLogs = 'DRK11',
19
19
  ThemeCheckedBeforeReactKitReady = 'DRK12',
20
20
  SessionExpiredMessageGottenBeforeReactKitReady = 'DRK13',
21
-
22
- // Server-to-server requests
23
- NotConnected = 'DRK14',
24
- SelfSigned = 'DRK15',
25
- ResponseParseError = 'DRK16',
26
21
  }
27
22
 
28
23
  export default ReactKitErrorCode;