dce-reactkit 3.8.1 → 3.9.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 +120 -101
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Modal/ModalProps.d.ts +2 -0
- package/dist/esm/index.js +121 -102
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Modal/ModalProps.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Modal/ModalProps.ts +4 -0
- package/src/components/Modal/index.tsx +38 -2
package/dist/cjs/index.js
CHANGED
|
@@ -218,6 +218,98 @@ const waitMs = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
218
218
|
});
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Loading spinner/indicator
|
|
223
|
+
* @author Gabe Abrams
|
|
224
|
+
*/
|
|
225
|
+
/*------------------------------------------------------------------------*/
|
|
226
|
+
/* -------------------------------- Style ------------------------------- */
|
|
227
|
+
/*------------------------------------------------------------------------*/
|
|
228
|
+
const style$a = `
|
|
229
|
+
/* Container fades in */
|
|
230
|
+
.LoadingSpinner-container {
|
|
231
|
+
animation-name: LoadingSpinner-container-fade-in;
|
|
232
|
+
animation-duration: 0.3s;
|
|
233
|
+
animation-delay: 0.4s;
|
|
234
|
+
animation-fill-mode: both;
|
|
235
|
+
animation-timing-function: ease-out;
|
|
236
|
+
}
|
|
237
|
+
@keyframes LoadingSpinner-container-fade-in {
|
|
238
|
+
0% {
|
|
239
|
+
opacity: 0;
|
|
240
|
+
}
|
|
241
|
+
100% {
|
|
242
|
+
opacity: 1;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Blips */
|
|
247
|
+
.LoadingSpinner-blip-1,
|
|
248
|
+
.LoadingSpinner-blip-2,
|
|
249
|
+
.LoadingSpinner-blip-3,
|
|
250
|
+
.LoadingSpinner-blip-4 {
|
|
251
|
+
font-size: 1.8rem;
|
|
252
|
+
opacity: 0.6;
|
|
253
|
+
margin-top: 1rem;
|
|
254
|
+
margin-bottom: 1rem;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* First Blip */
|
|
258
|
+
.LoadingSpinner-blip-1 {
|
|
259
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* Second Blip */
|
|
263
|
+
.LoadingSpinner-blip-2 {
|
|
264
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
265
|
+
-webkit-animation-delay: 0.1s;
|
|
266
|
+
animation-delay: 0.1s;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* Third Blip */
|
|
270
|
+
.LoadingSpinner-blip-3 {
|
|
271
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
272
|
+
animation-delay: 0.2s;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* Fourth Blip */
|
|
276
|
+
.LoadingSpinner-blip-4 {
|
|
277
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
278
|
+
animation-delay: 0.3s;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* Pop Animation for Each Blip */
|
|
282
|
+
@keyframes LoadingSpinner-pop-animation {
|
|
283
|
+
0% {
|
|
284
|
+
transform: scale(1.0);
|
|
285
|
+
}
|
|
286
|
+
10% {
|
|
287
|
+
transform: scale(1.5);
|
|
288
|
+
}
|
|
289
|
+
30% {
|
|
290
|
+
transform: scale(1.0);
|
|
291
|
+
}
|
|
292
|
+
100% {
|
|
293
|
+
transform: scale(1.0);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
`;
|
|
297
|
+
/*------------------------------------------------------------------------*/
|
|
298
|
+
/* ------------------------------ Component ----------------------------- */
|
|
299
|
+
/*------------------------------------------------------------------------*/
|
|
300
|
+
const LoadingSpinner = () => {
|
|
301
|
+
/*------------------------------------------------------------------------*/
|
|
302
|
+
/* ------------------------------- Render ------------------------------- */
|
|
303
|
+
/*------------------------------------------------------------------------*/
|
|
304
|
+
// Add all four blips to a container
|
|
305
|
+
return (React__default["default"].createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
306
|
+
React__default["default"].createElement("style", null, style$a),
|
|
307
|
+
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-1 me-1" }),
|
|
308
|
+
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-2 me-1" }),
|
|
309
|
+
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-3 me-1" }),
|
|
310
|
+
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-4" })));
|
|
311
|
+
};
|
|
312
|
+
|
|
221
313
|
/**
|
|
222
314
|
* Modal sizes
|
|
223
315
|
* @author Gabe Abrams
|
|
@@ -437,7 +529,7 @@ const getNextUniqueId = () => {
|
|
|
437
529
|
/*------------------------------------------------------------------------*/
|
|
438
530
|
/* -------------------------------- Style ------------------------------- */
|
|
439
531
|
/*------------------------------------------------------------------------*/
|
|
440
|
-
const style$
|
|
532
|
+
const style$9 = `
|
|
441
533
|
.Modal-backdrop {
|
|
442
534
|
position: fixed;
|
|
443
535
|
top: 0;
|
|
@@ -509,13 +601,14 @@ const Modal = (props) => {
|
|
|
509
601
|
/*------------------------------------------------------------------------*/
|
|
510
602
|
var _a;
|
|
511
603
|
/* -------------- Props ------------- */
|
|
512
|
-
const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, largeTitle, children, onClose, dontAllowBackdropExit, dontShowXButton, onTopOfOtherModals, } = props;
|
|
604
|
+
const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, largeTitle, children, onClose, dontAllowBackdropExit, dontShowXButton, onTopOfOtherModals, isLoading, isLoadingCancelable, } = props;
|
|
513
605
|
// Determine if no header either
|
|
514
606
|
const noHeader = (!title && type === ModalType$1.NoButtons);
|
|
515
607
|
/* -------------- State ------------- */
|
|
516
608
|
// True if animation is in use
|
|
517
609
|
const [animatingIn, setAnimatingIn] = React.useState(true);
|
|
518
610
|
const [animatingPop, setAnimatingPop] = React.useState(false);
|
|
611
|
+
const [showModal, setShowModal] = React.useState(false);
|
|
519
612
|
/* -------------- Refs -------------- */
|
|
520
613
|
// Keep track of whether modal is still mounted
|
|
521
614
|
const mounted = React.useRef(false);
|
|
@@ -541,6 +634,14 @@ const Modal = (props) => {
|
|
|
541
634
|
// Update to state after animated in
|
|
542
635
|
if (mounted.current) {
|
|
543
636
|
setAnimatingIn(false);
|
|
637
|
+
if (isLoading) {
|
|
638
|
+
// wait 1 second before showing modal
|
|
639
|
+
yield waitMs(1000);
|
|
640
|
+
setShowModal(true);
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
setShowModal(true);
|
|
644
|
+
}
|
|
544
645
|
}
|
|
545
646
|
}))();
|
|
546
647
|
return () => {
|
|
@@ -616,7 +717,7 @@ const Modal = (props) => {
|
|
|
616
717
|
left: 0,
|
|
617
718
|
right: 0,
|
|
618
719
|
} },
|
|
619
|
-
React__default["default"].createElement("style", null, style$
|
|
720
|
+
React__default["default"].createElement("style", null, style$9),
|
|
620
721
|
React__default["default"].createElement("div", { className: `Modal-backdrop ${backdropAnimationClass}`, style: {
|
|
621
722
|
zIndex: baseZIndex + 1,
|
|
622
723
|
}, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -634,7 +735,7 @@ const Modal = (props) => {
|
|
|
634
735
|
// Handle close
|
|
635
736
|
handleClose(ModalButtonType$1.Cancel);
|
|
636
737
|
}) }),
|
|
637
|
-
React__default["default"].createElement("div", { className: `modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`, style: {
|
|
738
|
+
showModal && (React__default["default"].createElement("div", { className: `modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`, style: {
|
|
638
739
|
zIndex: baseZIndex + 2,
|
|
639
740
|
// Override sizes for even larger for XL
|
|
640
741
|
width: (size === ModalSize$1.ExtraLarge
|
|
@@ -666,7 +767,7 @@ const Modal = (props) => {
|
|
|
666
767
|
? '1.6rem'
|
|
667
768
|
: undefined),
|
|
668
769
|
} }, title),
|
|
669
|
-
(onClose && !dontShowXButton) && (React__default["default"].createElement("button", { type: "button", className: "Modal-x-button btn-close", "aria-label": "Close", style: {
|
|
770
|
+
(onClose && !dontShowXButton && !(isLoading && !isLoadingCancelable)) && (React__default["default"].createElement("button", { type: "button", className: "Modal-x-button btn-close", "aria-label": "Close", style: {
|
|
670
771
|
backgroundColor: (isDarkModeOn()
|
|
671
772
|
? 'white'
|
|
672
773
|
: undefined),
|
|
@@ -674,7 +775,17 @@ const Modal = (props) => {
|
|
|
674
775
|
// Handle close
|
|
675
776
|
handleClose(ModalButtonType$1.Cancel);
|
|
676
777
|
} })))),
|
|
677
|
-
|
|
778
|
+
isLoading && (React__default["default"].createElement("div", { className: "modal-body", style: {
|
|
779
|
+
color: (isDarkModeOn()
|
|
780
|
+
? 'white'
|
|
781
|
+
: undefined),
|
|
782
|
+
backgroundColor: (isDarkModeOn()
|
|
783
|
+
? '#444'
|
|
784
|
+
: undefined),
|
|
785
|
+
} },
|
|
786
|
+
React__default["default"].createElement(LoadingSpinner, null),
|
|
787
|
+
React__default["default"].createElement("span", { className: "sr-only" }, "Content loading"))),
|
|
788
|
+
children && !isLoading && (React__default["default"].createElement("div", { className: "modal-body", style: {
|
|
678
789
|
color: (isDarkModeOn()
|
|
679
790
|
? 'white'
|
|
680
791
|
: undefined),
|
|
@@ -692,7 +803,7 @@ const Modal = (props) => {
|
|
|
692
803
|
borderTop: (isDarkModeOn()
|
|
693
804
|
? '0.1rem solid gray'
|
|
694
805
|
: undefined),
|
|
695
|
-
} }, footer))))));
|
|
806
|
+
} }, footer)))))));
|
|
696
807
|
// Determine which portal to use
|
|
697
808
|
const portalNumber = id.current % NUM_MODAL_PORTALS;
|
|
698
809
|
// Render in a portal
|
|
@@ -1172,7 +1283,7 @@ const showSessionExpiredMessage = () => __awaiter(void 0, void 0, void 0, functi
|
|
|
1172
1283
|
/*------------------------------------------------------------------------*/
|
|
1173
1284
|
/* -------------------------------- Style ------------------------------- */
|
|
1174
1285
|
/*------------------------------------------------------------------------*/
|
|
1175
|
-
const style$
|
|
1286
|
+
const style$8 = `
|
|
1176
1287
|
.AppWrapper-leave-to-url-notice {
|
|
1177
1288
|
opacity: 0;
|
|
1178
1289
|
|
|
@@ -1347,105 +1458,13 @@ const AppWrapper = (props) => {
|
|
|
1347
1458
|
/* --------------- Main UI -------------- */
|
|
1348
1459
|
/*----------------------------------------*/
|
|
1349
1460
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1350
|
-
React__default["default"].createElement("style", null, style$
|
|
1461
|
+
React__default["default"].createElement("style", null, style$8),
|
|
1351
1462
|
React__default["default"].createElement("style", null, tooltipStyle),
|
|
1352
1463
|
modal,
|
|
1353
1464
|
customModalPortals,
|
|
1354
1465
|
body));
|
|
1355
1466
|
};
|
|
1356
1467
|
|
|
1357
|
-
/**
|
|
1358
|
-
* Loading spinner/indicator
|
|
1359
|
-
* @author Gabe Abrams
|
|
1360
|
-
*/
|
|
1361
|
-
/*------------------------------------------------------------------------*/
|
|
1362
|
-
/* -------------------------------- Style ------------------------------- */
|
|
1363
|
-
/*------------------------------------------------------------------------*/
|
|
1364
|
-
const style$8 = `
|
|
1365
|
-
/* Container fades in */
|
|
1366
|
-
.LoadingSpinner-container {
|
|
1367
|
-
animation-name: LoadingSpinner-container-fade-in;
|
|
1368
|
-
animation-duration: 0.3s;
|
|
1369
|
-
animation-delay: 0.4s;
|
|
1370
|
-
animation-fill-mode: both;
|
|
1371
|
-
animation-timing-function: ease-out;
|
|
1372
|
-
}
|
|
1373
|
-
@keyframes LoadingSpinner-container-fade-in {
|
|
1374
|
-
0% {
|
|
1375
|
-
opacity: 0;
|
|
1376
|
-
}
|
|
1377
|
-
100% {
|
|
1378
|
-
opacity: 1;
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
/* Blips */
|
|
1383
|
-
.LoadingSpinner-blip-1,
|
|
1384
|
-
.LoadingSpinner-blip-2,
|
|
1385
|
-
.LoadingSpinner-blip-3,
|
|
1386
|
-
.LoadingSpinner-blip-4 {
|
|
1387
|
-
font-size: 1.8rem;
|
|
1388
|
-
opacity: 0.6;
|
|
1389
|
-
margin-top: 1rem;
|
|
1390
|
-
margin-bottom: 1rem;
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
/* First Blip */
|
|
1394
|
-
.LoadingSpinner-blip-1 {
|
|
1395
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
/* Second Blip */
|
|
1399
|
-
.LoadingSpinner-blip-2 {
|
|
1400
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
1401
|
-
-webkit-animation-delay: 0.1s;
|
|
1402
|
-
animation-delay: 0.1s;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
/* Third Blip */
|
|
1406
|
-
.LoadingSpinner-blip-3 {
|
|
1407
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
1408
|
-
animation-delay: 0.2s;
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
/* Fourth Blip */
|
|
1412
|
-
.LoadingSpinner-blip-4 {
|
|
1413
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
1414
|
-
animation-delay: 0.3s;
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
/* Pop Animation for Each Blip */
|
|
1418
|
-
@keyframes LoadingSpinner-pop-animation {
|
|
1419
|
-
0% {
|
|
1420
|
-
transform: scale(1.0);
|
|
1421
|
-
}
|
|
1422
|
-
10% {
|
|
1423
|
-
transform: scale(1.5);
|
|
1424
|
-
}
|
|
1425
|
-
30% {
|
|
1426
|
-
transform: scale(1.0);
|
|
1427
|
-
}
|
|
1428
|
-
100% {
|
|
1429
|
-
transform: scale(1.0);
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
`;
|
|
1433
|
-
/*------------------------------------------------------------------------*/
|
|
1434
|
-
/* ------------------------------ Component ----------------------------- */
|
|
1435
|
-
/*------------------------------------------------------------------------*/
|
|
1436
|
-
const LoadingSpinner = () => {
|
|
1437
|
-
/*------------------------------------------------------------------------*/
|
|
1438
|
-
/* ------------------------------- Render ------------------------------- */
|
|
1439
|
-
/*------------------------------------------------------------------------*/
|
|
1440
|
-
// Add all four blips to a container
|
|
1441
|
-
return (React__default["default"].createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
1442
|
-
React__default["default"].createElement("style", null, style$8),
|
|
1443
|
-
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-1 me-1" }),
|
|
1444
|
-
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-2 me-1" }),
|
|
1445
|
-
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-3 me-1" }),
|
|
1446
|
-
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-4" })));
|
|
1447
|
-
};
|
|
1448
|
-
|
|
1449
1468
|
/**
|
|
1450
1469
|
* A box with a tab on the top that holds buttons and other content
|
|
1451
1470
|
* @author Gabe Abrams
|