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