@factorialco/rjsf-f0 2.2.0 → 2.3.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 +6 -1
- package/dist/rjsf-f0.cjs.js +21 -21
- package/dist/rjsf-f0.cjs.js.map +1 -1
- package/dist/rjsf-f0.es.js +1114 -1088
- package/dist/rjsf-f0.es.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/oauth/connect-control.d.ts +9 -0
- package/dist/src/oauth/index.d.ts +4 -0
- package/dist/src/oauth/oauth.test.d.ts +1 -0
- package/dist/src/oauth/types.d.ts +17 -0
- package/dist/src/templates/misc-templates.d.ts +6 -4
- package/dist/src/theme.d.ts +4 -1
- package/dist/src/widgets/f0-field.d.ts +7 -5
- package/dist/styles.css +32 -2
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export { default as Form, generateForm } from './form';
|
|
|
2
2
|
export { Templates, Theme, Widgets, generateTheme } from './theme';
|
|
3
3
|
export type { F0RjsfTheme } from './theme';
|
|
4
4
|
export { Multistep } from './multistep';
|
|
5
|
+
export { Oauth } from './oauth';
|
|
6
|
+
export type { OauthConnectControlProps, OauthConnectStatus } from './oauth';
|
|
5
7
|
export { markdownComponents } from './markdown/markdown-components';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from '../../node_modules/@types/react';
|
|
2
|
+
import { OauthConnectControlProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The connect button of an `oauth` field. The SDK owns the flow (popup,
|
|
5
|
+
* completion, form reaction); this only draws the control for each status.
|
|
6
|
+
* F0Button renders a `<button>` with no `type`, so the click must prevent the
|
|
7
|
+
* default or it would submit the form.
|
|
8
|
+
*/
|
|
9
|
+
export declare const OauthConnectControl: ({ id, status, label, disabled, errorMessage, onClick, }: OauthConnectControlProps) => React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from '../../node_modules/@types/react';
|
|
2
|
+
/**
|
|
3
|
+
* Structural copies of the OAuth connect contract in
|
|
4
|
+
* `@factorialco/fcode-react-forms` (`FcodeJsonSchemaForm`'s `rjsfTheme.oauth`).
|
|
5
|
+
* This package does not depend on that one, so the types are duplicated here;
|
|
6
|
+
* TypeScript's structural typing keeps them interchangeable.
|
|
7
|
+
*/
|
|
8
|
+
export type OauthConnectStatus = 'idle' | 'pending' | 'connected';
|
|
9
|
+
export interface OauthConnectControlProps {
|
|
10
|
+
id: string;
|
|
11
|
+
status: OauthConnectStatus;
|
|
12
|
+
label: string;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
errorMessage?: string;
|
|
15
|
+
/** Must be called synchronously from the click, or popup blockers step in. */
|
|
16
|
+
onClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
17
|
+
}
|
|
@@ -5,11 +5,13 @@ export declare function TitleFieldTemplate({ id, title, uiSchema, optionalDataCo
|
|
|
5
5
|
/** Section (object/array level) description. */
|
|
6
6
|
export declare function DescriptionFieldTemplate({ id, description, }: DescriptionFieldProps): React.JSX.Element | null;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Every error message RJSF has for a field, and the only place they render.
|
|
9
9
|
*
|
|
10
|
-
* f0
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* f0 form fields are told they are in an error state but not what to say
|
|
11
|
+
* (`f0-field.tsx`), because half of what this theme renders is not an f0 form
|
|
12
|
+
* field at all — checkboxes, file inputs, the SDK's own fields, and the object
|
|
13
|
+
* and array levels a global form error lands on — and each of those swallowed
|
|
14
|
+
* its message when the control was trusted to show it.
|
|
13
15
|
*/
|
|
14
16
|
export declare function FieldErrorTemplate({ errors, fieldPathId, }: FieldErrorProps): React.JSX.Element | null;
|
|
15
17
|
/** Renders a `ui:help` directive under the control. */
|
package/dist/src/theme.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { BaseInputTemplate, TextareaWidget } from './widgets/input-widgets';
|
|
|
6
6
|
import { FileWidget } from './widgets/file-widget';
|
|
7
7
|
import { CheckboxWidget, CheckboxesWidget, RadioWidget, SelectWidget } from './widgets/choice-widgets';
|
|
8
8
|
import { Multistep } from './multistep';
|
|
9
|
+
import { Oauth } from './oauth';
|
|
9
10
|
export declare const Templates: {
|
|
10
11
|
ArrayFieldItemButtonsTemplate: typeof ArrayFieldItemButtonsTemplate;
|
|
11
12
|
ArrayFieldItemTemplate: typeof ArrayFieldItemTemplate;
|
|
@@ -41,10 +42,12 @@ export declare const Widgets: {
|
|
|
41
42
|
};
|
|
42
43
|
/**
|
|
43
44
|
* `ThemeProps` plus the `multistep` components `FcodeJsonSchemaForm` uses to
|
|
44
|
-
* render a `ui:steps` form's navigation
|
|
45
|
+
* render a `ui:steps` form's navigation and the `oauth` control it uses for
|
|
46
|
+
* `ui:widget: "oauth"` fields. RJSF itself ignores the extra keys.
|
|
45
47
|
*/
|
|
46
48
|
export type F0RjsfTheme = ThemeProps & {
|
|
47
49
|
multistep: typeof Multistep;
|
|
50
|
+
oauth: typeof Oauth;
|
|
48
51
|
};
|
|
49
52
|
/**
|
|
50
53
|
* Builds the theme. Present for parity with the official RJSF theme packages,
|
|
@@ -3,11 +3,13 @@ import { WidgetProps } from '@rjsf/utils';
|
|
|
3
3
|
/**
|
|
4
4
|
* Shared bridge from an RJSF widget to `F0FormField`.
|
|
5
5
|
*
|
|
6
|
-
* RJSF keeps ownership of validation: the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the
|
|
10
|
-
* the control
|
|
6
|
+
* RJSF keeps ownership of validation: the control is told it is in an error
|
|
7
|
+
* state rather than letting f0 (which validates with zod) derive its own, and
|
|
8
|
+
* the messages themselves are rendered by `FieldErrorTemplate`, the one place
|
|
9
|
+
* that also covers the controls f0 does not render. The label is hidden because
|
|
10
|
+
* `FieldTemplate` renders it above the control to support markdown; the
|
|
11
|
+
* plain-text label is still handed to f0 so the control keeps an accessible
|
|
12
|
+
* name.
|
|
11
13
|
*/
|
|
12
14
|
export interface F0FieldBridgeProps extends WidgetProps {
|
|
13
15
|
/** The f0 field descriptor minus the parts derived from the RJSF props. */
|
package/dist/styles.css
CHANGED
|
@@ -135,14 +135,26 @@
|
|
|
135
135
|
margin-top: 0.125rem;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
/*
|
|
139
|
+
* Matches what f0 draws under a field in error (`text-base font-medium
|
|
140
|
+
* text-f1-foreground-critical`), minus its icon: this list carries the single
|
|
141
|
+
* message of an ordinary invalid field, not just the rare pile-up, so a marker
|
|
142
|
+
* and its indent would set it apart from every f0 field error on the page.
|
|
143
|
+
*/
|
|
138
144
|
.rjsf-f0-errors {
|
|
139
145
|
margin: 0;
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
padding-left: 0;
|
|
147
|
+
list-style: none;
|
|
142
148
|
font-size: 0.875rem;
|
|
149
|
+
font-weight: 500;
|
|
143
150
|
color: hsl(var(--critical-70, 3 71% 41%));
|
|
144
151
|
}
|
|
145
152
|
|
|
153
|
+
.rjsf-f0-errors li + li {
|
|
154
|
+
/* f0 `0.5`. */
|
|
155
|
+
margin-top: 0.125rem;
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
.rjsf-f0-object,
|
|
147
159
|
.rjsf-f0-array {
|
|
148
160
|
display: flex;
|
|
@@ -208,6 +220,24 @@
|
|
|
208
220
|
margin-top: 1.5rem;
|
|
209
221
|
}
|
|
210
222
|
|
|
223
|
+
/* The OAuth connect control: button and, when the flow failed, its message. */
|
|
224
|
+
.rjsf-f0-oauth {
|
|
225
|
+
display: flex;
|
|
226
|
+
flex-wrap: wrap;
|
|
227
|
+
align-items: center;
|
|
228
|
+
gap: 0.75rem;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* f0's `text-base font-medium` in the critical foreground colour. */
|
|
232
|
+
.rjsf-f0-oauth-error {
|
|
233
|
+
flex-basis: 100%;
|
|
234
|
+
margin: 0;
|
|
235
|
+
font-size: 0.875rem;
|
|
236
|
+
line-height: 1.25rem;
|
|
237
|
+
font-weight: 500;
|
|
238
|
+
color: hsl(var(--critical-70, 3 71% 41%));
|
|
239
|
+
}
|
|
240
|
+
|
|
211
241
|
/*
|
|
212
242
|
* `gap` matches the `pl-2.5` f0 puts between a checkbox and its own label, so a
|
|
213
243
|
* markdown label (rendered here) lines up with a plain one (rendered by f0).
|
package/package.json
CHANGED