@petrarca/sonnet-forms 0.4.2 → 0.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/dist/index.d.ts +255 -5
- package/dist/index.js +973 -243
- package/dist/index.js.map +1 -1
- package/dist/widget-options.d.ts +61 -0
- package/dist/widget-options.js +237 -0
- package/dist/widget-options.js.map +1 -0
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { ComponentType, ReactNode } from 'react';
|
|
4
4
|
import { Input, Textarea, badgeVariants } from '@petrarca/sonnet-ui';
|
|
5
|
-
import { JsonSchemaProperty, UILayoutConfig, JsonSchema, UISchema, UISchemaOptions, FormDiff } from '@petrarca/sonnet-core/schema';
|
|
5
|
+
import { JsonSchemaProperty, UILayoutConfig, JsonSchema, UISchema, UISchemaOptions, FormDiff, RefResolver, FieldError } from '@petrarca/sonnet-core/schema';
|
|
6
6
|
export { UISchema, UISchemaOptions } from '@petrarca/sonnet-core/schema';
|
|
7
7
|
import { VariantProps } from 'class-variance-authority';
|
|
8
8
|
|
|
@@ -23,6 +23,12 @@ interface FormFieldWrapperProps {
|
|
|
23
23
|
* still communicated via the control's own styling (e.g. red border).
|
|
24
24
|
*/
|
|
25
25
|
compact?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Label placement: "top" (default) renders the label above the control;
|
|
28
|
+
* "start" renders the label inline on the reading-start side (RTL-safe: left
|
|
29
|
+
* in LTR, right in RTL). Logical values follow the MUI convention.
|
|
30
|
+
*/
|
|
31
|
+
labelPlacement?: "top" | "start";
|
|
26
32
|
/** Additional class name for the outer wrapper div */
|
|
27
33
|
className?: string;
|
|
28
34
|
/** The form control(s) */
|
|
@@ -32,7 +38,7 @@ interface FormFieldWrapperProps {
|
|
|
32
38
|
* FormFieldWrapper renders label, children (the control), description, and
|
|
33
39
|
* error in the standard vertical layout used by all form field components.
|
|
34
40
|
*/
|
|
35
|
-
declare function FormFieldWrapper({ inputId, label, description, error, required, compact, className, children, }: FormFieldWrapperProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
declare function FormFieldWrapper({ inputId, label, description, error, required, compact, labelPlacement, className, children, }: FormFieldWrapperProps): react_jsx_runtime.JSX.Element;
|
|
36
42
|
|
|
37
43
|
/**
|
|
38
44
|
* Shared utility functions for form field components.
|
|
@@ -78,6 +84,8 @@ interface FormInputProps extends React__default.ComponentPropsWithoutRef<typeof
|
|
|
78
84
|
* still communicated via a red border on the input.
|
|
79
85
|
*/
|
|
80
86
|
compact?: boolean;
|
|
87
|
+
/** Label placement: "vertical" (default, above) or "horizontal" (inline). */
|
|
88
|
+
labelPlacement?: "top" | "start";
|
|
81
89
|
}
|
|
82
90
|
/**
|
|
83
91
|
* FormInput component with label, description, and error handling
|
|
@@ -106,6 +114,8 @@ interface FormTextareaProps extends React__default.ComponentPropsWithoutRef<type
|
|
|
106
114
|
required?: boolean;
|
|
107
115
|
/** Additional class name for the wrapper */
|
|
108
116
|
wrapperClassName?: string;
|
|
117
|
+
/** Label placement: "vertical" (default, above) or "horizontal" (inline). */
|
|
118
|
+
labelPlacement?: "top" | "start";
|
|
109
119
|
/** Enable auto-resize behavior (default: false) */
|
|
110
120
|
autosize?: boolean;
|
|
111
121
|
/** Minimum number of rows when autosize is enabled (default: 3) */
|
|
@@ -163,6 +173,8 @@ interface FormNumberInputProps {
|
|
|
163
173
|
id?: string;
|
|
164
174
|
/** Input name */
|
|
165
175
|
name?: string;
|
|
176
|
+
/** Label placement: "vertical" (default, above) or "horizontal" (inline). */
|
|
177
|
+
labelPlacement?: "top" | "start";
|
|
166
178
|
}
|
|
167
179
|
declare const FormNumberInput: React__default.ForwardRefExoticComponent<FormNumberInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
168
180
|
|
|
@@ -381,6 +393,12 @@ interface ArrayItemTemplateProps {
|
|
|
381
393
|
disabled?: boolean;
|
|
382
394
|
layout: UILayoutConfig;
|
|
383
395
|
fieldCount: number;
|
|
396
|
+
/**
|
|
397
|
+
* Stable form-internal item id (_fid). Rendered as `data-fid` on the item
|
|
398
|
+
* container so tests can target a specific item across reorders (the
|
|
399
|
+
* positional `index` is not stable).
|
|
400
|
+
*/
|
|
401
|
+
fid?: string;
|
|
384
402
|
onRemove: () => void;
|
|
385
403
|
onMoveUp?: () => void;
|
|
386
404
|
onMoveDown?: () => void;
|
|
@@ -401,6 +419,33 @@ interface ObjectContainerTemplateProps {
|
|
|
401
419
|
variant?: string;
|
|
402
420
|
defaultOpen?: boolean;
|
|
403
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* One group of fields in a grouped layout (a tab, a wizard step, a section).
|
|
424
|
+
* `content` is already laid out -- the template only decides how groups are
|
|
425
|
+
* presented and navigated.
|
|
426
|
+
*/
|
|
427
|
+
interface FieldGroup {
|
|
428
|
+
/** Stable key for React and for the template's own selection state. */
|
|
429
|
+
key: string;
|
|
430
|
+
/** Label shown on the group's trigger, step header or section legend. */
|
|
431
|
+
label: string;
|
|
432
|
+
/** The group's rendered rows. */
|
|
433
|
+
content: React.ReactNode;
|
|
434
|
+
/** Validation errors owned by this group's fields (for a badge). */
|
|
435
|
+
errorCount: number;
|
|
436
|
+
}
|
|
437
|
+
/** Props passed to a GroupLayoutTemplate */
|
|
438
|
+
interface GroupLayoutTemplateProps {
|
|
439
|
+
/** The visible groups, in declaration order. Never empty. */
|
|
440
|
+
groups: FieldGroup[];
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Presents a set of field groups: as tabs, as a wizard, as an accordion --
|
|
444
|
+
* whatever the registered template renders. Selected by
|
|
445
|
+
* `x-ui-layout.variant`, which maps to a TemplateRegistry key, so consumers
|
|
446
|
+
* can register their own presentation without changing the renderer.
|
|
447
|
+
*/
|
|
448
|
+
type GroupLayoutTemplate = (props: GroupLayoutTemplateProps) => React.ReactElement;
|
|
404
449
|
type ArrayItemTemplate = (props: ArrayItemTemplateProps) => React.ReactElement;
|
|
405
450
|
type ArrayHeaderTemplate = (props: ArrayHeaderTemplateProps) => React.ReactElement | null;
|
|
406
451
|
type ObjectContainerTemplate = (props: ObjectContainerTemplateProps) => React.ReactElement;
|
|
@@ -417,6 +462,10 @@ type TemplateRegistry = {
|
|
|
417
462
|
HorizontalArrayItemTemplate?: ArrayItemTemplate;
|
|
418
463
|
ArrayHeaderTemplate?: ArrayHeaderTemplate;
|
|
419
464
|
ObjectContainerTemplate?: ObjectContainerTemplate;
|
|
465
|
+
/** Group presentations, selected by x-ui-layout.variant (default "tabs"). */
|
|
466
|
+
TabsGroupTemplate?: GroupLayoutTemplate;
|
|
467
|
+
StepperGroupTemplate?: GroupLayoutTemplate;
|
|
468
|
+
SectionsGroupTemplate?: GroupLayoutTemplate;
|
|
420
469
|
[templateName: string]: unknown;
|
|
421
470
|
};
|
|
422
471
|
|
|
@@ -432,6 +481,8 @@ interface FormSelectProps {
|
|
|
432
481
|
* still communicated via a red border on the trigger button.
|
|
433
482
|
*/
|
|
434
483
|
compact?: boolean;
|
|
484
|
+
/** Label placement: "vertical" (default, above) or "horizontal" (inline). */
|
|
485
|
+
labelPlacement?: "top" | "start";
|
|
435
486
|
options: SelectOption[];
|
|
436
487
|
value?: string | null;
|
|
437
488
|
onChange?: (value: string | null) => void;
|
|
@@ -447,6 +498,15 @@ interface FormSelectProps {
|
|
|
447
498
|
id?: string;
|
|
448
499
|
name?: string;
|
|
449
500
|
autoFocus?: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Allow creating a new option from the search text. When set, a
|
|
503
|
+
* `+ Create "<text>"` item appears at the bottom of the list whenever the
|
|
504
|
+
* trimmed search matches no existing option label (case-insensitive).
|
|
505
|
+
* Selecting it calls `onCreate(text)`. Requires `onCreate`.
|
|
506
|
+
*/
|
|
507
|
+
allowCreate?: boolean;
|
|
508
|
+
/** Called with the trimmed search text when the create item is chosen. */
|
|
509
|
+
onCreate?: (label: string) => void;
|
|
450
510
|
}
|
|
451
511
|
declare function FormSelect(props: FormSelectProps): react_jsx_runtime.JSX.Element;
|
|
452
512
|
|
|
@@ -458,6 +518,8 @@ interface FormMultiSelectProps {
|
|
|
458
518
|
error?: string;
|
|
459
519
|
required?: boolean;
|
|
460
520
|
wrapperClassName?: string;
|
|
521
|
+
/** Label placement: "vertical" (default, above) or "horizontal" (inline). */
|
|
522
|
+
labelPlacement?: "top" | "start";
|
|
461
523
|
options: SelectOption[];
|
|
462
524
|
value?: string[];
|
|
463
525
|
onChange?: (value: string[]) => void;
|
|
@@ -492,6 +554,8 @@ interface FormTagsInputProps {
|
|
|
492
554
|
error?: string;
|
|
493
555
|
required?: boolean;
|
|
494
556
|
wrapperClassName?: string;
|
|
557
|
+
/** Label placement: "vertical" (default, above) or "horizontal" (inline). */
|
|
558
|
+
labelPlacement?: "top" | "start";
|
|
495
559
|
id?: string;
|
|
496
560
|
name?: string;
|
|
497
561
|
value: string[];
|
|
@@ -580,6 +644,8 @@ interface FormQuantityInputProps {
|
|
|
580
644
|
autoFocus?: boolean;
|
|
581
645
|
/** Additional class name for the outer wrapper */
|
|
582
646
|
wrapperClassName?: string;
|
|
647
|
+
/** Label placement: "vertical" (default, above) or "horizontal" (inline). */
|
|
648
|
+
labelPlacement?: "top" | "start";
|
|
583
649
|
/** Additional class name for the numeric input */
|
|
584
650
|
className?: string;
|
|
585
651
|
id?: string;
|
|
@@ -804,6 +870,83 @@ declare function ArrayWidget({ propertySchema, value, onChange, registry, uiSche
|
|
|
804
870
|
|
|
805
871
|
declare function QuantityWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, placeholder, autofocus, options, }: WidgetProps): react_jsx_runtime.JSX.Element;
|
|
806
872
|
|
|
873
|
+
/**
|
|
874
|
+
* DateWidget - date field widget backed by the DateInput primitive.
|
|
875
|
+
*
|
|
876
|
+
* Renders a text input with calendar popover. Value is a partial ISO 8601 date
|
|
877
|
+
* string (`YYYY`, `YYYY-MM`, or `YYYY-MM-DD`). Auto-resolves from schema
|
|
878
|
+
* `format: "date"`, or `x-ui-widget: "date"`.
|
|
879
|
+
*
|
|
880
|
+
* x-ui-options:
|
|
881
|
+
* precision - "year" | "month" | "day" (default "day")
|
|
882
|
+
* locale - BCP-47 locale override (defaults to the app locale)
|
|
883
|
+
*
|
|
884
|
+
* The label/description chrome comes from FormFieldWrapper; the primitive owns
|
|
885
|
+
* the inline error message and invalid border.
|
|
886
|
+
*/
|
|
887
|
+
|
|
888
|
+
declare function DateWidget({ id, value, onChange, onBlur, required, disabled, rawErrors, label, description, placeholder, options, }: WidgetProps): React.ReactElement;
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* TimeWidget - time-of-day field widget backed by the TimeInput primitive.
|
|
892
|
+
*
|
|
893
|
+
* Zone-free time value as a normalized ISO string (`HH:mm` or `HH:mm:ss`).
|
|
894
|
+
* Auto-resolves from schema `format: "time"`, or `x-ui-widget: "time"`.
|
|
895
|
+
*
|
|
896
|
+
* x-ui-options:
|
|
897
|
+
* granularity - "minute" | "second" (default "minute")
|
|
898
|
+
*
|
|
899
|
+
* The label/description chrome comes from FormFieldWrapper; the primitive owns
|
|
900
|
+
* the inline error message and invalid border.
|
|
901
|
+
*/
|
|
902
|
+
|
|
903
|
+
declare function TimeWidget({ id, value, onChange, onBlur, required, disabled, rawErrors, label, description, placeholder, options, }: WidgetProps): React.ReactElement;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* DateTimeWidget - date + time field widget backed by the DateTimeInput primitive.
|
|
907
|
+
*
|
|
908
|
+
* Plain wall-clock value as an ISO string (`YYYY-MM-DDTHH:mm[:ss]`), no
|
|
909
|
+
* timezone. Auto-resolves from schema `format: "date-time"`, or
|
|
910
|
+
* `x-ui-widget: "date-time"`.
|
|
911
|
+
*
|
|
912
|
+
* x-ui-options:
|
|
913
|
+
* granularity - "minute" | "second" (default "minute")
|
|
914
|
+
* timeZone - IANA id shown as a display-only hint (never applied)
|
|
915
|
+
* locale - BCP-47 locale override for the date part
|
|
916
|
+
*
|
|
917
|
+
* The label/description chrome comes from FormFieldWrapper; the primitive owns
|
|
918
|
+
* the inline error message and invalid border.
|
|
919
|
+
*/
|
|
920
|
+
|
|
921
|
+
declare function DateTimeWidget({ id, value, onChange, onBlur, required, disabled, rawErrors, label, description, options, }: WidgetProps): React.ReactElement;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* DisplayWidget - read-only text block, no data binding.
|
|
925
|
+
*
|
|
926
|
+
* Renders a property's title (and optional description) as static text --
|
|
927
|
+
* instructions, notes, disclaimers placed between fields. Collects no value.
|
|
928
|
+
* Auto-resolves from `type: "null"`, or `x-ui-widget: "display"`.
|
|
929
|
+
*
|
|
930
|
+
* Modeled as a value-less property so it participates in field ordering and
|
|
931
|
+
* layout (appears exactly where placed). It never contributes to form data.
|
|
932
|
+
*/
|
|
933
|
+
|
|
934
|
+
declare function DisplayWidget({ label, description, }: WidgetProps): React.ReactElement | null;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* OneOfWidget -- renders a discriminated union (oneOf).
|
|
938
|
+
*
|
|
939
|
+
* A branch selector (reusing the Select primitive) chooses one of the property's
|
|
940
|
+
* `oneOf` branches; the selected branch's object sub-schema is then rendered as
|
|
941
|
+
* a nested sub-form (same pattern as ObjectWidget). The active branch is tracked
|
|
942
|
+
* by the discriminator property (see the oneOf helpers in
|
|
943
|
+
* @petrarca/sonnet-core/schema).
|
|
944
|
+
*
|
|
945
|
+
* Auto-resolves when a property has `oneOf`, or via `x-ui-widget: "one-of"`.
|
|
946
|
+
*/
|
|
947
|
+
|
|
948
|
+
declare function OneOfWidget({ propertySchema, value, onChange, registry, uiSchema, disabled, readonly, label, description, id, options, }: WidgetProps): React.ReactElement | null;
|
|
949
|
+
|
|
807
950
|
/**
|
|
808
951
|
* Widget Resolution Algorithm
|
|
809
952
|
*
|
|
@@ -935,6 +1078,19 @@ type JsonSchemaFormRendererProps = {
|
|
|
935
1078
|
readOnly?: boolean;
|
|
936
1079
|
/** Show Save/Cancel action buttons */
|
|
937
1080
|
showActions?: boolean;
|
|
1081
|
+
/**
|
|
1082
|
+
* Allow Save when the form is pristine (no changes vs the baseline). Set for
|
|
1083
|
+
* CREATE forms, where submitting default / empty values is valid -- the
|
|
1084
|
+
* "must have changed something" dirty-check is an edit-only concept. Required-
|
|
1085
|
+
* field validation still applies. Default false (edit semantics).
|
|
1086
|
+
*/
|
|
1087
|
+
allowPristineSave?: boolean;
|
|
1088
|
+
/**
|
|
1089
|
+
* Optional resolver for non-local `$ref`s (schema-registry id / canonical
|
|
1090
|
+
* URI). Tried before the in-document `$defs` fallback. Synchronous -- the
|
|
1091
|
+
* caller pre-loads referenced schemas into a map and passes a lookup.
|
|
1092
|
+
*/
|
|
1093
|
+
refResolver?: RefResolver;
|
|
938
1094
|
/** Label for Save button (default: "Save") */
|
|
939
1095
|
saveLabel?: string;
|
|
940
1096
|
/** Label for Cancel button (default: "Cancel") */
|
|
@@ -981,6 +1137,12 @@ type JsonSchemaFormRendererProps = {
|
|
|
981
1137
|
uiSchema?: {
|
|
982
1138
|
[fieldName: string]: UISchema;
|
|
983
1139
|
};
|
|
1140
|
+
/**
|
|
1141
|
+
* Prefix for generated field control ids: `<idPrefix>-<fieldName>` (default
|
|
1142
|
+
* "field"). Set a distinct prefix per form when rendering multiple forms on
|
|
1143
|
+
* one page to avoid duplicate DOM ids.
|
|
1144
|
+
*/
|
|
1145
|
+
idPrefix?: string;
|
|
984
1146
|
};
|
|
985
1147
|
declare function JsonSchemaFormRenderer(props: JsonSchemaFormRendererProps): React__default.ReactElement;
|
|
986
1148
|
|
|
@@ -1009,8 +1171,14 @@ interface FormFieldRendererProps {
|
|
|
1009
1171
|
registry: WidgetRegistry;
|
|
1010
1172
|
globalOptions?: UISchemaOptions;
|
|
1011
1173
|
formData?: Record<string, unknown>;
|
|
1174
|
+
/**
|
|
1175
|
+
* Prefix for generated control ids: `<idPrefix>-<fieldName>` (default
|
|
1176
|
+
* "field"). Set a per-form prefix when rendering multiple forms on one page
|
|
1177
|
+
* to keep ids unique.
|
|
1178
|
+
*/
|
|
1179
|
+
idPrefix?: string;
|
|
1012
1180
|
}
|
|
1013
|
-
declare function FormFieldRenderer({ fieldName, property, value, onChange, onBlur, required, disabled, readOnly, schema, uiSchema, registry, globalOptions, formData, }: FormFieldRendererProps): React__default.ReactElement | null;
|
|
1181
|
+
declare function FormFieldRenderer({ fieldName, property, value, onChange, onBlur, required, disabled, readOnly, schema, uiSchema, registry, globalOptions, formData, idPrefix, }: FormFieldRendererProps): React__default.ReactElement | null;
|
|
1014
1182
|
|
|
1015
1183
|
/**
|
|
1016
1184
|
* useFormEngine - Core form state, schema resolution, and update-mode logic
|
|
@@ -1047,6 +1215,19 @@ interface UseFormEngineOptions {
|
|
|
1047
1215
|
showActions?: boolean;
|
|
1048
1216
|
deferChanges?: boolean;
|
|
1049
1217
|
deferStateUpdates?: boolean;
|
|
1218
|
+
/**
|
|
1219
|
+
* Allow saving when the form is pristine (no changes vs the baseline). Use for
|
|
1220
|
+
* CREATE forms, where submitting default / empty values is valid -- the
|
|
1221
|
+
* "must have changed something" dirty-check is an edit-only concept.
|
|
1222
|
+
* Validation (required fields) still applies. Default false (edit semantics).
|
|
1223
|
+
*/
|
|
1224
|
+
allowPristineSave?: boolean;
|
|
1225
|
+
/**
|
|
1226
|
+
* Optional resolver for non-local `$ref`s (e.g. a schema-registry id or
|
|
1227
|
+
* canonical URI). Tried before the in-document `$defs` fallback. Must be
|
|
1228
|
+
* synchronous -- pre-load referenced schemas into a map and pass a lookup.
|
|
1229
|
+
*/
|
|
1230
|
+
refResolver?: RefResolver;
|
|
1050
1231
|
}
|
|
1051
1232
|
interface UseFormEngineResult {
|
|
1052
1233
|
/** The current working form data (for controlled field values) */
|
|
@@ -1062,12 +1243,17 @@ interface UseFormEngineResult {
|
|
|
1062
1243
|
orderedProperties: [string, JsonSchemaProperty][];
|
|
1063
1244
|
hasChanges: boolean;
|
|
1064
1245
|
isValid: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Current validation errors, each attributed to its field by JSON Pointer.
|
|
1248
|
+
* Lets the renderer surface problems for fields that are not on screen.
|
|
1249
|
+
*/
|
|
1250
|
+
fieldErrors: FieldError[];
|
|
1065
1251
|
handleFieldChange: (fieldName: string, value: any) => void;
|
|
1066
1252
|
handleFieldBlur: (fieldName: string) => void;
|
|
1067
1253
|
handleSave: () => void;
|
|
1068
1254
|
handleCancel: () => void;
|
|
1069
1255
|
}
|
|
1070
|
-
declare function useFormEngine({ schema, data, uiSchema, onChange, onBlur, onValidationChange, onUpdate, onCancel, readOnly, showActions, deferChanges, deferStateUpdates, }: UseFormEngineOptions): UseFormEngineResult;
|
|
1256
|
+
declare function useFormEngine({ schema, data, uiSchema, onChange, onBlur, onValidationChange, onUpdate, onCancel, readOnly, showActions, deferChanges, deferStateUpdates, allowPristineSave, refResolver, }: UseFormEngineOptions): UseFormEngineResult;
|
|
1071
1257
|
|
|
1072
1258
|
/**
|
|
1073
1259
|
* useResolvedSchema - Schema resolution and property ordering
|
|
@@ -1129,6 +1315,63 @@ interface NestedFormContextValue {
|
|
|
1129
1315
|
|
|
1130
1316
|
declare function useNestedFormContext(): NestedFormContextValue;
|
|
1131
1317
|
|
|
1318
|
+
/**
|
|
1319
|
+
* TabsGroupTemplate -- presents field groups as a tab bar (the default for
|
|
1320
|
+
* `x-ui-layout.tabs`).
|
|
1321
|
+
*
|
|
1322
|
+
* Selection is controlled and clamped to a group that still exists, so hiding
|
|
1323
|
+
* the group the user is on (via its rule) falls back to the first remaining one
|
|
1324
|
+
* instead of leaving an empty body.
|
|
1325
|
+
*/
|
|
1326
|
+
|
|
1327
|
+
declare function TabsGroupTemplate({ groups, }: GroupLayoutTemplateProps): React__default.ReactElement;
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* StepperGroupTemplate -- presents field groups as a wizard
|
|
1331
|
+
* (`x-ui-layout.variant: "stepper"`).
|
|
1332
|
+
*
|
|
1333
|
+
* Same group model as the tab presentation, different chrome: a numbered step
|
|
1334
|
+
* rail plus Back/Next. Steps stay directly clickable so the user is never
|
|
1335
|
+
* trapped; validation gating is deliberately not applied here, because a
|
|
1336
|
+
* group's errors are advisory (the badge) rather than a hard barrier.
|
|
1337
|
+
*
|
|
1338
|
+
* Selection is controlled and clamped to a group that still exists, so hiding
|
|
1339
|
+
* the step the user is on falls back to the first remaining one.
|
|
1340
|
+
*/
|
|
1341
|
+
|
|
1342
|
+
declare function StepperGroupTemplate({ groups, }: GroupLayoutTemplateProps): React__default.ReactElement;
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* SectionsGroupTemplate -- presents field groups as stacked titled sections
|
|
1346
|
+
* (`x-ui-layout.variant: "sections"`).
|
|
1347
|
+
*
|
|
1348
|
+
* Unlike tabs and stepper, every group is visible at once. This is the
|
|
1349
|
+
* multi-row counterpart to a row's `group` fieldset: a section holds as many
|
|
1350
|
+
* rows as it likes, whereas `row.group` wraps exactly one.
|
|
1351
|
+
*
|
|
1352
|
+
* No selection state, so nothing to clamp -- a group hidden by its rule simply
|
|
1353
|
+
* does not appear.
|
|
1354
|
+
*/
|
|
1355
|
+
|
|
1356
|
+
declare function SectionsGroupTemplate({ groups, }: GroupLayoutTemplateProps): React__default.ReactElement;
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* GroupErrorBadge -- marks a group's trigger (tab or step) as having
|
|
1360
|
+
* validation errors. Shared by the built-in group templates.
|
|
1361
|
+
*
|
|
1362
|
+
* Deliberately just the icon: a trigger sits in a dense strip alongside its
|
|
1363
|
+
* label and, in a stepper, a step number, so a second numeral reads as clutter
|
|
1364
|
+
* and competes with the step index. The exact count stays available as the
|
|
1365
|
+
* accessible name and the tooltip, and the form-level summary reports totals.
|
|
1366
|
+
*
|
|
1367
|
+
* The signal is a shape, not a colour, so it survives a colour-vision
|
|
1368
|
+
* deficiency or a greyscale print.
|
|
1369
|
+
*/
|
|
1370
|
+
|
|
1371
|
+
declare function GroupErrorBadge({ count, }: {
|
|
1372
|
+
count: number;
|
|
1373
|
+
}): React__default.ReactElement | null;
|
|
1374
|
+
|
|
1132
1375
|
/**
|
|
1133
1376
|
* Default templates for structural layout rendering.
|
|
1134
1377
|
*
|
|
@@ -1146,5 +1389,12 @@ declare function useNestedFormContext(): NestedFormContextValue;
|
|
|
1146
1389
|
* schema property for per-field overrides.
|
|
1147
1390
|
*/
|
|
1148
1391
|
declare const DEFAULT_TEMPLATES: TemplateRegistry;
|
|
1392
|
+
/**
|
|
1393
|
+
* The TemplateRegistry key for a group-layout variant. The variant name maps
|
|
1394
|
+
* directly to a template name, so a consumer can register
|
|
1395
|
+
* `WizardGroupTemplate` and select it with `variant: "wizard"` -- no library
|
|
1396
|
+
* change needed. Unknown variants fall back to the tab presentation.
|
|
1397
|
+
*/
|
|
1398
|
+
declare function groupTemplateKey(variant: string | undefined): string;
|
|
1149
1399
|
|
|
1150
|
-
export { type ArrayHeaderTemplate, type ArrayHeaderTemplateProps, type ArrayItemTemplate, type ArrayItemTemplateProps, ArrayWidget, CheckboxWidget, DEFAULT_TEMPLATES, DEFAULT_WIDGETS, DEFAULT_WIDGET_MAP, EntitySelectWidget, ExtraPropertiesCard, FormActions, FormCheckbox, FormFieldRenderer, FormFieldWrapper, type FormFieldWrapperProps, FormInput, FormMultiSelect, FormNumberInput, FormQuantityInput, FormSelect, FormTagsInput, FormTextarea, JsonEditorWidget, JsonSchemaFormRenderer, type JsonSchemaFormRendererProps, type NestedFormContextValue, type NestedRenderer, NumberWidget, type ObjectContainerTemplate, type ObjectContainerTemplateProps, ObjectWidget, type QuantityValue, QuantityWidget, type SelectOption, SelectWidget, TagsInputWidget, type TemplateRegistry, TextInputWidget, TextareaWidget, type UnitOption, type UnitPosition, type Widget, type WidgetDescriptor, type WidgetMap, type WidgetProps, type WidgetRegistry, firstError, getAriaDescribedBy, getDefaultWidgetForType, resolveWidget, useFormEngine, useNestedFormContext, useResolvedSchema };
|
|
1400
|
+
export { type ArrayHeaderTemplate, type ArrayHeaderTemplateProps, type ArrayItemTemplate, type ArrayItemTemplateProps, ArrayWidget, CheckboxWidget, DEFAULT_TEMPLATES, DEFAULT_WIDGETS, DEFAULT_WIDGET_MAP, DateTimeWidget, DateWidget, DisplayWidget, EntitySelectWidget, ExtraPropertiesCard, type FieldGroup, FormActions, FormCheckbox, FormFieldRenderer, FormFieldWrapper, type FormFieldWrapperProps, FormInput, FormMultiSelect, FormNumberInput, FormQuantityInput, FormSelect, FormTagsInput, FormTextarea, GroupErrorBadge, type GroupLayoutTemplate, type GroupLayoutTemplateProps, JsonEditorWidget, JsonSchemaFormRenderer, type JsonSchemaFormRendererProps, type NestedFormContextValue, type NestedRenderer, NumberWidget, type ObjectContainerTemplate, type ObjectContainerTemplateProps, ObjectWidget, OneOfWidget, type QuantityValue, QuantityWidget, SectionsGroupTemplate, type SelectOption, SelectWidget, StepperGroupTemplate, TabsGroupTemplate, TagsInputWidget, type TemplateRegistry, TextInputWidget, TextareaWidget, TimeWidget, type UnitOption, type UnitPosition, type Widget, type WidgetDescriptor, type WidgetMap, type WidgetProps, type WidgetRegistry, firstError, getAriaDescribedBy, getDefaultWidgetForType, groupTemplateKey, resolveWidget, useFormEngine, useNestedFormContext, useResolvedSchema };
|