dce-reactkit 4.0.0-beta-date-and-time.1 → 4.0.0-beta.2

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 (36) hide show
  1. package/.vscode/settings.json +1 -3
  2. package/README.md +20 -0
  3. package/dist/cjs/index.js +167 -392
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/types/components/ItemPicker/index.d.ts +0 -1
  6. package/dist/cjs/types/components/Modal/ModalProps.d.ts +0 -2
  7. package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -3
  8. package/dist/cjs/types/components/TabBox.d.ts +0 -1
  9. package/dist/cjs/types/index.d.ts +1 -3
  10. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +1 -3
  11. package/dist/esm/index.js +169 -392
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/types/components/ItemPicker/index.d.ts +0 -1
  14. package/dist/esm/types/components/Modal/ModalProps.d.ts +0 -2
  15. package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -3
  16. package/dist/esm/types/components/TabBox.d.ts +0 -1
  17. package/dist/esm/types/index.d.ts +1 -3
  18. package/dist/esm/types/types/ReactKitErrorCode.d.ts +1 -3
  19. package/dist/index.d.ts +17 -55
  20. package/package.json +2 -2
  21. package/src/components/IntelliTable.tsx +1 -1
  22. package/src/components/ItemPicker/NestableItemList.tsx +0 -1
  23. package/src/components/ItemPicker/index.tsx +0 -96
  24. package/src/components/LogReviewer.tsx +2 -2
  25. package/src/components/Modal/ModalProps.ts +0 -4
  26. package/src/components/Modal/index.tsx +20 -59
  27. package/src/components/SimpleDateChooser.tsx +26 -62
  28. package/src/components/TabBox.tsx +9 -27
  29. package/src/index.ts +0 -4
  30. package/src/types/ReactKitErrorCode.tsx +1 -3
  31. package/dist/cjs/types/components/SimpleTimeChooser.d.ts +0 -20
  32. package/dist/cjs/types/helpers/getWordCount.d.ts +0 -10
  33. package/dist/esm/types/components/SimpleTimeChooser.d.ts +0 -20
  34. package/dist/esm/types/helpers/getWordCount.d.ts +0 -10
  35. package/src/components/SimpleTimeChooser.tsx +0 -195
  36. package/src/helpers/getWordCount.ts +0 -26
@@ -14,7 +14,6 @@ type Props = {
14
14
  */
15
15
  onChanged: (updatedItems: PickableItem[]) => void;
16
16
  noBottomMargin?: boolean;
17
- hideSelectAllOrNoneButtons?: boolean;
18
17
  };
19
18
  declare const ItemPicker: React.FC<Props>;
20
19
  export default ItemPicker;
@@ -38,7 +38,5 @@ type ModalProps = {
38
38
  confirmLabel?: string;
39
39
  confirmVariant?: Variant;
40
40
  onTopOfOtherModals?: boolean;
41
- isLoading?: boolean;
42
- isLoadingCancelable?: boolean;
43
41
  };
44
42
  export default ModalProps;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * A very simple, lightweight date chooser
3
3
  * @author Gabe Abrams
4
- * @author Gardeniu Liu
5
4
  */
6
5
  import React from 'react';
7
6
  type Props = {
@@ -18,8 +17,7 @@ type Props = {
18
17
  */
19
18
  onChange: (month: number, day: number, year: number) => void;
20
19
  numMonthsToShow?: number;
21
- dontAllowPast?: boolean;
22
- dontAllowFuture?: boolean;
20
+ chooseFromPast?: boolean;
23
21
  };
24
22
  declare const SimpleDateChooser: React.FC<Props>;
25
23
  export default SimpleDateChooser;
@@ -6,7 +6,6 @@ import React from 'react';
6
6
  type Props = {
7
7
  title: React.ReactNode;
8
8
  children: React.ReactNode;
9
- topRightChildren?: React.ReactNode;
10
9
  noBottomMargin?: boolean;
11
10
  noBottomPadding?: boolean;
12
11
  };
@@ -7,7 +7,6 @@ import RadioButton from './components/RadioButton';
7
7
  import CheckboxButton from './components/CheckboxButton';
8
8
  import ButtonInputGroup from './components/ButtonInputGroup';
9
9
  import SimpleDateChooser from './components/SimpleDateChooser';
10
- import SimpleTimeChooser from './components/SimpleTimeChooser';
11
10
  import Drawer from './components/Drawer';
12
11
  import PopSuccessMark from './components/PopSuccessMark';
13
12
  import PopFailureMark from './components/PopFailureMark';
@@ -76,7 +75,6 @@ import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
76
75
  import someAsync from './helpers/asyncArrayFunctions/someAsync';
77
76
  import capitalize from './helpers/capitalize';
78
77
  import shuffleArray from './helpers/shuffleArray';
79
- import getWordCount from './helpers/getWordCount';
80
78
  import ParamType from './types/ParamType';
81
79
  import ModalButtonType from './types/ModalButtonType';
82
80
  import ModalSize from './types/ModalSize';
@@ -101,4 +99,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
101
99
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
102
100
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
103
101
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
104
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, SimpleTimeChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, 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, getWordCount, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, ParamType, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, };
102
+ 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, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, 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, ParamType, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, };
@@ -6,8 +6,6 @@ declare enum ReactKitErrorCode {
6
6
  NoResponse = "DRK1",
7
7
  NoCode = "DRK2",
8
8
  SessionExpired = "DRK3",
9
- NoCACCLSendRequestFunction = "DRK7",
10
- SimpleDateChooserInvalidDateRange = "DRK35",
11
- SimpleDateChooserInvalidNumMonths = "DRK36"
9
+ NoCACCLSendRequestFunction = "DRK7"
12
10
  }
13
11
  export default ReactKitErrorCode;
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare enum Variant {
23
23
  * @author Gabe Abrams
24
24
  */
25
25
 
26
- type Props$m = {
26
+ type Props$l = {
27
27
  children: React$1.ReactNode;
28
28
  };
29
29
  /**
@@ -106,7 +106,7 @@ declare const showFatalError: (error: any, errorTitle?: string) => Promise<void>
106
106
  * @author Gabe Abrams
107
107
  */
108
108
  declare const addFatalErrorHandler: (handler: () => void) => void;
109
- declare const AppWrapper: React$1.FC<Props$m>;
109
+ declare const AppWrapper: React$1.FC<Props$l>;
110
110
 
111
111
  /**
112
112
  * Loading spinner/indicator
@@ -120,14 +120,14 @@ declare const LoadingSpinner: () => React$1.JSX.Element;
120
120
  * @author Gabe Abrams
121
121
  */
122
122
 
123
- type Props$l = {
123
+ type Props$k = {
124
124
  error: any;
125
125
  title?: string;
126
126
  onClose?: () => void;
127
127
  variant?: Variant;
128
128
  icon?: IconProp;
129
129
  };
130
- declare const ErrorBox: React$1.FC<Props$l>;
130
+ declare const ErrorBox: React$1.FC<Props$k>;
131
131
 
132
132
  /**
133
133
  * Types of buttons in the modal
@@ -209,8 +209,6 @@ type ModalProps = {
209
209
  confirmLabel?: string;
210
210
  confirmVariant?: Variant;
211
211
  onTopOfOtherModals?: boolean;
212
- isLoading?: boolean;
213
- isLoadingCancelable?: boolean;
214
212
  };
215
213
 
216
214
  /**
@@ -226,21 +224,20 @@ declare const Modal: React$1.FC<ModalProps>;
226
224
  * @author Gabe Abrams
227
225
  */
228
226
 
229
- type Props$k = {
227
+ type Props$j = {
230
228
  title: React$1.ReactNode;
231
229
  children: React$1.ReactNode;
232
- topRightChildren?: React$1.ReactNode;
233
230
  noBottomMargin?: boolean;
234
231
  noBottomPadding?: boolean;
235
232
  };
236
- declare const TabBox: React$1.FC<Props$k>;
233
+ declare const TabBox: React$1.FC<Props$j>;
237
234
 
238
235
  /**
239
236
  * A radio selection button
240
237
  * @author Gabe Abrams
241
238
  */
242
239
 
243
- type Props$j = {
240
+ type Props$i = {
244
241
  text: React$1.ReactNode;
245
242
  onSelected: () => void;
246
243
  ariaLabel: string;
@@ -254,14 +251,14 @@ type Props$j = {
254
251
  small?: boolean;
255
252
  useComplexFormatting?: boolean;
256
253
  };
257
- declare const RadioButton: React$1.FC<Props$j>;
254
+ declare const RadioButton: React$1.FC<Props$i>;
258
255
 
259
256
  /**
260
257
  * A checkbox button
261
258
  * @author Gabe Abrams
262
259
  */
263
260
 
264
- type Props$i = {
261
+ type Props$h = {
265
262
  text: React$1.ReactNode;
266
263
  onChanged: (checked: boolean) => void;
267
264
  ariaLabel: string;
@@ -276,14 +273,14 @@ type Props$i = {
276
273
  dashed?: boolean;
277
274
  useComplexFormatting?: boolean;
278
275
  };
279
- declare const CheckboxButton: React$1.FC<Props$i>;
276
+ declare const CheckboxButton: React$1.FC<Props$h>;
280
277
 
281
278
  /**
282
279
  * Input group with a title and space for buttons
283
280
  * @author Gabe Abrams
284
281
  */
285
282
 
286
- type Props$h = {
283
+ type Props$g = {
287
284
  label: React$1.ReactNode;
288
285
  minLabelWidth?: string;
289
286
  children: React$1.ReactNode;
@@ -292,15 +289,14 @@ type Props$h = {
292
289
  isAdminFeature?: boolean;
293
290
  noMarginOnBottom?: boolean;
294
291
  };
295
- declare const ButtonInputGroup: React$1.FC<Props$h>;
292
+ declare const ButtonInputGroup: React$1.FC<Props$g>;
296
293
 
297
294
  /**
298
295
  * A very simple, lightweight date chooser
299
296
  * @author Gabe Abrams
300
- * @author Gardeniu Liu
301
297
  */
302
298
 
303
- type Props$g = {
299
+ type Props$f = {
304
300
  ariaLabel: string;
305
301
  name: string;
306
302
  month: number;
@@ -314,30 +310,9 @@ type Props$g = {
314
310
  */
315
311
  onChange: (month: number, day: number, year: number) => void;
316
312
  numMonthsToShow?: number;
317
- dontAllowPast?: boolean;
318
- dontAllowFuture?: boolean;
313
+ chooseFromPast?: boolean;
319
314
  };
320
- declare const SimpleDateChooser: React$1.FC<Props$g>;
321
-
322
- /**
323
- * A very simple, lightweight time chooser
324
- * @author Gardenia Liu
325
- */
326
-
327
- type Props$f = {
328
- ariaLabel: string;
329
- name: string;
330
- hour: number;
331
- minute: number;
332
- /**
333
- * Handler for when time changes
334
- * @param hour new 24hr hour number
335
- * @param minute new minute number
336
- */
337
- onChange: (hour: number, minute: number) => void;
338
- intervalMin?: number;
339
- };
340
- declare const SimpleTimeChooser: React$1.FC<Props$f>;
315
+ declare const SimpleDateChooser: React$1.FC<Props$f>;
341
316
 
342
317
  /**
343
318
  * Drawer container
@@ -437,7 +412,6 @@ type Props$9 = {
437
412
  */
438
413
  onChanged: (updatedItems: PickableItem[]) => void;
439
414
  noBottomMargin?: boolean;
440
- hideSelectAllOrNoneButtons?: boolean;
441
415
  };
442
416
  declare const ItemPicker: React$1.FC<Props$9>;
443
417
 
@@ -1524,16 +1498,6 @@ declare const capitalize: (str: string) => string;
1524
1498
  */
1525
1499
  declare const shuffleArray: <T>(arr: T[]) => T[];
1526
1500
 
1527
- /**
1528
- * Get number of words in string
1529
- * @author Gardenia Liu
1530
- * @author Allison Zhang
1531
- * @author Gabe Abrams
1532
- * @param text the string to check
1533
- * @returns number of words in the string
1534
- */
1535
- declare const getWordCount: (text: string) => number;
1536
-
1537
1501
  /**
1538
1502
  * Days of the week
1539
1503
  * @author Gabe Abrams
@@ -1572,9 +1536,7 @@ declare enum ReactKitErrorCode {
1572
1536
  NoResponse = "DRK1",
1573
1537
  NoCode = "DRK2",
1574
1538
  SessionExpired = "DRK3",
1575
- NoCACCLSendRequestFunction = "DRK7",
1576
- SimpleDateChooserInvalidDateRange = "DRK35",
1577
- SimpleDateChooserInvalidNumMonths = "DRK36"
1539
+ NoCACCLSendRequestFunction = "DRK7"
1578
1540
  }
1579
1541
 
1580
- 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, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogLevel, LogMainInfo, LogMetadataType, LogReviewer, LogSource, LogSourceSpecificInfo, LogType, LogTypeSpecificInfo, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getWordCount, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
1542
+ 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, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogLevel, LogMainInfo, LogMetadataType, LogReviewer, LogSource, LogSourceSpecificInfo, LogType, LogTypeSpecificInfo, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, 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": "4.0.0-beta-date-and-time.1",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -33,7 +33,7 @@
33
33
  "@fortawesome/free-solid-svg-icons": "^x.x.x",
34
34
  "@fortawesome/react-fontawesome": "^x.x.x",
35
35
  "bootstrap": "^5.x.x",
36
- "react": "^x.x.x"
36
+ "react": "^19.0.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -315,7 +315,7 @@ const IntelliTable: React.FC<Props> = (props) => {
315
315
  checked={columnVisibilityMap[column.param]}
316
316
  ariaLabel={`show "${column.title}" column in the ${title} table`}
317
317
  checkedVariant={Variant.Light}
318
- uncheckedVariant={Variant.Light}
318
+ uncheckedVariant={Variant.Secondary}
319
319
  />
320
320
  );
321
321
  })
@@ -272,7 +272,6 @@ const NestableItemList: React.FC<Props> = (props) => {
272
272
  }}
273
273
  ariaLabel={`Select ${item.name}`}
274
274
  checkedVariant={Variant.Light}
275
- uncheckedVariant={Variant.Light}
276
275
  />
277
276
 
278
277
  {/* Children */}
@@ -33,8 +33,6 @@ type Props = {
33
33
  onChanged: (updatedItems: PickableItem[]) => void,
34
34
  // If true, don't add margin to bottom of item picker
35
35
  noBottomMargin?: boolean,
36
- // If true, hide select all or none buttons
37
- hideSelectAllOrNoneButtons?: boolean,
38
36
  };
39
37
 
40
38
  /*------------------------------------------------------------------------*/
@@ -54,61 +52,12 @@ const ItemPicker: React.FC<Props> = (props) => {
54
52
  items,
55
53
  onChanged,
56
54
  noBottomMargin,
57
- hideSelectAllOrNoneButtons,
58
55
  } = props;
59
56
 
60
57
  /*------------------------------------------------------------------------*/
61
58
  /* ------------------------- Component Functions ------------------------ */
62
59
  /*------------------------------------------------------------------------*/
63
60
 
64
- /**
65
- * Updates the checked state of an item (including all children)
66
- * @author Yuen Ler Chow
67
- * @param item the item to update
68
- * @param checked the new checked state
69
- * @returns the updated item
70
- */
71
- const updateItemChecked = (
72
- item: PickableItem,
73
- checked: boolean,
74
- ): PickableItem => {
75
- if (item.isGroup) {
76
- return {
77
- ...item,
78
- children: item.children.map((child) => {
79
- return updateItemChecked(child, checked);
80
- }),
81
- };
82
- }
83
- return { ...item, checked };
84
- };
85
-
86
- /**
87
- * Selects all items in the list
88
- * @author Yuen Ler Chow
89
- */
90
- const handleSelectAll = () => {
91
- const updatedItems = items.map(
92
- (item) => {
93
- return updateItemChecked(item, true);
94
- },
95
- );
96
- onChanged(updatedItems);
97
- };
98
-
99
- /**
100
- * Deselects all items in the list
101
- * @author Yuen Ler Chow
102
- */
103
- const handleDeselectAll = () => {
104
- const updatedItems = items.map(
105
- (item) => {
106
- return updateItemChecked(item, false);
107
- },
108
- );
109
- onChanged(updatedItems);
110
- };
111
-
112
61
  /*------------------------------------------------------------------------*/
113
62
  /* ------------------------------- Render ------------------------------- */
114
63
  /*------------------------------------------------------------------------*/
@@ -117,55 +66,10 @@ const ItemPicker: React.FC<Props> = (props) => {
117
66
  /* --------------- Main UI -------------- */
118
67
  /*----------------------------------------*/
119
68
 
120
- // Select all/none
121
- const selectAllOrNone = (
122
- !hideSelectAllOrNoneButtons
123
- ? (
124
- <div
125
- className="d-flex h-100 align-items-end flex-row"
126
- >
127
- <div className="d-flex justify-content-end">
128
- {/* Label */}
129
- <div
130
- className="me-2"
131
- style={{ fontSize: '1.2rem' }}
132
- >
133
- Select
134
- </div>
135
- {/* Buttons */}
136
- <div className="btn-group" role="group">
137
- {/* All */}
138
- <button
139
- type="button"
140
- style={{ borderRight: '0.1rem solid white' }}
141
- aria-label="Select all contexts"
142
- className="btn btn-secondary py-0"
143
- onClick={handleSelectAll}
144
- >
145
- All
146
- </button>
147
- {/* None */}
148
- <button
149
- type="button"
150
- aria-label="Deselect all contexts"
151
- className="btn btn-secondary py-0"
152
- onClick={handleDeselectAll}
153
- >
154
- None
155
- </button>
156
- </div>
157
- </div>
158
- </div>
159
- )
160
- : undefined
161
- );
162
-
163
- // Main UI
164
69
  return (
165
70
  <TabBox
166
71
  title={title}
167
72
  noBottomMargin={noBottomMargin}
168
- topRightChildren={selectAllOrNone}
169
73
  >
170
74
  <div style={{ overflowX: 'auto' }}>
171
75
  <NestableItemList
@@ -1182,7 +1182,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1182
1182
  year={dateFilterState.startDate.year}
1183
1183
  month={dateFilterState.startDate.month}
1184
1184
  day={dateFilterState.startDate.day}
1185
- dontAllowFuture
1185
+ chooseFromPast
1186
1186
  numMonthsToShow={36}
1187
1187
  onChange={(month, day, year) => {
1188
1188
  dateFilterState.startDate = { month, day, year };
@@ -1198,7 +1198,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1198
1198
  year={dateFilterState.endDate.year}
1199
1199
  month={dateFilterState.endDate.month}
1200
1200
  day={dateFilterState.endDate.day}
1201
- dontAllowFuture
1201
+ chooseFromPast
1202
1202
  numMonthsToShow={12}
1203
1203
  onChange={(month, day, year) => {
1204
1204
  if (
@@ -69,10 +69,6 @@ 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,
76
72
  };
77
73
 
78
74
  export default ModalProps;
@@ -14,9 +14,6 @@ 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
20
17
  import waitMs from '../../helpers/waitMs';
21
18
 
22
19
  // Import types
@@ -44,7 +41,6 @@ const BASE_Z_INDEX_ON_TOP = 2000000000;
44
41
 
45
42
  // Constants
46
43
  const MS_TO_ANIMATE = 200; // Animation duration
47
- const MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR = 1000;
48
44
 
49
45
  // Modal type to list of buttons
50
46
  const modalTypeToModalButtonTypes: {
@@ -260,8 +256,6 @@ const Modal: React.FC<ModalProps> = (props) => {
260
256
  dontAllowBackdropExit,
261
257
  dontShowXButton,
262
258
  onTopOfOtherModals,
263
- isLoading,
264
- isLoadingCancelable,
265
259
  } = props;
266
260
 
267
261
  // Determine if no header either
@@ -272,7 +266,6 @@ const Modal: React.FC<ModalProps> = (props) => {
272
266
  // True if animation is in use
273
267
  const [animatingIn, setAnimatingIn] = useState(true);
274
268
  const [animatingPop, setAnimatingPop] = useState(false);
275
- const [showModal, setShowModal] = useState(false);
276
269
 
277
270
  /* -------------- Refs -------------- */
278
271
 
@@ -305,15 +298,6 @@ const Modal: React.FC<ModalProps> = (props) => {
305
298
  if (mounted.current) {
306
299
  setAnimatingIn(false);
307
300
  }
308
- if (isLoading) {
309
- // wait before showing modal
310
- await waitMs(MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR);
311
- if (mounted.current) {
312
- setShowModal(true);
313
- }
314
- } else {
315
- setShowModal(true);
316
- }
317
301
  })();
318
302
 
319
303
  return () => {
@@ -416,17 +400,6 @@ const Modal: React.FC<ModalProps> = (props) => {
416
400
  animationClass = 'Modal-animating-pop';
417
401
  }
418
402
 
419
- // default to show close button when not loading and not show close button when loading
420
- // unless downShowXButton or isLoadingCancelable
421
- const showCloseButton = (
422
- // The modal must have an onClose function
423
- onClose
424
- // ...and the close button is allowed to be visible
425
- && !dontShowXButton
426
- // ...and should not be shown if the modal is loading and not cancelable
427
- && !(isLoading && !isLoadingCancelable)
428
- );
429
-
430
403
  // Render the modal
431
404
  const contentToRender = (
432
405
  <div
@@ -463,8 +436,6 @@ const Modal: React.FC<ModalProps> = (props) => {
463
436
  handleClose(ModalButtonType.Cancel);
464
437
  }}
465
438
  />
466
-
467
- {showModal && (
468
439
  <div
469
440
  className={`modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`}
470
441
  style={{
@@ -527,7 +498,7 @@ const Modal: React.FC<ModalProps> = (props) => {
527
498
  {title}
528
499
  </h5>
529
500
 
530
- {showCloseButton && (
501
+ {(onClose && !dontShowXButton) && (
531
502
  <button
532
503
  type="button"
533
504
  className="Modal-x-button btn-close"
@@ -547,34 +518,25 @@ const Modal: React.FC<ModalProps> = (props) => {
547
518
  )}
548
519
  </div>
549
520
  )}
550
-
551
- <div
552
- className="modal-body"
553
- style={{
554
- color: (
555
- isDarkModeOn()
556
- ? 'white'
557
- : undefined
558
- ),
559
- backgroundColor: (
560
- isDarkModeOn()
561
- ? '#444'
562
- : undefined
563
- ),
564
- }}
565
- >
566
- {
567
- isLoading
568
- ? (
569
- <>
570
- <LoadingSpinner />
571
- <span className="sr-only">Content loading</span>
572
- </>
573
- )
574
- : children
575
- }
576
- </div>
577
-
521
+ {children && (
522
+ <div
523
+ className="modal-body"
524
+ style={{
525
+ color: (
526
+ isDarkModeOn()
527
+ ? 'white'
528
+ : undefined
529
+ ),
530
+ backgroundColor: (
531
+ isDarkModeOn()
532
+ ? '#444'
533
+ : undefined
534
+ ),
535
+ }}
536
+ >
537
+ {children}
538
+ </div>
539
+ )}
578
540
  {footer && (
579
541
  <div
580
542
  className="modal-footer pt-1 pb-1"
@@ -601,7 +563,6 @@ const Modal: React.FC<ModalProps> = (props) => {
601
563
  )}
602
564
  </div>
603
565
  </div>
604
- )}
605
566
  </div>
606
567
  );
607
568