@usefillo/react 0.7.0 → 0.8.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 +2 -1
- package/dist/index.d.ts +36 -14
- package/dist/index.js +630 -229
- package/dist/styles.css +4 -0
- package/dist/styles.unlayered.css +4 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -71,7 +71,8 @@ Every rendered part carries a named slot (`data-fillo`) and state attributes
|
|
|
71
71
|
(`data-invalid`, `data-selected`, `data-checked`, …), and the default
|
|
72
72
|
stylesheet is cascade-layered so your utilities always win. On Tailwind v3 or
|
|
73
73
|
reset-heavy sites import `@usefillo/react/styles.unlayered.css` instead.
|
|
74
|
-
Localize
|
|
74
|
+
Localize the shared form chrome (navigation, submit states, errors, and resume
|
|
75
|
+
notices) with the `strings` prop. Styling contract:
|
|
75
76
|
[fillo.so/docs/styling](https://fillo.so/docs/styling).
|
|
76
77
|
|
|
77
78
|
## Go fully headless
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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,
|
|
5
|
-
export { CodeForm, Field, FieldValue, FileValue, FilloAppearance, FilloClient, FilloError, FilloJsxError, FilloSlot, FilloStrings, FormSchema, FormStatus, FormTheme, ProvisionWorkspaceResult, PublishedForm, ResponseData, SlotState, createClient, defineForm, provisionWorkspace, when } from '@usefillo/core';
|
|
4
|
+
import { FormSchema, FilloClient, ResponseData, FieldValue, FormPage, Block, FormStatus, FieldKind, Field, CustomField, FormTheme, FilloAppearance, FilloRendererStrings, FilloRespondent, FilloError, CodeForm, FormSettings, Condition, TextField, PhoneField, NumberField, ChoiceField, SelectOption, CheckboxField, RatingField, LinearScaleField, RankingField, SignatureField, DateField, FileUploadField as FileUploadField$1, HiddenField } from '@usefillo/core';
|
|
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
|
/**
|
|
8
8
|
* Everything a custom renderer needs. Returned by useFillo() and provided
|
|
@@ -48,6 +48,23 @@ interface FilloApi {
|
|
|
48
48
|
* previous answers — submitting updates that response in place.
|
|
49
49
|
*/
|
|
50
50
|
editingPrevious: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* True when the last submit was kept as an already-recorded response (a
|
|
53
|
+
* verified identify() repeat on a keep-mode form) rather than a fresh one.
|
|
54
|
+
* Renderers show an "already answered" note instead of implying a new save.
|
|
55
|
+
*/
|
|
56
|
+
duplicateSubmission: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* True when the last submit updated the person's existing response in place
|
|
59
|
+
* (responseLimit onRepeat "update") rather than creating a new one.
|
|
60
|
+
*/
|
|
61
|
+
updatedSubmission: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* True when a resume link (#fillo-draft=…) was expired, spent, or foreign, so
|
|
64
|
+
* no progress could be restored. Renderers explain the blank form instead of
|
|
65
|
+
* showing it with no context.
|
|
66
|
+
*/
|
|
67
|
+
resumeLinkFailed: boolean;
|
|
51
68
|
/**
|
|
52
69
|
* Persist unsaved draft progress right now (settings.saveProgress forms).
|
|
53
70
|
* The built-in renderers call it on pagehide/visibility-hidden; custom
|
|
@@ -105,7 +122,7 @@ interface FilloFormBaseProps {
|
|
|
105
122
|
*/
|
|
106
123
|
appearance?: FilloAppearance;
|
|
107
124
|
/** Override any visitor-facing renderer string (for localized sites). */
|
|
108
|
-
strings?: Partial<
|
|
125
|
+
strings?: Partial<FilloRendererStrings>;
|
|
109
126
|
/** Swap any built-in field kind for your own component. */
|
|
110
127
|
components?: FieldComponents;
|
|
111
128
|
/** Renderers for your own `custom` field kinds, keyed by `component`. */
|
|
@@ -167,8 +184,8 @@ declare function FilloForm(props: FilloFormProps): react.JSX.Element;
|
|
|
167
184
|
* The authoring namespace: `<Fillo.Form id="contact"><Fillo.Email id="email"
|
|
168
185
|
* label="Work email"/></Fillo.Form>`. Field elements are inert descriptors
|
|
169
186
|
* compiled (never rendered) into the exact CodeForm defineForm() emits, then
|
|
170
|
-
* fed to the existing framed <FilloForm> — same
|
|
171
|
-
* same badge, same responses. Define forms in a client module ("use client");
|
|
187
|
+
* fed to the existing framed <FilloForm> — same policy-aware resolution and
|
|
188
|
+
* staging, same badge, same responses. Define forms in a client module ("use client");
|
|
172
189
|
* pass the compiled VALUE across server/client boundaries, never the JSX.
|
|
173
190
|
*/
|
|
174
191
|
type WithVisible<T> = Omit<T, "kind" | "visibleIf"> & {
|
|
@@ -261,7 +278,7 @@ interface ControllerOptions {
|
|
|
261
278
|
* renderers pass "default" explicitly.
|
|
262
279
|
*/
|
|
263
280
|
surface?: "default" | "headless";
|
|
264
|
-
/** Resolve the submission target
|
|
281
|
+
/** Resolve/verify the canonical submission target immediately before submit. */
|
|
265
282
|
resolveFormId?: () => Promise<string>;
|
|
266
283
|
/**
|
|
267
284
|
* Host-app account context (identify()): who is filling this form, by your
|
|
@@ -286,14 +303,19 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
|
|
|
286
303
|
/** Slot classes for FormField-rendered fields in your composed layout. */
|
|
287
304
|
appearance?: FilloAppearance;
|
|
288
305
|
/** Override any visitor-facing renderer string (for localized sites). */
|
|
289
|
-
strings?: Partial<
|
|
306
|
+
strings?: Partial<FilloRendererStrings>;
|
|
307
|
+
/** Observe code-form sync/configuration failures. */
|
|
308
|
+
onError?: (error: FilloError) => void;
|
|
309
|
+
/** Custom unavailable state; receives the full actionable integration error. */
|
|
310
|
+
renderError?: (error: FilloError) => ReactNode;
|
|
290
311
|
children: ReactNode;
|
|
291
312
|
}
|
|
292
313
|
/**
|
|
293
314
|
* The headless escape hatch. Sets up the form engine (validation, conditional
|
|
294
|
-
* logic, uploads, submit) and renders
|
|
295
|
-
*
|
|
296
|
-
*
|
|
315
|
+
* logic, uploads, submit) and renders no resolved form layout — you compose it
|
|
316
|
+
* with <FormField>, useField() and useFillo(). In production, a code form
|
|
317
|
+
* withholds children (returns null) until its canonical schema is safe; pass
|
|
318
|
+
* renderError to own unavailable/not-published UI without adding SDK layout.
|
|
297
319
|
*
|
|
298
320
|
* <FilloProvider form={feedback} client={client}>
|
|
299
321
|
* <YourErrorContext />
|
|
@@ -308,7 +330,7 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
|
|
|
308
330
|
* defineForm() form and a keyed client, the structure also syncs into your
|
|
309
331
|
* workspace, exactly like <FilloForm>.
|
|
310
332
|
*/
|
|
311
|
-
declare function FilloProvider({ children, form, formId, client, appearance, strings, ...options }: FilloProviderProps): react.JSX.Element;
|
|
333
|
+
declare function FilloProvider({ children, form, formId, client, appearance, strings, onError, renderError, ...options }: FilloProviderProps): react.JSX.Element | null;
|
|
312
334
|
|
|
313
335
|
/**
|
|
314
336
|
* The full form engine — data, errors, pages, submit, status. Use inside a
|
|
@@ -353,9 +375,9 @@ declare function FormField({ id, components, customComponents, }: {
|
|
|
353
375
|
}): react.JSX.Element | null;
|
|
354
376
|
|
|
355
377
|
/**
|
|
356
|
-
* Default file upload field: drag & drop,
|
|
357
|
-
*
|
|
358
|
-
*
|
|
378
|
+
* Default file upload field: drag & drop, multiple files, live progress, and
|
|
379
|
+
* provider-aware browser-direct transfer (resumable where supported). Replace
|
|
380
|
+
* it via `components` if needed; completed uploads are FileValue[] in the data.
|
|
359
381
|
*/
|
|
360
382
|
declare function FileUploadField({ field, value, error, setValue, api, ids: providedIds }: FieldComponentProps): react.JSX.Element;
|
|
361
383
|
|