@elliemae/ds-utilities 2.0.0-alpha.8 → 2.0.0-next.11

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 (53) hide show
  1. package/cjs/compose.js +13 -2
  2. package/cjs/getComponentFromProps.js +8 -1
  3. package/cjs/hooks/index.js +31 -25
  4. package/cjs/hooks/useCancellableDelayedCallback.js +6 -1
  5. package/cjs/hooks/useDerivedStateFromProps.js +16 -6
  6. package/cjs/hooks/useExecutionTimer.js +11 -2
  7. package/cjs/hooks/useExpandState.js +30 -17
  8. package/cjs/hooks/useHotkeys.js +8 -5
  9. package/cjs/hooks/useHoverHandlersDelay.js +7 -6
  10. package/cjs/hooks/useOnElementResize.js +37 -0
  11. package/cjs/hooks/useParentElement.js +16 -0
  12. package/cjs/hooks/useResizeObserver.js +1 -0
  13. package/cjs/hooks/useSetRef.js +15 -0
  14. package/cjs/hooks/useWindowScrollerList.js +10 -8
  15. package/cjs/hooks/useWindowSize.js +1 -0
  16. package/cjs/index.js +234 -0
  17. package/cjs/operators.js +3 -0
  18. package/cjs/scrollingTimer.js +5 -1
  19. package/cjs/system.js +14 -2
  20. package/cjs/timeUtils.js +8 -0
  21. package/cjs/utils.js +37 -9
  22. package/cjs/validations.js +24 -19
  23. package/esm/compose.js +13 -2
  24. package/esm/getComponentFromProps.js +8 -1
  25. package/esm/hooks/index.js +11 -18
  26. package/esm/hooks/useCancellableDelayedCallback.js +6 -1
  27. package/esm/hooks/useDerivedStateFromProps.js +16 -6
  28. package/esm/hooks/useExecutionTimer.js +11 -2
  29. package/esm/hooks/useExpandState.js +27 -14
  30. package/esm/hooks/useHotkeys.js +8 -5
  31. package/esm/hooks/useHoverHandlersDelay.js +7 -6
  32. package/esm/hooks/useOnElementResize.js +33 -0
  33. package/esm/hooks/useParentElement.js +12 -0
  34. package/esm/hooks/useResizeObserver.js +1 -0
  35. package/esm/hooks/useSetRef.js +11 -0
  36. package/esm/hooks/useWindowScrollerList.js +10 -8
  37. package/esm/hooks/useWindowSize.js +1 -0
  38. package/esm/index.js +26 -0
  39. package/esm/operators.js +3 -0
  40. package/esm/scrollingTimer.js +5 -1
  41. package/esm/system.js +14 -2
  42. package/esm/timeUtils.js +8 -0
  43. package/esm/utils.js +37 -8
  44. package/esm/validations.js +24 -19
  45. package/package.json +13 -1
  46. package/types/hooks/index.d.ts +11 -3
  47. package/types/hooks/useOnElementResize.d.ts +2 -0
  48. package/types/hooks/useParentElement.d.ts +1 -0
  49. package/types/hooks/useSetRef.d.ts +2 -0
  50. package/types/index.d.ts +8 -0
  51. package/types/utils.d.ts +1 -2
  52. package/cjs/package.json +0 -7
  53. package/esm/package.json +0 -7
@@ -1,6 +1,14 @@
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
1
3
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
4
+ import 'core-js/modules/web.dom-collections.iterator.js';
5
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
6
+ import 'core-js/modules/esnext.iterator.constructor.js';
7
+ import 'core-js/modules/esnext.iterator.for-each.js';
2
8
  import { useMemo } from 'react';
3
- import { isFunction } from '@elliemae/ds-utilities/utils';
9
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
10
+ import 'core-js/modules/esnext.iterator.reduce.js';
11
+ import { isFunction } from 'lodash';
4
12
  import useDerivedStateFromProp from './useDerivedStateFromProps.js';
5
13
 
6
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -21,20 +29,22 @@ const toggleStateInObject = (obj, key, value) => {
21
29
 
22
30
  const noop = () => null;
23
31
 
24
- function useExpandState({
25
- items = [],
26
- itemKey = 'id',
27
- expanded: expandedProp = {},
28
- onExpand,
29
- onExpandChange = noop,
30
- onExpandAll = noop,
31
- onToggleExpand,
32
- onCollapse
33
- }) {
32
+ function useExpandState(_ref) {
33
+ let {
34
+ items = [],
35
+ itemKey = 'id',
36
+ expanded: expandedProp = {},
37
+ onExpand,
38
+ onExpandChange = noop,
39
+ onExpandAll = noop,
40
+ onToggleExpand,
41
+ onCollapse
42
+ } = _ref;
34
43
  const [expanded, setExpanded] = useDerivedStateFromProp(expandedProp);
35
44
  const isExpandedAll = useMemo(() => Object.keys(expanded).length === items.length, [expanded, items]);
36
45
 
37
- const toggleExpandAll = (stateData = true) => {
46
+ const toggleExpandAll = function () {
47
+ let stateData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
38
48
  setExpanded(() => {
39
49
  const nextState = {};
40
50
 
@@ -50,7 +60,8 @@ function useExpandState({
50
60
  });
51
61
  };
52
62
 
53
- const expand = (item, stateData = true) => {
63
+ const expand = function (item) {
64
+ let stateData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
54
65
  if (!item) return;
55
66
 
56
67
  if (isFunction(onExpand)) {
@@ -69,7 +80,9 @@ function useExpandState({
69
80
  });
70
81
  };
71
82
 
72
- const toggleExpand = (item, stateData = true) => {
83
+ const toggleExpand = function (item) {
84
+ let stateData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
85
+
73
86
  if (isFunction(onToggleExpand)) {
74
87
  onToggleExpand(item);
75
88
  }
@@ -1,11 +1,14 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
1
2
  import hotkeys from 'hotkeys-js';
2
3
  import { useCallback, useEffect } from 'react';
3
4
 
4
- function useHotkeys({
5
- keys,
6
- handler,
7
- options = {}
8
- }, deps = []) {
5
+ function useHotkeys(_ref) {
6
+ let {
7
+ keys,
8
+ handler,
9
+ options = {}
10
+ } = _ref;
11
+ let deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
9
12
  const memoizedCallback = useCallback(handler, deps);
10
13
  useEffect(() => {
11
14
  hotkeys(keys, options, memoizedCallback);
@@ -1,11 +1,12 @@
1
1
  import { useRef, useCallback } from 'react';
2
2
 
3
- function useHoverHandlersDelay({
4
- onMouseOver,
5
- onMouseLeave,
6
- hideDelay = 300,
7
- showDelay = 300
8
- }) {
3
+ function useHoverHandlersDelay(_ref) {
4
+ let {
5
+ onMouseOver,
6
+ onMouseLeave,
7
+ hideDelay = 300,
8
+ showDelay = 300
9
+ } = _ref;
9
10
  const hideTimer = useRef();
10
11
  const showTimer = useRef();
11
12
  const delayedHide = useCallback(() => {
@@ -0,0 +1,33 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import { useState, useRef, useEffect, useMemo } from 'react';
3
+
4
+ // Taken and modified from https://stackoverflow.com/a/60218754
5
+
6
+ const useOnElementResize = targetRef => {
7
+ var _targetRef$current, _targetRef$current2;
8
+
9
+ const [width, setWidth] = useState(targetRef.current ? (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.offsetWidth : 0);
10
+ const [height, setHeight] = useState(targetRef.current ? (_targetRef$current2 = targetRef.current) === null || _targetRef$current2 === void 0 ? void 0 : _targetRef$current2.offsetWidth : 0);
11
+ const observer = useRef(null);
12
+ useEffect(() => {
13
+ function outputsize() {
14
+ var _targetRef$current3, _targetRef$current4;
15
+
16
+ setWidth((_targetRef$current3 = targetRef.current) === null || _targetRef$current3 === void 0 ? void 0 : _targetRef$current3.offsetWidth);
17
+ setHeight((_targetRef$current4 = targetRef.current) === null || _targetRef$current4 === void 0 ? void 0 : _targetRef$current4.offsetHeight);
18
+ }
19
+
20
+ observer.current = new ResizeObserver(outputsize).observe(targetRef.current);
21
+ return () => {
22
+ var _observer$current;
23
+
24
+ (_observer$current = observer.current) === null || _observer$current === void 0 ? void 0 : _observer$current.disconnect();
25
+ };
26
+ }, [targetRef]);
27
+ return useMemo(() => ({
28
+ width,
29
+ height
30
+ }), [width, height]);
31
+ };
32
+
33
+ export { useOnElementResize };
@@ -0,0 +1,12 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import { useState, useEffect } from 'react';
3
+
4
+ const useParentElement = ref => {
5
+ const [parent, setParent] = useState(ref.current);
6
+ useEffect(() => {
7
+ if (ref.current) setParent(ref.current.parentNode);
8
+ });
9
+ return parent;
10
+ };
11
+
12
+ export { useParentElement };
@@ -1,3 +1,4 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
1
2
  import { useState, useEffect } from 'react';
2
3
  import raf from 'raf';
3
4
  import ResizeObserver from 'resize-observer-polyfill';
@@ -0,0 +1,11 @@
1
+ import { useRef, useCallback } from 'react';
2
+
3
+ const useSetRef = initial => {
4
+ const ref = useRef(initial);
5
+ const setRef = useCallback(node => {
6
+ ref.current = node;
7
+ }, []);
8
+ return [ref, setRef];
9
+ };
10
+
11
+ export { useSetRef };
@@ -1,9 +1,10 @@
1
1
  import { useRef, useEffect } from 'react';
2
2
 
3
- function getScrollOffset(element = {
4
- scrollTop: 0,
5
- scrollLeft: 0
6
- }) {
3
+ function getScrollOffset() {
4
+ let element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
5
+ scrollTop: 0,
6
+ scrollLeft: 0
7
+ };
7
8
  return {
8
9
  top: element.scrollTop,
9
10
  left: element.scrollLeft
@@ -24,10 +25,11 @@ function isParent(parentNode, childNode) {
24
25
  return childNode.parentNode === parentNode || childNode.parentNode && isParent(parentNode, childNode.parentNode);
25
26
  }
26
27
 
27
- function useWindowScrollerList({
28
- listInstance,
29
- outerListRef
30
- }) {
28
+ function useWindowScrollerList(_ref) {
29
+ let {
30
+ listInstance,
31
+ outerListRef
32
+ } = _ref;
31
33
  const scrollableParent = useRef();
32
34
  const listOffset = useRef();
33
35
 
@@ -1,3 +1,4 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
1
2
  import { useState, useLayoutEffect } from 'react';
2
3
 
3
4
  function useWindowSize() {
package/esm/index.js CHANGED
@@ -1,4 +1,30 @@
1
1
  export { default as getComponentFromProps } from './getComponentFromProps.js';
2
2
  export { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements.js';
3
3
  export { checkEmpty, checkNotEmpty, contains, equal, greaterThan, greaterThanOrEquals, isIn, isNotIn, isNotNull, isNull, lessThanOrEquals, notEqual, startsWith, validDate } from './operators.js';
4
+ export { addOrRemove, arrayMove, cx, hashArray, removeUndefinedProperties, runAll, safeCall, toggleInArray, toggleInObject } from './utils.js';
4
5
  export { logger, mergeRefs, setRef } from './system.js';
6
+ export { default as useMeasure } from 'use-measure';
7
+ export { default as useExecutionTimer } from './hooks/useExecutionTimer.js';
8
+ export { default as useExpandState } from './hooks/useExpandState.js';
9
+ export { default as useHotkeys } from './hooks/useHotkeys.js';
10
+ export { default as useHoverHandlersDelay } from './hooks/useHoverHandlersDelay.js';
11
+ export { default as useResizeObserver } from './hooks/useResizeObserver.js';
12
+ export { default as useShouldRecalculate } from './hooks/useShouldRecalculate.js';
13
+ export { default as useWindowScrollerList } from './hooks/useWindowScrollerList.js';
14
+ export { default as useWindowSize } from './hooks/useWindowSize.js';
15
+ export { default as useForceUpdate } from 'use-force-update';
16
+ export { default as useOnClickOutside } from 'use-onclickoutside';
17
+ export { useUncontrolled } from 'uncontrollable';
18
+ export { default as usePrevious } from './hooks/usePrevious.js';
19
+ export { default as useCancellableDelayedCallback } from './hooks/useCancellableDelayedCallback.js';
20
+ export { default as useDerivedStateFromProps } from './hooks/useDerivedStateFromProps.js';
21
+ export { useSetRef } from './hooks/useSetRef.js';
22
+ export { useParentElement } from './hooks/useParentElement.js';
23
+ export { useOnElementResize } from './hooks/useOnElementResize.js';
24
+ export { addLeadingZeros, getVisibleTimeByFormat } from './timeUtils.js';
25
+ export { compose } from './compose.js';
26
+ export { DOCUMENT, WINDOW } from './platform.js';
27
+ export { isClassComponent, isCompositeTypeElement, isDOMTypeElement, isElement, isFunctionComponent, isReactComponent } from './reactTypesUtility.js';
28
+ export { resetTimer } from './scrollingTimer.js';
29
+ export { isGreaterThan, isRequired, isValidDate } from './validations.js';
30
+ 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';
package/esm/operators.js CHANGED
@@ -1,3 +1,6 @@
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import 'core-js/modules/esnext.async-iterator.map.js';
3
+ import 'core-js/modules/esnext.iterator.map.js';
1
4
  import { isEmpty } from 'lodash';
2
5
 
3
6
  /**
@@ -1,6 +1,10 @@
1
1
  function resetTimer(func) {
2
2
  let timeout;
3
- return function (...args) {
3
+ return function () {
4
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5
+ args[_key] = arguments[_key];
6
+ }
7
+
4
8
  const context = this;
5
9
 
6
10
  const lastCall = () => {
package/esm/system.js CHANGED
@@ -1,4 +1,12 @@
1
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.for-each.js';
4
+ import 'core-js/modules/esnext.async-iterator.filter.js';
5
+ import 'core-js/modules/esnext.iterator.filter.js';
1
6
  import '@babel/runtime/helpers/esm/defineProperty';
7
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
8
+ import 'core-js/modules/esnext.iterator.reduce.js';
9
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
10
  import { isFunction } from 'lodash';
3
11
 
4
12
  const setRef = (ref, value) => {
@@ -8,7 +16,11 @@ const setRef = (ref, value) => {
8
16
  ref.current = value;
9
17
  }
10
18
  };
11
- function mergeRefs(...refs) {
19
+ function mergeRefs() {
20
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
21
+ refs[_key] = arguments[_key];
22
+ }
23
+
12
24
  return node => {
13
25
  if (!node) return;
14
26
  refs.forEach(ref => {
@@ -20,6 +32,6 @@ function mergeRefs(...refs) {
20
32
  });
21
33
  };
22
34
  }
23
- function logger(...args) {}
35
+ function logger() {}
24
36
 
25
37
  export { logger, mergeRefs, setRef };
package/esm/timeUtils.js CHANGED
@@ -1,4 +1,12 @@
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
1
3
  import '@babel/runtime/helpers/esm/defineProperty';
4
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
5
+ import 'core-js/modules/esnext.iterator.constructor.js';
6
+ import 'core-js/modules/esnext.iterator.reduce.js';
7
+ import 'core-js/modules/web.dom-collections.iterator.js';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
9
+ import 'core-js/modules/esnext.iterator.for-each.js';
2
10
  import { padStart } from 'lodash';
3
11
 
4
12
  const getVisibleTimeByFormat = format => ({
package/esm/utils.js CHANGED
@@ -1,7 +1,14 @@
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
1
3
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
4
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
5
+ import 'core-js/modules/esnext.iterator.constructor.js';
6
+ import 'core-js/modules/esnext.iterator.reduce.js';
7
+ import 'core-js/modules/web.dom-collections.iterator.js';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
9
+ import 'core-js/modules/esnext.iterator.for-each.js';
2
10
  import { omit, cloneDeep, isFunction } from 'lodash';
3
11
  export { cloneDeep, curry, debounce, differenceBy, differenceWith, filter, findIndex, get, groupBy, isBoolean, isEmpty, isEqual, isEqualWith, isFunction, isNaN, isObject, isString, maxBy, meanBy, noop, omit, orderBy, padStart, parseInt, pick, pickBy, property, pull, range, set, sortBy, sumBy, throttle, transform, uniq, uniqBy, values } from 'lodash';
4
- export { compose } from './compose.js';
5
12
 
6
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
14
 
@@ -12,7 +19,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
19
  * @param {...any} classnames
13
20
  */
14
21
 
15
- const cx = (...classnames) => classnames.reduce((result, cn) => `${result} ${cn || ''}`, ''); // if entry exists, remove it, if not, add it
22
+ const cx = function () {
23
+ for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
24
+ classnames[_key] = arguments[_key];
25
+ }
26
+
27
+ return classnames.reduce((result, cn) => "".concat(result, " ").concat(cn || ''), '');
28
+ }; // if entry exists, remove it, if not, add it
16
29
 
17
30
  const toggleInObject = (obj, key, value) => obj[key] !== undefined ? omit(obj, [key]) : _objectSpread(_objectSpread({}, obj), {}, {
18
31
  [key]: value
@@ -32,7 +45,8 @@ const arrayMove = (array, from, to) => {
32
45
 
33
46
  const accessorDefault = item => item;
34
47
 
35
- const addOrRemove = (array, item, accessor = accessorDefault) => {
48
+ const addOrRemove = function (array, item) {
49
+ let accessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : accessorDefault;
36
50
  const index = array.findIndex(iItem => accessor(iItem) === accessor(item));
37
51
 
38
52
  if (index !== -1) {
@@ -44,18 +58,33 @@ const addOrRemove = (array, item, accessor = accessorDefault) => {
44
58
  return [...array, item];
45
59
  };
46
60
 
47
- function runAll(...fns) {
48
- return (...args) => fns.forEach(fn => {
49
- if (isFunction(fn)) fn(...args);
50
- });
61
+ function runAll() {
62
+ for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
63
+ fns[_key2] = arguments[_key2];
64
+ }
65
+
66
+ return function () {
67
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
68
+ args[_key3] = arguments[_key3];
69
+ }
70
+
71
+ return fns.forEach(fn => {
72
+ if (Array.isArray(fn)) runAll(fn);
73
+ if (isFunction(fn)) fn(...args);
74
+ });
75
+ };
51
76
  }
52
77
  function hashArray(arr, fieldName) {
53
78
  return arr.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
54
79
  [fieldName ? item[fieldName] : item]: true
55
80
  }), {});
56
81
  }
57
- function safeCall(fun, ...args) {
82
+ function safeCall(fun) {
58
83
  if (isFunction(fun)) {
84
+ for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
85
+ args[_key4 - 1] = arguments[_key4];
86
+ }
87
+
59
88
  fun(...args);
60
89
  }
61
90
  }
@@ -1,29 +1,34 @@
1
1
  import { checkNotEmpty, greaterThan, validDate } from './operators.js';
2
2
 
3
- const isRequired = ({
4
- value,
5
- help = 'Field is Required'
6
- }) => ({
7
- payload: help,
8
- error: checkNotEmpty(value)
9
- });
10
- const isGreaterThan = ({
11
- value,
12
- help,
13
- comparator = 0
14
- }) => {
15
- if (!help) help = `Max value ${comparator}`;
3
+ const isRequired = _ref => {
4
+ let {
5
+ value,
6
+ help = 'Field is Required'
7
+ } = _ref;
8
+ return {
9
+ payload: help,
10
+ error: checkNotEmpty(value)
11
+ };
12
+ };
13
+ const isGreaterThan = _ref2 => {
14
+ let {
15
+ value,
16
+ help,
17
+ comparator = 0
18
+ } = _ref2;
19
+ if (!help) help = "Max value ".concat(comparator);
16
20
  return {
17
21
  payload: help,
18
22
  error: greaterThan(value, comparator)
19
23
  };
20
24
  };
21
- const isValidDate = ({
22
- value,
23
- help,
24
- format = 'MM/DD/AAA'
25
- }) => {
26
- if (!help) help = `Valid Date is required ${format}`;
25
+ const isValidDate = _ref3 => {
26
+ let {
27
+ value,
28
+ help,
29
+ format = 'MM/DD/AAA'
30
+ } = _ref3;
31
+ if (!help) help = "Valid Date is required ".concat(format);
27
32
  return {
28
33
  payload: help,
29
34
  error: !validDate(value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-utilities",
3
- "version": "2.0.0-alpha.8",
3
+ "version": "2.0.0-next.11",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Utilities",
6
6
  "module": "./esm/index.js",
@@ -59,6 +59,10 @@
59
59
  "import": "./esm/hooks/useShouldRecalculate.js",
60
60
  "require": "./cjs/hooks/useShouldRecalculate.js"
61
61
  },
62
+ "./hooks/useSetRef": {
63
+ "import": "./esm/hooks/useSetRef.js",
64
+ "require": "./cjs/hooks/useSetRef.js"
65
+ },
62
66
  "./hooks/useResizeObserver": {
63
67
  "import": "./esm/hooks/useResizeObserver.js",
64
68
  "require": "./cjs/hooks/useResizeObserver.js"
@@ -67,6 +71,14 @@
67
71
  "import": "./esm/hooks/usePrevious.js",
68
72
  "require": "./cjs/hooks/usePrevious.js"
69
73
  },
74
+ "./hooks/useParentElement": {
75
+ "import": "./esm/hooks/useParentElement.js",
76
+ "require": "./cjs/hooks/useParentElement.js"
77
+ },
78
+ "./hooks/useOnElementResize": {
79
+ "import": "./esm/hooks/useOnElementResize.js",
80
+ "require": "./cjs/hooks/useOnElementResize.js"
81
+ },
70
82
  "./hooks/useHoverHandlersDelay": {
71
83
  "import": "./esm/hooks/useHoverHandlersDelay.js",
72
84
  "require": "./cjs/hooks/useHoverHandlersDelay.js"
@@ -1,10 +1,18 @@
1
- /// <reference types="react" />
2
1
  export { default as useMeasure } from 'use-measure';
3
2
  export { default as useExecutionTimer } from './useExecutionTimer';
3
+ export { default as useExpandState } from './useExpandState';
4
+ export { default as useHotkeys } from './useHotkeys';
5
+ export { default as useHoverHandlersDelay } from './useHoverHandlersDelay';
6
+ export { default as useResizeObserver } from './useResizeObserver';
7
+ export { default as useShouldRecalculate } from './useShouldRecalculate';
8
+ export { default as useWindowScrollerList } from './useWindowScrollerList';
9
+ export { default as useWindowSize } from './useWindowSize';
4
10
  export { default as useForceUpdate } from 'use-force-update';
5
11
  export { default as useOnClickOutside } from 'use-onclickoutside';
6
12
  export { useUncontrolled } from 'uncontrollable';
7
13
  export { default as usePrevious } from './usePrevious';
8
14
  export { default as useCancellableDelayedCallback } from './useCancellableDelayedCallback';
9
- export declare function useParentElement(ref: any): any;
10
- export declare function useSetRef(initial: any): (import("react").MutableRefObject<any> | ((node: any) => void))[];
15
+ export { default as useDerivedStateFromProps } from './useDerivedStateFromProps';
16
+ export * from './useSetRef';
17
+ export * from './useParentElement';
18
+ export * from './useOnElementResize';
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const useOnElementResize: (targetRef: React.RefObject<HTMLDivElement>) => Record<'width' | 'height', number>;
@@ -0,0 +1 @@
1
+ export declare const useParentElement: (ref: any) => any;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const useSetRef: (initial: any) => (import("react").MutableRefObject<any> | ((node: any) => void))[];
package/types/index.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  export { default as getComponentFromProps } from './getComponentFromProps';
2
2
  export { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';
3
3
  export * from './operators';
4
+ export * from './utils';
4
5
  export * from './system';
6
+ export * from './hooks';
7
+ export * from './timeUtils';
8
+ export * from './compose';
9
+ export * from './platform';
10
+ export * from './reactTypesUtility';
11
+ export * from './scrollingTimer';
12
+ export * from './validations';
package/types/utils.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  * it if desired, while keeping function names the same
5
5
  */
6
6
  import { cloneDeep, filter, debounce, findIndex, isEmpty, isString, isEqual, noop, omit, orderBy, pull, sumBy, maxBy, meanBy, sortBy, transform, isFunction, uniq, uniqBy, groupBy, property, get, set, range, parseInt, padStart, isNaN, values, throttle, pick, pickBy, differenceBy, differenceWith, isEqualWith, curry, isObject, isBoolean } from 'lodash';
7
- import { compose } from './compose';
8
7
  /**
9
8
  * Concatenates classNames from arguments
10
9
  *
@@ -21,4 +20,4 @@ export declare function safeCall(fun: any, ...args: any[]): void;
21
20
  export declare const removeUndefinedProperties: (obj: any) => any;
22
21
  declare const _default: {};
23
22
  export default _default;
24
- export { 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, compose, isEqualWith, isBoolean, };
23
+ export { 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, };
package/cjs/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "commonjs",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }
package/esm/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }