@elliemae/ds-utilities 2.2.0-next.6 → 2.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/cjs/capitalize.js +35 -7
  2. package/cjs/capitalize.js.map +7 -0
  3. package/cjs/compose.js +39 -32
  4. package/cjs/compose.js.map +7 -0
  5. package/cjs/getComponentFromProps.js +47 -29
  6. package/cjs/getComponentFromProps.js.map +7 -0
  7. package/cjs/hooks/index.js +68 -62
  8. package/cjs/hooks/index.js.map +7 -0
  9. package/cjs/hooks/useCancellableDelayedCallback.js +43 -18
  10. package/cjs/hooks/useCancellableDelayedCallback.js.map +7 -0
  11. package/cjs/hooks/useDerivedStateFromProps.js +47 -36
  12. package/cjs/hooks/useDerivedStateFromProps.js.map +7 -0
  13. package/cjs/hooks/useExecutionTimer.js +43 -24
  14. package/cjs/hooks/useExecutionTimer.js.map +7 -0
  15. package/cjs/hooks/useExpandState.js +69 -82
  16. package/cjs/hooks/useExpandState.js.map +7 -0
  17. package/cjs/hooks/useHotkeys.js +44 -24
  18. package/cjs/hooks/useHotkeys.js.map +7 -0
  19. package/cjs/hooks/useHoverHandlersDelay.js +48 -18
  20. package/cjs/hooks/useHoverHandlersDelay.js.map +7 -0
  21. package/cjs/hooks/useOnElementResize.js +44 -27
  22. package/cjs/hooks/useOnElementResize.js.map +7 -0
  23. package/cjs/hooks/useParentElement.js +40 -13
  24. package/cjs/hooks/useParentElement.js.map +7 -0
  25. package/cjs/hooks/usePrevious.js +41 -10
  26. package/cjs/hooks/usePrevious.js.map +7 -0
  27. package/cjs/hooks/useResizeObserver.js +52 -25
  28. package/cjs/hooks/useResizeObserver.js.map +7 -0
  29. package/cjs/hooks/useSetRef.js +38 -11
  30. package/cjs/hooks/useSetRef.js.map +7 -0
  31. package/cjs/hooks/useShouldRecalculate.js +41 -14
  32. package/cjs/hooks/useShouldRecalculate.js.map +7 -0
  33. package/cjs/hooks/useWindowScrollerList.js +51 -33
  34. package/cjs/hooks/useWindowScrollerList.js.map +7 -0
  35. package/cjs/hooks/useWindowSize.js +49 -19
  36. package/cjs/hooks/useWindowSize.js.map +7 -0
  37. package/cjs/index.js +145 -268
  38. package/cjs/index.js.map +7 -0
  39. package/cjs/onClickHandlerForNonInteractiveElements.js +46 -19
  40. package/cjs/onClickHandlerForNonInteractiveElements.js.map +7 -0
  41. package/cjs/operators.js +56 -51
  42. package/cjs/operators.js.map +7 -0
  43. package/cjs/platform.js +37 -9
  44. package/cjs/platform.js.map +7 -0
  45. package/cjs/reactTypesUtility.js +45 -22
  46. package/cjs/reactTypesUtility.js.map +7 -0
  47. package/cjs/scrollingTimer.js +37 -15
  48. package/cjs/scrollingTimer.js.map +7 -0
  49. package/cjs/system.js +47 -30
  50. package/cjs/system.js.map +7 -0
  51. package/cjs/timeUtils.js +42 -24
  52. package/cjs/timeUtils.js.map +7 -0
  53. package/cjs/utils.js +101 -237
  54. package/cjs/utils.js.map +7 -0
  55. package/cjs/validations.js +48 -35
  56. package/cjs/validations.js.map +7 -0
  57. package/esm/capitalize.js +6 -3
  58. package/esm/capitalize.js.map +7 -0
  59. package/esm/compose.js +11 -29
  60. package/esm/compose.js.map +7 -0
  61. package/esm/getComponentFromProps.js +18 -22
  62. package/esm/getComponentFromProps.js.map +7 -0
  63. package/esm/hooks/index.js +40 -19
  64. package/esm/hooks/index.js.map +7 -0
  65. package/esm/hooks/useCancellableDelayedCallback.js +12 -14
  66. package/esm/hooks/useCancellableDelayedCallback.js.map +7 -0
  67. package/esm/hooks/useDerivedStateFromProps.js +15 -31
  68. package/esm/hooks/useDerivedStateFromProps.js.map +7 -0
  69. package/esm/hooks/useExecutionTimer.js +12 -20
  70. package/esm/hooks/useExecutionTimer.js.map +7 -0
  71. package/esm/hooks/useExpandState.js +36 -72
  72. package/esm/hooks/useExpandState.js.map +7 -0
  73. package/esm/hooks/useHotkeys.js +11 -14
  74. package/esm/hooks/useHotkeys.js.map +7 -0
  75. package/esm/hooks/useHoverHandlersDelay.js +15 -12
  76. package/esm/hooks/useHoverHandlersDelay.js.map +7 -0
  77. package/esm/hooks/useOnElementResize.js +12 -20
  78. package/esm/hooks/useOnElementResize.js.map +7 -0
  79. package/esm/hooks/useParentElement.js +9 -7
  80. package/esm/hooks/useParentElement.js.map +7 -0
  81. package/esm/hooks/usePrevious.js +10 -6
  82. package/esm/hooks/usePrevious.js.map +7 -0
  83. package/esm/hooks/useResizeObserver.js +20 -15
  84. package/esm/hooks/useResizeObserver.js.map +7 -0
  85. package/esm/hooks/useSetRef.js +8 -6
  86. package/esm/hooks/useSetRef.js.map +7 -0
  87. package/esm/hooks/useShouldRecalculate.js +11 -11
  88. package/esm/hooks/useShouldRecalculate.js.map +7 -0
  89. package/esm/hooks/useWindowScrollerList.js +20 -29
  90. package/esm/hooks/useWindowScrollerList.js.map +7 -0
  91. package/esm/hooks/useWindowSize.js +18 -15
  92. package/esm/hooks/useWindowSize.js.map +7 -0
  93. package/esm/index.js +204 -32
  94. package/esm/index.js.map +7 -0
  95. package/esm/onClickHandlerForNonInteractiveElements.js +17 -17
  96. package/esm/onClickHandlerForNonInteractiveElements.js.map +7 -0
  97. package/esm/operators.js +27 -34
  98. package/esm/operators.js.map +7 -0
  99. package/esm/platform.js +8 -4
  100. package/esm/platform.js.map +7 -0
  101. package/esm/reactTypesUtility.js +16 -9
  102. package/esm/reactTypesUtility.js.map +7 -0
  103. package/esm/scrollingTimer.js +8 -11
  104. package/esm/scrollingTimer.js.map +7 -0
  105. package/esm/system.js +16 -22
  106. package/esm/system.js.map +7 -0
  107. package/esm/timeUtils.js +13 -19
  108. package/esm/timeUtils.js.map +7 -0
  109. package/esm/utils.js +109 -72
  110. package/esm/utils.js.map +7 -0
  111. package/esm/validations.js +18 -28
  112. package/esm/validations.js.map +7 -0
  113. package/package.json +1 -5
  114. package/types/compose.d.ts +2 -1
  115. package/types/getComponentFromProps.d.ts +2 -1
  116. package/types/hooks/index.d.ts +14 -15
  117. package/types/hooks/useCancellableDelayedCallback.d.ts +2 -1
  118. package/types/hooks/useDerivedStateFromProps.d.ts +2 -1
  119. package/types/hooks/useExecutionTimer.d.ts +2 -1
  120. package/types/hooks/useExpandState.d.ts +3 -2
  121. package/types/hooks/useHotkeys.d.ts +3 -2
  122. package/types/hooks/useHoverHandlersDelay.d.ts +3 -2
  123. package/types/hooks/usePrevious.d.ts +1 -1
  124. package/types/hooks/useResizeObserver.d.ts +2 -1
  125. package/types/hooks/useShouldRecalculate.d.ts +2 -1
  126. package/types/hooks/useWindowScrollerList.d.ts +3 -2
  127. package/types/hooks/useWindowSize.d.ts +2 -1
  128. package/types/index.d.ts +11 -11
  129. package/types/onClickHandlerForNonInteractiveElements.d.ts +7 -7
  130. package/types/scrollingTimer.d.ts +1 -1
  131. package/cjs/hooks/useIsShowingEllipsis.js +0 -36
  132. package/esm/hooks/useIsShowingEllipsis.js +0 -32
  133. package/types/hooks/useIsShowingEllipsis.d.ts +0 -5
@@ -1,9 +1,10 @@
1
- export default function useHoverHandlersDelay({ onMouseOver, onMouseLeave, hideDelay, showDelay, }: {
1
+ export declare const useHoverHandlersDelay: ({ onMouseOver, onMouseLeave, hideDelay, showDelay, }: {
2
2
  onMouseOver: any;
3
3
  onMouseLeave: any;
4
4
  hideDelay?: number | undefined;
5
5
  showDelay?: number | undefined;
6
- }): {
6
+ }) => {
7
7
  onMouseOver: () => void;
8
8
  onMouseLeave: () => void;
9
9
  };
10
+ export default useHoverHandlersDelay;
@@ -1,2 +1,2 @@
1
- declare function usePrevious(value: any): undefined;
1
+ export declare const usePrevious: (value: any) => undefined;
2
2
  export default usePrevious;
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
- export default function useResizeObserver(handler: any, el: any): import("react").Dispatch<any>[];
2
+ export declare const useResizeObserver: (handler: any, el: any) => import("react").Dispatch<any>[];
3
+ export default useResizeObserver;
@@ -1 +1,2 @@
1
- export default function useShouldRecalculate(bool: any): number;
1
+ export declare const useShouldRecalculate: (bool: any) => number;
2
+ export default useShouldRecalculate;
@@ -1,4 +1,5 @@
1
- export default function useWindowScrollerList({ listInstance, outerListRef }: {
1
+ export declare const useWindowScrollerList: ({ listInstance, outerListRef }: {
2
2
  listInstance: any;
3
3
  outerListRef: any;
4
- }): void;
4
+ }) => void;
5
+ export default useWindowScrollerList;
@@ -1 +1,2 @@
1
- export default function useWindowSize(): false | number[];
1
+ export declare const useWindowSize: () => false | number[];
2
+ export default useWindowSize;
package/types/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export { default as getComponentFromProps } from './getComponentFromProps';
2
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';
3
+ export { capitalize } from './capitalize';
4
+ export { checkNotEmpty, checkEmpty, greaterThan, validDate, equal, notEqual, isNull, isNotNull, isIn, isNotIn, greaterThanOrEquals, lessThanOrEquals, startsWith, contains, } from './operators';
5
+ export { cx, runAll, hashArray, safeCall, removeUndefinedProperties, isObject, curry, arrayMove, uniq, filter, uniqBy, groupBy, property, get, set, cloneDeep, debounce, findIndex, isEmpty, isString, isEqual, maxBy, meanBy, noop, omit, orderBy, pull, sortBy, sumBy, transform, isFunction, range, parseInt, padStart, isNaN, values, throttle, toggleInObject, toggleInArray, pick, pickBy, differenceBy, differenceWith, addOrRemove, isEqualWith, isBoolean, } from './utils';
6
+ export { setRef, mergeRefs, logger } from './system';
7
+ export { useMeasure, useForceUpdate, useOnClickOutside, useUncontrolled, useExecutionTimer, useExpandState, useHotkeys, useHoverHandlersDelay, useResizeObserver, useShouldRecalculate, useWindowScrollerList, useWindowSize, usePrevious, useCancellableDelayedCallback, useDerivedStateFromProps, useSetRef, useParentElement, useOnElementResize, } from './hooks';
8
+ export { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';
9
+ export { compose } from './compose';
10
+ export { DOCUMENT, WINDOW } from './platform';
11
+ export { isClassComponent, isFunctionComponent, isReactComponent, isElement, isDOMTypeElement, isCompositeTypeElement, } from './reactTypesUtility';
12
+ export { resetTimer } from './scrollingTimer';
13
+ export { isRequired, isGreaterThan, isValidDate } from './validations';
@@ -1,12 +1,12 @@
1
- declare const _default: (onClickHandler: any) => {
2
- role: string;
3
- tabIndex: string;
4
- onClick: any;
5
- onKeyPress: (event: any) => void;
6
- };
7
1
  /**
8
2
  * onClickHandler: callback
9
3
  *
10
4
  * @param onClickHandler
11
5
  */
12
- export default _default;
6
+ export declare const onClickHandlerForNonInteractiveElements: (onClickHandler: any) => {
7
+ role: string;
8
+ tabIndex: string;
9
+ onClick: any;
10
+ onKeyPress: (event: any) => void;
11
+ };
12
+ export default onClickHandlerForNonInteractiveElements;
@@ -1 +1 @@
1
- export declare function resetTimer(func: any): (...args: any[]) => void;
1
+ export declare const resetTimer: (func: any) => (...args: any[]) => void;
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
- var React = require('react');
7
-
8
- const useIsShowingEllipsis = () => {
9
- const [element, setElement] = React.useState();
10
- const [isShowingEllipsis, setIsShowingEllipsis] = React.useState(false);
11
- const resizeObserver = React.useMemo(() => new ResizeObserver(entries => {
12
- if (entries.length) {
13
- const [textWrapperEntry] = entries;
14
- const el = textWrapperEntry.target;
15
- setIsShowingEllipsis((el === null || el === void 0 ? void 0 : el.scrollWidth) > (el === null || el === void 0 ? void 0 : el.clientWidth));
16
- }
17
- }), []);
18
- React.useEffect(() => {
19
- if (element) {
20
- setIsShowingEllipsis(element.scrollWidth > element.clientWidth);
21
- resizeObserver.observe(element);
22
- }
23
-
24
- return () => {
25
- if (element) {
26
- resizeObserver.unobserve(element);
27
- }
28
- };
29
- }, [resizeObserver, element]);
30
- return {
31
- setElement,
32
- isShowingEllipsis
33
- };
34
- };
35
-
36
- exports.useIsShowingEllipsis = useIsShowingEllipsis;
@@ -1,32 +0,0 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import { useState, useMemo, useEffect } from 'react';
3
-
4
- const useIsShowingEllipsis = () => {
5
- const [element, setElement] = useState();
6
- const [isShowingEllipsis, setIsShowingEllipsis] = useState(false);
7
- const resizeObserver = useMemo(() => new ResizeObserver(entries => {
8
- if (entries.length) {
9
- const [textWrapperEntry] = entries;
10
- const el = textWrapperEntry.target;
11
- setIsShowingEllipsis((el === null || el === void 0 ? void 0 : el.scrollWidth) > (el === null || el === void 0 ? void 0 : el.clientWidth));
12
- }
13
- }), []);
14
- useEffect(() => {
15
- if (element) {
16
- setIsShowingEllipsis(element.scrollWidth > element.clientWidth);
17
- resizeObserver.observe(element);
18
- }
19
-
20
- return () => {
21
- if (element) {
22
- resizeObserver.unobserve(element);
23
- }
24
- };
25
- }, [resizeObserver, element]);
26
- return {
27
- setElement,
28
- isShowingEllipsis
29
- };
30
- };
31
-
32
- export { useIsShowingEllipsis };
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const useIsShowingEllipsis: <T extends HTMLElement = HTMLSpanElement>() => {
3
- setElement: import("react").Dispatch<import("react").SetStateAction<T | undefined>>;
4
- isShowingEllipsis: boolean;
5
- };