@dxos/react-ui-form 0.8.4-main.70d3990 → 0.8.4-main.74a063c4e0

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.
Files changed (183) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/index.mjs +2319 -2347
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/node-esm/index.mjs +2319 -2347
  6. package/dist/lib/node-esm/index.mjs.map +4 -4
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +8 -7
  9. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +66 -60
  11. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Form.d.ts +87 -27
  13. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.stories.d.ts +111 -150
  15. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/FormField.d.ts +43 -0
  17. package/dist/types/src/components/Form/FormField.d.ts.map +1 -0
  18. package/dist/types/src/components/Form/FormFieldComponent.d.ts +77 -0
  19. package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -0
  20. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts +9 -0
  21. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -0
  22. package/dist/types/src/components/Form/FormFieldSet.d.ts +18 -0
  23. package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -0
  24. package/dist/types/src/components/Form/fields/ArrayField.d.ts +18 -0
  25. package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -0
  26. package/dist/types/src/components/Form/fields/BooleanField.d.ts +4 -0
  27. package/dist/types/src/components/Form/fields/BooleanField.d.ts.map +1 -0
  28. package/dist/types/src/components/Form/fields/GeoPointField.d.ts +5 -0
  29. package/dist/types/src/components/Form/fields/GeoPointField.d.ts.map +1 -0
  30. package/dist/types/src/components/Form/fields/MarkdownField.d.ts +4 -0
  31. package/dist/types/src/components/Form/fields/MarkdownField.d.ts.map +1 -0
  32. package/dist/types/src/components/Form/fields/NumberField.d.ts +4 -0
  33. package/dist/types/src/components/Form/fields/NumberField.d.ts.map +1 -0
  34. package/dist/types/src/components/Form/fields/RefField.d.ts +16 -0
  35. package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -0
  36. package/dist/types/src/components/Form/fields/SelectField.d.ts +10 -0
  37. package/dist/types/src/components/Form/fields/SelectField.d.ts.map +1 -0
  38. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts +5 -0
  39. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -0
  40. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +82 -0
  41. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -0
  42. package/dist/types/src/components/Form/fields/TextAreaField.d.ts +4 -0
  43. package/dist/types/src/components/Form/fields/TextAreaField.d.ts.map +1 -0
  44. package/dist/types/src/components/Form/fields/TextField.d.ts +4 -0
  45. package/dist/types/src/components/Form/fields/TextField.d.ts.map +1 -0
  46. package/dist/types/src/components/Form/fields/TupleField.d.ts +6 -0
  47. package/dist/types/src/components/Form/fields/TupleField.d.ts.map +1 -0
  48. package/dist/types/src/components/Form/fields/index.d.ts +12 -0
  49. package/dist/types/src/components/Form/fields/index.d.ts.map +1 -0
  50. package/dist/types/src/components/Form/index.d.ts +2 -4
  51. package/dist/types/src/components/Form/index.d.ts.map +1 -1
  52. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +23 -10
  53. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  54. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +62 -59
  55. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/Settings/Settings.d.ts +39 -0
  57. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
  58. package/dist/types/src/components/Settings/Settings.stories.d.ts +81 -0
  59. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
  60. package/dist/types/src/components/Settings/index.d.ts +2 -0
  61. package/dist/types/src/components/Settings/index.d.ts.map +1 -0
  62. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +9 -11
  63. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  64. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +66 -62
  65. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  66. package/dist/types/src/components/index.d.ts +1 -1
  67. package/dist/types/src/components/index.d.ts.map +1 -1
  68. package/dist/types/src/components/testing.d.ts +0 -2
  69. package/dist/types/src/components/testing.d.ts.map +1 -1
  70. package/dist/types/src/hooks/index.d.ts +2 -3
  71. package/dist/types/src/hooks/index.d.ts.map +1 -1
  72. package/dist/types/src/hooks/useFormHandler.d.ts +82 -0
  73. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -0
  74. package/dist/types/src/hooks/useKeyHandler.d.ts +7 -0
  75. package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -0
  76. package/dist/types/src/translations.d.ts +63 -60
  77. package/dist/types/src/translations.d.ts.map +1 -1
  78. package/dist/types/src/util/index.d.ts +1 -1
  79. package/dist/types/src/util/index.d.ts.map +1 -1
  80. package/dist/types/src/util/properties.d.ts +7 -0
  81. package/dist/types/src/util/properties.d.ts.map +1 -0
  82. package/dist/types/src/util/refs.d.ts +2 -2
  83. package/dist/types/src/util/refs.d.ts.map +1 -1
  84. package/dist/types/tsconfig.tsbuildinfo +1 -1
  85. package/package.json +51 -48
  86. package/src/components/FieldEditor/FieldEditor.stories.tsx +43 -25
  87. package/src/components/FieldEditor/FieldEditor.test.tsx +0 -1
  88. package/src/components/FieldEditor/FieldEditor.tsx +73 -77
  89. package/src/components/Form/AUDIT.md +17 -0
  90. package/src/components/Form/Form.stories.tsx +147 -249
  91. package/src/components/Form/Form.tsx +324 -110
  92. package/src/components/Form/FormField.tsx +304 -0
  93. package/src/components/Form/FormFieldComponent.stories.tsx +65 -0
  94. package/src/components/Form/FormFieldComponent.tsx +171 -0
  95. package/src/components/Form/FormFieldSet.tsx +128 -0
  96. package/src/components/Form/README.md +3 -0
  97. package/src/components/Form/fields/ArrayField.tsx +154 -0
  98. package/src/components/Form/fields/BooleanField.tsx +22 -0
  99. package/src/components/Form/fields/GeoPointField.tsx +120 -0
  100. package/src/components/Form/fields/MarkdownField.tsx +78 -0
  101. package/src/components/Form/fields/NumberField.tsx +39 -0
  102. package/src/components/Form/fields/RefField.tsx +198 -0
  103. package/src/components/Form/fields/SelectField.tsx +65 -0
  104. package/src/components/Form/{custom/SelectOptionsInput.stories.tsx → fields/SelectOptionField.stories.tsx} +19 -17
  105. package/src/components/Form/{custom/SelectOptionsInput.tsx → fields/SelectOptionField.tsx} +29 -24
  106. package/src/components/Form/fields/TextAreaField.tsx +38 -0
  107. package/src/components/Form/fields/TextField.tsx +38 -0
  108. package/src/components/Form/{custom/TupleInput.tsx → fields/TupleField.tsx} +16 -9
  109. package/src/components/Form/fields/index.ts +15 -0
  110. package/src/components/Form/index.ts +3 -4
  111. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +18 -16
  112. package/src/components/ObjectPicker/ObjectPicker.tsx +103 -78
  113. package/src/components/Settings/Settings.stories.tsx +55 -0
  114. package/src/components/Settings/Settings.tsx +129 -0
  115. package/src/components/{ControlSection → Settings}/index.ts +1 -1
  116. package/src/components/ViewEditor/ViewEditor.stories.tsx +44 -39
  117. package/src/components/ViewEditor/ViewEditor.test.tsx +5 -5
  118. package/src/components/ViewEditor/ViewEditor.tsx +295 -197
  119. package/src/components/index.ts +1 -1
  120. package/src/components/testing.tsx +23 -9
  121. package/src/hooks/index.ts +2 -3
  122. package/src/hooks/useFormHandler.ts +380 -0
  123. package/src/hooks/useKeyHandler.tsx +37 -0
  124. package/src/translations.ts +66 -65
  125. package/src/util/index.ts +1 -1
  126. package/src/util/properties.ts +18 -0
  127. package/src/util/refs.ts +13 -15
  128. package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
  129. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
  130. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -84
  131. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
  132. package/dist/types/src/components/ControlSection/index.d.ts +0 -2
  133. package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
  134. package/dist/types/src/components/Form/ArrayField.d.ts +0 -16
  135. package/dist/types/src/components/Form/ArrayField.d.ts.map +0 -1
  136. package/dist/types/src/components/Form/Defaults.d.ts +0 -14
  137. package/dist/types/src/components/Form/Defaults.d.ts.map +0 -1
  138. package/dist/types/src/components/Form/FormActions.d.ts +0 -9
  139. package/dist/types/src/components/Form/FormActions.d.ts.map +0 -1
  140. package/dist/types/src/components/Form/FormContent.d.ts +0 -63
  141. package/dist/types/src/components/Form/FormContent.d.ts.map +0 -1
  142. package/dist/types/src/components/Form/FormContext.d.ts +0 -23
  143. package/dist/types/src/components/Form/FormContext.d.ts.map +0 -1
  144. package/dist/types/src/components/Form/Input.d.ts +0 -29
  145. package/dist/types/src/components/Form/Input.d.ts.map +0 -1
  146. package/dist/types/src/components/Form/RefField.d.ts +0 -22
  147. package/dist/types/src/components/Form/RefField.d.ts.map +0 -1
  148. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts +0 -4
  149. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +0 -1
  150. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts +0 -4
  151. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +0 -1
  152. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +0 -79
  153. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +0 -1
  154. package/dist/types/src/components/Form/custom/TupleInput.d.ts +0 -6
  155. package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +0 -1
  156. package/dist/types/src/components/Form/custom/index.d.ts +0 -4
  157. package/dist/types/src/components/Form/custom/index.d.ts.map +0 -1
  158. package/dist/types/src/components/Form/factory.d.ts +0 -8
  159. package/dist/types/src/components/Form/factory.d.ts.map +0 -1
  160. package/dist/types/src/hooks/useForm.d.ts +0 -67
  161. package/dist/types/src/hooks/useForm.d.ts.map +0 -1
  162. package/dist/types/src/hooks/useQueryRefOptions.d.ts +0 -29
  163. package/dist/types/src/hooks/useQueryRefOptions.d.ts.map +0 -1
  164. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +0 -8
  165. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +0 -1
  166. package/dist/types/src/util/schema.d.ts +0 -3
  167. package/dist/types/src/util/schema.d.ts.map +0 -1
  168. package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
  169. package/src/components/ControlSection/ControlSection.tsx +0 -153
  170. package/src/components/Form/ArrayField.tsx +0 -127
  171. package/src/components/Form/Defaults.tsx +0 -205
  172. package/src/components/Form/FormActions.tsx +0 -59
  173. package/src/components/Form/FormContent.tsx +0 -362
  174. package/src/components/Form/FormContext.tsx +0 -110
  175. package/src/components/Form/Input.tsx +0 -54
  176. package/src/components/Form/RefField.tsx +0 -283
  177. package/src/components/Form/custom/GeoPointInput.tsx +0 -80
  178. package/src/components/Form/custom/index.ts +0 -7
  179. package/src/components/Form/factory.tsx +0 -34
  180. package/src/hooks/useForm.ts +0 -296
  181. package/src/hooks/useQueryRefOptions.ts +0 -62
  182. package/src/hooks/useRefQueryLookupHandler.ts +0 -39
  183. package/src/util/schema.ts +0 -12
@@ -1,169 +1,130 @@
1
1
  import { type StoryObj } from '@storybook/react-vite';
2
2
  import * as Schema from 'effect/Schema';
3
3
  import React from 'react';
4
+ import { Type } from '@dxos/echo';
4
5
  import { type AnyProperties } from '@dxos/echo/internal';
5
- import { type FormProps } from './Form';
6
- type StoryProps<T extends AnyProperties> = {
6
+ import { type ExcludeId, type FormRootProps } from './Form';
7
+ declare const Organization: Type.Obj<{
8
+ readonly name: string;
9
+ }, Schema.Struct.Fields>;
10
+ export interface Organization extends Schema.Schema.Type<typeof Organization> {
11
+ }
12
+ declare const Person: Type.Obj<{
13
+ readonly name: string;
14
+ readonly address?: {
15
+ readonly state: string;
16
+ readonly street: string;
17
+ readonly city: string;
18
+ readonly zip: number;
19
+ } | undefined;
20
+ readonly status?: "active" | "inactive" | undefined;
21
+ readonly location?: readonly [number, number, (number | undefined)?] | undefined;
22
+ readonly tags?: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
23
+ readonly hue?: string | undefined;
24
+ readonly label: string;
25
+ }>[] | undefined;
26
+ readonly ignore?: string | undefined;
27
+ readonly active?: boolean | undefined;
28
+ readonly employer?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
29
+ readonly name: string;
30
+ }> | undefined;
31
+ readonly notes?: string | undefined;
32
+ readonly tasks?: readonly string[] | undefined;
33
+ readonly locations?: readonly (readonly [number, number, (number | undefined)?])[] | undefined;
34
+ readonly identities?: readonly {
35
+ readonly type: string;
36
+ readonly value: string;
37
+ }[] | undefined;
38
+ }, Schema.Struct.Fields>;
39
+ export interface Person extends Schema.Schema.Type<typeof Person> {
40
+ }
41
+ type DefaultStoryProps<T extends AnyProperties> = {
7
42
  debug?: boolean;
8
- schema: Schema.Schema.AnyNoContext;
9
- } & FormProps<T>;
43
+ schema: Schema.Schema<T>;
44
+ } & FormRootProps<T>;
10
45
  declare const meta: {
11
46
  title: string;
12
- component: any;
13
- render: <T extends AnyProperties = any>({ debug, schema, values: initialValues, ...props }: StoryProps<T>) => React.JSX.Element;
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>({ debug, schema, values: valuesProp, ...props }: DefaultStoryProps<T>) => React.JSX.Element;
14
52
  decorators: import("@storybook/react").Decorator[];
15
53
  parameters: {
16
54
  layout: string;
17
55
  translations: [{
18
56
  readonly 'en-US': {
19
- readonly "react-ui-form": {
20
- readonly 'fields label': "Fields";
21
- readonly 'hidden fields label': "Hidden Fields";
22
- readonly 'empty readonly ref field label': "(none)";
23
- readonly 'add property button label': "Add property";
24
- readonly 'field property label': "Property";
25
- readonly 'field property placeholder': "Property name";
26
- readonly 'field format label': "Type";
27
- readonly 'field path label': "Field path";
28
- readonly 'add field': "Add field";
29
- readonly 'delete field': "Delete field";
30
- readonly 'field limit reached': "Maximum number of fields reached";
31
- readonly 'boolean input true value': "Yes";
32
- readonly 'boolean input false value': "No";
33
- readonly 'show field label': "Show field";
34
- readonly 'hide field label': "Hide field";
35
- readonly 'delete field label': "Delete field";
36
- readonly 'ref field combobox input placeholder': "Search…";
37
- readonly 'ref field placeholder_one': "Select…";
38
- readonly 'ref field placeholder_other': "Select items…";
39
- readonly 'cancel button label': "Cancel";
40
- readonly 'save button label': "Save";
41
- readonly 'format boolean': "Boolean";
42
- readonly 'format currency': "Currency";
43
- readonly 'format date': "Date";
44
- readonly 'format date-time': "DateTime";
45
- readonly 'format did': "DID";
46
- readonly 'format duration': "Duration";
47
- readonly 'format dxn': "DXN";
48
- readonly 'format email': "Email";
49
- readonly 'format formula': "Formula";
50
- readonly 'format hostname': "Hostname";
51
- readonly 'format integer': "Integer";
52
- readonly 'format json': "JSON";
53
- readonly 'format lnglat': "Geopoint";
54
- readonly 'format markdown': "Markdown";
55
- readonly 'format percent': "Percent";
56
- readonly 'format ref': "Reference";
57
- readonly 'format regex': "RegExp";
58
- readonly 'format string': "String";
59
- readonly 'format single-select': "Select";
60
- readonly 'format multi-select': "Multi-select";
61
- readonly 'format text': "Long text";
62
- readonly 'format time': "Time";
63
- readonly 'format timestamp': "Timestamp";
64
- readonly 'format user': "User";
65
- readonly 'format number': "Number";
66
- readonly 'format uri': "URI";
67
- readonly 'format url': "URL";
68
- readonly 'format uuid': "UUID";
69
- readonly 'latitude label': "Latitude";
70
- readonly 'longitude label': "Longitude";
71
- readonly 'select option label': "Label";
72
- readonly 'select option label placeholder': "Option label";
73
- readonly 'select option color': "Color";
74
- readonly 'select option delete': "Delete";
75
- readonly 'select option add': "Add option";
76
- readonly 'system schema title': "System type";
77
- readonly 'system schema description': "This is a system type and cannot be modified, though the view can still be configured.";
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 'add-property-button.label': "Add property";
62
+ readonly 'field-property.label': "Property";
63
+ readonly 'field-property.placeholder': "Property name";
64
+ readonly 'field-format.label': "Type";
65
+ readonly 'field-path.label': "Field path";
66
+ readonly 'add-field.button': "Add field";
67
+ readonly 'boolean-input-true.value': "Yes";
68
+ readonly 'boolean-input-false.value': "No";
69
+ readonly 'show-field.label': "Show field";
70
+ readonly 'hide-field.label': "Hide field";
71
+ readonly 'delete-field.label': "Delete field";
72
+ readonly 'ref-field-combobox-input.placeholder': "Search…";
73
+ readonly 'ref-field.placeholder': "Select…";
74
+ readonly 'ref-field.placeholder_one': "Select…";
75
+ readonly 'ref-field.placeholder_other': "Select items…";
76
+ readonly 'create-option.label': "Create";
77
+ readonly 'example.placeholder': "Example";
78
+ readonly 'latitude.placeholder': "Latitude (e.g., 40.7128)";
79
+ readonly 'longitude.placeholder': "Longitude (e.g., -74.0060)";
80
+ readonly 'cancel-button.label': "Cancel";
81
+ readonly 'save-button.label': "Save";
82
+ readonly 'format.boolean.label': "Boolean";
83
+ readonly 'format.currency.label': "Currency";
84
+ readonly 'format.date.label': "Date";
85
+ readonly 'format.date-time.label': "DateTime";
86
+ readonly 'format.did.label': "DID";
87
+ readonly 'format.duration.label': "Duration";
88
+ readonly 'format.dxn.label': "DXN";
89
+ readonly 'format.email.label': "Email";
90
+ readonly 'format.formula.label': "Formula";
91
+ readonly 'format.hostname.label': "Hostname";
92
+ readonly 'format.integer.label': "Integer";
93
+ readonly 'format.json.label': "JSON";
94
+ readonly 'format.lnglat.label': "Geopoint";
95
+ readonly 'format.markdown.label': "Markdown";
96
+ readonly 'format.percent.label': "Percent";
97
+ readonly 'format.ref.label': "Reference";
98
+ readonly 'format.regex.label': "RegExp";
99
+ readonly 'format.string.label': "String";
100
+ readonly 'format.single-select.label': "Select";
101
+ readonly 'format.multi-select.label': "Multi-select";
102
+ readonly 'format.text.label': "Long text";
103
+ readonly 'format.time.label': "Time";
104
+ readonly 'format.timestamp.label': "Timestamp";
105
+ readonly 'format.user.label': "User";
106
+ readonly 'format.number.label': "Number";
107
+ readonly 'format.uri.label': "URI";
108
+ readonly 'format.url.label': "URL";
109
+ readonly 'format.uuid.label': "UUID";
110
+ readonly 'latitude.label': "Latitude";
111
+ readonly 'longitude.label': "Longitude";
112
+ readonly 'select-option.label': "Label";
113
+ readonly 'select-option-label.placeholder': "Option label";
114
+ readonly 'select-option-delete.button': "Delete";
115
+ readonly 'select-option-add.button': "Add option";
116
+ readonly 'system-schema.title': "System type";
117
+ readonly 'system-schema.description': "System type: cannot add or remove fields.";
118
+ readonly 'remove.button': "Remove";
78
119
  };
79
120
  };
80
121
  }];
81
122
  };
82
- argTypes: {
83
- readonly: {
84
- control: "boolean";
85
- description: string;
86
- };
87
- };
88
123
  };
89
124
  export default meta;
90
- type Story = StoryObj<typeof meta>;
91
- export declare const Default: Story;
92
- export declare const Organization: Story;
93
- export declare const OrganizationAutoSave: Story;
94
- export declare const Person: Story;
95
- declare const ShapeSchema: Schema.mutable<Schema.Struct<{
96
- shape: Schema.optional<Schema.Union<[Schema.Struct<{
97
- type: Schema.Literal<["circle"]>;
98
- radius: Schema.optional<Schema.SchemaClass<number, number, never>>;
99
- }>, Schema.Struct<{
100
- type: Schema.Literal<["square"]>;
101
- size: Schema.optional<Schema.refine<number, typeof Schema.Number>>;
102
- }>]>>;
103
- }>>;
104
- type ShapeSchema = Schema.Schema.Type<typeof ShapeSchema>;
105
- export declare const DiscriminatedShape: StoryObj<StoryProps<ShapeSchema>>;
106
- declare const ArraysSchema: Schema.mutable<Schema.Struct<{
107
- names: Schema.Array$<Schema.filter<typeof Schema.String>>;
108
- addresses: Schema.Array$<Schema.Struct<{
109
- street: Schema.optional<Schema.SchemaClass<string, string, never>>;
110
- city: Schema.optional<Schema.SchemaClass<string, string, never>>;
111
- zip: Schema.optional<Schema.refine<string, typeof Schema.String>>;
112
- location: Schema.optional<Schema.Tuple<[Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.Element<typeof Schema.Number, "?">]>>;
113
- }>>;
114
- }>>;
115
- type ArraysSchema = Schema.Schema.Type<typeof ArraysSchema>;
116
- export declare const Arrays: StoryObj<StoryProps<ArraysSchema>>;
117
- declare const TupleSchema: Schema.mutable<Schema.Struct<{
118
- tuple: Schema.Tuple<[typeof Schema.Number, typeof Schema.String, typeof Schema.Boolean]>;
119
- geopoint: Schema.Tuple<[Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.Element<typeof Schema.Number, "?">]>;
120
- }>>;
121
- type TupleSchema = Schema.Schema.Type<typeof TupleSchema>;
122
- export declare const Tuple: StoryObj<StoryProps<TupleSchema>>;
123
- declare const ColorSchema: Schema.mutable<Schema.Struct<{
124
- color: Schema.Union<[Schema.Literal<["red"]>, Schema.Literal<["green"]>, Schema.Literal<["blue"]>]>;
125
- }>>;
126
- type ColorType = Schema.Schema.Type<typeof ColorSchema>;
127
- export declare const Enum: StoryObj<StoryProps<ColorType>>;
128
- declare const RefSchema: Schema.Struct<{
129
- contact: Schema.SchemaClass<import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
130
- image?: string | undefined;
131
- name: string;
132
- email?: string | undefined;
133
- organization?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
134
- description?: string | undefined;
135
- name: string;
136
- website?: string | undefined;
137
- image?: string | undefined;
138
- }> | undefined;
139
- }>, import("@dxos/echo-protocol").EncodedReference, never>;
140
- optionalContact: Schema.optional<Schema.SchemaClass<import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
141
- image?: string | undefined;
142
- name: string;
143
- email?: string | undefined;
144
- organization?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
145
- description?: string | undefined;
146
- name: string;
147
- website?: string | undefined;
148
- image?: string | undefined;
149
- }> | undefined;
150
- }>, import("@dxos/echo-protocol").EncodedReference, never>>;
151
- refArray: Schema.optional<Schema.Array$<import("@dxos/echo/internal").RefSchema<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
152
- image?: string | undefined;
153
- name: string;
154
- email?: string | undefined;
155
- organization?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
156
- description?: string | undefined;
157
- name: string;
158
- website?: string | undefined;
159
- image?: string | undefined;
160
- }> | undefined;
161
- }>>>;
162
- unknownExpando: Schema.optional<Schema.SchemaClass<import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
163
- [x: string]: any;
164
- id: import("@dxos/keys").ObjectId;
165
- }>, import("@dxos/echo-protocol").EncodedReference, never>>;
166
- }>;
167
- type RefSchema = Schema.Schema.Type<typeof RefSchema>;
168
- export declare const Refs: StoryObj<StoryProps<RefSchema>>;
125
+ type Story<T extends AnyProperties> = StoryObj<DefaultStoryProps<T>>;
126
+ export declare const Default: Story<ExcludeId<typeof Person>>;
127
+ export declare const Readonly: Story<ExcludeId<typeof Person>>;
128
+ export declare const Static: Story<ExcludeId<typeof Person>>;
129
+ export declare const Empty: Story<ExcludeId<typeof Person>>;
169
130
  //# 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;AAGrD,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,qBAAqB,CAAC;AAS9E,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,KAAK,UAAU,CAAC,CAAC,SAAS,aAAa,IAAI;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;CACpC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AA6DjB,QAAA,MAAM,IAAI;;eAEW,GAAG;aA7DF,CAAC,SAAS,aAAa,4DAK1C,UAAU,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEiB,CAAC;AAElC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAYrB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CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,CAMnD,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,CAMpD,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,CAMlD,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,CAajD,CAAC"}
@@ -0,0 +1,43 @@
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.
13
+ */
14
+ name: string;
15
+ /**
16
+ * Path to the current object from the root. Used with nested forms.
17
+ */
18
+ path?: (string | number)[];
19
+ /**
20
+ * Optional projection for projection-based field management.
21
+ */
22
+ projection?: ProjectionModel;
23
+ /**
24
+ * Map of custom renderers for specific properties.
25
+ * Prefer fieldProvider for plugin specific input surfaces.
26
+ */
27
+ fieldMap?: FormFieldMap;
28
+ /**
29
+ * Function to lookup custom renderers for specific properties.
30
+ */
31
+ fieldProvider?: FormFieldProvider;
32
+ /**
33
+ * Typename of the ref type that the create props apply to.
34
+ * When set, createOptionLabel/createOptionIcon/createInitialValuePath/createFieldMap/onCreate
35
+ * are only passed to ref fields whose typename matches.
36
+ */
37
+ createTypename?: string;
38
+ } & Pick<FormFieldComponentProps, 'autoFocus' | 'readonly' | 'layout'> & Pick<RefFieldProps, 'createOptionLabel' | 'createOptionIcon' | 'createInitialValuePath' | 'createFieldMap' | 'db' | 'schemaHook' | 'getOptions' | 'onCreate'>;
39
+ export declare const FormField: {
40
+ (props: FormFieldProps): React.JSX.Element | null;
41
+ displayName: string;
42
+ };
43
+ //# 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;AAIpD,OAAO,EAOL,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;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;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,YAAY,GACZ,YAAY,GACZ,UAAU,CACb,CAAC;AAEJ,eAAO,MAAM,SAAS;YAAW,cAAc;;CAgK9C,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type * as Schema from 'effect/Schema';
2
+ import type * as SchemaAST from 'effect/SchemaAST';
3
+ import React, { Component, type FC, type FocusEvent, type PropsWithChildren, type ReactElement, type ReactNode } from 'react';
4
+ import { type Format } from '@dxos/echo/internal';
5
+ import { type FormFieldStatus } from '../../hooks';
6
+ /**
7
+ * Dynamic props passed to input components.
8
+ */
9
+ export type FormFieldStateProps<T = any> = {
10
+ getStatus: () => FormFieldStatus;
11
+ getValue: () => T | undefined;
12
+ onBlur: (event: FocusEvent<HTMLElement>) => void;
13
+ onValueChange: (type: SchemaAST.AST, value: T) => void;
14
+ };
15
+ /**
16
+ * Presentation mode.
17
+ * - full: Show label, control, and status.
18
+ * - compact: Show label and control.
19
+ * - inline: Control only.
20
+ * - static: Plain DOM; omit all undefined values.
21
+ */
22
+ export type Presentation = 'full' | 'compact' | 'inline' | 'static';
23
+ /**
24
+ * Props passed to input components.
25
+ */
26
+ export type FormFieldComponentProps<T = any> = {
27
+ type: SchemaAST.AST;
28
+ format?: Format.TypeFormat;
29
+ readonly?: boolean;
30
+ label: string;
31
+ placeholder?: string;
32
+ autoFocus?: boolean;
33
+ layout?: Presentation;
34
+ } & FormFieldStateProps<T>;
35
+ /**
36
+ * Form field component.
37
+ */
38
+ export type FormFieldComponent = FC<FormFieldComponentProps>;
39
+ export type FormFieldMap = Record<string, FormFieldComponent>;
40
+ export type FormFieldProvider = (props: {
41
+ prop: string;
42
+ schema: Schema.Schema<any>;
43
+ fieldProps: FormFieldComponentProps;
44
+ }) => ReactElement | undefined;
45
+ export type FormFieldLabelProps = {
46
+ asChild?: boolean;
47
+ error?: string;
48
+ } & Pick<FormFieldComponentProps, 'label' | 'readonly'>;
49
+ export declare const FormFieldLabel: {
50
+ ({ label, error, readonly, asChild }: FormFieldLabelProps): React.JSX.Element;
51
+ displayName: string;
52
+ };
53
+ export type FormFieldWrapperProps<T = any> = Pick<FormFieldComponentProps, 'readonly' | 'label' | 'layout' | 'getStatus' | 'getValue'> & {
54
+ children?: (props: {
55
+ value: T;
56
+ }) => ReactNode;
57
+ };
58
+ export declare const FormFieldWrapper: <T>(props: FormFieldWrapperProps<T>) => React.JSX.Element | null;
59
+ type FormFieldErrorState = {
60
+ error: Error | undefined;
61
+ };
62
+ type FormFieldErrorBoundaryProps = PropsWithChildren<{
63
+ path?: (string | number)[];
64
+ }>;
65
+ export declare class FormFieldErrorBoundary extends Component<FormFieldErrorBoundaryProps, FormFieldErrorState> {
66
+ static getDerivedStateFromError(error: Error): {
67
+ error: Error;
68
+ };
69
+ state: {
70
+ error: undefined;
71
+ };
72
+ componentDidUpdate(prevProps: FormFieldErrorBoundaryProps): void;
73
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
74
+ private resetError;
75
+ }
76
+ export {};
77
+ //# sourceMappingURL=FormFieldComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/FormFieldComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,SAAS,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,EACZ,SAAS,EACT,KAAK,EAAE,EACP,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,GAAG,IAAI;IACzC,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,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,GAAG,IAAI,IAAI,CAC/C,uBAAuB,EACvB,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAC3D,GAAG;IACF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,KAAK,SAAS,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,OAAO,qBAAqB,CAAC,CAAC,CAAC,6BAwBnE,CAAC;AAMF,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,KAAK,2BAA2B,GAAG,iBAAiB,CAAC;IACnD,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC5B,CAAC,CAAC;AAEH,qBAAa,sBAAuB,SAAQ,SAAS,CAAC,2BAA2B,EAAE,mBAAmB,CAAC;IACrG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE;IAItD,KAAK;;MAAwB;IAE7B,kBAAkB,CAAC,SAAS,EAAE,2BAA2B;IAMzD,MAAM;IAaf,OAAO,CAAC,UAAU;CAGnB"}
@@ -0,0 +1,9 @@
1
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ import { type FormFieldComponentProps } from './FormFieldComponent';
4
+ declare const DefaultStory: ({ type, placeholder, readonly, onBlur, onValueChange, ...props }: FormFieldComponentProps<string>) => React.JSX.Element;
5
+ declare const meta: Meta<typeof DefaultStory>;
6
+ export default meta;
7
+ type Story = StoryObj<typeof meta>;
8
+ export declare const Default: Story;
9
+ //# sourceMappingURL=FormFieldComponent.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldComponent.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/FormFieldComponent.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAwC,MAAM,OAAO,CAAC;AAK7D,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,sBAAsB,CAAC;AAEtF,QAAA,MAAM,YAAY,GAAI,kEAOnB,uBAAuB,CAAC,MAAM,CAAC,sBAsBjC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAOnC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { type AnyProperties } from '@dxos/echo/internal';
3
+ import { type SchemaProperty } from '@dxos/effect';
4
+ import { type FormHandlerProps } from '../../hooks';
5
+ import { type FormFieldProps } from './FormField';
6
+ export type FormFieldSetProps<T extends AnyProperties> = {
7
+ label?: string;
8
+ sort?: string[];
9
+ exclude?: (props: SchemaProperty[]) => SchemaProperty[];
10
+ } & Pick<FormHandlerProps<T>, 'schema'> & Pick<FormFieldProps, 'path' | 'autoFocus' | 'readonly' | 'layout' | 'projection' | 'fieldMap' | 'fieldProvider' | 'createTypename' | 'createOptionLabel' | 'createOptionIcon' | 'createInitialValuePath' | 'createFieldMap' | 'db' | 'schemaHook' | 'getOptions' | 'onCreate'>;
11
+ /**
12
+ * Renders a set of form fields derived from a schema object.
13
+ */
14
+ export declare const FormFieldSet: {
15
+ ({ label, schema, readonly, path, sort, exclude, projection, layout, ...props }: FormFieldSetProps<any>): React.JSX.Element | null;
16
+ displayName: string;
17
+ };
18
+ //# sourceMappingURL=FormFieldSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldSet.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/FormFieldSet.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAK7D,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,aAAa,IAAI;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAC;CACzD,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GACrC,IAAI,CACF,cAAc,EACZ,MAAM,GACN,WAAW,GACX,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,eAAe,GACf,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,wBAAwB,GACxB,gBAAgB,GAChB,IAAI,GACJ,YAAY,GACZ,YAAY,GACZ,UAAU,CACb,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,YAAY;qFAUtB,iBAAiB,CAAC,GAAG,CAAC;;CAsExB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import * as SchemaAST from 'effect/SchemaAST';
2
+ import React from 'react';
3
+ import { type FormFieldProps } from '../FormField';
4
+ import { type FormFieldStateProps } from '../FormFieldComponent';
5
+ export type ArrayFieldProps = {
6
+ label: string;
7
+ fieldProps: FormFieldStateProps;
8
+ } & FormFieldProps;
9
+ export declare const ArrayField: {
10
+ ({ type, path, label, readonly, layout, fieldProps: inputProps, ...props }: ArrayFieldProps): React.JSX.Element | null;
11
+ displayName: string;
12
+ };
13
+ /**
14
+ * Returns the default empty value for a given AST.
15
+ * Used for initializing new array values etc.
16
+ */
17
+ export declare const getDefaultValue: (ast?: SchemaAST.AST) => any;
18
+ //# sourceMappingURL=ArrayField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/ArrayField.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAsB,MAAM,OAAO,CAAC;AAQ3C,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,mBAAmB,CAAC;CACjC,GAAG,cAAc,CAAC;AAEnB,eAAO,MAAM,UAAU;gFAQpB,eAAe;;CA4FjB,CAAC;AAIF;;;GAGG;AAEH,eAAO,MAAM,eAAe,GAAI,MAAM,SAAS,CAAC,GAAG,KAAG,GAsBrD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
3
+ export declare const BooleanField: ({ type, readonly, onValueChange, ...props }: FormFieldComponentProps<boolean>) => React.JSX.Element;
4
+ //# sourceMappingURL=BooleanField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BooleanField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/BooleanField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAI3C,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,uBAAuB,CAAC;AAEvF,eAAO,MAAM,YAAY,GAAI,6CAA6C,uBAAuB,CAAC,OAAO,CAAC,sBAWzG,CAAC"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { type GeoPoint } from '@dxos/echo/internal';
3
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
4
+ export declare const GeoPointField: ({ type, label, readonly, layout, getStatus, getValue, onValueChange, onBlur, }: FormFieldComponentProps<GeoPoint>) => React.JSX.Element | null;
5
+ //# sourceMappingURL=GeoPointField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoPointField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/GeoPointField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAE3F,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKjE,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAErF,eAAO,MAAM,aAAa,GAAI,gFAS3B,uBAAuB,CAAC,QAAQ,CAAC,6BA+EnC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
3
+ export declare const MarkdownField: ({ type, readonly, label, placeholder, layout, getStatus, getValue, onValueChange, onBlur, }: FormFieldComponentProps) => React.JSX.Element | null;
4
+ //# sourceMappingURL=MarkdownField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/MarkdownField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAErF,eAAO,MAAM,aAAa,GAAI,6FAU3B,uBAAuB,6BAyDzB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
3
+ export declare const NumberField: ({ type, readonly, placeholder, onValueChange, onBlur, ...props }: FormFieldComponentProps<number>) => React.JSX.Element;
4
+ //# sourceMappingURL=NumberField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/NumberField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,uBAAuB,CAAC;AAEvF,eAAO,MAAM,WAAW,GAAI,kEAOzB,uBAAuB,CAAC,MAAM,CAAC,sBAoBjC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import '@dxos/lit-ui/dx-tag-picker.pcss';
3
+ import { type Database, Entity, Type } from '@dxos/echo';
4
+ import { type ObjectPickerContentProps, type RefOption } from '../../ObjectPicker';
5
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
6
+ export type RefFieldProps = FormFieldComponentProps & Pick<ObjectPickerContentProps, 'createOptionLabel' | 'createOptionIcon' | 'createInitialValuePath' | 'createFieldMap'> & {
7
+ db?: Database.Database;
8
+ resultsHook?: (db?: Database.Database, typename?: string) => Entity.Any[];
9
+ schemaHook?: (db?: Database.Database, typename?: string) => Type.AnyEntity;
10
+ getOptions?: (objects: Entity.Any[], options?: {
11
+ parentLabel?: boolean;
12
+ }) => RefOption[];
13
+ onCreate?: (schema: Type.AnyEntity, values: any) => void;
14
+ };
15
+ export declare const RefField: (props: RefFieldProps) => React.JSX.Element | null;
16
+ //# sourceMappingURL=RefField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/RefField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,OAAO,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAoB,IAAI,EAAE,MAAM,YAAY,CAAC;AAW3E,OAAO,EAAgB,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjG,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AA0BrF,MAAM,MAAM,aAAa,GAAG,uBAAuB,GACjD,IAAI,CACF,wBAAwB,EACxB,mBAAmB,GAAG,kBAAkB,GAAG,wBAAwB,GAAG,gBAAgB,CACvF,GAAG;IACF,EAAE,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC;IAC1E,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,SAAS,CAAC;IAC3E,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,SAAS,EAAE,CAAC;IACzF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,6BA2I5C,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
3
+ export type SelectFieldOptions = FormFieldComponentProps & {
4
+ options?: Array<{
5
+ value: string | number;
6
+ label?: string;
7
+ }>;
8
+ };
9
+ export declare const SelectField: ({ type, readonly, label, layout, placeholder, options, getStatus, getValue, onValueChange, }: SelectFieldOptions) => React.JSX.Element | null;
10
+ //# sourceMappingURL=SelectField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/SelectField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAI3C,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAErF,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,GAAG;IACzD,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,8FAUzB,kBAAkB,6BAwCpB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { type SelectOption } from '@dxos/echo/internal';
3
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
4
+ export declare const SelectOptionField: ({ type, readonly, label, getStatus, getValue, onValueChange, }: FormFieldComponentProps<SelectOption[] | undefined>) => React.JSX.Element;
5
+ //# sourceMappingURL=SelectOptionField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectOptionField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/SelectOptionField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAyF,MAAM,OAAO,CAAC;AAE9G,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAErF,eAAO,MAAM,iBAAiB,GAAI,gEAO/B,uBAAuB,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,sBA4KrD,CAAC"}