@factorialco/rjsf-f0 2.5.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 +55 -42
- package/dist/rjsf-f0.cjs.js +18 -18
- package/dist/rjsf-f0.cjs.js.map +1 -1
- package/dist/rjsf-f0.es.js +2088 -1915
- 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/src/widgets/file-widget.d.ts +22 -3
- package/dist/styles.css +67 -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,
|
|
@@ -10,6 +10,20 @@ import { WidgetProps } from '@rjsf/utils';
|
|
|
10
10
|
* available to this package.
|
|
11
11
|
*/
|
|
12
12
|
export declare function formatFileSize(bytes: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Files above this size are held aside instead of being read into a `data:`
|
|
15
|
+
* URL, when the form offers a place to hold them (see `keptFilesOf`).
|
|
16
|
+
*
|
|
17
|
+
* 50 MiB because that is the most any path that carries the file *inside* the
|
|
18
|
+
* submission accepts — the platform's multipart relay and the largest plan's
|
|
19
|
+
* file limit — so a file this big can only reach a process through an upload
|
|
20
|
+
* grant, which sends the `File` as it is. Below it the `data:` URL stays: a
|
|
21
|
+
* host whose grant is refused still sends the file inline, as before grants.
|
|
22
|
+
* Above it the `data:` URL is what broke: base64 of a file approaching 1 GB is
|
|
23
|
+
* longer than the longest string the browser can hold, so reading it fails
|
|
24
|
+
* before the form is even submitted.
|
|
25
|
+
*/
|
|
26
|
+
export declare const LARGE_FILE_BYTES: number;
|
|
13
27
|
/**
|
|
14
28
|
* The f0 file control.
|
|
15
29
|
*
|
|
@@ -20,9 +34,14 @@ export declare function formatFileSize(bytes: number): string;
|
|
|
20
34
|
* locale — English chrome inside a Spanish form, which no amount of locale
|
|
21
35
|
* propagation on our side can reach.
|
|
22
36
|
*
|
|
23
|
-
* The
|
|
24
|
-
* hook)
|
|
25
|
-
*
|
|
37
|
+
* The value RJSF sees is byte-identical to core's: `useFileWidgetProps` (core's
|
|
38
|
+
* own hook) owns multiple-file fields and the chips of encoded values, and a
|
|
39
|
+
* single file is read into the same `data:` URL here (`readAsDataUrl`), only so
|
|
40
|
+
* a slow read cannot overwrite a newer pick. The one exception is a
|
|
41
|
+
* single file above `LARGE_FILE_BYTES` in a root field of a form that holds
|
|
42
|
+
* large files (`keptFilesOf`): its value is the form's placeholder instead.
|
|
43
|
+
* Multiple-file fields and fields nested in an object or array always encode:
|
|
44
|
+
* the submit paths only lift top-level files out of the submission.
|
|
26
45
|
*
|
|
27
46
|
* The native input is kept — transparent, stretched over the whole dropzone —
|
|
28
47
|
* rather than hidden behind a JS click handler. It stays the labelled control
|
package/dist/styles.css
CHANGED
|
@@ -1049,3 +1049,70 @@
|
|
|
1049
1049
|
.fcode-steps-actions .rjsf-f0-submit {
|
|
1050
1050
|
margin-top: 0;
|
|
1051
1051
|
}
|
|
1052
|
+
|
|
1053
|
+
/* Same colour and weight as a field error (`.rjsf-f0-errors`). */
|
|
1054
|
+
.rjsf-f0-file-error {
|
|
1055
|
+
margin: 0;
|
|
1056
|
+
color: hsl(var(--critical-70, 3 71% 41%));
|
|
1057
|
+
font-weight: 500;
|
|
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",
|