dce-reactkit 3.0.40 → 3.0.43

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 CHANGED
@@ -279,7 +279,7 @@ const ModalButtonTypeToLabelAndVariant = {
279
279
  /*------------------------------------------------------------------------*/
280
280
  /* Style */
281
281
  /*------------------------------------------------------------------------*/
282
- const style$4 = `
282
+ const style$6 = `
283
283
  .Modal-backdrop {
284
284
  position: fixed;
285
285
  top: 0;
@@ -453,7 +453,7 @@ const Modal = (props) => {
453
453
  left: 0,
454
454
  right: 0,
455
455
  } },
456
- React__default["default"].createElement("style", null, style$4),
456
+ React__default["default"].createElement("style", null, style$6),
457
457
  React__default["default"].createElement("div", { className: `Modal-backdrop ${backdropAnimationClass}`, style: {
458
458
  zIndex: 5000000003,
459
459
  }, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
@@ -718,7 +718,7 @@ const AppWrapper = (props) => {
718
718
  /*------------------------------------------------------------------------*/
719
719
  /* Style */
720
720
  /*------------------------------------------------------------------------*/
721
- const style$3 = `
721
+ const style$5 = `
722
722
  /* Container fades in */
723
723
  .LoadingSpinner-container {
724
724
  animation-name: LoadingSpinner-container-fade-in;
@@ -796,7 +796,7 @@ const LoadingSpinner = () => {
796
796
  /*------------------------------------------------------------------------*/
797
797
  // Add all four blips to a container
798
798
  return (React__default["default"].createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
799
- React__default["default"].createElement("style", null, style$3),
799
+ React__default["default"].createElement("style", null, style$5),
800
800
  React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-1 me-1" }),
801
801
  React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-2 me-1" }),
802
802
  React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-3 me-1" }),
@@ -810,7 +810,7 @@ const LoadingSpinner = () => {
810
810
  /*------------------------------------------------------------------------*/
811
811
  /* Style */
812
812
  /*------------------------------------------------------------------------*/
813
- const style$2 = `
813
+ const style$4 = `
814
814
  /* Tab Box */
815
815
  .TabBox-box {
816
816
  /* Light Border */
@@ -890,7 +890,7 @@ const TabBox = (props) => {
890
890
  /*----------------------------------------*/
891
891
  // Full UI
892
892
  return (React__default["default"].createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
893
- React__default["default"].createElement("style", null, style$2),
893
+ React__default["default"].createElement("style", null, style$4),
894
894
  React__default["default"].createElement("div", { className: "TabBox-title-container" },
895
895
  React__default["default"].createElement("div", { className: "TabBox-title" }, title)),
896
896
  React__default["default"].createElement("div", { className: `TabBox-box ps-2 pt-2 pe-2 ${noBottomPadding ? '' : 'pb-2'}` },
@@ -1162,7 +1162,7 @@ const SimpleDateChooser = (props) => {
1162
1162
  /*------------------------------------------------------------------------*/
1163
1163
  /* Style */
1164
1164
  /*------------------------------------------------------------------------*/
1165
- const style$1 = `
1165
+ const style$3 = `
1166
1166
  .Drawer-container {
1167
1167
  margin-left: 1rem;
1168
1168
  margin-right: 1rem;
@@ -1194,7 +1194,7 @@ const Drawer = (props) => {
1194
1194
  /* Main UI */
1195
1195
  /*----------------------------------------*/
1196
1196
  return (React__default["default"].createElement("div", { className: "Drawer-container" },
1197
- React__default["default"].createElement("style", null, style$1),
1197
+ React__default["default"].createElement("style", null, style$3),
1198
1198
  children));
1199
1199
  };
1200
1200
 
@@ -1205,7 +1205,7 @@ const Drawer = (props) => {
1205
1205
  /*------------------------------------------------------------------------*/
1206
1206
  /* Style */
1207
1207
  /*------------------------------------------------------------------------*/
1208
- const style = `
1208
+ const style$2 = `
1209
1209
  .PopSuccessMark-outer-container {
1210
1210
  position: relative;
1211
1211
  display: inline-block;
@@ -1310,7 +1310,7 @@ const PopSuccessMark = (props) => {
1310
1310
  width: `${sizeRem}rem`,
1311
1311
  height: `${sizeRem}rem`,
1312
1312
  }, "aria-label": "checkmark indicating success" },
1313
- React__default["default"].createElement("style", null, style),
1313
+ React__default["default"].createElement("style", null, style$2),
1314
1314
  React__default["default"].createElement("div", { className: `PopSuccessMark-check-stroke-1 bg-${checkVariant}`, style: {
1315
1315
  borderRadius: `${sizeRem / 5}rem`,
1316
1316
  } }),
@@ -1319,6 +1319,336 @@ const PopSuccessMark = (props) => {
1319
1319
  } })));
1320
1320
  };
1321
1321
 
1322
+ /**
1323
+ * Failure x mark that pops into view
1324
+ * @author Gabe Abrams
1325
+ */
1326
+ /*------------------------------------------------------------------------*/
1327
+ /* Style */
1328
+ /*------------------------------------------------------------------------*/
1329
+ const style$1 = `
1330
+ .PopFailureMark-outer-container {
1331
+ position: relative;
1332
+ display: inline-block;
1333
+ border-radius: 50%;
1334
+
1335
+ animation-name: PopFailureMark-outer-container;
1336
+ animation-duration: 0.8s;
1337
+ animation-fill-mode: both;
1338
+ animation-iteration-count: 1;
1339
+ animation-timing-function: ease-out;
1340
+ }
1341
+ @keyframes PopFailureMark-outer-container {
1342
+ 0% {
1343
+ opacity: 0;
1344
+ transform: scale(1.5);
1345
+ filter: saturate(0);
1346
+ }
1347
+ 80.7% {
1348
+ opacity: 1;
1349
+ transform: scale(1);
1350
+ filter: saturate(0);
1351
+ }
1352
+ 100% {
1353
+ opacity: 1;
1354
+ transform: scale(1);
1355
+ filter: saturate(1);
1356
+ }
1357
+ }
1358
+
1359
+ .PopFailureMark-x-stroke-1 {
1360
+ position: absolute;
1361
+ left: 25%;
1362
+ top: 19%;
1363
+
1364
+ display: inline-block;
1365
+ height: 16%;
1366
+ width: 70%;
1367
+
1368
+ transform-origin: left;
1369
+
1370
+ animation-name: PopFailureMark-x-stroke-1;
1371
+ animation-duration: 0.3s;
1372
+ animation-delay: 0.3s;
1373
+ animation-fill-mode: both;
1374
+ animation-iteration-count: 1;
1375
+ animation-timing-function: ease-in;
1376
+ }
1377
+ @keyframes PopFailureMark-x-stroke-1 {
1378
+ 0% {
1379
+ transform: rotate(45deg) scaleX(0);
1380
+ }
1381
+ 100% {
1382
+ transform: rotate(45deg) scaleX(1);
1383
+ }
1384
+ }
1385
+
1386
+ .PopFailureMark-x-stroke-2 {
1387
+ position: absolute;
1388
+ left: 75%;
1389
+ top: 19%;
1390
+
1391
+ display: inline-block;
1392
+ height: 16%;
1393
+ width: 70%;
1394
+
1395
+ transform-origin: left;
1396
+
1397
+ animation-name: PopFailureMark-x-stroke-2;
1398
+ animation-duration: 0.3s;
1399
+ animation-delay: 0.6s;
1400
+ animation-fill-mode: both;
1401
+ animation-iteration-count: 1;
1402
+ animation-timing-function: ease-out;
1403
+ }
1404
+ @keyframes PopFailureMark-x-stroke-2 {
1405
+ 0% {
1406
+ transform: rotate(135deg) scaleX(0);
1407
+ }
1408
+ 100% {
1409
+ transform: rotate(135deg) scaleX(1);
1410
+ }
1411
+ }
1412
+ `;
1413
+ /*------------------------------------------------------------------------*/
1414
+ /* Component */
1415
+ /*------------------------------------------------------------------------*/
1416
+ const PopFailureMark = (props) => {
1417
+ /*------------------------------------------------------------------------*/
1418
+ /* Setup */
1419
+ /*------------------------------------------------------------------------*/
1420
+ /* -------------- Props ------------- */
1421
+ // Destructure all props
1422
+ const { sizeRem = 3, circleVariant = 'danger', xVariant = 'white', } = props;
1423
+ /*------------------------------------------------------------------------*/
1424
+ /* Render */
1425
+ /*------------------------------------------------------------------------*/
1426
+ /*----------------------------------------*/
1427
+ /* Main UI */
1428
+ /*----------------------------------------*/
1429
+ return (React__default["default"].createElement("div", { className: `PopFailureMark-outer-container bg-${circleVariant}`, style: {
1430
+ width: `${sizeRem}rem`,
1431
+ height: `${sizeRem}rem`,
1432
+ }, "aria-label": "mark indicating failure" },
1433
+ React__default["default"].createElement("style", null, style$1),
1434
+ React__default["default"].createElement("div", { className: `PopFailureMark-x-stroke-1 bg-${xVariant}`, style: {
1435
+ borderRadius: `${sizeRem / 5}rem`,
1436
+ } }),
1437
+ React__default["default"].createElement("div", { className: `PopFailureMark-x-stroke-2 bg-${xVariant}`, style: {
1438
+ borderRadius: `${sizeRem / 5}rem`,
1439
+ } })));
1440
+ };
1441
+
1442
+ /**
1443
+ * Failure pending that pops into view
1444
+ * @author Gabe Abrams
1445
+ */
1446
+ /*------------------------------------------------------------------------*/
1447
+ /* Style */
1448
+ /*------------------------------------------------------------------------*/
1449
+ const style = `
1450
+ .PopPendingMark-outer-container {
1451
+ position: relative;
1452
+ display: inline-block;
1453
+ border-radius: 50%;
1454
+
1455
+ animation-name: PopPendingMark-outer-container;
1456
+ animation-duration: 0.8s;
1457
+ animation-fill-mode: both;
1458
+ animation-iteration-count: 1;
1459
+ animation-timing-function: ease-out;
1460
+ }
1461
+ @keyframes PopPendingMark-outer-container {
1462
+ 0% {
1463
+ opacity: 0;
1464
+ transform: scale(1.5);
1465
+ filter: saturate(0);
1466
+ }
1467
+ 80.7% {
1468
+ opacity: 1;
1469
+ transform: scale(1);
1470
+ filter: saturate(0);
1471
+ }
1472
+ 100% {
1473
+ opacity: 1;
1474
+ transform: scale(1);
1475
+ filter: saturate(1);
1476
+ }
1477
+ }
1478
+
1479
+ .PopPendingMark-hourglass {
1480
+ position: absolute;
1481
+ left: 28%;
1482
+ top: 21%;
1483
+
1484
+ animation-name: PopPendingMark-pending;
1485
+ animation-duration: 0.3s;
1486
+ animation-delay: 0.3s;
1487
+ animation-fill-mode: both;
1488
+ animation-iteration-count: 1;
1489
+ animation-timing-function: ease-in;
1490
+ }
1491
+ @keyframes PopPendingMark-pending {
1492
+ 0% {
1493
+ transform: scale(0.7) rotate(30deg);
1494
+ opacity: 0;
1495
+ }
1496
+ 100% {
1497
+ transform: scale(1) rotate(0);
1498
+ opacity: 1;
1499
+ }
1500
+ }
1501
+ `;
1502
+ /*------------------------------------------------------------------------*/
1503
+ /* Component */
1504
+ /*------------------------------------------------------------------------*/
1505
+ const PopPendingMark = (props) => {
1506
+ /*------------------------------------------------------------------------*/
1507
+ /* Setup */
1508
+ /*------------------------------------------------------------------------*/
1509
+ /* -------------- Props ------------- */
1510
+ // Destructure all props
1511
+ const { sizeRem = 3, circleVariant = 'warning', hourglassVariant = 'white', } = props;
1512
+ /*------------------------------------------------------------------------*/
1513
+ /* Render */
1514
+ /*------------------------------------------------------------------------*/
1515
+ /*----------------------------------------*/
1516
+ /* Main UI */
1517
+ /*----------------------------------------*/
1518
+ return (React__default["default"].createElement("div", { className: `PopPendingMark-outer-container bg-${circleVariant}`, style: {
1519
+ width: `${sizeRem}rem`,
1520
+ height: `${sizeRem}rem`,
1521
+ }, "aria-label": "mark indicating that the item is pending" },
1522
+ React__default["default"].createElement("style", null, style),
1523
+ React__default["default"].createElement("div", null,
1524
+ React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faHourglass, className: `PopPendingMark-hourglass text-${hourglassVariant}`, style: {
1525
+ fontSize: `${sizeRem * 0.6}rem`,
1526
+ } }))));
1527
+ };
1528
+
1529
+ /**
1530
+ * Copiable text box
1531
+ * @author Gabe Abrams
1532
+ */
1533
+ /* ------------- Actions ------------ */
1534
+ // Types of actions
1535
+ var ActionType;
1536
+ (function (ActionType) {
1537
+ // Indicate that the text was recently copied
1538
+ ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
1539
+ // Clear the status
1540
+ ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
1541
+ })(ActionType || (ActionType = {}));
1542
+ /**
1543
+ * Reducer that executes actions
1544
+ * @author Gabe Abrams
1545
+ * @param state current state
1546
+ * @param action action to execute
1547
+ */
1548
+ const reducer = (state, action) => {
1549
+ switch (action.type) {
1550
+ case ActionType.IndicateRecentlyCopied: {
1551
+ return {
1552
+ recentlyCopied: true,
1553
+ };
1554
+ }
1555
+ case ActionType.ClearRecentlyCopiedStatus: {
1556
+ return {
1557
+ recentlyCopied: false,
1558
+ };
1559
+ }
1560
+ default: {
1561
+ return state;
1562
+ }
1563
+ }
1564
+ };
1565
+ /*------------------------------------------------------------------------*/
1566
+ /* Component */
1567
+ /*------------------------------------------------------------------------*/
1568
+ const CopiableBox = (props) => {
1569
+ /*------------------------------------------------------------------------*/
1570
+ /* Setup */
1571
+ /*------------------------------------------------------------------------*/
1572
+ /* -------------- Props ------------- */
1573
+ // Destructure all props
1574
+ const { name, text, label, labelIcon, minLabelWidthRem, multiline, numVisibleLines = 10, } = props;
1575
+ /* -------------- State ------------- */
1576
+ // Initial state
1577
+ const initialState = {
1578
+ recentlyCopied: false,
1579
+ };
1580
+ // Initialize state
1581
+ const [state, dispatch] = React.useReducer(reducer, initialState);
1582
+ // Destructure common state
1583
+ const { recentlyCopied, } = state;
1584
+ /*------------------------------------------------------------------------*/
1585
+ /* Component Functions */
1586
+ /*------------------------------------------------------------------------*/
1587
+ // Determine the id for the copiable text field
1588
+ const copiableFieldClassName = `CopiableBox-text-box-${name}`;
1589
+ /**
1590
+ * Perform a copy
1591
+ * @author Gabe Abrams
1592
+ */
1593
+ const performCopy = () => __awaiter(void 0, void 0, void 0, function* () {
1594
+ // Write to clipboard
1595
+ let copyFailed = false;
1596
+ try {
1597
+ yield navigator.clipboard.writeText(text);
1598
+ }
1599
+ catch (err) {
1600
+ copyFailed = true;
1601
+ }
1602
+ // Try copy again if it failed
1603
+ if (copyFailed) {
1604
+ try {
1605
+ const input = (document.getElementsByClassName(copiableFieldClassName)[0]);
1606
+ input.focus();
1607
+ input.select();
1608
+ document.execCommand('copy');
1609
+ input.blur();
1610
+ }
1611
+ catch (err) {
1612
+ return alert$1('Unable to copy', 'Oops! We couldn\'t copy that to the clipboard. Please copy the text manually.');
1613
+ }
1614
+ }
1615
+ // Show copied notice
1616
+ dispatch({
1617
+ type: ActionType.IndicateRecentlyCopied,
1618
+ });
1619
+ // Wait a moment
1620
+ yield waitMs(4000);
1621
+ // Hide copied notice
1622
+ dispatch({
1623
+ type: ActionType.ClearRecentlyCopiedStatus,
1624
+ });
1625
+ });
1626
+ /*------------------------------------------------------------------------*/
1627
+ /* Render */
1628
+ /*------------------------------------------------------------------------*/
1629
+ /*----------------------------------------*/
1630
+ /* Main UI */
1631
+ /*----------------------------------------*/
1632
+ return (React__default["default"].createElement("div", { className: "input-group mb-2" },
1633
+ React__default["default"].createElement("span", { className: "input-group-text", style: {
1634
+ minWidth: (minLabelWidthRem
1635
+ ? `${minLabelWidthRem}rem`
1636
+ : undefined),
1637
+ } },
1638
+ labelIcon && (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: labelIcon, className: "me-1" })),
1639
+ label),
1640
+ multiline
1641
+ ? (React__default["default"].createElement("textarea", { className: `${copiableFieldClassName} CopiableBox-text-multiline form-control bg-white text-dark`, value: text, "aria-label": `${label} text`, rows: numVisibleLines, readOnly: true }))
1642
+ : (React__default["default"].createElement("input", { type: "text", className: `${copiableFieldClassName} CopiableBox-text-single-line form-control bg-white text-dark`, value: text, "aria-label": `${label} text`, readOnly: true })),
1643
+ React__default["default"].createElement("button", { className: "btn btn-secondary", type: "button", "aria-label": `copy ${label} to the clipboard`, disabled: recentlyCopied, style: {
1644
+ minWidth: '5.2rem',
1645
+ }, onClick: performCopy }, recentlyCopied
1646
+ ? 'Copied!'
1647
+ : (React__default["default"].createElement("span", null,
1648
+ React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faClipboard, className: "me-1" }),
1649
+ "Copy")))));
1650
+ };
1651
+
1322
1652
  /**
1323
1653
  * One minute in ms
1324
1654
  * @author Gabe Abrams
@@ -2071,7 +2401,7 @@ const getHumanReadableDate = (dateOrTimestamp) => {
2071
2401
  const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
2072
2402
  const currYear = getTimeInfoInET().year;
2073
2403
  // Create start of description
2074
- let description = `${monthMap[month]} ${getOrdinal(day)}`;
2404
+ let description = `${monthMap[month]} ${day}${getOrdinal(day)}`;
2075
2405
  // Add on year if it's different
2076
2406
  if (year !== currYear) {
2077
2407
  description += ` ${year}`;
@@ -2083,6 +2413,7 @@ const getHumanReadableDate = (dateOrTimestamp) => {
2083
2413
  exports.AppWrapper = AppWrapper;
2084
2414
  exports.ButtonInputGroup = ButtonInputGroup;
2085
2415
  exports.CheckboxButton = CheckboxButton;
2416
+ exports.CopiableBox = CopiableBox;
2086
2417
  exports.DAY_IN_MS = DAY_IN_MS;
2087
2418
  exports.Drawer = Drawer;
2088
2419
  exports.ErrorBox = ErrorBox;
@@ -2095,6 +2426,8 @@ exports.ModalButtonType = ModalButtonType$1;
2095
2426
  exports.ModalSize = ModalSize$1;
2096
2427
  exports.ModalType = ModalType$1;
2097
2428
  exports.ParamType = ParamType$1;
2429
+ exports.PopFailureMark = PopFailureMark;
2430
+ exports.PopPendingMark = PopPendingMark;
2098
2431
  exports.PopSuccessMark = PopSuccessMark;
2099
2432
  exports.RadioButton = RadioButton;
2100
2433
  exports.ReactKitErrorCode = ReactKitErrorCode$1;