@elliemae/ds-utilities 3.0.0-alpha.3 → 3.0.0-next.3
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 +2 -0
- package/dist/cjs/hooks/index.js.map +2 -2
- package/dist/cjs/hooks/useCallbackAfterRender.js +45 -0
- package/dist/cjs/hooks/useCallbackAfterRender.js.map +7 -0
- package/dist/cjs/hooks/useIsShowingEllipsis.js.map +2 -2
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +2 -2
- package/dist/esm/hooks/useCallbackAfterRender.js +16 -0
- package/dist/esm/hooks/useCallbackAfterRender.js.map +7 -0
- package/dist/esm/hooks/useIsShowingEllipsis.js.map +2 -2
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +2 -2
- package/package.json +1 -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
|
+
useCallbackAfterRender: () => import_useCallbackAfterRender.useCallbackAfterRender,
|
|
30
31
|
useCancellableDelayedCallback: () => import_useCancellableDelayedCallback.useCancellableDelayedCallback,
|
|
31
32
|
useDerivedStateFromProps: () => import_useDerivedStateFromProps.useDerivedStateFromProps,
|
|
32
33
|
useExecutionTimer: () => import_useExecutionTimer.useExecutionTimer,
|
|
@@ -68,6 +69,7 @@ var import_useSetRef = require("./useSetRef");
|
|
|
68
69
|
var import_useParentElement = require("./useParentElement");
|
|
69
70
|
var import_useOnElementResize = require("./useOnElementResize");
|
|
70
71
|
var import_useIsShowingEllipsis = require("./useIsShowingEllipsis");
|
|
72
|
+
var import_useCallbackAfterRender = require("./useCallbackAfterRender");
|
|
71
73
|
var import_useFocusTrap = require("./useFocusTrap");
|
|
72
74
|
module.exports = __toCommonJS(hooks_exports);
|
|
73
75
|
//# 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';\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 { 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;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,0BAA6B;",
|
|
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,0BAA6B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useCallbackAfterRender_exports = {};
|
|
29
|
+
__export(useCallbackAfterRender_exports, {
|
|
30
|
+
useCallbackAfterRender: () => useCallbackAfterRender
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
const useCallbackAfterRender = () => {
|
|
35
|
+
const lastRun = (0, import_react.useRef)(null);
|
|
36
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
37
|
+
lastRun.current?.();
|
|
38
|
+
lastRun.current = null;
|
|
39
|
+
});
|
|
40
|
+
return (callback) => {
|
|
41
|
+
lastRun.current = callback;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
module.exports = __toCommonJS(useCallbackAfterRender_exports);
|
|
45
|
+
//# sourceMappingURL=useCallbackAfterRender.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useCallbackAfterRender.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useRef, useLayoutEffect } from 'react';\n\n// Inspired in https://github.com/ryuuji3/react-hooks/blob/4b183d61c30abf17efeab2240f8ff652a5dbb8e2/packages/use-callback-after-render/src/hooks/useCallbackAfterRender.ts\nexport const useCallbackAfterRender = (): Callback => {\n const lastRun = useRef<(() => void) | null>(null);\n\n useLayoutEffect(() => {\n lastRun.current?.();\n lastRun.current = null;\n });\n\n return (callback) => {\n lastRun.current = callback; // schedule callback after render\n };\n};\n\ntype Callback = (callback: () => void) => void;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwC;AAGjC,MAAM,yBAAyB,MAAgB;AACpD,QAAM,UAAU,yBAA4B;AAE5C,oCAAgB,MAAM;AACpB,YAAQ;AACR,YAAQ,UAAU;AAAA;AAGpB,SAAO,CAAC,aAAa;AACnB,YAAQ,UAAU;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useIsShowingEllipsis.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useState, useMemo } from 'react';\n\nexport const useIsShowingEllipsis = <T extends HTMLElement =
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAEtC,MAAM,uBAAuB,
|
|
4
|
+
"sourcesContent": ["import { useEffect, useState, useMemo } from 'react';\n\nexport const useIsShowingEllipsis = <T extends HTMLElement | null = HTMLElement | null>() => {\n const [element, setElement] = useState<T>();\n\n const [isShowingEllipsis, setIsShowingEllipsis] = useState(false);\n\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n if (entries.length) {\n const [textWrapperEntry] = entries;\n const el = textWrapperEntry.target;\n setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);\n }\n }),\n [],\n );\n\n useEffect(() => {\n if (element) {\n setIsShowingEllipsis(element.scrollWidth > element.clientWidth);\n resizeObserver.observe(element);\n }\n return () => {\n if (element) {\n resizeObserver.unobserve(element);\n }\n };\n }, [resizeObserver, element]);\n\n return { setElement, isShowingEllipsis };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAEtC,MAAM,uBAAuB,MAAyD;AAC3F,QAAM,CAAC,SAAS,cAAc;AAE9B,QAAM,CAAC,mBAAmB,wBAAwB,2BAAS;AAE3D,QAAM,iBAAiB,0BACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,QAAI,QAAQ,QAAQ;AAClB,YAAM,CAAC,oBAAoB;AAC3B,YAAM,KAAK,iBAAiB;AAC5B,2BAAqB,IAAI,cAAc,IAAI;AAAA;AAAA,MAGjD;AAGF,8BAAU,MAAM;AACd,QAAI,SAAS;AACX,2BAAqB,QAAQ,cAAc,QAAQ;AACnD,qBAAe,QAAQ;AAAA;AAEzB,WAAO,MAAM;AACX,UAAI,SAAS;AACX,uBAAe,UAAU;AAAA;AAAA;AAAA,KAG5B,CAAC,gBAAgB;AAEpB,SAAO,EAAE,YAAY;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -106,10 +106,12 @@ __export(src_exports, {
|
|
|
106
106
|
transform: () => import_utils.transform,
|
|
107
107
|
uniq: () => import_utils.uniq,
|
|
108
108
|
uniqBy: () => import_utils.uniqBy,
|
|
109
|
+
useCallbackAfterRender: () => import_hooks.useCallbackAfterRender,
|
|
109
110
|
useCancellableDelayedCallback: () => import_hooks.useCancellableDelayedCallback,
|
|
110
111
|
useDerivedStateFromProps: () => import_hooks.useDerivedStateFromProps,
|
|
111
112
|
useExecutionTimer: () => import_hooks.useExecutionTimer,
|
|
112
113
|
useExpandState: () => import_hooks.useExpandState,
|
|
114
|
+
useFocusTrap: () => import_hooks.useFocusTrap,
|
|
113
115
|
useForceUpdate: () => import_hooks.useForceUpdate,
|
|
114
116
|
useHotkeys: () => import_hooks.useHotkeys,
|
|
115
117
|
useHoverHandlersDelay: () => import_hooks.useHoverHandlersDelay,
|
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} 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;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} 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,mBAsBO;AACP,uBAAwD;AACxD,qBAAwB;AACxB,sBAAiC;AACjC,+BAOO;AACP,4BAA2B;AAC3B,yBAAuD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -18,8 +18,10 @@ import { useSetRef } from "./useSetRef";
|
|
|
18
18
|
import { useParentElement } from "./useParentElement";
|
|
19
19
|
import { useOnElementResize } from "./useOnElementResize";
|
|
20
20
|
import { useIsShowingEllipsis } from "./useIsShowingEllipsis";
|
|
21
|
+
import { useCallbackAfterRender } from "./useCallbackAfterRender";
|
|
21
22
|
import { useFocusTrap } from "./useFocusTrap";
|
|
22
23
|
export {
|
|
24
|
+
useCallbackAfterRender,
|
|
23
25
|
useCancellableDelayedCallback,
|
|
24
26
|
useDerivedStateFromProps,
|
|
25
27
|
useExecutionTimer,
|
|
@@ -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 { useFocusTrap } from './useFocusTrap';\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;",
|
|
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"],
|
|
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
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRef, useLayoutEffect } from "react";
|
|
3
|
+
const useCallbackAfterRender = () => {
|
|
4
|
+
const lastRun = useRef(null);
|
|
5
|
+
useLayoutEffect(() => {
|
|
6
|
+
lastRun.current?.();
|
|
7
|
+
lastRun.current = null;
|
|
8
|
+
});
|
|
9
|
+
return (callback) => {
|
|
10
|
+
lastRun.current = callback;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
useCallbackAfterRender
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useCallbackAfterRender.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useCallbackAfterRender.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef, useLayoutEffect } from 'react';\n\n// Inspired in https://github.com/ryuuji3/react-hooks/blob/4b183d61c30abf17efeab2240f8ff652a5dbb8e2/packages/use-callback-after-render/src/hooks/useCallbackAfterRender.ts\nexport const useCallbackAfterRender = (): Callback => {\n const lastRun = useRef<(() => void) | null>(null);\n\n useLayoutEffect(() => {\n lastRun.current?.();\n lastRun.current = null;\n });\n\n return (callback) => {\n lastRun.current = callback; // schedule callback after render\n };\n};\n\ntype Callback = (callback: () => void) => void;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAGO,MAAM,yBAAyB,MAAgB;AACpD,QAAM,UAAU,OAA4B;AAE5C,kBAAgB,MAAM;AACpB,YAAQ;AACR,YAAQ,UAAU;AAAA;AAGpB,SAAO,CAAC,aAAa;AACnB,YAAQ,UAAU;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useIsShowingEllipsis.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useState, useMemo } from 'react';\n\nexport const useIsShowingEllipsis = <T extends HTMLElement =
|
|
5
|
-
"mappings": "AAAA;ACAA;AAEO,MAAM,uBAAuB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useState, useMemo } from 'react';\n\nexport const useIsShowingEllipsis = <T extends HTMLElement | null = HTMLElement | null>() => {\n const [element, setElement] = useState<T>();\n\n const [isShowingEllipsis, setIsShowingEllipsis] = useState(false);\n\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n if (entries.length) {\n const [textWrapperEntry] = entries;\n const el = textWrapperEntry.target;\n setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);\n }\n }),\n [],\n );\n\n useEffect(() => {\n if (element) {\n setIsShowingEllipsis(element.scrollWidth > element.clientWidth);\n resizeObserver.observe(element);\n }\n return () => {\n if (element) {\n resizeObserver.unobserve(element);\n }\n };\n }, [resizeObserver, element]);\n\n return { setElement, isShowingEllipsis };\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,uBAAuB,MAAyD;AAC3F,QAAM,CAAC,SAAS,cAAc;AAE9B,QAAM,CAAC,mBAAmB,wBAAwB,SAAS;AAE3D,QAAM,iBAAiB,QACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,QAAI,QAAQ,QAAQ;AAClB,YAAM,CAAC,oBAAoB;AAC3B,YAAM,KAAK,iBAAiB;AAC5B,2BAAqB,IAAI,cAAc,IAAI;AAAA;AAAA,MAGjD;AAGF,YAAU,MAAM;AACd,QAAI,SAAS;AACX,2BAAqB,QAAQ,cAAc,QAAQ;AACnD,qBAAe,QAAQ;AAAA;AAEzB,WAAO,MAAM;AACX,UAAI,SAAS;AACX,uBAAe,UAAU;AAAA;AAAA;AAAA,KAG5B,CAAC,gBAAgB;AAEpB,SAAO,EAAE,YAAY;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -86,7 +86,9 @@ import {
|
|
|
86
86
|
useSetRef,
|
|
87
87
|
useParentElement,
|
|
88
88
|
useOnElementResize,
|
|
89
|
-
useIsShowingEllipsis
|
|
89
|
+
useIsShowingEllipsis,
|
|
90
|
+
useCallbackAfterRender,
|
|
91
|
+
useFocusTrap
|
|
90
92
|
} from "./hooks";
|
|
91
93
|
import { getVisibleTimeByFormat, addLeadingZeros } from "./timeUtils";
|
|
92
94
|
import { compose } from "./compose";
|
|
@@ -181,10 +183,12 @@ export {
|
|
|
181
183
|
transform,
|
|
182
184
|
uniq,
|
|
183
185
|
uniqBy,
|
|
186
|
+
useCallbackAfterRender,
|
|
184
187
|
useCancellableDelayedCallback,
|
|
185
188
|
useDerivedStateFromProps,
|
|
186
189
|
useExecutionTimer,
|
|
187
190
|
useExpandState,
|
|
191
|
+
useFocusTrap,
|
|
188
192
|
useForceUpdate,
|
|
189
193
|
useHotkeys,
|
|
190
194
|
useHoverHandlersDelay,
|
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} 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;
|
|
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;AAuBA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|