@tesouro/embedded-components-react 0.5.27 → 0.5.28

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.
@@ -1,22 +1,14 @@
1
1
  import { useEffect as e, useState as t } from "react";
2
2
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index506.js
3
3
  var n = {
4
- mm: {
5
- width: 210,
6
- height: 297
7
- },
8
- cm: {
9
- width: 21,
10
- height: 29.7
11
- },
12
- inches: {
13
- width: 8.27,
14
- height: 11.69
15
- }
16
- }, r = () => {
17
- let [r, i] = t({
18
- width: 794,
19
- height: 1123,
4
+ width: 8.5,
5
+ height: 11
6
+ }, r = {
7
+ width: 816,
8
+ height: 1056
9
+ }, i = () => {
10
+ let [i, a] = t({
11
+ ...r,
20
12
  dpi: 96
21
13
  });
22
14
  return e(() => {
@@ -36,12 +28,12 @@ var n = {
36
28
  t = n;
37
29
  break;
38
30
  }
39
- let r = window.devicePixelRatio || 1, a = t * r, o = document.createElement("div");
31
+ let r = window.devicePixelRatio || 1, i = t * r, o = document.createElement("div");
40
32
  o.style.width = "1in", o.style.height = "1in", o.style.position = "absolute", o.style.left = "-9999px", document.body.appendChild(o);
41
33
  let s = o.getBoundingClientRect(), c = Math.round(s.width);
42
34
  document.body.removeChild(o);
43
- let l = c > 0 ? c : a, u = Math.round(n.inches.width * l), d = Math.round(n.inches.height * l);
44
- i({
35
+ let l = c > 0 ? c : i, u = Math.round(n.width * l), d = Math.round(n.height * l);
36
+ a({
45
37
  width: u,
46
38
  height: d,
47
39
  dpi: l
@@ -50,7 +42,7 @@ var n = {
50
42
  return e(), window.addEventListener("resize", e), () => {
51
43
  window.removeEventListener("resize", e);
52
44
  };
53
- }, []), r;
45
+ }, []), i;
54
46
  };
55
47
  //#endregion
56
- export { r as useA4Dimensions };
48
+ export { r as LETTER_PX, i as useLetterDimensions };
@@ -2,47 +2,47 @@ import { useIsMounted as e } from "./index28.js";
2
2
  import "./index216.js";
3
3
  import { useResizeObserver as t } from "./index504.js";
4
4
  import { useWindowResize as n } from "./index505.js";
5
- import { useA4Dimensions as r } from "./index506.js";
6
- import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
5
+ import { LETTER_PX as r, useLetterDimensions as i } from "./index506.js";
6
+ import { useCallback as a, useEffect as o, useRef as s, useState as c } from "react";
7
7
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index507.js
8
- var c = (c, l, u = {}) => {
9
- let { minWidth: d, minHeight: f, containerPadding: p = 96, minScale: m = 1, initialDelay: h = 100, useAdaptiveDimensions: g = !0 } = u, [_, v] = s(1), y = o(!1), b = e(), x = r(), S = d ?? (g ? x.width : 794), C = f ?? (g ? x.height : 1123), w = i(() => {
10
- if (!c.current || !l.current || typeof window > "u" || !b.current) return;
11
- let e = c.current, t = e.clientWidth - p, n = e.clientHeight - p;
12
- if (t <= 0 || n <= 0 || S <= 0 || C <= 0) {
13
- v(m);
8
+ var l = (l, u, d = {}) => {
9
+ let { minWidth: f, minHeight: p, containerPadding: m = 96, minScale: h = 1, initialDelay: g = 100, useAdaptiveDimensions: _ = !0 } = d, [v, y] = c(1), b = s(!1), x = e(), S = i(), C = f ?? (_ ? S.width : r.width), w = p ?? (_ ? S.height : r.height), T = a(() => {
10
+ if (!l.current || !u.current || typeof window > "u" || !x.current) return;
11
+ let e = l.current, t = e.clientWidth - m, n = e.clientHeight - m;
12
+ if (t <= 0 || n <= 0 || C <= 0 || w <= 0) {
13
+ y(h);
14
14
  return;
15
15
  }
16
- let r = t / S, i = n / C;
17
- v(Math.max(Math.min(r, i), m));
16
+ let r = t / C, i = n / w;
17
+ y(Math.max(Math.min(r, i), h));
18
18
  }, [
19
- c,
20
19
  l,
21
- b,
22
- p,
23
- S,
20
+ u,
21
+ x,
22
+ m,
24
23
  C,
25
- m
24
+ w,
25
+ h
26
26
  ]);
27
- n(w, 100);
28
- let { observe: T, disconnect: E } = t(w, 50);
29
- return a(() => {
27
+ n(T, 100);
28
+ let { observe: E, disconnect: D } = t(T, 50);
29
+ return o(() => {
30
30
  if (typeof window > "u") return;
31
31
  let e = setTimeout(() => {
32
- w(), y.current = !0;
33
- }, h);
34
- return c.current && T(c.current), () => {
35
- clearTimeout(e), E();
32
+ T(), b.current = !0;
33
+ }, g);
34
+ return l.current && E(l.current), () => {
35
+ clearTimeout(e), D();
36
36
  };
37
37
  }, [
38
- T,
39
38
  E,
40
- h,
41
- w,
42
- c
43
- ]), a(() => {
44
- c.current && y.current && T(c.current);
45
- }, [c, T]), _;
39
+ D,
40
+ g,
41
+ T,
42
+ l
43
+ ]), o(() => {
44
+ l.current && b.current && E(l.current);
45
+ }, [l, E]), v;
46
46
  };
47
47
  //#endregion
48
- export { c as useAdaptiveScale };
48
+ export { l as useAdaptiveScale };
@@ -29,8 +29,8 @@ var s = ({ address: s, counterpart: c, currency: l, invoiceData: u, entityData:
29
29
  alignItems: "safe center"
30
30
  },
31
31
  children: /* @__PURE__ */ o(i, {
32
- ratio: 21 / 29.7,
33
- className: e("ttw:max-w-[21cm]", "ttw:min-w-[794px] ttw:min-h-[1123px]", "ttw:transition-transform ttw:duration-200 ttw:ease-in-out", "motion-reduce:ttw:transition-none", "ttw:origin-center", "ttw:shrink-0", "ttw:[contain:\"layout style\"]"),
32
+ ratio: 8.5 / 11,
33
+ className: e("ttw:max-w-[8.5in]", "ttw:min-w-[816px] ttw:min-h-[1056px]", "ttw:transition-transform ttw:duration-200 ttw:ease-in-out", "motion-reduce:ttw:transition-none", "ttw:origin-center", "ttw:shrink-0", "ttw:[contain:\"layout style\"]"),
34
34
  style: { transform: `scale(${g})` },
35
35
  children: /* @__PURE__ */ o("div", {
36
36
  ref: m,