@petrarca/sonnet-forms 0.8.0 → 0.9.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 +2 -2
- package/dist/index.d.ts +229 -19
- package/dist/index.js +2468 -451
- package/dist/index.js.map +1 -1
- package/dist/widget-options.d.ts +2 -1
- package/dist/widget-options.js +74 -1
- package/dist/widget-options.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ labelled, validated controls.
|
|
|
10
10
|
flattening against the current values, schema defaults, nested objects and
|
|
11
11
|
arrays, buffered or live editing, and a change set on save.
|
|
12
12
|
|
|
13
|
-
**A widget registry.**
|
|
14
|
-
quantities, enums, checkboxes, tags, arrays, objects, entity references and
|
|
13
|
+
**A widget registry.** Twenty-two built-in controls covering text, numbers,
|
|
14
|
+
quantities, coded values and codeable concepts, dates and times, enums, checkboxes, tags, arrays, objects, entity references and
|
|
15
15
|
embedded JSON, plus your own controls keyed by `x-ui-widget`. A parallel
|
|
16
16
|
template registry makes the structure around a field -- the array-item row, the
|
|
17
17
|
object container, the group chrome -- replaceable without touching the widgets.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React$1 from 'react';
|
|
3
2
|
import React__default, { ComponentType, ReactNode } from 'react';
|
|
4
3
|
import { Input, Textarea, badgeVariants } from '@petrarca/sonnet-ui';
|
|
5
|
-
import {
|
|
4
|
+
import { JsonSchema, JsonSchemaProperty, UISchema, UISchemaOptions, UILayoutConfig, FieldError, FormDiff, RefResolver } from '@petrarca/sonnet-core/schema';
|
|
6
5
|
export { UISchema, UISchemaOptions } from '@petrarca/sonnet-core/schema';
|
|
7
6
|
import { VariantProps } from 'class-variance-authority';
|
|
8
7
|
import { SaveWhenInvalid, ValidationDisplay } from '@petrarca/sonnet-core/config';
|
|
9
8
|
|
|
9
|
+
/**
|
|
10
|
+
* FormFieldWrapper - Shared label / description / error chrome for form fields.
|
|
11
|
+
*
|
|
12
|
+
* Eliminates duplication across FormInput, FormNumberInput, FormQuantityInput,
|
|
13
|
+
* etc. Each field component renders its control as `children` and delegates
|
|
14
|
+
* the surrounding chrome here.
|
|
15
|
+
*
|
|
16
|
+
* Supports two modes:
|
|
17
|
+
* - Normal: label, children, description, error displayed vertically
|
|
18
|
+
* - Compact: suppresses label, description, error text (for grid layouts)
|
|
19
|
+
*/
|
|
20
|
+
|
|
10
21
|
interface FormFieldWrapperProps {
|
|
11
22
|
/** Field id -- wired to the label's htmlFor */
|
|
12
23
|
inputId: string;
|
|
@@ -39,7 +50,7 @@ interface FormFieldWrapperProps {
|
|
|
39
50
|
* FormFieldWrapper renders label, children (the control), description, and
|
|
40
51
|
* error in the standard vertical layout used by all form field components.
|
|
41
52
|
*/
|
|
42
|
-
declare function FormFieldWrapper({ inputId, label, description, error, required, compact, labelPlacement, className, children, }: FormFieldWrapperProps):
|
|
53
|
+
declare function FormFieldWrapper({ inputId, label, description, error, required, compact, labelPlacement, className, children, }: FormFieldWrapperProps): React__default.JSX.Element;
|
|
43
54
|
|
|
44
55
|
/**
|
|
45
56
|
* Shared utility functions for form field components.
|
|
@@ -470,6 +481,14 @@ type TemplateRegistry = {
|
|
|
470
481
|
[templateName: string]: unknown;
|
|
471
482
|
};
|
|
472
483
|
|
|
484
|
+
/**
|
|
485
|
+
* FormSelect - Searchable single-select dropdown with form field wrapper
|
|
486
|
+
*
|
|
487
|
+
* Composable select component using Popover + Command for searchable,
|
|
488
|
+
* keyboard-navigable dropdown. Follows Form wrapper pattern with
|
|
489
|
+
* label, description, error support.
|
|
490
|
+
*/
|
|
491
|
+
|
|
473
492
|
interface FormSelectProps {
|
|
474
493
|
label?: string | false;
|
|
475
494
|
description?: string;
|
|
@@ -509,7 +528,15 @@ interface FormSelectProps {
|
|
|
509
528
|
/** Called with the trimmed search text when the create item is chosen. */
|
|
510
529
|
onCreate?: (label: string) => void;
|
|
511
530
|
}
|
|
512
|
-
declare function FormSelect(props: FormSelectProps):
|
|
531
|
+
declare function FormSelect(props: FormSelectProps): React$1.JSX.Element;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* FormMultiSelect - Searchable multi-select dropdown with badges
|
|
535
|
+
*
|
|
536
|
+
* Multi-select component using Popover + Command with badge display
|
|
537
|
+
* for selected items. Follows Form wrapper pattern with label,
|
|
538
|
+
* description, error support.
|
|
539
|
+
*/
|
|
513
540
|
|
|
514
541
|
type BadgeColor = NonNullable<VariantProps<typeof badgeVariants>["badgeColor"]>;
|
|
515
542
|
|
|
@@ -539,7 +566,7 @@ interface FormMultiSelectProps {
|
|
|
539
566
|
maxDisplay?: number;
|
|
540
567
|
badgeColor?: BadgeColor;
|
|
541
568
|
}
|
|
542
|
-
declare function FormMultiSelect(props: FormMultiSelectProps):
|
|
569
|
+
declare function FormMultiSelect(props: FormMultiSelectProps): React$1.JSX.Element;
|
|
543
570
|
|
|
544
571
|
/**
|
|
545
572
|
* FormTagsInput - Input field for managing tags with badges
|
|
@@ -570,6 +597,59 @@ interface FormTagsInputProps {
|
|
|
570
597
|
}
|
|
571
598
|
declare const FormTagsInput: React$1.ForwardRefExoticComponent<FormTagsInputProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
572
599
|
|
|
600
|
+
/**
|
|
601
|
+
* FormKeyValueInput - Input for a map of string keys to string values
|
|
602
|
+
*
|
|
603
|
+
* Each pair is entered in two fields (key, value) and added with Enter or the
|
|
604
|
+
* add button. A key is unique: adding it again replaces its value. The entered
|
|
605
|
+
* pairs are displayed one of two ways (`display`):
|
|
606
|
+
*
|
|
607
|
+
* tags (default) as "key:value" tags -- for short labels. Clicking a tag
|
|
608
|
+
* loads it back into the fields to edit it; its X removes it.
|
|
609
|
+
* rows as a list, a row per pair: its key and value editable in
|
|
610
|
+
* place (taken on leaving the field or Enter), a remove
|
|
611
|
+
* button -- for values too long or too many to read as tags,
|
|
612
|
+
* such as templates or paths.
|
|
613
|
+
|
|
614
|
+
* keys only the keys, as badges, each value on hover -- a compact
|
|
615
|
+
* summary, not edited (the host edits the pairs elsewhere,
|
|
616
|
+
* e.g. as rows in a dialog).
|
|
617
|
+
*
|
|
618
|
+
* `valueSuggestions` offers values to pick in the value fields (still free to
|
|
619
|
+
* type) -- e.g. the references a value may name.
|
|
620
|
+
*
|
|
621
|
+
* Follows the Form wrapper pattern with label, description, error support.
|
|
622
|
+
*/
|
|
623
|
+
|
|
624
|
+
interface FormKeyValueInputProps {
|
|
625
|
+
label?: string | false;
|
|
626
|
+
description?: string;
|
|
627
|
+
error?: string;
|
|
628
|
+
required?: boolean;
|
|
629
|
+
wrapperClassName?: string;
|
|
630
|
+
labelPlacement?: "top" | "start";
|
|
631
|
+
id?: string;
|
|
632
|
+
name?: string;
|
|
633
|
+
value: Record<string, string>;
|
|
634
|
+
onChange?: (value: Record<string, string>) => void;
|
|
635
|
+
disabled?: boolean;
|
|
636
|
+
readOnly?: boolean;
|
|
637
|
+
/** Placeholders of the two fields. Default "Key" / "Value". */
|
|
638
|
+
keyPlaceholder?: string;
|
|
639
|
+
valuePlaceholder?: string;
|
|
640
|
+
/** How a pair is shown as a tag. Default ":" ("key:value"). */
|
|
641
|
+
separator?: string;
|
|
642
|
+
/** How the pairs are displayed: as tags (default), as rows, or only their
|
|
643
|
+
* keys (a summary, not edited). */
|
|
644
|
+
display?: "tags" | "rows" | "keys";
|
|
645
|
+
/** Values the value fields suggest; one may still type any other. */
|
|
646
|
+
valueSuggestions?: {
|
|
647
|
+
value: string;
|
|
648
|
+
label?: string;
|
|
649
|
+
}[];
|
|
650
|
+
}
|
|
651
|
+
declare const FormKeyValueInput: React$1.ForwardRefExoticComponent<FormKeyValueInputProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
652
|
+
|
|
573
653
|
/**
|
|
574
654
|
* FormQuantityInput - Compound input for a numeric value paired with a unit selector.
|
|
575
655
|
*
|
|
@@ -612,8 +692,10 @@ interface FormQuantityInputProps {
|
|
|
612
692
|
onChange?: (value: QuantityValue) => void;
|
|
613
693
|
/** Blur handler */
|
|
614
694
|
onBlur?: () => void;
|
|
615
|
-
/** Available unit options. Single = static text, 2+ = dropdown, none = no addon. */
|
|
695
|
+
/** Available unit options. Single = static text, 2+ = dropdown, none = no addon (or a typed unit, with `freeUnit`). */
|
|
616
696
|
units?: UnitOption[];
|
|
697
|
+
/** Without units, the unit is typed -- a code such as `kg`. Default false: no unit at all. */
|
|
698
|
+
freeUnit?: boolean;
|
|
617
699
|
/**
|
|
618
700
|
* Default position for all units. Individual UnitOption.position overrides
|
|
619
701
|
* this. Default: "suffix".
|
|
@@ -684,7 +766,7 @@ interface FormActionsProps {
|
|
|
684
766
|
*/
|
|
685
767
|
leadingActions?: ReactNode;
|
|
686
768
|
}
|
|
687
|
-
declare function FormActions({ onSave, onCancel, disabled, hasChanges, isValid, saveWhenInvalid, saveLabel, cancelLabel, showCancel, isValidating, leadingActions, }: FormActionsProps):
|
|
769
|
+
declare function FormActions({ onSave, onCancel, disabled, hasChanges, isValid, saveWhenInvalid, saveLabel, cancelLabel, showCancel, isValidating, leadingActions, }: FormActionsProps): React$1.JSX.Element;
|
|
688
770
|
|
|
689
771
|
type Props = {
|
|
690
772
|
properties: Record<string, any>;
|
|
@@ -697,7 +779,7 @@ type Props = {
|
|
|
697
779
|
* This is a generic component that can be used anywhere a schema and properties
|
|
698
780
|
* need to be compared to show additional/extra properties.
|
|
699
781
|
*/
|
|
700
|
-
declare function ExtraPropertiesCard({ properties, schema }: Props):
|
|
782
|
+
declare function ExtraPropertiesCard({ properties, schema }: Props): React$1.JSX.Element | null;
|
|
701
783
|
|
|
702
784
|
/**
|
|
703
785
|
* TextInputWidget - Standard text input widget
|
|
@@ -728,7 +810,7 @@ declare function TextInputWidget({ id, name, value, onChange, onBlur, propertySc
|
|
|
728
810
|
*
|
|
729
811
|
* @param props - WidgetProps
|
|
730
812
|
*/
|
|
731
|
-
declare function TextareaWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, placeholder, autofocus, options, }: WidgetProps):
|
|
813
|
+
declare function TextareaWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, placeholder, autofocus, options, }: WidgetProps): React$1.JSX.Element;
|
|
732
814
|
|
|
733
815
|
/**
|
|
734
816
|
* NumberWidget renders a number input field.
|
|
@@ -741,7 +823,7 @@ declare function TextareaWidget({ id, name, value, onChange, onBlur, propertySch
|
|
|
741
823
|
*
|
|
742
824
|
* @param props - WidgetProps
|
|
743
825
|
*/
|
|
744
|
-
declare function NumberWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, placeholder, autofocus, options, }: WidgetProps):
|
|
826
|
+
declare function NumberWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, placeholder, autofocus, options, }: WidgetProps): React$1.JSX.Element;
|
|
745
827
|
|
|
746
828
|
/**
|
|
747
829
|
* CheckboxWidget - Boolean checkbox widget
|
|
@@ -750,7 +832,8 @@ declare function NumberWidget({ id, name, value, onChange, onBlur, propertySchem
|
|
|
750
832
|
* Used for boolean type fields.
|
|
751
833
|
*
|
|
752
834
|
* Supports tri-state behavior for nullable boolean fields (anyOf[boolean, null]):
|
|
753
|
-
* - null (indeterminate) -> true (checked) -> false (unchecked) -> null
|
|
835
|
+
* - null or no value (indeterminate) -> true (checked) -> false (unchecked) -> null
|
|
836
|
+
* No value is shown as null is: not answered -- unchecked would read as "no".
|
|
754
837
|
*/
|
|
755
838
|
|
|
756
839
|
/**
|
|
@@ -763,13 +846,13 @@ declare function NumberWidget({ id, name, value, onChange, onBlur, propertySchem
|
|
|
763
846
|
* - Description text
|
|
764
847
|
*
|
|
765
848
|
* Tri-state behavior (when anyOf[boolean, null] is detected):
|
|
766
|
-
* - Click on null -> becomes true
|
|
849
|
+
* - Click on null, or no value -> becomes true
|
|
767
850
|
* - Click on true -> becomes false
|
|
768
851
|
* - Click on false -> becomes null
|
|
769
852
|
*/
|
|
770
853
|
declare function CheckboxWidget({ id, value, onChange, onBlur, disabled, readonly, rawErrors, label, description, autofocus, propertySchema, options, }: WidgetProps): React.ReactElement;
|
|
771
854
|
|
|
772
|
-
declare function SelectWidget(props: WidgetProps):
|
|
855
|
+
declare function SelectWidget(props: WidgetProps): React$1.JSX.Element;
|
|
773
856
|
|
|
774
857
|
/**
|
|
775
858
|
* TagsInputWidget - Free-text tag input widget
|
|
@@ -810,9 +893,24 @@ declare function TagsInputWidget({ id, name, value, onChange, required, disabled
|
|
|
810
893
|
* - Full document editing (no readonly regions)
|
|
811
894
|
* - Invalid JSON is silently retained until fixed
|
|
812
895
|
* - Height configurable via x-ui-options.height (default: "240px")
|
|
896
|
+
* - The editor loads on first use (a placeholder of that height meanwhile)
|
|
813
897
|
*/
|
|
814
898
|
declare function JsonEditorWidget({ id, value, onChange, label, description, required, options, }: WidgetProps): React__default.ReactElement;
|
|
815
899
|
|
|
900
|
+
/**
|
|
901
|
+
* KeyValueWidget - Key-value pair input widget
|
|
902
|
+
*
|
|
903
|
+
* Renders FormKeyValueInput for an object of string values (a free map such as
|
|
904
|
+
* labels: `additionalProperties: { type: "string" }`, no declared properties).
|
|
905
|
+
* Pairs are entered in a key and a value field and shown as "key:value" tags,
|
|
906
|
+
* or -- `x-ui-options: { display: "rows" }` -- as rows edited in place, for long
|
|
907
|
+
* values such as templates or paths, or -- `display: "keys"` -- only the keys,
|
|
908
|
+
* a summary not edited. Chosen automatically for such maps;
|
|
909
|
+
* explicitly via x-ui-widget: "key-value".
|
|
910
|
+
*/
|
|
911
|
+
|
|
912
|
+
declare function KeyValueWidget({ id, name, value, onChange, required, disabled, readonly, rawErrors, label, description, options, }: WidgetProps): React__default.ReactElement;
|
|
913
|
+
|
|
816
914
|
/**
|
|
817
915
|
* EntitySelectWidget -- form widget for async entity reference selection.
|
|
818
916
|
*
|
|
@@ -878,9 +976,68 @@ declare function ObjectWidget({ id, propertySchema, value, onChange, onBlur, reg
|
|
|
878
976
|
* never leave the renderer boundary.
|
|
879
977
|
*/
|
|
880
978
|
|
|
881
|
-
declare function ArrayWidget({ propertySchema, value, onChange, registry, uiSchema, disabled, readonly, label, description, options, schema, name, }: WidgetProps): React.ReactElement;
|
|
979
|
+
declare function ArrayWidget({ propertySchema, value, onChange, registry, uiSchema, disabled, readonly, label, description, options, schema, name, onBlur, }: WidgetProps): React.ReactElement;
|
|
882
980
|
|
|
883
|
-
declare function QuantityWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, placeholder, autofocus, options, }: WidgetProps):
|
|
981
|
+
declare function QuantityWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, placeholder, autofocus, options, }: WidgetProps): React$1.JSX.Element;
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* CodedValueWidget -- a code from a list someone else maintains, asked of the
|
|
985
|
+
* application's terminology service (`TerminologyProvider`).
|
|
986
|
+
*
|
|
987
|
+
* The list is the field's binding (`x-binding`: a value set or a code system,
|
|
988
|
+
* its strength). What is stored the field's type decides: the core coding type
|
|
989
|
+
* stores `{ system, code, version?, display? }`; a string bound to a list stores
|
|
990
|
+
* the code alone, its label looked up to show it; a coding or a text (`anyOf`,
|
|
991
|
+
* an open list) stores a coding, or a text of one's own as a plain string --
|
|
992
|
+
* never a coding without its code. An array of any of them takes several
|
|
993
|
+
* answers, shown as chips. The first search decides whether the list is shown
|
|
994
|
+
* whole (it fits one page) or searched; a hit shows its code and, when the
|
|
995
|
+
* service gives it, its path. An open list -- a coding or a text, or an
|
|
996
|
+
* `extensible` binding on a string -- takes a typed text no code fits.
|
|
997
|
+
*
|
|
998
|
+
* Registered as x-ui-widget: "coded-value"; the core coding type carries that
|
|
999
|
+
* hint, and a string, a coding or a text, or an array bound to a list resolves
|
|
1000
|
+
* to it without one.
|
|
1001
|
+
*
|
|
1002
|
+
* x-ui-options:
|
|
1003
|
+
* mode - "list" | "search": overrides what the list's size decides
|
|
1004
|
+
* minChars - the characters a search waits for (default 1)
|
|
1005
|
+
* store - the hit's property a code-only field stores (default "code")
|
|
1006
|
+
* keep - properties of a hit a coding keeps beside its own -- an
|
|
1007
|
+
* application's, which its service returns on its hits
|
|
1008
|
+
*
|
|
1009
|
+
* See docs/design/coded-values.md (workspace).
|
|
1010
|
+
*/
|
|
1011
|
+
|
|
1012
|
+
declare function CodedValueWidget(props: WidgetProps): React$1.ReactElement;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* CodeableConceptWidget -- one concept, coded in the field's lists, compact:
|
|
1016
|
+
* the coded-value picker on the first list, and one line of chips for the
|
|
1017
|
+
* codings of the others -- as clinical systems show a concept: its term, the
|
|
1018
|
+
* other codes beside it.
|
|
1019
|
+
*
|
|
1020
|
+
* [ Glucose [Mass/volume] in Serum or Plasma 2345-7 v ]
|
|
1021
|
+
* [Lab GLU-S x] [Registry *] + Coding + Text
|
|
1022
|
+
*
|
|
1023
|
+
* A chip -- or "+ Coding", for a list without one -- opens the same search on
|
|
1024
|
+
* its list. What a person picks is stored as theirs (`userSelected`), with the
|
|
1025
|
+
* list's purpose; a required list without a coding shows as an empty chip. A
|
|
1026
|
+
* coding of a list the field does not name is shown and kept, never dropped.
|
|
1027
|
+
*
|
|
1028
|
+
* The lists are the field's binding (`x-binding`): the first, then
|
|
1029
|
+
* `additional`. Registered as x-ui-widget: "codeable-concept"; the core
|
|
1030
|
+
* codeable concept type carries that hint.
|
|
1031
|
+
*
|
|
1032
|
+
* x-ui-options:
|
|
1033
|
+
* text - offer the text (default: when the first list is extensible)
|
|
1034
|
+
* mode - "list" | "search", for every list (default: each list's size decides)
|
|
1035
|
+
* minChars - the characters a search waits for
|
|
1036
|
+
*
|
|
1037
|
+
* See docs/design/codeable-concepts.md (workspace).
|
|
1038
|
+
*/
|
|
1039
|
+
|
|
1040
|
+
declare function CodeableConceptWidget(props: WidgetProps): React$1.ReactElement;
|
|
884
1041
|
|
|
885
1042
|
/**
|
|
886
1043
|
* DateWidget - date field widget backed by the DateInput primitive.
|
|
@@ -889,6 +1046,9 @@ declare function QuantityWidget({ id, name, value, onChange, onBlur, propertySch
|
|
|
889
1046
|
* string (`YYYY`, `YYYY-MM`, or `YYYY-MM-DD`). Auto-resolves from schema
|
|
890
1047
|
* `format: "date"`, or `x-ui-widget: "date"`.
|
|
891
1048
|
*
|
|
1049
|
+
* Its range is the schema's `formatMinimum` / `formatMaximum`: the calendar
|
|
1050
|
+
* offers only the dates between; validation names a typed one outside.
|
|
1051
|
+
*
|
|
892
1052
|
* x-ui-options:
|
|
893
1053
|
* precision - "year" | "month" | "day" (default "day")
|
|
894
1054
|
* locale - BCP-47 locale override (defaults to the app locale)
|
|
@@ -897,7 +1057,7 @@ declare function QuantityWidget({ id, name, value, onChange, onBlur, propertySch
|
|
|
897
1057
|
* the inline error message and invalid border.
|
|
898
1058
|
*/
|
|
899
1059
|
|
|
900
|
-
declare function DateWidget({ id, value, onChange, onBlur, required, disabled, rawErrors, label, description, placeholder, options, }: WidgetProps): React.ReactElement;
|
|
1060
|
+
declare function DateWidget({ id, value, onChange, onBlur, required, disabled, rawErrors, label, description, placeholder, options, propertySchema, }: WidgetProps): React.ReactElement;
|
|
901
1061
|
|
|
902
1062
|
/**
|
|
903
1063
|
* TimeWidget - time-of-day field widget backed by the TimeInput primitive.
|
|
@@ -930,7 +1090,7 @@ declare function TimeWidget({ id, value, onChange, onBlur, required, disabled, r
|
|
|
930
1090
|
* the inline error message and invalid border.
|
|
931
1091
|
*/
|
|
932
1092
|
|
|
933
|
-
declare function DateTimeWidget({ id, value, onChange, onBlur, required, disabled, rawErrors, label, description, options, }: WidgetProps): React.ReactElement;
|
|
1093
|
+
declare function DateTimeWidget({ id, value, onChange, onBlur, required, disabled, rawErrors, label, description, options, propertySchema, }: WidgetProps): React.ReactElement;
|
|
934
1094
|
|
|
935
1095
|
/**
|
|
936
1096
|
* DisplayWidget - read-only text block, no data binding.
|
|
@@ -959,6 +1119,55 @@ declare function DisplayWidget({ label, description, }: WidgetProps): React.Reac
|
|
|
959
1119
|
|
|
960
1120
|
declare function OneOfWidget({ propertySchema, value, onChange, registry, uiSchema, disabled, readonly, label, description, id, options, }: WidgetProps): React.ReactElement | null;
|
|
961
1121
|
|
|
1122
|
+
/**
|
|
1123
|
+
* RadioWidget -- a single choice as radio buttons, every option in view.
|
|
1124
|
+
*
|
|
1125
|
+
* For an enum property, selected by `x-ui-widget: "radio"`. Labels come from
|
|
1126
|
+
* x-ui-options.enumNames, as for the select. `x-ui-options.orientation`
|
|
1127
|
+
* "horizontal" lays the options out in a row (default: a column).
|
|
1128
|
+
*/
|
|
1129
|
+
|
|
1130
|
+
declare function RadioWidget({ id, name, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, options, }: WidgetProps): React.ReactElement;
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* CheckboxGroupWidget -- a multiple choice as checkboxes, every option in view.
|
|
1134
|
+
*
|
|
1135
|
+
* For an array of enum items, selected by `x-ui-widget: "checkbox-group"`.
|
|
1136
|
+
* Labels come from x-ui-options.enumNames, as for the select; the value keeps
|
|
1137
|
+
* the options' order. `x-ui-options.orientation` "horizontal" lays them out in
|
|
1138
|
+
* a row (default: a column).
|
|
1139
|
+
*/
|
|
1140
|
+
|
|
1141
|
+
declare function CheckboxGroupWidget({ id, value, onChange, onBlur, propertySchema, required, disabled, readonly, rawErrors, label, description, options, }: WidgetProps): React.ReactElement;
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* ChoiceWithTextWidget -- a choice and a text as one answer: "one of these, and
|
|
1145
|
+
* add detail".
|
|
1146
|
+
*
|
|
1147
|
+
* A container, selected by `x-ui-widget: "choice-with-text"` on an object of
|
|
1148
|
+
* `choice` (an enum) and `text` (a string). It only arranges the two -- the
|
|
1149
|
+
* choice beside the text, the choice unlabelled -- and renders them as any
|
|
1150
|
+
* nested object is (ObjectWidget, inline, under the question's own label):
|
|
1151
|
+
* each child by its own widget, resolved as
|
|
1152
|
+
* for any field. So the choice is a select, radio buttons or an application's
|
|
1153
|
+
* terminology picker, set on the child (`x-ui-fields.choice`), and the text a
|
|
1154
|
+
* line or a textarea.
|
|
1155
|
+
*/
|
|
1156
|
+
|
|
1157
|
+
declare function ChoiceWithTextWidget(props: WidgetProps): React.ReactElement | null;
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* AbsentReasonsWidget -- the questions of a section left unanswered, and why:
|
|
1161
|
+
* one row each, the question and its reason (*unknown*, *not applicable*).
|
|
1162
|
+
*
|
|
1163
|
+
* For an object property mapping question keys to reasons, selected by
|
|
1164
|
+
* `x-ui-widget: "absent-reasons"`. The reasons are its `additionalProperties`
|
|
1165
|
+
* enum, labelled by x-ui-options.enumNames; the questions are its siblings in
|
|
1166
|
+
* the form schema it renders in -- every field but itself and static texts.
|
|
1167
|
+
*/
|
|
1168
|
+
|
|
1169
|
+
declare function AbsentReasonsWidget(props: WidgetProps): React.ReactElement;
|
|
1170
|
+
|
|
962
1171
|
/**
|
|
963
1172
|
* Widget Resolution Algorithm
|
|
964
1173
|
*
|
|
@@ -1284,7 +1493,7 @@ interface FormFieldRendererProps {
|
|
|
1284
1493
|
/** Validation messages for this field, rendered inline by the widget. */
|
|
1285
1494
|
rawErrors?: string[];
|
|
1286
1495
|
}
|
|
1287
|
-
declare function FormFieldRenderer({ fieldName, property, value, onChange, onBlur, required, disabled, readOnly, schema, uiSchema, registry, globalOptions, formData, idPrefix, rawErrors, }: FormFieldRendererProps): React__default.ReactElement | null;
|
|
1496
|
+
declare function FormFieldRenderer({ fieldName, property: declared, value, onChange, onBlur, required, disabled, readOnly, schema, uiSchema, registry, globalOptions, formData, idPrefix, rawErrors, }: FormFieldRendererProps): React__default.ReactElement | null;
|
|
1288
1497
|
|
|
1289
1498
|
/**
|
|
1290
1499
|
* useFormEngine - Core form state, schema resolution, and update-mode logic
|
|
@@ -1556,4 +1765,5 @@ declare const DEFAULT_TEMPLATES: TemplateRegistry;
|
|
|
1556
1765
|
*/
|
|
1557
1766
|
declare function groupTemplateKey(variant: string | undefined): string;
|
|
1558
1767
|
|
|
1559
|
-
export {
|
|
1768
|
+
export { AbsentReasonsWidget, ArrayWidget, CheckboxGroupWidget, CheckboxWidget, ChoiceWithTextWidget, CodeableConceptWidget, CodedValueWidget, DEFAULT_TEMPLATES, DEFAULT_WIDGETS, DEFAULT_WIDGET_MAP, DateTimeWidget, DateWidget, DisplayWidget, EntitySelectWidget, ExtraPropertiesCard, FormActions, FormCheckbox, FormFieldRenderer, FormFieldWrapper, FormInput, FormKeyValueInput, FormMultiSelect, FormNumberInput, FormQuantityInput, FormSelect, FormTagsInput, FormTextarea, GroupErrorBadge, JsonEditorWidget, JsonSchemaFormRenderer, KeyValueWidget, NumberWidget, ObjectWidget, OneOfWidget, QuantityWidget, RadioWidget, SectionsGroupTemplate, SelectWidget, StepperGroupTemplate, TabsGroupTemplate, TagsInputWidget, TextInputWidget, TextareaWidget, TimeWidget, firstError, getAriaDescribedBy, getDefaultWidgetForType, groupTemplateKey, resolveWidget, useFormEngine, useNestedFormContext, useResolvedSchema };
|
|
1769
|
+
export type { ArrayHeaderTemplate, ArrayHeaderTemplateProps, ArrayItemTemplate, ArrayItemTemplateProps, AsyncFieldValidator, AsyncFormValidator, FieldGroup, FieldValidator, FormFieldWrapperProps, FormValidator, GroupLayoutTemplate, GroupLayoutTemplateProps, JsonSchemaFormRendererProps, NestedFormContextValue, NestedRenderer, ObjectContainerTemplate, ObjectContainerTemplateProps, QuantityValue, SelectOption, TemplateRegistry, UnitOption, UnitPosition, ValidatorContext, ValidatorRegistry, ValidatorResult, Widget, WidgetDescriptor, WidgetMap, WidgetProps, WidgetRegistry };
|