dce-reactkit 2.0.0 → 2.0.3

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.
@@ -2,6 +2,5 @@
2
2
  * Loading spinner/indicator
3
3
  * @author Gabe Abrams
4
4
  */
5
- import './LoadingSpinner.scss';
6
5
  declare const LoadingSpinner: () => JSX.Element;
7
6
  export default LoadingSpinner;
@@ -19,8 +19,10 @@ var jsx_runtime_1 = require("react/jsx-runtime");
19
19
  // Import FontAwesome Icons
20
20
  var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
21
21
  var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
22
- // Import style
23
- require("./LoadingSpinner.scss");
22
+ /*------------------------------------------------------------------------*/
23
+ /* Style */
24
+ /*------------------------------------------------------------------------*/
25
+ var style = "\n/* Blips */\n.LoadingSpinner-blip-1,\n.LoadingSpinner-blip-2,\n.LoadingSpinner-blip-3,\n.LoadingSpinner-blip-4 {\n font-size: 25px;\n opacity: 0.6;\n margin-top: 20px;\n margin-bottom: 20px;\n}\n\n/* First Blip */\n.LoadingSpinner-blip-1 {\n animation: LoadingSpinner-pop-animation 2s infinite;\n}\n\n/* Second Blip */\n.LoadingSpinner-blip-2 {\n animation: LoadingSpinner-pop-animation 2s infinite;\n -webkit-animation-delay: 0.1s;\n animation-delay: 0.1s;\n}\n\n/* Third Blip */\n.LoadingSpinner-blip-3 {\n animation: LoadingSpinner-pop-animation 2s infinite;\n animation-delay: 0.2s;\n}\n\n/* Fourth Blip */\n.LoadingSpinner-blip-4 {\n animation: LoadingSpinner-pop-animation 2s infinite;\n animation-delay: 0.3s;\n}\n\n/* Pop Animation for Each Blip */\n@keyframes LoadingSpinner-pop-animation {\n 0% {\n transform: scale(1.0);\n }\n 10% {\n transform: scale(1.5);\n }\n 30% {\n transform: scale(1.0);\n }\n 100% {\n transform: scale(1.0);\n }\n}\n";
24
26
  /*------------------------------------------------------------------------*/
25
27
  /* Component */
26
28
  /*------------------------------------------------------------------------*/
@@ -29,7 +31,7 @@ var LoadingSpinner = function () {
29
31
  /* Render */
30
32
  /*------------------------------------------------------------------------*/
31
33
  // Add all four blips to a container
32
- return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "text-center LoadingSpinner LoadingSpinner-container" }, { children: [(0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-1 me-1" }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-2 me-1" }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-3 me-1" }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-4" })] })));
34
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "text-center LoadingSpinner LoadingSpinner-container" }, { children: [(0, jsx_runtime_1.jsx)("style", { children: style }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-1 me-1" }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-2 me-1" }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-3 me-1" }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCircle, className: "LoadingSpinner-blip-4" })] })));
33
35
  };
34
36
  /*------------------------------------------------------------------------*/
35
37
  /* Wrap Up */
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingSpinner.js","sourceRoot":"","sources":["../../src/components/LoadingSpinner.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;GAGG;AAEH,2BAA2B;AAC3B,oEAAiE;AACjE,0EAA6D;AAE7D,eAAe;AACf,iCAA+B;AAE/B,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,IAAM,cAAc,GAAG;IACrB,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAE5E,oCAAoC;IACpC,OAAO,CACL,0CAAK,SAAS,EAAC,qDAAqD,iBAClE,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,4BAA4B,GACtC,EACF,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,4BAA4B,GACtC,EACF,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,4BAA4B,GACtC,EACF,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,uBAAuB,GACjC,KACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,mBAAmB;AACnB,kBAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"LoadingSpinner.js","sourceRoot":"","sources":["../../src/components/LoadingSpinner.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;GAGG;AAEH,2BAA2B;AAC3B,oEAAiE;AACjE,0EAA6D;AAE7D,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,IAAM,KAAK,GAAG,69BAmDb,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,IAAM,cAAc,GAAG;IACrB,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAE5E,oCAAoC;IACpC,OAAO,CACL,0CAAK,SAAS,EAAC,qDAAqD,iBAClE,4CAAQ,KAAK,GAAS,EACtB,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,4BAA4B,GACtC,EACF,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,4BAA4B,GACtC,EACF,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,4BAA4B,GACtC,EACF,uBAAC,mCAAe,IACd,IAAI,EAAE,+BAAQ,EACd,SAAS,EAAC,uBAAuB,GACjC,KACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,mBAAmB;AACnB,kBAAe,cAAc,CAAC"}
@@ -64,6 +64,10 @@ var waitMs_1 = __importDefault(require("../helpers/waitMs"));
64
64
  // Import types
65
65
  var Variant_1 = __importDefault(require("../types/Variant"));
66
66
  /*------------------------------------------------------------------------*/
67
+ /* Style */
68
+ /*------------------------------------------------------------------------*/
69
+ var style = "\n/* More opaque backdrop */\n.Modal-backdrop {\n background-color: black !important;\n opacity: 0.8 !important;\n z-index: 10000000 !important;\n}\n\n/* Customize the modal header and body */\n.modal-header {\n /* Dark theme */\n background-color: #222 !important;\n color: white !important;\n\n /* Border */\n border: 1px solid #545454 !important;\n}\n.modal-body {\n /* Dark theme */\n background-color: #222 !important;\n color: white !important;\n\n /* Border */\n border-top: 0 !important;\n border-left: 1px solid #545454 !important;\n border-bottom: 1px solid #545454 !important;\n border-right: 1px solid #545454 !important;\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n}\n\n/* Create our own animation */\n.modal-content {\n animation-name: Modal-drop-in;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-timing-function: ease-out;\n}\n@keyframes Modal-drop-in {\n 0% {\n transform: scale(0.8);\n opacity: 0.5;\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n}\n";
70
+ /*------------------------------------------------------------------------*/
67
71
  /* Constants */
68
72
  /*------------------------------------------------------------------------*/
69
73
  // Constants
@@ -297,7 +301,7 @@ var Modal = function (props) {
297
301
  // Render the modal
298
302
  return ((0, jsx_runtime_1.jsxs)(Modal_1.default, __assign({ show: visible, size: size !== ModalSize.Medium ? size : undefined, onHide: function () {
299
303
  handleClose(ButtonType.Cancel);
300
- }, style: { zIndex: 5000000000 }, backdropClassName: "Modal-backdrop", centered: true }, { children: [title && ((0, jsx_runtime_1.jsx)(Modal_1.default.Header, __assign({ closeButton: !!onClose }, { children: (0, jsx_runtime_1.jsx)(Modal_1.default.Title, { children: title }) }))), children && ((0, jsx_runtime_1.jsx)(Modal_1.default.Body, { children: children })), footer && ((0, jsx_runtime_1.jsx)(Modal_1.default.Footer, { children: footer }))] })));
304
+ }, style: { zIndex: 5000000000 }, backdropClassName: "Modal-backdrop", centered: true }, { children: [(0, jsx_runtime_1.jsx)("style", { children: style }), title && ((0, jsx_runtime_1.jsx)(Modal_1.default.Header, __assign({ closeButton: !!onClose }, { children: (0, jsx_runtime_1.jsx)(Modal_1.default.Title, { children: title }) }))), children && ((0, jsx_runtime_1.jsx)(Modal_1.default.Body, { children: children })), footer && ((0, jsx_runtime_1.jsx)(Modal_1.default.Footer, { children: footer }))] })));
301
305
  };
302
306
  /*------------------------------------------------------------------------*/
303
307
  /* Wrap Up */
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/components/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;GAGG;AAEH,eAAe;AACf,+BAAmD;AAEnD,0BAA0B;AAC1B,gEAAmD;AACnD,6DAAuC;AAEvC,eAAe;AACf,6DAAuC;AAEvC,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,YAAY;AACZ,IAAM,aAAa,GAAG,GAAG,CAAC,CAAC,gDAAgD;AAC3E,IAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,2EAA2E;AAE3E,cAAc;AACd,IAAK,SAUJ;AAVD,WAAK,SAAS;IACZ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QAAQ,uBAER,4CAAQ,KAAK,GAAS,EACrB,KAAK,IAAI,CACR,uBAAC,eAAc,CAAC,MAAM,aACpB,WAAW,EAAE,CAAC,CAAC,OAAO,gBAEtB,uBAAC,eAAc,CAAC,KAAK,cAClB,KAAK,GACe,IACD,CACzB,EACA,QAAQ,IAAI,CACX,uBAAC,eAAc,CAAC,IAAI,cACjB,QAAQ,GACW,CACvB,EACA,MAAM,IAAI,CACT,uBAAC,eAAc,CAAC,MAAM,cACnB,MAAM,GACe,CACzB,KACc,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,YAAY;AACZ,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;AAC5B,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;AAC5B,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAC9B,KAAK,CAAC,OAAO,GAAG,iBAAO,CAAC;AAExB,kBAAe,KAAK,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An error with a code
3
+ * @author Gabe Abrams
4
+ */
5
+ declare class ErrorWithCode extends Error {
6
+ code: string;
7
+ constructor(message: string, code: string);
8
+ }
9
+ export default ErrorWithCode;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ /**
19
+ * An error with a code
20
+ * @author Gabe Abrams
21
+ */
22
+ var ErrorWithCode = /** @class */ (function (_super) {
23
+ __extends(ErrorWithCode, _super);
24
+ function ErrorWithCode(message, code) {
25
+ var _this = _super.call(this, message) || this;
26
+ _this.name = 'ErrorWithCode';
27
+ _this.code = code;
28
+ return _this;
29
+ }
30
+ return ErrorWithCode;
31
+ }(Error));
32
+ exports.default = ErrorWithCode;
33
+ //# sourceMappingURL=ErrorWithCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorWithCode.js","sourceRoot":"","sources":["../../src/errors/ErrorWithCode.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH;IAA4B,iCAAK;IAG/B,uBAAY,OAAe,EAAE,IAAY;QAAzC,YACE,kBAAM,OAAO,CAAC,SAGf;QAFC,KAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IACH,oBAAC;AAAD,CAAC,AARD,CAA4B,KAAK,GAQhC;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Visit an endpoint on the server
3
+ * @author Gabe Abrams
4
+ * @param opts object containing all arguments
5
+ * @param opts.path - the path of the server endpoint
6
+ * @param [opts.method=GET] - the method of the endpoint
7
+ * @param [opts.params] - query/body parameters to include
8
+ * @returns response from server
9
+ */
10
+ declare const visitServerEndpoint: (opts: {
11
+ path: string;
12
+ method?: ('GET' | 'POST' | 'DELETE' | 'PUT');
13
+ params?: {
14
+ [x: string]: any;
15
+ };
16
+ }) => Promise<any>;
17
+ export default visitServerEndpoint;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ // Initialize caccl
43
+ var client_1 = require("caccl/client");
44
+ // Import custom error
45
+ var ErrorWithCode_1 = __importDefault(require("../errors/ErrorWithCode"));
46
+ var ReactKitErrorCode_1 = __importDefault(require("../types/ReactKitErrorCode"));
47
+ /**
48
+ * Visit an endpoint on the server
49
+ * @author Gabe Abrams
50
+ * @param opts object containing all arguments
51
+ * @param opts.path - the path of the server endpoint
52
+ * @param [opts.method=GET] - the method of the endpoint
53
+ * @param [opts.params] - query/body parameters to include
54
+ * @returns response from server
55
+ */
56
+ var visitServerEndpoint = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
57
+ var response, body;
58
+ return __generator(this, function (_a) {
59
+ switch (_a.label) {
60
+ case 0: return [4 /*yield*/, (0, client_1.sendRequest)({
61
+ path: opts.path,
62
+ method: opts.method,
63
+ params: opts.params,
64
+ })];
65
+ case 1:
66
+ response = _a.sent();
67
+ // Check for failure
68
+ if (!response || !response.body) {
69
+ throw new ErrorWithCode_1.default('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode_1.default.NoResponse);
70
+ }
71
+ if (!response.body.success) {
72
+ // Other errors
73
+ throw new ErrorWithCode_1.default((response.body.message
74
+ || 'An unknown error occurred. Please contact an admin.'), (response.body.code
75
+ || ReactKitErrorCode_1.default.NoCode));
76
+ }
77
+ body = response.body.body;
78
+ // Return
79
+ return [2 /*return*/, body];
80
+ }
81
+ });
82
+ }); };
83
+ exports.default = visitServerEndpoint;
84
+ //# sourceMappingURL=visitServerEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visitServerEndpoint.js","sourceRoot":"","sources":["../../src/helpers/visitServerEndpoint.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mBAAmB;AACnB,uCAA2C;AAE3C,sBAAsB;AACtB,0EAAoD;AACpD,iFAA2D;AAE3D;;;;;;;;GAQG;AACH,IAAM,mBAAmB,GAAG,UAC1B,IAIC;;;;oBAGgB,qBAAM,IAAA,oBAAW,EAAC;oBACjC,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;iBACpB,CAAC,EAAA;;gBAJI,QAAQ,GAAG,SAIf;gBAEF,oBAAoB;gBACpB,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;oBAC/B,MAAM,IAAI,uBAAa,CACrB,mFAAmF,EACnF,2BAAiB,CAAC,UAAU,CAC7B,CAAC;iBACH;gBACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE;oBAC1B,eAAe;oBACf,MAAM,IAAI,uBAAa,CACrB,CACE,QAAQ,CAAC,IAAI,CAAC,OAAO;2BAClB,qDAAqD,CACzD,EACD,CACE,QAAQ,CAAC,IAAI,CAAC,IAAI;2BACf,2BAAiB,CAAC,MAAM,CAC5B,CACF,CAAC;iBACH;gBAGO,IAAI,GAAK,QAAQ,CAAC,IAAI,KAAlB,CAAmB;gBAE/B,SAAS;gBACT,sBAAO,IAAI,EAAC;;;KACb,CAAC;AAEF,kBAAe,mBAAmB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * List of error codes built into the react kit
3
+ * @author Gabe Abrams
4
+ */
5
+ declare enum ReactKitErrorCode {
6
+ NoResponse = "DRK1",
7
+ NoCode = "DRK2"
8
+ }
9
+ export default ReactKitErrorCode;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // Highest error code = DRK2
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /**
5
+ * List of error codes built into the react kit
6
+ * @author Gabe Abrams
7
+ */
8
+ var ReactKitErrorCode;
9
+ (function (ReactKitErrorCode) {
10
+ ReactKitErrorCode["NoResponse"] = "DRK1";
11
+ ReactKitErrorCode["NoCode"] = "DRK2";
12
+ })(ReactKitErrorCode || (ReactKitErrorCode = {}));
13
+ exports.default = ReactKitErrorCode;
14
+ //# sourceMappingURL=ReactKitErrorCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactKitErrorCode.js","sourceRoot":"","sources":["../../src/types/ReactKitErrorCode.tsx"],"names":[],"mappings":";AAAA,4BAA4B;;AAE5B;;;GAGG;AACH,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,wCAAmB,CAAA;IACnB,oCAAe,CAAA;AACjB,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,kBAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "2.0.0",
3
+ "version": "2.0.3",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "scripts": {
@@ -18,6 +18,7 @@
18
18
  "@fortawesome/free-regular-svg-icons": "^6.1.1",
19
19
  "@fortawesome/free-solid-svg-icons": "^6.1.1",
20
20
  "@fortawesome/react-fontawesome": "^0.1.18",
21
+ "caccl": "^2.0.0-beta.39",
21
22
  "react-bootstrap": "^2.2.3"
22
23
  },
23
24
  "devDependencies": {
@@ -31,7 +32,6 @@
31
32
  "eslint-plugin-jsx-a11y": "^6.5.1",
32
33
  "eslint-plugin-react": "^7.29.4",
33
34
  "eslint-plugin-react-hooks": "^4.4.0",
34
- "sass": "^1.49.11",
35
35
  "typescript": "^4.6.3"
36
36
  }
37
37
  }
@@ -0,0 +1,127 @@
1
+ /**
2
+ * A wrapper for the entire React app that adds global functionality like
3
+ * handling for fatal error messages
4
+ * @author Gabe Abrams
5
+ */
6
+
7
+ // Import React
8
+ import React, { useState } from 'react';
9
+
10
+ // Import shared components
11
+ import ErrorBox from './ErrorBox';
12
+
13
+ // Import shared types
14
+ import ReactKitErrorCode from '../types/ReactKitErrorCode';
15
+
16
+ // Import custom errors
17
+ import ErrorWithCode from '../errors/ErrorWithCode';
18
+
19
+ /*------------------------------------------------------------------------*/
20
+ /* Props */
21
+ /*------------------------------------------------------------------------*/
22
+
23
+ type Props = {
24
+ // The entire app
25
+ children: React.ReactNode,
26
+ // True if this app is a dark-themed app
27
+ dark?: boolean,
28
+ };
29
+
30
+ /*------------------------------------------------------------------------*/
31
+ /* Static Helpers */
32
+ /*------------------------------------------------------------------------*/
33
+
34
+ // Stored copies of setters
35
+ let setFatalErrorMessage: (message: string) => void;
36
+ let setFatalErrorCode: (code: string) => void;
37
+
38
+ /**
39
+ * Show a fatal error message
40
+ * @author Gabe Abrams
41
+ * @param error the error to show
42
+ */
43
+ export const showFatalError = (error: any) => {
44
+ // Determine message and code
45
+ const message: string = (
46
+ typeof error === 'string'
47
+ ? error.trim()
48
+ : String(error.message ?? 'An unknown error occurred.')
49
+ );
50
+ const code: string = (
51
+ typeof error === 'string'
52
+ ? ReactKitErrorCode.NoCode
53
+ : String(error.code ?? ReactKitErrorCode.NoCode)
54
+ );
55
+
56
+ // Handle case where app hasn't loaded
57
+ if (!setFatalErrorMessage || !setFatalErrorCode) {
58
+ return alert(`An error has occurred: ${message} (code: ${code}). Please contact support.`);
59
+ }
60
+
61
+ // Use setters
62
+ setFatalErrorMessage(message);
63
+ setFatalErrorCode(code);
64
+ };
65
+
66
+ /*------------------------------------------------------------------------*/
67
+ /* Component */
68
+ /*------------------------------------------------------------------------*/
69
+
70
+ const AppWrapper = (props: Props) => {
71
+ /*------------------------------------------------------------------------*/
72
+ /* Setup */
73
+ /*------------------------------------------------------------------------*/
74
+
75
+ /* -------------- Props ------------- */
76
+
77
+ const {
78
+ children,
79
+ dark,
80
+ } = props;
81
+
82
+ /* -------------- State ------------- */
83
+
84
+ // Fatal error
85
+ const [fatalErrorMessage, setFatalErrorMessageInner] = useState(null);
86
+ setFatalErrorMessage = setFatalErrorMessageInner;
87
+ const [fatalErrorCode, setFatalErrorCodeInner] = useState(null);
88
+ setFatalErrorCode = setFatalErrorCodeInner;
89
+
90
+ /*----------------------------------------*/
91
+ /* Main UI */
92
+ /*----------------------------------------*/
93
+
94
+ // Show error
95
+ if (fatalErrorMessage || fatalErrorCode) {
96
+ // Re-encapsulate in an error
97
+ const error = new ErrorWithCode(
98
+ fatalErrorMessage,
99
+ fatalErrorCode,
100
+ );
101
+
102
+ return (
103
+ <div
104
+ style={{
105
+ display: 'block',
106
+ width: '100vw',
107
+ minHeight: '100vh',
108
+ paddingTop: '10rem',
109
+ }}
110
+ >
111
+ <ErrorBox
112
+ error={error}
113
+ />
114
+ </div>
115
+ );
116
+ }
117
+
118
+ // Show the app itself
119
+ return children;
120
+ };
121
+
122
+ /*------------------------------------------------------------------------*/
123
+ /* Wrap Up */
124
+ /*------------------------------------------------------------------------*/
125
+
126
+ // Export component
127
+ export default AppWrapper;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Displays an error
3
+ * @author Gabe Abrams
4
+ */
5
+
6
+ // Import React
7
+ import React from 'react';
8
+
9
+ // Import FontAwesome Icons
10
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11
+ import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
12
+
13
+ // Import shared types
14
+ import ReactKitErrorCode from '../types/ReactKitErrorCode';
15
+
16
+ /*------------------------------------------------------------------------*/
17
+ /* Types */
18
+ /*------------------------------------------------------------------------*/
19
+
20
+ type Props = {
21
+ // Error to display
22
+ error: any,
23
+ // Handler for close,
24
+ onClose?: () => void,
25
+ };
26
+
27
+ /*------------------------------------------------------------------------*/
28
+ /* Component */
29
+ /*------------------------------------------------------------------------*/
30
+
31
+ const ErrorBox: React.FC<Props> = (props) => {
32
+ /*------------------------------------------------------------------------*/
33
+ /* Setup */
34
+ /*------------------------------------------------------------------------*/
35
+
36
+ /* -------------- Props ------------- */
37
+
38
+ const {
39
+ error,
40
+ onClose,
41
+ } = props;
42
+
43
+ /*------------------------------------------------------------------------*/
44
+ /* Render */
45
+ /*------------------------------------------------------------------------*/
46
+
47
+ // Determine error text
48
+ const errorText: string = (
49
+ typeof error === 'string'
50
+ ? error.trim()
51
+ : String(error.message || 'An unknown error occurred. Please contact support.')
52
+ );
53
+
54
+ // Error code box
55
+ let errorCodeBox;
56
+ if (error && (error as any).code) {
57
+ errorCodeBox = (
58
+ <span>
59
+ {' '}
60
+ <span
61
+ style={{
62
+ backgroundColor: 'white',
63
+ borderRadius: '5px',
64
+ paddingLeft: '3px',
65
+ paddingRight: '3px',
66
+ color: '#DC4150',
67
+ fontVariant: 'small-caps',
68
+ fontSize: '80%',
69
+ whiteSpace: 'nowrap',
70
+ }}
71
+ >
72
+ code:
73
+ {' '}
74
+ {String((error as any).code ?? ReactKitErrorCode.NoCode).toUpperCase()}
75
+ </span>
76
+ </span>
77
+ );
78
+ }
79
+
80
+ // Main UI
81
+ return (
82
+ <div
83
+ className="alert alert-danger text-center"
84
+ style={{
85
+ maxWidth: '650px',
86
+ margin: 'auto',
87
+ }}
88
+ >
89
+ <h4 className="mb-1">
90
+ <FontAwesomeIcon
91
+ icon={faExclamationTriangle}
92
+ className="me-2"
93
+ />
94
+ An Error Occurred
95
+ </h4>
96
+ <div>
97
+ {errorText}
98
+ {errorCodeBox}
99
+ </div>
100
+ {onClose && (
101
+ <div className="mt-2">
102
+ <button
103
+ type="button"
104
+ className="btn btn-light"
105
+ aria-label="dismiss error and close this activity or view"
106
+ onClick={onClose}
107
+ >
108
+ Close
109
+ </button>
110
+ </div>
111
+ )}
112
+ </div>
113
+ );
114
+ };
115
+
116
+ /*------------------------------------------------------------------------*/
117
+ /* Wrap Up */
118
+ /*------------------------------------------------------------------------*/
119
+
120
+ // Export component
121
+ export default ErrorBox;
@@ -7,8 +7,62 @@
7
7
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
8
  import { faCircle } from '@fortawesome/free-solid-svg-icons';
9
9
 
10
- // Import style
11
- import './LoadingSpinner.scss';
10
+ /*------------------------------------------------------------------------*/
11
+ /* Style */
12
+ /*------------------------------------------------------------------------*/
13
+
14
+ const style = `
15
+ /* Blips */
16
+ .LoadingSpinner-blip-1,
17
+ .LoadingSpinner-blip-2,
18
+ .LoadingSpinner-blip-3,
19
+ .LoadingSpinner-blip-4 {
20
+ font-size: 25px;
21
+ opacity: 0.6;
22
+ margin-top: 20px;
23
+ margin-bottom: 20px;
24
+ }
25
+
26
+ /* First Blip */
27
+ .LoadingSpinner-blip-1 {
28
+ animation: LoadingSpinner-pop-animation 2s infinite;
29
+ }
30
+
31
+ /* Second Blip */
32
+ .LoadingSpinner-blip-2 {
33
+ animation: LoadingSpinner-pop-animation 2s infinite;
34
+ -webkit-animation-delay: 0.1s;
35
+ animation-delay: 0.1s;
36
+ }
37
+
38
+ /* Third Blip */
39
+ .LoadingSpinner-blip-3 {
40
+ animation: LoadingSpinner-pop-animation 2s infinite;
41
+ animation-delay: 0.2s;
42
+ }
43
+
44
+ /* Fourth Blip */
45
+ .LoadingSpinner-blip-4 {
46
+ animation: LoadingSpinner-pop-animation 2s infinite;
47
+ animation-delay: 0.3s;
48
+ }
49
+
50
+ /* Pop Animation for Each Blip */
51
+ @keyframes LoadingSpinner-pop-animation {
52
+ 0% {
53
+ transform: scale(1.0);
54
+ }
55
+ 10% {
56
+ transform: scale(1.5);
57
+ }
58
+ 30% {
59
+ transform: scale(1.0);
60
+ }
61
+ 100% {
62
+ transform: scale(1.0);
63
+ }
64
+ }
65
+ `;
12
66
 
13
67
  /*------------------------------------------------------------------------*/
14
68
  /* Component */
@@ -22,6 +76,7 @@ const LoadingSpinner = () => {
22
76
  // Add all four blips to a container
23
77
  return (
24
78
  <div className="text-center LoadingSpinner LoadingSpinner-container">
79
+ <style>{style}</style>
25
80
  <FontAwesomeIcon
26
81
  icon={faCircle}
27
82
  className="LoadingSpinner-blip-1 me-1"
@@ -13,6 +13,61 @@ import waitMs from '../helpers/waitMs';
13
13
  // Import types
14
14
  import Variant from '../types/Variant';
15
15
 
16
+ /*------------------------------------------------------------------------*/
17
+ /* Style */
18
+ /*------------------------------------------------------------------------*/
19
+
20
+ 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
+ `;
70
+
16
71
  /*------------------------------------------------------------------------*/
17
72
  /* Constants */
18
73
  /*------------------------------------------------------------------------*/
@@ -355,6 +410,7 @@ const Modal: (
355
410
  backdropClassName="Modal-backdrop"
356
411
  centered
357
412
  >
413
+ <style>{style}</style>
358
414
  {title && (
359
415
  <BootstrapModal.Header
360
416
  closeButton={!!onClose}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * An error with a code
3
+ * @author Gabe Abrams
4
+ */
5
+ class ErrorWithCode extends Error {
6
+ code: string;
7
+
8
+ constructor(message: string, code: string) {
9
+ super(message);
10
+ this.name = 'ErrorWithCode';
11
+ this.code = code;
12
+ }
13
+ }
14
+
15
+ export default ErrorWithCode;
@@ -0,0 +1,3 @@
1
+ import { showFatalError } from '../components/AppWrapper';
2
+
3
+ export default showFatalError;
@@ -0,0 +1,59 @@
1
+ // Initialize caccl
2
+ import { sendRequest } from 'caccl/client';
3
+
4
+ // Import custom error
5
+ import ErrorWithCode from '../errors/ErrorWithCode';
6
+ import ReactKitErrorCode from '../types/ReactKitErrorCode';
7
+
8
+ /**
9
+ * Visit an endpoint on the server
10
+ * @author Gabe Abrams
11
+ * @param opts object containing all arguments
12
+ * @param opts.path - the path of the server endpoint
13
+ * @param [opts.method=GET] - the method of the endpoint
14
+ * @param [opts.params] - query/body parameters to include
15
+ * @returns response from server
16
+ */
17
+ const visitServerEndpoint = async (
18
+ opts: {
19
+ path: string,
20
+ method?: ('GET' | 'POST' | 'DELETE' | 'PUT'),
21
+ params?: { [key in string]: any },
22
+ },
23
+ ): Promise<any> => {
24
+ // Send the request
25
+ const response = await sendRequest({
26
+ path: opts.path,
27
+ method: opts.method,
28
+ params: opts.params,
29
+ });
30
+
31
+ // Check for failure
32
+ if (!response || !response.body) {
33
+ throw new ErrorWithCode(
34
+ 'We didn\'t get a response from the server. Please check your internet connection.',
35
+ ReactKitErrorCode.NoResponse,
36
+ );
37
+ }
38
+ if (!response.body.success) {
39
+ // Other errors
40
+ throw new ErrorWithCode(
41
+ (
42
+ response.body.message
43
+ || 'An unknown error occurred. Please contact an admin.'
44
+ ),
45
+ (
46
+ response.body.code
47
+ || ReactKitErrorCode.NoCode
48
+ ),
49
+ );
50
+ }
51
+
52
+ // Success! Extract the body
53
+ const { body } = response.body;
54
+
55
+ // Return
56
+ return body;
57
+ };
58
+
59
+ export default visitServerEndpoint;
@@ -0,0 +1,12 @@
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
+ }
11
+
12
+ export default ReactKitErrorCode;
@@ -1,50 +0,0 @@
1
- /* Blips */
2
- .LoadingSpinner-blip-1,
3
- .LoadingSpinner-blip-2,
4
- .LoadingSpinner-blip-3,
5
- .LoadingSpinner-blip-4 {
6
- font-size: 25px;
7
- opacity: 0.6;
8
- margin-top: 20px;
9
- margin-bottom: 20px;
10
- }
11
-
12
- /* First Blip */
13
- .LoadingSpinner-blip-1 {
14
- animation: LoadingSpinner-pop-animation 2s infinite;
15
- }
16
-
17
- /* Second Blip */
18
- .LoadingSpinner-blip-2 {
19
- animation: LoadingSpinner-pop-animation 2s infinite;
20
- -webkit-animation-delay: 0.1s;
21
- animation-delay: 0.1s;
22
- }
23
-
24
- /* Third Blip */
25
- .LoadingSpinner-blip-3 {
26
- animation: LoadingSpinner-pop-animation 2s infinite;
27
- animation-delay: 0.2s;
28
- }
29
-
30
- /* Fourth Blip */
31
- .LoadingSpinner-blip-4 {
32
- animation: LoadingSpinner-pop-animation 2s infinite;
33
- animation-delay: 0.3s;
34
- }
35
-
36
- /* Pop Animation for Each Blip */
37
- @keyframes LoadingSpinner-pop-animation {
38
- 0% {
39
- transform: scale(1.0);
40
- }
41
- 10% {
42
- transform: scale(1.5);
43
- }
44
- 30% {
45
- transform: scale(1.0);
46
- }
47
- 100% {
48
- transform: scale(1.0);
49
- }
50
- }
@@ -1,48 +0,0 @@
1
- /* More opaque backdrop */
2
- .Modal-backdrop {
3
- background-color: black !important;
4
- opacity: 0.8 !important;
5
- z-index: 10000000 !important;
6
- }
7
-
8
- /* Customize the modal header and body */
9
- .modal-header {
10
- /* Dark theme */
11
- background-color: #222 !important;
12
- color: white !important;
13
-
14
- /* Border */
15
- border: 1px solid #545454 !important;
16
- }
17
- .modal-body {
18
- /* Dark theme */
19
- background-color: #222 !important;
20
- color: white !important;
21
-
22
- /* Border */
23
- border-top: 0 !important;
24
- border-left: 1px solid #545454 !important;
25
- border-bottom: 1px solid #545454 !important;
26
- border-right: 1px solid #545454 !important;
27
- border-bottom-left-radius: 3px;
28
- border-bottom-right-radius: 3px;
29
- }
30
-
31
- /* Create our own animation */
32
- .modal-content {
33
- animation-name: Modal-drop-in;
34
- animation-duration: 0.4s;
35
- animation-iteration-count: 1;
36
- animation-fill-mode: forwards;
37
- animation-timing-function: ease-out;
38
- }
39
- @keyframes Modal-drop-in {
40
- 0% {
41
- transform: scale(0.8);
42
- opacity: 0.5;
43
- }
44
- 100% {
45
- transform: scale(1);
46
- opacity: 1;
47
- }
48
- }