dce-reactkit 3.6.4 → 3.6.6
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 +29 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ErrorBox.d.ts +4 -0
- package/dist/esm/index.js +29 -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 +15 -0
- package/src/components/ErrorBox.tsx +10 -2
package/dist/cjs/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
7
6
|
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
7
|
+
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
8
8
|
var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -78,6 +78,23 @@ var ReactKitErrorCode;
|
|
|
78
78
|
})(ReactKitErrorCode || (ReactKitErrorCode = {}));
|
|
79
79
|
var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Bootstrap variants
|
|
83
|
+
* @author Gabe Abrams
|
|
84
|
+
*/
|
|
85
|
+
var Variant;
|
|
86
|
+
(function (Variant) {
|
|
87
|
+
Variant["Primary"] = "primary";
|
|
88
|
+
Variant["Secondary"] = "secondary";
|
|
89
|
+
Variant["Success"] = "success";
|
|
90
|
+
Variant["Warning"] = "warning";
|
|
91
|
+
Variant["Info"] = "info";
|
|
92
|
+
Variant["Danger"] = "danger";
|
|
93
|
+
Variant["Light"] = "light";
|
|
94
|
+
Variant["Dark"] = "dark";
|
|
95
|
+
})(Variant || (Variant = {}));
|
|
96
|
+
var Variant$1 = Variant;
|
|
97
|
+
|
|
81
98
|
/**
|
|
82
99
|
* Displays an error
|
|
83
100
|
* @author Gabe Abrams
|
|
@@ -91,7 +108,7 @@ const ErrorBox = (props) => {
|
|
|
91
108
|
/*------------------------------------------------------------------------*/
|
|
92
109
|
var _a;
|
|
93
110
|
/* -------------- Props ------------- */
|
|
94
|
-
const { error, title = 'An Error Occurred', onClose, } = props;
|
|
111
|
+
const { error, title = 'An Error Occurred', onClose, variant = Variant$1.Danger, icon = freeSolidSvgIcons.faExclamationTriangle, } = props;
|
|
95
112
|
/*------------------------------------------------------------------------*/
|
|
96
113
|
/* ------------------------------- Render ------------------------------- */
|
|
97
114
|
/*------------------------------------------------------------------------*/
|
|
@@ -119,12 +136,12 @@ const ErrorBox = (props) => {
|
|
|
119
136
|
String((_a = error.code) !== null && _a !== void 0 ? _a : ReactKitErrorCode$1.NoCode).toUpperCase())));
|
|
120
137
|
}
|
|
121
138
|
// Main UI
|
|
122
|
-
return (React__default["default"].createElement("div", { className:
|
|
139
|
+
return (React__default["default"].createElement("div", { className: `alert alert-${variant} text-center`, style: {
|
|
123
140
|
maxWidth: '40rem',
|
|
124
141
|
margin: 'auto',
|
|
125
142
|
} },
|
|
126
143
|
React__default["default"].createElement("h4", { className: "mb-1" },
|
|
127
|
-
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon:
|
|
144
|
+
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: icon, className: "me-2" }),
|
|
128
145
|
title),
|
|
129
146
|
React__default["default"].createElement("div", null,
|
|
130
147
|
errorText,
|
|
@@ -199,23 +216,6 @@ const waitMs = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
199
216
|
});
|
|
200
217
|
});
|
|
201
218
|
|
|
202
|
-
/**
|
|
203
|
-
* Bootstrap variants
|
|
204
|
-
* @author Gabe Abrams
|
|
205
|
-
*/
|
|
206
|
-
var Variant;
|
|
207
|
-
(function (Variant) {
|
|
208
|
-
Variant["Primary"] = "primary";
|
|
209
|
-
Variant["Secondary"] = "secondary";
|
|
210
|
-
Variant["Success"] = "success";
|
|
211
|
-
Variant["Warning"] = "warning";
|
|
212
|
-
Variant["Info"] = "info";
|
|
213
|
-
Variant["Danger"] = "danger";
|
|
214
|
-
Variant["Light"] = "light";
|
|
215
|
-
Variant["Dark"] = "dark";
|
|
216
|
-
})(Variant || (Variant = {}));
|
|
217
|
-
var Variant$1 = Variant;
|
|
218
|
-
|
|
219
219
|
/**
|
|
220
220
|
* Modal sizes
|
|
221
221
|
* @author Gabe Abrams
|
|
@@ -1148,6 +1148,13 @@ const AppWrapper = (props) => {
|
|
|
1148
1148
|
const error = (sessionHasExpired
|
|
1149
1149
|
? new ErrorWithCode(getSessionExpiredMessage(), ReactKitErrorCode$1.SessionExpired)
|
|
1150
1150
|
: new ErrorWithCode((fatalErrorMessage !== null && fatalErrorMessage !== void 0 ? fatalErrorMessage : 'An unknown error has occurred. Please contact support.'), (fatalErrorCode !== null && fatalErrorCode !== void 0 ? fatalErrorCode : ReactKitErrorCode$1.NoCode)));
|
|
1151
|
+
// Choose error box variant
|
|
1152
|
+
let errorBoxVariant = Variant$1.Danger;
|
|
1153
|
+
if (sessionHasExpired) {
|
|
1154
|
+
errorBoxVariant = (isDarkModeOn()
|
|
1155
|
+
? Variant$1.Light
|
|
1156
|
+
: Variant$1.Secondary);
|
|
1157
|
+
}
|
|
1151
1158
|
// Build error screen
|
|
1152
1159
|
body = (React__default["default"].createElement("div", { style: {
|
|
1153
1160
|
display: 'block',
|
|
@@ -1160,7 +1167,7 @@ const AppWrapper = (props) => {
|
|
|
1160
1167
|
} },
|
|
1161
1168
|
React__default["default"].createElement(ErrorBox, { title: (sessionHasExpired
|
|
1162
1169
|
? 'Session Expired'
|
|
1163
|
-
: fatalErrorTitle), error: error })));
|
|
1170
|
+
: fatalErrorTitle), error: error, variant: errorBoxVariant, icon: freeSolidSvgIcons.faHourglassEnd })));
|
|
1164
1171
|
}
|
|
1165
1172
|
/* --------------- App -------------- */
|
|
1166
1173
|
if (!body) {
|