@factorialco/rjsf-f0 2.4.0 → 2.6.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 +43 -41
- package/dist/rjsf-f0.cjs.js +18 -18
- package/dist/rjsf-f0.cjs.js.map +1 -1
- package/dist/rjsf-f0.es.js +2008 -1932
- package/dist/rjsf-f0.es.js.map +1 -1
- package/dist/src/multistep/index.d.ts +2 -1
- package/dist/src/multistep/leave-confirm.d.ts +7 -0
- package/dist/src/multistep/types.d.ts +12 -1
- package/dist/src/widgets/file-widget.d.ts +22 -3
- package/dist/styles.css +151 -12
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const Multistep: {
|
|
2
2
|
StepsNavigation: ({ layout, items, currentIndex, onNavigate, children, }: import('./types').StepsNavigationProps) => import('../../node_modules/@types/react').JSX.Element;
|
|
3
3
|
BackButton: ({ label, onClick, disabled, }: import('./types').StepBackButtonProps) => import('../../node_modules/@types/react').JSX.Element;
|
|
4
|
+
LeaveConfirm: ({ open, title, message, confirmLabel, cancelLabel, onConfirm, onCancel, }: import('./types').LeaveConfirmProps) => import('../../node_modules/@types/react').JSX.Element;
|
|
4
5
|
};
|
|
5
|
-
export type { StepBackButtonProps, StepsLayout, StepsNavigationItem, StepsNavigationProps, StepStatus, } from './types';
|
|
6
|
+
export type { LeaveConfirmProps, StepBackButtonProps, StepsLayout, StepsNavigationItem, StepsNavigationProps, StepStatus, } from './types';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from '../../node_modules/@types/react';
|
|
2
|
+
import { LeaveConfirmProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Asked before leaving a flow's step for an earlier one with values typed but
|
|
5
|
+
* not submitted. Closing the dialog any other way keeps the user on the step.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LeaveConfirm: ({ open, title, message, confirmLabel, cancelLabel, onConfirm, onCancel, }: LeaveConfirmProps) => React.JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { default as React } from '../../node_modules/@types/react';
|
|
|
6
6
|
* TypeScript's structural typing keeps them interchangeable.
|
|
7
7
|
*/
|
|
8
8
|
export type StepsLayout = 'tabs' | 'sidebar';
|
|
9
|
-
export type StepStatus = 'completed' | 'current' | 'upcoming';
|
|
9
|
+
export type StepStatus = 'completed' | 'current' | 'upcoming' | 'skipped';
|
|
10
10
|
export interface StepsNavigationItem {
|
|
11
11
|
index: number;
|
|
12
12
|
title: string;
|
|
@@ -14,6 +14,8 @@ export interface StepsNavigationItem {
|
|
|
14
14
|
status: StepStatus;
|
|
15
15
|
clickable: boolean;
|
|
16
16
|
hasErrors: boolean;
|
|
17
|
+
depth?: number;
|
|
18
|
+
counter?: string;
|
|
17
19
|
}
|
|
18
20
|
export interface StepsNavigationProps {
|
|
19
21
|
layout: StepsLayout;
|
|
@@ -22,6 +24,15 @@ export interface StepsNavigationProps {
|
|
|
22
24
|
onNavigate: (index: number) => void;
|
|
23
25
|
children: React.ReactNode;
|
|
24
26
|
}
|
|
27
|
+
export interface LeaveConfirmProps {
|
|
28
|
+
open: boolean;
|
|
29
|
+
title: string;
|
|
30
|
+
message: string;
|
|
31
|
+
confirmLabel: string;
|
|
32
|
+
cancelLabel: string;
|
|
33
|
+
onConfirm: () => void;
|
|
34
|
+
onCancel: () => void;
|
|
35
|
+
}
|
|
25
36
|
export interface StepBackButtonProps {
|
|
26
37
|
label: string;
|
|
27
38
|
onClick: () => void;
|
|
@@ -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
|
@@ -856,35 +856,159 @@
|
|
|
856
856
|
}
|
|
857
857
|
|
|
858
858
|
/*
|
|
859
|
-
* Multistep (`ui:steps`) navigation
|
|
860
|
-
*
|
|
859
|
+
* Multistep (`ui:steps`) navigation, laid out like f0's own `F0WizardForm`:
|
|
860
|
+
* a step list beside the form behind a dashed divider, numbered badges that
|
|
861
|
+
* turn into a check once a step is done, the current step tinted, and the
|
|
862
|
+
* actions as a footer row. Colours are f0's own tokens.
|
|
861
863
|
*/
|
|
862
864
|
|
|
863
865
|
.rjsf-f0-steps-tabs {
|
|
864
|
-
display: flex;
|
|
865
|
-
flex-wrap: wrap;
|
|
866
|
-
gap: 0.25rem;
|
|
867
866
|
margin-bottom: 1.5rem;
|
|
868
867
|
padding-bottom: 0.5rem;
|
|
869
|
-
border-bottom: 1px
|
|
868
|
+
border-bottom: 1px dashed hsl(var(--neutral-20, 214 70% 20% / 0.1));
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/* In the tabs layout the same step list runs in a row above the form. */
|
|
872
|
+
.rjsf-f0-steps-tabs .rjsf-f0-steps-list {
|
|
873
|
+
position: static;
|
|
874
|
+
flex-direction: row;
|
|
875
|
+
flex-wrap: wrap;
|
|
876
|
+
gap: 0.25rem;
|
|
877
|
+
padding: 0;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
.rjsf-f0-steps-tabs .rjsf-f0-steps-item {
|
|
881
|
+
width: auto;
|
|
882
|
+
padding: 0.375rem 0.5rem;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
.rjsf-f0-steps-tabs .rjsf-f0-steps-item-title {
|
|
886
|
+
flex: none;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/* A row has no room to indent sub-steps; their "2.1" badges set them apart. */
|
|
890
|
+
.rjsf-f0-steps-tabs .rjsf-f0-steps-item-substep {
|
|
891
|
+
margin-left: 0;
|
|
870
892
|
}
|
|
871
893
|
|
|
872
894
|
/* Wraps to a stacked layout on narrow widths via the main column's min-width. */
|
|
873
895
|
.rjsf-f0-steps-layout-sidebar {
|
|
874
896
|
display: flex;
|
|
875
897
|
flex-wrap: wrap;
|
|
876
|
-
|
|
877
|
-
|
|
898
|
+
align-items: stretch;
|
|
899
|
+
row-gap: 1rem;
|
|
878
900
|
}
|
|
879
901
|
|
|
880
|
-
.rjsf-f0-steps-nav {
|
|
881
|
-
flex:
|
|
882
|
-
|
|
902
|
+
.rjsf-f0-steps-layout-sidebar .rjsf-f0-steps-nav {
|
|
903
|
+
flex: 0 0 clamp(12rem, 30%, 18rem);
|
|
904
|
+
box-sizing: border-box;
|
|
905
|
+
padding: 0.5rem 0.5rem 0.5rem 0;
|
|
906
|
+
border-right: 1px dashed hsl(var(--neutral-20, 214 70% 20% / 0.1));
|
|
883
907
|
}
|
|
884
908
|
|
|
885
909
|
.rjsf-f0-steps-layout-sidebar .rjsf-f0-steps-main {
|
|
886
910
|
flex: 1 1 24rem;
|
|
887
911
|
min-width: 0;
|
|
912
|
+
padding-left: 2rem;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
.rjsf-f0-steps-list {
|
|
916
|
+
/* The list stays in view while a long step scrolls past it. */
|
|
917
|
+
position: sticky;
|
|
918
|
+
top: 1rem;
|
|
919
|
+
display: flex;
|
|
920
|
+
flex-direction: column;
|
|
921
|
+
gap: 0.375rem;
|
|
922
|
+
margin: 0;
|
|
923
|
+
padding: 0.25rem;
|
|
924
|
+
list-style: none;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.rjsf-f0-steps-item {
|
|
928
|
+
display: flex;
|
|
929
|
+
align-items: center;
|
|
930
|
+
gap: 0.5rem;
|
|
931
|
+
box-sizing: border-box;
|
|
932
|
+
width: 100%;
|
|
933
|
+
padding: 0.5rem;
|
|
934
|
+
border: 0;
|
|
935
|
+
border-radius: 0.625rem;
|
|
936
|
+
background: transparent;
|
|
937
|
+
color: hsl(var(--neutral-100, 218 48% 10%));
|
|
938
|
+
font: inherit;
|
|
939
|
+
text-align: left;
|
|
940
|
+
cursor: default;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
.rjsf-f0-steps-item-reachable {
|
|
944
|
+
cursor: pointer;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
.rjsf-f0-steps-item-reachable:hover {
|
|
948
|
+
background-color: hsl(var(--neutral-20, 214 70% 20% / 0.1));
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.rjsf-f0-steps-item:focus-visible {
|
|
952
|
+
outline: 2px solid hsl(var(--selected-50, 184 92% 35%));
|
|
953
|
+
outline-offset: 1px;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/* A process step heading its form's sub-steps: the sub-step is tinted, not it. */
|
|
957
|
+
.rjsf-f0-steps-item-current:not(.rjsf-f0-steps-item-group) {
|
|
958
|
+
background-color: hsl(var(--selected-50, 184 92% 35%) / 0.1);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
.rjsf-f0-steps-item:disabled:not(.rjsf-f0-steps-item-current) {
|
|
962
|
+
opacity: 0.7;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
.rjsf-f0-steps-item-substep {
|
|
966
|
+
margin-left: 1.75rem;
|
|
967
|
+
width: calc(100% - 1.75rem);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
.rjsf-f0-steps-item-title {
|
|
971
|
+
flex: 1;
|
|
972
|
+
font-size: 0.875rem;
|
|
973
|
+
font-weight: 500;
|
|
974
|
+
line-height: 1.25rem;
|
|
975
|
+
letter-spacing: -0.005em;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.rjsf-f0-steps-item-completed .rjsf-f0-steps-item-title,
|
|
979
|
+
.rjsf-f0-steps-item-skipped .rjsf-f0-steps-item-title {
|
|
980
|
+
color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
.rjsf-f0-steps-item-skipped .rjsf-f0-steps-item-title {
|
|
984
|
+
text-decoration: line-through;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
.rjsf-f0-steps-badge {
|
|
988
|
+
display: inline-flex;
|
|
989
|
+
flex-shrink: 0;
|
|
990
|
+
align-items: center;
|
|
991
|
+
justify-content: center;
|
|
992
|
+
box-sizing: border-box;
|
|
993
|
+
min-width: 1.25rem;
|
|
994
|
+
height: 1.25rem;
|
|
995
|
+
padding: 0 0.25rem;
|
|
996
|
+
border-radius: 0.375rem;
|
|
997
|
+
background-color: hsl(var(--neutral-10, 210 91% 22% / 0.03));
|
|
998
|
+
color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
|
|
999
|
+
font-size: 0.75rem;
|
|
1000
|
+
font-weight: 500;
|
|
1001
|
+
line-height: 1;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
.rjsf-f0-steps-badge-current {
|
|
1005
|
+
background-color: hsl(var(--selected-60, 184 92% 30%));
|
|
1006
|
+
color: #fff;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
.rjsf-f0-steps-item-errors .rjsf-f0-steps-badge {
|
|
1010
|
+
background-color: hsl(var(--critical-50, 4 84% 60%) / 0.1);
|
|
1011
|
+
color: hsl(var(--critical-70, 4 84% 45%));
|
|
888
1012
|
}
|
|
889
1013
|
|
|
890
1014
|
.rjsf-f0-steps-header {
|
|
@@ -903,17 +1027,32 @@
|
|
|
903
1027
|
color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
|
|
904
1028
|
}
|
|
905
1029
|
|
|
1030
|
+
.rjsf-f0-steps-leave-message {
|
|
1031
|
+
margin: 0;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
906
1034
|
/*
|
|
907
1035
|
* The actions row (rendered by the SDK's step engine) holds Back and
|
|
908
|
-
* Next/Submit
|
|
1036
|
+
* Next/Submit as a footer, right-aligned like f0's wizard; it takes over the
|
|
1037
|
+
* submit button's usual top margin.
|
|
909
1038
|
*/
|
|
910
1039
|
.fcode-steps-actions {
|
|
911
1040
|
display: flex;
|
|
912
1041
|
align-items: center;
|
|
1042
|
+
justify-content: flex-end;
|
|
913
1043
|
gap: 0.75rem;
|
|
914
1044
|
margin-top: 1.5rem;
|
|
1045
|
+
padding-top: 1rem;
|
|
1046
|
+
border-top: 1px solid hsl(var(--neutral-20, 214 70% 20% / 0.1));
|
|
915
1047
|
}
|
|
916
1048
|
|
|
917
1049
|
.fcode-steps-actions .rjsf-f0-submit {
|
|
918
1050
|
margin-top: 0;
|
|
919
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
|
+
}
|
package/package.json
CHANGED