@moondreamsdev/dreamer-ui 1.7.2 → 1.7.3

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,25 +1,25 @@
1
- import { jsxs as w, jsx as c } from "react/jsx-runtime";
1
+ import { jsxs as w, jsx as l } from "react/jsx-runtime";
2
2
  import I, { useId as E, useState as N, createElement as B, useEffect as A, useCallback as $, useMemo as R, isValidElement as F, cloneElement as q } from "react";
3
3
  import { join as v } from "./utils.esm.js";
4
4
  import { b as K, C as G, E as H, a as T, d as Q, c as U, Q as W } from "./QuestionMarkCircled-CIc05alV.js";
5
- function k({
5
+ function j({
6
6
  id: o,
7
7
  title: r,
8
8
  content: e,
9
- children: a,
10
- className: t = "",
9
+ children: t,
10
+ className: a = "",
11
11
  disabled: n = !1,
12
12
  isOpen: s = !1,
13
13
  onToggle: i,
14
- triggerClassName: l = "",
14
+ triggerClassName: u = "",
15
15
  bodyClassName: g = ""
16
16
  }) {
17
- const p = E(), d = o || `accordion-item-${p}`, h = `${d}-header`, b = `${d}-panel`, u = () => {
17
+ const p = E(), d = o || `accordion-item-${p}`, h = `${d}-header`, b = `${d}-panel`, c = () => {
18
18
  !n && i && i();
19
19
  }, x = (f) => {
20
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), u());
20
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), c());
21
21
  };
22
- return /* @__PURE__ */ w("div", { className: v("border-b border-gray-200", n && "opacity-60 cursor-not-allowed", t), children: [
22
+ return /* @__PURE__ */ w("div", { className: v("border-b border-gray-200", n && "opacity-60 cursor-not-allowed", a), children: [
23
23
  /* @__PURE__ */ w(
24
24
  "button",
25
25
  {
@@ -28,16 +28,16 @@ function k({
28
28
  className: v(
29
29
  "w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary",
30
30
  n ? "cursor-not-allowed" : "hover:bg-gray-50/10 cursor-pointer",
31
- l
31
+ u
32
32
  ),
33
33
  "aria-expanded": s,
34
34
  "aria-controls": b,
35
35
  disabled: n,
36
- onClick: u,
36
+ onClick: c,
37
37
  onKeyDown: x,
38
38
  children: [
39
- /* @__PURE__ */ c("span", { children: r }),
40
- /* @__PURE__ */ c(
39
+ /* @__PURE__ */ l("span", { children: r }),
40
+ /* @__PURE__ */ l(
41
41
  "span",
42
42
  {
43
43
  className: v(
@@ -45,13 +45,13 @@ function k({
45
45
  s ? "rotate-180" : "rotate-0"
46
46
  ),
47
47
  "aria-hidden": "true",
48
- children: /* @__PURE__ */ c(K, { size: 18 })
48
+ children: /* @__PURE__ */ l(K, { size: 18 })
49
49
  }
50
50
  )
51
51
  ]
52
52
  }
53
53
  ),
54
- /* @__PURE__ */ c(
54
+ /* @__PURE__ */ l(
55
55
  "div",
56
56
  {
57
57
  id: b,
@@ -62,7 +62,7 @@ function k({
62
62
  s ? "max-h-96 opacity-100 overflow-auto py-3" : "max-h-0 opacity-0 overflow-hidden",
63
63
  g
64
64
  ),
65
- children: s && (a || e)
65
+ children: s && (t || e)
66
66
  }
67
67
  )
68
68
  ] });
@@ -71,24 +71,24 @@ function le({
71
71
  name: o,
72
72
  items: r = [],
73
73
  children: e,
74
- className: a = "",
75
- itemClassName: t = "",
74
+ className: t = "",
75
+ itemClassName: a = "",
76
76
  allowMultiple: n = !1,
77
77
  defaultOpenItems: s = [],
78
78
  triggersClassName: i = "",
79
- bodiesClassName: l = ""
79
+ bodiesClassName: u = ""
80
80
  }) {
81
81
  const g = E(), p = o || `accordion-group-${g}`, [d, h] = N(new Set(s)), b = (f) => {
82
82
  h((y) => {
83
83
  const m = new Set(y);
84
84
  return m.has(f) ? m.delete(f) : (n || m.clear(), m.add(f)), m;
85
85
  });
86
- }, u = (f) => `${g}-item-${f}`, x = (f) => d.has(f);
87
- return /* @__PURE__ */ w("div", { id: p, className: a, children: [
86
+ }, c = (f) => `${g}-item-${f}`, x = (f) => d.has(f);
87
+ return /* @__PURE__ */ w("div", { id: p, className: t, children: [
88
88
  r.length > 0 && r.map((f, y) => {
89
- const m = f.id || u(y);
90
- return /* @__PURE__ */ c(
91
- k,
89
+ const m = f.id || c(y);
90
+ return /* @__PURE__ */ l(
91
+ j,
92
92
  {
93
93
  id: m,
94
94
  title: f.title,
@@ -96,27 +96,27 @@ function le({
96
96
  disabled: f.disabled,
97
97
  isOpen: x(m),
98
98
  onToggle: () => b(m),
99
- className: t,
99
+ className: a,
100
100
  triggerClassName: i,
101
- bodyClassName: l
101
+ bodyClassName: u
102
102
  },
103
103
  m
104
104
  );
105
105
  }),
106
106
  r.length === 0 && e && I.Children.map(e, (f, y) => {
107
- if (I.isValidElement(f) && f.type === k) {
108
- const m = f.props.id || u(y);
107
+ if (I.isValidElement(f) && f.type === j) {
108
+ const m = f.props.id || c(y);
109
109
  return /* @__PURE__ */ B(
110
- k,
110
+ j,
111
111
  {
112
112
  ...f.props,
113
113
  key: m,
114
114
  id: m,
115
- className: v(t, f.props.className),
115
+ className: v(a, f.props.className),
116
116
  isOpen: x(m),
117
117
  onToggle: () => b(m),
118
118
  triggerClassName: v(i, f.props.triggerClassName),
119
- bodyClassName: v(l, f.props.bodyClassName)
119
+ bodyClassName: v(u, f.props.bodyClassName)
120
120
  }
121
121
  );
122
122
  }
@@ -128,10 +128,10 @@ function _() {
128
128
  const [o, r] = N(0);
129
129
  return A(() => {
130
130
  const e = setInterval(() => {
131
- r((a) => (a + 1) % 3);
131
+ r((t) => (t + 1) % 3);
132
132
  }, 500);
133
133
  return () => clearInterval(e);
134
- }, []), /* @__PURE__ */ c("div", { className: "absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle", children: [0, 1, 2].map((e) => /* @__PURE__ */ c(
134
+ }, []), /* @__PURE__ */ l("div", { className: "absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle", children: [0, 1, 2].map((e) => /* @__PURE__ */ l(
135
135
  "div",
136
136
  {
137
137
  className: v(
@@ -164,53 +164,53 @@ const J = {
164
164
  md: "rounded-md",
165
165
  lg: "rounded-lg",
166
166
  full: "rounded-full"
167
- }, j = {
167
+ }, k = {
168
168
  variant: "primary",
169
169
  size: "md",
170
170
  rounded: "md"
171
171
  };
172
172
  function ue({
173
- variant: o = j.variant,
173
+ variant: o = k.variant,
174
174
  size: r,
175
- rounded: e = j.rounded,
176
- loading: a,
177
- linkTo: t,
175
+ rounded: e = k.rounded,
176
+ loading: t,
177
+ linkTo: a,
178
178
  linkProps: n,
179
179
  type: s = "button",
180
180
  className: i,
181
- ...l
181
+ ...u
182
182
  }) {
183
183
  let g;
184
- o === "link" && !r ? g = "fitted" : g = r || j.size;
184
+ o === "link" && !r ? g = "fitted" : g = r || k.size;
185
185
  const d = v(
186
186
  "appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",
187
187
  J[o],
188
188
  X[g],
189
189
  Y[e],
190
- a && "relative pointer-events-none",
191
- t && "relative",
190
+ t && "relative pointer-events-none",
191
+ a && "relative",
192
192
  i
193
193
  );
194
194
  return /* @__PURE__ */ w(
195
195
  "button",
196
196
  {
197
- ...l,
198
- role: t ? "link" : l.role,
199
- "aria-label": l["aria-label"] || (n == null ? void 0 : n["aria-label"]),
200
- "aria-description": l["aria-description"] || (n == null ? void 0 : n["aria-description"]),
201
- "aria-disabled": l.disabled || a,
202
- "aria-busy": a,
197
+ ...u,
198
+ role: a ? "link" : u.role,
199
+ "aria-label": u["aria-label"] || (n == null ? void 0 : n["aria-label"]),
200
+ "aria-description": u["aria-description"] || (n == null ? void 0 : n["aria-description"]),
201
+ "aria-disabled": u.disabled || t,
202
+ "aria-busy": t,
203
203
  type: s,
204
204
  className: d,
205
205
  children: [
206
- a && /* @__PURE__ */ c(_, {}),
207
- /* @__PURE__ */ c("span", { className: v(a && "invisible"), children: l.children }),
208
- t && !l.disabled && /* @__PURE__ */ c(
206
+ t && /* @__PURE__ */ l(_, {}),
207
+ /* @__PURE__ */ l("span", { className: v(t && "invisible"), children: u.children }),
208
+ a && !u.disabled && /* @__PURE__ */ l(
209
209
  "a",
210
210
  {
211
211
  ...n,
212
212
  "aria-hidden": !0,
213
- href: t,
213
+ href: a,
214
214
  target: (n == null ? void 0 : n.target) || "_blank",
215
215
  rel: (n == null ? void 0 : n.rel) || "noreferrer",
216
216
  className: "absolute inset-0"
@@ -221,8 +221,8 @@ function ue({
221
221
  );
222
222
  }
223
223
  function Z(o) {
224
- const [r, e] = N(""), a = $((t) => {
225
- let n = t, s = "";
224
+ const [r, e] = N(""), t = $((a) => {
225
+ let n = a, s = "";
226
226
  for (; n && !s; ) {
227
227
  const i = window.getComputedStyle(n).backgroundColor;
228
228
  i && i !== "transparent" && i !== "rgba(0, 0, 0, 0)" && (s = i), n = n.parentElement;
@@ -230,42 +230,42 @@ function Z(o) {
230
230
  return s || "transparent";
231
231
  }, []);
232
232
  return A(() => {
233
- const t = document.getElementById(o);
234
- if (t) {
235
- const n = a(t.parentElement);
233
+ const a = document.getElementById(o);
234
+ if (a) {
235
+ const n = t(a.parentElement);
236
236
  e(n);
237
237
  }
238
- }, [o, a]), r;
238
+ }, [o, t]), r;
239
239
  }
240
240
  function ce({
241
241
  ref: o,
242
242
  id: r,
243
243
  size: e = 20,
244
- color: a,
245
- filled: t = !1,
244
+ color: t,
245
+ filled: a = !1,
246
246
  rounded: n = !0,
247
247
  checked: s = !1,
248
248
  onCheckedChange: i,
249
- disabled: l,
249
+ disabled: u,
250
250
  className: g = "",
251
251
  ...p
252
252
  }) {
253
- const d = E(), h = R(() => r || `checkbox-${d}`, [r, d]), b = Z(h), [u, x] = N(s);
253
+ const d = E(), h = R(() => r || `checkbox-${d}`, [r, d]), b = Z(h), [c, x] = N(s);
254
254
  A(() => {
255
255
  x(s);
256
256
  }, [s]);
257
257
  const f = () => {
258
- l || (x(!u), i == null || i(!u));
258
+ u || (x(!c), i == null || i(!c));
259
259
  }, y = (C) => {
260
260
  C.key === " " && (C.preventDefault(), f());
261
261
  }, m = v(
262
262
  "flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",
263
263
  n && "rounded",
264
- l && "opacity-40 cursor-not-allowed",
265
- !l && "cursor-pointer",
264
+ u && "opacity-40 cursor-not-allowed",
265
+ !u && "cursor-pointer",
266
266
  g
267
267
  );
268
- return /* @__PURE__ */ c(
268
+ return /* @__PURE__ */ l(
269
269
  "button",
270
270
  {
271
271
  id: h,
@@ -274,35 +274,65 @@ function ce({
274
274
  tabIndex: 0,
275
275
  role: "checkbox",
276
276
  onClick: f,
277
- "aria-checked": u,
278
- "aria-disabled": l,
277
+ "aria-checked": c,
278
+ "aria-disabled": u,
279
279
  onKeyDownCapture: y,
280
280
  style: {
281
281
  width: e,
282
282
  height: e,
283
- color: a,
284
- backgroundColor: u && t ? "currentcolor" : "transparent"
283
+ color: t,
284
+ backgroundColor: c && a ? "currentcolor" : "transparent"
285
285
  },
286
286
  className: m,
287
287
  ...p,
288
- children: u && /* @__PURE__ */ c(G, { size: e, color: t ? b : void 0 })
288
+ children: c && /* @__PURE__ */ l(G, { size: e, color: a ? b : void 0 })
289
289
  }
290
290
  );
291
291
  }
292
+ function fe({
293
+ children: o,
294
+ className: r,
295
+ linkTo: e,
296
+ linkProps: t,
297
+ onButtonClick: a,
298
+ buttonProps: n,
299
+ ...s
300
+ }) {
301
+ return e && a && console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'), /* @__PURE__ */ w("div", { className: v("relative w-fit", r), ...s, children: [
302
+ o,
303
+ e && /* @__PURE__ */ l(
304
+ "a",
305
+ {
306
+ ...t,
307
+ href: e,
308
+ className: v("absolute inset-0", t == null ? void 0 : t.className)
309
+ }
310
+ ),
311
+ !e && a && /* @__PURE__ */ l(
312
+ "button",
313
+ {
314
+ ...n,
315
+ type: "button",
316
+ onClick: a,
317
+ className: v("absolute inset-0 cursor-pointer", n == null ? void 0 : n.className)
318
+ }
319
+ )
320
+ ] });
321
+ }
292
322
  function D({ elementId: o, type: r, message: e }) {
293
323
  return A(() => {
294
- const a = document.getElementById(o);
295
- if (a) {
324
+ const t = document.getElementById(o);
325
+ if (t) {
296
326
  if (!e && r === "error") {
297
- a.removeAttribute("data-error");
327
+ t.removeAttribute("data-error");
298
328
  return;
299
329
  }
300
330
  if (!e && r === "success") {
301
- a.removeAttribute("data-success");
331
+ t.removeAttribute("data-success");
302
332
  return;
303
333
  }
304
- return a.setAttribute("aria-describedby", `${o}-${r}-message`), a.setAttribute("aria-invalid", r === "error" ? "true" : "false"), r === "error" && a.setAttribute("data-error", "true"), r === "success" && a.setAttribute("data-success", "true"), () => {
305
- a.removeAttribute("aria-describedby"), a.removeAttribute("aria-invalid"), a.removeAttribute("data-error"), a.removeAttribute("data-success");
334
+ return t.setAttribute("aria-describedby", `${o}-${r}-message`), t.setAttribute("aria-invalid", r === "error" ? "true" : "false"), r === "error" && t.setAttribute("data-error", "true"), r === "success" && t.setAttribute("data-success", "true"), () => {
335
+ t.removeAttribute("aria-describedby"), t.removeAttribute("aria-invalid"), t.removeAttribute("data-error"), t.removeAttribute("data-success");
306
336
  };
307
337
  }
308
338
  }, [o, r, e]), e ? /* @__PURE__ */ w(
@@ -315,8 +345,8 @@ function D({ elementId: o, type: r, message: e }) {
315
345
  ),
316
346
  role: "status",
317
347
  children: [
318
- r === "error" ? /* @__PURE__ */ c(H, {}) : /* @__PURE__ */ c(T, {}),
319
- /* @__PURE__ */ c("span", { id: `${o}-${r}-message`, children: e })
348
+ r === "error" ? /* @__PURE__ */ l(H, {}) : /* @__PURE__ */ l(T, {}),
349
+ /* @__PURE__ */ l("span", { id: `${o}-${r}-message`, children: e })
320
350
  ]
321
351
  }
322
352
  ) : null;
@@ -326,7 +356,7 @@ const O = {
326
356
  default: "ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-danger not-disabled:data-success:ring-success",
327
357
  underline: "border-b border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success",
328
358
  outline: "border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success"
329
- }, P = {
359
+ }, M = {
330
360
  none: "rounded-none",
331
361
  sm: "rounded-sm",
332
362
  md: "rounded-md",
@@ -336,24 +366,24 @@ const O = {
336
366
  variant: "default",
337
367
  rounded: "none"
338
368
  };
339
- function fe({
369
+ function be({
340
370
  variant: o = L.variant,
341
371
  rounded: r,
342
372
  displayOnlyMode: e = !1,
343
- errorMessage: a,
344
- successMessage: t,
373
+ errorMessage: t,
374
+ successMessage: a,
345
375
  type: n = "text",
346
376
  className: s,
347
377
  ...i
348
378
  }) {
349
- const l = E(), [g, p] = N(!1);
379
+ const u = E(), [g, p] = N(!1);
350
380
  let d = r;
351
381
  o === "outline" && !r && (d = "md"), d = d || L.rounded;
352
- const u = v(
382
+ const c = v(
353
383
  "appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",
354
384
  "file:mr-2 file:border-0 file:rounded-md file:px-1.5 file:py-1 file:bg-primary hover:file:bg-primary/85 file:text-sm file:font-medium file:text-foreground file:transition-colors",
355
385
  !e && O[o],
356
- !e && P[d],
386
+ !e && M[d],
357
387
  n === "password" && "pr-10",
358
388
  !e && "px-2 py-1",
359
389
  e && "pointer-events-none",
@@ -361,110 +391,110 @@ function fe({
361
391
  );
362
392
  return /* @__PURE__ */ w("div", { className: v(e && "cursor-text"), style: { height: i.height, width: i.width }, children: [
363
393
  /* @__PURE__ */ w("div", { className: v(n === "password" && "relative"), children: [
364
- /* @__PURE__ */ c(
394
+ /* @__PURE__ */ l(
365
395
  "input",
366
396
  {
367
397
  ...i,
368
- id: l,
398
+ id: u,
369
399
  type: n === "password" && g ? "text" : n,
370
400
  "aria-disabled": i.disabled,
371
401
  readOnly: e,
372
402
  "aria-readonly": e || i["aria-readonly"],
373
- "data-error": a ? !0 : void 0,
374
- "data-success": t ? !0 : void 0,
375
- className: u
403
+ "data-error": t ? !0 : void 0,
404
+ "data-success": a ? !0 : void 0,
405
+ className: c
376
406
  }
377
407
  ),
378
- n === "password" && /* @__PURE__ */ c(
408
+ n === "password" && /* @__PURE__ */ l(
379
409
  "button",
380
410
  {
381
411
  onClick: () => p(!g),
382
412
  className: "absolute inset-y-0 right-0 px-2 hover:cursor-pointer",
383
413
  "aria-label": "Toggle password visibility",
384
414
  "data-state": g ? "visible" : "hidden",
385
- children: g ? /* @__PURE__ */ c(Q, { size: 20 }) : /* @__PURE__ */ c(U, { size: 20 })
415
+ children: g ? /* @__PURE__ */ l(Q, { size: 20 }) : /* @__PURE__ */ l(U, { size: 20 })
386
416
  }
387
417
  )
388
418
  ] }),
389
- !e && /* @__PURE__ */ c(D, { elementId: l, type: "error", message: a }),
390
- !e && /* @__PURE__ */ c(D, { elementId: l, type: "success", message: t })
419
+ !e && /* @__PURE__ */ l(D, { elementId: u, type: "error", message: t }),
420
+ !e && /* @__PURE__ */ l(D, { elementId: u, type: "success", message: a })
391
421
  ] });
392
422
  }
393
- function be({
423
+ function me({
394
424
  display: o = "inline",
395
425
  width: r = "fit-content",
396
426
  className: e = "",
397
- required: a,
398
- helpMessage: t,
427
+ required: t,
428
+ helpMessage: a,
399
429
  suffix: n,
400
430
  htmlFor: s,
401
431
  children: i,
402
- ...l
432
+ ...u
403
433
  }) {
404
- const g = E(), p = v("font-medium", o, e), d = t ? `${s ?? g}-help` : void 0;
434
+ const g = E(), p = v("font-medium", o, e), d = a ? `${s ?? g}-help` : void 0;
405
435
  return /* @__PURE__ */ w("div", { style: { display: o === "inline" ? "inline-flex" : "flex", width: r }, className: "relative", children: [
406
- /* @__PURE__ */ w("label", { className: p, htmlFor: s, ...l, children: [
436
+ /* @__PURE__ */ w("label", { className: p, htmlFor: s, ...u, children: [
407
437
  i,
408
- a && /* @__PURE__ */ c("span", { className: "text-red-500 font-medium ml-1", "aria-label": "required", children: "*" })
438
+ t && /* @__PURE__ */ l("span", { className: "text-red-500 font-medium ml-1", "aria-label": "required", children: "*" })
409
439
  ] }),
410
- t && /* @__PURE__ */ c(
440
+ a && /* @__PURE__ */ l(
411
441
  "span",
412
442
  {
413
443
  className: "text-gray-500 ml-1 size-fit -translate-y-1/3",
414
444
  "aria-describedby": d,
415
445
  "aria-label": "Help information",
416
- title: t,
417
- children: /* @__PURE__ */ c(W, {})
446
+ title: a,
447
+ children: /* @__PURE__ */ l(W, {})
418
448
  }
419
449
  ),
420
- t && /* @__PURE__ */ c("div", { id: d, className: "sr-only", children: t }),
421
- n && /* @__PURE__ */ c("span", { className: "ml-1", children: n })
450
+ a && /* @__PURE__ */ l("div", { id: d, className: "sr-only", children: a }),
451
+ n && /* @__PURE__ */ l("span", { className: "ml-1", children: n })
422
452
  ] });
423
453
  }
424
- function me({ children: o, ref: r, ...e }) {
454
+ function ge({ children: o, ref: r, ...e }) {
425
455
  if (F(o)) {
426
- let a = { ...e };
427
- return o.props && (a = { ...a, ...o.props }), q(o, {
428
- ...a,
429
- ref: (t) => {
430
- typeof r == "function" ? r(t) : r && (r.current = t);
456
+ let t = { ...e };
457
+ return o.props && (t = { ...t, ...o.props }), q(o, {
458
+ ...t,
459
+ ref: (a) => {
460
+ typeof r == "function" ? r(a) : r && (r.current = a);
431
461
  }
432
462
  });
433
463
  }
434
464
  return B("div", { ...e, ref: r }, o);
435
465
  }
436
- function M({ itemId: o, checked: r, onChange: e, name: a, disabled: t = !1, className: n = "" }) {
466
+ function P({ itemId: o, checked: r, onChange: e, name: t, disabled: a = !1, className: n = "" }) {
437
467
  const s = "relative inline-flex items-center justify-center rounded-full", i = () => {
438
- t || e();
439
- }, l = v(
468
+ a || e();
469
+ }, u = v(
440
470
  s,
441
471
  !r && "hover:border-current/60",
442
- !t && "border-current cursor-pointer",
443
- t && "border-muted/60 cursor-not-allowed",
472
+ !a && "border-current cursor-pointer",
473
+ a && "border-muted/60 cursor-not-allowed",
444
474
  n
445
475
  );
446
- return /* @__PURE__ */ c(
476
+ return /* @__PURE__ */ l(
447
477
  "div",
448
478
  {
449
479
  id: o,
450
480
  role: "radio",
451
481
  tabIndex: -1,
452
482
  "aria-checked": r,
453
- "aria-disabled": t,
454
- "aria-description": `Radio button for ${a}`,
483
+ "aria-disabled": a,
484
+ "aria-description": `Radio button for ${t}`,
455
485
  "aria-labelledby": `${o}-label`,
456
486
  onClick: i,
457
- className: l,
487
+ className: u,
458
488
  style: {
459
489
  width: "1em",
460
490
  height: "1em",
461
491
  padding: "0.1em",
462
492
  borderWidth: "0.06em"
463
493
  },
464
- children: r && /* @__PURE__ */ c(
494
+ children: r && /* @__PURE__ */ l(
465
495
  "div",
466
496
  {
467
- className: v("size-full aspect-square rounded-full", t && "bg-muted/60", !t && "bg-current")
497
+ className: v("size-full aspect-square rounded-full", a && "bg-muted/60", !a && "bg-current")
468
498
  }
469
499
  )
470
500
  }
@@ -474,15 +504,15 @@ function z({
474
504
  value: o,
475
505
  children: r,
476
506
  className: e = "",
477
- isSelected: a = !1,
478
- onChange: t,
507
+ isSelected: t = !1,
508
+ onChange: a,
479
509
  disabled: n = !1,
480
510
  hideInput: s = !1,
481
511
  description: i,
482
- name: l
512
+ name: u
483
513
  }) {
484
514
  const p = `radio-${E()}-${o}`, d = () => {
485
- n || t == null || t(o);
515
+ n || a == null || a(o);
486
516
  };
487
517
  return /* @__PURE__ */ w(
488
518
  "div",
@@ -493,38 +523,38 @@ function z({
493
523
  e,
494
524
  // Uses text color for borders
495
525
  s && `p-2 border-2 focus-within:border-dashed focus-within:${n ? "border-current/50" : "border-current/80"}`,
496
- s && !a && `border-transparent ${n ? "" : "not-focus-within:hover:border-border/60"}`,
497
- s && a && "border-border",
526
+ s && !t && `border-transparent ${n ? "" : "not-focus-within:hover:border-border/60"}`,
527
+ s && t && "border-border",
498
528
  n && "opacity-60 cursor-not-allowed"
499
529
  ),
500
530
  style: {
501
531
  gap: "0.5em"
502
532
  },
503
533
  children: [
504
- !s && /* @__PURE__ */ c(
505
- M,
534
+ !s && /* @__PURE__ */ l(
535
+ P,
506
536
  {
507
537
  itemId: p,
508
- name: l || "",
509
- checked: a,
538
+ name: u || "",
539
+ checked: t,
510
540
  onChange: d,
511
541
  disabled: n,
512
542
  className: v(s && "")
513
543
  }
514
544
  ),
515
- /* @__PURE__ */ c(
545
+ /* @__PURE__ */ l(
516
546
  "div",
517
547
  {
518
548
  id: s ? p : void 0,
519
549
  tabIndex: s ? -1 : void 0,
520
550
  role: s ? "radio" : void 0,
521
551
  onClick: s ? d : void 0,
522
- "aria-checked": s ? a ? "true" : "false" : void 0,
552
+ "aria-checked": s ? t ? "true" : "false" : void 0,
523
553
  "aria-disabled": s ? n : void 0,
524
- "aria-description": s ? i || `Radio button for ${l}` : void 0,
554
+ "aria-description": s ? i || `Radio button for ${u}` : void 0,
525
555
  "aria-labelledby": s ? `${p}-label` : void 0,
526
556
  className: v(s && "size-full", typeof r == "object" && "grow focus:outline-none"),
527
- children: /* @__PURE__ */ c(
557
+ children: /* @__PURE__ */ l(
528
558
  "label",
529
559
  {
530
560
  id: `${p}-label`,
@@ -540,52 +570,52 @@ function z({
540
570
  );
541
571
  }
542
572
  function ee(o, r) {
543
- const [e, a] = N(r), [t, n] = N(-1), [s, i] = N(!1), l = $((b, u) => {
573
+ const [e, t] = N(r), [a, n] = N(-1), [s, i] = N(!1), u = $((b, c) => {
544
574
  var y;
545
- const x = b[u];
546
- x.hasAttribute("disabled") || x.getAttribute("aria-disabled") === "true" || ((y = b[u]) == null || y.click(), n(u));
575
+ const x = b[c];
576
+ x.hasAttribute("disabled") || x.getAttribute("aria-disabled") === "true" || ((y = b[c]) == null || y.click(), n(c));
547
577
  }, []), g = $(
548
- (b, u) => {
578
+ (b, c) => {
549
579
  var f;
550
- if (b.preventDefault(), s || !u.length) return;
580
+ if (b.preventDefault(), s || !c.length) return;
551
581
  const x = r !== -1 ? r : 0;
552
- (f = u[x]) == null || f.focus(), a(x), r !== -1 && l(u, x);
582
+ (f = c[x]) == null || f.focus(), t(x), r !== -1 && u(c, x);
553
583
  },
554
- [r, s, l]
584
+ [r, s, u]
555
585
  ), p = $(
556
586
  (b) => {
557
587
  var y;
558
588
  if (!b.shiftKey)
559
589
  return;
560
590
  b.preventDefault();
561
- const u = Array.from(
591
+ const c = Array.from(
562
592
  document.querySelectorAll(
563
593
  'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
564
594
  )
565
- ).filter((m) => !m.hasAttribute("disabled") && m.tabIndex >= 0), x = u.findIndex((m) => m.id === o), f = x > 0 ? x - 1 : u.length - 1;
566
- (y = u[f]) == null || y.focus();
595
+ ).filter((m) => !m.hasAttribute("disabled") && m.tabIndex >= 0), x = c.findIndex((m) => m.id === o), f = x > 0 ? x - 1 : c.length - 1;
596
+ (y = c[f]) == null || y.focus();
567
597
  },
568
598
  [o]
569
599
  ), d = $(
570
- (b, u) => {
600
+ (b, c) => {
571
601
  var C;
572
- if (!u.length) return;
602
+ if (!c.length) return;
573
603
  const x = b.target;
574
- if (!u.some((V) => V.id === x.id)) return;
604
+ if (!c.some((V) => V.id === x.id)) return;
575
605
  const y = e !== -1 ? e : 0;
576
606
  let m = y;
577
607
  switch (b.key) {
578
608
  case "ArrowUp":
579
609
  case "ArrowLeft":
580
- b.preventDefault(), m = y > 0 ? y - 1 : u.length - 1;
610
+ b.preventDefault(), m = y > 0 ? y - 1 : c.length - 1;
581
611
  break;
582
612
  case "ArrowDown":
583
613
  case "ArrowRight":
584
- b.preventDefault(), m = (y + 1) % u.length;
614
+ b.preventDefault(), m = (y + 1) % c.length;
585
615
  break;
586
616
  // Select the option when the space key is pressed
587
617
  case " ":
588
- b.preventDefault(), l(u, y);
618
+ b.preventDefault(), u(c, y);
589
619
  return;
590
620
  case "Tab":
591
621
  p(b);
@@ -593,9 +623,9 @@ function ee(o, r) {
593
623
  default:
594
624
  return;
595
625
  }
596
- (C = u[m]) == null || C.focus(), a(m), t !== -1 && l(u, m);
626
+ (C = c[m]) == null || C.focus(), t(m), a !== -1 && u(c, m);
597
627
  },
598
- [e, t, p, l]
628
+ [e, a, p, u]
599
629
  ), h = $(() => {
600
630
  const b = document.querySelector(`[id="${o}"][role="radiogroup"]`);
601
631
  return b ? Array.from(b.querySelectorAll('[role="radio"]')) : [];
@@ -603,30 +633,30 @@ function ee(o, r) {
603
633
  A(() => {
604
634
  const b = document.querySelector(`[id="${o}"][role="radiogroup"]`);
605
635
  if (!b) return;
606
- const u = h(), x = (C) => g(C, u), f = (C) => d(C, u), y = () => i(!0), m = () => i(!1);
636
+ const c = h(), x = (C) => g(C, c), f = (C) => d(C, c), y = () => i(!0), m = () => i(!1);
607
637
  return document.addEventListener("keydown", f), b.addEventListener("focus", x), b.addEventListener("mousedown", y), document.addEventListener("mouseup", m), () => {
608
638
  document.removeEventListener("keydown", f), b.removeEventListener("focus", x), b.removeEventListener("mousedown", y), document.removeEventListener("mouseup", m);
609
639
  };
610
640
  }, [o, h, g, d]);
611
641
  }
612
- function ge({
642
+ function ve({
613
643
  options: o = [],
614
644
  value: r,
615
645
  onChange: e,
616
- name: a,
617
- children: t,
646
+ name: t,
647
+ children: a,
618
648
  className: n = "",
619
649
  childrenClassName: s = "",
620
650
  hideInputs: i = !1
621
651
  }) {
622
- const l = E(), g = a || `radio-group-${l}`;
652
+ const u = E(), g = t || `radio-group-${u}`;
623
653
  ee(
624
654
  g,
625
655
  o.findIndex((d) => d === r)
626
656
  );
627
657
  const p = R(() => o.reduce((d, h) => (typeof h == "string" ? d.some((b) => b.value === h) || d.push({ label: h, value: h }) : d.push(h), d), []), [o]);
628
658
  return /* @__PURE__ */ w("div", { id: g, role: "radiogroup", tabIndex: 0, className: v(n, "focus:outline-none"), children: [
629
- p.length > 0 && p.map((d, h) => /* @__PURE__ */ c(
659
+ p.length > 0 && p.map((d, h) => /* @__PURE__ */ l(
630
660
  z,
631
661
  {
632
662
  value: d.value,
@@ -641,7 +671,7 @@ function ge({
641
671
  },
642
672
  `${d.value}-${h}`
643
673
  )),
644
- p.length === 0 && t && I.Children.map(t, (d) => I.isValidElement(d) && d.type === z ? /* @__PURE__ */ c(
674
+ p.length === 0 && a && I.Children.map(a, (d) => I.isValidElement(d) && d.type === z ? /* @__PURE__ */ l(
645
675
  z,
646
676
  {
647
677
  ...d.props,
@@ -656,21 +686,21 @@ function ge({
656
686
  ] });
657
687
  }
658
688
  function re({ elementId: o, maxLength: r }) {
659
- const [e, a] = N(0);
689
+ const [e, t] = N(0);
660
690
  return A(() => {
661
- const t = document.getElementById(o);
662
- if (!t)
691
+ const a = document.getElementById(o);
692
+ if (!a)
663
693
  return;
664
694
  const n = () => {
665
- const s = t.value.length;
666
- a(s);
695
+ const s = a.value.length;
696
+ t(s);
667
697
  const i = s >= r;
668
- t.setAttribute("aria-describedby", `${o}-character-count`), t.setAttribute("aria-invalid", i ? "true" : "false"), i ? t.setAttribute("data-error", "true") : t.removeAttribute("data-error");
698
+ a.setAttribute("aria-describedby", `${o}-character-count`), a.setAttribute("aria-invalid", i ? "true" : "false"), i ? a.setAttribute("data-error", "true") : a.removeAttribute("data-error");
669
699
  };
670
- return n(), t.addEventListener("input", n), t.setAttribute("maxlength", String(r)), () => {
671
- t.removeEventListener("input", n), t.removeAttribute("maxlength"), t.removeAttribute("aria-describedby"), t.removeAttribute("aria-invalid"), t.removeAttribute("data-error");
700
+ return n(), a.addEventListener("input", n), a.setAttribute("maxlength", String(r)), () => {
701
+ a.removeEventListener("input", n), a.removeAttribute("maxlength"), a.removeAttribute("aria-describedby"), a.removeAttribute("aria-invalid"), a.removeAttribute("data-error");
672
702
  };
673
- }, [o, r]), /* @__PURE__ */ c(
703
+ }, [o, r]), /* @__PURE__ */ l(
674
704
  "small",
675
705
  {
676
706
  className: v(
@@ -697,11 +727,11 @@ function te(o, r) {
697
727
  e.style.height = "auto";
698
728
  return;
699
729
  }
700
- const a = () => {
730
+ const t = () => {
701
731
  e.style.height = "auto", e.style.height = `${e.scrollHeight}px`;
702
732
  };
703
- return a(), e.addEventListener("input", a), e.addEventListener("resize", a), window.addEventListener("resize", a), () => {
704
- e.removeEventListener("input", a), e.removeEventListener("resize", a), window.removeEventListener("resize", a);
733
+ return t(), e.addEventListener("input", t), e.addEventListener("resize", t), window.addEventListener("resize", t), () => {
734
+ e.removeEventListener("input", t), e.removeEventListener("resize", t), window.removeEventListener("resize", t);
705
735
  };
706
736
  }, [o, r]);
707
737
  }
@@ -723,12 +753,12 @@ function pe({
723
753
  variant: o = S.variant,
724
754
  rounded: r,
725
755
  displayOnlyMode: e = !1,
726
- errorMessage: a,
727
- successMessage: t,
756
+ errorMessage: t,
757
+ successMessage: a,
728
758
  hideResizeHandle: n = !1,
729
759
  autoExpand: s = !1,
730
760
  characterLimit: i = 0,
731
- className: l,
761
+ className: u,
732
762
  ...g
733
763
  }) {
734
764
  const p = E();
@@ -737,17 +767,17 @@ function pe({
737
767
  o === "outline" && !r && (d = "md"), d = d || S.rounded;
738
768
  let h = n;
739
769
  (e || o === "left-line" && !n) && (h = !0);
740
- const u = v(
770
+ const c = v(
741
771
  "appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",
742
772
  !e && ae[o],
743
773
  !e && ne[d],
744
774
  !e && "px-2 py-1",
745
775
  e && "pointer-events-none",
746
776
  h && "no-resize-handle",
747
- l
777
+ u
748
778
  );
749
779
  return /* @__PURE__ */ w("div", { className: v("-space-y-1.5", e && "cursor-text"), children: [
750
- /* @__PURE__ */ c(
780
+ /* @__PURE__ */ l(
751
781
  "textarea",
752
782
  {
753
783
  ...g,
@@ -758,26 +788,27 @@ function pe({
758
788
  style: {
759
789
  resize: s ? "none" : void 0
760
790
  },
761
- className: u
791
+ className: c
762
792
  }
763
793
  ),
764
- i > 0 && /* @__PURE__ */ c(re, { elementId: p, maxLength: i }),
765
- !e && /* @__PURE__ */ c(D, { elementId: p, type: "error", message: a }),
766
- !e && /* @__PURE__ */ c(D, { elementId: p, type: "success", message: t })
794
+ i > 0 && /* @__PURE__ */ l(re, { elementId: p, maxLength: i }),
795
+ !e && /* @__PURE__ */ l(D, { elementId: p, type: "error", message: t }),
796
+ !e && /* @__PURE__ */ l(D, { elementId: p, type: "success", message: a })
767
797
  ] });
768
798
  }
769
799
  export {
770
800
  le as Accordion,
771
- k as AccordionItem,
801
+ j as AccordionItem,
772
802
  ue as Button,
773
803
  _ as ButtonLoadingDots,
774
804
  ce as Checkbox,
775
- fe as Input,
776
- be as Label,
777
- ge as RadioGroup,
805
+ fe as Clickable,
806
+ be as Input,
807
+ me as Label,
808
+ ve as RadioGroup,
778
809
  z as RadioGroupItem,
779
- M as RadioInput,
780
- me as Slot,
810
+ P as RadioInput,
811
+ ge as Slot,
781
812
  pe as Textarea
782
813
  };
783
814
  //# sourceMappingURL=components.esm.js.map