@moondreamsdev/dreamer-ui 1.1.4 → 1.1.6

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.
@@ -0,0 +1,656 @@
1
+ import { jsx as u, jsxs as C } from "react/jsx-runtime";
2
+ import { j as v, E as S, C as F, b as V, a as q, Q as G } from "./join-DATGxH1G.js";
3
+ import j, { useState as N, useEffect as A, useCallback as E, useId as $, useMemo as R } from "react";
4
+ function H() {
5
+ const [o, r] = N(0);
6
+ return A(() => {
7
+ const e = setInterval(() => {
8
+ r((a) => (a + 1) % 3);
9
+ }, 500);
10
+ return () => clearInterval(e);
11
+ }, []), /* @__PURE__ */ u("div", { className: "absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle", children: [0, 1, 2].map((e) => /* @__PURE__ */ u(
12
+ "div",
13
+ {
14
+ className: v(
15
+ "rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current",
16
+ o === e && "transform -translate-y-1"
17
+ )
18
+ },
19
+ e
20
+ )) });
21
+ }
22
+ const K = {
23
+ base: "",
24
+ primary: "bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-muted disabled:text-muted-foreground",
25
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/85 disabled:bg-muted/80 disabled:text-muted-foreground/80",
26
+ tertiary: "text-primary hover:text-primary-foreground disabled:text-muted",
27
+ outline: "border border-primary text-primary hover:border-primary-foreground hover:text-primary-foreground disabled:border-muted disabled:text-muted",
28
+ link: "underline-offset-4 hover:underline disabled:underline disabled:text-muted",
29
+ danger: "bg-danger text-danger-foreground hover:bg-danger/85 disabled:bg-muted disabled:text-muted-foreground"
30
+ }, T = {
31
+ stripped: "",
32
+ fitted: "size-fit",
33
+ sm: "px-2 py-1 text-sm",
34
+ md: "px-4 py-2 text-base",
35
+ lg: "px-6 py-3 text-lg",
36
+ icon: "p-1 w-fit aspect-square",
37
+ full: "p-2 w-full"
38
+ }, Q = {
39
+ none: "rounded-none",
40
+ sm: "rounded-sm",
41
+ md: "rounded-md",
42
+ lg: "rounded-lg",
43
+ full: "rounded-full"
44
+ }, L = {
45
+ variant: "primary",
46
+ size: "md",
47
+ rounded: "md"
48
+ };
49
+ function ae({
50
+ variant: o = L.variant,
51
+ size: r,
52
+ rounded: e = L.rounded,
53
+ loading: a,
54
+ linkTo: t,
55
+ linkProps: n,
56
+ type: d = "button",
57
+ className: i,
58
+ ...l
59
+ }) {
60
+ let f;
61
+ o === "link" && !r ? f = "fitted" : f = r || L.size;
62
+ const s = v(
63
+ "appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",
64
+ K[o],
65
+ T[f],
66
+ Q[e],
67
+ a && "relative pointer-events-none",
68
+ t && "relative",
69
+ i
70
+ );
71
+ return /* @__PURE__ */ C(
72
+ "button",
73
+ {
74
+ ...l,
75
+ role: t ? "link" : l.role,
76
+ "aria-label": l["aria-label"] || (n == null ? void 0 : n["aria-label"]),
77
+ "aria-description": l["aria-description"] || (n == null ? void 0 : n["aria-description"]),
78
+ "aria-disabled": l.disabled || a,
79
+ "aria-busy": a,
80
+ type: d,
81
+ className: s,
82
+ children: [
83
+ a && /* @__PURE__ */ u(H, {}),
84
+ /* @__PURE__ */ u("span", { className: v(a && "invisible"), children: l.children }),
85
+ t && !l.disabled && /* @__PURE__ */ u(
86
+ "a",
87
+ {
88
+ ...n,
89
+ "aria-hidden": !0,
90
+ href: t,
91
+ target: (n == null ? void 0 : n.target) || "_blank",
92
+ rel: (n == null ? void 0 : n.rel) || "noreferrer",
93
+ className: "absolute inset-0"
94
+ }
95
+ )
96
+ ]
97
+ }
98
+ );
99
+ }
100
+ function U({ size: o = 15, color: r = "currentColor" }) {
101
+ return /* @__PURE__ */ u("svg", { width: o, height: o, className: "inline", viewBox: "0 0 15 15", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ u(
102
+ "path",
103
+ {
104
+ d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
105
+ fill: r,
106
+ fillRule: "evenodd",
107
+ clipRule: "evenodd"
108
+ }
109
+ ) });
110
+ }
111
+ function W(o) {
112
+ const [r, e] = N(""), a = E((t) => {
113
+ let n = t, d = "";
114
+ for (; n && !d; ) {
115
+ const i = window.getComputedStyle(n).backgroundColor;
116
+ i && i !== "transparent" && i !== "rgba(0, 0, 0, 0)" && (d = i), n = n.parentElement;
117
+ }
118
+ return d || "transparent";
119
+ }, []);
120
+ return A(() => {
121
+ const t = document.getElementById(o);
122
+ if (t) {
123
+ const n = a(t.parentElement);
124
+ e(n);
125
+ }
126
+ }, [o, a]), r;
127
+ }
128
+ function ne({
129
+ ref: o,
130
+ id: r,
131
+ size: e = 20,
132
+ color: a,
133
+ filled: t = !1,
134
+ rounded: n = !0,
135
+ checked: d = !1,
136
+ onCheckedChange: i,
137
+ disabled: l,
138
+ className: f = "",
139
+ ...m
140
+ }) {
141
+ const s = $(), g = R(() => r || `checkbox-${s}`, [r, s]), b = W(g), [c, h] = N(d);
142
+ A(() => {
143
+ h(d);
144
+ }, [d]);
145
+ const w = () => {
146
+ l || (h(!c), i == null || i(!c));
147
+ }, p = (y) => {
148
+ y.key === " " && (y.preventDefault(), w());
149
+ }, x = v(
150
+ "flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",
151
+ n && "rounded",
152
+ l && "opacity-40 cursor-not-allowed",
153
+ !l && "cursor-pointer",
154
+ f
155
+ );
156
+ return /* @__PURE__ */ u(
157
+ "button",
158
+ {
159
+ id: g,
160
+ type: "button",
161
+ ref: o,
162
+ tabIndex: 0,
163
+ role: "checkbox",
164
+ onClick: w,
165
+ "aria-checked": c,
166
+ "aria-disabled": l,
167
+ onKeyDownCapture: p,
168
+ style: {
169
+ width: e,
170
+ height: e,
171
+ color: a,
172
+ backgroundColor: c && t ? "currentcolor" : "transparent"
173
+ },
174
+ className: x,
175
+ ...m,
176
+ children: c && /* @__PURE__ */ u(U, { size: e, color: t ? b : void 0 })
177
+ }
178
+ );
179
+ }
180
+ const Z = {
181
+ base: "",
182
+ default: "ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-danger not-disabled:data-success:ring-success",
183
+ 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",
184
+ outline: "border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success"
185
+ }, _ = {
186
+ none: "rounded-none",
187
+ sm: "rounded-sm",
188
+ md: "rounded-md",
189
+ lg: "rounded-lg",
190
+ full: "px-3 rounded-full"
191
+ }, k = {
192
+ variant: "default",
193
+ rounded: "none"
194
+ };
195
+ function D({ elementId: o, type: r, message: e }) {
196
+ return A(() => {
197
+ const a = document.getElementById(o);
198
+ if (a) {
199
+ if (!e && r === "error") {
200
+ a.removeAttribute("data-error");
201
+ return;
202
+ }
203
+ if (!e && r === "success") {
204
+ a.removeAttribute("data-success");
205
+ return;
206
+ }
207
+ 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"), () => {
208
+ a.removeAttribute("aria-describedby"), a.removeAttribute("aria-invalid"), a.removeAttribute("data-error"), a.removeAttribute("data-success");
209
+ };
210
+ }
211
+ }, [o, r, e]), e ? /* @__PURE__ */ C(
212
+ "small",
213
+ {
214
+ className: v(
215
+ "mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",
216
+ r === "error" && "text-danger",
217
+ r === "success" && "text-success"
218
+ ),
219
+ role: "status",
220
+ children: [
221
+ r === "error" ? /* @__PURE__ */ u(S, {}) : /* @__PURE__ */ u(F, {}),
222
+ /* @__PURE__ */ u("span", { id: `${o}-${r}-message`, children: e })
223
+ ]
224
+ }
225
+ ) : null;
226
+ }
227
+ function oe({
228
+ variant: o = k.variant,
229
+ rounded: r,
230
+ displayOnlyMode: e = !1,
231
+ errorMessage: a,
232
+ successMessage: t,
233
+ type: n = "text",
234
+ className: d,
235
+ ...i
236
+ }) {
237
+ const l = $(), [f, m] = N(!1);
238
+ let s = r;
239
+ o === "outline" && !r && (s = "md"), s = s || k.rounded;
240
+ const c = v(
241
+ "appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",
242
+ "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",
243
+ !e && Z[o],
244
+ !e && _[s],
245
+ n === "password" && "pr-10",
246
+ !e && "px-2 py-1",
247
+ e && "pointer-events-none",
248
+ d
249
+ );
250
+ return /* @__PURE__ */ C("div", { className: v(e && "cursor-text"), style: { height: i.height, width: i.width }, children: [
251
+ /* @__PURE__ */ C("div", { className: v(n === "password" && "relative"), children: [
252
+ /* @__PURE__ */ u(
253
+ "input",
254
+ {
255
+ ...i,
256
+ id: l,
257
+ type: n === "password" && f ? "text" : n,
258
+ "aria-disabled": i.disabled,
259
+ readOnly: e,
260
+ "aria-readonly": e || i["aria-readonly"],
261
+ "data-error": a ? !0 : void 0,
262
+ "data-success": t ? !0 : void 0,
263
+ className: c
264
+ }
265
+ ),
266
+ n === "password" && /* @__PURE__ */ u(
267
+ "button",
268
+ {
269
+ onClick: () => m(!f),
270
+ className: "absolute inset-y-0 right-0 px-2 hover:cursor-pointer",
271
+ "aria-label": "Toggle password visibility",
272
+ "data-state": f ? "visible" : "hidden",
273
+ children: f ? /* @__PURE__ */ u(V, { size: 20 }) : /* @__PURE__ */ u(q, { size: 20 })
274
+ }
275
+ )
276
+ ] }),
277
+ !e && /* @__PURE__ */ u(D, { elementId: l, type: "error", message: a }),
278
+ !e && /* @__PURE__ */ u(D, { elementId: l, type: "success", message: t })
279
+ ] });
280
+ }
281
+ function se({
282
+ display: o = "inline",
283
+ width: r = "fit-content",
284
+ className: e = "",
285
+ required: a,
286
+ helpMessage: t,
287
+ suffix: n,
288
+ htmlFor: d,
289
+ children: i,
290
+ ...l
291
+ }) {
292
+ const f = $(), m = v("font-medium", o, e), s = t ? `${d ?? f}-help` : void 0;
293
+ return /* @__PURE__ */ C("div", { style: { display: o === "inline" ? "inline-flex" : "flex", width: r }, className: "relative", children: [
294
+ /* @__PURE__ */ C("label", { className: m, htmlFor: d, ...l, children: [
295
+ i,
296
+ a && /* @__PURE__ */ u("span", { className: "text-red-500 font-medium ml-1", "aria-label": "required", children: "*" })
297
+ ] }),
298
+ t && /* @__PURE__ */ u(
299
+ "span",
300
+ {
301
+ className: "text-gray-500 ml-1 size-fit -translate-y-1/3",
302
+ "aria-describedby": s,
303
+ "aria-label": "Help information",
304
+ title: t,
305
+ children: /* @__PURE__ */ u(G, {})
306
+ }
307
+ ),
308
+ t && /* @__PURE__ */ u("div", { id: s, className: "sr-only", children: t }),
309
+ n && /* @__PURE__ */ u("span", { className: "ml-1", children: n })
310
+ ] });
311
+ }
312
+ function J({ itemId: o, checked: r, onChange: e, name: a, disabled: t = !1, className: n = "" }) {
313
+ const d = "relative inline-flex items-center justify-center rounded-full", i = () => {
314
+ t || e();
315
+ }, l = v(
316
+ d,
317
+ !r && "hover:border-current/60",
318
+ !t && "border-current cursor-pointer",
319
+ t && "border-muted/60 cursor-not-allowed",
320
+ n
321
+ );
322
+ return /* @__PURE__ */ u(
323
+ "div",
324
+ {
325
+ id: o,
326
+ role: "radio",
327
+ tabIndex: -1,
328
+ "aria-checked": r,
329
+ "aria-disabled": t,
330
+ "aria-description": `Radio button for ${a}`,
331
+ "aria-labelledby": `${o}-label`,
332
+ onClick: i,
333
+ className: l,
334
+ style: {
335
+ width: "1em",
336
+ height: "1em",
337
+ padding: "0.1em",
338
+ borderWidth: "0.06em"
339
+ },
340
+ children: r && /* @__PURE__ */ u(
341
+ "div",
342
+ {
343
+ className: v("size-full aspect-square rounded-full", t && "bg-muted/60", !t && "bg-current")
344
+ }
345
+ )
346
+ }
347
+ );
348
+ }
349
+ function I({
350
+ value: o,
351
+ children: r,
352
+ className: e = "",
353
+ isSelected: a = !1,
354
+ onChange: t,
355
+ disabled: n = !1,
356
+ hideInput: d = !1,
357
+ description: i,
358
+ name: l
359
+ }) {
360
+ const m = `radio-${$()}-${o}`, s = () => {
361
+ n || t == null || t(o);
362
+ };
363
+ return /* @__PURE__ */ C(
364
+ "div",
365
+ {
366
+ title: i,
367
+ className: v(
368
+ "relative flex items-center",
369
+ e,
370
+ // Uses text color for borders
371
+ d && `p-2 border-2 focus-within:border-dashed focus-within:${n ? "border-current/50" : "border-current/80"}`,
372
+ d && !a && `border-transparent ${n ? "" : "not-focus-within:hover:border-border/60"}`,
373
+ d && a && "border-border",
374
+ n && "opacity-60 cursor-not-allowed"
375
+ ),
376
+ style: {
377
+ gap: "0.5em"
378
+ },
379
+ children: [
380
+ !d && /* @__PURE__ */ u(
381
+ J,
382
+ {
383
+ itemId: m,
384
+ name: l || "",
385
+ checked: a,
386
+ onChange: s,
387
+ disabled: n,
388
+ className: v(d && "")
389
+ }
390
+ ),
391
+ /* @__PURE__ */ u(
392
+ "div",
393
+ {
394
+ id: d ? m : void 0,
395
+ tabIndex: d ? -1 : void 0,
396
+ role: d ? "radio" : void 0,
397
+ onClick: d ? s : void 0,
398
+ "aria-checked": d ? a ? "true" : "false" : void 0,
399
+ "aria-disabled": d ? n : void 0,
400
+ "aria-description": d ? i || `Radio button for ${l}` : void 0,
401
+ "aria-labelledby": d ? `${m}-label` : void 0,
402
+ className: v(d && "size-full", typeof r == "object" && "grow focus:outline-none"),
403
+ children: /* @__PURE__ */ u(
404
+ "label",
405
+ {
406
+ id: `${m}-label`,
407
+ onClick: d ? void 0 : s,
408
+ className: v(n && "cursor-not-allowed", !n && "cursor-pointer"),
409
+ children: r
410
+ }
411
+ )
412
+ }
413
+ )
414
+ ]
415
+ }
416
+ );
417
+ }
418
+ function X(o, r) {
419
+ const [e, a] = N(r), [t, n] = N(-1), [d, i] = N(!1), l = E((b, c) => {
420
+ var p;
421
+ const h = b[c];
422
+ h.hasAttribute("disabled") || h.getAttribute("aria-disabled") === "true" || ((p = b[c]) == null || p.click(), n(c));
423
+ }, []), f = E(
424
+ (b, c) => {
425
+ var w;
426
+ if (b.preventDefault(), d || !c.length) return;
427
+ const h = r !== -1 ? r : 0;
428
+ (w = c[h]) == null || w.focus(), a(h), r !== -1 && l(c, h);
429
+ },
430
+ [r, d, l]
431
+ ), m = E(
432
+ (b) => {
433
+ var p;
434
+ if (!b.shiftKey)
435
+ return;
436
+ b.preventDefault();
437
+ const c = Array.from(
438
+ document.querySelectorAll(
439
+ 'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
440
+ )
441
+ ).filter((x) => !x.hasAttribute("disabled") && x.tabIndex >= 0), h = c.findIndex((x) => x.id === o), w = h > 0 ? h - 1 : c.length - 1;
442
+ (p = c[w]) == null || p.focus();
443
+ },
444
+ [o]
445
+ ), s = E(
446
+ (b, c) => {
447
+ var y;
448
+ if (!c.length) return;
449
+ const h = b.target;
450
+ if (!c.some((B) => B.id === h.id)) return;
451
+ const p = e !== -1 ? e : 0;
452
+ let x = p;
453
+ switch (b.key) {
454
+ case "ArrowUp":
455
+ case "ArrowLeft":
456
+ b.preventDefault(), x = p > 0 ? p - 1 : c.length - 1;
457
+ break;
458
+ case "ArrowDown":
459
+ case "ArrowRight":
460
+ b.preventDefault(), x = (p + 1) % c.length;
461
+ break;
462
+ // Select the option when the space key is pressed
463
+ case " ":
464
+ b.preventDefault(), l(c, p);
465
+ return;
466
+ case "Tab":
467
+ m(b);
468
+ return;
469
+ default:
470
+ return;
471
+ }
472
+ (y = c[x]) == null || y.focus(), a(x), t !== -1 && l(c, x);
473
+ },
474
+ [e, t, m, l]
475
+ ), g = E(() => {
476
+ const b = document.querySelector(`[id="${o}"][role="radiogroup"]`);
477
+ return b ? Array.from(b.querySelectorAll('[role="radio"]')) : [];
478
+ }, [o]);
479
+ A(() => {
480
+ const b = document.querySelector(`[id="${o}"][role="radiogroup"]`);
481
+ if (!b) return;
482
+ const c = g(), h = (y) => f(y, c), w = (y) => s(y, c), p = () => i(!0), x = () => i(!1);
483
+ return document.addEventListener("keydown", w), b.addEventListener("focus", h), b.addEventListener("mousedown", p), document.addEventListener("mouseup", x), () => {
484
+ document.removeEventListener("keydown", w), b.removeEventListener("focus", h), b.removeEventListener("mousedown", p), document.removeEventListener("mouseup", x);
485
+ };
486
+ }, [o, g, f, s]);
487
+ }
488
+ function de({
489
+ options: o = [],
490
+ value: r,
491
+ onChange: e,
492
+ name: a,
493
+ children: t,
494
+ className: n = "",
495
+ childrenClassName: d = "",
496
+ hideInputs: i = !1
497
+ }) {
498
+ const l = $(), f = a || `radio-group-${l}`;
499
+ X(
500
+ f,
501
+ o.findIndex((s) => s === r)
502
+ );
503
+ const m = R(() => o.reduce((s, g) => (typeof g == "string" ? s.some((b) => b.value === g) || s.push({ label: g, value: g }) : s.push(g), s), []), [o]);
504
+ return /* @__PURE__ */ C("div", { id: f, role: "radiogroup", tabIndex: 0, className: v(n, "focus:outline-none"), children: [
505
+ m.length > 0 && m.map((s, g) => /* @__PURE__ */ u(
506
+ I,
507
+ {
508
+ value: s.value,
509
+ isSelected: r === s.value,
510
+ onChange: e,
511
+ name: f,
512
+ disabled: s.disabled,
513
+ description: s.description,
514
+ hideInput: i,
515
+ className: d,
516
+ children: s.label
517
+ },
518
+ `${s.value}-${g}`
519
+ )),
520
+ m.length === 0 && t && j.Children.map(t, (s) => j.isValidElement(s) && s.type === I ? /* @__PURE__ */ u(
521
+ I,
522
+ {
523
+ ...s.props,
524
+ className: v(d, s.props.className),
525
+ hideInput: s.props.hideInput || i,
526
+ isSelected: r === s.props.value,
527
+ onChange: e,
528
+ name: f,
529
+ children: s.props.children
530
+ }
531
+ ) : null)
532
+ ] });
533
+ }
534
+ function Y(o, r) {
535
+ A(() => {
536
+ const e = document.getElementById(o);
537
+ if (!e)
538
+ return;
539
+ if (!r) {
540
+ e.style.height = "auto";
541
+ return;
542
+ }
543
+ const a = () => {
544
+ e.style.height = "auto", e.style.height = `${e.scrollHeight}px`;
545
+ };
546
+ return a(), e.addEventListener("input", a), e.addEventListener("resize", a), window.addEventListener("resize", a), () => {
547
+ e.removeEventListener("input", a), e.removeEventListener("resize", a), window.removeEventListener("resize", a);
548
+ };
549
+ }, [o, r]);
550
+ }
551
+ const O = {
552
+ base: "",
553
+ "left-line": "border-l border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success",
554
+ outline: "border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success"
555
+ }, M = {
556
+ none: "rounded-none",
557
+ sm: "rounded-sm",
558
+ md: "rounded-md",
559
+ lg: "rounded-lg",
560
+ full: "px-3 rounded-full"
561
+ }, z = {
562
+ variant: "outline",
563
+ rounded: "none"
564
+ };
565
+ function P({ elementId: o, maxLength: r }) {
566
+ const [e, a] = N(0);
567
+ return A(() => {
568
+ const t = document.getElementById(o);
569
+ if (!t)
570
+ return;
571
+ const n = () => {
572
+ const d = t.value.length;
573
+ a(d);
574
+ const i = d >= r;
575
+ t.setAttribute("aria-describedby", `${o}-character-count`), t.setAttribute("aria-invalid", i ? "true" : "false"), i ? t.setAttribute("data-error", "true") : t.removeAttribute("data-error");
576
+ };
577
+ return n(), t.addEventListener("input", n), t.setAttribute("maxlength", String(r)), () => {
578
+ t.removeEventListener("input", n), t.removeAttribute("maxlength"), t.removeAttribute("aria-describedby"), t.removeAttribute("aria-invalid"), t.removeAttribute("data-error");
579
+ };
580
+ }, [o, r]), /* @__PURE__ */ u(
581
+ "small",
582
+ {
583
+ className: v(
584
+ "mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",
585
+ e >= r && "text-danger",
586
+ e < r && "text-current"
587
+ ),
588
+ role: "status",
589
+ children: /* @__PURE__ */ C("span", { id: `${o}-character-count`, children: [
590
+ e,
591
+ " / ",
592
+ r,
593
+ " characters"
594
+ ] })
595
+ }
596
+ );
597
+ }
598
+ function ie({
599
+ variant: o = z.variant,
600
+ rounded: r,
601
+ displayOnlyMode: e = !1,
602
+ errorMessage: a,
603
+ successMessage: t,
604
+ hideResizeHandle: n = !1,
605
+ autoExpand: d = !1,
606
+ characterLimit: i = 0,
607
+ className: l,
608
+ ...f
609
+ }) {
610
+ const m = $();
611
+ Y(m, d || e);
612
+ let s = r;
613
+ o === "outline" && !r && (s = "md"), s = s || z.rounded;
614
+ let g = n;
615
+ (e || o === "left-line" && !n) && (g = !0);
616
+ const c = v(
617
+ "appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",
618
+ !e && O[o],
619
+ !e && M[s],
620
+ !e && "px-2 py-1",
621
+ e && "pointer-events-none",
622
+ g && "no-resize-handle",
623
+ l
624
+ );
625
+ return /* @__PURE__ */ C("div", { className: v("-space-y-1.5", e && "cursor-text"), children: [
626
+ /* @__PURE__ */ u(
627
+ "textarea",
628
+ {
629
+ ...f,
630
+ id: m,
631
+ "aria-disabled": f.disabled,
632
+ readOnly: e,
633
+ "aria-readonly": e || f["aria-readonly"],
634
+ style: {
635
+ resize: d ? "none" : void 0
636
+ },
637
+ className: c
638
+ }
639
+ ),
640
+ i > 0 && /* @__PURE__ */ u(P, { elementId: m, maxLength: i }),
641
+ !e && /* @__PURE__ */ u(D, { elementId: m, type: "error", message: a }),
642
+ !e && /* @__PURE__ */ u(D, { elementId: m, type: "success", message: t })
643
+ ] });
644
+ }
645
+ export {
646
+ ae as Button,
647
+ H as ButtonLoadingDots,
648
+ ne as Checkbox,
649
+ oe as Input,
650
+ se as Label,
651
+ de as RadioGroup,
652
+ I as RadioGroupItem,
653
+ J as RadioInput,
654
+ ie as Textarea
655
+ };
656
+ //# sourceMappingURL=components.esm.js.map