ivt 0.0.9 → 0.1.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/accordion/index.mjs +1 -1
- package/dist/alert/index.mjs +1 -1
- package/dist/avatar/index.mjs +1 -1
- package/dist/badge/index.mjs +1 -1
- package/dist/base/index.mjs +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/calendar/index.mjs +1 -1
- package/dist/card/index.mjs +1 -1
- package/dist/checkbox/index.mjs +1 -1
- package/dist/chunks/{TextWrap-Dl2hdlNW.mjs → TextWrap-23P8STqb.mjs} +2 -2
- package/dist/chunks/{TextWrap-Dl2hdlNW.mjs.map → TextWrap-23P8STqb.mjs.map} +1 -1
- package/dist/chunks/{accordion-CmREbOZu.mjs → accordion-pKx1Q4tK.mjs} +2 -2
- package/dist/chunks/{accordion-CmREbOZu.mjs.map → accordion-pKx1Q4tK.mjs.map} +1 -1
- package/dist/chunks/{badge-C8zgs_tL.mjs → badge-Cy4rR7ko.mjs} +2 -2
- package/dist/chunks/{badge-C8zgs_tL.mjs.map → badge-Cy4rR7ko.mjs.map} +1 -1
- package/dist/chunks/bundle-mjs-E0baekTQ.mjs +2 -0
- package/dist/chunks/bundle-mjs-E0baekTQ.mjs.map +1 -0
- package/dist/chunks/{button-nH1thepn.mjs → button-L19W2fGF.mjs} +2 -2
- package/dist/chunks/{button-nH1thepn.mjs.map → button-L19W2fGF.mjs.map} +1 -1
- package/dist/chunks/{calendar-kXnIApaf.mjs → calendar-BQrtnevv.mjs} +2 -2
- package/dist/chunks/{calendar-kXnIApaf.mjs.map → calendar-BQrtnevv.mjs.map} +1 -1
- package/dist/chunks/{command-DGFeu1l0.mjs → command-BLs86fLx.mjs} +2 -2
- package/dist/chunks/{command-DGFeu1l0.mjs.map → command-BLs86fLx.mjs.map} +1 -1
- package/dist/chunks/{dialog-CK4LXN-o.mjs → dialog-BDBNWwYT.mjs} +2 -2
- package/dist/chunks/{dialog-CK4LXN-o.mjs.map → dialog-BDBNWwYT.mjs.map} +1 -1
- package/dist/chunks/{hover-card-CQqdx2Ss.mjs → hover-card-BjXLQEhK.mjs} +2 -2
- package/dist/chunks/{hover-card-CQqdx2Ss.mjs.map → hover-card-BjXLQEhK.mjs.map} +1 -1
- package/dist/chunks/{input-C42RCjiu.mjs → input-CIOLnRPP.mjs} +2 -2
- package/dist/chunks/{input-C42RCjiu.mjs.map → input-CIOLnRPP.mjs.map} +1 -1
- package/dist/chunks/{label-CYa-od6V.mjs → label-JzY_9HXj.mjs} +2 -2
- package/dist/chunks/{label-CYa-od6V.mjs.map → label-JzY_9HXj.mjs.map} +1 -1
- package/dist/chunks/{pagination-CA8cg0Ef.mjs → pagination-Duu8Xw3w.mjs} +2 -2
- package/dist/chunks/{pagination-CA8cg0Ef.mjs.map → pagination-Duu8Xw3w.mjs.map} +1 -1
- package/dist/chunks/{popover-Bnsc9Msi.mjs → popover-CstNJ6EN.mjs} +2 -2
- package/dist/chunks/{popover-Bnsc9Msi.mjs.map → popover-CstNJ6EN.mjs.map} +1 -1
- package/dist/chunks/{progress-D3QmAjD-.mjs → progress-sKEf-fjz.mjs} +2 -2
- package/dist/chunks/{progress-D3QmAjD-.mjs.map → progress-sKEf-fjz.mjs.map} +1 -1
- package/dist/chunks/{scroll-area-BQVIH3mC.mjs → scroll-area-B-ktzHvu.mjs} +2 -2
- package/dist/chunks/{scroll-area-BQVIH3mC.mjs.map → scroll-area-B-ktzHvu.mjs.map} +1 -1
- package/dist/chunks/{select-D7mWN4gA.mjs → select-DqeznJec.mjs} +2 -2
- package/dist/chunks/{select-D7mWN4gA.mjs.map → select-DqeznJec.mjs.map} +1 -1
- package/dist/chunks/{skeleton-m5uG2KMb.mjs → skeleton-cSOJ-vH8.mjs} +2 -2
- package/dist/chunks/{skeleton-m5uG2KMb.mjs.map → skeleton-cSOJ-vH8.mjs.map} +1 -1
- package/dist/chunks/{sortable-DtvuiJmc.mjs → sortable-BX5MRGOc.mjs} +2 -2
- package/dist/chunks/{sortable-DtvuiJmc.mjs.map → sortable-BX5MRGOc.mjs.map} +1 -1
- package/dist/chunks/{table-BaYgiNHD.mjs → table-BGjJ1DhO.mjs} +2 -2
- package/dist/chunks/{table-BaYgiNHD.mjs.map → table-BGjJ1DhO.mjs.map} +1 -1
- package/dist/chunks/{utils-DRGc21x1.mjs → utils-C6LYO_CH.mjs} +2 -2
- package/dist/chunks/{utils-DRGc21x1.mjs.map → utils-C6LYO_CH.mjs.map} +1 -1
- package/dist/command/index.mjs +1 -1
- package/dist/data-table/index.mjs +1 -1
- package/dist/data-table/index.mjs.map +1 -1
- package/dist/dialog/index.mjs +1 -1
- package/dist/dropdown-menu/index.mjs +1 -1
- package/dist/dropzone/index.mjs +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.mjs +1 -1
- package/dist/form/index.mjs.map +1 -1
- package/dist/hover-card/index.mjs +1 -1
- package/dist/icon/index.mjs +1 -1
- package/dist/input/index.mjs +1 -1
- package/dist/label/index.mjs +1 -1
- package/dist/pagination/index.mjs +1 -1
- package/dist/popover/index.mjs +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/scroll-area/index.mjs +1 -1
- package/dist/select/index.mjs +1 -1
- package/dist/separator/index.mjs +1 -1
- package/dist/sheet/index.mjs +1 -1
- package/dist/skeleton/index.mjs +1 -1
- package/dist/sonner/index.d.ts +5 -0
- package/dist/sonner/index.mjs +2 -0
- package/dist/sonner/index.mjs.map +1 -0
- package/dist/sortable/index.mjs +1 -1
- package/dist/table/index.mjs +1 -1
- package/dist/tabs/index.mjs +1 -1
- package/dist/toast/index.mjs +1 -1
- package/dist/tooltip/index.mjs +1 -1
- package/package.json +7 -3
- package/dist/chunks/bundle-mjs-AZJHj4Ev.mjs +0 -2
- package/dist/chunks/bundle-mjs-AZJHj4Ev.mjs.map +0 -1
package/dist/dropzone/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import a,{useRef as t,useEffect as i,useMemo as e,useCallback as n,useState as o,forwardRef as p,useImperativeHandle as c,Fragment as r,useReducer as l}from"react";import{c as s,f as d}from"../chunks/utils-
|
1
|
+
import a,{useRef as t,useEffect as i,useMemo as e,useCallback as n,useState as o,forwardRef as p,useImperativeHandle as c,Fragment as r,useReducer as l}from"react";import{c as s,f as d}from"../chunks/utils-C6LYO_CH.mjs";import{c as m}from"../chunks/tslib.es6-DnJNy3VA.mjs";import{c as u}from"../chunks/createLucideIcon-NXzoJfn7.mjs";import{P as f}from"../chunks/progress-sKEf-fjz.mjs";import{X as v}from"../chunks/x-DjF9gicP.mjs";import{S as x}from"../chunks/scroll-area-B-ktzHvu.mjs";import{B as g}from"../chunks/button-L19W2fGF.mjs";import"../chunks/bundle-mjs-E0baekTQ.mjs";import"../chunks/index-BkrjWCcN.mjs";import"react/jsx-runtime";import"../chunks/index-5xCD9zck.mjs";import"react-dom";import"@radix-ui/react-slot";import"../chunks/index-BzUzK8k1.mjs";import"../chunks/index-CBuWa3V_.mjs";import"../chunks/index-DXDEMoyA.mjs";import"class-variance-authority";const b=u("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),y=u("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);function h(a){const n=t(a);return i((()=>{n.current=a})),e((()=>(...a)=>n.current?.(...a)),[])}function w({prop:a,defaultProp:e,onChange:p=()=>{}}){const[c,r]=function({defaultProp:a,onChange:e}){const n=o(a),[p]=n,c=t(p),r=h(e);return i((()=>{c.current!==p&&(r(p),c.current=p)}),[p,c,r]),n}({defaultProp:e,onChange:p}),l=void 0!==a,s=l?a:c,d=h(p),m=n((t=>{if(l){const i="function"==typeof t?t(a):t;i!==a&&d(i)}else r(t)}),[l,a,r,d]);return[s,m]}let k=0;const j=new Map,E=a=>{if(j.has(a))return;const t=setTimeout((()=>{j.delete(a),D({type:"REMOVE_TOAST",toastId:a})}),1e6);j.set(a,t)},O=(a,t)=>{switch(t.type){case"ADD_TOAST":return{...a,toasts:[t.toast,...a.toasts].slice(0,1)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map((a=>a.id===t.toast.id?{...a,...t.toast}:a))};case"DISMISS_TOAST":{const{toastId:i}=t;if(i)E(i);else for(const t of a.toasts)E(t.id);return{...a,toasts:a.toasts.map((a=>a.id===i||void 0===i?{...a,open:!1}:a))}}case"REMOVE_TOAST":return void 0===t.toastId?{...a,toasts:[]}:{...a,toasts:a.toasts.filter((a=>a.id!==t.toastId))}}},z=[];let S={toasts:[]};function D(a){S=O(S,a);for(const a of z)a(S)}function A({...a}){const t=(k=(k+1)%Number.MAX_SAFE_INTEGER,k.toString()),i=()=>D({type:"DISMISS_TOAST",toastId:t});return D({type:"ADD_TOAST",toast:{...a,id:t,open:!0,onOpenChange:a=>{a||i()}}}),{id:t,dismiss:i,update:a=>D({type:"UPDATE_TOAST",toast:{...a,id:t}})}}function P(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var T,F={exports:{}},q={exports:{}},C={};var I,N,$,_,R,M,L,V,B,U,W,K,H,Y,G,J={};function X(){return N||(N=1,"production"===process.env.NODE_ENV?q.exports=function(){if(T)return C;T=1;var a="function"==typeof Symbol&&Symbol.for,t=a?Symbol.for("react.element"):60103,i=a?Symbol.for("react.portal"):60106,e=a?Symbol.for("react.fragment"):60107,n=a?Symbol.for("react.strict_mode"):60108,o=a?Symbol.for("react.profiler"):60114,p=a?Symbol.for("react.provider"):60109,c=a?Symbol.for("react.context"):60110,r=a?Symbol.for("react.async_mode"):60111,l=a?Symbol.for("react.concurrent_mode"):60111,s=a?Symbol.for("react.forward_ref"):60112,d=a?Symbol.for("react.suspense"):60113,m=a?Symbol.for("react.suspense_list"):60120,u=a?Symbol.for("react.memo"):60115,f=a?Symbol.for("react.lazy"):60116,v=a?Symbol.for("react.block"):60121,x=a?Symbol.for("react.fundamental"):60117,g=a?Symbol.for("react.responder"):60118,b=a?Symbol.for("react.scope"):60119;function y(a){if("object"==typeof a&&null!==a){var m=a.$$typeof;switch(m){case t:switch(a=a.type){case r:case l:case e:case o:case n:case d:return a;default:switch(a=a&&a.$$typeof){case c:case s:case f:case u:case p:return a;default:return m}}case i:return m}}}function h(a){return y(a)===l}return C.AsyncMode=r,C.ConcurrentMode=l,C.ContextConsumer=c,C.ContextProvider=p,C.Element=t,C.ForwardRef=s,C.Fragment=e,C.Lazy=f,C.Memo=u,C.Portal=i,C.Profiler=o,C.StrictMode=n,C.Suspense=d,C.isAsyncMode=function(a){return h(a)||y(a)===r},C.isConcurrentMode=h,C.isContextConsumer=function(a){return y(a)===c},C.isContextProvider=function(a){return y(a)===p},C.isElement=function(a){return"object"==typeof a&&null!==a&&a.$$typeof===t},C.isForwardRef=function(a){return y(a)===s},C.isFragment=function(a){return y(a)===e},C.isLazy=function(a){return y(a)===f},C.isMemo=function(a){return y(a)===u},C.isPortal=function(a){return y(a)===i},C.isProfiler=function(a){return y(a)===o},C.isStrictMode=function(a){return y(a)===n},C.isSuspense=function(a){return y(a)===d},C.isValidElementType=function(a){return"string"==typeof a||"function"==typeof a||a===e||a===l||a===o||a===n||a===d||a===m||"object"==typeof a&&null!==a&&(a.$$typeof===f||a.$$typeof===u||a.$$typeof===p||a.$$typeof===c||a.$$typeof===s||a.$$typeof===x||a.$$typeof===g||a.$$typeof===b||a.$$typeof===v)},C.typeOf=y,C}():q.exports=(I||(I=1,"production"!==process.env.NODE_ENV&&function(){var a="function"==typeof Symbol&&Symbol.for,t=a?Symbol.for("react.element"):60103,i=a?Symbol.for("react.portal"):60106,e=a?Symbol.for("react.fragment"):60107,n=a?Symbol.for("react.strict_mode"):60108,o=a?Symbol.for("react.profiler"):60114,p=a?Symbol.for("react.provider"):60109,c=a?Symbol.for("react.context"):60110,r=a?Symbol.for("react.async_mode"):60111,l=a?Symbol.for("react.concurrent_mode"):60111,s=a?Symbol.for("react.forward_ref"):60112,d=a?Symbol.for("react.suspense"):60113,m=a?Symbol.for("react.suspense_list"):60120,u=a?Symbol.for("react.memo"):60115,f=a?Symbol.for("react.lazy"):60116,v=a?Symbol.for("react.block"):60121,x=a?Symbol.for("react.fundamental"):60117,g=a?Symbol.for("react.responder"):60118,b=a?Symbol.for("react.scope"):60119;function y(a){if("object"==typeof a&&null!==a){var m=a.$$typeof;switch(m){case t:var v=a.type;switch(v){case r:case l:case e:case o:case n:case d:return v;default:var x=v&&v.$$typeof;switch(x){case c:case s:case f:case u:case p:return x;default:return m}}case i:return m}}}var h=r,w=l,k=c,j=p,E=t,O=s,z=e,S=f,D=u,A=i,P=o,T=n,F=d,q=!1;function C(a){return y(a)===l}J.AsyncMode=h,J.ConcurrentMode=w,J.ContextConsumer=k,J.ContextProvider=j,J.Element=E,J.ForwardRef=O,J.Fragment=z,J.Lazy=S,J.Memo=D,J.Portal=A,J.Profiler=P,J.StrictMode=T,J.Suspense=F,J.isAsyncMode=function(a){return q||(q=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(a)||y(a)===r},J.isConcurrentMode=C,J.isContextConsumer=function(a){return y(a)===c},J.isContextProvider=function(a){return y(a)===p},J.isElement=function(a){return"object"==typeof a&&null!==a&&a.$$typeof===t},J.isForwardRef=function(a){return y(a)===s},J.isFragment=function(a){return y(a)===e},J.isLazy=function(a){return y(a)===f},J.isMemo=function(a){return y(a)===u},J.isPortal=function(a){return y(a)===i},J.isProfiler=function(a){return y(a)===o},J.isStrictMode=function(a){return y(a)===n},J.isSuspense=function(a){return y(a)===d},J.isValidElementType=function(a){return"string"==typeof a||"function"==typeof a||a===e||a===l||a===o||a===n||a===d||a===m||"object"==typeof a&&null!==a&&(a.$$typeof===f||a.$$typeof===u||a.$$typeof===p||a.$$typeof===c||a.$$typeof===s||a.$$typeof===x||a.$$typeof===g||a.$$typeof===b||a.$$typeof===v)},J.typeOf=y}()),J)),q.exports}
|
2
2
|
/*
|
3
3
|
object-assign
|
4
4
|
(c) Sindre Sorhus
|
package/dist/form/index.d.ts
CHANGED
@@ -5,7 +5,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
5
|
import { Slot } from '@radix-ui/react-slot';
|
6
6
|
import * as React from 'react';
|
7
7
|
|
8
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues
|
8
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
9
9
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
10
10
|
declare const useFormField: () => {
|
11
11
|
invalid: boolean;
|
package/dist/form/index.mjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{Slot as e}from"@radix-ui/react-slot";import*as t from"react";import r from"react";import{c as
|
1
|
+
import{Slot as e}from"@radix-ui/react-slot";import*as t from"react";import r from"react";import{c as a}from"../chunks/utils-C6LYO_CH.mjs";import{L as s}from"../chunks/label-JzY_9HXj.mjs";import"../chunks/bundle-mjs-E0baekTQ.mjs";import"../chunks/index-5xCD9zck.mjs";import"react-dom";import"react/jsx-runtime";var o=e=>null==e;var n=e=>!o(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),i=e=>n(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,l="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function c(e){let t;const r=Array.isArray(e),a="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(l&&(e instanceof Blob||a)||!r&&!n(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return n(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=c(e[r]));else t=e}return t}var u=e=>Array.isArray(e)?e.filter(Boolean):[],d=e=>void 0===e,m=(e,t,r)=>{if(!t||!n(e))return r;const a=u(t.split(/[,[\].]+?/)).reduce(((e,t)=>o(e)?e:e[t]),e);return d(a)||a===e?d(e[t])?r:e[t]:a},f=e=>"boolean"==typeof e,p=(e,t,r)=>{let a=-1;const s=(e=>/^\w*$/.test(e))(t)?[t]:u(t.replace(/["|']|\]/g,"").split(/\.|\[/));const o=s.length,i=o-1;for(;++a<o;){const t=s[a];let o=r;if(a!==i){const r=e[t];o=n(r)||Array.isArray(r)?r:isNaN(+s[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const b="blur",g="change",y="all",_=r.createContext(null),h=()=>r.useContext(_);function v(e){const t=h(),{control:a=t.control,disabled:s,name:o,exact:n}=e||{},[i,l]=r.useState(a._formState),c=r.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=r.useRef(o);return u.current=o,r.useEffect((()=>a._subscribe({name:u.current,formState:c.current,exact:n,callback:e=>{!s&&l({...a._formState,...e})}})),[a,s,n]),r.useEffect((()=>{c.current.isValid&&a._setValid(!0)}),[a]),r.useMemo((()=>((e,t,r,a=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const s=o;return t._proxyFormState[s]!==y&&(t._proxyFormState[s]=!a||y),r&&(r[s]=!0),e[s]}});return s})(i,a,c.current,!1)),[i,a])}function x(e){const t=h(),{control:a=t.control,name:s,defaultValue:o,disabled:n,exact:i}=e||{},l=r.useRef(s),c=r.useRef(o);l.current=s,r.useEffect((()=>a._subscribe({name:l.current,formState:{values:!0},exact:i,callback:e=>!n&&d(((e,t,r,a,s)=>"string"==typeof e?m(r,e,s):Array.isArray(e)?e.map((e=>m(r,e))):r)(l.current,a._names,e.values||a._formValues,0,c.current))})),[a,n,i]);const[u,d]=r.useState(a._getWatch(s,o));return r.useEffect((()=>a._removeUnmounted())),u}const V=e=>e.render(function(e){const t=h(),{name:a,disabled:s,control:o=t.control,shouldUnregister:n}=e,l=((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(o._names.array,a),u=x({control:o,name:a,defaultValue:m(o._formValues,a,m(o._defaultValues,a,e.defaultValue)),exact:!0}),y=v({control:o,name:a,exact:!0}),_=r.useRef(e),V=r.useRef(o.register(a,{...e.rules,value:u,...f(e.disabled)?{disabled:e.disabled}:{}})),E=r.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!m(y.errors,a)},isDirty:{enumerable:!0,get:()=>!!m(y.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!m(y.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!m(y.validatingFields,a)},error:{enumerable:!0,get:()=>m(y.errors,a)}})),[y,a]),F=r.useCallback((e=>V.current.onChange({target:{value:i(e),name:a},type:g})),[a]),S=r.useCallback((()=>V.current.onBlur({target:{value:m(o._formValues,a),name:a},type:b})),[a,o._formValues]),C=r.useCallback((e=>{const t=m(o._fields,a);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}),[o._fields,a]),I=r.useMemo((()=>({name:a,value:u,...f(s)||y.disabled?{disabled:y.disabled||s}:{},onChange:F,onBlur:S,ref:C})),[a,s,y.disabled,F,S,C,u]);return r.useEffect((()=>{const e=o._options.shouldUnregister||n;o.register(a,{..._.current.rules,...f(_.current.disabled)?{disabled:_.current.disabled}:{}});const t=(e,t)=>{const r=m(o._fields,e);r&&r._f&&(r._f.mount=t)};if(t(a,!0),e){const e=c(m(o._options.defaultValues,a));p(o._defaultValues,a,e),d(m(o._formValues,a))&&p(o._formValues,a,e)}return!l&&o.register(a),()=>{(l?e&&!o._state.action:e)?o.unregister(a):t(a,!1)}}),[a,o,l,n]),r.useEffect((()=>{o._setDisabledField({disabled:s,name:a})}),[s,a,o]),r.useMemo((()=>({field:I,formState:y,fieldState:E})),[I,y,E])}(e)),E=e=>{const{children:t,...a}=e;return r.createElement(_.Provider,{value:a},t)},F=t.createContext({}),S=({...e})=>t.createElement(F.Provider,{value:{name:e.name}},t.createElement(V,e)),C=()=>{const e=t.useContext(F),r=t.useContext(I),{getFieldState:a}=h(),s=v({name:e.name}),o=a(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:n}=r;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...o}},I=t.createContext({});function w({className:e,...r}){const s=t.useId();return t.createElement(I.Provider,{value:{id:s}},t.createElement("div",{"data-slot":"form-item",className:a("grid gap-2",e),...r}))}function k({className:e,...r}){const{error:o,formItemId:n}=C();return t.createElement(s,{"data-slot":"form-label","data-error":!!o,className:a("data-[error=true]:text-destructive",e),htmlFor:n,...r})}function A({...r}){const{error:a,formItemId:s,formDescriptionId:o,formMessageId:n}=C();return t.createElement(e,{"data-slot":"form-control",id:s,"aria-describedby":a?`${o} ${n}`:`${o}`,"aria-invalid":!!a,...r})}function N({className:e,...r}){const{formDescriptionId:s}=C();return t.createElement("p",{"data-slot":"form-description",id:s,className:a("text-muted-foreground text-sm",e),...r})}function j({className:e,...r}){const{error:s,formMessageId:o}=C(),n=s?String(s?.message??""):r.children;return n?t.createElement("p",{"data-slot":"form-message",id:o,className:a("text-destructive text-sm",e),...r},n):null}export{E as Form,A as FormControl,N as FormDescription,S as FormField,w as FormItem,k as FormLabel,j as FormMessage,C as useFormField};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|