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