@factorialco/rjsf-f0 2.6.0 → 3.0.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 +12 -1
- package/dist/rjsf-f0.cjs.js +18 -18
- package/dist/rjsf-f0.cjs.js.map +1 -1
- package/dist/rjsf-f0.es.js +1420 -1296
- package/dist/rjsf-f0.es.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/pairing/index.d.ts +4 -0
- package/dist/src/pairing/pairing-table.d.ts +14 -0
- package/dist/src/pairing/pairing.test.d.ts +1 -0
- package/dist/src/pairing/types.d.ts +64 -0
- package/dist/src/theme.d.ts +5 -2
- package/dist/styles.css +60 -0
- package/package.json +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -5,3 +5,5 @@ 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 type { PairingLabels, PairingOption, PairingRowStatus, PairingSuggestion, 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, 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,64 @@
|
|
|
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 interface PairingSuggestion {
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PairingLabels {
|
|
18
|
+
status: string;
|
|
19
|
+
confirmed: string;
|
|
20
|
+
suggested: string;
|
|
21
|
+
needsChoice: string;
|
|
22
|
+
unavailable: string;
|
|
23
|
+
accept: string;
|
|
24
|
+
acceptAll: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
placeholder: string;
|
|
27
|
+
addRow: string;
|
|
28
|
+
needsChoiceFilter: string;
|
|
29
|
+
empty: string;
|
|
30
|
+
}
|
|
31
|
+
export type PairingRowStatus = 'confirmed' | 'suggested' | 'unavailable' | 'open';
|
|
32
|
+
export interface PairingTableRow {
|
|
33
|
+
id: string;
|
|
34
|
+
label: string;
|
|
35
|
+
value: string;
|
|
36
|
+
shownValue: string;
|
|
37
|
+
pending: boolean;
|
|
38
|
+
options: PairingOption[];
|
|
39
|
+
status: PairingRowStatus;
|
|
40
|
+
statusLabel: string;
|
|
41
|
+
suggestion: PairingSuggestion | null;
|
|
42
|
+
error: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface PairingTableProps {
|
|
45
|
+
id: string;
|
|
46
|
+
columns: [string, string];
|
|
47
|
+
labels: PairingLabels;
|
|
48
|
+
rows: PairingTableRow[];
|
|
49
|
+
summary: string;
|
|
50
|
+
pendingCount: number;
|
|
51
|
+
acceptAllLabel: string;
|
|
52
|
+
inUseNote: string | null;
|
|
53
|
+
filter: {
|
|
54
|
+
active: boolean;
|
|
55
|
+
label: string;
|
|
56
|
+
onToggle: () => void;
|
|
57
|
+
} | null;
|
|
58
|
+
addable: PairingOption[];
|
|
59
|
+
disabled: boolean;
|
|
60
|
+
onChange: (rowId: string, value: string | null) => void;
|
|
61
|
+
onAccept: (rowId: string) => void;
|
|
62
|
+
onAcceptAll: () => void;
|
|
63
|
+
onAdd: (rowId: string) => void;
|
|
64
|
+
}
|
package/dist/src/theme.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ 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';
|
|
10
11
|
export declare const Templates: {
|
|
11
12
|
ArrayFieldItemButtonsTemplate: typeof ArrayFieldItemButtonsTemplate;
|
|
12
13
|
ArrayFieldItemTemplate: typeof ArrayFieldItemTemplate;
|
|
@@ -42,12 +43,14 @@ export declare const Widgets: {
|
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
44
45
|
* `ThemeProps` plus the `multistep` components `FcodeJsonSchemaForm` uses to
|
|
45
|
-
* render a `ui:steps` form's navigation
|
|
46
|
-
* `ui:widget: "oauth"` fields
|
|
46
|
+
* render a `ui:steps` form's navigation, the `oauth` control it uses for
|
|
47
|
+
* `ui:widget: "oauth"` fields and the `pairing` table it uses for
|
|
48
|
+
* `ui:field: "pairing"` objects. RJSF itself ignores the extra keys.
|
|
47
49
|
*/
|
|
48
50
|
export type F0RjsfTheme = ThemeProps & {
|
|
49
51
|
multistep: typeof Multistep;
|
|
50
52
|
oauth: typeof Oauth;
|
|
53
|
+
pairing: typeof Pairing;
|
|
51
54
|
};
|
|
52
55
|
/**
|
|
53
56
|
* Builds the theme. Present for parity with the official RJSF theme packages,
|
package/dist/styles.css
CHANGED
|
@@ -1056,3 +1056,63 @@
|
|
|
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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorialco/rjsf-f0",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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": "^
|
|
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",
|