@formancy/react 0.7.0 → 0.9.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/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ComponentType, ReactElement, ReactNode } from "react";
2
2
  import { ControlProps, FieldSnapshot, FormEngine, Path } from "@formancy/core";
3
3
  import { FormText, FormText as FormText$1, FormWordId, FormWordValues, FormWords, FormWordsByLocale, FormWordsByLocale as FormWordsByLocale$1 } from "@formancy/core/words";
4
- import { FieldType, RemoteOption, RemoteOptionsAnswer, RemoteOptionsAnswer as RemoteOptionsAnswer$1, RemoteOptionsPage, RichCommand } from "@formancy/spec";
4
+ import { FieldType, RemoteOption, RemoteOptionsAnswer, RemoteOptionsAnswer as RemoteOptionsAnswer$1, RemoteOptionsPage, RichCommand, StoredFile, StoredFile as StoredFile$1 } from "@formancy/spec";
5
5
  //#region src/context.d.ts
6
6
  export declare function FormancyProvider({ engine, words, children }: {
7
7
  engine: FormEngine;
@@ -109,6 +109,16 @@ export declare function useSubmit(): () => {
109
109
  errors: Record<string, string[]>;
110
110
  };
111
111
  //#endregion
112
+ //#region src/go-to-field.d.ts
113
+ /**
114
+ * Take the person to a question: to its page first, on a paged form, and to its control once
115
+ * that page is drawn — into a group's first option, since a fieldset takes no focus, and past a
116
+ * tab a layout hides it behind (0213). What the error summary's links and the review's Change do,
117
+ * one function for both and for a host's own list of questions; the Angular binding's
118
+ * `injectGoToField` is the same. A path no field has throws, as the engine does for one.
119
+ */
120
+ export declare function useGoToField(): (path: string) => void;
121
+ //#endregion
112
122
  //#region src/fields/internals.d.ts
113
123
  /**
114
124
  * The pieces every control shares: the shell it renders inside, the prop shapes, and the few helpers more than one of them needs.
@@ -155,6 +165,11 @@ interface FormancyFormProps {
155
165
  */
156
166
  layout?: string;
157
167
  submitLabel?: string;
168
+ /**
169
+ * Show the answers in words before sending, each with a way back to its question: the last
170
+ * step offers "Check your answers" in place of sending (0204). Off unless asked for.
171
+ */
172
+ review?: boolean;
158
173
  onSubmit?: (outcome: SubmitOutcome) => void;
159
174
  }
160
175
  //#endregion
@@ -363,25 +378,6 @@ export declare const ScannerProvider: import("react").Provider<Scanner | undefin
363
378
  export declare function useScanner(): Scanner | undefined;
364
379
  //#endregion
365
380
  //#region src/uploads.d.ts
366
- /**
367
- * Where a file goes, and what the submission remembers about it.
368
- *
369
- * This package has no opinion about the destination: the same field works against local
370
- * disk, S3 or a customer's own service, and none of them is a dependency of a renderer.
371
- *
372
- * **The bytes never pass through the submission.** What is stored is what the file is
373
- * and where it went, so a submission read back years later is small, readable on its
374
- * own, and says what was attached even if the object store has since been emptied.
375
- */
376
- interface StoredFile {
377
- /** Stable within the submission; how a row is keyed and removed. */
378
- id: string;
379
- name: string;
380
- size: number;
381
- contentType: string;
382
- /** Where the bytes are, in whatever the host's storage calls a location. */
383
- storageKey: string;
384
- }
385
381
  /**
386
382
  * What the field tells an uploader about the file it is sending.
387
383
  *
@@ -404,11 +400,14 @@ interface UploadOptions {
404
400
  /**
405
401
  * Uploads one file and reports what was stored.
406
402
  *
403
+ * This package has no opinion about the destination: the same field works against local
404
+ * disk, S3 or a customer's own service, and none of them is a dependency of a renderer.
405
+ *
407
406
  * **Rejecting is a real answer**: the field says so out loud rather than dropping the
408
407
  * file, because a submission somebody believes carries their evidence and does not is
409
408
  * the worst outcome available here.
410
409
  */
411
- type Uploader = (file: File, options: UploadOptions) => Promise<StoredFile>;
410
+ type Uploader = (file: File, options: UploadOptions) => Promise<StoredFile$1>;
412
411
  export declare const UploaderProvider: import("react").Provider<Uploader | undefined>;
413
412
  /**
414
413
  * The host's uploader, or undefined when there is none.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/context.tsx","../src/use-field.ts","../src/use-repeater.ts","../src/use-wizard.ts","../src/use-submit.ts","../src/fields/internals.tsx","../src/form.tsx","../src/error-summary.tsx","../src/rich-text.tsx","../src/options-source.ts","../src/scanning.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B;;;;;;;;;;;;UC9FpB;;EAEf;;EAEA;;;;;;;;;;;;;;;;;;;KAoBU,WAAW,SAAS,gBAAgB;qBAInC,iCAAe,SAAA;;;;;;;;wBASZ,cAAc;;;;;;;;;;;;;UCpCb;;EAEf;EACA;EACA;EACA;;EAEA;;;;;;;;;;UAWe;;;;;EAKf;;EAEA,QAAQ;;EAER,WAAW,cAAc;;;;;;;;;KAUf,YAAY,MAAM,MAAM,SAAS,kBAAkB,QAAQ;qBAI1D,kCAAgB,SAAA;;;;;;;;;wBAUb,eAAe;;;;;;;;;;;;;;;;;;;;;UC1Cd;;EAEf;;EAEA,WAAW;;;;;;;;;;;;;EAaX,MAAM,SAAS,aAAa;;EAE5B,WAAW,SAAS;EACpB;;UAGe;;WAEN,SAAS;;WAET;;WAEA,WAAW;WACX;;;;;;;;;;WAUA,YAAY,SAAS;;KAGpB,yBAAyB,OAAO,wBAAwB;qBAIvD,wCAAsB,SAAA;;;;;;;;;wBAUnB,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC9C3B;WACN;WACA,SAAS;aAAyB;aAAuB;;;UAGnD;;WAEN,YAAY;;WAEZ,SAAS,SAAS;;wBAGb,eAAe,WAAW,UAAU,oBAAoB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/context.tsx","../src/use-field.ts","../src/use-repeater.ts","../src/use-wizard.ts","../src/use-submit.ts","../src/go-to-field.ts","../src/fields/internals.tsx","../src/form.tsx","../src/error-summary.tsx","../src/rich-text.tsx","../src/options-source.ts","../src/scanning.ts","../src/uploads.ts","../src/rich-text-editor.ts","../src/resume-notice.tsx"],"mappings":";;;;;wBAsBgB,mBACd,QACA,OACA;EAEA,QAAQ;;;;;;;EAOR,QAAQ;EACR,WAAW;oBACZ,IAAA;wBAsBe,iBAAiB;;;;;;;;;wBAkBjB,eAAe;;;UCvEd,qBAAqB;EACpC,SAAS;EACT;;EAEA,cAAc;;EAEd;IAAc;IAAY;;;EAE1B;IAAc;;;;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