@elliemae/ds-utilities 1.60.0 → 2.0.0-alpha.12
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.
- package/cjs/capitalize.js +7 -0
- package/cjs/compose.js +8 -8
- package/cjs/getComponentFromProps.js +13 -7
- package/cjs/hooks/index.js +33 -51
- package/cjs/hooks/useCancellableDelayedCallback.js +6 -8
- package/cjs/hooks/useDerivedStateFromProps.js +28 -35
- package/cjs/hooks/useExecutionTimer.js +7 -11
- package/cjs/hooks/useExpandState.js +53 -59
- package/cjs/hooks/useHotkeys.js +11 -12
- package/cjs/hooks/useHoverHandlersDelay.js +10 -11
- package/cjs/hooks/useOnElementResize.js +11 -26
- package/cjs/hooks/useParentElement.js +4 -13
- package/cjs/hooks/usePrevious.js +2 -3
- package/cjs/hooks/useResizeObserver.js +11 -21
- package/cjs/hooks/useSetRef.js +3 -4
- package/cjs/hooks/useShouldRecalculate.js +1 -2
- package/cjs/hooks/useWindowScrollerList.js +17 -16
- package/cjs/hooks/useWindowSize.js +4 -13
- package/cjs/index.js +73 -162
- package/cjs/onClickHandlerForNonInteractiveElements.js +13 -14
- package/cjs/operators.js +19 -56
- package/cjs/platform.js +2 -3
- package/cjs/reactTypesUtility.js +1 -2
- package/cjs/scrollingTimer.js +3 -4
- package/cjs/system.js +11 -5
- package/cjs/timeUtils.js +15 -15
- package/cjs/utils.js +70 -149
- package/cjs/validations.js +17 -17
- package/esm/capitalize.js +3 -0
- package/esm/compose.js +8 -8
- package/esm/getComponentFromProps.js +12 -5
- package/esm/hooks/index.js +1 -10
- package/esm/hooks/useCancellableDelayedCallback.js +6 -8
- package/esm/hooks/useDerivedStateFromProps.js +29 -32
- package/esm/hooks/useExecutionTimer.js +7 -11
- package/esm/hooks/useExpandState.js +51 -56
- package/esm/hooks/useHotkeys.js +10 -11
- package/esm/hooks/useHoverHandlersDelay.js +10 -11
- package/esm/hooks/useOnElementResize.js +11 -22
- package/esm/hooks/useParentElement.js +4 -9
- package/esm/hooks/usePrevious.js +2 -3
- package/esm/hooks/useResizeObserver.js +11 -20
- package/esm/hooks/useSetRef.js +3 -4
- package/esm/hooks/useShouldRecalculate.js +1 -2
- package/esm/hooks/useWindowScrollerList.js +18 -17
- package/esm/hooks/useWindowSize.js +4 -9
- package/esm/index.js +2 -9
- package/esm/onClickHandlerForNonInteractiveElements.js +13 -14
- package/esm/operators.js +19 -52
- package/esm/platform.js +2 -3
- package/esm/reactTypesUtility.js +0 -1
- package/esm/scrollingTimer.js +3 -4
- package/esm/system.js +11 -5
- package/esm/timeUtils.js +15 -15
- package/esm/utils.js +31 -35
- package/esm/validations.js +17 -17
- package/package.json +135 -10
- package/types/capitalize.d.ts +1 -0
- package/types/compose.d.ts +11 -0
- package/types/getComponentFromProps.d.ts +2 -0
- package/types/hooks/index.d.ts +18 -0
- package/types/hooks/useCancellableDelayedCallback.d.ts +1 -0
- package/types/hooks/useDerivedStateFromProps.d.ts +1 -0
- package/types/hooks/useExecutionTimer.d.ts +1 -0
- package/types/hooks/useExpandState.d.ts +22 -0
- package/types/hooks/useHotkeys.d.ts +5 -0
- package/types/hooks/useHoverHandlersDelay.d.ts +9 -0
- package/types/hooks/useOnElementResize.d.ts +2 -0
- package/types/hooks/useParentElement.d.ts +1 -0
- package/types/hooks/usePrevious.d.ts +2 -0
- package/types/hooks/useResizeObserver.d.ts +2 -0
- package/types/hooks/useSetRef.d.ts +2 -0
- package/types/hooks/useShouldRecalculate.d.ts +1 -0
- package/types/hooks/useWindowScrollerList.d.ts +4 -0
- package/types/hooks/useWindowSize.d.ts +1 -0
- package/types/index.d.ts +13 -0
- package/types/onClickHandlerForNonInteractiveElements.d.ts +12 -0
- package/types/operators.d.ts +31 -0
- package/types/platform.d.ts +2 -0
- package/types/reactTypesUtility.d.ts +6 -0
- package/types/scrollingTimer.d.ts +1 -0
- package/types/system.d.ts +3 -0
- package/types/timeUtils.d.ts +7 -0
- package/types/utils.d.ts +23 -0
- package/types/validations.d.ts +23 -0
- package/cjs/compose.js.map +0 -1
- package/cjs/getComponentFromProps.js.map +0 -1
- package/cjs/hooks/index.js.map +0 -1
- package/cjs/hooks/useCancellableDelayedCallback.js.map +0 -1
- package/cjs/hooks/useDerivedStateFromProps.js.map +0 -1
- package/cjs/hooks/useExecutionTimer.js.map +0 -1
- package/cjs/hooks/useExpandState.js.map +0 -1
- package/cjs/hooks/useHotkeys.js.map +0 -1
- package/cjs/hooks/useHoverHandlersDelay.js.map +0 -1
- package/cjs/hooks/useOnElementResize.js.map +0 -1
- package/cjs/hooks/useParentElement.js.map +0 -1
- package/cjs/hooks/usePrevious.js.map +0 -1
- package/cjs/hooks/useResizeObserver.js.map +0 -1
- package/cjs/hooks/useSetRef.js.map +0 -1
- package/cjs/hooks/useShouldRecalculate.js.map +0 -1
- package/cjs/hooks/useWindowScrollerList.js.map +0 -1
- package/cjs/hooks/useWindowSize.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/onClickHandlerForNonInteractiveElements.js.map +0 -1
- package/cjs/operators.js.map +0 -1
- package/cjs/platform.js.map +0 -1
- package/cjs/reactTypesUtility.js.map +0 -1
- package/cjs/scrollingTimer.js.map +0 -1
- package/cjs/system.js.map +0 -1
- package/cjs/timeUtils.js.map +0 -1
- package/cjs/utils.js.map +0 -1
- package/cjs/validations.js.map +0 -1
- package/compose/package.json +0 -10
- package/esm/compose.js.map +0 -1
- package/esm/getComponentFromProps.js.map +0 -1
- package/esm/hooks/index.js.map +0 -1
- package/esm/hooks/useCancellableDelayedCallback.js.map +0 -1
- package/esm/hooks/useDerivedStateFromProps.js.map +0 -1
- package/esm/hooks/useExecutionTimer.js.map +0 -1
- package/esm/hooks/useExpandState.js.map +0 -1
- package/esm/hooks/useHotkeys.js.map +0 -1
- package/esm/hooks/useHoverHandlersDelay.js.map +0 -1
- package/esm/hooks/useOnElementResize.js.map +0 -1
- package/esm/hooks/useParentElement.js.map +0 -1
- package/esm/hooks/usePrevious.js.map +0 -1
- package/esm/hooks/useResizeObserver.js.map +0 -1
- package/esm/hooks/useSetRef.js.map +0 -1
- package/esm/hooks/useShouldRecalculate.js.map +0 -1
- package/esm/hooks/useWindowScrollerList.js.map +0 -1
- package/esm/hooks/useWindowSize.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/onClickHandlerForNonInteractiveElements.js.map +0 -1
- package/esm/operators.js.map +0 -1
- package/esm/platform.js.map +0 -1
- package/esm/reactTypesUtility.js.map +0 -1
- package/esm/scrollingTimer.js.map +0 -1
- package/esm/system.js.map +0 -1
- package/esm/timeUtils.js.map +0 -1
- package/esm/utils.js.map +0 -1
- package/esm/validations.js.map +0 -1
- package/getComponentFromProps/package.json +0 -10
- package/hooks/package.json +0 -10
- package/hooks/useCancellableDelayedCallback/package.json +0 -10
- package/hooks/useDerivedStateFromProps/package.json +0 -10
- package/hooks/useExecutionTimer/package.json +0 -10
- package/hooks/useExpandState/package.json +0 -10
- package/hooks/useHotkeys/package.json +0 -10
- package/hooks/useHoverHandlersDelay/package.json +0 -10
- package/hooks/useOnElementResize/package.json +0 -10
- package/hooks/useParentElement/package.json +0 -10
- package/hooks/usePrevious/package.json +0 -10
- package/hooks/useResizeObserver/package.json +0 -10
- package/hooks/useSetRef/package.json +0 -10
- package/hooks/useShouldRecalculate/package.json +0 -10
- package/hooks/useWindowScrollerList/package.json +0 -10
- package/hooks/useWindowSize/package.json +0 -10
- package/onClickHandlerForNonInteractiveElements/package.json +0 -10
- package/operators/package.json +0 -10
- package/platform/package.json +0 -10
- package/reactTypesUtility/package.json +0 -10
- package/scrollingTimer/package.json +0 -10
- package/system/package.json +0 -10
- package/timeUtils/package.json +0 -10
- package/utils/package.json +0 -10
- package/validations/package.json +0 -10
package/cjs/utils.js
CHANGED
|
@@ -2,69 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
6
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
9
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
7
14
|
var lodash = require('lodash');
|
|
8
15
|
|
|
9
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
17
|
|
|
11
|
-
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
12
18
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
13
19
|
|
|
14
20
|
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; }
|
|
15
21
|
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
23
|
/**
|
|
18
24
|
* Concatenates classNames from arguments
|
|
19
25
|
*
|
|
20
26
|
* @param {...any} classnames
|
|
21
27
|
*/
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
const cx = function () {
|
|
24
30
|
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
31
|
classnames[_key] = arguments[_key];
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
return classnames.reduce(
|
|
29
|
-
return "".concat(result, " ").concat(cn || '');
|
|
30
|
-
}, '');
|
|
34
|
+
return classnames.reduce((result, cn) => "".concat(result, " ").concat(cn || ''), '');
|
|
31
35
|
}; // if entry exists, remove it, if not, add it
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
37
|
+
const toggleInObject = (obj, key, value) => obj[key] !== undefined ? lodash.omit(obj, [key]) : _objectSpread(_objectSpread({}, obj), {}, {
|
|
38
|
+
[key]: value
|
|
39
|
+
});
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
return array.indexOf(value) === -1 ? [value] : [];
|
|
39
|
-
};
|
|
41
|
+
const toggleInArray = (array, value) => array.indexOf(value) === -1 ? [value] : [];
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
const arrayMoveMutate = (array, from, to) => {
|
|
42
44
|
array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
|
|
43
45
|
};
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
const arrayMove = (array, from, to) => {
|
|
46
48
|
array = array.slice();
|
|
47
49
|
arrayMoveMutate(array, from, to);
|
|
48
50
|
return array;
|
|
49
51
|
};
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
return item;
|
|
53
|
-
};
|
|
53
|
+
const accessorDefault = item => item;
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return accessor(iItem) === accessor(item);
|
|
59
|
-
});
|
|
55
|
+
const addOrRemove = function (array, item) {
|
|
56
|
+
let accessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : accessorDefault;
|
|
57
|
+
const index = array.findIndex(iItem => accessor(iItem) === accessor(item));
|
|
60
58
|
|
|
61
59
|
if (index !== -1) {
|
|
62
|
-
|
|
60
|
+
const nextArray = lodash.cloneDeep(array);
|
|
63
61
|
nextArray.splice(index, 1);
|
|
64
62
|
return nextArray;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
return [
|
|
65
|
+
return [...array, item];
|
|
68
66
|
};
|
|
69
67
|
|
|
70
68
|
function runAll() {
|
|
@@ -77,16 +75,16 @@ function runAll() {
|
|
|
77
75
|
args[_key3] = arguments[_key3];
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
return fns.forEach(
|
|
78
|
+
return fns.forEach(fn => {
|
|
81
79
|
if (Array.isArray(fn)) runAll(fn);
|
|
82
|
-
if (lodash.isFunction(fn)) fn
|
|
80
|
+
if (lodash.isFunction(fn)) fn(...args);
|
|
83
81
|
});
|
|
84
82
|
};
|
|
85
83
|
}
|
|
86
84
|
function hashArray(arr, fieldName) {
|
|
87
|
-
return arr.reduce(
|
|
88
|
-
|
|
89
|
-
}, {});
|
|
85
|
+
return arr.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
|
|
86
|
+
[fieldName ? item[fieldName] : item]: true
|
|
87
|
+
}), {});
|
|
90
88
|
}
|
|
91
89
|
function safeCall(fun) {
|
|
92
90
|
if (lodash.isFunction(fun)) {
|
|
@@ -94,249 +92,172 @@ function safeCall(fun) {
|
|
|
94
92
|
args[_key4 - 1] = arguments[_key4];
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
fun
|
|
95
|
+
fun(...args);
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
const removeUndefinedProperties = obj => {
|
|
99
|
+
const cleanObject = _objectSpread({}, obj);
|
|
102
100
|
|
|
103
|
-
Object.keys(obj).forEach(
|
|
104
|
-
return cleanObject[key] === undefined && delete cleanObject[key];
|
|
105
|
-
});
|
|
101
|
+
Object.keys(obj).forEach(key => cleanObject[key] === undefined && delete cleanObject[key]);
|
|
106
102
|
return cleanObject;
|
|
107
103
|
};
|
|
108
104
|
var utils = {};
|
|
109
105
|
|
|
110
106
|
Object.defineProperty(exports, 'cloneDeep', {
|
|
111
107
|
enumerable: true,
|
|
112
|
-
get: function () {
|
|
113
|
-
return lodash.cloneDeep;
|
|
114
|
-
}
|
|
108
|
+
get: function () { return lodash.cloneDeep; }
|
|
115
109
|
});
|
|
116
110
|
Object.defineProperty(exports, 'curry', {
|
|
117
111
|
enumerable: true,
|
|
118
|
-
get: function () {
|
|
119
|
-
return lodash.curry;
|
|
120
|
-
}
|
|
112
|
+
get: function () { return lodash.curry; }
|
|
121
113
|
});
|
|
122
114
|
Object.defineProperty(exports, 'debounce', {
|
|
123
115
|
enumerable: true,
|
|
124
|
-
get: function () {
|
|
125
|
-
return lodash.debounce;
|
|
126
|
-
}
|
|
116
|
+
get: function () { return lodash.debounce; }
|
|
127
117
|
});
|
|
128
118
|
Object.defineProperty(exports, 'differenceBy', {
|
|
129
119
|
enumerable: true,
|
|
130
|
-
get: function () {
|
|
131
|
-
return lodash.differenceBy;
|
|
132
|
-
}
|
|
120
|
+
get: function () { return lodash.differenceBy; }
|
|
133
121
|
});
|
|
134
122
|
Object.defineProperty(exports, 'differenceWith', {
|
|
135
123
|
enumerable: true,
|
|
136
|
-
get: function () {
|
|
137
|
-
return lodash.differenceWith;
|
|
138
|
-
}
|
|
124
|
+
get: function () { return lodash.differenceWith; }
|
|
139
125
|
});
|
|
140
126
|
Object.defineProperty(exports, 'filter', {
|
|
141
127
|
enumerable: true,
|
|
142
|
-
get: function () {
|
|
143
|
-
return lodash.filter;
|
|
144
|
-
}
|
|
128
|
+
get: function () { return lodash.filter; }
|
|
145
129
|
});
|
|
146
130
|
Object.defineProperty(exports, 'findIndex', {
|
|
147
131
|
enumerable: true,
|
|
148
|
-
get: function () {
|
|
149
|
-
return lodash.findIndex;
|
|
150
|
-
}
|
|
132
|
+
get: function () { return lodash.findIndex; }
|
|
151
133
|
});
|
|
152
134
|
Object.defineProperty(exports, 'get', {
|
|
153
135
|
enumerable: true,
|
|
154
|
-
get: function () {
|
|
155
|
-
return lodash.get;
|
|
156
|
-
}
|
|
136
|
+
get: function () { return lodash.get; }
|
|
157
137
|
});
|
|
158
138
|
Object.defineProperty(exports, 'groupBy', {
|
|
159
139
|
enumerable: true,
|
|
160
|
-
get: function () {
|
|
161
|
-
return lodash.groupBy;
|
|
162
|
-
}
|
|
140
|
+
get: function () { return lodash.groupBy; }
|
|
163
141
|
});
|
|
164
142
|
Object.defineProperty(exports, 'isBoolean', {
|
|
165
143
|
enumerable: true,
|
|
166
|
-
get: function () {
|
|
167
|
-
return lodash.isBoolean;
|
|
168
|
-
}
|
|
144
|
+
get: function () { return lodash.isBoolean; }
|
|
169
145
|
});
|
|
170
146
|
Object.defineProperty(exports, 'isEmpty', {
|
|
171
147
|
enumerable: true,
|
|
172
|
-
get: function () {
|
|
173
|
-
return lodash.isEmpty;
|
|
174
|
-
}
|
|
148
|
+
get: function () { return lodash.isEmpty; }
|
|
175
149
|
});
|
|
176
150
|
Object.defineProperty(exports, 'isEqual', {
|
|
177
151
|
enumerable: true,
|
|
178
|
-
get: function () {
|
|
179
|
-
return lodash.isEqual;
|
|
180
|
-
}
|
|
152
|
+
get: function () { return lodash.isEqual; }
|
|
181
153
|
});
|
|
182
154
|
Object.defineProperty(exports, 'isEqualWith', {
|
|
183
155
|
enumerable: true,
|
|
184
|
-
get: function () {
|
|
185
|
-
return lodash.isEqualWith;
|
|
186
|
-
}
|
|
156
|
+
get: function () { return lodash.isEqualWith; }
|
|
187
157
|
});
|
|
188
158
|
Object.defineProperty(exports, 'isFunction', {
|
|
189
159
|
enumerable: true,
|
|
190
|
-
get: function () {
|
|
191
|
-
return lodash.isFunction;
|
|
192
|
-
}
|
|
160
|
+
get: function () { return lodash.isFunction; }
|
|
193
161
|
});
|
|
194
162
|
Object.defineProperty(exports, 'isNaN', {
|
|
195
163
|
enumerable: true,
|
|
196
|
-
get: function () {
|
|
197
|
-
return lodash.isNaN;
|
|
198
|
-
}
|
|
164
|
+
get: function () { return lodash.isNaN; }
|
|
199
165
|
});
|
|
200
166
|
Object.defineProperty(exports, 'isObject', {
|
|
201
167
|
enumerable: true,
|
|
202
|
-
get: function () {
|
|
203
|
-
return lodash.isObject;
|
|
204
|
-
}
|
|
168
|
+
get: function () { return lodash.isObject; }
|
|
205
169
|
});
|
|
206
170
|
Object.defineProperty(exports, 'isString', {
|
|
207
171
|
enumerable: true,
|
|
208
|
-
get: function () {
|
|
209
|
-
return lodash.isString;
|
|
210
|
-
}
|
|
172
|
+
get: function () { return lodash.isString; }
|
|
211
173
|
});
|
|
212
174
|
Object.defineProperty(exports, 'maxBy', {
|
|
213
175
|
enumerable: true,
|
|
214
|
-
get: function () {
|
|
215
|
-
return lodash.maxBy;
|
|
216
|
-
}
|
|
176
|
+
get: function () { return lodash.maxBy; }
|
|
217
177
|
});
|
|
218
178
|
Object.defineProperty(exports, 'meanBy', {
|
|
219
179
|
enumerable: true,
|
|
220
|
-
get: function () {
|
|
221
|
-
return lodash.meanBy;
|
|
222
|
-
}
|
|
180
|
+
get: function () { return lodash.meanBy; }
|
|
223
181
|
});
|
|
224
182
|
Object.defineProperty(exports, 'noop', {
|
|
225
183
|
enumerable: true,
|
|
226
|
-
get: function () {
|
|
227
|
-
return lodash.noop;
|
|
228
|
-
}
|
|
184
|
+
get: function () { return lodash.noop; }
|
|
229
185
|
});
|
|
230
186
|
Object.defineProperty(exports, 'omit', {
|
|
231
187
|
enumerable: true,
|
|
232
|
-
get: function () {
|
|
233
|
-
return lodash.omit;
|
|
234
|
-
}
|
|
188
|
+
get: function () { return lodash.omit; }
|
|
235
189
|
});
|
|
236
190
|
Object.defineProperty(exports, 'orderBy', {
|
|
237
191
|
enumerable: true,
|
|
238
|
-
get: function () {
|
|
239
|
-
return lodash.orderBy;
|
|
240
|
-
}
|
|
192
|
+
get: function () { return lodash.orderBy; }
|
|
241
193
|
});
|
|
242
194
|
Object.defineProperty(exports, 'padStart', {
|
|
243
195
|
enumerable: true,
|
|
244
|
-
get: function () {
|
|
245
|
-
return lodash.padStart;
|
|
246
|
-
}
|
|
196
|
+
get: function () { return lodash.padStart; }
|
|
247
197
|
});
|
|
248
198
|
Object.defineProperty(exports, 'parseInt', {
|
|
249
199
|
enumerable: true,
|
|
250
|
-
get: function () {
|
|
251
|
-
return lodash.parseInt;
|
|
252
|
-
}
|
|
200
|
+
get: function () { return lodash.parseInt; }
|
|
253
201
|
});
|
|
254
202
|
Object.defineProperty(exports, 'pick', {
|
|
255
203
|
enumerable: true,
|
|
256
|
-
get: function () {
|
|
257
|
-
return lodash.pick;
|
|
258
|
-
}
|
|
204
|
+
get: function () { return lodash.pick; }
|
|
259
205
|
});
|
|
260
206
|
Object.defineProperty(exports, 'pickBy', {
|
|
261
207
|
enumerable: true,
|
|
262
|
-
get: function () {
|
|
263
|
-
return lodash.pickBy;
|
|
264
|
-
}
|
|
208
|
+
get: function () { return lodash.pickBy; }
|
|
265
209
|
});
|
|
266
210
|
Object.defineProperty(exports, 'property', {
|
|
267
211
|
enumerable: true,
|
|
268
|
-
get: function () {
|
|
269
|
-
return lodash.property;
|
|
270
|
-
}
|
|
212
|
+
get: function () { return lodash.property; }
|
|
271
213
|
});
|
|
272
214
|
Object.defineProperty(exports, 'pull', {
|
|
273
215
|
enumerable: true,
|
|
274
|
-
get: function () {
|
|
275
|
-
return lodash.pull;
|
|
276
|
-
}
|
|
216
|
+
get: function () { return lodash.pull; }
|
|
277
217
|
});
|
|
278
218
|
Object.defineProperty(exports, 'range', {
|
|
279
219
|
enumerable: true,
|
|
280
|
-
get: function () {
|
|
281
|
-
return lodash.range;
|
|
282
|
-
}
|
|
220
|
+
get: function () { return lodash.range; }
|
|
283
221
|
});
|
|
284
222
|
Object.defineProperty(exports, 'set', {
|
|
285
223
|
enumerable: true,
|
|
286
|
-
get: function () {
|
|
287
|
-
return lodash.set;
|
|
288
|
-
}
|
|
224
|
+
get: function () { return lodash.set; }
|
|
289
225
|
});
|
|
290
226
|
Object.defineProperty(exports, 'sortBy', {
|
|
291
227
|
enumerable: true,
|
|
292
|
-
get: function () {
|
|
293
|
-
return lodash.sortBy;
|
|
294
|
-
}
|
|
228
|
+
get: function () { return lodash.sortBy; }
|
|
295
229
|
});
|
|
296
230
|
Object.defineProperty(exports, 'sumBy', {
|
|
297
231
|
enumerable: true,
|
|
298
|
-
get: function () {
|
|
299
|
-
return lodash.sumBy;
|
|
300
|
-
}
|
|
232
|
+
get: function () { return lodash.sumBy; }
|
|
301
233
|
});
|
|
302
234
|
Object.defineProperty(exports, 'throttle', {
|
|
303
235
|
enumerable: true,
|
|
304
|
-
get: function () {
|
|
305
|
-
return lodash.throttle;
|
|
306
|
-
}
|
|
236
|
+
get: function () { return lodash.throttle; }
|
|
307
237
|
});
|
|
308
238
|
Object.defineProperty(exports, 'transform', {
|
|
309
239
|
enumerable: true,
|
|
310
|
-
get: function () {
|
|
311
|
-
return lodash.transform;
|
|
312
|
-
}
|
|
240
|
+
get: function () { return lodash.transform; }
|
|
313
241
|
});
|
|
314
242
|
Object.defineProperty(exports, 'uniq', {
|
|
315
243
|
enumerable: true,
|
|
316
|
-
get: function () {
|
|
317
|
-
return lodash.uniq;
|
|
318
|
-
}
|
|
244
|
+
get: function () { return lodash.uniq; }
|
|
319
245
|
});
|
|
320
246
|
Object.defineProperty(exports, 'uniqBy', {
|
|
321
247
|
enumerable: true,
|
|
322
|
-
get: function () {
|
|
323
|
-
return lodash.uniqBy;
|
|
324
|
-
}
|
|
248
|
+
get: function () { return lodash.uniqBy; }
|
|
325
249
|
});
|
|
326
250
|
Object.defineProperty(exports, 'values', {
|
|
327
251
|
enumerable: true,
|
|
328
|
-
get: function () {
|
|
329
|
-
return lodash.values;
|
|
330
|
-
}
|
|
252
|
+
get: function () { return lodash.values; }
|
|
331
253
|
});
|
|
332
254
|
exports.addOrRemove = addOrRemove;
|
|
333
255
|
exports.arrayMove = arrayMove;
|
|
334
256
|
exports.cx = cx;
|
|
335
|
-
exports[
|
|
257
|
+
exports["default"] = utils;
|
|
336
258
|
exports.hashArray = hashArray;
|
|
337
259
|
exports.removeUndefinedProperties = removeUndefinedProperties;
|
|
338
260
|
exports.runAll = runAll;
|
|
339
261
|
exports.safeCall = safeCall;
|
|
340
262
|
exports.toggleInArray = toggleInArray;
|
|
341
263
|
exports.toggleInObject = toggleInObject;
|
|
342
|
-
//# sourceMappingURL=utils.js.map
|
package/cjs/validations.js
CHANGED
|
@@ -3,34 +3,35 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var operators = require('./operators.js');
|
|
6
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
7
|
-
require('lodash');
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const isRequired = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
value,
|
|
10
|
+
help = 'Field is Required'
|
|
11
|
+
} = _ref;
|
|
13
12
|
return {
|
|
14
13
|
payload: help,
|
|
15
14
|
error: operators.checkNotEmpty(value)
|
|
16
15
|
};
|
|
17
16
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const isGreaterThan = _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
value,
|
|
20
|
+
help,
|
|
21
|
+
comparator = 0
|
|
22
|
+
} = _ref2;
|
|
23
23
|
if (!help) help = "Max value ".concat(comparator);
|
|
24
24
|
return {
|
|
25
25
|
payload: help,
|
|
26
26
|
error: operators.greaterThan(value, comparator)
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const isValidDate = _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
value,
|
|
32
|
+
help,
|
|
33
|
+
format = 'MM/DD/AAA'
|
|
34
|
+
} = _ref3;
|
|
34
35
|
if (!help) help = "Valid Date is required ".concat(format);
|
|
35
36
|
return {
|
|
36
37
|
payload: help,
|
|
@@ -41,4 +42,3 @@ var isValidDate = function isValidDate(_ref3) {
|
|
|
41
42
|
exports.isGreaterThan = isGreaterThan;
|
|
42
43
|
exports.isRequired = isRequired;
|
|
43
44
|
exports.isValidDate = isValidDate;
|
|
44
|
-
//# sourceMappingURL=validations.js.map
|
package/esm/compose.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Composes single-argument functions from right to left. The rightmost
|
|
3
8
|
* function can take multiple arguments as it provides the signature for
|
|
@@ -14,21 +19,16 @@ function compose() {
|
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
if (funcs.length === 0) {
|
|
17
|
-
return
|
|
18
|
-
return arg;
|
|
19
|
-
};
|
|
22
|
+
return arg => arg;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
if (funcs.length === 1) {
|
|
23
26
|
return funcs[0];
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
return funcs.reduce(
|
|
27
|
-
return
|
|
28
|
-
return a(b.apply(void 0, arguments));
|
|
29
|
-
};
|
|
29
|
+
return funcs.reduce((a, b) => function () {
|
|
30
|
+
return a(b(...arguments));
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export { compose };
|
|
34
|
-
//# sourceMappingURL=compose.js.map
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
2
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
8
|
import React from 'react';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
10
|
|
|
5
11
|
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; }
|
|
6
12
|
|
|
7
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
14
|
function getComponentFromProps(Component, props) {
|
|
9
|
-
|
|
15
|
+
let children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
10
16
|
if (!Component) return null;
|
|
11
|
-
|
|
12
|
-
return typeof Component === 'function' ? /*#__PURE__*/
|
|
17
|
+
const componentChildren = Component.props ? Array.isArray(Component.props.children) ? Component.props.children : [Component.props.children] : null;
|
|
18
|
+
return typeof Component === 'function' ? /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
|
|
19
|
+
children: children
|
|
20
|
+
})) : /*#__PURE__*/React.cloneElement(Component, _objectSpread(_objectSpread({}, Component.props), props), componentChildren ? [...componentChildren, ...children] : [...children]);
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
export { getComponentFromProps as default };
|
|
16
|
-
//# sourceMappingURL=getComponentFromProps.js.map
|
package/esm/hooks/index.js
CHANGED
|
@@ -9,19 +9,10 @@ export { default as useWindowScrollerList } from './useWindowScrollerList.js';
|
|
|
9
9
|
export { default as useWindowSize } from './useWindowSize.js';
|
|
10
10
|
export { default as useForceUpdate } from 'use-force-update';
|
|
11
11
|
export { default as useOnClickOutside } from 'use-onclickoutside';
|
|
12
|
-
export {
|
|
12
|
+
export { useUncontrolled } from 'uncontrollable';
|
|
13
13
|
export { default as usePrevious } from './usePrevious.js';
|
|
14
14
|
export { default as useCancellableDelayedCallback } from './useCancellableDelayedCallback.js';
|
|
15
15
|
export { default as useDerivedStateFromProps } from './useDerivedStateFromProps.js';
|
|
16
16
|
export { useSetRef } from './useSetRef.js';
|
|
17
17
|
export { useParentElement } from './useParentElement.js';
|
|
18
18
|
export { useOnElementResize } from './useOnElementResize.js';
|
|
19
|
-
import 'react';
|
|
20
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
21
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
22
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
23
|
-
import 'lodash';
|
|
24
|
-
import 'hotkeys-js';
|
|
25
|
-
import 'raf';
|
|
26
|
-
import 'resize-observer-polyfill';
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useRef, useCallback } from 'react';
|
|
2
3
|
|
|
3
4
|
function useCancellableDelayedCallback(cb, delay) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const timeoutRef = useRef();
|
|
6
|
+
const cancel = useCallback(() => {
|
|
7
|
+
const timeoutId = timeoutRef.current;
|
|
7
8
|
|
|
8
9
|
if (timeoutId) {
|
|
9
10
|
timeoutRef.current = undefined;
|
|
10
11
|
clearTimeout(timeoutId);
|
|
11
12
|
}
|
|
12
13
|
}, [timeoutRef]);
|
|
13
|
-
|
|
14
|
+
const delayedCb = useCallback(function () {
|
|
14
15
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
16
|
args[_key] = arguments[_key];
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
timeoutRef.current = setTimeout(
|
|
19
|
-
return cb.apply(void 0, args);
|
|
20
|
-
}, delay);
|
|
19
|
+
timeoutRef.current = setTimeout(() => cb(...args), delay);
|
|
21
20
|
}, [cb, delay]);
|
|
22
21
|
return [delayedCb, cancel];
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export { useCancellableDelayedCallback as default };
|
|
26
|
-
//# sourceMappingURL=useCancellableDelayedCallback.js.map
|
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
2
|
import { useState, useRef } from 'react';
|
|
3
|
-
import '
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
5
|
import '@babel/runtime/helpers/esm/defineProperty';
|
|
5
|
-
import
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
11
|
+
import { isFunction, isEqual } from 'lodash';
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
return prop;
|
|
9
|
-
};
|
|
13
|
+
const defaultPropUpdateOnChange = prop => prop;
|
|
10
14
|
|
|
11
15
|
function defaultShouldUpdate(_ref) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
let {
|
|
17
|
+
prop,
|
|
18
|
+
prevProp,
|
|
19
|
+
stateValue
|
|
20
|
+
} = _ref;
|
|
15
21
|
return !isEqual(prop, prevProp) && !isEqual(prop, stateValue);
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
function setStateWithUpdate(onUpdate, setState) {
|
|
19
|
-
return
|
|
20
|
-
setState(
|
|
21
|
-
return onUpdate(isFunction(state) ? state(prevState) : state, prevState);
|
|
22
|
-
});
|
|
25
|
+
return state => {
|
|
26
|
+
setState(prevState => onUpdate(isFunction(state) ? state(prevState) : state, prevState));
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
function useDerivedStateFromProp(prop) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
-
stateValue = _useState2[0],
|
|
38
|
-
setState = _useState2[1];
|
|
39
|
-
|
|
40
|
-
var handleSetState = updateOnStateChange ? setStateWithUpdate(onUpdate, setState) : setState;
|
|
41
|
-
var prevProp = useRef(prop);
|
|
31
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
32
|
+
const {
|
|
33
|
+
onUpdate = defaultPropUpdateOnChange,
|
|
34
|
+
shouldUpdate = defaultShouldUpdate,
|
|
35
|
+
updateOnStateChange = false
|
|
36
|
+
} = options;
|
|
37
|
+
const [stateValue, setState] = useState(onUpdate(prop, {}));
|
|
38
|
+
const handleSetState = updateOnStateChange ? setStateWithUpdate(onUpdate, setState) : setState;
|
|
39
|
+
const prevProp = useRef(prop);
|
|
42
40
|
|
|
43
41
|
if (shouldUpdate({
|
|
44
|
-
prop
|
|
42
|
+
prop,
|
|
45
43
|
prevProp: prevProp.current,
|
|
46
|
-
stateValue
|
|
44
|
+
stateValue
|
|
47
45
|
})) {
|
|
48
|
-
|
|
46
|
+
const nextProp = onUpdate(prop, prevProp.current);
|
|
49
47
|
setState(nextProp);
|
|
50
48
|
}
|
|
51
49
|
|
|
@@ -54,4 +52,3 @@ function useDerivedStateFromProp(prop) {
|
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
export { useDerivedStateFromProp as default };
|
|
57
|
-
//# sourceMappingURL=useDerivedStateFromProps.js.map
|