dce-reactkit 3.5.5 → 3.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Container that automatically scrolls when new items are added,
3
+ * lets the user scroll up to see old items, but resumes
4
+ * autoscroll when the user scrolls back to the bottom
5
+ * @author Gabe Abrams
6
+ */
7
+ import React from 'react';
8
+ import Variant from '../types/Variant';
9
+ type Props = {
10
+ itemsName?: string;
11
+ items: AutoScrollItem[];
12
+ jumpToBottomButtonVariant?: Variant;
13
+ };
14
+ type AutoScrollItem = {
15
+ id: string | number;
16
+ item: React.ReactNode;
17
+ };
18
+ declare const ScrollLockToBottom: React.FC<Props>;
19
+ export default ScrollLockToBottom;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Convert a string to hyphenated lowercase format with no space or
3
+ * non-alphanumeric characters
4
+ * @author Gabe Abrams
5
+ * @param str the string to convert
6
+ * @returns the idified string
7
+ */
8
+ declare const idify: (str: string) => string;
9
+ export default idify;
@@ -19,6 +19,7 @@ import CSVDownloadButton from './components/CSVDownloadButton';
19
19
  import DBEntryManagerPanel from './components/DBEntryManagerPanel';
20
20
  import Tooltip from './components/Tooltip';
21
21
  import ToggleSwitch from './components/ToggleSwitch';
22
+ import ScrollLockToBottom from './components/ScrollLockToBottomContainer';
22
23
  import ErrorWithCode from './errors/ErrorWithCode';
23
24
  import MINUTE_IN_MS from './constants/MINUTE_IN_MS';
24
25
  import HOUR_IN_MS from './constants/HOUR_IN_MS';
@@ -63,6 +64,7 @@ import genCommaList from './helpers/genCommaList';
63
64
  import validateEmail from './helpers/validators/validateEmail';
64
65
  import validatePhoneNumber from './helpers/validators/validatePhoneNumber';
65
66
  import validateString from './helpers/validators/validateString';
67
+ import idify from './helpers/idify';
66
68
  import ModalButtonType from './types/ModalButtonType';
67
69
  import ModalSize from './types/ModalSize';
68
70
  import ModalType from './types/ModalType';
@@ -81,4 +83,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
81
83
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
82
84
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
83
85
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
84
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, 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, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
86
+ export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, ScrollLockToBottom, 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, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
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$j = {
27
+ type Props$k = {
28
28
  children: React.ReactNode;
29
29
  dark?: boolean;
30
30
  };
@@ -68,7 +68,7 @@ declare const showFatalError: (error: any, errorTitle?: string) => undefined;
68
68
  * @author Gabe Abrams
69
69
  */
70
70
  declare const addFatalErrorHandler: (handler: () => void) => void;
71
- declare const AppWrapper: React.FC<Props$j>;
71
+ declare const AppWrapper: React.FC<Props$k>;
72
72
 
73
73
  /**
74
74
  * Loading spinner/indicator
@@ -81,12 +81,12 @@ declare const LoadingSpinner: () => JSX.Element;
81
81
  * @author Gabe Abrams
82
82
  */
83
83
 
84
- type Props$i = {
84
+ type Props$j = {
85
85
  error: any;
86
86
  title?: string;
87
87
  onClose?: () => void;
88
88
  };
89
- declare const ErrorBox: React.FC<Props$i>;
89
+ declare const ErrorBox: React.FC<Props$j>;
90
90
 
91
91
  /**
92
92
  * Types of buttons in the modal
@@ -137,7 +137,7 @@ declare enum ModalType {
137
137
  * @author Gabe Abrams
138
138
  */
139
139
 
140
- type Props$h = {
140
+ type Props$i = {
141
141
  type?: ModalType;
142
142
  size?: ModalSize;
143
143
  title?: React.ReactNode;
@@ -166,27 +166,27 @@ type Props$h = {
166
166
  confirmVariant?: Variant;
167
167
  onTopOfOtherModals?: boolean;
168
168
  };
169
- declare const Modal: React.FC<Props$h>;
169
+ declare const Modal: React.FC<Props$i>;
170
170
 
171
171
  /**
172
172
  * A box with a tab on the top that holds buttons and other content
173
173
  * @author Gabe Abrams
174
174
  */
175
175
 
176
- type Props$g = {
176
+ type Props$h = {
177
177
  title: React.ReactNode;
178
178
  children: React.ReactNode;
179
179
  noBottomMargin?: boolean;
180
180
  noBottomPadding?: boolean;
181
181
  };
182
- declare const TabBox: React.FC<Props$g>;
182
+ declare const TabBox: React.FC<Props$h>;
183
183
 
184
184
  /**
185
185
  * A radio selection button
186
186
  * @author Gabe Abrams
187
187
  */
188
188
 
189
- type Props$f = {
189
+ type Props$g = {
190
190
  text: string;
191
191
  onSelected: () => void;
192
192
  ariaLabel: string;
@@ -198,14 +198,14 @@ type Props$f = {
198
198
  unselectedVariant?: Variant;
199
199
  small?: boolean;
200
200
  };
201
- declare const RadioButton: React.FC<Props$f>;
201
+ declare const RadioButton: React.FC<Props$g>;
202
202
 
203
203
  /**
204
204
  * A checkbox button
205
205
  * @author Gabe Abrams
206
206
  */
207
207
 
208
- type Props$e = {
208
+ type Props$f = {
209
209
  text: string;
210
210
  onChanged: (checked: boolean) => void;
211
211
  ariaLabel: string;
@@ -219,28 +219,28 @@ type Props$e = {
219
219
  small?: boolean;
220
220
  dashed?: boolean;
221
221
  };
222
- declare const CheckboxButton: React.FC<Props$e>;
222
+ declare const CheckboxButton: React.FC<Props$f>;
223
223
 
224
224
  /**
225
225
  * Input group with a title and space for buttons
226
226
  * @author Gabe Abrams
227
227
  */
228
228
 
229
- type Props$d = {
229
+ type Props$e = {
230
230
  label: string;
231
231
  minLabelWidth?: string;
232
232
  children: React.ReactNode;
233
233
  className?: string;
234
234
  wrapButtonsAndAddGaps?: boolean;
235
235
  };
236
- declare const ButtonInputGroup: React.FC<Props$d>;
236
+ declare const ButtonInputGroup: React.FC<Props$e>;
237
237
 
238
238
  /**
239
239
  * A very simple, lightweight date chooser
240
240
  * @author Gabe Abrams
241
241
  */
242
242
 
243
- type Props$c = {
243
+ type Props$d = {
244
244
  ariaLabel: string;
245
245
  name: string;
246
246
  month: number;
@@ -256,61 +256,61 @@ type Props$c = {
256
256
  numMonthsToShow?: number;
257
257
  chooseFromPast?: boolean;
258
258
  };
259
- declare const SimpleDateChooser: React.FC<Props$c>;
259
+ declare const SimpleDateChooser: React.FC<Props$d>;
260
260
 
261
261
  /**
262
262
  * Drawer container
263
263
  * @author Gabe Abrams
264
264
  */
265
265
 
266
- type Props$b = {
266
+ type Props$c = {
267
267
  customBackgroundColor?: string;
268
268
  children: React.ReactNode;
269
269
  };
270
- declare const Drawer: React.FC<Props$b>;
270
+ declare const Drawer: React.FC<Props$c>;
271
271
 
272
272
  /**
273
273
  * Success checkmark that pops into view
274
274
  * @author Gabe Abrams
275
275
  */
276
276
 
277
- type Props$a = {
277
+ type Props$b = {
278
278
  sizeRem?: number;
279
279
  circleVariant?: string;
280
280
  checkVariant?: string;
281
281
  };
282
- declare const PopSuccessMark: React.FC<Props$a>;
282
+ declare const PopSuccessMark: React.FC<Props$b>;
283
283
 
284
284
  /**
285
285
  * Failure x mark that pops into view
286
286
  * @author Gabe Abrams
287
287
  */
288
288
 
289
- type Props$9 = {
289
+ type Props$a = {
290
290
  sizeRem?: number;
291
291
  circleVariant?: string;
292
292
  xVariant?: string;
293
293
  };
294
- declare const PopFailureMark: React.FC<Props$9>;
294
+ declare const PopFailureMark: React.FC<Props$a>;
295
295
 
296
296
  /**
297
297
  * Failure pending that pops into view
298
298
  * @author Gabe Abrams
299
299
  */
300
300
 
301
- type Props$8 = {
301
+ type Props$9 = {
302
302
  sizeRem?: number;
303
303
  circleVariant?: string;
304
304
  hourglassVariant?: string;
305
305
  };
306
- declare const PopPendingMark: React.FC<Props$8>;
306
+ declare const PopPendingMark: React.FC<Props$9>;
307
307
 
308
308
  /**
309
309
  * Copiable text box
310
310
  * @author Gabe Abrams
311
311
  */
312
312
 
313
- type Props$7 = {
313
+ type Props$8 = {
314
314
  text: string;
315
315
  maxTextWidthRem?: number;
316
316
  label?: string;
@@ -322,7 +322,7 @@ type Props$7 = {
322
322
  textAreaId?: string;
323
323
  copyButtonId?: string;
324
324
  };
325
- declare const CopiableBox: React.FC<Props$7>;
325
+ declare const CopiableBox: React.FC<Props$8>;
326
326
 
327
327
  /**
328
328
  * An item that can be chosen (for use within ItemPicker)
@@ -345,7 +345,7 @@ type PickableItem = ({
345
345
  * @author Yuen Ler Chow
346
346
  */
347
347
 
348
- type Props$6 = {
348
+ type Props$7 = {
349
349
  title: string;
350
350
  items: PickableItem[];
351
351
  /**
@@ -356,7 +356,7 @@ type Props$6 = {
356
356
  onChanged: (updatedItems: PickableItem[]) => void;
357
357
  noBottomMargin?: boolean;
358
358
  };
359
- declare const ItemPicker: React.FC<Props$6>;
359
+ declare const ItemPicker: React.FC<Props$7>;
360
360
 
361
361
  /**
362
362
  * Type of the context map in a LogMetadata file
@@ -401,11 +401,11 @@ type LogMetadataType = {
401
401
  * @author Gabe Abrams
402
402
  */
403
403
 
404
- type Props$5 = {
404
+ type Props$6 = {
405
405
  LogMetadata: LogMetadataType;
406
406
  onClose: () => void;
407
407
  };
408
- declare const LogReviewer: React.FC<Props$5>;
408
+ declare const LogReviewer: React.FC<Props$6>;
409
409
 
410
410
  /**
411
411
  * Server-side API param types
@@ -440,7 +440,7 @@ type IntelliTableColumn = {
440
440
  * @author Gabe Abrams
441
441
  */
442
442
 
443
- type Props$4 = {
443
+ type Props$5 = {
444
444
  title: string;
445
445
  id: string;
446
446
  data: {
@@ -450,14 +450,14 @@ type Props$4 = {
450
450
  columns: IntelliTableColumn[];
451
451
  csvName?: string;
452
452
  };
453
- declare const IntelliTable: React.FC<Props$4>;
453
+ declare const IntelliTable: React.FC<Props$5>;
454
454
 
455
455
  /**
456
456
  * Button for downloading a csv file
457
457
  * @author Gabe Abrams
458
458
  */
459
459
 
460
- type Props$3 = {
460
+ type Props$4 = {
461
461
  filename: string;
462
462
  csv: string;
463
463
  id?: string;
@@ -469,7 +469,7 @@ type Props$3 = {
469
469
  onClick?: () => void;
470
470
  children?: React.ReactNode;
471
471
  };
472
- declare const CSVDownloadButton: React.FC<Props$3>;
472
+ declare const CSVDownloadButton: React.FC<Props$4>;
473
473
 
474
474
  /**
475
475
  * Generic type for an object
@@ -545,7 +545,7 @@ type DBEntryField = ({
545
545
  * @author Gabe Abrams
546
546
  */
547
547
 
548
- type Props$2 = {
548
+ type Props$3 = {
549
549
  entryFields: DBEntryField[];
550
550
  idPropName: string;
551
551
  titlePropName: string;
@@ -571,21 +571,21 @@ type Props$2 = {
571
571
  [k: string]: any;
572
572
  };
573
573
  };
574
- declare const DBEntryManagerPanel: React.FC<Props$2>;
574
+ declare const DBEntryManagerPanel: React.FC<Props$3>;
575
575
 
576
576
  /**
577
577
  * Simple tooltip component
578
578
  * @author Gabe Abrams
579
579
  */
580
580
 
581
- type Props$1 = {
581
+ type Props$2 = {
582
582
  icon?: IconProp;
583
583
  text: string;
584
584
  children: React.ReactNode;
585
585
  wide?: boolean;
586
586
  thin?: boolean;
587
587
  };
588
- declare const Tooltip: React.FC<Props$1>;
588
+ declare const Tooltip: React.FC<Props$2>;
589
589
 
590
590
  /**
591
591
  * A toggle switch that toggles on or off
@@ -593,7 +593,7 @@ declare const Tooltip: React.FC<Props$1>;
593
593
  * @author Gabe Abrams
594
594
  */
595
595
 
596
- type Props = {
596
+ type Props$1 = {
597
597
  isOn: boolean;
598
598
  /**
599
599
  * A handler to call when the switch is toggled
@@ -604,7 +604,25 @@ type Props = {
604
604
  description: string;
605
605
  backgroundVariantWhenOn?: Variant;
606
606
  };
607
- declare const ToggleSwitch: React.FC<Props>;
607
+ declare const ToggleSwitch: React.FC<Props$1>;
608
+
609
+ /**
610
+ * Container that automatically scrolls when new items are added,
611
+ * lets the user scroll up to see old items, but resumes
612
+ * autoscroll when the user scrolls back to the bottom
613
+ * @author Gabe Abrams
614
+ */
615
+
616
+ type Props = {
617
+ itemsName?: string;
618
+ items: AutoScrollItem[];
619
+ jumpToBottomButtonVariant?: Variant;
620
+ };
621
+ type AutoScrollItem = {
622
+ id: string | number;
623
+ item: React.ReactNode;
624
+ };
625
+ declare const ScrollLockToBottom: React.FC<Props>;
608
626
 
609
627
  /**
610
628
  * An error with a code
@@ -1333,6 +1351,15 @@ declare const validateString: (input: string, opts: {
1333
1351
  regexDescription?: string;
1334
1352
  }) => ValidationResult<string>;
1335
1353
 
1354
+ /**
1355
+ * Convert a string to hyphenated lowercase format with no space or
1356
+ * non-alphanumeric characters
1357
+ * @author Gabe Abrams
1358
+ * @param str the string to convert
1359
+ * @returns the idified string
1360
+ */
1361
+ declare const idify: (str: string) => string;
1362
+
1336
1363
  /**
1337
1364
  * List of error codes built into the react kit
1338
1365
  * @author Gabe Abrams
@@ -1383,4 +1410,4 @@ declare const LogBuiltInMetadata: {
1383
1410
  };
1384
1411
  };
1385
1412
 
1386
- export { AppWrapper, 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, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
1413
+ export { AppWrapper, 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, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, ScrollLockToBottom, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.5.5",
3
+ "version": "3.5.6",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",