@moondreamsdev/dreamer-ui 1.6.0 → 1.6.2

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