@moondreamsdev/dreamer-ui 1.5.9 → 1.6.1

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