@tesouro/embedded-components-react 0.5.262 → 0.5.263

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,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.262", n = "f5c7c2f27ff9cfe5c90994abc317a3ae0b556203", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.263", n = "759b6fc6c60363f415ccba2e5bb33c107e8f9697", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -2,44 +2,66 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Toaster as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { useEffect as t, useState as n, useSyncExternalStore as r } from "react";
7
- import { jsx as i } from "react/jsx-runtime";
5
+ import { Toaster as e, usePortalContainer as t } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { OVERLAY_Z_INDEX as n, SCOPE_CLASS as r } from "./HostIsolationScope/isolationRoot.js";
7
+ import { useEffect as i, useLayoutEffect as a, useState as o, useSyncExternalStore as s } from "react";
8
+ import { createPortal as c } from "react-dom";
9
+ import { jsx as l } from "react/jsx-runtime";
8
10
  //#region ../../libs/tesouro-embedded-components-react/shared/ui/dist/lib/EmbeddedToaster.js
9
- var a = Symbol.for("tesouro.embedded-toaster.registry.v1");
10
- function o() {
11
- let e = globalThis, t = e[a];
11
+ var u = Symbol.for("tesouro.embedded-toaster.registry.v1");
12
+ function d() {
13
+ let e = globalThis, t = e[u];
12
14
  return t || (t = {
13
15
  nextId: 1,
14
16
  active: /* @__PURE__ */ new Set(),
15
17
  listeners: /* @__PURE__ */ new Set()
16
- }, e[a] = t), t;
18
+ }, e[u] = t), t;
17
19
  }
18
- function s(e) {
19
- let t = o();
20
+ function f(e) {
21
+ let t = d();
20
22
  return t.listeners.add(e), () => {
21
23
  t.listeners.delete(e);
22
24
  };
23
25
  }
24
- function c() {
25
- o().listeners.forEach((e) => e());
26
+ function p() {
27
+ d().listeners.forEach((e) => e());
26
28
  }
27
- function l() {
28
- let e = o();
29
+ function m() {
30
+ let e = d();
29
31
  if (e.active.size === 0) return 0;
30
32
  let t = Infinity;
31
33
  return e.active.forEach((e) => {
32
34
  e < t && (t = e);
33
35
  }), t;
34
36
  }
35
- function u(a = {}) {
36
- let [u] = n(() => o().nextId++);
37
- return t(() => {
38
- let e = o();
39
- return e.active.add(u), c(), () => {
40
- e.active.delete(u), c();
37
+ var h = `position: relative; z-index: calc(${n} + 1);`, g = "document" in globalThis ? a : i;
38
+ function _() {
39
+ if (!("document" in globalThis)) return null;
40
+ let e = globalThis.document.createElement("div");
41
+ return e.classList.add(r), e.setAttribute("style", h), e;
42
+ }
43
+ function v(e) {
44
+ let [t] = o(_);
45
+ return g(() => {
46
+ if (!e || !t) return;
47
+ let n = globalThis.document?.body;
48
+ if (n) return n.appendChild(t), () => {
49
+ t.remove();
50
+ };
51
+ }, [e, t]), e ? t : null;
52
+ }
53
+ function y(n = {}) {
54
+ let [r] = o(() => d().nextId++), a = t();
55
+ i(() => {
56
+ let e = d();
57
+ return e.active.add(r), p(), () => {
58
+ e.active.delete(r), p();
41
59
  };
42
- }, [u]), r(s, l, l) === u ? /* @__PURE__ */ i(e, { ...a }) : null;
60
+ }, [r]);
61
+ let u = s(f, m, m) === r, h = v(u && a != null);
62
+ if (!u) return null;
63
+ let g = /* @__PURE__ */ l(e, { ...n });
64
+ return h ? c(g, h) : g;
43
65
  }
44
66
  //#endregion
45
- export { u as EmbeddedToaster };
67
+ export { y as EmbeddedToaster };
@@ -3,30 +3,31 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { PortalContainerProvider as e, usePortalContainer as t } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { useEffect as n, useLayoutEffect as r, useState as i } from "react";
7
- import { jsx as a } from "react/jsx-runtime";
6
+ import { OVERLAY_Z_INDEX as n, SCOPE_CLASS as r } from "./isolationRoot.js";
7
+ import { useEffect as i, useLayoutEffect as a, useState as o } from "react";
8
+ import { jsx as s } from "react/jsx-runtime";
8
9
  //#region ../../libs/tesouro-embedded-components-react/shared/ui/dist/lib/HostIsolationScope/HostIsolationScope.js
9
- var o = { display: "contents" }, s = "tesouro-embedded", c = "position: relative; z-index: var(--tesouro-embedded-overlay-z-index, 2147483000);", l = "document" in globalThis ? r : n;
10
- function u({ children: n }) {
11
- let r = t(), [u] = i(() => {
12
- if (r != null || !("document" in globalThis)) return null;
10
+ var c = { display: "contents" }, l = `position: relative; z-index: ${n};`, u = "document" in globalThis ? a : i;
11
+ function d({ children: n }) {
12
+ let i = t(), [a] = o(() => {
13
+ if (i != null || !("document" in globalThis)) return null;
13
14
  let e = globalThis.document.createElement("div");
14
- return e.classList.add(s), e.setAttribute("style", c), e;
15
+ return e.classList.add(r), e.setAttribute("style", l), e;
15
16
  });
16
- return l(() => {
17
- if (!u) return;
18
- let e = u, t = globalThis.document?.body;
17
+ return u(() => {
18
+ if (!a) return;
19
+ let e = a, t = globalThis.document?.body;
19
20
  if (t) return t.appendChild(e), () => {
20
21
  e.remove();
21
22
  };
22
- }, [u]), /* @__PURE__ */ a(e, {
23
- container: u ?? r,
24
- children: /* @__PURE__ */ a("div", {
25
- className: s,
26
- style: o,
23
+ }, [a]), /* @__PURE__ */ s(e, {
24
+ container: a ?? i,
25
+ children: /* @__PURE__ */ s("div", {
26
+ className: r,
27
+ style: c,
27
28
  children: n
28
29
  })
29
30
  });
30
31
  }
31
32
  //#endregion
32
- export { u as HostIsolationScope };
33
+ export { d as HostIsolationScope };
@@ -0,0 +1,4 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/shared/ui/dist/lib/HostIsolationScope/isolationRoot.js
2
+ var e = "tesouro-embedded", t = "var(--tesouro-embedded-overlay-z-index, 2147483000)";
3
+ //#endregion
4
+ export { t as OVERLAY_Z_INDEX, e as SCOPE_CLASS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.262",
3
+ "version": "0.5.263",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {