@factorialco/rjsf-f0 3.0.0 → 3.2.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const Assistant: {
2
+ LaunchButton: ({ id, label, disabled, onClick, toggle, }: import('./types').LaunchButtonProps) => import('../../node_modules/@types/react').JSX.Element;
3
+ };
4
+ export type { LaunchButtonProps, LaunchButtonToggle } from './types';
@@ -0,0 +1,11 @@
1
+ import { default as React } from '../../node_modules/@types/react';
2
+ import { LaunchButtonProps } from './types';
3
+ /**
4
+ * The `launch-one` button: the SDK fills the texts in and calls the host;
5
+ * this only draws it, with the toggle for the fields it collapses beside it
6
+ * when there is one. A button with a toggle is drawn inside its section,
7
+ * under the heading, so it keeps the space the section's content would.
8
+ * F0Button renders a `<button>` with no `type`, so its
9
+ * click must prevent the default or it would submit the form.
10
+ */
11
+ export declare const LaunchButton: ({ id, label, disabled, onClick, toggle, }: LaunchButtonProps) => React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Structural copy of the `launch-one` button contract in
3
+ * `@factorialco/fcode-react-forms` (`FcodeJsonSchemaForm`'s
4
+ * `rjsfTheme.assistant`). This package does not depend on that one, so the
5
+ * type is duplicated here; TypeScript's structural typing keeps them
6
+ * interchangeable.
7
+ */
8
+ /** The link under a button with `collapse: true`. */
9
+ export interface LaunchButtonToggle {
10
+ /** The fields are hidden now. */
11
+ collapsed: boolean;
12
+ label: string;
13
+ onClick: () => void;
14
+ }
15
+ export interface LaunchButtonProps {
16
+ id: string;
17
+ label: string;
18
+ disabled: boolean;
19
+ onClick: () => void;
20
+ toggle?: LaunchButtonToggle;
21
+ }
@@ -6,4 +6,6 @@ export { Oauth } from './oauth';
6
6
  export type { OauthConnectControlProps, OauthConnectStatus } from './oauth';
7
7
  export { markdownComponents } from './markdown/markdown-components';
8
8
  export { Pairing } from './pairing';
9
- export type { PairingLabels, PairingOption, PairingRowStatus, PairingSuggestion, PairingTableProps, PairingTableRow, } from './pairing';
9
+ export { Assistant } from './assistant';
10
+ export type { LaunchButtonProps, LaunchButtonToggle } from './assistant';
11
+ export type { PairingLabels, PairingOption, PairingRowStatus, PairingSuggestion, PairingSuggestionSource, PairingTableProps, PairingTableRow, } from './pairing';
@@ -1,4 +1,4 @@
1
1
  export declare const Pairing: {
2
2
  Table: (props: import('./types').PairingTableProps) => import('../../node_modules/@types/react').JSX.Element;
3
3
  };
4
- export type { PairingLabels, PairingOption, PairingRowStatus, PairingSuggestion, PairingTableProps, PairingTableRow, } from './types';
4
+ export type { PairingLabels, PairingOption, PairingRowStatus, PairingSuggestion, PairingSuggestionSource, PairingTableProps, PairingTableRow, } from './types';
@@ -5,7 +5,8 @@ import { PairingTableProps } from './types';
5
5
  * the filter and the submitted values; this only lays them out: a header with
6
6
  * the counts, the "Needs a choice" filter (filled while on) and "Accept N
7
7
  * suggestions" (while any is pending), the table (Factorial record, a
8
- * searchable select of the other system's records, a status tag, and an
8
+ * searchable select of the other system's records, or a text input on a
9
+ * free-text row, a status tag, and an
9
10
  * "Accept" action on rows showing a suggestion), and a footer with the select to add rows
10
11
  * not listed beside the note explaining which rows are.
11
12
  * F0Button renders a `<button>` with no `type`, so its clicks must prevent the
@@ -9,16 +9,22 @@ export interface PairingOption {
9
9
  value: string;
10
10
  label: string;
11
11
  }
12
+ export type PairingSuggestionSource = 'app' | 'one';
12
13
  export interface PairingSuggestion {
13
14
  value: string;
14
15
  label: string;
15
16
  reason: string;
17
+ source: PairingSuggestionSource;
16
18
  }
17
19
  export interface PairingLabels {
18
20
  status: string;
19
21
  confirmed: string;
20
22
  suggested: string;
23
+ suggestedByOne: string;
24
+ oneSuggests: string;
25
+ use: string;
21
26
  needsChoice: string;
27
+ needsValue: string;
22
28
  unavailable: string;
23
29
  accept: string;
24
30
  acceptAll: string;
@@ -26,6 +32,7 @@ export interface PairingLabels {
26
32
  placeholder: string;
27
33
  addRow: string;
28
34
  needsChoiceFilter: string;
35
+ needsValueFilter: string;
29
36
  empty: string;
30
37
  }
31
38
  export type PairingRowStatus = 'confirmed' | 'suggested' | 'unavailable' | 'open';
@@ -36,9 +43,12 @@ export interface PairingTableRow {
36
43
  shownValue: string;
37
44
  pending: boolean;
38
45
  options: PairingOption[];
46
+ freeText: boolean;
39
47
  status: PairingRowStatus;
40
48
  statusLabel: string;
41
49
  suggestion: PairingSuggestion | null;
50
+ alternative: PairingSuggestion | null;
51
+ alternativeLabel: string;
42
52
  error: string | null;
43
53
  }
44
54
  export interface PairingTableProps {
@@ -8,6 +8,7 @@ import { CheckboxWidget, CheckboxesWidget, RadioWidget, SelectWidget } from './w
8
8
  import { Multistep } from './multistep';
9
9
  import { Oauth } from './oauth';
10
10
  import { Pairing } from './pairing';
11
+ import { Assistant } from './assistant';
11
12
  export declare const Templates: {
12
13
  ArrayFieldItemButtonsTemplate: typeof ArrayFieldItemButtonsTemplate;
13
14
  ArrayFieldItemTemplate: typeof ArrayFieldItemTemplate;
@@ -45,12 +46,14 @@ export declare const Widgets: {
45
46
  * `ThemeProps` plus the `multistep` components `FcodeJsonSchemaForm` uses to
46
47
  * render a `ui:steps` form's navigation, the `oauth` control it uses for
47
48
  * `ui:widget: "oauth"` fields and the `pairing` table it uses for
48
- * `ui:field: "pairing"` objects. RJSF itself ignores the extra keys.
49
+ * `ui:field: "pairing"` objects, and the `assistant` button it uses for
50
+ * `ui:field: "launch-one"`. RJSF itself ignores the extra keys.
49
51
  */
50
52
  export type F0RjsfTheme = ThemeProps & {
51
53
  multistep: typeof Multistep;
52
54
  oauth: typeof Oauth;
53
55
  pairing: typeof Pairing;
56
+ assistant: typeof Assistant;
54
57
  };
55
58
  /**
56
59
  * Builds the theme. Present for parity with the official RJSF theme packages,
package/dist/styles.css CHANGED
@@ -1116,3 +1116,48 @@
1116
1116
  .rjsf-f0-pairing-footer .rjsf-f0-pairing-note {
1117
1117
  flex: 1 1 16rem;
1118
1118
  }
1119
+
1120
+ /* The launch-one button, with its collapse toggle, a link, beside it. */
1121
+ .rjsf-f0-launch-assistant {
1122
+ display: flex;
1123
+ flex-wrap: wrap;
1124
+ align-items: center;
1125
+ gap: 0.25rem 1rem;
1126
+ }
1127
+
1128
+ /*
1129
+ * Inside a section (collapse needs one), the button line sits under the
1130
+ * section's heading: the same space parts it from the description as the
1131
+ * pairing table's, and the content below keeps its own.
1132
+ */
1133
+ .rjsf-f0-launch-assistant--in-section {
1134
+ margin-top: 0.75rem;
1135
+ }
1136
+
1137
+ .rjsf-f0-launch-assistant-toggle {
1138
+ display: inline-flex;
1139
+ align-items: center;
1140
+ gap: 0.25rem;
1141
+ padding: 0;
1142
+ border: 0;
1143
+ background: none;
1144
+ font: inherit;
1145
+ font-size: 0.875rem;
1146
+ font-weight: 500;
1147
+ /* f0's link: foreground text, underlined. */
1148
+ color: hsl(var(--neutral-100, 218 48% 10%));
1149
+ text-decoration: underline;
1150
+ text-decoration-color: hsl(var(--neutral-30, 213 87% 15% / 0.2));
1151
+ text-underline-offset: 3px;
1152
+ cursor: pointer;
1153
+ }
1154
+
1155
+ .rjsf-f0-launch-assistant-toggle:hover {
1156
+ text-decoration-color: currentColor;
1157
+ }
1158
+
1159
+ .rjsf-f0-launch-assistant-toggle:focus-visible {
1160
+ outline: 2px solid hsl(var(--ring, 184 92% 35%));
1161
+ outline-offset: 2px;
1162
+ border-radius: 0.25rem;
1163
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/rjsf-f0",
3
- "version": "3.0.0",
3
+ "version": "3.2.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/",