@moondreamsdev/dreamer-ui 1.7.2 → 1.7.3-test.0

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
+ }, z = {
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 = z.variant,
174
174
  size: r,
175
- rounded: e = j.rounded,
176
- loading: a,
177
- linkTo: t,
175
+ rounded: e = z.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 || z.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,66 @@ 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
+ "aria-label": (t == null ? void 0 : t["aria-label"]) || "Navigate to link"
310
+ }
311
+ ),
312
+ !e && a && /* @__PURE__ */ l(
313
+ "button",
314
+ {
315
+ ...n,
316
+ type: "button",
317
+ onClick: a,
318
+ className: v("absolute inset-0 cursor-pointer", n == null ? void 0 : n.className)
319
+ }
320
+ )
321
+ ] });
322
+ }
292
323
  function D({ elementId: o, type: r, message: e }) {
293
324
  return A(() => {
294
- const a = document.getElementById(o);
295
- if (a) {
325
+ const t = document.getElementById(o);
326
+ if (t) {
296
327
  if (!e && r === "error") {
297
- a.removeAttribute("data-error");
328
+ t.removeAttribute("data-error");
298
329
  return;
299
330
  }
300
331
  if (!e && r === "success") {
301
- a.removeAttribute("data-success");
332
+ t.removeAttribute("data-success");
302
333
  return;
303
334
  }
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");
335
+ 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"), () => {
336
+ t.removeAttribute("aria-describedby"), t.removeAttribute("aria-invalid"), t.removeAttribute("data-error"), t.removeAttribute("data-success");
306
337
  };
307
338
  }
308
339
  }, [o, r, e]), e ? /* @__PURE__ */ w(
@@ -315,8 +346,8 @@ function D({ elementId: o, type: r, message: e }) {
315
346
  ),
316
347
  role: "status",
317
348
  children: [
318
- r === "error" ? /* @__PURE__ */ c(H, {}) : /* @__PURE__ */ c(T, {}),
319
- /* @__PURE__ */ c("span", { id: `${o}-${r}-message`, children: e })
349
+ r === "error" ? /* @__PURE__ */ l(H, {}) : /* @__PURE__ */ l(T, {}),
350
+ /* @__PURE__ */ l("span", { id: `${o}-${r}-message`, children: e })
320
351
  ]
321
352
  }
322
353
  ) : null;
@@ -326,34 +357,34 @@ const O = {
326
357
  default: "ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-danger not-disabled:data-success:ring-success",
327
358
  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
359
  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 = {
360
+ }, M = {
330
361
  none: "rounded-none",
331
362
  sm: "rounded-sm",
332
363
  md: "rounded-md",
333
364
  lg: "rounded-lg",
334
365
  full: "px-3 rounded-full"
335
- }, L = {
366
+ }, S = {
336
367
  variant: "default",
337
368
  rounded: "none"
338
369
  };
339
- function fe({
340
- variant: o = L.variant,
370
+ function be({
371
+ variant: o = S.variant,
341
372
  rounded: r,
342
373
  displayOnlyMode: e = !1,
343
- errorMessage: a,
344
- successMessage: t,
374
+ errorMessage: t,
375
+ successMessage: a,
345
376
  type: n = "text",
346
377
  className: s,
347
378
  ...i
348
379
  }) {
349
- const l = E(), [g, p] = N(!1);
380
+ const u = E(), [g, p] = N(!1);
350
381
  let d = r;
351
- o === "outline" && !r && (d = "md"), d = d || L.rounded;
352
- const u = v(
382
+ o === "outline" && !r && (d = "md"), d = d || S.rounded;
383
+ const c = v(
353
384
  "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
385
  "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
386
  !e && O[o],
356
- !e && P[d],
387
+ !e && M[d],
357
388
  n === "password" && "pr-10",
358
389
  !e && "px-2 py-1",
359
390
  e && "pointer-events-none",
@@ -361,128 +392,128 @@ function fe({
361
392
  );
362
393
  return /* @__PURE__ */ w("div", { className: v(e && "cursor-text"), style: { height: i.height, width: i.width }, children: [
363
394
  /* @__PURE__ */ w("div", { className: v(n === "password" && "relative"), children: [
364
- /* @__PURE__ */ c(
395
+ /* @__PURE__ */ l(
365
396
  "input",
366
397
  {
367
398
  ...i,
368
- id: l,
399
+ id: u,
369
400
  type: n === "password" && g ? "text" : n,
370
401
  "aria-disabled": i.disabled,
371
402
  readOnly: e,
372
403
  "aria-readonly": e || i["aria-readonly"],
373
- "data-error": a ? !0 : void 0,
374
- "data-success": t ? !0 : void 0,
375
- className: u
404
+ "data-error": t ? !0 : void 0,
405
+ "data-success": a ? !0 : void 0,
406
+ className: c
376
407
  }
377
408
  ),
378
- n === "password" && /* @__PURE__ */ c(
409
+ n === "password" && /* @__PURE__ */ l(
379
410
  "button",
380
411
  {
381
412
  onClick: () => p(!g),
382
413
  className: "absolute inset-y-0 right-0 px-2 hover:cursor-pointer",
383
414
  "aria-label": "Toggle password visibility",
384
415
  "data-state": g ? "visible" : "hidden",
385
- children: g ? /* @__PURE__ */ c(Q, { size: 20 }) : /* @__PURE__ */ c(U, { size: 20 })
416
+ children: g ? /* @__PURE__ */ l(Q, { size: 20 }) : /* @__PURE__ */ l(U, { size: 20 })
386
417
  }
387
418
  )
388
419
  ] }),
389
- !e && /* @__PURE__ */ c(D, { elementId: l, type: "error", message: a }),
390
- !e && /* @__PURE__ */ c(D, { elementId: l, type: "success", message: t })
420
+ !e && /* @__PURE__ */ l(D, { elementId: u, type: "error", message: t }),
421
+ !e && /* @__PURE__ */ l(D, { elementId: u, type: "success", message: a })
391
422
  ] });
392
423
  }
393
- function be({
424
+ function me({
394
425
  display: o = "inline",
395
426
  width: r = "fit-content",
396
427
  className: e = "",
397
- required: a,
398
- helpMessage: t,
428
+ required: t,
429
+ helpMessage: a,
399
430
  suffix: n,
400
431
  htmlFor: s,
401
432
  children: i,
402
- ...l
433
+ ...u
403
434
  }) {
404
- const g = E(), p = v("font-medium", o, e), d = t ? `${s ?? g}-help` : void 0;
435
+ const g = E(), p = v("font-medium", o, e), d = a ? `${s ?? g}-help` : void 0;
405
436
  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: [
437
+ /* @__PURE__ */ w("label", { className: p, htmlFor: s, ...u, children: [
407
438
  i,
408
- a && /* @__PURE__ */ c("span", { className: "text-red-500 font-medium ml-1", "aria-label": "required", children: "*" })
439
+ t && /* @__PURE__ */ l("span", { className: "text-red-500 font-medium ml-1", "aria-label": "required", children: "*" })
409
440
  ] }),
410
- t && /* @__PURE__ */ c(
441
+ a && /* @__PURE__ */ l(
411
442
  "span",
412
443
  {
413
444
  className: "text-gray-500 ml-1 size-fit -translate-y-1/3",
414
445
  "aria-describedby": d,
415
446
  "aria-label": "Help information",
416
- title: t,
417
- children: /* @__PURE__ */ c(W, {})
447
+ title: a,
448
+ children: /* @__PURE__ */ l(W, {})
418
449
  }
419
450
  ),
420
- t && /* @__PURE__ */ c("div", { id: d, className: "sr-only", children: t }),
421
- n && /* @__PURE__ */ c("span", { className: "ml-1", children: n })
451
+ a && /* @__PURE__ */ l("div", { id: d, className: "sr-only", children: a }),
452
+ n && /* @__PURE__ */ l("span", { className: "ml-1", children: n })
422
453
  ] });
423
454
  }
424
- function me({ children: o, ref: r, ...e }) {
455
+ function ge({ children: o, ref: r, ...e }) {
425
456
  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);
457
+ let t = { ...e };
458
+ return o.props && (t = { ...t, ...o.props }), q(o, {
459
+ ...t,
460
+ ref: (a) => {
461
+ typeof r == "function" ? r(a) : r && (r.current = a);
431
462
  }
432
463
  });
433
464
  }
434
465
  return B("div", { ...e, ref: r }, o);
435
466
  }
436
- function M({ itemId: o, checked: r, onChange: e, name: a, disabled: t = !1, className: n = "" }) {
467
+ function P({ itemId: o, checked: r, onChange: e, name: t, disabled: a = !1, className: n = "" }) {
437
468
  const s = "relative inline-flex items-center justify-center rounded-full", i = () => {
438
- t || e();
439
- }, l = v(
469
+ a || e();
470
+ }, u = v(
440
471
  s,
441
472
  !r && "hover:border-current/60",
442
- !t && "border-current cursor-pointer",
443
- t && "border-muted/60 cursor-not-allowed",
473
+ !a && "border-current cursor-pointer",
474
+ a && "border-muted/60 cursor-not-allowed",
444
475
  n
445
476
  );
446
- return /* @__PURE__ */ c(
477
+ return /* @__PURE__ */ l(
447
478
  "div",
448
479
  {
449
480
  id: o,
450
481
  role: "radio",
451
482
  tabIndex: -1,
452
483
  "aria-checked": r,
453
- "aria-disabled": t,
454
- "aria-description": `Radio button for ${a}`,
484
+ "aria-disabled": a,
485
+ "aria-description": `Radio button for ${t}`,
455
486
  "aria-labelledby": `${o}-label`,
456
487
  onClick: i,
457
- className: l,
488
+ className: u,
458
489
  style: {
459
490
  width: "1em",
460
491
  height: "1em",
461
492
  padding: "0.1em",
462
493
  borderWidth: "0.06em"
463
494
  },
464
- children: r && /* @__PURE__ */ c(
495
+ children: r && /* @__PURE__ */ l(
465
496
  "div",
466
497
  {
467
- className: v("size-full aspect-square rounded-full", t && "bg-muted/60", !t && "bg-current")
498
+ className: v("size-full aspect-square rounded-full", a && "bg-muted/60", !a && "bg-current")
468
499
  }
469
500
  )
470
501
  }
471
502
  );
472
503
  }
473
- function z({
504
+ function L({
474
505
  value: o,
475
506
  children: r,
476
507
  className: e = "",
477
- isSelected: a = !1,
478
- onChange: t,
508
+ isSelected: t = !1,
509
+ onChange: a,
479
510
  disabled: n = !1,
480
511
  hideInput: s = !1,
481
512
  description: i,
482
- name: l
513
+ name: u
483
514
  }) {
484
515
  const p = `radio-${E()}-${o}`, d = () => {
485
- n || t == null || t(o);
516
+ n || a == null || a(o);
486
517
  };
487
518
  return /* @__PURE__ */ w(
488
519
  "div",
@@ -493,38 +524,38 @@ function z({
493
524
  e,
494
525
  // Uses text color for borders
495
526
  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",
527
+ s && !t && `border-transparent ${n ? "" : "not-focus-within:hover:border-border/60"}`,
528
+ s && t && "border-border",
498
529
  n && "opacity-60 cursor-not-allowed"
499
530
  ),
500
531
  style: {
501
532
  gap: "0.5em"
502
533
  },
503
534
  children: [
504
- !s && /* @__PURE__ */ c(
505
- M,
535
+ !s && /* @__PURE__ */ l(
536
+ P,
506
537
  {
507
538
  itemId: p,
508
- name: l || "",
509
- checked: a,
539
+ name: u || "",
540
+ checked: t,
510
541
  onChange: d,
511
542
  disabled: n,
512
543
  className: v(s && "")
513
544
  }
514
545
  ),
515
- /* @__PURE__ */ c(
546
+ /* @__PURE__ */ l(
516
547
  "div",
517
548
  {
518
549
  id: s ? p : void 0,
519
550
  tabIndex: s ? -1 : void 0,
520
551
  role: s ? "radio" : void 0,
521
552
  onClick: s ? d : void 0,
522
- "aria-checked": s ? a ? "true" : "false" : void 0,
553
+ "aria-checked": s ? t ? "true" : "false" : void 0,
523
554
  "aria-disabled": s ? n : void 0,
524
- "aria-description": s ? i || `Radio button for ${l}` : void 0,
555
+ "aria-description": s ? i || `Radio button for ${u}` : void 0,
525
556
  "aria-labelledby": s ? `${p}-label` : void 0,
526
557
  className: v(s && "size-full", typeof r == "object" && "grow focus:outline-none"),
527
- children: /* @__PURE__ */ c(
558
+ children: /* @__PURE__ */ l(
528
559
  "label",
529
560
  {
530
561
  id: `${p}-label`,
@@ -540,52 +571,52 @@ function z({
540
571
  );
541
572
  }
542
573
  function ee(o, r) {
543
- const [e, a] = N(r), [t, n] = N(-1), [s, i] = N(!1), l = $((b, u) => {
574
+ const [e, t] = N(r), [a, n] = N(-1), [s, i] = N(!1), u = $((b, c) => {
544
575
  var y;
545
- const x = b[u];
546
- x.hasAttribute("disabled") || x.getAttribute("aria-disabled") === "true" || ((y = b[u]) == null || y.click(), n(u));
576
+ const x = b[c];
577
+ x.hasAttribute("disabled") || x.getAttribute("aria-disabled") === "true" || ((y = b[c]) == null || y.click(), n(c));
547
578
  }, []), g = $(
548
- (b, u) => {
579
+ (b, c) => {
549
580
  var f;
550
- if (b.preventDefault(), s || !u.length) return;
581
+ if (b.preventDefault(), s || !c.length) return;
551
582
  const x = r !== -1 ? r : 0;
552
- (f = u[x]) == null || f.focus(), a(x), r !== -1 && l(u, x);
583
+ (f = c[x]) == null || f.focus(), t(x), r !== -1 && u(c, x);
553
584
  },
554
- [r, s, l]
585
+ [r, s, u]
555
586
  ), p = $(
556
587
  (b) => {
557
588
  var y;
558
589
  if (!b.shiftKey)
559
590
  return;
560
591
  b.preventDefault();
561
- const u = Array.from(
592
+ const c = Array.from(
562
593
  document.querySelectorAll(
563
594
  'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
564
595
  )
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();
596
+ ).filter((m) => !m.hasAttribute("disabled") && m.tabIndex >= 0), x = c.findIndex((m) => m.id === o), f = x > 0 ? x - 1 : c.length - 1;
597
+ (y = c[f]) == null || y.focus();
567
598
  },
568
599
  [o]
569
600
  ), d = $(
570
- (b, u) => {
601
+ (b, c) => {
571
602
  var C;
572
- if (!u.length) return;
603
+ if (!c.length) return;
573
604
  const x = b.target;
574
- if (!u.some((V) => V.id === x.id)) return;
605
+ if (!c.some((V) => V.id === x.id)) return;
575
606
  const y = e !== -1 ? e : 0;
576
607
  let m = y;
577
608
  switch (b.key) {
578
609
  case "ArrowUp":
579
610
  case "ArrowLeft":
580
- b.preventDefault(), m = y > 0 ? y - 1 : u.length - 1;
611
+ b.preventDefault(), m = y > 0 ? y - 1 : c.length - 1;
581
612
  break;
582
613
  case "ArrowDown":
583
614
  case "ArrowRight":
584
- b.preventDefault(), m = (y + 1) % u.length;
615
+ b.preventDefault(), m = (y + 1) % c.length;
585
616
  break;
586
617
  // Select the option when the space key is pressed
587
618
  case " ":
588
- b.preventDefault(), l(u, y);
619
+ b.preventDefault(), u(c, y);
589
620
  return;
590
621
  case "Tab":
591
622
  p(b);
@@ -593,9 +624,9 @@ function ee(o, r) {
593
624
  default:
594
625
  return;
595
626
  }
596
- (C = u[m]) == null || C.focus(), a(m), t !== -1 && l(u, m);
627
+ (C = c[m]) == null || C.focus(), t(m), a !== -1 && u(c, m);
597
628
  },
598
- [e, t, p, l]
629
+ [e, a, p, u]
599
630
  ), h = $(() => {
600
631
  const b = document.querySelector(`[id="${o}"][role="radiogroup"]`);
601
632
  return b ? Array.from(b.querySelectorAll('[role="radio"]')) : [];
@@ -603,31 +634,31 @@ function ee(o, r) {
603
634
  A(() => {
604
635
  const b = document.querySelector(`[id="${o}"][role="radiogroup"]`);
605
636
  if (!b) return;
606
- const u = h(), x = (C) => g(C, u), f = (C) => d(C, u), y = () => i(!0), m = () => i(!1);
637
+ const c = h(), x = (C) => g(C, c), f = (C) => d(C, c), y = () => i(!0), m = () => i(!1);
607
638
  return document.addEventListener("keydown", f), b.addEventListener("focus", x), b.addEventListener("mousedown", y), document.addEventListener("mouseup", m), () => {
608
639
  document.removeEventListener("keydown", f), b.removeEventListener("focus", x), b.removeEventListener("mousedown", y), document.removeEventListener("mouseup", m);
609
640
  };
610
641
  }, [o, h, g, d]);
611
642
  }
612
- function ge({
643
+ function ve({
613
644
  options: o = [],
614
645
  value: r,
615
646
  onChange: e,
616
- name: a,
617
- children: t,
647
+ name: t,
648
+ children: a,
618
649
  className: n = "",
619
650
  childrenClassName: s = "",
620
651
  hideInputs: i = !1
621
652
  }) {
622
- const l = E(), g = a || `radio-group-${l}`;
653
+ const u = E(), g = t || `radio-group-${u}`;
623
654
  ee(
624
655
  g,
625
656
  o.findIndex((d) => d === r)
626
657
  );
627
658
  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
659
  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(
630
- z,
660
+ p.length > 0 && p.map((d, h) => /* @__PURE__ */ l(
661
+ L,
631
662
  {
632
663
  value: d.value,
633
664
  isSelected: r === d.value,
@@ -641,8 +672,8 @@ function ge({
641
672
  },
642
673
  `${d.value}-${h}`
643
674
  )),
644
- p.length === 0 && t && I.Children.map(t, (d) => I.isValidElement(d) && d.type === z ? /* @__PURE__ */ c(
645
- z,
675
+ p.length === 0 && a && I.Children.map(a, (d) => I.isValidElement(d) && d.type === L ? /* @__PURE__ */ l(
676
+ L,
646
677
  {
647
678
  ...d.props,
648
679
  className: v(s, d.props.className),
@@ -656,21 +687,21 @@ function ge({
656
687
  ] });
657
688
  }
658
689
  function re({ elementId: o, maxLength: r }) {
659
- const [e, a] = N(0);
690
+ const [e, t] = N(0);
660
691
  return A(() => {
661
- const t = document.getElementById(o);
662
- if (!t)
692
+ const a = document.getElementById(o);
693
+ if (!a)
663
694
  return;
664
695
  const n = () => {
665
- const s = t.value.length;
666
- a(s);
696
+ const s = a.value.length;
697
+ t(s);
667
698
  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");
699
+ 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
700
  };
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");
701
+ return n(), a.addEventListener("input", n), a.setAttribute("maxlength", String(r)), () => {
702
+ a.removeEventListener("input", n), a.removeAttribute("maxlength"), a.removeAttribute("aria-describedby"), a.removeAttribute("aria-invalid"), a.removeAttribute("data-error");
672
703
  };
673
- }, [o, r]), /* @__PURE__ */ c(
704
+ }, [o, r]), /* @__PURE__ */ l(
674
705
  "small",
675
706
  {
676
707
  className: v(
@@ -697,11 +728,11 @@ function te(o, r) {
697
728
  e.style.height = "auto";
698
729
  return;
699
730
  }
700
- const a = () => {
731
+ const t = () => {
701
732
  e.style.height = "auto", e.style.height = `${e.scrollHeight}px`;
702
733
  };
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);
734
+ return t(), e.addEventListener("input", t), e.addEventListener("resize", t), window.addEventListener("resize", t), () => {
735
+ e.removeEventListener("input", t), e.removeEventListener("resize", t), window.removeEventListener("resize", t);
705
736
  };
706
737
  }, [o, r]);
707
738
  }
@@ -715,39 +746,39 @@ const ae = {
715
746
  md: "rounded-md",
716
747
  lg: "rounded-lg",
717
748
  full: "px-3 rounded-full"
718
- }, S = {
749
+ }, k = {
719
750
  variant: "outline",
720
751
  rounded: "none"
721
752
  };
722
753
  function pe({
723
- variant: o = S.variant,
754
+ variant: o = k.variant,
724
755
  rounded: r,
725
756
  displayOnlyMode: e = !1,
726
- errorMessage: a,
727
- successMessage: t,
757
+ errorMessage: t,
758
+ successMessage: a,
728
759
  hideResizeHandle: n = !1,
729
760
  autoExpand: s = !1,
730
761
  characterLimit: i = 0,
731
- className: l,
762
+ className: u,
732
763
  ...g
733
764
  }) {
734
765
  const p = E();
735
766
  te(p, s || e);
736
767
  let d = r;
737
- o === "outline" && !r && (d = "md"), d = d || S.rounded;
768
+ o === "outline" && !r && (d = "md"), d = d || k.rounded;
738
769
  let h = n;
739
770
  (e || o === "left-line" && !n) && (h = !0);
740
- const u = v(
771
+ const c = v(
741
772
  "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
773
  !e && ae[o],
743
774
  !e && ne[d],
744
775
  !e && "px-2 py-1",
745
776
  e && "pointer-events-none",
746
777
  h && "no-resize-handle",
747
- l
778
+ u
748
779
  );
749
780
  return /* @__PURE__ */ w("div", { className: v("-space-y-1.5", e && "cursor-text"), children: [
750
- /* @__PURE__ */ c(
781
+ /* @__PURE__ */ l(
751
782
  "textarea",
752
783
  {
753
784
  ...g,
@@ -758,26 +789,27 @@ function pe({
758
789
  style: {
759
790
  resize: s ? "none" : void 0
760
791
  },
761
- className: u
792
+ className: c
762
793
  }
763
794
  ),
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 })
795
+ i > 0 && /* @__PURE__ */ l(re, { elementId: p, maxLength: i }),
796
+ !e && /* @__PURE__ */ l(D, { elementId: p, type: "error", message: t }),
797
+ !e && /* @__PURE__ */ l(D, { elementId: p, type: "success", message: a })
767
798
  ] });
768
799
  }
769
800
  export {
770
801
  le as Accordion,
771
- k as AccordionItem,
802
+ j as AccordionItem,
772
803
  ue as Button,
773
804
  _ as ButtonLoadingDots,
774
805
  ce as Checkbox,
775
- fe as Input,
776
- be as Label,
777
- ge as RadioGroup,
778
- z as RadioGroupItem,
779
- M as RadioInput,
780
- me as Slot,
806
+ fe as Clickable,
807
+ be as Input,
808
+ me as Label,
809
+ ve as RadioGroup,
810
+ L as RadioGroupItem,
811
+ P as RadioInput,
812
+ ge as Slot,
781
813
  pe as Textarea
782
814
  };
783
815
  //# sourceMappingURL=components.esm.js.map