@arcadeai/design-system 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +134 -130
- package/dist/components/ui/atoms/accordion.js +1 -1
- package/dist/components/ui/atoms/avatar.js +200 -82
- package/dist/components/ui/atoms/breadcrumb.js +25 -37
- package/dist/components/ui/atoms/chart.js +115 -10398
- package/dist/components/ui/atoms/command.js +158 -168
- package/dist/components/ui/atoms/dialog.js +30 -29
- package/dist/components/ui/atoms/dropdown-menu.js +153 -162
- package/dist/components/ui/atoms/form.js +57 -250
- package/dist/components/ui/atoms/hover-card.js +1 -1
- package/dist/components/ui/atoms/index.d.ts +1 -0
- package/dist/components/ui/atoms/index.js +134 -130
- package/dist/components/ui/atoms/popover.js +1 -1
- package/dist/components/ui/atoms/radio-group.d.ts +5 -0
- package/dist/components/ui/atoms/radio-group.js +272 -0
- package/dist/components/ui/atoms/resizable.js +359 -372
- package/dist/components/ui/atoms/select.js +101 -110
- package/dist/components/ui/atoms/sheet.js +24 -23
- package/dist/components/ui/atoms/sidebar.js +80 -89
- package/dist/components/ui/atoms/tooltip.js +1 -1
- package/dist/components/ui/index.js +134 -130
- package/dist/{index-f0YS5Ufh.js → index-PlrlSrPo.js} +266 -259
- package/dist/{index-DLfXSskr.js → index-toVHZ337.js} +49 -61
- package/dist/main.js +134 -130
- package/package.json +13 -12
- package/dist/check-B5h1DvDs.js +0 -11
- package/dist/chevron-down-DmZMdOiC.js +0 -11
- package/dist/chevron-right-BYYHEJjK.js +0 -11
- package/dist/createLucideIcon-XRdN60yz.js +0 -94
- package/dist/index-CJFGOBPb.js +0 -122
|
@@ -1,296 +1,103 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { S as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
var b = (e) => !O(e) && !Array.isArray(e) && q(e) && !K(e), z = (e) => b(e) && e.target ? j(e.target) ? e.target.checked : e.target.value : e, J = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Q = (e, o) => e.has(J(o)), X = (e) => {
|
|
10
|
-
const o = e.constructor && e.constructor.prototype;
|
|
11
|
-
return b(o) && o.hasOwnProperty("isPrototypeOf");
|
|
12
|
-
}, Y = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
13
|
-
function L(e) {
|
|
14
|
-
let o;
|
|
15
|
-
const t = Array.isArray(e), s = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
16
|
-
if (e instanceof Date)
|
|
17
|
-
o = new Date(e);
|
|
18
|
-
else if (!(Y && (e instanceof Blob || s)) && (t || b(e)))
|
|
19
|
-
if (o = t ? [] : {}, !t && !X(e))
|
|
20
|
-
o = e;
|
|
21
|
-
else
|
|
22
|
-
for (const r in e)
|
|
23
|
-
e.hasOwnProperty(r) && (o[r] = L(e[r]));
|
|
24
|
-
else
|
|
25
|
-
return e;
|
|
26
|
-
return o;
|
|
27
|
-
}
|
|
28
|
-
var M = (e) => /^\w*$/.test(e), V = (e) => e === void 0, Z = (e) => Array.isArray(e) ? e.filter(Boolean) : [], B = (e) => Z(e.replace(/["|']|\]/g, "").split(/\.|\[/)), c = (e, o, t) => {
|
|
29
|
-
if (!o || !b(e))
|
|
30
|
-
return t;
|
|
31
|
-
const s = (M(o) ? [o] : B(o)).reduce((r, n) => O(r) ? r : r[n], e);
|
|
32
|
-
return V(s) || s === e ? V(e[o]) ? t : e[o] : s;
|
|
33
|
-
}, C = (e) => typeof e == "boolean", P = (e, o, t) => {
|
|
34
|
-
let s = -1;
|
|
35
|
-
const r = M(o) ? [o] : B(o), n = r.length, l = n - 1;
|
|
36
|
-
for (; ++s < n; ) {
|
|
37
|
-
const u = r[s];
|
|
38
|
-
let a = t;
|
|
39
|
-
if (s !== l) {
|
|
40
|
-
const f = e[u];
|
|
41
|
-
a = b(f) || Array.isArray(f) ? f : isNaN(+r[s + 1]) ? {} : [];
|
|
42
|
-
}
|
|
43
|
-
if (u === "__proto__" || u === "constructor" || u === "prototype")
|
|
44
|
-
return;
|
|
45
|
-
e[u] = a, e = e[u];
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const k = {
|
|
49
|
-
BLUR: "blur",
|
|
50
|
-
CHANGE: "change"
|
|
51
|
-
}, D = {
|
|
52
|
-
all: "all"
|
|
53
|
-
}, I = i.createContext(null);
|
|
54
|
-
I.displayName = "HookFormContext";
|
|
55
|
-
const v = () => i.useContext(I), ee = (e) => {
|
|
56
|
-
const { children: o, ...t } = e;
|
|
57
|
-
return i.createElement(I.Provider, { value: t }, o);
|
|
58
|
-
};
|
|
59
|
-
var te = (e, o, t, s = !0) => {
|
|
60
|
-
const r = {
|
|
61
|
-
defaultValues: o._defaultValues
|
|
62
|
-
};
|
|
63
|
-
for (const n in e)
|
|
64
|
-
Object.defineProperty(r, n, {
|
|
65
|
-
get: () => {
|
|
66
|
-
const l = n;
|
|
67
|
-
return o._proxyFormState[l] !== D.all && (o._proxyFormState[l] = !s || D.all), t && (t[l] = !0), e[l];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return r;
|
|
71
|
-
};
|
|
72
|
-
const R = typeof window < "u" ? y.useLayoutEffect : y.useEffect;
|
|
73
|
-
function U(e) {
|
|
74
|
-
const o = v(), { control: t = o.control, disabled: s, name: r, exact: n } = e || {}, [l, u] = i.useState(t._formState), a = i.useRef({
|
|
75
|
-
isDirty: !1,
|
|
76
|
-
isLoading: !1,
|
|
77
|
-
dirtyFields: !1,
|
|
78
|
-
touchedFields: !1,
|
|
79
|
-
validatingFields: !1,
|
|
80
|
-
isValidating: !1,
|
|
81
|
-
isValid: !1,
|
|
82
|
-
errors: !1
|
|
83
|
-
});
|
|
84
|
-
return R(() => t._subscribe({
|
|
85
|
-
name: r,
|
|
86
|
-
formState: a.current,
|
|
87
|
-
exact: n,
|
|
88
|
-
callback: (f) => {
|
|
89
|
-
!s && u({
|
|
90
|
-
...t._formState,
|
|
91
|
-
...f
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}), [r, s, n]), i.useEffect(() => {
|
|
95
|
-
a.current.isValid && t._setValid(!0);
|
|
96
|
-
}, [t]), i.useMemo(() => te(l, t, a.current, !1), [l, t]);
|
|
97
|
-
}
|
|
98
|
-
var re = (e) => typeof e == "string", oe = (e, o, t, s, r) => re(e) ? c(t, e, r) : Array.isArray(e) ? e.map((n) => c(t, n)) : t;
|
|
99
|
-
function se(e) {
|
|
100
|
-
const o = v(), { control: t = o.control, name: s, defaultValue: r, disabled: n, exact: l } = e || {}, u = i.useRef(r), [a, f] = i.useState(t._getWatch(s, u.current));
|
|
101
|
-
return R(() => t._subscribe({
|
|
102
|
-
name: s,
|
|
103
|
-
formState: {
|
|
104
|
-
values: !0
|
|
105
|
-
},
|
|
106
|
-
exact: l,
|
|
107
|
-
callback: (F) => !n && f(oe(s, t._names, F.values || t._formValues, !1, u.current))
|
|
108
|
-
}), [s, t, n, l]), i.useEffect(() => t._removeUnmounted()), a;
|
|
109
|
-
}
|
|
110
|
-
function ne(e) {
|
|
111
|
-
const o = v(), { name: t, disabled: s, control: r = o.control, shouldUnregister: n } = e, l = Q(r._names.array, t), u = se({
|
|
112
|
-
control: r,
|
|
113
|
-
name: t,
|
|
114
|
-
defaultValue: c(r._formValues, t, c(r._defaultValues, t, e.defaultValue)),
|
|
115
|
-
exact: !0
|
|
116
|
-
}), a = U({
|
|
117
|
-
control: r,
|
|
118
|
-
name: t,
|
|
119
|
-
exact: !0
|
|
120
|
-
}), f = i.useRef(e), F = i.useRef(r.register(t, {
|
|
121
|
-
...e.rules,
|
|
122
|
-
value: u,
|
|
123
|
-
...C(e.disabled) ? { disabled: e.disabled } : {}
|
|
124
|
-
})), S = i.useMemo(() => Object.defineProperties({}, {
|
|
125
|
-
invalid: {
|
|
126
|
-
enumerable: !0,
|
|
127
|
-
get: () => !!c(a.errors, t)
|
|
128
|
-
},
|
|
129
|
-
isDirty: {
|
|
130
|
-
enumerable: !0,
|
|
131
|
-
get: () => !!c(a.dirtyFields, t)
|
|
132
|
-
},
|
|
133
|
-
isTouched: {
|
|
134
|
-
enumerable: !0,
|
|
135
|
-
get: () => !!c(a.touchedFields, t)
|
|
136
|
-
},
|
|
137
|
-
isValidating: {
|
|
138
|
-
enumerable: !0,
|
|
139
|
-
get: () => !!c(a.validatingFields, t)
|
|
140
|
-
},
|
|
141
|
-
error: {
|
|
142
|
-
enumerable: !0,
|
|
143
|
-
get: () => c(a.errors, t)
|
|
144
|
-
}
|
|
145
|
-
}), [a, t]), A = i.useCallback((d) => F.current.onChange({
|
|
146
|
-
target: {
|
|
147
|
-
value: z(d),
|
|
148
|
-
name: t
|
|
149
|
-
},
|
|
150
|
-
type: k.CHANGE
|
|
151
|
-
}), [t]), E = i.useCallback(() => F.current.onBlur({
|
|
152
|
-
target: {
|
|
153
|
-
value: c(r._formValues, t),
|
|
154
|
-
name: t
|
|
155
|
-
},
|
|
156
|
-
type: k.BLUR
|
|
157
|
-
}), [t, r._formValues]), w = i.useCallback((d) => {
|
|
158
|
-
const _ = c(r._fields, t);
|
|
159
|
-
_ && d && (_._f.ref = {
|
|
160
|
-
focus: () => d.focus && d.focus(),
|
|
161
|
-
select: () => d.select && d.select(),
|
|
162
|
-
setCustomValidity: (g) => d.setCustomValidity(g),
|
|
163
|
-
reportValidity: () => d.reportValidity()
|
|
164
|
-
});
|
|
165
|
-
}, [r._fields, t]), N = i.useMemo(() => ({
|
|
166
|
-
name: t,
|
|
167
|
-
value: u,
|
|
168
|
-
...C(s) || a.disabled ? { disabled: a.disabled || s } : {},
|
|
169
|
-
onChange: A,
|
|
170
|
-
onBlur: E,
|
|
171
|
-
ref: w
|
|
172
|
-
}), [t, s, a.disabled, A, E, w, u]);
|
|
173
|
-
return i.useEffect(() => {
|
|
174
|
-
const d = r._options.shouldUnregister || n;
|
|
175
|
-
r.register(t, {
|
|
176
|
-
...f.current.rules,
|
|
177
|
-
...C(f.current.disabled) ? { disabled: f.current.disabled } : {}
|
|
178
|
-
});
|
|
179
|
-
const _ = (g, H) => {
|
|
180
|
-
const h = c(r._fields, g);
|
|
181
|
-
h && h._f && (h._f.mount = H);
|
|
182
|
-
};
|
|
183
|
-
if (_(t, !0), d) {
|
|
184
|
-
const g = L(c(r._options.defaultValues, t));
|
|
185
|
-
P(r._defaultValues, t, g), V(c(r._formValues, t)) && P(r._formValues, t, g);
|
|
186
|
-
}
|
|
187
|
-
return !l && r.register(t), () => {
|
|
188
|
-
(l ? d && !r._state.action : d) ? r.unregister(t) : _(t, !1);
|
|
189
|
-
};
|
|
190
|
-
}, [t, r, l, n]), i.useEffect(() => {
|
|
191
|
-
r._setDisabledField({
|
|
192
|
-
disabled: s,
|
|
193
|
-
name: t
|
|
194
|
-
});
|
|
195
|
-
}, [s, t, r]), i.useMemo(() => ({
|
|
196
|
-
field: N,
|
|
197
|
-
formState: a,
|
|
198
|
-
fieldState: S
|
|
199
|
-
}), [N, a, S]);
|
|
200
|
-
}
|
|
201
|
-
const ae = (e) => e.render(ne(e)), fe = ee, $ = y.createContext(
|
|
2
|
+
import { S as f } from "../../../index-5Bhkapwi.js";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
import { FormProvider as u, useFormContext as F, useFormState as x, Controller as I } from "react-hook-form";
|
|
5
|
+
import { useFormContext as j } from "react-hook-form";
|
|
6
|
+
import { Label as p } from "./label.js";
|
|
7
|
+
import { c as a } from "../../../utils-CRiPKpXj.js";
|
|
8
|
+
const S = u, c = s.createContext(
|
|
202
9
|
{}
|
|
203
|
-
),
|
|
10
|
+
), $ = ({
|
|
204
11
|
...e
|
|
205
|
-
}) => /* @__PURE__ */ m(
|
|
206
|
-
const e =
|
|
12
|
+
}) => /* @__PURE__ */ m(c.Provider, { value: { name: e.name }, children: /* @__PURE__ */ m(I, { ...e }) }), d = () => {
|
|
13
|
+
const e = s.useContext(c), t = s.useContext(l), { getFieldState: r } = F(), o = x({ name: e.name }), n = r(e.name, o);
|
|
207
14
|
if (!e)
|
|
208
15
|
throw new Error("useFormField should be used within <FormField>");
|
|
209
|
-
const { id:
|
|
16
|
+
const { id: i } = t;
|
|
210
17
|
return {
|
|
211
|
-
id:
|
|
18
|
+
id: i,
|
|
212
19
|
name: e.name,
|
|
213
|
-
formItemId: `${
|
|
214
|
-
formDescriptionId: `${
|
|
215
|
-
formMessageId: `${
|
|
216
|
-
...
|
|
20
|
+
formItemId: `${i}-form-item`,
|
|
21
|
+
formDescriptionId: `${i}-form-item-description`,
|
|
22
|
+
formMessageId: `${i}-form-item-message`,
|
|
23
|
+
...n
|
|
217
24
|
};
|
|
218
|
-
},
|
|
25
|
+
}, l = s.createContext(
|
|
219
26
|
{}
|
|
220
27
|
);
|
|
221
|
-
function
|
|
222
|
-
const
|
|
223
|
-
return /* @__PURE__ */ m(
|
|
28
|
+
function D({ className: e, ...t }) {
|
|
29
|
+
const r = s.useId();
|
|
30
|
+
return /* @__PURE__ */ m(l.Provider, { value: { id: r }, children: /* @__PURE__ */ m(
|
|
224
31
|
"div",
|
|
225
32
|
{
|
|
226
|
-
className:
|
|
33
|
+
className: a("grid gap-2", e),
|
|
227
34
|
"data-slot": "form-item",
|
|
228
|
-
...
|
|
35
|
+
...t
|
|
229
36
|
}
|
|
230
37
|
) });
|
|
231
38
|
}
|
|
232
|
-
function
|
|
39
|
+
function M({
|
|
233
40
|
className: e,
|
|
234
|
-
...
|
|
41
|
+
...t
|
|
235
42
|
}) {
|
|
236
|
-
const { error:
|
|
43
|
+
const { error: r, formItemId: o } = d();
|
|
237
44
|
return /* @__PURE__ */ m(
|
|
238
|
-
|
|
45
|
+
p,
|
|
239
46
|
{
|
|
240
|
-
className:
|
|
241
|
-
"data-error": !!
|
|
47
|
+
className: a("data-[error=true]:text-destructive", e),
|
|
48
|
+
"data-error": !!r,
|
|
242
49
|
"data-slot": "form-label",
|
|
243
|
-
htmlFor:
|
|
244
|
-
...
|
|
50
|
+
htmlFor: o,
|
|
51
|
+
...t
|
|
245
52
|
}
|
|
246
53
|
);
|
|
247
54
|
}
|
|
248
|
-
function
|
|
249
|
-
const { error:
|
|
55
|
+
function N({ ...e }) {
|
|
56
|
+
const { error: t, formItemId: r, formDescriptionId: o, formMessageId: n } = d();
|
|
250
57
|
return /* @__PURE__ */ m(
|
|
251
|
-
|
|
58
|
+
f,
|
|
252
59
|
{
|
|
253
|
-
"aria-describedby":
|
|
254
|
-
"aria-invalid": !!
|
|
60
|
+
"aria-describedby": t ? `${o} ${n}` : `${o}`,
|
|
61
|
+
"aria-invalid": !!t,
|
|
255
62
|
"data-slot": "form-control",
|
|
256
|
-
id:
|
|
63
|
+
id: r,
|
|
257
64
|
...e
|
|
258
65
|
}
|
|
259
66
|
);
|
|
260
67
|
}
|
|
261
|
-
function
|
|
262
|
-
const { formDescriptionId:
|
|
68
|
+
function w({ className: e, ...t }) {
|
|
69
|
+
const { formDescriptionId: r } = d();
|
|
263
70
|
return /* @__PURE__ */ m(
|
|
264
71
|
"p",
|
|
265
72
|
{
|
|
266
|
-
className:
|
|
73
|
+
className: a("text-muted-foreground text-sm", e),
|
|
267
74
|
"data-slot": "form-description",
|
|
268
|
-
id:
|
|
269
|
-
...
|
|
75
|
+
id: r,
|
|
76
|
+
...t
|
|
270
77
|
}
|
|
271
78
|
);
|
|
272
79
|
}
|
|
273
|
-
function
|
|
274
|
-
const { error:
|
|
275
|
-
return
|
|
80
|
+
function P({ className: e, ...t }) {
|
|
81
|
+
const { error: r, formMessageId: o } = d(), n = r ? String(r?.message ?? "") : t.children;
|
|
82
|
+
return n ? /* @__PURE__ */ m(
|
|
276
83
|
"p",
|
|
277
84
|
{
|
|
278
|
-
className:
|
|
85
|
+
className: a("text-destructive text-sm", e),
|
|
279
86
|
"data-slot": "form-message",
|
|
280
|
-
id:
|
|
281
|
-
...
|
|
282
|
-
children:
|
|
87
|
+
id: o,
|
|
88
|
+
...t,
|
|
89
|
+
children: n
|
|
283
90
|
}
|
|
284
91
|
) : null;
|
|
285
92
|
}
|
|
286
93
|
export {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
94
|
+
S as Form,
|
|
95
|
+
N as FormControl,
|
|
96
|
+
w as FormDescription,
|
|
97
|
+
$ as FormField,
|
|
98
|
+
D as FormItem,
|
|
99
|
+
M as FormLabel,
|
|
100
|
+
P as FormMessage,
|
|
101
|
+
j as useFormContext,
|
|
102
|
+
d as useFormField
|
|
296
103
|
};
|
|
@@ -4,7 +4,7 @@ import { c as l } from "../../../index-B695uy69.js";
|
|
|
4
4
|
import { c as k } from "../../../index-DFZozV_h.js";
|
|
5
5
|
import { u as F } from "../../../index-437EL2iq.js";
|
|
6
6
|
import { u as I } from "../../../index-5Bhkapwi.js";
|
|
7
|
-
import { c as H, R as U, A as $, C as W, a as z } from "../../../index-
|
|
7
|
+
import { c as H, R as U, A as $, C as W, a as z } from "../../../index-PlrlSrPo.js";
|
|
8
8
|
import { P as B, D as G } from "../../../index-DYHsXnnS.js";
|
|
9
9
|
import { P as T } from "../../../index-C8_QusYl.js";
|
|
10
10
|
import { P as K } from "../../../index-CpDnqHCm.js";
|