@arcadeai/design-system 0.7.2 → 0.7.4
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/assets/index.css +1 -1
- package/dist/{check-CxcShTlQ.js → check-B5h1DvDs.js} +2 -2
- package/dist/{chevron-down-D_a-ccxi.js → chevron-down-DmZMdOiC.js} +2 -2
- package/dist/{chevron-right-DriXIqe5.js → chevron-right-BYYHEJjK.js} +2 -2
- package/dist/components/ui/atoms/accordion.js +70 -74
- package/dist/components/ui/atoms/alert.js +2 -2
- package/dist/components/ui/atoms/avatar.js +5 -5
- package/dist/components/ui/atoms/badge.js +3 -3
- package/dist/components/ui/atoms/breadcrumb.js +5 -5
- package/dist/components/ui/atoms/button.js +3 -3
- package/dist/components/ui/atoms/card.js +1 -1
- package/dist/components/ui/atoms/chart.js +3247 -3228
- package/dist/components/ui/atoms/collapsible.js +1 -1
- package/dist/components/ui/atoms/command.js +15 -15
- package/dist/components/ui/atoms/dialog.js +2 -2
- package/dist/components/ui/atoms/dropdown-menu.js +367 -384
- package/dist/components/ui/atoms/form.d.ts +1 -1
- package/dist/components/ui/atoms/form.js +182 -199
- package/dist/components/ui/atoms/hover-card.js +40 -41
- package/dist/components/ui/atoms/input.js +1 -1
- package/dist/components/ui/atoms/label.js +18 -19
- package/dist/components/ui/atoms/popover.js +107 -110
- package/dist/components/ui/atoms/progress.js +3 -3
- package/dist/components/ui/atoms/resizable.js +8 -8
- package/dist/components/ui/atoms/scroll-area.js +82 -84
- package/dist/components/ui/atoms/select.js +393 -407
- package/dist/components/ui/atoms/separator.js +2 -2
- package/dist/components/ui/atoms/sheet.js +2 -2
- package/dist/components/ui/atoms/sidebar.js +17 -17
- package/dist/components/ui/atoms/skeleton.js +1 -1
- package/dist/components/ui/atoms/slider.js +213 -214
- package/dist/components/ui/atoms/sonner.js +28 -28
- package/dist/components/ui/atoms/switch.js +7 -7
- package/dist/components/ui/atoms/table.js +1 -1
- package/dist/components/ui/atoms/tabs.js +8 -8
- package/dist/components/ui/atoms/textarea.js +1 -1
- package/dist/components/ui/atoms/toggle.js +5 -5
- package/dist/components/ui/atoms/tooltip.js +103 -104
- package/dist/{createLucideIcon-B6fy1GTR.js → createLucideIcon-XRdN60yz.js} +4 -4
- package/dist/index-0ioNhtNM.js +10 -0
- package/dist/index-437EL2iq.js +52 -0
- package/dist/{index-CB1Wkg0G.js → index-5Bhkapwi.js} +2 -3
- package/dist/index-B695uy69.js +9 -0
- package/dist/{index-CHDs-SiB.js → index-BGQepRFJ.js} +1 -1
- package/dist/{index-BAhNQL1u.js → index-BvWMjxZ5.js} +22 -23
- package/dist/index-C8_QusYl.js +70 -0
- package/dist/index-CCKe-Mpx.js +6 -0
- package/dist/{index-DdnpnyX2.js → index-CQhYMnjT.js} +4 -4
- package/dist/{index-C9KW2H79.js → index-CpDnqHCm.js} +1 -1
- package/dist/{index-CxK6rt_N.js → index-CtSXVDca.js} +8 -8
- package/dist/{index-umR1UobZ.js → index-Cv867SGx.js} +1 -1
- package/dist/{index-CuMpq4Un.js → index-CxO14pcK.js} +2 -2
- package/dist/index-DFZozV_h.js +68 -0
- package/dist/index-DLfXSskr.js +255 -0
- package/dist/{index-D2uXV4lz.js → index-DMCYNwtg.js} +8 -8
- package/dist/index-DYHsXnnS.js +144 -0
- package/dist/{index-nluJZSbA.js → index-DfNPZZ8M.js} +1 -1
- package/dist/{index-Dy7YuPrV.js → index-f0YS5Ufh.js} +319 -321
- package/dist/lib/utils.js +1 -1
- package/dist/{utils-Dy2WjYNJ.js → utils-CRiPKpXj.js} +41 -42
- package/package.json +33 -26
- package/dist/index-CL4N9wMT.js +0 -259
- package/dist/index-DLeNytVF.js +0 -9
- package/dist/index-DYfkNB0n.js +0 -54
- package/dist/index-DuekHEmj.js +0 -6
- package/dist/index-DwYXX2sM.js +0 -13
- package/dist/index-QMp1pYFl.js +0 -145
- package/dist/index-UFb2E87s.js +0 -70
- package/dist/index-p7nYL7BU.js +0 -71
|
@@ -2,7 +2,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
2
2
|
import { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
3
3
|
import type * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues
|
|
5
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import('react-hook-form').FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
6
6
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare const useFormField: () => {
|
|
8
8
|
invalid: boolean;
|
|
@@ -1,92 +1,77 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { S as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import { Label as
|
|
6
|
-
import { c as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
function
|
|
14
|
-
let
|
|
15
|
-
const t = Array.isArray(e),
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { S as W } from "../../../index-5Bhkapwi.js";
|
|
3
|
+
import * as y from "react";
|
|
4
|
+
import i from "react";
|
|
5
|
+
import { Label as G } from "./label.js";
|
|
6
|
+
import { c as p } from "../../../utils-CRiPKpXj.js";
|
|
7
|
+
var j = (e) => e.type === "checkbox", K = (e) => e instanceof Date, O = (e) => e == null;
|
|
8
|
+
const q = (e) => typeof e == "object";
|
|
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
16
|
if (e instanceof Date)
|
|
17
|
-
|
|
18
|
-
else if (e instanceof
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (r = t ? [] : {}, !t && !q(e))
|
|
22
|
-
r = e;
|
|
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;
|
|
23
21
|
else
|
|
24
|
-
for (const
|
|
25
|
-
e.hasOwnProperty(
|
|
22
|
+
for (const r in e)
|
|
23
|
+
e.hasOwnProperty(r) && (o[r] = L(e[r]));
|
|
26
24
|
else
|
|
27
25
|
return e;
|
|
28
|
-
return
|
|
26
|
+
return o;
|
|
29
27
|
}
|
|
30
|
-
var w = (e) => Array.isArray(e) ? e.filter(Boolean) : [],
|
|
31
|
-
if (!
|
|
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))
|
|
32
30
|
return t;
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
}, C = (e) => typeof e == "boolean",
|
|
36
|
-
let
|
|
37
|
-
const
|
|
38
|
-
for (; ++
|
|
39
|
-
const
|
|
40
|
-
let
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
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]) ? {} : [];
|
|
44
42
|
}
|
|
45
|
-
if (
|
|
43
|
+
if (u === "__proto__" || u === "constructor" || u === "prototype")
|
|
46
44
|
return;
|
|
47
|
-
e[
|
|
45
|
+
e[u] = a, e = e[u];
|
|
48
46
|
}
|
|
49
|
-
return e;
|
|
50
47
|
};
|
|
51
|
-
const
|
|
48
|
+
const k = {
|
|
52
49
|
BLUR: "blur",
|
|
53
50
|
CHANGE: "change"
|
|
54
|
-
},
|
|
51
|
+
}, D = {
|
|
55
52
|
all: "all"
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
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);
|
|
59
58
|
};
|
|
60
|
-
var
|
|
61
|
-
const
|
|
62
|
-
defaultValues:
|
|
59
|
+
var te = (e, o, t, s = !0) => {
|
|
60
|
+
const r = {
|
|
61
|
+
defaultValues: o._defaultValues
|
|
63
62
|
};
|
|
64
63
|
for (const n in e)
|
|
65
|
-
Object.defineProperty(
|
|
64
|
+
Object.defineProperty(r, n, {
|
|
66
65
|
get: () => {
|
|
67
|
-
const
|
|
68
|
-
return
|
|
66
|
+
const l = n;
|
|
67
|
+
return o._proxyFormState[l] !== D.all && (o._proxyFormState[l] = !s || D.all), t && (t[l] = !0), e[l];
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, te = (e) => Array.isArray(e) ? e : [e], k = (e, r, t) => !e || !r || e === r || te(e).some((o) => o && (t ? o === r : o.startsWith(r) || r.startsWith(o)));
|
|
77
|
-
function D(e) {
|
|
78
|
-
const r = a.useRef(e);
|
|
79
|
-
r.current = e, a.useEffect(() => {
|
|
80
|
-
const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
|
|
81
|
-
next: r.current.next
|
|
82
|
-
});
|
|
83
|
-
return () => {
|
|
84
|
-
t && t.unsubscribe();
|
|
85
|
-
};
|
|
86
|
-
}, [e.disabled]);
|
|
87
|
-
}
|
|
88
|
-
function R(e) {
|
|
89
|
-
const r = v(), { control: t = r.control, disabled: o, name: s, exact: n } = e || {}, [u, l] = a.useState(t._formState), i = a.useRef(!0), d = a.useRef({
|
|
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({
|
|
90
75
|
isDirty: !1,
|
|
91
76
|
isLoading: !1,
|
|
92
77
|
dirtyFields: !1,
|
|
@@ -95,218 +80,216 @@ function R(e) {
|
|
|
95
80
|
isValidating: !1,
|
|
96
81
|
isValid: !1,
|
|
97
82
|
errors: !1
|
|
98
|
-
}), m = a.useRef(s);
|
|
99
|
-
return m.current = s, D({
|
|
100
|
-
disabled: o,
|
|
101
|
-
next: (b) => i.current && k(m.current, b.name, n) && ee(b, d.current, t._updateFormState) && l({
|
|
102
|
-
...t._formState,
|
|
103
|
-
...b
|
|
104
|
-
}),
|
|
105
|
-
subject: t._subjects.state
|
|
106
|
-
}), a.useEffect(() => (i.current = !0, d.current.isValid && t._updateValid(!0), () => {
|
|
107
|
-
i.current = !1;
|
|
108
|
-
}), [t]), a.useMemo(() => Y(u, t, d.current, !1), [u, t]);
|
|
109
|
-
}
|
|
110
|
-
var re = (e) => typeof e == "string", se = (e, r, t, o, s) => re(e) ? c(t, e, s) : Array.isArray(e) ? e.map((n) => c(t, n)) : t;
|
|
111
|
-
function oe(e) {
|
|
112
|
-
const r = v(), { control: t = r.control, name: o, defaultValue: s, disabled: n, exact: u } = e || {}, l = a.useRef(o);
|
|
113
|
-
l.current = o, D({
|
|
114
|
-
disabled: n,
|
|
115
|
-
subject: t._subjects.values,
|
|
116
|
-
next: (m) => {
|
|
117
|
-
k(l.current, m.name, u) && d(I(se(l.current, t._names, m.values || t._formValues, !1, s)));
|
|
118
|
-
}
|
|
119
83
|
});
|
|
120
|
-
|
|
121
|
-
|
|
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;
|
|
122
109
|
}
|
|
123
110
|
function ne(e) {
|
|
124
|
-
const
|
|
125
|
-
control:
|
|
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,
|
|
126
113
|
name: t,
|
|
127
|
-
defaultValue: c(
|
|
114
|
+
defaultValue: c(r._formValues, t, c(r._defaultValues, t, e.defaultValue)),
|
|
128
115
|
exact: !0
|
|
129
|
-
}),
|
|
130
|
-
control:
|
|
116
|
+
}), a = U({
|
|
117
|
+
control: r,
|
|
131
118
|
name: t,
|
|
132
119
|
exact: !0
|
|
133
|
-
}),
|
|
120
|
+
}), f = i.useRef(e), F = i.useRef(r.register(t, {
|
|
134
121
|
...e.rules,
|
|
135
|
-
value:
|
|
122
|
+
value: u,
|
|
136
123
|
...C(e.disabled) ? { disabled: e.disabled } : {}
|
|
137
|
-
})),
|
|
124
|
+
})), S = i.useMemo(() => Object.defineProperties({}, {
|
|
138
125
|
invalid: {
|
|
139
126
|
enumerable: !0,
|
|
140
|
-
get: () => !!c(
|
|
127
|
+
get: () => !!c(a.errors, t)
|
|
141
128
|
},
|
|
142
129
|
isDirty: {
|
|
143
130
|
enumerable: !0,
|
|
144
|
-
get: () => !!c(
|
|
131
|
+
get: () => !!c(a.dirtyFields, t)
|
|
145
132
|
},
|
|
146
133
|
isTouched: {
|
|
147
134
|
enumerable: !0,
|
|
148
|
-
get: () => !!c(
|
|
135
|
+
get: () => !!c(a.touchedFields, t)
|
|
149
136
|
},
|
|
150
137
|
isValidating: {
|
|
151
138
|
enumerable: !0,
|
|
152
|
-
get: () => !!c(
|
|
139
|
+
get: () => !!c(a.validatingFields, t)
|
|
153
140
|
},
|
|
154
141
|
error: {
|
|
155
142
|
enumerable: !0,
|
|
156
|
-
get: () => c(
|
|
143
|
+
get: () => c(a.errors, t)
|
|
157
144
|
}
|
|
158
|
-
}), [
|
|
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(() => ({
|
|
159
166
|
name: t,
|
|
160
|
-
value:
|
|
161
|
-
...C(
|
|
162
|
-
onChange:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}),
|
|
176
|
-
ref: (f) => {
|
|
177
|
-
const F = c(s._fields, t);
|
|
178
|
-
F && f && (F._f.ref = {
|
|
179
|
-
focus: () => f.focus(),
|
|
180
|
-
select: () => f.select(),
|
|
181
|
-
setCustomValidity: (g) => f.setCustomValidity(g),
|
|
182
|
-
reportValidity: () => f.reportValidity()
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}), [
|
|
186
|
-
t,
|
|
187
|
-
s._formValues,
|
|
188
|
-
o,
|
|
189
|
-
i.disabled,
|
|
190
|
-
l,
|
|
191
|
-
s._fields
|
|
192
|
-
]);
|
|
193
|
-
return a.useEffect(() => {
|
|
194
|
-
const f = s._options.shouldUnregister || n, F = (g, B) => {
|
|
195
|
-
const V = c(s._fields, g);
|
|
196
|
-
V && V._f && (V._f.mount = B);
|
|
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);
|
|
197
182
|
};
|
|
198
|
-
if (
|
|
199
|
-
const g =
|
|
200
|
-
|
|
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);
|
|
201
186
|
}
|
|
202
|
-
return () => {
|
|
203
|
-
(
|
|
187
|
+
return !l && r.register(t), () => {
|
|
188
|
+
(l ? d && !r._state.action : d) ? r.unregister(t) : _(t, !1);
|
|
204
189
|
};
|
|
205
|
-
}, [t,
|
|
206
|
-
|
|
207
|
-
disabled:
|
|
208
|
-
|
|
209
|
-
name: t,
|
|
210
|
-
value: c(s._fields, t)._f.value
|
|
190
|
+
}, [t, r, l, n]), i.useEffect(() => {
|
|
191
|
+
r._setDisabledField({
|
|
192
|
+
disabled: s,
|
|
193
|
+
name: t
|
|
211
194
|
});
|
|
212
|
-
}, [
|
|
213
|
-
field:
|
|
214
|
-
formState:
|
|
215
|
-
fieldState:
|
|
216
|
-
}), [
|
|
195
|
+
}, [s, t, r]), i.useMemo(() => ({
|
|
196
|
+
field: N,
|
|
197
|
+
formState: a,
|
|
198
|
+
fieldState: S
|
|
199
|
+
}), [N, a, S]);
|
|
217
200
|
}
|
|
218
|
-
const
|
|
201
|
+
const ae = (e) => e.render(ne(e)), fe = ee, $ = y.createContext(
|
|
219
202
|
{}
|
|
220
203
|
), me = ({
|
|
221
204
|
...e
|
|
222
|
-
}) => /* @__PURE__ */
|
|
223
|
-
const e =
|
|
205
|
+
}) => /* @__PURE__ */ m($.Provider, { value: { name: e.name }, children: /* @__PURE__ */ m(ae, { ...e }) }), x = () => {
|
|
206
|
+
const e = y.useContext($), o = y.useContext(T), { getFieldState: t } = v(), s = U({ name: e.name }), r = t(e.name, s);
|
|
224
207
|
if (!e)
|
|
225
208
|
throw new Error("useFormField should be used within <FormField>");
|
|
226
|
-
const { id: n } =
|
|
209
|
+
const { id: n } = o;
|
|
227
210
|
return {
|
|
228
211
|
id: n,
|
|
229
212
|
name: e.name,
|
|
230
213
|
formItemId: `${n}-form-item`,
|
|
231
214
|
formDescriptionId: `${n}-form-item-description`,
|
|
232
215
|
formMessageId: `${n}-form-item-message`,
|
|
233
|
-
...
|
|
216
|
+
...r
|
|
234
217
|
};
|
|
235
|
-
},
|
|
218
|
+
}, T = y.createContext(
|
|
236
219
|
{}
|
|
237
220
|
);
|
|
238
|
-
function ye({ className: e, ...
|
|
239
|
-
const t =
|
|
240
|
-
return /* @__PURE__ */
|
|
221
|
+
function ye({ className: e, ...o }) {
|
|
222
|
+
const t = y.useId();
|
|
223
|
+
return /* @__PURE__ */ m(T.Provider, { value: { id: t }, children: /* @__PURE__ */ m(
|
|
241
224
|
"div",
|
|
242
225
|
{
|
|
243
|
-
className:
|
|
226
|
+
className: p("grid gap-2", e),
|
|
244
227
|
"data-slot": "form-item",
|
|
245
|
-
...
|
|
228
|
+
...o
|
|
246
229
|
}
|
|
247
230
|
) });
|
|
248
231
|
}
|
|
249
|
-
function
|
|
232
|
+
function ge({
|
|
250
233
|
className: e,
|
|
251
|
-
...
|
|
234
|
+
...o
|
|
252
235
|
}) {
|
|
253
|
-
const { error: t, formItemId:
|
|
254
|
-
return /* @__PURE__ */
|
|
255
|
-
|
|
236
|
+
const { error: t, formItemId: s } = x();
|
|
237
|
+
return /* @__PURE__ */ m(
|
|
238
|
+
G,
|
|
256
239
|
{
|
|
257
|
-
className:
|
|
240
|
+
className: p("data-[error=true]:text-destructive", e),
|
|
258
241
|
"data-error": !!t,
|
|
259
242
|
"data-slot": "form-label",
|
|
260
|
-
htmlFor:
|
|
261
|
-
...
|
|
243
|
+
htmlFor: s,
|
|
244
|
+
...o
|
|
262
245
|
}
|
|
263
246
|
);
|
|
264
247
|
}
|
|
265
|
-
function
|
|
266
|
-
const { error:
|
|
267
|
-
return /* @__PURE__ */
|
|
268
|
-
|
|
248
|
+
function _e({ ...e }) {
|
|
249
|
+
const { error: o, formItemId: t, formDescriptionId: s, formMessageId: r } = x();
|
|
250
|
+
return /* @__PURE__ */ m(
|
|
251
|
+
W,
|
|
269
252
|
{
|
|
270
|
-
"aria-describedby":
|
|
271
|
-
"aria-invalid": !!
|
|
253
|
+
"aria-describedby": o ? `${s} ${r}` : `${s}`,
|
|
254
|
+
"aria-invalid": !!o,
|
|
272
255
|
"data-slot": "form-control",
|
|
273
256
|
id: t,
|
|
274
257
|
...e
|
|
275
258
|
}
|
|
276
259
|
);
|
|
277
260
|
}
|
|
278
|
-
function
|
|
261
|
+
function be({ className: e, ...o }) {
|
|
279
262
|
const { formDescriptionId: t } = x();
|
|
280
|
-
return /* @__PURE__ */
|
|
263
|
+
return /* @__PURE__ */ m(
|
|
281
264
|
"p",
|
|
282
265
|
{
|
|
283
|
-
className:
|
|
266
|
+
className: p("text-muted-foreground text-sm", e),
|
|
284
267
|
"data-slot": "form-description",
|
|
285
268
|
id: t,
|
|
286
|
-
...
|
|
269
|
+
...o
|
|
287
270
|
}
|
|
288
271
|
);
|
|
289
272
|
}
|
|
290
|
-
function Fe({ className: e, ...
|
|
291
|
-
const { error: t, formMessageId:
|
|
292
|
-
return
|
|
273
|
+
function Fe({ className: e, ...o }) {
|
|
274
|
+
const { error: t, formMessageId: s } = x(), r = t ? String(t?.message ?? "") : o.children;
|
|
275
|
+
return r ? /* @__PURE__ */ m(
|
|
293
276
|
"p",
|
|
294
277
|
{
|
|
295
|
-
className:
|
|
278
|
+
className: p("text-destructive text-sm", e),
|
|
296
279
|
"data-slot": "form-message",
|
|
297
|
-
id:
|
|
298
|
-
...
|
|
299
|
-
children:
|
|
280
|
+
id: s,
|
|
281
|
+
...o,
|
|
282
|
+
children: r
|
|
300
283
|
}
|
|
301
284
|
) : null;
|
|
302
285
|
}
|
|
303
286
|
export {
|
|
304
287
|
fe as Form,
|
|
305
|
-
|
|
306
|
-
|
|
288
|
+
_e as FormControl,
|
|
289
|
+
be as FormDescription,
|
|
307
290
|
me as FormField,
|
|
308
291
|
ye as FormItem,
|
|
309
|
-
|
|
292
|
+
ge as FormLabel,
|
|
310
293
|
Fe as FormMessage,
|
|
311
294
|
v as useFormContext,
|
|
312
295
|
x as useFormField
|