@elliemae/ds-utilities 3.0.0-next.4 → 3.0.0-next.40
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/dist/cjs/capitalize.js.map +1 -1
- package/dist/cjs/compose.js.map +2 -2
- package/dist/cjs/deprecated/deprecatedMsg.js +35 -0
- package/dist/cjs/deprecated/deprecatedMsg.js.map +7 -0
- package/dist/cjs/deprecated/index.js +33 -0
- package/dist/cjs/deprecated/index.js.map +7 -0
- package/dist/cjs/deprecated/reactTypesUtility.js +60 -0
- package/dist/cjs/deprecated/reactTypesUtility.js.map +7 -0
- package/dist/cjs/{scrollingTimer.js → deprecated/scrollingTimer.js} +5 -3
- package/dist/cjs/deprecated/scrollingTimer.js.map +7 -0
- package/dist/cjs/{hooks → deprecated}/useParentElement.js +0 -0
- package/dist/cjs/deprecated/useParentElement.js.map +7 -0
- package/dist/cjs/{hooks → deprecated}/useSetRef.js +2 -0
- package/dist/cjs/deprecated/useSetRef.js.map +7 -0
- package/dist/cjs/deprecated/useUncontrolled.js +40 -0
- package/dist/cjs/deprecated/useUncontrolled.js.map +7 -0
- package/dist/cjs/{hooks → deprecated}/useWindowSize.js +6 -2
- package/dist/cjs/deprecated/useWindowSize.js.map +7 -0
- package/dist/cjs/getComponentFromProps.js +1 -1
- package/dist/cjs/getComponentFromProps.js.map +2 -2
- package/dist/cjs/hooks/index.js +4 -9
- package/dist/cjs/hooks/index.js.map +2 -2
- package/dist/cjs/hooks/useCallbackAfterRender.js.map +2 -2
- package/dist/cjs/hooks/useCancellableDelayedCallback.js.map +2 -2
- package/dist/cjs/hooks/useDerivedStateFromProps.js.map +2 -2
- package/dist/cjs/hooks/useExecutionTimer.js +4 -2
- package/dist/cjs/hooks/useExecutionTimer.js.map +2 -2
- package/dist/cjs/hooks/useExpandState.js.map +2 -2
- package/dist/cjs/hooks/useFocusTrap.js +66 -12
- package/dist/cjs/hooks/useFocusTrap.js.map +2 -2
- package/dist/cjs/hooks/useHotkeys.js +1 -1
- package/dist/cjs/hooks/useHotkeys.js.map +2 -2
- package/dist/cjs/hooks/useHoverHandlersDelay.js +6 -4
- package/dist/cjs/hooks/useHoverHandlersDelay.js.map +2 -2
- package/dist/cjs/hooks/useIsMobile.js +57 -0
- package/dist/cjs/hooks/useIsMobile.js.map +7 -0
- package/dist/cjs/hooks/useIsShowingEllipsis.js.map +1 -1
- package/dist/cjs/hooks/useOnElementResize.js.map +1 -1
- package/dist/cjs/hooks/usePrevious.js.map +2 -2
- package/dist/cjs/hooks/useResizeObserver.js +3 -3
- package/dist/cjs/hooks/useResizeObserver.js.map +2 -2
- package/dist/cjs/hooks/useShouldRecalculate.js.map +2 -2
- package/dist/cjs/hooks/useWindowScrollerList.js +11 -9
- package/dist/cjs/hooks/useWindowScrollerList.js.map +2 -2
- package/dist/cjs/index.js +4 -11
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/onClickHandlerForNonInteractiveElements.js +2 -2
- package/dist/cjs/onClickHandlerForNonInteractiveElements.js.map +2 -2
- package/dist/cjs/operators.js.map +2 -2
- package/dist/cjs/props-helpers/defaultProps/index.js +28 -0
- package/dist/cjs/props-helpers/defaultProps/index.js.map +7 -0
- package/dist/cjs/props-helpers/defaultProps/useMemoMergePropsWithDefault.js +62 -0
- package/dist/cjs/props-helpers/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
- package/dist/cjs/props-helpers/getProps/index.js +37 -0
- package/dist/cjs/props-helpers/getProps/index.js.map +7 -0
- package/dist/cjs/props-helpers/globalProps/constants.js +397 -0
- package/dist/cjs/props-helpers/globalProps/constants.js.map +7 -0
- package/dist/cjs/props-helpers/globalProps/globalAttributesPropTypes.js +398 -0
- package/dist/cjs/props-helpers/globalProps/globalAttributesPropTypes.js.map +7 -0
- package/dist/cjs/props-helpers/globalProps/index.js +29 -0
- package/dist/cjs/props-helpers/globalProps/index.js.map +7 -0
- package/dist/cjs/props-helpers/globalProps/useGetGlobalAttributes.js +56 -0
- package/dist/cjs/props-helpers/globalProps/useGetGlobalAttributes.js.map +7 -0
- package/dist/cjs/props-helpers/index.js +34 -0
- package/dist/cjs/props-helpers/index.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/PropTypes.js +151 -0
- package/dist/cjs/props-helpers/propTypes/PropTypes.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/customPropTypes.js +38 -0
- package/dist/cjs/props-helpers/propTypes/customPropTypes.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/describe.js +81 -0
- package/dist/cjs/props-helpers/propTypes/describe.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/describeConversions.js +96 -0
- package/dist/cjs/props-helpers/propTypes/describeConversions.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/describeGuards.js +49 -0
- package/dist/cjs/props-helpers/propTypes/describeGuards.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/index.js +37 -0
- package/dist/cjs/props-helpers/propTypes/index.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/toTypescript.js +154 -0
- package/dist/cjs/props-helpers/propTypes/toTypescript.js.map +7 -0
- package/dist/cjs/props-helpers/propTypes/types.js +27 -0
- package/dist/cjs/props-helpers/propTypes/types.js.map +7 -0
- package/dist/cjs/props-helpers/tests/globalProps/TestComponent.js +54 -0
- package/dist/cjs/props-helpers/tests/globalProps/TestComponent.js.map +7 -0
- package/dist/cjs/props-helpers/tests/validation/test.schema.js +69 -0
- package/dist/cjs/props-helpers/tests/validation/test.schema.js.map +7 -0
- package/dist/cjs/props-helpers/tests/xstyledProps/TestComponent.js +60 -0
- package/dist/cjs/props-helpers/tests/xstyledProps/TestComponent.js.map +7 -0
- package/dist/cjs/props-helpers/useDeprecateComponent/index.js +40 -0
- package/dist/cjs/props-helpers/useDeprecateComponent/index.js.map +7 -0
- package/dist/cjs/props-helpers/validation/errorTemplates.js +48 -0
- package/dist/cjs/props-helpers/validation/errorTemplates.js.map +7 -0
- package/dist/cjs/props-helpers/validation/index.js +29 -0
- package/dist/cjs/props-helpers/validation/index.js.map +7 -0
- package/dist/cjs/props-helpers/validation/typescriptGuards.js +83 -0
- package/dist/cjs/props-helpers/validation/typescriptGuards.js.map +7 -0
- package/dist/cjs/props-helpers/validation/typescriptParsers.js +76 -0
- package/dist/cjs/props-helpers/validation/typescriptParsers.js.map +7 -0
- package/dist/cjs/props-helpers/validation/typescriptValidator.js +177 -0
- package/dist/cjs/props-helpers/validation/typescriptValidator.js.map +7 -0
- package/dist/cjs/props-helpers/xstyledProps/constants.js +88 -0
- package/dist/cjs/props-helpers/xstyledProps/constants.js.map +7 -0
- package/dist/cjs/props-helpers/xstyledProps/index.js +29 -0
- package/dist/cjs/props-helpers/xstyledProps/index.js.map +7 -0
- package/dist/cjs/props-helpers/xstyledProps/useGetXstyledProps.js +48 -0
- package/dist/cjs/props-helpers/xstyledProps/useGetXstyledProps.js.map +7 -0
- package/dist/cjs/props-helpers/xstyledProps/xstyledPropTypes.js +92 -0
- package/dist/cjs/props-helpers/xstyledProps/xstyledPropTypes.js.map +7 -0
- package/dist/cjs/reactTypesUtility.js +3 -24
- package/dist/cjs/reactTypesUtility.js.map +2 -2
- package/dist/cjs/system.js +5 -10
- package/dist/cjs/system.js.map +2 -2
- package/dist/cjs/timeUtils.js.map +2 -2
- package/dist/cjs/utils.js +6 -3
- package/dist/cjs/utils.js.map +2 -2
- package/dist/cjs/validations.js +4 -6
- package/dist/cjs/validations.js.map +2 -2
- package/dist/esm/capitalize.js.map +1 -1
- package/dist/esm/compose.js.map +2 -2
- package/dist/esm/deprecated/deprecatedMsg.js +6 -0
- package/dist/esm/deprecated/deprecatedMsg.js.map +7 -0
- package/dist/esm/deprecated/index.js +8 -0
- package/dist/esm/deprecated/index.js.map +7 -0
- package/dist/esm/deprecated/reactTypesUtility.js +31 -0
- package/dist/esm/deprecated/reactTypesUtility.js.map +7 -0
- package/dist/esm/{scrollingTimer.js → deprecated/scrollingTimer.js} +5 -3
- package/dist/esm/deprecated/scrollingTimer.js.map +7 -0
- package/dist/esm/{hooks → deprecated}/useParentElement.js +0 -0
- package/dist/esm/deprecated/useParentElement.js.map +7 -0
- package/dist/esm/{hooks → deprecated}/useSetRef.js +2 -0
- package/dist/esm/deprecated/useSetRef.js.map +7 -0
- package/dist/esm/deprecated/useUncontrolled.js +11 -0
- package/dist/esm/deprecated/useUncontrolled.js.map +7 -0
- package/dist/esm/{hooks → deprecated}/useWindowSize.js +6 -2
- package/dist/esm/deprecated/useWindowSize.js.map +7 -0
- package/dist/esm/getComponentFromProps.js +1 -1
- package/dist/esm/getComponentFromProps.js.map +2 -2
- package/dist/esm/hooks/index.js +5 -10
- package/dist/esm/hooks/index.js.map +2 -2
- package/dist/esm/hooks/useCallbackAfterRender.js.map +2 -2
- package/dist/esm/hooks/useCancellableDelayedCallback.js.map +2 -2
- package/dist/esm/hooks/useDerivedStateFromProps.js.map +2 -2
- package/dist/esm/hooks/useExecutionTimer.js +4 -2
- package/dist/esm/hooks/useExecutionTimer.js.map +2 -2
- package/dist/esm/hooks/useExpandState.js.map +2 -2
- package/dist/esm/hooks/useFocusTrap.js +67 -13
- package/dist/esm/hooks/useFocusTrap.js.map +2 -2
- package/dist/esm/hooks/useHotkeys.js +1 -1
- package/dist/esm/hooks/useHotkeys.js.map +2 -2
- package/dist/esm/hooks/useHoverHandlersDelay.js +6 -4
- package/dist/esm/hooks/useHoverHandlersDelay.js.map +2 -2
- package/dist/esm/hooks/useIsMobile.js +28 -0
- package/dist/esm/hooks/useIsMobile.js.map +7 -0
- package/dist/esm/hooks/useIsShowingEllipsis.js.map +1 -1
- package/dist/esm/hooks/useOnElementResize.js.map +1 -1
- package/dist/esm/hooks/usePrevious.js.map +2 -2
- package/dist/esm/hooks/useResizeObserver.js +4 -4
- package/dist/esm/hooks/useResizeObserver.js.map +2 -2
- package/dist/esm/hooks/useShouldRecalculate.js.map +2 -2
- package/dist/esm/hooks/useWindowScrollerList.js +12 -10
- package/dist/esm/hooks/useWindowScrollerList.js.map +2 -2
- package/dist/esm/index.js +8 -24
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/onClickHandlerForNonInteractiveElements.js +2 -2
- package/dist/esm/onClickHandlerForNonInteractiveElements.js.map +2 -2
- package/dist/esm/operators.js.map +2 -2
- package/dist/esm/props-helpers/defaultProps/index.js +3 -0
- package/dist/esm/props-helpers/defaultProps/index.js.map +7 -0
- package/dist/esm/props-helpers/defaultProps/useMemoMergePropsWithDefault.js +35 -0
- package/dist/esm/props-helpers/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
- package/dist/esm/props-helpers/getProps/index.js +8 -0
- package/dist/esm/props-helpers/getProps/index.js.map +7 -0
- package/dist/esm/props-helpers/globalProps/constants.js +368 -0
- package/dist/esm/props-helpers/globalProps/constants.js.map +7 -0
- package/dist/esm/props-helpers/globalProps/globalAttributesPropTypes.js +369 -0
- package/dist/esm/props-helpers/globalProps/globalAttributesPropTypes.js.map +7 -0
- package/dist/esm/props-helpers/globalProps/index.js +4 -0
- package/dist/esm/props-helpers/globalProps/index.js.map +7 -0
- package/dist/esm/props-helpers/globalProps/useGetGlobalAttributes.js +27 -0
- package/dist/esm/props-helpers/globalProps/useGetGlobalAttributes.js.map +7 -0
- package/dist/esm/props-helpers/index.js +9 -0
- package/dist/esm/props-helpers/index.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/PropTypes.js +124 -0
- package/dist/esm/props-helpers/propTypes/PropTypes.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/customPropTypes.js +9 -0
- package/dist/esm/props-helpers/propTypes/customPropTypes.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/describe.js +52 -0
- package/dist/esm/props-helpers/propTypes/describe.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/describeConversions.js +76 -0
- package/dist/esm/props-helpers/propTypes/describeConversions.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/describeGuards.js +20 -0
- package/dist/esm/props-helpers/propTypes/describeGuards.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/index.js +8 -0
- package/dist/esm/props-helpers/propTypes/index.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/toTypescript.js +127 -0
- package/dist/esm/props-helpers/propTypes/toTypescript.js.map +7 -0
- package/dist/esm/props-helpers/propTypes/types.js +2 -0
- package/dist/esm/props-helpers/propTypes/types.js.map +7 -0
- package/dist/esm/props-helpers/tests/globalProps/TestComponent.js +27 -0
- package/dist/esm/props-helpers/tests/globalProps/TestComponent.js.map +7 -0
- package/dist/esm/props-helpers/tests/validation/test.schema.js +40 -0
- package/dist/esm/props-helpers/tests/validation/test.schema.js.map +7 -0
- package/dist/esm/props-helpers/tests/xstyledProps/TestComponent.js +33 -0
- package/dist/esm/props-helpers/tests/xstyledProps/TestComponent.js.map +7 -0
- package/dist/esm/props-helpers/useDeprecateComponent/index.js +11 -0
- package/dist/esm/props-helpers/useDeprecateComponent/index.js.map +7 -0
- package/dist/esm/props-helpers/validation/errorTemplates.js +19 -0
- package/dist/esm/props-helpers/validation/errorTemplates.js.map +7 -0
- package/dist/esm/props-helpers/validation/index.js +4 -0
- package/dist/esm/props-helpers/validation/index.js.map +7 -0
- package/dist/esm/props-helpers/validation/typescriptGuards.js +54 -0
- package/dist/esm/props-helpers/validation/typescriptGuards.js.map +7 -0
- package/dist/esm/props-helpers/validation/typescriptParsers.js +47 -0
- package/dist/esm/props-helpers/validation/typescriptParsers.js.map +7 -0
- package/dist/esm/props-helpers/validation/typescriptValidator.js +159 -0
- package/dist/esm/props-helpers/validation/typescriptValidator.js.map +7 -0
- package/dist/esm/props-helpers/xstyledProps/constants.js +59 -0
- package/dist/esm/props-helpers/xstyledProps/constants.js.map +7 -0
- package/dist/esm/props-helpers/xstyledProps/index.js +4 -0
- package/dist/esm/props-helpers/xstyledProps/index.js.map +7 -0
- package/dist/esm/props-helpers/xstyledProps/useGetXstyledProps.js +19 -0
- package/dist/esm/props-helpers/xstyledProps/useGetXstyledProps.js.map +7 -0
- package/dist/esm/props-helpers/xstyledProps/xstyledPropTypes.js +63 -0
- package/dist/esm/props-helpers/xstyledProps/xstyledPropTypes.js.map +7 -0
- package/dist/esm/reactTypesUtility.js +3 -24
- package/dist/esm/reactTypesUtility.js.map +2 -2
- package/dist/esm/system.js +5 -10
- package/dist/esm/system.js.map +2 -2
- package/dist/esm/timeUtils.js.map +2 -2
- package/dist/esm/utils.js +6 -3
- package/dist/esm/utils.js.map +2 -2
- package/dist/esm/validations.js +4 -6
- package/dist/esm/validations.js.map +2 -2
- package/package.json +1 -1
- package/dist/cjs/hooks/useParentElement.js.map +0 -7
- package/dist/cjs/hooks/useSetRef.js.map +0 -7
- package/dist/cjs/hooks/useWindowSize.js.map +0 -7
- package/dist/cjs/scrollingTimer.js.map +0 -7
- package/dist/esm/hooks/useParentElement.js.map +0 -7
- package/dist/esm/hooks/useSetRef.js.map +0 -7
- package/dist/esm/hooks/useWindowSize.js.map +0 -7
- package/dist/esm/scrollingTimer.js.map +0 -7
|
@@ -27,23 +27,77 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
27
27
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
28
|
var useFocusTrap_exports = {};
|
|
29
29
|
__export(useFocusTrap_exports, {
|
|
30
|
+
UseFocusTrapWithSchema: () => UseFocusTrapWithSchema,
|
|
30
31
|
useFocusTrap: () => useFocusTrap
|
|
31
32
|
});
|
|
32
33
|
var React = __toESM(require("react"));
|
|
33
34
|
var import_react = require("react");
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
var import_props_helpers = require("../props-helpers");
|
|
36
|
+
const useFocusTrapProps = {
|
|
37
|
+
firstElementRef: "object",
|
|
38
|
+
lastElementRef: "object",
|
|
39
|
+
onKeyDown: "function"
|
|
40
|
+
};
|
|
41
|
+
const getVariableType = (arg) => {
|
|
42
|
+
if (Array.isArray(arg))
|
|
43
|
+
return "array";
|
|
44
|
+
if (arg === null)
|
|
45
|
+
return "null";
|
|
46
|
+
if (arg === void 0)
|
|
47
|
+
return "undefined";
|
|
48
|
+
return typeof arg;
|
|
49
|
+
};
|
|
50
|
+
const throwTypeError = (validPropKey, invalidProp) => {
|
|
51
|
+
throw new Error(`Warning: You are trying to pass a not valid "${validPropKey}" property to use a useFocusTrap hook, please provide a valid type.
|
|
52
|
+
|
|
53
|
+
Received: ${getVariableType(invalidProp)}
|
|
54
|
+
Expected: ${useFocusTrapProps[validPropKey]}
|
|
55
|
+
`);
|
|
56
|
+
};
|
|
57
|
+
const throwRequiredError = (validPropKey) => {
|
|
58
|
+
throw new Error(`Warning: Please provide a "${validPropKey}" property to use a useFocusTrap hook, this property is required.`);
|
|
59
|
+
};
|
|
60
|
+
const validateProps = (componentProps) => {
|
|
61
|
+
if (componentProps.firstElementRef === void 0) {
|
|
62
|
+
throwRequiredError("firstElementRef");
|
|
63
|
+
}
|
|
64
|
+
if (componentProps.lastElementRef === void 0) {
|
|
65
|
+
throwRequiredError("lastElementRef");
|
|
41
66
|
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
e.stopPropagation();
|
|
45
|
-
lastElementRef.current.focus();
|
|
67
|
+
if (componentProps.firstElementRef && typeof componentProps.firstElementRef !== "object") {
|
|
68
|
+
throwTypeError("firstElementRef", componentProps.firstElementRef);
|
|
46
69
|
}
|
|
47
|
-
|
|
70
|
+
if (componentProps.lastElementRef && typeof componentProps.lastElementRef !== "object") {
|
|
71
|
+
throwTypeError("lastElementRef", componentProps.lastElementRef);
|
|
72
|
+
}
|
|
73
|
+
if (componentProps.onKeyDown && typeof componentProps.onKeyDown !== "function") {
|
|
74
|
+
throwTypeError("onKeyDown", componentProps.onKeyDown);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const propTypes = {
|
|
78
|
+
firstElementRef: import_props_helpers.PropTypes.oneOfType([import_props_helpers.PropTypes.oneOf([null]), import_props_helpers.PropTypes.node]).description("Reference to the first element in the focus trap.").isRequired,
|
|
79
|
+
lastElementRef: import_props_helpers.PropTypes.oneOfType([import_props_helpers.PropTypes.oneOf([null]), import_props_helpers.PropTypes.node]).description("Reference to the second element in the focus trap.").isRequired,
|
|
80
|
+
onKeyDown: import_props_helpers.PropTypes.func.description("Optional onKeyDown callback.")
|
|
81
|
+
};
|
|
82
|
+
const useFocusTrap = (props) => {
|
|
83
|
+
(0, import_react.useEffect)(() => validateProps(props), [props]);
|
|
84
|
+
const { firstElementRef, lastElementRef, onKeyDown } = props;
|
|
85
|
+
return (0, import_react.useCallback)((e) => {
|
|
86
|
+
if (onKeyDown)
|
|
87
|
+
onKeyDown(e);
|
|
88
|
+
if (e.key === "Tab" && !e.shiftKey && e.target === lastElementRef.current && firstElementRef.current) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
firstElementRef.current.focus();
|
|
92
|
+
}
|
|
93
|
+
if (e.key === "Tab" && e.shiftKey && e.target === firstElementRef.current && lastElementRef.current) {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
lastElementRef.current.focus();
|
|
97
|
+
}
|
|
98
|
+
}, [firstElementRef, lastElementRef, onKeyDown]);
|
|
99
|
+
};
|
|
100
|
+
const UseFocusTrapWithSchema = (0, import_props_helpers.describe)(useFocusTrap);
|
|
101
|
+
UseFocusTrapWithSchema.propTypes = propTypes;
|
|
48
102
|
module.exports = __toCommonJS(useFocusTrap_exports);
|
|
49
103
|
//# sourceMappingURL=useFocusTrap.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useFocusTrap.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback } from 'react';\n\ntype UseFocusTrapT = <T extends HTMLElement = HTMLElement, K extends HTMLElement = HTMLElement>({\n firstElementRef,\n lastElementRef,\n onKeyDown,\n}: {\n firstElementRef: React.MutableRefObject<T | null>;\n lastElementRef: React.MutableRefObject<K | null>;\n onKeyDown?: (e: KeyboardEvent) => void;\n}) => (e: KeyboardEvent) => void;\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useEffect, WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '../props-helpers';\n\nconst useFocusTrapProps: { [index: string]: string } = {\n firstElementRef: 'object',\n lastElementRef: 'object',\n onKeyDown: 'function',\n};\n\nconst getVariableType = (arg: unknown): string => {\n if (Array.isArray(arg)) return 'array';\n if (arg === null) return 'null';\n if (arg === undefined) return 'undefined';\n return typeof arg;\n};\n\nconst throwTypeError = (validPropKey: string, invalidProp: unknown): void => {\n throw new Error(\n `Warning: You are trying to pass a not valid \"${validPropKey}\" property to use a useFocusTrap hook, please provide a valid type.\n\n Received: ${getVariableType(invalidProp)}\n Expected: ${useFocusTrapProps[validPropKey]}\n `,\n );\n};\n\nconst throwRequiredError = (validPropKey: string): void => {\n throw new Error(\n `Warning: Please provide a \"${validPropKey}\" property to use a useFocusTrap hook, this property is required.`,\n );\n};\n\nconst validateProps = (componentProps: Record<string, unknown>): void => {\n if (componentProps.firstElementRef === undefined) {\n throwRequiredError('firstElementRef');\n }\n if (componentProps.lastElementRef === undefined) {\n throwRequiredError('lastElementRef');\n }\n if (componentProps.firstElementRef && typeof componentProps.firstElementRef !== 'object') {\n throwTypeError('firstElementRef', componentProps.firstElementRef);\n }\n if (componentProps.lastElementRef && typeof componentProps.lastElementRef !== 'object') {\n throwTypeError('lastElementRef', componentProps.lastElementRef);\n }\n if (componentProps.onKeyDown && typeof componentProps.onKeyDown !== 'function') {\n throwTypeError('onKeyDown', componentProps.onKeyDown);\n }\n};\n\nconst propTypes = {\n firstElementRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.node]).description(\n 'Reference to the first element in the focus trap.',\n ).isRequired,\n lastElementRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.node]).description(\n 'Reference to the second element in the focus trap.',\n ).isRequired,\n onKeyDown: PropTypes.func.description('Optional onKeyDown callback.'),\n} as WeakValidationMap<unknown>;\n\ntype UseFocusTrapT = <T extends HTMLElement = HTMLElement, K extends HTMLElement = HTMLElement>({\n firstElementRef,\n lastElementRef,\n onKeyDown,\n}: {\n firstElementRef: React.MutableRefObject<T | null>;\n lastElementRef: React.MutableRefObject<K | null>;\n onKeyDown?: (e: KeyboardEvent) => void;\n}) => (e: KeyboardEvent) => void;\n\nconst useFocusTrap: UseFocusTrapT = (props) => {\n // We need to investigate how to validate references with useValidateTypescriptPropTypes.\n useEffect(() => validateProps(props), [props]);\n\n const { firstElementRef, lastElementRef, onKeyDown } = props;\n\n return useCallback(\n (e: KeyboardEvent) => {\n if (onKeyDown) onKeyDown(e);\n // we need to check all the condition before preventing default\n // because we want last-element/first-element tab/shift-tab to keep working\n\n if (e.key === 'Tab' && !e.shiftKey && e.target === lastElementRef.current && firstElementRef.current) {\n e.preventDefault();\n e.stopPropagation();\n firstElementRef.current.focus();\n }\n if (e.key === 'Tab' && e.shiftKey && e.target === firstElementRef.current && lastElementRef.current) {\n e.preventDefault();\n e.stopPropagation();\n lastElementRef.current.focus();\n }\n },\n [firstElementRef, lastElementRef, onKeyDown],\n );\n};\n\nconst UseFocusTrapWithSchema = describe(useFocusTrap);\n\nUseFocusTrapWithSchema.propTypes = propTypes;\n\nexport { useFocusTrap, UseFocusTrapWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAiE;AACjE,2BAAoC;AAEpC,MAAM,oBAAiD;AAAA,EACrD,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,WAAW;AACb;AAEA,MAAM,kBAAkB,CAAC,QAAyB;AAChD,MAAI,MAAM,QAAQ,GAAG;AAAG,WAAO;AAC/B,MAAI,QAAQ;AAAM,WAAO;AACzB,MAAI,QAAQ;AAAW,WAAO;AAC9B,SAAO,OAAO;AAChB;AAEA,MAAM,iBAAiB,CAAC,cAAsB,gBAA+B;AAC3E,QAAM,IAAI,MACR,gDAAgD;AAAA;AAAA,cAEtC,gBAAgB,WAAW;AAAA,cAC3B,kBAAkB;AAAA,GAE9B;AACF;AAEA,MAAM,qBAAqB,CAAC,iBAA+B;AACzD,QAAM,IAAI,MACR,8BAA8B,+EAChC;AACF;AAEA,MAAM,gBAAgB,CAAC,mBAAkD;AACvE,MAAI,eAAe,oBAAoB,QAAW;AAChD,uBAAmB,iBAAiB;AAAA,EACtC;AACA,MAAI,eAAe,mBAAmB,QAAW;AAC/C,uBAAmB,gBAAgB;AAAA,EACrC;AACA,MAAI,eAAe,mBAAmB,OAAO,eAAe,oBAAoB,UAAU;AACxF,mBAAe,mBAAmB,eAAe,eAAe;AAAA,EAClE;AACA,MAAI,eAAe,kBAAkB,OAAO,eAAe,mBAAmB,UAAU;AACtF,mBAAe,kBAAkB,eAAe,cAAc;AAAA,EAChE;AACA,MAAI,eAAe,aAAa,OAAO,eAAe,cAAc,YAAY;AAC9E,mBAAe,aAAa,eAAe,SAAS;AAAA,EACtD;AACF;AAEA,MAAM,YAAY;AAAA,EAChB,iBAAiB,+BAAU,UAAU,CAAC,+BAAU,MAAM,CAAC,IAAI,CAAC,GAAG,+BAAU,IAAI,CAAC,EAAE,YAC9E,mDACF,EAAE;AAAA,EACF,gBAAgB,+BAAU,UAAU,CAAC,+BAAU,MAAM,CAAC,IAAI,CAAC,GAAG,+BAAU,IAAI,CAAC,EAAE,YAC7E,oDACF,EAAE;AAAA,EACF,WAAW,+BAAU,KAAK,YAAY,8BAA8B;AACtE;AAYA,MAAM,eAA8B,CAAC,UAAU;AAE7C,8BAAU,MAAM,cAAc,KAAK,GAAG,CAAC,KAAK,CAAC;AAE7C,QAAM,EAAE,iBAAiB,gBAAgB,cAAc;AAEvD,SAAO,8BACL,CAAC,MAAqB;AACpB,QAAI;AAAW,gBAAU,CAAC;AAI1B,QAAI,EAAE,QAAQ,SAAS,CAAC,EAAE,YAAY,EAAE,WAAW,eAAe,WAAW,gBAAgB,SAAS;AACpG,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,sBAAgB,QAAQ,MAAM;AAAA,IAChC;AACA,QAAI,EAAE,QAAQ,SAAS,EAAE,YAAY,EAAE,WAAW,gBAAgB,WAAW,eAAe,SAAS;AACnG,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,qBAAe,QAAQ,MAAM;AAAA,IAC/B;AAAA,EACF,GACA,CAAC,iBAAiB,gBAAgB,SAAS,CAC7C;AACF;AAEA,MAAM,yBAAyB,mCAAS,YAAY;AAEpD,uBAAuB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,7 @@ const useHotkeys = ({ keys, handler, options = {} }, deps = []) => {
|
|
|
38
38
|
(0, import_react.useEffect)(() => {
|
|
39
39
|
(0, import_hotkeys_js.default)(keys, options, memoizedCallback);
|
|
40
40
|
return () => import_hotkeys_js.default.unbind(keys);
|
|
41
|
-
}, [memoizedCallback]);
|
|
41
|
+
}, [keys, memoizedCallback, options]);
|
|
42
42
|
};
|
|
43
43
|
var useHotkeys_default = useHotkeys;
|
|
44
44
|
module.exports = __toCommonJS(useHotkeys_exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useHotkeys.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import hotkeys from 'hotkeys-js';\nimport { useCallback, useEffect } from 'react';\n\nexport const useHotkeys = ({ keys, handler, options = {} }, deps = []) => {\n const memoizedCallback = useCallback(handler, deps);\n\n useEffect(() => {\n hotkeys(keys, options, memoizedCallback);\n\n return () => hotkeys.unbind(keys);\n }, [memoizedCallback]);\n};\n\nexport default useHotkeys;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import hotkeys, { KeyHandler } from 'hotkeys-js';\nimport { useCallback, useEffect } from 'react';\n\ntype Options = {\n scope?: string;\n element?: HTMLElement | null;\n keyup?: boolean | null;\n keydown?: boolean | null;\n splitKey?: string;\n};\ninterface UseHotKeysArg {\n keys: string;\n options?: Options;\n handler: KeyHandler;\n}\n\nexport const useHotkeys = ({ keys, handler, options = {} }: UseHotKeysArg, deps: unknown[] = []) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const memoizedCallback = useCallback(handler, deps);\n\n useEffect(() => {\n hotkeys(keys, options, memoizedCallback);\n\n return () => hotkeys.unbind(keys);\n }, [keys, memoizedCallback, options]);\n};\n\nexport default useHotkeys;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAoC;AACpC,mBAAuC;AAehC,MAAM,aAAa,CAAC,EAAE,MAAM,SAAS,UAAU,CAAC,KAAoB,OAAkB,CAAC,MAAM;AAElG,QAAM,mBAAmB,8BAAY,SAAS,IAAI;AAElD,8BAAU,MAAM;AACd,mCAAQ,MAAM,SAAS,gBAAgB;AAEvC,WAAO,MAAM,0BAAQ,OAAO,IAAI;AAAA,EAClC,GAAG,CAAC,MAAM,kBAAkB,OAAO,CAAC;AACtC;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,13 +41,15 @@ const useHoverHandlersDelay = ({
|
|
|
41
41
|
const hideTimer = (0, import_react.useRef)();
|
|
42
42
|
const showTimer = (0, import_react.useRef)();
|
|
43
43
|
const delayedHide = (0, import_react.useCallback)(() => {
|
|
44
|
-
|
|
44
|
+
if (showTimer.current)
|
|
45
|
+
clearTimeout(showTimer.current);
|
|
45
46
|
hideTimer.current = setTimeout(onMouseLeave, hideDelay);
|
|
46
|
-
}, []);
|
|
47
|
+
}, [hideDelay, onMouseLeave]);
|
|
47
48
|
const delayedShow = (0, import_react.useCallback)(() => {
|
|
48
|
-
|
|
49
|
+
if (hideTimer.current)
|
|
50
|
+
clearTimeout(hideTimer.current);
|
|
49
51
|
showTimer.current = setTimeout(onMouseOver, showDelay);
|
|
50
|
-
}, []);
|
|
52
|
+
}, [onMouseOver, showDelay]);
|
|
51
53
|
return {
|
|
52
54
|
onMouseOver: delayedShow,
|
|
53
55
|
onMouseLeave: delayedHide
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useHoverHandlersDelay.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useRef } from 'react';\n\nexport const useHoverHandlersDelay = ({\n onMouseOver,\n onMouseLeave,\n hideDelay = 300,\n showDelay = 300,\n}) => {\n const hideTimer = useRef();\n const showTimer = useRef();\n\n const delayedHide = useCallback(() => {\n clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(onMouseLeave, hideDelay);\n }, []);\n\n const delayedShow = useCallback(() => {\n clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(onMouseOver, showDelay);\n }, []);\n\n return {\n onMouseOver: delayedShow,\n onMouseLeave: delayedHide,\n };\n};\n\nexport default useHoverHandlersDelay;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;
|
|
4
|
+
"sourcesContent": ["import { useCallback, useRef } from 'react';\n\ninterface UseHoverHandlersDelayArg {\n onMouseOver: () => void;\n onMouseLeave: () => void;\n hideDelay?: number;\n showDelay?: number;\n}\n\nexport const useHoverHandlersDelay = ({\n onMouseOver,\n onMouseLeave,\n hideDelay = 300,\n showDelay = 300,\n}: UseHoverHandlersDelayArg) => {\n const hideTimer = useRef<NodeJS.Timeout>();\n const showTimer = useRef<NodeJS.Timeout>();\n\n const delayedHide = useCallback(() => {\n if (showTimer.current) clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(onMouseLeave, hideDelay);\n }, [hideDelay, onMouseLeave]);\n\n const delayedShow = useCallback(() => {\n if (hideTimer.current) clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(onMouseOver, showDelay);\n }, [onMouseOver, showDelay]);\n\n return {\n onMouseOver: delayedShow,\n onMouseLeave: delayedHide,\n };\n};\n\nexport default useHoverHandlersDelay;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AAS7B,MAAM,wBAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,MACkB;AAC9B,QAAM,YAAY,yBAAuB;AACzC,QAAM,YAAY,yBAAuB;AAEzC,QAAM,cAAc,8BAAY,MAAM;AACpC,QAAI,UAAU;AAAS,mBAAa,UAAU,OAAO;AACrD,cAAU,UAAU,WAAW,cAAc,SAAS;AAAA,EACxD,GAAG,CAAC,WAAW,YAAY,CAAC;AAE5B,QAAM,cAAc,8BAAY,MAAM;AACpC,QAAI,UAAU;AAAS,mBAAa,UAAU,OAAO;AACrD,cAAU,UAAU,WAAW,aAAa,SAAS;AAAA,EACvD,GAAG,CAAC,aAAa,SAAS,CAAC;AAE3B,SAAO;AAAA,IACL,aAAa;AAAA,IACb,cAAc;AAAA,EAChB;AACF;AAEA,IAAO,gCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
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);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useIsMobile_exports = {};
|
|
29
|
+
__export(useIsMobile_exports, {
|
|
30
|
+
useIsMobile: () => useIsMobile
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_pui_theme = require("@elliemae/pui-theme");
|
|
35
|
+
const theme = (0, import_pui_theme.getDefaultTheme)();
|
|
36
|
+
const isMobile = () => {
|
|
37
|
+
if (!window)
|
|
38
|
+
return false;
|
|
39
|
+
return Number(theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
|
|
40
|
+
};
|
|
41
|
+
const useIsMobile = () => {
|
|
42
|
+
const [mobile, setMobile] = (0, import_react.useState)(isMobile());
|
|
43
|
+
(0, import_react.useEffect)(() => {
|
|
44
|
+
function handleResize() {
|
|
45
|
+
setMobile(isMobile());
|
|
46
|
+
}
|
|
47
|
+
window?.addEventListener("resize", handleResize);
|
|
48
|
+
return () => {
|
|
49
|
+
window?.removeEventListener("resize", handleResize);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
if (!window)
|
|
53
|
+
return false;
|
|
54
|
+
return mobile;
|
|
55
|
+
};
|
|
56
|
+
module.exports = __toCommonJS(useIsMobile_exports);
|
|
57
|
+
//# sourceMappingURL=useIsMobile.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useIsMobile.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useState, useEffect } from 'react';\nimport { getDefaultTheme } from '@elliemae/pui-theme';\nimport type { Theme } from '@elliemae/pui-theme';\n\nconst theme = getDefaultTheme() as Theme;\n\nconst isMobile = (): boolean => {\n if (!window) return false;\n return Number(theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0;\n};\n\nexport const useIsMobile = (): boolean => {\n const [mobile, setMobile] = useState<boolean>(isMobile());\n\n useEffect(() => {\n function handleResize() {\n setMobile(isMobile());\n }\n window?.addEventListener('resize', handleResize);\n return () => {\n window?.removeEventListener('resize', handleResize);\n };\n }, []);\n\n if (!window) return false;\n return mobile;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AACpC,uBAAgC;AAGhC,MAAM,QAAQ,sCAAgB;AAE9B,MAAM,WAAW,MAAe;AAC9B,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO,OAAO,MAAM,YAAY,OAAO,MAAM,IAAI,EAAE,EAAE,IAAI,OAAO,cAAc;AAChF;AAEO,MAAM,cAAc,MAAe;AACxC,QAAM,CAAC,QAAQ,aAAa,2BAAkB,SAAS,CAAC;AAExD,8BAAU,MAAM;AACd,4BAAwB;AACtB,gBAAU,SAAS,CAAC;AAAA,IACtB;AACA,YAAQ,iBAAiB,UAAU,YAAY;AAC/C,WAAO,MAAM;AACX,cAAQ,oBAAoB,UAAU,YAAY;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useIsShowingEllipsis.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useEffect, useState, useMemo } from 'react';\n\nexport const useIsShowingEllipsis = <T extends HTMLElement | null = HTMLElement | null>() => {\n const [element, setElement] = useState<T>();\n\n const [isShowingEllipsis, setIsShowingEllipsis] = useState(false);\n\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n if (entries.length) {\n const [textWrapperEntry] = entries;\n const el = textWrapperEntry.target;\n setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);\n }\n }),\n [],\n );\n\n useEffect(() => {\n if (element) {\n setIsShowingEllipsis(element.scrollWidth > element.clientWidth);\n resizeObserver.observe(element);\n }\n return () => {\n if (element) {\n resizeObserver.unobserve(element);\n }\n };\n }, [resizeObserver, element]);\n\n return { setElement, isShowingEllipsis };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAEtC,MAAM,uBAAuB,MAAyD;AAC3F,QAAM,CAAC,SAAS,cAAc;
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAEtC,MAAM,uBAAuB,MAAyD;AAC3F,QAAM,CAAC,SAAS,cAAc,2BAAY;AAE1C,QAAM,CAAC,mBAAmB,wBAAwB,2BAAS,KAAK;AAEhE,QAAM,iBAAiB,0BACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,QAAI,QAAQ,QAAQ;AAClB,YAAM,CAAC,oBAAoB;AAC3B,YAAM,KAAK,iBAAiB;AAC5B,2BAAqB,IAAI,cAAc,IAAI,WAAW;AAAA,IACxD;AAAA,EACF,CAAC,GACH,CAAC,CACH;AAEA,8BAAU,MAAM;AACd,QAAI,SAAS;AACX,2BAAqB,QAAQ,cAAc,QAAQ,WAAW;AAC9D,qBAAe,QAAQ,OAAO;AAAA,IAChC;AACA,WAAO,MAAM;AACX,UAAI,SAAS;AACX,uBAAe,UAAU,OAAO;AAAA,MAClC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,gBAAgB,OAAO,CAAC;AAE5B,SAAO,EAAE,YAAY,kBAAkB;AACzC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useOnElementResize.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useState, useEffect, useRef, useMemo } from 'react';\n\n// Custom hook to track dimension of a component\n// Taken and modified from https://stackoverflow.com/a/60218754\nexport const useOnElementResize = <T extends HTMLElement>(\n targetRef: React.RefObject<T>,\n): Record<'width' | 'height', number> => {\n const [width, setWidth] = useState(targetRef.current?.offsetWidth ?? 0);\n const [height, setHeight] = useState(targetRef.current?.offsetHeight ?? 0);\n const observer = useRef<ResizeObserver>();\n\n useEffect(() => {\n function outputsize() {\n setWidth(targetRef.current?.offsetWidth ?? 0);\n setHeight(targetRef.current?.offsetHeight ?? 0);\n }\n\n observer.current = new ResizeObserver(outputsize);\n observer.current.observe(targetRef.current as Element);\n\n return () => {\n observer.current?.disconnect();\n };\n }, [targetRef]);\n\n return useMemo(\n () => ({\n width,\n height,\n }),\n [width, height],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4D;AAIrD,MAAM,qBAAqB,CAChC,cACuC;AACvC,QAAM,CAAC,OAAO,YAAY,2BAAS,UAAU,SAAS,eAAe;
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4D;AAIrD,MAAM,qBAAqB,CAChC,cACuC;AACvC,QAAM,CAAC,OAAO,YAAY,2BAAS,UAAU,SAAS,eAAe,CAAC;AACtE,QAAM,CAAC,QAAQ,aAAa,2BAAS,UAAU,SAAS,gBAAgB,CAAC;AACzE,QAAM,WAAW,yBAAuB;AAExC,8BAAU,MAAM;AACd,0BAAsB;AACpB,eAAS,UAAU,SAAS,eAAe,CAAC;AAC5C,gBAAU,UAAU,SAAS,gBAAgB,CAAC;AAAA,IAChD;AAEA,aAAS,UAAU,IAAI,eAAe,UAAU;AAChD,aAAS,QAAQ,QAAQ,UAAU,OAAkB;AAErD,WAAO,MAAM;AACX,eAAS,SAAS,WAAW;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO,0BACL,MAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF,IACA,CAAC,OAAO,MAAM,CAChB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/usePrevious.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useRef } from 'react';\n\nexport const usePrevious = (value) => {\n const ref = useRef();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n};\n\nexport default usePrevious;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAE3B,MAAM,cAAc,CAAC,
|
|
4
|
+
"sourcesContent": ["import { useEffect, useRef } from 'react';\n\nexport const usePrevious = (value: unknown) => {\n const ref = useRef<unknown>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n};\n\nexport default usePrevious;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAE3B,MAAM,cAAc,CAAC,UAAmB;AAC7C,QAAM,MAAM,yBAAgB;AAE5B,8BAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAChB,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO,IAAI;AACb;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,7 +36,7 @@ var import_raf = __toESM(require("raf"));
|
|
|
36
36
|
var import_resize_observer_polyfill = __toESM(require("resize-observer-polyfill"));
|
|
37
37
|
const useResizeObserver = (handler, el) => {
|
|
38
38
|
const [node, setRef] = (0, import_react.useState)(el);
|
|
39
|
-
const resizeObserver = new import_resize_observer_polyfill.default((entries) => {
|
|
39
|
+
const resizeObserver = (0, import_react.useMemo)(() => new import_resize_observer_polyfill.default((entries) => {
|
|
40
40
|
if (!Array.isArray(entries))
|
|
41
41
|
return;
|
|
42
42
|
if (!entries.length)
|
|
@@ -46,13 +46,13 @@ const useResizeObserver = (handler, el) => {
|
|
|
46
46
|
width: entry.target.offsetWidth,
|
|
47
47
|
height: entry.target.offsetHeight
|
|
48
48
|
}, entry.target));
|
|
49
|
-
});
|
|
49
|
+
}), [handler]);
|
|
50
50
|
const htmlEl = el || node;
|
|
51
51
|
(0, import_react.useEffect)(() => {
|
|
52
52
|
if (htmlEl)
|
|
53
53
|
resizeObserver.observe(htmlEl);
|
|
54
54
|
return () => htmlEl && resizeObserver.unobserve(htmlEl);
|
|
55
|
-
}, [htmlEl]);
|
|
55
|
+
}, [htmlEl, resizeObserver]);
|
|
56
56
|
return [setRef];
|
|
57
57
|
};
|
|
58
58
|
var useResizeObserver_default = useResizeObserver;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useResizeObserver.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useState } from 'react';\nimport raf from 'raf';\nimport ResizeObserver from 'resize-observer-polyfill';\n\nexport const useResizeObserver = (handler, el) => {\n const [node, setRef] = useState(el);\n\n const resizeObserver = new ResizeObserver(entries => {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import { useEffect, useMemo, useState } from 'react';\nimport raf from 'raf';\nimport ResizeObserver from 'resize-observer-polyfill';\n\ntype HandlerT = (measures: { width: number; height: number }, element: Element) => void;\n\nexport const useResizeObserver = (handler: HandlerT, el: HTMLElement) => {\n const [node, setRef] = useState(el);\n\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n if (!Array.isArray(entries)) return;\n if (!entries.length) return;\n const entry = entries[0];\n\n // execute on the next animation frame\n raf(() =>\n handler(\n {\n width: (entry.target as HTMLElement).offsetWidth,\n height: (entry.target as HTMLElement).offsetHeight,\n },\n entry.target,\n ),\n );\n }),\n [handler],\n );\n\n const htmlEl = el || node;\n\n useEffect(() => {\n if (htmlEl) resizeObserver.observe(htmlEl);\n return () => htmlEl && resizeObserver.unobserve(htmlEl);\n }, [htmlEl, resizeObserver]);\n\n return [setRef];\n};\n\nexport default useResizeObserver;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAC7C,iBAAgB;AAChB,sCAA2B;AAIpB,MAAM,oBAAoB,CAAC,SAAmB,OAAoB;AACvE,QAAM,CAAC,MAAM,UAAU,2BAAS,EAAE;AAElC,QAAM,iBAAiB,0BACrB,MACE,IAAI,wCAAe,CAAC,YAAY;AAC9B,QAAI,CAAC,MAAM,QAAQ,OAAO;AAAG;AAC7B,QAAI,CAAC,QAAQ;AAAQ;AACrB,UAAM,QAAQ,QAAQ;AAGtB,4BAAI,MACF,QACE;AAAA,MACE,OAAQ,MAAM,OAAuB;AAAA,MACrC,QAAS,MAAM,OAAuB;AAAA,IACxC,GACA,MAAM,MACR,CACF;AAAA,EACF,CAAC,GACH,CAAC,OAAO,CACV;AAEA,QAAM,SAAS,MAAM;AAErB,8BAAU,MAAM;AACd,QAAI;AAAQ,qBAAe,QAAQ,MAAM;AACzC,WAAO,MAAM,UAAU,eAAe,UAAU,MAAM;AAAA,EACxD,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO,CAAC,MAAM;AAChB;AAEA,IAAO,4BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useShouldRecalculate.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useRef } from 'react';\n\nexport const useShouldRecalculate = (bool) => {\n const prevValueRef = useRef(0);\n if (!bool) {\n // If we need to recalculate, change the value we return\n prevValueRef.current += 1;\n } // else we return the same value as the previous render, which won't trigger a recalculation\n return prevValueRef.current;\n};\n\nexport default useShouldRecalculate;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAuB;AAEhB,MAAM,uBAAuB,CAAC,
|
|
4
|
+
"sourcesContent": ["import { useRef } from 'react';\n\nexport const useShouldRecalculate = (bool: boolean) => {\n const prevValueRef = useRef(0);\n if (!bool) {\n // If we need to recalculate, change the value we return\n prevValueRef.current += 1;\n } // else we return the same value as the previous render, which won't trigger a recalculation\n return prevValueRef.current;\n};\n\nexport default useShouldRecalculate;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAuB;AAEhB,MAAM,uBAAuB,CAAC,SAAkB;AACrD,QAAM,eAAe,yBAAO,CAAC;AAC7B,MAAI,CAAC,MAAM;AAET,iBAAa,WAAW;AAAA,EAC1B;AACA,SAAO,aAAa;AACtB;AAEA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -48,15 +48,17 @@ function getPositionOffset(listEl, scrollableEl) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
function isParent(parentNode, childNode) {
|
|
51
|
-
return childNode
|
|
51
|
+
return childNode?.parentNode === parentNode || !!childNode?.parentNode && isParent(parentNode, childNode.parentNode);
|
|
52
52
|
}
|
|
53
53
|
const useWindowScrollerList = ({ listInstance, outerListRef }) => {
|
|
54
54
|
const scrollableParent = (0, import_react.useRef)();
|
|
55
55
|
const listOffset = (0, import_react.useRef)();
|
|
56
|
-
const getElementOffset = () => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const getElementOffset = (0, import_react.useCallback)(() => {
|
|
57
|
+
if (outerListRef.current && scrollableParent.current) {
|
|
58
|
+
listOffset.current = getPositionOffset(outerListRef.current, scrollableParent.current);
|
|
59
|
+
}
|
|
60
|
+
}, [outerListRef]);
|
|
61
|
+
const handleScroll = (0, import_react.useCallback)((e) => {
|
|
60
62
|
if (!scrollableParent.current) {
|
|
61
63
|
const containerTarget = e.target === document ? document.body : e.target;
|
|
62
64
|
scrollableParent.current = isParent(containerTarget, outerListRef.current) && containerTarget;
|
|
@@ -65,10 +67,10 @@ const useWindowScrollerList = ({ listInstance, outerListRef }) => {
|
|
|
65
67
|
return;
|
|
66
68
|
getElementOffset();
|
|
67
69
|
const scrollOffset = getScrollOffset(scrollableParent.current);
|
|
68
|
-
const scrollTop = Math.max(0, scrollOffset.top - listOffset.current
|
|
70
|
+
const scrollTop = Math.max(0, scrollOffset.top - (listOffset.current?.top ?? 0));
|
|
69
71
|
if (listInstance.current)
|
|
70
|
-
listInstance.current.scrollTo(scrollTop);
|
|
71
|
-
};
|
|
72
|
+
listInstance.current.scrollTo({ top: scrollTop });
|
|
73
|
+
}, [getElementOffset, listInstance, outerListRef]);
|
|
72
74
|
(0, import_react.useEffect)(() => {
|
|
73
75
|
window.addEventListener("scroll", handleScroll, true);
|
|
74
76
|
window.addEventListener("resize", getElementOffset, true);
|
|
@@ -76,7 +78,7 @@ const useWindowScrollerList = ({ listInstance, outerListRef }) => {
|
|
|
76
78
|
window.removeEventListener("scroll", handleScroll, true);
|
|
77
79
|
window.removeEventListener("resize", getElementOffset, true);
|
|
78
80
|
};
|
|
79
|
-
}, []);
|
|
81
|
+
}, [getElementOffset, handleScroll]);
|
|
80
82
|
};
|
|
81
83
|
var useWindowScrollerList_default = useWindowScrollerList;
|
|
82
84
|
module.exports = __toCommonJS(useWindowScrollerList_exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useWindowScrollerList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useRef } from 'react';\n\nfunction getScrollOffset(element = { scrollTop: 0, scrollLeft: 0 }) {\n return {\n top: element.scrollTop,\n left: element.scrollLeft,\n };\n}\n\nfunction getPositionOffset(listEl, scrollableEl) {\n const scrollOffset = getScrollOffset(scrollableEl);\n const elementRect = listEl.getBoundingClientRect();\n const containerRect = scrollableEl.getBoundingClientRect();\n return {\n top: elementRect.top + scrollOffset.top - containerRect.top,\n left: elementRect.left + scrollOffset.top - containerRect.left,\n };\n}\n\nfunction isParent(parentNode, childNode) {\n return (\n childNode
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useEffect, useRef } from 'react';\n\ninterface UseWindowScrollerListArg {\n listInstance: React.RefObject<HTMLElement>;\n outerListRef: React.RefObject<HTMLElement>;\n}\n\nfunction getScrollOffset(element = { scrollTop: 0, scrollLeft: 0 }) {\n return {\n top: element.scrollTop,\n left: element.scrollLeft,\n };\n}\n\nfunction getPositionOffset(listEl: HTMLElement, scrollableEl: HTMLElement) {\n const scrollOffset = getScrollOffset(scrollableEl);\n const elementRect = listEl.getBoundingClientRect();\n const containerRect = scrollableEl.getBoundingClientRect();\n return {\n top: elementRect.top + scrollOffset.top - containerRect.top,\n left: elementRect.left + scrollOffset.top - containerRect.left,\n };\n}\n\nfunction isParent(parentNode: EventTarget | null, childNode: HTMLElement | null): boolean {\n return (\n childNode?.parentNode === (parentNode as ParentNode) ||\n (!!childNode?.parentNode && isParent(parentNode, childNode.parentNode as HTMLElement))\n );\n}\n\nexport const useWindowScrollerList = ({ listInstance, outerListRef }: UseWindowScrollerListArg) => {\n const scrollableParent = useRef<HTMLElement | false>();\n const listOffset = useRef<ReturnType<typeof getPositionOffset>>();\n\n const getElementOffset = useCallback(() => {\n if (outerListRef.current && scrollableParent.current) {\n listOffset.current = getPositionOffset(outerListRef.current, scrollableParent.current);\n }\n }, [outerListRef]);\n\n const handleScroll: EventListener = useCallback(\n (e) => {\n if (!scrollableParent.current) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const containerTarget = e.target === document ? document.body : e.target;\n scrollableParent.current = isParent(containerTarget, outerListRef.current) && (containerTarget as HTMLElement);\n }\n\n if (!scrollableParent.current) return;\n\n getElementOffset();\n\n const scrollOffset = getScrollOffset(scrollableParent.current);\n const scrollTop = Math.max(0, scrollOffset.top - (listOffset.current?.top ?? 0));\n if (listInstance.current) listInstance.current.scrollTo({ top: scrollTop });\n },\n [getElementOffset, listInstance, outerListRef],\n );\n\n useEffect(() => {\n window.addEventListener('scroll', handleScroll, true);\n window.addEventListener('resize', getElementOffset, true);\n return () => {\n window.removeEventListener('scroll', handleScroll, true);\n window.removeEventListener('resize', getElementOffset, true);\n };\n }, [getElementOffset, handleScroll]);\n};\n\nexport default useWindowScrollerList;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsD;AAOtD,yBAAyB,UAAU,EAAE,WAAW,GAAG,YAAY,EAAE,GAAG;AAClE,SAAO;AAAA,IACL,KAAK,QAAQ;AAAA,IACb,MAAM,QAAQ;AAAA,EAChB;AACF;AAEA,2BAA2B,QAAqB,cAA2B;AACzE,QAAM,eAAe,gBAAgB,YAAY;AACjD,QAAM,cAAc,OAAO,sBAAsB;AACjD,QAAM,gBAAgB,aAAa,sBAAsB;AACzD,SAAO;AAAA,IACL,KAAK,YAAY,MAAM,aAAa,MAAM,cAAc;AAAA,IACxD,MAAM,YAAY,OAAO,aAAa,MAAM,cAAc;AAAA,EAC5D;AACF;AAEA,kBAAkB,YAAgC,WAAwC;AACxF,SACE,WAAW,eAAgB,cAC1B,CAAC,CAAC,WAAW,cAAc,SAAS,YAAY,UAAU,UAAyB;AAExF;AAEO,MAAM,wBAAwB,CAAC,EAAE,cAAc,mBAA6C;AACjG,QAAM,mBAAmB,yBAA4B;AACrD,QAAM,aAAa,yBAA6C;AAEhE,QAAM,mBAAmB,8BAAY,MAAM;AACzC,QAAI,aAAa,WAAW,iBAAiB,SAAS;AACpD,iBAAW,UAAU,kBAAkB,aAAa,SAAS,iBAAiB,OAAO;AAAA,IACvF;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AAEjB,QAAM,eAA8B,8BAClC,CAAC,MAAM;AACL,QAAI,CAAC,iBAAiB,SAAS;AAE7B,YAAM,kBAAkB,EAAE,WAAW,WAAW,SAAS,OAAO,EAAE;AAClE,uBAAiB,UAAU,SAAS,iBAAiB,aAAa,OAAO,KAAM;AAAA,IACjF;AAEA,QAAI,CAAC,iBAAiB;AAAS;AAE/B,qBAAiB;AAEjB,UAAM,eAAe,gBAAgB,iBAAiB,OAAO;AAC7D,UAAM,YAAY,KAAK,IAAI,GAAG,aAAa,MAAO,YAAW,SAAS,OAAO,EAAE;AAC/E,QAAI,aAAa;AAAS,mBAAa,QAAQ,SAAS,EAAE,KAAK,UAAU,CAAC;AAAA,EAC5E,GACA,CAAC,kBAAkB,cAAc,YAAY,CAC/C;AAEA,8BAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,cAAc,IAAI;AACpD,WAAO,iBAAiB,UAAU,kBAAkB,IAAI;AACxD,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,cAAc,IAAI;AACvD,aAAO,oBAAoB,UAAU,kBAAkB,IAAI;AAAA,IAC7D;AAAA,EACF,GAAG,CAAC,kBAAkB,YAAY,CAAC;AACrC;AAEA,IAAO,gCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
28
28
|
var src_exports = {};
|
|
29
29
|
__export(src_exports, {
|
|
30
30
|
DOCUMENT: () => import_platform.DOCUMENT,
|
|
31
|
+
UseFocusTrapWithSchema: () => import_hooks.UseFocusTrapWithSchema,
|
|
31
32
|
WINDOW: () => import_platform.WINDOW,
|
|
32
33
|
addLeadingZeros: () => import_timeUtils.addLeadingZeros,
|
|
33
34
|
addOrRemove: () => import_utils.addOrRemove,
|
|
@@ -54,15 +55,11 @@ __export(src_exports, {
|
|
|
54
55
|
groupBy: () => import_utils.groupBy,
|
|
55
56
|
hashArray: () => import_utils.hashArray,
|
|
56
57
|
isBoolean: () => import_utils.isBoolean,
|
|
57
|
-
isClassComponent: () => import_reactTypesUtility.isClassComponent,
|
|
58
|
-
isCompositeTypeElement: () => import_reactTypesUtility.isCompositeTypeElement,
|
|
59
58
|
isDOMTypeElement: () => import_reactTypesUtility.isDOMTypeElement,
|
|
60
|
-
isElement: () => import_reactTypesUtility.isElement,
|
|
61
59
|
isEmpty: () => import_utils.isEmpty,
|
|
62
60
|
isEqual: () => import_utils.isEqual,
|
|
63
61
|
isEqualWith: () => import_utils.isEqualWith,
|
|
64
62
|
isFunction: () => import_utils.isFunction,
|
|
65
|
-
isFunctionComponent: () => import_reactTypesUtility.isFunctionComponent,
|
|
66
63
|
isGreaterThan: () => import_validations.isGreaterThan,
|
|
67
64
|
isIn: () => import_operators.isIn,
|
|
68
65
|
isNaN: () => import_utils.isNaN,
|
|
@@ -70,7 +67,6 @@ __export(src_exports, {
|
|
|
70
67
|
isNotNull: () => import_operators.isNotNull,
|
|
71
68
|
isNull: () => import_operators.isNull,
|
|
72
69
|
isObject: () => import_utils.isObject,
|
|
73
|
-
isReactComponent: () => import_reactTypesUtility.isReactComponent,
|
|
74
70
|
isRequired: () => import_validations.isRequired,
|
|
75
71
|
isString: () => import_utils.isString,
|
|
76
72
|
isValidDate: () => import_validations.isValidDate,
|
|
@@ -92,7 +88,6 @@ __export(src_exports, {
|
|
|
92
88
|
pull: () => import_utils.pull,
|
|
93
89
|
range: () => import_utils.range,
|
|
94
90
|
removeUndefinedProperties: () => import_utils.removeUndefinedProperties,
|
|
95
|
-
resetTimer: () => import_scrollingTimer.resetTimer,
|
|
96
91
|
runAll: () => import_utils.runAll,
|
|
97
92
|
safeCall: () => import_utils.safeCall,
|
|
98
93
|
set: () => import_utils.set,
|
|
@@ -115,18 +110,15 @@ __export(src_exports, {
|
|
|
115
110
|
useForceUpdate: () => import_hooks.useForceUpdate,
|
|
116
111
|
useHotkeys: () => import_hooks.useHotkeys,
|
|
117
112
|
useHoverHandlersDelay: () => import_hooks.useHoverHandlersDelay,
|
|
113
|
+
useIsMobile: () => import_hooks.useIsMobile,
|
|
118
114
|
useIsShowingEllipsis: () => import_hooks.useIsShowingEllipsis,
|
|
119
115
|
useMeasure: () => import_hooks.useMeasure,
|
|
120
116
|
useOnClickOutside: () => import_hooks.useOnClickOutside,
|
|
121
117
|
useOnElementResize: () => import_hooks.useOnElementResize,
|
|
122
|
-
useParentElement: () => import_hooks.useParentElement,
|
|
123
118
|
usePrevious: () => import_hooks.usePrevious,
|
|
124
119
|
useResizeObserver: () => import_hooks.useResizeObserver,
|
|
125
|
-
useSetRef: () => import_hooks.useSetRef,
|
|
126
120
|
useShouldRecalculate: () => import_hooks.useShouldRecalculate,
|
|
127
|
-
useUncontrolled: () => import_hooks.useUncontrolled,
|
|
128
121
|
useWindowScrollerList: () => import_hooks.useWindowScrollerList,
|
|
129
|
-
useWindowSize: () => import_hooks.useWindowSize,
|
|
130
122
|
validDate: () => import_operators.validDate,
|
|
131
123
|
values: () => import_utils.values
|
|
132
124
|
});
|
|
@@ -142,7 +134,8 @@ var import_timeUtils = require("./timeUtils");
|
|
|
142
134
|
var import_compose = require("./compose");
|
|
143
135
|
var import_platform = require("./platform");
|
|
144
136
|
var import_reactTypesUtility = require("./reactTypesUtility");
|
|
145
|
-
var import_scrollingTimer = require("./scrollingTimer");
|
|
146
137
|
var import_validations = require("./validations");
|
|
138
|
+
__reExport(src_exports, require("./deprecated"));
|
|
139
|
+
__reExport(src_exports, require("./props-helpers"));
|
|
147
140
|
module.exports = __toCommonJS(src_exports);
|
|
148
141
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { default as getComponentFromProps } from './getComponentFromProps';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';\nexport { capitalize } from './capitalize';\nexport {\n checkNotEmpty,\n checkEmpty,\n greaterThan,\n validDate,\n equal,\n notEqual,\n isNull,\n isNotNull,\n isIn,\n isNotIn,\n greaterThanOrEquals,\n lessThanOrEquals,\n startsWith,\n contains,\n} from './operators';\nexport {\n cx,\n runAll,\n hashArray,\n safeCall,\n removeUndefinedProperties,\n isObject,\n curry,\n arrayMove,\n uniq,\n filter,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n cloneDeep,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n pull,\n sortBy,\n sumBy,\n transform,\n isFunction,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n toggleInObject,\n toggleInArray,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n addOrRemove,\n isEqualWith,\n isBoolean,\n} from './utils';\nexport { setRef, mergeRefs, logger } from './system';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["export { default as getComponentFromProps } from './getComponentFromProps';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';\nexport { capitalize } from './capitalize';\nexport {\n checkNotEmpty,\n checkEmpty,\n greaterThan,\n validDate,\n equal,\n notEqual,\n isNull,\n isNotNull,\n isIn,\n isNotIn,\n greaterThanOrEquals,\n lessThanOrEquals,\n startsWith,\n contains,\n} from './operators';\nexport {\n cx,\n runAll,\n hashArray,\n safeCall,\n removeUndefinedProperties,\n isObject,\n curry,\n arrayMove,\n uniq,\n filter,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n cloneDeep,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n pull,\n sortBy,\n sumBy,\n transform,\n isFunction,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n toggleInObject,\n toggleInArray,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n addOrRemove,\n isEqualWith,\n isBoolean,\n} from './utils';\nexport { setRef, mergeRefs, logger } from './system';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport { isDOMTypeElement } from './reactTypesUtility';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n\n// TODO -- REMOVE WHEN READY\nexport * from './deprecated';\nexport * from './props-helpers';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mCAAiD;AACjD,qDAAmE;AACnE,wBAA2B;AAC3B,uBAeO;AACP,mBA+CO;AACP,oBAA0C;AAC1C,mBAoBO;AACP,uBAAwD;AACxD,qBAAwB;AACxB,sBAAiC;AACjC,+BAAiC;AACjC,yBAAuD;AAGvD,wBAAc;AACd,wBAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,10 +37,10 @@ const onClickHandlerForNonInteractiveElements = (onClickHandler) => ({
|
|
|
37
37
|
onClick: onClickHandler,
|
|
38
38
|
onKeyPress: (event) => {
|
|
39
39
|
event.stopPropagation();
|
|
40
|
-
const {
|
|
40
|
+
const { keyCode, key } = event;
|
|
41
41
|
if (key === "Enter")
|
|
42
42
|
onClickHandler(event);
|
|
43
|
-
else if (
|
|
43
|
+
else if (keyCode === 13)
|
|
44
44
|
onClickHandler(event);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/onClickHandlerForNonInteractiveElements.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\n\nexport const onClickHandlerForNonInteractiveElements = (\n onClickHandler: React.MouseEventHandler & React.KeyboardEventHandler,\n) => ({\n role: 'button',\n tabIndex: '0',\n onClick: onClickHandler,\n onKeyPress: (event: React.KeyboardEvent) => {\n event.stopPropagation();\n const { keyCode, key } = event;\n if (key === 'Enter') onClickHandler(event);\n else if (keyCode === 13) onClickHandler(event);\n },\n});\n\nexport default onClickHandlerForNonInteractiveElements;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEhB,MAAM,0CAA0C,CACrD,mBACI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY,CAAC,UAA+B;AAC1C,UAAM,gBAAgB;AACtB,UAAM,EAAE,SAAS,QAAQ;AACzB,QAAI,QAAQ;AAAS,qBAAe,KAAK;AAAA,aAChC,YAAY;AAAI,qBAAe,KAAK;AAAA,EAC/C;AACF;AAEA,IAAO,kDAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/operators.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { isEmpty } from 'lodash';\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oBAAwB;
|
|
4
|
+
"sourcesContent": ["import { isEmpty } from 'lodash';\n\n// Check if the value is empty\nexport const checkNotEmpty = (value: unknown) =>\n // eslint-disable-next-line eqeqeq\n value === '' || value === undefined || value == [] || value === null || isEmpty(value);\n\n// Check if the value is not empty\nexport const checkEmpty = (value: unknown) => !isEmpty(value);\n\nexport const greaterThan = (value: number, comparator: number) => value > comparator;\n\n// Check if a valid date with format MM/DD/YYYY\nexport const validDate = (value: string) => {\n const dateValidationRegex = /^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$/;\n if (!dateValidationRegex.test(value)) return false;\n const [m, d, y] = value.split('/').map((n) => Number(n));\n return m === Number(new Date(y, m - 1, d).getMonth()) + 1 && d === Number(new Date(y, m - 1, d).getDate());\n};\n\nexport const equal = (a: unknown, b: unknown) => a === b;\n\nexport const notEqual = (a: unknown, b: unknown) => !equal(a, b);\n\nexport const isNull = (a: unknown) => checkNotEmpty(a);\n\nexport const isNotNull = (a: unknown) => !isNull(a);\n\nexport const isIn = <T,>(a: T, b: T[]) => b.indexOf(a) > -1;\n\nexport const isNotIn = <T,>(a: T, b: T[]) => !isIn(a, b);\n\nexport const greaterThanOrEquals = (value: number, comparator: number) => value >= comparator;\nexport const lessThanOrEquals = (value: number, comparator: number) => value <= comparator;\nexport const startsWith = (value: unknown, comparator: string) => String(value).startsWith(comparator);\nexport const contains = (value: unknown, comparator: string) => String(value).includes(comparator);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oBAAwB;AAGjB,MAAM,gBAAgB,CAAC,UAE5B,UAAU,MAAM,UAAU,UAAa,SAAS,CAAC,KAAK,UAAU,QAAQ,2BAAQ,KAAK;AAGhF,MAAM,aAAa,CAAC,UAAmB,CAAC,2BAAQ,KAAK;AAErD,MAAM,cAAc,CAAC,OAAe,eAAuB,QAAQ;AAGnE,MAAM,YAAY,CAAC,UAAkB;AAC1C,QAAM,sBAAsB;AAC5B,MAAI,CAAC,oBAAoB,KAAK,KAAK;AAAG,WAAO;AAC7C,QAAM,CAAC,GAAG,GAAG,KAAK,MAAM,MAAM,GAAG,EAAE,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC;AACvD,SAAO,MAAM,OAAO,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,KAAK,MAAM,OAAO,IAAI,KAAK,GAAG,IAAI,GAAG,CAAC,EAAE,QAAQ,CAAC;AAC3G;AAEO,MAAM,QAAQ,CAAC,GAAY,MAAe,MAAM;AAEhD,MAAM,WAAW,CAAC,GAAY,MAAe,CAAC,MAAM,GAAG,CAAC;AAExD,MAAM,SAAS,CAAC,MAAe,cAAc,CAAC;AAE9C,MAAM,YAAY,CAAC,MAAe,CAAC,OAAO,CAAC;AAE3C,MAAM,OAAO,CAAK,GAAM,MAAW,EAAE,QAAQ,CAAC,IAAI;AAElD,MAAM,UAAU,CAAK,GAAM,MAAW,CAAC,KAAK,GAAG,CAAC;AAEhD,MAAM,sBAAsB,CAAC,OAAe,eAAuB,SAAS;AAC5E,MAAM,mBAAmB,CAAC,OAAe,eAAuB,SAAS;AACzE,MAAM,aAAa,CAAC,OAAgB,eAAuB,OAAO,KAAK,EAAE,WAAW,UAAU;AAC9F,MAAM,WAAW,CAAC,OAAgB,eAAuB,OAAO,KAAK,EAAE,SAAS,UAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
9
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(module2))
|
|
11
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
12
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (module2, isNodeMode) => {
|
|
17
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
+
return (module2, temp) => {
|
|
21
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
+
};
|
|
23
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var defaultProps_exports = {};
|
|
25
|
+
var React = __toESM(require("react"));
|
|
26
|
+
__reExport(defaultProps_exports, require("./useMemoMergePropsWithDefault"));
|
|
27
|
+
module.exports = __toCommonJS(defaultProps_exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/props-helpers/defaultProps/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './useMemoMergePropsWithDefault';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;ADAvB,iCAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|