@factorialco/rjsf-f0 2.2.1 → 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.
@@ -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,4 @@
1
+ export declare const Oauth: {
2
+ ConnectControl: ({ id, status, label, disabled, errorMessage, onClick, }: import('./types').OauthConnectControlProps) => import("react").JSX.Element;
3
+ };
4
+ export type { OauthConnectControlProps, OauthConnectStatus } from './types';
@@ -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
+ }
@@ -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. RJSF itself ignores the extra key.
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
@@ -220,6 +220,24 @@
220
220
  margin-top: 1.5rem;
221
221
  }
222
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
+
223
241
  /*
224
242
  * `gap` matches the `pl-2.5` f0 puts between a checkbox and its own label, so a
225
243
  * markdown label (rendered here) lines up with a plain one (rendered by f0).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/rjsf-f0",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Factorial f0 theme for react-jsonschema-form: renders RJSF forms with f0 components.",
5
5
  "type": "module",
6
6
  "homepage": "https://code.factorialhr.com/docs/forms/",