@moondreamsdev/dreamer-ui 1.7.4-test.8 → 1.7.6-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.
Files changed (39) hide show
  1. package/dist/components.cjs.js +1 -1
  2. package/dist/components.cjs.js.map +1 -1
  3. package/dist/components.esm.js +680 -481
  4. package/dist/components.esm.js.map +1 -1
  5. package/dist/hooks.cjs.js +2 -0
  6. package/dist/hooks.cjs.js.map +1 -0
  7. package/dist/hooks.esm.js +6 -0
  8. package/dist/hooks.esm.js.map +1 -0
  9. package/dist/providers.cjs.js +2 -0
  10. package/dist/providers.cjs.js.map +1 -0
  11. package/dist/providers.esm.js +72 -0
  12. package/dist/providers.esm.js.map +1 -0
  13. package/dist/src/components/accordion/AccordionItem.d.ts +1 -0
  14. package/dist/src/components/actionmodal/ActionModal.d.ts +21 -0
  15. package/dist/src/components/actionmodal/index.d.ts +2 -0
  16. package/dist/src/components/button/variants.d.ts +1 -1
  17. package/dist/src/components/clickable/Clickable.d.ts +1 -0
  18. package/dist/src/components/index.d.ts +3 -1
  19. package/dist/src/components/input/variants.d.ts +3 -3
  20. package/dist/src/components/radiogroup/RadioGroup.d.ts +2 -2
  21. package/dist/src/components/radiogroup/RadioGroupItem.d.ts +1 -0
  22. package/dist/src/components/textarea/variants.d.ts +2 -2
  23. package/dist/src/components/tooltip/Tooltip.d.ts +25 -0
  24. package/dist/src/components/tooltip/hooks.d.ts +28 -0
  25. package/dist/src/components/tooltip/index.d.ts +2 -0
  26. package/dist/src/hooks/index.d.ts +1 -0
  27. package/dist/src/hooks/useActionModal.d.ts +4 -0
  28. package/dist/src/providers/ActionModalProvider.d.ts +21 -0
  29. package/dist/src/providers/index.d.ts +1 -0
  30. package/dist/styles-BqvnMUW1.cjs +2 -0
  31. package/dist/styles-BqvnMUW1.cjs.map +1 -0
  32. package/dist/styles-DUXNGn3s.js +289 -0
  33. package/dist/styles-DUXNGn3s.js.map +1 -0
  34. package/dist/theme.css +2 -2
  35. package/dist/useActionModal-BXwArRwi.cjs +2 -0
  36. package/dist/useActionModal-BXwArRwi.cjs.map +1 -0
  37. package/dist/useActionModal-C4X_-O9_.js +13 -0
  38. package/dist/useActionModal-C4X_-O9_.js.map +1 -0
  39. package/package.json +11 -1
@@ -1,123 +1,125 @@
1
- import { jsxs as w, jsx as d, Fragment as G } from "react/jsx-runtime";
2
- import I, { useId as A, useState as C, createElement as V, useEffect as E, useCallback as $, useMemo as F, useRef as Q, isValidElement as U, cloneElement as W } from "react";
3
- import { join as p } from "./utils.esm.js";
4
- import { b as X, C as _, E as J, a as Y, d as Z, c as M, Q as O, X as P } from "./QuestionMarkCircled-JRFAPLtT.js";
5
- import { createPortal as ee } from "react-dom";
6
- function L({
1
+ import { jsxs as N, jsx as c, Fragment as _ } from "react/jsx-runtime";
2
+ import T, { useId as $, useState as x, createElement as X, useEffect as E, useCallback as A, useMemo as Z, useRef as z, isValidElement as M, cloneElement as O } from "react";
3
+ import { join as w } from "./utils.esm.js";
4
+ import { b as P, C as ee, E as te, a as re, d as oe, c as ne, Q as ae, X as se } from "./QuestionMarkCircled-JRFAPLtT.js";
5
+ import { n as H } from "./styles-DUXNGn3s.js";
6
+ import { A as Qe } from "./styles-DUXNGn3s.js";
7
+ import { createPortal as J } from "react-dom";
8
+ function q({
7
9
  id: n,
8
- title: r,
10
+ title: a,
9
11
  content: e,
10
- children: t,
11
- className: a = "",
12
- disabled: o = !1,
12
+ children: o,
13
+ className: t = "",
14
+ disabled: r = !1,
13
15
  isOpen: s = !1,
14
16
  onToggle: l,
15
- triggerClassName: u = "",
16
- bodyClassName: b = ""
17
+ triggerClassName: d = "",
18
+ bodyClassName: u = ""
17
19
  }) {
18
- const v = A(), i = n || `accordion-item-${v}`, x = `${i}-header`, m = `${i}-panel`, c = () => {
19
- !o && l && l();
20
- }, y = (f) => {
21
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), c());
20
+ const f = $(), i = n || `accordion-item-${f}`, g = `${i}-header`, b = `${i}-panel`, m = () => {
21
+ !r && l && l();
22
+ }, v = (h) => {
23
+ (h.key === "Enter" || h.key === " ") && (h.preventDefault(), m());
22
24
  };
23
- return /* @__PURE__ */ w("div", { className: p("border-b border-gray-200", o && "opacity-60 cursor-not-allowed", a), children: [
24
- /* @__PURE__ */ w(
25
+ return /* @__PURE__ */ N("div", { className: w("border-b border-gray-200", r && "opacity-60 cursor-not-allowed", t), children: [
26
+ /* @__PURE__ */ N(
25
27
  "button",
26
28
  {
27
- id: x,
29
+ id: g,
28
30
  type: "button",
29
- className: p(
31
+ className: w(
30
32
  "w-full text-left py-3 px-4 flex justify-between items-center focus:outline focus:outline-secondary",
31
- o ? "cursor-not-allowed" : "hover:bg-gray-50/10 cursor-pointer",
32
- u
33
+ r ? "cursor-not-allowed" : "hover:bg-gray-50/10 cursor-pointer",
34
+ d
33
35
  ),
34
36
  "aria-expanded": s,
35
- "aria-controls": m,
36
- disabled: o,
37
- onClick: c,
38
- onKeyDown: y,
37
+ "aria-controls": b,
38
+ disabled: r,
39
+ onClick: m,
40
+ onKeyDown: v,
39
41
  children: [
40
- /* @__PURE__ */ d("span", { children: r }),
41
- /* @__PURE__ */ d(
42
+ /* @__PURE__ */ c("span", { children: a }),
43
+ /* @__PURE__ */ c(
42
44
  "span",
43
45
  {
44
- className: p(
46
+ className: w(
45
47
  "transform transition-transform duration-300 ease-linear",
46
48
  s ? "rotate-180" : "rotate-0"
47
49
  ),
48
50
  "aria-hidden": "true",
49
- children: /* @__PURE__ */ d(X, { size: 18 })
51
+ children: /* @__PURE__ */ c(P, { size: 18 })
50
52
  }
51
53
  )
52
54
  ]
53
55
  }
54
56
  ),
55
- /* @__PURE__ */ d(
57
+ /* @__PURE__ */ c(
56
58
  "div",
57
59
  {
58
- id: m,
60
+ id: b,
59
61
  role: "region",
60
- "aria-labelledby": x,
61
- className: p(
62
+ "aria-labelledby": g,
63
+ className: w(
62
64
  "transition-all duration-300 ease-linear px-4",
63
65
  s ? "max-h-96 opacity-100 overflow-auto py-3" : "max-h-0 opacity-0 overflow-hidden",
64
- b
66
+ u
65
67
  ),
66
- children: s && (t || e)
68
+ children: s && (o || e)
67
69
  }
68
70
  )
69
71
  ] });
70
72
  }
71
- function Ce({
73
+ function ze({
72
74
  id: n,
73
- items: r = [],
75
+ items: a = [],
74
76
  children: e,
75
- className: t = "",
76
- itemClassName: a = "",
77
- allowMultiple: o = !1,
77
+ className: o = "",
78
+ itemClassName: t = "",
79
+ allowMultiple: r = !1,
78
80
  defaultOpenItems: s = [],
79
81
  triggersClassName: l = "",
80
- bodiesClassName: u = ""
82
+ bodiesClassName: d = ""
81
83
  }) {
82
- const b = A(), v = n || `accordion-group-${b}`, [i, x] = C(new Set(s)), m = (f) => {
83
- x((h) => {
84
- const g = new Set(h);
85
- return g.has(f) ? g.delete(f) : (o || g.clear(), g.add(f)), g;
84
+ const u = $(), f = n || `accordion-group-${u}`, [i, g] = x(new Set(s)), b = (h) => {
85
+ g((y) => {
86
+ const p = new Set(y);
87
+ return p.has(h) ? p.delete(h) : (r || p.clear(), p.add(h)), p;
86
88
  });
87
- }, c = (f) => `${b}-item-${f}`, y = (f) => i.has(f);
88
- return /* @__PURE__ */ w("div", { id: v, className: t, children: [
89
- r.length > 0 && r.map((f, h) => {
90
- const g = f.id || c(h);
91
- return /* @__PURE__ */ d(
92
- L,
89
+ }, m = (h) => `${u}-item-${h}`, v = (h) => i.has(h);
90
+ return /* @__PURE__ */ N("div", { id: f, className: o, children: [
91
+ a.length > 0 && a.map((h, y) => {
92
+ const p = h.id || m(y);
93
+ return /* @__PURE__ */ c(
94
+ q,
93
95
  {
94
- id: g,
95
- title: f.title,
96
- content: f.content,
97
- disabled: f.disabled,
98
- isOpen: y(g),
99
- onToggle: () => m(g),
100
- className: a,
96
+ id: p,
97
+ title: h.title,
98
+ content: h.content,
99
+ disabled: h.disabled,
100
+ isOpen: v(p),
101
+ onToggle: () => b(p),
102
+ className: t,
101
103
  triggerClassName: l,
102
- bodyClassName: u
104
+ bodyClassName: d
103
105
  },
104
- g
106
+ p
105
107
  );
106
108
  }),
107
- r.length === 0 && e && I.Children.map(e, (f, h) => {
108
- if (I.isValidElement(f) && f.type === L) {
109
- const g = f.props.id || c(h);
110
- return /* @__PURE__ */ V(
111
- L,
109
+ a.length === 0 && e && T.Children.map(e, (h, y) => {
110
+ if (T.isValidElement(h) && h.type === q) {
111
+ const p = h.props.id || m(y);
112
+ return /* @__PURE__ */ X(
113
+ q,
112
114
  {
113
- ...f.props,
114
- key: g,
115
- id: g,
116
- className: p(a, f.props.className),
117
- isOpen: y(g),
118
- onToggle: () => m(g),
119
- triggerClassName: p(l, f.props.triggerClassName),
120
- bodyClassName: p(u, f.props.bodyClassName)
115
+ ...h.props,
116
+ key: p,
117
+ id: p,
118
+ className: w(t, h.props.className),
119
+ isOpen: v(p),
120
+ onToggle: () => b(p),
121
+ triggerClassName: w(l, h.props.triggerClassName),
122
+ bodyClassName: w(d, h.props.bodyClassName)
121
123
  }
122
124
  );
123
125
  }
@@ -125,17 +127,17 @@ function Ce({
125
127
  })
126
128
  ] });
127
129
  }
128
- function re() {
129
- const [n, r] = C(0);
130
+ function ie() {
131
+ const [n, a] = x(0);
130
132
  return E(() => {
131
133
  const e = setInterval(() => {
132
- r((t) => (t + 1) % 3);
134
+ a((o) => (o + 1) % 3);
133
135
  }, 500);
134
136
  return () => clearInterval(e);
135
- }, []), /* @__PURE__ */ d("div", { className: "absolute inset-0 inline-flex items-center justify-center gap-x-2 align-middle", children: [0, 1, 2].map((e) => /* @__PURE__ */ d(
137
+ }, []), /* @__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(
136
138
  "div",
137
139
  {
138
- className: p(
140
+ className: w(
139
141
  "rounded-full transition-all duration-500 ease-in-out size-[0.35em] bg-current",
140
142
  n === e && "transform -translate-y-1"
141
143
  )
@@ -143,15 +145,15 @@ function re() {
143
145
  e
144
146
  )) });
145
147
  }
146
- const te = {
148
+ const le = {
147
149
  base: "",
148
150
  primary: "bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-muted disabled:text-muted-foreground",
149
151
  secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/85 disabled:bg-muted/80 disabled:text-muted-foreground/80",
150
152
  tertiary: "text-primary hover:text-primary-foreground disabled:text-muted",
151
153
  outline: "border border-primary text-primary hover:border-primary-foreground hover:text-primary-foreground disabled:border-muted disabled:text-muted",
152
154
  link: "underline-offset-4 hover:underline disabled:underline disabled:text-muted",
153
- danger: "bg-danger text-danger-foreground hover:bg-danger/85 disabled:bg-muted disabled:text-muted-foreground"
154
- }, ne = {
155
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/85 disabled:bg-muted disabled:text-muted-foreground"
156
+ }, de = {
155
157
  stripped: "",
156
158
  fitted: "size-fit",
157
159
  sm: "px-2 py-1 text-sm",
@@ -159,61 +161,60 @@ const te = {
159
161
  lg: "px-6 py-3 text-lg",
160
162
  icon: "p-1 w-fit aspect-square",
161
163
  full: "p-2 w-full"
162
- }, ae = {
164
+ }, ue = {
163
165
  none: "rounded-none",
164
166
  sm: "rounded-sm",
165
167
  md: "rounded-md",
166
168
  lg: "rounded-lg",
167
169
  full: "rounded-full"
168
- }, j = {
170
+ }, K = {
169
171
  variant: "primary",
170
172
  size: "md",
171
173
  rounded: "md"
172
174
  };
173
- function oe({
174
- variant: n = j.variant,
175
- size: r,
176
- rounded: e = j.rounded,
177
- loading: t,
178
- linkTo: a,
179
- linkProps: o,
175
+ function ce({
176
+ variant: n = K.variant,
177
+ size: a,
178
+ rounded: e = K.rounded,
179
+ loading: o,
180
+ linkTo: t,
181
+ linkProps: r,
180
182
  type: s = "button",
181
183
  className: l,
182
- ...u
184
+ ...d
183
185
  }) {
184
- let b;
185
- n === "link" && !r ? b = "fitted" : b = r || j.size;
186
- const i = p(
186
+ let u;
187
+ n === "link" && !a ? u = "fitted" : u = a || K.size;
188
+ const i = w(
187
189
  "appearance-none focus:outline-none focus:ring not-disabled:hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed transition-all",
188
- te[n],
189
- ne[b],
190
- ae[e],
191
- t && "relative pointer-events-none",
192
- a && "relative",
190
+ le[n],
191
+ de[u],
192
+ ue[e],
193
+ o && "relative pointer-events-none",
194
+ t && "relative",
193
195
  l
194
196
  );
195
- return /* @__PURE__ */ w(
197
+ return /* @__PURE__ */ N(
196
198
  "button",
197
199
  {
198
- ...u,
199
- role: a ? "link" : u.role,
200
- "aria-label": u["aria-label"] || (o == null ? void 0 : o["aria-label"]),
201
- "aria-description": u["aria-description"] || (o == null ? void 0 : o["aria-description"]),
202
- "aria-disabled": u.disabled || t,
203
- "aria-busy": t,
200
+ ...d,
201
+ role: t ? "link" : d.role,
202
+ "aria-label": d["aria-label"] || (r == null ? void 0 : r["aria-label"]),
203
+ "aria-description": d["aria-description"] || (r == null ? void 0 : r["aria-description"]),
204
+ "aria-disabled": d.disabled || o,
205
+ "aria-busy": o,
204
206
  type: s,
205
207
  className: i,
206
208
  children: [
207
- t && /* @__PURE__ */ d(re, {}),
208
- /* @__PURE__ */ d("span", { className: p(t && "invisible"), children: u.children }),
209
- a && !u.disabled && /* @__PURE__ */ d(
209
+ o && /* @__PURE__ */ c(ie, {}),
210
+ /* @__PURE__ */ c("span", { className: w(o && "invisible"), children: d.children }),
211
+ t && !d.disabled && /* @__PURE__ */ c(
210
212
  "a",
211
213
  {
212
- ...o,
214
+ ...r,
213
215
  "aria-hidden": !0,
214
- href: a,
215
- target: (o == null ? void 0 : o.target) || "_blank",
216
- rel: (o == null ? void 0 : o.rel) || "noreferrer",
216
+ href: t,
217
+ rel: (r == null ? void 0 : r.rel) || "noreferrer",
217
218
  className: "absolute inset-0"
218
219
  }
219
220
  )
@@ -221,270 +222,268 @@ function oe({
221
222
  }
222
223
  );
223
224
  }
224
- function se(n) {
225
- const [r, e] = C(""), t = $((a) => {
226
- let o = a, s = "";
227
- for (; o && !s; ) {
228
- const l = window.getComputedStyle(o).backgroundColor;
229
- l && l !== "transparent" && l !== "rgba(0, 0, 0, 0)" && (s = l), o = o.parentElement;
225
+ function fe(n) {
226
+ const [a, e] = x(""), o = A((t) => {
227
+ let r = t, s = "";
228
+ for (; r && !s; ) {
229
+ const l = window.getComputedStyle(r).backgroundColor;
230
+ l && l !== "transparent" && l !== "rgba(0, 0, 0, 0)" && (s = l), r = r.parentElement;
230
231
  }
231
232
  return s || "transparent";
232
233
  }, []);
233
234
  return E(() => {
234
- const a = document.getElementById(n);
235
- if (a) {
236
- const o = t(a.parentElement);
237
- e(o);
235
+ const t = document.getElementById(n);
236
+ if (t) {
237
+ const r = o(t.parentElement);
238
+ e(r);
238
239
  }
239
- }, [n, t]), r;
240
+ }, [n, o]), a;
240
241
  }
241
- function Ee({
242
+ function Be({
242
243
  ref: n,
243
- id: r,
244
+ id: a,
244
245
  size: e = 20,
245
- color: t,
246
- filled: a = !1,
247
- rounded: o = !0,
246
+ color: o,
247
+ filled: t = !1,
248
+ rounded: r = !0,
248
249
  checked: s = !1,
249
250
  onCheckedChange: l,
250
- disabled: u,
251
- className: b = "",
252
- ...v
251
+ disabled: d,
252
+ className: u = "",
253
+ ...f
253
254
  }) {
254
- const i = A(), x = F(() => r || `checkbox-${i}`, [r, i]), m = se(x), [c, y] = C(s);
255
+ const i = $(), g = Z(() => a || `checkbox-${i}`, [a, i]), b = fe(g), [m, v] = x(s);
255
256
  E(() => {
256
- y(s);
257
+ v(s);
257
258
  }, [s]);
258
- const f = () => {
259
- u || (y(!c), l == null || l(!c));
260
- }, h = (N) => {
261
- N.key === " " && (N.preventDefault(), f());
262
- }, g = p(
259
+ const h = () => {
260
+ d || (v(!m), l == null || l(!m));
261
+ }, y = (C) => {
262
+ C.key === " " && (C.preventDefault(), h());
263
+ }, p = w(
263
264
  "flex items-center justify-center border outline outline-transparent focus:outline-current focus:outline-offset-2",
264
- o && "rounded",
265
- u && "opacity-40 cursor-not-allowed",
266
- !u && "cursor-pointer",
267
- b
265
+ r && "rounded",
266
+ d && "opacity-40 cursor-not-allowed",
267
+ !d && "cursor-pointer",
268
+ u
268
269
  );
269
- return /* @__PURE__ */ d(
270
+ return /* @__PURE__ */ c(
270
271
  "button",
271
272
  {
272
- id: x,
273
+ id: g,
273
274
  type: "button",
274
275
  ref: n,
275
276
  tabIndex: 0,
276
277
  role: "checkbox",
277
- onClick: f,
278
- "aria-checked": c,
279
- "aria-disabled": u,
280
- onKeyDownCapture: h,
278
+ onClick: h,
279
+ "aria-checked": m,
280
+ "aria-disabled": d,
281
+ onKeyDownCapture: y,
281
282
  style: {
282
283
  width: e,
283
284
  height: e,
284
- color: t,
285
- backgroundColor: c && a ? "currentcolor" : "transparent"
285
+ color: o,
286
+ backgroundColor: m && t ? "currentcolor" : "transparent"
286
287
  },
287
- className: g,
288
- ...v,
289
- children: c && /* @__PURE__ */ d(_, { size: e, color: a ? m : void 0 })
288
+ className: p,
289
+ ...f,
290
+ children: m && /* @__PURE__ */ c(ee, { size: e, color: t ? b : void 0 })
290
291
  }
291
292
  );
292
293
  }
293
- function Ae({
294
+ function je({
294
295
  children: n,
295
- className: r,
296
+ className: a,
296
297
  linkTo: e,
297
- linkProps: t,
298
- onButtonClick: a,
299
- buttonProps: o,
298
+ linkProps: o,
299
+ onButtonClick: t,
300
+ buttonProps: r,
300
301
  ...s
301
302
  }) {
302
- return e && a && console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'), /* @__PURE__ */ w("div", { className: p("relative w-fit", r), ...s, children: [
303
+ return e && t && console.warn('Clickable: Both "linkTo" and "onButtonClick" props are provided. Only "linkTo" will be used.'), /* @__PURE__ */ N("div", { className: w("relative w-fit", a), ...s, children: [
303
304
  n,
304
- e && /* @__PURE__ */ d(
305
+ e && /* @__PURE__ */ c(
305
306
  "a",
306
307
  {
307
- ...t,
308
+ ...o,
309
+ rel: (o == null ? void 0 : o.rel) || "noreferrer",
308
310
  href: e,
309
- className: p("absolute inset-0", t == null ? void 0 : t.className)
311
+ className: w("absolute inset-0", o == null ? void 0 : o.className)
310
312
  }
311
313
  ),
312
- !e && a && /* @__PURE__ */ d(
314
+ !e && t && /* @__PURE__ */ c(
313
315
  "button",
314
316
  {
315
- ...o,
317
+ ...r,
316
318
  type: "button",
317
- onClick: a,
318
- className: p("absolute inset-0 cursor-pointer", o == null ? void 0 : o.className)
319
+ onClick: t,
320
+ className: w("absolute inset-0 cursor-pointer", r == null ? void 0 : r.className)
319
321
  }
320
322
  )
321
323
  ] });
322
324
  }
323
- function D({ elementId: n, type: r, message: e }) {
325
+ function B({ elementId: n, type: a, message: e }) {
324
326
  return E(() => {
325
- const t = document.getElementById(n);
326
- if (t) {
327
- if (!e && r === "error") {
328
- t.removeAttribute("data-error");
327
+ const o = document.getElementById(n);
328
+ if (o) {
329
+ if (!e && a === "error") {
330
+ o.removeAttribute("data-error");
329
331
  return;
330
332
  }
331
- if (!e && r === "success") {
332
- t.removeAttribute("data-success");
333
+ if (!e && a === "success") {
334
+ o.removeAttribute("data-success");
333
335
  return;
334
336
  }
335
- 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"), () => {
336
- t.removeAttribute("aria-describedby"), t.removeAttribute("aria-invalid"), t.removeAttribute("data-error"), t.removeAttribute("data-success");
337
+ return o.setAttribute("aria-describedby", `${n}-${a}-message`), o.setAttribute("aria-invalid", a === "error" ? "true" : "false"), a === "error" && o.setAttribute("data-error", "true"), a === "success" && o.setAttribute("data-success", "true"), () => {
338
+ o.removeAttribute("aria-describedby"), o.removeAttribute("aria-invalid"), o.removeAttribute("data-error"), o.removeAttribute("data-success");
337
339
  };
338
340
  }
339
- }, [n, r, e]), e ? /* @__PURE__ */ w(
341
+ }, [n, a, e]), e ? /* @__PURE__ */ N(
340
342
  "small",
341
343
  {
342
- className: p(
344
+ className: w(
343
345
  "mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-start",
344
- r === "error" && "text-danger",
345
- r === "success" && "text-success"
346
+ a === "error" && "text-destructive",
347
+ a === "success" && "text-success"
346
348
  ),
347
349
  role: "status",
348
350
  children: [
349
- r === "error" ? /* @__PURE__ */ d(J, {}) : /* @__PURE__ */ d(Y, {}),
350
- /* @__PURE__ */ d("span", { id: `${n}-${r}-message`, children: e })
351
+ a === "error" ? /* @__PURE__ */ c(te, {}) : /* @__PURE__ */ c(re, {}),
352
+ /* @__PURE__ */ c("span", { id: `${n}-${a}-message`, children: e })
351
353
  ]
352
354
  }
353
355
  ) : null;
354
356
  }
355
- const ie = {
357
+ const me = {
356
358
  base: "",
357
- default: "ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-danger not-disabled:data-success:ring-success",
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",
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"
360
- }, de = {
359
+ default: "ring ring-transparent focus:ring-primary-foreground not-disabled:data-error:ring-destructive not-disabled:data-success:ring-success",
360
+ underline: "border-b border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",
361
+ outline: "border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success"
362
+ }, be = {
361
363
  none: "rounded-none",
362
364
  sm: "rounded-sm",
363
365
  md: "rounded-md",
364
366
  lg: "rounded-lg",
365
367
  full: "px-3 rounded-full"
366
- }, B = {
368
+ }, W = {
367
369
  variant: "default",
368
370
  rounded: "none"
369
371
  };
370
- function $e({
371
- variant: n = B.variant,
372
- rounded: r,
372
+ function Fe({
373
+ variant: n = W.variant,
374
+ rounded: a,
373
375
  displayOnlyMode: e = !1,
374
- errorMessage: t,
375
- successMessage: a,
376
- type: o = "text",
376
+ errorMessage: o,
377
+ successMessage: t,
378
+ type: r = "text",
377
379
  className: s,
378
380
  ...l
379
381
  }) {
380
- const u = A(), [b, v] = C(!1);
381
- let i = r;
382
- n === "outline" && !r && (i = "md"), i = i || B.rounded;
383
- const c = p(
382
+ const d = $(), [u, f] = x(!1);
383
+ let i = a;
384
+ n === "outline" && !a && (i = "md"), i = i || W.rounded;
385
+ const m = w(
384
386
  "appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",
385
387
  "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",
386
- !e && ie[n],
387
- !e && de[i],
388
- o === "password" && "pr-10",
388
+ !e && me[n],
389
+ !e && be[i],
390
+ r === "password" && "pr-10",
389
391
  !e && "px-2 py-1",
390
392
  e && "pointer-events-none",
391
393
  s
392
394
  );
393
- return /* @__PURE__ */ w("div", { className: p(e && "cursor-text"), style: { height: l.height, width: l.width }, children: [
394
- /* @__PURE__ */ w("div", { className: p(o === "password" && "relative"), children: [
395
- /* @__PURE__ */ d(
395
+ return /* @__PURE__ */ N("div", { className: w(e && "cursor-text"), style: { height: l.height, width: l.width }, children: [
396
+ /* @__PURE__ */ N("div", { className: w(r === "password" && "relative"), children: [
397
+ /* @__PURE__ */ c(
396
398
  "input",
397
399
  {
398
400
  ...l,
399
- id: u,
400
- type: o === "password" && b ? "text" : o,
401
+ id: d,
402
+ type: r === "password" && u ? "text" : r,
401
403
  "aria-disabled": l.disabled,
402
404
  readOnly: e,
403
405
  "aria-readonly": e || l["aria-readonly"],
404
- "data-error": t ? !0 : void 0,
405
- "data-success": a ? !0 : void 0,
406
- className: c
406
+ "data-error": o ? !0 : void 0,
407
+ "data-success": t ? !0 : void 0,
408
+ className: m
407
409
  }
408
410
  ),
409
- o === "password" && /* @__PURE__ */ d(
411
+ r === "password" && /* @__PURE__ */ c(
410
412
  "button",
411
413
  {
412
- onClick: () => v(!b),
414
+ onClick: () => f(!u),
413
415
  className: "absolute inset-y-0 right-0 px-2 hover:cursor-pointer",
414
416
  "aria-label": "Toggle password visibility",
415
- "data-state": b ? "visible" : "hidden",
416
- children: b ? /* @__PURE__ */ d(Z, { size: 20 }) : /* @__PURE__ */ d(M, { size: 20 })
417
+ "data-state": u ? "visible" : "hidden",
418
+ children: u ? /* @__PURE__ */ c(oe, { size: 20 }) : /* @__PURE__ */ c(ne, { size: 20 })
417
419
  }
418
420
  )
419
421
  ] }),
420
- !e && /* @__PURE__ */ d(D, { elementId: u, type: "error", message: t }),
421
- !e && /* @__PURE__ */ d(D, { elementId: u, type: "success", message: a })
422
+ !e && /* @__PURE__ */ c(B, { elementId: d, type: "error", message: o }),
423
+ !e && /* @__PURE__ */ c(B, { elementId: d, type: "success", message: t })
422
424
  ] });
423
425
  }
424
- function Ie({
426
+ function Se({
425
427
  display: n = "inline",
426
- width: r = "fit-content",
428
+ width: a = "fit-content",
427
429
  className: e = "",
428
- required: t,
429
- helpMessage: a,
430
- suffix: o,
430
+ required: o,
431
+ helpMessage: t,
432
+ suffix: r,
431
433
  htmlFor: s,
432
434
  children: l,
433
- ...u
435
+ ...d
434
436
  }) {
435
- const b = A(), v = p("font-medium", n, e), i = a ? `${s ?? b}-help` : void 0;
436
- return /* @__PURE__ */ w("div", { style: { display: n === "inline" ? "inline-flex" : "flex", width: r }, className: "relative", children: [
437
- /* @__PURE__ */ w("label", { className: v, htmlFor: s, ...u, children: [
437
+ const u = $(), f = w("font-medium", n, e), i = t ? `${s ?? u}-help` : void 0;
438
+ return /* @__PURE__ */ N("div", { style: { display: n === "inline" ? "inline-flex" : "flex", width: a }, className: "relative", children: [
439
+ /* @__PURE__ */ N("label", { className: f, htmlFor: s, ...d, children: [
438
440
  l,
439
- t && /* @__PURE__ */ d("span", { className: "text-red-500 font-medium ml-1", "aria-label": "required", children: "*" })
441
+ o && /* @__PURE__ */ c("span", { className: "text-red-500 font-medium ml-1", "aria-label": "required", children: "*" })
440
442
  ] }),
441
- a && /* @__PURE__ */ d(
443
+ t && /* @__PURE__ */ c(
442
444
  "span",
443
445
  {
444
446
  className: "text-gray-500 ml-1 size-fit -translate-y-1/3",
445
447
  "aria-describedby": i,
446
448
  "aria-label": "Help information",
447
- title: a,
448
- children: /* @__PURE__ */ d(O, {})
449
+ title: t,
450
+ children: /* @__PURE__ */ c(ae, {})
449
451
  }
450
452
  ),
451
- a && /* @__PURE__ */ d("div", { id: i, className: "sr-only", children: a }),
452
- o && /* @__PURE__ */ d("span", { className: "ml-1", children: o })
453
+ t && /* @__PURE__ */ c("div", { id: i, className: "sr-only", children: t }),
454
+ r && /* @__PURE__ */ c("span", { className: "ml-1", children: r })
453
455
  ] });
454
456
  }
455
- function z(...n) {
456
- return n.filter((r) => typeof r == "string" && r).join(" ").trim() || void 0;
457
- }
458
- function le(n) {
459
- const [r, e] = C(!1), [t, a] = C(!1);
457
+ function he(n) {
458
+ const [a, e] = x(!1), [o, t] = x(!1);
460
459
  return E(() => {
461
- n ? (a(!0), setTimeout(() => e(!0), 10)) : (e(!1), setTimeout(() => a(!1), 150));
462
- }, [n]), { show: r, shouldRender: t };
460
+ n ? (t(!0), setTimeout(() => e(!0), 10)) : (e(!1), setTimeout(() => t(!1), 150));
461
+ }, [n]), { show: a, shouldRender: o };
463
462
  }
464
- function ue(n, r) {
463
+ function pe(n, a) {
465
464
  E(() => {
466
- const e = (t) => {
467
- t.key === "Escape" && n && r();
465
+ const e = (o) => {
466
+ o.key === "Escape" && n && a();
468
467
  };
469
468
  return document.addEventListener("keydown", e), n && (document.body.style.overflow = "hidden"), () => {
470
469
  document.removeEventListener("keydown", e), document.body.style.overflow = "auto";
471
470
  };
472
- }, [n, r]);
471
+ }, [n, a]);
473
472
  }
474
- function ce(n, r) {
475
- const e = Q(null), t = $(() => {
476
- const a = document.getElementById(n);
477
- if (!a) return;
478
- const o = a.querySelectorAll('[data-modal-action="true"]');
479
- if (o.length > 0) {
480
- o[0].focus();
473
+ function ge(n, a) {
474
+ const e = z(null), o = A(() => {
475
+ const t = document.getElementById(n);
476
+ if (!t) return;
477
+ const r = t.querySelectorAll('[data-modal-action="true"]');
478
+ if (r.length > 0) {
479
+ r[0].focus();
481
480
  return;
482
481
  }
483
- const s = a.querySelectorAll(
482
+ const s = t.querySelectorAll(
484
483
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
485
484
  );
486
485
  if (s.length > 0) {
487
- const l = Array.from(s).filter((u) => !(u instanceof HTMLButtonElement && u.getAttribute("data-modal-close-button") === "true"));
486
+ const l = Array.from(s).filter((d) => !(d instanceof HTMLButtonElement && d.getAttribute("data-modal-close-button") === "true"));
488
487
  if (l.length > 0) {
489
488
  l[0].focus();
490
489
  return;
@@ -492,77 +491,77 @@ function ce(n, r) {
492
491
  s[0].focus();
493
492
  return;
494
493
  }
495
- a.focus();
494
+ t.focus();
496
495
  }, [n]);
497
- E(() => (r && (e.current = document.activeElement, t()), () => {
496
+ E(() => (a && (e.current = document.activeElement, o()), () => {
498
497
  document.body.style.overflow = "auto", e.current instanceof HTMLElement && e.current.focus();
499
- }), [r, t]);
498
+ }), [a, o]);
500
499
  }
501
- function De({
500
+ function He({
502
501
  id: n,
503
- isOpen: r,
502
+ isOpen: a,
504
503
  onClose: e,
505
- title: t,
506
- children: a,
507
- contentOnly: o = !1,
504
+ title: o,
505
+ children: t,
506
+ contentOnly: r = !1,
508
507
  className: s,
509
508
  overlayClassName: l,
510
- hideCloseButton: u = !1,
511
- actions: b = [],
512
- disableCloseOnOverlayClick: v = !1,
509
+ hideCloseButton: d = !1,
510
+ actions: u = [],
511
+ disableCloseOnOverlayClick: f = !1,
513
512
  ariaLabelledBy: i,
514
- ariaDescribedBy: x
513
+ ariaDescribedBy: g
515
514
  }) {
516
- const m = A(), c = n || `modal-${m}`, y = n ? `${n}-title` : `modal-title-${m}`, { show: f, shouldRender: h } = le(r);
517
- if (ce(c, h), ue(h, e), !h) return null;
518
- const g = () => t ? I.isValidElement(t) ? /* @__PURE__ */ d("div", { className: "mb-4", children: t }) : /* @__PURE__ */ d("h2", { className: "mb-4 text-xl font-semibold", id: y, children: t }) : null, N = () => b.length === 0 ? null : /* @__PURE__ */ d("div", { className: "mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3", children: b.map((k, q) => {
519
- const { label: T, className: H, ...K } = k;
520
- return /* @__PURE__ */ d(oe, { className: H, type: "button", ...K, "data-modal-action": "true", children: T }, q);
515
+ const b = $(), m = n || `modal-${b}`, v = n ? `${n}-title` : `modal-title-${b}`, { show: h, shouldRender: y } = he(a);
516
+ if (ge(m, y), pe(y, e), !y) return null;
517
+ const p = () => o ? T.isValidElement(o) ? /* @__PURE__ */ c("div", { className: "mb-4", children: o }) : /* @__PURE__ */ c("h2", { className: "mb-4 text-xl font-semibold", id: v, children: o }) : null, C = () => u.length === 0 ? null : /* @__PURE__ */ c("div", { className: "mt-6 not-sm:grid gap-y-2 sm:flex sm:justify-start sm:flex-row-reverse sm:gap-x-3", children: u.map((D, j) => {
518
+ const { label: F, className: L, ...R } = D;
519
+ return /* @__PURE__ */ c(ce, { className: L, type: "button", ...R, "data-modal-action": "true", children: F }, j);
521
520
  }) });
522
- return /* @__PURE__ */ d(G, { children: ee(
523
- /* @__PURE__ */ d(
521
+ return /* @__PURE__ */ c(_, { children: J(
522
+ /* @__PURE__ */ c(
524
523
  "div",
525
524
  {
526
- "aria-labelledby": i ?? t ? y : void 0,
527
- "aria-describedby": x,
525
+ "aria-labelledby": i ?? o ? v : void 0,
526
+ "aria-describedby": g,
528
527
  role: "dialog",
529
528
  "aria-modal": "true",
530
529
  className: "fixed inset-0 z-[100] overflow-y-auto",
531
- children: /* @__PURE__ */ w("div", { className: "flex min-h-screen items-center justify-center p-4", children: [
532
- /* @__PURE__ */ d(
530
+ children: /* @__PURE__ */ N("div", { className: "flex min-h-screen items-center justify-center p-4", children: [
531
+ /* @__PURE__ */ c(
533
532
  "div",
534
533
  {
535
- className: z("fixed inset-0 bg-black/20 transition-all", l),
534
+ className: H("fixed inset-0 bg-black/20 transition-all", l),
536
535
  onClick: () => {
537
- v || e();
536
+ f || e();
538
537
  }
539
538
  }
540
539
  ),
541
- o && /* @__PURE__ */ d("div", { className: z("relative w-fit", s), children: a }),
542
- !o && /* @__PURE__ */ w(
540
+ r && /* @__PURE__ */ c("div", { className: H("relative w-fit", s), children: t }),
541
+ !r && /* @__PURE__ */ N(
543
542
  "div",
544
543
  {
545
- id: c,
544
+ id: m,
546
545
  tabIndex: -1,
547
- className: z(
548
- "relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:border ease-in duration-75",
549
- f ? "opacity-100 scale-100" : "opacity-0 scale-90",
546
+ className: H(
547
+ "relative w-full max-w-xl transform rounded-lg shadow-xl transition-all p-6 bg-inherit focus:ring ease-in duration-75",
548
+ h ? "opacity-100 scale-100" : "opacity-0 scale-90",
550
549
  s
551
550
  ),
552
551
  children: [
553
- !u && /* @__PURE__ */ d(
552
+ !d && /* @__PURE__ */ c(
554
553
  "button",
555
554
  {
556
555
  type: "button",
557
556
  onClick: e,
558
557
  "data-modal-close-button": "true",
559
558
  className: "rounded-md p-0.5 top-2.5 right-2.5 absolute opacity-80 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-gray-500 leading-0",
560
- children: /* @__PURE__ */ d(P, { size: 18 })
559
+ children: /* @__PURE__ */ c(se, { size: 18 })
561
560
  }
562
561
  ),
563
- g(),
564
- a,
565
- N()
562
+ p(),
563
+ t,
564
+ C()
566
565
  ]
567
566
  }
568
567
  )
@@ -572,116 +571,104 @@ function De({
572
571
  document.body
573
572
  ) });
574
573
  }
575
- function ke({ children: n, ref: r, ...e }) {
576
- if (U(n)) {
577
- let t = { ...e };
578
- return n.props && (t = { ...t, ...n.props }), W(n, {
579
- ...t,
580
- ref: (a) => {
581
- typeof r == "function" ? r(a) : r && (r.current = a);
582
- }
583
- });
584
- }
585
- return V("div", { ...e, ref: r }, n);
586
- }
587
- function fe({ itemId: n, checked: r, onChange: e, name: t, disabled: a = !1, className: o = "" }) {
574
+ function ve({ itemId: n, checked: a, onChange: e, name: o, disabled: t = !1, className: r = "" }) {
588
575
  const s = "relative inline-flex items-center justify-center rounded-full", l = () => {
589
- a || e();
590
- }, u = p(
576
+ t || e();
577
+ }, d = w(
591
578
  s,
592
- !r && "hover:border-current/60",
593
- !a && "border-current cursor-pointer",
594
- a && "border-muted/60 cursor-not-allowed",
595
- o
579
+ !a && "hover:border-current/60",
580
+ !t && "border-current cursor-pointer",
581
+ t && "border-muted/60 cursor-not-allowed",
582
+ r
596
583
  );
597
- return /* @__PURE__ */ d(
584
+ return /* @__PURE__ */ c(
598
585
  "div",
599
586
  {
600
587
  id: n,
601
588
  role: "radio",
602
589
  tabIndex: -1,
603
- "aria-checked": r,
604
- "aria-disabled": a,
605
- "aria-description": `Radio button for ${t}`,
590
+ "aria-checked": a,
591
+ "aria-disabled": t,
592
+ "aria-description": `Radio button for ${o}`,
606
593
  "aria-labelledby": `${n}-label`,
607
594
  onClick: l,
608
- className: u,
595
+ className: d,
609
596
  style: {
610
597
  width: "1em",
611
598
  height: "1em",
612
599
  padding: "0.1em",
613
600
  borderWidth: "0.06em"
614
601
  },
615
- children: r && /* @__PURE__ */ d(
602
+ children: a && /* @__PURE__ */ c(
616
603
  "div",
617
604
  {
618
- className: p("size-full aspect-square rounded-full", a && "bg-muted/60", !a && "bg-current")
605
+ className: w("size-full aspect-square rounded-full", t && "bg-muted/60", !t && "bg-current")
619
606
  }
620
607
  )
621
608
  }
622
609
  );
623
610
  }
624
- function S({
611
+ function V({
625
612
  value: n,
626
- children: r,
613
+ children: a,
627
614
  className: e = "",
628
- isSelected: t = !1,
629
- onChange: a,
630
- disabled: o = !1,
615
+ isSelected: o = !1,
616
+ onChange: t,
617
+ disabled: r = !1,
631
618
  hideInput: s = !1,
632
619
  description: l,
633
- name: u
620
+ name: d
634
621
  }) {
635
- const v = `radio-${A()}-${n}`, i = () => {
636
- o || a == null || a(n);
622
+ const f = `radio-${$()}-${n}`, i = () => {
623
+ r || t == null || t(n);
637
624
  };
638
- return /* @__PURE__ */ w(
625
+ return /* @__PURE__ */ N(
639
626
  "div",
640
627
  {
641
628
  title: l,
642
- className: p(
629
+ className: w(
643
630
  "relative flex items-center",
644
631
  e,
645
632
  // Uses text color for borders
646
- s && `p-2 border-2 focus-within:border-dashed focus-within:${o ? "border-current/50" : "border-current/80"}`,
647
- s && !t && `border-transparent ${o ? "" : "not-focus-within:hover:border-border/60"}`,
648
- s && t && "border-border",
649
- o && "opacity-60 cursor-not-allowed"
633
+ s && `p-2 border-2 focus-within:border-dashed focus-within:${r ? "border-current/50" : "border-current/80"}`,
634
+ s && !o && `border-transparent ${r ? "" : "not-focus-within:hover:border-border/60"}`,
635
+ s && o && "border-border",
636
+ r && "opacity-60 cursor-not-allowed"
650
637
  ),
651
638
  style: {
652
639
  gap: "0.5em"
653
640
  },
654
641
  children: [
655
- !s && /* @__PURE__ */ d(
656
- fe,
642
+ !s && /* @__PURE__ */ c(
643
+ ve,
657
644
  {
658
- itemId: v,
659
- name: u || "",
660
- checked: t,
645
+ itemId: f,
646
+ name: d || "",
647
+ checked: o,
661
648
  onChange: i,
662
- disabled: o,
663
- className: p(s && "")
649
+ disabled: r,
650
+ className: w(s && "")
664
651
  }
665
652
  ),
666
- /* @__PURE__ */ d(
653
+ /* @__PURE__ */ c(
667
654
  "div",
668
655
  {
669
- id: s ? v : void 0,
656
+ id: s ? f : void 0,
670
657
  tabIndex: s ? -1 : void 0,
671
658
  role: s ? "radio" : void 0,
672
659
  onClick: s ? i : void 0,
673
- "aria-checked": s ? t ? "true" : "false" : void 0,
674
- "aria-disabled": s ? o : void 0,
675
- "aria-description": s ? l || `Radio button for ${u}` : void 0,
676
- "aria-labelledby": s ? `${v}-label` : void 0,
677
- className: p(s && "size-full", typeof r == "object" && "grow focus:outline-none"),
678
- children: /* @__PURE__ */ d(
660
+ "aria-checked": s ? o ? "true" : "false" : void 0,
661
+ "aria-disabled": s ? r : void 0,
662
+ "aria-description": s ? l || `Radio button for ${d}` : void 0,
663
+ "aria-labelledby": s ? `${f}-label` : void 0,
664
+ className: w(s && "size-full", typeof a == "object" && "grow focus:outline-none"),
665
+ children: /* @__PURE__ */ c(
679
666
  "label",
680
667
  {
681
- id: `${v}-label`,
668
+ id: `${f}-label`,
682
669
  onClick: s ? void 0 : i,
683
- className: p(o && "cursor-not-allowed", !o && "cursor-pointer"),
684
- children: r
670
+ className: w(r && "cursor-not-allowed", !r && "cursor-pointer"),
671
+ children: a
685
672
  }
686
673
  )
687
674
  }
@@ -690,247 +677,459 @@ function S({
690
677
  }
691
678
  );
692
679
  }
693
- function me(n, r) {
694
- const [e, t] = C(r), [a, o] = C(-1), [s, l] = C(!1), u = $((m, c) => {
695
- var h;
696
- const y = m[c];
697
- y.hasAttribute("disabled") || y.getAttribute("aria-disabled") === "true" || ((h = m[c]) == null || h.click(), o(c));
698
- }, []), b = $(
699
- (m, c) => {
700
- var f;
701
- if (m.preventDefault(), s || !c.length) return;
702
- const y = r !== -1 ? r : 0;
703
- (f = c[y]) == null || f.focus(), t(y), r !== -1 && u(c, y);
704
- },
705
- [r, s, u]
706
- ), v = $(
707
- (m) => {
680
+ function we(n, a) {
681
+ const [e, o] = x(a), [t, r] = x(-1), [s, l] = x(!1), d = A((b, m) => {
682
+ var y;
683
+ const v = b[m];
684
+ v.hasAttribute("disabled") || v.getAttribute("aria-disabled") === "true" || ((y = b[m]) == null || y.click(), r(m));
685
+ }, []), u = A(
686
+ (b, m) => {
708
687
  var h;
709
- if (!m.shiftKey)
688
+ if (b.preventDefault(), s || !m.length) return;
689
+ const v = a !== -1 ? a : 0;
690
+ (h = m[v]) == null || h.focus(), o(v), a !== -1 && d(m, v);
691
+ },
692
+ [a, s, d]
693
+ ), f = A(
694
+ (b) => {
695
+ var y;
696
+ if (!b.shiftKey)
710
697
  return;
711
- m.preventDefault();
712
- const c = Array.from(
698
+ b.preventDefault();
699
+ const m = Array.from(
713
700
  document.querySelectorAll(
714
701
  'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
715
702
  )
716
- ).filter((g) => !g.hasAttribute("disabled") && g.tabIndex >= 0), y = c.findIndex((g) => g.id === n), f = y > 0 ? y - 1 : c.length - 1;
717
- (h = c[f]) == null || h.focus();
703
+ ).filter((p) => !p.hasAttribute("disabled") && p.tabIndex >= 0), v = m.findIndex((p) => p.id === n), h = v > 0 ? v - 1 : m.length - 1;
704
+ (y = m[h]) == null || y.focus();
718
705
  },
719
706
  [n]
720
- ), i = $(
721
- (m, c) => {
722
- var N;
723
- if (!c.length) return;
724
- const y = m.target;
725
- if (!c.some((k) => k.id === y.id)) return;
726
- const h = e !== -1 ? e : 0;
727
- let g = h;
728
- switch (m.key) {
707
+ ), i = A(
708
+ (b, m) => {
709
+ var C;
710
+ if (!m.length) return;
711
+ const v = b.target;
712
+ if (!m.some((D) => D.id === v.id)) return;
713
+ const y = e !== -1 ? e : 0;
714
+ let p = y;
715
+ switch (b.key) {
729
716
  case "ArrowUp":
730
717
  case "ArrowLeft":
731
- m.preventDefault(), g = h > 0 ? h - 1 : c.length - 1;
718
+ b.preventDefault(), p = y > 0 ? y - 1 : m.length - 1;
732
719
  break;
733
720
  case "ArrowDown":
734
721
  case "ArrowRight":
735
- m.preventDefault(), g = (h + 1) % c.length;
722
+ b.preventDefault(), p = (y + 1) % m.length;
736
723
  break;
737
724
  // Select the option when the space key is pressed
738
725
  case " ":
739
- m.preventDefault(), u(c, h);
726
+ b.preventDefault(), d(m, y);
740
727
  return;
741
728
  case "Tab":
742
- v(m);
729
+ f(b);
743
730
  return;
744
731
  default:
745
732
  return;
746
733
  }
747
- (N = c[g]) == null || N.focus(), t(g), a !== -1 && u(c, g);
734
+ (C = m[p]) == null || C.focus(), o(p), t !== -1 && d(m, p);
748
735
  },
749
- [e, a, v, u]
750
- ), x = $(() => {
751
- const m = document.querySelector(`[id="${n}"][role="radiogroup"]`);
752
- return m ? Array.from(m.querySelectorAll('[role="radio"]')) : [];
736
+ [e, t, f, d]
737
+ ), g = A(() => {
738
+ const b = document.querySelector(`[id="${n}"][role="radiogroup"]`);
739
+ return b ? Array.from(b.querySelectorAll('[role="radio"]')) : [];
753
740
  }, [n]);
754
741
  E(() => {
755
- const m = document.querySelector(`[id="${n}"][role="radiogroup"]`);
756
- if (!m) return;
757
- const c = x(), y = (N) => b(N, c), f = (N) => i(N, c), h = () => l(!0), g = () => l(!1);
758
- return document.addEventListener("keydown", f), m.addEventListener("focus", y), m.addEventListener("mousedown", h), document.addEventListener("mouseup", g), () => {
759
- document.removeEventListener("keydown", f), m.removeEventListener("focus", y), m.removeEventListener("mousedown", h), document.removeEventListener("mouseup", g);
742
+ const b = document.querySelector(`[id="${n}"][role="radiogroup"]`);
743
+ if (!b) return;
744
+ const m = g(), v = (C) => u(C, m), h = (C) => i(C, m), y = () => l(!0), p = () => l(!1);
745
+ return document.addEventListener("keydown", h), b.addEventListener("focus", v), b.addEventListener("mousedown", y), document.addEventListener("mouseup", p), () => {
746
+ document.removeEventListener("keydown", h), b.removeEventListener("focus", v), b.removeEventListener("mousedown", y), document.removeEventListener("mouseup", p);
760
747
  };
761
- }, [n, x, b, i]);
748
+ }, [n, g, u, i]);
762
749
  }
763
- function Le({
750
+ function qe({
764
751
  options: n = [],
765
- value: r,
752
+ value: a,
766
753
  onChange: e,
767
- name: t,
768
- children: a,
769
- className: o = "",
754
+ id: o,
755
+ children: t,
756
+ className: r = "",
770
757
  childrenClassName: s = "",
771
758
  hideInputs: l = !1
772
759
  }) {
773
- const u = A(), b = t || `radio-group-${u}`;
774
- me(
775
- b,
776
- n.findIndex((i) => i === r)
760
+ const d = $(), u = o || `radio-group-${d}`;
761
+ we(
762
+ u,
763
+ n.findIndex((i) => i === a)
777
764
  );
778
- const v = F(() => n.reduce((i, x) => (typeof x == "string" ? i.some((m) => m.value === x) || i.push({ label: x, value: x }) : i.push(x), i), []), [n]);
779
- return /* @__PURE__ */ w("div", { id: b, role: "radiogroup", tabIndex: 0, className: p(o, "focus:outline-none"), children: [
780
- v.length > 0 && v.map((i, x) => /* @__PURE__ */ d(
781
- S,
765
+ const f = Z(() => n.reduce((i, g) => (typeof g == "string" ? i.some((b) => b.value === g) || i.push({ label: g, value: g }) : i.push(g), i), []), [n]);
766
+ return /* @__PURE__ */ N("div", { id: u, role: "radiogroup", tabIndex: 0, className: w(r, "focus:outline-none"), children: [
767
+ f.length > 0 && f.map((i, g) => /* @__PURE__ */ c(
768
+ V,
782
769
  {
783
770
  value: i.value,
784
- isSelected: r === i.value,
771
+ isSelected: a === i.value,
785
772
  onChange: e,
786
- name: b,
773
+ name: u,
787
774
  disabled: i.disabled,
788
775
  description: i.description,
789
776
  hideInput: l,
790
777
  className: s,
791
778
  children: i.label
792
779
  },
793
- `${i.value}-${x}`
780
+ `${i.value}-${g}`
794
781
  )),
795
- v.length === 0 && a && I.Children.map(a, (i) => I.isValidElement(i) && i.type === S ? /* @__PURE__ */ d(
796
- S,
782
+ f.length === 0 && t && T.Children.map(t, (i) => T.isValidElement(i) && i.type === V ? /* @__PURE__ */ c(
783
+ V,
797
784
  {
798
785
  ...i.props,
799
- className: p(s, i.props.className),
786
+ className: w(s, i.props.className),
800
787
  hideInput: i.props.hideInput || l,
801
- isSelected: r === i.props.value,
788
+ isSelected: a === i.props.value,
802
789
  onChange: e,
803
- name: b,
790
+ name: u,
804
791
  children: i.props.children
805
792
  }
806
793
  ) : null)
807
794
  ] });
808
795
  }
809
- function be({ elementId: n, maxLength: r }) {
810
- const [e, t] = C(0);
796
+ function Ke({ children: n, ref: a, ...e }) {
797
+ if (M(n)) {
798
+ let o = { ...e };
799
+ return n.props && (o = { ...o, ...n.props }), O(n, {
800
+ ...o,
801
+ ref: (t) => {
802
+ typeof a == "function" ? a(t) : a && (a.current = t);
803
+ }
804
+ });
805
+ }
806
+ return X("div", { ...e, ref: a }, n);
807
+ }
808
+ function ye({ elementId: n, maxLength: a }) {
809
+ const [e, o] = x(0);
811
810
  return E(() => {
812
- const a = document.getElementById(n);
813
- if (!a)
811
+ const t = document.getElementById(n);
812
+ if (!t)
814
813
  return;
815
- const o = () => {
816
- const s = a.value.length;
817
- t(s);
818
- const l = s >= r;
819
- a.setAttribute("aria-describedby", `${n}-character-count`), a.setAttribute("aria-invalid", l ? "true" : "false"), l ? a.setAttribute("data-error", "true") : a.removeAttribute("data-error");
814
+ const r = () => {
815
+ const s = t.value.length;
816
+ o(s);
817
+ const l = s >= a;
818
+ t.setAttribute("aria-describedby", `${n}-character-count`), t.setAttribute("aria-invalid", l ? "true" : "false"), l ? t.setAttribute("data-error", "true") : t.removeAttribute("data-error");
820
819
  };
821
- return o(), a.addEventListener("input", o), a.setAttribute("maxlength", String(r)), () => {
822
- a.removeEventListener("input", o), a.removeAttribute("maxlength"), a.removeAttribute("aria-describedby"), a.removeAttribute("aria-invalid"), a.removeAttribute("data-error");
820
+ return r(), t.addEventListener("input", r), t.setAttribute("maxlength", String(a)), () => {
821
+ t.removeEventListener("input", r), t.removeAttribute("maxlength"), t.removeAttribute("aria-describedby"), t.removeAttribute("aria-invalid"), t.removeAttribute("data-error");
823
822
  };
824
- }, [n, r]), /* @__PURE__ */ d(
823
+ }, [n, a]), /* @__PURE__ */ c(
825
824
  "small",
826
825
  {
827
- className: p(
826
+ className: w(
828
827
  "mt-0.5 text-sm inline-flex items-center gap-1 w-full justify-end",
829
- e >= r && "text-danger",
830
- e < r && "text-current"
828
+ e >= a && "text-destructive",
829
+ e < a && "text-current"
831
830
  ),
832
831
  role: "status",
833
- children: /* @__PURE__ */ w("span", { id: `${n}-character-count`, children: [
832
+ children: /* @__PURE__ */ N("span", { id: `${n}-character-count`, children: [
834
833
  e,
835
834
  " / ",
836
- r,
835
+ a,
837
836
  " characters"
838
837
  ] })
839
838
  }
840
839
  );
841
840
  }
842
- function ge(n, r) {
841
+ function xe(n, a) {
843
842
  E(() => {
844
843
  const e = document.getElementById(n);
845
844
  if (!e)
846
845
  return;
847
- if (!r) {
846
+ if (!a) {
848
847
  e.style.height = "auto";
849
848
  return;
850
849
  }
851
- const t = () => {
850
+ const o = () => {
852
851
  e.style.height = "auto", e.style.height = `${e.scrollHeight}px`;
853
852
  };
854
- return t(), e.addEventListener("input", t), e.addEventListener("resize", t), window.addEventListener("resize", t), () => {
855
- e.removeEventListener("input", t), e.removeEventListener("resize", t), window.removeEventListener("resize", t);
853
+ return o(), e.addEventListener("input", o), e.addEventListener("resize", o), window.addEventListener("resize", o), () => {
854
+ e.removeEventListener("input", o), e.removeEventListener("resize", o), window.removeEventListener("resize", o);
856
855
  };
857
- }, [n, r]);
856
+ }, [n, a]);
858
857
  }
859
- const ve = {
858
+ const Ne = {
860
859
  base: "",
861
- "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",
862
- outline: "border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-danger not-disabled:data-success:border-success"
863
- }, pe = {
860
+ "left-line": "border-l border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success",
861
+ outline: "border border-border focus:border-primary-foreground disabled:border-muted/30 not-disabled:data-error:border-destructive not-disabled:data-success:border-success"
862
+ }, Ce = {
864
863
  none: "rounded-none",
865
864
  sm: "rounded-sm",
866
865
  md: "rounded-md",
867
866
  lg: "rounded-lg",
868
867
  full: "px-3 rounded-full"
869
- }, R = {
868
+ }, Q = {
870
869
  variant: "outline",
871
870
  rounded: "none"
872
871
  };
873
- function je({
874
- variant: n = R.variant,
875
- rounded: r,
872
+ function Ve({
873
+ variant: n = Q.variant,
874
+ rounded: a,
876
875
  displayOnlyMode: e = !1,
877
- errorMessage: t,
878
- successMessage: a,
879
- hideResizeHandle: o = !1,
876
+ errorMessage: o,
877
+ successMessage: t,
878
+ hideResizeHandle: r = !1,
880
879
  autoExpand: s = !1,
881
880
  characterLimit: l = 0,
882
- className: u,
883
- ...b
881
+ className: d,
882
+ ...u
884
883
  }) {
885
- const v = A();
886
- ge(v, s || e);
887
- let i = r;
888
- n === "outline" && !r && (i = "md"), i = i || R.rounded;
889
- let x = o;
890
- (e || n === "left-line" && !o) && (x = !0);
891
- const c = p(
884
+ const f = $();
885
+ xe(f, s || e);
886
+ let i = a;
887
+ n === "outline" && !a && (i = "md"), i = i || Q.rounded;
888
+ let g = r;
889
+ (e || n === "left-line" && !r) && (g = !0);
890
+ const m = w(
892
891
  "appearance-none w-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted/70 hide-number-input-arrows transition-all",
893
- !e && ve[n],
894
- !e && pe[i],
892
+ !e && Ne[n],
893
+ !e && Ce[i],
895
894
  !e && "px-2 py-1",
896
895
  e && "pointer-events-none",
897
- x && "no-resize-handle",
898
- u
896
+ g && "no-resize-handle",
897
+ d
899
898
  );
900
- return /* @__PURE__ */ w("div", { className: p("-space-y-1.5", e && "cursor-text"), children: [
901
- /* @__PURE__ */ d(
899
+ return /* @__PURE__ */ N("div", { className: w("-space-y-1.5", e && "cursor-text"), children: [
900
+ /* @__PURE__ */ c(
902
901
  "textarea",
903
902
  {
904
- ...b,
905
- id: v,
906
- "aria-disabled": b.disabled,
903
+ ...u,
904
+ id: f,
905
+ "aria-disabled": u.disabled,
907
906
  readOnly: e,
908
- "aria-readonly": e || b["aria-readonly"],
907
+ "aria-readonly": e || u["aria-readonly"],
909
908
  style: {
910
909
  resize: s ? "none" : void 0
911
910
  },
912
- className: c
911
+ className: m
913
912
  }
914
913
  ),
915
- l > 0 && /* @__PURE__ */ d(be, { elementId: v, maxLength: l }),
916
- !e && /* @__PURE__ */ d(D, { elementId: v, type: "error", message: t }),
917
- !e && /* @__PURE__ */ d(D, { elementId: v, type: "success", message: a })
914
+ l > 0 && /* @__PURE__ */ c(ye, { elementId: f, maxLength: l }),
915
+ !e && /* @__PURE__ */ c(B, { elementId: f, type: "error", message: o }),
916
+ !e && /* @__PURE__ */ c(B, { elementId: f, type: "success", message: t })
917
+ ] });
918
+ }
919
+ function Ee(n) {
920
+ return { calculatePosition: A(
921
+ (e, o) => {
922
+ const t = e.getBoundingClientRect(), r = o.getBoundingClientRect(), s = {
923
+ width: window.innerWidth,
924
+ height: window.innerHeight
925
+ }, l = (g, b, m, v) => g < 0 || b < 0 || g + m > s.width || b + v > s.height, d = {
926
+ top: {
927
+ x: t.left + t.width / 2 - r.width / 2,
928
+ y: t.top - r.height - k,
929
+ arrow: {
930
+ x: r.width / 2 - I,
931
+ y: r.height
932
+ }
933
+ },
934
+ bottom: {
935
+ x: t.left + t.width / 2 - r.width / 2,
936
+ y: t.bottom + k,
937
+ arrow: {
938
+ x: r.width / 2 - I,
939
+ y: -6
940
+ }
941
+ },
942
+ left: {
943
+ x: t.left - r.width - k,
944
+ y: t.top + t.height / 2 - r.height / 2,
945
+ arrow: {
946
+ x: r.width,
947
+ y: r.height / 2 - I
948
+ }
949
+ },
950
+ right: {
951
+ x: t.right + k,
952
+ y: t.top + t.height / 2 - r.height / 2,
953
+ arrow: {
954
+ x: -6,
955
+ y: r.height / 2 - I
956
+ }
957
+ }
958
+ };
959
+ let u = n, f = d[n];
960
+ if (l(f.x, f.y, r.width, r.height)) {
961
+ const g = {
962
+ top: "bottom",
963
+ bottom: "top",
964
+ left: "right",
965
+ right: "left"
966
+ }, b = d[g[n]];
967
+ if (!l(b.x, b.y, r.width, r.height))
968
+ u = g[n], f = b;
969
+ else {
970
+ const m = ["top", "bottom", "left", "right"].filter(
971
+ (v) => v !== n && v !== g[n]
972
+ );
973
+ for (const v of m) {
974
+ const h = d[v];
975
+ if (!l(h.x, h.y, r.width, r.height)) {
976
+ u = v, f = h;
977
+ break;
978
+ }
979
+ }
980
+ }
981
+ }
982
+ f.x = Math.max(8, Math.min(f.x, s.width - r.width - 8)), f.y = Math.max(8, Math.min(f.y, s.height - r.height - 8));
983
+ const i = {
984
+ x: t.left + t.width / 2,
985
+ y: t.top + t.height / 2
986
+ };
987
+ return u === "top" || u === "bottom" ? f.arrow.x = Math.max(
988
+ I,
989
+ Math.min(i.x - f.x - I, r.width - I * 2)
990
+ ) : f.arrow.y = Math.max(
991
+ I,
992
+ Math.min(i.y - f.y - I, r.height - I * 2)
993
+ ), {
994
+ ...f,
995
+ placement: u
996
+ };
997
+ },
998
+ [n]
999
+ ) };
1000
+ }
1001
+ function Ae(n, a, e) {
1002
+ const o = z(null), t = z(null), r = A(() => {
1003
+ if (!o.current || !t.current) return;
1004
+ const s = n(o.current, t.current);
1005
+ e(s);
1006
+ }, [n, e]);
1007
+ return E(() => {
1008
+ if (!a) return;
1009
+ const s = () => r();
1010
+ return window.addEventListener("resize", s), () => {
1011
+ window.removeEventListener("resize", s);
1012
+ };
1013
+ }, [a, r]), {
1014
+ triggerRef: o,
1015
+ tooltipRef: t,
1016
+ updatePosition: r
1017
+ };
1018
+ }
1019
+ function Ie(n, a, e, o, t, r, s, l, d) {
1020
+ const u = z(null), f = A(() => {
1021
+ n || (u.current && clearTimeout(u.current), u.current = window.setTimeout(() => {
1022
+ e(!0), requestAnimationFrame(() => {
1023
+ t(), o(!0);
1024
+ });
1025
+ }, a));
1026
+ }, [n, a, e, t, o]), i = A(
1027
+ (g = !1) => {
1028
+ if (u.current && clearTimeout(u.current), g) {
1029
+ o(!1), setTimeout(() => e(!1), 150);
1030
+ return;
1031
+ }
1032
+ u.current = window.setTimeout(() => {
1033
+ o(!1), setTimeout(() => e(!1), 150);
1034
+ }, 100);
1035
+ },
1036
+ [o, e]
1037
+ );
1038
+ return E(() => {
1039
+ !r && !s && !l && d && i();
1040
+ }, [r, s, l, d, i]), E(() => () => {
1041
+ u.current && clearTimeout(u.current);
1042
+ }, []), {
1043
+ showTooltip: f,
1044
+ hideTooltip: i,
1045
+ timeoutRef: u
1046
+ };
1047
+ }
1048
+ const k = 4, I = 6;
1049
+ function Ge({
1050
+ id: n,
1051
+ children: a,
1052
+ message: e,
1053
+ placement: o = "top",
1054
+ disabled: t = !1,
1055
+ delay: r = 200,
1056
+ className: s
1057
+ }) {
1058
+ const [l, d] = x(!1), [u, f] = x(!1), [i, g] = x(null), [b, m] = x(!1), [v, h] = x(!1), [y, p] = x(!1), { calculatePosition: C } = Ee(o), { triggerRef: D, tooltipRef: j, updatePosition: F } = Ae(C, u, g), { showTooltip: L, hideTooltip: R, timeoutRef: G } = Ie(
1059
+ t,
1060
+ r,
1061
+ f,
1062
+ d,
1063
+ F,
1064
+ b,
1065
+ v,
1066
+ y,
1067
+ l
1068
+ ), Y = $(), U = n ?? Y;
1069
+ return /* @__PURE__ */ N(_, { children: [
1070
+ T.cloneElement(a, {
1071
+ ref: (S) => {
1072
+ D.current = S;
1073
+ },
1074
+ onMouseEnter: () => {
1075
+ m(!0), L();
1076
+ },
1077
+ onMouseLeave: () => {
1078
+ m(!1);
1079
+ },
1080
+ onFocus: () => {
1081
+ p(!0), L();
1082
+ },
1083
+ onBlur: () => {
1084
+ p(!1), R(!0);
1085
+ },
1086
+ onKeyDown: (S) => {
1087
+ S.key === "Escape" && R(!0);
1088
+ },
1089
+ "aria-describedby": t ? void 0 : U
1090
+ }),
1091
+ u && J(
1092
+ /* @__PURE__ */ c(
1093
+ "div",
1094
+ {
1095
+ ref: j,
1096
+ id: U,
1097
+ role: "tooltip",
1098
+ className: w(
1099
+ "fixed z-50 px-2 py-1 text-sm rounded shadow-lg pointer-events-auto transition-all duration-150 ease-out",
1100
+ l ? "opacity-100" : "opacity-0",
1101
+ s
1102
+ ),
1103
+ style: i ? { left: i.x, top: i.y } : { opacity: 0 },
1104
+ onMouseEnter: () => {
1105
+ h(!0), G.current && clearTimeout(G.current);
1106
+ },
1107
+ onMouseLeave: () => {
1108
+ h(!1);
1109
+ },
1110
+ children: e
1111
+ }
1112
+ ),
1113
+ document.body
1114
+ )
918
1115
  ] });
919
1116
  }
920
1117
  export {
921
- Ce as Accordion,
922
- L as AccordionItem,
923
- oe as Button,
924
- re as ButtonLoadingDots,
925
- Ee as Checkbox,
926
- Ae as Clickable,
927
- $e as Input,
928
- Ie as Label,
929
- De as Modal,
930
- Le as RadioGroup,
931
- S as RadioGroupItem,
932
- fe as RadioInput,
933
- ke as Slot,
934
- je as Textarea
1118
+ ze as Accordion,
1119
+ q as AccordionItem,
1120
+ Qe as ActionModal,
1121
+ ce as Button,
1122
+ ie as ButtonLoadingDots,
1123
+ Be as Checkbox,
1124
+ je as Clickable,
1125
+ Fe as Input,
1126
+ Se as Label,
1127
+ He as Modal,
1128
+ qe as RadioGroup,
1129
+ V as RadioGroupItem,
1130
+ ve as RadioInput,
1131
+ Ke as Slot,
1132
+ Ve as Textarea,
1133
+ Ge as Tooltip
935
1134
  };
936
1135
  //# sourceMappingURL=components.esm.js.map