dce-reactkit 3.9.0-beta.1 → 3.9.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 +564 -257
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/Dropdown.d.ts +32 -0
  4. package/dist/cjs/types/components/Modal/ModalProps.d.ts +0 -2
  5. package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +9 -0
  6. package/dist/cjs/types/helpers/validators/validURL.d.ts +8 -0
  7. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +24 -0
  8. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
  9. package/dist/cjs/types/index.d.ts +4 -1
  10. package/dist/cjs/types/types/DropdownItemType.d.ts +6 -0
  11. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +4 -1
  12. package/dist/esm/index.js +562 -259
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/types/components/Dropdown.d.ts +32 -0
  15. package/dist/esm/types/components/Modal/ModalProps.d.ts +0 -2
  16. package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +9 -0
  17. package/dist/esm/types/helpers/validators/validURL.d.ts +8 -0
  18. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +24 -0
  19. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
  20. package/dist/esm/types/index.d.ts +4 -1
  21. package/dist/esm/types/types/DropdownItemType.d.ts +6 -0
  22. package/dist/esm/types/types/ReactKitErrorCode.d.ts +4 -1
  23. package/dist/index.d.ts +107 -46
  24. package/package.json +2 -1
  25. package/src/components/Dropdown.tsx +317 -0
  26. package/src/components/Modal/ModalProps.ts +0 -4
  27. package/src/components/Modal/index.tsx +3 -39
  28. package/src/components/MultiSwitch.tsx +1 -1
  29. package/src/helpers/validators/ChicagoTitleCase.test.ts +85 -0
  30. package/src/helpers/validators/ChicagoTitleCase.ts +32 -0
  31. package/src/helpers/validators/findURL.test.ts +83 -0
  32. package/src/helpers/validators/findURL.ts +43 -0
  33. package/src/helpers/validators/validURL.test.ts +90 -0
  34. package/src/helpers/validators/validURL.ts +18 -0
  35. package/src/helpers/visitEndpointOnAnotherServer/index.ts +93 -0
  36. package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +164 -0
  37. package/src/index.ts +6 -0
  38. package/src/types/DropdownItemType.ts +11 -0
  39. package/src/types/ReactKitErrorCode.tsx +6 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A simple dropdown menu
3
+ * @author Alessandra De Lucas
4
+ * @author Yuen Ler Chow
5
+ * @author Gabe Abrams
6
+ */
7
+ import React from 'react';
8
+ import Variant from '../types/Variant';
9
+ import DropdownItemType from '../types/DropdownItemType';
10
+ type Props = {
11
+ items: DropdownItem[];
12
+ dropdownButton: {
13
+ ariaLabel: string;
14
+ id: string;
15
+ content?: React.ReactNode;
16
+ variant?: Variant;
17
+ };
18
+ };
19
+ type DropdownItem = ({
20
+ type: DropdownItemType.Header;
21
+ content: React.ReactNode;
22
+ } | {
23
+ type: DropdownItemType.Divider;
24
+ } | {
25
+ type: DropdownItemType.Item;
26
+ content: React.ReactNode;
27
+ ariaLabel: string;
28
+ id: string;
29
+ onClick: () => void;
30
+ });
31
+ declare const Dropdown: React.FC<Props>;
32
+ export default Dropdown;
@@ -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;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This function converts a string to title case based on Chicago Title Case
3
+ * Style rules.
4
+ * @author Leisha Bhandari
5
+ * @param input: The input string that needs to be converted to Chicago title
6
+ * case.
7
+ * @returns Input string converted to title case
8
+ */
9
+ declare const chicagoTitleCase: (input: string) => string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This function checks if a given input string is a valid URL.
3
+ * @author Leisha Bhandari
4
+ * @param URL: The input string that needs checked as a URL or not.
5
+ * @returns A true boolean value if the input string is a valid URL, and a false
6
+ * boolean value if the input string is a invalid URL
7
+ */
8
+ declare function isValid(url: string): boolean;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Send a server-to-server request from this sever to another server that uses
3
+ * dce-reactkit [for server only]
4
+ * @author Gabe Abrams
5
+ * @param opts object containing all arguments
6
+ * @param opts.host - the host of the other server
7
+ * @param opts.path - the path of the other server's endpoint
8
+ * @param [opts.method=GET] - the method of the endpoint
9
+ * @param [opts.params] - query/body parameters to include
10
+ * @param [opts.headers] - headers to include
11
+ * @returns response from server
12
+ */
13
+ declare const visitEndpointOnAnotherServer: (opts: {
14
+ host: string;
15
+ path: string;
16
+ method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
17
+ params?: {
18
+ [x: string]: any;
19
+ } | undefined;
20
+ headers?: {
21
+ [x: string]: any;
22
+ } | undefined;
23
+ }) => Promise<any>;
24
+ export default visitEndpointOnAnotherServer;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Sends and retries an http request
3
+ * @author Gabriel Abrams
4
+ * @param opts object containing all arguments
5
+ * @param opts.path path to send request to
6
+ * @param [opts.host] host to send request to
7
+ * @param [opts.method=GET] http method to use
8
+ * @param [opts.params] body/data to include in the request
9
+ * @param [opts.headers] headers to include in the request
10
+ * @param [opts.sendCrossDomainCredentials=true if in development mode] if true,
11
+ * send cross-domain credentials even if not in dev mode
12
+ * @param [opts.responseType=JSON] expected response type
13
+ * @returns { body, status, headers } on success
14
+ */
15
+ declare const sendServerToServerRequest: (opts: {
16
+ path: string;
17
+ host?: string | undefined;
18
+ method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
19
+ params?: {
20
+ [x: string]: any;
21
+ } | undefined;
22
+ headers?: {
23
+ [x: string]: any;
24
+ } | undefined;
25
+ responseType?: "Text" | "JSON" | undefined;
26
+ }) => Promise<{
27
+ body: any;
28
+ status: number;
29
+ headers: {
30
+ [x: string]: any;
31
+ };
32
+ }>;
33
+ export default sendServerToServerRequest;
@@ -21,6 +21,7 @@ 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';
24
25
  import ErrorWithCode from './errors/ErrorWithCode';
25
26
  import MINUTE_IN_MS from './constants/MINUTE_IN_MS';
26
27
  import HOUR_IN_MS from './constants/HOUR_IN_MS';
@@ -77,6 +78,7 @@ import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
77
78
  import someAsync from './helpers/asyncArrayFunctions/someAsync';
78
79
  import capitalize from './helpers/capitalize';
79
80
  import shuffleArray from './helpers/shuffleArray';
81
+ import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
80
82
  import ModalButtonType from './types/ModalButtonType';
81
83
  import ModalSize from './types/ModalSize';
82
84
  import ModalType from './types/ModalType';
@@ -92,8 +94,9 @@ import LogBuiltInMetadata from './types/LogBuiltInMetadata';
92
94
  import LogMetadataType from './types/LogMetadataType';
93
95
  import LogFunction from './types/LogFunction';
94
96
  import IntelliTableColumn from './types/IntelliTableColumn';
97
+ import DropdownItemType from './types/DropdownItemType';
95
98
  import PickableItem from './components/ItemPicker/types/PickableItem';
96
99
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
97
100
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
98
101
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
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, };
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, 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, visitEndpointOnAnotherServer, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
@@ -0,0 +1,6 @@
1
+ declare enum DropdownItemType {
2
+ Header = "Header",
3
+ Divider = "Divider",
4
+ Item = "Item"
5
+ }
6
+ export default DropdownItemType;
@@ -15,6 +15,9 @@ declare enum ReactKitErrorCode {
15
15
  NotAdmin = "DRK10",
16
16
  NotAllowedToReviewLogs = "DRK11",
17
17
  ThemeCheckedBeforeReactKitReady = "DRK12",
18
- SessionExpiredMessageGottenBeforeReactKitReady = "DRK13"
18
+ SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
19
+ NotConnected = "DRK14",
20
+ SelfSigned = "DRK15",
21
+ ResponseParseError = "DRK16"
19
22
  }
20
23
  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$k = {
27
+ type Props$l = {
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$k>;
78
+ declare const AppWrapper: React$1.FC<Props$l>;
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$j = {
91
+ type Props$k = {
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$j>;
98
+ declare const ErrorBox: React$1.FC<Props$k>;
99
99
 
100
100
  /**
101
101
  * Types of buttons in the modal
@@ -176,8 +176,6 @@ type ModalProps = {
176
176
  confirmLabel?: string;
177
177
  confirmVariant?: Variant;
178
178
  onTopOfOtherModals?: boolean;
179
- isLoading?: boolean;
180
- isLoadingCancelable?: boolean;
181
179
  };
182
180
 
183
181
  /**
@@ -193,20 +191,20 @@ declare const Modal: React$1.FC<ModalProps>;
193
191
  * @author Gabe Abrams
194
192
  */
195
193
 
196
- type Props$i = {
194
+ type Props$j = {
197
195
  title: React$1.ReactNode;
198
196
  children: React$1.ReactNode;
199
197
  noBottomMargin?: boolean;
200
198
  noBottomPadding?: boolean;
201
199
  };
202
- declare const TabBox: React$1.FC<Props$i>;
200
+ declare const TabBox: React$1.FC<Props$j>;
203
201
 
204
202
  /**
205
203
  * A radio selection button
206
204
  * @author Gabe Abrams
207
205
  */
208
206
 
209
- type Props$h = {
207
+ type Props$i = {
210
208
  text: React$1.ReactNode;
211
209
  onSelected: () => void;
212
210
  ariaLabel: string;
@@ -218,14 +216,14 @@ type Props$h = {
218
216
  unselectedVariant?: Variant;
219
217
  small?: boolean;
220
218
  };
221
- declare const RadioButton: React$1.FC<Props$h>;
219
+ declare const RadioButton: React$1.FC<Props$i>;
222
220
 
223
221
  /**
224
222
  * A checkbox button
225
223
  * @author Gabe Abrams
226
224
  */
227
225
 
228
- type Props$g = {
226
+ type Props$h = {
229
227
  text: React$1.ReactNode;
230
228
  onChanged: (checked: boolean) => void;
231
229
  ariaLabel: string;
@@ -239,14 +237,14 @@ type Props$g = {
239
237
  small?: boolean;
240
238
  dashed?: boolean;
241
239
  };
242
- declare const CheckboxButton: React$1.FC<Props$g>;
240
+ declare const CheckboxButton: React$1.FC<Props$h>;
243
241
 
244
242
  /**
245
243
  * Input group with a title and space for buttons
246
244
  * @author Gabe Abrams
247
245
  */
248
246
 
249
- type Props$f = {
247
+ type Props$g = {
250
248
  label: React$1.ReactNode;
251
249
  minLabelWidth?: string;
252
250
  children: React$1.ReactNode;
@@ -255,14 +253,14 @@ type Props$f = {
255
253
  isAdminFeature?: boolean;
256
254
  noMarginOnBottom?: boolean;
257
255
  };
258
- declare const ButtonInputGroup: React$1.FC<Props$f>;
256
+ declare const ButtonInputGroup: React$1.FC<Props$g>;
259
257
 
260
258
  /**
261
259
  * A very simple, lightweight date chooser
262
260
  * @author Gabe Abrams
263
261
  */
264
262
 
265
- type Props$e = {
263
+ type Props$f = {
266
264
  ariaLabel: string;
267
265
  name: string;
268
266
  month: number;
@@ -278,62 +276,62 @@ type Props$e = {
278
276
  numMonthsToShow?: number;
279
277
  chooseFromPast?: boolean;
280
278
  };
281
- declare const SimpleDateChooser: React$1.FC<Props$e>;
279
+ declare const SimpleDateChooser: React$1.FC<Props$f>;
282
280
 
283
281
  /**
284
282
  * Drawer container
285
283
  * @author Gabe Abrams
286
284
  */
287
285
 
288
- type Props$d = {
286
+ type Props$e = {
289
287
  grayBackground?: boolean;
290
288
  customBackgroundColor?: string;
291
289
  children: React$1.ReactNode;
292
290
  };
293
- declare const Drawer: React$1.FC<Props$d>;
291
+ declare const Drawer: React$1.FC<Props$e>;
294
292
 
295
293
  /**
296
294
  * Success checkmark that pops into view
297
295
  * @author Gabe Abrams
298
296
  */
299
297
 
300
- type Props$c = {
298
+ type Props$d = {
301
299
  sizeRem?: number;
302
300
  circleVariant?: string;
303
301
  checkVariant?: string;
304
302
  };
305
- declare const PopSuccessMark: React$1.FC<Props$c>;
303
+ declare const PopSuccessMark: React$1.FC<Props$d>;
306
304
 
307
305
  /**
308
306
  * Failure x mark that pops into view
309
307
  * @author Gabe Abrams
310
308
  */
311
309
 
312
- type Props$b = {
310
+ type Props$c = {
313
311
  sizeRem?: number;
314
312
  circleVariant?: string;
315
313
  xVariant?: string;
316
314
  };
317
- declare const PopFailureMark: React$1.FC<Props$b>;
315
+ declare const PopFailureMark: React$1.FC<Props$c>;
318
316
 
319
317
  /**
320
318
  * Failure pending that pops into view
321
319
  * @author Gabe Abrams
322
320
  */
323
321
 
324
- type Props$a = {
322
+ type Props$b = {
325
323
  sizeRem?: number;
326
324
  circleVariant?: string;
327
325
  hourglassVariant?: string;
328
326
  };
329
- declare const PopPendingMark: React$1.FC<Props$a>;
327
+ declare const PopPendingMark: React$1.FC<Props$b>;
330
328
 
331
329
  /**
332
330
  * Copiable text box
333
331
  * @author Gabe Abrams
334
332
  */
335
333
 
336
- type Props$9 = {
334
+ type Props$a = {
337
335
  text: string;
338
336
  maxTextWidthRem?: number;
339
337
  label?: string;
@@ -345,7 +343,7 @@ type Props$9 = {
345
343
  textAreaId?: string;
346
344
  copyButtonId?: string;
347
345
  };
348
- declare const CopiableBox: React$1.FC<Props$9>;
346
+ declare const CopiableBox: React$1.FC<Props$a>;
349
347
 
350
348
  /**
351
349
  * An item that can be chosen (for use within ItemPicker)
@@ -368,7 +366,7 @@ type PickableItem = ({
368
366
  * @author Yuen Ler Chow
369
367
  */
370
368
 
371
- type Props$8 = {
369
+ type Props$9 = {
372
370
  title: string;
373
371
  items: PickableItem[];
374
372
  /**
@@ -379,7 +377,7 @@ type Props$8 = {
379
377
  onChanged: (updatedItems: PickableItem[]) => void;
380
378
  noBottomMargin?: boolean;
381
379
  };
382
- declare const ItemPicker: React$1.FC<Props$8>;
380
+ declare const ItemPicker: React$1.FC<Props$9>;
383
381
 
384
382
  /**
385
383
  * Type of the context map in a LogMetadata file
@@ -424,11 +422,11 @@ type LogMetadataType = {
424
422
  * @author Gabe Abrams
425
423
  */
426
424
 
427
- type Props$7 = {
425
+ type Props$8 = {
428
426
  LogMetadata: LogMetadataType;
429
427
  onClose: () => void;
430
428
  };
431
- declare const LogReviewer: React$1.FC<Props$7>;
429
+ declare const LogReviewer: React$1.FC<Props$8>;
432
430
 
433
431
  /**
434
432
  * Server-side API param types
@@ -463,7 +461,7 @@ type IntelliTableColumn = {
463
461
  * @author Gabe Abrams
464
462
  */
465
463
 
466
- type Props$6 = {
464
+ type Props$7 = {
467
465
  title: string;
468
466
  id: string;
469
467
  data: {
@@ -473,14 +471,14 @@ type Props$6 = {
473
471
  columns: IntelliTableColumn[];
474
472
  csvName?: string;
475
473
  };
476
- declare const IntelliTable: React$1.FC<Props$6>;
474
+ declare const IntelliTable: React$1.FC<Props$7>;
477
475
 
478
476
  /**
479
477
  * Button for downloading a csv file
480
478
  * @author Gabe Abrams
481
479
  */
482
480
 
483
- type Props$5 = {
481
+ type Props$6 = {
484
482
  filename: string;
485
483
  csv: string;
486
484
  id?: string;
@@ -492,7 +490,7 @@ type Props$5 = {
492
490
  onClick?: () => void;
493
491
  children?: React$1.ReactNode;
494
492
  };
495
- declare const CSVDownloadButton: React$1.FC<Props$5>;
493
+ declare const CSVDownloadButton: React$1.FC<Props$6>;
496
494
 
497
495
  /**
498
496
  * Generic type for an object
@@ -568,7 +566,7 @@ type DBEntryField = ({
568
566
  * @author Gabe Abrams
569
567
  */
570
568
 
571
- type Props$4 = {
569
+ type Props$5 = {
572
570
  entryFields: DBEntryField[];
573
571
  idPropName: string;
574
572
  titlePropName: string;
@@ -594,18 +592,18 @@ type Props$4 = {
594
592
  [k: string]: any;
595
593
  };
596
594
  };
597
- declare const DBEntryManagerPanel: React$1.FC<Props$4>;
595
+ declare const DBEntryManagerPanel: React$1.FC<Props$5>;
598
596
 
599
597
  /**
600
598
  * Simple tooltip component
601
599
  * @author Gabe Abrams
602
600
  */
603
601
 
604
- type Props$3 = {
602
+ type Props$4 = {
605
603
  text: string;
606
604
  children: JSX.Element;
607
605
  };
608
- declare const Tooltip: React$1.FC<Props$3>;
606
+ declare const Tooltip: React$1.FC<Props$4>;
609
607
 
610
608
  /**
611
609
  * A toggle switch that toggles on or off
@@ -613,7 +611,7 @@ declare const Tooltip: React$1.FC<Props$3>;
613
611
  * @author Gabe Abrams
614
612
  */
615
613
 
616
- type Props$2 = {
614
+ type Props$3 = {
617
615
  isOn: boolean;
618
616
  /**
619
617
  * A handler to call when the switch is toggled
@@ -625,7 +623,7 @@ type Props$2 = {
625
623
  description: string;
626
624
  backgroundVariantWhenOn?: Variant;
627
625
  };
628
- declare const ToggleSwitch: React$1.FC<Props$2>;
626
+ declare const ToggleSwitch: React$1.FC<Props$3>;
629
627
 
630
628
  /**
631
629
  * Container that automatically scrolls when new items are added,
@@ -636,7 +634,7 @@ declare const ToggleSwitch: React$1.FC<Props$2>;
636
634
  * @author Gabe Abrams
637
635
  */
638
636
 
639
- type Props$1 = {
637
+ type Props$2 = {
640
638
  itemsName?: string;
641
639
  items: AutoScrollItem[];
642
640
  jumpToBottomButtonVariant?: Variant;
@@ -647,7 +645,7 @@ type AutoScrollItem = {
647
645
  id: string | number;
648
646
  item: React$1.ReactNode;
649
647
  };
650
- declare const AutoscrollToBottomContainer: React$1.FC<Props$1>;
648
+ declare const AutoscrollToBottomContainer: React$1.FC<Props$2>;
651
649
 
652
650
  /**
653
651
  * A switch with multiple options for selection
@@ -656,7 +654,7 @@ declare const AutoscrollToBottomContainer: React$1.FC<Props$1>;
656
654
  * @author Austen Money
657
655
  */
658
656
 
659
- type Props = {
657
+ type Props$1 = {
660
658
  options: Option[];
661
659
  selectedOptionId: string;
662
660
  /**
@@ -671,7 +669,43 @@ type Option = {
671
669
  icon: IconProp;
672
670
  id: string;
673
671
  };
674
- declare const MultiSwitch: React$1.FC<Props>;
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>;
675
709
 
676
710
  /**
677
711
  * An error with a code
@@ -1569,6 +1603,30 @@ declare const capitalize: (str: string) => string;
1569
1603
  */
1570
1604
  declare const shuffleArray: <T>(arr: T[]) => T[];
1571
1605
 
1606
+ /**
1607
+ * Send a server-to-server request from this sever to another server that uses
1608
+ * dce-reactkit [for server only]
1609
+ * @author Gabe Abrams
1610
+ * @param opts object containing all arguments
1611
+ * @param opts.host - the host of the other server
1612
+ * @param opts.path - the path of the other server's endpoint
1613
+ * @param [opts.method=GET] - the method of the endpoint
1614
+ * @param [opts.params] - query/body parameters to include
1615
+ * @param [opts.headers] - headers to include
1616
+ * @returns response from server
1617
+ */
1618
+ declare const visitEndpointOnAnotherServer: (opts: {
1619
+ host: string;
1620
+ path: string;
1621
+ method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
1622
+ params?: {
1623
+ [x: string]: any;
1624
+ } | undefined;
1625
+ headers?: {
1626
+ [x: string]: any;
1627
+ } | undefined;
1628
+ }) => Promise<any>;
1629
+
1572
1630
  /**
1573
1631
  * List of error codes built into the react kit
1574
1632
  * @author Gabe Abrams
@@ -1586,7 +1644,10 @@ declare enum ReactKitErrorCode {
1586
1644
  NotAdmin = "DRK10",
1587
1645
  NotAllowedToReviewLogs = "DRK11",
1588
1646
  ThemeCheckedBeforeReactKitReady = "DRK12",
1589
- SessionExpiredMessageGottenBeforeReactKitReady = "DRK13"
1647
+ SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
1648
+ NotConnected = "DRK14",
1649
+ SelfSigned = "DRK15",
1650
+ ResponseParseError = "DRK16"
1590
1651
  }
1591
1652
 
1592
1653
  /**
@@ -1619,4 +1680,4 @@ declare const LogBuiltInMetadata: {
1619
1680
  };
1620
1681
  };
1621
1682
 
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 };
1683
+ 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, visitEndpointOnAnotherServer, visitServerEndpoint, waitMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.9.0-beta.1",
3
+ "version": "3.9.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,6 +24,7 @@
24
24
  },
25
25
  "homepage": "https://github.com/harvard-edtech/dce-reactkit#readme",
26
26
  "dependencies": {
27
+ "qs": "^6.x.x",
27
28
  "react-select": "^5.7.3"
28
29
  },
29
30
  "peerDependencies": {