@elliemae/ds-utilities 3.0.0-next.2 → 3.0.0-next.3

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 (207) hide show
  1. package/dist/cjs/capitalize.js +35 -0
  2. package/dist/cjs/capitalize.js.map +7 -0
  3. package/dist/cjs/compose.js +45 -0
  4. package/dist/cjs/compose.js.map +7 -0
  5. package/dist/cjs/getComponentFromProps.js +57 -0
  6. package/dist/cjs/getComponentFromProps.js.map +7 -0
  7. package/dist/cjs/hooks/index.js +75 -0
  8. package/dist/cjs/hooks/index.js.map +7 -0
  9. package/dist/cjs/hooks/useCallbackAfterRender.js +45 -0
  10. package/dist/cjs/hooks/useCallbackAfterRender.js.map +7 -0
  11. package/dist/cjs/hooks/useCancellableDelayedCallback.js +51 -0
  12. package/dist/cjs/hooks/useCancellableDelayedCallback.js.map +7 -0
  13. package/dist/cjs/hooks/useDerivedStateFromProps.js +67 -0
  14. package/dist/cjs/hooks/useDerivedStateFromProps.js.map +7 -0
  15. package/dist/cjs/hooks/useExecutionTimer.js +50 -0
  16. package/dist/cjs/hooks/useExecutionTimer.js.map +7 -0
  17. package/dist/cjs/hooks/useExpandState.js +137 -0
  18. package/dist/cjs/hooks/useExpandState.js.map +7 -0
  19. package/dist/cjs/hooks/useFocusTrap.js +49 -0
  20. package/dist/cjs/hooks/useFocusTrap.js.map +7 -0
  21. package/dist/cjs/hooks/useHotkeys.js +45 -0
  22. package/dist/cjs/hooks/useHotkeys.js.map +7 -0
  23. package/dist/cjs/hooks/useHoverHandlersDelay.js +58 -0
  24. package/dist/cjs/hooks/useHoverHandlersDelay.js.map +7 -0
  25. package/dist/cjs/hooks/useIsShowingEllipsis.js +58 -0
  26. package/dist/cjs/hooks/useIsShowingEllipsis.js.map +7 -0
  27. package/dist/cjs/hooks/useOnElementResize.js +55 -0
  28. package/dist/cjs/hooks/useOnElementResize.js.map +7 -0
  29. package/dist/cjs/hooks/useParentElement.js +43 -0
  30. package/dist/cjs/hooks/useParentElement.js.map +7 -0
  31. package/dist/cjs/hooks/usePrevious.js +44 -0
  32. package/dist/cjs/hooks/usePrevious.js.map +7 -0
  33. package/dist/cjs/hooks/useResizeObserver.js +60 -0
  34. package/dist/cjs/hooks/useResizeObserver.js.map +7 -0
  35. package/dist/cjs/hooks/useSetRef.js +42 -0
  36. package/dist/cjs/hooks/useSetRef.js.map +7 -0
  37. package/dist/cjs/hooks/useShouldRecalculate.js +44 -0
  38. package/dist/cjs/hooks/useShouldRecalculate.js.map +7 -0
  39. package/dist/cjs/hooks/useWindowScrollerList.js +83 -0
  40. package/dist/cjs/hooks/useWindowScrollerList.js.map +7 -0
  41. package/dist/cjs/hooks/useWindowSize.js +57 -0
  42. package/dist/cjs/hooks/useWindowSize.js.map +7 -0
  43. package/dist/cjs/index.js +148 -0
  44. package/dist/cjs/index.js.map +7 -0
  45. package/dist/cjs/onClickHandlerForNonInteractiveElements.js +49 -0
  46. package/dist/cjs/onClickHandlerForNonInteractiveElements.js.map +7 -0
  47. package/dist/cjs/operators.js +68 -0
  48. package/dist/cjs/operators.js.map +7 -0
  49. package/dist/cjs/platform.js +37 -0
  50. package/dist/cjs/platform.js.map +7 -0
  51. package/dist/cjs/reactTypesUtility.js +58 -0
  52. package/dist/cjs/reactTypesUtility.js.map +7 -0
  53. package/dist/cjs/scrollingTimer.js +46 -0
  54. package/dist/cjs/scrollingTimer.js.map +7 -0
  55. package/dist/cjs/system.js +60 -0
  56. package/dist/cjs/system.js.map +7 -0
  57. package/dist/cjs/timeUtils.js +43 -0
  58. package/dist/cjs/timeUtils.js.map +7 -0
  59. package/dist/cjs/utils.js +143 -0
  60. package/dist/cjs/utils.js.map +7 -0
  61. package/dist/cjs/validations.js +57 -0
  62. package/dist/cjs/validations.js.map +7 -0
  63. package/dist/esm/capitalize.js +6 -0
  64. package/dist/esm/capitalize.js.map +7 -0
  65. package/dist/esm/compose.js +16 -0
  66. package/dist/esm/compose.js.map +7 -0
  67. package/dist/esm/getComponentFromProps.js +30 -0
  68. package/dist/esm/getComponentFromProps.js.map +7 -0
  69. package/dist/esm/hooks/index.js +46 -0
  70. package/dist/esm/hooks/index.js.map +7 -0
  71. package/dist/esm/hooks/useCallbackAfterRender.js +16 -0
  72. package/dist/esm/hooks/useCallbackAfterRender.js.map +7 -0
  73. package/dist/esm/hooks/useCancellableDelayedCallback.js +22 -0
  74. package/dist/esm/hooks/useCancellableDelayedCallback.js.map +7 -0
  75. package/dist/esm/hooks/useDerivedStateFromProps.js +38 -0
  76. package/dist/esm/hooks/useDerivedStateFromProps.js.map +7 -0
  77. package/dist/esm/hooks/useExecutionTimer.js +21 -0
  78. package/dist/esm/hooks/useExecutionTimer.js.map +7 -0
  79. package/dist/esm/hooks/useExpandState.js +110 -0
  80. package/dist/esm/hooks/useExpandState.js.map +7 -0
  81. package/dist/esm/hooks/useFocusTrap.js +20 -0
  82. package/dist/esm/hooks/useFocusTrap.js.map +7 -0
  83. package/dist/esm/hooks/useHotkeys.js +16 -0
  84. package/dist/esm/hooks/useHotkeys.js.map +7 -0
  85. package/{esm → dist/esm}/hooks/useHoverHandlersDelay.js +15 -12
  86. package/dist/esm/hooks/useHoverHandlersDelay.js.map +7 -0
  87. package/dist/esm/hooks/useIsShowingEllipsis.js +29 -0
  88. package/dist/esm/hooks/useIsShowingEllipsis.js.map +7 -0
  89. package/dist/esm/hooks/useOnElementResize.js +26 -0
  90. package/dist/esm/hooks/useOnElementResize.js.map +7 -0
  91. package/dist/esm/hooks/useParentElement.js +14 -0
  92. package/dist/esm/hooks/useParentElement.js.map +7 -0
  93. package/dist/esm/hooks/usePrevious.js +15 -0
  94. package/dist/esm/hooks/usePrevious.js.map +7 -0
  95. package/dist/esm/hooks/useResizeObserver.js +31 -0
  96. package/dist/esm/hooks/useResizeObserver.js.map +7 -0
  97. package/dist/esm/hooks/useSetRef.js +13 -0
  98. package/dist/esm/hooks/useSetRef.js.map +7 -0
  99. package/dist/esm/hooks/useShouldRecalculate.js +15 -0
  100. package/dist/esm/hooks/useShouldRecalculate.js.map +7 -0
  101. package/{esm → dist/esm}/hooks/useWindowScrollerList.js +20 -29
  102. package/dist/esm/hooks/useWindowScrollerList.js.map +7 -0
  103. package/dist/esm/hooks/useWindowSize.js +28 -0
  104. package/dist/esm/hooks/useWindowSize.js.map +7 -0
  105. package/dist/esm/index.js +210 -0
  106. package/dist/esm/index.js.map +7 -0
  107. package/dist/esm/onClickHandlerForNonInteractiveElements.js +20 -0
  108. package/dist/esm/onClickHandlerForNonInteractiveElements.js.map +7 -0
  109. package/dist/esm/operators.js +39 -0
  110. package/dist/esm/operators.js.map +7 -0
  111. package/dist/esm/platform.js +8 -0
  112. package/dist/esm/platform.js.map +7 -0
  113. package/dist/esm/reactTypesUtility.js +29 -0
  114. package/dist/esm/reactTypesUtility.js.map +7 -0
  115. package/dist/esm/scrollingTimer.js +17 -0
  116. package/dist/esm/scrollingTimer.js.map +7 -0
  117. package/dist/esm/system.js +31 -0
  118. package/dist/esm/system.js.map +7 -0
  119. package/dist/esm/timeUtils.js +14 -0
  120. package/dist/esm/timeUtils.js.map +7 -0
  121. package/dist/esm/utils.js +154 -0
  122. package/dist/esm/utils.js.map +7 -0
  123. package/dist/esm/validations.js +28 -0
  124. package/dist/esm/validations.js.map +7 -0
  125. package/package.json +82 -69
  126. package/cjs/capitalize.js +0 -7
  127. package/cjs/compose.js +0 -38
  128. package/cjs/getComponentFromProps.js +0 -30
  129. package/cjs/hooks/index.js +0 -61
  130. package/cjs/hooks/useCancellableDelayedCallback.js +0 -26
  131. package/cjs/hooks/useDerivedStateFromProps.js +0 -56
  132. package/cjs/hooks/useExecutionTimer.js +0 -31
  133. package/cjs/hooks/useExpandState.js +0 -133
  134. package/cjs/hooks/useHotkeys.js +0 -25
  135. package/cjs/hooks/useHoverHandlersDelay.js +0 -28
  136. package/cjs/hooks/useOnElementResize.js +0 -37
  137. package/cjs/hooks/useParentElement.js +0 -16
  138. package/cjs/hooks/usePrevious.js +0 -13
  139. package/cjs/hooks/useResizeObserver.js +0 -33
  140. package/cjs/hooks/useSetRef.js +0 -15
  141. package/cjs/hooks/useShouldRecalculate.js +0 -17
  142. package/cjs/hooks/useWindowScrollerList.js +0 -65
  143. package/cjs/hooks/useWindowSize.js +0 -27
  144. package/cjs/index.js +0 -266
  145. package/cjs/onClickHandlerForNonInteractiveElements.js +0 -22
  146. package/cjs/operators.js +0 -63
  147. package/cjs/platform.js +0 -9
  148. package/cjs/reactTypesUtility.js +0 -35
  149. package/cjs/scrollingTimer.js +0 -24
  150. package/cjs/system.js +0 -43
  151. package/cjs/timeUtils.js +0 -25
  152. package/cjs/utils.js +0 -263
  153. package/cjs/validations.js +0 -44
  154. package/esm/capitalize.js +0 -3
  155. package/esm/compose.js +0 -34
  156. package/esm/getComponentFromProps.js +0 -23
  157. package/esm/hooks/index.js +0 -18
  158. package/esm/hooks/useCancellableDelayedCallback.js +0 -24
  159. package/esm/hooks/useDerivedStateFromProps.js +0 -54
  160. package/esm/hooks/useExecutionTimer.js +0 -29
  161. package/esm/hooks/useExpandState.js +0 -127
  162. package/esm/hooks/useHotkeys.js +0 -19
  163. package/esm/hooks/useOnElementResize.js +0 -33
  164. package/esm/hooks/useParentElement.js +0 -12
  165. package/esm/hooks/usePrevious.js +0 -11
  166. package/esm/hooks/useResizeObserver.js +0 -26
  167. package/esm/hooks/useSetRef.js +0 -11
  168. package/esm/hooks/useShouldRecalculate.js +0 -15
  169. package/esm/hooks/useWindowSize.js +0 -25
  170. package/esm/index.js +0 -31
  171. package/esm/onClickHandlerForNonInteractiveElements.js +0 -20
  172. package/esm/operators.js +0 -46
  173. package/esm/platform.js +0 -4
  174. package/esm/reactTypesUtility.js +0 -22
  175. package/esm/scrollingTimer.js +0 -20
  176. package/esm/system.js +0 -37
  177. package/esm/timeUtils.js +0 -20
  178. package/esm/utils.js +0 -99
  179. package/esm/validations.js +0 -38
  180. package/types/capitalize.d.ts +0 -1
  181. package/types/compose.d.ts +0 -11
  182. package/types/getComponentFromProps.d.ts +0 -2
  183. package/types/hooks/index.d.ts +0 -18
  184. package/types/hooks/useCancellableDelayedCallback.d.ts +0 -1
  185. package/types/hooks/useDerivedStateFromProps.d.ts +0 -1
  186. package/types/hooks/useExecutionTimer.d.ts +0 -1
  187. package/types/hooks/useExpandState.d.ts +0 -22
  188. package/types/hooks/useHotkeys.d.ts +0 -5
  189. package/types/hooks/useHoverHandlersDelay.d.ts +0 -9
  190. package/types/hooks/useOnElementResize.d.ts +0 -2
  191. package/types/hooks/useParentElement.d.ts +0 -1
  192. package/types/hooks/usePrevious.d.ts +0 -2
  193. package/types/hooks/useResizeObserver.d.ts +0 -2
  194. package/types/hooks/useSetRef.d.ts +0 -2
  195. package/types/hooks/useShouldRecalculate.d.ts +0 -1
  196. package/types/hooks/useWindowScrollerList.d.ts +0 -4
  197. package/types/hooks/useWindowSize.d.ts +0 -1
  198. package/types/index.d.ts +0 -13
  199. package/types/onClickHandlerForNonInteractiveElements.d.ts +0 -12
  200. package/types/operators.d.ts +0 -31
  201. package/types/platform.d.ts +0 -2
  202. package/types/reactTypesUtility.d.ts +0 -6
  203. package/types/scrollingTimer.d.ts +0 -1
  204. package/types/system.d.ts +0 -3
  205. package/types/timeUtils.d.ts +0 -7
  206. package/types/utils.d.ts +0 -23
  207. package/types/validations.d.ts +0 -23
@@ -1,12 +0,0 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import { useState, useEffect } from 'react';
3
-
4
- const useParentElement = ref => {
5
- const [parent, setParent] = useState(ref.current);
6
- useEffect(() => {
7
- if (ref.current) setParent(ref.current.parentNode);
8
- });
9
- return parent;
10
- };
11
-
12
- export { useParentElement };
@@ -1,11 +0,0 @@
1
- import { useRef, useEffect } from 'react';
2
-
3
- function usePrevious(value) {
4
- const ref = useRef();
5
- useEffect(() => {
6
- ref.current = value;
7
- }, [value]);
8
- return ref.current;
9
- }
10
-
11
- export { usePrevious as default };
@@ -1,26 +0,0 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import { useState, useEffect } from 'react';
3
- import raf from 'raf';
4
- import ResizeObserver from 'resize-observer-polyfill';
5
-
6
- function useResizeObserver(handler, el) {
7
- const [node, setRef] = useState(el);
8
- const resizeObserver = new ResizeObserver(entries => {
9
- if (!Array.isArray(entries)) return;
10
- if (!entries.length) return;
11
- const entry = entries[0]; // execute on the next animation frame
12
-
13
- raf(() => handler({
14
- width: entry.target.offsetWidth,
15
- height: entry.target.offsetHeight
16
- }, entry.target));
17
- });
18
- const htmlEl = el || node;
19
- useEffect(() => {
20
- if (htmlEl) resizeObserver.observe(htmlEl);
21
- return () => htmlEl && resizeObserver.unobserve(htmlEl);
22
- }, [htmlEl]);
23
- return [setRef];
24
- }
25
-
26
- export { useResizeObserver as default };
@@ -1,11 +0,0 @@
1
- import { useRef, useCallback } from 'react';
2
-
3
- const useSetRef = initial => {
4
- const ref = useRef(initial);
5
- const setRef = useCallback(node => {
6
- ref.current = node;
7
- }, []);
8
- return [ref, setRef];
9
- };
10
-
11
- export { useSetRef };
@@ -1,15 +0,0 @@
1
- import { useRef } from 'react';
2
-
3
- function useShouldRecalculate(bool) {
4
- const prevValueRef = useRef(0);
5
-
6
- if (!bool) {
7
- // If we need to recalculate, change the value we return
8
- prevValueRef.current += 1;
9
- } // else we return the same value as the previous render, which won't trigger a recalculation
10
-
11
-
12
- return prevValueRef.current;
13
- }
14
-
15
- export { useShouldRecalculate as default };
@@ -1,25 +0,0 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import { useState, useLayoutEffect } from 'react';
3
-
4
- function useWindowSize() {
5
- const [size, setSize] = useState([0, 0]);
6
- useLayoutEffect(() => {
7
- if (!window) return false;
8
-
9
- function updateSize() {
10
- setSize([window.innerWidth, window.innerHeight]);
11
- }
12
-
13
- window.addEventListener('resize', updateSize);
14
- window.addEventListener('orientationchange', updateSize);
15
- updateSize();
16
- return () => {
17
- window.removeEventListener('resize', updateSize);
18
- window.removeEventListener('orientationchange', updateSize);
19
- };
20
- }, []);
21
- if (!window) return false;
22
- return size;
23
- }
24
-
25
- export { useWindowSize as default };
package/esm/index.js DELETED
@@ -1,31 +0,0 @@
1
- export { default as getComponentFromProps } from './getComponentFromProps.js';
2
- export { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements.js';
3
- export { capitalize } from './capitalize.js';
4
- export { checkEmpty, checkNotEmpty, contains, equal, greaterThan, greaterThanOrEquals, isIn, isNotIn, isNotNull, isNull, lessThanOrEquals, notEqual, startsWith, validDate } from './operators.js';
5
- export { addOrRemove, arrayMove, cx, hashArray, removeUndefinedProperties, runAll, safeCall, toggleInArray, toggleInObject } from './utils.js';
6
- export { logger, mergeRefs, setRef } from './system.js';
7
- export { default as useMeasure } from 'use-measure';
8
- export { default as useExecutionTimer } from './hooks/useExecutionTimer.js';
9
- export { default as useExpandState } from './hooks/useExpandState.js';
10
- export { default as useHotkeys } from './hooks/useHotkeys.js';
11
- export { default as useHoverHandlersDelay } from './hooks/useHoverHandlersDelay.js';
12
- export { default as useResizeObserver } from './hooks/useResizeObserver.js';
13
- export { default as useShouldRecalculate } from './hooks/useShouldRecalculate.js';
14
- export { default as useWindowScrollerList } from './hooks/useWindowScrollerList.js';
15
- export { default as useWindowSize } from './hooks/useWindowSize.js';
16
- export { default as useForceUpdate } from 'use-force-update';
17
- export { default as useOnClickOutside } from 'use-onclickoutside';
18
- export { useUncontrolled } from 'uncontrollable';
19
- export { default as usePrevious } from './hooks/usePrevious.js';
20
- export { default as useCancellableDelayedCallback } from './hooks/useCancellableDelayedCallback.js';
21
- export { default as useDerivedStateFromProps } from './hooks/useDerivedStateFromProps.js';
22
- export { useSetRef } from './hooks/useSetRef.js';
23
- export { useParentElement } from './hooks/useParentElement.js';
24
- export { useOnElementResize } from './hooks/useOnElementResize.js';
25
- export { addLeadingZeros, getVisibleTimeByFormat } from './timeUtils.js';
26
- export { compose } from './compose.js';
27
- export { DOCUMENT, WINDOW } from './platform.js';
28
- export { isClassComponent, isCompositeTypeElement, isDOMTypeElement, isElement, isFunctionComponent, isReactComponent } from './reactTypesUtility.js';
29
- export { resetTimer } from './scrollingTimer.js';
30
- export { isGreaterThan, isRequired, isValidDate } from './validations.js';
31
- 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';
@@ -1,20 +0,0 @@
1
- /**
2
- * onClickHandler: callback
3
- *
4
- * @param onClickHandler
5
- */
6
- var onClickHandlerForNonInteractiveElements = (onClickHandler => ({
7
- role: 'button',
8
- tabIndex: '0',
9
- onClick: onClickHandler,
10
- onKeyPress: event => {
11
- event.stopPropagation();
12
- const {
13
- keycode,
14
- key
15
- } = event;
16
- if (key === 'Enter') onClickHandler(event);else if (keycode === 13) onClickHandler(event);
17
- }
18
- }));
19
-
20
- export { onClickHandlerForNonInteractiveElements as default };
package/esm/operators.js DELETED
@@ -1,46 +0,0 @@
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';
4
- import { isEmpty } from 'lodash';
5
-
6
- /**
7
- * Check if the value is null undefined ''
8
- *
9
- * @param value
10
- */
11
-
12
- const checkNotEmpty = value => value === '' || value === undefined || value == [] || value === null || isEmpty(value);
13
- const checkEmpty = value => !isEmpty(value);
14
- /**
15
- * @param value: number
16
- * @param comparator: number
17
- * @param value
18
- * @param comparator
19
- */
20
-
21
- const greaterThan = (value, comparator) => value > comparator;
22
- /**
23
- * Check if a valid date with format MM/DD/YYYY
24
- *
25
- * @param {*} value: string
26
- * @param value
27
- */
28
-
29
- const validDate = value => {
30
- const dateValidationRegex = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
31
- if (!dateValidationRegex.test(value)) return false;
32
- const [m, d, y] = value.split('/').map(n => Number(n));
33
- return m === Number(new Date(y, m - 1, d).getMonth()) + 1 && d === Number(new Date(y, m - 1, d).getDate());
34
- };
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);
45
-
46
- export { checkEmpty, checkNotEmpty, contains, equal, greaterThan, greaterThanOrEquals, isIn, isNotIn, isNotNull, isNull, lessThanOrEquals, notEqual, startsWith, validDate };
package/esm/platform.js DELETED
@@ -1,4 +0,0 @@
1
- const DOCUMENT = typeof document !== 'undefined' ? document : null;
2
- const WINDOW = typeof window !== 'undefined' ? window : null;
3
-
4
- export { DOCUMENT, WINDOW };
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
-
3
- function isClassComponent(component) {
4
- return !!(typeof component === 'function' && !!component.prototype.isReactComponent);
5
- }
6
- function isFunctionComponent(component) {
7
- return typeof component === 'function' && String(component).includes('return React.createElement');
8
- }
9
- function isReactComponent(component) {
10
- return !!(isClassComponent(component) || isFunctionComponent(component));
11
- }
12
- function isElement(element) {
13
- return /*#__PURE__*/React.isValidElement(element);
14
- }
15
- function isDOMTypeElement(element) {
16
- return isElement(element) && typeof element.type === 'string';
17
- }
18
- function isCompositeTypeElement(element) {
19
- return isElement(element) && typeof element.type === 'function';
20
- }
21
-
22
- export { isClassComponent, isCompositeTypeElement, isDOMTypeElement, isElement, isFunctionComponent, isReactComponent };
@@ -1,20 +0,0 @@
1
- function resetTimer(func) {
2
- let timeout;
3
- return function () {
4
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5
- args[_key] = arguments[_key];
6
- }
7
-
8
- const context = this;
9
-
10
- const lastCall = () => {
11
- timeout = null;
12
- func.apply(context, args);
13
- };
14
-
15
- clearTimeout(timeout);
16
- timeout = setTimeout(lastCall, 300);
17
- };
18
- }
19
-
20
- export { resetTimer };
package/esm/system.js DELETED
@@ -1,37 +0,0 @@
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';
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';
10
- import { isFunction } from 'lodash';
11
-
12
- const setRef = (ref, value) => {
13
- if (isFunction(ref)) {
14
- ref(value);
15
- } else if (ref) {
16
- ref.current = value;
17
- }
18
- };
19
- function mergeRefs() {
20
- for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
21
- refs[_key] = arguments[_key];
22
- }
23
-
24
- return node => {
25
- if (!node) return;
26
- refs.forEach(ref => {
27
- if (isFunction(ref)) {
28
- ref(node);
29
- } else if (ref) {
30
- ref.current = node;
31
- }
32
- });
33
- };
34
- }
35
- function logger() {}
36
-
37
- export { logger, mergeRefs, setRef };
package/esm/timeUtils.js DELETED
@@ -1,20 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.filter.js';
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';
10
- import { padStart } from 'lodash';
11
-
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');
19
-
20
- export { addLeadingZeros, getVisibleTimeByFormat };
package/esm/utils.js DELETED
@@ -1,99 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.filter.js';
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';
10
- import { omit, cloneDeep, isFunction } from 'lodash';
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';
12
-
13
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
-
15
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
- /**
17
- * Concatenates classNames from arguments
18
- *
19
- * @param {...any} classnames
20
- */
21
-
22
- const cx = function () {
23
- for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
24
- classnames[_key] = arguments[_key];
25
- }
26
-
27
- return classnames.reduce((result, cn) => "".concat(result, " ").concat(cn || ''), '');
28
- }; // if entry exists, remove it, if not, add it
29
-
30
- const toggleInObject = (obj, key, value) => obj[key] !== undefined ? omit(obj, [key]) : _objectSpread(_objectSpread({}, obj), {}, {
31
- [key]: value
32
- });
33
-
34
- const toggleInArray = (array, value) => array.indexOf(value) === -1 ? [value] : [];
35
-
36
- const arrayMoveMutate = (array, from, to) => {
37
- array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
38
- };
39
-
40
- const arrayMove = (array, from, to) => {
41
- array = array.slice();
42
- arrayMoveMutate(array, from, to);
43
- return array;
44
- };
45
-
46
- const accessorDefault = item => item;
47
-
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));
51
-
52
- if (index !== -1) {
53
- const nextArray = cloneDeep(array);
54
- nextArray.splice(index, 1);
55
- return nextArray;
56
- }
57
-
58
- return [...array, item];
59
- };
60
-
61
- function runAll() {
62
- for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
63
- fns[_key2] = arguments[_key2];
64
- }
65
-
66
- return function () {
67
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
68
- args[_key3] = arguments[_key3];
69
- }
70
-
71
- return fns.forEach(fn => {
72
- if (Array.isArray(fn)) runAll(fn);
73
- if (isFunction(fn)) fn(...args);
74
- });
75
- };
76
- }
77
- function hashArray(arr, fieldName) {
78
- return arr.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
79
- [fieldName ? item[fieldName] : item]: true
80
- }), {});
81
- }
82
- function safeCall(fun) {
83
- if (isFunction(fun)) {
84
- for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
85
- args[_key4 - 1] = arguments[_key4];
86
- }
87
-
88
- fun(...args);
89
- }
90
- }
91
- const removeUndefinedProperties = obj => {
92
- const cleanObject = _objectSpread({}, obj);
93
-
94
- Object.keys(obj).forEach(key => cleanObject[key] === undefined && delete cleanObject[key]);
95
- return cleanObject;
96
- };
97
- var utils = {};
98
-
99
- export { addOrRemove, arrayMove, cx, utils as default, hashArray, removeUndefinedProperties, runAll, safeCall, toggleInArray, toggleInObject };
@@ -1,38 +0,0 @@
1
- import { checkNotEmpty, greaterThan, validDate } from './operators.js';
2
-
3
- const isRequired = _ref => {
4
- let {
5
- value,
6
- help = 'Field is Required'
7
- } = _ref;
8
- return {
9
- payload: help,
10
- error: checkNotEmpty(value)
11
- };
12
- };
13
- const isGreaterThan = _ref2 => {
14
- let {
15
- value,
16
- help,
17
- comparator = 0
18
- } = _ref2;
19
- if (!help) help = "Max value ".concat(comparator);
20
- return {
21
- payload: help,
22
- error: greaterThan(value, comparator)
23
- };
24
- };
25
- const isValidDate = _ref3 => {
26
- let {
27
- value,
28
- help,
29
- format = 'MM/DD/AAA'
30
- } = _ref3;
31
- if (!help) help = "Valid Date is required ".concat(format);
32
- return {
33
- payload: help,
34
- error: !validDate(value)
35
- };
36
- };
37
-
38
- export { isGreaterThan, isRequired, isValidDate };
@@ -1 +0,0 @@
1
- export declare const capitalize: (string: string) => string;
@@ -1,11 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export default function getComponentFromProps(Component: any, props: any, children?: never[]): JSX.Element | null;
@@ -1,18 +0,0 @@
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';
@@ -1 +0,0 @@
1
- export default function useCancellableDelayedCallback(cb: any, delay: any): ((...args: any[]) => void)[];
@@ -1 +0,0 @@
1
- export default function useDerivedStateFromProp(prop: any, options?: {}): any[];
@@ -1 +0,0 @@
1
- export default function useExecutionDelay(startFn: any, cleanFn: any, delayTime: any): ((...args: any[]) => void)[];
@@ -1,22 +0,0 @@
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
- };
@@ -1,5 +0,0 @@
1
- export default function useHotkeys({ keys, handler, options }: {
2
- keys: any;
3
- handler: any;
4
- options?: {} | undefined;
5
- }, deps?: never[]): void;
@@ -1,9 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const useOnElementResize: (targetRef: React.RefObject<HTMLDivElement>) => Record<'width' | 'height', number>;
@@ -1 +0,0 @@
1
- export declare const useParentElement: (ref: any) => any;
@@ -1,2 +0,0 @@
1
- declare function usePrevious(value: any): undefined;
2
- export default usePrevious;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export default function useResizeObserver(handler: any, el: any): import("react").Dispatch<any>[];
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const useSetRef: (initial: any) => (import("react").MutableRefObject<any> | ((node: any) => void))[];
@@ -1 +0,0 @@
1
- export default function useShouldRecalculate(bool: any): number;
@@ -1,4 +0,0 @@
1
- export default function useWindowScrollerList({ listInstance, outerListRef }: {
2
- listInstance: any;
3
- outerListRef: any;
4
- }): void;
@@ -1 +0,0 @@
1
- export default function useWindowSize(): false | number[];
package/types/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export { default as getComponentFromProps } from './getComponentFromProps';
2
- export { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';
3
- export * from './capitalize';
4
- export * from './operators';
5
- export * from './utils';
6
- export * from './system';
7
- export * from './hooks';
8
- export * from './timeUtils';
9
- export * from './compose';
10
- export * from './platform';
11
- export * from './reactTypesUtility';
12
- export * from './scrollingTimer';
13
- export * from './validations';
@@ -1,12 +0,0 @@
1
- declare const _default: (onClickHandler: any) => {
2
- role: string;
3
- tabIndex: string;
4
- onClick: any;
5
- onKeyPress: (event: any) => void;
6
- };
7
- /**
8
- * onClickHandler: callback
9
- *
10
- * @param onClickHandler
11
- */
12
- export default _default;
@@ -1,31 +0,0 @@
1
- /**
2
- * Check if the value is null undefined ''
3
- *
4
- * @param value
5
- */
6
- export declare const checkNotEmpty: (value: any) => boolean;
7
- export declare const checkEmpty: (value: any) => boolean;
8
- /**
9
- * @param value: number
10
- * @param comparator: number
11
- * @param value
12
- * @param comparator
13
- */
14
- export declare const greaterThan: (value: any, comparator: any) => boolean;
15
- /**
16
- * Check if a valid date with format MM/DD/YYYY
17
- *
18
- * @param {*} value: string
19
- * @param value
20
- */
21
- export declare const validDate: (value: any) => boolean;
22
- export declare const equal: (a: any, b: any) => boolean;
23
- export declare const notEqual: (a: any, b: any) => boolean;
24
- export declare const isNull: (a: any) => boolean;
25
- export declare const isNotNull: (a: any) => boolean;
26
- export declare const isIn: (a: any, b: any) => boolean;
27
- export declare const isNotIn: (a: any, b: any) => boolean;
28
- export declare const greaterThanOrEquals: (value: any, comparator: any) => boolean;
29
- export declare const lessThanOrEquals: (value: any, comparator: any) => boolean;
30
- export declare const startsWith: (value: any, comparator: any) => boolean;
31
- export declare const contains: (value: any, comparator: any) => boolean;
@@ -1,2 +0,0 @@
1
- export declare const DOCUMENT: Document | null;
2
- export declare const WINDOW: (Window & typeof globalThis) | null;