@form-engine-ts/react 1.1.0 → 2.0.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/README.md CHANGED
@@ -50,3 +50,33 @@ on the next mount:
50
50
  `FormProvider` resolves authoring-time translations synchronously whenever `locale` changes. `FormBuilder` includes page
51
51
  membership controls and localization editors; pass an `AsyncTranslationAdapter` as `translationAdapter` to enable its
52
52
  batch-translation action.
53
+
54
+ ## Headless builder and renderer lifecycle
55
+
56
+ `useFormBuilder({ schema, onChange, policy, idFactory })` exposes controlled field, option, page, and locale actions.
57
+ `BuilderPolicy` can enforce allowed field types, 20-field/10-option style limits, text length, and required locales.
58
+ Rejected add operations return typed errors without changing the schema. `<FormBuilder>` uses the same hook and accepts
59
+ `policy` and `idFactory` props.
60
+
61
+ `FormRenderer` can also be used without an explicit provider:
62
+
63
+ ```tsx
64
+ <FormRenderer
65
+ schema={schema}
66
+ locale="en"
67
+ beforeSubmit={async (values) => (await confirmValues(values) ? "continue" : "cancel")}
68
+ onSubmit={saveValues}
69
+ onDraftSave={saveDraft}
70
+ slots={{
71
+ renderHeader: ({ title }) => <MyHeader>{title}</MyHeader>,
72
+ renderField: (props) => <MyField {...props} />,
73
+ renderSubmitButton: ({ isSubmitting, onSubmit }) => (
74
+ <MyButton disabled={isSubmitting} onClick={onSubmit}>Save</MyButton>
75
+ )
76
+ }}
77
+ />
78
+ ```
79
+
80
+ Validation runs before `beforeSubmit`. A `"cancel"` result does not call `onSubmit` and preserves values and drafts.
81
+ Header, field, navigation, submit, validation-summary, and completion slots can replace the default UI. The localized
82
+ `completionMessage` is displayed after a successful submission.