dce-reactkit 2.0.12 → 3.0.0-beta.1
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 +36424 -0
- package/dist/cjs/index.js.map +1 -0
- package/{lib → dist/cjs/types}/components/AppWrapper.d.ts +9 -4
- package/{lib → dist/cjs/types}/components/ErrorBox.d.ts +0 -0
- package/{lib → dist/cjs/types}/components/LoadingSpinner.d.ts +1 -0
- package/{lib → dist/cjs/types}/components/Modal.d.ts +5 -36
- package/{lib → dist/cjs/types}/components/TabBox.d.ts +0 -0
- package/{lib → dist/cjs/types}/errors/ErrorWithCode.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/abbreviate.d.ts +1 -0
- package/{lib → dist/cjs/types}/helpers/avg.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/ceilToNumDecimals.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/floorToNumDecimals.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/forceNumIntoBounds.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/padDecimalZeros.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/padZerosLeft.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/roundToNumDecimals.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/sum.d.ts +0 -0
- package/{lib → dist/cjs/types}/helpers/waitMs.d.ts +0 -0
- package/dist/cjs/types/index.d.ts +22 -0
- package/dist/cjs/types/types/ModalButtonType.d.ts +17 -0
- package/dist/cjs/types/types/ModalSize.d.ts +11 -0
- package/dist/cjs/types/types/ModalType.d.ts +16 -0
- package/{lib → dist/cjs/types}/types/ReactKitErrorCode.d.ts +0 -0
- package/{lib → dist/cjs/types}/types/Variant.d.ts +0 -0
- package/dist/esm/index.js +36375 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/AppWrapper.d.ts +40 -0
- package/dist/esm/types/components/ErrorBox.d.ts +12 -0
- package/dist/esm/types/components/LoadingSpinner.d.ts +7 -0
- package/dist/esm/types/components/Modal.d.ts +40 -0
- package/dist/esm/types/components/TabBox.d.ts +11 -0
- package/dist/esm/types/errors/ErrorWithCode.d.ts +9 -0
- package/dist/esm/types/helpers/abbreviate.d.ts +10 -0
- package/dist/esm/types/helpers/avg.d.ts +8 -0
- package/{src/helpers/ceilToNumDecimals.tsx → dist/esm/types/helpers/ceilToNumDecimals.d.ts} +1 -5
- package/{src/helpers/floorToNumDecimals.tsx → dist/esm/types/helpers/floorToNumDecimals.d.ts} +1 -5
- package/{src/helpers/forceNumIntoBounds.tsx → dist/esm/types/helpers/forceNumIntoBounds.d.ts} +1 -10
- package/dist/esm/types/helpers/padDecimalZeros.d.ts +10 -0
- package/{src/helpers/padZerosLeft.tsx → dist/esm/types/helpers/padZerosLeft.d.ts} +1 -13
- package/{src/helpers/roundToNumDecimals.tsx → dist/esm/types/helpers/roundToNumDecimals.d.ts} +1 -5
- package/{src/helpers/sum.tsx → dist/esm/types/helpers/sum.d.ts} +1 -9
- package/{src/helpers/waitMs.tsx → dist/esm/types/helpers/waitMs.d.ts} +1 -6
- package/dist/esm/types/index.d.ts +22 -0
- package/dist/esm/types/types/ModalButtonType.d.ts +17 -0
- package/dist/esm/types/types/ModalSize.d.ts +11 -0
- package/dist/esm/types/types/ModalType.d.ts +16 -0
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +13 -0
- package/dist/esm/types/types/Variant.d.ts +15 -0
- package/dist/index.d.ts +274 -0
- package/package.json +23 -22
- package/.eslintrc.js +0 -95
- package/lib/components/AppWrapper.js +0 -277
- package/lib/components/AppWrapper.js.map +0 -1
- package/lib/components/ErrorBox.js +0 -65
- package/lib/components/ErrorBox.js.map +0 -1
- package/lib/components/LoadingSpinner.js +0 -41
- package/lib/components/LoadingSpinner.js.map +0 -1
- package/lib/components/Modal.js +0 -321
- package/lib/components/Modal.js.map +0 -1
- package/lib/components/TabBox.js +0 -42
- package/lib/components/TabBox.js.map +0 -1
- package/lib/errors/ErrorWithCode.js +0 -33
- package/lib/errors/ErrorWithCode.js.map +0 -1
- package/lib/helpers/abbreviate.js +0 -21
- package/lib/helpers/abbreviate.js.map +0 -1
- package/lib/helpers/alert.d.ts +0 -2
- package/lib/helpers/alert.js +0 -6
- package/lib/helpers/alert.js.map +0 -1
- package/lib/helpers/avg.js +0 -24
- package/lib/helpers/avg.js.map +0 -1
- package/lib/helpers/ceilToNumDecimals.js +0 -15
- package/lib/helpers/ceilToNumDecimals.js.map +0 -1
- package/lib/helpers/confirm.d.ts +0 -2
- package/lib/helpers/confirm.js +0 -6
- package/lib/helpers/confirm.js.map +0 -1
- package/lib/helpers/floorToNumDecimals.js +0 -15
- package/lib/helpers/floorToNumDecimals.js.map +0 -1
- package/lib/helpers/forceNumIntoBounds.js +0 -15
- package/lib/helpers/forceNumIntoBounds.js.map +0 -1
- package/lib/helpers/handleError.d.ts +0 -14
- package/lib/helpers/handleError.js +0 -54
- package/lib/helpers/handleError.js.map +0 -1
- package/lib/helpers/handleSuccess.d.ts +0 -8
- package/lib/helpers/handleSuccess.js +0 -20
- package/lib/helpers/handleSuccess.js.map +0 -1
- package/lib/helpers/padDecimalZeros.js +0 -30
- package/lib/helpers/padDecimalZeros.js.map +0 -1
- package/lib/helpers/padZerosLeft.js +0 -21
- package/lib/helpers/padZerosLeft.js.map +0 -1
- package/lib/helpers/parseRequest.d.ts +0 -21
- package/lib/helpers/parseRequest.js +0 -240
- package/lib/helpers/parseRequest.js.map +0 -1
- package/lib/helpers/roundToNumDecimals.js +0 -15
- package/lib/helpers/roundToNumDecimals.js.map +0 -1
- package/lib/helpers/showFatalError.d.ts +0 -2
- package/lib/helpers/showFatalError.js +0 -6
- package/lib/helpers/showFatalError.js.map +0 -1
- package/lib/helpers/sum.js +0 -15
- package/lib/helpers/sum.js.map +0 -1
- package/lib/helpers/visitServerEndpoint.d.ts +0 -23
- package/lib/helpers/visitServerEndpoint.js +0 -135
- package/lib/helpers/visitServerEndpoint.js.map +0 -1
- package/lib/helpers/waitMs.js +0 -55
- package/lib/helpers/waitMs.js.map +0 -1
- package/lib/types/ParamType.d.ts +0 -17
- package/lib/types/ParamType.js +0 -21
- package/lib/types/ParamType.js.map +0 -1
- package/lib/types/ReactKitErrorCode.js +0 -18
- package/lib/types/ReactKitErrorCode.js.map +0 -1
- package/lib/types/Variant.js +0 -19
- package/lib/types/Variant.js.map +0 -1
- package/src/components/AppWrapper.tsx +0 -369
- package/src/components/ErrorBox.tsx +0 -124
- package/src/components/LoadingSpinner.tsx +0 -105
- package/src/components/Modal.tsx +0 -461
- package/src/components/TabBox.tsx +0 -136
- package/src/errors/ErrorWithCode.tsx +0 -15
- package/src/helpers/abbreviate.tsx +0 -23
- package/src/helpers/alert.tsx +0 -5
- package/src/helpers/avg.tsx +0 -22
- package/src/helpers/confirm.tsx +0 -5
- package/src/helpers/handleError.ts +0 -65
- package/src/helpers/handleSuccess.ts +0 -18
- package/src/helpers/padDecimalZeros.tsx +0 -32
- package/src/helpers/parseRequest.ts +0 -299
- package/src/helpers/showFatalError.tsx +0 -5
- package/src/helpers/visitServerEndpoint.tsx +0 -110
- package/src/types/ParamType.ts +0 -18
- package/src/types/ReactKitErrorCode.tsx +0 -16
- package/src/types/Variant.tsx +0 -16
- package/tsconfig.json +0 -24
package/lib/components/Modal.js
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
var _a, _b;
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
55
|
-
/**
|
|
56
|
-
* A generic popup modal
|
|
57
|
-
* @author Gabe Abrams
|
|
58
|
-
*/
|
|
59
|
-
// Import React
|
|
60
|
-
var react_1 = require("react");
|
|
61
|
-
// Import other components
|
|
62
|
-
var Modal_1 = __importDefault(require("react-bootstrap/Modal"));
|
|
63
|
-
var waitMs_1 = __importDefault(require("../helpers/waitMs"));
|
|
64
|
-
// Import types
|
|
65
|
-
var Variant_1 = __importDefault(require("../types/Variant"));
|
|
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
|
-
/*------------------------------------------------------------------------*/
|
|
71
|
-
/* Constants */
|
|
72
|
-
/*------------------------------------------------------------------------*/
|
|
73
|
-
// Constants
|
|
74
|
-
var MS_TO_ANIMATE = 400; // Time to animate in/out (defined by bootstrap)
|
|
75
|
-
var MS_ANIMATE_IN_DELAY = 10;
|
|
76
|
-
// Time to wait before animating in (must be >0 or animation won't trigger)
|
|
77
|
-
// Modal types
|
|
78
|
-
var ModalType;
|
|
79
|
-
(function (ModalType) {
|
|
80
|
-
ModalType["Okay"] = "okay";
|
|
81
|
-
ModalType["OkayCancel"] = "okay-cancel";
|
|
82
|
-
ModalType["YesNo"] = "yes-no";
|
|
83
|
-
ModalType["YesNoCancel"] = "yes-no-cancel";
|
|
84
|
-
ModalType["AbandonGoBack"] = "abandon-goBack";
|
|
85
|
-
ModalType["ImSureCancel"] = "imSure-cancel";
|
|
86
|
-
ModalType["DeleteCancel"] = "delete-cancel";
|
|
87
|
-
ModalType["ConfirmCancel"] = "confirm-cancel";
|
|
88
|
-
ModalType["NoButtons"] = "-";
|
|
89
|
-
})(ModalType || (ModalType = {}));
|
|
90
|
-
// Modal sizes
|
|
91
|
-
var ModalSize;
|
|
92
|
-
(function (ModalSize) {
|
|
93
|
-
ModalSize["Small"] = "sm";
|
|
94
|
-
ModalSize["Medium"] = "md";
|
|
95
|
-
ModalSize["Large"] = "lg";
|
|
96
|
-
ModalSize["ExtraLarge"] = "xl";
|
|
97
|
-
})(ModalSize || (ModalSize = {}));
|
|
98
|
-
// Button types
|
|
99
|
-
var ButtonType;
|
|
100
|
-
(function (ButtonType) {
|
|
101
|
-
ButtonType["Okay"] = "okay";
|
|
102
|
-
ButtonType["Cancel"] = "cancel";
|
|
103
|
-
ButtonType["Yes"] = "yes";
|
|
104
|
-
ButtonType["No"] = "no";
|
|
105
|
-
ButtonType["Abandon"] = "abandon";
|
|
106
|
-
ButtonType["GoBack"] = "goBack";
|
|
107
|
-
ButtonType["Continue"] = "continue";
|
|
108
|
-
ButtonType["ImSure"] = "imSure";
|
|
109
|
-
ButtonType["Delete"] = "delete";
|
|
110
|
-
ButtonType["Confirm"] = "confirm";
|
|
111
|
-
})(ButtonType || (ButtonType = {}));
|
|
112
|
-
// Modal type to list of buttons
|
|
113
|
-
var modalTypeToButtonTypes = (_a = {},
|
|
114
|
-
_a[ModalType.Okay] = [
|
|
115
|
-
ButtonType.Okay,
|
|
116
|
-
],
|
|
117
|
-
_a[ModalType.OkayCancel] = [
|
|
118
|
-
ButtonType.Okay,
|
|
119
|
-
ButtonType.Cancel,
|
|
120
|
-
],
|
|
121
|
-
_a[ModalType.YesNo] = [
|
|
122
|
-
ButtonType.Yes,
|
|
123
|
-
ButtonType.No,
|
|
124
|
-
],
|
|
125
|
-
_a[ModalType.YesNoCancel] = [
|
|
126
|
-
ButtonType.Yes,
|
|
127
|
-
ButtonType.No,
|
|
128
|
-
ButtonType.Cancel,
|
|
129
|
-
],
|
|
130
|
-
_a[ModalType.AbandonGoBack] = [
|
|
131
|
-
ButtonType.Abandon,
|
|
132
|
-
ButtonType.GoBack,
|
|
133
|
-
],
|
|
134
|
-
_a[ModalType.ImSureCancel] = [
|
|
135
|
-
ButtonType.ImSure,
|
|
136
|
-
ButtonType.Cancel,
|
|
137
|
-
],
|
|
138
|
-
_a[ModalType.DeleteCancel] = [
|
|
139
|
-
ButtonType.Delete,
|
|
140
|
-
ButtonType.Cancel,
|
|
141
|
-
],
|
|
142
|
-
_a[ModalType.ConfirmCancel] = [
|
|
143
|
-
ButtonType.Confirm,
|
|
144
|
-
ButtonType.Cancel,
|
|
145
|
-
],
|
|
146
|
-
_a);
|
|
147
|
-
// Button type styling and labels
|
|
148
|
-
var buttonTypeToLabelAndVariant = (_b = {},
|
|
149
|
-
_b[ButtonType.Okay] = {
|
|
150
|
-
label: 'Okay',
|
|
151
|
-
variant: Variant_1.default.Dark,
|
|
152
|
-
},
|
|
153
|
-
_b[ButtonType.Cancel] = {
|
|
154
|
-
label: 'Cancel',
|
|
155
|
-
variant: Variant_1.default.Secondary,
|
|
156
|
-
},
|
|
157
|
-
_b[ButtonType.Yes] = {
|
|
158
|
-
label: 'Yes',
|
|
159
|
-
variant: Variant_1.default.Dark,
|
|
160
|
-
},
|
|
161
|
-
_b[ButtonType.No] = {
|
|
162
|
-
label: 'No',
|
|
163
|
-
variant: Variant_1.default.Secondary,
|
|
164
|
-
},
|
|
165
|
-
_b[ButtonType.Abandon] = {
|
|
166
|
-
label: 'Abandon Changes',
|
|
167
|
-
variant: Variant_1.default.Warning,
|
|
168
|
-
},
|
|
169
|
-
_b[ButtonType.GoBack] = {
|
|
170
|
-
label: 'Go Back',
|
|
171
|
-
variant: Variant_1.default.Secondary,
|
|
172
|
-
},
|
|
173
|
-
_b[ButtonType.Continue] = {
|
|
174
|
-
label: 'Continue',
|
|
175
|
-
variant: Variant_1.default.Dark,
|
|
176
|
-
},
|
|
177
|
-
_b[ButtonType.ImSure] = {
|
|
178
|
-
label: 'I am sure',
|
|
179
|
-
variant: Variant_1.default.Warning,
|
|
180
|
-
},
|
|
181
|
-
_b[ButtonType.Delete] = {
|
|
182
|
-
label: 'Yes, Delete',
|
|
183
|
-
variant: Variant_1.default.Danger,
|
|
184
|
-
},
|
|
185
|
-
_b[ButtonType.Confirm] = {
|
|
186
|
-
label: 'Confirm',
|
|
187
|
-
variant: Variant_1.default.Dark,
|
|
188
|
-
},
|
|
189
|
-
_b);
|
|
190
|
-
/*------------------------------------------------------------------------*/
|
|
191
|
-
/* Component */
|
|
192
|
-
/*------------------------------------------------------------------------*/
|
|
193
|
-
var Modal = function (props) {
|
|
194
|
-
/*------------------------------------------------------------------------*/
|
|
195
|
-
/* Setup */
|
|
196
|
-
/*------------------------------------------------------------------------*/
|
|
197
|
-
var _a;
|
|
198
|
-
/* -------------- Props ------------- */
|
|
199
|
-
var _b = props.type, type = _b === void 0 ? ModalType.NoButtons : _b, _c = props.size, size = _c === void 0 ? ModalSize.Large : _c, title = props.title, children = props.children, onClose = props.onClose, dontAllowBackdropExit = props.dontAllowBackdropExit, onTopOfOtherModals = props.onTopOfOtherModals;
|
|
200
|
-
/* -------------- State ------------- */
|
|
201
|
-
// If true, the modal is shown
|
|
202
|
-
var _d = (0, react_1.useState)(false), visible = _d[0], setVisible = _d[1];
|
|
203
|
-
// True if currently animating in
|
|
204
|
-
var _e = (0, react_1.useState)(false), animatingIn = _e[0], setAnimatingIn = _e[1];
|
|
205
|
-
/*------------------------------------------------------------------------*/
|
|
206
|
-
/* Lifecycle Functions */
|
|
207
|
-
/*------------------------------------------------------------------------*/
|
|
208
|
-
/**
|
|
209
|
-
* Mount
|
|
210
|
-
* @author Gabe Abrams
|
|
211
|
-
*/
|
|
212
|
-
(0, react_1.useEffect)(function () {
|
|
213
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
214
|
-
return __generator(this, function (_a) {
|
|
215
|
-
switch (_a.label) {
|
|
216
|
-
case 0:
|
|
217
|
-
// Start the component animating in
|
|
218
|
-
return [4 /*yield*/, (0, waitMs_1.default)(MS_ANIMATE_IN_DELAY)];
|
|
219
|
-
case 1:
|
|
220
|
-
// Start the component animating in
|
|
221
|
-
_a.sent();
|
|
222
|
-
setAnimatingIn(true);
|
|
223
|
-
// Wait and then set visible to true
|
|
224
|
-
return [4 /*yield*/, (0, waitMs_1.default)(MS_TO_ANIMATE)];
|
|
225
|
-
case 2:
|
|
226
|
-
// Wait and then set visible to true
|
|
227
|
-
_a.sent();
|
|
228
|
-
setVisible(true);
|
|
229
|
-
return [2 /*return*/];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}); })();
|
|
233
|
-
}, []);
|
|
234
|
-
/*------------------------------------------------------------------------*/
|
|
235
|
-
/* Component Functions */
|
|
236
|
-
/*------------------------------------------------------------------------*/
|
|
237
|
-
/**
|
|
238
|
-
* Handles the closing of the modal
|
|
239
|
-
* @author Gabe Abrams
|
|
240
|
-
* @param buttonType the button that was clicked when closing the
|
|
241
|
-
* modal
|
|
242
|
-
*/
|
|
243
|
-
var handleClose = function (buttonType) { return __awaiter(void 0, void 0, void 0, function () {
|
|
244
|
-
return __generator(this, function (_a) {
|
|
245
|
-
switch (_a.label) {
|
|
246
|
-
case 0:
|
|
247
|
-
// Don't close if no handler
|
|
248
|
-
if (!onClose) {
|
|
249
|
-
return [2 /*return*/];
|
|
250
|
-
}
|
|
251
|
-
// Don't close if animating in
|
|
252
|
-
if (animatingIn) {
|
|
253
|
-
return [2 /*return*/];
|
|
254
|
-
}
|
|
255
|
-
// Don't close if already closed
|
|
256
|
-
if (!visible) {
|
|
257
|
-
return [2 /*return*/];
|
|
258
|
-
}
|
|
259
|
-
// Update the state
|
|
260
|
-
setVisible(false);
|
|
261
|
-
// Call the handler after the modal has animated out
|
|
262
|
-
return [4 /*yield*/, (0, waitMs_1.default)(MS_TO_ANIMATE)];
|
|
263
|
-
case 1:
|
|
264
|
-
// Call the handler after the modal has animated out
|
|
265
|
-
_a.sent();
|
|
266
|
-
onClose(buttonType);
|
|
267
|
-
return [2 /*return*/];
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
}); };
|
|
271
|
-
/*------------------------------------------------------------------------*/
|
|
272
|
-
/* Render */
|
|
273
|
-
/*------------------------------------------------------------------------*/
|
|
274
|
-
/*----------------------------------------*/
|
|
275
|
-
/* Footer */
|
|
276
|
-
/*----------------------------------------*/
|
|
277
|
-
// Get list of buttons for this modal type
|
|
278
|
-
var buttonTypes = (_a = modalTypeToButtonTypes[type]) !== null && _a !== void 0 ? _a : [];
|
|
279
|
-
// Create buttons
|
|
280
|
-
var buttons = buttonTypes.map(function (buttonType, i) {
|
|
281
|
-
// Get default style
|
|
282
|
-
var _a = buttonTypeToLabelAndVariant[buttonType], label = _a.label, variant = _a.variant;
|
|
283
|
-
// Override with customizations
|
|
284
|
-
if (props["".concat(buttonType, "Label")]) {
|
|
285
|
-
label = props["".concat(buttonType, "Label")];
|
|
286
|
-
}
|
|
287
|
-
if (props["".concat(buttonType, "Variant")]) {
|
|
288
|
-
variant = props["".concat(buttonType, "Variant")];
|
|
289
|
-
}
|
|
290
|
-
// Check if this button is last
|
|
291
|
-
var last = (i === buttonTypes.length - 1);
|
|
292
|
-
// Create the button
|
|
293
|
-
return ((0, jsx_runtime_1.jsx)("button", __assign({ type: "button", className: "Modal-".concat(buttonType, "-button btn btn-").concat(variant, " ").concat(last ? '' : 'mr-1'), onClick: function () {
|
|
294
|
-
handleClose(buttonType);
|
|
295
|
-
} }, { children: label })));
|
|
296
|
-
});
|
|
297
|
-
// Put all buttons in a footer
|
|
298
|
-
var footer = ((buttons && buttons.length)
|
|
299
|
-
? ((0, jsx_runtime_1.jsx)("div", { children: buttons }))
|
|
300
|
-
: undefined);
|
|
301
|
-
// Render the modal
|
|
302
|
-
return ((0, jsx_runtime_1.jsxs)(Modal_1.default, __assign({ show: visible, size: size !== ModalSize.Medium ? size : undefined, onHide: function () {
|
|
303
|
-
if (!dontAllowBackdropExit) {
|
|
304
|
-
handleClose(ButtonType.Cancel);
|
|
305
|
-
}
|
|
306
|
-
}, style: {
|
|
307
|
-
zIndex: (onTopOfOtherModals
|
|
308
|
-
? 6000000000
|
|
309
|
-
: 5000000000),
|
|
310
|
-
}, 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 }))] })));
|
|
311
|
-
};
|
|
312
|
-
/*------------------------------------------------------------------------*/
|
|
313
|
-
/* Wrap Up */
|
|
314
|
-
/*------------------------------------------------------------------------*/
|
|
315
|
-
// Add enums
|
|
316
|
-
Modal.ModalType = ModalType;
|
|
317
|
-
Modal.ModalSize = ModalSize;
|
|
318
|
-
Modal.ButtonType = ButtonType;
|
|
319
|
-
Modal.Variant = Variant_1.default;
|
|
320
|
-
exports.default = Modal;
|
|
321
|
-
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,IAAM,KAAK,GAAG,6kCAiDb,CAAC;AAEF,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,0BAAa,CAAA;IACb,uCAA0B,CAAA;IAC1B,6BAAgB,CAAA;IAChB,0CAA6B,CAAA;IAC7B,6CAAgC,CAAA;IAChC,2CAA8B,CAAA;IAC9B,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAChC,4BAAe,CAAA;AACjB,CAAC,EAVI,SAAS,KAAT,SAAS,QAUb;AAED,cAAc;AACd,IAAK,SAKJ;AALD,WAAK,SAAS;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"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
-
/*------------------------------------------------------------------------*/
|
|
16
|
-
/* Style */
|
|
17
|
-
/*------------------------------------------------------------------------*/
|
|
18
|
-
var style = "\n/* Tab Box */\n.TabBox-box {\n /* Light Border */\n border: 2px solid #dedede;\n \n /* Rounded Corners (except top-left) */\n border-bottom-right-radius: 5px;\n border-bottom-left-radius: 5px;\n border-top-right-radius: 5px;\n\n /* Very Light Gray Border */\n background: #fdfdfd;\n\n /* Align Contents on Left */\n text-align: left;\n}\n\n/* Container for Title */\n.TabBox-title-container {\n /* Place on Left */\n position: relative;\n left: 0;\n text-align: left;\n}\n\n/* Tab-style Title */\n.TabBox-title {\n /* Place so it Barely Overlaps the Box Border */\n display: inline-block;\n position: relative;\n top: 2px; /* Gives Illusion that Border Doesn't Exist Below Tab */\n\n /* Title-sized Font */\n font-size: 25px;\n\n /* Add Border on Top and Sides */\n border-top: 2px solid #dedede;\n border-left: 2px solid #dedede;\n border-right: 2px solid #dedede;\n\n /* Round the Top Corners */\n border-top-left-radius: 5px;\n border-top-right-radius: 5px;\n\n /* Add Text Padding */\n padding-left: 12px;\n padding-right: 12px;\n\n /* Match Background Color of Box */\n background: #fdfdfd;\n}\n\n/* Make the TabBox's Children Appear Above Title if Overlap Occurs */\n.TabBox-children {\n position: relative;\n z-index: 1;\n}\n";
|
|
19
|
-
/*------------------------------------------------------------------------*/
|
|
20
|
-
/* Component */
|
|
21
|
-
/*------------------------------------------------------------------------*/
|
|
22
|
-
var TabBox = function (props) {
|
|
23
|
-
/*------------------------------------------------------------------------*/
|
|
24
|
-
/* Setup */
|
|
25
|
-
/*------------------------------------------------------------------------*/
|
|
26
|
-
/* -------------- Props ------------- */
|
|
27
|
-
var title = props.title, children = props.children;
|
|
28
|
-
/*------------------------------------------------------------------------*/
|
|
29
|
-
/* Render */
|
|
30
|
-
/*------------------------------------------------------------------------*/
|
|
31
|
-
/*----------------------------------------*/
|
|
32
|
-
/* Main UI */
|
|
33
|
-
/*----------------------------------------*/
|
|
34
|
-
// Full UI
|
|
35
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("style", { children: style }), (0, jsx_runtime_1.jsx)("div", __assign({ className: "TabBox-title-container" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "TabBox-title" }, { children: title })) })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "TabBox-box p-2" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "TabBox-children" }, { children: children })) }))] }));
|
|
36
|
-
};
|
|
37
|
-
/*------------------------------------------------------------------------*/
|
|
38
|
-
/* Wrap Up */
|
|
39
|
-
/*------------------------------------------------------------------------*/
|
|
40
|
-
// Export component
|
|
41
|
-
exports.default = TabBox;
|
|
42
|
-
//# sourceMappingURL=TabBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabBox.js","sourceRoot":"","sources":["../../src/components/TabBox.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAmBA,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,IAAM,KAAK,GAAG,uvCA0Db,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,IAAM,MAAM,GAAoB,UAAC,KAAK;IACpC,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAE5E,wCAAwC;IAGtC,IAAA,KAAK,GAEH,KAAK,MAFF,EACL,QAAQ,GACN,KAAK,SADC,CACA;IAEV,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAE5E,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAE5C,UAAU;IACV,OAAO,CACL,4CAEE,4CAAQ,KAAK,GAAS,EAGtB,yCAAK,SAAS,EAAC,wBAAwB,gBACrC,yCAAK,SAAS,EAAC,cAAc,gBAC1B,KAAK,IACF,IACF,EAGN,yCAAK,SAAS,EAAC,gBAAgB,gBAC7B,yCAAK,SAAS,EAAC,iBAAiB,gBAC7B,QAAQ,IACL,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,mBAAmB;AACnB,kBAAe,MAAM,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shorten text so it fits into a certain number of chars
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
* @param text the text to abbreviate
|
|
5
|
-
* @param maxChars the maximum number of chars to include
|
|
6
|
-
* @returns abbreviated text with length no greater than maxChars
|
|
7
|
-
* (including ellipses if applicable)
|
|
8
|
-
*/
|
|
9
|
-
var abbreviate = function (text, maxChars) {
|
|
10
|
-
// Check if already short enough
|
|
11
|
-
if (text.trim().length < maxChars) {
|
|
12
|
-
return text.trim();
|
|
13
|
-
}
|
|
14
|
-
// Abbreviate
|
|
15
|
-
var shortenedText = (text
|
|
16
|
-
.trim()
|
|
17
|
-
.substring(0, maxChars - 3)
|
|
18
|
-
.trim());
|
|
19
|
-
return "".concat(shortenedText, "...");
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=abbreviate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abbreviate.js","sourceRoot":"","sources":["../../src/helpers/abbreviate.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,IAAM,UAAU,GAAG,UAAC,IAAY,EAAE,QAAgB;IAChD,gCAAgC;IAChC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,QAAQ,EAAE;QACjC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;KACpB;IAED,aAAa;IACb,IAAM,aAAa,GAAG,CACpB,IAAI;SACD,IAAI,EAAE;SACN,SAAS,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC;SAC1B,IAAI,EAAE,CACV,CAAC;IACF,OAAO,UAAG,aAAa,QAAK,CAAC;AAC/B,CAAC,CAAC"}
|
package/lib/helpers/alert.d.ts
DELETED
package/lib/helpers/alert.js
DELETED
package/lib/helpers/alert.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../src/helpers/alert.tsx"],"names":[],"mappings":";;AAAA,uDAAkD;AAElD,IAAM,KAAK,GAAG,mBAAM,CAAC;AAErB,kBAAe,KAAK,CAAC"}
|
package/lib/helpers/avg.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var sum_1 = __importDefault(require("./sum"));
|
|
7
|
-
/**
|
|
8
|
-
* Get the average of a set of numbers
|
|
9
|
-
* @author Gabe Abrams
|
|
10
|
-
* @param nums the numbers to average
|
|
11
|
-
* @returns average value or 0 if no numbers
|
|
12
|
-
*/
|
|
13
|
-
var avg = function (nums) {
|
|
14
|
-
// Handle empty array case
|
|
15
|
-
if (nums.length === 0) {
|
|
16
|
-
return 0;
|
|
17
|
-
}
|
|
18
|
-
// Get the total value
|
|
19
|
-
var total = (0, sum_1.default)(nums);
|
|
20
|
-
// Get average
|
|
21
|
-
return (total / nums.length);
|
|
22
|
-
};
|
|
23
|
-
exports.default = avg;
|
|
24
|
-
//# sourceMappingURL=avg.js.map
|
package/lib/helpers/avg.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"avg.js","sourceRoot":"","sources":["../../src/helpers/avg.tsx"],"names":[],"mappings":";;;;;AAAA,8CAAwB;AAExB;;;;;GAKG;AACH,IAAM,GAAG,GAAG,UAAC,IAAc;IACzB,0BAA0B;IAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,CAAC,CAAC;KACV;IAED,sBAAsB;IACtB,IAAM,KAAK,GAAG,IAAA,aAAG,EAAC,IAAI,CAAC,CAAC;IAExB,cAAc;IACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Round a number (ceiling) to a certain number of decimals
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to round
|
|
7
|
-
* @param numDecimals the number of decimals to round to
|
|
8
|
-
* @returns rounded number
|
|
9
|
-
*/
|
|
10
|
-
var ceilToNumDecimals = function (num, numDecimals) {
|
|
11
|
-
var rounder = Math.pow(10, numDecimals);
|
|
12
|
-
return (Math.ceil(num * rounder) / rounder);
|
|
13
|
-
};
|
|
14
|
-
exports.default = ceilToNumDecimals;
|
|
15
|
-
//# sourceMappingURL=ceilToNumDecimals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ceilToNumDecimals.js","sourceRoot":"","sources":["../../src/helpers/ceilToNumDecimals.tsx"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,IAAM,iBAAiB,GAAG,UAAC,GAAW,EAAE,WAAmB;IACzD,IAAM,OAAO,GAAG,SAAA,EAAE,EAAI,WAAW,CAAA,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
package/lib/helpers/confirm.d.ts
DELETED
package/lib/helpers/confirm.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../src/helpers/confirm.tsx"],"names":[],"mappings":";;AAAA,uDAAoD;AAEpD,IAAM,OAAO,GAAG,qBAAQ,CAAC;AAEzB,kBAAe,OAAO,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Round a number (floor) to a certain number of decimals
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to round
|
|
7
|
-
* @param numDecimals the number of decimals to round to
|
|
8
|
-
* @returns rounded number
|
|
9
|
-
*/
|
|
10
|
-
var floorToNumDecimals = function (num, numDecimals) {
|
|
11
|
-
var rounder = Math.pow(10, numDecimals);
|
|
12
|
-
return (Math.floor(num * rounder) / rounder);
|
|
13
|
-
};
|
|
14
|
-
exports.default = floorToNumDecimals;
|
|
15
|
-
//# sourceMappingURL=floorToNumDecimals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"floorToNumDecimals.js","sourceRoot":"","sources":["../../src/helpers/floorToNumDecimals.tsx"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,IAAM,kBAAkB,GAAG,UAAC,GAAW,EAAE,WAAmB;IAC1D,IAAM,OAAO,GAAG,SAAA,EAAE,EAAI,WAAW,CAAA,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Force a number to stay within specific bounds
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to move into the bounds
|
|
7
|
-
* @param min the minimum number in the bound
|
|
8
|
-
* @param max the maximum number in the bound
|
|
9
|
-
* @returns bounded number
|
|
10
|
-
*/
|
|
11
|
-
var forceNumIntoBounds = function (num, min, max) {
|
|
12
|
-
return Math.max(min, Math.min(max, num));
|
|
13
|
-
};
|
|
14
|
-
exports.default = forceNumIntoBounds;
|
|
15
|
-
//# sourceMappingURL=forceNumIntoBounds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forceNumIntoBounds.js","sourceRoot":"","sources":["../../src/helpers/forceNumIntoBounds.tsx"],"names":[],"mappings":";;AAAA;;;;;;;GAOG;AACH,IAAM,kBAAkB,GAAG,UAAC,GAAW,EAAE,GAAW,EAAE,GAAW;IAC/D,OAAO,IAAI,CAAC,GAAG,CACb,GAAG,EACH,IAAI,CAAC,GAAG,CACN,GAAG,EACH,GAAG,CACJ,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handle an error and respond to the client
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
* @param res express response
|
|
5
|
-
* @param error error info
|
|
6
|
-
* @param opts.err the error to send to the client
|
|
7
|
-
* or the error message
|
|
8
|
-
* @param [opts.code] an error code (only used if err.code is not
|
|
9
|
-
* included)
|
|
10
|
-
* @param [opts.status=500] the https status code to use
|
|
11
|
-
* defined)
|
|
12
|
-
*/
|
|
13
|
-
declare const handleError: (res: any, error: any) => undefined;
|
|
14
|
-
export default handleError;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// Import shared types
|
|
7
|
-
var ReactKitErrorCode_1 = __importDefault(require("../types/ReactKitErrorCode"));
|
|
8
|
-
/**
|
|
9
|
-
* Handle an error and respond to the client
|
|
10
|
-
* @author Gabe Abrams
|
|
11
|
-
* @param res express response
|
|
12
|
-
* @param error error info
|
|
13
|
-
* @param opts.err the error to send to the client
|
|
14
|
-
* or the error message
|
|
15
|
-
* @param [opts.code] an error code (only used if err.code is not
|
|
16
|
-
* included)
|
|
17
|
-
* @param [opts.status=500] the https status code to use
|
|
18
|
-
* defined)
|
|
19
|
-
*/
|
|
20
|
-
var handleError = function (res, error) {
|
|
21
|
-
// Get the error message
|
|
22
|
-
var message;
|
|
23
|
-
if (error && error.message) {
|
|
24
|
-
message = (error.message || 'An unknown error occurred.');
|
|
25
|
-
}
|
|
26
|
-
else if (typeof error === 'string') {
|
|
27
|
-
message = (error.trim().length > 0
|
|
28
|
-
? error
|
|
29
|
-
: 'An unknown error occurred.');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
message = 'An unknown error occurred.';
|
|
33
|
-
}
|
|
34
|
-
// Get the error code
|
|
35
|
-
var code = (error.code || ReactKitErrorCode_1.default.NoCode);
|
|
36
|
-
// Get the status code
|
|
37
|
-
var status = (error.status || 500);
|
|
38
|
-
// Respond to user
|
|
39
|
-
res
|
|
40
|
-
// Set the http status code
|
|
41
|
-
.status(status)
|
|
42
|
-
// Send a JSON response
|
|
43
|
-
.json({
|
|
44
|
-
// Error message
|
|
45
|
-
message: message,
|
|
46
|
-
// Error code
|
|
47
|
-
code: code,
|
|
48
|
-
// Success = false flag so client can detect server-side errors
|
|
49
|
-
success: false,
|
|
50
|
-
});
|
|
51
|
-
return undefined;
|
|
52
|
-
};
|
|
53
|
-
exports.default = handleError;
|
|
54
|
-
//# sourceMappingURL=handleError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleError.js","sourceRoot":"","sources":["../../src/helpers/handleError.ts"],"names":[],"mappings":";;;;;AAAA,sBAAsB;AACtB,iFAA2D;AAE3D;;;;;;;;;;;GAWG;AACH,IAAM,WAAW,GAAG,UAClB,GAAQ,EACR,KASC;IAED,wBAAwB;IACxB,IAAI,OAAO,CAAC;IACZ,IAAI,KAAK,IAAK,KAAa,CAAC,OAAO,EAAE;QACnC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,4BAA4B,CAAC,CAAC;KAC3D;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,OAAO,GAAG,CACR,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,4BAA4B,CACjC,CAAC;KACH;SAAM;QACL,OAAO,GAAG,4BAA4B,CAAC;KACxC;IAED,qBAAqB;IACrB,IAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,2BAAiB,CAAC,MAAM,CAAC,CAAC;IAEtD,sBAAsB;IACtB,IAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;IAErC,kBAAkB;IAClB,GAAG;QACD,2BAA2B;SAC1B,MAAM,CAAC,MAAM,CAAC;QACf,uBAAuB;SACtB,IAAI,CAAC;QACJ,gBAAgB;QAChB,OAAO,SAAA;QACP,aAAa;QACb,IAAI,MAAA;QACJ,+DAA+D;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IACL,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|