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