dce-reactkit 3.7.3 → 3.7.5

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.
Files changed (46) hide show
  1. package/dist/cjs/index.js +159 -3
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/Modal.d.ts +1 -0
  4. package/dist/cjs/types/components/Shimmer.d.ts +13 -0
  5. package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.d.ts +13 -0
  6. package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +1 -0
  7. package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.d.ts +13 -0
  8. package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +1 -0
  9. package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +10 -0
  10. package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +1 -0
  11. package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.d.ts +11 -0
  12. package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +1 -0
  13. package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.d.ts +13 -0
  14. package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +1 -0
  15. package/dist/cjs/types/index.d.ts +6 -1
  16. package/dist/esm/index.js +155 -4
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/types/components/Modal.d.ts +1 -0
  19. package/dist/esm/types/components/Shimmer.d.ts +13 -0
  20. package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.d.ts +13 -0
  21. package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +1 -0
  22. package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.d.ts +13 -0
  23. package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +1 -0
  24. package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +10 -0
  25. package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +1 -0
  26. package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.d.ts +11 -0
  27. package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +1 -0
  28. package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.d.ts +13 -0
  29. package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +1 -0
  30. package/dist/esm/types/index.d.ts +6 -1
  31. package/dist/index.d.ts +62 -1
  32. package/package.json +1 -1
  33. package/src/components/CopiableBox.tsx +1 -1
  34. package/src/components/Modal.tsx +4 -1
  35. package/src/components/Shimmer.tsx +153 -0
  36. package/src/helpers/asyncArrayFunctions/everyAsync.test.ts +114 -0
  37. package/src/helpers/asyncArrayFunctions/everyAsync.ts +51 -0
  38. package/src/helpers/asyncArrayFunctions/filterAsync.test.ts +126 -0
  39. package/src/helpers/asyncArrayFunctions/filterAsync.ts +50 -0
  40. package/src/helpers/asyncArrayFunctions/forEachAsync.test.ts +136 -0
  41. package/src/helpers/asyncArrayFunctions/forEachAsync.ts +40 -0
  42. package/src/helpers/asyncArrayFunctions/mapAsync.test.ts +125 -0
  43. package/src/helpers/asyncArrayFunctions/mapAsync.ts +46 -0
  44. package/src/helpers/asyncArrayFunctions/someAsync.test.ts +92 -0
  45. package/src/helpers/asyncArrayFunctions/someAsync.ts +49 -0
  46. package/src/index.ts +10 -0
package/dist/cjs/index.js CHANGED
@@ -484,7 +484,7 @@ const Modal = (props) => {
484
484
  /*------------------------------------------------------------------------*/
485
485
  var _a;
486
486
  /* -------------- Props ------------- */
487
- const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, onTopOfOtherModals, } = props;
487
+ const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, children, onClose, dontAllowBackdropExit, dontShowXButton, onTopOfOtherModals, } = props;
488
488
  /* -------------- State ------------- */
489
489
  // True if animation is in use
490
490
  const [animatingIn, setAnimatingIn] = React.useState(true);
@@ -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 && (React__default["default"].createElement("button", { type: "button", className: "Modal-x-button btn-close", "aria-label": "Close", style: {
624
+ (onClose && !dontShowXButton) && (React__default["default"].createElement("button", { type: "button", className: "Modal-x-button btn-close", "aria-label": "Close", style: {
625
625
  backgroundColor: (isDarkModeOn()
626
626
  ? 'white'
627
627
  : undefined),
@@ -2209,7 +2209,7 @@ const CopiableBox = (props) => {
2209
2209
  /*----------------------------------------*/
2210
2210
  /* --------------- Main UI -------------- */
2211
2211
  /*----------------------------------------*/
2212
- return (React__default["default"].createElement("div", { className: "input-group mb-2" },
2212
+ return (React__default["default"].createElement("div", { className: "input-group" },
2213
2213
  (label || labelIcon) && (React__default["default"].createElement("span", { className: "input-group-text", style: {
2214
2214
  minWidth: (minLabelWidthRem
2215
2215
  ? `${minLabelWidthRem}rem`
@@ -43274,6 +43274,157 @@ const useForceRender = (useReducer) => {
43274
43274
  };
43275
43275
  };
43276
43276
 
43277
+ /**
43278
+ * Run the operator function on each item in the array, returning true if
43279
+ * the operator function returns true for every item in the array
43280
+ * @author Gabe Abrams
43281
+ * @param operatorFunction the operator function to apply. If it returns true
43282
+ * for every item, this function will return true
43283
+ * @returns true if the operator function returns true for every item in the array
43284
+ */
43285
+ const everyAsync = (array, operatorFunction) => __awaiter(void 0, void 0, void 0, function* () {
43286
+ // Create break logic
43287
+ let done = false;
43288
+ /**
43289
+ * Break the loop (checking stops here)
43290
+ * @author Gabe Abrams
43291
+ */
43292
+ const breakNow = () => {
43293
+ done = true;
43294
+ };
43295
+ // Loop through each item, checking
43296
+ for (let i = 0; i < array.length && !done; i++) {
43297
+ const passed = yield operatorFunction(array[i], i, {
43298
+ breakNow,
43299
+ array,
43300
+ });
43301
+ // Check if this one failed or if loop was broken
43302
+ if (!passed || done) {
43303
+ return false;
43304
+ }
43305
+ }
43306
+ // Return true because none returned false
43307
+ return true;
43308
+ });
43309
+
43310
+ /**
43311
+ * Run the operator function on each item in the array, returning a new array
43312
+ * that only contains the items that pass the filter
43313
+ * @author Gabe Abrams
43314
+ * @param operatorFunction the operator function to apply. If it returns true
43315
+ * for an item, the item will be included in the returned array
43316
+ * @returns the filtered array
43317
+ */
43318
+ const filterAsync = (array, operatorFunction) => __awaiter(void 0, void 0, void 0, function* () {
43319
+ // Create break logic
43320
+ let done = false;
43321
+ /**
43322
+ * Break the loop (filtering stops here)
43323
+ * @author Gabe Abrams
43324
+ */
43325
+ const breakNow = () => {
43326
+ done = true;
43327
+ };
43328
+ // Loop through each item, filtering
43329
+ const output = [];
43330
+ for (let i = 0; i < array.length && !done; i++) {
43331
+ const included = yield operatorFunction(array[i], i, {
43332
+ breakNow,
43333
+ array,
43334
+ });
43335
+ if (included && !done) {
43336
+ output.push(array[i]);
43337
+ }
43338
+ }
43339
+ // Return results
43340
+ return output;
43341
+ });
43342
+
43343
+ /**
43344
+ * Run the operator function on each item in the array
43345
+ * @author Gabe Abrams
43346
+ * @param operatorFunction the operator function to apply
43347
+ */
43348
+ const forEachAsync = (array, operatorFunction) => __awaiter(void 0, void 0, void 0, function* () {
43349
+ // Create break logic
43350
+ let done = false;
43351
+ /**
43352
+ * Break the loop
43353
+ * @author Gabe Abrams
43354
+ */
43355
+ const breakNow = () => {
43356
+ done = true;
43357
+ };
43358
+ // Loop through each item
43359
+ for (let i = 0; i < array.length && !done; i++) {
43360
+ yield operatorFunction(array[i], i, {
43361
+ breakNow,
43362
+ array,
43363
+ });
43364
+ }
43365
+ });
43366
+
43367
+ /**
43368
+ * Run the operator function on each item in the array, collecting all results
43369
+ * @author Gabe Abrams
43370
+ * @param operatorFunction the operator function to apply
43371
+ * @returns the array of results
43372
+ */
43373
+ const mapAsync = (array, operatorFunction) => __awaiter(void 0, void 0, void 0, function* () {
43374
+ // Create break logic
43375
+ let done = false;
43376
+ /**
43377
+ * Break the loop
43378
+ * @author Gabe Abrams
43379
+ */
43380
+ const breakNow = () => {
43381
+ done = true;
43382
+ };
43383
+ // Loop through each item, collecting results
43384
+ const results = [];
43385
+ for (let i = 0; i < array.length && !done; i++) {
43386
+ const result = yield operatorFunction(array[i], i, {
43387
+ breakNow,
43388
+ array,
43389
+ });
43390
+ results.push(result);
43391
+ }
43392
+ // Return results
43393
+ return results;
43394
+ });
43395
+
43396
+ /**
43397
+ * Run the operator function on each item in the array, returning true if
43398
+ * the operator function returns true for any item in the array
43399
+ * @author Gabe Abrams
43400
+ * @param operatorFunction the operator function to apply. If it returns true
43401
+ * for any item, this function will return true
43402
+ * @returns true if the operator function returns true for any item in the array
43403
+ */
43404
+ const someAsync = (array, operatorFunction) => __awaiter(void 0, void 0, void 0, function* () {
43405
+ // Create break logic
43406
+ let done = false;
43407
+ /**
43408
+ * Break the loop (checking stops here)
43409
+ * @author Gabe Abrams
43410
+ */
43411
+ const breakNow = () => {
43412
+ done = true;
43413
+ };
43414
+ // Loop through each item, checking
43415
+ for (let i = 0; i < array.length && !done; i++) {
43416
+ const passed = yield operatorFunction(array[i], i, {
43417
+ breakNow,
43418
+ array,
43419
+ });
43420
+ if (passed && !done) {
43421
+ return true;
43422
+ }
43423
+ }
43424
+ // Return false because none returned true
43425
+ return false;
43426
+ });
43427
+
43277
43428
  /**
43278
43429
  * Days of the week
43279
43430
  * @author Gabe Abrams
@@ -43340,8 +43491,11 @@ exports.ceilToNumDecimals = ceilToNumDecimals;
43340
43491
  exports.combineClassNames = combineClassNames;
43341
43492
  exports.compareArraysByProp = compareArraysByProp;
43342
43493
  exports.confirm = confirm;
43494
+ exports.everyAsync = everyAsync;
43343
43495
  exports.extractProp = extractProp;
43496
+ exports.filterAsync = filterAsync;
43344
43497
  exports.floorToNumDecimals = floorToNumDecimals;
43498
+ exports.forEachAsync = forEachAsync;
43345
43499
  exports.forceNumIntoBounds = forceNumIntoBounds;
43346
43500
  exports.genCSV = genCSV;
43347
43501
  exports.genCommaList = genCommaList;
@@ -43362,6 +43516,7 @@ exports.isMobileOrTablet = isMobileOrTablet;
43362
43516
  exports.leaveToURL = leaveToURL;
43363
43517
  exports.logClientEvent = logClientEvent;
43364
43518
  exports.makeLinksClickable = makeLinksClickable;
43519
+ exports.mapAsync = mapAsync;
43365
43520
  exports.onlyKeepLetters = onlyKeepLetters;
43366
43521
  exports.padDecimalZeros = padDecimalZeros;
43367
43522
  exports.padZerosLeft = padZerosLeft;
@@ -43370,6 +43525,7 @@ exports.prefixWithAOrAn = prefixWithAOrAn;
43370
43525
  exports.roundToNumDecimals = roundToNumDecimals;
43371
43526
  exports.setClientEventMetadataPopulator = setClientEventMetadataPopulator;
43372
43527
  exports.showFatalError = showFatalError;
43528
+ exports.someAsync = someAsync;
43373
43529
  exports.startMinWait = startMinWait;
43374
43530
  exports.stringsToHumanReadableList = stringsToHumanReadableList;
43375
43531
  exports.stubServerEndpoint = stubServerEndpoint;