@moondreamsdev/dreamer-ui 1.7.9 → 1.7.10-test.1
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/{Toast-B83cGTb3.js → Toast-C0wOVeh0.js} +93 -89
- package/dist/Toast-C0wOVeh0.js.map +1 -0
- package/dist/Toast-DLFVFkWv.cjs +2 -0
- package/dist/Toast-DLFVFkWv.cjs.map +1 -0
- package/dist/{QuestionMarkCircled-CY81euqP.js → Window-CT479Oxr.js} +98 -6
- package/dist/Window-CT479Oxr.js.map +1 -0
- package/dist/Window-oF6fyFBX.cjs +2 -0
- package/dist/Window-oF6fyFBX.cjs.map +1 -0
- package/dist/components.cjs.js +2 -1
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.esm.js +1753 -1410
- package/dist/components.esm.js.map +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.esm.js +6 -3
- package/dist/hooks.esm.js.map +1 -1
- package/dist/providers.cjs.js +1 -1
- package/dist/providers.esm.js +1 -1
- package/dist/src/components/code-block/CodeBlock.d.ts +35 -0
- package/dist/src/components/code-block/hooks.d.ts +65 -0
- package/dist/src/components/code-block/index.d.ts +2 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/useCopyToClipboard.d.ts +9 -0
- package/dist/src/hooks/useDownloadFile.d.ts +6 -0
- package/dist/src/symbols/Copy.d.ts +2 -0
- package/dist/src/symbols/Dash.d.ts +2 -0
- package/dist/src/symbols/Download.d.ts +2 -0
- package/dist/src/symbols/Window.d.ts +2 -0
- package/dist/src/symbols/index.d.ts +4 -0
- package/dist/symbols.cjs.js +1 -1
- package/dist/symbols.esm.js +15 -11
- package/dist/useDownloadFile-D7aXoP4p.cjs +2 -0
- package/dist/useDownloadFile-D7aXoP4p.cjs.map +1 -0
- package/dist/useDownloadFile-fw_TsfK6.js +22 -0
- package/dist/useDownloadFile-fw_TsfK6.js.map +1 -0
- package/package.json +1 -1
- package/dist/QuestionMarkCircled-CY81euqP.js.map +0 -1
- package/dist/QuestionMarkCircled-D3gPieJ7.cjs +0 -2
- package/dist/QuestionMarkCircled-D3gPieJ7.cjs.map +0 -1
- package/dist/Toast-B83cGTb3.js.map +0 -1
- package/dist/Toast-BDQ9mOuz.cjs +0 -2
- package/dist/Toast-BDQ9mOuz.cjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as r, Fragment as q, jsxs as b } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { X
|
|
5
|
-
import { join as
|
|
2
|
+
import $, { createContext as o, useId as D, useState as v, useEffect as g, useRef as H, useCallback as L, useMemo as E, useContext as P } from "react";
|
|
3
|
+
import { createPortal as Q } from "react-dom";
|
|
4
|
+
import { X, C as Z, E as F, I as J } from "./X-CIoyLewf.js";
|
|
5
|
+
import { join as K } from "./utils.esm.js";
|
|
6
6
|
function N(...e) {
|
|
7
7
|
return e.filter((l) => typeof l == "string" && l).join(" ").trim() || void 0;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function U({ size: e = 15, color: l = "currentColor", className: n = "inline", ...t }) {
|
|
10
10
|
return /* @__PURE__ */ r(
|
|
11
11
|
"svg",
|
|
12
12
|
{
|
|
@@ -31,21 +31,25 @@ function $({ size: e = 15, color: l = "currentColor", className: n = "inline", .
|
|
|
31
31
|
function x(...e) {
|
|
32
32
|
return e.filter((l) => typeof l == "string" && l).join(" ").trim() || void 0;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
o(void 0);
|
|
35
|
+
o(null);
|
|
36
|
+
o(null);
|
|
37
|
+
o(null);
|
|
38
|
+
o(null);
|
|
39
|
+
o(null);
|
|
40
|
+
o(null);
|
|
41
|
+
o(null);
|
|
42
|
+
o(null);
|
|
43
|
+
o(null);
|
|
44
|
+
o(null);
|
|
45
|
+
o(null);
|
|
46
|
+
o(null);
|
|
47
|
+
o(null);
|
|
48
|
+
o(null);
|
|
49
|
+
o(null);
|
|
50
|
+
o(void 0);
|
|
51
|
+
o(void 0);
|
|
52
|
+
function V() {
|
|
49
53
|
const [e, l] = v(0);
|
|
50
54
|
return g(() => {
|
|
51
55
|
const n = setInterval(() => {
|
|
@@ -63,7 +67,7 @@ function G() {
|
|
|
63
67
|
n
|
|
64
68
|
)) });
|
|
65
69
|
}
|
|
66
|
-
const
|
|
70
|
+
const _ = {
|
|
67
71
|
base: "",
|
|
68
72
|
primary: "bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-muted disabled:text-muted-foreground",
|
|
69
73
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/85 disabled:bg-muted/80 disabled:text-muted-foreground/80",
|
|
@@ -71,7 +75,7 @@ const Q = {
|
|
|
71
75
|
outline: "border border-primary text-primary hover:border-primary-foreground hover:text-primary-foreground disabled:border-muted disabled:text-muted",
|
|
72
76
|
link: "underline-offset-4 hover:underline disabled:underline disabled:text-muted",
|
|
73
77
|
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/85 disabled:bg-muted disabled:text-muted-foreground"
|
|
74
|
-
},
|
|
78
|
+
}, G = {
|
|
75
79
|
stripped: "",
|
|
76
80
|
fitted: "size-fit",
|
|
77
81
|
sm: "px-2 py-1 text-sm",
|
|
@@ -90,43 +94,43 @@ const Q = {
|
|
|
90
94
|
size: "md",
|
|
91
95
|
rounded: "md"
|
|
92
96
|
};
|
|
93
|
-
function
|
|
97
|
+
function Y({
|
|
94
98
|
variant: e = w.variant,
|
|
95
99
|
size: l,
|
|
96
100
|
rounded: n = w.rounded,
|
|
97
101
|
loading: t,
|
|
98
102
|
linkTo: i,
|
|
99
103
|
linkProps: a,
|
|
100
|
-
type:
|
|
101
|
-
className:
|
|
102
|
-
...
|
|
104
|
+
type: s = "button",
|
|
105
|
+
className: u,
|
|
106
|
+
...d
|
|
103
107
|
}) {
|
|
104
108
|
let c;
|
|
105
109
|
e === "link" && !l ? c = "fitted" : c = l || w.size;
|
|
106
110
|
const m = N(
|
|
107
111
|
"appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
_[e],
|
|
113
|
+
G[c],
|
|
110
114
|
W[n],
|
|
111
115
|
t && "relative pointer-events-none",
|
|
112
116
|
i && "relative",
|
|
113
|
-
|
|
117
|
+
u
|
|
114
118
|
);
|
|
115
119
|
return /* @__PURE__ */ b(
|
|
116
120
|
"button",
|
|
117
121
|
{
|
|
118
|
-
...
|
|
119
|
-
role: i ? "link" :
|
|
120
|
-
"aria-label":
|
|
121
|
-
"aria-description":
|
|
122
|
-
"aria-disabled":
|
|
122
|
+
...d,
|
|
123
|
+
role: i ? "link" : d.role,
|
|
124
|
+
"aria-label": d["aria-label"] || (a == null ? void 0 : a["aria-label"]),
|
|
125
|
+
"aria-description": d["aria-description"] || (a == null ? void 0 : a["aria-description"]),
|
|
126
|
+
"aria-disabled": d.disabled || t,
|
|
123
127
|
"aria-busy": t,
|
|
124
|
-
type:
|
|
128
|
+
type: s,
|
|
125
129
|
className: m,
|
|
126
130
|
children: [
|
|
127
|
-
t && /* @__PURE__ */ r(
|
|
128
|
-
/* @__PURE__ */ r("span", { className: N(t && "invisible"), children:
|
|
129
|
-
i && !
|
|
131
|
+
t && /* @__PURE__ */ r(V, {}),
|
|
132
|
+
/* @__PURE__ */ r("span", { className: N(t && "invisible"), children: d.children }),
|
|
133
|
+
i && !d.disabled && /* @__PURE__ */ r(
|
|
130
134
|
"a",
|
|
131
135
|
{
|
|
132
136
|
...a,
|
|
@@ -157,7 +161,7 @@ function ee(e, l) {
|
|
|
157
161
|
}, [e, l]);
|
|
158
162
|
}
|
|
159
163
|
function te(e, l) {
|
|
160
|
-
const n =
|
|
164
|
+
const n = H(null), t = L(() => {
|
|
161
165
|
const i = document.getElementById(e);
|
|
162
166
|
if (!i) return;
|
|
163
167
|
const a = i.querySelectorAll('[data-modal-action="true"]');
|
|
@@ -165,16 +169,16 @@ function te(e, l) {
|
|
|
165
169
|
a[0].focus();
|
|
166
170
|
return;
|
|
167
171
|
}
|
|
168
|
-
const
|
|
172
|
+
const s = i.querySelectorAll(
|
|
169
173
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
170
174
|
);
|
|
171
|
-
if (
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
+
if (s.length > 0) {
|
|
176
|
+
const u = Array.from(s).filter((d) => !(d instanceof HTMLButtonElement && d.getAttribute("data-modal-close-button") === "true"));
|
|
177
|
+
if (u.length > 0) {
|
|
178
|
+
u[0].focus();
|
|
175
179
|
return;
|
|
176
180
|
}
|
|
177
|
-
|
|
181
|
+
s[0].focus();
|
|
178
182
|
return;
|
|
179
183
|
}
|
|
180
184
|
i.focus();
|
|
@@ -190,21 +194,21 @@ function re({
|
|
|
190
194
|
title: t,
|
|
191
195
|
children: i,
|
|
192
196
|
contentOnly: a = !1,
|
|
193
|
-
className:
|
|
194
|
-
overlayClassName:
|
|
195
|
-
hideCloseButton:
|
|
197
|
+
className: s,
|
|
198
|
+
overlayClassName: u,
|
|
199
|
+
hideCloseButton: d = !1,
|
|
196
200
|
actions: c = [],
|
|
197
201
|
disableCloseOnOverlayClick: m = !1,
|
|
198
202
|
ariaLabelledBy: f,
|
|
199
203
|
ariaDescribedBy: h
|
|
200
204
|
}) {
|
|
201
|
-
const p =
|
|
205
|
+
const p = D(), k = e || `modal-${p}`, C = e ? `${e}-title` : `modal-title-${p}`, { show: z, shouldRender: y } = R(l);
|
|
202
206
|
if (te(k, y), ee(y, n), !y) return null;
|
|
203
|
-
const
|
|
204
|
-
const { label:
|
|
205
|
-
return /* @__PURE__ */ r(
|
|
207
|
+
const j = () => t ? $.isValidElement(t) ? /* @__PURE__ */ r("div", { className: "mb-4", children: t }) : /* @__PURE__ */ r("h2", { className: "mb-4 text-xl font-semibold", id: C, children: t }) : null, A = () => c.length === 0 ? null : /* @__PURE__ */ r("div", { className: "mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3", children: c.map((I, B) => {
|
|
208
|
+
const { label: O, className: M, ...S } = I;
|
|
209
|
+
return /* @__PURE__ */ r(Y, { className: M, type: "button", ...S, "data-modal-action": "true", children: O }, B);
|
|
206
210
|
}) });
|
|
207
|
-
return /* @__PURE__ */ r(q, { children:
|
|
211
|
+
return /* @__PURE__ */ r(q, { children: Q(
|
|
208
212
|
/* @__PURE__ */ r(
|
|
209
213
|
"div",
|
|
210
214
|
{
|
|
@@ -217,13 +221,13 @@ function re({
|
|
|
217
221
|
/* @__PURE__ */ r(
|
|
218
222
|
"div",
|
|
219
223
|
{
|
|
220
|
-
className: x("fixed inset-0 bg-black/20 transition-all",
|
|
224
|
+
className: x("fixed inset-0 bg-black/20 transition-all", u),
|
|
221
225
|
onClick: () => {
|
|
222
226
|
m || n();
|
|
223
227
|
}
|
|
224
228
|
}
|
|
225
229
|
),
|
|
226
|
-
a && /* @__PURE__ */ r("div", { className: x("relative w-fit",
|
|
230
|
+
a && /* @__PURE__ */ r("div", { className: x("relative w-fit", s), children: i }),
|
|
227
231
|
!a && /* @__PURE__ */ b(
|
|
228
232
|
"div",
|
|
229
233
|
{
|
|
@@ -232,22 +236,22 @@ function re({
|
|
|
232
236
|
className: x(
|
|
233
237
|
"relative w-full max-w-xl transform rounded-lg shadow-xl bg-popover transition-all p-6 focus:ring ease-in duration-75",
|
|
234
238
|
z ? "opacity-100 scale-100" : "opacity-0 scale-90",
|
|
235
|
-
|
|
239
|
+
s
|
|
236
240
|
),
|
|
237
241
|
children: [
|
|
238
|
-
!
|
|
242
|
+
!d && /* @__PURE__ */ r(
|
|
239
243
|
"button",
|
|
240
244
|
{
|
|
241
245
|
type: "button",
|
|
242
246
|
onClick: n,
|
|
243
247
|
"data-modal-close-button": "true",
|
|
244
248
|
className: "rounded-md p-0.5 top-2.5 right-2.5 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",
|
|
245
|
-
children: /* @__PURE__ */ r(
|
|
249
|
+
children: /* @__PURE__ */ r(U, { size: 18 })
|
|
246
250
|
}
|
|
247
251
|
),
|
|
248
|
-
|
|
252
|
+
j(),
|
|
249
253
|
i,
|
|
250
|
-
|
|
254
|
+
A()
|
|
251
255
|
]
|
|
252
256
|
}
|
|
253
257
|
)
|
|
@@ -264,19 +268,19 @@ function de({
|
|
|
264
268
|
confirmText: t,
|
|
265
269
|
onConfirm: i,
|
|
266
270
|
onClose: a,
|
|
267
|
-
destructive:
|
|
268
|
-
title:
|
|
269
|
-
...
|
|
271
|
+
destructive: s = !1,
|
|
272
|
+
title: u,
|
|
273
|
+
...d
|
|
270
274
|
}) {
|
|
271
275
|
const c = E(() => e === "confirm" ? {
|
|
272
276
|
confirm: t || "Confirm",
|
|
273
277
|
cancel: n || "Cancel",
|
|
274
|
-
defaultTitle:
|
|
278
|
+
defaultTitle: u || "Confirm Action"
|
|
275
279
|
} : {
|
|
276
280
|
confirm: t || "OK",
|
|
277
281
|
cancel: null,
|
|
278
|
-
defaultTitle:
|
|
279
|
-
}, [e, t,
|
|
282
|
+
defaultTitle: u || "Alert"
|
|
283
|
+
}, [e, t, u, n]), m = E(
|
|
280
284
|
() => [
|
|
281
285
|
...c.cancel ? [
|
|
282
286
|
{
|
|
@@ -287,19 +291,19 @@ function de({
|
|
|
287
291
|
] : [],
|
|
288
292
|
{
|
|
289
293
|
label: c.confirm,
|
|
290
|
-
variant:
|
|
294
|
+
variant: s ? "destructive" : "primary",
|
|
291
295
|
onClick: () => {
|
|
292
296
|
i == null || i(), a();
|
|
293
297
|
}
|
|
294
298
|
}
|
|
295
299
|
],
|
|
296
|
-
[c,
|
|
300
|
+
[c, s, i, a]
|
|
297
301
|
);
|
|
298
302
|
return /* @__PURE__ */ r(
|
|
299
303
|
re,
|
|
300
304
|
{
|
|
301
|
-
...
|
|
302
|
-
title:
|
|
305
|
+
...d,
|
|
306
|
+
title: u || c.defaultTitle,
|
|
303
307
|
onClose: a,
|
|
304
308
|
actions: m,
|
|
305
309
|
disableCloseOnOverlayClick: e === "confirm",
|
|
@@ -308,23 +312,23 @@ function de({
|
|
|
308
312
|
}
|
|
309
313
|
);
|
|
310
314
|
}
|
|
311
|
-
const le =
|
|
312
|
-
const e =
|
|
315
|
+
const le = o(null), ue = () => {
|
|
316
|
+
const e = P(le);
|
|
313
317
|
if (!e)
|
|
314
318
|
throw new Error("Tabs components must be used within a Tabs component");
|
|
315
319
|
return e;
|
|
316
|
-
},
|
|
320
|
+
}, T = {
|
|
317
321
|
info: {
|
|
318
322
|
className: "bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-800 dark:border-blue-950 dark:text-blue-100",
|
|
319
|
-
icon: /* @__PURE__ */ r(
|
|
323
|
+
icon: /* @__PURE__ */ r(J, { size: 20 })
|
|
320
324
|
},
|
|
321
325
|
warning: {
|
|
322
326
|
className: "bg-yellow-50 border-yellow-200 text-yellow-900 dark:bg-yellow-800 dark:border-yellow-950 dark:text-yellow-100",
|
|
323
|
-
icon: /* @__PURE__ */ r(
|
|
327
|
+
icon: /* @__PURE__ */ r(F, { size: 20 })
|
|
324
328
|
},
|
|
325
329
|
error: {
|
|
326
330
|
className: "bg-red-50 border-red-200 text-red-900 dark:bg-red-800 dark:border-red-950 dark:text-red-100",
|
|
327
|
-
icon: /* @__PURE__ */ r(
|
|
331
|
+
icon: /* @__PURE__ */ r(Z, { size: 20 })
|
|
328
332
|
}
|
|
329
333
|
};
|
|
330
334
|
function ce({
|
|
@@ -334,15 +338,15 @@ function ce({
|
|
|
334
338
|
type: t = "info",
|
|
335
339
|
action: i,
|
|
336
340
|
duration: a = 5e3,
|
|
337
|
-
onRemove:
|
|
338
|
-
customTypes:
|
|
339
|
-
customComponent:
|
|
341
|
+
onRemove: s,
|
|
342
|
+
customTypes: u,
|
|
343
|
+
customComponent: d
|
|
340
344
|
}) {
|
|
341
|
-
const [c, m] = v(!1), f =
|
|
345
|
+
const [c, m] = v(!1), f = L(() => {
|
|
342
346
|
m(!0), setTimeout(() => {
|
|
343
|
-
|
|
347
|
+
s == null || s(e);
|
|
344
348
|
}, 150);
|
|
345
|
-
}, [e,
|
|
349
|
+
}, [e, s]);
|
|
346
350
|
if (g(() => {
|
|
347
351
|
if (a > 0) {
|
|
348
352
|
const p = setTimeout(() => {
|
|
@@ -350,9 +354,9 @@ function ce({
|
|
|
350
354
|
}, a);
|
|
351
355
|
return () => clearTimeout(p);
|
|
352
356
|
}
|
|
353
|
-
}, [a, e,
|
|
357
|
+
}, [a, e, s, f]), d)
|
|
354
358
|
return /* @__PURE__ */ r(
|
|
355
|
-
|
|
359
|
+
d,
|
|
356
360
|
{
|
|
357
361
|
id: e,
|
|
358
362
|
title: l,
|
|
@@ -360,16 +364,16 @@ function ce({
|
|
|
360
364
|
type: t,
|
|
361
365
|
action: i,
|
|
362
366
|
duration: a,
|
|
363
|
-
onRemove:
|
|
367
|
+
onRemove: s
|
|
364
368
|
}
|
|
365
369
|
);
|
|
366
|
-
const h = (
|
|
370
|
+
const h = (u == null ? void 0 : u[t]) || T[t] || T.info;
|
|
367
371
|
return /* @__PURE__ */ b(
|
|
368
372
|
"div",
|
|
369
373
|
{
|
|
370
374
|
role: t === "error" ? "alert" : "status",
|
|
371
375
|
"aria-live": t === "error" ? void 0 : "polite",
|
|
372
|
-
className:
|
|
376
|
+
className: K(
|
|
373
377
|
"relative flex items-start p-4 rounded-lg border shadow-lg transition-all duration-150 ease-in-out",
|
|
374
378
|
i && "pb-3",
|
|
375
379
|
h.className,
|
|
@@ -394,7 +398,7 @@ function ce({
|
|
|
394
398
|
{
|
|
395
399
|
onClick: f,
|
|
396
400
|
className: "flex-shrink-0 ml-3 p-1 rounded-md hover:bg-black/10 dark:hover:bg-white/10 focus:outline-none focus:ring-1 focus:ring-current leading-0",
|
|
397
|
-
children: /* @__PURE__ */ r(
|
|
401
|
+
children: /* @__PURE__ */ r(X, { size: 16 })
|
|
398
402
|
}
|
|
399
403
|
)
|
|
400
404
|
]
|
|
@@ -408,4 +412,4 @@ export {
|
|
|
408
412
|
N as n,
|
|
409
413
|
ue as u
|
|
410
414
|
};
|
|
411
|
-
//# sourceMappingURL=Toast-
|
|
415
|
+
//# sourceMappingURL=Toast-C0wOVeh0.js.map
|