@companix/uikit 0.1.27 → 0.1.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.
Files changed (66) hide show
  1. package/dist/ImageBase/ImageBase.scss +50 -0
  2. package/dist/ImageBase/index.d.ts +8 -0
  3. package/dist/bundle.es.js +63 -61
  4. package/dist/bundle.es10.js +1 -1
  5. package/dist/bundle.es13.js +4 -4
  6. package/dist/bundle.es14.js +3 -3
  7. package/dist/bundle.es15.js +2 -2
  8. package/dist/bundle.es17.js +1 -1
  9. package/dist/bundle.es23.js +5 -5
  10. package/dist/bundle.es25.js +1 -1
  11. package/dist/bundle.es26.js +1 -1
  12. package/dist/bundle.es27.js +1 -1
  13. package/dist/bundle.es28.js +1 -1
  14. package/dist/bundle.es29.js +1 -1
  15. package/dist/bundle.es30.js +1 -1
  16. package/dist/bundle.es31.js +4 -4
  17. package/dist/bundle.es32.js +2 -2
  18. package/dist/bundle.es35.js +2 -2
  19. package/dist/bundle.es41.js +1 -1
  20. package/dist/bundle.es42.js +2 -2
  21. package/dist/bundle.es45.js +45 -33
  22. package/dist/bundle.es46.js +33 -20
  23. package/dist/bundle.es47.js +19 -47
  24. package/dist/bundle.es48.js +49 -11
  25. package/dist/bundle.es49.js +11 -13
  26. package/dist/bundle.es50.js +13 -13
  27. package/dist/bundle.es51.js +13 -30
  28. package/dist/bundle.es52.js +30 -11
  29. package/dist/bundle.es53.js +10 -25
  30. package/dist/bundle.es54.js +17 -29
  31. package/dist/bundle.es55.js +36 -48
  32. package/dist/bundle.es56.js +49 -55
  33. package/dist/bundle.es57.js +56 -8
  34. package/dist/bundle.es58.js +8 -26
  35. package/dist/bundle.es59.js +27 -5
  36. package/dist/bundle.es60.js +5 -66
  37. package/dist/bundle.es61.js +66 -23
  38. package/dist/bundle.es62.js +22 -23
  39. package/dist/bundle.es63.js +24 -90
  40. package/dist/bundle.es64.js +90 -18
  41. package/dist/bundle.es65.js +17 -93
  42. package/dist/bundle.es66.js +93 -73
  43. package/dist/bundle.es67.js +73 -23
  44. package/dist/bundle.es68.js +20 -35
  45. package/dist/bundle.es69.js +39 -24
  46. package/dist/bundle.es70.js +24 -79
  47. package/dist/bundle.es71.js +71 -85
  48. package/dist/bundle.es72.js +93 -10
  49. package/dist/bundle.es73.js +10 -6
  50. package/dist/bundle.es74.js +5 -69
  51. package/dist/bundle.es75.js +68 -10
  52. package/dist/bundle.es76.js +11 -42
  53. package/dist/bundle.es77.js +42 -32
  54. package/dist/bundle.es78.js +31 -64
  55. package/dist/bundle.es79.js +65 -40
  56. package/dist/bundle.es80.js +40 -14
  57. package/dist/bundle.es81.js +15 -32
  58. package/dist/bundle.es82.js +23 -61
  59. package/dist/bundle.es83.js +69 -13
  60. package/dist/bundle.es84.js +13 -74
  61. package/dist/bundle.es85.js +71 -45
  62. package/dist/bundle.es86.js +48 -13
  63. package/dist/bundle.es87.js +16 -0
  64. package/dist/index.d.ts +2 -0
  65. package/dist/index.scss +1 -0
  66. package/package.json +1 -1
@@ -1,52 +1,24 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { EventEmmiter as g } from "@companix/utils-js";
3
- import { useContext as S, createContext as l, useState as f, useEffect as n, useRef as w } from "react";
4
- const a = l({});
5
- class d {
6
- constructor(e) {
7
- this.emmiter = e;
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { memo as n } from "react";
3
+ const i = n(({ storageKey: t, defaultColorScheme: o }) => /* @__PURE__ */ l(
4
+ "script",
5
+ {
6
+ suppressHydrationWarning: !0,
7
+ dangerouslySetInnerHTML: {
8
+ __html: `(${a.toString()})("${t}", "${o}")`
9
+ }
8
10
  }
9
- getStorageValue(e, t) {
10
- if (typeof window > "u")
11
- return t;
12
- const r = localStorage.getItem(e);
13
- return r ? JSON.parse(r) : t;
11
+ )), a = (t, o) => {
12
+ const [r, c] = ["theme-light", "theme-dark"];
13
+ try {
14
+ let e = localStorage.getItem(t) || o;
15
+ e === "system" && (e = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
16
+ const s = e === "dark" ? c : r;
17
+ document.documentElement.classList.remove(r, c), document.documentElement.classList.add(s), document.documentElement.style.colorScheme = e;
18
+ } catch {
14
19
  }
15
- setValue(e, t) {
16
- localStorage.setItem(e, JSON.stringify(t)), this.emmiter.emit(e, t);
17
- }
18
- }
19
- const x = (o, e) => {
20
- const t = S(a), [r, i] = f(() => t.getStorageValue(o, e));
21
- n(() => {
22
- i(t.getStorageValue(o, e));
23
- }, [o]);
24
- const c = (s) => {
25
- t.setValue(o, s);
26
- };
27
- return n(() => {
28
- const s = t.emmiter.subscribe(o, (u) => {
29
- i(u);
30
- });
31
- return () => {
32
- s();
33
- };
34
- }, [o]), [r, c];
35
- }, y = ({ children: o }) => {
36
- const e = w(new d(new g()));
37
- return n(() => {
38
- if (!window || !e.current)
39
- return;
40
- const t = (r) => {
41
- r.key && e.current.emmiter.store[r.key] && r.newValue && e.current.emmiter.emit(r.key, JSON.parse(r.newValue));
42
- };
43
- return window.addEventListener("storage", t), () => {
44
- window.removeEventListener("storage", t);
45
- };
46
- }, []), /* @__PURE__ */ m(a.Provider, { value: e.current, children: o });
47
20
  };
48
21
  export {
49
- y as LocalStorageProvider,
50
- d as LocalStorageService,
51
- x as useLocalStorage
22
+ i as ColorSchemeScript,
23
+ a as colorSchemeScript
52
24
  };
@@ -1,14 +1,52 @@
1
- import { useState as r, useCallback as t } from "react";
2
- const f = (s = !1) => {
3
- const [o, e] = r(s), a = t(() => {
4
- e(!0);
5
- }, []), l = t(() => {
6
- e(!1);
7
- }, []), u = t(() => {
8
- e((n) => !n);
9
- }, []);
10
- return [o, a, l, u];
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { EventEmmiter as g } from "@companix/utils-js";
3
+ import { useContext as S, createContext as l, useState as f, useEffect as n, useRef as w } from "react";
4
+ const a = l({});
5
+ class d {
6
+ constructor(e) {
7
+ this.emmiter = e;
8
+ }
9
+ getStorageValue(e, t) {
10
+ if (typeof window > "u")
11
+ return t;
12
+ const r = localStorage.getItem(e);
13
+ return r ? JSON.parse(r) : t;
14
+ }
15
+ setValue(e, t) {
16
+ localStorage.setItem(e, JSON.stringify(t)), this.emmiter.emit(e, t);
17
+ }
18
+ }
19
+ const x = (o, e) => {
20
+ const t = S(a), [r, i] = f(() => t.getStorageValue(o, e));
21
+ n(() => {
22
+ i(t.getStorageValue(o, e));
23
+ }, [o]);
24
+ const c = (s) => {
25
+ t.setValue(o, s);
26
+ };
27
+ return n(() => {
28
+ const s = t.emmiter.subscribe(o, (u) => {
29
+ i(u);
30
+ });
31
+ return () => {
32
+ s();
33
+ };
34
+ }, [o]), [r, c];
35
+ }, y = ({ children: o }) => {
36
+ const e = w(new d(new g()));
37
+ return n(() => {
38
+ if (!window || !e.current)
39
+ return;
40
+ const t = (r) => {
41
+ r.key && e.current.emmiter.store[r.key] && r.newValue && e.current.emmiter.emit(r.key, JSON.parse(r.newValue));
42
+ };
43
+ return window.addEventListener("storage", t), () => {
44
+ window.removeEventListener("storage", t);
45
+ };
46
+ }, []), /* @__PURE__ */ m(a.Provider, { value: e.current, children: o });
11
47
  };
12
48
  export {
13
- f as useBooleanState
49
+ y as LocalStorageProvider,
50
+ d as LocalStorageService,
51
+ x as useLocalStorage
14
52
  };
@@ -1,16 +1,14 @@
1
- import { useRef as i, useCallback as o } from "react";
2
- const f = (e, s) => {
3
- const r = i(null), c = i(void 0), n = o(
4
- (t) => {
5
- s && t.offsetParent && (t.style.height = "", t.style.height = `${t.scrollHeight}px`, t.scrollHeight !== c.current && e && (e(t), c.current = t.scrollHeight));
6
- },
7
- [s, e]
8
- ), l = o(() => {
9
- const t = r.current;
10
- t && n(t);
11
- }, [r, n]);
12
- return [r, l];
1
+ import { useState as r, useCallback as t } from "react";
2
+ const f = (s = !1) => {
3
+ const [o, e] = r(s), a = t(() => {
4
+ e(!0);
5
+ }, []), l = t(() => {
6
+ e(!1);
7
+ }, []), u = t(() => {
8
+ e((n) => !n);
9
+ }, []);
10
+ return [o, a, l, u];
13
11
  };
14
12
  export {
15
- f as useResizeTextarea
13
+ f as useBooleanState
16
14
  };
@@ -1,16 +1,16 @@
1
- import { useState as e } from "react";
2
- const d = ({ onClick: t }) => {
3
- const [a, s] = e({ isLoading: !1, isError: !1 });
4
- return { ...a, handleClick: (r) => {
5
- a.isLoading || t(() => {
6
- s({ isLoading: !0, isError: !1 });
7
- }, r).then(() => {
8
- s({ isLoading: !1, isError: !1 });
9
- }).catch(() => {
10
- s({ isLoading: !1, isError: !0 });
11
- });
12
- } };
1
+ import { useRef as i, useCallback as o } from "react";
2
+ const f = (e, s) => {
3
+ const r = i(null), c = i(void 0), n = o(
4
+ (t) => {
5
+ s && t.offsetParent && (t.style.height = "", t.style.height = `${t.scrollHeight}px`, t.scrollHeight !== c.current && e && (e(t), c.current = t.scrollHeight));
6
+ },
7
+ [s, e]
8
+ ), l = o(() => {
9
+ const t = r.current;
10
+ t && n(t);
11
+ }, [r, n]);
12
+ return [r, l];
13
13
  };
14
14
  export {
15
- d as useLoading
15
+ f as useResizeTextarea
16
16
  };
@@ -1,33 +1,16 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { useState as w, useEffect as i, useRef as d, useCallback as f, createContext as C, useContext as b } from "react";
3
- const k = 6e4, a = C(null), g = ({ children: t }) => {
4
- const r = d(/* @__PURE__ */ new Map()), s = f(
5
- (e, c) => {
6
- let n = r.current.get(e);
7
- return n || (n = {
8
- intervalId: window.setInterval(() => {
9
- const o = Date.now();
10
- n?.callbacks.forEach((l) => l(o));
11
- }, e),
12
- callbacks: /* @__PURE__ */ new Set()
13
- }, r.current.set(e, n)), n.callbacks.add(c), () => {
14
- const o = r.current.get(e);
15
- o && (o.callbacks.delete(c), o.callbacks.size === 0 && (window.clearInterval(o.intervalId), r.current.delete(e)));
16
- };
17
- },
18
- []
19
- );
20
- return /* @__PURE__ */ u(a.Provider, { value: s, children: t });
21
- }, x = () => {
22
- const t = b(a);
23
- if (t === null)
24
- throw new Error("NowContextProvider is not provided");
25
- return t;
26
- }, p = (t = k) => {
27
- const [r, s] = w(() => Date.now()), e = x();
28
- return i(() => e(t, s), [t, e]), r;
1
+ import { useState as e } from "react";
2
+ const d = ({ onClick: t }) => {
3
+ const [a, s] = e({ isLoading: !1, isError: !1 });
4
+ return { ...a, handleClick: (r) => {
5
+ a.isLoading || t(() => {
6
+ s({ isLoading: !0, isError: !1 });
7
+ }, r).then(() => {
8
+ s({ isLoading: !1, isError: !1 });
9
+ }).catch(() => {
10
+ s({ isLoading: !1, isError: !0 });
11
+ });
12
+ } };
29
13
  };
30
14
  export {
31
- g as NowContextProvider,
32
- p as useNow
15
+ d as useLoading
33
16
  };
@@ -1,14 +1,33 @@
1
- import { useRef as o } from "react";
2
- import { useRerender as u } from "./bundle.es73.js";
3
- const m = (e) => {
4
- const t = u(), r = o(e);
5
- return [
6
- r.current,
7
- (n) => {
8
- r.current = n, t();
9
- }
10
- ];
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useState as w, useEffect as i, useRef as d, useCallback as f, createContext as C, useContext as b } from "react";
3
+ const k = 6e4, a = C(null), g = ({ children: t }) => {
4
+ const r = d(/* @__PURE__ */ new Map()), s = f(
5
+ (e, c) => {
6
+ let n = r.current.get(e);
7
+ return n || (n = {
8
+ intervalId: window.setInterval(() => {
9
+ const o = Date.now();
10
+ n?.callbacks.forEach((l) => l(o));
11
+ }, e),
12
+ callbacks: /* @__PURE__ */ new Set()
13
+ }, r.current.set(e, n)), n.callbacks.add(c), () => {
14
+ const o = r.current.get(e);
15
+ o && (o.callbacks.delete(c), o.callbacks.size === 0 && (window.clearInterval(o.intervalId), r.current.delete(e)));
16
+ };
17
+ },
18
+ []
19
+ );
20
+ return /* @__PURE__ */ u(a.Provider, { value: s, children: t });
21
+ }, x = () => {
22
+ const t = b(a);
23
+ if (t === null)
24
+ throw new Error("NowContextProvider is not provided");
25
+ return t;
26
+ }, p = (t = k) => {
27
+ const [r, s] = w(() => Date.now()), e = x();
28
+ return i(() => e(t, s), [t, e]), r;
11
29
  };
12
30
  export {
13
- m as useSyncSubmit
31
+ g as NowContextProvider,
32
+ p as useNow
14
33
  };
@@ -1,29 +1,14 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { hash as m } from "@companix/utils-js";
3
- import { useRef as n, useMemo as s } from "react";
4
- import { Viewport as p } from "./bundle.es81.js";
5
- const a = (t = {}) => {
6
- const e = {
7
- emit: (r) => {
8
- console.error("uninitialized", r);
1
+ import { useRef as o } from "react";
2
+ import { useRerender as u } from "./bundle.es74.js";
3
+ const m = (e) => {
4
+ const t = u(), r = o(e);
5
+ return [
6
+ r.current,
7
+ (n) => {
8
+ r.current = n, t();
9
9
  }
10
- };
11
- return {
12
- api: {
13
- show: (r) => {
14
- e.emit({ ...r, id: m() });
15
- }
16
- },
17
- Viewport: () => {
18
- const r = n(null);
19
- return s(() => {
20
- e.emit = (o) => {
21
- r.current && r.current.showAlert(o);
22
- };
23
- }, []), /* @__PURE__ */ i(p, { ref: r, ...t });
24
- }
25
- };
10
+ ];
26
11
  };
27
12
  export {
28
- a as createAlertAgent
13
+ m as useSyncSubmit
29
14
  };
@@ -1,41 +1,29 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { hash as r } from "@companix/utils-js";
3
- import { Viewport as a } from "./bundle.es82.js";
4
- import { useRef as c, useMemo as h } from "react";
5
- const m = (i = {}) => {
6
- const o = {
7
- showToast: (e) => {
8
- console.error("uninitialized", e);
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { hash as m } from "@companix/utils-js";
3
+ import { useRef as n, useMemo as s } from "react";
4
+ import { Viewport as p } from "./bundle.es82.js";
5
+ const a = (t = {}) => {
6
+ const e = {
7
+ emit: (r) => {
8
+ console.error("uninitialized", r);
9
9
  }
10
10
  };
11
11
  return {
12
12
  api: {
13
- show: (e) => {
14
- const n = e.id ?? r();
15
- return o.showToast({ ...e, id: n }), n;
13
+ show: (r) => {
14
+ e.emit({ ...r, id: m() });
16
15
  }
17
16
  },
18
- Viewport: (e = {}) => {
19
- const n = c(null);
20
- return h(() => {
21
- o.showToast = (s) => {
22
- n.current && n.current.showToast(s);
17
+ Viewport: () => {
18
+ const r = n(null);
19
+ return s(() => {
20
+ e.emit = (o) => {
21
+ r.current && r.current.showAlert(o);
23
22
  };
24
- }, []), /* @__PURE__ */ t(
25
- a,
26
- {
27
- ref: n,
28
- align: e.align ?? i.align,
29
- closeIcon: e.closeIcon ?? i.closeIcon,
30
- duration: e.duration ?? i.duration,
31
- gap: e.gap ?? i.gap,
32
- side: e.side ?? i.side,
33
- swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
34
- }
35
- );
23
+ }, []), /* @__PURE__ */ i(p, { ref: r, ...t });
36
24
  }
37
25
  };
38
26
  };
39
27
  export {
40
- m as createToaster
28
+ a as createAlertAgent
41
29
  };
@@ -1,53 +1,41 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import * as t from "@radix-ui/react-toast";
3
- import { attr as T } from "@companix/utils-browser";
4
- import { useState as d, useRef as b, useEffect as j, useLayoutEffect as E } from "react";
5
- import { RemoveListener as I } from "./bundle.es59.js";
6
- const m = (o) => {
7
- const [r, u] = d(!0), [p, f] = d(!1), s = b(null), {
8
- appearance: C = "neutral",
9
- icon: a,
10
- title: n,
11
- description: c,
12
- duration: L,
13
- closeIcon: h,
14
- onClosing: v,
15
- onClosed: N,
16
- closable: x = !0,
17
- onInitialized: g
18
- } = o;
19
- j(() => {
20
- f(!0);
21
- }, []), E(() => {
22
- s.current && g(s.current);
23
- }, []);
24
- const R = (i) => {
25
- i || v(), u(i);
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { hash as r } from "@companix/utils-js";
3
+ import { Viewport as a } from "./bundle.es83.js";
4
+ import { useRef as c, useMemo as h } from "react";
5
+ const m = (i = {}) => {
6
+ const o = {
7
+ showToast: (e) => {
8
+ console.error("uninitialized", e);
9
+ }
26
10
  };
27
- return /* @__PURE__ */ l(
28
- t.Root,
29
- {
30
- ref: s,
31
- "data-expanded": !0,
32
- "data-appearance": C,
33
- "data-mounted": T(p),
34
- className: "toaster",
35
- open: r,
36
- onOpenChange: R,
37
- duration: L,
38
- children: [
39
- /* @__PURE__ */ e(I, { callback: N }),
40
- a && /* @__PURE__ */ e("div", { className: "toaster-icon", children: a }),
41
- /* @__PURE__ */ l("div", { className: "toaster-content", children: [
42
- n && /* @__PURE__ */ e(t.Title, { className: "toaster-title", children: n }),
43
- c && /* @__PURE__ */ e(t.Description, { className: "toaster-description", children: c })
44
- ] }),
45
- x && /* @__PURE__ */ e(m.Close, { className: "toaster-close toaster-close-placement", closeIcon: h })
46
- ]
11
+ return {
12
+ api: {
13
+ show: (e) => {
14
+ const n = e.id ?? r();
15
+ return o.showToast({ ...e, id: n }), n;
16
+ }
17
+ },
18
+ Viewport: (e = {}) => {
19
+ const n = c(null);
20
+ return h(() => {
21
+ o.showToast = (s) => {
22
+ n.current && n.current.showToast(s);
23
+ };
24
+ }, []), /* @__PURE__ */ t(
25
+ a,
26
+ {
27
+ ref: n,
28
+ align: e.align ?? i.align,
29
+ closeIcon: e.closeIcon ?? i.closeIcon,
30
+ duration: e.duration ?? i.duration,
31
+ gap: e.gap ?? i.gap,
32
+ side: e.side ?? i.side,
33
+ swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
34
+ }
35
+ );
47
36
  }
48
- );
37
+ };
49
38
  };
50
- m.Close = ({ closeIcon: o, className: r } = {}) => /* @__PURE__ */ e(t.Close, { className: r, children: o ?? /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.96967 2.96967C3.26256 2.67678 3.73744 2.67678 4.03033 2.96967L8 6.939L11.9697 2.96967C12.2626 2.67678 12.7374 2.67678 13.0303 2.96967C13.3232 3.26256 13.3232 3.73744 13.0303 4.03033L9.061 8L13.0303 11.9697C13.2966 12.2359 13.3208 12.6526 13.1029 12.9462L13.0303 13.0303C12.7374 13.3232 12.2626 13.3232 11.9697 13.0303L8 9.061L4.03033 13.0303C3.73744 13.3232 3.26256 13.3232 2.96967 13.0303C2.67678 12.7374 2.67678 12.2626 2.96967 11.9697L6.939 8L2.96967 4.03033C2.7034 3.76406 2.6792 3.3474 2.89705 3.05379L2.96967 2.96967Z" }) }) });
51
39
  export {
52
- m as Toast
40
+ m as createToaster
53
41
  };
@@ -1,59 +1,53 @@
1
- import { jsx as r, Fragment as h } from "react/jsx-runtime";
2
- import { useContext as C, createContext as x, useState as w, useEffect as D, useCallback as u, memo as P } from "react";
3
- import { hash as S } from "@companix/utils-js";
4
- import { Dialog as g } from "./bundle.es24.js";
5
- import { Drawer as v } from "./bundle.es22.js";
6
- import { MobileDrawer as b } from "./bundle.es23.js";
7
- const R = (o) => {
8
- const t = {}, e = {}, l = [], c = S();
9
- for (const n in o)
10
- t[n] = () => {
11
- }, e[n] = () => {
12
- }, l.push(() => /* @__PURE__ */ r(O, { Open: t, Close: e, name: n, Content: o[n] }));
13
- return {
14
- Open: t,
15
- Close: e,
16
- Overlay: () => /* @__PURE__ */ r(h, { children: l.map((n, s) => /* @__PURE__ */ r(n, {}, `popup-${c}-${s}`)) })
17
- };
18
- }, O = ({ name: o, Open: t, Close: e, Content: l }) => {
19
- const [{ data: c, open: n }, s] = w({
20
- data: null,
21
- open: !1
22
- });
23
- D(() => {
24
- t[o] = (a) => {
25
- s({ data: a, open: !0 });
26
- }, e[o] = () => {
27
- n && p();
28
- };
29
- }, []);
30
- const p = u(() => {
31
- s(({ data: a }) => ({ data: a, open: !1 }));
32
- }, []), m = u(() => {
33
- s({ data: null, open: !1 });
34
- }, []), d = u((a) => {
35
- a || p();
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import * as t from "@radix-ui/react-toast";
3
+ import { attr as T } from "@companix/utils-browser";
4
+ import { useState as d, useRef as b, useEffect as j, useLayoutEffect as E } from "react";
5
+ import { RemoveListener as I } from "./bundle.es60.js";
6
+ const m = (o) => {
7
+ const [r, u] = d(!0), [p, f] = d(!1), s = b(null), {
8
+ appearance: C = "neutral",
9
+ icon: a,
10
+ title: n,
11
+ description: c,
12
+ duration: L,
13
+ closeIcon: h,
14
+ onClosing: v,
15
+ onClosed: N,
16
+ closable: x = !0,
17
+ onInitialized: g
18
+ } = o;
19
+ j(() => {
20
+ f(!0);
21
+ }, []), E(() => {
22
+ s.current && g(s.current);
36
23
  }, []);
37
- return c ? /* @__PURE__ */ r(f.Provider, { value: { open: n, onOpenChange: d, onClosed: m }, children: /* @__PURE__ */ r(y, { data: c, close: p, Content: l }) }) : null;
38
- }, y = P(({ data: o, close: t, Content: e }) => /* @__PURE__ */ r(e, { data: o, close: t })), f = x(null), i = () => {
39
- const o = C(f);
40
- if (!o)
41
- throw new Error("Popup context not provided");
42
- return o;
43
- }, W = ({ children: o, ...t }) => {
44
- const e = i();
45
- return /* @__PURE__ */ r(g, { ...e, ...t, children: o });
46
- }, q = ({ children: o, ...t }) => {
47
- const e = i();
48
- return /* @__PURE__ */ r(v, { ...e, ...t, children: o });
49
- }, z = ({ children: o, ...t }) => {
50
- const e = i();
51
- return /* @__PURE__ */ r(b, { ...e, ...t, children: o });
24
+ const R = (i) => {
25
+ i || v(), u(i);
26
+ };
27
+ return /* @__PURE__ */ l(
28
+ t.Root,
29
+ {
30
+ ref: s,
31
+ "data-expanded": !0,
32
+ "data-appearance": C,
33
+ "data-mounted": T(p),
34
+ className: "toaster",
35
+ open: r,
36
+ onOpenChange: R,
37
+ duration: L,
38
+ children: [
39
+ /* @__PURE__ */ e(I, { callback: N }),
40
+ a && /* @__PURE__ */ e("div", { className: "toaster-icon", children: a }),
41
+ /* @__PURE__ */ l("div", { className: "toaster-content", children: [
42
+ n && /* @__PURE__ */ e(t.Title, { className: "toaster-title", children: n }),
43
+ c && /* @__PURE__ */ e(t.Description, { className: "toaster-description", children: c })
44
+ ] }),
45
+ x && /* @__PURE__ */ e(m.Close, { className: "toaster-close toaster-close-placement", closeIcon: h })
46
+ ]
47
+ }
48
+ );
52
49
  };
50
+ m.Close = ({ closeIcon: o, className: r } = {}) => /* @__PURE__ */ e(t.Close, { className: r, children: o ?? /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.96967 2.96967C3.26256 2.67678 3.73744 2.67678 4.03033 2.96967L8 6.939L11.9697 2.96967C12.2626 2.67678 12.7374 2.67678 13.0303 2.96967C13.3232 3.26256 13.3232 3.73744 13.0303 4.03033L9.061 8L13.0303 11.9697C13.2966 12.2359 13.3208 12.6526 13.1029 12.9462L13.0303 13.0303C12.7374 13.3232 12.2626 13.3232 11.9697 13.0303L8 9.061L4.03033 13.0303C3.73744 13.3232 3.26256 13.3232 2.96967 13.0303C2.67678 12.7374 2.67678 12.2626 2.96967 11.9697L6.939 8L2.96967 4.03033C2.7034 3.76406 2.6792 3.3474 2.89705 3.05379L2.96967 2.96967Z" }) }) });
53
51
  export {
54
- W as DialogShell,
55
- q as DrawerShell,
56
- z as MobileDrawerShell,
57
- R as createPopupRegistry,
58
- i as usePopup
52
+ m as Toast
59
53
  };