@factorialco/rjsf-f0 2.2.1 → 2.3.1
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 +5 -0
- package/dist/rjsf-f0.cjs.js +21 -21
- package/dist/rjsf-f0.cjs.js.map +1 -1
- package/dist/rjsf-f0.es.js +1113 -1086
- 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/theme.d.ts +4 -1
- package/dist/styles.css +23 -1
- 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
|
+
}
|
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,
|
package/dist/styles.css
CHANGED
|
@@ -214,12 +214,34 @@
|
|
|
214
214
|
display: flex;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
/*
|
|
217
|
+
/*
|
|
218
|
+
* The submit button is a sibling of the field list, so it gets no row gap. It
|
|
219
|
+
* sits at the end of the row, where f0 dialogs and forms put the primary action.
|
|
220
|
+
*/
|
|
218
221
|
.rjsf-f0-submit {
|
|
219
222
|
display: flex;
|
|
223
|
+
justify-content: flex-end;
|
|
220
224
|
margin-top: 1.5rem;
|
|
221
225
|
}
|
|
222
226
|
|
|
227
|
+
/* The OAuth connect control: button and, when the flow failed, its message. */
|
|
228
|
+
.rjsf-f0-oauth {
|
|
229
|
+
display: flex;
|
|
230
|
+
flex-wrap: wrap;
|
|
231
|
+
align-items: center;
|
|
232
|
+
gap: 0.75rem;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* f0's `text-base font-medium` in the critical foreground colour. */
|
|
236
|
+
.rjsf-f0-oauth-error {
|
|
237
|
+
flex-basis: 100%;
|
|
238
|
+
margin: 0;
|
|
239
|
+
font-size: 0.875rem;
|
|
240
|
+
line-height: 1.25rem;
|
|
241
|
+
font-weight: 500;
|
|
242
|
+
color: hsl(var(--critical-70, 3 71% 41%));
|
|
243
|
+
}
|
|
244
|
+
|
|
223
245
|
/*
|
|
224
246
|
* `gap` matches the `pl-2.5` f0 puts between a checkbox and its own label, so a
|
|
225
247
|
* markdown label (rendered here) lines up with a plain one (rendered by f0).
|
package/package.json
CHANGED