@factorialco/rjsf-f0 2.6.0 → 3.1.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
+ }
@@ -5,3 +5,7 @@ export { Multistep } from './multistep';
5
5
  export { Oauth } from './oauth';
6
6
  export type { OauthConnectControlProps, OauthConnectStatus } from './oauth';
7
7
  export { markdownComponents } from './markdown/markdown-components';
8
+ export { Pairing } 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';
@@ -0,0 +1,4 @@
1
+ export declare const Pairing: {
2
+ Table: (props: import('./types').PairingTableProps) => import('../../node_modules/@types/react').JSX.Element;
3
+ };
4
+ export type { PairingLabels, PairingOption, PairingRowStatus, PairingSuggestion, PairingSuggestionSource, PairingTableProps, PairingTableRow, } from './types';
@@ -0,0 +1,14 @@
1
+ import { default as React } from '../../node_modules/@types/react';
2
+ import { PairingTableProps } from './types';
3
+ /**
4
+ * The f0 drawing of a `ui:field: "pairing"` object. The SDK owns the rows,
5
+ * the filter and the submitted values; this only lays them out: a header with
6
+ * the counts, the "Needs a choice" filter (filled while on) and "Accept N
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
9
+ * "Accept" action on rows showing a suggestion), and a footer with the select to add rows
10
+ * not listed beside the note explaining which rows are.
11
+ * F0Button renders a `<button>` with no `type`, so its clicks must prevent the
12
+ * default or they would submit the form.
13
+ */
14
+ export declare const PairingTable: (props: PairingTableProps) => React.JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Structural copies of the pairing table contract in
3
+ * `@factorialco/fcode-react-forms` (`FcodeJsonSchemaForm`'s
4
+ * `rjsfTheme.pairing`). This package does not depend on that one, so the
5
+ * types are duplicated here; TypeScript's structural typing keeps them
6
+ * interchangeable.
7
+ */
8
+ export interface PairingOption {
9
+ value: string;
10
+ label: string;
11
+ }
12
+ export type PairingSuggestionSource = 'app' | 'one';
13
+ export interface PairingSuggestion {
14
+ value: string;
15
+ label: string;
16
+ reason: string;
17
+ source: PairingSuggestionSource;
18
+ }
19
+ export interface PairingLabels {
20
+ status: string;
21
+ confirmed: string;
22
+ suggested: string;
23
+ suggestedByOne: string;
24
+ oneSuggests: string;
25
+ use: string;
26
+ needsChoice: string;
27
+ unavailable: string;
28
+ accept: string;
29
+ acceptAll: string;
30
+ summary: string;
31
+ placeholder: string;
32
+ addRow: string;
33
+ needsChoiceFilter: string;
34
+ empty: string;
35
+ }
36
+ export type PairingRowStatus = 'confirmed' | 'suggested' | 'unavailable' | 'open';
37
+ export interface PairingTableRow {
38
+ id: string;
39
+ label: string;
40
+ value: string;
41
+ shownValue: string;
42
+ pending: boolean;
43
+ options: PairingOption[];
44
+ status: PairingRowStatus;
45
+ statusLabel: string;
46
+ suggestion: PairingSuggestion | null;
47
+ alternative: PairingSuggestion | null;
48
+ alternativeLabel: string;
49
+ error: string | null;
50
+ }
51
+ export interface PairingTableProps {
52
+ id: string;
53
+ columns: [string, string];
54
+ labels: PairingLabels;
55
+ rows: PairingTableRow[];
56
+ summary: string;
57
+ pendingCount: number;
58
+ acceptAllLabel: string;
59
+ inUseNote: string | null;
60
+ filter: {
61
+ active: boolean;
62
+ label: string;
63
+ onToggle: () => void;
64
+ } | null;
65
+ addable: PairingOption[];
66
+ disabled: boolean;
67
+ onChange: (rowId: string, value: string | null) => void;
68
+ onAccept: (rowId: string) => void;
69
+ onAcceptAll: () => void;
70
+ onAdd: (rowId: string) => void;
71
+ }
@@ -7,6 +7,8 @@ import { FileWidget } from './widgets/file-widget';
7
7
  import { CheckboxWidget, CheckboxesWidget, RadioWidget, SelectWidget } from './widgets/choice-widgets';
8
8
  import { Multistep } from './multistep';
9
9
  import { Oauth } from './oauth';
10
+ import { Pairing } from './pairing';
11
+ import { Assistant } from './assistant';
10
12
  export declare const Templates: {
11
13
  ArrayFieldItemButtonsTemplate: typeof ArrayFieldItemButtonsTemplate;
12
14
  ArrayFieldItemTemplate: typeof ArrayFieldItemTemplate;
@@ -42,12 +44,16 @@ export declare const Widgets: {
42
44
  };
43
45
  /**
44
46
  * `ThemeProps` plus the `multistep` components `FcodeJsonSchemaForm` uses to
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.
47
+ * render a `ui:steps` form's navigation, the `oauth` control it uses for
48
+ * `ui:widget: "oauth"` fields and the `pairing` table it uses for
49
+ * `ui:field: "pairing"` objects, and the `assistant` button it uses for
50
+ * `ui:field: "launch-one"`. RJSF itself ignores the extra keys.
47
51
  */
48
52
  export type F0RjsfTheme = ThemeProps & {
49
53
  multistep: typeof Multistep;
50
54
  oauth: typeof Oauth;
55
+ pairing: typeof Pairing;
56
+ assistant: typeof Assistant;
51
57
  };
52
58
  /**
53
59
  * Builds the theme. Present for parity with the official RJSF theme packages,
package/dist/styles.css CHANGED
@@ -1056,3 +1056,108 @@
1056
1056
  color: hsl(var(--critical-70, 3 71% 41%));
1057
1057
  font-weight: 500;
1058
1058
  }
1059
+
1060
+ /*
1061
+ * The pairing table (`ui:field: "pairing"`): a header with the counts and the
1062
+ * bulk actions, an optional note, the f0 editable table, and the select that
1063
+ * adds rows not listed.
1064
+ */
1065
+ /* `margin-top` parts the table from the section description above it. */
1066
+ .rjsf-f0-pairing {
1067
+ display: flex;
1068
+ flex-direction: column;
1069
+ gap: 0.75rem;
1070
+ margin-top: 0.75rem;
1071
+ }
1072
+
1073
+ .rjsf-f0-pairing-header {
1074
+ display: flex;
1075
+ flex-wrap: wrap;
1076
+ align-items: center;
1077
+ justify-content: space-between;
1078
+ gap: 0.5rem;
1079
+ }
1080
+
1081
+ .rjsf-f0-pairing-actions {
1082
+ display: flex;
1083
+ flex-wrap: wrap;
1084
+ gap: 0.5rem;
1085
+ }
1086
+
1087
+ /* f0's `text-base font-medium`. */
1088
+ .rjsf-f0-pairing-summary {
1089
+ margin: 0;
1090
+ font-size: 0.875rem;
1091
+ line-height: 1.25rem;
1092
+ font-weight: 500;
1093
+ }
1094
+
1095
+ /* f0's `text-base` in the secondary foreground colour. */
1096
+ .rjsf-f0-pairing-note {
1097
+ margin: 0;
1098
+ font-size: 0.875rem;
1099
+ line-height: 1.25rem;
1100
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
1101
+ }
1102
+
1103
+ /* The "add row" select beside the note that says which rows are listed. */
1104
+ .rjsf-f0-pairing-footer {
1105
+ display: flex;
1106
+ flex-wrap: wrap;
1107
+ align-items: center;
1108
+ gap: 0.75rem;
1109
+ }
1110
+
1111
+ .rjsf-f0-pairing-add {
1112
+ flex: 0 1 20rem;
1113
+ min-width: 12rem;
1114
+ }
1115
+
1116
+ .rjsf-f0-pairing-footer .rjsf-f0-pairing-note {
1117
+ flex: 1 1 16rem;
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": "2.6.0",
3
+ "version": "3.1.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/",
@@ -40,7 +40,7 @@
40
40
  "dev": "vite"
41
41
  },
42
42
  "peerDependencies": {
43
- "@factorialco/f0-react": "^4.39.0 || ^6 || ^7 || ^8 || ^9 || ^10 || ^11",
43
+ "@factorialco/f0-react": "^11.3.1 || ^12 || ^13 || ^14",
44
44
  "@rjsf/core": "^6.7.1",
45
45
  "@rjsf/utils": "^6.7.1",
46
46
  "react": "^18.3.1 || ^19.0.0",