@dxos/react-ui-form 0.8.4-staging.60fe92afc8 → 0.9.1-main.c7dcc2e112
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/lib/browser/index.mjs +2221 -2147
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +2221 -2147
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +3 -3
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +15 -110
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +3 -37
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormControls.d.ts +66 -0
- package/dist/types/src/components/Form/FormControls.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/FieldHeader.d.ts +19 -0
- package/dist/types/src/components/Form/FormField/FieldHeader.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/FormField.d.ts +30 -0
- package/dist/types/src/components/Form/FormField/FormField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/FormFieldWrapper.d.ts +47 -0
- package/dist/types/src/components/Form/FormField/FormFieldWrapper.d.ts.map +1 -0
- package/dist/types/src/components/Form/{FormFieldComponent.stories.d.ts → FormField/FormFieldWrapper.stories.d.ts} +3 -3
- package/dist/types/src/components/Form/FormField/FormFieldWrapper.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/{fields → FormField/fields/ArrayField}/ArrayField.d.ts +2 -2
- package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.d.ts +87 -0
- package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/ArrayField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/ArrayField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/BooleanField/BooleanField.d.ts +4 -0
- package/dist/types/src/components/Form/FormField/fields/BooleanField/BooleanField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/BooleanField/BooleanField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/BooleanField/BooleanField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/BooleanField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/BooleanField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/DateField/DateField.d.ts +4 -0
- package/dist/types/src/components/Form/FormField/fields/DateField/DateField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/DateField/DateField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/DateField/DateField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/DateField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/DateField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/{fields → FormField/fields/GeoPointField}/GeoPointField.d.ts +2 -2
- package/dist/types/src/components/Form/FormField/fields/GeoPointField/GeoPointField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/GeoPointField/GeoPointField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/GeoPointField/GeoPointField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/GeoPointField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/GeoPointField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/{fields → FormField/fields/MarkdownField}/MarkdownField.d.ts +2 -2
- package/dist/types/src/components/Form/FormField/fields/MarkdownField/MarkdownField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/MarkdownField/MarkdownField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/MarkdownField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/MarkdownField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.d.ts +4 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/InlineRefField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/RefField.d.ts +16 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/RefField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/RefField.stories.d.ts +92 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/RefField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/RefField.test.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/index.d.ts +3 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/{fields → FormField/fields/SelectField}/SelectField.d.ts +2 -2
- package/dist/types/src/components/Form/FormField/fields/SelectField/SelectField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/SelectField/SelectField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/SelectField/SelectField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/SelectField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/SelectField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/SelectOptionField/SelectOptionField.d.ts +5 -0
- package/dist/types/src/components/Form/FormField/fields/SelectOptionField/SelectOptionField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/SelectOptionField/SelectOptionField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/SelectOptionField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/SelectOptionField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TextAreaField/TextAreaField.d.ts +4 -0
- package/dist/types/src/components/Form/FormField/fields/TextAreaField/TextAreaField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TextAreaField/TextAreaField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/TextAreaField/TextAreaField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TextAreaField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/TextAreaField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TextField/TextField.d.ts +4 -0
- package/dist/types/src/components/Form/FormField/fields/TextField/TextField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TextField/TextField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/TextField/TextField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TextField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/TextField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/{fields → FormField/fields/TupleField}/TupleField.d.ts +2 -2
- package/dist/types/src/components/Form/FormField/fields/TupleField/TupleField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TupleField/TupleField.stories.d.ts +88 -0
- package/dist/types/src/components/Form/FormField/fields/TupleField/TupleField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/TupleField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/TupleField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/{fields → FormField/fields}/index.d.ts +0 -1
- package/dist/types/src/components/Form/FormField/fields/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/index.d.ts +5 -0
- package/dist/types/src/components/Form/FormField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/{FormFieldSet.d.ts → FormFieldSet/FormFieldSet.d.ts} +4 -3
- package/dist/types/src/components/Form/FormFieldSet/FormFieldSet.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormFieldSet/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormFieldSet/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormLayout/FormLayout.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormLayout/FormLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormLayout/FormLayout.stories.test.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormLayout/FormLayout.test.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormLayout/index.d.ts +3 -0
- package/dist/types/src/components/Form/FormLayout/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormLayout/parser.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormLayout/parser.test.d.ts.map +1 -0
- package/dist/types/src/components/Form/index.d.ts +3 -5
- package/dist/types/src/components/Form/index.d.ts.map +1 -1
- package/dist/types/src/components/Form/meta-tags.d.ts +2 -2
- package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -1
- package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +6 -23
- package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
- package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -1
- package/dist/types/src/components/RefEditor/RefEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useFormContext.d.ts +37 -0
- package/dist/types/src/hooks/useFormContext.d.ts.map +1 -0
- package/dist/types/src/hooks/useFormHandler.d.ts +1 -4
- package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/{components/testing.d.ts → testing/TestLayout.d.ts} +1 -1
- package/dist/types/src/testing/TestLayout.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +3 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/schema.d.ts +43 -0
- package/dist/types/src/testing/schema.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +112 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/omit.d.ts +12 -0
- package/dist/types/src/util/omit.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -34
- package/src/components/FieldEditor/FieldEditor.stories.tsx +1 -1
- package/src/components/FieldEditor/FieldEditor.test.tsx +1 -1
- package/src/components/FieldEditor/FieldEditor.tsx +5 -4
- package/src/components/Form/Form.stories.tsx +4 -49
- package/src/components/Form/Form.tsx +18 -447
- package/src/components/Form/FormControls.tsx +320 -0
- package/src/components/Form/FormField/FieldHeader.tsx +36 -0
- package/src/components/Form/{FormField.tsx → FormField/FormField.tsx} +35 -59
- package/src/components/Form/{FormFieldComponent.stories.tsx → FormField/FormFieldWrapper.stories.tsx} +24 -17
- package/src/components/Form/{FormFieldComponent.tsx → FormField/FormFieldWrapper.tsx} +21 -95
- package/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.tsx +103 -0
- package/src/components/Form/FormField/fields/ArrayField/ArrayField.tsx +269 -0
- package/src/components/Form/FormField/fields/ArrayField/index.ts +5 -0
- package/src/components/Form/FormField/fields/BooleanField/BooleanField.stories.tsx +52 -0
- package/src/components/Form/{fields → FormField/fields/BooleanField}/BooleanField.tsx +10 -3
- package/src/components/Form/FormField/fields/BooleanField/index.ts +5 -0
- package/src/components/Form/FormField/fields/DateField/DateField.stories.tsx +60 -0
- package/src/components/Form/{fields → FormField/fields/DateField}/DateField.tsx +4 -2
- package/src/components/Form/FormField/fields/DateField/index.ts +5 -0
- package/src/components/Form/FormField/fields/GeoPointField/GeoPointField.stories.tsx +53 -0
- package/src/components/Form/{fields → FormField/fields/GeoPointField}/GeoPointField.tsx +4 -3
- package/src/components/Form/FormField/fields/GeoPointField/index.ts +5 -0
- package/src/components/Form/{fields → FormField/fields/MarkdownField}/MarkdownField.stories.tsx +6 -6
- package/src/components/Form/{fields → FormField/fields/MarkdownField}/MarkdownField.tsx +3 -2
- package/src/components/Form/FormField/fields/MarkdownField/index.ts +5 -0
- package/src/components/Form/FormField/fields/NumberField/NumberField.stories.tsx +52 -0
- package/src/components/Form/{fields → FormField/fields/NumberField}/NumberField.tsx +27 -2
- package/src/components/Form/FormField/fields/NumberField/index.ts +5 -0
- package/src/components/Form/{fields → FormField/fields/RefField}/InlineRefField.tsx +8 -7
- package/src/components/Form/FormField/fields/RefField/RefField.stories.tsx +97 -0
- package/src/components/Form/{fields → FormField/fields/RefField}/RefField.test.ts +2 -1
- package/src/components/Form/{fields → FormField/fields/RefField}/RefField.tsx +6 -25
- package/src/components/Form/FormField/fields/RefField/index.ts +6 -0
- package/src/components/Form/FormField/fields/SelectField/SelectField.stories.tsx +53 -0
- package/src/components/Form/{fields → FormField/fields/SelectField}/SelectField.tsx +4 -2
- package/src/components/Form/FormField/fields/SelectField/index.ts +5 -0
- package/src/components/Form/{fields → FormField/fields/SelectOptionField}/SelectOptionField.stories.tsx +5 -5
- package/src/components/Form/{fields → FormField/fields/SelectOptionField}/SelectOptionField.tsx +55 -53
- package/src/components/Form/FormField/fields/SelectOptionField/index.ts +5 -0
- package/src/components/Form/FormField/fields/TextAreaField/TextAreaField.stories.tsx +53 -0
- package/src/components/Form/{fields → FormField/fields/TextAreaField}/TextAreaField.tsx +4 -2
- package/src/components/Form/FormField/fields/TextAreaField/index.ts +5 -0
- package/src/components/Form/FormField/fields/TextField/TextField.stories.tsx +52 -0
- package/src/components/Form/{fields → FormField/fields/TextField}/TextField.tsx +4 -2
- package/src/components/Form/FormField/fields/TextField/index.ts +5 -0
- package/src/components/Form/FormField/fields/TupleField/TupleField.stories.tsx +55 -0
- package/src/components/Form/{fields → FormField/fields/TupleField}/TupleField.tsx +4 -2
- package/src/components/Form/FormField/fields/TupleField/index.ts +5 -0
- package/src/components/Form/{fields → FormField/fields}/index.ts +0 -1
- package/src/components/Form/FormField/index.ts +8 -0
- package/src/components/Form/{FormFieldSet.tsx → FormFieldSet/FormFieldSet.tsx} +16 -32
- package/src/components/Form/FormFieldSet/index.ts +5 -0
- package/src/components/Form/{Layout → FormLayout}/FormLayout.stories.tsx +4 -4
- package/src/components/Form/{Layout → FormLayout}/FormLayout.tsx +7 -6
- package/src/components/Form/{Layout → FormLayout}/index.ts +1 -2
- package/src/components/Form/index.ts +3 -5
- package/src/components/Form/meta-tags.ts +1 -1
- package/src/components/ObjectForm/ObjectForm.tsx +15 -14
- package/src/components/ObjectPicker/ObjectPicker.tsx +19 -27
- package/src/components/ObjectProperties/ObjectProperties.stories.tsx +1 -1
- package/src/components/ObjectProperties/ObjectProperties.test.tsx +1 -1
- package/src/components/ObjectProperties/ObjectProperties.tsx +2 -1
- package/src/components/RefEditor/RefEditor.stories.tsx +0 -1
- package/src/components/ViewEditor/ViewEditor.stories.tsx +4 -5
- package/src/components/ViewEditor/ViewEditor.test.tsx +1 -1
- package/src/components/ViewEditor/ViewEditor.tsx +98 -128
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useFormContext.ts +86 -0
- package/src/hooks/useFormHandler.ts +1 -4
- package/src/index.ts +1 -0
- package/src/{components/testing.tsx → testing/TestLayout.tsx} +1 -1
- package/src/testing/index.ts +7 -0
- package/src/testing/schema.ts +59 -0
- package/src/types.ts +134 -0
- package/src/util/index.ts +1 -0
- package/src/util/omit.ts +47 -0
- package/src/vitest-setup.ts +40 -0
- package/dist/types/src/components/Form/FormField.d.ts +0 -52
- package/dist/types/src/components/Form/FormField.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormFieldComponent.d.ts +0 -98
- package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormFieldSet.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormTooltipsContext.d.ts +0 -19
- package/dist/types/src/components/Form/FormTooltipsContext.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/FormLayout.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/FormLayout.stories.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/FormLayout.stories.test.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/FormLayout.test.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/annotation.d.ts +0 -30
- package/dist/types/src/components/Form/Layout/annotation.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/index.d.ts +0 -4
- package/dist/types/src/components/Form/Layout/index.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/parser.d.ts.map +0 -1
- package/dist/types/src/components/Form/Layout/parser.test.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/BooleanField.d.ts +0 -4
- package/dist/types/src/components/Form/fields/BooleanField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/DateField.d.ts +0 -4
- package/dist/types/src/components/Form/fields/DateField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/GeoPointField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/InlineRefField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/MarkdownField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/NumberField.d.ts +0 -4
- package/dist/types/src/components/Form/fields/NumberField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/RefField.d.ts +0 -34
- package/dist/types/src/components/Form/fields/RefField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/RefField.test.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/SelectField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/SelectOptionField.d.ts +0 -5
- package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/TextAreaField.d.ts +0 -4
- package/dist/types/src/components/Form/fields/TextAreaField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/TextField.d.ts +0 -4
- package/dist/types/src/components/Form/fields/TextField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/TupleField.d.ts.map +0 -1
- package/dist/types/src/components/Form/fields/index.d.ts.map +0 -1
- package/dist/types/src/components/testing.d.ts.map +0 -1
- package/src/components/Form/AUDIT.md +0 -17
- package/src/components/Form/FormTooltipsContext.ts +0 -25
- package/src/components/Form/Layout/annotation.ts +0 -38
- package/src/components/Form/README.md +0 -3
- package/src/components/Form/fields/ArrayField.tsx +0 -173
- /package/dist/types/src/components/Form/{fields → FormField/fields/MarkdownField}/MarkdownField.stories.d.ts +0 -0
- /package/dist/types/src/components/Form/{fields → FormField/fields/RefField}/InlineRefField.d.ts +0 -0
- /package/dist/types/src/components/Form/{fields → FormField/fields/RefField}/RefField.test.d.ts +0 -0
- /package/dist/types/src/components/Form/{fields → FormField/fields/SelectOptionField}/SelectOptionField.stories.d.ts +0 -0
- /package/dist/types/src/components/Form/{Layout → FormLayout}/FormLayout.d.ts +0 -0
- /package/dist/types/src/components/Form/{Layout → FormLayout}/FormLayout.stories.d.ts +0 -0
- /package/dist/types/src/components/Form/{Layout → FormLayout}/FormLayout.stories.test.d.ts +0 -0
- /package/dist/types/src/components/Form/{Layout → FormLayout}/FormLayout.test.d.ts +0 -0
- /package/dist/types/src/components/Form/{Layout → FormLayout}/parser.d.ts +0 -0
- /package/dist/types/src/components/Form/{Layout → FormLayout}/parser.test.d.ts +0 -0
- /package/src/components/Form/{Layout → FormLayout}/FormLayout.stories.test.tsx +0 -0
- /package/src/components/Form/{Layout → FormLayout}/FormLayout.test.ts +0 -0
- /package/src/components/Form/{Layout → FormLayout}/parser.test.ts +0 -0
- /package/src/components/Form/{Layout → FormLayout}/parser.ts +0 -0
package/src/components/Form/{fields → FormField/fields/SelectOptionField}/SelectOptionField.tsx
RENAMED
|
@@ -6,14 +6,15 @@ import React, { type ChangeEvent, type KeyboardEvent, useCallback, useEffect, us
|
|
|
6
6
|
|
|
7
7
|
import { type SelectOption } from '@dxos/echo/Format';
|
|
8
8
|
import { PublicKey } from '@dxos/keys';
|
|
9
|
-
import { type ChromaticPalette, IconButton, Input, Tag, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
9
|
+
import { type ChromaticPalette, IconButton, Input, Tag, ToggleIconButton, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { OrderedList } from '@dxos/react-ui-list';
|
|
11
11
|
import { HuePicker } from '@dxos/react-ui-pickers';
|
|
12
12
|
import { hues, osTranslations } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
14
|
import { translationKey } from '#translations';
|
|
15
|
+
import { type FormFieldRendererProps } from '#types';
|
|
15
16
|
|
|
16
|
-
import {
|
|
17
|
+
import { FormFieldLabel } from '../../FormFieldWrapper';
|
|
17
18
|
|
|
18
19
|
export const SelectOptionField = ({
|
|
19
20
|
type,
|
|
@@ -23,7 +24,7 @@ export const SelectOptionField = ({
|
|
|
23
24
|
getStatus,
|
|
24
25
|
getValue,
|
|
25
26
|
onValueChange,
|
|
26
|
-
}:
|
|
27
|
+
}: FormFieldRendererProps<SelectOption[] | undefined>) => {
|
|
27
28
|
const { t } = useTranslation(translationKey);
|
|
28
29
|
const { status, error } = getStatus();
|
|
29
30
|
const [selected, setSelectedId] = useState<string | null>(null);
|
|
@@ -123,62 +124,63 @@ export const SelectOptionField = ({
|
|
|
123
124
|
<FormFieldLabel error={error} readonly={readonly} label={label} path={jsonPath} />
|
|
124
125
|
<div>
|
|
125
126
|
{options && (
|
|
126
|
-
<
|
|
127
|
+
<OrderedList.Root<SelectOption>
|
|
127
128
|
items={options}
|
|
128
129
|
isItem={(_item) => true}
|
|
130
|
+
getId={(option) => option.id}
|
|
129
131
|
onMove={readonly ? undefined : handleMove}
|
|
130
132
|
readonly={!!readonly}
|
|
131
133
|
>
|
|
132
134
|
{({ items }) => (
|
|
133
|
-
<
|
|
135
|
+
<OrderedList.Content classNames='w-full overflow-auto'>
|
|
134
136
|
{items?.map((item) => (
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
</List.ItemTitle>
|
|
148
|
-
<IconButton
|
|
149
|
-
iconOnly
|
|
150
|
-
variant='ghost'
|
|
151
|
-
label={t(selected === item.id ? 'collapse.label' : 'expand.label', { ns: osTranslations })}
|
|
152
|
-
icon={selected === item.id ? 'ph--caret-down--regular' : 'ph--caret-right--regular'}
|
|
153
|
-
onClick={() => handleClick(item.id)}
|
|
154
|
-
/>
|
|
137
|
+
<OrderedList.Item
|
|
138
|
+
key={item.id}
|
|
139
|
+
id={item.id}
|
|
140
|
+
item={item}
|
|
141
|
+
canDrag={!readonly}
|
|
142
|
+
classNames='flex flex-col cursor-pointer rounded-xs dx-hover'
|
|
143
|
+
>
|
|
144
|
+
<div className='flex items-center'>
|
|
145
|
+
<OrderedList.DragHandle />
|
|
146
|
+
{/* TODO(ZaymonFC): Move spacer into Tag component. */}
|
|
147
|
+
<div className='flex grow items-center truncate px-2' onClick={() => handleClick(item.id)}>
|
|
148
|
+
<Tag palette={item.color as ChromaticPalette}>{item.title || '\u200b'}</Tag>
|
|
155
149
|
</div>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
150
|
+
<ToggleIconButton
|
|
151
|
+
iconOnly
|
|
152
|
+
variant='ghost'
|
|
153
|
+
active={selected === item.id}
|
|
154
|
+
icon='ph--caret-right--regular'
|
|
155
|
+
label={t(selected === item.id ? 'collapse.label' : 'expand.label', { ns: osTranslations })}
|
|
156
|
+
onClick={() => handleClick(item.id)}
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
{selected === item.id && (
|
|
160
|
+
<div className='flex flex-col p-form-padding gap-form-gap dx-density-md'>
|
|
161
|
+
<Input.Label classNames='text-sm'>{t('select-option.label')}</Input.Label>
|
|
162
|
+
<div className='grid grid-cols-[1fr_min-content_min-content] gap-form-gap'>
|
|
163
|
+
<Input.TextInput
|
|
164
|
+
disabled={!!readonly}
|
|
165
|
+
placeholder={t('select-option-label.placeholder')}
|
|
166
|
+
ref={selected === item.id ? inputRef : undefined}
|
|
167
|
+
value={item.title}
|
|
168
|
+
onChange={handleTitleChange(item.id)}
|
|
169
|
+
onKeyDown={handleKeyDown}
|
|
170
|
+
classNames='flex-1'
|
|
171
|
+
/>
|
|
172
|
+
<HuePicker disabled={!!readonly} value={item.color} onChange={handleColorChange(item.id)} />
|
|
173
|
+
<IconButton
|
|
174
|
+
disabled={!!readonly}
|
|
175
|
+
icon='ph--trash--fill'
|
|
176
|
+
iconOnly
|
|
177
|
+
label={t('select-option-delete.button')}
|
|
178
|
+
onClick={() => handleDelete(item.id)}
|
|
179
|
+
/>
|
|
178
180
|
</div>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
</
|
|
181
|
+
</div>
|
|
182
|
+
)}
|
|
183
|
+
</OrderedList.Item>
|
|
182
184
|
))}
|
|
183
185
|
<IconButton
|
|
184
186
|
variant='ghost'
|
|
@@ -188,9 +190,9 @@ export const SelectOptionField = ({
|
|
|
188
190
|
disabled={!!readonly}
|
|
189
191
|
classNames='w-full'
|
|
190
192
|
/>
|
|
191
|
-
</
|
|
193
|
+
</OrderedList.Content>
|
|
192
194
|
)}
|
|
193
|
-
</
|
|
195
|
+
</OrderedList.Root>
|
|
194
196
|
)}
|
|
195
197
|
</div>
|
|
196
198
|
</Input.Root>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Format } from '@dxos/echo';
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
|
|
12
|
+
import { translations } from '#translations';
|
|
13
|
+
|
|
14
|
+
import { TestLayout } from '../../../../../testing';
|
|
15
|
+
import { Form } from '../../../Form';
|
|
16
|
+
|
|
17
|
+
const schema = Schema.Struct({
|
|
18
|
+
notes: Format.Text.annotations({ title: 'Notes' }),
|
|
19
|
+
}).pipe(Schema.mutable);
|
|
20
|
+
|
|
21
|
+
type Values = Schema.Schema.Type<typeof schema>;
|
|
22
|
+
|
|
23
|
+
const DefaultStory = () => {
|
|
24
|
+
const [values, setValues] = useState<Values>({ notes: 'Multi-line\nplain text.' });
|
|
25
|
+
return (
|
|
26
|
+
<TestLayout json={values}>
|
|
27
|
+
<Form.Root
|
|
28
|
+
schema={schema}
|
|
29
|
+
values={values}
|
|
30
|
+
onValuesChanged={(values) => setValues((prev) => ({ ...prev, ...values }))}
|
|
31
|
+
>
|
|
32
|
+
<Form.Viewport>
|
|
33
|
+
<Form.Content>
|
|
34
|
+
<Form.FieldSet />
|
|
35
|
+
</Form.Content>
|
|
36
|
+
</Form.Viewport>
|
|
37
|
+
</Form.Root>
|
|
38
|
+
</TestLayout>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const meta = {
|
|
43
|
+
title: 'ui/react-ui-form/FormField/TextAreaField',
|
|
44
|
+
render: DefaultStory,
|
|
45
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
46
|
+
parameters: { layout: 'fullscreen', translations },
|
|
47
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
48
|
+
|
|
49
|
+
export default meta;
|
|
50
|
+
|
|
51
|
+
type Story = StoryObj<typeof meta>;
|
|
52
|
+
|
|
53
|
+
export const Default: Story = {};
|
|
@@ -6,7 +6,9 @@ import React, { useCallback } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Input, type TextAreaProps } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
-
import { type
|
|
9
|
+
import { type FormFieldRendererProps } from '#types';
|
|
10
|
+
|
|
11
|
+
import { FormFieldWrapper } from '../../FormFieldWrapper';
|
|
10
12
|
|
|
11
13
|
export const TextAreaField = ({
|
|
12
14
|
type,
|
|
@@ -15,7 +17,7 @@ export const TextAreaField = ({
|
|
|
15
17
|
onValueChange,
|
|
16
18
|
onBlur,
|
|
17
19
|
...props
|
|
18
|
-
}:
|
|
20
|
+
}: FormFieldRendererProps<string>) => {
|
|
19
21
|
const handleChange = useCallback<NonNullable<TextAreaProps['onChange']>>(
|
|
20
22
|
(event) => onValueChange(type, event.target.value),
|
|
21
23
|
[type, onValueChange],
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
|
+
|
|
11
|
+
import { translations } from '#translations';
|
|
12
|
+
|
|
13
|
+
import { TestLayout } from '../../../../../testing';
|
|
14
|
+
import { Form } from '../../../Form';
|
|
15
|
+
|
|
16
|
+
const schema = Schema.Struct({
|
|
17
|
+
name: Schema.String.annotations({ title: 'Name' }),
|
|
18
|
+
}).pipe(Schema.mutable);
|
|
19
|
+
|
|
20
|
+
type Values = Schema.Schema.Type<typeof schema>;
|
|
21
|
+
|
|
22
|
+
const DefaultStory = () => {
|
|
23
|
+
const [values, setValues] = useState<Values>({ name: 'Alice' });
|
|
24
|
+
return (
|
|
25
|
+
<TestLayout json={values}>
|
|
26
|
+
<Form.Root
|
|
27
|
+
schema={schema}
|
|
28
|
+
values={values}
|
|
29
|
+
onValuesChanged={(values) => setValues((prev) => ({ ...prev, ...values }))}
|
|
30
|
+
>
|
|
31
|
+
<Form.Viewport>
|
|
32
|
+
<Form.Content>
|
|
33
|
+
<Form.FieldSet />
|
|
34
|
+
</Form.Content>
|
|
35
|
+
</Form.Viewport>
|
|
36
|
+
</Form.Root>
|
|
37
|
+
</TestLayout>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const meta = {
|
|
42
|
+
title: 'ui/react-ui-form/FormField/TextField',
|
|
43
|
+
render: DefaultStory,
|
|
44
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
45
|
+
parameters: { layout: 'fullscreen', translations },
|
|
46
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
47
|
+
|
|
48
|
+
export default meta;
|
|
49
|
+
|
|
50
|
+
type Story = StoryObj<typeof meta>;
|
|
51
|
+
|
|
52
|
+
export const Default: Story = {};
|
|
@@ -6,7 +6,9 @@ import React, { useCallback } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Input, type TextInputProps } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
-
import { type
|
|
9
|
+
import { type FormFieldRendererProps } from '#types';
|
|
10
|
+
|
|
11
|
+
import { FormFieldWrapper } from '../../FormFieldWrapper';
|
|
10
12
|
|
|
11
13
|
export const TextField = ({
|
|
12
14
|
type,
|
|
@@ -15,7 +17,7 @@ export const TextField = ({
|
|
|
15
17
|
onBlur,
|
|
16
18
|
onValueChange,
|
|
17
19
|
...props
|
|
18
|
-
}:
|
|
20
|
+
}: FormFieldRendererProps<string>) => {
|
|
19
21
|
const handleChange = useCallback<NonNullable<TextInputProps['onChange']>>(
|
|
20
22
|
(event) => onValueChange(type, event.target.value),
|
|
21
23
|
[type, onValueChange],
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
|
+
|
|
11
|
+
import { translations } from '#translations';
|
|
12
|
+
|
|
13
|
+
import { TestLayout } from '../../../../../testing';
|
|
14
|
+
import { Form } from '../../../Form';
|
|
15
|
+
import { TupleField } from './TupleField';
|
|
16
|
+
|
|
17
|
+
// TupleField isn't auto-dispatched and needs a `binding`; wire it via `fieldMap`.
|
|
18
|
+
const schema = Schema.Struct({
|
|
19
|
+
point: Schema.Struct({ x: Schema.Number, y: Schema.Number }).annotations({ title: 'Point' }),
|
|
20
|
+
}).pipe(Schema.mutable);
|
|
21
|
+
|
|
22
|
+
type Values = Schema.Schema.Type<typeof schema>;
|
|
23
|
+
|
|
24
|
+
const DefaultStory = () => {
|
|
25
|
+
const [values, setValues] = useState<Values>({ point: { x: 1, y: 2 } });
|
|
26
|
+
return (
|
|
27
|
+
<TestLayout json={values}>
|
|
28
|
+
<Form.Root
|
|
29
|
+
schema={schema}
|
|
30
|
+
values={values}
|
|
31
|
+
fieldMap={{ point: (props) => <TupleField {...props} binding={['x', 'y']} /> }}
|
|
32
|
+
onValuesChanged={(values) => setValues((prev) => ({ ...prev, ...values }))}
|
|
33
|
+
>
|
|
34
|
+
<Form.Viewport>
|
|
35
|
+
<Form.Content>
|
|
36
|
+
<Form.FieldSet />
|
|
37
|
+
</Form.Content>
|
|
38
|
+
</Form.Viewport>
|
|
39
|
+
</Form.Root>
|
|
40
|
+
</TestLayout>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const meta = {
|
|
45
|
+
title: 'ui/react-ui-form/FormField/TupleField',
|
|
46
|
+
render: DefaultStory,
|
|
47
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
48
|
+
parameters: { layout: 'fullscreen', translations },
|
|
49
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<typeof meta>;
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {};
|
|
@@ -8,7 +8,9 @@ import { Input } from '@dxos/react-ui';
|
|
|
8
8
|
import { mx } from '@dxos/ui-theme';
|
|
9
9
|
import { safeParseFloat } from '@dxos/util';
|
|
10
10
|
|
|
11
|
-
import { type
|
|
11
|
+
import { type FormFieldRendererProps } from '#types';
|
|
12
|
+
|
|
13
|
+
import { FormFieldLabel } from '../../FormFieldWrapper';
|
|
12
14
|
|
|
13
15
|
const gridCols = ['grid-cols-1', 'grid-cols-2', 'grid-cols-3', 'grid-cols-4'];
|
|
14
16
|
|
|
@@ -22,7 +24,7 @@ export const TupleField = ({
|
|
|
22
24
|
getValue,
|
|
23
25
|
onValueChange,
|
|
24
26
|
onBlur,
|
|
25
|
-
}:
|
|
27
|
+
}: FormFieldRendererProps<Record<string, number>> & {
|
|
26
28
|
binding: string[];
|
|
27
29
|
}) => {
|
|
28
30
|
const { status, error } = getStatus();
|
|
@@ -5,19 +5,18 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import React, { useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
+
import { DEFAULT_LAYOUT_NAME, FormLayoutAnnotation } from '@dxos/echo/Annotation';
|
|
8
9
|
import { type AnyProperties } from '@dxos/echo/internal';
|
|
9
10
|
import { SchemaEx } from '@dxos/effect';
|
|
10
|
-
import {
|
|
11
|
-
import { mx } from '@dxos/ui-theme';
|
|
11
|
+
import { ToggleIconButton, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
|
|
13
13
|
import { translationKey } from '#translations';
|
|
14
|
+
import { type CreateOptions, type FormFieldOptions, type RefFieldDataProps } from '#types';
|
|
14
15
|
|
|
15
|
-
import { type FormHandlerProps } from '
|
|
16
|
-
import { getRootFormProperties } from '
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { FormFieldErrorBoundary, FormFieldLabel } from './FormFieldComponent';
|
|
20
|
-
import { DEFAULT_LAYOUT_NAME, FormLayout, FormLayoutAnnotation } from './Layout';
|
|
16
|
+
import { type FormHandlerProps, useFormValues } from '../../../hooks';
|
|
17
|
+
import { getRootFormProperties } from '../../../util';
|
|
18
|
+
import { FormField, FormFieldErrorBoundary, FormFieldLabel, type FormFieldProps } from '../FormField';
|
|
19
|
+
import { FormLayout } from '../FormLayout';
|
|
21
20
|
|
|
22
21
|
const FORM_FIELDSET_NAME = 'Form.FieldSet';
|
|
23
22
|
|
|
@@ -37,25 +36,10 @@ export type FormFieldSetProps<T extends AnyProperties> = {
|
|
|
37
36
|
*/
|
|
38
37
|
layoutName?: string;
|
|
39
38
|
} & Pick<FormHandlerProps<T>, 'schema'> &
|
|
40
|
-
Pick<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
| 'readonly'
|
|
45
|
-
| 'layout'
|
|
46
|
-
| 'projection'
|
|
47
|
-
| 'fieldMap'
|
|
48
|
-
| 'fieldProvider'
|
|
49
|
-
| 'createTypename'
|
|
50
|
-
| 'createOptionLabel'
|
|
51
|
-
| 'createOptionIcon'
|
|
52
|
-
| 'createInitialValuePath'
|
|
53
|
-
| 'createFieldMap'
|
|
54
|
-
| 'db'
|
|
55
|
-
| 'useType'
|
|
56
|
-
| 'getOptions'
|
|
57
|
-
| 'onCreate'
|
|
58
|
-
>;
|
|
39
|
+
Pick<FormFieldProps, 'path' | 'autoFocus'> &
|
|
40
|
+
FormFieldOptions &
|
|
41
|
+
CreateOptions &
|
|
42
|
+
Pick<RefFieldDataProps, 'useType' | 'getOptions' | 'onCreate'>;
|
|
59
43
|
|
|
60
44
|
/**
|
|
61
45
|
* Renders a set of form fields derived from a schema object.
|
|
@@ -76,7 +60,7 @@ export const FormFieldSet = ({
|
|
|
76
60
|
const { t } = useTranslation(translationKey);
|
|
77
61
|
const values = useFormValues(FORM_FIELDSET_NAME, path);
|
|
78
62
|
const properties = useFormFieldSetProperties({ schema, values, exclude, sort, projection });
|
|
79
|
-
// TODO(burdon): Generalize collapse state (cf.
|
|
63
|
+
// TODO(burdon): Generalize collapse state (cf. useSelection in react-ui-attention, plugin-markdown cursor state).
|
|
80
64
|
const [collapsed, setCollapsed] = useState(false);
|
|
81
65
|
if ((readonly || layout === 'static') && values == null) {
|
|
82
66
|
return null;
|
|
@@ -120,19 +104,19 @@ export const FormFieldSet = ({
|
|
|
120
104
|
<>
|
|
121
105
|
{layout !== 'inline' && label && (
|
|
122
106
|
<FormFieldLabel
|
|
123
|
-
|
|
107
|
+
standalone
|
|
124
108
|
classNames='pl-2'
|
|
125
109
|
label={label}
|
|
126
110
|
path={SchemaEx.createJsonPath(path ?? [])}
|
|
127
111
|
button={
|
|
128
112
|
collapsible && (
|
|
129
|
-
<
|
|
113
|
+
<ToggleIconButton
|
|
114
|
+
active={!collapsed}
|
|
130
115
|
classNames='px-1 mr-0.5'
|
|
131
116
|
variant='ghost'
|
|
132
117
|
density='xs'
|
|
133
118
|
iconOnly
|
|
134
119
|
icon='ph--caret-right--regular'
|
|
135
|
-
iconClassNames={mx('transition-transform', !collapsed && 'rotate-90')}
|
|
136
120
|
label={t(collapsed ? 'expand-fields.label' : 'collapse-fields.label')}
|
|
137
121
|
/>
|
|
138
122
|
)
|
|
@@ -146,7 +130,7 @@ export const FormFieldSet = ({
|
|
|
146
130
|
|
|
147
131
|
// Nested field sets render inside an indented, bordered container with a collapse toggle.
|
|
148
132
|
if (collapsible) {
|
|
149
|
-
return <div className='border border-subdued-separator rounded-sm
|
|
133
|
+
return <div className='border border-subdued-separator rounded-sm mb-1'>{content}</div>;
|
|
150
134
|
}
|
|
151
135
|
|
|
152
136
|
return content;
|
|
@@ -19,9 +19,9 @@ import { trim } from '@dxos/util';
|
|
|
19
19
|
|
|
20
20
|
import { translations } from '#translations';
|
|
21
21
|
|
|
22
|
-
import { TestLayout, TestPanel } from '
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
22
|
+
import { TestLayout, TestPanel } from '../../../testing';
|
|
23
|
+
import { omitId } from '../../../util';
|
|
24
|
+
import { Form, type FormRootProps } from '../Form';
|
|
25
25
|
import { parseLayout } from './parser';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -84,7 +84,7 @@ const FLIGHT_LAYOUT_COMPACT = trim`
|
|
|
84
84
|
*/
|
|
85
85
|
const AnnotatedFlight = Type.getSchema(Flight)
|
|
86
86
|
.annotations({})
|
|
87
|
-
.pipe(FormLayoutAnnotation.set({ default: FLIGHT_LAYOUT, compact: FLIGHT_LAYOUT_COMPACT }));
|
|
87
|
+
.pipe(Annotation.FormLayoutAnnotation.set({ default: FLIGHT_LAYOUT, compact: FLIGHT_LAYOUT_COMPACT }));
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* Sample schema with nested `Place` structs carrying a `LabelAnnotation`.
|
|
@@ -13,10 +13,11 @@ import { type AnyProperties } from '@dxos/echo/internal';
|
|
|
13
13
|
import { SchemaEx } from '@dxos/effect';
|
|
14
14
|
import { Input } from '@dxos/react-ui';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { type FormPresentation } from '#types';
|
|
17
|
+
|
|
18
|
+
import { useFormFieldState } from '../../../hooks';
|
|
17
19
|
import { FormField, type FormFieldProps } from '../FormField';
|
|
18
|
-
import { FormFieldErrorBoundary, FormFieldLabel
|
|
19
|
-
import { DEFAULT_LAYOUT_NAME, FormLayoutAnnotation } from './annotation';
|
|
20
|
+
import { FormFieldErrorBoundary, FormFieldLabel } from '../FormField';
|
|
20
21
|
import { LayoutParseError, type LayoutNode, parseLayout } from './parser';
|
|
21
22
|
|
|
22
23
|
const FORM_LAYOUT_NAME = 'Form.Layout';
|
|
@@ -57,14 +58,14 @@ type FormFieldSetSubset = Pick<
|
|
|
57
58
|
export const FormLayout = ({
|
|
58
59
|
schema,
|
|
59
60
|
template,
|
|
60
|
-
name = DEFAULT_LAYOUT_NAME,
|
|
61
|
+
name = Annotation.DEFAULT_LAYOUT_NAME,
|
|
61
62
|
path,
|
|
62
63
|
readonly,
|
|
63
64
|
layout,
|
|
64
65
|
projection,
|
|
65
66
|
...props
|
|
66
67
|
}: FormLayoutProps) => {
|
|
67
|
-
const annotated = Option.getOrUndefined(FormLayoutAnnotation.get(schema));
|
|
68
|
+
const annotated = Option.getOrUndefined(Annotation.FormLayoutAnnotation.get(schema));
|
|
68
69
|
const source = template ?? annotated?.[name];
|
|
69
70
|
if (source === undefined) {
|
|
70
71
|
throw new LayoutParseError(
|
|
@@ -222,7 +223,7 @@ type LabelFieldProps = {
|
|
|
222
223
|
schema: Schema.Schema<any>;
|
|
223
224
|
label: string;
|
|
224
225
|
path: (string | number)[];
|
|
225
|
-
layout?:
|
|
226
|
+
layout?: FormPresentation;
|
|
226
227
|
};
|
|
227
228
|
|
|
228
229
|
/**
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './meta-tags';
|
|
6
6
|
|
|
7
7
|
export * from './Form';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './meta-tags';
|
|
11
|
-
export * from './Layout';
|
|
8
|
+
export * from './FormField';
|
|
9
|
+
export * from './FormFieldSet';
|