@moveindustries/movement-design-system 1.1.0 → 1.1.3

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./drawer-BkuiusSD.cjs");exports.Drawer=r.Drawer;exports.DrawerClose=r.DrawerClose;exports.DrawerContent=r.DrawerContent;exports.DrawerDescription=r.DrawerDescription;exports.DrawerFooter=r.DrawerFooter;exports.DrawerHeader=r.DrawerHeader;exports.DrawerTitle=r.DrawerTitle;exports.DrawerTrigger=r.DrawerTrigger;
@@ -0,0 +1,2 @@
1
+ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from './components/shadcn/drawer';
2
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../src/drawer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,4BAA4B,CAAC"}
package/dist/drawer.js ADDED
@@ -0,0 +1,11 @@
1
+ import { D as e, a as s, b as D, c as w, d as o, e as t, f as i, g } from "./drawer-C7hRQ7X-.js";
2
+ export {
3
+ e as Drawer,
4
+ s as DrawerClose,
5
+ D as DrawerContent,
6
+ w as DrawerDescription,
7
+ o as DrawerFooter,
8
+ t as DrawerHeader,
9
+ i as DrawerTitle,
10
+ g as DrawerTrigger
11
+ };
package/dist/forms.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),n=require("react");require("@radix-ui/react-label");const te=require("@radix-ui/react-slot"),w=require("./utils-CikHldDD.cjs"),re=require("./label-tKsAbVfX.cjs");function oe(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const I=oe(n);var se=e=>e.type==="checkbox",k=e=>e instanceof Date,L=e=>e==null;const G=e=>typeof e=="object";var h=e=>!L(e)&&!Array.isArray(e)&&G(e)&&!k(e),ne=e=>h(e)&&e.target?se(e.target)?e.target.checked:e.target.value:e,ae=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ue=(e,o)=>e.has(ae(o)),ie=e=>{const o=e.constructor&&e.constructor.prototype;return h(o)&&o.hasOwnProperty("isPrototypeOf")},le=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function z(e){if(e instanceof Date)return new Date(e);const o=typeof FileList<"u"&&e instanceof FileList;if(le&&(e instanceof Blob||o))return e;const t=Array.isArray(e);if(!t&&!(h(e)&&ie(e)))return e;const s=t?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=z(e[r]));return s}var K=e=>/^\w*$/.test(e),D=e=>e===void 0,ce=e=>Array.isArray(e)?e.filter(Boolean):[],J=e=>ce(e.replace(/["|']|\]/g,"").split(/\.|\[/)),g=(e,o,t)=>{if(!o||!h(e))return t;const s=(K(o)?[o]:J(o)).reduce((r,a)=>L(r)?r:r[a],e);return D(s)||s===e?D(e[o])?t:e[o]:s},R=e=>typeof e=="boolean",P=e=>typeof e=="function",U=(e,o,t)=>{let s=-1;const r=K(o)?[o]:J(o),a=r.length,i=a-1;for(;++s<a;){const l=r[s];let c=t;if(s!==i){const f=e[l];c=h(f)||Array.isArray(f)?f:isNaN(+r[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const $={BLUR:"blur",CHANGE:"change"},q={all:"all"},T=n.createContext(null);T.displayName="HookFormControlContext";const j=()=>n.useContext(T);var fe=(e,o,t,s=!0)=>{const r={defaultValues:o._defaultValues};for(const a in e)Object.defineProperty(r,a,{get:()=>{const i=a;return o._proxyFormState[i]!==q.all&&(o._proxyFormState[i]=!s||q.all),t&&(t[i]=!0),e[i]}});return r};const Q=typeof window<"u"?n.useLayoutEffect:n.useEffect;function X(e){const o=j(),{control:t=o,disabled:s,name:r,exact:a}=e||{},[i,l]=n.useState(t._formState),c=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Q(()=>t._subscribe({name:r,formState:c.current,exact:a,callback:f=>{!s&&l({...t._formState,...f})}}),[r,s,a]),n.useEffect(()=>{c.current.isValid&&t._setValid(!0)},[t]),n.useMemo(()=>fe(i,t,c.current,!1),[i,t])}var de=e=>typeof e=="string",H=(e,o,t,s,r)=>de(e)?g(t,e,r):Array.isArray(e)?e.map(a=>g(t,a)):t,W=e=>L(e)||!G(e);function E(e,o,t=new WeakSet){if(W(e)||W(o))return Object.is(e,o);if(k(e)&&k(o))return Object.is(e.getTime(),o.getTime());const s=Object.keys(e),r=Object.keys(o);if(s.length!==r.length)return!1;if(t.has(e)||t.has(o))return!0;t.add(e),t.add(o);for(const a of s){const i=e[a];if(!r.includes(a))return!1;if(a!=="ref"){const l=o[a];if(k(i)&&k(l)||h(i)&&h(l)||Array.isArray(i)&&Array.isArray(l)?!E(i,l,t):!Object.is(i,l))return!1}}return!0}function me(e){const o=j(),{control:t=o,name:s,defaultValue:r,disabled:a,exact:i,compute:l}=e||{},c=n.useRef(r),f=n.useRef(l),F=n.useRef(void 0),d=n.useRef(t),y=n.useRef(s);f.current=l;const[V,p]=n.useState(()=>{const u=t._getWatch(s,c.current);return f.current?f.current(u):u}),C=n.useCallback(u=>{const m=H(s,t._names,u||t._formValues,!1,c.current);return f.current?f.current(m):m},[t._formValues,t._names,s]),b=n.useCallback(u=>{if(!a){const m=H(s,t._names,u||t._formValues,!1,c.current);if(f.current){const v=f.current(m);E(v,F.current)||(p(v),F.current=v)}else p(m)}},[t._formValues,t._names,a,s]);Q(()=>((d.current!==t||!E(y.current,s))&&(d.current=t,y.current=s,b()),t._subscribe({name:s,formState:{values:!0},exact:i,callback:u=>{b(u.values)}})),[t,i,s,b]),n.useEffect(()=>t._removeUnmounted());const _=d.current!==t,O=y.current,S=n.useMemo(()=>{if(a)return null;const u=!_&&!E(O,s);return _||u?C():null},[a,_,s,O,C]);return S!==null?S:V}function ge(e){const o=j(),{name:t,disabled:s,control:r=o,shouldUnregister:a,defaultValue:i,exact:l=!0}=e,c=ue(r._names.array,t),f=n.useMemo(()=>g(r._formValues,t,g(r._defaultValues,t,i)),[r,t,i]),F=me({control:r,name:t,defaultValue:f,exact:l}),d=X({control:r,name:t,exact:l}),y=n.useRef(e),V=n.useRef(void 0),p=n.useRef(r.register(t,{...e.rules,value:F,...R(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const C=n.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(d.errors,t)},isDirty:{enumerable:!0,get:()=>!!g(d.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!g(d.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!g(d.validatingFields,t)},error:{enumerable:!0,get:()=>g(d.errors,t)}}),[d,t]),b=n.useCallback(u=>p.current.onChange({target:{value:ne(u),name:t},type:$.CHANGE}),[t]),_=n.useCallback(()=>p.current.onBlur({target:{value:g(r._formValues,t),name:t},type:$.BLUR}),[t,r._formValues]),O=n.useCallback(u=>{const m=g(r._fields,t);m&&m._f&&u&&(m._f.ref={focus:()=>P(u.focus)&&u.focus(),select:()=>P(u.select)&&u.select(),setCustomValidity:v=>P(u.setCustomValidity)&&u.setCustomValidity(v),reportValidity:()=>P(u.reportValidity)&&u.reportValidity()})},[r._fields,t]),S=n.useMemo(()=>({name:t,value:F,...R(s)||d.disabled?{disabled:d.disabled||s}:{},onChange:b,onBlur:_,ref:O}),[t,s,d.disabled,b,_,O,F]);return n.useEffect(()=>{const u=r._options.shouldUnregister||a,m=V.current;m&&m!==t&&!c&&r.unregister(m),r.register(t,{...y.current.rules,...R(y.current.disabled)?{disabled:y.current.disabled}:{}});const v=(N,ee)=>{const M=g(r._fields,N);M&&M._f&&(M._f.mount=ee)};if(v(t,!0),u){const N=z(g(r._options.defaultValues,t,y.current.defaultValue));U(r._defaultValues,t,N),D(g(r._formValues,t))&&U(r._formValues,t,N)}return!c&&r.register(t),V.current=t,()=>{(c?u&&!r._state.action:u)?r.unregister(t):v(t,!1)}},[t,r,c,a]),n.useEffect(()=>{r._setDisabledField({disabled:s,name:t})},[s,t,r]),n.useMemo(()=>({field:S,formState:d,fieldState:C}),[S,d,C])}const ye=e=>e.render(ge(e)),B=n.createContext(null);B.displayName="HookFormContext";const Fe=()=>n.useContext(B),pe=e=>{const{children:o,watch:t,getValues:s,getFieldState:r,setError:a,clearErrors:i,setValue:l,trigger:c,formState:f,resetField:F,reset:d,handleSubmit:y,unregister:V,control:p,register:C,setFocus:b,subscribe:_}=e;return n.createElement(B.Provider,{value:n.useMemo(()=>({watch:t,getValues:s,getFieldState:r,setError:a,clearErrors:i,setValue:l,trigger:c,formState:f,resetField:F,reset:d,handleSubmit:y,unregister:V,control:p,register:C,setFocus:b,subscribe:_}),[i,p,f,r,s,y,C,d,F,a,b,l,_,c,V,t])},n.createElement(T.Provider,{value:p},o))},be=pe,Y=I.createContext({}),_e=({...e})=>x.jsx(Y.Provider,{value:{name:e.name},children:x.jsx(ye,{...e})}),A=()=>{const e=I.useContext(Y),o=I.useContext(Z),{getFieldState:t}=Fe(),s=X({name:e.name}),r=t(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=o;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...r}},Z=I.createContext({});function Ce({className:e,...o}){const t=I.useId();return x.jsx(Z.Provider,{value:{id:t},children:x.jsx("div",{"data-slot":"form-item",className:w.cn("grid gap-2",e),...o})})}function ve({className:e,...o}){const{error:t,formItemId:s}=A();return x.jsx(re.Label,{"data-slot":"form-label","data-error":!!t,className:w.cn("data-[error=true]:text-destructive",e),htmlFor:s,...o})}function xe({...e}){const{error:o,formItemId:t,formDescriptionId:s,formMessageId:r}=A();return x.jsx(te.Slot,{"data-slot":"form-control",id:t,"aria-describedby":o?`${s} ${r}`:`${s}`,"aria-invalid":!!o,...e})}function Ve({className:e,...o}){const{formDescriptionId:t}=A();return x.jsx("p",{"data-slot":"form-description",id:t,className:w.cn("text-muted-foreground text-sm",e),...o})}function he({className:e,...o}){const{error:t,formMessageId:s}=A(),r=t?String(t?.message??""):o.children;return r?x.jsx("p",{"data-slot":"form-message",id:s,className:w.cn("text-destructive text-sm",e),...o,children:r}):null}exports.Form=be;exports.FormControl=xe;exports.FormDescription=Ve;exports.FormField=_e;exports.FormItem=Ce;exports.FormLabel=ve;exports.FormMessage=he;exports.useFormField=A;
@@ -0,0 +1,2 @@
1
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, } from './components/shadcn/form';
2
+ //# sourceMappingURL=forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,GACb,MAAM,0BAA0B,CAAC"}
package/dist/forms.js ADDED
@@ -0,0 +1,386 @@
1
+ import { jsx as v } from "react/jsx-runtime";
2
+ import * as S from "react";
3
+ import n from "react";
4
+ import "@radix-ui/react-label";
5
+ import { Slot as te } from "@radix-ui/react-slot";
6
+ import { c as P } from "./utils-eGXXUFl7.js";
7
+ import { L as re } from "./label-CPL77haD.js";
8
+ var oe = (e) => e.type === "checkbox", O = (e) => e instanceof Date, L = (e) => e == null;
9
+ const K = (e) => typeof e == "object";
10
+ var x = (e) => !L(e) && !Array.isArray(e) && K(e) && !O(e), se = (e) => x(e) && e.target ? oe(e.target) ? e.target.checked : e.target.value : e, ne = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ae = (e, o) => e.has(ne(o)), ue = (e) => {
11
+ const o = e.constructor && e.constructor.prototype;
12
+ return x(o) && o.hasOwnProperty("isPrototypeOf");
13
+ }, ie = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
14
+ function z(e) {
15
+ if (e instanceof Date)
16
+ return new Date(e);
17
+ const o = typeof FileList < "u" && e instanceof FileList;
18
+ if (ie && (e instanceof Blob || o))
19
+ return e;
20
+ const t = Array.isArray(e);
21
+ if (!t && !(x(e) && ue(e)))
22
+ return e;
23
+ const s = t ? [] : Object.create(Object.getPrototypeOf(e));
24
+ for (const r in e)
25
+ Object.prototype.hasOwnProperty.call(e, r) && (s[r] = z(e[r]));
26
+ return s;
27
+ }
28
+ var J = (e) => /^\w*$/.test(e), D = (e) => e === void 0, le = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Q = (e) => le(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, o, t) => {
29
+ if (!o || !x(e))
30
+ return t;
31
+ const s = (J(o) ? [o] : Q(o)).reduce((r, a) => L(r) ? r : r[a], e);
32
+ return D(s) || s === e ? D(e[o]) ? t : e[o] : s;
33
+ }, M = (e) => typeof e == "boolean", E = (e) => typeof e == "function", $ = (e, o, t) => {
34
+ let s = -1;
35
+ const r = J(o) ? [o] : Q(o), a = r.length, i = a - 1;
36
+ for (; ++s < a; ) {
37
+ const l = r[s];
38
+ let c = t;
39
+ if (s !== i) {
40
+ const f = e[l];
41
+ c = x(f) || Array.isArray(f) ? f : isNaN(+r[s + 1]) ? {} : [];
42
+ }
43
+ if (l === "__proto__" || l === "constructor" || l === "prototype")
44
+ return;
45
+ e[l] = c, e = e[l];
46
+ }
47
+ };
48
+ const H = {
49
+ BLUR: "blur",
50
+ CHANGE: "change"
51
+ }, W = {
52
+ all: "all"
53
+ }, B = n.createContext(null);
54
+ B.displayName = "HookFormControlContext";
55
+ const T = () => n.useContext(B);
56
+ var ce = (e, o, t, s = !0) => {
57
+ const r = {
58
+ defaultValues: o._defaultValues
59
+ };
60
+ for (const a in e)
61
+ Object.defineProperty(r, a, {
62
+ get: () => {
63
+ const i = a;
64
+ return o._proxyFormState[i] !== W.all && (o._proxyFormState[i] = !s || W.all), t && (t[i] = !0), e[i];
65
+ }
66
+ });
67
+ return r;
68
+ };
69
+ const X = typeof window < "u" ? n.useLayoutEffect : n.useEffect;
70
+ function Y(e) {
71
+ const o = T(), { control: t = o, disabled: s, name: r, exact: a } = e || {}, [i, l] = n.useState(t._formState), c = n.useRef({
72
+ isDirty: !1,
73
+ isLoading: !1,
74
+ dirtyFields: !1,
75
+ touchedFields: !1,
76
+ validatingFields: !1,
77
+ isValidating: !1,
78
+ isValid: !1,
79
+ errors: !1
80
+ });
81
+ return X(() => t._subscribe({
82
+ name: r,
83
+ formState: c.current,
84
+ exact: a,
85
+ callback: (f) => {
86
+ !s && l({
87
+ ...t._formState,
88
+ ...f
89
+ });
90
+ }
91
+ }), [r, s, a]), n.useEffect(() => {
92
+ c.current.isValid && t._setValid(!0);
93
+ }, [t]), n.useMemo(() => ce(i, t, c.current, !1), [i, t]);
94
+ }
95
+ var fe = (e) => typeof e == "string", G = (e, o, t, s, r) => fe(e) ? y(t, e, r) : Array.isArray(e) ? e.map((a) => y(t, a)) : t, q = (e) => L(e) || !K(e);
96
+ function N(e, o, t = /* @__PURE__ */ new WeakSet()) {
97
+ if (q(e) || q(o))
98
+ return Object.is(e, o);
99
+ if (O(e) && O(o))
100
+ return Object.is(e.getTime(), o.getTime());
101
+ const s = Object.keys(e), r = Object.keys(o);
102
+ if (s.length !== r.length)
103
+ return !1;
104
+ if (t.has(e) || t.has(o))
105
+ return !0;
106
+ t.add(e), t.add(o);
107
+ for (const a of s) {
108
+ const i = e[a];
109
+ if (!r.includes(a))
110
+ return !1;
111
+ if (a !== "ref") {
112
+ const l = o[a];
113
+ if (O(i) && O(l) || x(i) && x(l) || Array.isArray(i) && Array.isArray(l) ? !N(i, l, t) : !Object.is(i, l))
114
+ return !1;
115
+ }
116
+ }
117
+ return !0;
118
+ }
119
+ function de(e) {
120
+ const o = T(), { control: t = o, name: s, defaultValue: r, disabled: a, exact: i, compute: l } = e || {}, c = n.useRef(r), f = n.useRef(l), p = n.useRef(void 0), d = n.useRef(t), g = n.useRef(s);
121
+ f.current = l;
122
+ const [h, F] = n.useState(() => {
123
+ const u = t._getWatch(s, c.current);
124
+ return f.current ? f.current(u) : u;
125
+ }), b = n.useCallback((u) => {
126
+ const m = G(s, t._names, u || t._formValues, !1, c.current);
127
+ return f.current ? f.current(m) : m;
128
+ }, [t._formValues, t._names, s]), _ = n.useCallback((u) => {
129
+ if (!a) {
130
+ const m = G(s, t._names, u || t._formValues, !1, c.current);
131
+ if (f.current) {
132
+ const V = f.current(m);
133
+ N(V, p.current) || (F(V), p.current = V);
134
+ } else
135
+ F(m);
136
+ }
137
+ }, [t._formValues, t._names, a, s]);
138
+ X(() => ((d.current !== t || !N(g.current, s)) && (d.current = t, g.current = s, _()), t._subscribe({
139
+ name: s,
140
+ formState: {
141
+ values: !0
142
+ },
143
+ exact: i,
144
+ callback: (u) => {
145
+ _(u.values);
146
+ }
147
+ })), [t, i, s, _]), n.useEffect(() => t._removeUnmounted());
148
+ const C = d.current !== t, k = g.current, I = n.useMemo(() => {
149
+ if (a)
150
+ return null;
151
+ const u = !C && !N(k, s);
152
+ return C || u ? b() : null;
153
+ }, [a, C, s, k, b]);
154
+ return I !== null ? I : h;
155
+ }
156
+ function me(e) {
157
+ const o = T(), { name: t, disabled: s, control: r = o, shouldUnregister: a, defaultValue: i, exact: l = !0 } = e, c = ae(r._names.array, t), f = n.useMemo(() => y(r._formValues, t, y(r._defaultValues, t, i)), [r, t, i]), p = de({
158
+ control: r,
159
+ name: t,
160
+ defaultValue: f,
161
+ exact: l
162
+ }), d = Y({
163
+ control: r,
164
+ name: t,
165
+ exact: l
166
+ }), g = n.useRef(e), h = n.useRef(void 0), F = n.useRef(r.register(t, {
167
+ ...e.rules,
168
+ value: p,
169
+ ...M(e.disabled) ? { disabled: e.disabled } : {}
170
+ }));
171
+ g.current = e;
172
+ const b = n.useMemo(() => Object.defineProperties({}, {
173
+ invalid: {
174
+ enumerable: !0,
175
+ get: () => !!y(d.errors, t)
176
+ },
177
+ isDirty: {
178
+ enumerable: !0,
179
+ get: () => !!y(d.dirtyFields, t)
180
+ },
181
+ isTouched: {
182
+ enumerable: !0,
183
+ get: () => !!y(d.touchedFields, t)
184
+ },
185
+ isValidating: {
186
+ enumerable: !0,
187
+ get: () => !!y(d.validatingFields, t)
188
+ },
189
+ error: {
190
+ enumerable: !0,
191
+ get: () => y(d.errors, t)
192
+ }
193
+ }), [d, t]), _ = n.useCallback((u) => F.current.onChange({
194
+ target: {
195
+ value: se(u),
196
+ name: t
197
+ },
198
+ type: H.CHANGE
199
+ }), [t]), C = n.useCallback(() => F.current.onBlur({
200
+ target: {
201
+ value: y(r._formValues, t),
202
+ name: t
203
+ },
204
+ type: H.BLUR
205
+ }), [t, r._formValues]), k = n.useCallback((u) => {
206
+ const m = y(r._fields, t);
207
+ m && m._f && u && (m._f.ref = {
208
+ focus: () => E(u.focus) && u.focus(),
209
+ select: () => E(u.select) && u.select(),
210
+ setCustomValidity: (V) => E(u.setCustomValidity) && u.setCustomValidity(V),
211
+ reportValidity: () => E(u.reportValidity) && u.reportValidity()
212
+ });
213
+ }, [r._fields, t]), I = n.useMemo(() => ({
214
+ name: t,
215
+ value: p,
216
+ ...M(s) || d.disabled ? { disabled: d.disabled || s } : {},
217
+ onChange: _,
218
+ onBlur: C,
219
+ ref: k
220
+ }), [t, s, d.disabled, _, C, k, p]);
221
+ return n.useEffect(() => {
222
+ const u = r._options.shouldUnregister || a, m = h.current;
223
+ m && m !== t && !c && r.unregister(m), r.register(t, {
224
+ ...g.current.rules,
225
+ ...M(g.current.disabled) ? { disabled: g.current.disabled } : {}
226
+ });
227
+ const V = (A, ee) => {
228
+ const R = y(r._fields, A);
229
+ R && R._f && (R._f.mount = ee);
230
+ };
231
+ if (V(t, !0), u) {
232
+ const A = z(y(r._options.defaultValues, t, g.current.defaultValue));
233
+ $(r._defaultValues, t, A), D(y(r._formValues, t)) && $(r._formValues, t, A);
234
+ }
235
+ return !c && r.register(t), h.current = t, () => {
236
+ (c ? u && !r._state.action : u) ? r.unregister(t) : V(t, !1);
237
+ };
238
+ }, [t, r, c, a]), n.useEffect(() => {
239
+ r._setDisabledField({
240
+ disabled: s,
241
+ name: t
242
+ });
243
+ }, [s, t, r]), n.useMemo(() => ({
244
+ field: I,
245
+ formState: d,
246
+ fieldState: b
247
+ }), [I, d, b]);
248
+ }
249
+ const ye = (e) => e.render(me(e)), U = n.createContext(null);
250
+ U.displayName = "HookFormContext";
251
+ const ge = () => n.useContext(U), pe = (e) => {
252
+ const { children: o, watch: t, getValues: s, getFieldState: r, setError: a, clearErrors: i, setValue: l, trigger: c, formState: f, resetField: p, reset: d, handleSubmit: g, unregister: h, control: F, register: b, setFocus: _, subscribe: C } = e;
253
+ return n.createElement(
254
+ U.Provider,
255
+ { value: n.useMemo(() => ({
256
+ watch: t,
257
+ getValues: s,
258
+ getFieldState: r,
259
+ setError: a,
260
+ clearErrors: i,
261
+ setValue: l,
262
+ trigger: c,
263
+ formState: f,
264
+ resetField: p,
265
+ reset: d,
266
+ handleSubmit: g,
267
+ unregister: h,
268
+ control: F,
269
+ register: b,
270
+ setFocus: _,
271
+ subscribe: C
272
+ }), [
273
+ i,
274
+ F,
275
+ f,
276
+ r,
277
+ s,
278
+ g,
279
+ b,
280
+ d,
281
+ p,
282
+ a,
283
+ _,
284
+ l,
285
+ C,
286
+ c,
287
+ h,
288
+ t
289
+ ]) },
290
+ n.createElement(B.Provider, { value: F }, o)
291
+ );
292
+ }, he = pe, Z = S.createContext(
293
+ {}
294
+ ), xe = ({
295
+ ...e
296
+ }) => /* @__PURE__ */ v(Z.Provider, { value: { name: e.name }, children: /* @__PURE__ */ v(ye, { ...e }) }), w = () => {
297
+ const e = S.useContext(Z), o = S.useContext(j), { getFieldState: t } = ge(), s = Y({ name: e.name }), r = t(e.name, s);
298
+ if (!e)
299
+ throw new Error("useFormField should be used within <FormField>");
300
+ const { id: a } = o;
301
+ return {
302
+ id: a,
303
+ name: e.name,
304
+ formItemId: `${a}-form-item`,
305
+ formDescriptionId: `${a}-form-item-description`,
306
+ formMessageId: `${a}-form-item-message`,
307
+ ...r
308
+ };
309
+ }, j = S.createContext(
310
+ {}
311
+ );
312
+ function ke({ className: e, ...o }) {
313
+ const t = S.useId();
314
+ return /* @__PURE__ */ v(j.Provider, { value: { id: t }, children: /* @__PURE__ */ v(
315
+ "div",
316
+ {
317
+ "data-slot": "form-item",
318
+ className: P("grid gap-2", e),
319
+ ...o
320
+ }
321
+ ) });
322
+ }
323
+ function Ie({
324
+ className: e,
325
+ ...o
326
+ }) {
327
+ const { error: t, formItemId: s } = w();
328
+ return /* @__PURE__ */ v(
329
+ re,
330
+ {
331
+ "data-slot": "form-label",
332
+ "data-error": !!t,
333
+ className: P("data-[error=true]:text-destructive", e),
334
+ htmlFor: s,
335
+ ...o
336
+ }
337
+ );
338
+ }
339
+ function Oe({ ...e }) {
340
+ const { error: o, formItemId: t, formDescriptionId: s, formMessageId: r } = w();
341
+ return /* @__PURE__ */ v(
342
+ te,
343
+ {
344
+ "data-slot": "form-control",
345
+ id: t,
346
+ "aria-describedby": o ? `${s} ${r}` : `${s}`,
347
+ "aria-invalid": !!o,
348
+ ...e
349
+ }
350
+ );
351
+ }
352
+ function Se({ className: e, ...o }) {
353
+ const { formDescriptionId: t } = w();
354
+ return /* @__PURE__ */ v(
355
+ "p",
356
+ {
357
+ "data-slot": "form-description",
358
+ id: t,
359
+ className: P("text-muted-foreground text-sm", e),
360
+ ...o
361
+ }
362
+ );
363
+ }
364
+ function Ae({ className: e, ...o }) {
365
+ const { error: t, formMessageId: s } = w(), r = t ? String(t?.message ?? "") : o.children;
366
+ return r ? /* @__PURE__ */ v(
367
+ "p",
368
+ {
369
+ "data-slot": "form-message",
370
+ id: s,
371
+ className: P("text-destructive text-sm", e),
372
+ ...o,
373
+ children: r
374
+ }
375
+ ) : null;
376
+ }
377
+ export {
378
+ he as Form,
379
+ Oe as FormControl,
380
+ Se as FormDescription,
381
+ xe as FormField,
382
+ ke as FormItem,
383
+ Ie as FormLabel,
384
+ Ae as FormMessage,
385
+ w as useFormField
386
+ };
@@ -0,0 +1 @@
1
+ "use strict";const O=require("./utils-CikHldDD.cjs"),m=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,y=O.clsx,b=(e,l)=>n=>{var d;if(l?.variants==null)return y(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=l,V=Object.keys(o).map(t=>{const a=n?.[t],u=s?.[t];if(a===null)return null;const i=m(a)||m(u);return o[t][i]}),v=n&&Object.entries(n).reduce((t,a)=>{let[u,i]=a;return i===void 0||(t[u]=i),t},{}),N=l==null||(d=l.compoundVariants)===null||d===void 0?void 0:d.reduce((t,a)=>{let{class:u,className:i,...C}=a;return Object.entries(C).every(f=>{let[c,r]=f;return Array.isArray(r)?r.includes({...s,...v}[c]):{...s,...v}[c]===r})?[...t,u,i]:t},[]);return y(e,V,N,n?.class,n?.className)};exports.cva=b;
@@ -0,0 +1,34 @@
1
+ import { a as O } from "./utils-eGXXUFl7.js";
2
+ const m = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, y = O, j = (e, l) => (n) => {
3
+ var u;
4
+ if (l?.variants == null) return y(e, n?.class, n?.className);
5
+ const { variants: r, defaultVariants: d } = l, V = Object.keys(r).map((t) => {
6
+ const a = n?.[t], s = d?.[t];
7
+ if (a === null) return null;
8
+ const i = m(a) || m(s);
9
+ return r[t][i];
10
+ }), v = n && Object.entries(n).reduce((t, a) => {
11
+ let [s, i] = a;
12
+ return i === void 0 || (t[s] = i), t;
13
+ }, {}), N = l == null || (u = l.compoundVariants) === null || u === void 0 ? void 0 : u.reduce((t, a) => {
14
+ let { class: s, className: i, ...f } = a;
15
+ return Object.entries(f).every((C) => {
16
+ let [c, o] = C;
17
+ return Array.isArray(o) ? o.includes({
18
+ ...d,
19
+ ...v
20
+ }[c]) : {
21
+ ...d,
22
+ ...v
23
+ }[c] === o;
24
+ }) ? [
25
+ ...t,
26
+ s,
27
+ i
28
+ ] : t;
29
+ }, []);
30
+ return y(e, V, N, n?.class, n?.className);
31
+ };
32
+ export {
33
+ j as c
34
+ };