@elliemae/ds-utilities 2.2.1 → 2.3.0-alpha.4

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 (135) 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 +70 -60
  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/useIsShowingEllipsis.js +58 -0
  22. package/cjs/hooks/useIsShowingEllipsis.js.map +7 -0
  23. package/cjs/hooks/useOnElementResize.js +44 -27
  24. package/cjs/hooks/useOnElementResize.js.map +7 -0
  25. package/cjs/hooks/useParentElement.js +40 -13
  26. package/cjs/hooks/useParentElement.js.map +7 -0
  27. package/cjs/hooks/usePrevious.js +41 -10
  28. package/cjs/hooks/usePrevious.js.map +7 -0
  29. package/cjs/hooks/useResizeObserver.js +52 -25
  30. package/cjs/hooks/useResizeObserver.js.map +7 -0
  31. package/cjs/hooks/useSetRef.js +38 -11
  32. package/cjs/hooks/useSetRef.js.map +7 -0
  33. package/cjs/hooks/useShouldRecalculate.js +41 -14
  34. package/cjs/hooks/useShouldRecalculate.js.map +7 -0
  35. package/cjs/hooks/useWindowScrollerList.js +51 -33
  36. package/cjs/hooks/useWindowScrollerList.js.map +7 -0
  37. package/cjs/hooks/useWindowSize.js +49 -19
  38. package/cjs/hooks/useWindowSize.js.map +7 -0
  39. package/cjs/index.js +146 -266
  40. package/cjs/index.js.map +7 -0
  41. package/cjs/onClickHandlerForNonInteractiveElements.js +46 -19
  42. package/cjs/onClickHandlerForNonInteractiveElements.js.map +7 -0
  43. package/cjs/operators.js +56 -51
  44. package/cjs/operators.js.map +7 -0
  45. package/cjs/platform.js +37 -9
  46. package/cjs/platform.js.map +7 -0
  47. package/cjs/reactTypesUtility.js +45 -22
  48. package/cjs/reactTypesUtility.js.map +7 -0
  49. package/cjs/scrollingTimer.js +37 -15
  50. package/cjs/scrollingTimer.js.map +7 -0
  51. package/cjs/system.js +47 -30
  52. package/cjs/system.js.map +7 -0
  53. package/cjs/timeUtils.js +42 -24
  54. package/cjs/timeUtils.js.map +7 -0
  55. package/cjs/utils.js +101 -237
  56. package/cjs/utils.js.map +7 -0
  57. package/cjs/validations.js +48 -35
  58. package/cjs/validations.js.map +7 -0
  59. package/esm/capitalize.js +6 -3
  60. package/esm/capitalize.js.map +7 -0
  61. package/esm/compose.js +11 -29
  62. package/esm/compose.js.map +7 -0
  63. package/esm/getComponentFromProps.js +18 -22
  64. package/esm/getComponentFromProps.js.map +7 -0
  65. package/esm/hooks/index.js +42 -18
  66. package/esm/hooks/index.js.map +7 -0
  67. package/esm/hooks/useCancellableDelayedCallback.js +12 -14
  68. package/esm/hooks/useCancellableDelayedCallback.js.map +7 -0
  69. package/esm/hooks/useDerivedStateFromProps.js +15 -31
  70. package/esm/hooks/useDerivedStateFromProps.js.map +7 -0
  71. package/esm/hooks/useExecutionTimer.js +12 -20
  72. package/esm/hooks/useExecutionTimer.js.map +7 -0
  73. package/esm/hooks/useExpandState.js +36 -72
  74. package/esm/hooks/useExpandState.js.map +7 -0
  75. package/esm/hooks/useHotkeys.js +11 -14
  76. package/esm/hooks/useHotkeys.js.map +7 -0
  77. package/esm/hooks/useHoverHandlersDelay.js +15 -12
  78. package/esm/hooks/useHoverHandlersDelay.js.map +7 -0
  79. package/esm/hooks/useIsShowingEllipsis.js +29 -0
  80. package/esm/hooks/useIsShowingEllipsis.js.map +7 -0
  81. package/esm/hooks/useOnElementResize.js +12 -20
  82. package/esm/hooks/useOnElementResize.js.map +7 -0
  83. package/esm/hooks/useParentElement.js +9 -7
  84. package/esm/hooks/useParentElement.js.map +7 -0
  85. package/esm/hooks/usePrevious.js +10 -6
  86. package/esm/hooks/usePrevious.js.map +7 -0
  87. package/esm/hooks/useResizeObserver.js +20 -15
  88. package/esm/hooks/useResizeObserver.js.map +7 -0
  89. package/esm/hooks/useSetRef.js +8 -6
  90. package/esm/hooks/useSetRef.js.map +7 -0
  91. package/esm/hooks/useShouldRecalculate.js +11 -11
  92. package/esm/hooks/useShouldRecalculate.js.map +7 -0
  93. package/esm/hooks/useWindowScrollerList.js +20 -29
  94. package/esm/hooks/useWindowScrollerList.js.map +7 -0
  95. package/esm/hooks/useWindowSize.js +18 -15
  96. package/esm/hooks/useWindowSize.js.map +7 -0
  97. package/esm/index.js +206 -31
  98. package/esm/index.js.map +7 -0
  99. package/esm/onClickHandlerForNonInteractiveElements.js +17 -17
  100. package/esm/onClickHandlerForNonInteractiveElements.js.map +7 -0
  101. package/esm/operators.js +27 -34
  102. package/esm/operators.js.map +7 -0
  103. package/esm/platform.js +8 -4
  104. package/esm/platform.js.map +7 -0
  105. package/esm/reactTypesUtility.js +16 -9
  106. package/esm/reactTypesUtility.js.map +7 -0
  107. package/esm/scrollingTimer.js +8 -11
  108. package/esm/scrollingTimer.js.map +7 -0
  109. package/esm/system.js +16 -22
  110. package/esm/system.js.map +7 -0
  111. package/esm/timeUtils.js +13 -19
  112. package/esm/timeUtils.js.map +7 -0
  113. package/esm/utils.js +109 -72
  114. package/esm/utils.js.map +7 -0
  115. package/esm/validations.js +18 -28
  116. package/esm/validations.js.map +7 -0
  117. package/package.json +5 -1
  118. package/types/compose.d.ts +2 -1
  119. package/types/getComponentFromProps.d.ts +2 -1
  120. package/types/hooks/index.d.ts +15 -14
  121. package/types/hooks/useCancellableDelayedCallback.d.ts +2 -1
  122. package/types/hooks/useDerivedStateFromProps.d.ts +2 -1
  123. package/types/hooks/useExecutionTimer.d.ts +2 -1
  124. package/types/hooks/useExpandState.d.ts +3 -2
  125. package/types/hooks/useHotkeys.d.ts +3 -2
  126. package/types/hooks/useHoverHandlersDelay.d.ts +3 -2
  127. package/types/hooks/useIsShowingEllipsis.d.ts +5 -0
  128. package/types/hooks/usePrevious.d.ts +1 -1
  129. package/types/hooks/useResizeObserver.d.ts +2 -1
  130. package/types/hooks/useShouldRecalculate.d.ts +2 -1
  131. package/types/hooks/useWindowScrollerList.d.ts +3 -2
  132. package/types/hooks/useWindowSize.d.ts +2 -1
  133. package/types/index.d.ts +11 -11
  134. package/types/onClickHandlerForNonInteractiveElements.d.ts +7 -7
  135. package/types/scrollingTimer.d.ts +1 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useParentElement.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useState } from 'react';\n\nexport const useParentElement = (ref) => {\n const [parent, setParent] = useState(ref.current);\n\n useEffect(() => {\n if (ref.current) setParent(ref.current.parentNode);\n });\n return parent;\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,mBAAmB,CAAC,QAAQ;AACvC,QAAM,CAAC,QAAQ,aAAa,SAAS,IAAI;AAEzC,YAAU,MAAM;AACd,QAAI,IAAI;AAAS,gBAAU,IAAI,QAAQ;AAAA;AAEzC,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -1,11 +1,15 @@
1
- import { useRef, useEffect } from 'react';
2
-
3
- function usePrevious(value) {
1
+ import * as React from "react";
2
+ import { useEffect, useRef } from "react";
3
+ const usePrevious = (value) => {
4
4
  const ref = useRef();
5
5
  useEffect(() => {
6
6
  ref.current = value;
7
7
  }, [value]);
8
8
  return ref.current;
9
- }
10
-
11
- export { usePrevious as default };
9
+ };
10
+ var usePrevious_default = usePrevious;
11
+ export {
12
+ usePrevious_default as default,
13
+ usePrevious
14
+ };
15
+ //# sourceMappingURL=usePrevious.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/usePrevious.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useRef } from 'react';\n\nexport const usePrevious = (value) => {\n const ref = useRef();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n};\n\nexport default usePrevious;\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,cAAc,CAAC,UAAU;AACpC,QAAM,MAAM;AAEZ,YAAU,MAAM;AACd,QAAI,UAAU;AAAA,KACb,CAAC;AAEJ,SAAO,IAAI;AAAA;AAGb,IAAO,sBAAQ;",
6
+ "names": []
7
+ }
@@ -1,15 +1,15 @@
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) {
1
+ import * as React from "react";
2
+ import { useEffect, useState } from "react";
3
+ import raf from "raf";
4
+ import ResizeObserver from "resize-observer-polyfill";
5
+ const useResizeObserver = (handler, el) => {
7
6
  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
-
7
+ const resizeObserver = new ResizeObserver((entries) => {
8
+ if (!Array.isArray(entries))
9
+ return;
10
+ if (!entries.length)
11
+ return;
12
+ const entry = entries[0];
13
13
  raf(() => handler({
14
14
  width: entry.target.offsetWidth,
15
15
  height: entry.target.offsetHeight
@@ -17,10 +17,15 @@ function useResizeObserver(handler, el) {
17
17
  });
18
18
  const htmlEl = el || node;
19
19
  useEffect(() => {
20
- if (htmlEl) resizeObserver.observe(htmlEl);
20
+ if (htmlEl)
21
+ resizeObserver.observe(htmlEl);
21
22
  return () => htmlEl && resizeObserver.unobserve(htmlEl);
22
23
  }, [htmlEl]);
23
24
  return [setRef];
24
- }
25
-
26
- export { useResizeObserver as default };
25
+ };
26
+ var useResizeObserver_default = useResizeObserver;
27
+ export {
28
+ useResizeObserver_default as default,
29
+ useResizeObserver
30
+ };
31
+ //# sourceMappingURL=useResizeObserver.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useResizeObserver.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useState } from 'react';\nimport raf from 'raf';\nimport ResizeObserver from 'resize-observer-polyfill';\n\nexport const useResizeObserver = (handler, el) => {\n const [node, setRef] = useState(el);\n\n const resizeObserver = new ResizeObserver(entries => {\n if (!Array.isArray(entries)) return;\n if (!entries.length) return;\n const entry = entries[0];\n\n // execute on the next animation frame\n raf(() =>\n handler(\n {\n width: entry.target.offsetWidth,\n height: entry.target.offsetHeight,\n },\n entry.target,\n ),\n );\n });\n\n const htmlEl = el || node;\n\n useEffect(() => {\n if (htmlEl) resizeObserver.observe(htmlEl);\n return () => htmlEl && resizeObserver.unobserve(htmlEl);\n }, [htmlEl]);\n\n return [setRef];\n};\n\nexport default useResizeObserver;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAEO,MAAM,oBAAoB,CAAC,SAAS,OAAO;AAChD,QAAM,CAAC,MAAM,UAAU,SAAS;AAEhC,QAAM,iBAAiB,IAAI,eAAe,aAAW;AACnD,QAAI,CAAC,MAAM,QAAQ;AAAU;AAC7B,QAAI,CAAC,QAAQ;AAAQ;AACrB,UAAM,QAAQ,QAAQ;AAGtB,QAAI,MACF,QACE;AAAA,MACE,OAAO,MAAM,OAAO;AAAA,MACpB,QAAQ,MAAM,OAAO;AAAA,OAEvB,MAAM;AAAA;AAKZ,QAAM,SAAS,MAAM;AAErB,YAAU,MAAM;AACd,QAAI;AAAQ,qBAAe,QAAQ;AACnC,WAAO,MAAM,UAAU,eAAe,UAAU;AAAA,KAC/C,CAAC;AAEJ,SAAO,CAAC;AAAA;AAGV,IAAO,4BAAQ;",
6
+ "names": []
7
+ }
@@ -1,11 +1,13 @@
1
- import { useRef, useCallback } from 'react';
2
-
3
- const useSetRef = initial => {
1
+ import * as React from "react";
2
+ import { useCallback, useRef } from "react";
3
+ const useSetRef = (initial) => {
4
4
  const ref = useRef(initial);
5
- const setRef = useCallback(node => {
5
+ const setRef = useCallback((node) => {
6
6
  ref.current = node;
7
7
  }, []);
8
8
  return [ref, setRef];
9
9
  };
10
-
11
- export { useSetRef };
10
+ export {
11
+ useSetRef
12
+ };
13
+ //# sourceMappingURL=useSetRef.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useSetRef.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useRef } from 'react';\n\nexport const useSetRef = (initial) => {\n const ref = useRef(initial);\n const setRef = useCallback((node) => {\n ref.current = node;\n }, []);\n return [ref, setRef];\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,YAAY,CAAC,YAAY;AACpC,QAAM,MAAM,OAAO;AACnB,QAAM,SAAS,YAAY,CAAC,SAAS;AACnC,QAAI,UAAU;AAAA,KACb;AACH,SAAO,CAAC,KAAK;AAAA;",
6
+ "names": []
7
+ }
@@ -1,15 +1,15 @@
1
- import { useRef } from 'react';
2
-
3
- function useShouldRecalculate(bool) {
1
+ import * as React from "react";
2
+ import { useRef } from "react";
3
+ const useShouldRecalculate = (bool) => {
4
4
  const prevValueRef = useRef(0);
5
-
6
5
  if (!bool) {
7
- // If we need to recalculate, change the value we return
8
6
  prevValueRef.current += 1;
9
- } // else we return the same value as the previous render, which won't trigger a recalculation
10
-
11
-
7
+ }
12
8
  return prevValueRef.current;
13
- }
14
-
15
- export { useShouldRecalculate as default };
9
+ };
10
+ var useShouldRecalculate_default = useShouldRecalculate;
11
+ export {
12
+ useShouldRecalculate_default as default,
13
+ useShouldRecalculate
14
+ };
15
+ //# sourceMappingURL=useShouldRecalculate.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useShouldRecalculate.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef } from 'react';\n\nexport const useShouldRecalculate = (bool) => {\n const prevValueRef = useRef(0);\n if (!bool) {\n // If we need to recalculate, change the value we return\n prevValueRef.current += 1;\n } // else we return the same value as the previous render, which won't trigger a recalculation\n return prevValueRef.current;\n};\n\nexport default useShouldRecalculate;\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,uBAAuB,CAAC,SAAS;AAC5C,QAAM,eAAe,OAAO;AAC5B,MAAI,CAAC,MAAM;AAET,iBAAa,WAAW;AAAA;AAE1B,SAAO,aAAa;AAAA;AAGtB,IAAO,+BAAQ;",
6
+ "names": []
7
+ }
@@ -1,16 +1,11 @@
1
- import { useRef, useEffect } from 'react';
2
-
3
- function getScrollOffset() {
4
- let element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
5
- scrollTop: 0,
6
- scrollLeft: 0
7
- };
1
+ import * as React from "react";
2
+ import { useEffect, useRef } from "react";
3
+ function getScrollOffset(element = { scrollTop: 0, scrollLeft: 0 }) {
8
4
  return {
9
5
  top: element.scrollTop,
10
6
  left: element.scrollLeft
11
7
  };
12
8
  }
13
-
14
9
  function getPositionOffset(listEl, scrollableEl) {
15
10
  const scrollOffset = getScrollOffset(scrollableEl);
16
11
  const elementRect = listEl.getBoundingClientRect();
@@ -20,44 +15,40 @@ function getPositionOffset(listEl, scrollableEl) {
20
15
  left: elementRect.left + scrollOffset.top - containerRect.left
21
16
  };
22
17
  }
23
-
24
18
  function isParent(parentNode, childNode) {
25
19
  return childNode.parentNode === parentNode || childNode.parentNode && isParent(parentNode, childNode.parentNode);
26
20
  }
27
-
28
- function useWindowScrollerList(_ref) {
29
- let {
30
- listInstance,
31
- outerListRef
32
- } = _ref;
21
+ const useWindowScrollerList = ({ listInstance, outerListRef }) => {
33
22
  const scrollableParent = useRef();
34
23
  const listOffset = useRef();
35
-
36
24
  const getElementOffset = () => {
37
25
  listOffset.current = getPositionOffset(outerListRef.current, scrollableParent.current);
38
26
  };
39
-
40
- const handleScroll = e => {
27
+ const handleScroll = (e) => {
41
28
  if (!scrollableParent.current) {
42
29
  const containerTarget = e.target === document ? document.body : e.target;
43
30
  scrollableParent.current = isParent(containerTarget, outerListRef.current) && containerTarget;
44
31
  }
45
-
46
- if (!scrollableParent.current) return;
32
+ if (!scrollableParent.current)
33
+ return;
47
34
  getElementOffset();
48
35
  const scrollOffset = getScrollOffset(scrollableParent.current);
49
36
  const scrollTop = Math.max(0, scrollOffset.top - listOffset.current.top);
50
- if (listInstance.current) listInstance.current.scrollTo(scrollTop);
37
+ if (listInstance.current)
38
+ listInstance.current.scrollTo(scrollTop);
51
39
  };
52
-
53
40
  useEffect(() => {
54
- window.addEventListener('scroll', handleScroll, true);
55
- window.addEventListener('resize', getElementOffset, true);
41
+ window.addEventListener("scroll", handleScroll, true);
42
+ window.addEventListener("resize", getElementOffset, true);
56
43
  return () => {
57
- window.removeEventListener('scroll', handleScroll, true);
58
- window.removeEventListener('resize', getElementOffset, true);
44
+ window.removeEventListener("scroll", handleScroll, true);
45
+ window.removeEventListener("resize", getElementOffset, true);
59
46
  };
60
47
  }, []);
61
- }
62
-
63
- export { useWindowScrollerList as default };
48
+ };
49
+ var useWindowScrollerList_default = useWindowScrollerList;
50
+ export {
51
+ useWindowScrollerList_default as default,
52
+ useWindowScrollerList
53
+ };
54
+ //# sourceMappingURL=useWindowScrollerList.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useWindowScrollerList.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useRef } from 'react';\n\nfunction getScrollOffset(element = { scrollTop: 0, scrollLeft: 0 }) {\n return {\n top: element.scrollTop,\n left: element.scrollLeft,\n };\n}\n\nfunction getPositionOffset(listEl, scrollableEl) {\n const scrollOffset = getScrollOffset(scrollableEl);\n const elementRect = listEl.getBoundingClientRect();\n const containerRect = scrollableEl.getBoundingClientRect();\n return {\n top: elementRect.top + scrollOffset.top - containerRect.top,\n left: elementRect.left + scrollOffset.top - containerRect.left,\n };\n}\n\nfunction isParent(parentNode, childNode) {\n return (\n childNode.parentNode === parentNode ||\n (childNode.parentNode && isParent(parentNode, childNode.parentNode))\n );\n}\n\nexport const useWindowScrollerList = ({ listInstance, outerListRef }) => {\n const scrollableParent = useRef();\n const listOffset = useRef();\n\n const getElementOffset = () => {\n listOffset.current = getPositionOffset(\n outerListRef.current,\n scrollableParent.current,\n );\n };\n\n const handleScroll = e => {\n if (!scrollableParent.current) {\n const containerTarget = e.target === document ? document.body : e.target;\n scrollableParent.current =\n isParent(containerTarget, outerListRef.current) && containerTarget;\n }\n\n if (!scrollableParent.current) return;\n\n getElementOffset();\n\n const scrollOffset = getScrollOffset(scrollableParent.current);\n const scrollTop = Math.max(0, scrollOffset.top - listOffset.current.top);\n if (listInstance.current) listInstance.current.scrollTo(scrollTop);\n };\n\n useEffect(() => {\n window.addEventListener('scroll', handleScroll, true);\n window.addEventListener('resize', getElementOffset, true);\n return () => {\n window.removeEventListener('scroll', handleScroll, true);\n window.removeEventListener('resize', getElementOffset, true);\n };\n }, []);\n};\n\nexport default useWindowScrollerList;"],
5
+ "mappings": "AAAA;ACAA;AAEA,yBAAyB,UAAU,EAAE,WAAW,GAAG,YAAY,KAAK;AAClE,SAAO;AAAA,IACL,KAAK,QAAQ;AAAA,IACb,MAAM,QAAQ;AAAA;AAAA;AAIlB,2BAA2B,QAAQ,cAAc;AAC/C,QAAM,eAAe,gBAAgB;AACrC,QAAM,cAAc,OAAO;AAC3B,QAAM,gBAAgB,aAAa;AACnC,SAAO;AAAA,IACL,KAAK,YAAY,MAAM,aAAa,MAAM,cAAc;AAAA,IACxD,MAAM,YAAY,OAAO,aAAa,MAAM,cAAc;AAAA;AAAA;AAI9D,kBAAkB,YAAY,WAAW;AACvC,SACE,UAAU,eAAe,cACxB,UAAU,cAAc,SAAS,YAAY,UAAU;AAAA;AAIrD,MAAM,wBAAwB,CAAC,EAAE,cAAc,mBAAmB;AACvE,QAAM,mBAAmB;AACzB,QAAM,aAAa;AAEnB,QAAM,mBAAmB,MAAM;AAC7B,eAAW,UAAU,kBACnB,aAAa,SACb,iBAAiB;AAAA;AAIrB,QAAM,eAAe,OAAK;AACxB,QAAI,CAAC,iBAAiB,SAAS;AAC7B,YAAM,kBAAkB,EAAE,WAAW,WAAW,SAAS,OAAO,EAAE;AAClE,uBAAiB,UACf,SAAS,iBAAiB,aAAa,YAAY;AAAA;AAGvD,QAAI,CAAC,iBAAiB;AAAS;AAE/B;AAEA,UAAM,eAAe,gBAAgB,iBAAiB;AACtD,UAAM,YAAY,KAAK,IAAI,GAAG,aAAa,MAAM,WAAW,QAAQ;AACpE,QAAI,aAAa;AAAS,mBAAa,QAAQ,SAAS;AAAA;AAG1D,YAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,cAAc;AAChD,WAAO,iBAAiB,UAAU,kBAAkB;AACpD,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,cAAc;AACnD,aAAO,oBAAoB,UAAU,kBAAkB;AAAA;AAAA,KAExD;AAAA;AAGL,IAAO,gCAAQ;",
6
+ "names": []
7
+ }
@@ -1,25 +1,28 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import { useState, useLayoutEffect } from 'react';
3
-
4
- function useWindowSize() {
1
+ import * as React from "react";
2
+ import { useLayoutEffect, useState } from "react";
3
+ const useWindowSize = () => {
5
4
  const [size, setSize] = useState([0, 0]);
6
5
  useLayoutEffect(() => {
7
- if (!window) return false;
8
-
6
+ if (!window)
7
+ return false;
9
8
  function updateSize() {
10
9
  setSize([window.innerWidth, window.innerHeight]);
11
10
  }
12
-
13
- window.addEventListener('resize', updateSize);
14
- window.addEventListener('orientationchange', updateSize);
11
+ window.addEventListener("resize", updateSize);
12
+ window.addEventListener("orientationchange", updateSize);
15
13
  updateSize();
16
14
  return () => {
17
- window.removeEventListener('resize', updateSize);
18
- window.removeEventListener('orientationchange', updateSize);
15
+ window.removeEventListener("resize", updateSize);
16
+ window.removeEventListener("orientationchange", updateSize);
19
17
  };
20
18
  }, []);
21
- if (!window) return false;
19
+ if (!window)
20
+ return false;
22
21
  return size;
23
- }
24
-
25
- export { useWindowSize as default };
22
+ };
23
+ var useWindowSize_default = useWindowSize;
24
+ export {
25
+ useWindowSize_default as default,
26
+ useWindowSize
27
+ };
28
+ //# sourceMappingURL=useWindowSize.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useWindowSize.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useLayoutEffect, useState } from 'react';\n\nexport const useWindowSize = () => {\n const [size, setSize] = useState([0, 0]);\n useLayoutEffect(() => {\n if (!window) return false;\n function updateSize() {\n setSize([window.innerWidth, window.innerHeight]);\n }\n window.addEventListener('resize', updateSize);\n window.addEventListener('orientationchange', updateSize);\n updateSize();\n return () => {\n window.removeEventListener('resize', updateSize);\n window.removeEventListener('orientationchange', updateSize);\n };\n }, []);\n if (!window) return false;\n return size;\n};\n\nexport default useWindowSize;\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,MAAM,WAAW,SAAS,CAAC,GAAG;AACrC,kBAAgB,MAAM;AACpB,QAAI,CAAC;AAAQ,aAAO;AACpB,0BAAsB;AACpB,cAAQ,CAAC,OAAO,YAAY,OAAO;AAAA;AAErC,WAAO,iBAAiB,UAAU;AAClC,WAAO,iBAAiB,qBAAqB;AAC7C;AACA,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU;AACrC,aAAO,oBAAoB,qBAAqB;AAAA;AAAA,KAEjD;AACH,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AAAA;AAGT,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
package/esm/index.js CHANGED
@@ -1,31 +1,206 @@
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
+ import * as React from "react";
2
+ import { default as default2 } from "./getComponentFromProps";
3
+ import { default as default3 } from "./onClickHandlerForNonInteractiveElements";
4
+ import { capitalize } from "./capitalize";
5
+ import {
6
+ checkNotEmpty,
7
+ checkEmpty,
8
+ greaterThan,
9
+ validDate,
10
+ equal,
11
+ notEqual,
12
+ isNull,
13
+ isNotNull,
14
+ isIn,
15
+ isNotIn,
16
+ greaterThanOrEquals,
17
+ lessThanOrEquals,
18
+ startsWith,
19
+ contains
20
+ } from "./operators";
21
+ import {
22
+ cx,
23
+ runAll,
24
+ hashArray,
25
+ safeCall,
26
+ removeUndefinedProperties,
27
+ isObject,
28
+ curry,
29
+ arrayMove,
30
+ uniq,
31
+ filter,
32
+ uniqBy,
33
+ groupBy,
34
+ property,
35
+ get,
36
+ set,
37
+ cloneDeep,
38
+ debounce,
39
+ findIndex,
40
+ isEmpty,
41
+ isString,
42
+ isEqual,
43
+ maxBy,
44
+ meanBy,
45
+ noop,
46
+ omit,
47
+ orderBy,
48
+ pull,
49
+ sortBy,
50
+ sumBy,
51
+ transform,
52
+ isFunction,
53
+ range,
54
+ parseInt,
55
+ padStart,
56
+ isNaN,
57
+ values,
58
+ throttle,
59
+ toggleInObject,
60
+ toggleInArray,
61
+ pick,
62
+ pickBy,
63
+ differenceBy,
64
+ differenceWith,
65
+ addOrRemove,
66
+ isEqualWith,
67
+ isBoolean
68
+ } from "./utils";
69
+ import { setRef, mergeRefs, logger } from "./system";
70
+ import {
71
+ useMeasure,
72
+ useForceUpdate,
73
+ useOnClickOutside,
74
+ useUncontrolled,
75
+ useExecutionTimer,
76
+ useExpandState,
77
+ useHotkeys,
78
+ useHoverHandlersDelay,
79
+ useResizeObserver,
80
+ useShouldRecalculate,
81
+ useWindowScrollerList,
82
+ useWindowSize,
83
+ usePrevious,
84
+ useCancellableDelayedCallback,
85
+ useDerivedStateFromProps,
86
+ useSetRef,
87
+ useParentElement,
88
+ useOnElementResize,
89
+ useIsShowingEllipsis
90
+ } from "./hooks";
91
+ import { getVisibleTimeByFormat, addLeadingZeros } from "./timeUtils";
92
+ import { compose } from "./compose";
93
+ import { DOCUMENT, WINDOW } from "./platform";
94
+ import {
95
+ isClassComponent,
96
+ isFunctionComponent,
97
+ isReactComponent,
98
+ isElement,
99
+ isDOMTypeElement,
100
+ isCompositeTypeElement
101
+ } from "./reactTypesUtility";
102
+ import { resetTimer } from "./scrollingTimer";
103
+ import { isRequired, isGreaterThan, isValidDate } from "./validations";
104
+ export {
105
+ DOCUMENT,
106
+ WINDOW,
107
+ addLeadingZeros,
108
+ addOrRemove,
109
+ arrayMove,
110
+ capitalize,
111
+ checkEmpty,
112
+ checkNotEmpty,
113
+ cloneDeep,
114
+ compose,
115
+ contains,
116
+ curry,
117
+ cx,
118
+ debounce,
119
+ differenceBy,
120
+ differenceWith,
121
+ equal,
122
+ filter,
123
+ findIndex,
124
+ get,
125
+ default2 as getComponentFromProps,
126
+ getVisibleTimeByFormat,
127
+ greaterThan,
128
+ greaterThanOrEquals,
129
+ groupBy,
130
+ hashArray,
131
+ isBoolean,
132
+ isClassComponent,
133
+ isCompositeTypeElement,
134
+ isDOMTypeElement,
135
+ isElement,
136
+ isEmpty,
137
+ isEqual,
138
+ isEqualWith,
139
+ isFunction,
140
+ isFunctionComponent,
141
+ isGreaterThan,
142
+ isIn,
143
+ isNaN,
144
+ isNotIn,
145
+ isNotNull,
146
+ isNull,
147
+ isObject,
148
+ isReactComponent,
149
+ isRequired,
150
+ isString,
151
+ isValidDate,
152
+ lessThanOrEquals,
153
+ logger,
154
+ maxBy,
155
+ meanBy,
156
+ mergeRefs,
157
+ noop,
158
+ notEqual,
159
+ omit,
160
+ default3 as onClickHandlerForNonInteractiveElements,
161
+ orderBy,
162
+ padStart,
163
+ parseInt,
164
+ pick,
165
+ pickBy,
166
+ property,
167
+ pull,
168
+ range,
169
+ removeUndefinedProperties,
170
+ resetTimer,
171
+ runAll,
172
+ safeCall,
173
+ set,
174
+ setRef,
175
+ sortBy,
176
+ startsWith,
177
+ sumBy,
178
+ throttle,
179
+ toggleInArray,
180
+ toggleInObject,
181
+ transform,
182
+ uniq,
183
+ uniqBy,
184
+ useCancellableDelayedCallback,
185
+ useDerivedStateFromProps,
186
+ useExecutionTimer,
187
+ useExpandState,
188
+ useForceUpdate,
189
+ useHotkeys,
190
+ useHoverHandlersDelay,
191
+ useIsShowingEllipsis,
192
+ useMeasure,
193
+ useOnClickOutside,
194
+ useOnElementResize,
195
+ useParentElement,
196
+ usePrevious,
197
+ useResizeObserver,
198
+ useSetRef,
199
+ useShouldRecalculate,
200
+ useUncontrolled,
201
+ useWindowScrollerList,
202
+ useWindowSize,
203
+ validDate,
204
+ values
205
+ };
206
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default as getComponentFromProps } from './getComponentFromProps';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';\nexport { capitalize } from './capitalize';\nexport {\n checkNotEmpty,\n checkEmpty,\n greaterThan,\n validDate,\n equal,\n notEqual,\n isNull,\n isNotNull,\n isIn,\n isNotIn,\n greaterThanOrEquals,\n lessThanOrEquals,\n startsWith,\n contains,\n} from './operators';\nexport {\n cx,\n runAll,\n hashArray,\n safeCall,\n removeUndefinedProperties,\n isObject,\n curry,\n arrayMove,\n uniq,\n filter,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n cloneDeep,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n pull,\n sortBy,\n sumBy,\n transform,\n isFunction,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n toggleInObject,\n toggleInArray,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n addOrRemove,\n isEqualWith,\n isBoolean,\n} from './utils';\nexport { setRef, mergeRefs, logger } from './system';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useUncontrolled,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n useWindowSize,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useSetRef,\n useParentElement,\n useOnElementResize,\n useIsShowingEllipsis,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport {\n isClassComponent,\n isFunctionComponent,\n isReactComponent,\n isElement,\n isDOMTypeElement,\n isCompositeTypeElement,\n} from './reactTypesUtility';\nexport { resetTimer } from './scrollingTimer';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;",
6
+ "names": []
7
+ }
@@ -1,20 +1,20 @@
1
- /**
2
- * onClickHandler: callback
3
- *
4
- * @param onClickHandler
5
- */
6
- var onClickHandlerForNonInteractiveElements = (onClickHandler => ({
7
- role: 'button',
8
- tabIndex: '0',
1
+ import * as React from "react";
2
+ const onClickHandlerForNonInteractiveElements = (onClickHandler) => ({
3
+ role: "button",
4
+ tabIndex: "0",
9
5
  onClick: onClickHandler,
10
- onKeyPress: event => {
6
+ onKeyPress: (event) => {
11
7
  event.stopPropagation();
12
- const {
13
- keycode,
14
- key
15
- } = event;
16
- if (key === 'Enter') onClickHandler(event);else if (keycode === 13) onClickHandler(event);
8
+ const { keycode, key } = event;
9
+ if (key === "Enter")
10
+ onClickHandler(event);
11
+ else if (keycode === 13)
12
+ onClickHandler(event);
17
13
  }
18
- }));
19
-
20
- export { onClickHandlerForNonInteractiveElements as default };
14
+ });
15
+ var onClickHandlerForNonInteractiveElements_default = onClickHandlerForNonInteractiveElements;
16
+ export {
17
+ onClickHandlerForNonInteractiveElements_default as default,
18
+ onClickHandlerForNonInteractiveElements
19
+ };
20
+ //# sourceMappingURL=onClickHandlerForNonInteractiveElements.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/onClickHandlerForNonInteractiveElements.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/**\n * onClickHandler: callback\n *\n * @param onClickHandler\n */\nexport const onClickHandlerForNonInteractiveElements = onClickHandler => ({\n role: 'button',\n tabIndex: '0',\n onClick: onClickHandler,\n onKeyPress: event => {\n event.stopPropagation();\n const { keycode, key } = event;\n if (key === 'Enter') onClickHandler(event);\n else if (keycode === 13) onClickHandler(event);\n },\n});\n\nexport default onClickHandlerForNonInteractiveElements;\n"],
5
+ "mappings": "AAAA;ACKO,MAAM,0CAA0C,oBAAmB;AAAA,EACxE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY,WAAS;AACnB,UAAM;AACN,UAAM,EAAE,SAAS,QAAQ;AACzB,QAAI,QAAQ;AAAS,qBAAe;AAAA,aAC3B,YAAY;AAAI,qBAAe;AAAA;AAAA;AAI5C,IAAO,kDAAQ;",
6
+ "names": []
7
+ }