dce-reactkit 3.7.9 → 3.7.10-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 +161 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +21 -0
- package/dist/cjs/types/components/Modal/ModalForWrapper.d.ts +9 -0
- package/dist/cjs/types/components/{Modal.d.ts → Modal/ModalProps.d.ts} +9 -9
- package/dist/cjs/types/components/Modal/index.d.ts +8 -0
- package/dist/esm/index.js +161 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +21 -0
- package/dist/esm/types/components/Modal/ModalForWrapper.d.ts +9 -0
- package/dist/esm/types/components/{Modal.d.ts → Modal/ModalProps.d.ts} +9 -9
- package/dist/esm/types/components/Modal/index.d.ts +8 -0
- package/dist/index.d.ts +116 -110
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +129 -5
- package/src/components/IntelliTable.tsx +1 -1
- package/src/components/{Modal.tsx → Modal/ModalForWrapper.tsx} +22 -83
- package/src/components/Modal/ModalProps.ts +72 -0
- package/src/components/Modal/index.tsx +105 -0
package/dist/cjs/index.js
CHANGED
|
@@ -413,7 +413,7 @@ const getModalButtonTypeToLabelAndVariant = () => {
|
|
|
413
413
|
/* -------------------------------- Style ------------------------------- */
|
|
414
414
|
/*------------------------------------------------------------------------*/
|
|
415
415
|
const style$a = `
|
|
416
|
-
.
|
|
416
|
+
.ModalForWrapper-backdrop {
|
|
417
417
|
position: fixed;
|
|
418
418
|
top: 0;
|
|
419
419
|
left: 0;
|
|
@@ -421,7 +421,7 @@ const style$a = `
|
|
|
421
421
|
height: 200vh;
|
|
422
422
|
background-color: rgba(0, 0, 0, 0.7);
|
|
423
423
|
}
|
|
424
|
-
.
|
|
424
|
+
.ModalForWrapper-fading-in {
|
|
425
425
|
animation-name: Modal-fading-in;
|
|
426
426
|
animation-duration: ${Math.floor(MS_TO_ANIMATE * 2)}ms;
|
|
427
427
|
animation-iteration-count: 1;
|
|
@@ -436,7 +436,7 @@ const style$a = `
|
|
|
436
436
|
opacity: 1;
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
.
|
|
439
|
+
.ModalForWrapper-animating-in {
|
|
440
440
|
animation-name: Modal-animating-in;
|
|
441
441
|
animation-duration: ${MS_TO_ANIMATE}ms;
|
|
442
442
|
animation-iteration-count: 1;
|
|
@@ -453,14 +453,14 @@ const style$a = `
|
|
|
453
453
|
opacity: 1;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
.
|
|
457
|
-
animation-name:
|
|
456
|
+
.ModalForWrapper-animating-pop {
|
|
457
|
+
animation-name: ModalForWrapper-animating-pop;
|
|
458
458
|
animation-duration: ${MS_TO_ANIMATE}ms;
|
|
459
459
|
animation-iteration-count: 1;
|
|
460
460
|
animation-fill-mode: both;
|
|
461
461
|
animation-timing-function: ease-in-out;
|
|
462
462
|
}
|
|
463
|
-
@keyframes
|
|
463
|
+
@keyframes ModalForWrapper-animating-pop {
|
|
464
464
|
0% {
|
|
465
465
|
transform: scale(1);
|
|
466
466
|
opacity: 1;
|
|
@@ -478,7 +478,7 @@ const style$a = `
|
|
|
478
478
|
/*------------------------------------------------------------------------*/
|
|
479
479
|
/* ------------------------------ Component ----------------------------- */
|
|
480
480
|
/*------------------------------------------------------------------------*/
|
|
481
|
-
const Modal = (props) => {
|
|
481
|
+
const Modal$1 = (props) => {
|
|
482
482
|
/*------------------------------------------------------------------------*/
|
|
483
483
|
/* -------------------------------- Setup ------------------------------- */
|
|
484
484
|
/*------------------------------------------------------------------------*/
|
|
@@ -553,7 +553,7 @@ const Modal = (props) => {
|
|
|
553
553
|
// Check if this button is last
|
|
554
554
|
const last = (i === ModalButtonTypes.length - 1);
|
|
555
555
|
// Create the button
|
|
556
|
-
return (React__default["default"].createElement("button", { key: modalButtonType, type: "button", className: `
|
|
556
|
+
return (React__default["default"].createElement("button", { key: modalButtonType, type: "button", className: `ModalForWrapper-${modalButtonType}-button btn btn-${variant} ${last ? '' : 'me-1'}`, onClick: () => {
|
|
557
557
|
handleClose(modalButtonType);
|
|
558
558
|
} }, label));
|
|
559
559
|
});
|
|
@@ -565,11 +565,11 @@ const Modal = (props) => {
|
|
|
565
565
|
let animationClass = '';
|
|
566
566
|
let backdropAnimationClass = '';
|
|
567
567
|
if (animatingIn) {
|
|
568
|
-
animationClass = '
|
|
569
|
-
backdropAnimationClass = '
|
|
568
|
+
animationClass = 'ModalForWrapper-animating-in';
|
|
569
|
+
backdropAnimationClass = 'ModalForWrapper-fading-in';
|
|
570
570
|
}
|
|
571
571
|
else if (animatingPop) {
|
|
572
|
-
animationClass = '
|
|
572
|
+
animationClass = 'ModalForWrapper-animating-pop';
|
|
573
573
|
}
|
|
574
574
|
// Render the modal
|
|
575
575
|
return (React__default["default"].createElement("div", { className: "modal show", tabIndex: -1, style: {
|
|
@@ -582,7 +582,7 @@ const Modal = (props) => {
|
|
|
582
582
|
right: 0,
|
|
583
583
|
} },
|
|
584
584
|
React__default["default"].createElement("style", null, style$a),
|
|
585
|
-
React__default["default"].createElement("div", { className: `
|
|
585
|
+
React__default["default"].createElement("div", { className: `ModalForWrapper-backdrop ${backdropAnimationClass}`, style: {
|
|
586
586
|
zIndex: 5000000003,
|
|
587
587
|
}, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
588
588
|
// Skip if exit via backdrop not allowed
|
|
@@ -621,7 +621,7 @@ const Modal = (props) => {
|
|
|
621
621
|
React__default["default"].createElement("h5", { className: "modal-title", style: {
|
|
622
622
|
fontWeight: 'bold',
|
|
623
623
|
} }, title),
|
|
624
|
-
(onClose && !dontShowXButton) && (React__default["default"].createElement("button", { type: "button", className: "
|
|
624
|
+
(onClose && !dontShowXButton) && (React__default["default"].createElement("button", { type: "button", className: "ModalForWrapper-x-button btn-close", "aria-label": "Close", style: {
|
|
625
625
|
backgroundColor: (isDarkModeOn()
|
|
626
626
|
? 'white'
|
|
627
627
|
: undefined),
|
|
@@ -1078,6 +1078,70 @@ const showSessionExpiredMessage = () => __awaiter(void 0, void 0, void 0, functi
|
|
|
1078
1078
|
showFatalError('Your session has expired. Please start over.', 'Session Expired');
|
|
1079
1079
|
}
|
|
1080
1080
|
});
|
|
1081
|
+
// Stored copies of setters
|
|
1082
|
+
let setModals;
|
|
1083
|
+
// Stored copies of modals
|
|
1084
|
+
let modals = [];
|
|
1085
|
+
/**
|
|
1086
|
+
* Add a modal to the screen
|
|
1087
|
+
* @author Gabe Abrams
|
|
1088
|
+
* @param id the uniqueId of the modal
|
|
1089
|
+
* @param props the props for the modal
|
|
1090
|
+
*/
|
|
1091
|
+
const addModal = (id, props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1092
|
+
// Wait for helper to exist
|
|
1093
|
+
yield waitForHelper(() => {
|
|
1094
|
+
return !!setModals;
|
|
1095
|
+
});
|
|
1096
|
+
// Add modal
|
|
1097
|
+
modals.push({
|
|
1098
|
+
id,
|
|
1099
|
+
props,
|
|
1100
|
+
});
|
|
1101
|
+
// Update modals
|
|
1102
|
+
setModals(modals);
|
|
1103
|
+
});
|
|
1104
|
+
/**
|
|
1105
|
+
* Update a modal on the screen by id (if it exists) with new props
|
|
1106
|
+
* @author Gabe Abrams
|
|
1107
|
+
* @param id the uniqueId of the modal
|
|
1108
|
+
* @param props the new props for the modal
|
|
1109
|
+
*/
|
|
1110
|
+
const updateModal = (id, props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1111
|
+
// Wait for helper to exist
|
|
1112
|
+
yield waitForHelper(() => {
|
|
1113
|
+
return !!setModals;
|
|
1114
|
+
});
|
|
1115
|
+
// Update modal
|
|
1116
|
+
modals = modals.map((modal) => {
|
|
1117
|
+
if (modal.id === id) {
|
|
1118
|
+
return {
|
|
1119
|
+
id,
|
|
1120
|
+
props,
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
return modal;
|
|
1124
|
+
});
|
|
1125
|
+
// Update modals
|
|
1126
|
+
setModals(modals);
|
|
1127
|
+
});
|
|
1128
|
+
/**
|
|
1129
|
+
* Remove a modal from the screen by id (if it exists)
|
|
1130
|
+
* @author Gabe Abrams
|
|
1131
|
+
* @param id the uniqueId of the modal
|
|
1132
|
+
*/
|
|
1133
|
+
const removeModal = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1134
|
+
// Wait for helper to exist
|
|
1135
|
+
yield waitForHelper(() => {
|
|
1136
|
+
return !!setModals;
|
|
1137
|
+
});
|
|
1138
|
+
// Remove modal
|
|
1139
|
+
modals = modals.filter((modal) => {
|
|
1140
|
+
return modal.id !== id;
|
|
1141
|
+
});
|
|
1142
|
+
// Update modals
|
|
1143
|
+
setModals(modals);
|
|
1144
|
+
});
|
|
1081
1145
|
/*------------------------------------------------------------------------*/
|
|
1082
1146
|
/* -------------------------------- Style ------------------------------- */
|
|
1083
1147
|
/*------------------------------------------------------------------------*/
|
|
@@ -1131,6 +1195,9 @@ const AppWrapper = (props) => {
|
|
|
1131
1195
|
// Session expired
|
|
1132
1196
|
const [sessionHasExpired, setSessionHasExpiredInner,] = React.useState(false);
|
|
1133
1197
|
setSessionHasExpired = setSessionHasExpiredInner;
|
|
1198
|
+
// Modals
|
|
1199
|
+
const [modalsFromState, setModalsInner,] = React.useState([]);
|
|
1200
|
+
setModals = setModalsInner;
|
|
1134
1201
|
/*------------------------------------------------------------------------*/
|
|
1135
1202
|
/* ------------------------------- Render ------------------------------- */
|
|
1136
1203
|
/*------------------------------------------------------------------------*/
|
|
@@ -1141,7 +1208,7 @@ const AppWrapper = (props) => {
|
|
|
1141
1208
|
let modal;
|
|
1142
1209
|
/* -------------- Alert ------------- */
|
|
1143
1210
|
if (alertInfo) {
|
|
1144
|
-
modal = (React__default["default"].createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
|
|
1211
|
+
modal = (React__default["default"].createElement(Modal$1, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
|
|
1145
1212
|
// Alert closed
|
|
1146
1213
|
setAlertInfo(undefined);
|
|
1147
1214
|
if (onAlertClosed) {
|
|
@@ -1151,13 +1218,21 @@ const AppWrapper = (props) => {
|
|
|
1151
1218
|
}
|
|
1152
1219
|
/* ------------- Confirm ------------ */
|
|
1153
1220
|
if (confirmInfo) {
|
|
1154
|
-
modal = (React__default["default"].createElement(Modal, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$1.OkayCancel, okayLabel: confirmInfo.opts.confirmButtonText, okayVariant: confirmInfo.opts.confirmButtonVariant, cancelLabel: confirmInfo.opts.cancelButtonText, cancelVariant: confirmInfo.opts.cancelButtonVariant, onClose: (buttonType) => {
|
|
1221
|
+
modal = (React__default["default"].createElement(Modal$1, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$1.OkayCancel, okayLabel: confirmInfo.opts.confirmButtonText, okayVariant: confirmInfo.opts.confirmButtonVariant, cancelLabel: confirmInfo.opts.cancelButtonText, cancelVariant: confirmInfo.opts.cancelButtonVariant, onClose: (buttonType) => {
|
|
1155
1222
|
setConfirmInfo(undefined);
|
|
1156
1223
|
if (onConfirmClosed) {
|
|
1157
1224
|
onConfirmClosed(buttonType === ModalButtonType$1.Okay);
|
|
1158
1225
|
}
|
|
1159
1226
|
}, dontAllowBackdropExit: true }, confirmInfo.text));
|
|
1160
1227
|
}
|
|
1228
|
+
/* ---------- Custom Modals --------- */
|
|
1229
|
+
// List of modals added outside reactkit via the Modal component
|
|
1230
|
+
const customModals = [];
|
|
1231
|
+
// Add custom modals
|
|
1232
|
+
modalsFromState.forEach((modalTuple) => {
|
|
1233
|
+
var _a;
|
|
1234
|
+
customModals.push(React__default["default"].createElement(Modal$1, Object.assign({ key: String((_a = modalTuple.props.key) !== null && _a !== void 0 ? _a : modalTuple.id) }, modalTuple.props)));
|
|
1235
|
+
});
|
|
1161
1236
|
/*----------------------------------------*/
|
|
1162
1237
|
/* ---------------- Views --------------- */
|
|
1163
1238
|
/*----------------------------------------*/
|
|
@@ -1222,10 +1297,12 @@ const AppWrapper = (props) => {
|
|
|
1222
1297
|
background-color: white;
|
|
1223
1298
|
color: black;
|
|
1224
1299
|
border: 0.1rem solid black;
|
|
1300
|
+
pointer-events: none;
|
|
1225
1301
|
}
|
|
1226
1302
|
div[data-popper-placement="top"] .tooltip-arrow::before {
|
|
1227
1303
|
border-top-color: white !important;
|
|
1228
1304
|
transform: translate(0, -0.05rem);
|
|
1305
|
+
pointer-events: none;
|
|
1229
1306
|
}
|
|
1230
1307
|
`
|
|
1231
1308
|
: `
|
|
@@ -1233,10 +1310,12 @@ const AppWrapper = (props) => {
|
|
|
1233
1310
|
background-color: black;
|
|
1234
1311
|
color: black;
|
|
1235
1312
|
border: 0.1rem solid white;
|
|
1313
|
+
pointer-events: none;
|
|
1236
1314
|
}
|
|
1237
1315
|
div[data-popper-placement="top"] .tooltip-arrow::before {
|
|
1238
1316
|
border-top-color: black !important;
|
|
1239
1317
|
transform: translate(0, -0.05rem);
|
|
1318
|
+
pointer-events: none;
|
|
1240
1319
|
}
|
|
1241
1320
|
`);
|
|
1242
1321
|
/*----------------------------------------*/
|
|
@@ -1246,6 +1325,7 @@ const AppWrapper = (props) => {
|
|
|
1246
1325
|
React__default["default"].createElement("style", null, style$9),
|
|
1247
1326
|
React__default["default"].createElement("style", null, tooltipStyle),
|
|
1248
1327
|
modal,
|
|
1328
|
+
customModals,
|
|
1249
1329
|
body));
|
|
1250
1330
|
};
|
|
1251
1331
|
|
|
@@ -1341,6 +1421,71 @@ const LoadingSpinner = () => {
|
|
|
1341
1421
|
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-4" })));
|
|
1342
1422
|
};
|
|
1343
1423
|
|
|
1424
|
+
/**
|
|
1425
|
+
* General use modal component
|
|
1426
|
+
* @author Gabe Abrams
|
|
1427
|
+
*/
|
|
1428
|
+
/*------------------------------------------------------------------------*/
|
|
1429
|
+
/* --------------------------- Static Helpers --------------------------- */
|
|
1430
|
+
/*------------------------------------------------------------------------*/
|
|
1431
|
+
// Next unique id
|
|
1432
|
+
let nextUniqueId = 0;
|
|
1433
|
+
/**
|
|
1434
|
+
* Get a new unique id for this modal
|
|
1435
|
+
* @author Gabe Abrams
|
|
1436
|
+
* @returns new unique id
|
|
1437
|
+
*/
|
|
1438
|
+
const getNextUniqueId = () => {
|
|
1439
|
+
// eslint-disable-next-line no-plusplus
|
|
1440
|
+
return nextUniqueId++;
|
|
1441
|
+
};
|
|
1442
|
+
/*------------------------------------------------------------------------*/
|
|
1443
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1444
|
+
/*------------------------------------------------------------------------*/
|
|
1445
|
+
const Modal = (props) => {
|
|
1446
|
+
/*------------------------------------------------------------------------*/
|
|
1447
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1448
|
+
/*------------------------------------------------------------------------*/
|
|
1449
|
+
/* -------------- Refs -------------- */
|
|
1450
|
+
// Initialize refs
|
|
1451
|
+
const id = React.useRef(getNextUniqueId());
|
|
1452
|
+
/*------------------------------------------------------------------------*/
|
|
1453
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
1454
|
+
/*------------------------------------------------------------------------*/
|
|
1455
|
+
/**
|
|
1456
|
+
* Mount: add to app wrapper
|
|
1457
|
+
* @author Gabe Abrams
|
|
1458
|
+
*/
|
|
1459
|
+
React.useEffect(() => {
|
|
1460
|
+
addModal(id.current, props);
|
|
1461
|
+
}, []);
|
|
1462
|
+
/**
|
|
1463
|
+
* Update: update modal props in app wrapper when props change
|
|
1464
|
+
* @author Gabe Abrams
|
|
1465
|
+
*/
|
|
1466
|
+
React.useEffect(() => {
|
|
1467
|
+
// Update modal props
|
|
1468
|
+
updateModal(id.current, props);
|
|
1469
|
+
}, [props]);
|
|
1470
|
+
/**
|
|
1471
|
+
* Unmount: remove from app wrapper when unmounting
|
|
1472
|
+
* @author Gabe Abrams
|
|
1473
|
+
*/
|
|
1474
|
+
React.useEffect(() => {
|
|
1475
|
+
return () => {
|
|
1476
|
+
// Remove modal
|
|
1477
|
+
removeModal(id.current);
|
|
1478
|
+
};
|
|
1479
|
+
}, []);
|
|
1480
|
+
/*------------------------------------------------------------------------*/
|
|
1481
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1482
|
+
/*------------------------------------------------------------------------*/
|
|
1483
|
+
/*----------------------------------------*/
|
|
1484
|
+
/* --------------- Main UI -------------- */
|
|
1485
|
+
/*----------------------------------------*/
|
|
1486
|
+
return (React__default["default"].createElement("div", { className: "Modal-shell d-none" }));
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1344
1489
|
/**
|
|
1345
1490
|
* A box with a tab on the top that holds buttons and other content
|
|
1346
1491
|
* @author Gabe Abrams
|
|
@@ -2781,7 +2926,7 @@ const IntelliTable = (props) => {
|
|
|
2781
2926
|
/* ------- Col Vis Customization Modal ------ */
|
|
2782
2927
|
if (columnVisibilityCustomizationModalVisible) {
|
|
2783
2928
|
// Create modal
|
|
2784
|
-
modal = (React__default["default"].createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
|
|
2929
|
+
modal = (React__default["default"].createElement(Modal$1, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
|
|
2785
2930
|
const noColumnsSelected = (Object.values(columnVisibilityMap)
|
|
2786
2931
|
.every((isSelected) => {
|
|
2787
2932
|
return !isSelected;
|