@usefillo/react 0.10.0 → 0.12.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.ts +93 -14
- package/dist/index.js +798 -339
- package/dist/styles.css +257 -57
- package/dist/styles.unlayered.css +257 -57
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, ReactElement } from 'react';
|
|
3
3
|
import * as _usefillo_core from '@usefillo/core';
|
|
4
|
-
import { FormSchema, FilloClient, ResponseData, FieldValue, FormPage, Block, FormStatus, FieldKind, Field, CustomField, FormTheme, FilloAppearance, FilloRendererStrings, FilloRespondent, ChallengeConfig, FilloError, CodeForm, FormSettings, Condition, TextField, PhoneField, NumberField, ChoiceField, SelectOption, CheckboxField, RatingField, LinearScaleField, RankingField, SignatureField, DateField, FileUploadField as FileUploadField$1, HiddenField } from '@usefillo/core';
|
|
4
|
+
import { FormSchema, FilloClient, ResponseData, FieldValue, FormPage, Block, FormStatus, FieldKind, Field, CustomField, FormTheme, FilloAppearance, FilloRendererStrings, FilloRespondent, ChallengeConfig, FilloError, CodeForm, FormSettings, Condition, TextField, PhoneField, NumberField, ChoiceField, SelectOption, CheckboxField, RatingField, LinearScaleField, RankingField, SignatureField, DateField, FileUploadField as FileUploadField$1, HiddenField, CalculatedField } from '@usefillo/core';
|
|
5
5
|
export { CodeForm, Field, FieldValue, FileValue, FilloAppearance, FilloClient, FilloError, FilloJsxError, FilloRendererStrings, FilloSlot, FilloStrings, FormSchema, FormStatus, FormTheme, ProvisionWorkspaceResult, PublishedForm, ResponseData, SlotState, createClient, defineForm, provisionWorkspace, when } from '@usefillo/core';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -143,6 +143,12 @@ interface FilloFormBaseProps {
|
|
|
143
143
|
* hosted page does this). The SECRET key stays server-side — never passed here.
|
|
144
144
|
*/
|
|
145
145
|
challenge?: ChallengeConfig;
|
|
146
|
+
/**
|
|
147
|
+
* Server-owned per-file ceiling when an inline schema skips the normal form
|
|
148
|
+
* fetch. Fillo's hosted page uses this to preserve its server-rendered fast
|
|
149
|
+
* path; fetched and code-defined forms receive the value automatically.
|
|
150
|
+
*/
|
|
151
|
+
uploadFileSizeLimitMb?: number;
|
|
146
152
|
onChange?: (data: ResponseData) => void;
|
|
147
153
|
onSubmitted?: (responseId: string | undefined, data: ResponseData) => void;
|
|
148
154
|
/** Observe load and code-form sync failures (otherwise only logged). */
|
|
@@ -172,6 +178,12 @@ interface FilloFormBaseProps {
|
|
|
172
178
|
renderSuccess?: () => ReactNode;
|
|
173
179
|
/** Custom error screen — receives the failure (e.g. 404 vs network). */
|
|
174
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;
|
|
175
187
|
/**
|
|
176
188
|
* @internal Builder/test preview: let "Next" move between pages without
|
|
177
189
|
* client-side validation. Submission and branding are still authoritative.
|
|
@@ -184,22 +196,42 @@ type HostedFormProps = FilloFormBaseProps & {
|
|
|
184
196
|
formId: string;
|
|
185
197
|
form?: undefined;
|
|
186
198
|
client?: FilloClient;
|
|
199
|
+
renderOnly?: false;
|
|
200
|
+
skipValidation?: false;
|
|
187
201
|
};
|
|
188
|
-
type
|
|
189
|
-
/** Render a schema directly
|
|
202
|
+
type InlineTargetedFormProps = FilloFormBaseProps & {
|
|
203
|
+
/** Render a schema directly against an explicit published Fillo form. */
|
|
190
204
|
form: FormSchema | CodeForm;
|
|
191
|
-
|
|
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;
|
|
192
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;
|
|
193
222
|
formId?: string;
|
|
223
|
+
renderOnly: true;
|
|
224
|
+
skipValidation?: boolean;
|
|
194
225
|
};
|
|
195
|
-
type
|
|
196
|
-
/**
|
|
226
|
+
type LegacyPreviewFormProps = FilloFormBaseProps & {
|
|
227
|
+
/** @internal Backward-compatible builder/test preview. */
|
|
197
228
|
form: FormSchema | CodeForm;
|
|
198
229
|
client?: FilloClient;
|
|
199
230
|
formId?: string;
|
|
231
|
+
renderOnly?: boolean;
|
|
200
232
|
skipValidation: true;
|
|
201
233
|
};
|
|
202
|
-
type FilloFormProps = HostedFormProps | CodeBackedFormProps |
|
|
234
|
+
type FilloFormProps = HostedFormProps | InlineTargetedFormProps | CodeBackedFormProps | RenderOnlyFormProps | LegacyPreviewFormProps;
|
|
203
235
|
declare function FilloForm(props: FilloFormProps): react.JSX.Element;
|
|
204
236
|
|
|
205
237
|
/**
|
|
@@ -225,16 +257,28 @@ type ContentProps = {
|
|
|
225
257
|
};
|
|
226
258
|
/** Inert: rendering one throws; they exist to be read by the compiler. */
|
|
227
259
|
type Inert<P> = (props: P) => never;
|
|
228
|
-
interface
|
|
260
|
+
interface FilloJsxFormBaseProps extends Omit<FilloFormProps, "form" | "formId" | "client" | "renderOnly" | "skipValidation"> {
|
|
229
261
|
/** Workspace handle — the form's identity across syncs. */
|
|
230
262
|
id: string;
|
|
231
263
|
title?: string;
|
|
232
264
|
description?: string;
|
|
233
265
|
settings?: FormSettings;
|
|
234
266
|
theme?: FormTheme;
|
|
235
|
-
client?: FilloClient;
|
|
236
267
|
children?: ReactNode;
|
|
237
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
|
+
});
|
|
238
282
|
declare function JsxForm(props: FilloJsxFormProps): react.JSX.Element;
|
|
239
283
|
declare function defineFormFromJsx(element: ReactElement<FilloJsxFormProps>): CodeForm;
|
|
240
284
|
declare const Fillo: {
|
|
@@ -263,6 +307,7 @@ declare const Fillo: {
|
|
|
263
307
|
readonly Date: Inert<WithVisible<DateField>>;
|
|
264
308
|
readonly FileUpload: Inert<WithVisible<FileUploadField$1>>;
|
|
265
309
|
readonly Hidden: Inert<WithVisible<HiddenField>>;
|
|
310
|
+
readonly Calculated: Inert<WithVisible<CalculatedField>>;
|
|
266
311
|
readonly Custom: Inert<WithVisible<CustomField>>;
|
|
267
312
|
readonly Heading: Inert<ContentProps>;
|
|
268
313
|
readonly Paragraph: Inert<ContentProps>;
|
|
@@ -332,9 +377,7 @@ interface ControllerOptions {
|
|
|
332
377
|
*/
|
|
333
378
|
declare function useFilloController(options: ControllerOptions): FilloApi;
|
|
334
379
|
|
|
335
|
-
interface
|
|
336
|
-
/** A schema, or a code-defined form from defineForm() — which also syncs. */
|
|
337
|
-
form: FormSchema | CodeForm;
|
|
380
|
+
interface FilloProviderBaseProps extends Omit<ControllerOptions, "form" | "formId" | "client" | "skipValidation"> {
|
|
338
381
|
/** Slot classes for FormField-rendered fields in your composed layout. */
|
|
339
382
|
appearance?: FilloAppearance;
|
|
340
383
|
/** Override any visitor-facing renderer string (for localized sites). */
|
|
@@ -352,8 +395,44 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
|
|
|
352
395
|
* injects no layout (no badge or notices); the host owns all preview UI.
|
|
353
396
|
*/
|
|
354
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;
|
|
355
405
|
children: ReactNode;
|
|
356
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;
|
|
357
436
|
/**
|
|
358
437
|
* The headless escape hatch. Sets up the form engine (validation, conditional
|
|
359
438
|
* logic, uploads, submit) and renders no resolved form layout — you compose it
|
|
@@ -374,7 +453,7 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
|
|
|
374
453
|
* defineForm() form and a keyed client, the structure also syncs into your
|
|
375
454
|
* workspace, exactly like <FilloForm>.
|
|
376
455
|
*/
|
|
377
|
-
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;
|
|
378
457
|
|
|
379
458
|
/**
|
|
380
459
|
* The full form engine — data, errors, pages, submit, status. Use inside a
|
|
@@ -423,6 +502,6 @@ declare function FormField({ id, components, customComponents, }: {
|
|
|
423
502
|
* provider-aware browser-direct transfer (resumable where supported). Replace
|
|
424
503
|
* it via `components` if needed; completed uploads are FileValue[] in the data.
|
|
425
504
|
*/
|
|
426
|
-
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;
|
|
427
506
|
|
|
428
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 };
|