dce-reactkit 3.5.14 → 3.6.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.
- package/dist/cjs/index.js +388 -298
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/initClient.d.ts +7 -0
- package/dist/cjs/types/components/AppWrapper.d.ts +2 -3
- package/dist/esm/index.js +388 -298
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/initClient.d.ts +7 -0
- package/dist/esm/types/components/AppWrapper.d.ts +2 -3
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/client/initClient.tsx +20 -4
- package/src/components/AppWrapper.tsx +57 -13
- package/src/components/ButtonInputGroup.tsx +6 -6
- package/src/components/CSVDownloadButton.tsx +6 -6
- package/src/components/CheckboxButton.tsx +19 -8
- package/src/components/CopiableBox.tsx +8 -8
- package/src/components/Drawer.tsx +7 -7
- package/src/components/ErrorBox.tsx +5 -5
- package/src/components/IntelliTable.tsx +135 -135
- package/src/components/ItemPicker/NestableItemList.tsx +7 -7
- package/src/components/ItemPicker/index.tsx +7 -7
- package/src/components/LoadingSpinner.tsx +4 -4
- package/src/components/LogReviewer.tsx +21 -22
- package/src/components/Modal.tsx +163 -75
- package/src/components/PopFailureMark.tsx +7 -7
- package/src/components/PopPendingMark.tsx +7 -7
- package/src/components/PopSuccessMark.tsx +7 -7
- package/src/components/RadioButton.tsx +17 -8
- package/src/components/SimpleDateChooser.tsx +14 -13
- package/src/components/TabBox.tsx +7 -7
- package/src/helpers/genRouteHandler.ts +45 -41
|
@@ -32,6 +32,12 @@ declare let sessionExpiredMessage: string | undefined;
|
|
|
32
32
|
* @returns session expired message
|
|
33
33
|
*/
|
|
34
34
|
export declare const getSessionExpiredMessage: () => string;
|
|
35
|
+
declare let darkModeOn: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Get whether dark mode is enabled or not
|
|
38
|
+
* @returns true if dark mode is enabled
|
|
39
|
+
*/
|
|
40
|
+
export declare const isDarkModeOn: () => boolean;
|
|
35
41
|
/**
|
|
36
42
|
* Initialize the client-side version of reactkit
|
|
37
43
|
* @author Gabe Abrams
|
|
@@ -42,5 +48,6 @@ export declare const getSessionExpiredMessage: () => string;
|
|
|
42
48
|
declare const initClient: (opts: {
|
|
43
49
|
sendRequest: SendRequestFunction;
|
|
44
50
|
sessionExpiredMessage?: string;
|
|
51
|
+
darkModeOn?: boolean;
|
|
45
52
|
}) => void;
|
|
46
53
|
export default initClient;
|
|
@@ -7,7 +7,6 @@ import React from 'react';
|
|
|
7
7
|
import Variant from '../types/Variant';
|
|
8
8
|
type Props = {
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
-
dark?: boolean;
|
|
11
10
|
};
|
|
12
11
|
/**
|
|
13
12
|
* Redirect to a new page
|
|
@@ -51,7 +50,7 @@ export declare const confirm: (title: string, text: string, opts?: {
|
|
|
51
50
|
* @param error the error to show
|
|
52
51
|
* @param [errorTitle] title of the error box
|
|
53
52
|
*/
|
|
54
|
-
export declare const showFatalError: (error: any, errorTitle?: string) =>
|
|
53
|
+
export declare const showFatalError: (error: any, errorTitle?: string) => Promise<void>;
|
|
55
54
|
/**
|
|
56
55
|
* Add a handler for when a fatal error occurs
|
|
57
56
|
* @author Gabe Abrams
|
|
@@ -61,6 +60,6 @@ export declare const addFatalErrorHandler: (handler: () => void) => void;
|
|
|
61
60
|
* Show the "session expired" message
|
|
62
61
|
* @author Gabe Abrams
|
|
63
62
|
*/
|
|
64
|
-
export declare const showSessionExpiredMessage: () =>
|
|
63
|
+
export declare const showSessionExpiredMessage: () => void;
|
|
65
64
|
declare const AppWrapper: React.FC<Props>;
|
|
66
65
|
export default AppWrapper;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ declare enum Variant {
|
|
|
26
26
|
|
|
27
27
|
type Props$k = {
|
|
28
28
|
children: React.ReactNode;
|
|
29
|
-
dark?: boolean;
|
|
30
29
|
};
|
|
31
30
|
/**
|
|
32
31
|
* Redirect to a new page
|
|
@@ -70,7 +69,7 @@ declare const confirm: (title: string, text: string, opts?: {
|
|
|
70
69
|
* @param error the error to show
|
|
71
70
|
* @param [errorTitle] title of the error box
|
|
72
71
|
*/
|
|
73
|
-
declare const showFatalError: (error: any, errorTitle?: string) =>
|
|
72
|
+
declare const showFatalError: (error: any, errorTitle?: string) => Promise<void>;
|
|
74
73
|
/**
|
|
75
74
|
* Add a handler for when a fatal error occurs
|
|
76
75
|
* @author Gabe Abrams
|
|
@@ -707,6 +706,7 @@ type SendRequestFunction = (opts: {
|
|
|
707
706
|
declare const initClient: (opts: {
|
|
708
707
|
sendRequest: SendRequestFunction;
|
|
709
708
|
sessionExpiredMessage?: string;
|
|
709
|
+
darkModeOn?: boolean;
|
|
710
710
|
}) => void;
|
|
711
711
|
|
|
712
712
|
/**
|
package/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Import other components
|
|
2
|
+
// TODO: fix dependency cycle
|
|
3
|
+
// eslint-disable-next-line import/no-cycle
|
|
2
4
|
import { showFatalError } from '../components/AppWrapper';
|
|
3
5
|
|
|
4
6
|
// Import shared types
|
|
@@ -6,7 +8,6 @@ import ErrorWithCode from '../errors/ErrorWithCode';
|
|
|
6
8
|
import waitMs from '../helpers/waitMs';
|
|
7
9
|
import ReactKitErrorCode from '../types/ReactKitErrorCode';
|
|
8
10
|
|
|
9
|
-
|
|
10
11
|
/*----------------------------------------*/
|
|
11
12
|
/* ---------------- Types --------------- */
|
|
12
13
|
/*----------------------------------------*/
|
|
@@ -42,7 +43,7 @@ type SendRequestFunction = (
|
|
|
42
43
|
/* ----------- Initialized ---------- */
|
|
43
44
|
|
|
44
45
|
let onInitialized: (a: unknown) => void;
|
|
45
|
-
|
|
46
|
+
const initialized = new Promise((resolve) => {
|
|
46
47
|
onInitialized = resolve;
|
|
47
48
|
});
|
|
48
49
|
|
|
@@ -60,7 +61,7 @@ export const getSendRequest = async () => {
|
|
|
60
61
|
let successful = false;
|
|
61
62
|
(async () => {
|
|
62
63
|
await waitMs(5000);
|
|
63
|
-
|
|
64
|
+
|
|
64
65
|
if (!successful) {
|
|
65
66
|
showFatalError(
|
|
66
67
|
new ErrorWithCode(
|
|
@@ -69,7 +70,7 @@ export const getSendRequest = async () => {
|
|
|
69
70
|
),
|
|
70
71
|
);
|
|
71
72
|
}
|
|
72
|
-
})()
|
|
73
|
+
})();
|
|
73
74
|
|
|
74
75
|
// Wait for initialization
|
|
75
76
|
await initialized;
|
|
@@ -96,6 +97,18 @@ export const getSessionExpiredMessage = () => {
|
|
|
96
97
|
);
|
|
97
98
|
};
|
|
98
99
|
|
|
100
|
+
/* ------------ Dark Mode ----------- */
|
|
101
|
+
|
|
102
|
+
let darkModeOn = false;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get whether dark mode is enabled or not
|
|
106
|
+
* @returns true if dark mode is enabled
|
|
107
|
+
*/
|
|
108
|
+
export const isDarkModeOn = () => {
|
|
109
|
+
return darkModeOn;
|
|
110
|
+
};
|
|
111
|
+
|
|
99
112
|
/*----------------------------------------*/
|
|
100
113
|
/* ---------------- Init ---------------- */
|
|
101
114
|
/*----------------------------------------*/
|
|
@@ -113,11 +126,14 @@ const initClient = (
|
|
|
113
126
|
sendRequest: SendRequestFunction,
|
|
114
127
|
// Custom session expired message
|
|
115
128
|
sessionExpiredMessage?: string,
|
|
129
|
+
// If true, dark mode is enabled
|
|
130
|
+
darkModeOn?: boolean,
|
|
116
131
|
},
|
|
117
132
|
) => {
|
|
118
133
|
// Store values
|
|
119
134
|
storedSendRequest = opts.sendRequest;
|
|
120
135
|
sessionExpiredMessage = opts.sessionExpiredMessage;
|
|
136
|
+
darkModeOn = !!opts.darkModeOn;
|
|
121
137
|
|
|
122
138
|
// Mark as initialized
|
|
123
139
|
onInitialized(null);
|
|
@@ -18,16 +18,22 @@ import Variant from '../types/Variant';
|
|
|
18
18
|
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
19
19
|
|
|
20
20
|
// Import shared components
|
|
21
|
+
// TODO: fix dependency cycle
|
|
22
|
+
// eslint-disable-next-line import/no-cycle
|
|
21
23
|
import Modal from './Modal';
|
|
22
24
|
|
|
23
25
|
// Import custom errors
|
|
24
26
|
import ErrorWithCode from '../errors/ErrorWithCode';
|
|
25
27
|
|
|
26
28
|
// Import other helpers
|
|
29
|
+
// TODO: fix dependency cycle
|
|
30
|
+
// eslint-disable-next-line import/no-cycle
|
|
27
31
|
import logClientEvent from '../helpers/logClientEvent';
|
|
28
32
|
import {
|
|
29
33
|
getSessionExpiredMessage,
|
|
34
|
+
isDarkModeOn,
|
|
30
35
|
} from '../client/initClient';
|
|
36
|
+
import waitMs from '../helpers/waitMs';
|
|
31
37
|
|
|
32
38
|
/*------------------------------------------------------------------------*/
|
|
33
39
|
/* -------------------------------- Props ------------------------------- */
|
|
@@ -36,14 +42,38 @@ import {
|
|
|
36
42
|
type Props = {
|
|
37
43
|
// The entire app
|
|
38
44
|
children: React.ReactNode,
|
|
39
|
-
// True if this app is a dark-themed app
|
|
40
|
-
dark?: boolean,
|
|
41
45
|
};
|
|
42
46
|
|
|
43
47
|
/*------------------------------------------------------------------------*/
|
|
44
48
|
/* --------------------------- Static Helpers --------------------------- */
|
|
45
49
|
/*------------------------------------------------------------------------*/
|
|
46
50
|
|
|
51
|
+
// Timestamp after initialization when helpers should be available
|
|
52
|
+
const timestampWhenHelpersShouldBeAvailable = Date.now() + 2000;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Wait for a little while for a helper to exist
|
|
56
|
+
* @author Gabe Abrams
|
|
57
|
+
* @param checkForHelper a function that returns true if the helper exists
|
|
58
|
+
* @returns true if the helper exists, false if the process timed out
|
|
59
|
+
*/
|
|
60
|
+
const waitForHelper = async (checkForHelper: () => boolean): Promise<boolean> => {
|
|
61
|
+
// Wait for helper to exist
|
|
62
|
+
while (!checkForHelper()) {
|
|
63
|
+
// Check if we should stop waiting
|
|
64
|
+
if (Date.now() > timestampWhenHelpersShouldBeAvailable) {
|
|
65
|
+
// Stop waiting
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Wait a little while
|
|
70
|
+
await waitMs(10);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Helper exists
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
|
|
47
77
|
/*----------------------------------------*/
|
|
48
78
|
/* ----------- Redirect/Leave ----------- */
|
|
49
79
|
/*----------------------------------------*/
|
|
@@ -100,6 +130,11 @@ let onAlertClosed: () => void;
|
|
|
100
130
|
* @param text the text to display in the alert
|
|
101
131
|
*/
|
|
102
132
|
export const alert = async (title: string, text: string): Promise<undefined> => {
|
|
133
|
+
// Wait for helper to exist
|
|
134
|
+
await waitForHelper(() => {
|
|
135
|
+
return !!setAlertInfo;
|
|
136
|
+
});
|
|
137
|
+
|
|
103
138
|
// Fallback if alert not available
|
|
104
139
|
if (!setAlertInfo) {
|
|
105
140
|
// eslint-disable-next-line no-alert
|
|
@@ -169,6 +204,11 @@ export const confirm = async (
|
|
|
169
204
|
cancelButtonVariant?: Variant,
|
|
170
205
|
},
|
|
171
206
|
): Promise<boolean> => {
|
|
207
|
+
// Wait for helper to exist
|
|
208
|
+
await waitForHelper(() => {
|
|
209
|
+
return !!setConfirmInfo;
|
|
210
|
+
});
|
|
211
|
+
|
|
172
212
|
// Fallback if confirm is not available
|
|
173
213
|
if (!setConfirmInfo) {
|
|
174
214
|
// eslint-disable-next-line no-alert
|
|
@@ -209,10 +249,10 @@ const fatalErrorHandlers: (() => void)[] = [];
|
|
|
209
249
|
* @param error the error to show
|
|
210
250
|
* @param [errorTitle] title of the error box
|
|
211
251
|
*/
|
|
212
|
-
export const showFatalError = (
|
|
252
|
+
export const showFatalError = async (
|
|
213
253
|
error: any,
|
|
214
254
|
errorTitle: string = 'An Error Occurred',
|
|
215
|
-
)
|
|
255
|
+
) => {
|
|
216
256
|
// Determine message and code
|
|
217
257
|
const message: string = (
|
|
218
258
|
typeof error === 'string'
|
|
@@ -247,21 +287,27 @@ export const showFatalError = (
|
|
|
247
287
|
},
|
|
248
288
|
});
|
|
249
289
|
|
|
290
|
+
// Wait for helper to exist
|
|
291
|
+
await waitForHelper(() => {
|
|
292
|
+
return (
|
|
293
|
+
!!setFatalErrorMessage
|
|
294
|
+
&& !!setFatalErrorCode
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
|
|
250
298
|
// Handle case where app hasn't loaded
|
|
251
299
|
if (!setFatalErrorMessage || !setFatalErrorCode) {
|
|
252
300
|
alert(
|
|
253
301
|
errorTitle,
|
|
254
302
|
`${message} (code: ${code}). Please contact support.`,
|
|
255
303
|
);
|
|
256
|
-
return
|
|
304
|
+
return;
|
|
257
305
|
}
|
|
258
306
|
|
|
259
307
|
// Use setters
|
|
260
308
|
setFatalErrorMessage(message);
|
|
261
309
|
setFatalErrorCode(code);
|
|
262
310
|
setFatalErrorTitle(errorTitle);
|
|
263
|
-
|
|
264
|
-
return undefined;
|
|
265
311
|
};
|
|
266
312
|
|
|
267
313
|
/**
|
|
@@ -283,9 +329,8 @@ let setSessionHasExpired: (isExpired: boolean) => void;
|
|
|
283
329
|
* Show the "session expired" message
|
|
284
330
|
* @author Gabe Abrams
|
|
285
331
|
*/
|
|
286
|
-
export const showSessionExpiredMessage = ()
|
|
332
|
+
export const showSessionExpiredMessage = () => {
|
|
287
333
|
setSessionHasExpired(true);
|
|
288
|
-
return undefined;
|
|
289
334
|
};
|
|
290
335
|
|
|
291
336
|
/*------------------------------------------------------------------------*/
|
|
@@ -327,7 +372,6 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
327
372
|
|
|
328
373
|
const {
|
|
329
374
|
children,
|
|
330
|
-
dark,
|
|
331
375
|
} = props;
|
|
332
376
|
|
|
333
377
|
/* -------------- State ------------- */
|
|
@@ -523,7 +567,7 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
523
567
|
minHeight: '100vh',
|
|
524
568
|
paddingTop: '2rem',
|
|
525
569
|
backgroundColor: (
|
|
526
|
-
|
|
570
|
+
isDarkModeOn()
|
|
527
571
|
? '#222'
|
|
528
572
|
: '#fff'
|
|
529
573
|
),
|
|
@@ -548,7 +592,7 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
548
592
|
}
|
|
549
593
|
|
|
550
594
|
/*----------------------------------------*/
|
|
551
|
-
/*
|
|
595
|
+
/* --------------- Main UI -------------- */
|
|
552
596
|
/*----------------------------------------*/
|
|
553
597
|
|
|
554
598
|
return (
|
|
@@ -563,7 +607,7 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
|
|
|
563
607
|
};
|
|
564
608
|
|
|
565
609
|
/*------------------------------------------------------------------------*/
|
|
566
|
-
/*
|
|
610
|
+
/* ------------------------------- Wrap Up ------------------------------ */
|
|
567
611
|
/*------------------------------------------------------------------------*/
|
|
568
612
|
|
|
569
613
|
// Export component
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
9
|
/*------------------------------------------------------------------------*/
|
|
10
|
-
/*
|
|
10
|
+
/* -------------------------------- Types ------------------------------- */
|
|
11
11
|
/*------------------------------------------------------------------------*/
|
|
12
12
|
|
|
13
13
|
// Props definition
|
|
@@ -25,12 +25,12 @@ type Props = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
/*------------------------------------------------------------------------*/
|
|
28
|
-
/*
|
|
28
|
+
/* ------------------------------ Component ----------------------------- */
|
|
29
29
|
/*------------------------------------------------------------------------*/
|
|
30
30
|
|
|
31
31
|
const ButtonInputGroup: React.FC<Props> = (props) => {
|
|
32
32
|
/*------------------------------------------------------------------------*/
|
|
33
|
-
/*
|
|
33
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
34
34
|
/*------------------------------------------------------------------------*/
|
|
35
35
|
|
|
36
36
|
/* -------------- Props ------------- */
|
|
@@ -45,11 +45,11 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
|
|
|
45
45
|
} = props;
|
|
46
46
|
|
|
47
47
|
/*------------------------------------------------------------------------*/
|
|
48
|
-
/*
|
|
48
|
+
/* ------------------------------- Render ------------------------------- */
|
|
49
49
|
/*------------------------------------------------------------------------*/
|
|
50
50
|
|
|
51
51
|
/*----------------------------------------*/
|
|
52
|
-
/*
|
|
52
|
+
/* --------------- Main UI -------------- */
|
|
53
53
|
/*----------------------------------------*/
|
|
54
54
|
|
|
55
55
|
return (
|
|
@@ -96,7 +96,7 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
/*------------------------------------------------------------------------*/
|
|
99
|
-
/*
|
|
99
|
+
/* ------------------------------- Wrap Up ------------------------------ */
|
|
100
100
|
/*------------------------------------------------------------------------*/
|
|
101
101
|
|
|
102
102
|
// Export component
|
|
@@ -11,7 +11,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
11
11
|
import { faCloudDownloadAlt } from '@fortawesome/free-solid-svg-icons';
|
|
12
12
|
|
|
13
13
|
/*------------------------------------------------------------------------*/
|
|
14
|
-
/*
|
|
14
|
+
/* -------------------------------- Types ------------------------------- */
|
|
15
15
|
/*------------------------------------------------------------------------*/
|
|
16
16
|
|
|
17
17
|
// Props definition
|
|
@@ -35,12 +35,12 @@ type Props = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
/*------------------------------------------------------------------------*/
|
|
38
|
-
/*
|
|
38
|
+
/* ------------------------------ Component ----------------------------- */
|
|
39
39
|
/*------------------------------------------------------------------------*/
|
|
40
40
|
|
|
41
41
|
const CSVDownloadButton: React.FC<Props> = (props) => {
|
|
42
42
|
/*------------------------------------------------------------------------*/
|
|
43
|
-
/*
|
|
43
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
44
44
|
/*------------------------------------------------------------------------*/
|
|
45
45
|
|
|
46
46
|
/* -------------- Props ------------- */
|
|
@@ -58,11 +58,11 @@ const CSVDownloadButton: React.FC<Props> = (props) => {
|
|
|
58
58
|
} = props;
|
|
59
59
|
|
|
60
60
|
/*------------------------------------------------------------------------*/
|
|
61
|
-
/*
|
|
61
|
+
/* ------------------------------- Render ------------------------------- */
|
|
62
62
|
/*------------------------------------------------------------------------*/
|
|
63
63
|
|
|
64
64
|
/*----------------------------------------*/
|
|
65
|
-
/*
|
|
65
|
+
/* --------------- Main UI -------------- */
|
|
66
66
|
/*----------------------------------------*/
|
|
67
67
|
|
|
68
68
|
// Render the button
|
|
@@ -95,7 +95,7 @@ const CSVDownloadButton: React.FC<Props> = (props) => {
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
/*------------------------------------------------------------------------*/
|
|
98
|
-
/*
|
|
98
|
+
/* ------------------------------- Wrap Up ------------------------------ */
|
|
99
99
|
/*------------------------------------------------------------------------*/
|
|
100
100
|
|
|
101
101
|
// Export component
|
|
@@ -14,8 +14,11 @@ import { faSquare, faSquareMinus } from '@fortawesome/free-regular-svg-icons';
|
|
|
14
14
|
// Import shared types
|
|
15
15
|
import Variant from '../types/Variant';
|
|
16
16
|
|
|
17
|
+
// Import shared helpers
|
|
18
|
+
import { isDarkModeOn } from '../client/initClient';
|
|
19
|
+
|
|
17
20
|
/*------------------------------------------------------------------------*/
|
|
18
|
-
/*
|
|
21
|
+
/* -------------------------------- Types ------------------------------- */
|
|
19
22
|
/*------------------------------------------------------------------------*/
|
|
20
23
|
|
|
21
24
|
type Props = {
|
|
@@ -46,12 +49,12 @@ type Props = {
|
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
/*------------------------------------------------------------------------*/
|
|
49
|
-
/*
|
|
52
|
+
/* ------------------------------ Component ----------------------------- */
|
|
50
53
|
/*------------------------------------------------------------------------*/
|
|
51
54
|
|
|
52
55
|
const CheckboxButton: React.FC<Props> = (props) => {
|
|
53
56
|
/*------------------------------------------------------------------------*/
|
|
54
|
-
/*
|
|
57
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
55
58
|
/*------------------------------------------------------------------------*/
|
|
56
59
|
|
|
57
60
|
/* -------------- Props ------------- */
|
|
@@ -65,18 +68,26 @@ const CheckboxButton: React.FC<Props> = (props) => {
|
|
|
65
68
|
id,
|
|
66
69
|
className,
|
|
67
70
|
noMarginOnRight,
|
|
68
|
-
checkedVariant =
|
|
69
|
-
|
|
71
|
+
checkedVariant = (
|
|
72
|
+
isDarkModeOn()
|
|
73
|
+
? Variant.Light
|
|
74
|
+
: Variant.Secondary
|
|
75
|
+
),
|
|
76
|
+
uncheckedVariant = (
|
|
77
|
+
isDarkModeOn()
|
|
78
|
+
? Variant.Secondary
|
|
79
|
+
: Variant.Light
|
|
80
|
+
),
|
|
70
81
|
small,
|
|
71
82
|
dashed,
|
|
72
83
|
} = props;
|
|
73
84
|
|
|
74
85
|
/*------------------------------------------------------------------------*/
|
|
75
|
-
/*
|
|
86
|
+
/* ------------------------------- Render ------------------------------- */
|
|
76
87
|
/*------------------------------------------------------------------------*/
|
|
77
88
|
|
|
78
89
|
/*----------------------------------------*/
|
|
79
|
-
/*
|
|
90
|
+
/* --------------- Main UI -------------- */
|
|
80
91
|
/*----------------------------------------*/
|
|
81
92
|
|
|
82
93
|
// Determine the icon
|
|
@@ -113,7 +124,7 @@ const CheckboxButton: React.FC<Props> = (props) => {
|
|
|
113
124
|
};
|
|
114
125
|
|
|
115
126
|
/*------------------------------------------------------------------------*/
|
|
116
|
-
/*
|
|
127
|
+
/* ------------------------------- Wrap Up ------------------------------ */
|
|
117
128
|
/*------------------------------------------------------------------------*/
|
|
118
129
|
|
|
119
130
|
export default CheckboxButton;
|
|
@@ -15,7 +15,7 @@ import { alert } from './AppWrapper';
|
|
|
15
15
|
import waitMs from '../helpers/waitMs';
|
|
16
16
|
|
|
17
17
|
/*------------------------------------------------------------------------*/
|
|
18
|
-
/*
|
|
18
|
+
/* -------------------------------- Types ------------------------------- */
|
|
19
19
|
/*------------------------------------------------------------------------*/
|
|
20
20
|
|
|
21
21
|
// Props definition
|
|
@@ -43,7 +43,7 @@ type Props = {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
/*------------------------------------------------------------------------*/
|
|
46
|
-
/*
|
|
46
|
+
/* -------------------------------- State ------------------------------- */
|
|
47
47
|
/*------------------------------------------------------------------------*/
|
|
48
48
|
|
|
49
49
|
/* -------- State Definition -------- */
|
|
@@ -97,12 +97,12 @@ const reducer = (state: State, action: Action): State => {
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
/*------------------------------------------------------------------------*/
|
|
100
|
-
/*
|
|
100
|
+
/* ------------------------------ Component ----------------------------- */
|
|
101
101
|
/*------------------------------------------------------------------------*/
|
|
102
102
|
|
|
103
103
|
const CopiableBox: React.FC<Props> = (props) => {
|
|
104
104
|
/*------------------------------------------------------------------------*/
|
|
105
|
-
/*
|
|
105
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
106
106
|
/*------------------------------------------------------------------------*/
|
|
107
107
|
|
|
108
108
|
/* -------------- Props ------------- */
|
|
@@ -137,7 +137,7 @@ const CopiableBox: React.FC<Props> = (props) => {
|
|
|
137
137
|
} = state;
|
|
138
138
|
|
|
139
139
|
/*------------------------------------------------------------------------*/
|
|
140
|
-
/*
|
|
140
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
141
141
|
/*------------------------------------------------------------------------*/
|
|
142
142
|
|
|
143
143
|
/**
|
|
@@ -170,11 +170,11 @@ const CopiableBox: React.FC<Props> = (props) => {
|
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
/*------------------------------------------------------------------------*/
|
|
173
|
-
/*
|
|
173
|
+
/* ------------------------------- Render ------------------------------- */
|
|
174
174
|
/*------------------------------------------------------------------------*/
|
|
175
175
|
|
|
176
176
|
/*----------------------------------------*/
|
|
177
|
-
/*
|
|
177
|
+
/* --------------- Main UI -------------- */
|
|
178
178
|
/*----------------------------------------*/
|
|
179
179
|
|
|
180
180
|
return (
|
|
@@ -292,7 +292,7 @@ const CopiableBox: React.FC<Props> = (props) => {
|
|
|
292
292
|
};
|
|
293
293
|
|
|
294
294
|
/*------------------------------------------------------------------------*/
|
|
295
|
-
/*
|
|
295
|
+
/* ------------------------------- Wrap Up ------------------------------ */
|
|
296
296
|
/*------------------------------------------------------------------------*/
|
|
297
297
|
|
|
298
298
|
// Export component
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
9
|
/*------------------------------------------------------------------------*/
|
|
10
|
-
/*
|
|
10
|
+
/* -------------------------------- Types ------------------------------- */
|
|
11
11
|
/*------------------------------------------------------------------------*/
|
|
12
12
|
|
|
13
13
|
// Props definition
|
|
@@ -19,7 +19,7 @@ type Props = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/*------------------------------------------------------------------------*/
|
|
22
|
-
/*
|
|
22
|
+
/* -------------------------------- Style ------------------------------- */
|
|
23
23
|
/*------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
25
|
const style = `
|
|
@@ -39,12 +39,12 @@ const style = `
|
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
41
|
/*------------------------------------------------------------------------*/
|
|
42
|
-
/*
|
|
42
|
+
/* ------------------------------ Component ----------------------------- */
|
|
43
43
|
/*------------------------------------------------------------------------*/
|
|
44
44
|
|
|
45
45
|
const Drawer: React.FC<Props> = (props) => {
|
|
46
46
|
/*------------------------------------------------------------------------*/
|
|
47
|
-
/*
|
|
47
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
48
48
|
/*------------------------------------------------------------------------*/
|
|
49
49
|
|
|
50
50
|
/* -------------- Props ------------- */
|
|
@@ -56,11 +56,11 @@ const Drawer: React.FC<Props> = (props) => {
|
|
|
56
56
|
} = props;
|
|
57
57
|
|
|
58
58
|
/*------------------------------------------------------------------------*/
|
|
59
|
-
/*
|
|
59
|
+
/* ------------------------------- Render ------------------------------- */
|
|
60
60
|
/*------------------------------------------------------------------------*/
|
|
61
61
|
|
|
62
62
|
/*----------------------------------------*/
|
|
63
|
-
/*
|
|
63
|
+
/* --------------- Main UI -------------- */
|
|
64
64
|
/*----------------------------------------*/
|
|
65
65
|
|
|
66
66
|
return (
|
|
@@ -77,7 +77,7 @@ const Drawer: React.FC<Props> = (props) => {
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
/*------------------------------------------------------------------------*/
|
|
80
|
-
/*
|
|
80
|
+
/* ------------------------------- Wrap Up ------------------------------ */
|
|
81
81
|
/*------------------------------------------------------------------------*/
|
|
82
82
|
|
|
83
83
|
// Export component
|
|
@@ -14,7 +14,7 @@ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
|
|
14
14
|
import ReactKitErrorCode from '../types/ReactKitErrorCode';
|
|
15
15
|
|
|
16
16
|
/*------------------------------------------------------------------------*/
|
|
17
|
-
/*
|
|
17
|
+
/* -------------------------------- Types ------------------------------- */
|
|
18
18
|
/*------------------------------------------------------------------------*/
|
|
19
19
|
|
|
20
20
|
type Props = {
|
|
@@ -27,12 +27,12 @@ type Props = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
/*------------------------------------------------------------------------*/
|
|
30
|
-
/*
|
|
30
|
+
/* ------------------------------ Component ----------------------------- */
|
|
31
31
|
/*------------------------------------------------------------------------*/
|
|
32
32
|
|
|
33
33
|
const ErrorBox: React.FC<Props> = (props) => {
|
|
34
34
|
/*------------------------------------------------------------------------*/
|
|
35
|
-
/*
|
|
35
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
36
36
|
/*------------------------------------------------------------------------*/
|
|
37
37
|
|
|
38
38
|
/* -------------- Props ------------- */
|
|
@@ -44,7 +44,7 @@ const ErrorBox: React.FC<Props> = (props) => {
|
|
|
44
44
|
} = props;
|
|
45
45
|
|
|
46
46
|
/*------------------------------------------------------------------------*/
|
|
47
|
-
/*
|
|
47
|
+
/* ------------------------------- Render ------------------------------- */
|
|
48
48
|
/*------------------------------------------------------------------------*/
|
|
49
49
|
|
|
50
50
|
// Determine error text
|
|
@@ -117,7 +117,7 @@ const ErrorBox: React.FC<Props> = (props) => {
|
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
/*------------------------------------------------------------------------*/
|
|
120
|
-
/*
|
|
120
|
+
/* ------------------------------- Wrap Up ------------------------------ */
|
|
121
121
|
/*------------------------------------------------------------------------*/
|
|
122
122
|
|
|
123
123
|
// Export component
|