@elliemae/ds-utilities 1.56.1 → 1.57.0-rc.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.
@@ -2,70 +2,76 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
- var React = require('react');
7
5
  var useMeasure = require('use-measure');
8
6
  var hooks_useExecutionTimer = require('./useExecutionTimer.js');
7
+ var hooks_useExpandState = require('./useExpandState.js');
8
+ var hooks_useHotkeys = require('./useHotkeys.js');
9
+ var hooks_useHoverHandlersDelay = require('./useHoverHandlersDelay.js');
10
+ var hooks_useResizeObserver = require('./useResizeObserver.js');
11
+ var hooks_useShouldRecalculate = require('./useShouldRecalculate.js');
12
+ var hooks_useWindowScrollerList = require('./useWindowScrollerList.js');
13
+ var hooks_useWindowSize = require('./useWindowSize.js');
9
14
  var useForceUpdate = require('use-force-update');
10
15
  var useOnclickoutside = require('use-onclickoutside');
11
16
  var hook = require('uncontrollable/hook');
12
17
  var hooks_usePrevious = require('./usePrevious.js');
13
18
  var hooks_useCancellableDelayedCallback = require('./useCancellableDelayedCallback.js');
19
+ var hooks_useDerivedStateFromProps = require('./useDerivedStateFromProps.js');
20
+ var hooks_useSetRef = require('./useSetRef.js');
21
+ var hooks_useParentElement = require('./useParentElement.js');
22
+ require('react');
23
+ require('@babel/runtime/helpers/slicedToArray');
24
+ require('@babel/runtime/helpers/defineProperty');
25
+ require('@babel/runtime/helpers/toConsumableArray');
26
+ require('lodash');
27
+ require('hotkeys-js');
28
+ require('raf');
29
+ require('resize-observer-polyfill');
14
30
 
15
31
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
32
 
17
- var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
18
33
  var useMeasure__default = /*#__PURE__*/_interopDefaultLegacy(useMeasure);
19
34
  var useForceUpdate__default = /*#__PURE__*/_interopDefaultLegacy(useForceUpdate);
20
35
  var useOnclickoutside__default = /*#__PURE__*/_interopDefaultLegacy(useOnclickoutside);
21
36
  var hook__default = /*#__PURE__*/_interopDefaultLegacy(hook);
22
37
 
23
- function useParentElement(ref) {
24
- var _useState = React.useState(ref.current),
25
- _useState2 = _slicedToArray__default['default'](_useState, 2),
26
- parent = _useState2[0],
27
- setParent = _useState2[1];
28
38
 
29
- React.useEffect(function () {
30
- if (ref.current) setParent(ref.current.parentNode);
31
- });
32
- return parent;
33
- }
34
- function useSetRef(initial) {
35
- var ref = React.useRef(initial);
36
- var setRef = React.useCallback(function (node) {
37
- ref.current = node;
38
- }, []);
39
- return [ref, setRef];
40
- }
41
39
 
42
40
  Object.defineProperty(exports, 'useMeasure', {
43
- enumerable: true,
44
- get: function () {
45
- return useMeasure__default['default'];
46
- }
41
+ enumerable: true,
42
+ get: function () {
43
+ return useMeasure__default['default'];
44
+ }
47
45
  });
48
46
  exports.useExecutionTimer = hooks_useExecutionTimer;
47
+ exports.useExpandState = hooks_useExpandState;
48
+ exports.useHotkeys = hooks_useHotkeys;
49
+ exports.useHoverHandlersDelay = hooks_useHoverHandlersDelay;
50
+ exports.useResizeObserver = hooks_useResizeObserver;
51
+ exports.useShouldRecalculate = hooks_useShouldRecalculate;
52
+ exports.useWindowScrollerList = hooks_useWindowScrollerList;
53
+ exports.useWindowSize = hooks_useWindowSize;
49
54
  Object.defineProperty(exports, 'useForceUpdate', {
50
- enumerable: true,
51
- get: function () {
52
- return useForceUpdate__default['default'];
53
- }
55
+ enumerable: true,
56
+ get: function () {
57
+ return useForceUpdate__default['default'];
58
+ }
54
59
  });
55
60
  Object.defineProperty(exports, 'useOnClickOutside', {
56
- enumerable: true,
57
- get: function () {
58
- return useOnclickoutside__default['default'];
59
- }
61
+ enumerable: true,
62
+ get: function () {
63
+ return useOnclickoutside__default['default'];
64
+ }
60
65
  });
61
66
  Object.defineProperty(exports, 'useUncontrolled', {
62
- enumerable: true,
63
- get: function () {
64
- return hook__default['default'];
65
- }
67
+ enumerable: true,
68
+ get: function () {
69
+ return hook__default['default'];
70
+ }
66
71
  });
67
72
  exports.usePrevious = hooks_usePrevious;
68
73
  exports.useCancellableDelayedCallback = hooks_useCancellableDelayedCallback;
69
- exports.useParentElement = useParentElement;
70
- exports.useSetRef = useSetRef;
74
+ exports.useDerivedStateFromProps = hooks_useDerivedStateFromProps;
75
+ exports.useSetRef = hooks_useSetRef.useSetRef;
76
+ exports.useParentElement = hooks_useParentElement.useParentElement;
71
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/hooks/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport { default as useMeasure } from 'use-measure';\nexport { default as useExecutionTimer } from './useExecutionTimer';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\nexport { default as useUncontrolled } from 'uncontrollable/hook';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useCancellableDelayedCallback } from './useCancellableDelayedCallback';\n\nexport function useParentElement(ref) {\n const [parent, setParent] = useState(ref.current);\n useEffect(() => {\n if (ref.current) setParent(ref.current.parentNode);\n });\n return parent;\n}\n\nexport function useSetRef(initial) {\n const ref = useRef(initial);\n const setRef = useCallback((node) => {\n ref.current = node;\n }, []);\n return [ref, setRef];\n}\n"],"names":["useParentElement","ref","useState","current","parent","setParent","useEffect","parentNode","useSetRef","initial","useRef","setRef","useCallback","node"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAUO,SAASA,gBAAT,CAA0BC,GAA1B,EAA+B;AACpC,kBAA4BC,cAAQ,CAACD,GAAG,CAACE,OAAL,CAApC;AAAA;AAAA,MAAOC,MAAP;AAAA,MAAeC,SAAf;;AACAC,EAAAA,eAAS,CAAC,YAAM;AACd,QAAIL,GAAG,CAACE,OAAR,EAAiBE,SAAS,CAACJ,GAAG,CAACE,OAAJ,CAAYI,UAAb,CAAT;AAClB,GAFQ,CAAT;AAGA,SAAOH,MAAP;AACD;AAEM,SAASI,SAAT,CAAmBC,OAAnB,EAA4B;AACjC,MAAMR,GAAG,GAAGS,YAAM,CAACD,OAAD,CAAlB;AACA,MAAME,MAAM,GAAGC,iBAAW,CAAC,UAACC,IAAD,EAAU;AACnCZ,IAAAA,GAAG,CAACE,OAAJ,GAAcU,IAAd;AACD,GAFyB,EAEvB,EAFuB,CAA1B;AAGA,SAAO,CAACZ,GAAD,EAAMU,MAAN,CAAP;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
+ var React = require('react');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
11
+
12
+ var useParentElement = function useParentElement(ref) {
13
+ var _useState = React.useState(ref.current),
14
+ _useState2 = _slicedToArray__default['default'](_useState, 2),
15
+ parent = _useState2[0],
16
+ setParent = _useState2[1];
17
+
18
+ React.useEffect(function () {
19
+ if (ref.current) setParent(ref.current.parentNode);
20
+ });
21
+ return parent;
22
+ };
23
+
24
+ exports.useParentElement = useParentElement;
25
+ //# sourceMappingURL=useParentElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParentElement.js","sources":["../../../src/hooks/useParentElement.tsx"],"sourcesContent":["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"],"names":["useParentElement","ref","useState","current","parent","setParent","useEffect","parentNode"],"mappings":";;;;;;;;;;;IAEaA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,GAAD,EAAS;AACvC,kBAA4BC,cAAQ,CAACD,GAAG,CAACE,OAAL,CAApC;AAAA;AAAA,MAAOC,MAAP;AAAA,MAAeC,SAAf;;AAEAC,EAAAA,eAAS,CAAC,YAAM;AACd,QAAIL,GAAG,CAACE,OAAR,EAAiBE,SAAS,CAACJ,GAAG,CAACE,OAAJ,CAAYI,UAAb,CAAT;AAClB,GAFQ,CAAT;AAGA,SAAOH,MAAP;AACD;;;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ var useSetRef = function useSetRef(initial) {
8
+ var ref = React.useRef(initial);
9
+ var setRef = React.useCallback(function (node) {
10
+ ref.current = node;
11
+ }, []);
12
+ return [ref, setRef];
13
+ };
14
+
15
+ exports.useSetRef = useSetRef;
16
+ //# sourceMappingURL=useSetRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSetRef.js","sources":["../../../src/hooks/useSetRef.tsx"],"sourcesContent":["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"],"names":["useSetRef","initial","ref","useRef","setRef","useCallback","node","current"],"mappings":";;;;;;IAEaA,SAAS,GAAG,SAAZA,SAAY,CAACC,OAAD,EAAa;AACpC,MAAMC,GAAG,GAAGC,YAAM,CAACF,OAAD,CAAlB;AACA,MAAMG,MAAM,GAAGC,iBAAW,CAAC,UAACC,IAAD,EAAU;AACnCJ,IAAAA,GAAG,CAACK,OAAJ,GAAcD,IAAd;AACD,GAFyB,EAEvB,EAFuB,CAA1B;AAGA,SAAO,CAACJ,GAAD,EAAME,MAAN,CAAP;AACD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useWindowSize.js","sources":["../../../src/hooks/useWindowSize.tsx"],"sourcesContent":["import React, { useLayoutEffect, useState } from 'react';\n\nexport default function 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"],"names":["useWindowSize","useState","size","setSize","useLayoutEffect","window","updateSize","innerWidth","innerHeight","addEventListener","removeEventListener"],"mappings":";;;;;;;;;AAEe,SAASA,aAAT,GAAyB;AACtC,kBAAwBC,cAAQ,CAAC,CAAC,CAAD,EAAI,CAAJ,CAAD,CAAhC;AAAA;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACAC,EAAAA,qBAAe,CAAC,YAAM;AACpB,QAAI,CAACC,MAAL,EAAa,OAAO,KAAP;;AACb,aAASC,UAAT,GAAsB;AACpBH,MAAAA,OAAO,CAAC,CAACE,MAAM,CAACE,UAAR,EAAoBF,MAAM,CAACG,WAA3B,CAAD,CAAP;AACD;;AACDH,IAAAA,MAAM,CAACI,gBAAP,CAAwB,QAAxB,EAAkCH,UAAlC;AACAD,IAAAA,MAAM,CAACI,gBAAP,CAAwB,mBAAxB,EAA6CH,UAA7C;AACAA,IAAAA,UAAU;AACV,WAAO,YAAM;AACXD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,QAA3B,EAAqCJ,UAArC;AACAD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,mBAA3B,EAAgDJ,UAAhD;AACD,KAHD;AAID,GAZc,EAYZ,EAZY,CAAf;AAaA,MAAI,CAACD,MAAL,EAAa,OAAO,KAAP;AACb,SAAOH,IAAP;AACD;;;;"}
1
+ {"version":3,"file":"useWindowSize.js","sources":["../../../src/hooks/useWindowSize.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\nexport default function 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"],"names":["useWindowSize","useState","size","setSize","useLayoutEffect","window","updateSize","innerWidth","innerHeight","addEventListener","removeEventListener"],"mappings":";;;;;;;;;AAEe,SAASA,aAAT,GAAyB;AACtC,kBAAwBC,cAAQ,CAAC,CAAC,CAAD,EAAI,CAAJ,CAAD,CAAhC;AAAA;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACAC,EAAAA,qBAAe,CAAC,YAAM;AACpB,QAAI,CAACC,MAAL,EAAa,OAAO,KAAP;;AACb,aAASC,UAAT,GAAsB;AACpBH,MAAAA,OAAO,CAAC,CAACE,MAAM,CAACE,UAAR,EAAoBF,MAAM,CAACG,WAA3B,CAAD,CAAP;AACD;;AACDH,IAAAA,MAAM,CAACI,gBAAP,CAAwB,QAAxB,EAAkCH,UAAlC;AACAD,IAAAA,MAAM,CAACI,gBAAP,CAAwB,mBAAxB,EAA6CH,UAA7C;AACAA,IAAAA,UAAU;AACV,WAAO,YAAM;AACXD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,QAA3B,EAAqCJ,UAArC;AACAD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,mBAA3B,EAAgDJ,UAAhD;AACD,KAHD;AAID,GAZc,EAYZ,EAZY,CAAf;AAaA,MAAI,CAACD,MAAL,EAAa,OAAO,KAAP;AACb,SAAOH,IAAP;AACD;;;;"}
package/cjs/index.js CHANGED
@@ -5,12 +5,46 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var getComponentFromProps = require('./getComponentFromProps.js');
6
6
  var onClickHandlerForNonInteractiveElements = require('./onClickHandlerForNonInteractiveElements.js');
7
7
  var operators = require('./operators.js');
8
+ var utils = require('./utils.js');
8
9
  var system = require('./system.js');
10
+ var useMeasure = require('use-measure');
11
+ var hooks_useExecutionTimer = require('./hooks/useExecutionTimer.js');
12
+ var hooks_useExpandState = require('./hooks/useExpandState.js');
13
+ var hooks_useHotkeys = require('./hooks/useHotkeys.js');
14
+ var hooks_useHoverHandlersDelay = require('./hooks/useHoverHandlersDelay.js');
15
+ var hooks_useResizeObserver = require('./hooks/useResizeObserver.js');
16
+ var hooks_useShouldRecalculate = require('./hooks/useShouldRecalculate.js');
17
+ var hooks_useWindowScrollerList = require('./hooks/useWindowScrollerList.js');
18
+ var hooks_useWindowSize = require('./hooks/useWindowSize.js');
19
+ var useForceUpdate = require('use-force-update');
20
+ var useOnclickoutside = require('use-onclickoutside');
21
+ var hook = require('uncontrollable/hook');
22
+ var hooks_usePrevious = require('./hooks/usePrevious.js');
23
+ var hooks_useCancellableDelayedCallback = require('./hooks/useCancellableDelayedCallback.js');
24
+ var hooks_useDerivedStateFromProps = require('./hooks/useDerivedStateFromProps.js');
25
+ var hooks_useSetRef = require('./hooks/useSetRef.js');
26
+ var hooks_useParentElement = require('./hooks/useParentElement.js');
27
+ var timeUtils = require('./timeUtils.js');
28
+ var compose = require('./compose.js');
29
+ var platform = require('./platform.js');
30
+ var reactTypesUtility = require('./reactTypesUtility.js');
31
+ var scrollingTimer = require('./scrollingTimer.js');
32
+ var validations = require('./validations.js');
33
+ var lodash = require('lodash');
9
34
  require('@babel/runtime/helpers/toConsumableArray');
10
35
  require('@babel/runtime/helpers/defineProperty');
11
36
  require('react');
12
37
  require('@babel/runtime/helpers/slicedToArray');
13
- require('lodash');
38
+ require('hotkeys-js');
39
+ require('raf');
40
+ require('resize-observer-polyfill');
41
+
42
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
43
+
44
+ var useMeasure__default = /*#__PURE__*/_interopDefaultLegacy(useMeasure);
45
+ var useForceUpdate__default = /*#__PURE__*/_interopDefaultLegacy(useForceUpdate);
46
+ var useOnclickoutside__default = /*#__PURE__*/_interopDefaultLegacy(useOnclickoutside);
47
+ var hook__default = /*#__PURE__*/_interopDefaultLegacy(hook);
14
48
 
15
49
 
16
50
 
@@ -30,7 +64,290 @@ exports.lessThanOrEquals = operators.lessThanOrEquals;
30
64
  exports.notEqual = operators.notEqual;
31
65
  exports.startsWith = operators.startsWith;
32
66
  exports.validDate = operators.validDate;
67
+ exports.addOrRemove = utils.addOrRemove;
68
+ exports.arrayMove = utils.arrayMove;
69
+ exports.cx = utils.cx;
70
+ exports.hashArray = utils.hashArray;
71
+ exports.removeUndefinedProperties = utils.removeUndefinedProperties;
72
+ exports.runAll = utils.runAll;
73
+ exports.safeCall = utils.safeCall;
74
+ exports.toggleInArray = utils.toggleInArray;
75
+ exports.toggleInObject = utils.toggleInObject;
33
76
  exports.logger = system.logger;
34
77
  exports.mergeRefs = system.mergeRefs;
35
78
  exports.setRef = system.setRef;
79
+ Object.defineProperty(exports, 'useMeasure', {
80
+ enumerable: true,
81
+ get: function () {
82
+ return useMeasure__default['default'];
83
+ }
84
+ });
85
+ exports.useExecutionTimer = hooks_useExecutionTimer;
86
+ exports.useExpandState = hooks_useExpandState;
87
+ exports.useHotkeys = hooks_useHotkeys;
88
+ exports.useHoverHandlersDelay = hooks_useHoverHandlersDelay;
89
+ exports.useResizeObserver = hooks_useResizeObserver;
90
+ exports.useShouldRecalculate = hooks_useShouldRecalculate;
91
+ exports.useWindowScrollerList = hooks_useWindowScrollerList;
92
+ exports.useWindowSize = hooks_useWindowSize;
93
+ Object.defineProperty(exports, 'useForceUpdate', {
94
+ enumerable: true,
95
+ get: function () {
96
+ return useForceUpdate__default['default'];
97
+ }
98
+ });
99
+ Object.defineProperty(exports, 'useOnClickOutside', {
100
+ enumerable: true,
101
+ get: function () {
102
+ return useOnclickoutside__default['default'];
103
+ }
104
+ });
105
+ Object.defineProperty(exports, 'useUncontrolled', {
106
+ enumerable: true,
107
+ get: function () {
108
+ return hook__default['default'];
109
+ }
110
+ });
111
+ exports.usePrevious = hooks_usePrevious;
112
+ exports.useCancellableDelayedCallback = hooks_useCancellableDelayedCallback;
113
+ exports.useDerivedStateFromProps = hooks_useDerivedStateFromProps;
114
+ exports.useSetRef = hooks_useSetRef.useSetRef;
115
+ exports.useParentElement = hooks_useParentElement.useParentElement;
116
+ exports.addLeadingZeros = timeUtils.addLeadingZeros;
117
+ exports.getVisibleTimeByFormat = timeUtils.getVisibleTimeByFormat;
118
+ exports.compose = compose.compose;
119
+ exports.DOCUMENT = platform.DOCUMENT;
120
+ exports.WINDOW = platform.WINDOW;
121
+ exports.isClassComponent = reactTypesUtility.isClassComponent;
122
+ exports.isCompositeTypeElement = reactTypesUtility.isCompositeTypeElement;
123
+ exports.isDOMTypeElement = reactTypesUtility.isDOMTypeElement;
124
+ exports.isElement = reactTypesUtility.isElement;
125
+ exports.isFunctionComponent = reactTypesUtility.isFunctionComponent;
126
+ exports.isReactComponent = reactTypesUtility.isReactComponent;
127
+ exports.resetTimer = scrollingTimer.resetTimer;
128
+ exports.isGreaterThan = validations.isGreaterThan;
129
+ exports.isRequired = validations.isRequired;
130
+ exports.isValidDate = validations.isValidDate;
131
+ Object.defineProperty(exports, 'cloneDeep', {
132
+ enumerable: true,
133
+ get: function () {
134
+ return lodash.cloneDeep;
135
+ }
136
+ });
137
+ Object.defineProperty(exports, 'curry', {
138
+ enumerable: true,
139
+ get: function () {
140
+ return lodash.curry;
141
+ }
142
+ });
143
+ Object.defineProperty(exports, 'debounce', {
144
+ enumerable: true,
145
+ get: function () {
146
+ return lodash.debounce;
147
+ }
148
+ });
149
+ Object.defineProperty(exports, 'differenceBy', {
150
+ enumerable: true,
151
+ get: function () {
152
+ return lodash.differenceBy;
153
+ }
154
+ });
155
+ Object.defineProperty(exports, 'differenceWith', {
156
+ enumerable: true,
157
+ get: function () {
158
+ return lodash.differenceWith;
159
+ }
160
+ });
161
+ Object.defineProperty(exports, 'filter', {
162
+ enumerable: true,
163
+ get: function () {
164
+ return lodash.filter;
165
+ }
166
+ });
167
+ Object.defineProperty(exports, 'findIndex', {
168
+ enumerable: true,
169
+ get: function () {
170
+ return lodash.findIndex;
171
+ }
172
+ });
173
+ Object.defineProperty(exports, 'get', {
174
+ enumerable: true,
175
+ get: function () {
176
+ return lodash.get;
177
+ }
178
+ });
179
+ Object.defineProperty(exports, 'groupBy', {
180
+ enumerable: true,
181
+ get: function () {
182
+ return lodash.groupBy;
183
+ }
184
+ });
185
+ Object.defineProperty(exports, 'isBoolean', {
186
+ enumerable: true,
187
+ get: function () {
188
+ return lodash.isBoolean;
189
+ }
190
+ });
191
+ Object.defineProperty(exports, 'isEmpty', {
192
+ enumerable: true,
193
+ get: function () {
194
+ return lodash.isEmpty;
195
+ }
196
+ });
197
+ Object.defineProperty(exports, 'isEqual', {
198
+ enumerable: true,
199
+ get: function () {
200
+ return lodash.isEqual;
201
+ }
202
+ });
203
+ Object.defineProperty(exports, 'isEqualWith', {
204
+ enumerable: true,
205
+ get: function () {
206
+ return lodash.isEqualWith;
207
+ }
208
+ });
209
+ Object.defineProperty(exports, 'isFunction', {
210
+ enumerable: true,
211
+ get: function () {
212
+ return lodash.isFunction;
213
+ }
214
+ });
215
+ Object.defineProperty(exports, 'isNaN', {
216
+ enumerable: true,
217
+ get: function () {
218
+ return lodash.isNaN;
219
+ }
220
+ });
221
+ Object.defineProperty(exports, 'isObject', {
222
+ enumerable: true,
223
+ get: function () {
224
+ return lodash.isObject;
225
+ }
226
+ });
227
+ Object.defineProperty(exports, 'isString', {
228
+ enumerable: true,
229
+ get: function () {
230
+ return lodash.isString;
231
+ }
232
+ });
233
+ Object.defineProperty(exports, 'maxBy', {
234
+ enumerable: true,
235
+ get: function () {
236
+ return lodash.maxBy;
237
+ }
238
+ });
239
+ Object.defineProperty(exports, 'meanBy', {
240
+ enumerable: true,
241
+ get: function () {
242
+ return lodash.meanBy;
243
+ }
244
+ });
245
+ Object.defineProperty(exports, 'noop', {
246
+ enumerable: true,
247
+ get: function () {
248
+ return lodash.noop;
249
+ }
250
+ });
251
+ Object.defineProperty(exports, 'omit', {
252
+ enumerable: true,
253
+ get: function () {
254
+ return lodash.omit;
255
+ }
256
+ });
257
+ Object.defineProperty(exports, 'orderBy', {
258
+ enumerable: true,
259
+ get: function () {
260
+ return lodash.orderBy;
261
+ }
262
+ });
263
+ Object.defineProperty(exports, 'padStart', {
264
+ enumerable: true,
265
+ get: function () {
266
+ return lodash.padStart;
267
+ }
268
+ });
269
+ Object.defineProperty(exports, 'parseInt', {
270
+ enumerable: true,
271
+ get: function () {
272
+ return lodash.parseInt;
273
+ }
274
+ });
275
+ Object.defineProperty(exports, 'pick', {
276
+ enumerable: true,
277
+ get: function () {
278
+ return lodash.pick;
279
+ }
280
+ });
281
+ Object.defineProperty(exports, 'pickBy', {
282
+ enumerable: true,
283
+ get: function () {
284
+ return lodash.pickBy;
285
+ }
286
+ });
287
+ Object.defineProperty(exports, 'property', {
288
+ enumerable: true,
289
+ get: function () {
290
+ return lodash.property;
291
+ }
292
+ });
293
+ Object.defineProperty(exports, 'pull', {
294
+ enumerable: true,
295
+ get: function () {
296
+ return lodash.pull;
297
+ }
298
+ });
299
+ Object.defineProperty(exports, 'range', {
300
+ enumerable: true,
301
+ get: function () {
302
+ return lodash.range;
303
+ }
304
+ });
305
+ Object.defineProperty(exports, 'set', {
306
+ enumerable: true,
307
+ get: function () {
308
+ return lodash.set;
309
+ }
310
+ });
311
+ Object.defineProperty(exports, 'sortBy', {
312
+ enumerable: true,
313
+ get: function () {
314
+ return lodash.sortBy;
315
+ }
316
+ });
317
+ Object.defineProperty(exports, 'sumBy', {
318
+ enumerable: true,
319
+ get: function () {
320
+ return lodash.sumBy;
321
+ }
322
+ });
323
+ Object.defineProperty(exports, 'throttle', {
324
+ enumerable: true,
325
+ get: function () {
326
+ return lodash.throttle;
327
+ }
328
+ });
329
+ Object.defineProperty(exports, 'transform', {
330
+ enumerable: true,
331
+ get: function () {
332
+ return lodash.transform;
333
+ }
334
+ });
335
+ Object.defineProperty(exports, 'uniq', {
336
+ enumerable: true,
337
+ get: function () {
338
+ return lodash.uniq;
339
+ }
340
+ });
341
+ Object.defineProperty(exports, 'uniqBy', {
342
+ enumerable: true,
343
+ get: function () {
344
+ return lodash.uniqBy;
345
+ }
346
+ });
347
+ Object.defineProperty(exports, 'values', {
348
+ enumerable: true,
349
+ get: function () {
350
+ return lodash.values;
351
+ }
352
+ });
36
353
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/cjs/utils.js CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
6
6
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
7
  var lodash = require('lodash');
8
- var compose = require('./compose.js');
9
8
 
10
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
10
 
@@ -330,7 +329,6 @@ Object.defineProperty(exports, 'values', {
330
329
  return lodash.values;
331
330
  }
332
331
  });
333
- exports.compose = compose.compose;
334
332
  exports.addOrRemove = addOrRemove;
335
333
  exports.arrayMove = arrayMove;
336
334
  exports.cx = cx;
package/cjs/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/utils.tsx"],"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\nimport { compose } from './compose';\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 compose,\n isEqualWith,\n isBoolean,\n};\n"],"names":["cx","classnames","reduce","result","cn","toggleInObject","obj","key","value","undefined","omit","toggleInArray","array","indexOf","arrayMoveMutate","from","to","splice","length","arrayMove","slice","accessorDefault","item","addOrRemove","accessor","index","findIndex","iItem","nextArray","cloneDeep","runAll","fns","args","forEach","fn","Array","isArray","isFunction","hashArray","arr","fieldName","safeCall","fun","removeUndefinedProperties","cleanObject","Object","keys"],"mappings":";;;;;;;;;;;;;;;;;AAkDA;AACA;AACA;AACA;AACA;;IACaA,EAAE,GAAG,SAALA,EAAK;AAAA,oCAAIC,UAAJ;AAAIA,IAAAA,UAAJ;AAAA;;AAAA,SAAmBA,UAAU,CAACC,MAAX,CAAkB,UAACC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yBAAyB,GAAG,SAA5BA,yBAA4B,CAACrC,GAAD,EAAS;AAChD,MAAMsC,WAAW,qBAAQtC,GAAR,CAAjB;;AACAuC,EAAAA,MAAM,CAACC,IAAP,CAAYxC,GAAZ,EAAiB2B,OAAjB,CAAyB,UAAC1B,GAAD;AAAA,WAASqC,WAAW,CAACrC,GAAD,CAAX,KAAqBE,SAArB,IAAkC,OAAOmC,WAAW,CAACrC,GAAD,CAA7D;AAAA,GAAzB;AACA,SAAOqC,WAAP;AACD;AAED,YAAe,EAAf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../src/utils.tsx"],"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"],"names":["cx","classnames","reduce","result","cn","toggleInObject","obj","key","value","undefined","omit","toggleInArray","array","indexOf","arrayMoveMutate","from","to","splice","length","arrayMove","slice","accessorDefault","item","addOrRemove","accessor","index","findIndex","iItem","nextArray","cloneDeep","runAll","fns","args","forEach","fn","Array","isArray","isFunction","hashArray","arr","fieldName","safeCall","fun","removeUndefinedProperties","cleanObject","Object","keys"],"mappings":";;;;;;;;;;;;;;;;AAgDA;AACA;AACA;AACA;AACA;;IACaA,EAAE,GAAG,SAALA,EAAK;AAAA,oCAAIC,UAAJ;AAAIA,IAAAA,UAAJ;AAAA;;AAAA,SAAmBA,UAAU,CAACC,MAAX,CAAkB,UAACC,MAAD,EAASC,EAAT;AAAA,qBAAmBD,MAAnB,cAA6BC,EAAE,IAAI,EAAnC;AAAA,GAAlB,EAA2D,EAA3D,CAAnB;AAAA;;IAGZC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,GAAD,EAAMC,GAAN,EAAWC,KAAX;AAAA,SAAsBF,GAAG,CAACC,GAAD,CAAH,KAAaE,SAAb,GAAyBC,WAAI,CAACJ,GAAD,EAAM,CAACC,GAAD,CAAN,CAA7B,mCAAiDD,GAAjD,+CAAuDC,GAAvD,EAA6DC,KAA7D,EAAtB;AAAA;;IACjBG,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAQJ,KAAR;AAAA,SAAmBI,KAAK,CAACC,OAAN,CAAcL,KAAd,MAAyB,CAAC,CAA1B,GAA8B,CAACA,KAAD,CAA9B,GAAwC,EAA3D;AAAA;;AAEtB,IAAMM,eAAe,GAAG,SAAlBA,eAAkB,CAACF,KAAD,EAAQG,IAAR,EAAcC,EAAd,EAAqB;AAC3CJ,EAAAA,KAAK,CAACK,MAAN,CAAaD,EAAE,GAAG,CAAL,GAASJ,KAAK,CAACM,MAAN,GAAeF,EAAxB,GAA6BA,EAA1C,EAA8C,CAA9C,EAAiDJ,KAAK,CAACK,MAAN,CAAaF,IAAb,EAAmB,CAAnB,EAAsB,CAAtB,CAAjD;AACD,CAFD;;IAIMI,SAAS,GAAG,SAAZA,SAAY,CAACP,KAAD,EAAQG,IA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,EAASmB,IAAT;AAAA,2CACKnB,MADL,+CAEGqC,SAAS,GAAGlB,IAAI,CAACkB,SAAD,CAAP,GAAqBlB,IAFjC,EAEwC,IAFxC;AAAA,GADK,EAKL,EALK,CAAP;AAOD;AAEM,SAASmB,QAAT,CAAkBC,GAAlB,EAAgC;AACrC,MAAIL,iBAAU,CAACK,GAAD,CAAd,EAAqB;AAAA,uCADUV,IACV;AADUA,MAAAA,IACV;AAAA;;AACnBU,IAAAA,GAAG,MAAH,SAAOV,IAAP;AACD;AACF;IAEYW,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACrC,GAAD,EAAS;AAChD,MAAMsC,WAAW,qBAAQtC,GAAR,CAAjB;;AACAuC,EAAAA,MAAM,CAACC,IAAP,CAAYxC,GAAZ,EAAiB2B,OAAjB,CAAyB,UAAC1B,GAAD;AAAA,WAASqC,WAAW,CAACrC,GAAD,CAAX,KAAqBE,SAArB,IAAkC,OAAOmC,WAAW,CAACrC,GAAD,CAA7D;AAAA,GAAzB;AACA,SAAOqC,WAAP;AACD;AAED,YAAe,EAAf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,31 +1,26 @@
1
- import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
2
- import { useState, useEffect, useRef, useCallback } from 'react';
3
1
  export { default as useMeasure } from 'use-measure';
4
2
  export { default as useExecutionTimer } from './useExecutionTimer.js';
3
+ export { default as useExpandState } from './useExpandState.js';
4
+ export { default as useHotkeys } from './useHotkeys.js';
5
+ export { default as useHoverHandlersDelay } from './useHoverHandlersDelay.js';
6
+ export { default as useResizeObserver } from './useResizeObserver.js';
7
+ export { default as useShouldRecalculate } from './useShouldRecalculate.js';
8
+ export { default as useWindowScrollerList } from './useWindowScrollerList.js';
9
+ export { default as useWindowSize } from './useWindowSize.js';
5
10
  export { default as useForceUpdate } from 'use-force-update';
6
11
  export { default as useOnClickOutside } from 'use-onclickoutside';
7
12
  export { default as useUncontrolled } from 'uncontrollable/hook';
8
13
  export { default as usePrevious } from './usePrevious.js';
9
14
  export { default as useCancellableDelayedCallback } from './useCancellableDelayedCallback.js';
10
-
11
- function useParentElement(ref) {
12
- var _useState = useState(ref.current),
13
- _useState2 = _slicedToArray(_useState, 2),
14
- parent = _useState2[0],
15
- setParent = _useState2[1];
16
-
17
- useEffect(function () {
18
- if (ref.current) setParent(ref.current.parentNode);
19
- });
20
- return parent;
21
- }
22
- function useSetRef(initial) {
23
- var ref = useRef(initial);
24
- var setRef = useCallback(function (node) {
25
- ref.current = node;
26
- }, []);
27
- return [ref, setRef];
28
- }
29
-
30
- export { useParentElement, useSetRef };
15
+ export { default as useDerivedStateFromProps } from './useDerivedStateFromProps.js';
16
+ export { useSetRef } from './useSetRef.js';
17
+ export { useParentElement } from './useParentElement.js';
18
+ import 'react';
19
+ import '@babel/runtime/helpers/esm/slicedToArray';
20
+ import '@babel/runtime/helpers/esm/defineProperty';
21
+ import '@babel/runtime/helpers/esm/toConsumableArray';
22
+ import 'lodash';
23
+ import 'hotkeys-js';
24
+ import 'raf';
25
+ import 'resize-observer-polyfill';
31
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/hooks/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport { default as useMeasure } from 'use-measure';\nexport { default as useExecutionTimer } from './useExecutionTimer';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\nexport { default as useUncontrolled } from 'uncontrollable/hook';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useCancellableDelayedCallback } from './useCancellableDelayedCallback';\n\nexport function useParentElement(ref) {\n const [parent, setParent] = useState(ref.current);\n useEffect(() => {\n if (ref.current) setParent(ref.current.parentNode);\n });\n return parent;\n}\n\nexport function useSetRef(initial) {\n const ref = useRef(initial);\n const setRef = useCallback((node) => {\n ref.current = node;\n }, []);\n return [ref, setRef];\n}\n"],"names":["useParentElement","ref","useState","current","parent","setParent","useEffect","parentNode","useSetRef","initial","useRef","setRef","useCallback","node"],"mappings":";;;;;;;;;;AAUO,SAASA,gBAAT,CAA0BC,GAA1B,EAA+B;AACpC,kBAA4BC,QAAQ,CAACD,GAAG,CAACE,OAAL,CAApC;AAAA;AAAA,MAAOC,MAAP;AAAA,MAAeC,SAAf;;AACAC,EAAAA,SAAS,CAAC,YAAM;AACd,QAAIL,GAAG,CAACE,OAAR,EAAiBE,SAAS,CAACJ,GAAG,CAACE,OAAJ,CAAYI,UAAb,CAAT;AAClB,GAFQ,CAAT;AAGA,SAAOH,MAAP;AACD;AAEM,SAASI,SAAT,CAAmBC,OAAnB,EAA4B;AACjC,MAAMR,GAAG,GAAGS,MAAM,CAACD,OAAD,CAAlB;AACA,MAAME,MAAM,GAAGC,WAAW,CAAC,UAACC,IAAD,EAAU;AACnCZ,IAAAA,GAAG,CAACE,OAAJ,GAAcU,IAAd;AACD,GAFyB,EAEvB,EAFuB,CAA1B;AAGA,SAAO,CAACZ,GAAD,EAAMU,MAAN,CAAP;AACD;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,17 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
2
+ import { useState, useEffect } from 'react';
3
+
4
+ var useParentElement = function useParentElement(ref) {
5
+ var _useState = useState(ref.current),
6
+ _useState2 = _slicedToArray(_useState, 2),
7
+ parent = _useState2[0],
8
+ setParent = _useState2[1];
9
+
10
+ useEffect(function () {
11
+ if (ref.current) setParent(ref.current.parentNode);
12
+ });
13
+ return parent;
14
+ };
15
+
16
+ export { useParentElement };
17
+ //# sourceMappingURL=useParentElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParentElement.js","sources":["../../../src/hooks/useParentElement.tsx"],"sourcesContent":["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"],"names":["useParentElement","ref","useState","current","parent","setParent","useEffect","parentNode"],"mappings":";;;IAEaA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,GAAD,EAAS;AACvC,kBAA4BC,QAAQ,CAACD,GAAG,CAACE,OAAL,CAApC;AAAA;AAAA,MAAOC,MAAP;AAAA,MAAeC,SAAf;;AAEAC,EAAAA,SAAS,CAAC,YAAM;AACd,QAAIL,GAAG,CAACE,OAAR,EAAiBE,SAAS,CAACJ,GAAG,CAACE,OAAJ,CAAYI,UAAb,CAAT;AAClB,GAFQ,CAAT;AAGA,SAAOH,MAAP;AACD;;;;"}
@@ -0,0 +1,12 @@
1
+ import { useRef, useCallback } from 'react';
2
+
3
+ var useSetRef = function useSetRef(initial) {
4
+ var ref = useRef(initial);
5
+ var setRef = useCallback(function (node) {
6
+ ref.current = node;
7
+ }, []);
8
+ return [ref, setRef];
9
+ };
10
+
11
+ export { useSetRef };
12
+ //# sourceMappingURL=useSetRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSetRef.js","sources":["../../../src/hooks/useSetRef.tsx"],"sourcesContent":["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"],"names":["useSetRef","initial","ref","useRef","setRef","useCallback","node","current"],"mappings":";;IAEaA,SAAS,GAAG,SAAZA,SAAY,CAACC,OAAD,EAAa;AACpC,MAAMC,GAAG,GAAGC,MAAM,CAACF,OAAD,CAAlB;AACA,MAAMG,MAAM,GAAGC,WAAW,CAAC,UAACC,IAAD,EAAU;AACnCJ,IAAAA,GAAG,CAACK,OAAJ,GAAcD,IAAd;AACD,GAFyB,EAEvB,EAFuB,CAA1B;AAGA,SAAO,CAACJ,GAAD,EAAME,MAAN,CAAP;AACD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useWindowSize.js","sources":["../../../src/hooks/useWindowSize.tsx"],"sourcesContent":["import React, { useLayoutEffect, useState } from 'react';\n\nexport default function 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"],"names":["useWindowSize","useState","size","setSize","useLayoutEffect","window","updateSize","innerWidth","innerHeight","addEventListener","removeEventListener"],"mappings":";;;AAEe,SAASA,aAAT,GAAyB;AACtC,kBAAwBC,QAAQ,CAAC,CAAC,CAAD,EAAI,CAAJ,CAAD,CAAhC;AAAA;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACAC,EAAAA,eAAe,CAAC,YAAM;AACpB,QAAI,CAACC,MAAL,EAAa,OAAO,KAAP;;AACb,aAASC,UAAT,GAAsB;AACpBH,MAAAA,OAAO,CAAC,CAACE,MAAM,CAACE,UAAR,EAAoBF,MAAM,CAACG,WAA3B,CAAD,CAAP;AACD;;AACDH,IAAAA,MAAM,CAACI,gBAAP,CAAwB,QAAxB,EAAkCH,UAAlC;AACAD,IAAAA,MAAM,CAACI,gBAAP,CAAwB,mBAAxB,EAA6CH,UAA7C;AACAA,IAAAA,UAAU;AACV,WAAO,YAAM;AACXD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,QAA3B,EAAqCJ,UAArC;AACAD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,mBAA3B,EAAgDJ,UAAhD;AACD,KAHD;AAID,GAZc,EAYZ,EAZY,CAAf;AAaA,MAAI,CAACD,MAAL,EAAa,OAAO,KAAP;AACb,SAAOH,IAAP;AACD;;;;"}
1
+ {"version":3,"file":"useWindowSize.js","sources":["../../../src/hooks/useWindowSize.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\nexport default function 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"],"names":["useWindowSize","useState","size","setSize","useLayoutEffect","window","updateSize","innerWidth","innerHeight","addEventListener","removeEventListener"],"mappings":";;;AAEe,SAASA,aAAT,GAAyB;AACtC,kBAAwBC,QAAQ,CAAC,CAAC,CAAD,EAAI,CAAJ,CAAD,CAAhC;AAAA;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACAC,EAAAA,eAAe,CAAC,YAAM;AACpB,QAAI,CAACC,MAAL,EAAa,OAAO,KAAP;;AACb,aAASC,UAAT,GAAsB;AACpBH,MAAAA,OAAO,CAAC,CAACE,MAAM,CAACE,UAAR,EAAoBF,MAAM,CAACG,WAA3B,CAAD,CAAP;AACD;;AACDH,IAAAA,MAAM,CAACI,gBAAP,CAAwB,QAAxB,EAAkCH,UAAlC;AACAD,IAAAA,MAAM,CAACI,gBAAP,CAAwB,mBAAxB,EAA6CH,UAA7C;AACAA,IAAAA,UAAU;AACV,WAAO,YAAM;AACXD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,QAA3B,EAAqCJ,UAArC;AACAD,MAAAA,MAAM,CAACK,mBAAP,CAA2B,mBAA3B,EAAgDJ,UAAhD;AACD,KAHD;AAID,GAZc,EAYZ,EAZY,CAAf;AAaA,MAAI,CAACD,MAAL,EAAa,OAAO,KAAP;AACb,SAAOH,IAAP;AACD;;;;"}
package/esm/index.js CHANGED
@@ -1,10 +1,37 @@
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 { default as useUncontrolled } from 'uncontrollable/hook';
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 { addLeadingZeros, getVisibleTimeByFormat } from './timeUtils.js';
24
+ export { compose } from './compose.js';
25
+ export { DOCUMENT, WINDOW } from './platform.js';
26
+ export { isClassComponent, isCompositeTypeElement, isDOMTypeElement, isElement, isFunctionComponent, isReactComponent } from './reactTypesUtility.js';
27
+ export { resetTimer } from './scrollingTimer.js';
28
+ export { isGreaterThan, isRequired, isValidDate } from './validations.js';
29
+ 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';
5
30
  import '@babel/runtime/helpers/esm/toConsumableArray';
6
31
  import '@babel/runtime/helpers/esm/defineProperty';
7
32
  import 'react';
8
33
  import '@babel/runtime/helpers/esm/slicedToArray';
9
- import 'lodash';
34
+ import 'hotkeys-js';
35
+ import 'raf';
36
+ import 'resize-observer-polyfill';
10
37
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/esm/utils.js CHANGED
@@ -2,7 +2,6 @@ import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';
2
2
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
3
  import { omit, cloneDeep, isFunction } from 'lodash';
4
4
  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';
5
- export { compose } from './compose.js';
6
5
 
7
6
  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; }
8
7
 
package/esm/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/utils.tsx"],"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\nimport { compose } from './compose';\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 compose,\n isEqualWith,\n isBoolean,\n};\n"],"names":["cx","classnames","reduce","result","cn","toggleInObject","obj","key","value","undefined","omit","toggleInArray","array","indexOf","arrayMoveMutate","from","to","splice","length","arrayMove","slice","accessorDefault","item","addOrRemove","accessor","index","findIndex","iItem","nextArray","cloneDeep","runAll","fns","args","forEach","fn","Array","isArray","isFunction","hashArray","arr","fieldName","safeCall","fun","removeUndefinedProperties","cleanObject","Object","keys"],"mappings":";;;;;;;;;AAkDA;AACA;AACA;AACA;AACA;;IACaA,EAAE,GAAG,SAALA,EAAK;AAAA,oCAAIC,UAAJ;AAAIA,IAAAA,UAAJ;AAAA;;AAAA,SAAmBA,UAAU,CAACC,MAAX,CAAkB,UAACC,MAAD,EAASC,EAAT;AAAA,qBAAmBD,MAAnB,cAA6BC,EAAE,IAAI,EAAnC;AAAA,GAA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AR,CAAjB;;AACAuC,EAAAA,MAAM,CAACC,IAAP,CAAYxC,GAAZ,EAAiB2B,OAAjB,CAAyB,UAAC1B,GAAD;AAAA,WAASqC,WAAW,CAACrC,GAAD,CAAX,KAAqBE,SAArB,IAAkC,OAAOmC,WAAW,CAACrC,GAAD,CAA7D;AAAA,GAAzB;AACA,SAAOqC,WAAP;AACD;AAED,YAAe,EAAf;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../src/utils.tsx"],"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"],"names":["cx","classnames","reduce","result","cn","toggleInObject","obj","key","value","undefined","omit","toggleInArray","array","indexOf","arrayMoveMutate","from","to","splice","length","arrayMove","slice","accessorDefault","item","addOrRemove","accessor","index","findIndex","iItem","nextArray","cloneDeep","runAll","fns","args","forEach","fn","Array","isArray","isFunction","hashArray","arr","fieldName","safeCall","fun","removeUndefinedProperties","cleanObject","Object","keys"],"mappings":";;;;;;;;AAgDA;AACA;AACA;AACA;AACA;;IACaA,EAAE,GAAG,SAALA,EAAK;AAAA,oCAAIC,UAAJ;AAAIA,IAAAA,UAAJ;AAAA;;AAAA,SAAmBA,UAAU,CAACC,MAAX,CAAkB,UAACC,MAAD,EAASC,EAAT;AAAA,qBAAmBD,M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AAD,EAAS;AAChD,MAAMsC,WAAW,qBAAQtC,GAAR,CAAjB;;AACAuC,EAAAA,MAAM,CAACC,IAAP,CAAYxC,GAAZ,EAAiB2B,OAAjB,CAAyB,UAAC1B,GAAD;AAAA,WAASqC,WAAW,CAACrC,GAAD,CAAX,KAAqBE,SAArB,IAAkC,OAAOmC,WAAW,CAACrC,GAAD,CAA7D;AAAA,GAAzB;AACA,SAAOqC,WAAP;AACD;AAED,YAAe,EAAf;;;;"}
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@elliemae/ds-utilities/hooks/useParentElement",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ],
7
+ "private": true,
8
+ "main": "../../cjs/hooks/useParentElement.js",
9
+ "module": "../../esm/hooks/useParentElement.js"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@elliemae/ds-utilities/hooks/useSetRef",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ],
7
+ "private": true,
8
+ "main": "../../cjs/hooks/useSetRef.js",
9
+ "module": "../../esm/hooks/useSetRef.js"
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-utilities",
3
- "version": "1.56.1",
3
+ "version": "1.57.0-rc.11",
4
4
  "license": "MIT",
5
5
  "description": "Ellie Mae - Dim Sum - Utilities",
6
6
  "main": "cjs/index.js",