@classytic/formkit 1.0.3 → 1.2.2

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 CHANGED
@@ -1,56 +1,88 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [1.0.3] - 2024-12-04
9
-
10
- ### Changed
11
-
12
- - **Complete TypeScript Migration**: Rewrote entire codebase with strict TypeScript
13
- - **Improved Type Definitions**: Added comprehensive type exports for better DX
14
- - **Modern Build System**: Updated tsup configuration for better tree-shaking
15
- - **Enhanced Types**: Added `FieldOption`, `FieldOptionGroup`, `DefineField` utility types
16
- - **Better Error Messages**: Improved development warnings with actionable messages
17
-
18
- ### Added
19
-
20
- - New type exports: `FieldOption`, `FieldOptionGroup`, `DefineField`, `SchemaFieldNames`, `InferSchemaValues`
21
- - Subcomponent exports: `SectionRenderer`, `GridRenderer`, `FieldWrapper`
22
- - Hook exports: `useFieldComponent`, `useLayoutComponent`
23
- - Support for `gap` property in sections
24
- - Support for `collapsible` and `defaultCollapsed` section properties
25
- - `FormElement` type for consistent JSX return types
26
- - `ClassValue` re-export from utils
27
-
28
- ### Fixed
29
-
30
- - Package exports configuration for proper ESM/CJS interop
31
- - TypeScript strict mode compatibility
32
- - Proper peer dependency declarations
33
-
34
- ## [1.0.2] - 2024-12-03
35
-
36
- ### Added
37
-
38
- - Initial public release
39
- - FormGenerator component
40
- - FormSystemProvider context
41
- - Schema-driven form generation
42
- - Variant support for components
43
- - Conditional field rendering
44
-
45
- ## [1.0.1] - 2024-12-02
46
-
47
- ### Fixed
48
-
49
- - Package configuration fixes
50
-
51
- ## [1.0.0] - 2024-12-01
52
-
53
- ### Added
54
-
55
- - Initial release
56
-
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.2.2] - 2026-02-26
9
+
10
+ ### Fixed
11
+
12
+ - **`useFormKit` referential stability** Return value now preserves the original `useForm` object identity across re-renders using `Object.assign` instead of object spread. Previously, spreading `{...form, generatorProps}` created a new object every render, which caused infinite loops when the form was used in `useEffect` dependency arrays (e.g., `form.reset()` in effects triggered re-renders → new object → effect fires again)
13
+ - **`generatorProps` memoized** The `generatorProps` object returned by `useFormKit` is now wrapped in `useMemo`, preventing unnecessary re-renders of `<FormGenerator />` when unrelated props change
14
+
15
+ ### Added
16
+
17
+ - **Referential stability test** — New test case verifying that `useFormKit` return value and its methods (`reset`, `setValue`, `handleSubmit`) maintain referential identity across re-renders
18
+
19
+ ## [1.1.0] - 2026-02-24
20
+
21
+ ### Added
22
+
23
+ - **`useFormKit` hook** — Convenience hook that combines schema default extraction with react-hook-form setup. Returns all `useForm` methods plus ready-to-spread `generatorProps` for minimal boilerplate form setup
24
+ - **`extractDefaultValues(schema)`** Server-safe utility that walks a schema and extracts all `defaultValue` fields into a flat object, respecting `nameSpace` prefixes and group `itemFields`
25
+ - **`buildValidationRules(field)`** — Server-safe utility that generates react-hook-form validation rules from a field's `required`, `min`, `max`, `minLength`, `maxLength`, and `pattern` props with auto-generated error messages
26
+ - **`ref` prop on FormGenerator** — React 19 ref-as-prop support (no `forwardRef` needed). Pass a ref to get access to the root `<div>` element
27
+ - **`fieldState` runtime data** — `FieldComponentProps` now receives real `fieldState` with `invalid`, `isDirty`, `isTouched`, `isValidating`, and `error` from react-hook-form (previously always `undefined`)
28
+ - **Server entry exports** — `extractDefaultValues` and `buildValidationRules` added to `@classytic/formkit/server`
29
+ - New type exports: `UseFormKitOptions`, `UseFormKitReturn`
30
+
31
+ ### Fixed
32
+
33
+ - **Nested path DSL conditions** — `evaluateRule` now correctly resolves both flat keys (`"address.city"` as literal key from `DynamicFieldWrapper`) and nested objects (`{ address: { city: "NYC" } }`)
34
+ - **`useFormState` scoped per-field** — Added `name` parameter to prevent unnecessary re-renders across unrelated fields
35
+ - Removed `process.env.NODE_ENV` guard from missing-control warning — now always warns
36
+
37
+ ### Changed
38
+
39
+ - Requires React Hook Form `^7.54.0` (was `^7.53.2`)
40
+
41
+ ## [1.0.3] - 2024-12-04
42
+
43
+ ### Changed
44
+
45
+ - **Complete TypeScript Migration**: Rewrote entire codebase with strict TypeScript
46
+ - **Improved Type Definitions**: Added comprehensive type exports for better DX
47
+ - **Modern Build System**: Updated tsup configuration for better tree-shaking
48
+ - **Enhanced Types**: Added `FieldOption`, `FieldOptionGroup`, `DefineField` utility types
49
+ - **Better Error Messages**: Improved development warnings with actionable messages
50
+
51
+ ### Added
52
+
53
+ - New type exports: `FieldOption`, `FieldOptionGroup`, `DefineField`, `SchemaFieldNames`, `InferSchemaValues`
54
+ - Subcomponent exports: `SectionRenderer`, `GridRenderer`, `FieldWrapper`
55
+ - Hook exports: `useFieldComponent`, `useLayoutComponent`
56
+ - Support for `gap` property in sections
57
+ - Support for `collapsible` and `defaultCollapsed` section properties
58
+ - `FormElement` type for consistent JSX return types
59
+ - `ClassValue` re-export from utils
60
+
61
+ ### Fixed
62
+
63
+ - Package exports configuration for proper ESM/CJS interop
64
+ - TypeScript strict mode compatibility
65
+ - Proper peer dependency declarations
66
+
67
+ ## [1.0.2] - 2024-12-03
68
+
69
+ ### Added
70
+
71
+ - Initial public release
72
+ - FormGenerator component
73
+ - FormSystemProvider context
74
+ - Schema-driven form generation
75
+ - Variant support for components
76
+ - Conditional field rendering
77
+
78
+ ## [1.0.1] - 2024-12-02
79
+
80
+ ### Fixed
81
+
82
+ - Package configuration fixes
83
+
84
+ ## [1.0.0] - 2024-12-01
85
+
86
+ ### Added
87
+
88
+ - Initial release