boottent-design 0.1.136 → 0.1.137
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.
package/dist/components.es.js
CHANGED
|
@@ -5,8 +5,8 @@ import * as w from "react";
|
|
|
5
5
|
import M, { useState as pr, useEffect as Po } from "react";
|
|
6
6
|
import { a as $, d as ct, c as So } from "./index-CEwEyzHV.js";
|
|
7
7
|
import { S as R } from "./index-TpPaGoFn.js";
|
|
8
|
-
import { p as te, R as Eo } from "./portal-container-
|
|
9
|
-
import {
|
|
8
|
+
import { p as te, R as Eo } from "./portal-container-kpgXLOax.js";
|
|
9
|
+
import { c as Xs, d as Zs, e as Ks, f as Js, g as Qs, h as el, i as tl, j as rl, k as nl, l as ol, m as al, A as il, D as sl, n as ll, a as cl, o as dl, q as ul, b as ml, r as pl, s as fl, u as gl, v as bl, w as hl, M as vl, P as wl, z as yl, B as xl, C as Cl, E as Tl, T as Nl, F as Pl, G as Sl, H as El, x as Ol, y as kl } from "./portal-container-kpgXLOax.js";
|
|
10
10
|
var Tt = "Collapsible", [Oo, fr] = wt(Tt), [ko, Nt] = Oo(Tt), gr = w.forwardRef(
|
|
11
11
|
(r, e) => {
|
|
12
12
|
const {
|
|
@@ -1312,7 +1312,7 @@ export {
|
|
|
1312
1312
|
ja as A,
|
|
1313
1313
|
so as B,
|
|
1314
1314
|
no as C,
|
|
1315
|
-
|
|
1315
|
+
ma as D,
|
|
1316
1316
|
lo as E,
|
|
1317
1317
|
$a as F,
|
|
1318
1318
|
io as G,
|
|
@@ -1321,20 +1321,20 @@ export {
|
|
|
1321
1321
|
er as P,
|
|
1322
1322
|
Qa as R,
|
|
1323
1323
|
Za as T,
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1324
|
+
It as a,
|
|
1325
|
+
Ya as b,
|
|
1326
|
+
_t as c,
|
|
1327
|
+
Me as d,
|
|
1328
|
+
ge as e,
|
|
1329
|
+
_e as f,
|
|
1330
|
+
ae as g,
|
|
1331
|
+
Oe as h,
|
|
1332
|
+
Se as i,
|
|
1333
|
+
St as j,
|
|
1334
|
+
pa as k,
|
|
1335
|
+
Ie as l,
|
|
1336
|
+
qa as m,
|
|
1337
|
+
va as n,
|
|
1338
1338
|
Lt as o,
|
|
1339
1339
|
Ha as p,
|
|
1340
1340
|
Ft as q,
|
package/dist/provider.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("./portal-container-CjCfY0e4.cjs"),m=require("./index-Cv9m35ew.cjs"),r=require("react"),p=r.forwardRef(({open:t,onClose:u,className:n,contents:d},e)=>i.jsx(o.Dialog,{open:t,onOpenChange:s=>{!s&&u&&u()},children:i.jsx(o.DialogContent,{ref:e,className:m.cn(n),children:d})})),C=()=>{const[t,u]=r.useState([]);r.useEffect(()=>{const e=o.portalManager.subscribe((s,l)=>{u(c=>{const f=c.find(a=>a.id===s.id);return l?f?c:[...c,{...s,isOpen:l}]:c.map(a=>a.id===s.id?{...a,isOpen:!1}:a)})});return()=>{e()}},[]);const n=r.useCallback(e=>{o.portalManager.setPortalOpen(e,!1)},[]);r.useEffect(()=>{const e=[];return t.forEach(s=>{if(!s.isOpen){const l=setTimeout(()=>{u(c=>c.filter(f=>f.id!==s.id))},300);e.push(l)}}),()=>{e.forEach(s=>clearTimeout(s))}},[t]);const d=r.useCallback(e=>{const s=e.props;o.toast({title:s.title,description:s.description,action:s.action,closeButton:s.closeButton,variant:s.variant,position:s.position,size:s.size,className:s.className}),n(e.id)},[n]);return r.useEffect(()=>{t.forEach(e=>{e.type==="toast"&&e.isOpen&&d(e)})},[t,d]),i.jsxs(o.PortalContainer,{children:[i.jsx(o.ToastForm,{}),t.map(e=>{var s;if(!e.isOpen)return null;switch(e.type){case"modal":return i.jsx(o.ModalForm,{...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 i.jsx(o.AlertForm,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)}},e.id);case"dialog":return i.jsx(o.DialogForm,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)}},e.id);case"custom":return i.jsx(p,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)}},e.id);case"toast":return null;default:return null}})]})};exports.PortalProvider=C;
|
package/dist/provider.es.js
CHANGED
|
@@ -1,39 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as i, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { D as C, a as h, p as m, t as g, P, T as b, b as F, A as O, M as T } from "./portal-container-kpgXLOax.js";
|
|
3
|
+
import { c as x } from "./index-CWHiF7D_.js";
|
|
4
|
+
import { forwardRef as D, useState as E, useEffect as l, useCallback as f } from "react";
|
|
5
|
+
const M = D(({ open: n, onClose: t, className: o, contents: a }, s) => /* @__PURE__ */ i(
|
|
6
|
+
C,
|
|
7
|
+
{
|
|
8
|
+
open: n,
|
|
9
|
+
onOpenChange: (e) => {
|
|
10
|
+
!e && t && t();
|
|
11
|
+
},
|
|
12
|
+
children: /* @__PURE__ */ i(h, { ref: s, className: x(o), children: a })
|
|
13
|
+
}
|
|
14
|
+
)), z = () => {
|
|
15
|
+
const [n, t] = E([]);
|
|
16
|
+
l(() => {
|
|
17
|
+
const s = m.subscribe((e, u) => {
|
|
18
|
+
t((r) => {
|
|
19
|
+
const d = r.find((c) => c.id === e.id);
|
|
20
|
+
return u ? d ? r : [...r, { ...e, isOpen: u }] : r.map((c) => c.id === e.id ? { ...c, isOpen: !1 } : c);
|
|
11
21
|
});
|
|
12
22
|
});
|
|
13
23
|
return () => {
|
|
14
24
|
s();
|
|
15
25
|
};
|
|
16
26
|
}, []);
|
|
17
|
-
const
|
|
27
|
+
const o = f((s) => {
|
|
18
28
|
m.setPortalOpen(s, !1);
|
|
19
29
|
}, []);
|
|
20
|
-
|
|
30
|
+
l(() => {
|
|
21
31
|
const s = [];
|
|
22
|
-
return
|
|
32
|
+
return n.forEach((e) => {
|
|
23
33
|
if (!e.isOpen) {
|
|
24
|
-
const
|
|
25
|
-
|
|
34
|
+
const u = setTimeout(() => {
|
|
35
|
+
t((r) => r.filter((d) => d.id !== e.id));
|
|
26
36
|
}, 300);
|
|
27
|
-
s.push(
|
|
37
|
+
s.push(u);
|
|
28
38
|
}
|
|
29
39
|
}), () => {
|
|
30
40
|
s.forEach((e) => clearTimeout(e));
|
|
31
41
|
};
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
42
|
+
}, [n]);
|
|
43
|
+
const a = f(
|
|
34
44
|
(s) => {
|
|
35
45
|
const e = s.props;
|
|
36
|
-
|
|
46
|
+
g({
|
|
37
47
|
title: e.title,
|
|
38
48
|
description: e.description,
|
|
39
49
|
action: e.action,
|
|
@@ -42,50 +52,61 @@ const M = () => {
|
|
|
42
52
|
position: e.position,
|
|
43
53
|
size: e.size,
|
|
44
54
|
className: e.className
|
|
45
|
-
}),
|
|
55
|
+
}), o(s.id);
|
|
46
56
|
},
|
|
47
|
-
[
|
|
57
|
+
[o]
|
|
48
58
|
);
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
s.type === "toast" && s.isOpen &&
|
|
59
|
+
return l(() => {
|
|
60
|
+
n.forEach((s) => {
|
|
61
|
+
s.type === "toast" && s.isOpen && a(s);
|
|
52
62
|
});
|
|
53
|
-
}, [
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
|
|
63
|
+
}, [n, a]), /* @__PURE__ */ p(P, { children: [
|
|
64
|
+
/* @__PURE__ */ i(b, {}),
|
|
65
|
+
n.map((s) => {
|
|
56
66
|
var e;
|
|
57
67
|
if (!s.isOpen) return null;
|
|
58
68
|
switch (s.type) {
|
|
59
69
|
case "modal":
|
|
60
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ i(
|
|
61
71
|
T,
|
|
62
72
|
{
|
|
63
73
|
...s.props,
|
|
64
74
|
onClose: () => {
|
|
65
|
-
s.props.onClose && s.props.onClose(),
|
|
75
|
+
s.props.onClose && s.props.onClose(), o(s.id);
|
|
66
76
|
},
|
|
67
77
|
description: (e = s.props.description) == null ? void 0 : e.toString()
|
|
68
78
|
},
|
|
69
79
|
s.id
|
|
70
80
|
);
|
|
71
81
|
case "alert":
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
|
|
82
|
+
return /* @__PURE__ */ i(
|
|
83
|
+
O,
|
|
74
84
|
{
|
|
75
85
|
...s.props,
|
|
76
86
|
onClose: () => {
|
|
77
|
-
s.props.onClose && s.props.onClose(),
|
|
87
|
+
s.props.onClose && s.props.onClose(), o(s.id);
|
|
78
88
|
}
|
|
79
89
|
},
|
|
80
90
|
s.id
|
|
81
91
|
);
|
|
82
92
|
case "dialog":
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
|
|
93
|
+
return /* @__PURE__ */ i(
|
|
94
|
+
F,
|
|
95
|
+
{
|
|
96
|
+
...s.props,
|
|
97
|
+
onClose: () => {
|
|
98
|
+
s.props.onClose && s.props.onClose(), o(s.id);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
s.id
|
|
102
|
+
);
|
|
103
|
+
case "custom":
|
|
104
|
+
return /* @__PURE__ */ i(
|
|
105
|
+
M,
|
|
85
106
|
{
|
|
86
107
|
...s.props,
|
|
87
108
|
onClose: () => {
|
|
88
|
-
s.props.onClose && s.props.onClose(),
|
|
109
|
+
s.props.onClose && s.props.onClose(), o(s.id);
|
|
89
110
|
}
|
|
90
111
|
},
|
|
91
112
|
s.id
|
|
@@ -99,5 +120,5 @@ const M = () => {
|
|
|
99
120
|
] });
|
|
100
121
|
};
|
|
101
122
|
export {
|
|
102
|
-
|
|
123
|
+
z as PortalProvider
|
|
103
124
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -34,6 +34,12 @@ declare const buttonVariants: (props?: ({
|
|
|
34
34
|
shape?: "square" | "rounded" | null | undefined;
|
|
35
35
|
} & ClassProp) | undefined) => string;
|
|
36
36
|
|
|
37
|
+
export declare interface CustomPortalOptions {
|
|
38
|
+
id: string;
|
|
39
|
+
type: "custom";
|
|
40
|
+
props: FreeFormProps;
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
export declare interface DialogPortalOptions {
|
|
38
44
|
id: string;
|
|
39
45
|
type: "dialog";
|
|
@@ -138,7 +144,7 @@ export declare interface ModalProps {
|
|
|
138
144
|
className?: string;
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
export declare type PortalOptions = ModalPortalOptions | ToastPortalOptions | AlertPortalOptions | DialogPortalOptions;
|
|
147
|
+
export declare type PortalOptions = ModalPortalOptions | ToastPortalOptions | AlertPortalOptions | DialogPortalOptions | CustomPortalOptions;
|
|
142
148
|
|
|
143
149
|
export declare type PortalType = "modal" | "toast" | "alert" | "dialog" | "custom";
|
|
144
150
|
|