@me1a/ui 2.2.1 → 2.2.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.
- package/dist/accordion/index.d.mts +94 -0
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -0
- package/dist/avatar/index.d.mts +34 -0
- package/dist/avatar/index.mjs +2 -0
- package/dist/avatar/index.mjs.map +1 -0
- package/dist/badge/index.d.mts +41 -0
- package/dist/badge/index.mjs +2 -0
- package/dist/badge/index.mjs.map +1 -0
- package/dist/box/index.d.mts +50 -0
- package/dist/box/index.mjs +2 -0
- package/dist/box/index.mjs.map +1 -0
- package/dist/breadcrumb/index.d.mts +35 -0
- package/dist/breadcrumb/index.mjs +2 -0
- package/dist/breadcrumb/index.mjs.map +1 -0
- package/dist/{tooltip-B4jzaurK.d.mts → button/index.d.mts} +3 -25
- package/dist/button/index.mjs +2 -0
- package/dist/button/index.mjs.map +1 -0
- package/dist/card/index.d.mts +127 -0
- package/dist/card/index.mjs +2 -0
- package/dist/card/index.mjs.map +1 -0
- package/dist/checkbox/index.d.mts +21 -0
- package/dist/checkbox/index.mjs +2 -0
- package/dist/checkbox/index.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +26 -0
- package/dist/collapsible/index.mjs +2 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/command/index.d.mts +122 -0
- package/dist/command/index.mjs +2 -0
- package/dist/command/index.mjs.map +1 -0
- package/dist/container/index.d.mts +33 -0
- package/dist/container/index.mjs +2 -0
- package/dist/container/index.mjs.map +1 -0
- package/dist/dialog/index.d.mts +35 -0
- package/dist/dialog/index.mjs +2 -0
- package/dist/dialog/index.mjs.map +1 -0
- package/dist/drawer/index.d.mts +63 -0
- package/dist/drawer/index.mjs +2 -0
- package/dist/drawer/index.mjs.map +1 -0
- package/dist/dropdown-menu/index.d.mts +335 -0
- package/dist/dropdown-menu/index.mjs +2 -0
- package/dist/dropdown-menu/index.mjs.map +1 -0
- package/dist/form/index.d.mts +96 -0
- package/dist/form/index.mjs +2 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/{hooks.d.mts → hooks/index.d.mts} +10 -4
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +2739 -30
- package/dist/index.mjs +47 -0
- package/dist/{index.esm.js.map → index.mjs.map} +1 -1
- package/dist/input/index.d.mts +12 -0
- package/dist/input/index.mjs +2 -0
- package/dist/input/index.mjs.map +1 -0
- package/dist/label/index.d.mts +18 -0
- package/dist/label/index.mjs +2 -0
- package/dist/label/index.mjs.map +1 -0
- package/dist/navigation-menu/index.d.mts +104 -0
- package/dist/navigation-menu/index.mjs +2 -0
- package/dist/navigation-menu/index.mjs.map +1 -0
- package/dist/page-loader/index.d.mts +29 -0
- package/dist/page-loader/index.mjs +2 -0
- package/dist/page-loader/index.mjs.map +1 -0
- package/dist/pagination/index.d.mts +105 -0
- package/dist/pagination/index.mjs +2 -0
- package/dist/pagination/index.mjs.map +1 -0
- package/dist/popover/index.d.mts +30 -0
- package/dist/popover/index.mjs +2 -0
- package/dist/popover/index.mjs.map +1 -0
- package/dist/{checkbox-DxgDKaHx.d.mts → radio-group/index.d.mts} +5 -51
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -0
- package/dist/resizable/index.d.mts +53 -0
- package/dist/resizable/index.mjs +2 -0
- package/dist/resizable/index.mjs.map +1 -0
- package/dist/rhf-checkbox/index.d.mts +57 -0
- package/dist/rhf-checkbox/index.mjs +2 -0
- package/dist/rhf-checkbox/index.mjs.map +1 -0
- package/dist/rhf-multi-select/index.d.mts +84 -0
- package/dist/rhf-multi-select/index.mjs +2 -0
- package/dist/rhf-multi-select/index.mjs.map +1 -0
- package/dist/rhf-radio-button-group/index.d.mts +73 -0
- package/dist/rhf-radio-button-group/index.mjs +2 -0
- package/dist/rhf-radio-button-group/index.mjs.map +1 -0
- package/dist/rhf-radio-group/index.d.mts +103 -0
- package/dist/rhf-radio-group/index.mjs +2 -0
- package/dist/rhf-radio-group/index.mjs.map +1 -0
- package/dist/rhf-select/index.d.mts +80 -0
- package/dist/rhf-select/index.mjs +2 -0
- package/dist/rhf-select/index.mjs.map +1 -0
- package/dist/rhf-switch/index.d.mts +57 -0
- package/dist/rhf-switch/index.mjs +2 -0
- package/dist/rhf-switch/index.mjs.map +1 -0
- package/dist/rhf-textarea/index.d.mts +66 -0
- package/dist/rhf-textarea/index.mjs +2 -0
- package/dist/rhf-textarea/index.mjs.map +1 -0
- package/dist/separator/index.d.mts +13 -0
- package/dist/separator/index.mjs +2 -0
- package/dist/separator/index.mjs.map +1 -0
- package/dist/sheet/index.d.mts +42 -0
- package/dist/sheet/index.mjs +2 -0
- package/dist/sheet/index.mjs.map +1 -0
- package/dist/sidebar/index.d.mts +328 -0
- package/dist/sidebar/index.mjs +2 -0
- package/dist/sidebar/index.mjs.map +1 -0
- package/dist/skeleton/index.d.mts +17 -0
- package/dist/skeleton/index.mjs +2 -0
- package/dist/skeleton/index.mjs.map +1 -0
- package/dist/stack/index.d.mts +121 -0
- package/dist/stack/index.mjs +2 -0
- package/dist/stack/index.mjs.map +1 -0
- package/dist/switch/index.d.mts +21 -0
- package/dist/switch/index.mjs +2 -0
- package/dist/switch/index.mjs.map +1 -0
- package/dist/table/index.d.mts +53 -0
- package/dist/table/index.mjs +2 -0
- package/dist/table/index.mjs.map +1 -0
- package/dist/tabs/index.d.mts +97 -0
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -0
- package/dist/text-field/index.d.mts +65 -0
- package/dist/text-field/index.mjs +2 -0
- package/dist/text-field/index.mjs.map +1 -0
- package/dist/textarea/index.d.mts +24 -0
- package/dist/textarea/index.mjs +2 -0
- package/dist/textarea/index.mjs.map +1 -0
- package/dist/{toast-2xT7L1tJ.d.mts → toast/index.d.mts} +3 -3
- package/dist/toast/index.mjs +2 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toaster/index.d.mts +26 -0
- package/dist/toaster/index.mjs +2 -0
- package/dist/toaster/index.mjs.map +1 -0
- package/dist/tooltip/index.d.mts +25 -0
- package/dist/tooltip/index.mjs +2 -0
- package/dist/tooltip/index.mjs.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/{index.cjs.js.map → types/index.mjs.map} +1 -1
- package/dist/typography/index.d.mts +24 -0
- package/dist/typography/index.mjs +2 -0
- package/dist/typography/index.mjs.map +1 -0
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +199 -34
- package/dist/atoms.cjs.js +0 -2
- package/dist/atoms.cjs.js.map +0 -1
- package/dist/atoms.d.mts +0 -1051
- package/dist/atoms.d.ts +0 -1051
- package/dist/atoms.esm.js +0 -2
- package/dist/atoms.esm.js.map +0 -1
- package/dist/checkbox-DxgDKaHx.d.ts +0 -108
- package/dist/chunk-23T2PH5G.esm.js +0 -2
- package/dist/chunk-23T2PH5G.esm.js.map +0 -1
- package/dist/chunk-2QG3QTSW.cjs.js +0 -2
- package/dist/chunk-2QG3QTSW.cjs.js.map +0 -1
- package/dist/chunk-C26U3FL4.esm.js +0 -2
- package/dist/chunk-C26U3FL4.esm.js.map +0 -1
- package/dist/chunk-DTM5LZHM.cjs.js +0 -2
- package/dist/chunk-DTM5LZHM.cjs.js.map +0 -1
- package/dist/chunk-HW32JE75.cjs.js +0 -2
- package/dist/chunk-HW32JE75.cjs.js.map +0 -1
- package/dist/chunk-JIRS6MWF.cjs.js +0 -2
- package/dist/chunk-JIRS6MWF.cjs.js.map +0 -1
- package/dist/chunk-JKTYFZ5M.esm.js +0 -2
- package/dist/chunk-JKTYFZ5M.esm.js.map +0 -1
- package/dist/chunk-JUZG25DH.esm.js +0 -2
- package/dist/chunk-JUZG25DH.esm.js.map +0 -1
- package/dist/chunk-KOYJODOP.cjs.js +0 -2
- package/dist/chunk-KOYJODOP.cjs.js.map +0 -1
- package/dist/chunk-M4S5YZ56.esm.js +0 -2
- package/dist/chunk-M4S5YZ56.esm.js.map +0 -1
- package/dist/chunk-MOYOCJW6.esm.js +0 -2
- package/dist/chunk-MOYOCJW6.esm.js.map +0 -1
- package/dist/chunk-MVWMLXLL.cjs.js +0 -2
- package/dist/chunk-MVWMLXLL.cjs.js.map +0 -1
- package/dist/chunk-SL2ZUI4G.cjs.js +0 -2
- package/dist/chunk-SL2ZUI4G.cjs.js.map +0 -1
- package/dist/chunk-STRDPP3B.esm.js +0 -2
- package/dist/chunk-STRDPP3B.esm.js.map +0 -1
- package/dist/chunk-U4NMIMU7.esm.js +0 -2
- package/dist/chunk-U4NMIMU7.esm.js.map +0 -1
- package/dist/chunk-UK47BFA3.cjs.js +0 -2
- package/dist/chunk-UK47BFA3.cjs.js.map +0 -1
- package/dist/chunk-UTVXFZLD.esm.js +0 -2
- package/dist/chunk-UTVXFZLD.esm.js.map +0 -1
- package/dist/chunk-WJNYKJP6.cjs.js +0 -2
- package/dist/chunk-WJNYKJP6.cjs.js.map +0 -1
- package/dist/chunk-YEZB7AOJ.esm.js +0 -2
- package/dist/chunk-YEZB7AOJ.esm.js.map +0 -1
- package/dist/chunk-YGLYFSF6.cjs.js +0 -2
- package/dist/chunk-YGLYFSF6.cjs.js.map +0 -1
- package/dist/hooks.cjs.js +0 -2
- package/dist/hooks.cjs.js.map +0 -1
- package/dist/hooks.d.ts +0 -51
- package/dist/hooks.esm.js +0 -2
- package/dist/hooks.esm.js.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.d.ts +0 -30
- package/dist/index.esm.js +0 -2
- package/dist/molecules.cjs.js +0 -2
- package/dist/molecules.cjs.js.map +0 -1
- package/dist/molecules.d.mts +0 -201
- package/dist/molecules.d.ts +0 -201
- package/dist/molecules.esm.js +0 -2
- package/dist/molecules.esm.js.map +0 -1
- package/dist/organisms.cjs.js +0 -2
- package/dist/organisms.cjs.js.map +0 -1
- package/dist/organisms.d.mts +0 -673
- package/dist/organisms.d.ts +0 -673
- package/dist/organisms.esm.js +0 -2
- package/dist/organisms.esm.js.map +0 -1
- package/dist/rhf.cjs.js +0 -2
- package/dist/rhf.cjs.js.map +0 -1
- package/dist/rhf.d.mts +0 -408
- package/dist/rhf.d.ts +0 -408
- package/dist/rhf.esm.js +0 -2
- package/dist/rhf.esm.js.map +0 -1
- package/dist/toast-2xT7L1tJ.d.ts +0 -18
- package/dist/tooltip-B4jzaurK.d.ts +0 -104
- package/dist/types.cjs.js +0 -2
- package/dist/types.cjs.js.map +0 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.esm.js +0 -2
- package/dist/types.esm.js.map +0 -1
- package/dist/utils.cjs.js +0 -2
- package/dist/utils.cjs.js.map +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.esm.js +0 -2
- package/dist/utils.esm.js.map +0 -1
- /package/dist/{types.d.mts → types/index.d.mts} +0 -0
- /package/dist/{utils.d.mts → utils/index.d.mts} +0 -0
package/dist/rhf.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk2QG3QTSW_cjs_js=require('./chunk-2QG3QTSW.cjs.js'),chunkUK47BFA3_cjs_js=require('./chunk-UK47BFA3.cjs.js'),chunkSL2ZUI4G_cjs_js=require('./chunk-SL2ZUI4G.cjs.js'),reactHookForm=require('react-hook-form'),F=require('react'),reactSlot=require('@radix-ui/react-slot'),jsxRuntime=require('react/jsx-runtime');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var F__namespace=/*#__PURE__*/_interopNamespace(F);var oe=reactHookForm.FormProvider,U=F__namespace.createContext({}),R=({...r})=>jsxRuntime.jsx(U.Provider,{value:{name:r.name},children:jsxRuntime.jsx(reactHookForm.Controller,{...r})}),k=()=>{let r=F__namespace.useContext(U),a=F__namespace.useContext(X),{getFieldState:t,formState:i}=reactHookForm.useFormContext(),o=t(r.name,i);if(!r)throw new Error("useFormField should be used within <FormField>");let{id:e}=a;return {id:e,name:r.name,formItemId:`${e}-form-item`,formDescriptionId:`${e}-form-item-description`,formMessageId:`${e}-form-item-message`,...o}},X=F__namespace.createContext({}),p=F__namespace.forwardRef(({className:r,...a},t)=>{let i=F__namespace.useId();return jsxRuntime.jsx(X.Provider,{value:{id:i},children:jsxRuntime.jsx("div",{ref:t,className:chunkSL2ZUI4G_cjs_js.a("space-y-2",r),...a})})});p.displayName="FormItem";var u=F__namespace.forwardRef(({className:r,...a},t)=>{let{error:i,formItemId:o}=k();return jsxRuntime.jsx(chunk2QG3QTSW_cjs_js.a,{ref:t,className:chunkSL2ZUI4G_cjs_js.a(i&&"text-destructive",r),htmlFor:o,...a})});u.displayName="FormLabel";var c=F__namespace.forwardRef(({...r},a)=>{let{error:t,formItemId:i,formDescriptionId:o,formMessageId:e}=k();return jsxRuntime.jsx(reactSlot.Slot,{ref:a,id:i,"aria-describedby":t?`${o} ${e}`:`${o}`,"aria-invalid":!!t,...r})});c.displayName="FormControl";var n=F__namespace.forwardRef(({className:r,...a},t)=>{let{formDescriptionId:i}=k();return jsxRuntime.jsx("p",{ref:t,id:i,className:chunkSL2ZUI4G_cjs_js.a("text-sm text-muted-foreground",r),...a})});n.displayName="FormDescription";var f=F__namespace.forwardRef(({className:r,children:a,...t},i)=>{let{error:o,formMessageId:e}=k(),m=o?String(o?.message??""):a;return m?jsxRuntime.jsx("p",{ref:i,id:e,className:chunkSL2ZUI4G_cjs_js.a("text-sm font-medium text-destructive",r),...t,children:m}):null});f.displayName="FormMessage";function Ce({name:r,label:a,description:t,className:i,type:o="text",warningText:e,required:m,disabled:I,readOnly:y,placeholder:h,"aria-label":T,"aria-describedby":x,onBlur:b,...s}){let{control:C}=reactHookForm.useFormContext();return jsxRuntime.jsx(R,{name:r,control:C,render:({field:l,fieldState:{error:d}})=>jsxRuntime.jsxs(p,{children:[a&&jsxRuntime.jsxs(u,{children:[a,m&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),jsxRuntime.jsx(c,{children:jsxRuntime.jsx(chunkUK47BFA3_cjs_js.c,{...l,type:o,value:o==="number"&&l.value===0?"":l.value,onChange:g=>{o==="number"?l.onChange(Number(g.target.value)):l.onChange(g.target.value);},onBlur:g=>{o!=="number"&&typeof l.value=="string"&&l.onChange(l.value.trim()),l.onBlur(),b?.(g);},className:chunkSL2ZUI4G_cjs_js.a(d&&"border-destructive focus-visible:ring-destructive",i),disabled:I,readOnly:y,required:m,placeholder:h,"aria-label":T,"aria-describedby":x,"aria-invalid":!!d,"aria-required":m,...s})}),t&&jsxRuntime.jsx(n,{children:t}),d&&jsxRuntime.jsx(f,{children:d.message}),!d&&e&&jsxRuntime.jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:e})]})})}var E=F__namespace.forwardRef(({className:r,autoResize:a=false,...t},i)=>{let o=F__namespace.useRef(null);return F__namespace.useEffect(()=>{if(!a||!o.current)return;let e=o.current,m=()=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`;};return e.addEventListener("input",m),m(),()=>e.removeEventListener("input",m)},[a]),jsxRuntime.jsx("textarea",{className:chunkSL2ZUI4G_cjs_js.a("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:i,...t})});E.displayName="Textarea";function De({name:r,label:a,description:t,className:i,warningText:o,required:e,disabled:m,readOnly:I,placeholder:y,autoResize:h,"aria-label":T,"aria-describedby":x,onBlur:b,...s}){let{control:C}=reactHookForm.useFormContext();return jsxRuntime.jsx(R,{name:r,control:C,render:({field:l,fieldState:{error:d}})=>jsxRuntime.jsxs(p,{children:[a&&jsxRuntime.jsxs(u,{children:[a,e&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),jsxRuntime.jsx(c,{children:jsxRuntime.jsx(E,{...l,value:l.value,onChange:g=>{l.onChange(g.target.value);},onBlur:g=>{typeof l.value=="string"&&l.onChange(l.value.trim()),l.onBlur(),b?.(g);},className:chunkSL2ZUI4G_cjs_js.a(d&&"border-destructive focus-visible:ring-destructive",i),disabled:m,readOnly:I,required:e,placeholder:y,"aria-label":T,"aria-describedby":x,"aria-invalid":!!d,"aria-required":e,autoResize:h,...s})}),t&&jsxRuntime.jsx(n,{children:t}),d&&jsxRuntime.jsx(f,{children:d.message}),!d&&o&&jsxRuntime.jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:o})]})})}function Be({name:r,label:a,description:t,className:i,warningText:o,required:e,disabled:m,readOnly:I,"aria-label":y,"aria-describedby":h,...T}){let{control:x}=reactHookForm.useFormContext();return jsxRuntime.jsx(R,{name:r,control:x,render:({field:b,fieldState:{error:s}})=>jsxRuntime.jsxs(p,{className:"flex flex-row items-start space-x-3 space-y-0",children:[jsxRuntime.jsx(c,{children:jsxRuntime.jsx(chunk2QG3QTSW_cjs_js.g,{checked:b.value,onCheckedChange:b.onChange,disabled:m,"aria-label":y,"aria-describedby":h,"aria-invalid":!!s,"aria-required":e,...T})}),jsxRuntime.jsxs("div",{className:"space-y-1 leading-none",children:[a&&jsxRuntime.jsxs(u,{children:[a,e&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t&&jsxRuntime.jsx(n,{children:t}),s&&jsxRuntime.jsx(f,{children:s.message}),!s&&o&&jsxRuntime.jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:o})]})]})})}function Je({name:r,label:a,description:t,className:i,warningText:o,required:e,disabled:m,readOnly:I,"aria-label":y,"aria-describedby":h,...T}){let{control:x}=reactHookForm.useFormContext();return jsxRuntime.jsx(R,{name:r,control:x,render:({field:b,fieldState:{error:s}})=>jsxRuntime.jsxs(p,{className:"flex flex-row items-start space-x-3 space-y-0",children:[jsxRuntime.jsx(c,{children:jsxRuntime.jsx(chunk2QG3QTSW_cjs_js.b,{checked:b.value,onCheckedChange:b.onChange,disabled:m,"aria-label":y,"aria-describedby":h,"aria-invalid":!!s,"aria-required":e,...T})}),jsxRuntime.jsxs("div",{className:"space-y-1 leading-none",children:[a&&jsxRuntime.jsxs(u,{children:[a,e&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t&&jsxRuntime.jsx(n,{children:t}),s&&jsxRuntime.jsx(f,{children:s.message}),!s&&o&&jsxRuntime.jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:o})]})]})})}function Ze({name:r,label:a,description:t,className:i,warningText:o,required:e,disabled:m,readOnly:I,"aria-label":y,"aria-describedby":h,children:T,...x}){let{control:b}=reactHookForm.useFormContext(),s="options"in x;return jsxRuntime.jsx(R,{name:r,control:b,render:({field:C,fieldState:{error:l}})=>jsxRuntime.jsxs(p,{className:"space-y-3",children:[a&&jsxRuntime.jsxs(u,{children:[a,e&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),jsxRuntime.jsx(c,{children:jsxRuntime.jsxs(chunk2QG3QTSW_cjs_js.c,{onValueChange:C.onChange,defaultValue:C.value,disabled:m,"aria-label":y,"aria-describedby":h,"aria-invalid":!!l,"aria-required":e,...x,children:[s&&x.options.map(d=>jsxRuntime.jsxs(chunk2QG3QTSW_cjs_js.e,{children:[jsxRuntime.jsx(chunk2QG3QTSW_cjs_js.d,{value:d.id,id:d.id}),jsxRuntime.jsx(chunk2QG3QTSW_cjs_js.f,{htmlFor:d.id,children:d.label})]},d.id)),!s&&T]})}),t&&jsxRuntime.jsx(n,{children:t}),l&&jsxRuntime.jsx(f,{children:l.message}),!l&&o&&jsxRuntime.jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-500",role:"alert",children:o})]})})}function ra({name:r,label:a,description:t,className:i,warningText:o,required:e,disabled:m,readOnly:I,"aria-label":y,"aria-describedby":h,options:T,...x}){let{control:b}=reactHookForm.useFormContext();return jsxRuntime.jsx(R,{name:r,control:b,render:({field:s,fieldState:{error:C}})=>jsxRuntime.jsxs(p,{className:"space-y-3",children:[a&&jsxRuntime.jsxs(u,{children:[a,e&&jsxRuntime.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),jsxRuntime.jsx(c,{children:jsxRuntime.jsx(chunk2QG3QTSW_cjs_js.c,{onValueChange:s.onChange,defaultValue:s.value,disabled:m,"aria-label":y,"aria-describedby":h,"aria-invalid":!!C,"aria-required":e,className:"flex gap-2 p-2 border border-gray-200 rounded-md w-fit",...x,children:T.map(l=>jsxRuntime.jsx(chunkUK47BFA3_cjs_js.b,{size:l.size??"sm",variant:s.value===l.id?"default":"secondary",onClick:()=>s.onChange(l.id),role:"radio","aria-checked":s.value===l.id,disabled:m,children:l.label},l.id))})}),t&&jsxRuntime.jsx(n,{children:t}),o&&jsxRuntime.jsx(n,{className:"text-warning",children:o}),C&&jsxRuntime.jsx(f,{children:C.message})]})})}exports.Form=oe;exports.FormControl=c;exports.FormDescription=n;exports.FormField=R;exports.FormItem=p;exports.FormLabel=u;exports.FormMessage=f;exports.RHFCheckbox=Be;exports.RHFRadioButtonGroup=ra;exports.RHFRadioGroup=Ze;exports.RHFSwitch=Je;exports.RHFTextField=Ce;exports.RHFTextarea=De;exports.useFormField=k;//# sourceMappingURL=rhf.cjs.js.map
|
|
2
|
-
//# sourceMappingURL=rhf.cjs.js.map
|
package/dist/rhf.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/rhf/form/form.tsx","../src/components/rhf/rhf-text-field/rhf-text-field.tsx","../src/components/atoms/textarea/textarea.tsx","../src/components/rhf/rhf-textarea/rhf-textarea.tsx","../src/components/rhf/rhf-checkbox/rhf-checkbox.tsx","../src/components/rhf/rhf-switch/rhf-switch.tsx","../src/components/rhf/rhf-radio-group/rhf-radio-group.tsx","../src/components/rhf/rhf-radio-button-group/rhf-radio-button-group.tsx"],"names":["Form","FormProvider","FormFieldContext","F","FormField","props","jsx","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body","RHFTextField","name","label","description","type","warningText","required","disabled","readOnly","placeholder","ariaLabel","ariaDescribedby","onBlur","other","control","field","jsxs","Input","e","Textarea","D","autoResize","internalRef","textarea","resizeTextarea","RHFTextarea","RHFCheckbox","Checkbox","RHFSwitch","Switch","RHFRadioGroup","hasOptions","RadioGroup","option","RadioItemContainer","RadioGroupItem","RadioItemLabel","RHFRadioButtonGroup","options","Button"],"mappings":"irBAiBMA,EAAOC,CAAAA,0BAAAA,CASPC,EAAyBC,YAAqC,CAAA,aAAA,CAAA,EAA2B,CAEzFC,CAAAA,CAAAA,CAAY,CAGhB,CACA,GAAGC,CACL,CAEIC,GAAAA,cAAAA,CAACJ,EAAiB,QAAjB,CAAA,CAA0B,MAAO,CAAE,IAAA,CAAMG,EAAM,IAAK,CAAA,CACnD,QAAAC,CAAAA,cAAAA,CAACC,yBAAA,CAAY,GAAGF,EAAO,CACzB,CAAA,CAAA,CAIEG,EAAe,IAAM,CACzB,IAAMC,CAAqB,CAAAN,YAAA,CAAA,UAAA,CAAWD,CAAgB,CAChDQ,CAAAA,CAAAA,CAAoBP,wBAAWQ,CAAe,CAAA,CAC9C,CAAE,aAAAC,CAAAA,CAAAA,CAAe,UAAAC,CAAU,CAAA,CAAIC,8BAE/BC,CAAAA,CAAAA,CAAaH,EAAcH,CAAa,CAAA,IAAA,CAAMI,CAAS,CAE7D,CAAA,GAAI,CAACJ,CACH,CAAA,MAAM,IAAI,KAAM,CAAA,gDAAgD,EAGlE,GAAM,CAAE,GAAAO,CAAG,CAAA,CAAIN,CAEf,CAAA,OAAO,CACL,EAAAM,CAAAA,CAAAA,CACA,KAAMP,CAAa,CAAA,IAAA,CACnB,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,QAAAO,CAAAA,CAAAA,CAAY,EAC7CE,CAAehC,EAAAA,cAAAA,CAACuB,EAAA,CAAgB,SAAA,CAAU,eAAgB,QAAAS,CAAAA,CAAAA,CAAY,EACtEhB,CAAShB,EAAAA,cAAAA,CAACwB,EAAA,CAAa,QAAA,CAAAR,EAAM,OAAQ,CAAA,CAAA,CAAA,CACxC,EAEJ,CAEJ","file":"rhf.cjs.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { Input } from \"@/components/atoms/input\"\nimport { cn } from \"@/utils/cn\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFTextFieldProps } from \"./rhf-text-field.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A text field component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhftextfield--docs\n *\n * * @example\n * ```tsx\n * <Form>\n * <RHFTextField name=\"name\" label=\"Name\" />\n * <RHFTextField name=\"email\" label=\"Email\" />\n * </Form>\n * ```\n */\nexport function RHFTextField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n type = \"text\",\n warningText,\n required,\n disabled,\n readOnly,\n placeholder,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n onBlur,\n ...other\n}: RHFTextFieldProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem>\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <Input\n {...field}\n type={type}\n value={type === \"number\" && field.value === 0 ? \"\" : field.value}\n onChange={(e) => {\n if (type === \"number\") {\n field.onChange(Number(e.target.value))\n } else {\n field.onChange(e.target.value)\n }\n }}\n onBlur={(e) => {\n // trim if a string\n if (type !== \"number\" && typeof field.value === \"string\") {\n field.onChange(field.value.trim())\n }\n field.onBlur() // pass to react-hook-form\n onBlur?.(e) // pass to wrapper\n }}\n className={cn(\n error && \"border-destructive focus-visible:ring-destructive\",\n className\n )}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n placeholder={placeholder}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n />\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </FormItem>\n )}\n />\n )\n}\n","import * as React from \"react\"\nimport { cn } from \"@/utils/index\"\nimport { TextareaProps } from \"./textarea.types\"\n\n/**\n * Textarea component for creating accessible text areas.\n * Built on top of shadcn/ui's Textarea component.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-textarea--docs\n *\n * @example\n * ```tsx\n * <Textarea placeholder=\"Enter text\" />\n * ```\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoResize = false, ...props }, ref) => {\n const internalRef = React.useRef<HTMLTextAreaElement>(null)\n\n React.useEffect(() => {\n if (!autoResize || !internalRef.current) return\n\n const textarea = internalRef.current\n const resizeTextarea = () => {\n textarea.style.height = \"auto\"\n textarea.style.height = `${textarea.scrollHeight}px`\n }\n\n textarea.addEventListener(\"input\", resizeTextarea)\n resizeTextarea() // Initial resize\n\n return () => textarea.removeEventListener(\"input\", resizeTextarea)\n }, [autoResize])\n\n return (\n <textarea\n className={cn(\n \"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nTextarea.displayName = \"Textarea\"\n\nexport { Textarea }\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { Textarea } from \"@/components/atoms/textarea\"\nimport { cn } from \"@/utils/cn\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFTextareaProps } from \"./rhf-textarea.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A textarea component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhftextarea--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFTextarea name=\"description\" label=\"Description\" />\n * </Form>\n * ```\n */\nexport function RHFTextarea<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n placeholder,\n autoResize,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n onBlur,\n ...other\n}: RHFTextareaProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem>\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <Textarea\n {...field}\n value={field.value}\n onChange={(e) => {\n field.onChange(e.target.value)\n }}\n onBlur={(e) => {\n // trim if a string\n if (typeof field.value === \"string\") {\n field.onChange(field.value.trim())\n }\n field.onBlur() // pass to react-hook-form\n onBlur?.(e) // pass to wrapper\n }}\n className={cn(\n error && \"border-destructive focus-visible:ring-destructive\",\n className\n )}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n placeholder={placeholder}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n autoResize={autoResize}\n {...other}\n />\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </FormItem>\n )}\n />\n )\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { Checkbox } from \"@/components/atoms/checkbox\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFCheckboxProps } from \"./rhf-checkbox.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A checkbox component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfcheckbox--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFCheckbox name=\"terms\" label=\"Accept terms and conditions\" />\n * </Form>\n * ```\n */\nexport function RHFCheckbox<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n ...other\n}: RHFCheckboxProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"flex flex-row items-start space-x-3 space-y-0\">\n <FormControl>\n <Checkbox\n checked={field.value}\n onCheckedChange={field.onChange}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </div>\n </FormItem>\n )}\n />\n )\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { Switch } from \"@/components/atoms/switch\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFSwitchProps } from \"./rhf-switch.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A switch component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfswitch--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFSwitch name=\"notifications\" label=\"Enable notifications\" />\n * </Form>\n * ```\n */\nexport function RHFSwitch<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n ...other\n}: RHFSwitchProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"flex flex-row items-start space-x-3 space-y-0\">\n <FormControl>\n <Switch\n checked={field.value}\n onCheckedChange={field.onChange}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n />\n </FormControl>\n <div className=\"space-y-1 leading-none\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </div>\n </FormItem>\n )}\n />\n )\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport {\n RadioGroup,\n RadioGroupItem,\n RadioItemLabel,\n RadioItemContainer\n} from \"@/components/atoms/radio-group\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport {\n RHFRadioGroupOption,\n type RHFRadioGroupProps,\n type RHFRadioGroupWithOptionsProps\n} from \"./rhf-radio-group.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A radio group component that integrates with React Hook Form.\n * Provides form validation, error handling, and accessibility features.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiogroup--docs\n *\n * @example\n * ```tsx\n * // Using children\n * <Form>\n * <RHFRadioGroup name=\"preference\" label=\"Select your preference\">\n * <RadioGroupItem value=\"option1\" label=\"Option 1\" />\n * <RadioGroupItem value=\"option2\" label=\"Option 2\" />\n * </RHFRadioGroup>\n * </Form>\n *\n * // Using options prop\n * <Form>\n * <RHFRadioGroup\n * name=\"preference\"\n * label=\"Select your preference\"\n * options={[\n * { id: \"option1\", label: \"Option 1\" },\n * { id: \"option2\", label: \"Option 2\" }\n * ]}\n * />\n * </Form>\n * ```\n */\nexport function RHFRadioGroup<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n children,\n ...other\n}: RHFRadioGroupProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n const hasOptions = \"options\" in other\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"space-y-3\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <RadioGroup\n onValueChange={field.onChange}\n defaultValue={field.value}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n {...other}\n >\n {hasOptions &&\n (other as RHFRadioGroupWithOptionsProps<TFieldValues, TName>).options.map(\n (option: RHFRadioGroupOption) => (\n <RadioItemContainer key={option.id}>\n <RadioGroupItem value={option.id} id={option.id} />\n <RadioItemLabel htmlFor={option.id}>{option.label}</RadioItemLabel>\n </RadioItemContainer>\n )\n )}\n {!hasOptions && children}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n {!error && warningText && (\n <p className=\"text-sm text-yellow-600 dark:text-yellow-500\" role=\"alert\">\n {warningText}\n </p>\n )}\n </FormItem>\n )}\n />\n )\n}\n","import * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { RadioGroup } from \"@/components/atoms/radio-group\"\nimport { Button } from \"@/components/atoms/button\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport { type RHFRadioButtonGroupProps } from \"./rhf-radio-button-group.types\"\n\n// ----------------------------------------------------------------------\n\n/**\n * A radio button group component that integrates with React Hook Form.\n * Uses buttons instead of traditional radio inputs for a more modern look.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiobuttongroup--docs\n *\n * @example\n * ```tsx\n * <Form>\n * <RHFRadioButtonGroup\n * name=\"preference\"\n * label=\"Select your preference\"\n * options={[\n * { value: \"option1\", label: \"Option 1\" },\n * { value: \"option2\", label: \"Option 2\" },\n * { value: \"option3\", label: \"Option 3\" }\n * ]}\n * />\n * </Form>\n * ```\n */\nexport function RHFRadioButtonGroup<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n warningText,\n required,\n disabled,\n readOnly,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n options,\n ...other\n}: RHFRadioButtonGroupProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem className=\"space-y-3\">\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <RadioGroup\n onValueChange={field.onChange}\n defaultValue={field.value}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n className=\"flex gap-2 p-2 border border-gray-200 rounded-md w-fit\"\n {...other}\n >\n {options.map((option) => (\n <Button\n key={option.id}\n size={option.size ?? \"sm\"}\n variant={field.value === option.id ? \"default\" : \"secondary\"}\n onClick={() => field.onChange(option.id)}\n role=\"radio\"\n aria-checked={field.value === option.id}\n disabled={disabled}\n >\n {option.label}\n </Button>\n ))}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {warningText && <FormDescription className=\"text-warning\">{warningText}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n </FormItem>\n )}\n />\n )\n}\n"]}
|
package/dist/rhf.d.mts
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react_hook_form from 'react-hook-form';
|
|
3
|
-
import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { TextareaHTMLAttributes } from 'react';
|
|
6
|
-
import { I as Input, C as Checkbox, S as Switch, R as RadioGroup } from './checkbox-DxgDKaHx.mjs';
|
|
7
|
-
import * as _radix_ui_react_slot from '@radix-ui/react-slot';
|
|
8
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
9
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
10
|
-
import '@radix-ui/react-switch';
|
|
11
|
-
import 'class-variance-authority/types';
|
|
12
|
-
import 'class-variance-authority';
|
|
13
|
-
import '@radix-ui/react-radio-group';
|
|
14
|
-
import '@radix-ui/react-checkbox';
|
|
15
|
-
|
|
16
|
-
interface RHFTextFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof Input>, "name"> {
|
|
17
|
-
/** The name of the field in the form */
|
|
18
|
-
name: TName;
|
|
19
|
-
/** Optional label for the field */
|
|
20
|
-
label?: string;
|
|
21
|
-
/** Optional description text below the field */
|
|
22
|
-
description?: string;
|
|
23
|
-
/** Optional warning text to display */
|
|
24
|
-
warningText?: string;
|
|
25
|
-
/** Whether the field is required */
|
|
26
|
-
required?: boolean;
|
|
27
|
-
/** Whether the field is disabled */
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
/** Whether the field is read-only */
|
|
30
|
-
readOnly?: boolean;
|
|
31
|
-
/** The type of input (text, number, email, etc.) */
|
|
32
|
-
type?: React.HTMLInputTypeAttribute;
|
|
33
|
-
/** Optional placeholder text */
|
|
34
|
-
placeholder?: string;
|
|
35
|
-
/** Optional aria-label for accessibility */
|
|
36
|
-
"aria-label"?: string;
|
|
37
|
-
/** Optional aria-describedby for accessibility */
|
|
38
|
-
"aria-describedby"?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* A text field component that integrates with React Hook Form.
|
|
43
|
-
* Provides form validation, error handling, and accessibility features.
|
|
44
|
-
*
|
|
45
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhftextfield--docs
|
|
46
|
-
*
|
|
47
|
-
* * @example
|
|
48
|
-
* ```tsx
|
|
49
|
-
* <Form>
|
|
50
|
-
* <RHFTextField name="name" label="Name" />
|
|
51
|
-
* <RHFTextField name="email" label="Email" />
|
|
52
|
-
* </Form>
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
declare function RHFTextField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, type, warningText, required, disabled, readOnly, placeholder, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, onBlur, ...other }: RHFTextFieldProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
56
|
-
|
|
57
|
-
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
58
|
-
/**
|
|
59
|
-
* Whether the textarea should automatically resize
|
|
60
|
-
*/
|
|
61
|
-
autoResize?: boolean;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Textarea component for creating accessible text areas.
|
|
66
|
-
* Built on top of shadcn/ui's Textarea component.
|
|
67
|
-
*
|
|
68
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-textarea--docs
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```tsx
|
|
72
|
-
* <Textarea placeholder="Enter text" />
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
76
|
-
|
|
77
|
-
interface RHFTextareaProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof Textarea>, "name"> {
|
|
78
|
-
/** The name of the field in the form */
|
|
79
|
-
name: TName;
|
|
80
|
-
/** Optional label for the field */
|
|
81
|
-
label?: string;
|
|
82
|
-
/** Optional description text below the field */
|
|
83
|
-
description?: string;
|
|
84
|
-
/** Optional warning text to display */
|
|
85
|
-
warningText?: string;
|
|
86
|
-
/** Whether the field is required */
|
|
87
|
-
required?: boolean;
|
|
88
|
-
/** Whether the field is disabled */
|
|
89
|
-
disabled?: boolean;
|
|
90
|
-
/** Whether the field is read-only */
|
|
91
|
-
readOnly?: boolean;
|
|
92
|
-
/** Optional placeholder text */
|
|
93
|
-
placeholder?: string;
|
|
94
|
-
/** Optional aria-label for accessibility */
|
|
95
|
-
"aria-label"?: string;
|
|
96
|
-
/** Optional aria-describedby for accessibility */
|
|
97
|
-
"aria-describedby"?: string;
|
|
98
|
-
/** Whether the textarea should automatically resize */
|
|
99
|
-
autoResize?: boolean;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* A textarea component that integrates with React Hook Form.
|
|
104
|
-
* Provides form validation, error handling, and accessibility features.
|
|
105
|
-
*
|
|
106
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhftextarea--docs
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```tsx
|
|
110
|
-
* <Form>
|
|
111
|
-
* <RHFTextarea name="description" label="Description" />
|
|
112
|
-
* </Form>
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
declare function RHFTextarea<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, warningText, required, disabled, readOnly, placeholder, autoResize, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, onBlur, ...other }: RHFTextareaProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
116
|
-
|
|
117
|
-
interface RHFCheckboxProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof Checkbox>, "name"> {
|
|
118
|
-
/** The name of the field in the form */
|
|
119
|
-
name: TName;
|
|
120
|
-
/** Optional label for the field */
|
|
121
|
-
label?: string;
|
|
122
|
-
/** Optional description text below the field */
|
|
123
|
-
description?: string;
|
|
124
|
-
/** Optional warning text to display */
|
|
125
|
-
warningText?: string;
|
|
126
|
-
/** Whether the field is required */
|
|
127
|
-
required?: boolean;
|
|
128
|
-
/** Whether the field is disabled */
|
|
129
|
-
disabled?: boolean;
|
|
130
|
-
/** Whether the field is read-only */
|
|
131
|
-
readOnly?: boolean;
|
|
132
|
-
/** Optional aria-label for accessibility */
|
|
133
|
-
"aria-label"?: string;
|
|
134
|
-
/** Optional aria-describedby for accessibility */
|
|
135
|
-
"aria-describedby"?: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* A checkbox component that integrates with React Hook Form.
|
|
140
|
-
* Provides form validation, error handling, and accessibility features.
|
|
141
|
-
*
|
|
142
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfcheckbox--docs
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* ```tsx
|
|
146
|
-
* <Form>
|
|
147
|
-
* <RHFCheckbox name="terms" label="Accept terms and conditions" />
|
|
148
|
-
* </Form>
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
declare function RHFCheckbox<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, warningText, required, disabled, readOnly, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, ...other }: RHFCheckboxProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
152
|
-
|
|
153
|
-
interface RHFSwitchProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof Switch>, "name"> {
|
|
154
|
-
/** The name of the field in the form */
|
|
155
|
-
name: TName;
|
|
156
|
-
/** Optional label for the field */
|
|
157
|
-
label?: string;
|
|
158
|
-
/** Optional description text below the field */
|
|
159
|
-
description?: string;
|
|
160
|
-
/** Optional warning text to display */
|
|
161
|
-
warningText?: string;
|
|
162
|
-
/** Whether the field is required */
|
|
163
|
-
required?: boolean;
|
|
164
|
-
/** Whether the field is disabled */
|
|
165
|
-
disabled?: boolean;
|
|
166
|
-
/** Whether the field is read-only */
|
|
167
|
-
readOnly?: boolean;
|
|
168
|
-
/** Optional aria-label for accessibility */
|
|
169
|
-
"aria-label"?: string;
|
|
170
|
-
/** Optional aria-describedby for accessibility */
|
|
171
|
-
"aria-describedby"?: string;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* A switch component that integrates with React Hook Form.
|
|
176
|
-
* Provides form validation, error handling, and accessibility features.
|
|
177
|
-
*
|
|
178
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfswitch--docs
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```tsx
|
|
182
|
-
* <Form>
|
|
183
|
-
* <RHFSwitch name="notifications" label="Enable notifications" />
|
|
184
|
-
* </Form>
|
|
185
|
-
* ```
|
|
186
|
-
*/
|
|
187
|
-
declare function RHFSwitch<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, warningText, required, disabled, readOnly, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, ...other }: RHFSwitchProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
188
|
-
|
|
189
|
-
interface RHFRadioGroupOption {
|
|
190
|
-
label: string;
|
|
191
|
-
id: string;
|
|
192
|
-
}
|
|
193
|
-
interface RHFRadioGroupWithChildrenProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof RadioGroup>, "name"> {
|
|
194
|
-
/** The name of the field in the form */
|
|
195
|
-
name: TName;
|
|
196
|
-
/** Optional label for the field */
|
|
197
|
-
label?: string;
|
|
198
|
-
/** Optional description text below the field */
|
|
199
|
-
description?: string;
|
|
200
|
-
/** Optional warning text to display */
|
|
201
|
-
warningText?: string;
|
|
202
|
-
/** Whether the field is required */
|
|
203
|
-
required?: boolean;
|
|
204
|
-
/** Whether the field is disabled */
|
|
205
|
-
disabled?: boolean;
|
|
206
|
-
/** Whether the field is read-only */
|
|
207
|
-
readOnly?: boolean;
|
|
208
|
-
/** Optional aria-label for accessibility */
|
|
209
|
-
"aria-label"?: string;
|
|
210
|
-
/** Optional aria-describedby for accessibility */
|
|
211
|
-
"aria-describedby"?: string;
|
|
212
|
-
/** Children must be RadioGroupItem components */
|
|
213
|
-
children: React.ReactNode;
|
|
214
|
-
}
|
|
215
|
-
interface RHFRadioGroupWithOptionsProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof RadioGroup>, "name"> {
|
|
216
|
-
/** The name of the field in the form */
|
|
217
|
-
name: TName;
|
|
218
|
-
/** Optional label for the field */
|
|
219
|
-
label?: string;
|
|
220
|
-
/** radio group options */
|
|
221
|
-
options: RHFRadioGroupOption[];
|
|
222
|
-
/** Optional description text below the field */
|
|
223
|
-
description?: string;
|
|
224
|
-
/** Optional warning text to display */
|
|
225
|
-
warningText?: string;
|
|
226
|
-
/** Whether the field is required */
|
|
227
|
-
required?: boolean;
|
|
228
|
-
/** Whether the field is disabled */
|
|
229
|
-
disabled?: boolean;
|
|
230
|
-
/** Whether the field is read-only */
|
|
231
|
-
readOnly?: boolean;
|
|
232
|
-
/** Optional aria-label for accessibility */
|
|
233
|
-
"aria-label"?: string;
|
|
234
|
-
/** Optional aria-describedby for accessibility */
|
|
235
|
-
"aria-describedby"?: string;
|
|
236
|
-
}
|
|
237
|
-
type RHFRadioGroupProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = RHFRadioGroupWithChildrenProps<TFieldValues, TName> | RHFRadioGroupWithOptionsProps<TFieldValues, TName>;
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* A radio group component that integrates with React Hook Form.
|
|
241
|
-
* Provides form validation, error handling, and accessibility features.
|
|
242
|
-
*
|
|
243
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiogroup--docs
|
|
244
|
-
*
|
|
245
|
-
* @example
|
|
246
|
-
* ```tsx
|
|
247
|
-
* // Using children
|
|
248
|
-
* <Form>
|
|
249
|
-
* <RHFRadioGroup name="preference" label="Select your preference">
|
|
250
|
-
* <RadioGroupItem value="option1" label="Option 1" />
|
|
251
|
-
* <RadioGroupItem value="option2" label="Option 2" />
|
|
252
|
-
* </RHFRadioGroup>
|
|
253
|
-
* </Form>
|
|
254
|
-
*
|
|
255
|
-
* // Using options prop
|
|
256
|
-
* <Form>
|
|
257
|
-
* <RHFRadioGroup
|
|
258
|
-
* name="preference"
|
|
259
|
-
* label="Select your preference"
|
|
260
|
-
* options={[
|
|
261
|
-
* { id: "option1", label: "Option 1" },
|
|
262
|
-
* { id: "option2", label: "Option 2" }
|
|
263
|
-
* ]}
|
|
264
|
-
* />
|
|
265
|
-
* </Form>
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
declare function RHFRadioGroup<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, warningText, required, disabled, readOnly, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, children, ...other }: RHFRadioGroupProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
269
|
-
|
|
270
|
-
interface RHFRadioButtonGroupOption {
|
|
271
|
-
label: string;
|
|
272
|
-
id: string;
|
|
273
|
-
size?: "default" | "sm" | "lg";
|
|
274
|
-
}
|
|
275
|
-
interface RHFRadioButtonGroupProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<React.ComponentProps<typeof RadioGroup>, "name"> {
|
|
276
|
-
/** The name of the field in the form */
|
|
277
|
-
name: TName;
|
|
278
|
-
/** Optional label for the field */
|
|
279
|
-
label?: string;
|
|
280
|
-
/** Optional description text below the field */
|
|
281
|
-
description?: string;
|
|
282
|
-
/** Optional warning text to display */
|
|
283
|
-
warningText?: string;
|
|
284
|
-
/** Whether the field is required */
|
|
285
|
-
required?: boolean;
|
|
286
|
-
/** Whether the field is disabled */
|
|
287
|
-
disabled?: boolean;
|
|
288
|
-
/** Whether the field is read-only */
|
|
289
|
-
readOnly?: boolean;
|
|
290
|
-
/** Optional aria-label for accessibility */
|
|
291
|
-
"aria-label"?: string;
|
|
292
|
-
/** Optional aria-describedby for accessibility */
|
|
293
|
-
"aria-describedby"?: string;
|
|
294
|
-
/** Radio button group options */
|
|
295
|
-
options: RHFRadioButtonGroupOption[];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* A radio button group component that integrates with React Hook Form.
|
|
300
|
-
* Uses buttons instead of traditional radio inputs for a more modern look.
|
|
301
|
-
*
|
|
302
|
-
* @url https://sergii-melnykov.github.io/ui/?path=/docs/molecules-rhf-rhfradiobuttongroup--docs
|
|
303
|
-
*
|
|
304
|
-
* @example
|
|
305
|
-
* ```tsx
|
|
306
|
-
* <Form>
|
|
307
|
-
* <RHFRadioButtonGroup
|
|
308
|
-
* name="preference"
|
|
309
|
-
* label="Select your preference"
|
|
310
|
-
* options={[
|
|
311
|
-
* { value: "option1", label: "Option 1" },
|
|
312
|
-
* { value: "option2", label: "Option 2" },
|
|
313
|
-
* { value: "option3", label: "Option 3" }
|
|
314
|
-
* ]}
|
|
315
|
-
* />
|
|
316
|
-
* </Form>
|
|
317
|
-
* ```
|
|
318
|
-
*/
|
|
319
|
-
declare function RHFRadioButtonGroup<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, warningText, required, disabled, readOnly, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, options, ...other }: RHFRadioButtonGroupProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
320
|
-
|
|
321
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
322
|
-
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
323
|
-
declare const useFormField: () => {
|
|
324
|
-
invalid: boolean;
|
|
325
|
-
isDirty: boolean;
|
|
326
|
-
isTouched: boolean;
|
|
327
|
-
isValidating: boolean;
|
|
328
|
-
error?: react_hook_form.FieldError;
|
|
329
|
-
id: string;
|
|
330
|
-
name: string;
|
|
331
|
-
formItemId: string;
|
|
332
|
-
formDescriptionId: string;
|
|
333
|
-
formMessageId: string;
|
|
334
|
-
};
|
|
335
|
-
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
336
|
-
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
337
|
-
declare const FormControl: React.ForwardRefExoticComponent<Omit<_radix_ui_react_slot.SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
338
|
-
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
339
|
-
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Props interface for the Form component.
|
|
343
|
-
* Extends react-hook-form's FormProvider props.
|
|
344
|
-
*/
|
|
345
|
-
interface FormProps<TFieldValues extends FieldValues = FieldValues> {
|
|
346
|
-
/**
|
|
347
|
-
* The form context value
|
|
348
|
-
*/
|
|
349
|
-
context: React.Context<TFieldValues>;
|
|
350
|
-
/**
|
|
351
|
-
* The form children
|
|
352
|
-
*/
|
|
353
|
-
children: React.ReactNode;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Props interface for the FormField component.
|
|
357
|
-
* Extends react-hook-form's Controller props.
|
|
358
|
-
*/
|
|
359
|
-
interface FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends ControllerProps<TFieldValues, TName> {
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Props interface for the FormItem component.
|
|
363
|
-
* Extends HTML div attributes.
|
|
364
|
-
*/
|
|
365
|
-
interface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Props interface for the FormLabel component.
|
|
369
|
-
* Extends Radix UI Label props.
|
|
370
|
-
*/
|
|
371
|
-
interface FormLabelProps extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Props interface for the FormControl component.
|
|
375
|
-
* Extends Radix UI Slot props.
|
|
376
|
-
*/
|
|
377
|
-
interface FormControlProps extends React.ComponentPropsWithoutRef<typeof Slot> {
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Props interface for the FormDescription component.
|
|
381
|
-
* Extends HTML paragraph attributes.
|
|
382
|
-
*/
|
|
383
|
-
interface FormDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Props interface for the FormMessage component.
|
|
387
|
-
* Extends HTML paragraph attributes.
|
|
388
|
-
*/
|
|
389
|
-
interface FormMessageProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
390
|
-
/**
|
|
391
|
-
* The message content
|
|
392
|
-
*/
|
|
393
|
-
children?: React.ReactNode;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Context value type for form field context
|
|
397
|
-
*/
|
|
398
|
-
type FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
399
|
-
name: TName;
|
|
400
|
-
};
|
|
401
|
-
/**
|
|
402
|
-
* Context value type for form item context
|
|
403
|
-
*/
|
|
404
|
-
type FormItemContextValue = {
|
|
405
|
-
id: string;
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
export { Form, FormControl, type FormControlProps, FormDescription, type FormDescriptionProps, FormField, type FormFieldContextValue, type FormFieldProps, FormItem, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, RHFCheckbox, RHFRadioButtonGroup, type RHFRadioButtonGroupOption, type RHFRadioButtonGroupProps, RHFRadioGroup, RHFSwitch, RHFTextField, RHFTextarea, useFormField };
|