@elliemae/ds-utilities 3.55.0-next.8 → 3.55.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/algorithms/crossTypeSort.js +1 -1
- package/dist/cjs/algorithms/crossTypeSort.js.map +2 -2
- package/dist/cjs/hooks/useNativeResizeObserver.js +1 -1
- package/dist/cjs/hooks/useNativeResizeObserver.js.map +2 -2
- package/dist/esm/algorithms/crossTypeSort.js +1 -1
- package/dist/esm/algorithms/crossTypeSort.js.map +2 -2
- package/dist/esm/hooks/useNativeResizeObserver.js +1 -1
- package/dist/esm/hooks/useNativeResizeObserver.js.map +2 -2
- package/package.json +7 -7
|
@@ -38,7 +38,7 @@ const numberSort = (a, b, direction = "ASC") => {
|
|
|
38
38
|
const aAsNum = parseFloat(a);
|
|
39
39
|
const bAsNum = parseFloat(b);
|
|
40
40
|
if (direction === "ASC") return aAsNum - bAsNum;
|
|
41
|
-
return bAsNum - aAsNum;
|
|
41
|
+
else return bAsNum - aAsNum;
|
|
42
42
|
}
|
|
43
43
|
if (canBeParsedAsNumber(a)) return direction === "ASC" ? -1 : 1;
|
|
44
44
|
if (canBeParsedAsNumber(b)) return direction === "ASC" ? 1 : -1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/algorithms/crossTypeSort.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["type ComparisonTerm = string | number | null | undefined;\ntype Direction = 'ASC' | 'DESC';\ntype SortCB = Required<Parameters<(typeof Array.prototype)['sort']>>[0];\ntype SortingHelper = (a: ComparisonTerm, b: ComparisonTerm, direction?: Direction) => ReturnType<SortCB> | false;\n\nconst canBeParsedAsNumber = (val: ComparisonTerm): val is string => !Number.isNaN(parseFloat(val as string));\n\nconst numberSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (canBeParsedAsNumber(a) && canBeParsedAsNumber(b)) {\n const aAsNum = parseFloat(a);\n const bAsNum = parseFloat(b);\n if (direction === 'ASC') return aAsNum - bAsNum;\n return bAsNum - aAsNum;\n }\n if (canBeParsedAsNumber(a)) return direction === 'ASC' ? -1 : 1;\n if (canBeParsedAsNumber(b)) return direction === 'ASC' ? 1 : -1;\n return false;\n};\nconst voidishSort: SortingHelper = (a, b) => {\n // voids are always sorted the same way no matter the direction since it's more ux intuitive\n // order of execution matters, this ensure the order '-' , '', null, undefined\n if (a === undefined) return 1;\n if (b === undefined) return -1;\n if (a === null) return 1;\n if (b === null) return -1;\n if (a === '') return 1;\n if (b === '') return -1;\n if (a === '-') return 1;\n if (b === '-') return -1;\n return false;\n};\nconst stringSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (typeof a === 'string' && typeof b === 'string')\n return direction === 'ASC'\n ? a.localeCompare(b, undefined, { numeric: true })\n : b.localeCompare(a, undefined, { numeric: true });\n return false;\n};\n\nexport const crossTypeSort = (\n a: ComparisonTerm,\n b: ComparisonTerm,\n direction: Direction = 'ASC',\n): ReturnType<SortCB> => {\n if (a === b) return 0;\n const voidishSorted = voidishSort(a, b, direction);\n if (voidishSorted !== false) return voidishSorted;\n\n const numberSorted = numberSort(a, b, direction);\n if (numberSorted !== false) return numberSorted;\n\n const stringSorted = stringSort(a, b, direction);\n if (stringSorted !== false) return stringSorted;\n return -1;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,MAAM,sBAAsB,CAAC,QAAuC,CAAC,OAAO,MAAM,WAAW,GAAa,CAAC;AAE3G,MAAM,aAA4B,CAAC,GAAG,GAAG,YAAY,UAAU;AAC7D,MAAI,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,GAAG;AACpD,UAAM,SAAS,WAAW,CAAC;AAC3B,UAAM,SAAS,WAAW,CAAC;AAC3B,QAAI,cAAc,MAAO,QAAO,SAAS;
|
|
4
|
+
"sourcesContent": ["type ComparisonTerm = string | number | null | undefined;\ntype Direction = 'ASC' | 'DESC';\ntype SortCB = Required<Parameters<(typeof Array.prototype)['sort']>>[0];\ntype SortingHelper = (a: ComparisonTerm, b: ComparisonTerm, direction?: Direction) => ReturnType<SortCB> | false;\n\nconst canBeParsedAsNumber = (val: ComparisonTerm): val is string => !Number.isNaN(parseFloat(val as string));\n\nconst numberSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (canBeParsedAsNumber(a) && canBeParsedAsNumber(b)) {\n const aAsNum = parseFloat(a);\n const bAsNum = parseFloat(b);\n if (direction === 'ASC') return aAsNum - bAsNum;\n else return bAsNum - aAsNum;\n }\n if (canBeParsedAsNumber(a)) return direction === 'ASC' ? -1 : 1;\n if (canBeParsedAsNumber(b)) return direction === 'ASC' ? 1 : -1;\n return false;\n};\nconst voidishSort: SortingHelper = (a, b) => {\n // voids are always sorted the same way no matter the direction since it's more ux intuitive\n // order of execution matters, this ensure the order '-' , '', null, undefined\n if (a === undefined) return 1;\n if (b === undefined) return -1;\n if (a === null) return 1;\n if (b === null) return -1;\n if (a === '') return 1;\n if (b === '') return -1;\n if (a === '-') return 1;\n if (b === '-') return -1;\n return false;\n};\nconst stringSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (typeof a === 'string' && typeof b === 'string')\n return direction === 'ASC'\n ? a.localeCompare(b, undefined, { numeric: true })\n : b.localeCompare(a, undefined, { numeric: true });\n return false;\n};\n\nexport const crossTypeSort = (\n a: ComparisonTerm,\n b: ComparisonTerm,\n direction: Direction = 'ASC',\n): ReturnType<SortCB> => {\n if (a === b) return 0;\n const voidishSorted = voidishSort(a, b, direction);\n if (voidishSorted !== false) return voidishSorted;\n\n const numberSorted = numberSort(a, b, direction);\n if (numberSorted !== false) return numberSorted;\n\n const stringSorted = stringSort(a, b, direction);\n if (stringSorted !== false) return stringSorted;\n return -1;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,MAAM,sBAAsB,CAAC,QAAuC,CAAC,OAAO,MAAM,WAAW,GAAa,CAAC;AAE3G,MAAM,aAA4B,CAAC,GAAG,GAAG,YAAY,UAAU;AAC7D,MAAI,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,GAAG;AACpD,UAAM,SAAS,WAAW,CAAC;AAC3B,UAAM,SAAS,WAAW,CAAC;AAC3B,QAAI,cAAc,MAAO,QAAO,SAAS;AAAA,QACpC,QAAO,SAAS;AAAA,EACvB;AACA,MAAI,oBAAoB,CAAC,EAAG,QAAO,cAAc,QAAQ,KAAK;AAC9D,MAAI,oBAAoB,CAAC,EAAG,QAAO,cAAc,QAAQ,IAAI;AAC7D,SAAO;AACT;AACA,MAAM,cAA6B,CAAC,GAAG,MAAM;AAG3C,MAAI,MAAM,OAAW,QAAO;AAC5B,MAAI,MAAM,OAAW,QAAO;AAC5B,MAAI,MAAM,KAAM,QAAO;AACvB,MAAI,MAAM,KAAM,QAAO;AACvB,MAAI,MAAM,GAAI,QAAO;AACrB,MAAI,MAAM,GAAI,QAAO;AACrB,MAAI,MAAM,IAAK,QAAO;AACtB,MAAI,MAAM,IAAK,QAAO;AACtB,SAAO;AACT;AACA,MAAM,aAA4B,CAAC,GAAG,GAAG,YAAY,UAAU;AAC7D,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM;AACxC,WAAO,cAAc,QACjB,EAAE,cAAc,GAAG,QAAW,EAAE,SAAS,KAAK,CAAC,IAC/C,EAAE,cAAc,GAAG,QAAW,EAAE,SAAS,KAAK,CAAC;AACrD,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,GACA,GACA,YAAuB,UACA;AACvB,MAAI,MAAM,EAAG,QAAO;AACpB,QAAM,gBAAgB,YAAY,GAAG,GAAG,SAAS;AACjD,MAAI,kBAAkB,MAAO,QAAO;AAEpC,QAAM,eAAe,WAAW,GAAG,GAAG,SAAS;AAC/C,MAAI,iBAAiB,MAAO,QAAO;AAEnC,QAAM,eAAe,WAAW,GAAG,GAAG,SAAS;AAC/C,MAAI,iBAAiB,MAAO,QAAO;AACnC,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,7 +37,7 @@ const useNativeResizeObserver = (el, callback) => {
|
|
|
37
37
|
const resizeObserver = (0, import_react.useMemo)(
|
|
38
38
|
() => new ResizeObserver((entries) => {
|
|
39
39
|
const entry = entries[0];
|
|
40
|
-
const
|
|
40
|
+
const contentRect = entry.contentRect;
|
|
41
41
|
const target = entry.target;
|
|
42
42
|
callback({ contentRect, target });
|
|
43
43
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useNativeResizeObserver.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the resize observer api,\n// to observe changes in the size of an **UNIQUE** element\n// Will trigger the callback with the contentRect,\n// which contains width, height, top, bottom, etc of the element,\n// and the html element itself, so you can query for offsetWidth, etc\nexport const useNativeResizeObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: { contentRect: DOMRectReadOnly; target: T }) => void,\n) => {\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAmC;AAO5B,MAAM,0BAA0B,CACrC,IACA,aACG;AACH,QAAM,qBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,
|
|
4
|
+
"sourcesContent": ["import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the resize observer api,\n// to observe changes in the size of an **UNIQUE** element\n// Will trigger the callback with the contentRect,\n// which contains width, height, top, bottom, etc of the element,\n// and the html element itself, so you can query for offsetWidth, etc\nexport const useNativeResizeObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: { contentRect: DOMRectReadOnly; target: T }) => void,\n) => {\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const contentRect = entry.contentRect;\n\n const target = entry.target as T;\n\n callback({ contentRect, target });\n }),\n [callback],\n );\n\n useEffect(() => {\n if (el) resizeObserver.observe(el);\n return () => resizeObserver.disconnect();\n }, [el, resizeObserver]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAmC;AAO5B,MAAM,0BAA0B,CACrC,IACA,aACG;AACH,QAAM,qBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,cAAc,MAAM;AAE1B,YAAM,SAAS,MAAM;AAErB,eAAS,EAAE,aAAa,OAAO,CAAC;AAAA,IAClC,CAAC;AAAA,IACH,CAAC,QAAQ;AAAA,EACX;AAEA,8BAAU,MAAM;AACd,QAAI,GAAI,gBAAe,QAAQ,EAAE;AACjC,WAAO,MAAM,eAAe,WAAW;AAAA,EACzC,GAAG,CAAC,IAAI,cAAc,CAAC;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ const numberSort = (a, b, direction = "ASC") => {
|
|
|
5
5
|
const aAsNum = parseFloat(a);
|
|
6
6
|
const bAsNum = parseFloat(b);
|
|
7
7
|
if (direction === "ASC") return aAsNum - bAsNum;
|
|
8
|
-
return bAsNum - aAsNum;
|
|
8
|
+
else return bAsNum - aAsNum;
|
|
9
9
|
}
|
|
10
10
|
if (canBeParsedAsNumber(a)) return direction === "ASC" ? -1 : 1;
|
|
11
11
|
if (canBeParsedAsNumber(b)) return direction === "ASC" ? 1 : -1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/algorithms/crossTypeSort.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "type ComparisonTerm = string | number | null | undefined;\ntype Direction = 'ASC' | 'DESC';\ntype SortCB = Required<Parameters<(typeof Array.prototype)['sort']>>[0];\ntype SortingHelper = (a: ComparisonTerm, b: ComparisonTerm, direction?: Direction) => ReturnType<SortCB> | false;\n\nconst canBeParsedAsNumber = (val: ComparisonTerm): val is string => !Number.isNaN(parseFloat(val as string));\n\nconst numberSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (canBeParsedAsNumber(a) && canBeParsedAsNumber(b)) {\n const aAsNum = parseFloat(a);\n const bAsNum = parseFloat(b);\n if (direction === 'ASC') return aAsNum - bAsNum;\n return bAsNum - aAsNum;\n }\n if (canBeParsedAsNumber(a)) return direction === 'ASC' ? -1 : 1;\n if (canBeParsedAsNumber(b)) return direction === 'ASC' ? 1 : -1;\n return false;\n};\nconst voidishSort: SortingHelper = (a, b) => {\n // voids are always sorted the same way no matter the direction since it's more ux intuitive\n // order of execution matters, this ensure the order '-' , '', null, undefined\n if (a === undefined) return 1;\n if (b === undefined) return -1;\n if (a === null) return 1;\n if (b === null) return -1;\n if (a === '') return 1;\n if (b === '') return -1;\n if (a === '-') return 1;\n if (b === '-') return -1;\n return false;\n};\nconst stringSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (typeof a === 'string' && typeof b === 'string')\n return direction === 'ASC'\n ? a.localeCompare(b, undefined, { numeric: true })\n : b.localeCompare(a, undefined, { numeric: true });\n return false;\n};\n\nexport const crossTypeSort = (\n a: ComparisonTerm,\n b: ComparisonTerm,\n direction: Direction = 'ASC',\n): ReturnType<SortCB> => {\n if (a === b) return 0;\n const voidishSorted = voidishSort(a, b, direction);\n if (voidishSorted !== false) return voidishSorted;\n\n const numberSorted = numberSort(a, b, direction);\n if (numberSorted !== false) return numberSorted;\n\n const stringSorted = stringSort(a, b, direction);\n if (stringSorted !== false) return stringSorted;\n return -1;\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACKvB,MAAM,sBAAsB,CAAC,QAAuC,CAAC,OAAO,MAAM,WAAW,GAAa,CAAC;AAE3G,MAAM,aAA4B,CAAC,GAAG,GAAG,YAAY,UAAU;AAC7D,MAAI,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,GAAG;AACpD,UAAM,SAAS,WAAW,CAAC;AAC3B,UAAM,SAAS,WAAW,CAAC;AAC3B,QAAI,cAAc,MAAO,QAAO,SAAS;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "type ComparisonTerm = string | number | null | undefined;\ntype Direction = 'ASC' | 'DESC';\ntype SortCB = Required<Parameters<(typeof Array.prototype)['sort']>>[0];\ntype SortingHelper = (a: ComparisonTerm, b: ComparisonTerm, direction?: Direction) => ReturnType<SortCB> | false;\n\nconst canBeParsedAsNumber = (val: ComparisonTerm): val is string => !Number.isNaN(parseFloat(val as string));\n\nconst numberSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (canBeParsedAsNumber(a) && canBeParsedAsNumber(b)) {\n const aAsNum = parseFloat(a);\n const bAsNum = parseFloat(b);\n if (direction === 'ASC') return aAsNum - bAsNum;\n else return bAsNum - aAsNum;\n }\n if (canBeParsedAsNumber(a)) return direction === 'ASC' ? -1 : 1;\n if (canBeParsedAsNumber(b)) return direction === 'ASC' ? 1 : -1;\n return false;\n};\nconst voidishSort: SortingHelper = (a, b) => {\n // voids are always sorted the same way no matter the direction since it's more ux intuitive\n // order of execution matters, this ensure the order '-' , '', null, undefined\n if (a === undefined) return 1;\n if (b === undefined) return -1;\n if (a === null) return 1;\n if (b === null) return -1;\n if (a === '') return 1;\n if (b === '') return -1;\n if (a === '-') return 1;\n if (b === '-') return -1;\n return false;\n};\nconst stringSort: SortingHelper = (a, b, direction = 'ASC') => {\n if (typeof a === 'string' && typeof b === 'string')\n return direction === 'ASC'\n ? a.localeCompare(b, undefined, { numeric: true })\n : b.localeCompare(a, undefined, { numeric: true });\n return false;\n};\n\nexport const crossTypeSort = (\n a: ComparisonTerm,\n b: ComparisonTerm,\n direction: Direction = 'ASC',\n): ReturnType<SortCB> => {\n if (a === b) return 0;\n const voidishSorted = voidishSort(a, b, direction);\n if (voidishSorted !== false) return voidishSorted;\n\n const numberSorted = numberSort(a, b, direction);\n if (numberSorted !== false) return numberSorted;\n\n const stringSorted = stringSort(a, b, direction);\n if (stringSorted !== false) return stringSorted;\n return -1;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACKvB,MAAM,sBAAsB,CAAC,QAAuC,CAAC,OAAO,MAAM,WAAW,GAAa,CAAC;AAE3G,MAAM,aAA4B,CAAC,GAAG,GAAG,YAAY,UAAU;AAC7D,MAAI,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,GAAG;AACpD,UAAM,SAAS,WAAW,CAAC;AAC3B,UAAM,SAAS,WAAW,CAAC;AAC3B,QAAI,cAAc,MAAO,QAAO,SAAS;AAAA,QACpC,QAAO,SAAS;AAAA,EACvB;AACA,MAAI,oBAAoB,CAAC,EAAG,QAAO,cAAc,QAAQ,KAAK;AAC9D,MAAI,oBAAoB,CAAC,EAAG,QAAO,cAAc,QAAQ,IAAI;AAC7D,SAAO;AACT;AACA,MAAM,cAA6B,CAAC,GAAG,MAAM;AAG3C,MAAI,MAAM,OAAW,QAAO;AAC5B,MAAI,MAAM,OAAW,QAAO;AAC5B,MAAI,MAAM,KAAM,QAAO;AACvB,MAAI,MAAM,KAAM,QAAO;AACvB,MAAI,MAAM,GAAI,QAAO;AACrB,MAAI,MAAM,GAAI,QAAO;AACrB,MAAI,MAAM,IAAK,QAAO;AACtB,MAAI,MAAM,IAAK,QAAO;AACtB,SAAO;AACT;AACA,MAAM,aAA4B,CAAC,GAAG,GAAG,YAAY,UAAU;AAC7D,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM;AACxC,WAAO,cAAc,QACjB,EAAE,cAAc,GAAG,QAAW,EAAE,SAAS,KAAK,CAAC,IAC/C,EAAE,cAAc,GAAG,QAAW,EAAE,SAAS,KAAK,CAAC;AACrD,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,GACA,GACA,YAAuB,UACA;AACvB,MAAI,MAAM,EAAG,QAAO;AACpB,QAAM,gBAAgB,YAAY,GAAG,GAAG,SAAS;AACjD,MAAI,kBAAkB,MAAO,QAAO;AAEpC,QAAM,eAAe,WAAW,GAAG,GAAG,SAAS;AAC/C,MAAI,iBAAiB,MAAO,QAAO;AAEnC,QAAM,eAAe,WAAW,GAAG,GAAG,SAAS;AAC/C,MAAI,iBAAiB,MAAO,QAAO;AACnC,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ const useNativeResizeObserver = (el, callback) => {
|
|
|
4
4
|
const resizeObserver = useMemo(
|
|
5
5
|
() => new ResizeObserver((entries) => {
|
|
6
6
|
const entry = entries[0];
|
|
7
|
-
const
|
|
7
|
+
const contentRect = entry.contentRect;
|
|
8
8
|
const target = entry.target;
|
|
9
9
|
callback({ contentRect, target });
|
|
10
10
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useNativeResizeObserver.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the resize observer api,\n// to observe changes in the size of an **UNIQUE** element\n// Will trigger the callback with the contentRect,\n// which contains width, height, top, bottom, etc of the element,\n// and the html element itself, so you can query for offsetWidth, etc\nexport const useNativeResizeObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: { contentRect: DOMRectReadOnly; target: T }) => void,\n) => {\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,eAAe;AAO5B,MAAM,0BAA0B,CACrC,IACA,aACG;AACH,QAAM,iBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the resize observer api,\n// to observe changes in the size of an **UNIQUE** element\n// Will trigger the callback with the contentRect,\n// which contains width, height, top, bottom, etc of the element,\n// and the html element itself, so you can query for offsetWidth, etc\nexport const useNativeResizeObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: { contentRect: DOMRectReadOnly; target: T }) => void,\n) => {\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const contentRect = entry.contentRect;\n\n const target = entry.target as T;\n\n callback({ contentRect, target });\n }),\n [callback],\n );\n\n useEffect(() => {\n if (el) resizeObserver.observe(el);\n return () => resizeObserver.disconnect();\n }, [el, resizeObserver]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,eAAe;AAO5B,MAAM,0BAA0B,CACrC,IACA,aACG;AACH,QAAM,iBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,cAAc,MAAM;AAE1B,YAAM,SAAS,MAAM;AAErB,eAAS,EAAE,aAAa,OAAO,CAAC;AAAA,IAClC,CAAC;AAAA,IACH,CAAC,QAAQ;AAAA,EACX;AAEA,YAAU,MAAM;AACd,QAAI,GAAI,gBAAe,QAAQ,EAAE;AACjC,WAAO,MAAM,eAAe,WAAW;AAAA,EACzC,GAAG,CAAC,IAAI,cAAc,CAAC;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-utilities",
|
|
3
|
-
"version": "3.55.
|
|
3
|
+
"version": "3.55.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Utilities",
|
|
6
6
|
"files": [
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
"use-force-update": "~1.0.11",
|
|
50
50
|
"use-measure": "~0.3.0",
|
|
51
51
|
"use-onclickoutside": "~0.4.1",
|
|
52
|
-
"@elliemae/ds-hooks-
|
|
53
|
-
"@elliemae/ds-hooks-on-blur-out": "3.55.
|
|
54
|
-
"@elliemae/ds-hooks-
|
|
55
|
-
"@elliemae/ds-
|
|
56
|
-
"@elliemae/ds-
|
|
52
|
+
"@elliemae/ds-hooks-is-mobile": "3.55.1",
|
|
53
|
+
"@elliemae/ds-hooks-on-blur-out": "3.55.1",
|
|
54
|
+
"@elliemae/ds-hooks-on-first-focus-in": "3.55.1",
|
|
55
|
+
"@elliemae/ds-props-helpers": "3.55.1",
|
|
56
|
+
"@elliemae/ds-hooks-focus-trap": "3.55.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
60
60
|
"jest": "~29.7.0",
|
|
61
61
|
"jest-cli": "~29.7.0",
|
|
62
62
|
"react-dom": "^18.3.1",
|
|
63
|
-
"@elliemae/ds-monorepo-devops": "3.55.
|
|
63
|
+
"@elliemae/ds-monorepo-devops": "3.55.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"lodash-es": "^4.17.21",
|