@elliemae/ds-hooks-fontsize-detector 3.18.0-next.9

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.
@@ -0,0 +1,98 @@
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 DSHooksFontsizeDetector_exports = {};
30
+ __export(DSHooksFontsizeDetector_exports, {
31
+ useFontSizeDetector: () => useFontSizeDetector
32
+ });
33
+ module.exports = __toCommonJS(DSHooksFontsizeDetector_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = __toESM(require("react"));
37
+ var import_ds_utilities = require("@elliemae/ds-utilities");
38
+ var import_constants = require("./constants/index.js");
39
+ const FontDetectorElement = import_react.default.memo(() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
40
+ "p",
41
+ {
42
+ "aria-hidden": "true",
43
+ id: import_constants.FONT_DETECTOR_UID,
44
+ "data-testid": import_constants.FONT_DETECTOR_UID,
45
+ style: {
46
+ margin: 0,
47
+ color: "transparent",
48
+ position: "absolute"
49
+ },
50
+ children: "\xA0"
51
+ }
52
+ ));
53
+ const useResizeObserver = (ref) => {
54
+ const [dimensions, setDimensions] = import_react.default.useState(0);
55
+ (0, import_react.useEffect)(() => {
56
+ const resizeObserver = new ResizeObserver((entries) => {
57
+ entries.forEach((entry) => {
58
+ setDimensions(Math.ceil(entry.contentRect.height));
59
+ });
60
+ });
61
+ if (ref) {
62
+ resizeObserver.observe(ref);
63
+ }
64
+ return () => {
65
+ if (ref) {
66
+ resizeObserver.unobserve(ref);
67
+ }
68
+ };
69
+ }, [ref]);
70
+ return dimensions;
71
+ };
72
+ const useFontSizeDetector = () => {
73
+ const [ref, setRef] = (0, import_react.useState)(null);
74
+ const fontHeight = useResizeObserver(ref);
75
+ (0, import_react.useEffect)(() => {
76
+ const retrieveElement = async () => {
77
+ const elementAppended = await (0, import_ds_utilities.appendComponentIfNotExist)({
78
+ Component: FontDetectorElement,
79
+ uidSelector: import_constants.FONT_DETECTOR_UID,
80
+ tagName: "font-size"
81
+ });
82
+ setRef(elementAppended);
83
+ };
84
+ retrieveElement().catch(() => {
85
+ });
86
+ }, []);
87
+ const parentWidth = document.documentElement.clientWidth;
88
+ const ratio = parentWidth / fontHeight;
89
+ return {
90
+ ratio,
91
+ fontRatio: fontHeight,
92
+ documentWidthRatio: parentWidth,
93
+ isSmall: ratio <= import_constants.BREAKPOINTS.small,
94
+ isMedium: ratio > import_constants.BREAKPOINTS.small && ratio <= import_constants.BREAKPOINTS.medimum,
95
+ isLarge: ratio > import_constants.BREAKPOINTS.medimum
96
+ };
97
+ };
98
+ //# sourceMappingURL=DSHooksFontsizeDetector.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSHooksFontsizeDetector.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { appendComponentIfNotExist } from '@elliemae/ds-utilities';\nimport { FONT_DETECTOR_UID, BREAKPOINTS } from './constants/index.js';\nimport { type DSHooksFontsizeDetectorT } from './react-desc-prop-types.js';\n\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\nconst FontDetectorElement = React.memo(() => (\n <p\n aria-hidden=\"true\"\n id={FONT_DETECTOR_UID}\n data-testid={FONT_DETECTOR_UID}\n style={{\n margin: 0,\n color: 'transparent',\n position: 'absolute',\n }}\n >\n &nbsp;\n </p>\n));\n\nconst useResizeObserver = (ref: HTMLElement | null): number => {\n const [dimensions, setDimensions] = React.useState<number>(0);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.height));\n });\n });\n if (ref) {\n resizeObserver.observe(ref);\n }\n\n return () => {\n if (ref) {\n resizeObserver.unobserve(ref);\n }\n };\n }, [ref]);\n return dimensions;\n};\n\nconst useFontSizeDetector = (): DSHooksFontsizeDetectorT.UseFontSizeDetectorT => {\n const [ref, setRef] = useState<HTMLElement | null>(null);\n const fontHeight = useResizeObserver(ref);\n\n useEffect(() => {\n const retrieveElement = async () => {\n const elementAppended = await appendComponentIfNotExist({\n Component: FontDetectorElement,\n uidSelector: FONT_DETECTOR_UID,\n tagName: 'font-size',\n });\n setRef(elementAppended);\n };\n retrieveElement().catch(() => {});\n }, []);\n\n const parentWidth = document.documentElement.clientWidth;\n\n const ratio = parentWidth / fontHeight;\n\n return {\n ratio,\n fontRatio: fontHeight,\n documentWidthRatio: parentWidth,\n isSmall: ratio <= BREAKPOINTS.small,\n isMedium: ratio > BREAKPOINTS.small && ratio <= BREAKPOINTS.medimum,\n isLarge: ratio > BREAKPOINTS.medimum,\n };\n};\n\nexport { useFontSizeDetector };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADQrB;AARF,mBAA2C;AAC3C,0BAA0C;AAC1C,uBAA+C;AAK/C,MAAM,sBAAsB,aAAAA,QAAM,KAAK,MACrC;AAAA,EAAC;AAAA;AAAA,IACC,eAAY;AAAA,IACZ,IAAI;AAAA,IACJ,eAAa;AAAA,IACb,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,IACD;AAAA;AAED,CACD;AAED,MAAM,oBAAoB,CAAC,QAAoC;AAC7D,QAAM,CAAC,YAAY,aAAa,IAAI,aAAAA,QAAM,SAAiB,CAAC;AAE5D,8BAAU,MAAM;AACd,UAAM,iBAAiB,IAAI,eAAe,CAAC,YAA8C;AACvF,cAAQ,QAAQ,CAAC,UAAU;AACzB,sBAAc,KAAK,KAAK,MAAM,YAAY,MAAM,CAAC;AAAA,MACnD,CAAC;AAAA,IACH,CAAC;AACD,QAAI,KAAK;AACP,qBAAe,QAAQ,GAAG;AAAA,IAC5B;AAEA,WAAO,MAAM;AACX,UAAI,KAAK;AACP,uBAAe,UAAU,GAAG;AAAA,MAC9B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AACR,SAAO;AACT;AAEA,MAAM,sBAAsB,MAAqD;AAC/E,QAAM,CAAC,KAAK,MAAM,QAAI,uBAA6B,IAAI;AACvD,QAAM,aAAa,kBAAkB,GAAG;AAExC,8BAAU,MAAM;AACd,UAAM,kBAAkB,YAAY;AAClC,YAAM,kBAAkB,UAAM,+CAA0B;AAAA,QACtD,WAAW;AAAA,QACX,aAAa;AAAA,QACb,SAAS;AAAA,MACX,CAAC;AACD,aAAO,eAAe;AAAA,IACxB;AACA,oBAAgB,EAAE,MAAM,MAAM;AAAA,IAAC,CAAC;AAAA,EAClC,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,SAAS,gBAAgB;AAE7C,QAAM,QAAQ,cAAc;AAE5B,SAAO;AAAA,IACL;AAAA,IACA,WAAW;AAAA,IACX,oBAAoB;AAAA,IACpB,SAAS,SAAS,6BAAY;AAAA,IAC9B,UAAU,QAAQ,6BAAY,SAAS,SAAS,6BAAY;AAAA,IAC5D,SAAS,QAAQ,6BAAY;AAAA,EAC/B;AACF;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,42 @@
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 constants_exports = {};
30
+ __export(constants_exports, {
31
+ BREAKPOINTS: () => BREAKPOINTS,
32
+ FONT_DETECTOR_UID: () => FONT_DETECTOR_UID
33
+ });
34
+ module.exports = __toCommonJS(constants_exports);
35
+ var React = __toESM(require("react"));
36
+ const FONT_DETECTOR_UID = "DS_FONT_DETECTOR";
37
+ const BREAKPOINTS = {
38
+ small: 25,
39
+ medimum: 40,
40
+ large: 60
41
+ };
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/constants/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export const FONT_DETECTOR_UID = 'DS_FONT_DETECTOR';\n\nexport const BREAKPOINTS = {\n small: 25,\n medimum: 40,\n large: 60,\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,oBAAoB;AAE1B,MAAM,cAAc;AAAA,EACzB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
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 src_exports = {};
30
+ __export(src_exports, {
31
+ FONT_DETECTOR_UID: () => import_constants.FONT_DETECTOR_UID,
32
+ useFontSizeDetector: () => import_DSHooksFontsizeDetector.useFontSizeDetector
33
+ });
34
+ module.exports = __toCommonJS(src_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_DSHooksFontsizeDetector = require("./DSHooksFontsizeDetector.js");
37
+ var import_constants = require("./constants/index.js");
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { useFontSizeDetector } from './DSHooksFontsizeDetector.js';\nexport { FONT_DETECTOR_UID } from './constants/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,qCAAoC;AACpC,uBAAkC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "commonjs",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -0,0 +1,28 @@
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var react_desc_prop_types_exports = {};
26
+ module.exports = __toCommonJS(react_desc_prop_types_exports);
27
+ var React = __toESM(require("react"));
28
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react-desc-prop-types.ts", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\n\nexport declare namespace DSHooksFontsizeDetectorT {\n export interface UseFontSizeDetectorT {\n ratio: number;\n fontRatio: number;\n documentWidthRatio: number;\n isSmall: boolean;\n isMedium: boolean;\n isLarge: boolean;\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,68 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import React2, { useState, useEffect } from "react";
4
+ import { appendComponentIfNotExist } from "@elliemae/ds-utilities";
5
+ import { FONT_DETECTOR_UID, BREAKPOINTS } from "./constants/index.js";
6
+ const FontDetectorElement = React2.memo(() => /* @__PURE__ */ jsx(
7
+ "p",
8
+ {
9
+ "aria-hidden": "true",
10
+ id: FONT_DETECTOR_UID,
11
+ "data-testid": FONT_DETECTOR_UID,
12
+ style: {
13
+ margin: 0,
14
+ color: "transparent",
15
+ position: "absolute"
16
+ },
17
+ children: "\xA0"
18
+ }
19
+ ));
20
+ const useResizeObserver = (ref) => {
21
+ const [dimensions, setDimensions] = React2.useState(0);
22
+ useEffect(() => {
23
+ const resizeObserver = new ResizeObserver((entries) => {
24
+ entries.forEach((entry) => {
25
+ setDimensions(Math.ceil(entry.contentRect.height));
26
+ });
27
+ });
28
+ if (ref) {
29
+ resizeObserver.observe(ref);
30
+ }
31
+ return () => {
32
+ if (ref) {
33
+ resizeObserver.unobserve(ref);
34
+ }
35
+ };
36
+ }, [ref]);
37
+ return dimensions;
38
+ };
39
+ const useFontSizeDetector = () => {
40
+ const [ref, setRef] = useState(null);
41
+ const fontHeight = useResizeObserver(ref);
42
+ useEffect(() => {
43
+ const retrieveElement = async () => {
44
+ const elementAppended = await appendComponentIfNotExist({
45
+ Component: FontDetectorElement,
46
+ uidSelector: FONT_DETECTOR_UID,
47
+ tagName: "font-size"
48
+ });
49
+ setRef(elementAppended);
50
+ };
51
+ retrieveElement().catch(() => {
52
+ });
53
+ }, []);
54
+ const parentWidth = document.documentElement.clientWidth;
55
+ const ratio = parentWidth / fontHeight;
56
+ return {
57
+ ratio,
58
+ fontRatio: fontHeight,
59
+ documentWidthRatio: parentWidth,
60
+ isSmall: ratio <= BREAKPOINTS.small,
61
+ isMedium: ratio > BREAKPOINTS.small && ratio <= BREAKPOINTS.medimum,
62
+ isLarge: ratio > BREAKPOINTS.medimum
63
+ };
64
+ };
65
+ export {
66
+ useFontSizeDetector
67
+ };
68
+ //# sourceMappingURL=DSHooksFontsizeDetector.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSHooksFontsizeDetector.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect } from 'react';\nimport { appendComponentIfNotExist } from '@elliemae/ds-utilities';\nimport { FONT_DETECTOR_UID, BREAKPOINTS } from './constants/index.js';\nimport { type DSHooksFontsizeDetectorT } from './react-desc-prop-types.js';\n\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\nconst FontDetectorElement = React.memo(() => (\n <p\n aria-hidden=\"true\"\n id={FONT_DETECTOR_UID}\n data-testid={FONT_DETECTOR_UID}\n style={{\n margin: 0,\n color: 'transparent',\n position: 'absolute',\n }}\n >\n &nbsp;\n </p>\n));\n\nconst useResizeObserver = (ref: HTMLElement | null): number => {\n const [dimensions, setDimensions] = React.useState<number>(0);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.height));\n });\n });\n if (ref) {\n resizeObserver.observe(ref);\n }\n\n return () => {\n if (ref) {\n resizeObserver.unobserve(ref);\n }\n };\n }, [ref]);\n return dimensions;\n};\n\nconst useFontSizeDetector = (): DSHooksFontsizeDetectorT.UseFontSizeDetectorT => {\n const [ref, setRef] = useState<HTMLElement | null>(null);\n const fontHeight = useResizeObserver(ref);\n\n useEffect(() => {\n const retrieveElement = async () => {\n const elementAppended = await appendComponentIfNotExist({\n Component: FontDetectorElement,\n uidSelector: FONT_DETECTOR_UID,\n tagName: 'font-size',\n });\n setRef(elementAppended);\n };\n retrieveElement().catch(() => {});\n }, []);\n\n const parentWidth = document.documentElement.clientWidth;\n\n const ratio = parentWidth / fontHeight;\n\n return {\n ratio,\n fontRatio: fontHeight,\n documentWidthRatio: parentWidth,\n isSmall: ratio <= BREAKPOINTS.small,\n isMedium: ratio > BREAKPOINTS.small && ratio <= BREAKPOINTS.medimum,\n isLarge: ratio > BREAKPOINTS.medimum,\n };\n};\n\nexport { useFontSizeDetector };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACQrB;AARF,OAAOA,UAAS,UAAU,iBAAiB;AAC3C,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB,mBAAmB;AAK/C,MAAM,sBAAsBA,OAAM,KAAK,MACrC;AAAA,EAAC;AAAA;AAAA,IACC,eAAY;AAAA,IACZ,IAAI;AAAA,IACJ,eAAa;AAAA,IACb,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,IACD;AAAA;AAED,CACD;AAED,MAAM,oBAAoB,CAAC,QAAoC;AAC7D,QAAM,CAAC,YAAY,aAAa,IAAIA,OAAM,SAAiB,CAAC;AAE5D,YAAU,MAAM;AACd,UAAM,iBAAiB,IAAI,eAAe,CAAC,YAA8C;AACvF,cAAQ,QAAQ,CAAC,UAAU;AACzB,sBAAc,KAAK,KAAK,MAAM,YAAY,MAAM,CAAC;AAAA,MACnD,CAAC;AAAA,IACH,CAAC;AACD,QAAI,KAAK;AACP,qBAAe,QAAQ,GAAG;AAAA,IAC5B;AAEA,WAAO,MAAM;AACX,UAAI,KAAK;AACP,uBAAe,UAAU,GAAG;AAAA,MAC9B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AACR,SAAO;AACT;AAEA,MAAM,sBAAsB,MAAqD;AAC/E,QAAM,CAAC,KAAK,MAAM,IAAI,SAA6B,IAAI;AACvD,QAAM,aAAa,kBAAkB,GAAG;AAExC,YAAU,MAAM;AACd,UAAM,kBAAkB,YAAY;AAClC,YAAM,kBAAkB,MAAM,0BAA0B;AAAA,QACtD,WAAW;AAAA,QACX,aAAa;AAAA,QACb,SAAS;AAAA,MACX,CAAC;AACD,aAAO,eAAe;AAAA,IACxB;AACA,oBAAgB,EAAE,MAAM,MAAM;AAAA,IAAC,CAAC;AAAA,EAClC,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,SAAS,gBAAgB;AAE7C,QAAM,QAAQ,cAAc;AAE5B,SAAO;AAAA,IACL;AAAA,IACA,WAAW;AAAA,IACX,oBAAoB;AAAA,IACpB,SAAS,SAAS,YAAY;AAAA,IAC9B,UAAU,QAAQ,YAAY,SAAS,SAAS,YAAY;AAAA,IAC5D,SAAS,QAAQ,YAAY;AAAA,EAC/B;AACF;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ const FONT_DETECTOR_UID = "DS_FONT_DETECTOR";
3
+ const BREAKPOINTS = {
4
+ small: 25,
5
+ medimum: 40,
6
+ large: 60
7
+ };
8
+ export {
9
+ BREAKPOINTS,
10
+ FONT_DETECTOR_UID
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const FONT_DETECTOR_UID = 'DS_FONT_DETECTOR';\n\nexport const BREAKPOINTS = {\n small: 25,\n medimum: 40,\n large: 60,\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,oBAAoB;AAE1B,MAAM,cAAc;AAAA,EACzB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { useFontSizeDetector } from "./DSHooksFontsizeDetector.js";
3
+ import { FONT_DETECTOR_UID } from "./constants/index.js";
4
+ export {
5
+ FONT_DETECTOR_UID,
6
+ useFontSizeDetector
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { useFontSizeDetector } from './DSHooksFontsizeDetector.js';\nexport { FONT_DETECTOR_UID } from './constants/index.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import { type DSHooksFontsizeDetectorT } from './react-desc-prop-types.js';
2
+ declare const useFontSizeDetector: () => DSHooksFontsizeDetectorT.UseFontSizeDetectorT;
3
+ export { useFontSizeDetector };
@@ -0,0 +1,6 @@
1
+ export declare const FONT_DETECTOR_UID = "DS_FONT_DETECTOR";
2
+ export declare const BREAKPOINTS: {
3
+ small: number;
4
+ medimum: number;
5
+ large: number;
6
+ };
@@ -0,0 +1,2 @@
1
+ export { useFontSizeDetector } from './DSHooksFontsizeDetector.js';
2
+ export { FONT_DETECTOR_UID } from './constants/index.js';
@@ -0,0 +1,10 @@
1
+ export declare namespace DSHooksFontsizeDetectorT {
2
+ interface UseFontSizeDetectorT {
3
+ ratio: number;
4
+ fontRatio: number;
5
+ documentWidthRatio: number;
6
+ isSmall: boolean;
7
+ isMedium: boolean;
8
+ isLarge: boolean;
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@elliemae/ds-hooks-fontsize-detector",
3
+ "version": "3.18.0-next.9",
4
+ "license": "MIT",
5
+ "description": "ICE MT - Dimsum - Hooks Fontsize Detector",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
16
+ }
17
+ },
18
+ "sideEffects": [
19
+ "*.css",
20
+ "*.scss"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://git.elliemae.io/platform-ui/dimsum.git"
25
+ },
26
+ "engines": {
27
+ "pnpm": ">=6",
28
+ "node": ">=16"
29
+ },
30
+ "author": "ICE MT",
31
+ "jestSonar": {
32
+ "sonar56x": true,
33
+ "reportPath": "reports",
34
+ "reportFile": "tests.xml",
35
+ "indent": 4
36
+ },
37
+ "dependencies": {
38
+ "@elliemae/ds-utilities": "3.18.0-next.9"
39
+ },
40
+ "devDependencies": {
41
+ "lodash": "^4.17.21",
42
+ "styled-components": "~5.3.6"
43
+ },
44
+ "peerDependencies": {
45
+ "@testing-library/jest-dom": "~5.16.4",
46
+ "@testing-library/react": "~12.1.3",
47
+ "@testing-library/user-event": "~13.5.0",
48
+ "lodash": "^4.17.21",
49
+ "react": "^17.0.2",
50
+ "react-dom": "^17.0.2",
51
+ "styled-components": "~5.3.6"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public",
55
+ "typeSafety": false
56
+ },
57
+ "scripts": {
58
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
59
+ "test": "node ../../scripts/testing/test.mjs",
60
+ "lint": "node ../../scripts/lint.mjs --fix",
61
+ "eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../.eslintrc.js' src/",
62
+ "dts": "node ../../scripts/dts.mjs",
63
+ "dts:withdeps": "pnpm --filter {.}... dts",
64
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
65
+ "dev:build": "pnpm --filter {.}... build",
66
+ "dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
67
+ "checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
68
+ }
69
+ }