@factorialco/rjsf-f0 2.4.0 → 2.5.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.
@@ -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;
package/dist/styles.css CHANGED
@@ -856,35 +856,159 @@
856
856
  }
857
857
 
858
858
  /*
859
- * Multistep (`ui:steps`) navigation. Colours and controls come from f0
860
- * (`F0Button`, `F0TableOfContent`); these rules only lay the pieces out.
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 solid hsl(var(--neutral-20, 214 70% 20% / 0.1));
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
- gap: 1rem 2rem;
877
- align-items: flex-start;
898
+ align-items: stretch;
899
+ row-gap: 1rem;
878
900
  }
879
901
 
880
- .rjsf-f0-steps-nav {
881
- flex: 1 0 13rem;
882
- max-width: 16rem;
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,15 +1027,23 @@
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; it takes over the submit button's usual top margin.
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/rjsf-f0",
3
- "version": "2.4.0",
3
+ "version": "2.5.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/",