@elliemae/ds-utilities 1.60.0 → 2.0.0-alpha.12

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 (165) hide show
  1. package/cjs/capitalize.js +7 -0
  2. package/cjs/compose.js +8 -8
  3. package/cjs/getComponentFromProps.js +13 -7
  4. package/cjs/hooks/index.js +33 -51
  5. package/cjs/hooks/useCancellableDelayedCallback.js +6 -8
  6. package/cjs/hooks/useDerivedStateFromProps.js +28 -35
  7. package/cjs/hooks/useExecutionTimer.js +7 -11
  8. package/cjs/hooks/useExpandState.js +53 -59
  9. package/cjs/hooks/useHotkeys.js +11 -12
  10. package/cjs/hooks/useHoverHandlersDelay.js +10 -11
  11. package/cjs/hooks/useOnElementResize.js +11 -26
  12. package/cjs/hooks/useParentElement.js +4 -13
  13. package/cjs/hooks/usePrevious.js +2 -3
  14. package/cjs/hooks/useResizeObserver.js +11 -21
  15. package/cjs/hooks/useSetRef.js +3 -4
  16. package/cjs/hooks/useShouldRecalculate.js +1 -2
  17. package/cjs/hooks/useWindowScrollerList.js +17 -16
  18. package/cjs/hooks/useWindowSize.js +4 -13
  19. package/cjs/index.js +73 -162
  20. package/cjs/onClickHandlerForNonInteractiveElements.js +13 -14
  21. package/cjs/operators.js +19 -56
  22. package/cjs/platform.js +2 -3
  23. package/cjs/reactTypesUtility.js +1 -2
  24. package/cjs/scrollingTimer.js +3 -4
  25. package/cjs/system.js +11 -5
  26. package/cjs/timeUtils.js +15 -15
  27. package/cjs/utils.js +70 -149
  28. package/cjs/validations.js +17 -17
  29. package/esm/capitalize.js +3 -0
  30. package/esm/compose.js +8 -8
  31. package/esm/getComponentFromProps.js +12 -5
  32. package/esm/hooks/index.js +1 -10
  33. package/esm/hooks/useCancellableDelayedCallback.js +6 -8
  34. package/esm/hooks/useDerivedStateFromProps.js +29 -32
  35. package/esm/hooks/useExecutionTimer.js +7 -11
  36. package/esm/hooks/useExpandState.js +51 -56
  37. package/esm/hooks/useHotkeys.js +10 -11
  38. package/esm/hooks/useHoverHandlersDelay.js +10 -11
  39. package/esm/hooks/useOnElementResize.js +11 -22
  40. package/esm/hooks/useParentElement.js +4 -9
  41. package/esm/hooks/usePrevious.js +2 -3
  42. package/esm/hooks/useResizeObserver.js +11 -20
  43. package/esm/hooks/useSetRef.js +3 -4
  44. package/esm/hooks/useShouldRecalculate.js +1 -2
  45. package/esm/hooks/useWindowScrollerList.js +18 -17
  46. package/esm/hooks/useWindowSize.js +4 -9
  47. package/esm/index.js +2 -9
  48. package/esm/onClickHandlerForNonInteractiveElements.js +13 -14
  49. package/esm/operators.js +19 -52
  50. package/esm/platform.js +2 -3
  51. package/esm/reactTypesUtility.js +0 -1
  52. package/esm/scrollingTimer.js +3 -4
  53. package/esm/system.js +11 -5
  54. package/esm/timeUtils.js +15 -15
  55. package/esm/utils.js +31 -35
  56. package/esm/validations.js +17 -17
  57. package/package.json +135 -10
  58. package/types/capitalize.d.ts +1 -0
  59. package/types/compose.d.ts +11 -0
  60. package/types/getComponentFromProps.d.ts +2 -0
  61. package/types/hooks/index.d.ts +18 -0
  62. package/types/hooks/useCancellableDelayedCallback.d.ts +1 -0
  63. package/types/hooks/useDerivedStateFromProps.d.ts +1 -0
  64. package/types/hooks/useExecutionTimer.d.ts +1 -0
  65. package/types/hooks/useExpandState.d.ts +22 -0
  66. package/types/hooks/useHotkeys.d.ts +5 -0
  67. package/types/hooks/useHoverHandlersDelay.d.ts +9 -0
  68. package/types/hooks/useOnElementResize.d.ts +2 -0
  69. package/types/hooks/useParentElement.d.ts +1 -0
  70. package/types/hooks/usePrevious.d.ts +2 -0
  71. package/types/hooks/useResizeObserver.d.ts +2 -0
  72. package/types/hooks/useSetRef.d.ts +2 -0
  73. package/types/hooks/useShouldRecalculate.d.ts +1 -0
  74. package/types/hooks/useWindowScrollerList.d.ts +4 -0
  75. package/types/hooks/useWindowSize.d.ts +1 -0
  76. package/types/index.d.ts +13 -0
  77. package/types/onClickHandlerForNonInteractiveElements.d.ts +12 -0
  78. package/types/operators.d.ts +31 -0
  79. package/types/platform.d.ts +2 -0
  80. package/types/reactTypesUtility.d.ts +6 -0
  81. package/types/scrollingTimer.d.ts +1 -0
  82. package/types/system.d.ts +3 -0
  83. package/types/timeUtils.d.ts +7 -0
  84. package/types/utils.d.ts +23 -0
  85. package/types/validations.d.ts +23 -0
  86. package/cjs/compose.js.map +0 -1
  87. package/cjs/getComponentFromProps.js.map +0 -1
  88. package/cjs/hooks/index.js.map +0 -1
  89. package/cjs/hooks/useCancellableDelayedCallback.js.map +0 -1
  90. package/cjs/hooks/useDerivedStateFromProps.js.map +0 -1
  91. package/cjs/hooks/useExecutionTimer.js.map +0 -1
  92. package/cjs/hooks/useExpandState.js.map +0 -1
  93. package/cjs/hooks/useHotkeys.js.map +0 -1
  94. package/cjs/hooks/useHoverHandlersDelay.js.map +0 -1
  95. package/cjs/hooks/useOnElementResize.js.map +0 -1
  96. package/cjs/hooks/useParentElement.js.map +0 -1
  97. package/cjs/hooks/usePrevious.js.map +0 -1
  98. package/cjs/hooks/useResizeObserver.js.map +0 -1
  99. package/cjs/hooks/useSetRef.js.map +0 -1
  100. package/cjs/hooks/useShouldRecalculate.js.map +0 -1
  101. package/cjs/hooks/useWindowScrollerList.js.map +0 -1
  102. package/cjs/hooks/useWindowSize.js.map +0 -1
  103. package/cjs/index.js.map +0 -1
  104. package/cjs/onClickHandlerForNonInteractiveElements.js.map +0 -1
  105. package/cjs/operators.js.map +0 -1
  106. package/cjs/platform.js.map +0 -1
  107. package/cjs/reactTypesUtility.js.map +0 -1
  108. package/cjs/scrollingTimer.js.map +0 -1
  109. package/cjs/system.js.map +0 -1
  110. package/cjs/timeUtils.js.map +0 -1
  111. package/cjs/utils.js.map +0 -1
  112. package/cjs/validations.js.map +0 -1
  113. package/compose/package.json +0 -10
  114. package/esm/compose.js.map +0 -1
  115. package/esm/getComponentFromProps.js.map +0 -1
  116. package/esm/hooks/index.js.map +0 -1
  117. package/esm/hooks/useCancellableDelayedCallback.js.map +0 -1
  118. package/esm/hooks/useDerivedStateFromProps.js.map +0 -1
  119. package/esm/hooks/useExecutionTimer.js.map +0 -1
  120. package/esm/hooks/useExpandState.js.map +0 -1
  121. package/esm/hooks/useHotkeys.js.map +0 -1
  122. package/esm/hooks/useHoverHandlersDelay.js.map +0 -1
  123. package/esm/hooks/useOnElementResize.js.map +0 -1
  124. package/esm/hooks/useParentElement.js.map +0 -1
  125. package/esm/hooks/usePrevious.js.map +0 -1
  126. package/esm/hooks/useResizeObserver.js.map +0 -1
  127. package/esm/hooks/useSetRef.js.map +0 -1
  128. package/esm/hooks/useShouldRecalculate.js.map +0 -1
  129. package/esm/hooks/useWindowScrollerList.js.map +0 -1
  130. package/esm/hooks/useWindowSize.js.map +0 -1
  131. package/esm/index.js.map +0 -1
  132. package/esm/onClickHandlerForNonInteractiveElements.js.map +0 -1
  133. package/esm/operators.js.map +0 -1
  134. package/esm/platform.js.map +0 -1
  135. package/esm/reactTypesUtility.js.map +0 -1
  136. package/esm/scrollingTimer.js.map +0 -1
  137. package/esm/system.js.map +0 -1
  138. package/esm/timeUtils.js.map +0 -1
  139. package/esm/utils.js.map +0 -1
  140. package/esm/validations.js.map +0 -1
  141. package/getComponentFromProps/package.json +0 -10
  142. package/hooks/package.json +0 -10
  143. package/hooks/useCancellableDelayedCallback/package.json +0 -10
  144. package/hooks/useDerivedStateFromProps/package.json +0 -10
  145. package/hooks/useExecutionTimer/package.json +0 -10
  146. package/hooks/useExpandState/package.json +0 -10
  147. package/hooks/useHotkeys/package.json +0 -10
  148. package/hooks/useHoverHandlersDelay/package.json +0 -10
  149. package/hooks/useOnElementResize/package.json +0 -10
  150. package/hooks/useParentElement/package.json +0 -10
  151. package/hooks/usePrevious/package.json +0 -10
  152. package/hooks/useResizeObserver/package.json +0 -10
  153. package/hooks/useSetRef/package.json +0 -10
  154. package/hooks/useShouldRecalculate/package.json +0 -10
  155. package/hooks/useWindowScrollerList/package.json +0 -10
  156. package/hooks/useWindowSize/package.json +0 -10
  157. package/onClickHandlerForNonInteractiveElements/package.json +0 -10
  158. package/operators/package.json +0 -10
  159. package/platform/package.json +0 -10
  160. package/reactTypesUtility/package.json +0 -10
  161. package/scrollingTimer/package.json +0 -10
  162. package/system/package.json +0 -10
  163. package/timeUtils/package.json +0 -10
  164. package/utils/package.json +0 -10
  165. package/validations/package.json +0 -10
package/esm/operators.js CHANGED
@@ -1,4 +1,6 @@
1
- import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import 'core-js/modules/esnext.async-iterator.map.js';
3
+ import 'core-js/modules/esnext.iterator.map.js';
2
4
  import { isEmpty } from 'lodash';
3
5
 
4
6
  /**
@@ -7,12 +9,8 @@ import { isEmpty } from 'lodash';
7
9
  * @param value
8
10
  */
9
11
 
10
- var checkNotEmpty = function checkNotEmpty(value) {
11
- return value === '' || value === undefined || value == [] || value === null || isEmpty(value);
12
- };
13
- var checkEmpty = function checkEmpty(value) {
14
- return !isEmpty(value);
15
- };
12
+ const checkNotEmpty = value => value === '' || value === undefined || value == [] || value === null || isEmpty(value);
13
+ const checkEmpty = value => !isEmpty(value);
16
14
  /**
17
15
  * @param value: number
18
16
  * @param comparator: number
@@ -20,9 +18,7 @@ var checkEmpty = function checkEmpty(value) {
20
18
  * @param comparator
21
19
  */
22
20
 
23
- var greaterThan = function greaterThan(value, comparator) {
24
- return value > comparator;
25
- };
21
+ const greaterThan = (value, comparator) => value > comparator;
26
22
  /**
27
23
  * Check if a valid date with format MM/DD/YYYY
28
24
  *
@@ -30,50 +26,21 @@ var greaterThan = function greaterThan(value, comparator) {
30
26
  * @param value
31
27
  */
32
28
 
33
- var validDate = function validDate(value) {
34
- var dateValidationRegex = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
29
+ const validDate = value => {
30
+ const dateValidationRegex = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
35
31
  if (!dateValidationRegex.test(value)) return false;
36
-
37
- var _value$split$map = value.split('/').map(function (n) {
38
- return Number(n);
39
- }),
40
- _value$split$map2 = _slicedToArray(_value$split$map, 3),
41
- m = _value$split$map2[0],
42
- d = _value$split$map2[1],
43
- y = _value$split$map2[2];
44
-
32
+ const [m, d, y] = value.split('/').map(n => Number(n));
45
33
  return m === Number(new Date(y, m - 1, d).getMonth()) + 1 && d === Number(new Date(y, m - 1, d).getDate());
46
34
  };
47
- var equal = function equal(a, b) {
48
- return a === b;
49
- };
50
- var notEqual = function notEqual(a, b) {
51
- return !equal(a, b);
52
- };
53
- var isNull = function isNull(a) {
54
- return checkNotEmpty(a);
55
- };
56
- var isNotNull = function isNotNull(a) {
57
- return !isNull(a);
58
- };
59
- var isIn = function isIn(a, b) {
60
- return b.indexOf(a) > -1;
61
- };
62
- var isNotIn = function isNotIn(a, b) {
63
- return !isIn(a, b);
64
- };
65
- var greaterThanOrEquals = function greaterThanOrEquals(value, comparator) {
66
- return value >= comparator;
67
- };
68
- var lessThanOrEquals = function lessThanOrEquals(value, comparator) {
69
- return value <= comparator;
70
- };
71
- var startsWith = function startsWith(value, comparator) {
72
- return String(value).startsWith(comparator);
73
- };
74
- var contains = function contains(value, comparator) {
75
- return String(value).includes(comparator);
76
- };
35
+ const equal = (a, b) => a === b;
36
+ const notEqual = (a, b) => !equal(a, b);
37
+ const isNull = a => checkNotEmpty(a);
38
+ const isNotNull = a => !isNull(a);
39
+ const isIn = (a, b) => b.indexOf(a) > -1;
40
+ const isNotIn = (a, b) => !isIn(a, b);
41
+ const greaterThanOrEquals = (value, comparator) => value >= comparator;
42
+ const lessThanOrEquals = (value, comparator) => value <= comparator;
43
+ const startsWith = (value, comparator) => String(value).startsWith(comparator);
44
+ const contains = (value, comparator) => String(value).includes(comparator);
77
45
 
78
46
  export { checkEmpty, checkNotEmpty, contains, equal, greaterThan, greaterThanOrEquals, isIn, isNotIn, isNotNull, isNull, lessThanOrEquals, notEqual, startsWith, validDate };
79
- //# sourceMappingURL=operators.js.map
package/esm/platform.js CHANGED
@@ -1,5 +1,4 @@
1
- var DOCUMENT = typeof document !== 'undefined' ? document : null;
2
- var WINDOW = typeof window !== 'undefined' ? window : null;
1
+ const DOCUMENT = typeof document !== 'undefined' ? document : null;
2
+ const WINDOW = typeof window !== 'undefined' ? window : null;
3
3
 
4
4
  export { DOCUMENT, WINDOW };
5
- //# sourceMappingURL=platform.js.map
@@ -20,4 +20,3 @@ function isCompositeTypeElement(element) {
20
20
  }
21
21
 
22
22
  export { isClassComponent, isCompositeTypeElement, isDOMTypeElement, isElement, isFunctionComponent, isReactComponent };
23
- //# sourceMappingURL=reactTypesUtility.js.map
@@ -1,13 +1,13 @@
1
1
  function resetTimer(func) {
2
- var timeout;
2
+ let timeout;
3
3
  return function () {
4
4
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5
5
  args[_key] = arguments[_key];
6
6
  }
7
7
 
8
- var context = this;
8
+ const context = this;
9
9
 
10
- var lastCall = function lastCall() {
10
+ const lastCall = () => {
11
11
  timeout = null;
12
12
  func.apply(context, args);
13
13
  };
@@ -18,4 +18,3 @@ function resetTimer(func) {
18
18
  }
19
19
 
20
20
  export { resetTimer };
21
- //# sourceMappingURL=scrollingTimer.js.map
package/esm/system.js CHANGED
@@ -1,8 +1,15 @@
1
- import '@babel/runtime/helpers/esm/toConsumableArray';
1
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.for-each.js';
4
+ import 'core-js/modules/esnext.async-iterator.filter.js';
5
+ import 'core-js/modules/esnext.iterator.filter.js';
2
6
  import '@babel/runtime/helpers/esm/defineProperty';
7
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
8
+ import 'core-js/modules/esnext.iterator.reduce.js';
9
+ import 'core-js/modules/web.dom-collections.iterator.js';
3
10
  import { isFunction } from 'lodash';
4
11
 
5
- var setRef = function setRef(ref, value) {
12
+ const setRef = (ref, value) => {
6
13
  if (isFunction(ref)) {
7
14
  ref(value);
8
15
  } else if (ref) {
@@ -14,9 +21,9 @@ function mergeRefs() {
14
21
  refs[_key] = arguments[_key];
15
22
  }
16
23
 
17
- return function (node) {
24
+ return node => {
18
25
  if (!node) return;
19
- refs.forEach(function (ref) {
26
+ refs.forEach(ref => {
20
27
  if (isFunction(ref)) {
21
28
  ref(node);
22
29
  } else if (ref) {
@@ -28,4 +35,3 @@ function mergeRefs() {
28
35
  function logger() {}
29
36
 
30
37
  export { logger, mergeRefs, setRef };
31
- //# sourceMappingURL=system.js.map
package/esm/timeUtils.js CHANGED
@@ -1,20 +1,20 @@
1
- import '@babel/runtime/helpers/esm/toConsumableArray';
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
2
3
  import '@babel/runtime/helpers/esm/defineProperty';
4
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
5
+ import 'core-js/modules/esnext.iterator.constructor.js';
6
+ import 'core-js/modules/esnext.iterator.reduce.js';
7
+ import 'core-js/modules/web.dom-collections.iterator.js';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
9
+ import 'core-js/modules/esnext.iterator.for-each.js';
3
10
  import { padStart } from 'lodash';
4
11
 
5
- var getVisibleTimeByFormat = function getVisibleTimeByFormat(format) {
6
- return {
7
- showHours: format.indexOf('H') > -1 || format.indexOf('h') > -1 || format.indexOf('k') > -1,
8
- showMinutes: format.indexOf('m') > -1,
9
- showSeconds: format.indexOf('s') > -1,
10
- use12Hours: format.indexOf('A') > -1 || format.indexOf('h') > -1 || format.indexOf('a') > -1
11
- };
12
- };
13
- var addLeadingZeros = function addLeadingZeros(count) {
14
- return function (number) {
15
- return padStart(String(number), count, '0');
16
- };
17
- };
12
+ const getVisibleTimeByFormat = format => ({
13
+ showHours: format.indexOf('H') > -1 || format.indexOf('h') > -1 || format.indexOf('k') > -1,
14
+ showMinutes: format.indexOf('m') > -1,
15
+ showSeconds: format.indexOf('s') > -1,
16
+ use12Hours: format.indexOf('A') > -1 || format.indexOf('h') > -1 || format.indexOf('a') > -1
17
+ });
18
+ const addLeadingZeros = count => number => padStart(String(number), count, '0');
18
19
 
19
20
  export { addLeadingZeros, getVisibleTimeByFormat };
20
- //# sourceMappingURL=timeUtils.js.map
package/esm/utils.js CHANGED
@@ -1,5 +1,12 @@
1
- import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
2
3
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
4
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
5
+ import 'core-js/modules/esnext.iterator.constructor.js';
6
+ import 'core-js/modules/esnext.iterator.reduce.js';
7
+ import 'core-js/modules/web.dom-collections.iterator.js';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
9
+ import 'core-js/modules/esnext.iterator.for-each.js';
3
10
  import { omit, cloneDeep, isFunction } from 'lodash';
4
11
  export { cloneDeep, curry, debounce, differenceBy, differenceWith, filter, findIndex, get, groupBy, isBoolean, isEmpty, isEqual, isEqualWith, isFunction, isNaN, isObject, isString, maxBy, meanBy, noop, omit, orderBy, padStart, parseInt, pick, pickBy, property, pull, range, set, sortBy, sumBy, throttle, transform, uniq, uniqBy, values } from 'lodash';
5
12
 
@@ -12,51 +19,43 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
19
  * @param {...any} classnames
13
20
  */
14
21
 
15
- var cx = function cx() {
22
+ const cx = function () {
16
23
  for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
17
24
  classnames[_key] = arguments[_key];
18
25
  }
19
26
 
20
- return classnames.reduce(function (result, cn) {
21
- return "".concat(result, " ").concat(cn || '');
22
- }, '');
27
+ return classnames.reduce((result, cn) => "".concat(result, " ").concat(cn || ''), '');
23
28
  }; // if entry exists, remove it, if not, add it
24
29
 
25
- var toggleInObject = function toggleInObject(obj, key, value) {
26
- return obj[key] !== undefined ? omit(obj, [key]) : _objectSpread(_objectSpread({}, obj), {}, _defineProperty({}, key, value));
27
- };
30
+ const toggleInObject = (obj, key, value) => obj[key] !== undefined ? omit(obj, [key]) : _objectSpread(_objectSpread({}, obj), {}, {
31
+ [key]: value
32
+ });
28
33
 
29
- var toggleInArray = function toggleInArray(array, value) {
30
- return array.indexOf(value) === -1 ? [value] : [];
31
- };
34
+ const toggleInArray = (array, value) => array.indexOf(value) === -1 ? [value] : [];
32
35
 
33
- var arrayMoveMutate = function arrayMoveMutate(array, from, to) {
36
+ const arrayMoveMutate = (array, from, to) => {
34
37
  array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
35
38
  };
36
39
 
37
- var arrayMove = function arrayMove(array, from, to) {
40
+ const arrayMove = (array, from, to) => {
38
41
  array = array.slice();
39
42
  arrayMoveMutate(array, from, to);
40
43
  return array;
41
44
  };
42
45
 
43
- var accessorDefault = function accessorDefault(item) {
44
- return item;
45
- };
46
+ const accessorDefault = item => item;
46
47
 
47
- var addOrRemove = function addOrRemove(array, item) {
48
- var accessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : accessorDefault;
49
- var index = array.findIndex(function (iItem) {
50
- return accessor(iItem) === accessor(item);
51
- });
48
+ const addOrRemove = function (array, item) {
49
+ let accessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : accessorDefault;
50
+ const index = array.findIndex(iItem => accessor(iItem) === accessor(item));
52
51
 
53
52
  if (index !== -1) {
54
- var nextArray = cloneDeep(array);
53
+ const nextArray = cloneDeep(array);
55
54
  nextArray.splice(index, 1);
56
55
  return nextArray;
57
56
  }
58
57
 
59
- return [].concat(_toConsumableArray(array), [item]);
58
+ return [...array, item];
60
59
  };
61
60
 
62
61
  function runAll() {
@@ -69,16 +68,16 @@ function runAll() {
69
68
  args[_key3] = arguments[_key3];
70
69
  }
71
70
 
72
- return fns.forEach(function (fn) {
71
+ return fns.forEach(fn => {
73
72
  if (Array.isArray(fn)) runAll(fn);
74
- if (isFunction(fn)) fn.apply(void 0, args);
73
+ if (isFunction(fn)) fn(...args);
75
74
  });
76
75
  };
77
76
  }
78
77
  function hashArray(arr, fieldName) {
79
- return arr.reduce(function (result, item) {
80
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, fieldName ? item[fieldName] : item, true));
81
- }, {});
78
+ return arr.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
79
+ [fieldName ? item[fieldName] : item]: true
80
+ }), {});
82
81
  }
83
82
  function safeCall(fun) {
84
83
  if (isFunction(fun)) {
@@ -86,18 +85,15 @@ function safeCall(fun) {
86
85
  args[_key4 - 1] = arguments[_key4];
87
86
  }
88
87
 
89
- fun.apply(void 0, args);
88
+ fun(...args);
90
89
  }
91
90
  }
92
- var removeUndefinedProperties = function removeUndefinedProperties(obj) {
93
- var cleanObject = _objectSpread({}, obj);
91
+ const removeUndefinedProperties = obj => {
92
+ const cleanObject = _objectSpread({}, obj);
94
93
 
95
- Object.keys(obj).forEach(function (key) {
96
- return cleanObject[key] === undefined && delete cleanObject[key];
97
- });
94
+ Object.keys(obj).forEach(key => cleanObject[key] === undefined && delete cleanObject[key]);
98
95
  return cleanObject;
99
96
  };
100
97
  var utils = {};
101
98
 
102
99
  export { addOrRemove, arrayMove, cx, utils as default, hashArray, removeUndefinedProperties, runAll, safeCall, toggleInArray, toggleInObject };
103
- //# sourceMappingURL=utils.js.map
@@ -1,32 +1,33 @@
1
1
  import { checkNotEmpty, greaterThan, validDate } from './operators.js';
2
- import '@babel/runtime/helpers/esm/slicedToArray';
3
- import 'lodash';
4
2
 
5
- var isRequired = function isRequired(_ref) {
6
- var value = _ref.value,
7
- _ref$help = _ref.help,
8
- help = _ref$help === void 0 ? 'Field is Required' : _ref$help;
3
+ const isRequired = _ref => {
4
+ let {
5
+ value,
6
+ help = 'Field is Required'
7
+ } = _ref;
9
8
  return {
10
9
  payload: help,
11
10
  error: checkNotEmpty(value)
12
11
  };
13
12
  };
14
- var isGreaterThan = function isGreaterThan(_ref2) {
15
- var value = _ref2.value,
16
- help = _ref2.help,
17
- _ref2$comparator = _ref2.comparator,
18
- comparator = _ref2$comparator === void 0 ? 0 : _ref2$comparator;
13
+ const isGreaterThan = _ref2 => {
14
+ let {
15
+ value,
16
+ help,
17
+ comparator = 0
18
+ } = _ref2;
19
19
  if (!help) help = "Max value ".concat(comparator);
20
20
  return {
21
21
  payload: help,
22
22
  error: greaterThan(value, comparator)
23
23
  };
24
24
  };
25
- var isValidDate = function isValidDate(_ref3) {
26
- var value = _ref3.value,
27
- help = _ref3.help,
28
- _ref3$format = _ref3.format,
29
- format = _ref3$format === void 0 ? 'MM/DD/AAA' : _ref3$format;
25
+ const isValidDate = _ref3 => {
26
+ let {
27
+ value,
28
+ help,
29
+ format = 'MM/DD/AAA'
30
+ } = _ref3;
30
31
  if (!help) help = "Valid Date is required ".concat(format);
31
32
  return {
32
33
  payload: help,
@@ -35,4 +36,3 @@ var isValidDate = function isValidDate(_ref3) {
35
36
  };
36
37
 
37
38
  export { isGreaterThan, isRequired, isValidDate };
38
- //# sourceMappingURL=validations.js.map
package/package.json CHANGED
@@ -1,14 +1,138 @@
1
1
  {
2
2
  "name": "@elliemae/ds-utilities",
3
- "version": "1.60.0",
3
+ "version": "2.0.0-alpha.12",
4
4
  "license": "MIT",
5
- "description": "Ellie Mae - Dim Sum - Utilities",
6
- "main": "cjs/index.js",
7
- "module": "esm/index.js",
5
+ "description": "ICE MT - Dimsum - Utilities",
6
+ "module": "./esm/index.js",
7
+ "main": "./cjs/index.js",
8
+ "types": "./types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./esm/index.js",
12
+ "require": "./cjs/index.js"
13
+ },
14
+ "./validations": {
15
+ "import": "./esm/validations.js",
16
+ "require": "./cjs/validations.js"
17
+ },
18
+ "./utils": {
19
+ "import": "./esm/utils.js",
20
+ "require": "./cjs/utils.js"
21
+ },
22
+ "./timeUtils": {
23
+ "import": "./esm/timeUtils.js",
24
+ "require": "./cjs/timeUtils.js"
25
+ },
26
+ "./system": {
27
+ "import": "./esm/system.js",
28
+ "require": "./cjs/system.js"
29
+ },
30
+ "./scrollingTimer": {
31
+ "import": "./esm/scrollingTimer.js",
32
+ "require": "./cjs/scrollingTimer.js"
33
+ },
34
+ "./reactTypesUtility": {
35
+ "import": "./esm/reactTypesUtility.js",
36
+ "require": "./cjs/reactTypesUtility.js"
37
+ },
38
+ "./platform": {
39
+ "import": "./esm/platform.js",
40
+ "require": "./cjs/platform.js"
41
+ },
42
+ "./operators": {
43
+ "import": "./esm/operators.js",
44
+ "require": "./cjs/operators.js"
45
+ },
46
+ "./onClickHandlerForNonInteractiveElements": {
47
+ "import": "./esm/onClickHandlerForNonInteractiveElements.js",
48
+ "require": "./cjs/onClickHandlerForNonInteractiveElements.js"
49
+ },
50
+ "./hooks/useWindowSize": {
51
+ "import": "./esm/hooks/useWindowSize.js",
52
+ "require": "./cjs/hooks/useWindowSize.js"
53
+ },
54
+ "./hooks/useWindowScrollerList": {
55
+ "import": "./esm/hooks/useWindowScrollerList.js",
56
+ "require": "./cjs/hooks/useWindowScrollerList.js"
57
+ },
58
+ "./hooks/useShouldRecalculate": {
59
+ "import": "./esm/hooks/useShouldRecalculate.js",
60
+ "require": "./cjs/hooks/useShouldRecalculate.js"
61
+ },
62
+ "./hooks/useSetRef": {
63
+ "import": "./esm/hooks/useSetRef.js",
64
+ "require": "./cjs/hooks/useSetRef.js"
65
+ },
66
+ "./hooks/useResizeObserver": {
67
+ "import": "./esm/hooks/useResizeObserver.js",
68
+ "require": "./cjs/hooks/useResizeObserver.js"
69
+ },
70
+ "./hooks/usePrevious": {
71
+ "import": "./esm/hooks/usePrevious.js",
72
+ "require": "./cjs/hooks/usePrevious.js"
73
+ },
74
+ "./hooks/useParentElement": {
75
+ "import": "./esm/hooks/useParentElement.js",
76
+ "require": "./cjs/hooks/useParentElement.js"
77
+ },
78
+ "./hooks/useOnElementResize": {
79
+ "import": "./esm/hooks/useOnElementResize.js",
80
+ "require": "./cjs/hooks/useOnElementResize.js"
81
+ },
82
+ "./hooks/useHoverHandlersDelay": {
83
+ "import": "./esm/hooks/useHoverHandlersDelay.js",
84
+ "require": "./cjs/hooks/useHoverHandlersDelay.js"
85
+ },
86
+ "./hooks/useHotkeys": {
87
+ "import": "./esm/hooks/useHotkeys.js",
88
+ "require": "./cjs/hooks/useHotkeys.js"
89
+ },
90
+ "./hooks/useExpandState": {
91
+ "import": "./esm/hooks/useExpandState.js",
92
+ "require": "./cjs/hooks/useExpandState.js"
93
+ },
94
+ "./hooks/useExecutionTimer": {
95
+ "import": "./esm/hooks/useExecutionTimer.js",
96
+ "require": "./cjs/hooks/useExecutionTimer.js"
97
+ },
98
+ "./hooks/useDerivedStateFromProps": {
99
+ "import": "./esm/hooks/useDerivedStateFromProps.js",
100
+ "require": "./cjs/hooks/useDerivedStateFromProps.js"
101
+ },
102
+ "./hooks/useCancellableDelayedCallback": {
103
+ "import": "./esm/hooks/useCancellableDelayedCallback.js",
104
+ "require": "./cjs/hooks/useCancellableDelayedCallback.js"
105
+ },
106
+ "./hooks": {
107
+ "import": "./esm/hooks/index.js",
108
+ "require": "./cjs/hooks/index.js"
109
+ },
110
+ "./getComponentFromProps": {
111
+ "import": "./esm/getComponentFromProps.js",
112
+ "require": "./cjs/getComponentFromProps.js"
113
+ },
114
+ "./compose": {
115
+ "import": "./esm/compose.js",
116
+ "require": "./cjs/compose.js"
117
+ },
118
+ "./capitalize": {
119
+ "import": "./esm/capitalize.js",
120
+ "require": "./cjs/capitalize.js"
121
+ }
122
+ },
8
123
  "sideEffects": [
9
124
  "*.css",
10
125
  "*.scss"
11
126
  ],
127
+ "repository": {
128
+ "type": "git",
129
+ "url": "https://git.elliemae.io/platform-ui/dimsum.git"
130
+ },
131
+ "engines": {
132
+ "npm": ">=7",
133
+ "node": ">=14"
134
+ },
135
+ "author": "ICE MT",
12
136
  "scripts": {
13
137
  "prebuild": "exit 0",
14
138
  "predev": "exit 0",
@@ -17,20 +141,21 @@
17
141
  },
18
142
  "publishConfig": {
19
143
  "access": "public",
20
- "directory": "dist"
144
+ "directory": "dist",
145
+ "generateSubmodules": true
21
146
  },
22
147
  "dependencies": {
23
- "hotkeys-js": "~3.8.2",
148
+ "hotkeys-js": "~3.8.7",
24
149
  "raf": "~3.4.1",
25
150
  "resize-observer-polyfill": "~1.5.1",
26
151
  "uncontrollable": "~6.2.3",
27
152
  "use-force-update": "~1.0.7",
28
153
  "use-measure": "~0.3.0",
29
- "use-onclickoutside": "~0.3.1"
154
+ "use-onclickoutside": "~0.3.2"
30
155
  },
31
156
  "peerDependencies": {
32
- "lodash": "^4.17.20",
33
- "react": "~17.0.1",
34
- "react-dom": "^17.0.1"
157
+ "lodash": "^4.17.21",
158
+ "react": "~17.0.2",
159
+ "react-dom": "^17.0.2"
35
160
  }
36
161
  }
@@ -0,0 +1 @@
1
+ export declare const capitalize: (string: string) => string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Composes single-argument functions from right to left. The rightmost
3
+ * function can take multiple arguments as it provides the signature for
4
+ * the resulting composite function. [From redux v4.0.5]
5
+ *
6
+ * @param {...Function} funcs The functions to compose.
7
+ * @returns {Function} A function obtained by composing the argument functions
8
+ * from right to left. For example, compose(f, g, h) is identical to doing
9
+ * (...args) => f(g(h(...args))).
10
+ */
11
+ export declare function compose(...funcs: any[]): any;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function getComponentFromProps(Component: any, props: any, children?: never[]): JSX.Element | null;
@@ -0,0 +1,18 @@
1
+ export { default as useMeasure } from 'use-measure';
2
+ export { default as useExecutionTimer } from './useExecutionTimer';
3
+ export { default as useExpandState } from './useExpandState';
4
+ export { default as useHotkeys } from './useHotkeys';
5
+ export { default as useHoverHandlersDelay } from './useHoverHandlersDelay';
6
+ export { default as useResizeObserver } from './useResizeObserver';
7
+ export { default as useShouldRecalculate } from './useShouldRecalculate';
8
+ export { default as useWindowScrollerList } from './useWindowScrollerList';
9
+ export { default as useWindowSize } from './useWindowSize';
10
+ export { default as useForceUpdate } from 'use-force-update';
11
+ export { default as useOnClickOutside } from 'use-onclickoutside';
12
+ export { useUncontrolled } from 'uncontrollable';
13
+ export { default as usePrevious } from './usePrevious';
14
+ export { default as useCancellableDelayedCallback } from './useCancellableDelayedCallback';
15
+ export { default as useDerivedStateFromProps } from './useDerivedStateFromProps';
16
+ export * from './useSetRef';
17
+ export * from './useParentElement';
18
+ export * from './useOnElementResize';
@@ -0,0 +1 @@
1
+ export default function useCancellableDelayedCallback(cb: any, delay: any): ((...args: any[]) => void)[];
@@ -0,0 +1 @@
1
+ export default function useDerivedStateFromProp(prop: any, options?: {}): any[];
@@ -0,0 +1 @@
1
+ export default function useExecutionDelay(startFn: any, cleanFn: any, delayTime: any): ((...args: any[]) => void)[];
@@ -0,0 +1,22 @@
1
+ export default function useExpandState({ items, itemKey, expanded: expandedProp, onExpand, onExpandChange, onExpandAll, onToggleExpand, onCollapse, }: {
2
+ items?: never[] | undefined;
3
+ itemKey?: string | undefined;
4
+ expanded?: {} | undefined;
5
+ onExpand: any;
6
+ onExpandChange?: (() => null) | undefined;
7
+ onExpandAll?: (() => null) | undefined;
8
+ onToggleExpand: any;
9
+ onCollapse: any;
10
+ }): {
11
+ state: {
12
+ expanded: any;
13
+ isExpandedAll: boolean;
14
+ };
15
+ actions: {
16
+ expand: (item: any, stateData?: boolean) => void;
17
+ toggleExpandAll: (stateData?: boolean) => void;
18
+ toggleExpand: (item: any, stateData?: boolean) => void;
19
+ collapse: (item: any) => void;
20
+ };
21
+ setExpanded: any;
22
+ };
@@ -0,0 +1,5 @@
1
+ export default function useHotkeys({ keys, handler, options }: {
2
+ keys: any;
3
+ handler: any;
4
+ options?: {} | undefined;
5
+ }, deps?: never[]): void;
@@ -0,0 +1,9 @@
1
+ export default function useHoverHandlersDelay({ onMouseOver, onMouseLeave, hideDelay, showDelay, }: {
2
+ onMouseOver: any;
3
+ onMouseLeave: any;
4
+ hideDelay?: number | undefined;
5
+ showDelay?: number | undefined;
6
+ }): {
7
+ onMouseOver: () => void;
8
+ onMouseLeave: () => void;
9
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const useOnElementResize: (targetRef: React.RefObject<HTMLDivElement>) => Record<'width' | 'height', number>;
@@ -0,0 +1 @@
1
+ export declare const useParentElement: (ref: any) => any;