@elliemae/ds-utilities 3.19.0 → 3.19.1-rc.1
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 +4 -0
- package/dist/cjs/hooks/index.js.map +2 -2
- package/dist/cjs/hooks/useNativeIntersectionObserver.js +59 -0
- package/dist/cjs/hooks/useNativeIntersectionObserver.js.map +7 -0
- package/dist/cjs/hooks/useTrackElement.js +50 -0
- package/dist/cjs/hooks/useTrackElement.js.map +7 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/system.js.map +2 -2
- package/dist/esm/hooks/index.js +4 -0
- package/dist/esm/hooks/index.js.map +2 -2
- package/dist/esm/hooks/useNativeIntersectionObserver.js +29 -0
- package/dist/esm/hooks/useNativeIntersectionObserver.js.map +7 -0
- package/dist/esm/hooks/useTrackElement.js +20 -0
- package/dist/esm/hooks/useTrackElement.js.map +7 -0
- package/dist/esm/index.js +58 -54
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/system.js.map +2 -2
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/useNativeIntersectionObserver.d.ts +3 -0
- package/dist/types/hooks/useTrackElement.d.ts +5 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/system.d.ts +1 -1
- package/package.json +2 -2
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(hooks_exports, {
|
|
|
46
46
|
useIsShowingEllipsis: () => import_useIsShowingEllipsis.useIsShowingEllipsis,
|
|
47
47
|
useMakeMutable: () => import_useMakeMutable.useMakeMutable,
|
|
48
48
|
useMeasure: () => import_use_measure.default,
|
|
49
|
+
useNativeIntersectionObserver: () => import_useNativeIntersectionObserver.useNativeIntersectionObserver,
|
|
49
50
|
useNativeResizeObserver: () => import_useNativeResizeObserver.useNativeResizeObserver,
|
|
50
51
|
useOnBlurOut: () => import_useOnBlurOut.useOnBlurOut,
|
|
51
52
|
useOnClickOutside: () => import_use_onclickoutside.default,
|
|
@@ -55,6 +56,7 @@ __export(hooks_exports, {
|
|
|
55
56
|
usePrevious: () => import_usePrevious.usePrevious,
|
|
56
57
|
useResizeObserver: () => import_useResizeObserver.useResizeObserver,
|
|
57
58
|
useShouldRecalculate: () => import_useShouldRecalculate.useShouldRecalculate,
|
|
59
|
+
useTrackElement: () => import_useTrackElement.useTrackElement,
|
|
58
60
|
useWindowScrollerList: () => import_useWindowScrollerList.useWindowScrollerList
|
|
59
61
|
});
|
|
60
62
|
module.exports = __toCommonJS(hooks_exports);
|
|
@@ -74,6 +76,7 @@ var import_useHoverHandlersDelay = require("./useHoverHandlersDelay.js");
|
|
|
74
76
|
var import_useIsMobile = require("./useIsMobile.js");
|
|
75
77
|
var import_useIsShowingEllipsis = require("./useIsShowingEllipsis.js");
|
|
76
78
|
var import_useMakeMutable = require("./useMakeMutable.js");
|
|
79
|
+
var import_useNativeIntersectionObserver = require("./useNativeIntersectionObserver.js");
|
|
77
80
|
var import_useNativeResizeObserver = require("./useNativeResizeObserver.js");
|
|
78
81
|
var import_useOnBlurOut = require("./useOnBlurOut.js");
|
|
79
82
|
var import_useOnElementResize = require("./useOnElementResize.js");
|
|
@@ -82,5 +85,6 @@ var import_useOnSpecificFocus = require("./useOnSpecificFocus.js");
|
|
|
82
85
|
var import_usePrevious = require("./usePrevious.js");
|
|
83
86
|
var import_useResizeObserver = require("./useResizeObserver.js");
|
|
84
87
|
var import_useShouldRecalculate = require("./useShouldRecalculate.js");
|
|
88
|
+
var import_useTrackElement = require("./useTrackElement.js");
|
|
85
89
|
var import_useWindowScrollerList = require("./useWindowScrollerList.js");
|
|
86
90
|
//# sourceMappingURL=index.js.map
|
|
@@ -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';\n\nexport { useCallbackAfterRender } from './useCallbackAfterRender.js';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback.js';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps.js';\nexport { useExecutionTimer } from './useExecutionTimer.js';\nexport { useExpandState } from './useExpandState.js';\nexport { useFocusTrap, UseFocusTrapWithSchema } from './useFocusTrap.js';\nexport { useHeadlessTooltip } from './useHeadlessTooltip.js';\nexport { useHotkeys } from './useHotkeys.js';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay.js';\nexport { useIsMobile } from './useIsMobile.js';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis.js';\nexport { useMakeMutable } from './useMakeMutable.js';\nexport { useNativeResizeObserver } from './useNativeResizeObserver.js';\nexport { useOnBlurOut, UseOnBlurOutWithSchema } from './useOnBlurOut.js';\nexport { useOnElementResize } from './useOnElementResize.js';\nexport { useOnFirstFocusIn, UseOnFirstFocusInWithSchema } from './useOnFirstFocusIn.js';\nexport { useOnSpecificFocus, UseOnSpecificFocusWithSchema } from './useOnSpecificFocus.js';\nexport { usePrevious } from './usePrevious.js';\nexport { useResizeObserver } from './useResizeObserver.js';\nexport { useShouldRecalculate } from './useShouldRecalculate.js';\nexport { useWindowScrollerList } from './useWindowScrollerList.js';\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;ACAA,YAAuB;ADAvB,yBAAsC;AACtC,8BAA0C;AAC1C,gCAA6C;AAE7C,oCAAuC;AACvC,2CAA8C;AAC9C,sCAAyC;AACzC,+BAAkC;AAClC,4BAA+B;AAC/B,0BAAqD;AACrD,gCAAmC;AACnC,wBAA2B;AAC3B,mCAAsC;AACtC,yBAA4B;AAC5B,kCAAqC;AACrC,4BAA+B;AAC/B,qCAAwC;AACxC,0BAAqD;AACrD,gCAAmC;AACnC,+BAA+D;AAC/D,gCAAiE;AACjE,yBAA4B;AAC5B,+BAAkC;AAClC,kCAAqC;AACrC,mCAAsC;",
|
|
4
|
+
"sourcesContent": ["export { default as useMeasure } from 'use-measure';\nexport { default as useForceUpdate } from 'use-force-update';\nexport { default as useOnClickOutside } from 'use-onclickoutside';\n\nexport { useCallbackAfterRender } from './useCallbackAfterRender.js';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback.js';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps.js';\nexport { useExecutionTimer } from './useExecutionTimer.js';\nexport { useExpandState } from './useExpandState.js';\nexport { useFocusTrap, UseFocusTrapWithSchema } from './useFocusTrap.js';\nexport { useHeadlessTooltip } from './useHeadlessTooltip.js';\nexport { useHotkeys } from './useHotkeys.js';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay.js';\nexport { useIsMobile } from './useIsMobile.js';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis.js';\nexport { useMakeMutable } from './useMakeMutable.js';\nexport { useNativeIntersectionObserver } from './useNativeIntersectionObserver.js';\nexport { useNativeResizeObserver } from './useNativeResizeObserver.js';\nexport { useOnBlurOut, UseOnBlurOutWithSchema } from './useOnBlurOut.js';\nexport { useOnElementResize } from './useOnElementResize.js';\nexport { useOnFirstFocusIn, UseOnFirstFocusInWithSchema } from './useOnFirstFocusIn.js';\nexport { useOnSpecificFocus, UseOnSpecificFocusWithSchema } from './useOnSpecificFocus.js';\nexport { usePrevious } from './usePrevious.js';\nexport { useResizeObserver } from './useResizeObserver.js';\nexport { useShouldRecalculate } from './useShouldRecalculate.js';\nexport { useTrackElement } from './useTrackElement.js';\nexport { useWindowScrollerList } from './useWindowScrollerList.js';\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;ACAA,YAAuB;ADAvB,yBAAsC;AACtC,8BAA0C;AAC1C,gCAA6C;AAE7C,oCAAuC;AACvC,2CAA8C;AAC9C,sCAAyC;AACzC,+BAAkC;AAClC,4BAA+B;AAC/B,0BAAqD;AACrD,gCAAmC;AACnC,wBAA2B;AAC3B,mCAAsC;AACtC,yBAA4B;AAC5B,kCAAqC;AACrC,4BAA+B;AAC/B,2CAA8C;AAC9C,qCAAwC;AACxC,0BAAqD;AACrD,gCAAmC;AACnC,+BAA+D;AAC/D,gCAAiE;AACjE,yBAA4B;AAC5B,+BAAkC;AAClC,kCAAqC;AACrC,6BAAgC;AAChC,mCAAsC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useNativeIntersectionObserver_exports = {};
|
|
30
|
+
__export(useNativeIntersectionObserver_exports, {
|
|
31
|
+
useNativeIntersectionObserver: () => useNativeIntersectionObserver
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useNativeIntersectionObserver_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
const useNativeIntersectionObserver = (el, callback) => {
|
|
37
|
+
const intersectionObserver = (0, import_react.useMemo)(
|
|
38
|
+
() => new IntersectionObserver((entries) => {
|
|
39
|
+
const entry = entries[0];
|
|
40
|
+
const target = entry.target;
|
|
41
|
+
callback({
|
|
42
|
+
boundingClientRect: entry.boundingClientRect,
|
|
43
|
+
intersectionRatio: entry.intersectionRatio,
|
|
44
|
+
intersectionRect: entry.intersectionRect,
|
|
45
|
+
isIntersecting: entry.isIntersecting,
|
|
46
|
+
rootBounds: entry.rootBounds,
|
|
47
|
+
target,
|
|
48
|
+
time: entry.time
|
|
49
|
+
});
|
|
50
|
+
}),
|
|
51
|
+
[callback]
|
|
52
|
+
);
|
|
53
|
+
(0, import_react.useEffect)(() => {
|
|
54
|
+
if (el)
|
|
55
|
+
intersectionObserver.observe(el);
|
|
56
|
+
return () => intersectionObserver.disconnect();
|
|
57
|
+
}, [el, intersectionObserver]);
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=useNativeIntersectionObserver.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useNativeIntersectionObserver.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the intersection observer api,\n// to observe changes in the position of an **UNIQUE** element\n// Will trigger the callback with the boundingClientRect of the element\n// the intersection ratio, the intersection rect, if it is intersecting\n// and the html element itself, so you can query for extra information\nexport const useNativeIntersectionObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: Omit<IntersectionObserverEntry, 'target'> & { target: T }) => void,\n) => {\n const intersectionObserver = useMemo(\n () =>\n new IntersectionObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const target = entry.target as T;\n\n callback({\n boundingClientRect: entry.boundingClientRect,\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: entry.intersectionRect,\n isIntersecting: entry.isIntersecting,\n rootBounds: entry.rootBounds,\n target,\n time: entry.time,\n });\n }),\n [callback],\n );\n\n useEffect(() => {\n if (el) intersectionObserver.observe(el);\n return () => intersectionObserver.disconnect();\n }, [el, intersectionObserver]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAmC;AAO5B,MAAM,gCAAgC,CAC3C,IACA,aACG;AACH,QAAM,2BAAuB;AAAA,IAC3B,MACE,IAAI,qBAAqB,CAAC,YAAY;AACpC,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,SAAS,MAAM;AAErB,eAAS;AAAA,QACP,oBAAoB,MAAM;AAAA,QAC1B,mBAAmB,MAAM;AAAA,QACzB,kBAAkB,MAAM;AAAA,QACxB,gBAAgB,MAAM;AAAA,QACtB,YAAY,MAAM;AAAA,QAClB;AAAA,QACA,MAAM,MAAM;AAAA,MACd,CAAC;AAAA,IACH,CAAC;AAAA,IACH,CAAC,QAAQ;AAAA,EACX;AAEA,8BAAU,MAAM;AACd,QAAI;AAAI,2BAAqB,QAAQ,EAAE;AACvC,WAAO,MAAM,qBAAqB,WAAW;AAAA,EAC/C,GAAG,CAAC,IAAI,oBAAoB,CAAC;AAC/B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useTrackElement_exports = {};
|
|
30
|
+
__export(useTrackElement_exports, {
|
|
31
|
+
useTrackElement: () => useTrackElement
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useTrackElement_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_useNativeIntersectionObserver = require("./useNativeIntersectionObserver.js");
|
|
37
|
+
const useTrackElement = (el, callback) => {
|
|
38
|
+
const prevPosition = (0, import_react.useRef)({ x: null, y: null });
|
|
39
|
+
const debouncedCallback = (0, import_react.useCallback)(
|
|
40
|
+
(entry) => {
|
|
41
|
+
if (entry.boundingClientRect.x !== prevPosition.current.x || entry.boundingClientRect.y !== prevPosition.current.y) {
|
|
42
|
+
callback(entry);
|
|
43
|
+
}
|
|
44
|
+
prevPosition.current = { x: entry.boundingClientRect.x, y: entry.boundingClientRect.y };
|
|
45
|
+
},
|
|
46
|
+
[callback]
|
|
47
|
+
);
|
|
48
|
+
(0, import_useNativeIntersectionObserver.useNativeIntersectionObserver)(el, debouncedCallback);
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=useTrackElement.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useTrackElement.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useRef } from 'react';\nimport { useNativeIntersectionObserver } from './useNativeIntersectionObserver.js';\n\ntype Callback<T extends HTMLElement> = (entry: Omit<IntersectionObserverEntry, 'target'> & { target: T }) => void;\n\n// Uses native intersection observer to trigger the callback when the\n// element is intersecting the viewport and the position of the element\n// is changed\nexport const useTrackElement = <T extends HTMLElement>(el: T | null, callback: Callback<T>) => {\n const prevPosition = useRef<{ x: number | null; y: number | null }>({ x: null, y: null });\n\n const debouncedCallback: Callback<T> = useCallback(\n (entry) => {\n if (\n entry.boundingClientRect.x !== prevPosition.current.x ||\n entry.boundingClientRect.y !== prevPosition.current.y\n ) {\n callback(entry);\n }\n prevPosition.current = { x: entry.boundingClientRect.x, y: entry.boundingClientRect.y };\n },\n [callback],\n );\n\n useNativeIntersectionObserver(el, debouncedCallback);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AACpC,2CAA8C;AAOvC,MAAM,kBAAkB,CAAwB,IAAc,aAA0B;AAC7F,QAAM,mBAAe,qBAA+C,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC;AAExF,QAAM,wBAAiC;AAAA,IACrC,CAAC,UAAU;AACT,UACE,MAAM,mBAAmB,MAAM,aAAa,QAAQ,KACpD,MAAM,mBAAmB,MAAM,aAAa,QAAQ,GACpD;AACA,iBAAS,KAAK;AAAA,MAChB;AACA,mBAAa,UAAU,EAAE,GAAG,MAAM,mBAAmB,GAAG,GAAG,MAAM,mBAAmB,EAAE;AAAA,IACxF;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,0EAA8B,IAAI,iBAAiB;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -126,6 +126,7 @@ __export(src_exports, {
|
|
|
126
126
|
useIsShowingEllipsis: () => import_hooks.useIsShowingEllipsis,
|
|
127
127
|
useMakeMutable: () => import_hooks.useMakeMutable,
|
|
128
128
|
useMeasure: () => import_hooks.useMeasure,
|
|
129
|
+
useNativeIntersectionObserver: () => import_hooks.useNativeIntersectionObserver,
|
|
129
130
|
useNativeResizeObserver: () => import_hooks.useNativeResizeObserver,
|
|
130
131
|
useOnBlurOut: () => import_hooks.useOnBlurOut,
|
|
131
132
|
useOnClickOutside: () => import_hooks.useOnClickOutside,
|
|
@@ -135,6 +136,7 @@ __export(src_exports, {
|
|
|
135
136
|
usePrevious: () => import_hooks.usePrevious,
|
|
136
137
|
useResizeObserver: () => import_hooks.useResizeObserver,
|
|
137
138
|
useShouldRecalculate: () => import_hooks.useShouldRecalculate,
|
|
139
|
+
useTrackElement: () => import_hooks.useTrackElement,
|
|
138
140
|
useWindowScrollerList: () => import_hooks.useWindowScrollerList,
|
|
139
141
|
validDate: () => import_operators.validDate,
|
|
140
142
|
values: () => import_utils.values
|
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.js';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements.js';\nexport { capitalize } from './capitalize.js';\nexport { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities.js';\nexport {\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mCAAiD;AACjD,qDAAmE;AACnE,wBAA2B;AAC3B,6BAA6D;AAC7D,uBAeO;AACP,mBA+CO;AACP,oBAA2D;AAC3D,
|
|
4
|
+
"sourcesContent": ["export { default as getComponentFromProps } from './getComponentFromProps.js';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements.js';\nexport { capitalize } from './capitalize.js';\nexport { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities.js';\nexport {\n checkEmpty,\n checkNotEmpty,\n contains,\n equal,\n greaterThan,\n greaterThanOrEquals,\n isIn,\n isNotIn,\n isNotNull,\n isNull,\n lessThanOrEquals,\n notEqual,\n startsWith,\n validDate,\n} from './operators.js';\nexport {\n addOrRemove,\n arrayMove,\n cloneDeep,\n curry,\n cx,\n debounce,\n differenceBy,\n differenceWith,\n filter,\n findIndex,\n get,\n groupBy,\n hashArray,\n isBoolean,\n isEmpty,\n isEqual,\n isEqualWith,\n isFunction,\n isNaN,\n isObject,\n isString,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n padStart,\n parseInt,\n pick,\n pickBy,\n property,\n pull,\n range,\n removeUndefinedProperties,\n runAll,\n safeCall,\n set,\n sortBy,\n sumBy,\n throttle,\n toggleInArray,\n toggleInObject,\n transform,\n uniq,\n uniqBy,\n values,\n} from './utils.js';\nexport { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';\nexport {\n useCallbackAfterRender,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useExecutionTimer,\n useExpandState,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useForceUpdate,\n useHeadlessTooltip,\n useHotkeys,\n useHoverHandlersDelay,\n useIsMobile,\n useIsShowingEllipsis,\n useMakeMutable,\n useMeasure,\n useNativeIntersectionObserver,\n useNativeResizeObserver,\n useOnBlurOut,\n UseOnBlurOutWithSchema,\n useOnClickOutside,\n useOnElementResize,\n useOnFirstFocusIn,\n UseOnFirstFocusInWithSchema,\n useOnSpecificFocus,\n UseOnSpecificFocusWithSchema,\n usePrevious,\n useResizeObserver,\n useShouldRecalculate,\n useTrackElement,\n useWindowScrollerList,\n} from './hooks/index.js';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils.js';\nexport { compose } from './compose.js';\nexport { DOCUMENT, WINDOW } from './platform.js';\nexport { isDOMTypeElement } from './reactTypesUtility.js';\nexport { isRequired, isGreaterThan, isValidDate } from './validations.js';\nexport { getHighlightedRerendersStyle } from './getHighlightedRerendersStyle.js';\n\nexport { crossTypeSort } from './algorithms/crossTypeSort.js';\nexport { appendComponentIfNotExist } from './addComponentIfNotExists.js';\n// TODO -- REMOVE WHEN READY\nexport * from './deprecated/index.js';\nexport * from './props-helpers/index.js';\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mCAAiD;AACjD,qDAAmE;AACnE,wBAA2B;AAC3B,6BAA6D;AAC7D,uBAeO;AACP,mBA+CO;AACP,oBAA2D;AAC3D,mBA+BO;AACP,uBAAwD;AACxD,qBAAwB;AACxB,sBAAiC;AACjC,+BAAiC;AACjC,yBAAuD;AACvD,0CAA6C;AAE7C,2BAA8B;AAC9B,qCAA0C;AAE1C,wBAAc,kCA/Gd;AAgHA,wBAAc,qCAhHd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/system.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/system.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type React from 'react';\nimport { isFunction } from './utils.js';\n\ntype AnyRef<T extends HTMLElement> =\n | React.MutableRefObject<T | null>\n | ((_ref: T | null) => void)\n | React.Dispatch<React.SetStateAction<T | null>>\n | false;\n\nexport const setRef = <T extends HTMLElement>(ref: AnyRef<T>, value: T) => {\n if (isFunction(ref)) {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nexport const mergeRefs = <T extends HTMLElement>(...refs: AnyRef<T>[]) => {\n const mergeRefsFunc = (node: T | null) => {\n if (!node) return;\n refs.forEach((ref) => setRef(ref, node));\n };\n return mergeRefsFunc;\n};\n\nexport function setMultipleRefs<T = unknown>(\n refs: Array<React.RefObject<T> | React.LegacyRef<T>>,\n): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n });\n };\n}\n\nexport function logger(...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.log(...args);\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA2B;
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport { isFunction } from './utils.js';\n\ntype AnyRef<T extends HTMLElement> =\n | React.MutableRefObject<T | null>\n | ((_ref: T | null) => void)\n | React.Dispatch<React.SetStateAction<T | null>>\n | false\n | undefined\n | null;\n\nexport const setRef = <T extends HTMLElement>(ref: AnyRef<T>, value: T) => {\n if (isFunction(ref)) {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nexport const mergeRefs = <T extends HTMLElement>(...refs: AnyRef<T>[]) => {\n const mergeRefsFunc = (node: T | null) => {\n if (!node) return;\n refs.forEach((ref) => setRef(ref, node));\n };\n return mergeRefsFunc;\n};\n\nexport function setMultipleRefs<T = unknown>(\n refs: Array<React.RefObject<T> | React.LegacyRef<T>>,\n): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n });\n };\n}\n\nexport function logger(...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.log(...args);\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA2B;AAUpB,MAAM,SAAS,CAAwB,KAAgB,UAAa;AACzE,UAAI,yBAAW,GAAG,GAAG;AACnB,QAAI,KAAK;AAAA,EACX,WAAW,KAAK;AACd,QAAI,UAAU;AAAA,EAChB;AACF;AAEO,MAAM,YAAY,IAA2B,SAAsB;AACxE,QAAM,gBAAgB,CAAC,SAAmB;AACxC,QAAI,CAAC;AAAM;AACX,SAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAAA,EACzC;AACA,SAAO;AACT;AAEO,SAAS,gBACd,MACsB;AACtB,SAAO,CAAC,UAAU;AAChB,SAAK,QAAQ,CAAC,QAAQ;AACpB,UAAI,OAAO,QAAQ,YAAY;AAC7B,YAAI,KAAK;AAAA,MACX,WAAW,OAAO,MAAM;AACtB,QAAC,IAAyC,UAAU;AAAA,MACtD;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEO,SAAS,UAAU,MAAiB;AAEzC,UAAQ,IAAI,GAAG,IAAI;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { useHoverHandlersDelay } from "./useHoverHandlersDelay.js";
|
|
|
14
14
|
import { useIsMobile } from "./useIsMobile.js";
|
|
15
15
|
import { useIsShowingEllipsis } from "./useIsShowingEllipsis.js";
|
|
16
16
|
import { useMakeMutable } from "./useMakeMutable.js";
|
|
17
|
+
import { useNativeIntersectionObserver } from "./useNativeIntersectionObserver.js";
|
|
17
18
|
import { useNativeResizeObserver } from "./useNativeResizeObserver.js";
|
|
18
19
|
import { useOnBlurOut, UseOnBlurOutWithSchema } from "./useOnBlurOut.js";
|
|
19
20
|
import { useOnElementResize } from "./useOnElementResize.js";
|
|
@@ -22,6 +23,7 @@ import { useOnSpecificFocus, UseOnSpecificFocusWithSchema } from "./useOnSpecifi
|
|
|
22
23
|
import { usePrevious } from "./usePrevious.js";
|
|
23
24
|
import { useResizeObserver } from "./useResizeObserver.js";
|
|
24
25
|
import { useShouldRecalculate } from "./useShouldRecalculate.js";
|
|
26
|
+
import { useTrackElement } from "./useTrackElement.js";
|
|
25
27
|
import { useWindowScrollerList } from "./useWindowScrollerList.js";
|
|
26
28
|
export {
|
|
27
29
|
UseFocusTrapWithSchema,
|
|
@@ -42,6 +44,7 @@ export {
|
|
|
42
44
|
useIsShowingEllipsis,
|
|
43
45
|
useMakeMutable,
|
|
44
46
|
default2 as useMeasure,
|
|
47
|
+
useNativeIntersectionObserver,
|
|
45
48
|
useNativeResizeObserver,
|
|
46
49
|
useOnBlurOut,
|
|
47
50
|
default4 as useOnClickOutside,
|
|
@@ -51,6 +54,7 @@ export {
|
|
|
51
54
|
usePrevious,
|
|
52
55
|
useResizeObserver,
|
|
53
56
|
useShouldRecalculate,
|
|
57
|
+
useTrackElement,
|
|
54
58
|
useWindowScrollerList
|
|
55
59
|
};
|
|
56
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -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';\n\nexport { useCallbackAfterRender } from './useCallbackAfterRender.js';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback.js';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps.js';\nexport { useExecutionTimer } from './useExecutionTimer.js';\nexport { useExpandState } from './useExpandState.js';\nexport { useFocusTrap, UseFocusTrapWithSchema } from './useFocusTrap.js';\nexport { useHeadlessTooltip } from './useHeadlessTooltip.js';\nexport { useHotkeys } from './useHotkeys.js';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay.js';\nexport { useIsMobile } from './useIsMobile.js';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis.js';\nexport { useMakeMutable } from './useMakeMutable.js';\nexport { useNativeResizeObserver } from './useNativeResizeObserver.js';\nexport { useOnBlurOut, UseOnBlurOutWithSchema } from './useOnBlurOut.js';\nexport { useOnElementResize } from './useOnElementResize.js';\nexport { useOnFirstFocusIn, UseOnFirstFocusInWithSchema } from './useOnFirstFocusIn.js';\nexport { useOnSpecificFocus, UseOnSpecificFocusWithSchema } from './useOnSpecificFocus.js';\nexport { usePrevious } from './usePrevious.js';\nexport { useResizeObserver } from './useResizeObserver.js';\nexport { useShouldRecalculate } from './useShouldRecalculate.js';\nexport { useWindowScrollerList } from './useWindowScrollerList.js';\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAoC;AAE7C,SAAS,8BAA8B;AACvC,SAAS,qCAAqC;AAC9C,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,cAAc,8BAA8B;AACrD,SAAS,0BAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,+BAA+B;AACxC,SAAS,cAAc,8BAA8B;AACrD,SAAS,0BAA0B;AACnC,SAAS,mBAAmB,mCAAmC;AAC/D,SAAS,oBAAoB,oCAAoC;AACjE,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;",
|
|
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';\n\nexport { useCallbackAfterRender } from './useCallbackAfterRender.js';\nexport { useCancellableDelayedCallback } from './useCancellableDelayedCallback.js';\nexport { useDerivedStateFromProps } from './useDerivedStateFromProps.js';\nexport { useExecutionTimer } from './useExecutionTimer.js';\nexport { useExpandState } from './useExpandState.js';\nexport { useFocusTrap, UseFocusTrapWithSchema } from './useFocusTrap.js';\nexport { useHeadlessTooltip } from './useHeadlessTooltip.js';\nexport { useHotkeys } from './useHotkeys.js';\nexport { useHoverHandlersDelay } from './useHoverHandlersDelay.js';\nexport { useIsMobile } from './useIsMobile.js';\nexport { useIsShowingEllipsis } from './useIsShowingEllipsis.js';\nexport { useMakeMutable } from './useMakeMutable.js';\nexport { useNativeIntersectionObserver } from './useNativeIntersectionObserver.js';\nexport { useNativeResizeObserver } from './useNativeResizeObserver.js';\nexport { useOnBlurOut, UseOnBlurOutWithSchema } from './useOnBlurOut.js';\nexport { useOnElementResize } from './useOnElementResize.js';\nexport { useOnFirstFocusIn, UseOnFirstFocusInWithSchema } from './useOnFirstFocusIn.js';\nexport { useOnSpecificFocus, UseOnSpecificFocusWithSchema } from './useOnSpecificFocus.js';\nexport { usePrevious } from './usePrevious.js';\nexport { useResizeObserver } from './useResizeObserver.js';\nexport { useShouldRecalculate } from './useShouldRecalculate.js';\nexport { useTrackElement } from './useTrackElement.js';\nexport { useWindowScrollerList } from './useWindowScrollerList.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAoC;AAE7C,SAAS,8BAA8B;AACvC,SAAS,qCAAqC;AAC9C,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,cAAc,8BAA8B;AACrD,SAAS,0BAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,qCAAqC;AAC9C,SAAS,+BAA+B;AACxC,SAAS,cAAc,8BAA8B;AACrD,SAAS,0BAA0B;AACnC,SAAS,mBAAmB,mCAAmC;AAC/D,SAAS,oBAAoB,oCAAoC;AACjE,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useEffect, useMemo } from "react";
|
|
3
|
+
const useNativeIntersectionObserver = (el, callback) => {
|
|
4
|
+
const intersectionObserver = useMemo(
|
|
5
|
+
() => new IntersectionObserver((entries) => {
|
|
6
|
+
const entry = entries[0];
|
|
7
|
+
const target = entry.target;
|
|
8
|
+
callback({
|
|
9
|
+
boundingClientRect: entry.boundingClientRect,
|
|
10
|
+
intersectionRatio: entry.intersectionRatio,
|
|
11
|
+
intersectionRect: entry.intersectionRect,
|
|
12
|
+
isIntersecting: entry.isIntersecting,
|
|
13
|
+
rootBounds: entry.rootBounds,
|
|
14
|
+
target,
|
|
15
|
+
time: entry.time
|
|
16
|
+
});
|
|
17
|
+
}),
|
|
18
|
+
[callback]
|
|
19
|
+
);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (el)
|
|
22
|
+
intersectionObserver.observe(el);
|
|
23
|
+
return () => intersectionObserver.disconnect();
|
|
24
|
+
}, [el, intersectionObserver]);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
useNativeIntersectionObserver
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useNativeIntersectionObserver.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useNativeIntersectionObserver.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the intersection observer api,\n// to observe changes in the position of an **UNIQUE** element\n// Will trigger the callback with the boundingClientRect of the element\n// the intersection ratio, the intersection rect, if it is intersecting\n// and the html element itself, so you can query for extra information\nexport const useNativeIntersectionObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: Omit<IntersectionObserverEntry, 'target'> & { target: T }) => void,\n) => {\n const intersectionObserver = useMemo(\n () =>\n new IntersectionObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const target = entry.target as T;\n\n callback({\n boundingClientRect: entry.boundingClientRect,\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: entry.intersectionRect,\n isIntersecting: entry.isIntersecting,\n rootBounds: entry.rootBounds,\n target,\n time: entry.time,\n });\n }),\n [callback],\n );\n\n useEffect(() => {\n if (el) intersectionObserver.observe(el);\n return () => intersectionObserver.disconnect();\n }, [el, intersectionObserver]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,eAAe;AAO5B,MAAM,gCAAgC,CAC3C,IACA,aACG;AACH,QAAM,uBAAuB;AAAA,IAC3B,MACE,IAAI,qBAAqB,CAAC,YAAY;AACpC,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,SAAS,MAAM;AAErB,eAAS;AAAA,QACP,oBAAoB,MAAM;AAAA,QAC1B,mBAAmB,MAAM;AAAA,QACzB,kBAAkB,MAAM;AAAA,QACxB,gBAAgB,MAAM;AAAA,QACtB,YAAY,MAAM;AAAA,QAClB;AAAA,QACA,MAAM,MAAM;AAAA,MACd,CAAC;AAAA,IACH,CAAC;AAAA,IACH,CAAC,QAAQ;AAAA,EACX;AAEA,YAAU,MAAM;AACd,QAAI;AAAI,2BAAqB,QAAQ,EAAE;AACvC,WAAO,MAAM,qBAAqB,WAAW;AAAA,EAC/C,GAAG,CAAC,IAAI,oBAAoB,CAAC;AAC/B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useCallback, useRef } from "react";
|
|
3
|
+
import { useNativeIntersectionObserver } from "./useNativeIntersectionObserver.js";
|
|
4
|
+
const useTrackElement = (el, callback) => {
|
|
5
|
+
const prevPosition = useRef({ x: null, y: null });
|
|
6
|
+
const debouncedCallback = useCallback(
|
|
7
|
+
(entry) => {
|
|
8
|
+
if (entry.boundingClientRect.x !== prevPosition.current.x || entry.boundingClientRect.y !== prevPosition.current.y) {
|
|
9
|
+
callback(entry);
|
|
10
|
+
}
|
|
11
|
+
prevPosition.current = { x: entry.boundingClientRect.x, y: entry.boundingClientRect.y };
|
|
12
|
+
},
|
|
13
|
+
[callback]
|
|
14
|
+
);
|
|
15
|
+
useNativeIntersectionObserver(el, debouncedCallback);
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
useTrackElement
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useTrackElement.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useTrackElement.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useRef } from 'react';\nimport { useNativeIntersectionObserver } from './useNativeIntersectionObserver.js';\n\ntype Callback<T extends HTMLElement> = (entry: Omit<IntersectionObserverEntry, 'target'> & { target: T }) => void;\n\n// Uses native intersection observer to trigger the callback when the\n// element is intersecting the viewport and the position of the element\n// is changed\nexport const useTrackElement = <T extends HTMLElement>(el: T | null, callback: Callback<T>) => {\n const prevPosition = useRef<{ x: number | null; y: number | null }>({ x: null, y: null });\n\n const debouncedCallback: Callback<T> = useCallback(\n (entry) => {\n if (\n entry.boundingClientRect.x !== prevPosition.current.x ||\n entry.boundingClientRect.y !== prevPosition.current.y\n ) {\n callback(entry);\n }\n prevPosition.current = { x: entry.boundingClientRect.x, y: entry.boundingClientRect.y };\n },\n [callback],\n );\n\n useNativeIntersectionObserver(el, debouncedCallback);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,cAAc;AACpC,SAAS,qCAAqC;AAOvC,MAAM,kBAAkB,CAAwB,IAAc,aAA0B;AAC7F,QAAM,eAAe,OAA+C,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC;AAExF,QAAM,oBAAiC;AAAA,IACrC,CAAC,UAAU;AACT,UACE,MAAM,mBAAmB,MAAM,aAAa,QAAQ,KACpD,MAAM,mBAAmB,MAAM,aAAa,QAAQ,GACpD;AACA,iBAAS,KAAK;AAAA,MAChB;AACA,mBAAa,UAAU,EAAE,GAAG,MAAM,mBAAmB,GAAG,GAAG,MAAM,mBAAmB,EAAE;AAAA,IACxF;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,gCAA8B,IAAI,iBAAiB;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,99 +4,101 @@ import { default as default3 } from "./onClickHandlerForNonInteractiveElements.j
|
|
|
4
4
|
import { capitalize } from "./capitalize.js";
|
|
5
5
|
import { getObjectValuesToArray, getObjectKeysToArray } from "./objectUtilities.js";
|
|
6
6
|
import {
|
|
7
|
-
checkNotEmpty,
|
|
8
7
|
checkEmpty,
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
checkNotEmpty,
|
|
9
|
+
contains,
|
|
11
10
|
equal,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
isNotNull,
|
|
11
|
+
greaterThan,
|
|
12
|
+
greaterThanOrEquals,
|
|
15
13
|
isIn,
|
|
16
14
|
isNotIn,
|
|
17
|
-
|
|
15
|
+
isNotNull,
|
|
16
|
+
isNull,
|
|
18
17
|
lessThanOrEquals,
|
|
18
|
+
notEqual,
|
|
19
19
|
startsWith,
|
|
20
|
-
|
|
20
|
+
validDate
|
|
21
21
|
} from "./operators.js";
|
|
22
22
|
import {
|
|
23
|
-
|
|
24
|
-
runAll,
|
|
25
|
-
hashArray,
|
|
26
|
-
safeCall,
|
|
27
|
-
removeUndefinedProperties,
|
|
28
|
-
isObject,
|
|
29
|
-
curry,
|
|
23
|
+
addOrRemove,
|
|
30
24
|
arrayMove,
|
|
31
|
-
uniq,
|
|
32
|
-
filter,
|
|
33
|
-
uniqBy,
|
|
34
|
-
groupBy,
|
|
35
|
-
property,
|
|
36
|
-
get,
|
|
37
|
-
set,
|
|
38
25
|
cloneDeep,
|
|
26
|
+
curry,
|
|
27
|
+
cx,
|
|
39
28
|
debounce,
|
|
29
|
+
differenceBy,
|
|
30
|
+
differenceWith,
|
|
31
|
+
filter,
|
|
40
32
|
findIndex,
|
|
33
|
+
get,
|
|
34
|
+
groupBy,
|
|
35
|
+
hashArray,
|
|
36
|
+
isBoolean,
|
|
41
37
|
isEmpty,
|
|
42
|
-
isString,
|
|
43
38
|
isEqual,
|
|
39
|
+
isEqualWith,
|
|
40
|
+
isFunction,
|
|
41
|
+
isNaN,
|
|
42
|
+
isObject,
|
|
43
|
+
isString,
|
|
44
44
|
maxBy,
|
|
45
45
|
meanBy,
|
|
46
46
|
noop,
|
|
47
47
|
omit,
|
|
48
48
|
orderBy,
|
|
49
|
+
padStart,
|
|
50
|
+
parseInt,
|
|
51
|
+
pick,
|
|
52
|
+
pickBy,
|
|
53
|
+
property,
|
|
49
54
|
pull,
|
|
55
|
+
range,
|
|
56
|
+
removeUndefinedProperties,
|
|
57
|
+
runAll,
|
|
58
|
+
safeCall,
|
|
59
|
+
set,
|
|
50
60
|
sortBy,
|
|
51
61
|
sumBy,
|
|
52
|
-
transform,
|
|
53
|
-
isFunction,
|
|
54
|
-
range,
|
|
55
|
-
parseInt,
|
|
56
|
-
padStart,
|
|
57
|
-
isNaN,
|
|
58
|
-
values,
|
|
59
62
|
throttle,
|
|
60
|
-
toggleInObject,
|
|
61
63
|
toggleInArray,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
isEqualWith,
|
|
68
|
-
isBoolean
|
|
64
|
+
toggleInObject,
|
|
65
|
+
transform,
|
|
66
|
+
uniq,
|
|
67
|
+
uniqBy,
|
|
68
|
+
values
|
|
69
69
|
} from "./utils.js";
|
|
70
70
|
import { setRef, mergeRefs, setMultipleRefs, logger } from "./system.js";
|
|
71
71
|
import {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
useCallbackAfterRender,
|
|
73
|
+
useCancellableDelayedCallback,
|
|
74
|
+
useDerivedStateFromProps,
|
|
75
75
|
useExecutionTimer,
|
|
76
76
|
useExpandState,
|
|
77
|
+
useFocusTrap,
|
|
78
|
+
UseFocusTrapWithSchema,
|
|
79
|
+
useForceUpdate,
|
|
80
|
+
useHeadlessTooltip,
|
|
77
81
|
useHotkeys,
|
|
78
82
|
useHoverHandlersDelay,
|
|
79
|
-
|
|
80
|
-
useShouldRecalculate,
|
|
81
|
-
useWindowScrollerList,
|
|
82
|
-
usePrevious,
|
|
83
|
-
useCancellableDelayedCallback,
|
|
84
|
-
useDerivedStateFromProps,
|
|
85
|
-
useOnElementResize,
|
|
83
|
+
useIsMobile,
|
|
86
84
|
useIsShowingEllipsis,
|
|
87
|
-
useNativeResizeObserver,
|
|
88
85
|
useMakeMutable,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
useIsMobile,
|
|
86
|
+
useMeasure,
|
|
87
|
+
useNativeIntersectionObserver,
|
|
88
|
+
useNativeResizeObserver,
|
|
93
89
|
useOnBlurOut,
|
|
94
90
|
UseOnBlurOutWithSchema,
|
|
91
|
+
useOnClickOutside,
|
|
92
|
+
useOnElementResize,
|
|
95
93
|
useOnFirstFocusIn,
|
|
96
94
|
UseOnFirstFocusInWithSchema,
|
|
97
95
|
useOnSpecificFocus,
|
|
98
96
|
UseOnSpecificFocusWithSchema,
|
|
99
|
-
|
|
97
|
+
usePrevious,
|
|
98
|
+
useResizeObserver,
|
|
99
|
+
useShouldRecalculate,
|
|
100
|
+
useTrackElement,
|
|
101
|
+
useWindowScrollerList
|
|
100
102
|
} from "./hooks/index.js";
|
|
101
103
|
import { getVisibleTimeByFormat, addLeadingZeros } from "./timeUtils.js";
|
|
102
104
|
import { compose } from "./compose.js";
|
|
@@ -206,6 +208,7 @@ export {
|
|
|
206
208
|
useIsShowingEllipsis,
|
|
207
209
|
useMakeMutable,
|
|
208
210
|
useMeasure,
|
|
211
|
+
useNativeIntersectionObserver,
|
|
209
212
|
useNativeResizeObserver,
|
|
210
213
|
useOnBlurOut,
|
|
211
214
|
useOnClickOutside,
|
|
@@ -215,6 +218,7 @@ export {
|
|
|
215
218
|
usePrevious,
|
|
216
219
|
useResizeObserver,
|
|
217
220
|
useShouldRecalculate,
|
|
221
|
+
useTrackElement,
|
|
218
222
|
useWindowScrollerList,
|
|
219
223
|
validDate,
|
|
220
224
|
values
|
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.js';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements.js';\nexport { capitalize } from './capitalize.js';\nexport { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities.js';\nexport {\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAoB,WAAXA,gBAAwC;AACjD,SAAoB,WAAXA,gBAA0D;AACnE,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB,4BAA4B;AAC7D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAQ,WAAW,iBAAiB,cAAc;AAC3D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB,uBAAuB;AACxD,SAAS,eAAe;AACxB,SAAS,UAAU,cAAc;AACjC,SAAS,wBAAwB;AACjC,SAAS,YAAY,eAAe,mBAAmB;AACvD,SAAS,oCAAoC;AAE7C,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AAE1C,cAAc;AACd,cAAc;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default as getComponentFromProps } from './getComponentFromProps.js';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements.js';\nexport { capitalize } from './capitalize.js';\nexport { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities.js';\nexport {\n checkEmpty,\n checkNotEmpty,\n contains,\n equal,\n greaterThan,\n greaterThanOrEquals,\n isIn,\n isNotIn,\n isNotNull,\n isNull,\n lessThanOrEquals,\n notEqual,\n startsWith,\n validDate,\n} from './operators.js';\nexport {\n addOrRemove,\n arrayMove,\n cloneDeep,\n curry,\n cx,\n debounce,\n differenceBy,\n differenceWith,\n filter,\n findIndex,\n get,\n groupBy,\n hashArray,\n isBoolean,\n isEmpty,\n isEqual,\n isEqualWith,\n isFunction,\n isNaN,\n isObject,\n isString,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n padStart,\n parseInt,\n pick,\n pickBy,\n property,\n pull,\n range,\n removeUndefinedProperties,\n runAll,\n safeCall,\n set,\n sortBy,\n sumBy,\n throttle,\n toggleInArray,\n toggleInObject,\n transform,\n uniq,\n uniqBy,\n values,\n} from './utils.js';\nexport { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';\nexport {\n useCallbackAfterRender,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useExecutionTimer,\n useExpandState,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useForceUpdate,\n useHeadlessTooltip,\n useHotkeys,\n useHoverHandlersDelay,\n useIsMobile,\n useIsShowingEllipsis,\n useMakeMutable,\n useMeasure,\n useNativeIntersectionObserver,\n useNativeResizeObserver,\n useOnBlurOut,\n UseOnBlurOutWithSchema,\n useOnClickOutside,\n useOnElementResize,\n useOnFirstFocusIn,\n UseOnFirstFocusInWithSchema,\n useOnSpecificFocus,\n UseOnSpecificFocusWithSchema,\n usePrevious,\n useResizeObserver,\n useShouldRecalculate,\n useTrackElement,\n useWindowScrollerList,\n} from './hooks/index.js';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils.js';\nexport { compose } from './compose.js';\nexport { DOCUMENT, WINDOW } from './platform.js';\nexport { isDOMTypeElement } from './reactTypesUtility.js';\nexport { isRequired, isGreaterThan, isValidDate } from './validations.js';\nexport { getHighlightedRerendersStyle } from './getHighlightedRerendersStyle.js';\n\nexport { crossTypeSort } from './algorithms/crossTypeSort.js';\nexport { appendComponentIfNotExist } from './addComponentIfNotExists.js';\n// TODO -- REMOVE WHEN READY\nexport * from './deprecated/index.js';\nexport * from './props-helpers/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAoB,WAAXA,gBAAwC;AACjD,SAAoB,WAAXA,gBAA0D;AACnE,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB,4BAA4B;AAC7D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAQ,WAAW,iBAAiB,cAAc;AAC3D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB,uBAAuB;AACxD,SAAS,eAAe;AACxB,SAAS,UAAU,cAAc;AACjC,SAAS,wBAAwB;AACjC,SAAS,YAAY,eAAe,mBAAmB;AACvD,SAAS,oCAAoC;AAE7C,SAAS,qBAAqB;AAC9B,SAAS,iCAAiC;AAE1C,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
package/dist/esm/system.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/system.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { isFunction } from './utils.js';\n\ntype AnyRef<T extends HTMLElement> =\n | React.MutableRefObject<T | null>\n | ((_ref: T | null) => void)\n | React.Dispatch<React.SetStateAction<T | null>>\n | false;\n\nexport const setRef = <T extends HTMLElement>(ref: AnyRef<T>, value: T) => {\n if (isFunction(ref)) {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nexport const mergeRefs = <T extends HTMLElement>(...refs: AnyRef<T>[]) => {\n const mergeRefsFunc = (node: T | null) => {\n if (!node) return;\n refs.forEach((ref) => setRef(ref, node));\n };\n return mergeRefsFunc;\n};\n\nexport function setMultipleRefs<T = unknown>(\n refs: Array<React.RefObject<T> | React.LegacyRef<T>>,\n): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n });\n };\n}\n\nexport function logger(...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.log(...args);\n}\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,kBAAkB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { isFunction } from './utils.js';\n\ntype AnyRef<T extends HTMLElement> =\n | React.MutableRefObject<T | null>\n | ((_ref: T | null) => void)\n | React.Dispatch<React.SetStateAction<T | null>>\n | false\n | undefined\n | null;\n\nexport const setRef = <T extends HTMLElement>(ref: AnyRef<T>, value: T) => {\n if (isFunction(ref)) {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nexport const mergeRefs = <T extends HTMLElement>(...refs: AnyRef<T>[]) => {\n const mergeRefsFunc = (node: T | null) => {\n if (!node) return;\n refs.forEach((ref) => setRef(ref, node));\n };\n return mergeRefsFunc;\n};\n\nexport function setMultipleRefs<T = unknown>(\n refs: Array<React.RefObject<T> | React.LegacyRef<T>>,\n): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n });\n };\n}\n\nexport function logger(...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.log(...args);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,kBAAkB;AAUpB,MAAM,SAAS,CAAwB,KAAgB,UAAa;AACzE,MAAI,WAAW,GAAG,GAAG;AACnB,QAAI,KAAK;AAAA,EACX,WAAW,KAAK;AACd,QAAI,UAAU;AAAA,EAChB;AACF;AAEO,MAAM,YAAY,IAA2B,SAAsB;AACxE,QAAM,gBAAgB,CAAC,SAAmB;AACxC,QAAI,CAAC;AAAM;AACX,SAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAAA,EACzC;AACA,SAAO;AACT;AAEO,SAAS,gBACd,MACsB;AACtB,SAAO,CAAC,UAAU;AAChB,SAAK,QAAQ,CAAC,QAAQ;AACpB,UAAI,OAAO,QAAQ,YAAY;AAC7B,YAAI,KAAK;AAAA,MACX,WAAW,OAAO,MAAM;AACtB,QAAC,IAAyC,UAAU;AAAA,MACtD;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEO,SAAS,UAAU,MAAiB;AAEzC,UAAQ,IAAI,GAAG,IAAI;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,6 +13,7 @@ export { useHoverHandlersDelay } from './useHoverHandlersDelay.js';
|
|
|
13
13
|
export { useIsMobile } from './useIsMobile.js';
|
|
14
14
|
export { useIsShowingEllipsis } from './useIsShowingEllipsis.js';
|
|
15
15
|
export { useMakeMutable } from './useMakeMutable.js';
|
|
16
|
+
export { useNativeIntersectionObserver } from './useNativeIntersectionObserver.js';
|
|
16
17
|
export { useNativeResizeObserver } from './useNativeResizeObserver.js';
|
|
17
18
|
export { useOnBlurOut, UseOnBlurOutWithSchema } from './useOnBlurOut.js';
|
|
18
19
|
export { useOnElementResize } from './useOnElementResize.js';
|
|
@@ -21,4 +22,5 @@ export { useOnSpecificFocus, UseOnSpecificFocusWithSchema } from './useOnSpecifi
|
|
|
21
22
|
export { usePrevious } from './usePrevious.js';
|
|
22
23
|
export { useResizeObserver } from './useResizeObserver.js';
|
|
23
24
|
export { useShouldRecalculate } from './useShouldRecalculate.js';
|
|
25
|
+
export { useTrackElement } from './useTrackElement.js';
|
|
24
26
|
export { useWindowScrollerList } from './useWindowScrollerList.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ export { default as getComponentFromProps } from './getComponentFromProps.js';
|
|
|
2
2
|
export { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements.js';
|
|
3
3
|
export { capitalize } from './capitalize.js';
|
|
4
4
|
export { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { checkEmpty, checkNotEmpty, contains, equal, greaterThan, greaterThanOrEquals, isIn, isNotIn, isNotNull, isNull, lessThanOrEquals, notEqual, startsWith, validDate, } from './operators.js';
|
|
6
|
+
export { addOrRemove, arrayMove, cloneDeep, curry, cx, debounce, differenceBy, differenceWith, filter, findIndex, get, groupBy, hashArray, isBoolean, isEmpty, isEqual, isEqualWith, isFunction, isNaN, isObject, isString, maxBy, meanBy, noop, omit, orderBy, padStart, parseInt, pick, pickBy, property, pull, range, removeUndefinedProperties, runAll, safeCall, set, sortBy, sumBy, throttle, toggleInArray, toggleInObject, transform, uniq, uniqBy, values, } from './utils.js';
|
|
7
7
|
export { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';
|
|
8
|
-
export {
|
|
8
|
+
export { useCallbackAfterRender, useCancellableDelayedCallback, useDerivedStateFromProps, useExecutionTimer, useExpandState, useFocusTrap, UseFocusTrapWithSchema, useForceUpdate, useHeadlessTooltip, useHotkeys, useHoverHandlersDelay, useIsMobile, useIsShowingEllipsis, useMakeMutable, useMeasure, useNativeIntersectionObserver, useNativeResizeObserver, useOnBlurOut, UseOnBlurOutWithSchema, useOnClickOutside, useOnElementResize, useOnFirstFocusIn, UseOnFirstFocusInWithSchema, useOnSpecificFocus, UseOnSpecificFocusWithSchema, usePrevious, useResizeObserver, useShouldRecalculate, useTrackElement, useWindowScrollerList, } from './hooks/index.js';
|
|
9
9
|
export { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils.js';
|
|
10
10
|
export { compose } from './compose.js';
|
|
11
11
|
export { DOCUMENT, WINDOW } from './platform.js';
|
package/dist/types/system.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
type AnyRef<T extends HTMLElement> = React.MutableRefObject<T | null> | ((_ref: T | null) => void) | React.Dispatch<React.SetStateAction<T | null>> | false;
|
|
2
|
+
type AnyRef<T extends HTMLElement> = React.MutableRefObject<T | null> | ((_ref: T | null) => void) | React.Dispatch<React.SetStateAction<T | null>> | false | undefined | null;
|
|
3
3
|
export declare const setRef: <T extends HTMLElement>(ref: AnyRef<T>, value: T) => void;
|
|
4
4
|
export declare const mergeRefs: <T extends HTMLElement>(...refs: AnyRef<T>[]) => (node: T | null) => void;
|
|
5
5
|
export declare function setMultipleRefs<T = unknown>(refs: Array<React.RefObject<T> | React.LegacyRef<T>>): React.RefCallback<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-utilities",
|
|
3
|
-
"version": "3.19.
|
|
3
|
+
"version": "3.19.1-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Utilities",
|
|
6
6
|
"files": [
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"use-force-update": "~1.0.11",
|
|
160
160
|
"use-measure": "~0.3.0",
|
|
161
161
|
"use-onclickoutside": "~0.4.1",
|
|
162
|
-
"@elliemae/ds-props-helpers": "3.19.
|
|
162
|
+
"@elliemae/ds-props-helpers": "3.19.1-rc.1"
|
|
163
163
|
},
|
|
164
164
|
"devDependencies": {
|
|
165
165
|
"@testing-library/react": "~12.1.3",
|