@elliemae/ds-utilities 3.0.0-next.11 → 3.0.0-next.15
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/hooks/index.js +1 -0
- package/dist/cjs/hooks/index.js.map +2 -2
- package/dist/cjs/hooks/useFocusTrap.js +66 -12
- package/dist/cjs/hooks/useFocusTrap.js.map +2 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useFocusTrap.js +67 -13
- package/dist/esm/hooks/useFocusTrap.js.map +2 -2
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +2 -2
- package/package.json +2 -1
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -27,6 +27,7 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
27
27
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
28
|
var hooks_exports = {};
|
|
29
29
|
__export(hooks_exports, {
|
|
30
|
+
UseFocusTrapWithSchema: () => import_useFocusTrap.UseFocusTrapWithSchema,
|
|
30
31
|
useCallbackAfterRender: () => import_useCallbackAfterRender.useCallbackAfterRender,
|
|
31
32
|
useCancellableDelayedCallback: () => import_useCancellableDelayedCallback.useCancellableDelayedCallback,
|
|
32
33
|
useDerivedStateFromProps: () => import_useDerivedStateFromProps.useDerivedStateFromProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { default as useMeasure } from 'use-measure';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\nexport { useUncontrolled } from 'uncontrollable';\nexport { useExecutionTimer } from './useExecutionTimer';\nexport { useExpandState } from './useExpandState';\nexport { useHotkeys } from './useHotkeys';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay';\nexport { useResizeObserver } from './useResizeObserver';\nexport { useShouldRecalculate } from './useShouldRecalculate';\nexport { useWindowScrollerList } from './useWindowScrollerList';\nexport { useWindowSize } from './useWindowSize';\nexport { usePrevious } from './usePrevious';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps';\nexport { useSetRef } from './useSetRef';\nexport { useParentElement } from './useParentElement';\nexport { useOnElementResize } from './useOnElementResize';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis';\nexport { useCallbackAfterRender } from './useCallbackAfterRender';\nexport { useFocusTrap } from './useFocusTrap';\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;ACAA,YAAuB;ADAvB,yBAAsC;AACtC,8BAA0C;AAC1C,gCAA6C;AAC7C,4BAAgC;AAChC,+BAAkC;AAClC,4BAA+B;AAC/B,wBAA2B;AAC3B,mCAAsC;AACtC,+BAAkC;AAClC,kCAAqC;AACrC,mCAAsC;AACtC,2BAA8B;AAC9B,yBAA4B;AAC5B,2CAA8C;AAC9C,sCAAyC;AACzC,uBAA0B;AAC1B,8BAAiC;AACjC,gCAAmC;AACnC,kCAAqC;AACrC,oCAAuC;AACvC,
|
|
4
|
+
"sourcesContent": ["export { default as useMeasure } from 'use-measure';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\nexport { useUncontrolled } from 'uncontrollable';\nexport { useExecutionTimer } from './useExecutionTimer';\nexport { useExpandState } from './useExpandState';\nexport { useHotkeys } from './useHotkeys';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay';\nexport { useResizeObserver } from './useResizeObserver';\nexport { useShouldRecalculate } from './useShouldRecalculate';\nexport { useWindowScrollerList } from './useWindowScrollerList';\nexport { useWindowSize } from './useWindowSize';\nexport { usePrevious } from './usePrevious';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps';\nexport { useSetRef } from './useSetRef';\nexport { useParentElement } from './useParentElement';\nexport { useOnElementResize } from './useOnElementResize';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis';\nexport { useCallbackAfterRender } from './useCallbackAfterRender';\nexport { useFocusTrap, UseFocusTrapWithSchema } from './useFocusTrap';\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;ACAA,YAAuB;ADAvB,yBAAsC;AACtC,8BAA0C;AAC1C,gCAA6C;AAC7C,4BAAgC;AAChC,+BAAkC;AAClC,4BAA+B;AAC/B,wBAA2B;AAC3B,mCAAsC;AACtC,+BAAkC;AAClC,kCAAqC;AACrC,mCAAsC;AACtC,2BAA8B;AAC9B,yBAA4B;AAC5B,2CAA8C;AAC9C,sCAAyC;AACzC,uBAA0B;AAC1B,8BAAiC;AACjC,gCAAmC;AACnC,kCAAqC;AACrC,oCAAuC;AACvC,0BAAqD;",
|
|
6
6
|
"names": []
|
|
7
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_ds_props_helpers = require("@elliemae/ds-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_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.oneOf([null]), import_ds_props_helpers.PropTypes.node]).description("Reference to the first element in the focus trap.").isRequired,
|
|
79
|
+
lastElementRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.oneOf([null]), import_ds_props_helpers.PropTypes.node]).description("Reference to the second element in the focus trap.").isRequired,
|
|
80
|
+
onKeyDown: import_ds_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_ds_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 } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-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};\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,mBAA8C;AAC9C,8BAAoC;AAEpC,MAAM,oBAAiD;AAAA,EACrD,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,WAAW;AAAA;AAGb,MAAM,kBAAkB,CAAC,QAAyB;AAChD,MAAI,MAAM,QAAQ;AAAM,WAAO;AAC/B,MAAI,QAAQ;AAAM,WAAO;AACzB,MAAI,QAAQ;AAAW,WAAO;AAC9B,SAAO,OAAO;AAAA;AAGhB,MAAM,iBAAiB,CAAC,cAAsB,gBAA+B;AAC3E,QAAM,IAAI,MACR,gDAAgD;AAAA;AAAA,cAEtC,gBAAgB;AAAA,cAChB,kBAAkB;AAAA;AAAA;AAKhC,MAAM,qBAAqB,CAAC,iBAA+B;AACzD,QAAM,IAAI,MACR,8BAA8B;AAAA;AAIlC,MAAM,gBAAgB,CAAC,mBAAkD;AACvE,MAAI,eAAe,oBAAoB,QAAW;AAChD,uBAAmB;AAAA;AAErB,MAAI,eAAe,mBAAmB,QAAW;AAC/C,uBAAmB;AAAA;AAErB,MAAI,eAAe,mBAAmB,OAAO,eAAe,oBAAoB,UAAU;AACxF,mBAAe,mBAAmB,eAAe;AAAA;AAEnD,MAAI,eAAe,kBAAkB,OAAO,eAAe,mBAAmB,UAAU;AACtF,mBAAe,kBAAkB,eAAe;AAAA;AAElD,MAAI,eAAe,aAAa,OAAO,eAAe,cAAc,YAAY;AAC9E,mBAAe,aAAa,eAAe;AAAA;AAAA;AAI/C,MAAM,YAAY;AAAA,EAChB,iBAAiB,kCAAU,UAAU,CAAC,kCAAU,MAAM,CAAC,QAAQ,kCAAU,OAAO,YAC9E,qDACA;AAAA,EACF,gBAAgB,kCAAU,UAAU,CAAC,kCAAU,MAAM,CAAC,QAAQ,kCAAU,OAAO,YAC7E,sDACA;AAAA,EACF,WAAW,kCAAU,KAAK,YAAY;AAAA;AAaxC,MAAM,eAA8B,CAAC,UAAU;AAE7C,8BAAU,MAAM,cAAc,QAAQ,CAAC;AAEvC,QAAM,EAAE,iBAAiB,gBAAgB,cAAc;AAEvD,SAAO,8BACL,CAAC,MAAqB;AACpB,QAAI;AAAW,gBAAU;AAIzB,QAAI,EAAE,QAAQ,SAAS,CAAC,EAAE,YAAY,EAAE,WAAW,eAAe,WAAW,gBAAgB,SAAS;AACpG,QAAE;AACF,QAAE;AACF,sBAAgB,QAAQ;AAAA;AAE1B,QAAI,EAAE,QAAQ,SAAS,EAAE,YAAY,EAAE,WAAW,gBAAgB,WAAW,eAAe,SAAS;AACnG,QAAE;AACF,QAAE;AACF,qBAAe,QAAQ;AAAA;AAAA,KAG3B,CAAC,iBAAiB,gBAAgB;AAAA;AAItC,MAAM,yBAAyB,sCAAS;AAExC,uBAAuB,YAAY;",
|
|
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,
|
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 useUncontrolled,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n useWindowSize,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useSetRef,\n useParentElement,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport {\n isClassComponent,\n isFunctionComponent,\n isReactComponent,\n isElement,\n isDOMTypeElement,\n isCompositeTypeElement,\n} from './reactTypesUtility';\nexport { resetTimer } from './scrollingTimer';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mCAAiD;AACjD,qDAAmE;AACnE,wBAA2B;AAC3B,uBAeO;AACP,mBA+CO;AACP,oBAA0C;AAC1C,
|
|
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 useUncontrolled,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n useWindowSize,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useSetRef,\n useParentElement,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport {\n isClassComponent,\n isFunctionComponent,\n isReactComponent,\n isElement,\n isDOMTypeElement,\n isCompositeTypeElement,\n} from './reactTypesUtility';\nexport { resetTimer } from './scrollingTimer';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\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;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,mBAuBO;AACP,uBAAwD;AACxD,qBAAwB;AACxB,sBAAiC;AACjC,+BAOO;AACP,4BAA2B;AAC3B,yBAAuD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -19,8 +19,9 @@ import { useParentElement } from "./useParentElement";
|
|
|
19
19
|
import { useOnElementResize } from "./useOnElementResize";
|
|
20
20
|
import { useIsShowingEllipsis } from "./useIsShowingEllipsis";
|
|
21
21
|
import { useCallbackAfterRender } from "./useCallbackAfterRender";
|
|
22
|
-
import { useFocusTrap } from "./useFocusTrap";
|
|
22
|
+
import { useFocusTrap, UseFocusTrapWithSchema } from "./useFocusTrap";
|
|
23
23
|
export {
|
|
24
|
+
UseFocusTrapWithSchema,
|
|
24
25
|
useCallbackAfterRender,
|
|
25
26
|
useCancellableDelayedCallback,
|
|
26
27
|
useDerivedStateFromProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default as useMeasure } from 'use-measure';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\nexport { useUncontrolled } from 'uncontrollable';\nexport { useExecutionTimer } from './useExecutionTimer';\nexport { useExpandState } from './useExpandState';\nexport { useHotkeys } from './useHotkeys';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay';\nexport { useResizeObserver } from './useResizeObserver';\nexport { useShouldRecalculate } from './useShouldRecalculate';\nexport { useWindowScrollerList } from './useWindowScrollerList';\nexport { useWindowSize } from './useWindowSize';\nexport { usePrevious } from './usePrevious';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps';\nexport { useSetRef } from './useSetRef';\nexport { useParentElement } from './useParentElement';\nexport { useOnElementResize } from './useOnElementResize';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis';\nexport { useCallbackAfterRender } from './useCallbackAfterRender';\nexport { useFocusTrap } from './useFocusTrap';\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default as useMeasure } from 'use-measure';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\nexport { useUncontrolled } from 'uncontrollable';\nexport { useExecutionTimer } from './useExecutionTimer';\nexport { useExpandState } from './useExpandState';\nexport { useHotkeys } from './useHotkeys';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay';\nexport { useResizeObserver } from './useResizeObserver';\nexport { useShouldRecalculate } from './useShouldRecalculate';\nexport { useWindowScrollerList } from './useWindowScrollerList';\nexport { useWindowSize } from './useWindowSize';\nexport { usePrevious } from './usePrevious';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps';\nexport { useSetRef } from './useSetRef';\nexport { useParentElement } from './useParentElement';\nexport { useOnElementResize } from './useOnElementResize';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis';\nexport { useCallbackAfterRender } from './useCallbackAfterRender';\nexport { useFocusTrap, UseFocusTrapWithSchema } from './useFocusTrap';\n"],
|
|
5
5
|
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,74 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
import { describe, PropTypes } from "@elliemae/ds-props-helpers";
|
|
4
|
+
const useFocusTrapProps = {
|
|
5
|
+
firstElementRef: "object",
|
|
6
|
+
lastElementRef: "object",
|
|
7
|
+
onKeyDown: "function"
|
|
8
|
+
};
|
|
9
|
+
const getVariableType = (arg) => {
|
|
10
|
+
if (Array.isArray(arg))
|
|
11
|
+
return "array";
|
|
12
|
+
if (arg === null)
|
|
13
|
+
return "null";
|
|
14
|
+
if (arg === void 0)
|
|
15
|
+
return "undefined";
|
|
16
|
+
return typeof arg;
|
|
17
|
+
};
|
|
18
|
+
const throwTypeError = (validPropKey, invalidProp) => {
|
|
19
|
+
throw new Error(`Warning: You are trying to pass a not valid "${validPropKey}" property to use a useFocusTrap hook, please provide a valid type.
|
|
20
|
+
|
|
21
|
+
Received: ${getVariableType(invalidProp)}
|
|
22
|
+
Expected: ${useFocusTrapProps[validPropKey]}
|
|
23
|
+
`);
|
|
24
|
+
};
|
|
25
|
+
const throwRequiredError = (validPropKey) => {
|
|
26
|
+
throw new Error(`Warning: Please provide a "${validPropKey}" property to use a useFocusTrap hook, this property is required.`);
|
|
27
|
+
};
|
|
28
|
+
const validateProps = (componentProps) => {
|
|
29
|
+
if (componentProps.firstElementRef === void 0) {
|
|
30
|
+
throwRequiredError("firstElementRef");
|
|
31
|
+
}
|
|
32
|
+
if (componentProps.lastElementRef === void 0) {
|
|
33
|
+
throwRequiredError("lastElementRef");
|
|
10
34
|
}
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
e.stopPropagation();
|
|
14
|
-
lastElementRef.current.focus();
|
|
35
|
+
if (componentProps.firstElementRef && typeof componentProps.firstElementRef !== "object") {
|
|
36
|
+
throwTypeError("firstElementRef", componentProps.firstElementRef);
|
|
15
37
|
}
|
|
16
|
-
|
|
38
|
+
if (componentProps.lastElementRef && typeof componentProps.lastElementRef !== "object") {
|
|
39
|
+
throwTypeError("lastElementRef", componentProps.lastElementRef);
|
|
40
|
+
}
|
|
41
|
+
if (componentProps.onKeyDown && typeof componentProps.onKeyDown !== "function") {
|
|
42
|
+
throwTypeError("onKeyDown", componentProps.onKeyDown);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const propTypes = {
|
|
46
|
+
firstElementRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.node]).description("Reference to the first element in the focus trap.").isRequired,
|
|
47
|
+
lastElementRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.node]).description("Reference to the second element in the focus trap.").isRequired,
|
|
48
|
+
onKeyDown: PropTypes.func.description("Optional onKeyDown callback.")
|
|
49
|
+
};
|
|
50
|
+
const useFocusTrap = (props) => {
|
|
51
|
+
useEffect(() => validateProps(props), [props]);
|
|
52
|
+
const { firstElementRef, lastElementRef, onKeyDown } = props;
|
|
53
|
+
return useCallback((e) => {
|
|
54
|
+
if (onKeyDown)
|
|
55
|
+
onKeyDown(e);
|
|
56
|
+
if (e.key === "Tab" && !e.shiftKey && e.target === lastElementRef.current && firstElementRef.current) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
firstElementRef.current.focus();
|
|
60
|
+
}
|
|
61
|
+
if (e.key === "Tab" && e.shiftKey && e.target === firstElementRef.current && lastElementRef.current) {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
lastElementRef.current.focus();
|
|
65
|
+
}
|
|
66
|
+
}, [firstElementRef, lastElementRef, onKeyDown]);
|
|
67
|
+
};
|
|
68
|
+
const UseFocusTrapWithSchema = describe(useFocusTrap);
|
|
69
|
+
UseFocusTrapWithSchema.propTypes = propTypes;
|
|
17
70
|
export {
|
|
71
|
+
UseFocusTrapWithSchema,
|
|
18
72
|
useFocusTrap
|
|
19
73
|
};
|
|
20
74
|
//# sourceMappingURL=useFocusTrap.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useFocusTrap.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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;ACAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-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};\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"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEA,MAAM,oBAAiD;AAAA,EACrD,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,WAAW;AAAA;AAGb,MAAM,kBAAkB,CAAC,QAAyB;AAChD,MAAI,MAAM,QAAQ;AAAM,WAAO;AAC/B,MAAI,QAAQ;AAAM,WAAO;AACzB,MAAI,QAAQ;AAAW,WAAO;AAC9B,SAAO,OAAO;AAAA;AAGhB,MAAM,iBAAiB,CAAC,cAAsB,gBAA+B;AAC3E,QAAM,IAAI,MACR,gDAAgD;AAAA;AAAA,cAEtC,gBAAgB;AAAA,cAChB,kBAAkB;AAAA;AAAA;AAKhC,MAAM,qBAAqB,CAAC,iBAA+B;AACzD,QAAM,IAAI,MACR,8BAA8B;AAAA;AAIlC,MAAM,gBAAgB,CAAC,mBAAkD;AACvE,MAAI,eAAe,oBAAoB,QAAW;AAChD,uBAAmB;AAAA;AAErB,MAAI,eAAe,mBAAmB,QAAW;AAC/C,uBAAmB;AAAA;AAErB,MAAI,eAAe,mBAAmB,OAAO,eAAe,oBAAoB,UAAU;AACxF,mBAAe,mBAAmB,eAAe;AAAA;AAEnD,MAAI,eAAe,kBAAkB,OAAO,eAAe,mBAAmB,UAAU;AACtF,mBAAe,kBAAkB,eAAe;AAAA;AAElD,MAAI,eAAe,aAAa,OAAO,eAAe,cAAc,YAAY;AAC9E,mBAAe,aAAa,eAAe;AAAA;AAAA;AAI/C,MAAM,YAAY;AAAA,EAChB,iBAAiB,UAAU,UAAU,CAAC,UAAU,MAAM,CAAC,QAAQ,UAAU,OAAO,YAC9E,qDACA;AAAA,EACF,gBAAgB,UAAU,UAAU,CAAC,UAAU,MAAM,CAAC,QAAQ,UAAU,OAAO,YAC7E,sDACA;AAAA,EACF,WAAW,UAAU,KAAK,YAAY;AAAA;AAaxC,MAAM,eAA8B,CAAC,UAAU;AAE7C,YAAU,MAAM,cAAc,QAAQ,CAAC;AAEvC,QAAM,EAAE,iBAAiB,gBAAgB,cAAc;AAEvD,SAAO,YACL,CAAC,MAAqB;AACpB,QAAI;AAAW,gBAAU;AAIzB,QAAI,EAAE,QAAQ,SAAS,CAAC,EAAE,YAAY,EAAE,WAAW,eAAe,WAAW,gBAAgB,SAAS;AACpG,QAAE;AACF,QAAE;AACF,sBAAgB,QAAQ;AAAA;AAE1B,QAAI,EAAE,QAAQ,SAAS,EAAE,YAAY,EAAE,WAAW,gBAAgB,WAAW,eAAe,SAAS;AACnG,QAAE;AACF,QAAE;AACF,qBAAe,QAAQ;AAAA;AAAA,KAG3B,CAAC,iBAAiB,gBAAgB;AAAA;AAItC,MAAM,yBAAyB,SAAS;AAExC,uBAAuB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -88,7 +88,8 @@ import {
|
|
|
88
88
|
useOnElementResize,
|
|
89
89
|
useIsShowingEllipsis,
|
|
90
90
|
useCallbackAfterRender,
|
|
91
|
-
useFocusTrap
|
|
91
|
+
useFocusTrap,
|
|
92
|
+
UseFocusTrapWithSchema
|
|
92
93
|
} from "./hooks";
|
|
93
94
|
import { getVisibleTimeByFormat, addLeadingZeros } from "./timeUtils";
|
|
94
95
|
import { compose } from "./compose";
|
|
@@ -105,6 +106,7 @@ import { resetTimer } from "./scrollingTimer";
|
|
|
105
106
|
import { isRequired, isGreaterThan, isValidDate } from "./validations";
|
|
106
107
|
export {
|
|
107
108
|
DOCUMENT,
|
|
109
|
+
UseFocusTrapWithSchema,
|
|
108
110
|
WINDOW,
|
|
109
111
|
addLeadingZeros,
|
|
110
112
|
addOrRemove,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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 useUncontrolled,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n useWindowSize,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useSetRef,\n useParentElement,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport {\n isClassComponent,\n isFunctionComponent,\n isReactComponent,\n isElement,\n isDOMTypeElement,\n isCompositeTypeElement,\n} from './reactTypesUtility';\nexport { resetTimer } from './scrollingTimer';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;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;AAgDA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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 useUncontrolled,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n useWindowSize,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useSetRef,\n useParentElement,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport {\n isClassComponent,\n isFunctionComponent,\n isReactComponent,\n isElement,\n isDOMTypeElement,\n isCompositeTypeElement,\n} from './reactTypesUtility';\nexport { resetTimer } from './scrollingTimer';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;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;AAgDA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-utilities",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Utilities",
|
|
6
6
|
"files": [
|
|
@@ -151,6 +151,7 @@
|
|
|
151
151
|
"typeSafety": false
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
|
+
"@elliemae/ds-props-helpers": "3.0.0-next.15",
|
|
154
155
|
"hotkeys-js": "~3.8.7",
|
|
155
156
|
"raf": "~3.4.1",
|
|
156
157
|
"resize-observer-polyfill": "~1.5.1",
|