@rachelallyson/hero-hook-form 2.5.1 → 2.7.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 +76 -0
- package/dist/index.d.ts +584 -38
- package/dist/index.js +553 -92
- package/dist/react/index.d.ts +583 -37
- package/dist/react/index.js +553 -92
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,82 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.7.0] - 2026-01-13
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Enhanced FieldArrayConfig**: Added powerful new features for dynamic field arrays
|
|
10
|
+
- `enableReordering` - Enable up/down buttons to reorder array items
|
|
11
|
+
- `reorderButtonText` - Customize reorder button labels (`{ up?: string; down?: string }`)
|
|
12
|
+
- `renderItem` - Custom render function for array items with full control over layout
|
|
13
|
+
- `renderAddButton` - Custom render function for the add button
|
|
14
|
+
- `defaultItem` - Function to create default values when adding new array items
|
|
15
|
+
- Conditional fields now work within array items (automatic path resolution)
|
|
16
|
+
- Example: `{ type: "fieldArray", name: "slots", enableReordering: true, ... }`
|
|
17
|
+
|
|
18
|
+
- **SimpleForm Component**: New simplified API for single-field forms
|
|
19
|
+
- Perfect for search bars, message inputs, or simple single-field forms
|
|
20
|
+
- Uses `ZodForm` internally for consistent validation and error handling
|
|
21
|
+
- Example: `<SimpleForm schema={schema} field={FormFieldHelpers.input("message", "")} />`
|
|
22
|
+
|
|
23
|
+
- **syncArrays Utility**: Helper function for syncing arrays in edit forms
|
|
24
|
+
- Determines which items to create, update, or delete based on IDs
|
|
25
|
+
- Useful for edit forms where you need to sync array changes with a database
|
|
26
|
+
- Example: `const { toCreate, toUpdate, toDelete } = syncArrays({ existing, current, getId })`
|
|
27
|
+
|
|
28
|
+
- **createFieldArrayCustomConfig Helper**: Reduces boilerplate for custom field arrays
|
|
29
|
+
- Creates a `CustomFieldConfig` that uses `useFieldArray` internally
|
|
30
|
+
- Provides structured way to render custom array items with reordering
|
|
31
|
+
- Example: `createFieldArrayCustomConfig({ name: "slots", enableReordering: true, ... })`
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **Conditional Fields in Arrays**: Fixed path resolution for conditional fields within array items
|
|
36
|
+
- Uses `get()` from react-hook-form to correctly resolve nested paths like `"slots.0.slotType"`
|
|
37
|
+
- Conditional fields now work correctly within dynamic field arrays
|
|
38
|
+
- Example: Field with `dependsOn: "slotType"` in array item automatically resolves to `"slots.0.slotType"`
|
|
39
|
+
|
|
40
|
+
## [2.6.0] - 2026-01-13
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- **Complete Prop Support for All FormFieldHelpers**: All field helpers now accept full component props for complete customization
|
|
45
|
+
- `input()` - Added `inputProps` parameter for full Input component customization
|
|
46
|
+
- `textarea()` - Added `textareaProps` parameter (placeholder still works as shorthand)
|
|
47
|
+
- `select()` - Added `selectProps` parameter
|
|
48
|
+
- `checkbox()` - Added `checkboxProps` parameter
|
|
49
|
+
- `switch()` - Added `switchProps` parameter (description still works as shorthand)
|
|
50
|
+
- `autocomplete()` - Added `autocompleteProps` parameter (placeholder still works as shorthand)
|
|
51
|
+
- `date()` - Improved with proper `DateInput` component typing
|
|
52
|
+
- `slider()` - Improved with proper `Slider` component typing
|
|
53
|
+
- `file()` - Improved with proper `Input` component typing for file inputs
|
|
54
|
+
- `fontPicker()` - Added helper with proper `FontPickerProps` interface typing
|
|
55
|
+
|
|
56
|
+
- **New Field Helpers**: Added missing helpers for complete coverage
|
|
57
|
+
- `radio()` - Radio group field helper with `radioProps` support
|
|
58
|
+
- `slider()` - Slider field helper with `sliderProps` support
|
|
59
|
+
- `file()` - File upload field helper with `fileProps` support
|
|
60
|
+
- `fontPicker()` - Font picker field helper with `fontPickerProps` support
|
|
61
|
+
|
|
62
|
+
### Enhanced
|
|
63
|
+
|
|
64
|
+
- **Improved Type Safety**: Replaced all `Record<string, string | number | boolean>` types with proper component types
|
|
65
|
+
- All helpers now use `Omit<ComponentProps<typeof Component>, ...>` for full type safety
|
|
66
|
+
- Removed all type assertions (`as Record`) - now using proper component types
|
|
67
|
+
- Full IntelliSense support for all component props
|
|
68
|
+
- Type-safe exclusions for form-managed props (value, onChange, label, etc.)
|
|
69
|
+
|
|
70
|
+
- **Consistent API Pattern**: All helpers now follow the same pattern
|
|
71
|
+
- Simple API for basic cases: `FormFieldHelpers.input("email", "Email", "email")`
|
|
72
|
+
- Full customization when needed: `FormFieldHelpers.input("email", "Email", "email", { classNames: {...}, startContent: <Icon /> })`
|
|
73
|
+
- Backward compatible - all existing code continues to work
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
|
|
77
|
+
- **AdvancedFormBuilder**: Updated to use correct prop names (`maxValue`/`minValue` instead of `max`/`min` for Slider)
|
|
78
|
+
- **TypeInferredBuilder**: Updated slider props to use correct prop names
|
|
79
|
+
- **FontPicker Types**: Improved type safety with proper `FontPickerProps` interface instead of `Record`
|
|
80
|
+
|
|
5
81
|
## [2.5.1] - 2026-01-13
|
|
6
82
|
|
|
7
83
|
### Fixed
|