@elliemae/ds-utilities 2.3.0-alpha.8 → 2.3.0-next.2
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 +38 -0
- package/cjs/getComponentFromProps.js +30 -0
- package/cjs/hooks/index.js +63 -0
- package/cjs/hooks/useCancellableDelayedCallback.js +26 -0
- package/cjs/hooks/useDerivedStateFromProps.js +56 -0
- package/cjs/hooks/useExecutionTimer.js +31 -0
- package/cjs/hooks/useExpandState.js +133 -0
- package/cjs/hooks/useHotkeys.js +25 -0
- package/cjs/hooks/useHoverHandlersDelay.js +28 -0
- package/cjs/hooks/useIsShowingEllipsis.js +36 -0
- package/cjs/hooks/useOnElementResize.js +38 -0
- package/cjs/hooks/useParentElement.js +16 -0
- package/cjs/hooks/usePrevious.js +13 -0
- package/cjs/hooks/useResizeObserver.js +33 -0
- package/cjs/hooks/useSetRef.js +15 -0
- package/cjs/hooks/useShouldRecalculate.js +17 -0
- package/cjs/hooks/useWindowScrollerList.js +65 -0
- package/cjs/hooks/useWindowSize.js +27 -0
- package/cjs/index.js +268 -0
- package/cjs/onClickHandlerForNonInteractiveElements.js +22 -0
- package/cjs/operators.js +63 -0
- package/cjs/platform.js +9 -0
- package/cjs/reactTypesUtility.js +35 -0
- package/cjs/scrollingTimer.js +24 -0
- package/cjs/system.js +43 -0
- package/cjs/timeUtils.js +25 -0
- package/cjs/utils.js +263 -0
- package/cjs/validations.js +44 -0
- package/esm/capitalize.js +3 -0
- package/esm/compose.js +34 -0
- package/esm/getComponentFromProps.js +23 -0
- package/esm/hooks/index.js +19 -0
- package/esm/hooks/useCancellableDelayedCallback.js +24 -0
- package/esm/hooks/useDerivedStateFromProps.js +54 -0
- package/esm/hooks/useExecutionTimer.js +29 -0
- package/esm/hooks/useExpandState.js +127 -0
- package/esm/hooks/useHotkeys.js +19 -0
- package/{dist/esm → esm}/hooks/useHoverHandlersDelay.js +12 -15
- package/{dist/esm → esm}/hooks/useIsShowingEllipsis.js +12 -9
- package/esm/hooks/useOnElementResize.js +34 -0
- package/esm/hooks/useParentElement.js +12 -0
- package/esm/hooks/usePrevious.js +11 -0
- package/esm/hooks/useResizeObserver.js +26 -0
- package/esm/hooks/useSetRef.js +11 -0
- package/esm/hooks/useShouldRecalculate.js +15 -0
- package/{dist/esm → esm}/hooks/useWindowScrollerList.js +29 -20
- package/esm/hooks/useWindowSize.js +25 -0
- package/esm/index.js +32 -0
- package/esm/onClickHandlerForNonInteractiveElements.js +20 -0
- package/esm/operators.js +46 -0
- package/esm/platform.js +4 -0
- package/esm/reactTypesUtility.js +22 -0
- package/esm/scrollingTimer.js +20 -0
- package/esm/system.js +37 -0
- package/esm/timeUtils.js +20 -0
- package/esm/utils.js +99 -0
- package/esm/validations.js +38 -0
- package/package.json +72 -74
- 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 +19 -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/useIsShowingEllipsis.d.ts +5 -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/dist/cjs/capitalize.js +0 -35
- package/dist/cjs/capitalize.js.map +0 -7
- package/dist/cjs/compose.js +0 -45
- package/dist/cjs/compose.js.map +0 -7
- package/dist/cjs/getComponentFromProps.js +0 -48
- package/dist/cjs/getComponentFromProps.js.map +0 -7
- package/dist/cjs/hooks/index.js +0 -71
- package/dist/cjs/hooks/index.js.map +0 -7
- package/dist/cjs/hooks/useCancellableDelayedCallback.js +0 -51
- package/dist/cjs/hooks/useCancellableDelayedCallback.js.map +0 -7
- package/dist/cjs/hooks/useDerivedStateFromProps.js +0 -67
- package/dist/cjs/hooks/useDerivedStateFromProps.js.map +0 -7
- package/dist/cjs/hooks/useExecutionTimer.js +0 -50
- package/dist/cjs/hooks/useExecutionTimer.js.map +0 -7
- package/dist/cjs/hooks/useExpandState.js +0 -120
- package/dist/cjs/hooks/useExpandState.js.map +0 -7
- package/dist/cjs/hooks/useHotkeys.js +0 -45
- package/dist/cjs/hooks/useHotkeys.js.map +0 -7
- package/dist/cjs/hooks/useHoverHandlersDelay.js +0 -58
- package/dist/cjs/hooks/useHoverHandlersDelay.js.map +0 -7
- package/dist/cjs/hooks/useIsShowingEllipsis.js +0 -58
- package/dist/cjs/hooks/useIsShowingEllipsis.js.map +0 -7
- package/dist/cjs/hooks/useOnElementResize.js +0 -54
- package/dist/cjs/hooks/useOnElementResize.js.map +0 -7
- package/dist/cjs/hooks/useParentElement.js +0 -43
- package/dist/cjs/hooks/useParentElement.js.map +0 -7
- package/dist/cjs/hooks/usePrevious.js +0 -44
- package/dist/cjs/hooks/usePrevious.js.map +0 -7
- package/dist/cjs/hooks/useResizeObserver.js +0 -60
- package/dist/cjs/hooks/useResizeObserver.js.map +0 -7
- package/dist/cjs/hooks/useSetRef.js +0 -42
- package/dist/cjs/hooks/useSetRef.js.map +0 -7
- package/dist/cjs/hooks/useShouldRecalculate.js +0 -44
- package/dist/cjs/hooks/useShouldRecalculate.js.map +0 -7
- package/dist/cjs/hooks/useWindowScrollerList.js +0 -83
- package/dist/cjs/hooks/useWindowScrollerList.js.map +0 -7
- package/dist/cjs/hooks/useWindowSize.js +0 -57
- package/dist/cjs/hooks/useWindowSize.js.map +0 -7
- package/dist/cjs/index.js +0 -146
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/onClickHandlerForNonInteractiveElements.js +0 -49
- package/dist/cjs/onClickHandlerForNonInteractiveElements.js.map +0 -7
- package/dist/cjs/operators.js +0 -68
- package/dist/cjs/operators.js.map +0 -7
- package/dist/cjs/platform.js +0 -37
- package/dist/cjs/platform.js.map +0 -7
- package/dist/cjs/reactTypesUtility.js +0 -58
- package/dist/cjs/reactTypesUtility.js.map +0 -7
- package/dist/cjs/scrollingTimer.js +0 -46
- package/dist/cjs/scrollingTimer.js.map +0 -7
- package/dist/cjs/system.js +0 -60
- package/dist/cjs/system.js.map +0 -7
- package/dist/cjs/timeUtils.js +0 -43
- package/dist/cjs/timeUtils.js.map +0 -7
- package/dist/cjs/utils.js +0 -127
- package/dist/cjs/utils.js.map +0 -7
- package/dist/cjs/validations.js +0 -57
- package/dist/cjs/validations.js.map +0 -7
- package/dist/esm/capitalize.js +0 -6
- package/dist/esm/capitalize.js.map +0 -7
- package/dist/esm/compose.js +0 -16
- package/dist/esm/compose.js.map +0 -7
- package/dist/esm/getComponentFromProps.js +0 -19
- package/dist/esm/getComponentFromProps.js.map +0 -7
- package/dist/esm/hooks/index.js +0 -42
- package/dist/esm/hooks/index.js.map +0 -7
- package/dist/esm/hooks/useCancellableDelayedCallback.js +0 -22
- package/dist/esm/hooks/useCancellableDelayedCallback.js.map +0 -7
- package/dist/esm/hooks/useDerivedStateFromProps.js +0 -38
- package/dist/esm/hooks/useDerivedStateFromProps.js.map +0 -7
- package/dist/esm/hooks/useExecutionTimer.js +0 -21
- package/dist/esm/hooks/useExecutionTimer.js.map +0 -7
- package/dist/esm/hooks/useExpandState.js +0 -91
- package/dist/esm/hooks/useExpandState.js.map +0 -7
- package/dist/esm/hooks/useHotkeys.js +0 -16
- package/dist/esm/hooks/useHotkeys.js.map +0 -7
- package/dist/esm/hooks/useHoverHandlersDelay.js.map +0 -7
- package/dist/esm/hooks/useIsShowingEllipsis.js.map +0 -7
- package/dist/esm/hooks/useOnElementResize.js +0 -25
- package/dist/esm/hooks/useOnElementResize.js.map +0 -7
- package/dist/esm/hooks/useParentElement.js +0 -14
- package/dist/esm/hooks/useParentElement.js.map +0 -7
- package/dist/esm/hooks/usePrevious.js +0 -15
- package/dist/esm/hooks/usePrevious.js.map +0 -7
- package/dist/esm/hooks/useResizeObserver.js +0 -31
- package/dist/esm/hooks/useResizeObserver.js.map +0 -7
- package/dist/esm/hooks/useSetRef.js +0 -13
- package/dist/esm/hooks/useSetRef.js.map +0 -7
- package/dist/esm/hooks/useShouldRecalculate.js +0 -15
- package/dist/esm/hooks/useShouldRecalculate.js.map +0 -7
- package/dist/esm/hooks/useWindowScrollerList.js.map +0 -7
- package/dist/esm/hooks/useWindowSize.js +0 -28
- package/dist/esm/hooks/useWindowSize.js.map +0 -7
- package/dist/esm/index.js +0 -206
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/onClickHandlerForNonInteractiveElements.js +0 -20
- package/dist/esm/onClickHandlerForNonInteractiveElements.js.map +0 -7
- package/dist/esm/operators.js +0 -39
- package/dist/esm/operators.js.map +0 -7
- package/dist/esm/platform.js +0 -8
- package/dist/esm/platform.js.map +0 -7
- package/dist/esm/reactTypesUtility.js +0 -29
- package/dist/esm/reactTypesUtility.js.map +0 -7
- package/dist/esm/scrollingTimer.js +0 -17
- package/dist/esm/scrollingTimer.js.map +0 -7
- package/dist/esm/system.js +0 -31
- package/dist/esm/system.js.map +0 -7
- package/dist/esm/timeUtils.js +0 -14
- package/dist/esm/timeUtils.js.map +0 -7
- package/dist/esm/utils.js +0 -136
- package/dist/esm/utils.js.map +0 -7
- package/dist/esm/validations.js +0 -28
- package/dist/esm/validations.js.map +0 -7
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function getScrollOffset() {
|
|
6
|
+
let element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
7
|
+
scrollTop: 0,
|
|
8
|
+
scrollLeft: 0
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
top: element.scrollTop,
|
|
12
|
+
left: element.scrollLeft
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getPositionOffset(listEl, scrollableEl) {
|
|
17
|
+
const scrollOffset = getScrollOffset(scrollableEl);
|
|
18
|
+
const elementRect = listEl.getBoundingClientRect();
|
|
19
|
+
const containerRect = scrollableEl.getBoundingClientRect();
|
|
20
|
+
return {
|
|
21
|
+
top: elementRect.top + scrollOffset.top - containerRect.top,
|
|
22
|
+
left: elementRect.left + scrollOffset.top - containerRect.left
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function isParent(parentNode, childNode) {
|
|
27
|
+
return childNode.parentNode === parentNode || childNode.parentNode && isParent(parentNode, childNode.parentNode);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function useWindowScrollerList(_ref) {
|
|
31
|
+
let {
|
|
32
|
+
listInstance,
|
|
33
|
+
outerListRef
|
|
34
|
+
} = _ref;
|
|
35
|
+
const scrollableParent = React.useRef();
|
|
36
|
+
const listOffset = React.useRef();
|
|
37
|
+
|
|
38
|
+
const getElementOffset = () => {
|
|
39
|
+
listOffset.current = getPositionOffset(outerListRef.current, scrollableParent.current);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const handleScroll = e => {
|
|
43
|
+
if (!scrollableParent.current) {
|
|
44
|
+
const containerTarget = e.target === document ? document.body : e.target;
|
|
45
|
+
scrollableParent.current = isParent(containerTarget, outerListRef.current) && containerTarget;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!scrollableParent.current) return;
|
|
49
|
+
getElementOffset();
|
|
50
|
+
const scrollOffset = getScrollOffset(scrollableParent.current);
|
|
51
|
+
const scrollTop = Math.max(0, scrollOffset.top - listOffset.current.top);
|
|
52
|
+
if (listInstance.current) listInstance.current.scrollTo(scrollTop);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
window.addEventListener('scroll', handleScroll, true);
|
|
57
|
+
window.addEventListener('resize', getElementOffset, true);
|
|
58
|
+
return () => {
|
|
59
|
+
window.removeEventListener('scroll', handleScroll, true);
|
|
60
|
+
window.removeEventListener('resize', getElementOffset, true);
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = useWindowScrollerList;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function useWindowSize() {
|
|
7
|
+
const [size, setSize] = React.useState([0, 0]);
|
|
8
|
+
React.useLayoutEffect(() => {
|
|
9
|
+
if (!window) return false;
|
|
10
|
+
|
|
11
|
+
function updateSize() {
|
|
12
|
+
setSize([window.innerWidth, window.innerHeight]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
window.addEventListener('resize', updateSize);
|
|
16
|
+
window.addEventListener('orientationchange', updateSize);
|
|
17
|
+
updateSize();
|
|
18
|
+
return () => {
|
|
19
|
+
window.removeEventListener('resize', updateSize);
|
|
20
|
+
window.removeEventListener('orientationchange', updateSize);
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
if (!window) return false;
|
|
24
|
+
return size;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = useWindowSize;
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var getComponentFromProps = require('./getComponentFromProps.js');
|
|
6
|
+
var onClickHandlerForNonInteractiveElements = require('./onClickHandlerForNonInteractiveElements.js');
|
|
7
|
+
var capitalize = require('./capitalize.js');
|
|
8
|
+
var operators = require('./operators.js');
|
|
9
|
+
var utils = require('./utils.js');
|
|
10
|
+
var system = require('./system.js');
|
|
11
|
+
var useMeasure = require('use-measure');
|
|
12
|
+
var useExecutionTimer = require('./hooks/useExecutionTimer.js');
|
|
13
|
+
var useExpandState = require('./hooks/useExpandState.js');
|
|
14
|
+
var useHotkeys = require('./hooks/useHotkeys.js');
|
|
15
|
+
var useHoverHandlersDelay = require('./hooks/useHoverHandlersDelay.js');
|
|
16
|
+
var useResizeObserver = require('./hooks/useResizeObserver.js');
|
|
17
|
+
var useShouldRecalculate = require('./hooks/useShouldRecalculate.js');
|
|
18
|
+
var useWindowScrollerList = require('./hooks/useWindowScrollerList.js');
|
|
19
|
+
var useWindowSize = require('./hooks/useWindowSize.js');
|
|
20
|
+
var useForceUpdate = require('use-force-update');
|
|
21
|
+
var useOnclickoutside = require('use-onclickoutside');
|
|
22
|
+
var uncontrollable = require('uncontrollable');
|
|
23
|
+
var usePrevious = require('./hooks/usePrevious.js');
|
|
24
|
+
var useCancellableDelayedCallback = require('./hooks/useCancellableDelayedCallback.js');
|
|
25
|
+
var useDerivedStateFromProps = require('./hooks/useDerivedStateFromProps.js');
|
|
26
|
+
var useSetRef = require('./hooks/useSetRef.js');
|
|
27
|
+
var useParentElement = require('./hooks/useParentElement.js');
|
|
28
|
+
var useOnElementResize = require('./hooks/useOnElementResize.js');
|
|
29
|
+
var useIsShowingEllipsis = require('./hooks/useIsShowingEllipsis.js');
|
|
30
|
+
var timeUtils = require('./timeUtils.js');
|
|
31
|
+
var compose = require('./compose.js');
|
|
32
|
+
var platform = require('./platform.js');
|
|
33
|
+
var reactTypesUtility = require('./reactTypesUtility.js');
|
|
34
|
+
var scrollingTimer = require('./scrollingTimer.js');
|
|
35
|
+
var validations = require('./validations.js');
|
|
36
|
+
var lodash = require('lodash');
|
|
37
|
+
|
|
38
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
|
+
|
|
40
|
+
var useMeasure__default = /*#__PURE__*/_interopDefaultLegacy(useMeasure);
|
|
41
|
+
var useForceUpdate__default = /*#__PURE__*/_interopDefaultLegacy(useForceUpdate);
|
|
42
|
+
var useOnclickoutside__default = /*#__PURE__*/_interopDefaultLegacy(useOnclickoutside);
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
exports.getComponentFromProps = getComponentFromProps;
|
|
47
|
+
exports.onClickHandlerForNonInteractiveElements = onClickHandlerForNonInteractiveElements;
|
|
48
|
+
exports.capitalize = capitalize.capitalize;
|
|
49
|
+
exports.checkEmpty = operators.checkEmpty;
|
|
50
|
+
exports.checkNotEmpty = operators.checkNotEmpty;
|
|
51
|
+
exports.contains = operators.contains;
|
|
52
|
+
exports.equal = operators.equal;
|
|
53
|
+
exports.greaterThan = operators.greaterThan;
|
|
54
|
+
exports.greaterThanOrEquals = operators.greaterThanOrEquals;
|
|
55
|
+
exports.isIn = operators.isIn;
|
|
56
|
+
exports.isNotIn = operators.isNotIn;
|
|
57
|
+
exports.isNotNull = operators.isNotNull;
|
|
58
|
+
exports.isNull = operators.isNull;
|
|
59
|
+
exports.lessThanOrEquals = operators.lessThanOrEquals;
|
|
60
|
+
exports.notEqual = operators.notEqual;
|
|
61
|
+
exports.startsWith = operators.startsWith;
|
|
62
|
+
exports.validDate = operators.validDate;
|
|
63
|
+
exports.addOrRemove = utils.addOrRemove;
|
|
64
|
+
exports.arrayMove = utils.arrayMove;
|
|
65
|
+
exports.cx = utils.cx;
|
|
66
|
+
exports.hashArray = utils.hashArray;
|
|
67
|
+
exports.removeUndefinedProperties = utils.removeUndefinedProperties;
|
|
68
|
+
exports.runAll = utils.runAll;
|
|
69
|
+
exports.safeCall = utils.safeCall;
|
|
70
|
+
exports.toggleInArray = utils.toggleInArray;
|
|
71
|
+
exports.toggleInObject = utils.toggleInObject;
|
|
72
|
+
exports.logger = system.logger;
|
|
73
|
+
exports.mergeRefs = system.mergeRefs;
|
|
74
|
+
exports.setRef = system.setRef;
|
|
75
|
+
Object.defineProperty(exports, 'useMeasure', {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () { return useMeasure__default["default"]; }
|
|
78
|
+
});
|
|
79
|
+
exports.useExecutionTimer = useExecutionTimer;
|
|
80
|
+
exports.useExpandState = useExpandState;
|
|
81
|
+
exports.useHotkeys = useHotkeys;
|
|
82
|
+
exports.useHoverHandlersDelay = useHoverHandlersDelay;
|
|
83
|
+
exports.useResizeObserver = useResizeObserver;
|
|
84
|
+
exports.useShouldRecalculate = useShouldRecalculate;
|
|
85
|
+
exports.useWindowScrollerList = useWindowScrollerList;
|
|
86
|
+
exports.useWindowSize = useWindowSize;
|
|
87
|
+
Object.defineProperty(exports, 'useForceUpdate', {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return useForceUpdate__default["default"]; }
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, 'useOnClickOutside', {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return useOnclickoutside__default["default"]; }
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, 'useUncontrolled', {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () { return uncontrollable.useUncontrolled; }
|
|
98
|
+
});
|
|
99
|
+
exports.usePrevious = usePrevious;
|
|
100
|
+
exports.useCancellableDelayedCallback = useCancellableDelayedCallback;
|
|
101
|
+
exports.useDerivedStateFromProps = useDerivedStateFromProps;
|
|
102
|
+
exports.useSetRef = useSetRef.useSetRef;
|
|
103
|
+
exports.useParentElement = useParentElement.useParentElement;
|
|
104
|
+
exports.useOnElementResize = useOnElementResize.useOnElementResize;
|
|
105
|
+
exports.useIsShowingEllipsis = useIsShowingEllipsis.useIsShowingEllipsis;
|
|
106
|
+
exports.addLeadingZeros = timeUtils.addLeadingZeros;
|
|
107
|
+
exports.getVisibleTimeByFormat = timeUtils.getVisibleTimeByFormat;
|
|
108
|
+
exports.compose = compose.compose;
|
|
109
|
+
exports.DOCUMENT = platform.DOCUMENT;
|
|
110
|
+
exports.WINDOW = platform.WINDOW;
|
|
111
|
+
exports.isClassComponent = reactTypesUtility.isClassComponent;
|
|
112
|
+
exports.isCompositeTypeElement = reactTypesUtility.isCompositeTypeElement;
|
|
113
|
+
exports.isDOMTypeElement = reactTypesUtility.isDOMTypeElement;
|
|
114
|
+
exports.isElement = reactTypesUtility.isElement;
|
|
115
|
+
exports.isFunctionComponent = reactTypesUtility.isFunctionComponent;
|
|
116
|
+
exports.isReactComponent = reactTypesUtility.isReactComponent;
|
|
117
|
+
exports.resetTimer = scrollingTimer.resetTimer;
|
|
118
|
+
exports.isGreaterThan = validations.isGreaterThan;
|
|
119
|
+
exports.isRequired = validations.isRequired;
|
|
120
|
+
exports.isValidDate = validations.isValidDate;
|
|
121
|
+
Object.defineProperty(exports, 'cloneDeep', {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () { return lodash.cloneDeep; }
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(exports, 'curry', {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function () { return lodash.curry; }
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(exports, 'debounce', {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function () { return lodash.debounce; }
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(exports, 'differenceBy', {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: function () { return lodash.differenceBy; }
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, 'differenceWith', {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () { return lodash.differenceWith; }
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(exports, 'filter', {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function () { return lodash.filter; }
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(exports, 'findIndex', {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: function () { return lodash.findIndex; }
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(exports, 'get', {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function () { return lodash.get; }
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(exports, 'groupBy', {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () { return lodash.groupBy; }
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(exports, 'isBoolean', {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
get: function () { return lodash.isBoolean; }
|
|
160
|
+
});
|
|
161
|
+
Object.defineProperty(exports, 'isEmpty', {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
get: function () { return lodash.isEmpty; }
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(exports, 'isEqual', {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: function () { return lodash.isEqual; }
|
|
168
|
+
});
|
|
169
|
+
Object.defineProperty(exports, 'isEqualWith', {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
get: function () { return lodash.isEqualWith; }
|
|
172
|
+
});
|
|
173
|
+
Object.defineProperty(exports, 'isFunction', {
|
|
174
|
+
enumerable: true,
|
|
175
|
+
get: function () { return lodash.isFunction; }
|
|
176
|
+
});
|
|
177
|
+
Object.defineProperty(exports, 'isNaN', {
|
|
178
|
+
enumerable: true,
|
|
179
|
+
get: function () { return lodash.isNaN; }
|
|
180
|
+
});
|
|
181
|
+
Object.defineProperty(exports, 'isObject', {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function () { return lodash.isObject; }
|
|
184
|
+
});
|
|
185
|
+
Object.defineProperty(exports, 'isString', {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
get: function () { return lodash.isString; }
|
|
188
|
+
});
|
|
189
|
+
Object.defineProperty(exports, 'maxBy', {
|
|
190
|
+
enumerable: true,
|
|
191
|
+
get: function () { return lodash.maxBy; }
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(exports, 'meanBy', {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function () { return lodash.meanBy; }
|
|
196
|
+
});
|
|
197
|
+
Object.defineProperty(exports, 'noop', {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
get: function () { return lodash.noop; }
|
|
200
|
+
});
|
|
201
|
+
Object.defineProperty(exports, 'omit', {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
get: function () { return lodash.omit; }
|
|
204
|
+
});
|
|
205
|
+
Object.defineProperty(exports, 'orderBy', {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function () { return lodash.orderBy; }
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(exports, 'padStart', {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: function () { return lodash.padStart; }
|
|
212
|
+
});
|
|
213
|
+
Object.defineProperty(exports, 'parseInt', {
|
|
214
|
+
enumerable: true,
|
|
215
|
+
get: function () { return lodash.parseInt; }
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(exports, 'pick', {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
get: function () { return lodash.pick; }
|
|
220
|
+
});
|
|
221
|
+
Object.defineProperty(exports, 'pickBy', {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
get: function () { return lodash.pickBy; }
|
|
224
|
+
});
|
|
225
|
+
Object.defineProperty(exports, 'property', {
|
|
226
|
+
enumerable: true,
|
|
227
|
+
get: function () { return lodash.property; }
|
|
228
|
+
});
|
|
229
|
+
Object.defineProperty(exports, 'pull', {
|
|
230
|
+
enumerable: true,
|
|
231
|
+
get: function () { return lodash.pull; }
|
|
232
|
+
});
|
|
233
|
+
Object.defineProperty(exports, 'range', {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function () { return lodash.range; }
|
|
236
|
+
});
|
|
237
|
+
Object.defineProperty(exports, 'set', {
|
|
238
|
+
enumerable: true,
|
|
239
|
+
get: function () { return lodash.set; }
|
|
240
|
+
});
|
|
241
|
+
Object.defineProperty(exports, 'sortBy', {
|
|
242
|
+
enumerable: true,
|
|
243
|
+
get: function () { return lodash.sortBy; }
|
|
244
|
+
});
|
|
245
|
+
Object.defineProperty(exports, 'sumBy', {
|
|
246
|
+
enumerable: true,
|
|
247
|
+
get: function () { return lodash.sumBy; }
|
|
248
|
+
});
|
|
249
|
+
Object.defineProperty(exports, 'throttle', {
|
|
250
|
+
enumerable: true,
|
|
251
|
+
get: function () { return lodash.throttle; }
|
|
252
|
+
});
|
|
253
|
+
Object.defineProperty(exports, 'transform', {
|
|
254
|
+
enumerable: true,
|
|
255
|
+
get: function () { return lodash.transform; }
|
|
256
|
+
});
|
|
257
|
+
Object.defineProperty(exports, 'uniq', {
|
|
258
|
+
enumerable: true,
|
|
259
|
+
get: function () { return lodash.uniq; }
|
|
260
|
+
});
|
|
261
|
+
Object.defineProperty(exports, 'uniqBy', {
|
|
262
|
+
enumerable: true,
|
|
263
|
+
get: function () { return lodash.uniqBy; }
|
|
264
|
+
});
|
|
265
|
+
Object.defineProperty(exports, 'values', {
|
|
266
|
+
enumerable: true,
|
|
267
|
+
get: function () { return lodash.values; }
|
|
268
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* onClickHandler: callback
|
|
5
|
+
*
|
|
6
|
+
* @param onClickHandler
|
|
7
|
+
*/
|
|
8
|
+
var onClickHandlerForNonInteractiveElements = (onClickHandler => ({
|
|
9
|
+
role: 'button',
|
|
10
|
+
tabIndex: '0',
|
|
11
|
+
onClick: onClickHandler,
|
|
12
|
+
onKeyPress: event => {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
const {
|
|
15
|
+
keycode,
|
|
16
|
+
key
|
|
17
|
+
} = event;
|
|
18
|
+
if (key === 'Enter') onClickHandler(event);else if (keycode === 13) onClickHandler(event);
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
module.exports = onClickHandlerForNonInteractiveElements;
|
package/cjs/operators.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
var lodash = require('lodash');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Check if the value is null undefined ''
|
|
12
|
+
*
|
|
13
|
+
* @param value
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const checkNotEmpty = value => value === '' || value === undefined || value == [] || value === null || lodash.isEmpty(value);
|
|
17
|
+
const checkEmpty = value => !lodash.isEmpty(value);
|
|
18
|
+
/**
|
|
19
|
+
* @param value: number
|
|
20
|
+
* @param comparator: number
|
|
21
|
+
* @param value
|
|
22
|
+
* @param comparator
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const greaterThan = (value, comparator) => value > comparator;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a valid date with format MM/DD/YYYY
|
|
28
|
+
*
|
|
29
|
+
* @param {*} value: string
|
|
30
|
+
* @param value
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const validDate = value => {
|
|
34
|
+
const dateValidationRegex = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
|
|
35
|
+
if (!dateValidationRegex.test(value)) return false;
|
|
36
|
+
const [m, d, y] = value.split('/').map(n => Number(n));
|
|
37
|
+
return m === Number(new Date(y, m - 1, d).getMonth()) + 1 && d === Number(new Date(y, m - 1, d).getDate());
|
|
38
|
+
};
|
|
39
|
+
const equal = (a, b) => a === b;
|
|
40
|
+
const notEqual = (a, b) => !equal(a, b);
|
|
41
|
+
const isNull = a => checkNotEmpty(a);
|
|
42
|
+
const isNotNull = a => !isNull(a);
|
|
43
|
+
const isIn = (a, b) => b.indexOf(a) > -1;
|
|
44
|
+
const isNotIn = (a, b) => !isIn(a, b);
|
|
45
|
+
const greaterThanOrEquals = (value, comparator) => value >= comparator;
|
|
46
|
+
const lessThanOrEquals = (value, comparator) => value <= comparator;
|
|
47
|
+
const startsWith = (value, comparator) => String(value).startsWith(comparator);
|
|
48
|
+
const contains = (value, comparator) => String(value).includes(comparator);
|
|
49
|
+
|
|
50
|
+
exports.checkEmpty = checkEmpty;
|
|
51
|
+
exports.checkNotEmpty = checkNotEmpty;
|
|
52
|
+
exports.contains = contains;
|
|
53
|
+
exports.equal = equal;
|
|
54
|
+
exports.greaterThan = greaterThan;
|
|
55
|
+
exports.greaterThanOrEquals = greaterThanOrEquals;
|
|
56
|
+
exports.isIn = isIn;
|
|
57
|
+
exports.isNotIn = isNotIn;
|
|
58
|
+
exports.isNotNull = isNotNull;
|
|
59
|
+
exports.isNull = isNull;
|
|
60
|
+
exports.lessThanOrEquals = lessThanOrEquals;
|
|
61
|
+
exports.notEqual = notEqual;
|
|
62
|
+
exports.startsWith = startsWith;
|
|
63
|
+
exports.validDate = validDate;
|
package/cjs/platform.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const DOCUMENT = typeof document !== 'undefined' ? document : null;
|
|
6
|
+
const WINDOW = typeof window !== 'undefined' ? window : null;
|
|
7
|
+
|
|
8
|
+
exports.DOCUMENT = DOCUMENT;
|
|
9
|
+
exports.WINDOW = WINDOW;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
|
|
11
|
+
function isClassComponent(component) {
|
|
12
|
+
return !!(typeof component === 'function' && !!component.prototype.isReactComponent);
|
|
13
|
+
}
|
|
14
|
+
function isFunctionComponent(component) {
|
|
15
|
+
return typeof component === 'function' && String(component).includes('return React.createElement');
|
|
16
|
+
}
|
|
17
|
+
function isReactComponent(component) {
|
|
18
|
+
return !!(isClassComponent(component) || isFunctionComponent(component));
|
|
19
|
+
}
|
|
20
|
+
function isElement(element) {
|
|
21
|
+
return /*#__PURE__*/React__default["default"].isValidElement(element);
|
|
22
|
+
}
|
|
23
|
+
function isDOMTypeElement(element) {
|
|
24
|
+
return isElement(element) && typeof element.type === 'string';
|
|
25
|
+
}
|
|
26
|
+
function isCompositeTypeElement(element) {
|
|
27
|
+
return isElement(element) && typeof element.type === 'function';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.isClassComponent = isClassComponent;
|
|
31
|
+
exports.isCompositeTypeElement = isCompositeTypeElement;
|
|
32
|
+
exports.isDOMTypeElement = isDOMTypeElement;
|
|
33
|
+
exports.isElement = isElement;
|
|
34
|
+
exports.isFunctionComponent = isFunctionComponent;
|
|
35
|
+
exports.isReactComponent = isReactComponent;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function resetTimer(func) {
|
|
6
|
+
let timeout;
|
|
7
|
+
return function () {
|
|
8
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
|
+
args[_key] = arguments[_key];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const context = this;
|
|
13
|
+
|
|
14
|
+
const lastCall = () => {
|
|
15
|
+
timeout = null;
|
|
16
|
+
func.apply(context, args);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
clearTimeout(timeout);
|
|
20
|
+
timeout = setTimeout(lastCall, 300);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.resetTimer = resetTimer;
|
package/cjs/system.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
11
|
+
require('core-js/modules/web.dom-collections.iterator.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
|
+
const setRef = (ref, value) => {
|
|
17
|
+
if (lodash.isFunction(ref)) {
|
|
18
|
+
ref(value);
|
|
19
|
+
} else if (ref) {
|
|
20
|
+
ref.current = value;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function mergeRefs() {
|
|
24
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
+
refs[_key] = arguments[_key];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return node => {
|
|
29
|
+
if (!node) return;
|
|
30
|
+
refs.forEach(ref => {
|
|
31
|
+
if (lodash.isFunction(ref)) {
|
|
32
|
+
ref(node);
|
|
33
|
+
} else if (ref) {
|
|
34
|
+
ref.current = node;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function logger() {}
|
|
40
|
+
|
|
41
|
+
exports.logger = logger;
|
|
42
|
+
exports.mergeRefs = mergeRefs;
|
|
43
|
+
exports.setRef = setRef;
|
package/cjs/timeUtils.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
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
|
+
const getVisibleTimeByFormat = format => ({
|
|
17
|
+
showHours: format.indexOf('H') > -1 || format.indexOf('h') > -1 || format.indexOf('k') > -1,
|
|
18
|
+
showMinutes: format.indexOf('m') > -1,
|
|
19
|
+
showSeconds: format.indexOf('s') > -1,
|
|
20
|
+
use12Hours: format.indexOf('A') > -1 || format.indexOf('h') > -1 || format.indexOf('a') > -1
|
|
21
|
+
});
|
|
22
|
+
const addLeadingZeros = count => number => lodash.padStart(String(number), count, '0');
|
|
23
|
+
|
|
24
|
+
exports.addLeadingZeros = addLeadingZeros;
|
|
25
|
+
exports.getVisibleTimeByFormat = getVisibleTimeByFormat;
|