@dxos/react-ui-form 0.8.4-main.e8ec1fe → 0.8.4-main.effb148878
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 +102 -5
- package/README.md +0 -1
- package/dist/lib/browser/index.mjs +3240 -2345
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +83 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3240 -2345
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +85 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +8 -7
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +69 -59
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +123 -27
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +175 -137
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField.d.ts +48 -0
- package/dist/types/src/components/Form/FormField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormFieldComponent.d.ts +95 -0
- package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts +9 -0
- package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormFieldSet.d.ts +21 -0
- package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormTooltipsContext.d.ts +19 -0
- package/dist/types/src/components/Form/FormTooltipsContext.d.ts.map +1 -0
- package/dist/types/src/components/Form/Layout/FormLayout.d.ts +25 -0
- package/dist/types/src/components/Form/Layout/FormLayout.d.ts.map +1 -0
- package/dist/types/src/components/Form/Layout/FormLayout.stories.d.ts +116 -0
- package/dist/types/src/components/Form/Layout/FormLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/Layout/annotation.d.ts +30 -0
- package/dist/types/src/components/Form/Layout/annotation.d.ts.map +1 -0
- package/dist/types/src/components/Form/Layout/index.d.ts +4 -0
- package/dist/types/src/components/Form/Layout/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/Layout/parser.d.ts +31 -0
- package/dist/types/src/components/Form/Layout/parser.d.ts.map +1 -0
- package/dist/types/src/components/Form/Layout/parser.test.d.ts +2 -0
- package/dist/types/src/components/Form/Layout/parser.test.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/ArrayField.d.ts +18 -0
- package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/BooleanField.d.ts +4 -0
- package/dist/types/src/components/Form/fields/BooleanField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/DateField.d.ts +4 -0
- package/dist/types/src/components/Form/fields/DateField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/GeoPointField.d.ts +5 -0
- package/dist/types/src/components/Form/fields/GeoPointField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/MarkdownField.d.ts +11 -0
- package/dist/types/src/components/Form/fields/MarkdownField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts +85 -0
- package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/NumberField.d.ts +4 -0
- package/dist/types/src/components/Form/fields/NumberField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/RefField.d.ts +22 -0
- package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/SelectField.d.ts +13 -0
- package/dist/types/src/components/Form/fields/SelectField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/SelectOptionField.d.ts +5 -0
- package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +85 -0
- package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/TextAreaField.d.ts +4 -0
- package/dist/types/src/components/Form/fields/TextAreaField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/TextField.d.ts +4 -0
- package/dist/types/src/components/Form/fields/TextField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/TupleField.d.ts +6 -0
- package/dist/types/src/components/Form/fields/TupleField.d.ts.map +1 -0
- package/dist/types/src/components/Form/fields/index.d.ts +13 -0
- package/dist/types/src/components/Form/fields/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/index.d.ts +4 -4
- package/dist/types/src/components/Form/index.d.ts.map +1 -1
- package/dist/types/src/components/ObjectForm/ObjectForm.d.ts +8 -0
- package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -0
- package/dist/types/src/components/ObjectForm/index.d.ts +2 -0
- package/dist/types/src/components/ObjectForm/index.d.ts.map +1 -0
- package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +37 -10
- package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
- package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +65 -58
- package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +9 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts +128 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts.map +1 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts +2 -0
- package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts.map +1 -0
- package/dist/types/src/components/ObjectProperties/index.d.ts +2 -0
- package/dist/types/src/components/ObjectProperties/index.d.ts.map +1 -0
- package/dist/types/src/components/ObjectTree/ObjectTree.d.ts +9 -0
- package/dist/types/src/components/ObjectTree/ObjectTree.d.ts.map +1 -0
- package/dist/types/src/components/ObjectTree/ObjectTree.stories.d.ts +87 -0
- package/dist/types/src/components/ObjectTree/ObjectTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/ObjectTree/index.d.ts +2 -0
- package/dist/types/src/components/ObjectTree/index.d.ts.map +1 -0
- package/dist/types/src/components/Settings/Settings.d.ts +51 -0
- package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
- package/dist/types/src/components/Settings/Settings.stories.d.ts +85 -0
- package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
- package/dist/types/src/components/Settings/SettingsFieldSet.d.ts +43 -0
- package/dist/types/src/components/Settings/SettingsFieldSet.d.ts.map +1 -0
- package/dist/types/src/components/Settings/SettingsItem.d.ts +16 -0
- package/dist/types/src/components/Settings/SettingsItem.d.ts.map +1 -0
- package/dist/types/src/components/Settings/SettingsSelectField.d.ts +18 -0
- package/dist/types/src/components/Settings/SettingsSelectField.d.ts.map +1 -0
- package/dist/types/src/components/Settings/index.d.ts +4 -0
- package/dist/types/src/components/Settings/index.d.ts.map +1 -0
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +14 -18
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +71 -64
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +13 -6
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useFormHandler.d.ts +82 -0
- package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -0
- package/dist/types/src/hooks/useKeyHandler.d.ts +7 -0
- package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +66 -59
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/field-type.d.ts +19 -0
- package/dist/types/src/util/field-type.d.ts.map +1 -0
- package/dist/types/src/util/field.d.ts +3 -3
- package/dist/types/src/util/field.d.ts.map +1 -1
- package/dist/types/src/util/formatting.d.ts +2 -2
- package/dist/types/src/util/formatting.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +2 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/properties.d.ts +17 -0
- package/dist/types/src/util/properties.d.ts.map +1 -0
- package/dist/types/src/util/properties.test.d.ts +2 -0
- package/dist/types/src/util/properties.test.d.ts.map +1 -0
- package/dist/types/src/util/refs.d.ts +2 -2
- package/dist/types/src/util/refs.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -52
- package/src/components/FieldEditor/FieldEditor.stories.tsx +44 -25
- package/src/components/FieldEditor/FieldEditor.test.tsx +0 -1
- package/src/components/FieldEditor/FieldEditor.tsx +84 -84
- package/src/components/Form/AUDIT.md +17 -0
- package/src/components/Form/Form.stories.tsx +134 -252
- package/src/components/Form/Form.tsx +417 -109
- package/src/components/Form/FormField.tsx +332 -0
- package/src/components/Form/FormFieldComponent.stories.tsx +65 -0
- package/src/components/Form/FormFieldComponent.tsx +206 -0
- package/src/components/Form/FormFieldSet.tsx +173 -0
- package/src/components/Form/FormTooltipsContext.ts +25 -0
- package/src/components/Form/Layout/FormLayout.stories.tsx +339 -0
- package/src/components/Form/Layout/FormLayout.tsx +123 -0
- package/src/components/Form/Layout/annotation.ts +38 -0
- package/src/components/Form/Layout/index.ts +7 -0
- package/src/components/Form/Layout/parser.test.ts +120 -0
- package/src/components/Form/Layout/parser.ts +167 -0
- package/src/components/Form/README.md +3 -0
- package/src/components/Form/fields/ArrayField.tsx +185 -0
- package/src/components/Form/fields/BooleanField.tsx +22 -0
- package/src/components/Form/fields/DateField.tsx +95 -0
- package/src/components/Form/fields/GeoPointField.tsx +124 -0
- package/src/components/Form/fields/MarkdownField.stories.tsx +206 -0
- package/src/components/Form/fields/MarkdownField.tsx +168 -0
- package/src/components/Form/fields/NumberField.tsx +39 -0
- package/src/components/Form/fields/RefField.tsx +232 -0
- package/src/components/Form/fields/SelectField.tsx +77 -0
- package/src/components/Form/{custom/SelectOptionsInput.stories.tsx → fields/SelectOptionField.stories.tsx} +23 -18
- package/src/components/Form/{custom/SelectOptionsInput.tsx → fields/SelectOptionField.tsx} +32 -25
- package/src/components/Form/fields/TextAreaField.tsx +38 -0
- package/src/components/Form/fields/TextField.tsx +38 -0
- package/src/components/Form/{custom/TupleInput.tsx → fields/TupleField.tsx} +17 -9
- package/src/components/Form/fields/index.ts +16 -0
- package/src/components/Form/index.ts +5 -4
- package/src/components/ObjectForm/ObjectForm.tsx +115 -0
- package/src/components/{ControlSection → ObjectForm}/index.ts +1 -1
- package/src/components/ObjectPicker/ObjectPicker.stories.tsx +26 -21
- package/src/components/ObjectPicker/ObjectPicker.tsx +122 -81
- package/src/components/ObjectProperties/ObjectProperties.stories.tsx +350 -0
- package/src/components/ObjectProperties/ObjectProperties.test.tsx +108 -0
- package/src/components/ObjectProperties/ObjectProperties.tsx +147 -0
- package/src/components/ObjectProperties/index.ts +5 -0
- package/src/components/ObjectTree/ObjectTree.stories.tsx +134 -0
- package/src/components/ObjectTree/ObjectTree.tsx +190 -0
- package/src/components/ObjectTree/index.ts +5 -0
- package/src/components/Settings/AUDIT.md +51 -0
- package/src/components/Settings/Settings.stories.tsx +104 -0
- package/src/components/Settings/Settings.tsx +81 -0
- package/src/components/Settings/SettingsFieldSet.tsx +257 -0
- package/src/components/Settings/SettingsItem.tsx +58 -0
- package/src/components/Settings/SettingsSelectField.tsx +59 -0
- package/src/components/Settings/index.ts +7 -0
- package/src/components/ViewEditor/ViewEditor.stories.tsx +62 -71
- package/src/components/ViewEditor/ViewEditor.test.tsx +10 -10
- package/src/components/ViewEditor/ViewEditor.tsx +308 -217
- package/src/components/index.ts +4 -1
- package/src/components/testing.tsx +24 -11
- package/src/hooks/index.ts +2 -3
- package/src/hooks/useFormHandler.ts +380 -0
- package/src/hooks/useKeyHandler.tsx +37 -0
- package/src/index.ts +0 -4
- package/src/translations.ts +71 -64
- package/src/util/field-type.ts +60 -0
- package/src/util/field.ts +25 -25
- package/src/util/formatting.ts +22 -22
- package/src/util/index.ts +2 -1
- package/src/util/properties.test.ts +78 -0
- package/src/util/properties.ts +38 -0
- package/src/util/refs.ts +13 -15
- package/src/vite-env.d.ts +10 -0
- package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
- package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -83
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
- package/dist/types/src/components/ControlSection/index.d.ts +0 -2
- package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
- package/dist/types/src/components/Form/ArrayField.d.ts +0 -16
- package/dist/types/src/components/Form/ArrayField.d.ts.map +0 -1
- package/dist/types/src/components/Form/Defaults.d.ts +0 -14
- package/dist/types/src/components/Form/Defaults.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormActions.d.ts +0 -9
- package/dist/types/src/components/Form/FormActions.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormContent.d.ts +0 -63
- package/dist/types/src/components/Form/FormContent.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormContext.d.ts +0 -23
- package/dist/types/src/components/Form/FormContext.d.ts.map +0 -1
- package/dist/types/src/components/Form/Input.d.ts +0 -29
- package/dist/types/src/components/Form/Input.d.ts.map +0 -1
- package/dist/types/src/components/Form/RefField.d.ts +0 -22
- package/dist/types/src/components/Form/RefField.d.ts.map +0 -1
- package/dist/types/src/components/Form/custom/GeoPointInput.d.ts +0 -4
- package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +0 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts +0 -4
- package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +0 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +0 -78
- package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +0 -1
- package/dist/types/src/components/Form/custom/TupleInput.d.ts +0 -6
- package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +0 -1
- package/dist/types/src/components/Form/custom/index.d.ts +0 -4
- package/dist/types/src/components/Form/custom/index.d.ts.map +0 -1
- package/dist/types/src/components/Form/factory.d.ts +0 -8
- package/dist/types/src/components/Form/factory.d.ts.map +0 -1
- package/dist/types/src/hooks/useForm.d.ts +0 -67
- package/dist/types/src/hooks/useForm.d.ts.map +0 -1
- package/dist/types/src/hooks/useQueryRefOptions.d.ts +0 -29
- package/dist/types/src/hooks/useQueryRefOptions.d.ts.map +0 -1
- package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +0 -8
- package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +0 -1
- package/dist/types/src/util/schema.d.ts +0 -3
- package/dist/types/src/util/schema.d.ts.map +0 -1
- package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
- package/src/components/ControlSection/ControlSection.tsx +0 -153
- package/src/components/Form/ArrayField.tsx +0 -125
- package/src/components/Form/Defaults.tsx +0 -205
- package/src/components/Form/FormActions.tsx +0 -54
- package/src/components/Form/FormContent.tsx +0 -362
- package/src/components/Form/FormContext.tsx +0 -110
- package/src/components/Form/Input.tsx +0 -54
- package/src/components/Form/RefField.tsx +0 -283
- package/src/components/Form/custom/GeoPointInput.tsx +0 -80
- package/src/components/Form/custom/index.ts +0 -7
- package/src/components/Form/factory.tsx +0 -31
- package/src/hooks/useForm.ts +0 -296
- package/src/hooks/useQueryRefOptions.ts +0 -62
- package/src/hooks/useRefQueryLookupHandler.ts +0 -39
- package/src/util/schema.ts +0 -12
|
@@ -1,29 +1,125 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { type
|
|
3
|
-
import {
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
6
|
-
import { type
|
|
7
|
-
import { type
|
|
8
|
-
import { type
|
|
9
|
-
import { type
|
|
10
|
-
export type
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import React, { type PropsWithChildren } from 'react';
|
|
3
|
+
import { Type } from '@dxos/echo';
|
|
4
|
+
import { type AnyProperties } from '@dxos/echo/internal';
|
|
5
|
+
import { type IconButtonProps, type ThemedClassName } from '@dxos/react-ui';
|
|
6
|
+
import { type FormHandler, type FormHandlerProps, type FormUpdateMeta } from '../../hooks';
|
|
7
|
+
import { type FormFieldLabelProps, type FormFieldStateProps } from './FormFieldComponent';
|
|
8
|
+
import { type FormFieldSetProps as NaturalFormFieldSetProps } from './FormFieldSet';
|
|
9
|
+
import { type FormLayoutProps as NaturalFormLayoutProps } from './Layout/FormLayout';
|
|
10
|
+
export type ExcludeId<S extends Schema.Schema.AnyNoContext | Type.AnyEntity> = Omit<S extends Type.AnyEntity ? Type.InstanceType<S> : S extends Schema.Schema.AnyNoContext ? Schema.Schema.Type<S> : never, 'id'>;
|
|
11
|
+
export declare const omitId: <S extends Schema.Schema.AnyNoContext | Type.AnyEntity>(schemaOrType: S) => Schema.Schema<ExcludeId<S>, ExcludeId<S>>;
|
|
12
|
+
/**
|
|
13
|
+
* Drop fields annotated with `FormInputAnnotation.set(false)` from a schema so
|
|
14
|
+
* the form's validator doesn't trip on required-but-hidden fields. Used by
|
|
15
|
+
* the picker's inline create form, where a `FactoryAnnotation` typically
|
|
16
|
+
* supplies the hidden values (e.g. a backing-object Ref) outside the form.
|
|
17
|
+
*/
|
|
18
|
+
export declare const omitHiddenFormFields: <S extends Schema.Schema.AnyNoContext>(schema: S) => S;
|
|
19
|
+
type FormContextValue<T extends AnyProperties = any> = {
|
|
20
|
+
/**
|
|
21
|
+
* Form handler.
|
|
22
|
+
*/
|
|
23
|
+
form: FormHandler<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Show field tooltips (currently: JSON path on each label). Defaults to
|
|
26
|
+
* `true`; pass `false` to suppress.
|
|
27
|
+
*/
|
|
28
|
+
tooltips?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Testing.
|
|
31
|
+
*/
|
|
32
|
+
testId?: string;
|
|
33
|
+
} & Pick<NaturalFormFieldSetProps<T>, 'readonly' | 'layout' | 'fieldMap' | 'fieldProvider' | 'projection' | 'createTypename' | 'createFieldMap' | 'db'>;
|
|
34
|
+
declare const useFormContext: (consumerName: string) => FormContextValue<any>;
|
|
35
|
+
/**
|
|
36
|
+
* Get the current form values.
|
|
37
|
+
*/
|
|
38
|
+
declare const useFormValues: {
|
|
39
|
+
<T extends AnyProperties>(componentName: string, path?: (string | number)[]): T;
|
|
40
|
+
<T extends AnyProperties>(componentName: string, path: (string | number)[] | undefined, defaultValue: () => T): T | undefined;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Get the state props for the given field.
|
|
44
|
+
*/
|
|
45
|
+
declare const useFormFieldState: (componentName: string, path?: (string | number)[]) => FormFieldStateProps;
|
|
46
|
+
type FormRootProps<T extends AnyProperties = AnyProperties> = PropsWithChildren<{
|
|
47
|
+
/**
|
|
48
|
+
* Called when the form is submitted and passes validation.
|
|
49
|
+
*/
|
|
50
|
+
onSave?: (values: T, meta: FormUpdateMeta<T>) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Called when the form is canceled to abandon/undo any pending changes.
|
|
53
|
+
*/
|
|
26
54
|
onCancel?: () => void;
|
|
27
|
-
}> & Pick<
|
|
28
|
-
|
|
55
|
+
} & Omit<FormContextValue<T>, 'form'> & Pick<FormHandlerProps<T>, 'schema' | 'autoSave' | 'values' | 'defaultValues' | 'onValidate' | 'onValuesChanged'> & Omit<NaturalFormFieldSetProps<T>, 'schema' | 'path'>>;
|
|
56
|
+
declare function FormRoot<T extends AnyProperties = AnyProperties>({ children, schema, values, onSave, onCancel, ...props }: FormRootProps<T>): React.JSX.Element;
|
|
57
|
+
declare namespace FormRoot {
|
|
58
|
+
var displayName: string;
|
|
59
|
+
}
|
|
60
|
+
type FormViewportProps = {};
|
|
61
|
+
type FormContentProps = ThemedClassName<PropsWithChildren<{}>>;
|
|
62
|
+
type FormFieldSetProps = ThemedClassName<NaturalFormFieldSetProps<any>>;
|
|
63
|
+
declare function FormFieldSet(props: FormFieldSetProps): React.JSX.Element;
|
|
64
|
+
declare namespace FormFieldSet {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
type FormLayoutProps = Omit<NaturalFormLayoutProps, 'schema'> & {
|
|
68
|
+
schema?: NaturalFormLayoutProps['schema'];
|
|
69
|
+
};
|
|
70
|
+
declare function FormLayout({ schema, ...props }: FormLayoutProps): React.JSX.Element | null;
|
|
71
|
+
declare namespace FormLayout {
|
|
72
|
+
var displayName: string;
|
|
73
|
+
}
|
|
74
|
+
type FormActionsProps = ThemedClassName<{}>;
|
|
75
|
+
declare function FormActions({ classNames }: FormActionsProps): React.JSX.Element | null;
|
|
76
|
+
declare namespace FormActions {
|
|
77
|
+
var displayName: string;
|
|
78
|
+
}
|
|
79
|
+
type FormSectionProps = ThemedClassName<{
|
|
80
|
+
label?: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
}>;
|
|
83
|
+
type FormSubmitProps = ThemedClassName<Partial<Pick<IconButtonProps, 'icon' | 'label' | 'disabled'>>>;
|
|
84
|
+
declare function FormSubmit({ classNames, label, icon, disabled }: FormSubmitProps): React.JSX.Element | null;
|
|
85
|
+
declare namespace FormSubmit {
|
|
86
|
+
var displayName: string;
|
|
87
|
+
}
|
|
88
|
+
export declare const Form: {
|
|
89
|
+
Root: {
|
|
90
|
+
<T extends AnyProperties = AnyProperties>({ children, schema, values, onSave, onCancel, ...props }: FormRootProps<T>): React.JSX.Element;
|
|
91
|
+
displayName: string;
|
|
92
|
+
};
|
|
93
|
+
Viewport: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
|
|
94
|
+
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
95
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
96
|
+
Content: React.ForwardRefExoticComponent<Omit<FormContentProps, "className"> & {
|
|
97
|
+
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
98
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
99
|
+
Section: React.ForwardRefExoticComponent<Omit<FormSectionProps, "className"> & {
|
|
100
|
+
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
101
|
+
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
102
|
+
FieldSet: {
|
|
103
|
+
(props: FormFieldSetProps): React.JSX.Element;
|
|
104
|
+
displayName: string;
|
|
105
|
+
};
|
|
106
|
+
Layout: {
|
|
107
|
+
({ schema, ...props }: FormLayoutProps): React.JSX.Element | null;
|
|
108
|
+
displayName: string;
|
|
109
|
+
};
|
|
110
|
+
Label: {
|
|
111
|
+
({ label, error, readonly, asChild, path }: FormFieldLabelProps): React.JSX.Element;
|
|
112
|
+
displayName: string;
|
|
113
|
+
};
|
|
114
|
+
Actions: {
|
|
115
|
+
({ classNames }: FormActionsProps): React.JSX.Element | null;
|
|
116
|
+
displayName: string;
|
|
117
|
+
};
|
|
118
|
+
Submit: {
|
|
119
|
+
({ classNames, label, icon, disabled }: FormSubmitProps): React.JSX.Element | null;
|
|
120
|
+
displayName: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
export { useFormContext, useFormValues, useFormFieldState };
|
|
124
|
+
export type { FormRootProps, FormViewportProps, FormContentProps, FormSectionProps, FormFieldSetProps, FormLayoutProps, FormFieldLabelProps, FormActionsProps, FormSubmitProps, };
|
|
29
125
|
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAA8B,MAAM,OAAO,CAAC;AAElF,OAAO,EAAgC,IAAI,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAEL,KAAK,eAAe,EAEpB,KAAK,eAAe,EAGrB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAGpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAkB,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1G,OAAO,EAEL,KAAK,iBAAiB,IAAI,wBAAwB,EACnD,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,KAAK,eAAe,IAAI,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAKrF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,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import {
|
|
5
|
-
import { type
|
|
6
|
-
import { type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { Obj, Type } from '@dxos/echo';
|
|
5
|
+
import { type AnyProperties } from '@dxos/echo/internal';
|
|
6
|
+
import { type ExcludeId, type FormRootProps } from './Form';
|
|
7
|
+
declare const Organization: Type.Obj<{
|
|
8
|
+
readonly name: string;
|
|
9
|
+
}, Schema.Struct.Fields>;
|
|
10
|
+
export type Organization = Type.InstanceType<typeof Organization>;
|
|
11
|
+
declare const Person: Type.Obj<{
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly ignore?: string | undefined;
|
|
14
|
+
readonly active?: boolean | undefined;
|
|
15
|
+
readonly address?: {
|
|
16
|
+
readonly street: string;
|
|
17
|
+
readonly city: string;
|
|
18
|
+
readonly state: string;
|
|
19
|
+
readonly zip: number;
|
|
20
|
+
} | undefined;
|
|
21
|
+
readonly employer?: import("@dxos/echo/internal").Ref<{
|
|
22
|
+
readonly name: string;
|
|
23
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
|
|
24
|
+
readonly tags?: readonly import("@dxos/echo/internal").Ref<{
|
|
25
|
+
readonly label: string;
|
|
26
|
+
readonly hue?: string | undefined;
|
|
27
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[] | undefined;
|
|
28
|
+
readonly status?: "active" | "inactive" | undefined;
|
|
29
|
+
readonly notes?: string | undefined;
|
|
30
|
+
readonly location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
31
|
+
readonly birthday?: string | undefined;
|
|
32
|
+
readonly meetingAt?: string | undefined;
|
|
33
|
+
readonly reminderAt?: string | undefined;
|
|
34
|
+
readonly tasks?: readonly string[] | undefined;
|
|
35
|
+
readonly locations?: readonly (readonly [number, number, (number | undefined)?])[] | undefined;
|
|
36
|
+
readonly identities?: readonly {
|
|
37
|
+
readonly type: string;
|
|
38
|
+
readonly value: string;
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
}, Schema.Struct.Fields>;
|
|
41
|
+
export type Person = Type.InstanceType<typeof Person>;
|
|
42
|
+
type DefaultStoryProps<T extends AnyProperties> = {
|
|
43
|
+
schema?: Schema.Schema<T>;
|
|
44
|
+
} & FormRootProps<T>;
|
|
11
45
|
declare const meta: {
|
|
12
46
|
title: string;
|
|
13
|
-
component:
|
|
14
|
-
|
|
47
|
+
component: {
|
|
48
|
+
<T extends AnyProperties = AnyProperties>({ children, schema, values, onSave, onCancel, ...props }: FormRootProps<T>): React.JSX.Element;
|
|
49
|
+
displayName: string;
|
|
50
|
+
};
|
|
51
|
+
render: <T extends AnyProperties = AnyProperties>({ schema, values: valuesProp, ...props }: DefaultStoryProps<T>) => React.JSX.Element;
|
|
15
52
|
decorators: import("@storybook/react").Decorator[];
|
|
16
53
|
parameters: {
|
|
17
54
|
layout: string;
|
|
18
55
|
translations: [{
|
|
19
56
|
readonly 'en-US': {
|
|
20
|
-
readonly "react-ui-form": {
|
|
21
|
-
readonly 'fields
|
|
22
|
-
readonly 'hidden
|
|
23
|
-
readonly 'empty
|
|
24
|
-
readonly '
|
|
25
|
-
readonly 'field
|
|
26
|
-
readonly 'field
|
|
27
|
-
readonly 'field
|
|
28
|
-
readonly '
|
|
29
|
-
readonly 'add
|
|
30
|
-
readonly '
|
|
31
|
-
readonly '
|
|
32
|
-
readonly 'boolean
|
|
33
|
-
readonly '
|
|
34
|
-
readonly '
|
|
35
|
-
readonly '
|
|
36
|
-
readonly '
|
|
37
|
-
readonly '
|
|
38
|
-
readonly 'ref
|
|
39
|
-
readonly 'ref
|
|
40
|
-
readonly '
|
|
41
|
-
readonly '
|
|
42
|
-
readonly '
|
|
43
|
-
readonly '
|
|
44
|
-
readonly '
|
|
45
|
-
readonly '
|
|
46
|
-
readonly '
|
|
47
|
-
readonly '
|
|
48
|
-
readonly 'format
|
|
49
|
-
readonly 'format
|
|
50
|
-
readonly 'format
|
|
51
|
-
readonly 'format
|
|
52
|
-
readonly 'format
|
|
53
|
-
readonly 'format
|
|
54
|
-
readonly 'format
|
|
55
|
-
readonly 'format
|
|
56
|
-
readonly 'format
|
|
57
|
-
readonly 'format
|
|
58
|
-
readonly 'format
|
|
59
|
-
readonly 'format
|
|
60
|
-
readonly 'format
|
|
61
|
-
readonly 'format
|
|
62
|
-
readonly 'format
|
|
63
|
-
readonly 'format
|
|
64
|
-
readonly 'format
|
|
65
|
-
readonly 'format
|
|
66
|
-
readonly 'format
|
|
67
|
-
readonly 'format
|
|
68
|
-
readonly 'format
|
|
69
|
-
readonly '
|
|
70
|
-
readonly '
|
|
71
|
-
readonly '
|
|
72
|
-
readonly '
|
|
73
|
-
readonly '
|
|
74
|
-
readonly '
|
|
75
|
-
readonly '
|
|
76
|
-
readonly '
|
|
77
|
-
readonly '
|
|
57
|
+
readonly "@dxos/react-ui-form": {
|
|
58
|
+
readonly 'fields.label': 'Fields';
|
|
59
|
+
readonly 'hidden-fields.label': 'Hidden Fields';
|
|
60
|
+
readonly 'empty-readonly-ref-field.label': '(none)';
|
|
61
|
+
readonly 'field-property.label': 'Property';
|
|
62
|
+
readonly 'field-property.placeholder': 'Property name';
|
|
63
|
+
readonly 'field-format.label': 'Type';
|
|
64
|
+
readonly 'field-path.label': 'Field path';
|
|
65
|
+
readonly 'remove-item.button': 'Delete item';
|
|
66
|
+
readonly 'add-item.button': 'Add item';
|
|
67
|
+
readonly 'add-property-button.label': 'Add property';
|
|
68
|
+
readonly 'boolean-input-true.value': 'Yes';
|
|
69
|
+
readonly 'boolean-input-false.value': 'No';
|
|
70
|
+
readonly 'show-field.label': 'Show field';
|
|
71
|
+
readonly 'hide-field.label': 'Hide field';
|
|
72
|
+
readonly 'delete-field.label': 'Delete field';
|
|
73
|
+
readonly 'create-option.label': 'Create';
|
|
74
|
+
readonly 'add-tag.label': 'Add tag';
|
|
75
|
+
readonly 'ref-field-combobox-input.placeholder': 'Search\u2026';
|
|
76
|
+
readonly 'ref-field.placeholder': 'Select\u2026';
|
|
77
|
+
readonly 'ref-field.placeholder_one': 'Select\u2026';
|
|
78
|
+
readonly 'ref-field.placeholder_other': 'Select items\u2026';
|
|
79
|
+
readonly 'example.placeholder': 'Example';
|
|
80
|
+
readonly 'latitude.placeholder': 'Latitude (e.g., 40.7128)';
|
|
81
|
+
readonly 'longitude.placeholder': 'Longitude (e.g., -74.0060)';
|
|
82
|
+
readonly 'cancel-button.label': 'Cancel';
|
|
83
|
+
readonly 'save-button.label': 'Save';
|
|
84
|
+
readonly 'create-text.label': 'Create text';
|
|
85
|
+
readonly 'format.boolean.label': 'Boolean';
|
|
86
|
+
readonly 'format.currency.label': 'Currency';
|
|
87
|
+
readonly 'format.date.label': 'Date';
|
|
88
|
+
readonly 'format.date-time.label': 'DateTime';
|
|
89
|
+
readonly 'format.did.label': 'DID';
|
|
90
|
+
readonly 'format.duration.label': 'Duration';
|
|
91
|
+
readonly 'format.dxn.label': 'DXN';
|
|
92
|
+
readonly 'format.email.label': 'Email';
|
|
93
|
+
readonly 'format.formula.label': 'Formula';
|
|
94
|
+
readonly 'format.hostname.label': 'Hostname';
|
|
95
|
+
readonly 'format.integer.label': 'Integer';
|
|
96
|
+
readonly 'format.json.label': 'JSON';
|
|
97
|
+
readonly 'format.lnglat.label': 'Geopoint';
|
|
98
|
+
readonly 'format.markdown.label': 'Markdown';
|
|
99
|
+
readonly 'format.percent.label': 'Percent';
|
|
100
|
+
readonly 'format.ref.label': 'Reference';
|
|
101
|
+
readonly 'format.regex.label': 'RegExp';
|
|
102
|
+
readonly 'format.string.label': 'String';
|
|
103
|
+
readonly 'format.single-select.label': 'Select';
|
|
104
|
+
readonly 'format.multi-select.label': 'Multi-select';
|
|
105
|
+
readonly 'format.text.label': 'Long text';
|
|
106
|
+
readonly 'format.time.label': 'Time';
|
|
107
|
+
readonly 'format.timestamp.label': 'Timestamp';
|
|
108
|
+
readonly 'format.user.label': 'User';
|
|
109
|
+
readonly 'format.number.label': 'Number';
|
|
110
|
+
readonly 'format.uri.label': 'URI';
|
|
111
|
+
readonly 'format.url.label': 'URL';
|
|
112
|
+
readonly 'format.uuid.label': 'UUID';
|
|
113
|
+
readonly 'latitude.label': 'Latitude';
|
|
114
|
+
readonly 'longitude.label': 'Longitude';
|
|
115
|
+
readonly 'select-option.label': 'Label';
|
|
116
|
+
readonly 'select-option-label.placeholder': 'Option label';
|
|
117
|
+
readonly 'select-option-delete.button': 'Delete';
|
|
118
|
+
readonly 'select-option-add.button': 'Add option';
|
|
119
|
+
readonly 'system-schema.title': 'System type';
|
|
120
|
+
readonly 'system-schema.description': 'System type: cannot add or remove fields.';
|
|
121
|
+
readonly 'remove.button': 'Delete';
|
|
78
122
|
};
|
|
79
123
|
};
|
|
80
124
|
}];
|
|
81
125
|
};
|
|
82
|
-
argTypes: {
|
|
83
|
-
readonly: {
|
|
84
|
-
control: "boolean";
|
|
85
|
-
description: string;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
126
|
};
|
|
89
127
|
export default meta;
|
|
90
|
-
type Story = StoryObj<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
export declare const
|
|
128
|
+
type Story<T extends AnyProperties> = StoryObj<DefaultStoryProps<T>>;
|
|
129
|
+
declare const PersonSchema: Schema.Schema<{
|
|
130
|
+
readonly name: string;
|
|
131
|
+
readonly ignore?: string | undefined;
|
|
132
|
+
readonly active?: boolean | undefined;
|
|
133
|
+
readonly address?: {
|
|
134
|
+
readonly street: string;
|
|
135
|
+
readonly city: string;
|
|
136
|
+
readonly state: string;
|
|
137
|
+
readonly zip: number;
|
|
138
|
+
} | undefined;
|
|
139
|
+
readonly employer?: import("@dxos/echo/internal").Ref<{
|
|
140
|
+
readonly name: string;
|
|
141
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
|
|
142
|
+
readonly tags?: readonly import("@dxos/echo/internal").Ref<{
|
|
143
|
+
readonly label: string;
|
|
144
|
+
readonly hue?: string | undefined;
|
|
145
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[] | undefined;
|
|
146
|
+
readonly status?: "active" | "inactive" | undefined;
|
|
147
|
+
readonly notes?: string | undefined;
|
|
148
|
+
readonly location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
149
|
+
readonly birthday?: string | undefined;
|
|
150
|
+
readonly meetingAt?: string | undefined;
|
|
151
|
+
readonly reminderAt?: string | undefined;
|
|
152
|
+
readonly tasks?: readonly string[] | undefined;
|
|
153
|
+
readonly locations?: readonly (readonly [number, number, (number | undefined)?])[] | undefined;
|
|
154
|
+
readonly identities?: readonly {
|
|
155
|
+
readonly type: string;
|
|
156
|
+
readonly value: string;
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>, {
|
|
159
|
+
readonly name: string;
|
|
160
|
+
readonly ignore?: string | undefined;
|
|
161
|
+
readonly active?: boolean | undefined;
|
|
162
|
+
readonly address?: {
|
|
163
|
+
readonly street: string;
|
|
164
|
+
readonly city: string;
|
|
165
|
+
readonly state: string;
|
|
166
|
+
readonly zip: number;
|
|
167
|
+
} | undefined;
|
|
168
|
+
readonly employer?: import("@dxos/echo/internal").Ref<{
|
|
169
|
+
readonly name: string;
|
|
170
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
|
|
171
|
+
readonly tags?: readonly import("@dxos/echo/internal").Ref<{
|
|
172
|
+
readonly label: string;
|
|
173
|
+
readonly hue?: string | undefined;
|
|
174
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[] | undefined;
|
|
175
|
+
readonly status?: "active" | "inactive" | undefined;
|
|
176
|
+
readonly notes?: string | undefined;
|
|
177
|
+
readonly location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
178
|
+
readonly birthday?: string | undefined;
|
|
179
|
+
readonly meetingAt?: string | undefined;
|
|
180
|
+
readonly reminderAt?: string | undefined;
|
|
181
|
+
readonly tasks?: readonly string[] | undefined;
|
|
182
|
+
readonly locations?: readonly (readonly [number, number, (number | undefined)?])[] | undefined;
|
|
183
|
+
readonly identities?: readonly {
|
|
184
|
+
readonly type: string;
|
|
185
|
+
readonly value: string;
|
|
186
|
+
}[] | undefined;
|
|
187
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>, never>;
|
|
188
|
+
export declare const Default: Story<ExcludeId<typeof PersonSchema>>;
|
|
189
|
+
export declare const Readonly: Story<ExcludeId<typeof PersonSchema>>;
|
|
190
|
+
export declare const Static: Story<ExcludeId<typeof PersonSchema>>;
|
|
191
|
+
export declare const Empty: Story<ExcludeId<typeof PersonSchema>>;
|
|
154
192
|
//# sourceMappingURL=Form.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Form.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,EAA2B,GAAG,EAAY,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAUzD,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,aAAa,EAAU,MAAM,QAAQ,CAAC;AAE1E,QAAA,MAAM,YAAY;;wBAE0D,CAAC;AAE7E,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC;AAElE,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAoCuD,CAAC;AAEpE,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC;AAEtD,KAAK,iBAAiB,CAAC,CAAC,SAAS,aAAa,IAAI;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC3B,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAgDrB,QAAA,MAAM,IAAI;;;;;;aA9CY,CAAC,SAAS,aAAa,4DAI1C,iBAAiB,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEiB,CAAC;eAE1B,IAAI;AAEnB,KAAK,KAAK,CAAC,CAAC,SAAS,aAAa,IAAI,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAErE,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+FAAyB,CAAC;AAW5C,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,YAAY,CAAC,CAMzD,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,YAAY,CAAC,CAM1D,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,YAAY,CAAC,CAMxD,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,YAAY,CAAC,CAEvD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type ProjectionModel } from '@dxos/schema';
|
|
4
|
+
import { type RefFieldProps } from './fields';
|
|
5
|
+
import { type FormFieldComponentProps, type FormFieldMap, type FormFieldProvider } from './FormFieldComponent';
|
|
6
|
+
export type FormFieldProps = {
|
|
7
|
+
/**
|
|
8
|
+
* AST of the property to render.
|
|
9
|
+
*/
|
|
10
|
+
type: SchemaAST.AST;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the property. Used to derive a default label
|
|
13
|
+
* (`title ?? capitalize(name)`) and as the projection lookup key. Pass
|
|
14
|
+
* `null` to suppress the header label entirely -- the form still renders
|
|
15
|
+
* the field/struct, but `FormFieldSet`'s top-level `<FormFieldLabel>` is
|
|
16
|
+
* skipped. Used by `ArrayField` for object-array items, where every item
|
|
17
|
+
* would otherwise repeat the array's parent name.
|
|
18
|
+
*/
|
|
19
|
+
name: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Path to the current object from the root. Used with nested forms.
|
|
22
|
+
*/
|
|
23
|
+
path?: (string | number)[];
|
|
24
|
+
/**
|
|
25
|
+
* Optional projection for projection-based field management.
|
|
26
|
+
*/
|
|
27
|
+
projection?: ProjectionModel;
|
|
28
|
+
/**
|
|
29
|
+
* Map of custom renderers for specific properties.
|
|
30
|
+
* Prefer fieldProvider for plugin specific input surfaces.
|
|
31
|
+
*/
|
|
32
|
+
fieldMap?: FormFieldMap;
|
|
33
|
+
/**
|
|
34
|
+
* Function to lookup custom renderers for specific properties.
|
|
35
|
+
*/
|
|
36
|
+
fieldProvider?: FormFieldProvider;
|
|
37
|
+
/**
|
|
38
|
+
* Typename of the ref type that the create props apply to.
|
|
39
|
+
* When set, createOptionLabel/createOptionIcon/createInitialValuePath/createFieldMap/onCreate
|
|
40
|
+
* are only passed to ref fields whose typename matches.
|
|
41
|
+
*/
|
|
42
|
+
createTypename?: string;
|
|
43
|
+
} & Pick<FormFieldComponentProps, 'autoFocus' | 'readonly' | 'layout'> & Pick<RefFieldProps, 'createOptionLabel' | 'createOptionIcon' | 'createInitialValuePath' | 'createFieldMap' | 'db' | 'useType' | 'getOptions' | 'onCreate'>;
|
|
44
|
+
export declare function FormField(props: FormFieldProps): React.JSX.Element | null;
|
|
45
|
+
export declare namespace FormField {
|
|
46
|
+
var displayName: string;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=FormField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/FormField.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAkB,MAAM,OAAO,CAAC;AAcvC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAKpD,OAAO,EAQL,KAAK,aAAa,EAInB,MAAM,UAAU,CAAC;AAElB,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC;IAEpB;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB;;OAEG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC,GACpE,IAAI,CACF,aAAa,EACX,mBAAmB,GACnB,kBAAkB,GAClB,wBAAwB,GACxB,gBAAgB,GAChB,IAAI,GACJ,SAAS,GACT,YAAY,GACZ,UAAU,CACb,CAAC;kCAEsB,KAAK,EAAE,cAAc"}
|