dce-reactkit 2.0.11 → 3.0.0-beta.10

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 (129) hide show
  1. package/dist/cjs/index.js +921 -0
  2. package/dist/cjs/index.js.map +1 -0
  3. package/{lib → dist/cjs/types}/components/AppWrapper.d.ts +9 -4
  4. package/{lib → dist/cjs/types}/components/ErrorBox.d.ts +0 -0
  5. package/{lib → dist/cjs/types}/components/LoadingSpinner.d.ts +1 -0
  6. package/{lib → dist/cjs/types}/components/Modal.d.ts +5 -36
  7. package/{lib → dist/cjs/types}/components/TabBox.d.ts +0 -0
  8. package/{lib → dist/cjs/types}/errors/ErrorWithCode.d.ts +0 -0
  9. package/{lib → dist/cjs/types}/helpers/abbreviate.d.ts +1 -0
  10. package/{lib → dist/cjs/types}/helpers/avg.d.ts +0 -0
  11. package/{lib → dist/cjs/types}/helpers/ceilToNumDecimals.d.ts +0 -0
  12. package/{lib → dist/cjs/types}/helpers/floorToNumDecimals.d.ts +0 -0
  13. package/{lib → dist/cjs/types}/helpers/forceNumIntoBounds.d.ts +0 -0
  14. package/{lib → dist/cjs/types}/helpers/padDecimalZeros.d.ts +0 -0
  15. package/{lib → dist/cjs/types}/helpers/padZerosLeft.d.ts +0 -0
  16. package/{lib → dist/cjs/types}/helpers/roundToNumDecimals.d.ts +0 -0
  17. package/{lib → dist/cjs/types}/helpers/sum.d.ts +0 -0
  18. package/{lib → dist/cjs/types}/helpers/waitMs.d.ts +0 -0
  19. package/dist/cjs/types/index.d.ts +22 -0
  20. package/dist/cjs/types/types/ModalButtonType.d.ts +17 -0
  21. package/dist/cjs/types/types/ModalSize.d.ts +11 -0
  22. package/dist/cjs/types/types/ModalType.d.ts +16 -0
  23. package/{lib → dist/cjs/types}/types/ReactKitErrorCode.d.ts +0 -0
  24. package/{lib → dist/cjs/types}/types/Variant.d.ts +0 -0
  25. package/dist/esm/index.js +890 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/types/components/AppWrapper.d.ts +40 -0
  28. package/dist/esm/types/components/ErrorBox.d.ts +12 -0
  29. package/dist/esm/types/components/LoadingSpinner.d.ts +7 -0
  30. package/dist/esm/types/components/Modal.d.ts +40 -0
  31. package/dist/esm/types/components/TabBox.d.ts +11 -0
  32. package/dist/esm/types/errors/ErrorWithCode.d.ts +9 -0
  33. package/dist/esm/types/helpers/abbreviate.d.ts +10 -0
  34. package/dist/esm/types/helpers/avg.d.ts +8 -0
  35. package/dist/esm/types/helpers/ceilToNumDecimals.d.ts +9 -0
  36. package/dist/esm/types/helpers/floorToNumDecimals.d.ts +9 -0
  37. package/dist/esm/types/helpers/forceNumIntoBounds.d.ts +10 -0
  38. package/dist/esm/types/helpers/padDecimalZeros.d.ts +10 -0
  39. package/dist/esm/types/helpers/padZerosLeft.d.ts +9 -0
  40. package/dist/esm/types/helpers/roundToNumDecimals.d.ts +9 -0
  41. package/dist/esm/types/helpers/sum.d.ts +8 -0
  42. package/dist/esm/types/helpers/waitMs.d.ts +7 -0
  43. package/dist/esm/types/index.d.ts +22 -0
  44. package/dist/esm/types/types/ModalButtonType.d.ts +17 -0
  45. package/dist/esm/types/types/ModalSize.d.ts +11 -0
  46. package/dist/esm/types/types/ModalType.d.ts +16 -0
  47. package/dist/esm/types/types/ReactKitErrorCode.d.ts +13 -0
  48. package/dist/esm/types/types/Variant.d.ts +15 -0
  49. package/dist/index.d.ts +274 -0
  50. package/package.json +23 -15
  51. package/rollup.config.js +45 -0
  52. package/src/components/AppWrapper.tsx +38 -37
  53. package/src/components/LoadingSpinner.tsx +3 -0
  54. package/src/components/Modal.tsx +86 -173
  55. package/src/helpers/abbreviate.tsx +2 -0
  56. package/src/helpers/padDecimalZeros.tsx +1 -1
  57. package/src/index.ts +61 -0
  58. package/src/types/ModalButtonType.tsx +18 -0
  59. package/src/types/ModalSize.tsx +12 -0
  60. package/src/types/ModalType.tsx +17 -0
  61. package/tsconfig.json +16 -17
  62. package/lib/components/AppWrapper.js +0 -277
  63. package/lib/components/AppWrapper.js.map +0 -1
  64. package/lib/components/ErrorBox.js +0 -65
  65. package/lib/components/ErrorBox.js.map +0 -1
  66. package/lib/components/LoadingSpinner.js +0 -41
  67. package/lib/components/LoadingSpinner.js.map +0 -1
  68. package/lib/components/Modal.js +0 -321
  69. package/lib/components/Modal.js.map +0 -1
  70. package/lib/components/TabBox.js +0 -42
  71. package/lib/components/TabBox.js.map +0 -1
  72. package/lib/errors/ErrorWithCode.js +0 -33
  73. package/lib/errors/ErrorWithCode.js.map +0 -1
  74. package/lib/helpers/abbreviate.js +0 -21
  75. package/lib/helpers/abbreviate.js.map +0 -1
  76. package/lib/helpers/alert.d.ts +0 -2
  77. package/lib/helpers/alert.js +0 -5
  78. package/lib/helpers/alert.js.map +0 -1
  79. package/lib/helpers/avg.js +0 -24
  80. package/lib/helpers/avg.js.map +0 -1
  81. package/lib/helpers/ceilToNumDecimals.js +0 -15
  82. package/lib/helpers/ceilToNumDecimals.js.map +0 -1
  83. package/lib/helpers/confirm.d.ts +0 -2
  84. package/lib/helpers/confirm.js +0 -5
  85. package/lib/helpers/confirm.js.map +0 -1
  86. package/lib/helpers/floorToNumDecimals.js +0 -15
  87. package/lib/helpers/floorToNumDecimals.js.map +0 -1
  88. package/lib/helpers/forceNumIntoBounds.js +0 -15
  89. package/lib/helpers/forceNumIntoBounds.js.map +0 -1
  90. package/lib/helpers/handleError.d.ts +0 -14
  91. package/lib/helpers/handleError.js +0 -54
  92. package/lib/helpers/handleError.js.map +0 -1
  93. package/lib/helpers/handleSuccess.d.ts +0 -8
  94. package/lib/helpers/handleSuccess.js +0 -20
  95. package/lib/helpers/handleSuccess.js.map +0 -1
  96. package/lib/helpers/padDecimalZeros.js +0 -30
  97. package/lib/helpers/padDecimalZeros.js.map +0 -1
  98. package/lib/helpers/padZerosLeft.js +0 -21
  99. package/lib/helpers/padZerosLeft.js.map +0 -1
  100. package/lib/helpers/parseRequest.d.ts +0 -21
  101. package/lib/helpers/parseRequest.js +0 -240
  102. package/lib/helpers/parseRequest.js.map +0 -1
  103. package/lib/helpers/roundToNumDecimals.js +0 -15
  104. package/lib/helpers/roundToNumDecimals.js.map +0 -1
  105. package/lib/helpers/showFatalError.d.ts +0 -2
  106. package/lib/helpers/showFatalError.js +0 -5
  107. package/lib/helpers/showFatalError.js.map +0 -1
  108. package/lib/helpers/sum.js +0 -15
  109. package/lib/helpers/sum.js.map +0 -1
  110. package/lib/helpers/visitServerEndpoint.d.ts +0 -23
  111. package/lib/helpers/visitServerEndpoint.js +0 -135
  112. package/lib/helpers/visitServerEndpoint.js.map +0 -1
  113. package/lib/helpers/waitMs.js +0 -55
  114. package/lib/helpers/waitMs.js.map +0 -1
  115. package/lib/types/ParamType.d.ts +0 -17
  116. package/lib/types/ParamType.js +0 -21
  117. package/lib/types/ParamType.js.map +0 -1
  118. package/lib/types/ReactKitErrorCode.js +0 -18
  119. package/lib/types/ReactKitErrorCode.js.map +0 -1
  120. package/lib/types/Variant.js +0 -19
  121. package/lib/types/Variant.js.map +0 -1
  122. package/src/helpers/alert.tsx +0 -3
  123. package/src/helpers/confirm.tsx +0 -3
  124. package/src/helpers/handleError.ts +0 -65
  125. package/src/helpers/handleSuccess.ts +0 -18
  126. package/src/helpers/parseRequest.ts +0 -299
  127. package/src/helpers/showFatalError.tsx +0 -3
  128. package/src/helpers/visitServerEndpoint.tsx +0 -110
  129. package/src/types/ParamType.ts +0 -18
@@ -7,65 +7,19 @@
7
7
  import React, { useState, useEffect } from 'react';
8
8
 
9
9
  // Import other components
10
- import BootstrapModal from 'react-bootstrap/Modal';
11
10
  import waitMs from '../helpers/waitMs';
12
11
 
13
12
  // Import types
14
13
  import Variant from '../types/Variant';
14
+ import ModalButtonType from '../types/ModalButtonType';
15
+ import ModalSize from '../types/ModalSize';
16
+ import ModalType from '../types/ModalType';
15
17
 
16
18
  /*------------------------------------------------------------------------*/
17
19
  /* Style */
18
20
  /*------------------------------------------------------------------------*/
19
21
 
20
22
  const style = `
21
- /* More opaque backdrop */
22
- .Modal-backdrop {
23
- background-color: black !important;
24
- opacity: 0.8 !important;
25
- z-index: 10000000 !important;
26
- }
27
-
28
- /* Customize the modal header and body */
29
- .modal-header {
30
- /* Dark theme */
31
- background-color: #222 !important;
32
- color: white !important;
33
-
34
- /* Border */
35
- border: 1px solid #545454 !important;
36
- }
37
- .modal-body {
38
- /* Dark theme */
39
- background-color: #222 !important;
40
- color: white !important;
41
-
42
- /* Border */
43
- border-top: 0 !important;
44
- border-left: 1px solid #545454 !important;
45
- border-bottom: 1px solid #545454 !important;
46
- border-right: 1px solid #545454 !important;
47
- border-bottom-left-radius: 3px;
48
- border-bottom-right-radius: 3px;
49
- }
50
-
51
- /* Create our own animation */
52
- .modal-content {
53
- animation-name: Modal-drop-in;
54
- animation-duration: 0.4s;
55
- animation-iteration-count: 1;
56
- animation-fill-mode: forwards;
57
- animation-timing-function: ease-out;
58
- }
59
- @keyframes Modal-drop-in {
60
- 0% {
61
- transform: scale(0.8);
62
- opacity: 0.5;
63
- }
64
- 100% {
65
- transform: scale(1);
66
- opacity: 1;
67
- }
68
- }
69
23
  `;
70
24
 
71
25
  /*------------------------------------------------------------------------*/
@@ -77,118 +31,83 @@ const MS_TO_ANIMATE = 400; // Time to animate in/out (defined by bootstrap)
77
31
  const MS_ANIMATE_IN_DELAY = 10;
78
32
  // Time to wait before animating in (must be >0 or animation won't trigger)
79
33
 
80
- // Modal types
81
- enum ModalType {
82
- Okay = 'okay', // [Okay]
83
- OkayCancel = 'okay-cancel', // [Okay] [Cancel]
84
- YesNo = 'yes-no', // [Yes] [No]
85
- YesNoCancel = 'yes-no-cancel', // [Yes] [No] [Cancel]
86
- AbandonGoBack = 'abandon-goBack', // [Abandon Changes] [Go Back]
87
- ImSureCancel = 'imSure-cancel', // [I am sure] [Cancel]
88
- DeleteCancel = 'delete-cancel', // [Yes, Delete] [Cancel]
89
- ConfirmCancel = 'confirm-cancel', // [Confirm] [Cancel]
90
- NoButtons = '-', // No buttons
91
- }
92
-
93
- // Modal sizes
94
- enum ModalSize {
95
- Small = 'sm',
96
- Medium = 'md',
97
- Large = 'lg',
98
- ExtraLarge = 'xl',
99
- }
100
-
101
- // Button types
102
- enum ButtonType {
103
- Okay = 'okay',
104
- Cancel = 'cancel',
105
- Yes = 'yes',
106
- No = 'no',
107
- Abandon = 'abandon',
108
- GoBack = 'goBack',
109
- Continue = 'continue',
110
- ImSure = 'imSure',
111
- Delete = 'delete',
112
- Confirm = 'confirm',
113
- }
114
-
115
34
  // Modal type to list of buttons
116
- const modalTypeToButtonTypes: {
117
- [k: string]: ButtonType[]
35
+ const modalTypeToModalButtonTypes: {
36
+ [k: string]: ModalButtonType[]
118
37
  } = {
119
38
  [ModalType.Okay]: [
120
- ButtonType.Okay,
39
+ ModalButtonType.Okay,
121
40
  ],
122
41
  [ModalType.OkayCancel]: [
123
- ButtonType.Okay,
124
- ButtonType.Cancel,
42
+ ModalButtonType.Okay,
43
+ ModalButtonType.Cancel,
125
44
  ],
126
45
  [ModalType.YesNo]: [
127
- ButtonType.Yes,
128
- ButtonType.No,
46
+ ModalButtonType.Yes,
47
+ ModalButtonType.No,
129
48
  ],
130
49
  [ModalType.YesNoCancel]: [
131
- ButtonType.Yes,
132
- ButtonType.No,
133
- ButtonType.Cancel,
50
+ ModalButtonType.Yes,
51
+ ModalButtonType.No,
52
+ ModalButtonType.Cancel,
134
53
  ],
135
54
  [ModalType.AbandonGoBack]: [
136
- ButtonType.Abandon,
137
- ButtonType.GoBack,
55
+ ModalButtonType.Abandon,
56
+ ModalButtonType.GoBack,
138
57
  ],
139
58
  [ModalType.ImSureCancel]: [
140
- ButtonType.ImSure,
141
- ButtonType.Cancel,
59
+ ModalButtonType.ImSure,
60
+ ModalButtonType.Cancel,
142
61
  ],
143
62
  [ModalType.DeleteCancel]: [
144
- ButtonType.Delete,
145
- ButtonType.Cancel,
63
+ ModalButtonType.Delete,
64
+ ModalButtonType.Cancel,
146
65
  ],
147
66
  [ModalType.ConfirmCancel]: [
148
- ButtonType.Confirm,
149
- ButtonType.Cancel,
67
+ ModalButtonType.Confirm,
68
+ ModalButtonType.Cancel,
150
69
  ],
151
70
  };
152
71
 
153
72
  // Button type styling and labels
154
- const buttonTypeToLabelAndVariant = {
155
- [ButtonType.Okay]: {
73
+ const ModalButtonTypeToLabelAndVariant = {
74
+ [ModalButtonType.Okay]: {
156
75
  label: 'Okay',
157
76
  variant: Variant.Dark,
158
77
  },
159
- [ButtonType.Cancel]: {
78
+ [ModalButtonType.Cancel]: {
160
79
  label: 'Cancel',
161
80
  variant: Variant.Secondary,
162
81
  },
163
- [ButtonType.Yes]: {
82
+ [ModalButtonType.Yes]: {
164
83
  label: 'Yes',
165
84
  variant: Variant.Dark,
166
85
  },
167
- [ButtonType.No]: {
86
+ [ModalButtonType.No]: {
168
87
  label: 'No',
169
88
  variant: Variant.Secondary,
170
89
  },
171
- [ButtonType.Abandon]: {
90
+ [ModalButtonType.Abandon]: {
172
91
  label: 'Abandon Changes',
173
92
  variant: Variant.Warning,
174
93
  },
175
- [ButtonType.GoBack]: {
94
+ [ModalButtonType.GoBack]: {
176
95
  label: 'Go Back',
177
96
  variant: Variant.Secondary,
178
97
  },
179
- [ButtonType.Continue]: {
98
+ [ModalButtonType.Continue]: {
180
99
  label: 'Continue',
181
100
  variant: Variant.Dark,
182
101
  },
183
- [ButtonType.ImSure]: {
102
+ [ModalButtonType.ImSure]: {
184
103
  label: 'I am sure',
185
104
  variant: Variant.Warning,
186
105
  },
187
- [ButtonType.Delete]: {
106
+ [ModalButtonType.Delete]: {
188
107
  label: 'Yes, Delete',
189
108
  variant: Variant.Danger,
190
109
  },
191
- [ButtonType.Confirm]: {
110
+ [ModalButtonType.Confirm]: {
192
111
  label: 'Confirm',
193
112
  variant: Variant.Dark,
194
113
  },
@@ -208,7 +127,7 @@ type Props = {
208
127
  // The body of the modal
209
128
  children?: React.ReactNode,
210
129
  // Handler to call when modal is closed (if excluded, not closable)
211
- onClose?: (type: ButtonType) => void,
130
+ onClose?: (type: ModalButtonType) => void,
212
131
  // If true, don't allow the user to click the backdrop to exit
213
132
  dontAllowBackdropExit?: boolean,
214
133
  // Custom label for "okay" button
@@ -259,15 +178,7 @@ type Props = {
259
178
  /* Component */
260
179
  /*------------------------------------------------------------------------*/
261
180
 
262
- const Modal: (
263
- React.FC<Props>
264
- & {
265
- ModalType: typeof ModalType,
266
- ModalSize: typeof ModalSize,
267
- ButtonType: typeof ButtonType,
268
- Variant: typeof Variant,
269
- }
270
- ) = (props) => {
181
+ const Modal: React.FC<Props> = (props) => {
271
182
  /*------------------------------------------------------------------------*/
272
183
  /* Setup */
273
184
  /*------------------------------------------------------------------------*/
@@ -322,10 +233,10 @@ const Modal: (
322
233
  /**
323
234
  * Handles the closing of the modal
324
235
  * @author Gabe Abrams
325
- * @param buttonType the button that was clicked when closing the
236
+ * @param ModalButtonType the button that was clicked when closing the
326
237
  * modal
327
238
  */
328
- const handleClose = async (buttonType: ButtonType) => {
239
+ const handleClose = async (ModalButtonType: ModalButtonType) => {
329
240
  // Don't close if no handler
330
241
  if (!onClose) {
331
242
  return;
@@ -346,7 +257,7 @@ const Modal: (
346
257
 
347
258
  // Call the handler after the modal has animated out
348
259
  await waitMs(MS_TO_ANIMATE);
349
- onClose(buttonType);
260
+ onClose(ModalButtonType);
350
261
  };
351
262
 
352
263
  /*------------------------------------------------------------------------*/
@@ -358,34 +269,36 @@ const Modal: (
358
269
  /*----------------------------------------*/
359
270
 
360
271
  // Get list of buttons for this modal type
361
- const buttonTypes: ButtonType[] = modalTypeToButtonTypes[type] ?? [];
272
+ const ModalButtonTypes: ModalButtonType[] = modalTypeToModalButtonTypes[type] ?? [];
362
273
 
363
274
  // Create buttons
364
- const buttons = buttonTypes.map((buttonType: ButtonType, i) => {
275
+ const buttons = ModalButtonTypes.map((ModalButtonType: ModalButtonType, i) => {
365
276
  // Get default style
366
277
  let {
367
278
  label,
368
279
  variant,
369
- } = buttonTypeToLabelAndVariant[buttonType];
280
+ } = ModalButtonTypeToLabelAndVariant[ModalButtonType];
370
281
 
371
282
  // Override with customizations
372
- if (props[`${buttonType}Label`]) {
373
- label = props[`${buttonType}Label`];
283
+ const newLabel = props[`${ModalButtonType}Label`];
284
+ if (newLabel) {
285
+ label = newLabel;
374
286
  }
375
- if (props[`${buttonType}Variant`]) {
376
- variant = props[`${buttonType}Variant`];
287
+ const newVariant = props[`${ModalButtonType}Variant`];
288
+ if (newVariant) {
289
+ variant = newVariant;
377
290
  }
378
291
 
379
292
  // Check if this button is last
380
- const last = (i === buttonTypes.length - 1);
293
+ const last = (i === ModalButtonTypes.length - 1);
381
294
 
382
295
  // Create the button
383
296
  return (
384
297
  <button
385
298
  type="button"
386
- className={`Modal-${buttonType}-button btn btn-${variant} ${last ? '' : 'mr-1'}`}
299
+ className={`Modal-${ModalButtonType}-button btn btn-${variant} ${last ? '' : 'mr-1'}`}
387
300
  onClick={() => {
388
- handleClose(buttonType);
301
+ handleClose(ModalButtonType);
389
302
  }}
390
303
  >
391
304
  {label}
@@ -406,45 +319,51 @@ const Modal: (
406
319
 
407
320
  // Render the modal
408
321
  return (
409
- <BootstrapModal
410
- show={visible}
411
- size={size !== ModalSize.Medium ? size : undefined}
412
- onHide={() => {
413
- if (!dontAllowBackdropExit) {
414
- handleClose(ButtonType.Cancel);
415
- }
416
- }}
322
+ <div
323
+ className={`modal show modal-dialog-scrollable modal-dialog-centered modal-${size}`}
324
+ tabIndex={-1}
417
325
  style={{
418
326
  zIndex: (
419
327
  onTopOfOtherModals
420
328
  ? 6000000000
421
329
  : 5000000000
422
330
  ),
331
+ display: 'block',
332
+ margin: 'auto',
423
333
  }}
424
- backdropClassName="Modal-backdrop"
425
- centered
426
334
  >
427
- <style>{style}</style>
428
- {title && (
429
- <BootstrapModal.Header
430
- closeButton={!!onClose}
431
- >
432
- <BootstrapModal.Title>
433
- {title}
434
- </BootstrapModal.Title>
435
- </BootstrapModal.Header>
436
- )}
437
- {children && (
438
- <BootstrapModal.Body>
439
- {children}
440
- </BootstrapModal.Body>
441
- )}
442
- {footer && (
443
- <BootstrapModal.Footer>
444
- {footer}
445
- </BootstrapModal.Footer>
446
- )}
447
- </BootstrapModal>
335
+ <div className="modal-dialog">
336
+ <div className="modal-content">
337
+ <div className="modal-header">
338
+ <h5 className="modal-title">
339
+ {title}
340
+ </h5>
341
+
342
+ {onClose && (
343
+ <button
344
+ type="button"
345
+ className="btn-close"
346
+ data-bs-dismiss="modal"
347
+ aria-label="Close"
348
+ onClick={() => {
349
+ handleClose(ModalButtonType.Cancel);
350
+ }}
351
+ />
352
+ )}
353
+ </div>
354
+ {children && (
355
+ <div className="modal-body">
356
+ {children}
357
+ </div>
358
+ )}
359
+ {footer && (
360
+ <div className="modal-footer">
361
+ {footer}
362
+ </div>
363
+ )}
364
+ </div>
365
+ </div>
366
+ </div>
448
367
  );
449
368
  };
450
369
 
@@ -452,10 +371,4 @@ const Modal: (
452
371
  /* Wrap Up */
453
372
  /*------------------------------------------------------------------------*/
454
373
 
455
- // Add enums
456
- Modal.ModalType = ModalType;
457
- Modal.ModalSize = ModalSize;
458
- Modal.ButtonType = ButtonType;
459
- Modal.Variant = Variant;
460
-
461
374
  export default Modal;
@@ -21,3 +21,5 @@ const abbreviate = (text: string, maxChars: number): string => {
21
21
  );
22
22
  return `${shortenedText}...`;
23
23
  };
24
+
25
+ export default abbreviate;
@@ -9,7 +9,7 @@
9
9
  const padDecimalZeros = (num: number, numDigits: number): string => {
10
10
  // Skip if nothing to do
11
11
  if (numDigits < 1) {
12
- return;
12
+ return String(num);
13
13
  }
14
14
 
15
15
  // Convert to string
package/src/index.ts ADDED
@@ -0,0 +1,61 @@
1
+ // Import components
2
+ import AppWrapper, { alert, confirm, showFatalError } from './components/AppWrapper';
3
+ import LoadingSpinner from './components/LoadingSpinner';
4
+ import ErrorBox from './components/ErrorBox';
5
+ import Modal from './components/Modal';
6
+ import TabBox from './components/TabBox';
7
+
8
+ // Import errors
9
+ import ErrorWithCode from './errors/ErrorWithCode';
10
+
11
+ // Import helpers
12
+ import abbreviate from './helpers/abbreviate';
13
+ import avg from './helpers/avg';
14
+ import ceilToNumDecimals from './helpers/ceilToNumDecimals';
15
+ import floorToNumDecimals from './helpers/floorToNumDecimals';
16
+ import forceNumIntoBounds from './helpers/forceNumIntoBounds';
17
+ import padDecimalZeros from './helpers/padDecimalZeros';
18
+ import padZerosLeft from './helpers/padZerosLeft';
19
+ import roundToNumDecimals from './helpers/roundToNumDecimals';
20
+ import sum from './helpers/sum';
21
+ import waitMs from './helpers/waitMs';
22
+
23
+ // Import types
24
+ import ModalButtonType from './types/ModalButtonType';
25
+ import ModalSize from './types/ModalSize';
26
+ import ModalType from './types/ModalType';
27
+ import ReactKitErrorCode from './types/ReactKitErrorCode';
28
+ import Variant from './types/Variant';
29
+
30
+ // Export each item
31
+ export {
32
+ // Components
33
+ AppWrapper,
34
+ LoadingSpinner,
35
+ ErrorBox,
36
+ Modal,
37
+ TabBox,
38
+ // Global functions
39
+ alert,
40
+ confirm,
41
+ showFatalError,
42
+ // Errors
43
+ ErrorWithCode,
44
+ // Helpers
45
+ abbreviate,
46
+ avg,
47
+ ceilToNumDecimals,
48
+ floorToNumDecimals,
49
+ forceNumIntoBounds,
50
+ padDecimalZeros,
51
+ padZerosLeft,
52
+ roundToNumDecimals,
53
+ sum,
54
+ waitMs,
55
+ // Types
56
+ ModalButtonType,
57
+ ModalSize,
58
+ ModalType,
59
+ ReactKitErrorCode,
60
+ Variant,
61
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Types of buttons in the modal
3
+ * @author Gabe Abrams
4
+ */
5
+ enum ModalButtonType {
6
+ Okay = 'okay',
7
+ Cancel = 'cancel',
8
+ Yes = 'yes',
9
+ No = 'no',
10
+ Abandon = 'abandon',
11
+ GoBack = 'goBack',
12
+ Continue = 'continue',
13
+ ImSure = 'imSure',
14
+ Delete = 'delete',
15
+ Confirm = 'confirm',
16
+ }
17
+
18
+ export default ModalButtonType;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Modal sizes
3
+ * @author Gabe Abrams
4
+ */
5
+ enum ModalSize {
6
+ Small = 'sm',
7
+ Medium = 'md',
8
+ Large = 'lg',
9
+ ExtraLarge = 'xl',
10
+ }
11
+
12
+ export default ModalSize;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Types of modals
3
+ * @author Gabe Abrams
4
+ */
5
+ enum ModalType {
6
+ Okay = 'okay', // [Okay]
7
+ OkayCancel = 'okay-cancel', // [Okay] [Cancel]
8
+ YesNo = 'yes-no', // [Yes] [No]
9
+ YesNoCancel = 'yes-no-cancel', // [Yes] [No] [Cancel]
10
+ AbandonGoBack = 'abandon-goBack', // [Abandon Changes] [Go Back]
11
+ ImSureCancel = 'imSure-cancel', // [I am sure] [Cancel]
12
+ DeleteCancel = 'delete-cancel', // [Yes, Delete] [Cancel]
13
+ ConfirmCancel = 'confirm-cancel', // [Confirm] [Cancel]
14
+ NoButtons = '-', // No buttons
15
+ }
16
+
17
+ export default ModalType;
package/tsconfig.json CHANGED
@@ -1,24 +1,23 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "commonjs",
3
+ "target": "es2016",
4
4
  "esModuleInterop": true,
5
- "noImplicitAny": true,
6
- "noEmitOnError": true,
7
- "removeComments": false,
5
+ "forceConsistentCasingInFileNames": true,
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+
9
+ "jsx": "react",
10
+ "module": "ESNext",
8
11
  "declaration": true,
12
+ "declarationDir": "types",
9
13
  "sourceMap": true,
10
- "target": "es5",
11
- "jsx": "react-jsx",
12
- "lib": [
13
- "es2017",
14
- "dom"
15
- ],
16
- "outDir": "./lib"
14
+ "outDir": "dist",
15
+ "moduleResolution": "node",
16
+ "allowSyntheticDefaultImports": true,
17
+ "emitDeclarationOnly": true
17
18
  },
19
+
18
20
  "include": [
19
- "./src"
20
- ],
21
- "ts-node": {
22
- "files": true
23
- }
24
- }
21
+ "./src/**/*"
22
+ ]
23
+ }