@moondreamsdev/dreamer-ui 1.7.10-test.111 → 1.7.10-test.112

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,19 +1,19 @@
1
1
  import { jsx as t, Fragment as S, jsxs as b } from "react/jsx-runtime";
2
2
  import $, { createContext as l, useId as q, useState as v, useEffect as p, useRef as H, useCallback as L, useMemo as E, useContext as T } from "react";
3
- import { createPortal as P } from "react-dom";
4
- import { X, C as F, E as G, I as K } from "./X-CIoyLewf.js";
3
+ import { createPortal as X } from "react-dom";
4
+ import { X as F, C as G, E as K, I as P } from "./X-CIoyLewf.js";
5
5
  import { j as U } from "./join-BmgR_f4v.js";
6
6
  function N(...e) {
7
7
  return e.filter((r) => typeof r == "string" && r).join(" ").trim() || void 0;
8
8
  }
9
- function V({ size: e = 15, color: r = "currentColor", className: i = "inline", ...n }) {
9
+ function V({ size: e = 15, color: r = "currentColor", className: u = "inline", ...n }) {
10
10
  return /* @__PURE__ */ t(
11
11
  "svg",
12
12
  {
13
13
  ...n,
14
14
  width: e,
15
15
  height: e,
16
- className: i,
16
+ className: u,
17
17
  viewBox: "0 0 15 15",
18
18
  xmlns: "http://www.w3.org/2000/svg",
19
19
  children: /* @__PURE__ */ t(
@@ -154,22 +154,24 @@ l(null);
154
154
  l(null);
155
155
  l(null);
156
156
  l(null);
157
+ l(null);
158
+ l(null);
157
159
  function Y() {
158
160
  const [e, r] = v(0);
159
161
  return p(() => {
160
- const i = setInterval(() => {
162
+ const u = setInterval(() => {
161
163
  r((n) => (n + 1) % 3);
162
164
  }, 500);
163
- return () => clearInterval(i);
164
- }, []), /* @__PURE__ */ t("div", { className: "absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle", children: [0, 1, 2].map((i) => /* @__PURE__ */ t(
165
+ return () => clearInterval(u);
166
+ }, []), /* @__PURE__ */ t("div", { className: "absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle", children: [0, 1, 2].map((u) => /* @__PURE__ */ t(
165
167
  "div",
166
168
  {
167
169
  className: N(
168
170
  "rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current",
169
- e === i && "transform -translate-y-1"
171
+ e === u && "transform -translate-y-1"
170
172
  )
171
173
  },
172
- i
174
+ u
173
175
  )) });
174
176
  }
175
177
  const Z = {
@@ -202,10 +204,10 @@ const Z = {
202
204
  function Q({
203
205
  variant: e = w.variant,
204
206
  size: r,
205
- rounded: i = w.rounded,
207
+ rounded: u = w.rounded,
206
208
  loading: n,
207
209
  className: o,
208
- ...u
210
+ ...i
209
211
  }) {
210
212
  let a;
211
213
  e === "link" && !r ? a = "fitted" : a = r || w.size;
@@ -213,24 +215,24 @@ function Q({
213
215
  "appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",
214
216
  Z[e],
215
217
  _[a],
216
- J[i],
218
+ J[u],
217
219
  n && "relative pointer-events-none",
218
220
  o
219
221
  );
220
- if (u.href && !u.disabled)
222
+ if (i.href && !i.disabled)
221
223
  return /* @__PURE__ */ t(
222
224
  "a",
223
225
  {
224
- ...u,
225
- rel: u.rel ? u.rel : u.target === "_blank" ? "noopener noreferrer" : void 0,
226
- "aria-label": u["aria-label"],
227
- "aria-description": u["aria-description"],
228
- href: u.href,
226
+ ...i,
227
+ rel: i.rel ? i.rel : i.target === "_blank" ? "noopener noreferrer" : void 0,
228
+ "aria-label": i["aria-label"],
229
+ "aria-description": i["aria-description"],
230
+ href: i.href,
229
231
  className: s,
230
- children: u.children
232
+ children: i.children
231
233
  }
232
234
  );
233
- const d = u;
235
+ const d = i;
234
236
  return /* @__PURE__ */ b(
235
237
  "button",
236
238
  {
@@ -248,29 +250,29 @@ function Q({
248
250
  }
249
251
  );
250
252
  }
251
- function W(e) {
252
- const [r, i] = v(!1), [n, o] = v(!1);
253
+ function R(e) {
254
+ const [r, u] = v(!1), [n, o] = v(!1);
253
255
  return p(() => {
254
- e ? (o(!0), setTimeout(() => i(!0), 10)) : (i(!1), setTimeout(() => o(!1), 150));
256
+ e ? (o(!0), setTimeout(() => u(!0), 10)) : (u(!1), setTimeout(() => o(!1), 150));
255
257
  }, [e]), { show: r, shouldRender: n };
256
258
  }
257
- function R(e, r) {
259
+ function W(e, r) {
258
260
  p(() => {
259
- const i = (n) => {
261
+ const u = (n) => {
260
262
  n.key === "Escape" && e && r();
261
263
  };
262
- return document.addEventListener("keydown", i), e && (document.body.style.overflow = "hidden"), () => {
263
- document.removeEventListener("keydown", i), document.body.style.overflow = "auto";
264
+ return document.addEventListener("keydown", u), e && (document.body.style.overflow = "hidden"), () => {
265
+ document.removeEventListener("keydown", u), document.body.style.overflow = "auto";
264
266
  };
265
267
  }, [e, r]);
266
268
  }
267
269
  function ll(e, r) {
268
- const i = H(null), n = L(() => {
270
+ const u = H(null), n = L(() => {
269
271
  const o = document.getElementById(e);
270
272
  if (!o) return;
271
- const u = o.querySelectorAll('[data-modal-action="true"]');
272
- if (u.length > 0) {
273
- u[0].focus();
273
+ const i = o.querySelectorAll('[data-modal-action="true"]');
274
+ if (i.length > 0) {
275
+ i[0].focus();
274
276
  return;
275
277
  }
276
278
  const a = o.querySelectorAll(
@@ -287,17 +289,17 @@ function ll(e, r) {
287
289
  }
288
290
  o.focus();
289
291
  }, [e]);
290
- p(() => (r && (i.current = document.activeElement, n()), () => {
291
- document.body.style.overflow = "auto", i.current instanceof HTMLElement && i.current.focus();
292
+ p(() => (r && (u.current = document.activeElement, n()), () => {
293
+ document.body.style.overflow = "auto", u.current instanceof HTMLElement && u.current.focus();
292
294
  }), [r, n]);
293
295
  }
294
296
  function el({
295
297
  id: e,
296
298
  isOpen: r,
297
- onClose: i,
299
+ onClose: u,
298
300
  title: n,
299
301
  children: o,
300
- contentOnly: u = !1,
302
+ contentOnly: i = !1,
301
303
  className: a,
302
304
  overlayClassName: s,
303
305
  hideCloseButton: d = !1,
@@ -306,13 +308,13 @@ function el({
306
308
  ariaLabelledBy: f,
307
309
  ariaDescribedBy: g
308
310
  }) {
309
- const h = q(), k = e || `modal-${h}`, C = e ? `${e}-title` : `modal-title-${h}`, { show: j, shouldRender: x } = W(r);
310
- if (ll(k, x), R(x, i), !x) return null;
311
+ const h = q(), k = e || `modal-${h}`, C = e ? `${e}-title` : `modal-title-${h}`, { show: j, shouldRender: x } = R(r);
312
+ if (ll(k, x), W(x, u), !x) return null;
311
313
  const I = () => n ? $.isValidElement(n) ? /* @__PURE__ */ t("div", { className: "mb-4", children: n }) : /* @__PURE__ */ t("h2", { className: "mb-4 text-xl font-semibold", id: C, children: n }) : null, M = () => c.length === 0 ? null : /* @__PURE__ */ t("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((A, B) => {
312
314
  const { label: O, ...D } = A;
313
315
  return /* @__PURE__ */ t(Q, { ...D, "data-modal-action": "true", children: O }, B);
314
316
  }) });
315
- return /* @__PURE__ */ t(S, { children: P(
317
+ return /* @__PURE__ */ t(S, { children: X(
316
318
  /* @__PURE__ */ t(
317
319
  "div",
318
320
  {
@@ -327,12 +329,12 @@ function el({
327
329
  {
328
330
  className: y("fixed inset-0 bg-black/20 transition-all", s),
329
331
  onClick: () => {
330
- m || i();
332
+ m || u();
331
333
  }
332
334
  }
333
335
  ),
334
- u && /* @__PURE__ */ t("div", { className: y("relative w-fit", a), children: o }),
335
- !u && /* @__PURE__ */ b(
336
+ i && /* @__PURE__ */ t("div", { className: y("relative w-fit", a), children: o }),
337
+ !i && /* @__PURE__ */ b(
336
338
  "div",
337
339
  {
338
340
  id: k,
@@ -347,7 +349,7 @@ function el({
347
349
  "button",
348
350
  {
349
351
  type: "button",
350
- onClick: i,
352
+ onClick: u,
351
353
  "data-modal-close-button": "true",
352
354
  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",
353
355
  children: /* @__PURE__ */ t(V, { size: 18 })
@@ -368,47 +370,47 @@ function el({
368
370
  function sl({
369
371
  type: e,
370
372
  message: r,
371
- cancelText: i,
373
+ cancelText: u,
372
374
  confirmText: n,
373
375
  onConfirm: o,
374
- onClose: u,
376
+ onClose: i,
375
377
  destructive: a = !1,
376
378
  title: s,
377
379
  ...d
378
380
  }) {
379
381
  const c = E(() => e === "confirm" ? {
380
382
  confirm: n || "Confirm",
381
- cancel: i || "Cancel",
383
+ cancel: u || "Cancel",
382
384
  defaultTitle: s || "Confirm Action"
383
385
  } : {
384
386
  confirm: n || "OK",
385
387
  cancel: null,
386
388
  defaultTitle: s || "Alert"
387
- }, [e, n, s, i]), m = E(
389
+ }, [e, n, s, u]), m = E(
388
390
  () => [
389
391
  ...c.cancel ? [
390
392
  {
391
393
  label: c.cancel,
392
394
  variant: "secondary",
393
- onClick: u
395
+ onClick: i
394
396
  }
395
397
  ] : [],
396
398
  {
397
399
  label: c.confirm,
398
400
  variant: a ? "destructive" : "primary",
399
401
  onClick: () => {
400
- o == null || o(), u();
402
+ o == null || o(), i();
401
403
  }
402
404
  }
403
405
  ],
404
- [c, a, o, u]
406
+ [c, a, o, i]
405
407
  );
406
408
  return /* @__PURE__ */ t(
407
409
  el,
408
410
  {
409
411
  ...d,
410
412
  title: s || c.defaultTitle,
411
- onClose: u,
413
+ onClose: i,
412
414
  actions: m,
413
415
  disableCloseOnOverlayClick: e === "confirm",
414
416
  hideCloseButton: e === "confirm",
@@ -429,24 +431,24 @@ const nl = l(null), dl = () => {
429
431
  }, z = {
430
432
  info: {
431
433
  className: "bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-800 dark:border-blue-950 dark:text-blue-100",
432
- icon: /* @__PURE__ */ t(K, { size: 20 })
434
+ icon: /* @__PURE__ */ t(P, { size: 20 })
433
435
  },
434
436
  warning: {
435
437
  className: "bg-yellow-50 border-yellow-200 text-yellow-900 dark:bg-yellow-800 dark:border-yellow-950 dark:text-yellow-100",
436
- icon: /* @__PURE__ */ t(G, { size: 20 })
438
+ icon: /* @__PURE__ */ t(K, { size: 20 })
437
439
  },
438
440
  error: {
439
441
  className: "bg-red-50 border-red-200 text-red-900 dark:bg-red-800 dark:border-red-950 dark:text-red-100",
440
- icon: /* @__PURE__ */ t(F, { size: 20 })
442
+ icon: /* @__PURE__ */ t(G, { size: 20 })
441
443
  }
442
444
  };
443
445
  function ml({
444
446
  id: e,
445
447
  title: r,
446
- description: i,
448
+ description: u,
447
449
  type: n = "info",
448
450
  action: o,
449
- duration: u = 5e3,
451
+ duration: i = 5e3,
450
452
  onRemove: a,
451
453
  customTypes: s,
452
454
  customComponent: d
@@ -457,22 +459,22 @@ function ml({
457
459
  }, 150);
458
460
  }, [e, a]);
459
461
  if (p(() => {
460
- if (u > 0) {
462
+ if (i > 0) {
461
463
  const h = setTimeout(() => {
462
464
  f();
463
- }, u);
465
+ }, i);
464
466
  return () => clearTimeout(h);
465
467
  }
466
- }, [u, e, a, f]), d)
468
+ }, [i, e, a, f]), d)
467
469
  return /* @__PURE__ */ t(
468
470
  d,
469
471
  {
470
472
  id: e,
471
473
  title: r,
472
- description: i,
474
+ description: u,
473
475
  type: n,
474
476
  action: o,
475
- duration: u,
477
+ duration: i,
476
478
  onRemove: a
477
479
  }
478
480
  );
@@ -492,7 +494,7 @@ function ml({
492
494
  /* @__PURE__ */ t("div", { className: "flex-shrink-0 mr-3", children: g.icon }),
493
495
  /* @__PURE__ */ b("div", { className: "flex-grow min-w-0", children: [
494
496
  /* @__PURE__ */ t("div", { className: "font-medium text-sm leading-5", children: r }),
495
- i && /* @__PURE__ */ t("div", { className: "mt-1 text-sm opacity-90 leading-5", children: i }),
497
+ u && /* @__PURE__ */ t("div", { className: "mt-1 text-sm opacity-90 leading-5", children: u }),
496
498
  o && /* @__PURE__ */ t("div", { className: "mt-1.5", children: /* @__PURE__ */ t(
497
499
  "button",
498
500
  {
@@ -507,7 +509,7 @@ function ml({
507
509
  {
508
510
  onClick: f,
509
511
  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",
510
- children: /* @__PURE__ */ t(X, { size: 16 })
512
+ children: /* @__PURE__ */ t(F, { size: 16 })
511
513
  }
512
514
  )
513
515
  ]
@@ -523,4 +525,4 @@ export {
523
525
  N as n,
524
526
  dl as u
525
527
  };
526
- //# sourceMappingURL=Toast-CO6YHXyI.js.map
528
+ //# sourceMappingURL=Toast-Bc0ZiTYw.js.map