@factorialco/rjsf-f0 3.4.0 → 3.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/README.md +27 -0
- package/dist/rjsf-f0.cjs.js +18 -18
- package/dist/rjsf-f0.cjs.js.map +1 -1
- package/dist/rjsf-f0.es.js +1554 -1443
- package/dist/rjsf-f0.es.js.map +1 -1
- package/dist/src/button/action-button.d.ts +14 -0
- package/dist/src/button/button.test.d.ts +1 -0
- package/dist/src/button/index.d.ts +5 -0
- package/dist/src/button/types.d.ts +46 -0
- package/dist/src/button/variant-rule.d.ts +12 -0
- package/dist/src/button/variant.d.ts +11 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/multistep/index.d.ts +2 -2
- package/dist/src/multistep/steps-navigation.d.ts +1 -1
- package/dist/src/multistep/types.d.ts +3 -0
- package/dist/src/templates/button-templates.d.ts +19 -1
- package/dist/src/theme.d.ts +4 -1
- package/dist/src/utils/warn-once.d.ts +5 -0
- package/dist/src/widgets/cards.test.d.ts +1 -0
- package/dist/src/widgets/choice-widgets.d.ts +13 -3
- package/dist/src/widgets/display-option.d.ts +14 -0
- package/dist/src/widgets/display-rule.d.ts +23 -0
- package/dist/src/widgets/switch.test.d.ts +1 -0
- package/dist/styles.css +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,9 +58,12 @@ The host app must render f0's `F0Provider` above the form and import `@factorial
|
|
|
58
58
|
| `textarea` | `F0FormField` `textarea` |
|
|
59
59
|
| enum select, multi-select | `F0FormField` `select` |
|
|
60
60
|
| boolean checkbox, `checkboxes` | `F0Checkbox` |
|
|
61
|
+
| boolean with `display: "switch"` | f0's `Switch` (see below) |
|
|
62
|
+
| `checkboxes` with `display: "cards"` | `CardSelectableContainer` `multiple` (see below) |
|
|
61
63
|
| `radio` | `F0FormField` `cardSelect` (f0 has no radio control) |
|
|
62
64
|
| `file` / `data-url` | f0-styled dropzone + file chips (see below) |
|
|
63
65
|
| submit, add/move/copy/remove | `F0Button` |
|
|
66
|
+
| `button` action field | `F0Button` (see below) |
|
|
64
67
|
| `oauth` connect control | `F0Button` (see below) |
|
|
65
68
|
| `pairing` table | a table of `F0Select`, `F0TagStatus` (see below) |
|
|
66
69
|
| `launch-one` button | `F0Button` with the `Ai` icon (see below) |
|
|
@@ -195,10 +198,26 @@ The toolbar is RJSF's, so it is the schema that decides what a row can do:
|
|
|
195
198
|
|
|
196
199
|
`orderable` (default `true`) draws move up/down — turn it off when order carries no meaning, which is most scalar lists. `copyable` defaults to `false` already, `removable` and `addable` to `true`.
|
|
197
200
|
|
|
201
|
+
### Switches
|
|
202
|
+
|
|
203
|
+
`"ui:options": { "display": "switch" }` on a boolean draws f0's `Switch` (from `@factorialco/f0-react/dist/experimental`) instead of the `F0Checkbox`, with the label beside it the same way, a markdown label included. The value stays `true` / `false`; validation, errors and disabled/read-only work as for the checkbox. It is not `F0FormField`'s `switch` field: that one always hides the switch's own label and puts the field label above the control, where this theme keeps a boolean's label beside it.
|
|
204
|
+
|
|
205
|
+
It is an option rather than a `ui:widget` so an older theme or SDK keeps the checkbox instead of failing the form with `No widget "switch"`. Any other `display` value logs a warning and keeps the checkbox; `display` on anything other than a boolean drawn as a checkbox or a `checkboxes` list (see [cards](#cards-for-multiple-choice)) — a string, a boolean with `"ui:widget": "radio"` or `"ui:field"` — logs a warning and is ignored. The theme reads the option itself (`widgets/display-option.ts`), since it also renders standalone. Table cells are unaffected: a boolean cell stays a two-choice select.
|
|
206
|
+
|
|
207
|
+
### Cards for multiple choice
|
|
208
|
+
|
|
209
|
+
`"ui:options": { "display": "cards" }` on an array drawn with `"ui:widget": "checkboxes"` draws its options as f0's multi-select cards (`CardSelectableContainer` with `multiple` and `grouped`, one bordered block like the `radio` cards) instead of one `F0Checkbox` each. Each card shows the option's title and, when the items are a `oneOf` of `{ const, title, description }`, its description. The value is the array the checkboxes write, in the options' order whatever the order of the clicks; `uniqueItems`, `minItems` / `maxItems`, `required`, `default`, errors, disabled/read-only and `ui:enumDisabled` work as for the checkboxes.
|
|
210
|
+
|
|
211
|
+
f0's cards take plain strings, so a markdown title is shown as its plain text (`Sync **daily**` reads "Sync daily") and a description as written; the checkboxes render a markdown label as markup. The same rule as the switch applies (`widgets/display-option.ts`): any other `display` on a `checkboxes` list logs a warning and keeps the checkboxes, and `"cards"` on anything else (a multi-select dropdown, a `radio`, a boolean) logs a warning and is ignored. The Forms SDK's own theme (the hosted `forms.js`) does not draw cards: it keeps the checkboxes.
|
|
212
|
+
|
|
198
213
|
### OAuth connect fields
|
|
199
214
|
|
|
200
215
|
The Forms SDK's `"ui:widget": "oauth"` field opens the provider in a popup and reacts when the flow finishes; the widget logic ships in `@factorialco/fcode-react-forms`. This theme only contributes the control it draws, as `Theme.oauth.ConnectControl`: an `F0Button` (`default` while idle or waiting, `outline` with a check icon once connected) plus the flow's error message underneath. `FcodeJsonSchemaForm` finds it through `rjsfTheme.oauth`, the same way it finds `rjsfTheme.multistep`.
|
|
201
216
|
|
|
217
|
+
### Steps
|
|
218
|
+
|
|
219
|
+
The Forms SDK's `ui:steps` splits a form into steps; the step engine ships in `@factorialco/fcode-react-forms`, and this theme draws its navigation as `Theme.multistep.StepsNavigation` (plus the Back button and the leave confirmation), which `FcodeJsonSchemaForm` finds through `rjsfTheme.multistep`. A wizard (`navigation: "linear"`, the default) is a step list like `F0WizardForm`'s, numbered badges that turn into a check once a step is done, beside the form (`sidebar`) or in a row above it (`tabs`). A settings form with `navigation: "free"` is not a wizard: in the `tabs` layout its steps are f0's own `Tabs`, as f0 settings pages draw theirs, and a step with errors gets a critical dot after its label (f0's tabs take text only); in the `sidebar` layout it keeps the step list, every step reachable and none ever checked. f0's `Tabs` keeps its own copy of the active tab and restores it when the active tab changes from outside, as when the SDK opens the first step with errors, so the theme remounts it on every change.
|
|
220
|
+
|
|
202
221
|
### Pairing tables
|
|
203
222
|
|
|
204
223
|
The Forms SDK's `"ui:field": "pairing"` turns an object whose properties pair Factorial records with another system's (accounts, tax codes, wage types…) into one reviewable table. The rows, their suggestions, the in-use filter and the submitted values are all handled in `@factorialco/fcode-react-forms`. This theme contributes only the drawing, as `Theme.pairing.Table`, which `FcodeJsonSchemaForm` finds through `rjsfTheme.pairing`. The table has:
|
|
@@ -228,6 +247,14 @@ The select-all checkbox is handed to the editable table as that column's `label`
|
|
|
228
247
|
|
|
229
248
|
Like the pairing table, it re-renders every row on each edit, so it suits tens of rows, not thousands.
|
|
230
249
|
|
|
250
|
+
### Action buttons
|
|
251
|
+
|
|
252
|
+
The Forms SDK's `"ui:field": "button"` puts an extra way to submit the form beside the submit button — "Check connection" next to "Save". A click sets the boolean property to `true` and submits the form; that, and the validation, are handled in `@factorialco/fcode-react-forms`. This theme contributes only the drawing, as `Theme.button.Control`, which `FcodeJsonSchemaForm` finds through `rjsfTheme.button`: an `F0Button` in the variant the schema asked for with `ui:options.variant` (`outline` when absent, the look f0 forms give a secondary action), at f0's default `md` size, with the description under it. It is a `type="button"` and also prevents the default, so it never submits the form on its own.
|
|
253
|
+
|
|
254
|
+
The submit button reads `ui:submitButtonOptions.variant` itself, since this theme also renders standalone: `default` (primary) when absent, or `outline`, `neutral`, `critical`, `ghost`. An unknown value logs a warning and keeps `default`. The key is typed on RJSF's `UISchemaSubmitButtonOptions` by this package, and RJSF's own submit button ignores it.
|
|
255
|
+
|
|
256
|
+
A button can also stay disabled until a confirmation checkbox is ticked: `ui:submitButtonOptions.enabledWhen` (or `ui:options.enabledWhen` on an action button) names a root boolean property, and `disabledReason` explains why. The rule is resolved by `@factorialco/fcode-react-forms` against the live form data — this theme has no access to it — and reaches the theme already resolved: the submit gets `props.disabled: true` (RJSF's own way to disable it) plus `ui:submitButtonOptions.disabledReason`, the action button gets `disabled` plus `disabledReason`. Either way the reason becomes `F0Button`'s own `tooltip`, only while the button is disabled; f0 opens it on pointer hover even on a disabled button, after its usual one-second delay. The button stays natively `disabled`, so browsers do not submit through it on Enter. Rendered standalone, the theme draws a `disabledReason` whenever `props.disabled` is set and ignores `enabledWhen`. Both keys are typed on `UISchemaSubmitButtonOptions` by this package and never reach the DOM.
|
|
257
|
+
|
|
231
258
|
### Not yet f0
|
|
232
259
|
|
|
233
260
|
- **`range`** renders as a number input rather than `F0Slider`.
|