@elliemae/ds-utilities 2.2.0-alpha.3 → 3.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/capitalize.js +7 -35
- package/cjs/compose.js +32 -39
- package/cjs/getComponentFromProps.js +29 -47
- package/cjs/hooks/index.js +60 -68
- package/cjs/hooks/useCancellableDelayedCallback.js +18 -43
- package/cjs/hooks/useDerivedStateFromProps.js +36 -47
- package/cjs/hooks/useExecutionTimer.js +24 -43
- package/cjs/hooks/useExpandState.js +82 -69
- package/cjs/hooks/useHotkeys.js +24 -44
- package/cjs/hooks/useHoverHandlersDelay.js +18 -48
- package/cjs/hooks/useOnElementResize.js +27 -44
- package/cjs/hooks/useParentElement.js +13 -40
- package/cjs/hooks/usePrevious.js +10 -41
- package/cjs/hooks/useResizeObserver.js +25 -52
- package/cjs/hooks/useSetRef.js +11 -38
- package/cjs/hooks/useShouldRecalculate.js +14 -41
- package/cjs/hooks/useWindowScrollerList.js +33 -51
- package/cjs/hooks/useWindowSize.js +19 -49
- package/cjs/index.js +266 -145
- package/cjs/onClickHandlerForNonInteractiveElements.js +19 -46
- package/cjs/operators.js +51 -56
- package/cjs/platform.js +9 -37
- package/cjs/reactTypesUtility.js +22 -45
- package/cjs/scrollingTimer.js +15 -37
- package/cjs/system.js +30 -47
- package/cjs/timeUtils.js +24 -42
- package/cjs/utils.js +237 -101
- package/cjs/validations.js +35 -48
- package/esm/capitalize.js +3 -6
- package/esm/compose.js +29 -11
- package/esm/getComponentFromProps.js +22 -18
- package/esm/hooks/index.js +18 -40
- package/esm/hooks/useCancellableDelayedCallback.js +14 -12
- package/esm/hooks/useDerivedStateFromProps.js +31 -15
- package/esm/hooks/useExecutionTimer.js +20 -12
- package/esm/hooks/useExpandState.js +72 -36
- package/esm/hooks/useHotkeys.js +14 -11
- package/esm/hooks/useHoverHandlersDelay.js +12 -15
- package/esm/hooks/useOnElementResize.js +20 -12
- package/esm/hooks/useParentElement.js +7 -9
- package/esm/hooks/usePrevious.js +6 -10
- package/esm/hooks/useResizeObserver.js +15 -20
- package/esm/hooks/useSetRef.js +6 -8
- package/esm/hooks/useShouldRecalculate.js +11 -11
- package/esm/hooks/useWindowScrollerList.js +29 -20
- package/esm/hooks/useWindowSize.js +15 -18
- package/esm/index.js +31 -204
- package/esm/onClickHandlerForNonInteractiveElements.js +17 -17
- package/esm/operators.js +34 -27
- package/esm/platform.js +4 -8
- package/esm/reactTypesUtility.js +9 -16
- package/esm/scrollingTimer.js +11 -8
- package/esm/system.js +22 -16
- package/esm/timeUtils.js +19 -13
- package/esm/utils.js +72 -109
- package/esm/validations.js +28 -18
- package/package.json +1 -1
- package/types/compose.d.ts +1 -2
- package/types/getComponentFromProps.d.ts +1 -2
- package/types/hooks/index.d.ts +14 -14
- package/types/hooks/useCancellableDelayedCallback.d.ts +1 -2
- package/types/hooks/useDerivedStateFromProps.d.ts +1 -2
- package/types/hooks/useExecutionTimer.d.ts +1 -2
- package/types/hooks/useExpandState.d.ts +2 -3
- package/types/hooks/useHotkeys.d.ts +2 -3
- package/types/hooks/useHoverHandlersDelay.d.ts +2 -3
- package/types/hooks/usePrevious.d.ts +1 -1
- package/types/hooks/useResizeObserver.d.ts +1 -2
- package/types/hooks/useShouldRecalculate.d.ts +1 -2
- package/types/hooks/useWindowScrollerList.d.ts +2 -3
- package/types/hooks/useWindowSize.d.ts +1 -2
- package/types/index.d.ts +11 -11
- package/types/onClickHandlerForNonInteractiveElements.d.ts +7 -7
- package/types/scrollingTimer.d.ts +1 -1
- package/cjs/capitalize.js.map +0 -7
- package/cjs/compose.js.map +0 -7
- package/cjs/getComponentFromProps.js.map +0 -7
- package/cjs/hooks/index.js.map +0 -7
- package/cjs/hooks/useCancellableDelayedCallback.js.map +0 -7
- package/cjs/hooks/useDerivedStateFromProps.js.map +0 -7
- package/cjs/hooks/useExecutionTimer.js.map +0 -7
- package/cjs/hooks/useExpandState.js.map +0 -7
- package/cjs/hooks/useHotkeys.js.map +0 -7
- package/cjs/hooks/useHoverHandlersDelay.js.map +0 -7
- package/cjs/hooks/useOnElementResize.js.map +0 -7
- package/cjs/hooks/useParentElement.js.map +0 -7
- package/cjs/hooks/usePrevious.js.map +0 -7
- package/cjs/hooks/useResizeObserver.js.map +0 -7
- package/cjs/hooks/useSetRef.js.map +0 -7
- package/cjs/hooks/useShouldRecalculate.js.map +0 -7
- package/cjs/hooks/useWindowScrollerList.js.map +0 -7
- package/cjs/hooks/useWindowSize.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/onClickHandlerForNonInteractiveElements.js.map +0 -7
- package/cjs/operators.js.map +0 -7
- package/cjs/platform.js.map +0 -7
- package/cjs/reactTypesUtility.js.map +0 -7
- package/cjs/scrollingTimer.js.map +0 -7
- package/cjs/system.js.map +0 -7
- package/cjs/timeUtils.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/cjs/validations.js.map +0 -7
- package/esm/capitalize.js.map +0 -7
- package/esm/compose.js.map +0 -7
- package/esm/getComponentFromProps.js.map +0 -7
- package/esm/hooks/index.js.map +0 -7
- package/esm/hooks/useCancellableDelayedCallback.js.map +0 -7
- package/esm/hooks/useDerivedStateFromProps.js.map +0 -7
- package/esm/hooks/useExecutionTimer.js.map +0 -7
- package/esm/hooks/useExpandState.js.map +0 -7
- package/esm/hooks/useHotkeys.js.map +0 -7
- package/esm/hooks/useHoverHandlersDelay.js.map +0 -7
- package/esm/hooks/useOnElementResize.js.map +0 -7
- package/esm/hooks/useParentElement.js.map +0 -7
- package/esm/hooks/usePrevious.js.map +0 -7
- package/esm/hooks/useResizeObserver.js.map +0 -7
- package/esm/hooks/useSetRef.js.map +0 -7
- package/esm/hooks/useShouldRecalculate.js.map +0 -7
- package/esm/hooks/useWindowScrollerList.js.map +0 -7
- package/esm/hooks/useWindowSize.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/onClickHandlerForNonInteractiveElements.js.map +0 -7
- package/esm/operators.js.map +0 -7
- package/esm/platform.js.map +0 -7
- package/esm/reactTypesUtility.js.map +0 -7
- package/esm/scrollingTimer.js.map +0 -7
- package/esm/system.js.map +0 -7
- package/esm/timeUtils.js.map +0 -7
- package/esm/utils.js.map +0 -7
- package/esm/validations.js.map +0 -7
package/cjs/utils.js
CHANGED
|
@@ -1,127 +1,263 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
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');
|
|
14
|
+
var lodash = require('lodash');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
/**
|
|
24
|
+
* Concatenates classNames from arguments
|
|
25
|
+
*
|
|
26
|
+
* @param {...any} classnames
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const cx = function () {
|
|
30
|
+
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
classnames[_key] = arguments[_key];
|
|
17
32
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
addOrRemove: () => addOrRemove,
|
|
31
|
-
arrayMove: () => arrayMove,
|
|
32
|
-
cloneDeep: () => import_lodash.cloneDeep,
|
|
33
|
-
curry: () => import_lodash.curry,
|
|
34
|
-
cx: () => cx,
|
|
35
|
-
debounce: () => import_lodash.debounce,
|
|
36
|
-
default: () => utils_default,
|
|
37
|
-
differenceBy: () => import_lodash.differenceBy,
|
|
38
|
-
differenceWith: () => import_lodash.differenceWith,
|
|
39
|
-
filter: () => import_lodash.filter,
|
|
40
|
-
findIndex: () => import_lodash.findIndex,
|
|
41
|
-
get: () => import_lodash.get,
|
|
42
|
-
groupBy: () => import_lodash.groupBy,
|
|
43
|
-
hashArray: () => hashArray,
|
|
44
|
-
isBoolean: () => import_lodash.isBoolean,
|
|
45
|
-
isEmpty: () => import_lodash.isEmpty,
|
|
46
|
-
isEqual: () => import_lodash.isEqual,
|
|
47
|
-
isEqualWith: () => import_lodash.isEqualWith,
|
|
48
|
-
isFunction: () => import_lodash.isFunction,
|
|
49
|
-
isNaN: () => import_lodash.isNaN,
|
|
50
|
-
isObject: () => import_lodash.isObject,
|
|
51
|
-
isString: () => import_lodash.isString,
|
|
52
|
-
maxBy: () => import_lodash.maxBy,
|
|
53
|
-
meanBy: () => import_lodash.meanBy,
|
|
54
|
-
noop: () => import_lodash.noop,
|
|
55
|
-
omit: () => import_lodash.omit,
|
|
56
|
-
orderBy: () => import_lodash.orderBy,
|
|
57
|
-
padStart: () => import_lodash.padStart,
|
|
58
|
-
parseInt: () => import_lodash.parseInt,
|
|
59
|
-
pick: () => import_lodash.pick,
|
|
60
|
-
pickBy: () => import_lodash.pickBy,
|
|
61
|
-
property: () => import_lodash.property,
|
|
62
|
-
pull: () => import_lodash.pull,
|
|
63
|
-
range: () => import_lodash.range,
|
|
64
|
-
removeUndefinedProperties: () => removeUndefinedProperties,
|
|
65
|
-
runAll: () => runAll,
|
|
66
|
-
safeCall: () => safeCall,
|
|
67
|
-
set: () => import_lodash.set,
|
|
68
|
-
sortBy: () => import_lodash.sortBy,
|
|
69
|
-
sumBy: () => import_lodash.sumBy,
|
|
70
|
-
throttle: () => import_lodash.throttle,
|
|
71
|
-
toggleInArray: () => toggleInArray,
|
|
72
|
-
toggleInObject: () => toggleInObject,
|
|
73
|
-
transform: () => import_lodash.transform,
|
|
74
|
-
uniq: () => import_lodash.uniq,
|
|
75
|
-
uniqBy: () => import_lodash.uniqBy,
|
|
76
|
-
values: () => import_lodash.values
|
|
77
|
-
});
|
|
78
|
-
var React = __toESM(require("react"));
|
|
79
|
-
var import_lodash = __toESM(require("lodash"));
|
|
80
|
-
const cx = (...classnames) => classnames.reduce((result, cn) => `${result} ${cn || ""}`, "");
|
|
81
|
-
const toggleInObject = (obj, key, value) => obj[key] !== void 0 ? (0, import_lodash.omit)(obj, [key]) : { ...obj, [key]: value };
|
|
33
|
+
|
|
34
|
+
return classnames.reduce((result, cn) => "".concat(result, " ").concat(cn || ''), '');
|
|
35
|
+
}; // if entry exists, remove it, if not, add it
|
|
36
|
+
|
|
37
|
+
const toggleInObject = (obj, key, value) => obj[key] !== undefined ? lodash.omit(obj, [key]) : _objectSpread(_objectSpread({}, obj), {}, {
|
|
38
|
+
[key]: value
|
|
39
|
+
});
|
|
40
|
+
|
|
82
41
|
const toggleInArray = (array, value) => array.indexOf(value) === -1 ? [value] : [];
|
|
42
|
+
|
|
83
43
|
const arrayMoveMutate = (array, from, to) => {
|
|
84
44
|
array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
|
|
85
45
|
};
|
|
46
|
+
|
|
86
47
|
const arrayMove = (array, from, to) => {
|
|
87
48
|
array = array.slice();
|
|
88
49
|
arrayMoveMutate(array, from, to);
|
|
89
50
|
return array;
|
|
90
51
|
};
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
52
|
+
|
|
53
|
+
const accessorDefault = item => item;
|
|
54
|
+
|
|
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));
|
|
58
|
+
|
|
94
59
|
if (index !== -1) {
|
|
95
|
-
const nextArray =
|
|
60
|
+
const nextArray = lodash.cloneDeep(array);
|
|
96
61
|
nextArray.splice(index, 1);
|
|
97
62
|
return nextArray;
|
|
98
63
|
}
|
|
64
|
+
|
|
99
65
|
return [...array, item];
|
|
100
66
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
67
|
+
|
|
68
|
+
function runAll() {
|
|
69
|
+
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
70
|
+
fns[_key2] = arguments[_key2];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return function () {
|
|
74
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
75
|
+
args[_key3] = arguments[_key3];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return fns.forEach(fn => {
|
|
79
|
+
if (Array.isArray(fn)) runAll(fn);
|
|
80
|
+
if (lodash.isFunction(fn)) fn(...args);
|
|
81
|
+
});
|
|
82
|
+
};
|
|
108
83
|
}
|
|
109
84
|
function hashArray(arr, fieldName) {
|
|
110
|
-
return arr.reduce((result, item) => ({
|
|
111
|
-
...result,
|
|
85
|
+
return arr.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
|
|
112
86
|
[fieldName ? item[fieldName] : item]: true
|
|
113
87
|
}), {});
|
|
114
88
|
}
|
|
115
|
-
function safeCall(fun
|
|
116
|
-
if (
|
|
89
|
+
function safeCall(fun) {
|
|
90
|
+
if (lodash.isFunction(fun)) {
|
|
91
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
92
|
+
args[_key4 - 1] = arguments[_key4];
|
|
93
|
+
}
|
|
94
|
+
|
|
117
95
|
fun(...args);
|
|
118
96
|
}
|
|
119
97
|
}
|
|
120
|
-
const removeUndefinedProperties =
|
|
121
|
-
const cleanObject = {
|
|
122
|
-
|
|
98
|
+
const removeUndefinedProperties = obj => {
|
|
99
|
+
const cleanObject = _objectSpread({}, obj);
|
|
100
|
+
|
|
101
|
+
Object.keys(obj).forEach(key => cleanObject[key] === undefined && delete cleanObject[key]);
|
|
123
102
|
return cleanObject;
|
|
124
103
|
};
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
104
|
+
var utils = {};
|
|
105
|
+
|
|
106
|
+
Object.defineProperty(exports, 'cloneDeep', {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: function () { return lodash.cloneDeep; }
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(exports, 'curry', {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function () { return lodash.curry; }
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, 'debounce', {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () { return lodash.debounce; }
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(exports, 'differenceBy', {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function () { return lodash.differenceBy; }
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, 'differenceWith', {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function () { return lodash.differenceWith; }
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, 'filter', {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () { return lodash.filter; }
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(exports, 'findIndex', {
|
|
131
|
+
enumerable: true,
|
|
132
|
+
get: function () { return lodash.findIndex; }
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(exports, 'get', {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function () { return lodash.get; }
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, 'groupBy', {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () { return lodash.groupBy; }
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(exports, 'isBoolean', {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () { return lodash.isBoolean; }
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(exports, 'isEmpty', {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () { return lodash.isEmpty; }
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, 'isEqual', {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () { return lodash.isEqual; }
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(exports, 'isEqualWith', {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function () { return lodash.isEqualWith; }
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, 'isFunction', {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: function () { return lodash.isFunction; }
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, 'isNaN', {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () { return lodash.isNaN; }
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(exports, 'isObject', {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function () { return lodash.isObject; }
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, 'isString', {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function () { return lodash.isString; }
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, 'maxBy', {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () { return lodash.maxBy; }
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(exports, 'meanBy', {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: function () { return lodash.meanBy; }
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, 'noop', {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function () { return lodash.noop; }
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, 'omit', {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () { return lodash.omit; }
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(exports, 'orderBy', {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: function () { return lodash.orderBy; }
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(exports, 'padStart', {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () { return lodash.padStart; }
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, 'parseInt', {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () { return lodash.parseInt; }
|
|
201
|
+
});
|
|
202
|
+
Object.defineProperty(exports, 'pick', {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
get: function () { return lodash.pick; }
|
|
205
|
+
});
|
|
206
|
+
Object.defineProperty(exports, 'pickBy', {
|
|
207
|
+
enumerable: true,
|
|
208
|
+
get: function () { return lodash.pickBy; }
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, 'property', {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function () { return lodash.property; }
|
|
213
|
+
});
|
|
214
|
+
Object.defineProperty(exports, 'pull', {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
get: function () { return lodash.pull; }
|
|
217
|
+
});
|
|
218
|
+
Object.defineProperty(exports, 'range', {
|
|
219
|
+
enumerable: true,
|
|
220
|
+
get: function () { return lodash.range; }
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, 'set', {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () { return lodash.set; }
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(exports, 'sortBy', {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
get: function () { return lodash.sortBy; }
|
|
229
|
+
});
|
|
230
|
+
Object.defineProperty(exports, 'sumBy', {
|
|
231
|
+
enumerable: true,
|
|
232
|
+
get: function () { return lodash.sumBy; }
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(exports, 'throttle', {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function () { return lodash.throttle; }
|
|
237
|
+
});
|
|
238
|
+
Object.defineProperty(exports, 'transform', {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
get: function () { return lodash.transform; }
|
|
241
|
+
});
|
|
242
|
+
Object.defineProperty(exports, 'uniq', {
|
|
243
|
+
enumerable: true,
|
|
244
|
+
get: function () { return lodash.uniq; }
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, 'uniqBy', {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function () { return lodash.uniqBy; }
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(exports, 'values', {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: function () { return lodash.values; }
|
|
253
|
+
});
|
|
254
|
+
exports.addOrRemove = addOrRemove;
|
|
255
|
+
exports.arrayMove = arrayMove;
|
|
256
|
+
exports.cx = cx;
|
|
257
|
+
exports["default"] = utils;
|
|
258
|
+
exports.hashArray = hashArray;
|
|
259
|
+
exports.removeUndefinedProperties = removeUndefinedProperties;
|
|
260
|
+
exports.runAll = runAll;
|
|
261
|
+
exports.safeCall = safeCall;
|
|
262
|
+
exports.toggleInArray = toggleInArray;
|
|
263
|
+
exports.toggleInObject = toggleInObject;
|
package/cjs/validations.js
CHANGED
|
@@ -1,57 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var operators = require('./operators.js');
|
|
6
|
+
|
|
7
|
+
const isRequired = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
value,
|
|
10
|
+
help = 'Field is Required'
|
|
11
|
+
} = _ref;
|
|
12
|
+
return {
|
|
13
|
+
payload: help,
|
|
14
|
+
error: operators.checkNotEmpty(value)
|
|
26
15
|
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var import_operators = __toESM(require("./operators"));
|
|
36
|
-
const isRequired = ({ value, help = "Field is Required" }) => ({
|
|
37
|
-
payload: help,
|
|
38
|
-
error: (0, import_operators.checkNotEmpty)(value)
|
|
39
|
-
});
|
|
40
|
-
const isGreaterThan = ({ value, help, comparator = 0 }) => {
|
|
41
|
-
if (!help)
|
|
42
|
-
help = `Max value ${comparator}`;
|
|
16
|
+
};
|
|
17
|
+
const isGreaterThan = _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
value,
|
|
20
|
+
help,
|
|
21
|
+
comparator = 0
|
|
22
|
+
} = _ref2;
|
|
23
|
+
if (!help) help = "Max value ".concat(comparator);
|
|
43
24
|
return {
|
|
44
25
|
payload: help,
|
|
45
|
-
error:
|
|
26
|
+
error: operators.greaterThan(value, comparator)
|
|
46
27
|
};
|
|
47
28
|
};
|
|
48
|
-
const isValidDate =
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
const isValidDate = _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
value,
|
|
32
|
+
help,
|
|
33
|
+
format = 'MM/DD/AAA'
|
|
34
|
+
} = _ref3;
|
|
35
|
+
if (!help) help = "Valid Date is required ".concat(format);
|
|
51
36
|
return {
|
|
52
37
|
payload: help,
|
|
53
|
-
error: !
|
|
38
|
+
error: !operators.validDate(value)
|
|
54
39
|
};
|
|
55
40
|
};
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
|
|
42
|
+
exports.isGreaterThan = isGreaterThan;
|
|
43
|
+
exports.isRequired = isRequired;
|
|
44
|
+
exports.isValidDate = isValidDate;
|
package/esm/capitalize.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
capitalize
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=capitalize.js.map
|
|
1
|
+
const capitalize = string => string.charAt(0).toUpperCase() + string.slice(1);
|
|
2
|
+
|
|
3
|
+
export { capitalize };
|
package/esm/compose.js
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Composes single-argument functions from right to left. The rightmost
|
|
8
|
+
* function can take multiple arguments as it provides the signature for
|
|
9
|
+
* the resulting composite function. [From redux v4.0.5]
|
|
10
|
+
*
|
|
11
|
+
* @param {...Function} funcs The functions to compose.
|
|
12
|
+
* @returns {Function} A function obtained by composing the argument functions
|
|
13
|
+
* from right to left. For example, compose(f, g, h) is identical to doing
|
|
14
|
+
* (...args) => f(g(h(...args))).
|
|
15
|
+
*/
|
|
16
|
+
function compose() {
|
|
17
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
funcs[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
3
21
|
if (funcs.length === 0) {
|
|
4
|
-
return
|
|
22
|
+
return arg => arg;
|
|
5
23
|
}
|
|
24
|
+
|
|
6
25
|
if (funcs.length === 1) {
|
|
7
26
|
return funcs[0];
|
|
8
27
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=compose.js.map
|
|
28
|
+
|
|
29
|
+
return funcs.reduce((a, b) => function () {
|
|
30
|
+
return a(b(...arguments));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { compose };
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
+
function getComponentFromProps(Component, props) {
|
|
15
|
+
let children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
16
|
+
if (!Component) return null;
|
|
6
17
|
const componentChildren = Component.props ? Array.isArray(Component.props.children) ? Component.props.children : [Component.props.children] : null;
|
|
7
|
-
return typeof Component ===
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
var getComponentFromProps_default = getComponentFromProps;
|
|
15
|
-
export {
|
|
16
|
-
getComponentFromProps_default as default,
|
|
17
|
-
getComponentFromProps
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=getComponentFromProps.js.map
|
|
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]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { getComponentFromProps as default };
|
package/esm/hooks/index.js
CHANGED
|
@@ -1,40 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import { useOnElementResize } from "./useOnElementResize";
|
|
20
|
-
export {
|
|
21
|
-
useCancellableDelayedCallback,
|
|
22
|
-
useDerivedStateFromProps,
|
|
23
|
-
useExecutionTimer,
|
|
24
|
-
useExpandState,
|
|
25
|
-
default3 as useForceUpdate,
|
|
26
|
-
useHotkeys,
|
|
27
|
-
useHoverHandlersDelay,
|
|
28
|
-
default2 as useMeasure,
|
|
29
|
-
default4 as useOnClickOutside,
|
|
30
|
-
useOnElementResize,
|
|
31
|
-
useParentElement,
|
|
32
|
-
usePrevious,
|
|
33
|
-
useResizeObserver,
|
|
34
|
-
useSetRef,
|
|
35
|
-
useShouldRecalculate,
|
|
36
|
-
useUncontrolled,
|
|
37
|
-
useWindowScrollerList,
|
|
38
|
-
useWindowSize
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { default as useMeasure } from 'use-measure';
|
|
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';
|
|
10
|
+
export { default as useForceUpdate } from 'use-force-update';
|
|
11
|
+
export { default as useOnClickOutside } from 'use-onclickoutside';
|
|
12
|
+
export { useUncontrolled } from 'uncontrollable';
|
|
13
|
+
export { default as usePrevious } from './usePrevious.js';
|
|
14
|
+
export { default as useCancellableDelayedCallback } from './useCancellableDelayedCallback.js';
|
|
15
|
+
export { default as useDerivedStateFromProps } from './useDerivedStateFromProps.js';
|
|
16
|
+
export { useSetRef } from './useSetRef.js';
|
|
17
|
+
export { useParentElement } from './useParentElement.js';
|
|
18
|
+
export { useOnElementResize } from './useOnElementResize.js';
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
import { useRef, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
function useCancellableDelayedCallback(cb, delay) {
|
|
4
5
|
const timeoutRef = useRef();
|
|
5
6
|
const cancel = useCallback(() => {
|
|
6
7
|
const timeoutId = timeoutRef.current;
|
|
8
|
+
|
|
7
9
|
if (timeoutId) {
|
|
8
|
-
timeoutRef.current =
|
|
10
|
+
timeoutRef.current = undefined;
|
|
9
11
|
clearTimeout(timeoutId);
|
|
10
12
|
}
|
|
11
13
|
}, [timeoutRef]);
|
|
12
|
-
const delayedCb = useCallback((
|
|
14
|
+
const delayedCb = useCallback(function () {
|
|
15
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
|
+
args[_key] = arguments[_key];
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
timeoutRef.current = setTimeout(() => cb(...args), delay);
|
|
14
20
|
}, [cb, delay]);
|
|
15
21
|
return [delayedCb, cancel];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
useCancellableDelayedCallback_default as default,
|
|
20
|
-
useCancellableDelayedCallback
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=useCancellableDelayedCallback.js.map
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { useCancellableDelayedCallback as default };
|