@usefillo/react 0.9.0 → 0.11.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 +25 -18
- package/dist/index.d.ts +40 -2
- package/dist/index.js +1063 -490
- package/dist/styles.css +249 -30
- package/dist/styles.unlayered.css +249 -30
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://fillo.so">
|
|
3
|
+
<img src="https://fillo.so/brand/readme-banner.png" alt="Fillo — forms inside your product, with your UI." />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://fillo.so/docs">Docs</a> ·
|
|
9
|
+
<a href="https://fillo.so/guides">Guides</a> ·
|
|
10
|
+
<a href="https://fillo.so/examples">Examples</a> ·
|
|
11
|
+
<a href="https://fillo.so/changelog">Changelog</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.npmjs.com/package/@usefillo/react"><img src="https://img.shields.io/npm/v/@usefillo/react" alt="npm version" /></a>
|
|
16
|
+
<img src="https://img.shields.io/npm/l/@usefillo/react" alt="MIT license" />
|
|
17
|
+
</p>
|
|
2
18
|
|
|
3
19
|
React components and hooks for embedding [Fillo](https://fillo.so) forms **natively inside your product** — rendered in your own DOM, with your styles, on your route. No iframe.
|
|
4
20
|
|
|
5
|
-
### 📚 Full documentation → **[fillo.so/docs](https://fillo.so/docs)**
|
|
6
|
-
|
|
7
21
|
```sh
|
|
8
22
|
npm i @usefillo/react
|
|
9
23
|
```
|
|
@@ -36,10 +50,10 @@ export function ContactForm() {
|
|
|
36
50
|
```
|
|
37
51
|
|
|
38
52
|
The first time this runs, the form appears in your Fillo workspace as a draft —
|
|
39
|
-
publish it there and responses,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
publish it there and responses, exports, webhooks, and integrations all work.
|
|
54
|
+
Prefer config over JSX? `defineForm({ id, pages })` is first-class — JSX
|
|
55
|
+
compiles to it exactly. Authoring guide:
|
|
56
|
+
[fillo.so/docs/authoring](https://fillo.so/docs/authoring).
|
|
43
57
|
|
|
44
58
|
## Or embed a form built in the dashboard
|
|
45
59
|
|
|
@@ -67,12 +81,9 @@ import { FilloForm } from "@usefillo/react";
|
|
|
67
81
|
>
|
|
68
82
|
```
|
|
69
83
|
|
|
70
|
-
Every rendered part carries a named slot
|
|
71
|
-
(`data-invalid`, `data-selected`,
|
|
72
|
-
|
|
73
|
-
reset-heavy sites import `@usefillo/react/styles.unlayered.css` instead.
|
|
74
|
-
Localize the shared form chrome (navigation, submit states, errors, and resume
|
|
75
|
-
notices) with the `strings` prop. Styling contract:
|
|
84
|
+
Every rendered part carries a named slot and state attributes
|
|
85
|
+
(`data-invalid`, `data-selected`, …), and the default stylesheet is
|
|
86
|
+
cascade-layered so your utilities always win. Styling contract:
|
|
76
87
|
[fillo.so/docs/styling](https://fillo.so/docs/styling).
|
|
77
88
|
|
|
78
89
|
## Go fully headless
|
|
@@ -83,11 +94,7 @@ Every part is replaceable — and every embed method is free:
|
|
|
83
94
|
- `<FilloProvider>` + `<FormField>` / `useField()` — your layout, Fillo's engine
|
|
84
95
|
- `useFilloController()` — the bare engine for total control
|
|
85
96
|
|
|
86
|
-
|
|
87
|
-
submissions retry safely, and failed submits show a visible, answer-preserving
|
|
88
|
-
error. This package re-exports the embedding surface from
|
|
89
|
-
[`@usefillo/core`](https://www.npmjs.com/package/@usefillo/core) so a single
|
|
90
|
-
import is usually enough.
|
|
97
|
+
Headless guide: [fillo.so/docs/custom-ui](https://fillo.so/docs/custom-ui).
|
|
91
98
|
|
|
92
99
|
## Links
|
|
93
100
|
|
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,10 +143,31 @@ 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). */
|
|
149
155
|
onError?: (error: FilloError) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Show the developer chrome on a surface Fillo doesn't detect as local
|
|
158
|
+
* development — a tunnel, a staging deploy, a production build you're
|
|
159
|
+
* smoke-testing. COSMETIC ONLY: it renders the dev notices, developer-grade
|
|
160
|
+
* submit failures, and a visible "Preview" badge, and it never changes
|
|
161
|
+
* where submissions go or whether they are accepted (test submissions
|
|
162
|
+
* authenticate with a credential, never a prop).
|
|
163
|
+
*/
|
|
164
|
+
preview?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Set false to hide the built-in dev notices (draft/staged/sync/no-client)
|
|
167
|
+
* when your page provides its own context. The explicit Preview badge and
|
|
168
|
+
* the production fail-closed states are unaffected.
|
|
169
|
+
*/
|
|
170
|
+
devNotices?: boolean;
|
|
150
171
|
/**
|
|
151
172
|
* Render the form's own title/description header (default true). Set false
|
|
152
173
|
* when the embedding page already provides a heading, to avoid a second
|
|
@@ -248,6 +269,7 @@ declare const Fillo: {
|
|
|
248
269
|
readonly Date: Inert<WithVisible<DateField>>;
|
|
249
270
|
readonly FileUpload: Inert<WithVisible<FileUploadField$1>>;
|
|
250
271
|
readonly Hidden: Inert<WithVisible<HiddenField>>;
|
|
272
|
+
readonly Calculated: Inert<WithVisible<CalculatedField>>;
|
|
251
273
|
readonly Custom: Inert<WithVisible<CustomField>>;
|
|
252
274
|
readonly Heading: Inert<ContentProps>;
|
|
253
275
|
readonly Paragraph: Inert<ContentProps>;
|
|
@@ -287,6 +309,13 @@ interface ControllerOptions {
|
|
|
287
309
|
surface?: "default" | "headless";
|
|
288
310
|
/** Resolve/verify the canonical submission target immediately before submit. */
|
|
289
311
|
resolveFormId?: () => Promise<string>;
|
|
312
|
+
/**
|
|
313
|
+
* Surface the real resolveFormId failure (message + machine code) in
|
|
314
|
+
* `submitError` instead of the respondent-safe fallback. The built-in
|
|
315
|
+
* renderers set it from their dev-chrome gate (preview prop / dev
|
|
316
|
+
* environment) so integration details never reach production visitors.
|
|
317
|
+
*/
|
|
318
|
+
verboseResolutionErrors?: boolean;
|
|
290
319
|
/**
|
|
291
320
|
* Host-app account context (identify()): who is filling this form, by your
|
|
292
321
|
* own user id. Recorded with the response as an unverified claim so the
|
|
@@ -321,6 +350,15 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
|
|
|
321
350
|
onError?: (error: FilloError) => void;
|
|
322
351
|
/** Custom unavailable state; receives the full actionable integration error. */
|
|
323
352
|
renderError?: (error: FilloError) => ReactNode;
|
|
353
|
+
/**
|
|
354
|
+
* Apply the developer-chrome behavior on a surface Fillo doesn't detect as
|
|
355
|
+
* local development (a tunnel, staging, a production smoke test): the code
|
|
356
|
+
* form renders and gates like development and failed submits carry the real
|
|
357
|
+
* error + code. COSMETIC ONLY — it never changes where submissions go or
|
|
358
|
+
* whether they are accepted. Headless stays headless: the provider still
|
|
359
|
+
* injects no layout (no badge or notices); the host owns all preview UI.
|
|
360
|
+
*/
|
|
361
|
+
preview?: boolean;
|
|
324
362
|
children: ReactNode;
|
|
325
363
|
}
|
|
326
364
|
/**
|
|
@@ -343,7 +381,7 @@ interface FilloProviderProps extends Omit<ControllerOptions, "form"> {
|
|
|
343
381
|
* defineForm() form and a keyed client, the structure also syncs into your
|
|
344
382
|
* workspace, exactly like <FilloForm>.
|
|
345
383
|
*/
|
|
346
|
-
declare function FilloProvider({ children, form, formId, client, appearance, strings, onError, renderError, ...options }: FilloProviderProps): react.JSX.Element | null;
|
|
384
|
+
declare function FilloProvider({ children, form, formId, client, appearance, strings, onError, renderError, preview, ...options }: FilloProviderProps): react.JSX.Element | null;
|
|
347
385
|
|
|
348
386
|
/**
|
|
349
387
|
* The full form engine — data, errors, pages, submit, status. Use inside a
|