@usefillo/react 0.11.0 → 0.12.1

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.ts CHANGED
@@ -178,6 +178,12 @@ interface FilloFormBaseProps {
178
178
  renderSuccess?: () => ReactNode;
179
179
  /** Custom error screen — receives the failure (e.g. 404 vs network). */
180
180
  renderError?: (error: FilloError) => ReactNode;
181
+ /**
182
+ * Render a deliberately local, non-submitting preview. Transport, uploads,
183
+ * saved progress, and code-form sync are disabled. Use this only for UI
184
+ * previews; real embeds need either `formId` or `defineForm()` + `client`.
185
+ */
186
+ renderOnly?: boolean;
181
187
  /**
182
188
  * @internal Builder/test preview: let "Next" move between pages without
183
189
  * client-side validation. Submission and branding are still authoritative.
@@ -190,22 +196,42 @@ type HostedFormProps = FilloFormBaseProps & {
190
196
  formId: string;
191
197
  form?: undefined;
192
198
  client?: FilloClient;
199
+ renderOnly?: false;
200
+ skipValidation?: false;
193
201
  };
194
- type CodeBackedFormProps = FilloFormBaseProps & {
195
- /** Render a schema directly, or a code-defined form from defineForm(). */
202
+ type InlineTargetedFormProps = FilloFormBaseProps & {
203
+ /** Render a schema directly against an explicit published Fillo form. */
196
204
  form: FormSchema | CodeForm;
197
- /** Required for code-defined forms that should save responses in Fillo. */
205
+ formId: string;
206
+ client?: FilloClient;
207
+ renderOnly?: false;
208
+ skipValidation?: false;
209
+ };
210
+ type CodeBackedFormProps = FilloFormBaseProps & {
211
+ /** A defineForm() value can resolve its Fillo target through the keyed client. */
212
+ form: CodeForm;
198
213
  client: FilloClient;
214
+ formId?: undefined;
215
+ renderOnly?: false;
216
+ skipValidation?: false;
217
+ };
218
+ type RenderOnlyFormProps = FilloFormBaseProps & {
219
+ /** Explicit local preview: it can render, but cannot submit or upload. */
220
+ form: FormSchema | CodeForm;
221
+ client?: FilloClient;
199
222
  formId?: string;
223
+ renderOnly: true;
224
+ skipValidation?: boolean;
200
225
  };
201
- type PreviewFormProps = FilloFormBaseProps & {
202
- /** Builder/test preview: render locally and complete locally. */
226
+ type LegacyPreviewFormProps = FilloFormBaseProps & {
227
+ /** @internal Backward-compatible builder/test preview. */
203
228
  form: FormSchema | CodeForm;
204
229
  client?: FilloClient;
205
230
  formId?: string;
231
+ renderOnly?: boolean;
206
232
  skipValidation: true;
207
233
  };
208
- type FilloFormProps = HostedFormProps | CodeBackedFormProps | PreviewFormProps;
234
+ type FilloFormProps = HostedFormProps | InlineTargetedFormProps | CodeBackedFormProps | RenderOnlyFormProps | LegacyPreviewFormProps;
209
235
  declare function FilloForm(props: FilloFormProps): react.JSX.Element;
210
236
 
211
237
  /**
@@ -231,16 +257,28 @@ type ContentProps = {
231
257
  };
232
258
  /** Inert: rendering one throws; they exist to be read by the compiler. */
233
259
  type Inert<P> = (props: P) => never;
234
- interface FilloJsxFormProps extends Omit<FilloFormProps, "form" | "formId" | "client"> {
260
+ interface FilloJsxFormBaseProps extends Omit<FilloFormProps, "form" | "formId" | "client" | "renderOnly" | "skipValidation"> {
235
261
  /** Workspace handle — the form's identity across syncs. */
236
262
  id: string;
237
263
  title?: string;
238
264
  description?: string;
239
265
  settings?: FormSettings;
240
266
  theme?: FormTheme;
241
- client?: FilloClient;
242
267
  children?: ReactNode;
243
268
  }
269
+ type FilloJsxFormProps = FilloJsxFormBaseProps & ({
270
+ client: FilloClient;
271
+ renderOnly?: false;
272
+ skipValidation?: false;
273
+ } | {
274
+ client?: FilloClient;
275
+ renderOnly: true;
276
+ skipValidation?: boolean;
277
+ } | {
278
+ client?: FilloClient;
279
+ renderOnly?: boolean;
280
+ skipValidation: true;
281
+ });
244
282
  declare function JsxForm(props: FilloJsxFormProps): react.JSX.Element;
245
283
  declare function defineFormFromJsx(element: ReactElement<FilloJsxFormProps>): CodeForm;
246
284
  declare const Fillo: {
@@ -339,9 +377,7 @@ interface ControllerOptions {
339
377
  */
340
378
  declare function useFilloController(options: ControllerOptions): FilloApi;
341
379
 
342
- interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
343
- /** A schema, or a code-defined form from defineForm() — which also syncs. */
344
- form: FormSchema | CodeForm;
380
+ interface FilloProviderBaseProps extends Omit<ControllerOptions, "form" | "formId" | "client" | "skipValidation"> {
345
381
  /** Slot classes for FormField-rendered fields in your composed layout. */
346
382
  appearance?: FilloAppearance;
347
383
  /** Override any visitor-facing renderer string (for localized sites). */
@@ -359,8 +395,44 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
359
395
  * injects no layout (no badge or notices); the host owns all preview UI.
360
396
  */
361
397
  preview?: boolean;
398
+ /**
399
+ * Render a deliberately local preview. Submission, uploads, saved progress,
400
+ * and code-form sync are disabled.
401
+ */
402
+ renderOnly?: boolean;
403
+ /** @internal Backward-compatible builder/test preview. */
404
+ skipValidation?: boolean;
362
405
  children: ReactNode;
363
406
  }
407
+ type TargetedProviderProps = FilloProviderBaseProps & {
408
+ form: FormSchema | CodeForm;
409
+ formId: string;
410
+ client?: FilloClient;
411
+ renderOnly?: false;
412
+ skipValidation?: false;
413
+ };
414
+ type CodeBackedProviderProps = FilloProviderBaseProps & {
415
+ form: CodeForm;
416
+ client: FilloClient;
417
+ formId?: undefined;
418
+ renderOnly?: false;
419
+ skipValidation?: false;
420
+ };
421
+ type RenderOnlyProviderProps = FilloProviderBaseProps & {
422
+ form: FormSchema | CodeForm;
423
+ client?: FilloClient;
424
+ formId?: string;
425
+ renderOnly: true;
426
+ skipValidation?: boolean;
427
+ };
428
+ type LegacyPreviewProviderProps = FilloProviderBaseProps & {
429
+ form: FormSchema | CodeForm;
430
+ client?: FilloClient;
431
+ formId?: string;
432
+ renderOnly?: boolean;
433
+ skipValidation: true;
434
+ };
435
+ type FilloProviderProps = TargetedProviderProps | CodeBackedProviderProps | RenderOnlyProviderProps | LegacyPreviewProviderProps;
364
436
  /**
365
437
  * The headless escape hatch. Sets up the form engine (validation, conditional
366
438
  * logic, uploads, submit) and renders no resolved form layout — you compose it
@@ -381,7 +453,7 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
381
453
  * defineForm() form and a keyed client, the structure also syncs into your
382
454
  * workspace, exactly like <FilloForm>.
383
455
  */
384
- declare function FilloProvider({ children, form, formId, client, appearance, strings, onError, renderError, preview, ...options }: FilloProviderProps): react.JSX.Element | null;
456
+ declare function FilloProvider({ children, form, formId, client, appearance, strings, onError, renderError, preview, renderOnly, skipValidation, ...options }: FilloProviderProps): react.JSX.Element | null;
385
457
 
386
458
  /**
387
459
  * The full form engine — data, errors, pages, submit, status. Use inside a
@@ -430,6 +502,6 @@ declare function FormField({ id, components, customComponents, }: {
430
502
  * provider-aware browser-direct transfer (resumable where supported). Replace
431
503
  * it via `components` if needed; completed uploads are FileValue[] in the data.
432
504
  */
433
- declare function FileUploadField({ field, value, error, setValue, api, ids: providedIds }: FieldComponentProps): react.JSX.Element;
505
+ declare function FileUploadField({ field, value, error, setValue, api, ids: providedIds, }: FieldComponentProps): react.JSX.Element;
434
506
 
435
507
  export { BlockRenderer, type ControllerOptions, type CustomComponents, type FieldComponentProps, type FieldComponents, type FieldHandle, Fillo, type FilloApi, type FilloFieldIds, FileUploadField as FilloFileUpload, FilloForm, type FilloFormProps, type FilloJsxFormProps, FilloProvider, type FilloProviderProps, FormField, useField, useFillo, useFilloAppearance, useFilloController };