boottent-design 0.1.13 → 0.1.15

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 (32) hide show
  1. package/dist/boottent-design.hooks.cjs.js +1 -1
  2. package/dist/boottent-design.hooks.es.js +1 -1
  3. package/dist/boottent-design.main.cjs.js +1 -1
  4. package/dist/boottent-design.main.es.js +5 -5
  5. package/dist/boottent-design.provider.cjs.js +1 -1
  6. package/dist/boottent-design.provider.es.js +1 -1
  7. package/dist/boottent-design.ui.cjs.js +1 -1
  8. package/dist/boottent-design.ui.es.js +2 -2
  9. package/dist/boottent-design.utils.cjs.js +1 -1
  10. package/dist/boottent-design.utils.es.js +1 -1
  11. package/dist/{index-C9dzv_CG.cjs → index-BWKZX0-5.cjs} +1 -1
  12. package/dist/{index-eA7KeYI8.js → index-DZTfWalm.js} +1 -1
  13. package/dist/portal-manager-9WO01tNb.cjs +1 -0
  14. package/dist/portal-manager-nNJ4SIa2.js +95 -0
  15. package/dist/portal-provider-Cb0Fq_yq.cjs +1 -0
  16. package/dist/portal-provider-CkucnuYS.js +110 -0
  17. package/dist/{tooltip-Beq86Qug.js → tooltip-BYAvA36l.js} +596 -592
  18. package/dist/{tooltip-DWrSWVcc.cjs → tooltip-BeNesDLB.cjs} +5 -5
  19. package/dist/types/hooks.d.ts +14 -13
  20. package/dist/types/main.d.ts +36 -19
  21. package/dist/types/types.d.ts +25 -11
  22. package/dist/types/ui.d.ts +12 -10
  23. package/dist/types/utils.d.ts +24 -14
  24. package/dist/use-portal-B-W1cxuO.js +32 -0
  25. package/dist/use-portal-D6lcMQX5.cjs +1 -0
  26. package/package.json +1 -1
  27. package/dist/portal-manager-6YGufJVr.cjs +0 -1
  28. package/dist/portal-manager-CttMAZAu.js +0 -73
  29. package/dist/portal-provider-Bwzhqa3P.js +0 -106
  30. package/dist/portal-provider-DXVWgfhq.cjs +0 -1
  31. package/dist/use-portal-Ck3GPJQN.cjs +0 -1
  32. package/dist/use-portal-TiMPd_EZ.js +0 -17
@@ -1,106 +0,0 @@
1
- import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { P as f, T as m, D as p, f as C, M as P } from "./tooltip-Beq86Qug.js";
3
- import { useState as h, useEffect as c } from "react";
4
- import { p as u } from "./portal-manager-CttMAZAu.js";
5
- import { toast as T } from "./boottent-design.utils.es.js";
6
- const j = () => {
7
- const [t, d] = h([]);
8
- c(() => {
9
- const s = u.subscribe(
10
- (e, o) => {
11
- d((i) => {
12
- if (o) {
13
- if (!i.find((r) => r.id === e.id))
14
- return [...i, { ...e, isOpen: o }];
15
- } else
16
- return i.map(
17
- (r) => r.id === e.id ? { ...r, isOpen: o } : r
18
- );
19
- return i;
20
- });
21
- }
22
- );
23
- return () => {
24
- s();
25
- };
26
- }, []);
27
- const n = (s) => {
28
- u.setPortalOpen(s, !1);
29
- };
30
- return c(() => {
31
- t.forEach((s) => {
32
- if (!s.isOpen) {
33
- const e = setTimeout(() => {
34
- d((o) => o.filter((i) => i.id !== s.id));
35
- }, 300);
36
- return () => clearTimeout(e);
37
- }
38
- });
39
- }, [t]), c(() => {
40
- const s = (e) => {
41
- const o = e.props;
42
- T({
43
- title: o.title,
44
- description: o.description,
45
- action: o.action,
46
- closeButton: o.closeButton,
47
- variant: o.variant,
48
- position: o.position,
49
- size: o.size,
50
- className: o.className
51
- }), n(e.id);
52
- };
53
- t.forEach((e) => {
54
- e.type === "toast" && e.isOpen && s(e);
55
- });
56
- }, [t, n]), /* @__PURE__ */ l(f, { children: [
57
- /* @__PURE__ */ a(m, {}),
58
- t.map((s) => {
59
- var e;
60
- if (!s.isOpen) return null;
61
- switch (s.type) {
62
- case "modal":
63
- return /* @__PURE__ */ a(
64
- P,
65
- {
66
- ...s.props,
67
- onClose: () => {
68
- s.props.onClose && s.props.onClose(), n(s.id);
69
- },
70
- description: (e = s.props.description) == null ? void 0 : e.toString()
71
- },
72
- s.id
73
- );
74
- case "alert":
75
- return /* @__PURE__ */ a(
76
- C,
77
- {
78
- ...s.props,
79
- onClose: () => {
80
- s.props.onClose && s.props.onClose(), n(s.id);
81
- }
82
- },
83
- s.id
84
- );
85
- case "dialog":
86
- return /* @__PURE__ */ a(
87
- p,
88
- {
89
- ...s.props,
90
- onClose: () => {
91
- s.props.onClose && s.props.onClose(), n(s.id);
92
- }
93
- },
94
- s.id
95
- );
96
- case "toast":
97
- return null;
98
- default:
99
- return null;
100
- }
101
- })
102
- ] });
103
- };
104
- export {
105
- j as P
106
- };
@@ -1 +0,0 @@
1
- "use strict";const c=require("react/jsx-runtime"),u=require("./tooltip-DWrSWVcc.cjs"),a=require("react"),l=require("./portal-manager-6YGufJVr.cjs"),f=require("./boottent-design.utils.cjs.js"),p=()=>{const[o,d]=a.useState([]);a.useEffect(()=>{const e=l.portalManager.subscribe((s,t)=>{d(i=>{if(t){if(!i.find(r=>r.id===s.id))return[...i,{...s,isOpen:t}]}else return i.map(r=>r.id===s.id?{...r,isOpen:t}:r);return i})});return()=>{e()}},[]);const n=e=>{l.portalManager.setPortalOpen(e,!1)};return a.useEffect(()=>{o.forEach(e=>{if(!e.isOpen){const s=setTimeout(()=>{d(t=>t.filter(i=>i.id!==e.id))},300);return()=>clearTimeout(s)}})},[o]),a.useEffect(()=>{const e=s=>{const t=s.props;f.toast({title:t.title,description:t.description,action:t.action,closeButton:t.closeButton,variant:t.variant,position:t.position,size:t.size,className:t.className}),n(s.id)};o.forEach(s=>{s.type==="toast"&&s.isOpen&&e(s)})},[o,n]),c.jsxs(u.PortalContainer,{children:[c.jsx(u.Toaster,{}),o.map(e=>{var s;if(!e.isOpen)return null;switch(e.type){case"modal":return c.jsx(u.Modal,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)},description:(s=e.props.description)==null?void 0:s.toString()},e.id);case"alert":return c.jsx(u.Alert,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)}},e.id);case"dialog":return c.jsx(u.Dialog,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)}},e.id);case"toast":return null;default:return null}})]})};exports.PortalProvider=p;
@@ -1 +0,0 @@
1
- "use strict";const r=require("./portal-manager-6YGufJVr.cjs"),s=require("react"),g=()=>{const[n,a]=s.useState([]);return s.useEffect(()=>{a(r.portalManager.getOpenPortals());const t=(o,u)=>{a(u?e=>[...e,o.id]:e=>e.filter(c=>c!==o.id))},l=r.portalManager.subscribe(t);return()=>{l()}},[]),{modal:t=>r.portalManager.showPortal("modal",t),toast:t=>r.portalManager.showPortal("toast",t),alert:t=>r.portalManager.showPortal("alert",t),dialog:t=>r.portalManager.showPortal("dialog",t),getIsOpen:t=>r.portalManager.getIsPortalOpen(t),openPortals:n}};exports.usePortal=g;
@@ -1,17 +0,0 @@
1
- import { p as r } from "./portal-manager-CttMAZAu.js";
2
- import { useState as c, useEffect as i } from "react";
3
- const b = () => {
4
- const [a, o] = c([]);
5
- return i(() => {
6
- o(r.getOpenPortals());
7
- const t = (s, l) => {
8
- o(l ? (e) => [...e, s.id] : (e) => e.filter((u) => u !== s.id));
9
- }, n = r.subscribe(t);
10
- return () => {
11
- n();
12
- };
13
- }, []), { modal: (t) => r.showPortal("modal", t), toast: (t) => r.showPortal("toast", t), alert: (t) => r.showPortal("alert", t), dialog: (t) => r.showPortal("dialog", t), getIsOpen: (t) => r.getIsPortalOpen(t), openPortals: a };
14
- };
15
- export {
16
- b as u
17
- };