@form-engine-ts/react 2.9.5 → 3.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
@@ -29,7 +29,7 @@ export function ContactForm() {
29
29
  schema={schema}
30
30
  locale="en"
31
31
  translator={mockTranslator}
32
- onSubmit={async (values) => console.log(values)}
32
+ onSubmit={async (values, context) => console.log(values, context.attemptId)}
33
33
  >
34
34
  <FormRenderer />
35
35
  </FormProvider>
@@ -149,6 +149,15 @@ and `useSubmissionReceipts` loads multiple form/version receipts for list and da
149
149
 
150
150
  Receipt persistence is best-effort: `onReceiptError` observes storage failures while the successful completion screen is
151
151
  preserved. Pass an SSR-safe `createLocalStorageSubmissionAttemptStore()` as `attemptStore` to reserve an ID immediately
152
- before submission. Renderer injects it as `attemptId` and `submissionId`, retains it after a failed request, promotes it
153
- to the receipt after success, and then clears the attempt. Custom receipt stores may omit `getBatch`; the hook falls back
154
- to concurrent `get` calls.
152
+ before submission. `onSubmit(answers, context)` keeps `attemptId`, `formId`, `formVersion`, `locale`, and `submittedAt`
153
+ outside the answers object, retains the same attempt after a failed request, promotes it to the receipt after success,
154
+ and then clears the attempt. Custom receipt stores may omit `getBatch`; the hook falls back to concurrent `get` calls.
155
+
156
+ After success, completion rendering receives a typed `FormCompletionSlotProps` snapshot of `answers`, `schema`, the
157
+ optional response, and `submittedItems`. Each summary item includes the field title, raw value, formatted display value,
158
+ visibility, and field metadata. Use `renderSubmittedValues` for a typed summary slot; hidden fields are omitted by default
159
+ and can be included with `showHiddenFieldsInSummary`. Supply `messages` or `messageResolver` to localize standard buttons,
160
+ validation, retry, already-submitted, server-error, and sensitive-data confirmation UI. Server validation can be returned
161
+ by throwing `FormSubmissionError` or a payload with `fieldErrors` and `formError`; field messages are mapped back to the
162
+ form, scrolled into view, and focused. Use `submissionConfirmationRenderMode="replace"` or `"dialog"` for alternate
163
+ confirmation presentations, and `fieldsClassName` or `renderFields` to control the fields wrapper.