@chobantonov/jsonforms-extended-spec 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +126 -2
- package/conformance/authoring.json +2169 -0
- package/conformance/behavior.json +731 -0
- package/conformance/config-consumption.json +1531 -0
- package/conformance/expected-invalid.json +20 -0
- package/docs/audit.md +150 -0
- package/docs/conditional-fields.md +80 -0
- package/docs/draft-07-visual-support.md +43 -0
- package/docs/external-resources-proposal.md +536 -0
- package/docs/implementation-guide.md +180 -0
- package/docs/implementation-pitfalls.md +802 -0
- package/docs/implementation-web-typescript.md +41 -0
- package/docs/renderer-and-demo.md +1347 -0
- package/docs/renderer-selection.md +99 -0
- package/docs/spec.md +8321 -0
- package/docs/todo.md +149 -0
- package/examples/README.md +121 -0
- package/examples/additional-errors/README.md +169 -0
- package/examples/additional-errors/config.json +3 -0
- package/examples/additional-errors/data.json +11 -0
- package/examples/additional-errors/schema.json +56 -0
- package/examples/additional-errors/translations.json +64 -0
- package/examples/additional-errors/uischema.json +158 -0
- package/examples/additional-items-pagination/README.md +8 -0
- package/examples/additional-items-pagination/config.json +10 -0
- package/examples/additional-items-pagination/data.json +22 -0
- package/examples/additional-items-pagination/schema.json +30 -0
- package/examples/additional-items-pagination/translations.json +16 -0
- package/examples/additional-items-pagination/uischema.json +39 -0
- package/examples/additional-properties/README.md +188 -0
- package/examples/additional-properties/config.json +5 -0
- package/examples/additional-properties/data.json +31 -0
- package/examples/additional-properties/schema.json +78 -0
- package/examples/additional-properties/translations.json +80 -0
- package/examples/additional-properties/uischema.json +104 -0
- package/examples/ag-grid/README.md +62 -0
- package/examples/ag-grid/config.json +14 -0
- package/examples/ag-grid/data.json +124 -0
- package/examples/ag-grid/schema.json +48 -0
- package/examples/ag-grid/translations.json +58 -0
- package/examples/ag-grid/uischema.json +671 -0
- package/examples/array-choices/README.md +150 -0
- package/examples/array-choices/config.json +4 -0
- package/examples/array-choices/data.json +10 -0
- package/examples/array-choices/schema.json +68 -0
- package/examples/array-choices/translations.json +64 -0
- package/examples/array-choices/uischema.json +97 -0
- package/examples/array-controls/README.md +237 -0
- package/examples/array-controls/config.json +4 -0
- package/examples/array-controls/data.json +147 -0
- package/examples/array-controls/schema.json +374 -0
- package/examples/array-controls/translations.json +186 -0
- package/examples/array-controls/uischema.json +685 -0
- package/examples/array-detail-modes/README.md +11 -0
- package/examples/array-detail-modes/data.json +38 -0
- package/examples/array-detail-modes/schema.json +89 -0
- package/examples/array-detail-modes/translations.json +36 -0
- package/examples/array-detail-modes/uischema.json +73 -0
- package/examples/array-detail-modes/uischemas.d.mts +2 -0
- package/examples/array-detail-modes/uischemas.json +15 -0
- package/examples/boolean-controls/README.md +109 -0
- package/examples/boolean-controls/config.json +3 -0
- package/examples/boolean-controls/data.json +27 -0
- package/examples/boolean-controls/schema.json +98 -0
- package/examples/boolean-controls/translations.json +94 -0
- package/examples/boolean-controls/uischema.json +126 -0
- package/examples/button-actions/README.md +259 -0
- package/examples/button-actions/config.json +7 -0
- package/examples/button-actions/data.json +5 -0
- package/examples/button-actions/host.mjs +14 -0
- package/examples/button-actions/schema.json +20 -0
- package/examples/button-actions/translations.json +60 -0
- package/examples/button-actions/uischema.json +179 -0
- package/examples/catalog.json +634 -0
- package/examples/categorization/README.md +132 -0
- package/examples/categorization/config.json +7 -0
- package/examples/categorization/data.json +8 -0
- package/examples/categorization/schema.json +29 -0
- package/examples/categorization/translations.json +72 -0
- package/examples/categorization/uischema.json +288 -0
- package/examples/choice-controls/README.md +136 -0
- package/examples/choice-controls/config.json +10 -0
- package/examples/choice-controls/data.json +61 -0
- package/examples/choice-controls/schema.json +406 -0
- package/examples/choice-controls/translations.json +154 -0
- package/examples/choice-controls/uischema.json +575 -0
- package/examples/choice-controls/uischemas.d.mts +2 -0
- package/examples/choice-controls/uischemas.json +16 -0
- package/examples/code-editor/README.md +74 -0
- package/examples/code-editor/data.json +8 -0
- package/examples/code-editor/schema.json +28 -0
- package/examples/code-editor/translations.json +20 -0
- package/examples/code-editor/uischema.json +77 -0
- package/examples/collection-pagination/README.md +5 -0
- package/examples/collection-pagination/config.json +1 -0
- package/examples/collection-pagination/data.json +64 -0
- package/examples/collection-pagination/schema.json +23 -0
- package/examples/collection-pagination/translations.json +14 -0
- package/examples/collection-pagination/uischema.json +14 -0
- package/examples/color-control/README.md +151 -0
- package/examples/color-control/config.json +7 -0
- package/examples/color-control/data.json +11 -0
- package/examples/color-control/schema.json +61 -0
- package/examples/color-control/translations.json +76 -0
- package/examples/color-control/uischema.json +106 -0
- package/examples/combinators/README.md +223 -0
- package/examples/combinators/config.json +9 -0
- package/examples/combinators/data.json +23 -0
- package/examples/combinators/schema.json +232 -0
- package/examples/combinators/translations.json +178 -0
- package/examples/combinators/uischema.json +158 -0
- package/examples/conditional-fields/README.md +19 -0
- package/examples/conditional-fields/config.json +5 -0
- package/examples/conditional-fields/data.json +7 -0
- package/examples/conditional-fields/schema.json +59 -0
- package/examples/conditional-fields/translations.json +30 -0
- package/examples/conditional-fields/uischema.json +71 -0
- package/examples/container-validation-indicator/README.md +187 -0
- package/examples/container-validation-indicator/config.json +9 -0
- package/examples/container-validation-indicator/data.json +68 -0
- package/examples/container-validation-indicator/schema.json +222 -0
- package/examples/container-validation-indicator/translations.json +120 -0
- package/examples/container-validation-indicator/uischema.json +98 -0
- package/examples/cron-control/README.md +155 -0
- package/examples/cron-control/data.json +15 -0
- package/examples/cron-control/schema.json +72 -0
- package/examples/cron-control/translations.json +80 -0
- package/examples/cron-control/uischema.json +91 -0
- package/examples/destructive-confirmation/README.md +210 -0
- package/examples/destructive-confirmation/config.json +17 -0
- package/examples/destructive-confirmation/data.json +86 -0
- package/examples/destructive-confirmation/schema.json +204 -0
- package/examples/destructive-confirmation/translations.json +112 -0
- package/examples/destructive-confirmation/uischema.json +105 -0
- package/examples/draft-07-metaschema/README.md +11 -0
- package/examples/draft-07-metaschema/config.json +3 -0
- package/examples/draft-07-metaschema/data.json +25 -0
- package/examples/draft-07-metaschema/schema.json +172 -0
- package/examples/draft-07-metaschema/translations.json +10 -0
- package/examples/draft-07-metaschema/uischema.json +14 -0
- package/examples/dynamic-playground/README.md +95 -0
- package/examples/dynamic-playground/config.json +8 -0
- package/examples/dynamic-playground/configuration.json +152 -0
- package/examples/dynamic-playground/data.json +15 -0
- package/examples/dynamic-playground/dynamic-uischema.json +379 -0
- package/examples/dynamic-playground/host.mjs +37 -0
- package/examples/dynamic-playground/schema.json +48 -0
- package/examples/dynamic-playground/translations.json +76 -0
- package/examples/dynamic-playground/uischema.json +36 -0
- package/examples/editor-details/README.md +10 -0
- package/examples/editor-details/data.json +18 -0
- package/examples/editor-details/schema.json +49 -0
- package/examples/editor-details/translations.json +28 -0
- package/examples/editor-details/uischema.json +53 -0
- package/examples/editor-details/uischemas.d.mts +2 -0
- package/examples/editor-details/uischemas.json +14 -0
- package/examples/file-control/README.md +108 -0
- package/examples/file-control/data.json +28 -0
- package/examples/file-control/schema.json +89 -0
- package/examples/file-control/translations.json +46 -0
- package/examples/file-control/uischema.json +152 -0
- package/examples/group-layout/README.md +149 -0
- package/examples/group-layout/config.json +10 -0
- package/examples/group-layout/data.json +9 -0
- package/examples/group-layout/schema.json +51 -0
- package/examples/group-layout/translations.json +62 -0
- package/examples/group-layout/uischema.json +249 -0
- package/examples/index.d.ts +17 -0
- package/examples/index.js +69 -0
- package/examples/input-adornments/README.md +68 -0
- package/examples/input-adornments/data.json +41 -0
- package/examples/input-adornments/schema.json +207 -0
- package/examples/input-adornments/translations.json +106 -0
- package/examples/input-adornments/uischema.json +695 -0
- package/examples/job-application/README.md +23 -0
- package/examples/job-application/config.json +10 -0
- package/examples/job-application/data.json +68 -0
- package/examples/job-application/schema.json +196 -0
- package/examples/job-application/translations.json +388 -0
- package/examples/job-application/uischema.json +218 -0
- package/examples/job-application/uischemas.json +153 -0
- package/examples/json-editor/README.md +28 -0
- package/examples/json-editor/schema.json +1 -0
- package/examples/json-editor/translations.json +10 -0
- package/examples/json-editor/uischema.json +16 -0
- package/examples/json-inference/README.md +33 -0
- package/examples/json-inference/translations.json +10 -0
- package/examples/json-inference/uischema.json +16 -0
- package/examples/kitchen-sink/README.md +86 -0
- package/examples/kitchen-sink/config.json +14 -0
- package/examples/kitchen-sink/data.json +263 -0
- package/examples/kitchen-sink/invalid-data.json +263 -0
- package/examples/kitchen-sink/schema.json +515 -0
- package/examples/kitchen-sink/translations.json +270 -0
- package/examples/kitchen-sink/uischema.json +722 -0
- package/examples/label-interpolation/README.md +200 -0
- package/examples/label-interpolation/config.json +8 -0
- package/examples/label-interpolation/data.json +13 -0
- package/examples/label-interpolation/schema.json +64 -0
- package/examples/label-interpolation/translations.json +94 -0
- package/examples/label-interpolation/uischema.json +375 -0
- package/examples/layout-sizing/README.md +162 -0
- package/examples/layout-sizing/config.json +10 -0
- package/examples/layout-sizing/data.json +14 -0
- package/examples/layout-sizing/schema.json +58 -0
- package/examples/layout-sizing/translations.json +42 -0
- package/examples/layout-sizing/uischema.json +558 -0
- package/examples/markup-label/README.md +109 -0
- package/examples/markup-label/config.json +16 -0
- package/examples/markup-label/data.json +5 -0
- package/examples/markup-label/schema.json +24 -0
- package/examples/markup-label/translations.json +40 -0
- package/examples/markup-label/uischema.json +149 -0
- package/examples/mixed-control/README.md +164 -0
- package/examples/mixed-control/config.json +11 -0
- package/examples/mixed-control/data.json +70 -0
- package/examples/mixed-control/schema.json +221 -0
- package/examples/mixed-control/translations.json +158 -0
- package/examples/mixed-control/uischema.json +211 -0
- package/examples/null-control/README.md +111 -0
- package/examples/null-control/config.json +4 -0
- package/examples/null-control/data.json +6 -0
- package/examples/null-control/schema.json +36 -0
- package/examples/null-control/translations.json +42 -0
- package/examples/null-control/uischema.json +56 -0
- package/examples/numeric-controls/README.md +94 -0
- package/examples/numeric-controls/config.json +4 -0
- package/examples/numeric-controls/data.json +8 -0
- package/examples/numeric-controls/schema.json +52 -0
- package/examples/numeric-controls/translations.json +56 -0
- package/examples/numeric-controls/uischema.json +77 -0
- package/examples/object-control/README.md +220 -0
- package/examples/object-control/config.json +4 -0
- package/examples/object-control/data.json +62 -0
- package/examples/object-control/schema.json +252 -0
- package/examples/object-control/translations.json +160 -0
- package/examples/object-control/uischema.json +275 -0
- package/examples/object-control/uischemas.d.mts +2 -0
- package/examples/object-control/uischemas.json +59 -0
- package/examples/password-control/README.md +119 -0
- package/examples/password-control/config.json +3 -0
- package/examples/password-control/data.json +18 -0
- package/examples/password-control/schema.json +65 -0
- package/examples/password-control/translations.json +64 -0
- package/examples/password-control/uischema.json +94 -0
- package/examples/pre-touch-errors/README.md +176 -0
- package/examples/pre-touch-errors/config.json +4 -0
- package/examples/pre-touch-errors/data.json +5 -0
- package/examples/pre-touch-errors/schema.json +56 -0
- package/examples/pre-touch-errors/translations.json +68 -0
- package/examples/pre-touch-errors/uischema.json +85 -0
- package/examples/presentation/README.md +148 -0
- package/examples/presentation/config.json +9 -0
- package/examples/presentation/data.json +6 -0
- package/examples/presentation/schema.json +21 -0
- package/examples/presentation/translations.json +64 -0
- package/examples/presentation/uischema.json +210 -0
- package/examples/property-pagination/README.md +5 -0
- package/examples/property-pagination/config.json +1 -0
- package/examples/property-pagination/data.json +17 -0
- package/examples/property-pagination/schema.json +14 -0
- package/examples/property-pagination/translations.json +10 -0
- package/examples/property-pagination/uischema.json +24 -0
- package/examples/recursive-tree/README.md +49 -0
- package/examples/recursive-tree/config.json +1 -0
- package/examples/recursive-tree/data.json +40 -0
- package/examples/recursive-tree/schema.json +89 -0
- package/examples/recursive-tree/translations.json +42 -0
- package/examples/recursive-tree/uischema.json +84 -0
- package/examples/recursive-tree/uischemas.d.mts +2 -0
- package/examples/recursive-tree/uischemas.json +51 -0
- package/examples/split-layout/README.md +123 -0
- package/examples/split-layout/config.json +3 -0
- package/examples/split-layout/data.json +13 -0
- package/examples/split-layout/schema.json +50 -0
- package/examples/split-layout/translations.json +50 -0
- package/examples/split-layout/uischema.json +204 -0
- package/examples/string-controls/README.md +159 -0
- package/examples/string-controls/config.json +5 -0
- package/examples/string-controls/data.json +13 -0
- package/examples/string-controls/schema.json +70 -0
- package/examples/string-controls/translations.json +76 -0
- package/examples/string-controls/uischema.json +148 -0
- package/examples/table-row-details/README.md +69 -0
- package/examples/table-row-details/config.json +7 -0
- package/examples/table-row-details/data.json +280 -0
- package/examples/table-row-details/schema.json +61 -0
- package/examples/table-row-details/translations.json +56 -0
- package/examples/table-row-details/uischema.json +1303 -0
- package/examples/template-layout/README.md +250 -0
- package/examples/template-layout/config.json +9 -0
- package/examples/template-layout/data.json +20 -0
- package/examples/template-layout/host.mjs +13 -0
- package/examples/template-layout/schema.json +48 -0
- package/examples/template-layout/translations.json +70 -0
- package/examples/template-layout/uischema.json +177 -0
- package/examples/template-slots/README.md +19 -0
- package/examples/template-slots/data.json +4 -0
- package/examples/template-slots/schema.json +11 -0
- package/examples/template-slots/translations.json +26 -0
- package/examples/template-slots/uischema.json +47 -0
- package/examples/template-slots/uischemas.d.mts +2 -0
- package/examples/template-slots/uischemas.json +56 -0
- package/examples/temporal-controls/README.md +325 -0
- package/examples/temporal-controls/data.json +44 -0
- package/examples/temporal-controls/schema.json +208 -0
- package/examples/temporal-controls/translations.json +156 -0
- package/examples/temporal-controls/uischema.json +297 -0
- package/examples/tree-max-depth/README.md +5 -0
- package/examples/tree-max-depth/config.json +3 -0
- package/examples/tree-max-depth/data.json +31 -0
- package/examples/tree-max-depth/schema.json +258 -0
- package/examples/tree-max-depth/translations.json +42 -0
- package/examples/tree-max-depth/uischema.json +16 -0
- package/examples/tree-max-depth/uischemas.d.mts +2 -0
- package/examples/tree-max-depth/uischemas.json +50 -0
- package/examples/tuple-control/README.md +335 -0
- package/examples/tuple-control/config.json +4 -0
- package/examples/tuple-control/data.json +61 -0
- package/examples/tuple-control/schema.json +218 -0
- package/examples/tuple-control/translations.json +142 -0
- package/examples/tuple-control/uischema.json +128 -0
- package/examples/tuple-control/uischemas.d.mts +2 -0
- package/examples/tuple-control/uischemas.json +125 -0
- package/examples/validator-profile/README.md +197 -0
- package/examples/validator-profile/config.json +9 -0
- package/examples/validator-profile/data.json +16 -0
- package/examples/validator-profile/schema.json +139 -0
- package/examples/validator-profile/translations.json +34 -0
- package/examples/validator-profile/uischema.json +59 -0
- package/package.json +83 -3
- package/provenance.json +140 -0
- package/schemas/README.md +77 -0
- package/schemas/example.schema.json +37 -0
- package/schemas/jsonforms-config.schema.json +427 -0
- package/schemas/jsonforms-dynamic-uischema.schema.json +220 -0
- package/schemas/jsonforms-extended-config.schema.json +327 -0
- package/schemas/jsonforms-extended-uischema.schema.json +1923 -0
- package/schemas/jsonforms-rule.schema.json +104 -0
- package/schemas/jsonforms-uischema.schema.json +1421 -0
- package/typescript/README.md +540 -0
- package/typescript/lib/authoring/cssLength.d.ts +33 -0
- package/typescript/lib/authoring/cssLength.js +25 -0
- package/typescript/lib/authoring/dynamic.d.ts +73 -0
- package/typescript/lib/authoring/dynamic.js +8 -0
- package/typescript/lib/authoring/forSchema.d.ts +376 -0
- package/typescript/lib/authoring/forSchema.js +84 -0
- package/typescript/lib/authoring/schemaTypes.d.ts +111 -0
- package/typescript/lib/authoring/schemaTypes.js +15 -0
- package/typescript/lib/index.d.ts +4 -0
- package/typescript/lib/index.js +20 -0
- package/typescript/package.json +1 -0
- package/typescript/src/authoring/cssLength.ts +79 -0
- package/typescript/src/authoring/dynamic.ts +96 -0
- package/typescript/src/authoring/forSchema.ts +419 -0
- package/typescript/src/authoring/schemaTypes.ts +143 -0
- package/typescript/src/index.ts +4 -0
- package/typescript/test/schemaContract.test.ts +626 -0
- package/typescript/test/tsconfig.json +10 -0
- package/typescript/test/typedAuthoring.test.ts +140 -0
- package/typescript/test/typedAuthoringCoverage.test.ts +145 -0
- package/typescript/test/typedAuthoringCssLength.test.ts +81 -0
- package/typescript/test/typedAuthoringNames.test.ts +90 -0
- package/typescript/test/typedDynamic.test.ts +88 -0
- package/typescript/tsconfig.json +15 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Example: categorization — tabs, stepper and accordion
|
|
2
|
+
|
|
3
|
+
**Example ID:** `categorization`\
|
|
4
|
+
**Demo entry:** **Spec: Categorization: tabs, stepper, accordion** (`#spec-categorization`)\
|
|
5
|
+
**Domain:** equipment order\
|
|
6
|
+
**Specs covered:**
|
|
7
|
+
|
|
8
|
+
- [Categorization](../../docs/spec.md#86-categorization)
|
|
9
|
+
- [Accordion categorization](../../docs/spec.md#86-categorization)
|
|
10
|
+
- [Container visibility and hidden children](../../docs/spec.md#86-categorization)
|
|
11
|
+
- [The Categorization navigation contract](../../docs/spec.md#86-categorization)
|
|
12
|
+
- [Container validation indicator](../../docs/spec.md#86-categorization)
|
|
13
|
+
|
|
14
|
+
**The same four categories, rendered three ways, bound to the same data.** Type
|
|
15
|
+
in one and the other two follow. That is the point: which of tabs, stepper and
|
|
16
|
+
accordion is drawn is a presentation choice, and nothing else about the form —
|
|
17
|
+
navigation, visibility, validation or the section indicators — is allowed to
|
|
18
|
+
depend on it.
|
|
19
|
+
|
|
20
|
+
## Files
|
|
21
|
+
|
|
22
|
+
| File | Role |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `schema.json` | Eight properties across four subjects, with the constraints that produce the errors below. |
|
|
25
|
+
| `uischema.json` | One `isBusiness` control, then the same four categories as tabs, as a stepper, and as an accordion. |
|
|
26
|
+
| `data.json` | Deliberately invalid in two places, in two different categories. |
|
|
27
|
+
| `config.json` | `showUnfocusedDescription` flat; both indicators under `jsonformsExtended`. |
|
|
28
|
+
| `translations.json` | English and Bulgarian, including the category labels and both indicator messages. |
|
|
29
|
+
|
|
30
|
+
No `uischemas.json`: nothing here nests.
|
|
31
|
+
|
|
32
|
+
## What the form contains
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Business account [ ] <- toggles the Business category
|
|
36
|
+
|
|
37
|
+
Tabs — no variant
|
|
38
|
+
Contact | Planning | Notes
|
|
39
|
+
|
|
40
|
+
Stepper — variant: "stepper", showNavButtons
|
|
41
|
+
(1) Contact -> (2) Planning -> (3) Notes
|
|
42
|
+
|
|
43
|
+
Accordion — variant: "accordion", initial: "planning"
|
|
44
|
+
> Contact
|
|
45
|
+
v Planning <- open, because options.initial names it
|
|
46
|
+
> Notes
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`Business` is absent from all three until the toggle is on.
|
|
50
|
+
|
|
51
|
+
## Validation state
|
|
52
|
+
|
|
53
|
+
Validated with Ajv (`allErrors`, `strict: false`), the supplied data produces
|
|
54
|
+
exactly two errors — deliberately one in each of two different categories:
|
|
55
|
+
|
|
56
|
+
| Instance path | Keyword | Message |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `/contactName` | `minLength` | must NOT have fewer than 3 characters |
|
|
59
|
+
| `/itemCount` | `maximum` | must be <= 8 |
|
|
60
|
+
|
|
61
|
+
## Expected behaviour
|
|
62
|
+
|
|
63
|
+
**Both section indicators appear on every presentation.** Contact and Planning
|
|
64
|
+
carry an error marker, and every category holding data carries the dot. A
|
|
65
|
+
Category has no data scope of its own, so both are aggregated from the Controls
|
|
66
|
+
below it — through the one traversal shared with the Group's indicators.
|
|
67
|
+
|
|
68
|
+
Where they sit follows the **shape of the header**: at the end of the bar on an
|
|
69
|
+
accordion, matching a collapsible Group, and beside the label on a tab or a
|
|
70
|
+
step, which is just text with no trailing edge.
|
|
71
|
+
|
|
72
|
+
**The error marker survives being out of view.** The stepper shows one step at
|
|
73
|
+
a time and the accordion one panel; the marker on a step or header you are not
|
|
74
|
+
looking at is the whole reason the indicator exists.
|
|
75
|
+
|
|
76
|
+
**Toggle `Business account` on, then off.** The category appears in all three,
|
|
77
|
+
then disappears. If you select it and then toggle it off, the presentation falls
|
|
78
|
+
back to another visible category rather than leaving a stale panel — §8:
|
|
79
|
+
"when the selected category becomes hidden, select an available visible
|
|
80
|
+
category". Note also that the category is *hidden by its own rule*: a category
|
|
81
|
+
whose children are all hidden would still be shown, and there is no
|
|
82
|
+
`hideWhenEmpty`.
|
|
83
|
+
|
|
84
|
+
**The accordion opens on Planning.** `options.initial` names a direct Category
|
|
85
|
+
`name` — not its label, and not its index. Rename it to something that matches
|
|
86
|
+
nothing and the first category opens instead, with a console warning; the form
|
|
87
|
+
still works.
|
|
88
|
+
|
|
89
|
+
**Click the open accordion header.** It closes, and the accordion is left with
|
|
90
|
+
nothing open — collapse all three and you are looking at the form's outline.
|
|
91
|
+
Section 8 allows an explicit all-closed state; opening a category closes any
|
|
92
|
+
other open category. Two open at once is still impossible.
|
|
93
|
+
|
|
94
|
+
**Close the accordion, then toggle `Business account`.** It stays closed.
|
|
95
|
+
Closing is a state you chose, so the "selected category became hidden, open
|
|
96
|
+
another" rule must not quietly undo it.
|
|
97
|
+
|
|
98
|
+
**Type into a category, then open another.** The first keeps its value: closed
|
|
99
|
+
panels stay mounted, so "closing a category preserves its data and validation".
|
|
100
|
+
|
|
101
|
+
**Switch the demo to Bulgarian.** Category labels translate, because each
|
|
102
|
+
carries an explicit `i18n` prefix. A Category has no scope, so without one the
|
|
103
|
+
lookup key would be the literal English label and the catalog entry would never
|
|
104
|
+
be consulted.
|
|
105
|
+
|
|
106
|
+
## Fallback behaviour
|
|
107
|
+
|
|
108
|
+
| Situation | Result |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| No `variant` | Tabs. |
|
|
111
|
+
| `variant` the renderer set does not know | Tabs, at rank 1. An unknown variant is not an error. |
|
|
112
|
+
| `initial` naming no visible category | First visible category, plus a console warning. Nothing is rendered about it — it is an authoring mistake, not something the person filling in the form can act on. |
|
|
113
|
+
| A category with no `name` | Selection follows its position; there is no identity to preserve across a reorder. |
|
|
114
|
+
| Every category hidden | No open panel and no active step, rather than a stale one. |
|
|
115
|
+
| Accordion closed by the reader | Stays closed until they open something, through visibility changes and data edits. |
|
|
116
|
+
| `showNavButtons` or `vertical` on the accordion | Ignored. §8: they "do not alter this presentation". |
|
|
117
|
+
|
|
118
|
+
## Conformance scope
|
|
119
|
+
|
|
120
|
+
This walkthrough describes the portable contract. Renderer support must be checked
|
|
121
|
+
by a host adapter; the package validates the authored assets, not live UI behavior.
|
|
122
|
+
|
|
123
|
+
## Standalone host setup
|
|
124
|
+
|
|
125
|
+
Load the JSON assets listed in [the catalog](../catalog.json) into a host
|
|
126
|
+
with the relevant renderer capabilities. No framework registration module is
|
|
127
|
+
required by this package.
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## Feature navigation
|
|
131
|
+
|
|
132
|
+
Explore one feature at a time using the tabs: **Tabs**, **Stepper**, **Accordion**. Tab titles are localized in English and Bulgarian. The tabs share the existing form data.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"title": "Equipment order",
|
|
5
|
+
"required": ["contactName", "officeCity"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"contactName": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"title": "Contact name",
|
|
10
|
+
"minLength": 3
|
|
11
|
+
},
|
|
12
|
+
"contactPhone": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"title": "Phone",
|
|
15
|
+
"pattern": "^[0-9 +()-]{7,}$"
|
|
16
|
+
},
|
|
17
|
+
"officeCity": { "type": "string", "title": "Office city" },
|
|
18
|
+
"dropoffCity": { "type": "string", "title": "Drop-off city" },
|
|
19
|
+
"itemCount": {
|
|
20
|
+
"type": "integer",
|
|
21
|
+
"title": "Items",
|
|
22
|
+
"minimum": 1,
|
|
23
|
+
"maximum": 8
|
|
24
|
+
},
|
|
25
|
+
"isBusiness": { "type": "boolean", "title": "Business account" },
|
|
26
|
+
"companyName": { "type": "string", "title": "Company name" },
|
|
27
|
+
"notes": { "type": "string", "title": "Notes for the coordinator" }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"category.contact.label": "Contact",
|
|
4
|
+
"category.planning.label": "Planning",
|
|
5
|
+
"category.business.label": "Business",
|
|
6
|
+
"category.notes.label": "Notes",
|
|
7
|
+
"hint.visibility": "Toggle this to watch the Business category appear and disappear in all three.",
|
|
8
|
+
"hint.tabs": "Tabs — no variant",
|
|
9
|
+
"hint.stepper": "Stepper — variant: \"stepper\"",
|
|
10
|
+
"hint.accordion": "Accordion — variant: \"accordion\", opening on options.initial",
|
|
11
|
+
"group.dataIndicator": "Section contains data",
|
|
12
|
+
"validation.containerError": "1 error in this section",
|
|
13
|
+
"validation.containerErrors": "{count} errors in this section",
|
|
14
|
+
"categorization.next": "Next",
|
|
15
|
+
"categorization.previous": "Previous",
|
|
16
|
+
"error.minLength": "Use at least {limit} characters.",
|
|
17
|
+
"error.maximum": "Enter {limit} or fewer.",
|
|
18
|
+
"error.pattern": "Enter a valid phone number.",
|
|
19
|
+
"error.required": "This field is required.",
|
|
20
|
+
"featureNavigation.section1.label": "Tabs",
|
|
21
|
+
"featureNavigation.section2.label": "Stepper",
|
|
22
|
+
"featureNavigation.section3.label": "Accordion",
|
|
23
|
+
"specCategorization.schema.label": "Equipment order",
|
|
24
|
+
"specCategorization.schema.properties.contactName.label": "Contact name",
|
|
25
|
+
"specCategorization.schema.properties.contactPhone.label": "Phone",
|
|
26
|
+
"specCategorization.schema.properties.officeCity.label": "Office city",
|
|
27
|
+
"specCategorization.schema.properties.dropoffCity.label": "Drop-off city",
|
|
28
|
+
"specCategorization.schema.properties.itemCount.label": "Items",
|
|
29
|
+
"specCategorization.schema.properties.isBusiness.label": "Business account",
|
|
30
|
+
"specCategorization.schema.properties.companyName.label": "Company name",
|
|
31
|
+
"specCategorization.schema.properties.notes.label": "Notes for the coordinator",
|
|
32
|
+
"hint.visibility.text": "Toggle this to watch the Business category appear and disappear in all three.",
|
|
33
|
+
"hint.tabs.text": "Tabs — no variant",
|
|
34
|
+
"hint.stepper.text": "Stepper — variant: \"stepper\"",
|
|
35
|
+
"hint.accordion.text": "Accordion — variant: \"accordion\", opening on options.initial"
|
|
36
|
+
},
|
|
37
|
+
"bg": {
|
|
38
|
+
"category.contact.label": "Контакт",
|
|
39
|
+
"category.planning.label": "Планиране",
|
|
40
|
+
"category.business.label": "Фирма",
|
|
41
|
+
"category.notes.label": "Бележки",
|
|
42
|
+
"hint.visibility": "Превключете, за да видите как категорията „Фирма“ се появява и изчезва и в трите.",
|
|
43
|
+
"hint.tabs": "Табове — без variant",
|
|
44
|
+
"hint.stepper": "Стъпки — variant: \"stepper\"",
|
|
45
|
+
"hint.accordion": "Акордеон — variant: \"accordion\", отваря се на options.initial",
|
|
46
|
+
"group.dataIndicator": "Секцията съдържа данни",
|
|
47
|
+
"validation.containerError": "1 грешка в тази секция",
|
|
48
|
+
"validation.containerErrors": "{count} грешки в тази секция",
|
|
49
|
+
"categorization.next": "Напред",
|
|
50
|
+
"categorization.previous": "Назад",
|
|
51
|
+
"error.minLength": "Използвайте поне {limit} символа.",
|
|
52
|
+
"error.maximum": "Въведете {limit} или по-малко.",
|
|
53
|
+
"error.pattern": "Въведете валиден телефонен номер.",
|
|
54
|
+
"error.required": "Полето е задължително.",
|
|
55
|
+
"featureNavigation.section1.label": "Раздели",
|
|
56
|
+
"featureNavigation.section2.label": "Стъпки",
|
|
57
|
+
"featureNavigation.section3.label": "Акордеон",
|
|
58
|
+
"specCategorization.schema.label": "Поръчка на оборудване",
|
|
59
|
+
"specCategorization.schema.properties.contactName.label": "Име за контакт",
|
|
60
|
+
"specCategorization.schema.properties.contactPhone.label": "Телефон",
|
|
61
|
+
"specCategorization.schema.properties.officeCity.label": "Град на офиса",
|
|
62
|
+
"specCategorization.schema.properties.dropoffCity.label": "Град за доставка",
|
|
63
|
+
"specCategorization.schema.properties.itemCount.label": "Артикули",
|
|
64
|
+
"specCategorization.schema.properties.isBusiness.label": "Фирмена сметка",
|
|
65
|
+
"specCategorization.schema.properties.companyName.label": "Име на фирмата",
|
|
66
|
+
"specCategorization.schema.properties.notes.label": "Бележки за координатора",
|
|
67
|
+
"hint.visibility.text": "Превключете, за да видите как категорията „Фирма“ се появява и изчезва и в трите.",
|
|
68
|
+
"hint.tabs.text": "Табове — без variant",
|
|
69
|
+
"hint.stepper.text": "Стъпки — variant: \"stepper\"",
|
|
70
|
+
"hint.accordion.text": "Акордеон — variant: \"accordion\", отваря се на options.initial"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "VerticalLayout",
|
|
3
|
+
"elements": [
|
|
4
|
+
{
|
|
5
|
+
"type": "Label",
|
|
6
|
+
"text": "Toggle this to watch the Business category appear and disappear in all three.",
|
|
7
|
+
"i18n": "hint.visibility"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "Control",
|
|
11
|
+
"scope": "#/properties/isBusiness"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "Categorization",
|
|
15
|
+
"elements": [
|
|
16
|
+
{
|
|
17
|
+
"type": "Category",
|
|
18
|
+
"label": "Tabs",
|
|
19
|
+
"i18n": "featureNavigation.section1",
|
|
20
|
+
"elements": [
|
|
21
|
+
{
|
|
22
|
+
"type": "Label",
|
|
23
|
+
"text": "Tabs — no variant",
|
|
24
|
+
"i18n": "hint.tabs"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"type": "Categorization",
|
|
28
|
+
"elements": [
|
|
29
|
+
{
|
|
30
|
+
"type": "Category",
|
|
31
|
+
"name": "contact",
|
|
32
|
+
"label": "Contact",
|
|
33
|
+
"i18n": "category.contact",
|
|
34
|
+
"elements": [
|
|
35
|
+
{
|
|
36
|
+
"type": "Control",
|
|
37
|
+
"scope": "#/properties/contactName"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "Control",
|
|
41
|
+
"scope": "#/properties/contactPhone"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "Category",
|
|
47
|
+
"name": "planning",
|
|
48
|
+
"label": "Planning",
|
|
49
|
+
"i18n": "category.planning",
|
|
50
|
+
"elements": [
|
|
51
|
+
{
|
|
52
|
+
"type": "Control",
|
|
53
|
+
"scope": "#/properties/officeCity"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"type": "Control",
|
|
57
|
+
"scope": "#/properties/dropoffCity"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "Control",
|
|
61
|
+
"scope": "#/properties/itemCount"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "Category",
|
|
67
|
+
"name": "business",
|
|
68
|
+
"label": "Business",
|
|
69
|
+
"i18n": "category.business",
|
|
70
|
+
"elements": [
|
|
71
|
+
{
|
|
72
|
+
"type": "Control",
|
|
73
|
+
"scope": "#/properties/companyName"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"rule": {
|
|
77
|
+
"effect": "SHOW",
|
|
78
|
+
"condition": {
|
|
79
|
+
"scope": "#/properties/isBusiness",
|
|
80
|
+
"schema": {
|
|
81
|
+
"const": true
|
|
82
|
+
},
|
|
83
|
+
"failWhenUndefined": true
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"type": "Category",
|
|
89
|
+
"name": "notes",
|
|
90
|
+
"label": "Notes",
|
|
91
|
+
"i18n": "category.notes",
|
|
92
|
+
"elements": [
|
|
93
|
+
{
|
|
94
|
+
"type": "Control",
|
|
95
|
+
"scope": "#/properties/notes"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "Category",
|
|
105
|
+
"label": "Stepper",
|
|
106
|
+
"i18n": "featureNavigation.section2",
|
|
107
|
+
"elements": [
|
|
108
|
+
{
|
|
109
|
+
"type": "Label",
|
|
110
|
+
"text": "Stepper — variant: \"stepper\"",
|
|
111
|
+
"i18n": "hint.stepper"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"type": "Categorization",
|
|
115
|
+
"options": {
|
|
116
|
+
"variant": "stepper",
|
|
117
|
+
"showNavButtons": true
|
|
118
|
+
},
|
|
119
|
+
"elements": [
|
|
120
|
+
{
|
|
121
|
+
"type": "Category",
|
|
122
|
+
"name": "contact",
|
|
123
|
+
"label": "Contact",
|
|
124
|
+
"i18n": "category.contact",
|
|
125
|
+
"elements": [
|
|
126
|
+
{
|
|
127
|
+
"type": "Control",
|
|
128
|
+
"scope": "#/properties/contactName"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"type": "Control",
|
|
132
|
+
"scope": "#/properties/contactPhone"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"type": "Category",
|
|
138
|
+
"name": "planning",
|
|
139
|
+
"label": "Planning",
|
|
140
|
+
"i18n": "category.planning",
|
|
141
|
+
"elements": [
|
|
142
|
+
{
|
|
143
|
+
"type": "Control",
|
|
144
|
+
"scope": "#/properties/officeCity"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"type": "Control",
|
|
148
|
+
"scope": "#/properties/dropoffCity"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"type": "Control",
|
|
152
|
+
"scope": "#/properties/itemCount"
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"type": "Category",
|
|
158
|
+
"name": "business",
|
|
159
|
+
"label": "Business",
|
|
160
|
+
"i18n": "category.business",
|
|
161
|
+
"elements": [
|
|
162
|
+
{
|
|
163
|
+
"type": "Control",
|
|
164
|
+
"scope": "#/properties/companyName"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"rule": {
|
|
168
|
+
"effect": "SHOW",
|
|
169
|
+
"condition": {
|
|
170
|
+
"scope": "#/properties/isBusiness",
|
|
171
|
+
"schema": {
|
|
172
|
+
"const": true
|
|
173
|
+
},
|
|
174
|
+
"failWhenUndefined": true
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"type": "Category",
|
|
180
|
+
"name": "notes",
|
|
181
|
+
"label": "Notes",
|
|
182
|
+
"i18n": "category.notes",
|
|
183
|
+
"elements": [
|
|
184
|
+
{
|
|
185
|
+
"type": "Control",
|
|
186
|
+
"scope": "#/properties/notes"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"type": "Category",
|
|
196
|
+
"label": "Accordion",
|
|
197
|
+
"i18n": "featureNavigation.section3",
|
|
198
|
+
"elements": [
|
|
199
|
+
{
|
|
200
|
+
"type": "Label",
|
|
201
|
+
"text": "Accordion — variant: \"accordion\"",
|
|
202
|
+
"i18n": "hint.accordion"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"type": "Categorization",
|
|
206
|
+
"options": {
|
|
207
|
+
"variant": "accordion",
|
|
208
|
+
"initial": "planning"
|
|
209
|
+
},
|
|
210
|
+
"elements": [
|
|
211
|
+
{
|
|
212
|
+
"type": "Category",
|
|
213
|
+
"name": "contact",
|
|
214
|
+
"label": "Contact",
|
|
215
|
+
"i18n": "category.contact",
|
|
216
|
+
"elements": [
|
|
217
|
+
{
|
|
218
|
+
"type": "Control",
|
|
219
|
+
"scope": "#/properties/contactName"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"type": "Control",
|
|
223
|
+
"scope": "#/properties/contactPhone"
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"type": "Category",
|
|
229
|
+
"name": "planning",
|
|
230
|
+
"label": "Planning",
|
|
231
|
+
"i18n": "category.planning",
|
|
232
|
+
"elements": [
|
|
233
|
+
{
|
|
234
|
+
"type": "Control",
|
|
235
|
+
"scope": "#/properties/officeCity"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"type": "Control",
|
|
239
|
+
"scope": "#/properties/dropoffCity"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"type": "Control",
|
|
243
|
+
"scope": "#/properties/itemCount"
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"type": "Category",
|
|
249
|
+
"name": "business",
|
|
250
|
+
"label": "Business",
|
|
251
|
+
"i18n": "category.business",
|
|
252
|
+
"elements": [
|
|
253
|
+
{
|
|
254
|
+
"type": "Control",
|
|
255
|
+
"scope": "#/properties/companyName"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"rule": {
|
|
259
|
+
"effect": "SHOW",
|
|
260
|
+
"condition": {
|
|
261
|
+
"scope": "#/properties/isBusiness",
|
|
262
|
+
"schema": {
|
|
263
|
+
"const": true
|
|
264
|
+
},
|
|
265
|
+
"failWhenUndefined": true
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"type": "Category",
|
|
271
|
+
"name": "notes",
|
|
272
|
+
"label": "Notes",
|
|
273
|
+
"i18n": "category.notes",
|
|
274
|
+
"elements": [
|
|
275
|
+
{
|
|
276
|
+
"type": "Control",
|
|
277
|
+
"scope": "#/properties/notes"
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Example: choice controls
|
|
2
|
+
|
|
3
|
+
**Example ID:** `choice-controls`\
|
|
4
|
+
**Demo entry:** **Spec: Choice controls** (`#spec-choice-controls`)\
|
|
5
|
+
**Domain:** appointment options\
|
|
6
|
+
**Specs covered:**
|
|
7
|
+
|
|
8
|
+
- [Radio-choice layout and interaction](../../docs/spec.md#185-choice-and-suggested-string-controls)
|
|
9
|
+
- [Choice identity and existing values](../../docs/spec.md#185-choice-and-suggested-string-controls)
|
|
10
|
+
- [Honest rendering of invalid data](../../docs/spec.md#185-choice-and-suggested-string-controls)
|
|
11
|
+
- [Choice and suggested-string controls](../../docs/spec.md#185-choice-and-suggested-string-controls)
|
|
12
|
+
- [Choice searchability](../../docs/spec.md#185-choice-and-suggested-string-controls)
|
|
13
|
+
- [`vertical` orientation](../../docs/spec.md#185-choice-and-suggested-string-controls)
|
|
14
|
+
|
|
15
|
+
## Validation state
|
|
16
|
+
|
|
17
|
+
Validated with Ajv (`allErrors`, `strict: false`), the supplied data produces
|
|
18
|
+
exactly one error:
|
|
19
|
+
|
|
20
|
+
| Instance path | Keyword | Message |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| `/supplier` | `enum` | must be equal to one of the allowed values |
|
|
23
|
+
|
|
24
|
+
## Orientation
|
|
25
|
+
|
|
26
|
+
`options.vertical` is the single orientation encoding, and it means the same
|
|
27
|
+
thing here as on a checkbox group — see
|
|
28
|
+
[the specification](../../docs/spec.md#185-choice-and-suggested-string-controls).
|
|
29
|
+
|
|
30
|
+
| Control | Orientation |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| Processing speed | Absent, so horizontal, wrapping when the row runs out of space. |
|
|
33
|
+
| Workspace | `vertical: true`, stacked — the labels are long enough that a row reads poorly. |
|
|
34
|
+
| Billing department | `vertical: true` on constant-based `oneOf` choices. |
|
|
35
|
+
|
|
36
|
+
The orientation is announced with `aria-orientation`, so assistive technology
|
|
37
|
+
describes the arrangement actually on screen rather than a default.
|
|
38
|
+
|
|
39
|
+
## What to try
|
|
40
|
+
|
|
41
|
+
**Nothing is preselected.** `region` has no value, and mounting must not choose
|
|
42
|
+
the first option. Check the Data tab: the property is still absent.
|
|
43
|
+
|
|
44
|
+
**Value identity survives.** `priority` is an integer enum holding `2`. It must
|
|
45
|
+
stay the number `2`, never the string `"2"` — labels and widget identifiers are
|
|
46
|
+
presentation, not the identity of the stored value.
|
|
47
|
+
|
|
48
|
+
**Labels translate, values do not.** `department` has `i18n: "department"`, so
|
|
49
|
+
core looks up `department.fin`. Switch the demo to Bulgarian: the label becomes
|
|
50
|
+
"Финанси" while the stored value stays `"fin"`.
|
|
51
|
+
|
|
52
|
+
**An out-of-domain value is preserved.** `supplier` holds `"Legacy"`, which is not
|
|
53
|
+
in its enum. No radio is selected, the value stays in the data, and validation
|
|
54
|
+
reports it. A renderer must not select the nearest option or clear the field to
|
|
55
|
+
make the widget look valid.
|
|
56
|
+
|
|
57
|
+
## Fallback behaviour
|
|
58
|
+
|
|
59
|
+
| Situation | Result |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| No `format: "radio"` | Ordinary enum selection — a dropdown — not radios. |
|
|
62
|
+
| `vertical` absent | Horizontal. Only an explicit `true` stacks. |
|
|
63
|
+
| Two choices with the same translated label | Both still render. They are keyed by value, so distinct values stay distinct choices. |
|
|
64
|
+
|
|
65
|
+
## Conformance scope
|
|
66
|
+
|
|
67
|
+
This walkthrough describes the portable contract. Renderer support must be checked
|
|
68
|
+
by a host adapter; the package validates the authored assets, not live UI behavior.
|
|
69
|
+
|
|
70
|
+
## Searchable choices
|
|
71
|
+
|
|
72
|
+
**Office location and Handling team ask for `options.autocomplete: true`**, so
|
|
73
|
+
their dropdowns take a query. The same Office location appears again below without
|
|
74
|
+
the option, which is **this family's default**: not searchable.
|
|
75
|
+
|
|
76
|
+
That default is a choice, and section 18 allows it — "preserves the renderer
|
|
77
|
+
family's documented default. No universal default is imposed" — but it differs
|
|
78
|
+
from Material, where searching is on unless `autocomplete: false`. A document
|
|
79
|
+
that relies on Material's default will render a plain dropdown here. See
|
|
80
|
+
[the specification](../../docs/spec.md#185-choice-and-suggested-string-controls).
|
|
81
|
+
|
|
82
|
+
**Search Handling team for `Oper`.** It matches **Operations**, the visible
|
|
83
|
+
label, not the stored constant `ops` — searching for `ops` finds nothing. The
|
|
84
|
+
labels come from the branch titles and go through the translator, so the same
|
|
85
|
+
search works in Bulgarian against the Bulgarian labels.
|
|
86
|
+
|
|
87
|
+
**Type something no choice matches.** A localized "No matching choices" appears,
|
|
88
|
+
and pressing Enter stores nothing: "search text is not itself a new allowed
|
|
89
|
+
value." For a field that *should* accept other values, the encoding is
|
|
90
|
+
`options.suggestion` on a plain string, not this.
|
|
91
|
+
|
|
92
|
+
## Standalone host setup
|
|
93
|
+
|
|
94
|
+
Load the JSON assets listed in [the catalog](../catalog.json) into a host
|
|
95
|
+
with the relevant renderer capabilities. Register the trusted tester functions
|
|
96
|
+
exported by `uischemas.json` for the Card detail modes tab. The generated example
|
|
97
|
+
module includes these registrations for demo hosts.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
## Feature navigation
|
|
101
|
+
|
|
102
|
+
Explore one feature at a time using the tabs: **Horizontal radio**, **Vertical radio**, **Constant choices**, **Value identity**, **Searchable choices**. Tab titles are localized in English and Bulgarian. The tabs share the existing form data.
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## Choice cards
|
|
106
|
+
The Choice cards tab covers image data URLs (explicitly enabled in config),
|
|
107
|
+
selected content, rich translated labels, typed values, a disabled card and
|
|
108
|
+
automatic labels. Card branch forms covers explicit Email detail and generated
|
|
109
|
+
Postal detail. Switching populated branch forms uses the shared confirmation
|
|
110
|
+
policy. English and Bulgarian translations accompany the card UI.
|
|
111
|
+
|
|
112
|
+
Card branch forms explicitly uses `confirmation.branchChange: "complex"`. A discriminator-only value switches immediately; entered branch details require confirmation. Branch switch without prompt uses `never`. The default oneOf policy remains `always`.
|
|
113
|
+
|
|
114
|
+
Card validation demonstrates an absent required choice, an invalid imported enum value, and an invalid email within a selected branch, with English and Bulgarian messages.
|
|
115
|
+
|
|
116
|
+
Object and array choices demonstrates preloaded nested object and array constants in dropdowns, radios, and table cells. These values must remain selected after JSON reload. This also provides a parity fixture for renderer families whose composite choice support is not yet certified.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
## Card detail modes
|
|
120
|
+
|
|
121
|
+
The **Card detail modes** tab presents the same `cardContact` value twice:
|
|
122
|
+
|
|
123
|
+
- `choices[].detail: "GENERATE"` bypasses the matching registry entry and shows
|
|
124
|
+
the generated branch fields, including the discriminator.
|
|
125
|
+
- `choices[].detail: "REGISTERED"` uses `uischemas.json` for Email. Its custom
|
|
126
|
+
**Registered email address** label makes registry selection visible, and its
|
|
127
|
+
layout omits the discriminator already controlled by the cards.
|
|
128
|
+
|
|
129
|
+
Edit either email address and the other presentation updates. Switch to Postal
|
|
130
|
+
mail (confirm discarding populated details): no registry entry matches that
|
|
131
|
+
branch, so REGISTERED falls back to generation and both show Street and City.
|
|
132
|
+
The existing Card branch forms tab retains its inline Email detail for comparison.
|
|
133
|
+
The new tab and registered label have English and Bulgarian translations.
|
|
134
|
+
|
|
135
|
+
See the [implementation guide](../../docs/implementation-guide.md#choice-card-branch-details)
|
|
136
|
+
for executed renderer coverage of this example.
|