@rachelallyson/hero-hook-form 2.4.0 → 2.6.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/CHANGELOG.md +71 -0
- package/dist/index.d.ts +229 -14
- package/dist/index.js +279 -35
- package/dist/react/index.d.ts +228 -13
- package/dist/react/index.js +279 -35
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,77 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.6.0] - 2026-01-13
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Complete Prop Support for All FormFieldHelpers**: All field helpers now accept full component props for complete customization
|
|
10
|
+
- `input()` - Added `inputProps` parameter for full Input component customization
|
|
11
|
+
- `textarea()` - Added `textareaProps` parameter (placeholder still works as shorthand)
|
|
12
|
+
- `select()` - Added `selectProps` parameter
|
|
13
|
+
- `checkbox()` - Added `checkboxProps` parameter
|
|
14
|
+
- `switch()` - Added `switchProps` parameter (description still works as shorthand)
|
|
15
|
+
- `autocomplete()` - Added `autocompleteProps` parameter (placeholder still works as shorthand)
|
|
16
|
+
- `date()` - Improved with proper `DateInput` component typing
|
|
17
|
+
- `slider()` - Improved with proper `Slider` component typing
|
|
18
|
+
- `file()` - Improved with proper `Input` component typing for file inputs
|
|
19
|
+
- `fontPicker()` - Added helper with proper `FontPickerProps` interface typing
|
|
20
|
+
|
|
21
|
+
- **New Field Helpers**: Added missing helpers for complete coverage
|
|
22
|
+
- `radio()` - Radio group field helper with `radioProps` support
|
|
23
|
+
- `slider()` - Slider field helper with `sliderProps` support
|
|
24
|
+
- `file()` - File upload field helper with `fileProps` support
|
|
25
|
+
- `fontPicker()` - Font picker field helper with `fontPickerProps` support
|
|
26
|
+
|
|
27
|
+
### Enhanced
|
|
28
|
+
|
|
29
|
+
- **Improved Type Safety**: Replaced all `Record<string, string | number | boolean>` types with proper component types
|
|
30
|
+
- All helpers now use `Omit<ComponentProps<typeof Component>, ...>` for full type safety
|
|
31
|
+
- Removed all type assertions (`as Record`) - now using proper component types
|
|
32
|
+
- Full IntelliSense support for all component props
|
|
33
|
+
- Type-safe exclusions for form-managed props (value, onChange, label, etc.)
|
|
34
|
+
|
|
35
|
+
- **Consistent API Pattern**: All helpers now follow the same pattern
|
|
36
|
+
- Simple API for basic cases: `FormFieldHelpers.input("email", "Email", "email")`
|
|
37
|
+
- Full customization when needed: `FormFieldHelpers.input("email", "Email", "email", { classNames: {...}, startContent: <Icon /> })`
|
|
38
|
+
- Backward compatible - all existing code continues to work
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- **AdvancedFormBuilder**: Updated to use correct prop names (`maxValue`/`minValue` instead of `max`/`min` for Slider)
|
|
43
|
+
- **TypeInferredBuilder**: Updated slider props to use correct prop names
|
|
44
|
+
- **FontPicker Types**: Improved type safety with proper `FontPickerProps` interface instead of `Record`
|
|
45
|
+
|
|
46
|
+
## [2.5.1] - 2026-01-13
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- **Conditional Field Helper TypeScript Types**: Fixed type inference issues in `FormFieldHelpers.conditional()`
|
|
51
|
+
- Added default generic type parameter `= FieldValues` for better type compatibility
|
|
52
|
+
- Updated to use type assertion pattern similar to `FormFieldHelpers.content()` for consistency
|
|
53
|
+
- Improved type safety and compatibility with explicit type annotations in condition functions
|
|
54
|
+
- When TypeScript can't infer the type from `Partial<T>`, explicitly specify: `FormFieldHelpers.conditional<YourType>(...)`
|
|
55
|
+
- Removed unused `ConditionalFieldConfig` import
|
|
56
|
+
|
|
57
|
+
## [2.5.0] - 2026-01-13
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
|
|
61
|
+
- **AutocompleteField Component**: New autocomplete field component with full React Hook Form integration
|
|
62
|
+
- Supports static option lists via `items` prop
|
|
63
|
+
- Supports async loading via custom `children` render function
|
|
64
|
+
- Handles custom values with `allowsCustomValue` prop
|
|
65
|
+
- Full validation and error handling support
|
|
66
|
+
- Integrated with `FormFieldHelpers.autocomplete()` helper
|
|
67
|
+
- Integrated with `BasicFormBuilder.autocomplete()` method
|
|
68
|
+
- Comprehensive test coverage (10/10 tests passing)
|
|
69
|
+
- Example: `FormFieldHelpers.autocomplete("country", "Country", options, "Search for a country")`
|
|
70
|
+
|
|
71
|
+
### Dependencies
|
|
72
|
+
|
|
73
|
+
- Added `@heroui/autocomplete` as optional peer dependency and dev dependency
|
|
74
|
+
- Updated UI exports to include Autocomplete and AutocompleteItem components
|
|
75
|
+
|
|
5
76
|
## [2.4.0] - 2026-01-13
|
|
6
77
|
|
|
7
78
|
### Added
|
package/dist/index.d.ts
CHANGED
|
@@ -9,13 +9,13 @@ import * as _internationalized_date from '@internationalized/date';
|
|
|
9
9
|
import { CalendarDate } from '@internationalized/date';
|
|
10
10
|
import { Autocomplete } from '@heroui/autocomplete';
|
|
11
11
|
import { Checkbox } from '@heroui/checkbox';
|
|
12
|
+
import { DateInput } from '@heroui/date-input';
|
|
12
13
|
import { Input, Textarea } from '@heroui/input';
|
|
13
14
|
import { RadioGroup } from '@heroui/radio';
|
|
14
15
|
import { Select } from '@heroui/select';
|
|
16
|
+
import { Slider } from '@heroui/slider';
|
|
15
17
|
import { Switch } from '@heroui/switch';
|
|
16
18
|
import { Button as Button$1 } from '@heroui/button';
|
|
17
|
-
import { DateInput } from '@heroui/date-input';
|
|
18
|
-
import { Slider } from '@heroui/slider';
|
|
19
19
|
|
|
20
20
|
interface FieldBaseProps<TFieldValues extends FieldValues, TValue> {
|
|
21
21
|
name: Path<TFieldValues>;
|
|
@@ -76,24 +76,29 @@ interface RadioFieldConfig<TFieldValues extends FieldValues> extends BaseFormFie
|
|
|
76
76
|
interface SliderFieldConfig<TFieldValues extends FieldValues> extends BaseFormFieldConfig<TFieldValues> {
|
|
77
77
|
type: "slider";
|
|
78
78
|
defaultValue?: number;
|
|
79
|
-
sliderProps?:
|
|
79
|
+
sliderProps?: Omit<ComponentProps<typeof Slider>, "value" | "onChange" | "label" | "isDisabled">;
|
|
80
80
|
}
|
|
81
81
|
interface DateFieldConfig<TFieldValues extends FieldValues> extends BaseFormFieldConfig<TFieldValues> {
|
|
82
82
|
type: "date";
|
|
83
83
|
defaultValue?: _internationalized_date.CalendarDate | null;
|
|
84
|
-
dateProps?:
|
|
84
|
+
dateProps?: Omit<ComponentProps<typeof DateInput>, "value" | "onChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">;
|
|
85
85
|
}
|
|
86
86
|
interface FileFieldConfig<TFieldValues extends FieldValues> extends BaseFormFieldConfig<TFieldValues> {
|
|
87
87
|
type: "file";
|
|
88
88
|
defaultValue?: FileList | null;
|
|
89
|
-
fileProps?:
|
|
89
|
+
fileProps?: Omit<ComponentProps<typeof Input>, "value" | "onValueChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled" | "type">;
|
|
90
90
|
multiple?: boolean;
|
|
91
91
|
accept?: string;
|
|
92
92
|
}
|
|
93
93
|
interface FontPickerFieldConfig<TFieldValues extends FieldValues> extends BaseFormFieldConfig<TFieldValues> {
|
|
94
94
|
type: "fontPicker";
|
|
95
95
|
defaultValue?: string;
|
|
96
|
-
fontPickerProps?:
|
|
96
|
+
fontPickerProps?: {
|
|
97
|
+
showFontPreview?: boolean;
|
|
98
|
+
loadAllVariants?: boolean;
|
|
99
|
+
onFontsLoaded?: (loaded: boolean) => void;
|
|
100
|
+
fontsLoadedTimeout?: number;
|
|
101
|
+
};
|
|
97
102
|
}
|
|
98
103
|
interface CustomFieldConfig<TFieldValues extends FieldValues> extends BaseFormFieldConfig<TFieldValues> {
|
|
99
104
|
type: "custom";
|
|
@@ -2083,6 +2088,13 @@ declare class BasicFormBuilder<T extends FieldValues> {
|
|
|
2083
2088
|
label: string;
|
|
2084
2089
|
value: string | number;
|
|
2085
2090
|
}[]): this;
|
|
2091
|
+
/**
|
|
2092
|
+
* Add an autocomplete field
|
|
2093
|
+
*/
|
|
2094
|
+
autocomplete(name: Path<T>, label: string, items: {
|
|
2095
|
+
label: string;
|
|
2096
|
+
value: string | number;
|
|
2097
|
+
}[], placeholder?: string): this;
|
|
2086
2098
|
/**
|
|
2087
2099
|
* Add a checkbox field
|
|
2088
2100
|
*/
|
|
@@ -2180,15 +2192,42 @@ declare function createBasicFormBuilder<T extends FieldValues>(): BasicFormBuild
|
|
|
2180
2192
|
declare const FormFieldHelpers: {
|
|
2181
2193
|
/**
|
|
2182
2194
|
* Create an autocomplete field
|
|
2195
|
+
*
|
|
2196
|
+
* @example
|
|
2197
|
+
* ```tsx
|
|
2198
|
+
* // Simple autocomplete
|
|
2199
|
+
* FormFieldHelpers.autocomplete("country", "Country", options)
|
|
2200
|
+
*
|
|
2201
|
+
* // With placeholder
|
|
2202
|
+
* FormFieldHelpers.autocomplete("country", "Country", options, "Search countries")
|
|
2203
|
+
*
|
|
2204
|
+
* // With full customization
|
|
2205
|
+
* FormFieldHelpers.autocomplete("country", "Country", options, "Search countries", {
|
|
2206
|
+
* classNames: { base: "custom-autocomplete" },
|
|
2207
|
+
* allowsCustomValue: true
|
|
2208
|
+
* })
|
|
2209
|
+
* ```
|
|
2183
2210
|
*/
|
|
2184
2211
|
autocomplete: <T extends FieldValues>(name: Path<T>, label: string, items: {
|
|
2185
2212
|
label: string;
|
|
2186
2213
|
value: string | number;
|
|
2187
|
-
}[], placeholder?: string) => ZodFormFieldConfig<T>;
|
|
2214
|
+
}[], placeholder?: string, autocompleteProps?: Omit<React$1.ComponentProps<typeof Autocomplete>, "selectedKey" | "onSelectionChange" | "inputValue" | "onInputChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled" | "children" | "items">) => ZodFormFieldConfig<T>;
|
|
2188
2215
|
/**
|
|
2189
2216
|
* Create a checkbox field
|
|
2217
|
+
*
|
|
2218
|
+
* @example
|
|
2219
|
+
* ```tsx
|
|
2220
|
+
* // Simple checkbox
|
|
2221
|
+
* FormFieldHelpers.checkbox("newsletter", "Subscribe to newsletter")
|
|
2222
|
+
*
|
|
2223
|
+
* // With full customization
|
|
2224
|
+
* FormFieldHelpers.checkbox("newsletter", "Subscribe to newsletter", {
|
|
2225
|
+
* classNames: { base: "custom-checkbox" },
|
|
2226
|
+
* size: "lg"
|
|
2227
|
+
* })
|
|
2228
|
+
* ```
|
|
2190
2229
|
*/
|
|
2191
|
-
checkbox: <T extends FieldValues>(name: Path<T>, label: string) => ZodFormFieldConfig<T>;
|
|
2230
|
+
checkbox: <T extends FieldValues>(name: Path<T>, label: string, checkboxProps?: Omit<React$1.ComponentProps<typeof Checkbox>, "isSelected" | "onValueChange" | "isInvalid" | "errorMessage" | "isDisabled">) => ZodFormFieldConfig<T>;
|
|
2192
2231
|
/**
|
|
2193
2232
|
* Create a conditional field that shows/hides based on form data
|
|
2194
2233
|
*
|
|
@@ -2200,8 +2239,19 @@ declare const FormFieldHelpers: {
|
|
|
2200
2239
|
* FormFieldHelpers.input("phone", "Phone Number", "tel")
|
|
2201
2240
|
* )
|
|
2202
2241
|
* ```
|
|
2242
|
+
*
|
|
2243
|
+
* @example
|
|
2244
|
+
* With explicit type in condition function (similar to content helper pattern):
|
|
2245
|
+
* ```tsx
|
|
2246
|
+
* FormFieldHelpers.conditional(
|
|
2247
|
+
* "options",
|
|
2248
|
+
* (formData: Partial<z.infer<typeof fieldSchema>>) =>
|
|
2249
|
+
* formData.fieldType === 'DROPDOWN',
|
|
2250
|
+
* FormFieldHelpers.textarea("options", "Dropdown Options", "One per line")
|
|
2251
|
+
* )
|
|
2252
|
+
* ```
|
|
2203
2253
|
*/
|
|
2204
|
-
conditional: <T extends FieldValues>(name: Path<T>, condition: (formData: Partial<T>) => boolean, field: ZodFormFieldConfig<T>) => ZodFormFieldConfig<T>;
|
|
2254
|
+
conditional: <T extends FieldValues = FieldValues>(name: Path<T>, condition: (formData: Partial<T>) => boolean, field: ZodFormFieldConfig<T>) => ZodFormFieldConfig<T>;
|
|
2205
2255
|
/**
|
|
2206
2256
|
* Create a content field for headers, questions, or custom content between fields
|
|
2207
2257
|
*
|
|
@@ -2227,27 +2277,192 @@ declare const FormFieldHelpers: {
|
|
|
2227
2277
|
}) => ZodFormFieldConfig<T>;
|
|
2228
2278
|
/**
|
|
2229
2279
|
* Create a date field
|
|
2280
|
+
*
|
|
2281
|
+
* @example
|
|
2282
|
+
* ```tsx
|
|
2283
|
+
* // Simple date field
|
|
2284
|
+
* FormFieldHelpers.date("birthDate", "Birth Date")
|
|
2285
|
+
*
|
|
2286
|
+
* // With full customization
|
|
2287
|
+
* FormFieldHelpers.date("birthDate", "Birth Date", {
|
|
2288
|
+
* label: "Select your birth date",
|
|
2289
|
+
* granularity: "day",
|
|
2290
|
+
* minValue: new CalendarDate(1900, 1, 1)
|
|
2291
|
+
* })
|
|
2292
|
+
* ```
|
|
2293
|
+
*/
|
|
2294
|
+
date: <T extends FieldValues>(name: Path<T>, label: string, dateProps?: Omit<React$1.ComponentProps<typeof DateInput>, "value" | "onChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">) => ZodFormFieldConfig<T>;
|
|
2295
|
+
/**
|
|
2296
|
+
* Create a file upload field
|
|
2297
|
+
*
|
|
2298
|
+
* @example
|
|
2299
|
+
* ```tsx
|
|
2300
|
+
* // Simple file field
|
|
2301
|
+
* FormFieldHelpers.file("avatar", "Profile Picture")
|
|
2302
|
+
*
|
|
2303
|
+
* // With accept and multiple
|
|
2304
|
+
* FormFieldHelpers.file("avatar", "Profile Picture", {
|
|
2305
|
+
* accept: "image/*",
|
|
2306
|
+
* multiple: true
|
|
2307
|
+
* })
|
|
2308
|
+
*
|
|
2309
|
+
* // With full customization
|
|
2310
|
+
* FormFieldHelpers.file("avatar", "Profile Picture", {
|
|
2311
|
+
* accept: "image/*",
|
|
2312
|
+
* multiple: false,
|
|
2313
|
+
* fileProps: { className: "custom-file-input" }
|
|
2314
|
+
* })
|
|
2315
|
+
* ```
|
|
2316
|
+
*/
|
|
2317
|
+
file: <T extends FieldValues>(name: Path<T>, label: string, options?: {
|
|
2318
|
+
accept?: string;
|
|
2319
|
+
fileProps?: Omit<React$1.ComponentProps<typeof Input>, "value" | "onValueChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled" | "type">;
|
|
2320
|
+
multiple?: boolean;
|
|
2321
|
+
}) => ZodFormFieldConfig<T>;
|
|
2322
|
+
/**
|
|
2323
|
+
* Create a font picker field
|
|
2324
|
+
*
|
|
2325
|
+
* @example
|
|
2326
|
+
* ```tsx
|
|
2327
|
+
* // Simple font picker
|
|
2328
|
+
* FormFieldHelpers.fontPicker("font", "Choose Font")
|
|
2329
|
+
*
|
|
2330
|
+
* // With full customization
|
|
2331
|
+
* FormFieldHelpers.fontPicker("font", "Choose Font", {
|
|
2332
|
+
* showFontPreview: true,
|
|
2333
|
+
* loadAllVariants: false,
|
|
2334
|
+
* fontsLoadedTimeout: 5000
|
|
2335
|
+
* })
|
|
2336
|
+
* ```
|
|
2230
2337
|
*/
|
|
2231
|
-
|
|
2338
|
+
fontPicker: <T extends FieldValues>(name: Path<T>, label: string, fontPickerProps?: {
|
|
2339
|
+
showFontPreview?: boolean;
|
|
2340
|
+
loadAllVariants?: boolean;
|
|
2341
|
+
onFontsLoaded?: (loaded: boolean) => void;
|
|
2342
|
+
fontsLoadedTimeout?: number;
|
|
2343
|
+
}) => ZodFormFieldConfig<T>;
|
|
2232
2344
|
/**
|
|
2233
2345
|
* Create an input field
|
|
2346
|
+
*
|
|
2347
|
+
* @example
|
|
2348
|
+
* ```tsx
|
|
2349
|
+
* // Simple input
|
|
2350
|
+
* FormFieldHelpers.input("name", "Name")
|
|
2351
|
+
*
|
|
2352
|
+
* // With type
|
|
2353
|
+
* FormFieldHelpers.input("email", "Email", "email")
|
|
2354
|
+
*
|
|
2355
|
+
* // With full customization
|
|
2356
|
+
* FormFieldHelpers.input("email", "Email", "email", {
|
|
2357
|
+
* placeholder: "Enter your email",
|
|
2358
|
+
* classNames: { input: "custom-input" },
|
|
2359
|
+
* startContent: <MailIcon />,
|
|
2360
|
+
* description: "We'll never share your email"
|
|
2361
|
+
* })
|
|
2362
|
+
* ```
|
|
2363
|
+
*/
|
|
2364
|
+
input: <T extends FieldValues>(name: Path<T>, label: string, type?: "text" | "email" | "tel" | "password", inputProps?: Omit<React$1.ComponentProps<typeof Input>, "value" | "onValueChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">) => ZodFormFieldConfig<T>;
|
|
2365
|
+
/**
|
|
2366
|
+
* Create a radio group field
|
|
2367
|
+
*
|
|
2368
|
+
* @example
|
|
2369
|
+
* ```tsx
|
|
2370
|
+
* // Simple radio group
|
|
2371
|
+
* FormFieldHelpers.radio("gender", "Gender", [
|
|
2372
|
+
* { label: "Male", value: "male" },
|
|
2373
|
+
* { label: "Female", value: "female" }
|
|
2374
|
+
* ])
|
|
2375
|
+
*
|
|
2376
|
+
* // With full customization
|
|
2377
|
+
* FormFieldHelpers.radio("gender", "Gender", options, {
|
|
2378
|
+
* orientation: "horizontal",
|
|
2379
|
+
* classNames: { base: "custom-radio" }
|
|
2380
|
+
* })
|
|
2381
|
+
* ```
|
|
2234
2382
|
*/
|
|
2235
|
-
|
|
2383
|
+
radio: <T extends FieldValues>(name: Path<T>, label: string, options: {
|
|
2384
|
+
label: string;
|
|
2385
|
+
value: string | number;
|
|
2386
|
+
}[], radioProps?: Omit<React$1.ComponentProps<typeof RadioGroup>, "value" | "onValueChange" | "label">) => ZodFormFieldConfig<T>;
|
|
2236
2387
|
/**
|
|
2237
2388
|
* Create a select field
|
|
2389
|
+
*
|
|
2390
|
+
* @example
|
|
2391
|
+
* ```tsx
|
|
2392
|
+
* // Simple select
|
|
2393
|
+
* FormFieldHelpers.select("country", "Country", options)
|
|
2394
|
+
*
|
|
2395
|
+
* // With full customization
|
|
2396
|
+
* FormFieldHelpers.select("country", "Country", options, {
|
|
2397
|
+
* placeholder: "Select a country",
|
|
2398
|
+
* classNames: { trigger: "custom-select" },
|
|
2399
|
+
* selectionMode: "multiple"
|
|
2400
|
+
* })
|
|
2401
|
+
* ```
|
|
2238
2402
|
*/
|
|
2239
2403
|
select: <T extends FieldValues>(name: Path<T>, label: string, options: {
|
|
2240
2404
|
label: string;
|
|
2241
2405
|
value: string | number;
|
|
2242
|
-
}[]) => ZodFormFieldConfig<T>;
|
|
2406
|
+
}[], selectProps?: Omit<React$1.ComponentProps<typeof Select>, "selectedKeys" | "onSelectionChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">) => ZodFormFieldConfig<T>;
|
|
2407
|
+
/**
|
|
2408
|
+
* Create a slider field
|
|
2409
|
+
*
|
|
2410
|
+
* @example
|
|
2411
|
+
* ```tsx
|
|
2412
|
+
* // Simple slider
|
|
2413
|
+
* FormFieldHelpers.slider("rating", "Rating")
|
|
2414
|
+
*
|
|
2415
|
+
* // With full customization
|
|
2416
|
+
* FormFieldHelpers.slider("rating", "Rating", {
|
|
2417
|
+
* minValue: 1,
|
|
2418
|
+
* maxValue: 5,
|
|
2419
|
+
* step: 1,
|
|
2420
|
+
* showSteps: true,
|
|
2421
|
+
* classNames: { base: "custom-slider" }
|
|
2422
|
+
* })
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
2425
|
+
slider: <T extends FieldValues>(name: Path<T>, label: string, sliderProps?: Omit<React$1.ComponentProps<typeof Slider>, "value" | "onChange" | "label" | "isDisabled">) => ZodFormFieldConfig<T>;
|
|
2243
2426
|
/**
|
|
2244
2427
|
* Create a switch field
|
|
2428
|
+
*
|
|
2429
|
+
* @example
|
|
2430
|
+
* ```tsx
|
|
2431
|
+
* // Simple switch
|
|
2432
|
+
* FormFieldHelpers.switch("notifications", "Enable notifications")
|
|
2433
|
+
*
|
|
2434
|
+
* // With description
|
|
2435
|
+
* FormFieldHelpers.switch("notifications", "Enable notifications", "Receive email notifications")
|
|
2436
|
+
*
|
|
2437
|
+
* // With full customization
|
|
2438
|
+
* FormFieldHelpers.switch("notifications", "Enable notifications", "Receive email notifications", {
|
|
2439
|
+
* classNames: { base: "custom-switch" },
|
|
2440
|
+
* size: "lg",
|
|
2441
|
+
* color: "primary"
|
|
2442
|
+
* })
|
|
2443
|
+
* ```
|
|
2245
2444
|
*/
|
|
2246
|
-
switch: <T extends FieldValues>(name: Path<T>, label: string, description?: string) => ZodFormFieldConfig<T>;
|
|
2445
|
+
switch: <T extends FieldValues>(name: Path<T>, label: string, description?: string, switchProps?: Omit<React$1.ComponentProps<typeof Switch>, "isSelected" | "onValueChange" | "isInvalid" | "errorMessage" | "isDisabled">) => ZodFormFieldConfig<T>;
|
|
2247
2446
|
/**
|
|
2248
2447
|
* Create a textarea field
|
|
2448
|
+
*
|
|
2449
|
+
* @example
|
|
2450
|
+
* ```tsx
|
|
2451
|
+
* // Simple textarea
|
|
2452
|
+
* FormFieldHelpers.textarea("message", "Message")
|
|
2453
|
+
*
|
|
2454
|
+
* // With placeholder
|
|
2455
|
+
* FormFieldHelpers.textarea("message", "Message", "Enter your message")
|
|
2456
|
+
*
|
|
2457
|
+
* // With full customization
|
|
2458
|
+
* FormFieldHelpers.textarea("message", "Message", "Enter your message", {
|
|
2459
|
+
* classNames: { input: "custom-textarea" },
|
|
2460
|
+
* minRows: 3,
|
|
2461
|
+
* maxRows: 10
|
|
2462
|
+
* })
|
|
2463
|
+
* ```
|
|
2249
2464
|
*/
|
|
2250
|
-
textarea: <T extends FieldValues>(name: Path<T>, label: string, placeholder?: string) => ZodFormFieldConfig<T>;
|
|
2465
|
+
textarea: <T extends FieldValues>(name: Path<T>, label: string, placeholder?: string, textareaProps?: Omit<React$1.ComponentProps<typeof Textarea>, "value" | "onValueChange" | "label" | "isInvalid" | "errorMessage" | "isDisabled">) => ZodFormFieldConfig<T>;
|
|
2251
2466
|
};
|
|
2252
2467
|
/**
|
|
2253
2468
|
* Common field collections
|