dce-reactkit 3.0.0-beta.1 → 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.
- package/.eslintrc.js +95 -0
- package/dist/cjs/index.js +140 -35643
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +1 -1
- package/dist/esm/index.js +43 -35528
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +14 -7
- package/rollup.config.js +45 -0
- package/src/components/AppWrapper.tsx +370 -0
- package/src/components/ErrorBox.tsx +124 -0
- package/src/components/LoadingSpinner.tsx +108 -0
- package/src/components/Modal.tsx +374 -0
- package/src/components/TabBox.tsx +136 -0
- package/src/errors/ErrorWithCode.tsx +15 -0
- package/src/helpers/abbreviate.tsx +25 -0
- package/src/helpers/avg.tsx +22 -0
- package/src/helpers/ceilToNumDecimals.tsx +13 -0
- package/src/helpers/floorToNumDecimals.tsx +13 -0
- package/src/helpers/forceNumIntoBounds.tsx +19 -0
- package/src/helpers/padDecimalZeros.tsx +32 -0
- package/src/helpers/padZerosLeft.tsx +21 -0
- package/src/helpers/roundToNumDecimals.tsx +13 -0
- package/src/helpers/sum.tsx +16 -0
- package/src/helpers/waitMs.tsx +12 -0
- package/src/index.ts +61 -0
- package/src/types/ModalButtonType.tsx +18 -0
- package/src/types/ModalSize.tsx +12 -0
- package/src/types/ModalType.tsx +17 -0
- package/src/types/ReactKitErrorCode.tsx +16 -0
- package/src/types/Variant.tsx +16 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sum the numbers in an array
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
* @param nums the numbers to sum
|
|
5
|
+
* @returns the sum of the numbers
|
|
6
|
+
*/
|
|
7
|
+
const sum = (nums: number[]): number => {
|
|
8
|
+
return nums.reduce(
|
|
9
|
+
(a: number, b: number) => {
|
|
10
|
+
return (a + b);
|
|
11
|
+
},
|
|
12
|
+
0,
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default sum;
|
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,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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Highest error code = DRK2
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* List of error codes built into the react kit
|
|
5
|
+
* @author Gabe Abrams
|
|
6
|
+
*/
|
|
7
|
+
enum ReactKitErrorCode {
|
|
8
|
+
NoResponse = 'DRK1',
|
|
9
|
+
NoCode = 'DRK2',
|
|
10
|
+
SessionExpired = 'DRK3',
|
|
11
|
+
MissingParameter = 'DRK4',
|
|
12
|
+
InvalidParameter = 'DRK5',
|
|
13
|
+
WrongCourse = 'DRK6',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default ReactKitErrorCode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootstrap variants
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
enum Variant {
|
|
6
|
+
Primary = 'primary',
|
|
7
|
+
Secondary = 'secondary',
|
|
8
|
+
Success = 'success',
|
|
9
|
+
Warning = 'warning',
|
|
10
|
+
Info = 'info',
|
|
11
|
+
Danger = 'danger',
|
|
12
|
+
Light = 'light',
|
|
13
|
+
Dark = 'dark',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default Variant;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2016",
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"forceConsistentCasingInFileNames": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
"jsx": "react",
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"declarationDir": "types",
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"outDir": "dist",
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"allowSyntheticDefaultImports": true,
|
|
17
|
+
"emitDeclarationOnly": true
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"include": [
|
|
21
|
+
"./src/**/*"
|
|
22
|
+
]
|
|
23
|
+
}
|