@elliemae/ds-utilities 2.3.0-next.0 → 3.0.0-alpha.0

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 (215) 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 +48 -0
  6. package/dist/cjs/getComponentFromProps.js.map +7 -0
  7. package/dist/cjs/hooks/index.js +71 -0
  8. package/dist/cjs/hooks/index.js.map +7 -0
  9. package/dist/cjs/hooks/useCancellableDelayedCallback.js +51 -0
  10. package/dist/cjs/hooks/useCancellableDelayedCallback.js.map +7 -0
  11. package/dist/cjs/hooks/useDerivedStateFromProps.js +67 -0
  12. package/dist/cjs/hooks/useDerivedStateFromProps.js.map +7 -0
  13. package/dist/cjs/hooks/useExecutionTimer.js +50 -0
  14. package/dist/cjs/hooks/useExecutionTimer.js.map +7 -0
  15. package/dist/cjs/hooks/useExpandState.js +120 -0
  16. package/dist/cjs/hooks/useExpandState.js.map +7 -0
  17. package/dist/cjs/hooks/useHotkeys.js +45 -0
  18. package/dist/cjs/hooks/useHotkeys.js.map +7 -0
  19. package/dist/cjs/hooks/useHoverHandlersDelay.js +58 -0
  20. package/dist/cjs/hooks/useHoverHandlersDelay.js.map +7 -0
  21. package/dist/cjs/hooks/useIsShowingEllipsis.js +58 -0
  22. package/dist/cjs/hooks/useIsShowingEllipsis.js.map +7 -0
  23. package/dist/cjs/hooks/useOnElementResize.js +54 -0
  24. package/dist/cjs/hooks/useOnElementResize.js.map +7 -0
  25. package/dist/cjs/hooks/useParentElement.js +43 -0
  26. package/dist/cjs/hooks/useParentElement.js.map +7 -0
  27. package/dist/cjs/hooks/usePrevious.js +44 -0
  28. package/dist/cjs/hooks/usePrevious.js.map +7 -0
  29. package/dist/cjs/hooks/useResizeObserver.js +60 -0
  30. package/dist/cjs/hooks/useResizeObserver.js.map +7 -0
  31. package/dist/cjs/hooks/useSetRef.js +42 -0
  32. package/dist/cjs/hooks/useSetRef.js.map +7 -0
  33. package/dist/cjs/hooks/useShouldRecalculate.js +44 -0
  34. package/dist/cjs/hooks/useShouldRecalculate.js.map +7 -0
  35. package/dist/cjs/hooks/useWindowScrollerList.js +83 -0
  36. package/dist/cjs/hooks/useWindowScrollerList.js.map +7 -0
  37. package/dist/cjs/hooks/useWindowSize.js +57 -0
  38. package/dist/cjs/hooks/useWindowSize.js.map +7 -0
  39. package/dist/cjs/index.js +146 -0
  40. package/dist/cjs/index.js.map +7 -0
  41. package/dist/cjs/onClickHandlerForNonInteractiveElements.js +49 -0
  42. package/dist/cjs/onClickHandlerForNonInteractiveElements.js.map +7 -0
  43. package/dist/cjs/operators.js +68 -0
  44. package/dist/cjs/operators.js.map +7 -0
  45. package/dist/cjs/platform.js +37 -0
  46. package/dist/cjs/platform.js.map +7 -0
  47. package/dist/cjs/reactTypesUtility.js +58 -0
  48. package/dist/cjs/reactTypesUtility.js.map +7 -0
  49. package/dist/cjs/scrollingTimer.js +46 -0
  50. package/dist/cjs/scrollingTimer.js.map +7 -0
  51. package/dist/cjs/system.js +60 -0
  52. package/dist/cjs/system.js.map +7 -0
  53. package/dist/cjs/timeUtils.js +43 -0
  54. package/dist/cjs/timeUtils.js.map +7 -0
  55. package/dist/cjs/utils.js +127 -0
  56. package/dist/cjs/utils.js.map +7 -0
  57. package/dist/cjs/validations.js +57 -0
  58. package/dist/cjs/validations.js.map +7 -0
  59. package/dist/esm/capitalize.js +6 -0
  60. package/dist/esm/capitalize.js.map +7 -0
  61. package/dist/esm/compose.js +16 -0
  62. package/dist/esm/compose.js.map +7 -0
  63. package/dist/esm/getComponentFromProps.js +19 -0
  64. package/dist/esm/getComponentFromProps.js.map +7 -0
  65. package/dist/esm/hooks/index.js +42 -0
  66. package/dist/esm/hooks/index.js.map +7 -0
  67. package/dist/esm/hooks/useCancellableDelayedCallback.js +22 -0
  68. package/dist/esm/hooks/useCancellableDelayedCallback.js.map +7 -0
  69. package/dist/esm/hooks/useDerivedStateFromProps.js +38 -0
  70. package/dist/esm/hooks/useDerivedStateFromProps.js.map +7 -0
  71. package/dist/esm/hooks/useExecutionTimer.js +21 -0
  72. package/dist/esm/hooks/useExecutionTimer.js.map +7 -0
  73. package/dist/esm/hooks/useExpandState.js +91 -0
  74. package/dist/esm/hooks/useExpandState.js.map +7 -0
  75. package/dist/esm/hooks/useHotkeys.js +16 -0
  76. package/dist/esm/hooks/useHotkeys.js.map +7 -0
  77. package/{esm → dist/esm}/hooks/useHoverHandlersDelay.js +15 -12
  78. package/dist/esm/hooks/useHoverHandlersDelay.js.map +7 -0
  79. package/{esm → dist/esm}/hooks/useIsShowingEllipsis.js +9 -12
  80. package/dist/esm/hooks/useIsShowingEllipsis.js.map +7 -0
  81. package/dist/esm/hooks/useOnElementResize.js +25 -0
  82. package/dist/esm/hooks/useOnElementResize.js.map +7 -0
  83. package/dist/esm/hooks/useParentElement.js +14 -0
  84. package/dist/esm/hooks/useParentElement.js.map +7 -0
  85. package/dist/esm/hooks/usePrevious.js +15 -0
  86. package/dist/esm/hooks/usePrevious.js.map +7 -0
  87. package/dist/esm/hooks/useResizeObserver.js +31 -0
  88. package/dist/esm/hooks/useResizeObserver.js.map +7 -0
  89. package/dist/esm/hooks/useSetRef.js +13 -0
  90. package/dist/esm/hooks/useSetRef.js.map +7 -0
  91. package/dist/esm/hooks/useShouldRecalculate.js +15 -0
  92. package/dist/esm/hooks/useShouldRecalculate.js.map +7 -0
  93. package/{esm → dist/esm}/hooks/useWindowScrollerList.js +20 -29
  94. package/dist/esm/hooks/useWindowScrollerList.js.map +7 -0
  95. package/dist/esm/hooks/useWindowSize.js +28 -0
  96. package/dist/esm/hooks/useWindowSize.js.map +7 -0
  97. package/dist/esm/index.js +206 -0
  98. package/dist/esm/index.js.map +7 -0
  99. package/dist/esm/onClickHandlerForNonInteractiveElements.js +20 -0
  100. package/dist/esm/onClickHandlerForNonInteractiveElements.js.map +7 -0
  101. package/dist/esm/operators.js +39 -0
  102. package/dist/esm/operators.js.map +7 -0
  103. package/dist/esm/platform.js +8 -0
  104. package/dist/esm/platform.js.map +7 -0
  105. package/dist/esm/reactTypesUtility.js +29 -0
  106. package/dist/esm/reactTypesUtility.js.map +7 -0
  107. package/dist/esm/scrollingTimer.js +17 -0
  108. package/dist/esm/scrollingTimer.js.map +7 -0
  109. package/dist/esm/system.js +31 -0
  110. package/dist/esm/system.js.map +7 -0
  111. package/dist/esm/timeUtils.js +14 -0
  112. package/dist/esm/timeUtils.js.map +7 -0
  113. package/dist/esm/utils.js +136 -0
  114. package/dist/esm/utils.js.map +7 -0
  115. package/dist/esm/validations.js +28 -0
  116. package/dist/esm/validations.js.map +7 -0
  117. package/{types → dist/types}/capitalize.d.ts +0 -0
  118. package/{types → dist/types}/compose.d.ts +2 -1
  119. package/dist/types/getComponentFromProps.d.ts +3 -0
  120. package/dist/types/hooks/index.d.ts +19 -0
  121. package/dist/types/hooks/useCancellableDelayedCallback.d.ts +2 -0
  122. package/dist/types/hooks/useDerivedStateFromProps.d.ts +2 -0
  123. package/dist/types/hooks/useExecutionTimer.d.ts +2 -0
  124. package/{types → dist/types}/hooks/useExpandState.d.ts +3 -2
  125. package/dist/types/hooks/useHotkeys.d.ts +6 -0
  126. package/{types → dist/types}/hooks/useHoverHandlersDelay.d.ts +3 -2
  127. package/{types → dist/types}/hooks/useIsShowingEllipsis.d.ts +0 -0
  128. package/dist/types/hooks/useOnElementResize.d.ts +2 -0
  129. package/{types → dist/types}/hooks/useParentElement.d.ts +0 -0
  130. package/dist/types/hooks/usePrevious.d.ts +2 -0
  131. package/dist/types/hooks/useResizeObserver.d.ts +3 -0
  132. package/{types → dist/types}/hooks/useSetRef.d.ts +0 -0
  133. package/dist/types/hooks/useShouldRecalculate.d.ts +2 -0
  134. package/dist/types/hooks/useWindowScrollerList.d.ts +5 -0
  135. package/dist/types/hooks/useWindowSize.d.ts +2 -0
  136. package/dist/types/index.d.ts +13 -0
  137. package/{types → dist/types}/onClickHandlerForNonInteractiveElements.d.ts +7 -7
  138. package/{types → dist/types}/operators.d.ts +0 -0
  139. package/{types → dist/types}/platform.d.ts +0 -0
  140. package/{types → dist/types}/reactTypesUtility.d.ts +0 -0
  141. package/dist/types/scrollingTimer.d.ts +1 -0
  142. package/{types → dist/types}/system.d.ts +0 -0
  143. package/{types → dist/types}/timeUtils.d.ts +0 -0
  144. package/{types → dist/types}/utils.d.ts +0 -0
  145. package/{types → dist/types}/validations.d.ts +0 -0
  146. package/package.json +79 -71
  147. package/cjs/capitalize.js +0 -7
  148. package/cjs/compose.js +0 -38
  149. package/cjs/getComponentFromProps.js +0 -30
  150. package/cjs/hooks/index.js +0 -63
  151. package/cjs/hooks/useCancellableDelayedCallback.js +0 -26
  152. package/cjs/hooks/useDerivedStateFromProps.js +0 -56
  153. package/cjs/hooks/useExecutionTimer.js +0 -31
  154. package/cjs/hooks/useExpandState.js +0 -133
  155. package/cjs/hooks/useHotkeys.js +0 -25
  156. package/cjs/hooks/useHoverHandlersDelay.js +0 -28
  157. package/cjs/hooks/useIsShowingEllipsis.js +0 -36
  158. package/cjs/hooks/useOnElementResize.js +0 -38
  159. package/cjs/hooks/useParentElement.js +0 -16
  160. package/cjs/hooks/usePrevious.js +0 -13
  161. package/cjs/hooks/useResizeObserver.js +0 -33
  162. package/cjs/hooks/useSetRef.js +0 -15
  163. package/cjs/hooks/useShouldRecalculate.js +0 -17
  164. package/cjs/hooks/useWindowScrollerList.js +0 -65
  165. package/cjs/hooks/useWindowSize.js +0 -27
  166. package/cjs/index.js +0 -268
  167. package/cjs/onClickHandlerForNonInteractiveElements.js +0 -22
  168. package/cjs/operators.js +0 -63
  169. package/cjs/platform.js +0 -9
  170. package/cjs/reactTypesUtility.js +0 -35
  171. package/cjs/scrollingTimer.js +0 -24
  172. package/cjs/system.js +0 -43
  173. package/cjs/timeUtils.js +0 -25
  174. package/cjs/utils.js +0 -263
  175. package/cjs/validations.js +0 -44
  176. package/esm/capitalize.js +0 -3
  177. package/esm/compose.js +0 -34
  178. package/esm/getComponentFromProps.js +0 -23
  179. package/esm/hooks/index.js +0 -19
  180. package/esm/hooks/useCancellableDelayedCallback.js +0 -24
  181. package/esm/hooks/useDerivedStateFromProps.js +0 -54
  182. package/esm/hooks/useExecutionTimer.js +0 -29
  183. package/esm/hooks/useExpandState.js +0 -127
  184. package/esm/hooks/useHotkeys.js +0 -19
  185. package/esm/hooks/useOnElementResize.js +0 -34
  186. package/esm/hooks/useParentElement.js +0 -12
  187. package/esm/hooks/usePrevious.js +0 -11
  188. package/esm/hooks/useResizeObserver.js +0 -26
  189. package/esm/hooks/useSetRef.js +0 -11
  190. package/esm/hooks/useShouldRecalculate.js +0 -15
  191. package/esm/hooks/useWindowSize.js +0 -25
  192. package/esm/index.js +0 -32
  193. package/esm/onClickHandlerForNonInteractiveElements.js +0 -20
  194. package/esm/operators.js +0 -46
  195. package/esm/platform.js +0 -4
  196. package/esm/reactTypesUtility.js +0 -22
  197. package/esm/scrollingTimer.js +0 -20
  198. package/esm/system.js +0 -37
  199. package/esm/timeUtils.js +0 -20
  200. package/esm/utils.js +0 -99
  201. package/esm/validations.js +0 -38
  202. package/types/getComponentFromProps.d.ts +0 -2
  203. package/types/hooks/index.d.ts +0 -19
  204. package/types/hooks/useCancellableDelayedCallback.d.ts +0 -1
  205. package/types/hooks/useDerivedStateFromProps.d.ts +0 -1
  206. package/types/hooks/useExecutionTimer.d.ts +0 -1
  207. package/types/hooks/useHotkeys.d.ts +0 -5
  208. package/types/hooks/useOnElementResize.d.ts +0 -2
  209. package/types/hooks/usePrevious.d.ts +0 -2
  210. package/types/hooks/useResizeObserver.d.ts +0 -2
  211. package/types/hooks/useShouldRecalculate.d.ts +0 -1
  212. package/types/hooks/useWindowScrollerList.d.ts +0 -4
  213. package/types/hooks/useWindowSize.d.ts +0 -1
  214. package/types/index.d.ts +0 -13
  215. package/types/scrollingTimer.d.ts +0 -1
@@ -0,0 +1,127 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var utils_exports = {};
29
+ __export(utils_exports, {
30
+ addOrRemove: () => addOrRemove,
31
+ arrayMove: () => arrayMove,
32
+ cloneDeep: () => import_lodash.cloneDeep,
33
+ curry: () => import_lodash.curry,
34
+ cx: () => cx,
35
+ debounce: () => import_lodash.debounce,
36
+ default: () => utils_default,
37
+ differenceBy: () => import_lodash.differenceBy,
38
+ differenceWith: () => import_lodash.differenceWith,
39
+ filter: () => import_lodash.filter,
40
+ findIndex: () => import_lodash.findIndex,
41
+ get: () => import_lodash.get,
42
+ groupBy: () => import_lodash.groupBy,
43
+ hashArray: () => hashArray,
44
+ isBoolean: () => import_lodash.isBoolean,
45
+ isEmpty: () => import_lodash.isEmpty,
46
+ isEqual: () => import_lodash.isEqual,
47
+ isEqualWith: () => import_lodash.isEqualWith,
48
+ isFunction: () => import_lodash.isFunction,
49
+ isNaN: () => import_lodash.isNaN,
50
+ isObject: () => import_lodash.isObject,
51
+ isString: () => import_lodash.isString,
52
+ maxBy: () => import_lodash.maxBy,
53
+ meanBy: () => import_lodash.meanBy,
54
+ noop: () => import_lodash.noop,
55
+ omit: () => import_lodash.omit,
56
+ orderBy: () => import_lodash.orderBy,
57
+ padStart: () => import_lodash.padStart,
58
+ parseInt: () => import_lodash.parseInt,
59
+ pick: () => import_lodash.pick,
60
+ pickBy: () => import_lodash.pickBy,
61
+ property: () => import_lodash.property,
62
+ pull: () => import_lodash.pull,
63
+ range: () => import_lodash.range,
64
+ removeUndefinedProperties: () => removeUndefinedProperties,
65
+ runAll: () => runAll,
66
+ safeCall: () => safeCall,
67
+ set: () => import_lodash.set,
68
+ sortBy: () => import_lodash.sortBy,
69
+ sumBy: () => import_lodash.sumBy,
70
+ throttle: () => import_lodash.throttle,
71
+ toggleInArray: () => toggleInArray,
72
+ toggleInObject: () => toggleInObject,
73
+ transform: () => import_lodash.transform,
74
+ uniq: () => import_lodash.uniq,
75
+ uniqBy: () => import_lodash.uniqBy,
76
+ values: () => import_lodash.values
77
+ });
78
+ var React = __toESM(require("react"));
79
+ var import_lodash = require("lodash");
80
+ const cx = (...classnames) => classnames.reduce((result, cn) => `${result} ${cn || ""}`, "");
81
+ const toggleInObject = (obj, key, value) => obj[key] !== void 0 ? (0, import_lodash.omit)(obj, [key]) : { ...obj, [key]: value };
82
+ const toggleInArray = (array, value) => array.indexOf(value) === -1 ? [value] : [];
83
+ const arrayMoveMutate = (array, from, to) => {
84
+ array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
85
+ };
86
+ const arrayMove = (array, from, to) => {
87
+ array = array.slice();
88
+ arrayMoveMutate(array, from, to);
89
+ return array;
90
+ };
91
+ const accessorDefault = (item) => item;
92
+ const addOrRemove = (array, item, accessor = accessorDefault) => {
93
+ const index = array.findIndex((iItem) => accessor(iItem) === accessor(item));
94
+ if (index !== -1) {
95
+ const nextArray = (0, import_lodash.cloneDeep)(array);
96
+ nextArray.splice(index, 1);
97
+ return nextArray;
98
+ }
99
+ return [...array, item];
100
+ };
101
+ function runAll(...fns) {
102
+ return (...args) => fns.forEach((fn) => {
103
+ if (Array.isArray(fn))
104
+ runAll(fn);
105
+ if ((0, import_lodash.isFunction)(fn))
106
+ fn(...args);
107
+ });
108
+ }
109
+ function hashArray(arr, fieldName) {
110
+ return arr.reduce((result, item) => ({
111
+ ...result,
112
+ [fieldName ? item[fieldName] : item]: true
113
+ }), {});
114
+ }
115
+ function safeCall(fun, ...args) {
116
+ if ((0, import_lodash.isFunction)(fun)) {
117
+ fun(...args);
118
+ }
119
+ }
120
+ const removeUndefinedProperties = (obj) => {
121
+ const cleanObject = { ...obj };
122
+ Object.keys(obj).forEach((key) => cleanObject[key] === void 0 && delete cleanObject[key]);
123
+ return cleanObject;
124
+ };
125
+ var utils_default = {};
126
+ module.exports = __toCommonJS(utils_exports);
127
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable no-param-reassign */\n/* eslint-disable max-lines */\n/**\n * commonly used functions\n * Add a level of indirection to lodash so we can replace\n * it if desired, while keeping function names the same\n */\n// TODO: Import individual packages vs referencing all of lodash\nimport {\n cloneDeep,\n filter,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n noop,\n omit,\n orderBy,\n pull,\n sumBy,\n maxBy,\n meanBy,\n sortBy,\n transform,\n isFunction,\n uniq,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n isEqualWith,\n curry,\n isObject,\n isBoolean,\n} from 'lodash';\n\n/**\n * Concatenates classNames from arguments\n *\n * @param {...any} classnames\n */\nexport const cx = (...classnames) => classnames.reduce((result, cn) => `${result} ${cn || ''}`, '');\n\n// if entry exists, remove it, if not, add it\nconst toggleInObject = (obj, key, value) => (obj[key] !== undefined ? omit(obj, [key]) : { ...obj, [key]: value });\nconst toggleInArray = (array, value) => (array.indexOf(value) === -1 ? [value] : []);\n\nconst arrayMoveMutate = (array, from, to) => {\n array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);\n};\n\nconst arrayMove = (array, from, to) => {\n array = array.slice();\n arrayMoveMutate(array, from, to);\n return array;\n};\n\nconst accessorDefault = (item) => item;\nconst addOrRemove = (array, item, accessor = accessorDefault) => {\n const index = array.findIndex((iItem) => accessor(iItem) === accessor(item));\n\n if (index !== -1) {\n const nextArray = cloneDeep(array);\n nextArray.splice(index, 1);\n return nextArray;\n }\n\n return [...array, item];\n};\n\nexport function runAll(...fns) {\n return (...args) =>\n fns.forEach((fn) => {\n if (Array.isArray(fn)) runAll(fn);\n if (isFunction(fn)) fn(...args);\n });\n}\n\nexport function hashArray(arr, fieldName) {\n return arr.reduce(\n (result, item) => ({\n ...result,\n [fieldName ? item[fieldName] : item]: true,\n }),\n {},\n );\n}\n\nexport function safeCall(fun, ...args) {\n if (isFunction(fun)) {\n fun(...args);\n }\n}\n\nexport const removeUndefinedProperties = (obj) => {\n const cleanObject = { ...obj };\n Object.keys(obj).forEach((key) => cleanObject[key] === undefined && delete cleanObject[key]);\n return cleanObject;\n};\n\nexport default {};\nexport {\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};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAAA;AAAA;AAAA;ACAA,YAAuB;ADQvB,oBAsCO;AAOA,MAAM,KAAK,IAAI,eAAe,WAAW,OAAO,CAAC,QAAQ,OAAO,GAAG,UAAU,MAAM,MAAM;AAGhG,MAAM,iBAAiB,CAAC,KAAK,KAAK,UAAW,IAAI,SAAS,SAAY,wBAAK,KAAK,CAAC,QAAQ,KAAK,MAAM,MAAM;AAC1G,MAAM,gBAAgB,CAAC,OAAO,UAAW,MAAM,QAAQ,WAAW,KAAK,CAAC,SAAS;AAEjF,MAAM,kBAAkB,CAAC,OAAO,MAAM,OAAO;AAC3C,QAAM,OAAO,KAAK,IAAI,MAAM,SAAS,KAAK,IAAI,GAAG,MAAM,OAAO,MAAM,GAAG;AAAA;AAGzE,MAAM,YAAY,CAAC,OAAO,MAAM,OAAO;AACrC,UAAQ,MAAM;AACd,kBAAgB,OAAO,MAAM;AAC7B,SAAO;AAAA;AAGT,MAAM,kBAAkB,CAAC,SAAS;AAClC,MAAM,cAAc,CAAC,OAAO,MAAM,WAAW,oBAAoB;AAC/D,QAAM,QAAQ,MAAM,UAAU,CAAC,UAAU,SAAS,WAAW,SAAS;AAEtE,MAAI,UAAU,IAAI;AAChB,UAAM,YAAY,6BAAU;AAC5B,cAAU,OAAO,OAAO;AACxB,WAAO;AAAA;AAGT,SAAO,CAAC,GAAG,OAAO;AAAA;AAGb,mBAAmB,KAAK;AAC7B,SAAO,IAAI,SACT,IAAI,QAAQ,CAAC,OAAO;AAClB,QAAI,MAAM,QAAQ;AAAK,aAAO;AAC9B,QAAI,8BAAW;AAAK,SAAG,GAAG;AAAA;AAAA;AAIzB,mBAAmB,KAAK,WAAW;AACxC,SAAO,IAAI,OACT,CAAC,QAAQ,SAAU;AAAA,OACd;AAAA,KACF,YAAY,KAAK,aAAa,OAAO;AAAA,MAExC;AAAA;AAIG,kBAAkB,QAAQ,MAAM;AACrC,MAAI,8BAAW,MAAM;AACnB,QAAI,GAAG;AAAA;AAAA;AAIJ,MAAM,4BAA4B,CAAC,QAAQ;AAChD,QAAM,cAAc,KAAK;AACzB,SAAO,KAAK,KAAK,QAAQ,CAAC,QAAQ,YAAY,SAAS,UAAa,OAAO,YAAY;AACvF,SAAO;AAAA;AAGT,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,57 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var validations_exports = {};
29
+ __export(validations_exports, {
30
+ isGreaterThan: () => isGreaterThan,
31
+ isRequired: () => isRequired,
32
+ isValidDate: () => isValidDate
33
+ });
34
+ var React = __toESM(require("react"));
35
+ var import_operators = require("./operators");
36
+ const isRequired = ({ value, help = "Field is Required" }) => ({
37
+ payload: help,
38
+ error: (0, import_operators.checkNotEmpty)(value)
39
+ });
40
+ const isGreaterThan = ({ value, help, comparator = 0 }) => {
41
+ if (!help)
42
+ help = `Max value ${comparator}`;
43
+ return {
44
+ payload: help,
45
+ error: (0, import_operators.greaterThan)(value, comparator)
46
+ };
47
+ };
48
+ const isValidDate = ({ value, help, format = "MM/DD/AAA" }) => {
49
+ if (!help)
50
+ help = `Valid Date is required ${format}`;
51
+ return {
52
+ payload: help,
53
+ error: !(0, import_operators.validDate)(value)
54
+ };
55
+ };
56
+ module.exports = __toCommonJS(validations_exports);
57
+ //# sourceMappingURL=validations.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validations.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { checkNotEmpty, greaterThan, validDate } from './operators';\n\nexport const isRequired = ({ value, help = 'Field is Required' }) => ({\n payload: help,\n error: checkNotEmpty(value),\n});\n\nexport const isGreaterThan = ({ value, help, comparator = 0 }) => {\n if (!help) help = `Max value ${comparator}`;\n return {\n payload: help,\n error: greaterThan(value, comparator),\n };\n};\n\nexport const isValidDate = ({ value, help, format = 'MM/DD/AAA' }) => {\n if (!help) help = `Valid Date is required ${format}`;\n return {\n payload: help,\n error: !validDate(value),\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAsD;AAE/C,MAAM,aAAa,CAAC,EAAE,OAAO,OAAO,0BAA2B;AAAA,EACpE,SAAS;AAAA,EACT,OAAO,oCAAc;AAAA;AAGhB,MAAM,gBAAgB,CAAC,EAAE,OAAO,MAAM,aAAa,QAAQ;AAChE,MAAI,CAAC;AAAM,WAAO,aAAa;AAC/B,SAAO;AAAA,IACL,SAAS;AAAA,IACT,OAAO,kCAAY,OAAO;AAAA;AAAA;AAIvB,MAAM,cAAc,CAAC,EAAE,OAAO,MAAM,SAAS,kBAAkB;AACpE,MAAI,CAAC;AAAM,WAAO,0BAA0B;AAC5C,SAAO;AAAA,IACL,SAAS;AAAA,IACT,OAAO,CAAC,gCAAU;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
3
+ export {
4
+ capitalize
5
+ };
6
+ //# sourceMappingURL=capitalize.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/capitalize.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const capitalize = (string: string): string => string.charAt(0).toUpperCase() + string.slice(1);\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,aAAa,CAAC,WAA2B,OAAO,OAAO,GAAG,gBAAgB,OAAO,MAAM;",
6
+ "names": []
7
+ }
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ const compose = (...funcs) => {
3
+ if (funcs.length === 0) {
4
+ return (arg) => arg;
5
+ }
6
+ if (funcs.length === 1) {
7
+ return funcs[0];
8
+ }
9
+ return funcs.reduce((a, b) => (...args) => a(b(...args)));
10
+ };
11
+ var compose_default = compose;
12
+ export {
13
+ compose,
14
+ compose_default as default
15
+ };
16
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/compose.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function. [From redux v4.0.5]\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\n\nexport const compose = (...funcs) => {\n if (funcs.length === 0) {\n return (arg) => arg;\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce((a, b) => (...args) => a(b(...args)));\n};\n\nexport default compose;\n"],
5
+ "mappings": "AAAA;ACWO,MAAM,UAAU,IAAI,UAAU;AACnC,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,CAAC,QAAQ;AAAA;AAGlB,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,MAAM;AAAA;AAGf,SAAO,MAAM,OAAO,CAAC,GAAG,MAAM,IAAI,SAAS,EAAE,EAAE,GAAG;AAAA;AAGpD,IAAO,kBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ const getComponentFromProps = (Component, props, children = []) => {
4
+ if (!Component)
5
+ return null;
6
+ const componentChildren = Component.props ? Array.isArray(Component.props.children) ? Component.props.children : [Component.props.children] : null;
7
+ return typeof Component === "function" ? /* @__PURE__ */ React2.createElement(Component, {
8
+ ...props
9
+ }, children) : React2.cloneElement(Component, {
10
+ ...Component.props,
11
+ ...props
12
+ }, componentChildren ? [...componentChildren, ...children] : [...children]);
13
+ };
14
+ var getComponentFromProps_default = getComponentFromProps;
15
+ export {
16
+ getComponentFromProps_default as default,
17
+ getComponentFromProps
18
+ };
19
+ //# sourceMappingURL=getComponentFromProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/getComponentFromProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-nested-ternary */\nimport React from 'react';\n\nexport const getComponentFromProps = (Component, props, children = []) => {\n if (!Component) return null;\n const componentChildren = Component.props\n ? Array.isArray(Component.props.children)\n ? Component.props.children\n : [Component.props.children]\n : null;\n return typeof Component === 'function' ? (\n <Component {...props}>{children}</Component>\n ) : (\n React.cloneElement(\n Component,\n {\n ...Component.props,\n ...props,\n },\n componentChildren ? [...componentChildren, ...children] : [...children],\n )\n );\n};\n\nexport default getComponentFromProps;\n"],
5
+ "mappings": "AAAA;ACCA;AAEO,MAAM,wBAAwB,CAAC,WAAW,OAAO,WAAW,OAAO;AACxE,MAAI,CAAC;AAAW,WAAO;AACvB,QAAM,oBAAoB,UAAU,QAChC,MAAM,QAAQ,UAAU,MAAM,YAC5B,UAAU,MAAM,WAChB,CAAC,UAAU,MAAM,YACnB;AACJ,SAAO,OAAO,cAAc,aAC1B,qCAAC,WAAD;AAAA,OAAe;AAAA,KAAQ,YAEvB,OAAM,aACJ,WACA;AAAA,OACK,UAAU;AAAA,OACV;AAAA,KAEL,oBAAoB,CAAC,GAAG,mBAAmB,GAAG,YAAY,CAAC,GAAG;AAAA;AAKpE,IAAO,gCAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ import { default as default2 } from "use-measure";
3
+ import { default as default3 } from "use-force-update";
4
+ import { default as default4 } from "use-onclickoutside";
5
+ import { useUncontrolled } from "uncontrollable";
6
+ import { useExecutionTimer } from "./useExecutionTimer";
7
+ import { useExpandState } from "./useExpandState";
8
+ import { useHotkeys } from "./useHotkeys";
9
+ import { useHoverHandlersDelay } from "./useHoverHandlersDelay";
10
+ import { useResizeObserver } from "./useResizeObserver";
11
+ import { useShouldRecalculate } from "./useShouldRecalculate";
12
+ import { useWindowScrollerList } from "./useWindowScrollerList";
13
+ import { useWindowSize } from "./useWindowSize";
14
+ import { usePrevious } from "./usePrevious";
15
+ import { useCancellableDelayedCallback } from "./useCancellableDelayedCallback";
16
+ import { useDerivedStateFromProps } from "./useDerivedStateFromProps";
17
+ import { useSetRef } from "./useSetRef";
18
+ import { useParentElement } from "./useParentElement";
19
+ import { useOnElementResize } from "./useOnElementResize";
20
+ import { useIsShowingEllipsis } from "./useIsShowingEllipsis";
21
+ export {
22
+ useCancellableDelayedCallback,
23
+ useDerivedStateFromProps,
24
+ useExecutionTimer,
25
+ useExpandState,
26
+ default3 as useForceUpdate,
27
+ useHotkeys,
28
+ useHoverHandlersDelay,
29
+ useIsShowingEllipsis,
30
+ default2 as useMeasure,
31
+ default4 as useOnClickOutside,
32
+ useOnElementResize,
33
+ useParentElement,
34
+ usePrevious,
35
+ useResizeObserver,
36
+ useSetRef,
37
+ useShouldRecalculate,
38
+ useUncontrolled,
39
+ useWindowScrollerList,
40
+ useWindowSize
41
+ };
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default as useMeasure } from 'use-measure';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\nexport { useUncontrolled } from 'uncontrollable';\nexport { useExecutionTimer } from './useExecutionTimer';\nexport { useExpandState } from './useExpandState';\nexport { useHotkeys } from './useHotkeys';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay';\nexport { useResizeObserver } from './useResizeObserver';\nexport { useShouldRecalculate } from './useShouldRecalculate';\nexport { useWindowScrollerList } from './useWindowScrollerList';\nexport { useWindowSize } from './useWindowSize';\nexport { usePrevious } from './usePrevious';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps';\nexport { useSetRef } from './useSetRef';\nexport { useParentElement } from './useParentElement';\nexport { useOnElementResize } from './useOnElementResize';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import { useCallback, useRef } from "react";
3
+ const useCancellableDelayedCallback = (cb, delay) => {
4
+ const timeoutRef = useRef();
5
+ const cancel = useCallback(() => {
6
+ const timeoutId = timeoutRef.current;
7
+ if (timeoutId) {
8
+ timeoutRef.current = void 0;
9
+ clearTimeout(timeoutId);
10
+ }
11
+ }, [timeoutRef]);
12
+ const delayedCb = useCallback((...args) => {
13
+ timeoutRef.current = setTimeout(() => cb(...args), delay);
14
+ }, [cb, delay]);
15
+ return [delayedCb, cancel];
16
+ };
17
+ var useCancellableDelayedCallback_default = useCancellableDelayedCallback;
18
+ export {
19
+ useCancellableDelayedCallback_default as default,
20
+ useCancellableDelayedCallback
21
+ };
22
+ //# sourceMappingURL=useCancellableDelayedCallback.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useCancellableDelayedCallback.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useRef } from 'react';\n\nexport const useCancellableDelayedCallback = (cb, delay) => {\n const timeoutRef = useRef();\n const cancel = useCallback(() => {\n const timeoutId = timeoutRef.current;\n if (timeoutId) {\n timeoutRef.current = undefined;\n clearTimeout(timeoutId);\n }\n }, [timeoutRef]);\n const delayedCb = useCallback(\n (...args) => {\n timeoutRef.current = setTimeout(() => cb(...args), delay);\n },\n [cb, delay],\n );\n\n return [delayedCb, cancel];\n};\n\nexport default useCancellableDelayedCallback;\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,gCAAgC,CAAC,IAAI,UAAU;AAC1D,QAAM,aAAa;AACnB,QAAM,SAAS,YAAY,MAAM;AAC/B,UAAM,YAAY,WAAW;AAC7B,QAAI,WAAW;AACb,iBAAW,UAAU;AACrB,mBAAa;AAAA;AAAA,KAEd,CAAC;AACJ,QAAM,YAAY,YAChB,IAAI,SAAS;AACX,eAAW,UAAU,WAAW,MAAM,GAAG,GAAG,OAAO;AAAA,KAErD,CAAC,IAAI;AAGP,SAAO,CAAC,WAAW;AAAA;AAGrB,IAAO,wCAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
1
+ import * as React from "react";
2
+ import { useRef, useState } from "react";
3
+ import { isEqual, isFunction } from "../utils";
4
+ const defaultPropUpdateOnChange = (prop) => prop;
5
+ function defaultShouldUpdate({ prop, prevProp, stateValue }) {
6
+ return !isEqual(prop, prevProp) && !isEqual(prop, stateValue);
7
+ }
8
+ function setStateWithUpdate(onUpdate, setState) {
9
+ return (state) => {
10
+ setState((prevState) => onUpdate(isFunction(state) ? state(prevState) : state, prevState));
11
+ };
12
+ }
13
+ const useDerivedStateFromProps = (prop, options = {}) => {
14
+ const {
15
+ onUpdate = defaultPropUpdateOnChange,
16
+ shouldUpdate = defaultShouldUpdate,
17
+ updateOnStateChange = false
18
+ } = options;
19
+ const [stateValue, setState] = useState(onUpdate(prop, {}));
20
+ const handleSetState = updateOnStateChange ? setStateWithUpdate(onUpdate, setState) : setState;
21
+ const prevProp = useRef(prop);
22
+ if (shouldUpdate({
23
+ prop,
24
+ prevProp: prevProp.current,
25
+ stateValue
26
+ })) {
27
+ const nextProp = onUpdate(prop, prevProp.current);
28
+ setState(nextProp);
29
+ }
30
+ prevProp.current = prop;
31
+ return [stateValue, handleSetState];
32
+ };
33
+ var useDerivedStateFromProps_default = useDerivedStateFromProps;
34
+ export {
35
+ useDerivedStateFromProps_default as default,
36
+ useDerivedStateFromProps
37
+ };
38
+ //# sourceMappingURL=useDerivedStateFromProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useDerivedStateFromProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef, useState } from 'react';\nimport { isEqual, isFunction } from '../utils';\n\nconst defaultPropUpdateOnChange = prop => prop;\n\nfunction defaultShouldUpdate({ prop, prevProp, stateValue }) {\n return !isEqual(prop, prevProp) && !isEqual(prop, stateValue);\n}\n\nfunction setStateWithUpdate(onUpdate, setState) {\n return state => {\n setState(prevState =>\n onUpdate(isFunction(state) ? state(prevState) : state, prevState),\n );\n };\n}\n\nexport const useDerivedStateFromProps = (prop, options = {}) => {\n const {\n onUpdate = defaultPropUpdateOnChange,\n shouldUpdate = defaultShouldUpdate,\n updateOnStateChange = false,\n } = options;\n\n const [stateValue, setState] = useState(onUpdate(prop, {}));\n const handleSetState = updateOnStateChange\n ? setStateWithUpdate(onUpdate, setState)\n : setState;\n const prevProp = useRef(prop);\n\n if (\n shouldUpdate({\n prop,\n prevProp: prevProp.current,\n stateValue,\n })\n ) {\n const nextProp = onUpdate(prop, prevProp.current);\n setState(nextProp);\n }\n prevProp.current = prop;\n return [stateValue, handleSetState];\n};\n\nexport default useDerivedStateFromProps;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA,MAAM,4BAA4B,UAAQ;AAE1C,6BAA6B,EAAE,MAAM,UAAU,cAAc;AAC3D,SAAO,CAAC,QAAQ,MAAM,aAAa,CAAC,QAAQ,MAAM;AAAA;AAGpD,4BAA4B,UAAU,UAAU;AAC9C,SAAO,WAAS;AACd,aAAS,eACP,SAAS,WAAW,SAAS,MAAM,aAAa,OAAO;AAAA;AAAA;AAKtD,MAAM,2BAA2B,CAAC,MAAM,UAAU,OAAO;AAC9D,QAAM;AAAA,IACJ,WAAW;AAAA,IACX,eAAe;AAAA,IACf,sBAAsB;AAAA,MACpB;AAEJ,QAAM,CAAC,YAAY,YAAY,SAAS,SAAS,MAAM;AACvD,QAAM,iBAAiB,sBACnB,mBAAmB,UAAU,YAC7B;AACJ,QAAM,WAAW,OAAO;AAExB,MACE,aAAa;AAAA,IACX;AAAA,IACA,UAAU,SAAS;AAAA,IACnB;AAAA,MAEF;AACA,UAAM,WAAW,SAAS,MAAM,SAAS;AACzC,aAAS;AAAA;AAEX,WAAS,UAAU;AACnB,SAAO,CAAC,YAAY;AAAA;AAGtB,IAAO,mCAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ import { useRef } from "react";
3
+ const useExecutionTimer = (startFn, cleanFn, delayTime) => {
4
+ const startTimer = useRef();
5
+ const closeTimer = useRef();
6
+ const startFunction = (...args) => {
7
+ clearTimeout(closeTimer.current);
8
+ startTimer.current = setTimeout(() => startFn(...args), delayTime);
9
+ };
10
+ const cleanFunction = (...args) => {
11
+ clearTimeout(startTimer.current);
12
+ closeTimer.current = setTimeout(() => cleanFn(...args), 30);
13
+ };
14
+ return [startFunction, cleanFunction];
15
+ };
16
+ var useExecutionTimer_default = useExecutionTimer;
17
+ export {
18
+ useExecutionTimer_default as default,
19
+ useExecutionTimer
20
+ };
21
+ //# sourceMappingURL=useExecutionTimer.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useExecutionTimer.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef } from 'react';\n\nexport const useExecutionTimer = (startFn, cleanFn, delayTime) => {\n const startTimer = useRef();\n const closeTimer = useRef();\n\n const startFunction = (...args) => {\n clearTimeout(closeTimer.current);\n startTimer.current = setTimeout(() => startFn(...args), delayTime);\n };\n\n const cleanFunction = (...args) => {\n clearTimeout(startTimer.current);\n closeTimer.current = setTimeout(() => cleanFn(...args), 30);\n };\n return [startFunction, cleanFunction];\n};\n\nexport default useExecutionTimer;\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,oBAAoB,CAAC,SAAS,SAAS,cAAc;AAChE,QAAM,aAAa;AACnB,QAAM,aAAa;AAEnB,QAAM,gBAAgB,IAAI,SAAS;AACjC,iBAAa,WAAW;AACxB,eAAW,UAAU,WAAW,MAAM,QAAQ,GAAG,OAAO;AAAA;AAG1D,QAAM,gBAAgB,IAAI,SAAS;AACjC,iBAAa,WAAW;AACxB,eAAW,UAAU,WAAW,MAAM,QAAQ,GAAG,OAAO;AAAA;AAE1D,SAAO,CAAC,eAAe;AAAA;AAGzB,IAAO,4BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,91 @@
1
+ import * as React from "react";
2
+ import { useMemo } from "react";
3
+ import { isFunction } from "../utils";
4
+ import { useDerivedStateFromProps } from "./useDerivedStateFromProps";
5
+ const toggleStateInObject = (obj, key, value) => {
6
+ const nextObj = { ...obj };
7
+ if (nextObj[key]) {
8
+ delete nextObj[key];
9
+ } else {
10
+ nextObj[key] = value;
11
+ }
12
+ return nextObj;
13
+ };
14
+ const noop = () => null;
15
+ const useExpandState = ({
16
+ items = [],
17
+ itemKey = "id",
18
+ expanded: expandedProp = {},
19
+ onExpand,
20
+ onExpandChange = noop,
21
+ onExpandAll = noop,
22
+ onToggleExpand,
23
+ onCollapse
24
+ }) => {
25
+ const [expanded, setExpanded] = useDerivedStateFromProps(expandedProp);
26
+ const isExpandedAll = useMemo(() => Object.keys(expanded).length === items.length, [expanded, items]);
27
+ const toggleExpandAll = (stateData = true) => {
28
+ setExpanded(() => {
29
+ const nextState = {};
30
+ if (!isExpandedAll) {
31
+ items.forEach((item) => {
32
+ nextState[item[itemKey]] = stateData;
33
+ });
34
+ }
35
+ onExpandChange(nextState);
36
+ onExpandAll(nextState);
37
+ return nextState;
38
+ });
39
+ };
40
+ const expand = (item, stateData = true) => {
41
+ if (!item)
42
+ return;
43
+ if (isFunction(onExpand)) {
44
+ onExpand(item);
45
+ }
46
+ setExpanded((prevState) => {
47
+ const key = item[itemKey];
48
+ const nextState = { ...prevState, [key]: stateData };
49
+ onExpandChange(nextState, item);
50
+ return nextState;
51
+ });
52
+ };
53
+ const toggleExpand = (item, stateData = true) => {
54
+ if (isFunction(onToggleExpand)) {
55
+ onToggleExpand(item);
56
+ }
57
+ setExpanded((prevState) => {
58
+ const key = item[itemKey];
59
+ const nextState = toggleStateInObject(prevState, key, stateData);
60
+ onExpandChange(nextState, item);
61
+ return nextState;
62
+ });
63
+ };
64
+ const collapse = (item) => {
65
+ if (isFunction(onCollapse)) {
66
+ onCollapse(item);
67
+ }
68
+ setExpanded((prevState) => {
69
+ const nextState = { ...prevState };
70
+ delete nextState[item[itemKey]];
71
+ onExpandChange(nextState, item);
72
+ return nextState;
73
+ });
74
+ };
75
+ return {
76
+ state: { expanded, isExpandedAll },
77
+ actions: {
78
+ expand,
79
+ toggleExpandAll,
80
+ toggleExpand,
81
+ collapse
82
+ },
83
+ setExpanded
84
+ };
85
+ };
86
+ var useExpandState_default = useExpandState;
87
+ export {
88
+ useExpandState_default as default,
89
+ useExpandState
90
+ };
91
+ //# sourceMappingURL=useExpandState.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useExpandState.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { isFunction } from '../utils';\nimport { useDerivedStateFromProps } from './useDerivedStateFromProps';\n\nconst toggleStateInObject = (obj, key, value) => {\n const nextObj = { ...obj };\n if (nextObj[key]) {\n delete nextObj[key];\n } else {\n nextObj[key] = value;\n }\n return nextObj;\n};\n\nconst noop = () => null;\n\nexport const useExpandState = ({\n items = [],\n itemKey = 'id',\n expanded: expandedProp = {},\n onExpand,\n onExpandChange = noop,\n onExpandAll = noop,\n onToggleExpand,\n onCollapse,\n}) => {\n const [expanded, setExpanded] = useDerivedStateFromProps(expandedProp);\n\n const isExpandedAll = useMemo(\n () => Object.keys(expanded).length === items.length,\n [expanded, items],\n );\n\n const toggleExpandAll = (stateData = true) => {\n setExpanded(() => {\n const nextState = {};\n if (!isExpandedAll) {\n items.forEach(item => {\n nextState[item[itemKey]] = stateData;\n });\n }\n onExpandChange(nextState);\n onExpandAll(nextState);\n return nextState;\n });\n };\n\n const expand = (item, stateData = true) => {\n if (!item) return;\n if (isFunction(onExpand)) {\n onExpand(item);\n }\n setExpanded(prevState => {\n const key = item[itemKey];\n const nextState = { ...prevState, [key]: stateData };\n onExpandChange(nextState, item);\n return nextState;\n });\n };\n\n const toggleExpand = (item, stateData = true) => {\n if (isFunction(onToggleExpand)) {\n onToggleExpand(item);\n }\n setExpanded(prevState => {\n const key = item[itemKey];\n const nextState = toggleStateInObject(prevState, key, stateData);\n onExpandChange(nextState, item);\n return nextState;\n });\n };\n\n const collapse = item => {\n if (isFunction(onCollapse)) {\n onCollapse(item);\n }\n setExpanded(prevState => {\n const nextState = { ...prevState };\n delete nextState[item[itemKey]];\n onExpandChange(nextState, item);\n return nextState;\n });\n };\n\n return {\n state: { expanded, isExpandedAll },\n actions: {\n expand,\n toggleExpandAll,\n toggleExpand,\n collapse,\n },\n setExpanded,\n };\n};\n\nexport default useExpandState;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAEA,MAAM,sBAAsB,CAAC,KAAK,KAAK,UAAU;AAC/C,QAAM,UAAU,KAAK;AACrB,MAAI,QAAQ,MAAM;AAChB,WAAO,QAAQ;AAAA,SACV;AACL,YAAQ,OAAO;AAAA;AAEjB,SAAO;AAAA;AAGT,MAAM,OAAO,MAAM;AAEZ,MAAM,iBAAiB,CAAC;AAAA,EAC7B,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU,eAAe;AAAA,EACzB;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,MACI;AACJ,QAAM,CAAC,UAAU,eAAe,yBAAyB;AAEzD,QAAM,gBAAgB,QACpB,MAAM,OAAO,KAAK,UAAU,WAAW,MAAM,QAC7C,CAAC,UAAU;AAGb,QAAM,kBAAkB,CAAC,YAAY,SAAS;AAC5C,gBAAY,MAAM;AAChB,YAAM,YAAY;AAClB,UAAI,CAAC,eAAe;AAClB,cAAM,QAAQ,UAAQ;AACpB,oBAAU,KAAK,YAAY;AAAA;AAAA;AAG/B,qBAAe;AACf,kBAAY;AACZ,aAAO;AAAA;AAAA;AAIX,QAAM,SAAS,CAAC,MAAM,YAAY,SAAS;AACzC,QAAI,CAAC;AAAM;AACX,QAAI,WAAW,WAAW;AACxB,eAAS;AAAA;AAEX,gBAAY,eAAa;AACvB,YAAM,MAAM,KAAK;AACjB,YAAM,YAAY,KAAK,YAAY,MAAM;AACzC,qBAAe,WAAW;AAC1B,aAAO;AAAA;AAAA;AAIX,QAAM,eAAe,CAAC,MAAM,YAAY,SAAS;AAC/C,QAAI,WAAW,iBAAiB;AAC9B,qBAAe;AAAA;AAEjB,gBAAY,eAAa;AACvB,YAAM,MAAM,KAAK;AACjB,YAAM,YAAY,oBAAoB,WAAW,KAAK;AACtD,qBAAe,WAAW;AAC1B,aAAO;AAAA;AAAA;AAIX,QAAM,WAAW,UAAQ;AACvB,QAAI,WAAW,aAAa;AAC1B,iBAAW;AAAA;AAEb,gBAAY,eAAa;AACvB,YAAM,YAAY,KAAK;AACvB,aAAO,UAAU,KAAK;AACtB,qBAAe,WAAW;AAC1B,aAAO;AAAA;AAAA;AAIX,SAAO;AAAA,IACL,OAAO,EAAE,UAAU;AAAA,IACnB,SAAS;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA;AAAA;AAIJ,IAAO,yBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import hotkeys from "hotkeys-js";
3
+ import { useCallback, useEffect } from "react";
4
+ const useHotkeys = ({ keys, handler, options = {} }, deps = []) => {
5
+ const memoizedCallback = useCallback(handler, deps);
6
+ useEffect(() => {
7
+ hotkeys(keys, options, memoizedCallback);
8
+ return () => hotkeys.unbind(keys);
9
+ }, [memoizedCallback]);
10
+ };
11
+ var useHotkeys_default = useHotkeys;
12
+ export {
13
+ useHotkeys_default as default,
14
+ useHotkeys
15
+ };
16
+ //# sourceMappingURL=useHotkeys.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useHotkeys.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import hotkeys from 'hotkeys-js';\nimport { useCallback, useEffect } from 'react';\n\nexport const useHotkeys = ({ keys, handler, options = {} }, deps = []) => {\n const memoizedCallback = useCallback(handler, deps);\n\n useEffect(() => {\n hotkeys(keys, options, memoizedCallback);\n\n return () => hotkeys.unbind(keys);\n }, [memoizedCallback]);\n};\n\nexport default useHotkeys;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEO,MAAM,aAAa,CAAC,EAAE,MAAM,SAAS,UAAU,MAAM,OAAO,OAAO;AACxE,QAAM,mBAAmB,YAAY,SAAS;AAE9C,YAAU,MAAM;AACd,YAAQ,MAAM,SAAS;AAEvB,WAAO,MAAM,QAAQ,OAAO;AAAA,KAC3B,CAAC;AAAA;AAGN,IAAO,qBAAQ;",
6
+ "names": []
7
+ }
@@ -1,12 +1,11 @@
1
- import { useRef, useCallback } from 'react';
2
-
3
- function useHoverHandlersDelay(_ref) {
4
- let {
5
- onMouseOver,
6
- onMouseLeave,
7
- hideDelay = 300,
8
- showDelay = 300
9
- } = _ref;
1
+ import * as React from "react";
2
+ import { useCallback, useRef } from "react";
3
+ const useHoverHandlersDelay = ({
4
+ onMouseOver,
5
+ onMouseLeave,
6
+ hideDelay = 300,
7
+ showDelay = 300
8
+ }) => {
10
9
  const hideTimer = useRef();
11
10
  const showTimer = useRef();
12
11
  const delayedHide = useCallback(() => {
@@ -21,6 +20,10 @@ function useHoverHandlersDelay(_ref) {
21
20
  onMouseOver: delayedShow,
22
21
  onMouseLeave: delayedHide
23
22
  };
24
- }
25
-
26
- export { useHoverHandlersDelay as default };
23
+ };
24
+ var useHoverHandlersDelay_default = useHoverHandlersDelay;
25
+ export {
26
+ useHoverHandlersDelay_default as default,
27
+ useHoverHandlersDelay
28
+ };
29
+ //# sourceMappingURL=useHoverHandlersDelay.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useHoverHandlersDelay.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useRef } from 'react';\n\nexport const useHoverHandlersDelay = ({\n onMouseOver,\n onMouseLeave,\n hideDelay = 300,\n showDelay = 300,\n}) => {\n const hideTimer = useRef();\n const showTimer = useRef();\n\n const delayedHide = useCallback(() => {\n clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(onMouseLeave, hideDelay);\n }, []);\n\n const delayedShow = useCallback(() => {\n clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(onMouseOver, showDelay);\n }, []);\n\n return {\n onMouseOver: delayedShow,\n onMouseLeave: delayedHide,\n };\n};\n\nexport default useHoverHandlersDelay;\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,wBAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,MACR;AACJ,QAAM,YAAY;AAClB,QAAM,YAAY;AAElB,QAAM,cAAc,YAAY,MAAM;AACpC,iBAAa,UAAU;AACvB,cAAU,UAAU,WAAW,cAAc;AAAA,KAC5C;AAEH,QAAM,cAAc,YAAY,MAAM;AACpC,iBAAa,UAAU;AACvB,cAAU,UAAU,WAAW,aAAa;AAAA,KAC3C;AAEH,SAAO;AAAA,IACL,aAAa;AAAA,IACb,cAAc;AAAA;AAAA;AAIlB,IAAO,gCAAQ;",
6
+ "names": []
7
+ }