@elliemae/ds-utilities 3.17.0-next.1 → 3.17.0-next.11
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/getHighlightedRerendersStyle.js +63 -0
- package/dist/cjs/getHighlightedRerendersStyle.js.map +7 -0
- package/dist/cjs/hooks/index.js +2 -0
- package/dist/cjs/hooks/index.js.map +2 -2
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/getHighlightedRerendersStyle.js +33 -0
- package/dist/esm/getHighlightedRerendersStyle.js.map +7 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +2 -2
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/types/getHighlightedRerendersStyle.d.ts +11 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +5 -5
|
@@ -0,0 +1,63 @@
|
|
|
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 getHighlightedRerendersStyle_exports = {};
|
|
30
|
+
__export(getHighlightedRerendersStyle_exports, {
|
|
31
|
+
getHighlightedRerendersStyle: () => getHighlightedRerendersStyle
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getHighlightedRerendersStyle_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
const getRandomColor = () => {
|
|
36
|
+
const r = Math.floor(Math.random() * 256);
|
|
37
|
+
const g = Math.floor(Math.random() * 256);
|
|
38
|
+
const b = Math.floor(Math.random() * 256);
|
|
39
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
40
|
+
};
|
|
41
|
+
const getReadableColor = (rgbColorString) => {
|
|
42
|
+
if (!rgbColorString.match(/^rgb\(\d+, \d+, \d+\)$/)) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`The input color string "${rgbColorString}" is not in the correct format. The correct format is "rgb(r, g, b)" where r, g, and b are integers between 0 and 255.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const [r, g, b] = rgbColorString.match(/\d+/g)?.map((numStr) => parseInt(numStr)) ?? [0, 0, 0];
|
|
48
|
+
const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
49
|
+
const blackLuminance = 0;
|
|
50
|
+
const whiteLuminance = 1;
|
|
51
|
+
const luminanceDiffBlack = Math.abs(luminance - blackLuminance);
|
|
52
|
+
const luminanceDiffWhite = Math.abs(luminance - whiteLuminance);
|
|
53
|
+
const textColor = luminanceDiffBlack > luminanceDiffWhite ? "rgb(0, 0, 0)" : "rgb(255, 255, 255)";
|
|
54
|
+
return textColor;
|
|
55
|
+
};
|
|
56
|
+
const getHighlightedRerendersStyle = () => {
|
|
57
|
+
const randColor = getRandomColor();
|
|
58
|
+
return {
|
|
59
|
+
backgroundColor: randColor,
|
|
60
|
+
color: getReadableColor(randColor)
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=getHighlightedRerendersStyle.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/getHighlightedRerendersStyle.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\n\n// a strict type definition for rgb color strings\ntype RGBColorString = `rgb(${number}, ${number}, ${number})`;\n\n/**\n * This function returns a random color string in the format \"rgb(r, g, b)\"\n * This is meant to be used in conjunction with the getHighlightedRerendersStyle function.\n * This is not meant to be used in production, just a development tool.\n *\n * @returns {string} the random color string\n * @example\n * const color = getRandomColor(); // returns 'rgb(255, 255, 255)'\n * const color = getRandomColor(); // returns 'rgb(0, 0, 0)'\n * const color = getRandomColor(); // returns 'rgb(255, 0, 0)'\n * const color = getRandomColor(); // returns 'rgb(0, 255, 0)'\n * // etc...\n */\n\nconst getRandomColor = (): RGBColorString => {\n // generate random values for r, g, and b between 0 and 255\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n\n // return the color string in the format \"rgb(r, g, b)\"\n return `rgb(${r}, ${g}, ${b})`;\n};\n\n// type definition for getReadableColor\n\ntype GetReadableColor = (rgbColorString: RGBColorString) => RGBColorString;\n/**\n * This function returns a readable color for the input color string.\n * This is meant to be used in conjunction with the getHighlightedRerendersStyle function.\n * This is not meant to be used in production, just a development tool.\n *\n * @param {RGBColorString} rgbColorString the rgb color string to get a readable color for\n * @returns {RGBColorString} the readable color string\n * @example\n * const textColor = getReadableColor('rgb(255, 255, 255)'); // returns 'rgb(0, 0, 0)'\n * const textColor = getReadableColor('rgb(0, 0, 0)'); // returns 'rgb(255, 255, 255)'\n * const textColor = getReadableColor('rgb(255, 0, 0)'); // returns 'rgb(255, 255, 255)'\n * const textColor = getReadableColor('rgb(0, 255, 0)'); // returns 'rgb(0, 0, 0)'\n * // etc...\n */\nconst getReadableColor: GetReadableColor = (rgbColorString) => {\n // if the input color string is not in the correct format, throw an error\n if (!rgbColorString.match(/^rgb\\(\\d+, \\d+, \\d+\\)$/)) {\n throw new Error(\n `The input color string \"${rgbColorString}\" is not in the correct format. The correct format is \"rgb(r, g, b)\" where r, g, and b are integers between 0 and 255.`,\n );\n }\n // extract the r, g, and b values from the string\n const [r, g, b] = rgbColorString.match(/\\d+/g)?.map((numStr) => parseInt(numStr)) ?? [0, 0, 0];\n\n // calculate the relative luminance of the input color using the sRGB color space\n const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n\n // calculate the luminance of black and white colors\n const blackLuminance = 0;\n const whiteLuminance = 1;\n\n // calculate the luminance differences between the input color and black and white\n const luminanceDiffBlack = Math.abs(luminance - blackLuminance);\n const luminanceDiffWhite = Math.abs(luminance - whiteLuminance);\n\n // determine whether the input color is closer to black or white\n const textColor =\n luminanceDiffBlack > luminanceDiffWhite\n ? 'rgb(0, 0, 0)' // use white text for lighter colors\n : 'rgb(255, 255, 255)'; // use black text for darker colors\n\n // return the text color string\n return textColor;\n};\n// type definition for getHighlightedRerendersStyle\n// this function returns an object with the style properties for the highlighted rerenders\n\ntype GetHighlightedRerendersStyle = () => Partial<React.CSSProperties>;\n/**\n * This function returns an object with the style properties for highlighting rerenders.\n * this is meant to be invoked each time a component rerenders to get a new color combination\n * this is not meant to be used in production, just a development tool.\n *\n * @returns {Partial<React.CSSProperties>} an object with the style properties for the highlighted rerenders\n */\nexport const getHighlightedRerendersStyle: GetHighlightedRerendersStyle = () => {\n const randColor = getRandomColor();\n return {\n backgroundColor: randColor,\n color: getReadableColor(randColor),\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBvB,MAAM,iBAAiB,MAAsB;AAE3C,QAAM,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;AACxC,QAAM,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;AACxC,QAAM,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;AAGxC,SAAO,OAAO,MAAM,MAAM;AAC5B;AAmBA,MAAM,mBAAqC,CAAC,mBAAmB;AAE7D,MAAI,CAAC,eAAe,MAAM,wBAAwB,GAAG;AACnD,UAAM,IAAI;AAAA,MACR,2BAA2B;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,CAAC,GAAG,GAAG,CAAC,IAAI,eAAe,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;AAG7F,QAAM,aAAa,SAAS,IAAI,SAAS,IAAI,SAAS,KAAK;AAG3D,QAAM,iBAAiB;AACvB,QAAM,iBAAiB;AAGvB,QAAM,qBAAqB,KAAK,IAAI,YAAY,cAAc;AAC9D,QAAM,qBAAqB,KAAK,IAAI,YAAY,cAAc;AAG9D,QAAM,YACJ,qBAAqB,qBACjB,iBACA;AAGN,SAAO;AACT;AAYO,MAAM,+BAA6D,MAAM;AAC9E,QAAM,YAAY,eAAe;AACjC,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,OAAO,iBAAiB,SAAS;AAAA,EACnC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
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
|
+
useNativeResizeObserver: () => import_useNativeResizeObserver.useNativeResizeObserver,
|
|
49
50
|
useOnBlurOut: () => import_useOnBlurOut.useOnBlurOut,
|
|
50
51
|
useOnClickOutside: () => import_use_onclickoutside.default,
|
|
51
52
|
useOnElementResize: () => import_useOnElementResize.useOnElementResize,
|
|
@@ -73,6 +74,7 @@ var import_useHoverHandlersDelay = require("./useHoverHandlersDelay.js");
|
|
|
73
74
|
var import_useIsMobile = require("./useIsMobile.js");
|
|
74
75
|
var import_useIsShowingEllipsis = require("./useIsShowingEllipsis.js");
|
|
75
76
|
var import_useMakeMutable = require("./useMakeMutable.js");
|
|
77
|
+
var import_useNativeResizeObserver = require("./useNativeResizeObserver.js");
|
|
76
78
|
var import_useOnBlurOut = require("./useOnBlurOut.js");
|
|
77
79
|
var import_useOnElementResize = require("./useOnElementResize.js");
|
|
78
80
|
var import_useOnFirstFocusIn = require("./useOnFirstFocusIn.js");
|
|
@@ -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 { 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;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,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 { 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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __export(src_exports, {
|
|
|
55
55
|
findIndex: () => import_utils.findIndex,
|
|
56
56
|
get: () => import_utils.get,
|
|
57
57
|
getComponentFromProps: () => import_getComponentFromProps.default,
|
|
58
|
+
getHighlightedRerendersStyle: () => import_getHighlightedRerendersStyle.getHighlightedRerendersStyle,
|
|
58
59
|
getObjectKeysToArray: () => import_objectUtilities.getObjectKeysToArray,
|
|
59
60
|
getObjectValuesToArray: () => import_objectUtilities.getObjectValuesToArray,
|
|
60
61
|
getVisibleTimeByFormat: () => import_timeUtils.getVisibleTimeByFormat,
|
|
@@ -124,6 +125,7 @@ __export(src_exports, {
|
|
|
124
125
|
useIsShowingEllipsis: () => import_hooks.useIsShowingEllipsis,
|
|
125
126
|
useMakeMutable: () => import_hooks.useMakeMutable,
|
|
126
127
|
useMeasure: () => import_hooks.useMeasure,
|
|
128
|
+
useNativeResizeObserver: () => import_hooks.useNativeResizeObserver,
|
|
127
129
|
useOnBlurOut: () => import_hooks.useOnBlurOut,
|
|
128
130
|
useOnClickOutside: () => import_hooks.useOnClickOutside,
|
|
129
131
|
useOnElementResize: () => import_hooks.useOnElementResize,
|
|
@@ -151,6 +153,7 @@ var import_compose = require("./compose.js");
|
|
|
151
153
|
var import_platform = require("./platform.js");
|
|
152
154
|
var import_reactTypesUtility = require("./reactTypesUtility.js");
|
|
153
155
|
var import_validations = require("./validations.js");
|
|
156
|
+
var import_getHighlightedRerendersStyle = require("./getHighlightedRerendersStyle.js");
|
|
154
157
|
var import_crossTypeSort = require("./algorithms/crossTypeSort.js");
|
|
155
158
|
__reExport(src_exports, require("./deprecated/index.js"), module.exports);
|
|
156
159
|
__reExport(src_exports, require("./props-helpers/index.js"), module.exports);
|
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 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.js';\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.js';\nexport { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useMakeMutable,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n useOnBlurOut,\n UseOnBlurOutWithSchema,\n useOnFirstFocusIn,\n UseOnFirstFocusInWithSchema,\n useOnSpecificFocus,\n UseOnSpecificFocusWithSchema,\n useHeadlessTooltip,\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';\n\nexport { crossTypeSort } from './algorithms/crossTypeSort.js';\n\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;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 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.js';\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.js';\nexport { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useNativeResizeObserver,\n useMakeMutable,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n useOnBlurOut,\n UseOnBlurOutWithSchema,\n useOnFirstFocusIn,\n UseOnFirstFocusInWithSchema,\n useOnSpecificFocus,\n UseOnSpecificFocusWithSchema,\n useHeadlessTooltip,\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';\n\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;ACAA,YAAuB;ADAvB,mCAAiD;AACjD,qDAAmE;AACnE,wBAA2B;AAC3B,6BAA6D;AAC7D,uBAeO;AACP,mBA+CO;AACP,oBAA2D;AAC3D,mBA6BO;AACP,uBAAwD;AACxD,qBAAwB;AACxB,sBAAiC;AACjC,+BAAiC;AACjC,yBAAuD;AACvD,0CAA6C;AAE7C,2BAA8B;AAG9B,wBAAc,kCA7Gd;AA8GA,wBAAc,qCA9Gd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const getRandomColor = () => {
|
|
3
|
+
const r = Math.floor(Math.random() * 256);
|
|
4
|
+
const g = Math.floor(Math.random() * 256);
|
|
5
|
+
const b = Math.floor(Math.random() * 256);
|
|
6
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
7
|
+
};
|
|
8
|
+
const getReadableColor = (rgbColorString) => {
|
|
9
|
+
if (!rgbColorString.match(/^rgb\(\d+, \d+, \d+\)$/)) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`The input color string "${rgbColorString}" is not in the correct format. The correct format is "rgb(r, g, b)" where r, g, and b are integers between 0 and 255.`
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
const [r, g, b] = rgbColorString.match(/\d+/g)?.map((numStr) => parseInt(numStr)) ?? [0, 0, 0];
|
|
15
|
+
const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
16
|
+
const blackLuminance = 0;
|
|
17
|
+
const whiteLuminance = 1;
|
|
18
|
+
const luminanceDiffBlack = Math.abs(luminance - blackLuminance);
|
|
19
|
+
const luminanceDiffWhite = Math.abs(luminance - whiteLuminance);
|
|
20
|
+
const textColor = luminanceDiffBlack > luminanceDiffWhite ? "rgb(0, 0, 0)" : "rgb(255, 255, 255)";
|
|
21
|
+
return textColor;
|
|
22
|
+
};
|
|
23
|
+
const getHighlightedRerendersStyle = () => {
|
|
24
|
+
const randColor = getRandomColor();
|
|
25
|
+
return {
|
|
26
|
+
backgroundColor: randColor,
|
|
27
|
+
color: getReadableColor(randColor)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
getHighlightedRerendersStyle
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=getHighlightedRerendersStyle.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/getHighlightedRerendersStyle.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\n\n// a strict type definition for rgb color strings\ntype RGBColorString = `rgb(${number}, ${number}, ${number})`;\n\n/**\n * This function returns a random color string in the format \"rgb(r, g, b)\"\n * This is meant to be used in conjunction with the getHighlightedRerendersStyle function.\n * This is not meant to be used in production, just a development tool.\n *\n * @returns {string} the random color string\n * @example\n * const color = getRandomColor(); // returns 'rgb(255, 255, 255)'\n * const color = getRandomColor(); // returns 'rgb(0, 0, 0)'\n * const color = getRandomColor(); // returns 'rgb(255, 0, 0)'\n * const color = getRandomColor(); // returns 'rgb(0, 255, 0)'\n * // etc...\n */\n\nconst getRandomColor = (): RGBColorString => {\n // generate random values for r, g, and b between 0 and 255\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n\n // return the color string in the format \"rgb(r, g, b)\"\n return `rgb(${r}, ${g}, ${b})`;\n};\n\n// type definition for getReadableColor\n\ntype GetReadableColor = (rgbColorString: RGBColorString) => RGBColorString;\n/**\n * This function returns a readable color for the input color string.\n * This is meant to be used in conjunction with the getHighlightedRerendersStyle function.\n * This is not meant to be used in production, just a development tool.\n *\n * @param {RGBColorString} rgbColorString the rgb color string to get a readable color for\n * @returns {RGBColorString} the readable color string\n * @example\n * const textColor = getReadableColor('rgb(255, 255, 255)'); // returns 'rgb(0, 0, 0)'\n * const textColor = getReadableColor('rgb(0, 0, 0)'); // returns 'rgb(255, 255, 255)'\n * const textColor = getReadableColor('rgb(255, 0, 0)'); // returns 'rgb(255, 255, 255)'\n * const textColor = getReadableColor('rgb(0, 255, 0)'); // returns 'rgb(0, 0, 0)'\n * // etc...\n */\nconst getReadableColor: GetReadableColor = (rgbColorString) => {\n // if the input color string is not in the correct format, throw an error\n if (!rgbColorString.match(/^rgb\\(\\d+, \\d+, \\d+\\)$/)) {\n throw new Error(\n `The input color string \"${rgbColorString}\" is not in the correct format. The correct format is \"rgb(r, g, b)\" where r, g, and b are integers between 0 and 255.`,\n );\n }\n // extract the r, g, and b values from the string\n const [r, g, b] = rgbColorString.match(/\\d+/g)?.map((numStr) => parseInt(numStr)) ?? [0, 0, 0];\n\n // calculate the relative luminance of the input color using the sRGB color space\n const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n\n // calculate the luminance of black and white colors\n const blackLuminance = 0;\n const whiteLuminance = 1;\n\n // calculate the luminance differences between the input color and black and white\n const luminanceDiffBlack = Math.abs(luminance - blackLuminance);\n const luminanceDiffWhite = Math.abs(luminance - whiteLuminance);\n\n // determine whether the input color is closer to black or white\n const textColor =\n luminanceDiffBlack > luminanceDiffWhite\n ? 'rgb(0, 0, 0)' // use white text for lighter colors\n : 'rgb(255, 255, 255)'; // use black text for darker colors\n\n // return the text color string\n return textColor;\n};\n// type definition for getHighlightedRerendersStyle\n// this function returns an object with the style properties for the highlighted rerenders\n\ntype GetHighlightedRerendersStyle = () => Partial<React.CSSProperties>;\n/**\n * This function returns an object with the style properties for highlighting rerenders.\n * this is meant to be invoked each time a component rerenders to get a new color combination\n * this is not meant to be used in production, just a development tool.\n *\n * @returns {Partial<React.CSSProperties>} an object with the style properties for the highlighted rerenders\n */\nexport const getHighlightedRerendersStyle: GetHighlightedRerendersStyle = () => {\n const randColor = getRandomColor();\n return {\n backgroundColor: randColor,\n color: getReadableColor(randColor),\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmBvB,MAAM,iBAAiB,MAAsB;AAE3C,QAAM,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;AACxC,QAAM,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;AACxC,QAAM,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;AAGxC,SAAO,OAAO,MAAM,MAAM;AAC5B;AAmBA,MAAM,mBAAqC,CAAC,mBAAmB;AAE7D,MAAI,CAAC,eAAe,MAAM,wBAAwB,GAAG;AACnD,UAAM,IAAI;AAAA,MACR,2BAA2B;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,CAAC,GAAG,GAAG,CAAC,IAAI,eAAe,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;AAG7F,QAAM,aAAa,SAAS,IAAI,SAAS,IAAI,SAAS,KAAK;AAG3D,QAAM,iBAAiB;AACvB,QAAM,iBAAiB;AAGvB,QAAM,qBAAqB,KAAK,IAAI,YAAY,cAAc;AAC9D,QAAM,qBAAqB,KAAK,IAAI,YAAY,cAAc;AAG9D,QAAM,YACJ,qBAAqB,qBACjB,iBACA;AAGN,SAAO;AACT;AAYO,MAAM,+BAA6D,MAAM;AAC9E,QAAM,YAAY,eAAe;AACjC,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,OAAO,iBAAiB,SAAS;AAAA,EACnC;AACF;",
|
|
6
|
+
"names": []
|
|
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 { useNativeResizeObserver } from "./useNativeResizeObserver.js";
|
|
17
18
|
import { useOnBlurOut, UseOnBlurOutWithSchema } from "./useOnBlurOut.js";
|
|
18
19
|
import { useOnElementResize } from "./useOnElementResize.js";
|
|
19
20
|
import { useOnFirstFocusIn, UseOnFirstFocusInWithSchema } from "./useOnFirstFocusIn.js";
|
|
@@ -41,6 +42,7 @@ export {
|
|
|
41
42
|
useIsShowingEllipsis,
|
|
42
43
|
useMakeMutable,
|
|
43
44
|
default2 as useMeasure,
|
|
45
|
+
useNativeResizeObserver,
|
|
44
46
|
useOnBlurOut,
|
|
45
47
|
default4 as useOnClickOutside,
|
|
46
48
|
useOnElementResize,
|
|
@@ -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 { 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,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 { 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;",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -84,6 +84,7 @@ import {
|
|
|
84
84
|
useDerivedStateFromProps,
|
|
85
85
|
useOnElementResize,
|
|
86
86
|
useIsShowingEllipsis,
|
|
87
|
+
useNativeResizeObserver,
|
|
87
88
|
useMakeMutable,
|
|
88
89
|
useCallbackAfterRender,
|
|
89
90
|
useFocusTrap,
|
|
@@ -102,6 +103,7 @@ import { compose } from "./compose.js";
|
|
|
102
103
|
import { DOCUMENT, WINDOW } from "./platform.js";
|
|
103
104
|
import { isDOMTypeElement } from "./reactTypesUtility.js";
|
|
104
105
|
import { isRequired, isGreaterThan, isValidDate } from "./validations.js";
|
|
106
|
+
import { getHighlightedRerendersStyle } from "./getHighlightedRerendersStyle.js";
|
|
105
107
|
import { crossTypeSort } from "./algorithms/crossTypeSort.js";
|
|
106
108
|
export * from "./deprecated/index.js";
|
|
107
109
|
export * from "./props-helpers/index.js";
|
|
@@ -132,6 +134,7 @@ export {
|
|
|
132
134
|
findIndex,
|
|
133
135
|
get,
|
|
134
136
|
default2 as getComponentFromProps,
|
|
137
|
+
getHighlightedRerendersStyle,
|
|
135
138
|
getObjectKeysToArray,
|
|
136
139
|
getObjectValuesToArray,
|
|
137
140
|
getVisibleTimeByFormat,
|
|
@@ -201,6 +204,7 @@ export {
|
|
|
201
204
|
useIsShowingEllipsis,
|
|
202
205
|
useMakeMutable,
|
|
203
206
|
useMeasure,
|
|
207
|
+
useNativeResizeObserver,
|
|
204
208
|
useOnBlurOut,
|
|
205
209
|
useOnClickOutside,
|
|
206
210
|
useOnElementResize,
|
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 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.js';\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.js';\nexport { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useMakeMutable,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n useOnBlurOut,\n UseOnBlurOutWithSchema,\n useOnFirstFocusIn,\n UseOnFirstFocusInWithSchema,\n useOnSpecificFocus,\n UseOnSpecificFocusWithSchema,\n useHeadlessTooltip,\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';\n\nexport { crossTypeSort } from './algorithms/crossTypeSort.js';\n\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,OACK;AACP,SAAS,wBAAwB,uBAAuB;AACxD,SAAS,eAAe;AACxB,SAAS,UAAU,cAAc;AACjC,SAAS,wBAAwB;AACjC,SAAS,YAAY,eAAe,mBAAmB;
|
|
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 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.js';\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.js';\nexport { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useNativeResizeObserver,\n useMakeMutable,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n useOnBlurOut,\n UseOnBlurOutWithSchema,\n useOnFirstFocusIn,\n UseOnFirstFocusInWithSchema,\n useOnSpecificFocus,\n UseOnSpecificFocusWithSchema,\n useHeadlessTooltip,\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';\n\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,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;AAG9B,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
type GetHighlightedRerendersStyle = () => Partial<React.CSSProperties>;
|
|
3
|
+
/**
|
|
4
|
+
* This function returns an object with the style properties for highlighting rerenders.
|
|
5
|
+
* this is meant to be invoked each time a component rerenders to get a new color combination
|
|
6
|
+
* this is not meant to be used in production, just a development tool.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Partial<React.CSSProperties>} an object with the style properties for the highlighted rerenders
|
|
9
|
+
*/
|
|
10
|
+
export declare const getHighlightedRerendersStyle: GetHighlightedRerendersStyle;
|
|
11
|
+
export {};
|
|
@@ -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 { useNativeResizeObserver } from './useNativeResizeObserver.js';
|
|
16
17
|
export { useOnBlurOut, UseOnBlurOutWithSchema } from './useOnBlurOut.js';
|
|
17
18
|
export { useOnElementResize } from './useOnElementResize.js';
|
|
18
19
|
export { useOnFirstFocusIn, UseOnFirstFocusInWithSchema } from './useOnFirstFocusIn.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ export { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities.
|
|
|
5
5
|
export { checkNotEmpty, checkEmpty, greaterThan, validDate, equal, notEqual, isNull, isNotNull, isIn, isNotIn, greaterThanOrEquals, lessThanOrEquals, startsWith, contains, } from './operators.js';
|
|
6
6
|
export { cx, runAll, hashArray, safeCall, removeUndefinedProperties, isObject, curry, arrayMove, uniq, filter, uniqBy, groupBy, property, get, set, cloneDeep, debounce, findIndex, isEmpty, isString, isEqual, maxBy, meanBy, noop, omit, orderBy, pull, sortBy, sumBy, transform, isFunction, range, parseInt, padStart, isNaN, values, throttle, toggleInObject, toggleInArray, pick, pickBy, differenceBy, differenceWith, addOrRemove, isEqualWith, isBoolean, } from './utils.js';
|
|
7
7
|
export { setRef, mergeRefs, setMultipleRefs, logger } from './system.js';
|
|
8
|
-
export { useMeasure, useForceUpdate, useOnClickOutside, useExecutionTimer, useExpandState, useHotkeys, useHoverHandlersDelay, useResizeObserver, useShouldRecalculate, useWindowScrollerList, usePrevious, useCancellableDelayedCallback, useDerivedStateFromProps, useOnElementResize, useIsShowingEllipsis, useMakeMutable, useCallbackAfterRender, useFocusTrap, UseFocusTrapWithSchema, useIsMobile, useOnBlurOut, UseOnBlurOutWithSchema, useOnFirstFocusIn, UseOnFirstFocusInWithSchema, useOnSpecificFocus, UseOnSpecificFocusWithSchema, useHeadlessTooltip, } from './hooks/index.js';
|
|
8
|
+
export { useMeasure, useForceUpdate, useOnClickOutside, useExecutionTimer, useExpandState, useHotkeys, useHoverHandlersDelay, useResizeObserver, useShouldRecalculate, useWindowScrollerList, usePrevious, useCancellableDelayedCallback, useDerivedStateFromProps, useOnElementResize, useIsShowingEllipsis, useNativeResizeObserver, useMakeMutable, useCallbackAfterRender, useFocusTrap, UseFocusTrapWithSchema, useIsMobile, useOnBlurOut, UseOnBlurOutWithSchema, useOnFirstFocusIn, UseOnFirstFocusInWithSchema, useOnSpecificFocus, UseOnSpecificFocusWithSchema, useHeadlessTooltip, } 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';
|
|
12
12
|
export { isDOMTypeElement } from './reactTypesUtility.js';
|
|
13
13
|
export { isRequired, isGreaterThan, isValidDate } from './validations.js';
|
|
14
|
+
export { getHighlightedRerendersStyle } from './getHighlightedRerendersStyle.js';
|
|
14
15
|
export { crossTypeSort } from './algorithms/crossTypeSort.js';
|
|
15
16
|
export * from './deprecated/index.js';
|
|
16
17
|
export * from './props-helpers/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-utilities",
|
|
3
|
-
"version": "3.17.0-next.
|
|
3
|
+
"version": "3.17.0-next.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Utilities",
|
|
6
6
|
"files": [
|
|
@@ -152,18 +152,18 @@
|
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
154
|
"@elliemae/pui-theme": "~2.7.0",
|
|
155
|
-
"hotkeys-js": "~3.10.
|
|
155
|
+
"hotkeys-js": "~3.10.2",
|
|
156
156
|
"raf": "~3.4.1",
|
|
157
157
|
"resize-observer-polyfill": "~1.5.1",
|
|
158
158
|
"uncontrollable": "~7.2.1",
|
|
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.17.0-next.
|
|
162
|
+
"@elliemae/ds-props-helpers": "3.17.0-next.11"
|
|
163
163
|
},
|
|
164
164
|
"devDependencies": {
|
|
165
|
-
"@testing-library/
|
|
166
|
-
"@testing-library/react": "~
|
|
165
|
+
"@testing-library/react": "~12.1.3",
|
|
166
|
+
"@testing-library/react-hooks": "~8.0.1"
|
|
167
167
|
},
|
|
168
168
|
"peerDependencies": {
|
|
169
169
|
"lodash": "^4.17.21",
|