dce-reactkit 3.6.4 → 3.6.5
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 +24 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ErrorBox.d.ts +4 -0
- package/dist/esm/index.js +24 -22
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ErrorBox.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +9 -0
- package/src/components/ErrorBox.tsx +10 -2
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
* @author Gabe Abrams
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
7
|
+
import Variant from '../types/Variant';
|
|
6
8
|
type Props = {
|
|
7
9
|
error: any;
|
|
8
10
|
title?: string;
|
|
9
11
|
onClose?: () => void;
|
|
12
|
+
variant?: Variant;
|
|
13
|
+
icon?: IconProp;
|
|
10
14
|
};
|
|
11
15
|
declare const ErrorBox: React.FC<Props>;
|
|
12
16
|
export default ErrorBox;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useState, useRef, useEffect, useReducer, forwardRef, useContext, useLayoutEffect, createContext, useMemo, useCallback, Component, Fragment } from 'react';
|
|
3
|
+
import { faExclamationTriangle, faHourglassEnd, faCircle, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faMinus, faCheckCircle, faXmarkCircle, faSort, faSortDown, faSortUp, faCalendar, faTag, faHammer, faList, faTimes, faSave, faTrash, faCog, faPlus, faCaretDown } from '@fortawesome/free-solid-svg-icons';
|
|
3
4
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import { faExclamationTriangle, faCircle, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faMinus, faCheckCircle, faXmarkCircle, faSort, faSortDown, faSortUp, faCalendar, faTag, faHammer, faList, faTimes, faSave, faTrash, faCog, faPlus, faCaretDown } from '@fortawesome/free-solid-svg-icons';
|
|
5
5
|
import { faCircle as faCircle$1, faSquareMinus, faSquare } from '@fortawesome/free-regular-svg-icons';
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
@@ -52,6 +52,23 @@ var ReactKitErrorCode;
|
|
|
52
52
|
})(ReactKitErrorCode || (ReactKitErrorCode = {}));
|
|
53
53
|
var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Bootstrap variants
|
|
57
|
+
* @author Gabe Abrams
|
|
58
|
+
*/
|
|
59
|
+
var Variant;
|
|
60
|
+
(function (Variant) {
|
|
61
|
+
Variant["Primary"] = "primary";
|
|
62
|
+
Variant["Secondary"] = "secondary";
|
|
63
|
+
Variant["Success"] = "success";
|
|
64
|
+
Variant["Warning"] = "warning";
|
|
65
|
+
Variant["Info"] = "info";
|
|
66
|
+
Variant["Danger"] = "danger";
|
|
67
|
+
Variant["Light"] = "light";
|
|
68
|
+
Variant["Dark"] = "dark";
|
|
69
|
+
})(Variant || (Variant = {}));
|
|
70
|
+
var Variant$1 = Variant;
|
|
71
|
+
|
|
55
72
|
/**
|
|
56
73
|
* Displays an error
|
|
57
74
|
* @author Gabe Abrams
|
|
@@ -65,7 +82,7 @@ const ErrorBox = (props) => {
|
|
|
65
82
|
/*------------------------------------------------------------------------*/
|
|
66
83
|
var _a;
|
|
67
84
|
/* -------------- Props ------------- */
|
|
68
|
-
const { error, title = 'An Error Occurred', onClose, } = props;
|
|
85
|
+
const { error, title = 'An Error Occurred', onClose, variant = Variant$1.Danger, icon = faExclamationTriangle, } = props;
|
|
69
86
|
/*------------------------------------------------------------------------*/
|
|
70
87
|
/* ------------------------------- Render ------------------------------- */
|
|
71
88
|
/*------------------------------------------------------------------------*/
|
|
@@ -93,12 +110,12 @@ const ErrorBox = (props) => {
|
|
|
93
110
|
String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$1.NoCode).toUpperCase())));
|
|
94
111
|
}
|
|
95
112
|
// Main UI
|
|
96
|
-
return (React__default.createElement("div", { className:
|
|
113
|
+
return (React__default.createElement("div", { className: `alert alert-${variant} text-center`, style: {
|
|
97
114
|
maxWidth: '40rem',
|
|
98
115
|
margin: 'auto',
|
|
99
116
|
} },
|
|
100
117
|
React__default.createElement("h4", { className: "mb-1" },
|
|
101
|
-
React__default.createElement(FontAwesomeIcon, { icon:
|
|
118
|
+
React__default.createElement(FontAwesomeIcon, { icon: icon, className: "me-2" }),
|
|
102
119
|
title),
|
|
103
120
|
React__default.createElement("div", null,
|
|
104
121
|
errorText,
|
|
@@ -173,23 +190,6 @@ const waitMs = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
173
190
|
});
|
|
174
191
|
});
|
|
175
192
|
|
|
176
|
-
/**
|
|
177
|
-
* Bootstrap variants
|
|
178
|
-
* @author Gabe Abrams
|
|
179
|
-
*/
|
|
180
|
-
var Variant;
|
|
181
|
-
(function (Variant) {
|
|
182
|
-
Variant["Primary"] = "primary";
|
|
183
|
-
Variant["Secondary"] = "secondary";
|
|
184
|
-
Variant["Success"] = "success";
|
|
185
|
-
Variant["Warning"] = "warning";
|
|
186
|
-
Variant["Info"] = "info";
|
|
187
|
-
Variant["Danger"] = "danger";
|
|
188
|
-
Variant["Light"] = "light";
|
|
189
|
-
Variant["Dark"] = "dark";
|
|
190
|
-
})(Variant || (Variant = {}));
|
|
191
|
-
var Variant$1 = Variant;
|
|
192
|
-
|
|
193
193
|
/**
|
|
194
194
|
* Modal sizes
|
|
195
195
|
* @author Gabe Abrams
|
|
@@ -1134,7 +1134,9 @@ const AppWrapper = (props) => {
|
|
|
1134
1134
|
} },
|
|
1135
1135
|
React__default.createElement(ErrorBox, { title: (sessionHasExpired
|
|
1136
1136
|
? 'Session Expired'
|
|
1137
|
-
: fatalErrorTitle), error: error
|
|
1137
|
+
: fatalErrorTitle), error: error, variant: (isDarkModeOn()
|
|
1138
|
+
? Variant$1.Light
|
|
1139
|
+
: Variant$1.Secondary), icon: faHourglassEnd })));
|
|
1138
1140
|
}
|
|
1139
1141
|
/* --------------- App -------------- */
|
|
1140
1142
|
if (!body) {
|