@factorialco/rjsf-f0 2.0.0 → 2.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.
- package/dist/rjsf-f0.cjs.js +22 -22
- package/dist/rjsf-f0.cjs.js.map +1 -1
- package/dist/rjsf-f0.es.js +2810 -2723
- package/dist/rjsf-f0.es.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/multistep/back-button.d.ts +8 -0
- package/dist/src/multistep/index.d.ts +5 -0
- package/dist/src/multistep/multistep.test.d.ts +1 -0
- package/dist/src/multistep/steps-navigation.d.ts +3 -0
- package/dist/src/multistep/types.d.ts +29 -0
- package/dist/src/templates/button-templates.d.ts +6 -0
- package/dist/src/theme.d.ts +10 -2
- package/dist/styles.css +63 -0
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as Form, generateForm } from './form';
|
|
2
2
|
export { Templates, Theme, Widgets, generateTheme } from './theme';
|
|
3
|
+
export type { F0RjsfTheme } from './theme';
|
|
4
|
+
export { Multistep } from './multistep';
|
|
3
5
|
export { markdownComponents } from './markdown/markdown-components';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from '../../node_modules/@types/react';
|
|
2
|
+
import { StepBackButtonProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Sits inside the <form> next to the submit button, and F0Button renders a
|
|
5
|
+
* `<button>` with no explicit `type` — i.e. a submit button — so the click
|
|
6
|
+
* must prevent the default or going back would post the form.
|
|
7
|
+
*/
|
|
8
|
+
export declare const StepBackButton: ({ label, onClick, disabled, }: StepBackButtonProps) => React.JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const Multistep: {
|
|
2
|
+
StepsNavigation: ({ layout, items, currentIndex, onNavigate, children, }: import('./types').StepsNavigationProps) => import("react").JSX.Element;
|
|
3
|
+
BackButton: ({ label, onClick, disabled, }: import('./types').StepBackButtonProps) => import("react").JSX.Element;
|
|
4
|
+
};
|
|
5
|
+
export type { StepBackButtonProps, StepsLayout, StepsNavigationItem, StepsNavigationProps, StepStatus, } from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React } from '../../node_modules/@types/react';
|
|
2
|
+
/**
|
|
3
|
+
* Structural copies of the multistep contract in
|
|
4
|
+
* `@factorialco/fcode-react-forms` (`FcodeJsonSchemaForm`'s `rjsfTheme.multistep`).
|
|
5
|
+
* This package does not depend on that one, so the types are duplicated here;
|
|
6
|
+
* TypeScript's structural typing keeps them interchangeable.
|
|
7
|
+
*/
|
|
8
|
+
export type StepsLayout = 'tabs' | 'sidebar';
|
|
9
|
+
export type StepStatus = 'completed' | 'current' | 'upcoming';
|
|
10
|
+
export interface StepsNavigationItem {
|
|
11
|
+
index: number;
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
status: StepStatus;
|
|
15
|
+
clickable: boolean;
|
|
16
|
+
hasErrors: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface StepsNavigationProps {
|
|
19
|
+
layout: StepsLayout;
|
|
20
|
+
items: StepsNavigationItem[];
|
|
21
|
+
currentIndex: number;
|
|
22
|
+
onNavigate: (index: number) => void;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export interface StepBackButtonProps {
|
|
26
|
+
label: string;
|
|
27
|
+
onClick: () => void;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { default as React } from '../../node_modules/@types/react';
|
|
2
2
|
import { IconButtonProps, SubmitButtonProps, TemplatesType } from '@rjsf/utils';
|
|
3
|
+
/**
|
|
4
|
+
* `F0Button` renders a `<button>` without an explicit `type`, which inside a
|
|
5
|
+
* `<form>` means "submit". Every button that is not the submit button therefore
|
|
6
|
+
* has to stop the event itself.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useNonSubmittingClick(onClick: IconButtonProps['onClick']): (event: React.MouseEvent<HTMLElement>) => void;
|
|
3
9
|
export declare function CopyButton(props: IconButtonProps): React.JSX.Element;
|
|
4
10
|
export declare function MoveUpButton(props: IconButtonProps): React.JSX.Element;
|
|
5
11
|
export declare function MoveDownButton(props: IconButtonProps): React.JSX.Element;
|
package/dist/src/theme.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DescriptionFieldTemplate, ErrorListTemplate, FieldErrorTemplate, FieldH
|
|
|
4
4
|
import { ArrayFieldItemButtonsTemplate, ArrayFieldItemTemplate, ArrayFieldTemplate, GridTemplate, MultiSchemaFieldTemplate, ObjectFieldTemplate } from './templates/layout-templates';
|
|
5
5
|
import { BaseInputTemplate, TextareaWidget } from './widgets/input-widgets';
|
|
6
6
|
import { CheckboxWidget, CheckboxesWidget, RadioWidget, SelectWidget } from './widgets/choice-widgets';
|
|
7
|
+
import { Multistep } from './multistep';
|
|
7
8
|
export declare const Templates: {
|
|
8
9
|
ArrayFieldItemButtonsTemplate: typeof ArrayFieldItemButtonsTemplate;
|
|
9
10
|
ArrayFieldItemTemplate: typeof ArrayFieldItemTemplate;
|
|
@@ -36,13 +37,20 @@ export declare const Widgets: {
|
|
|
36
37
|
SelectWidget: typeof SelectWidget;
|
|
37
38
|
TextareaWidget: typeof TextareaWidget;
|
|
38
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* `ThemeProps` plus the `multistep` components `FcodeJsonSchemaForm` uses to
|
|
42
|
+
* render a `ui:steps` form's navigation. RJSF itself ignores the extra key.
|
|
43
|
+
*/
|
|
44
|
+
export type F0RjsfTheme = ThemeProps & {
|
|
45
|
+
multistep: typeof Multistep;
|
|
46
|
+
};
|
|
39
47
|
/**
|
|
40
48
|
* Builds the theme. Present for parity with the official RJSF theme packages,
|
|
41
49
|
* whose `generateTheme()` exists so the theme can be typed against a specific
|
|
42
50
|
* schema; here the templates are not schema-generic, so it returns the same
|
|
43
51
|
* object every time.
|
|
44
52
|
*/
|
|
45
|
-
export declare function generateTheme():
|
|
53
|
+
export declare function generateTheme(): F0RjsfTheme;
|
|
46
54
|
/**
|
|
47
55
|
* The f0 theme for react-jsonschema-form.
|
|
48
56
|
*
|
|
@@ -53,4 +61,4 @@ export declare function generateTheme(): ThemeProps;
|
|
|
53
61
|
* exchanges uploads as `data:` URLs, and f0's file field is built around an
|
|
54
62
|
* upload hook instead.
|
|
55
63
|
*/
|
|
56
|
-
export declare const Theme:
|
|
64
|
+
export declare const Theme: F0RjsfTheme;
|
package/dist/styles.css
CHANGED
|
@@ -489,3 +489,66 @@
|
|
|
489
489
|
pointer-events: none;
|
|
490
490
|
overflow: hidden;
|
|
491
491
|
}
|
|
492
|
+
|
|
493
|
+
/*
|
|
494
|
+
* Multistep (`ui:steps`) navigation. Colours and controls come from f0
|
|
495
|
+
* (`F0Button`, `F0TableOfContent`); these rules only lay the pieces out.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
.rjsf-f0-steps-tabs {
|
|
499
|
+
display: flex;
|
|
500
|
+
flex-wrap: wrap;
|
|
501
|
+
gap: 0.25rem;
|
|
502
|
+
margin-bottom: 1.5rem;
|
|
503
|
+
padding-bottom: 0.5rem;
|
|
504
|
+
border-bottom: 1px solid var(--f1-border-secondary, rgb(0 0 0 / 0.1));
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/* Wraps to a stacked layout on narrow widths via the main column's min-width. */
|
|
508
|
+
.rjsf-f0-steps-layout-sidebar {
|
|
509
|
+
display: flex;
|
|
510
|
+
flex-wrap: wrap;
|
|
511
|
+
gap: 1rem 2rem;
|
|
512
|
+
align-items: flex-start;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.rjsf-f0-steps-nav {
|
|
516
|
+
flex: 1 0 13rem;
|
|
517
|
+
max-width: 16rem;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.rjsf-f0-steps-layout-sidebar .rjsf-f0-steps-main {
|
|
521
|
+
flex: 1 1 24rem;
|
|
522
|
+
min-width: 0;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.rjsf-f0-steps-header {
|
|
526
|
+
margin-bottom: 1rem;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.rjsf-f0-steps-title {
|
|
530
|
+
margin: 0 0 0.25rem;
|
|
531
|
+
font-size: 1.125rem;
|
|
532
|
+
font-weight: 600;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.rjsf-f0-steps-description {
|
|
536
|
+
margin: 0;
|
|
537
|
+
font-size: 0.875rem;
|
|
538
|
+
color: var(--f1-foreground-secondary, inherit);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/*
|
|
542
|
+
* The actions row (rendered by the SDK's step engine) holds Back and
|
|
543
|
+
* Next/Submit; it takes over the submit button's usual top margin.
|
|
544
|
+
*/
|
|
545
|
+
.fcode-steps-actions {
|
|
546
|
+
display: flex;
|
|
547
|
+
align-items: center;
|
|
548
|
+
gap: 0.75rem;
|
|
549
|
+
margin-top: 1.5rem;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.fcode-steps-actions .rjsf-f0-submit {
|
|
553
|
+
margin-top: 0;
|
|
554
|
+
}
|
package/package.json
CHANGED