@dxos/react-ui-form 0.9.1-main.c7dcc2e112 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/dist/lib/browser/index.mjs +1883 -1539
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +1883 -1539
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/annotations.d.ts +47 -0
  8. package/dist/types/src/annotations.d.ts.map +1 -0
  9. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  10. package/dist/types/src/components/Form/Form.d.ts +12 -4
  11. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Form.stories.d.ts +46 -65
  13. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.theme.d.ts +252 -0
  15. package/dist/types/src/components/Form/Form.theme.d.ts.map +1 -0
  16. package/dist/types/src/components/Form/Form.theme.test.d.ts +2 -0
  17. package/dist/types/src/components/Form/Form.theme.test.d.ts.map +1 -0
  18. package/dist/types/src/components/Form/FormControls.d.ts +17 -8
  19. package/dist/types/src/components/Form/FormControls.d.ts.map +1 -1
  20. package/dist/types/src/components/Form/FormField/FormField.d.ts +16 -2
  21. package/dist/types/src/components/Form/FormField/FormField.d.ts.map +1 -1
  22. package/dist/types/src/components/Form/FormField/FormFieldHeader.d.ts +27 -0
  23. package/dist/types/src/components/Form/FormField/FormFieldHeader.d.ts.map +1 -0
  24. package/dist/types/src/components/Form/FormField/FormRow.d.ts +85 -0
  25. package/dist/types/src/components/Form/FormField/FormRow.d.ts.map +1 -0
  26. package/dist/types/src/components/Form/FormField/{FormFieldWrapper.stories.d.ts → FormRow.stories.d.ts} +4 -1
  27. package/dist/types/src/components/Form/FormField/FormRow.stories.d.ts.map +1 -0
  28. package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.d.ts.map +1 -1
  29. package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.d.ts +1 -0
  30. package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.d.ts.map +1 -1
  31. package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/AsyncSelectField.d.ts +12 -0
  32. package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/AsyncSelectField.d.ts.map +1 -0
  33. package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/index.d.ts +2 -0
  34. package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/index.d.ts.map +1 -0
  35. package/dist/types/src/components/Form/FormField/fields/AutofillField/AutofillField.d.ts +12 -0
  36. package/dist/types/src/components/Form/FormField/fields/AutofillField/AutofillField.d.ts.map +1 -0
  37. package/dist/types/src/components/Form/FormField/fields/AutofillField/index.d.ts +2 -0
  38. package/dist/types/src/components/Form/FormField/fields/AutofillField/index.d.ts.map +1 -0
  39. package/dist/types/src/components/Form/FormField/fields/BooleanField/BooleanField.d.ts.map +1 -1
  40. package/dist/types/src/components/Form/FormField/fields/ComboboxField/ComboboxField.d.ts +12 -0
  41. package/dist/types/src/components/Form/FormField/fields/ComboboxField/ComboboxField.d.ts.map +1 -0
  42. package/dist/types/src/components/Form/FormField/fields/ComboboxField/index.d.ts +2 -0
  43. package/dist/types/src/components/Form/FormField/fields/ComboboxField/index.d.ts.map +1 -0
  44. package/dist/types/src/components/Form/FormField/fields/GeoPointField/GeoPointField.d.ts +1 -1
  45. package/dist/types/src/components/Form/FormField/fields/GeoPointField/GeoPointField.d.ts.map +1 -1
  46. package/dist/types/src/components/Form/FormField/fields/MarkdownField/MarkdownField.d.ts +1 -1
  47. package/dist/types/src/components/Form/FormField/fields/MarkdownField/MarkdownField.d.ts.map +1 -1
  48. package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.d.ts +11 -0
  49. package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.d.ts.map +1 -1
  50. package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.test.d.ts +2 -0
  51. package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.test.d.ts.map +1 -0
  52. package/dist/types/src/components/Form/FormField/fields/PasswordField/PasswordField.d.ts +4 -0
  53. package/dist/types/src/components/Form/FormField/fields/PasswordField/PasswordField.d.ts.map +1 -0
  54. package/dist/types/src/components/{Settings/Settings.stories.d.ts → Form/FormField/fields/PasswordField/PasswordField.stories.d.ts} +1 -2
  55. package/dist/types/src/components/Form/FormField/fields/PasswordField/PasswordField.stories.d.ts.map +1 -0
  56. package/dist/types/src/components/Form/FormField/fields/PasswordField/index.d.ts +2 -0
  57. package/dist/types/src/components/Form/FormField/fields/PasswordField/index.d.ts.map +1 -0
  58. package/dist/types/src/components/Form/FormField/fields/RefField/InlineRefField.d.ts.map +1 -1
  59. package/dist/types/src/components/Form/FormField/fields/RefField/RefField.d.ts.map +1 -1
  60. package/dist/types/src/components/Form/FormField/fields/SelectField/SelectField.d.ts +18 -2
  61. package/dist/types/src/components/Form/FormField/fields/SelectField/SelectField.d.ts.map +1 -1
  62. package/dist/types/src/components/Form/FormField/fields/index.d.ts +4 -0
  63. package/dist/types/src/components/Form/FormField/fields/index.d.ts.map +1 -1
  64. package/dist/types/src/components/Form/FormField/index.d.ts +4 -3
  65. package/dist/types/src/components/Form/FormField/index.d.ts.map +1 -1
  66. package/dist/types/src/components/Form/FormField/presentation.d.ts +22 -0
  67. package/dist/types/src/components/Form/FormField/presentation.d.ts.map +1 -0
  68. package/dist/types/src/components/Form/FormFieldSet/FormFieldSet.d.ts +8 -5
  69. package/dist/types/src/components/Form/FormFieldSet/FormFieldSet.d.ts.map +1 -1
  70. package/dist/types/src/components/Form/FormFieldSet/FormFieldSetContainer.d.ts +22 -0
  71. package/dist/types/src/components/Form/FormFieldSet/FormFieldSetContainer.d.ts.map +1 -0
  72. package/dist/types/src/components/Form/FormFieldSet/index.d.ts +1 -0
  73. package/dist/types/src/components/Form/FormFieldSet/index.d.ts.map +1 -1
  74. package/dist/types/src/components/Form/FormLayout/FormLayout.d.ts +2 -0
  75. package/dist/types/src/components/Form/FormLayout/FormLayout.d.ts.map +1 -1
  76. package/dist/types/src/components/Form/FormLayout/FormLayout.stories.d.ts +5 -5
  77. package/dist/types/src/components/Form/FormLayout/FormLayout.stories.d.ts.map +1 -1
  78. package/dist/types/src/components/Form/FormLayout/index.d.ts +1 -1
  79. package/dist/types/src/components/Form/FormLayout/index.d.ts.map +1 -1
  80. package/dist/types/src/components/Form/meta-tags.d.ts +1 -12
  81. package/dist/types/src/components/Form/meta-tags.d.ts.map +1 -1
  82. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  83. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +2 -1
  84. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -1
  85. package/dist/types/src/components/RefEditor/RefEditor.stories.d.ts +2 -2
  86. package/dist/types/src/components/RefEditor/RefEditor.stories.d.ts.map +1 -1
  87. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  88. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +2 -2
  89. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  90. package/dist/types/src/components/index.d.ts +0 -1
  91. package/dist/types/src/components/index.d.ts.map +1 -1
  92. package/dist/types/src/hooks/index.d.ts +1 -0
  93. package/dist/types/src/hooks/index.d.ts.map +1 -1
  94. package/dist/types/src/hooks/useAsyncFieldEffect.d.ts +24 -0
  95. package/dist/types/src/hooks/useAsyncFieldEffect.d.ts.map +1 -0
  96. package/dist/types/src/hooks/useFormContext.d.ts +8 -3
  97. package/dist/types/src/hooks/useFormContext.d.ts.map +1 -1
  98. package/dist/types/src/hooks/useFormHandler.d.ts +8 -2
  99. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
  100. package/dist/types/src/index.d.ts +1 -0
  101. package/dist/types/src/index.d.ts.map +1 -1
  102. package/dist/types/src/testing/TestLayout.d.ts +1 -1
  103. package/dist/types/src/testing/TestLayout.d.ts.map +1 -1
  104. package/dist/types/src/testing/schema.d.ts +13 -16
  105. package/dist/types/src/testing/schema.d.ts.map +1 -1
  106. package/dist/types/src/types.d.ts +50 -1
  107. package/dist/types/src/types.d.ts.map +1 -1
  108. package/dist/types/src/util/index.d.ts +0 -1
  109. package/dist/types/src/util/index.d.ts.map +1 -1
  110. package/dist/types/src/util/omit.d.ts +1 -1
  111. package/dist/types/src/util/omit.d.ts.map +1 -1
  112. package/dist/types/tsconfig.tsbuildinfo +1 -1
  113. package/package.json +41 -40
  114. package/src/annotations.ts +63 -0
  115. package/src/components/FieldEditor/FieldEditor.tsx +5 -2
  116. package/src/components/Form/DESIGN.md +24 -0
  117. package/src/components/Form/Form.stories.tsx +257 -13
  118. package/src/components/Form/Form.theme.test.ts +33 -0
  119. package/src/components/Form/Form.theme.ts +86 -0
  120. package/src/components/Form/Form.tsx +15 -9
  121. package/src/components/Form/FormControls.tsx +94 -37
  122. package/src/components/Form/FormField/FormField.tsx +83 -32
  123. package/src/components/Form/FormField/FormFieldHeader.tsx +68 -0
  124. package/src/components/Form/FormField/{FormFieldWrapper.stories.tsx → FormRow.stories.tsx} +34 -9
  125. package/src/components/Form/FormField/FormRow.tsx +298 -0
  126. package/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.tsx +25 -9
  127. package/src/components/Form/FormField/fields/ArrayField/ArrayField.tsx +83 -24
  128. package/src/components/Form/FormField/fields/AsyncSelectField/AsyncSelectField.tsx +59 -0
  129. package/src/components/Form/FormField/fields/AsyncSelectField/index.ts +5 -0
  130. package/src/components/Form/FormField/fields/AutofillField/AutofillField.tsx +67 -0
  131. package/src/components/Form/FormField/fields/AutofillField/index.ts +5 -0
  132. package/src/components/Form/FormField/fields/BooleanField/BooleanField.tsx +5 -6
  133. package/src/components/Form/FormField/fields/ComboboxField/ComboboxField.tsx +104 -0
  134. package/src/components/Form/FormField/fields/ComboboxField/index.ts +5 -0
  135. package/src/components/Form/FormField/fields/DateField/DateField.tsx +9 -9
  136. package/src/components/Form/FormField/fields/GeoPointField/GeoPointField.tsx +17 -20
  137. package/src/components/Form/FormField/fields/MarkdownField/MarkdownField.stories.tsx +2 -2
  138. package/src/components/Form/FormField/fields/MarkdownField/MarkdownField.tsx +39 -40
  139. package/src/components/Form/FormField/fields/NumberField/NumberField.test.ts +29 -0
  140. package/src/components/Form/FormField/fields/NumberField/NumberField.tsx +60 -21
  141. package/src/components/Form/FormField/fields/PasswordField/PasswordField.stories.tsx +53 -0
  142. package/src/components/Form/FormField/fields/PasswordField/PasswordField.tsx +41 -0
  143. package/src/components/Form/FormField/fields/PasswordField/index.ts +5 -0
  144. package/src/components/Form/FormField/fields/RefField/InlineRefField.tsx +16 -10
  145. package/src/components/Form/FormField/fields/RefField/RefField.test.ts +8 -0
  146. package/src/components/Form/FormField/fields/RefField/RefField.tsx +50 -23
  147. package/src/components/Form/FormField/fields/SelectField/SelectField.tsx +104 -47
  148. package/src/components/Form/FormField/fields/SelectOptionField/SelectOptionField.tsx +3 -3
  149. package/src/components/Form/FormField/fields/TextAreaField/TextAreaField.tsx +3 -3
  150. package/src/components/Form/FormField/fields/TextField/TextField.tsx +3 -3
  151. package/src/components/Form/FormField/fields/TupleField/TupleField.tsx +1 -1
  152. package/src/components/Form/FormField/fields/index.ts +4 -0
  153. package/src/components/Form/FormField/index.ts +5 -3
  154. package/src/components/Form/FormField/presentation.tsx +32 -0
  155. package/src/components/Form/FormFieldSet/FormFieldSet.tsx +49 -70
  156. package/src/components/Form/FormFieldSet/FormFieldSetContainer.tsx +93 -0
  157. package/src/components/Form/FormFieldSet/index.ts +1 -0
  158. package/src/components/Form/FormLayout/FormLayout.stories.tsx +7 -5
  159. package/src/components/Form/FormLayout/FormLayout.tsx +24 -14
  160. package/src/components/Form/FormLayout/index.ts +1 -1
  161. package/src/components/Form/meta-tags.test.ts +1 -1
  162. package/src/components/ObjectForm/ObjectForm.tsx +2 -2
  163. package/src/components/ObjectPicker/ObjectPicker.tsx +1 -0
  164. package/src/components/ObjectProperties/ObjectProperties.stories.tsx +1 -1
  165. package/src/components/ObjectProperties/ObjectProperties.tsx +12 -8
  166. package/src/components/RefEditor/RefEditor.stories.tsx +2 -2
  167. package/src/components/RefEditor/RefEditor.tsx +1 -1
  168. package/src/components/ViewEditor/ViewEditor.stories.tsx +2 -2
  169. package/src/components/ViewEditor/ViewEditor.test.tsx +8 -2
  170. package/src/components/ViewEditor/ViewEditor.tsx +3 -3
  171. package/src/components/index.ts +0 -1
  172. package/src/hooks/index.ts +1 -0
  173. package/src/hooks/useAsyncFieldEffect.ts +81 -0
  174. package/src/hooks/useFormContext.ts +6 -3
  175. package/src/hooks/useFormHandler.ts +11 -6
  176. package/src/index.ts +1 -0
  177. package/src/testing/TestLayout.tsx +15 -12
  178. package/src/testing/schema.ts +43 -43
  179. package/src/types.ts +53 -1
  180. package/src/util/index.ts +0 -1
  181. package/src/util/omit.ts +25 -11
  182. package/src/util/properties.test.ts +110 -28
  183. package/src/util/refs.ts +1 -1
  184. package/dist/types/src/components/Form/FormField/FieldHeader.d.ts +0 -19
  185. package/dist/types/src/components/Form/FormField/FieldHeader.d.ts.map +0 -1
  186. package/dist/types/src/components/Form/FormField/FormFieldWrapper.d.ts +0 -47
  187. package/dist/types/src/components/Form/FormField/FormFieldWrapper.d.ts.map +0 -1
  188. package/dist/types/src/components/Form/FormField/FormFieldWrapper.stories.d.ts.map +0 -1
  189. package/dist/types/src/components/Settings/Settings.d.ts +0 -51
  190. package/dist/types/src/components/Settings/Settings.d.ts.map +0 -1
  191. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +0 -1
  192. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts +0 -43
  193. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts.map +0 -1
  194. package/dist/types/src/components/Settings/SettingsItem.d.ts +0 -16
  195. package/dist/types/src/components/Settings/SettingsItem.d.ts.map +0 -1
  196. package/dist/types/src/components/Settings/SettingsSelectField.d.ts +0 -18
  197. package/dist/types/src/components/Settings/SettingsSelectField.d.ts.map +0 -1
  198. package/dist/types/src/components/Settings/index.d.ts +0 -4
  199. package/dist/types/src/components/Settings/index.d.ts.map +0 -1
  200. package/dist/types/src/util/field-type.d.ts +0 -19
  201. package/dist/types/src/util/field-type.d.ts.map +0 -1
  202. package/src/components/Form/FormField/FieldHeader.tsx +0 -36
  203. package/src/components/Form/FormField/FormFieldWrapper.tsx +0 -179
  204. package/src/components/Settings/AUDIT.md +0 -51
  205. package/src/components/Settings/Settings.stories.tsx +0 -104
  206. package/src/components/Settings/Settings.tsx +0 -81
  207. package/src/components/Settings/SettingsFieldSet.tsx +0 -257
  208. package/src/components/Settings/SettingsItem.tsx +0 -58
  209. package/src/components/Settings/SettingsSelectField.tsx +0 -59
  210. package/src/components/Settings/index.ts +0 -7
  211. package/src/util/field-type.ts +0 -60
@@ -1,20 +1,20 @@
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 { Obj } from '@dxos/echo';
5
4
  import { type AnyProperties } from '@dxos/echo/internal';
5
+ import { Person } from '../../testing';
6
6
  import { type ExcludeId } from '../../util';
7
7
  import { type FormRootProps } from './Form';
8
- type DefaultStoryProps<T extends AnyProperties> = {
9
- schema?: Schema.Schema<T>;
10
- } & FormRootProps<T>;
8
+ type StoryArgs<T extends AnyProperties> = FormRootProps<T> & {
9
+ json?: boolean;
10
+ };
11
11
  declare const meta: {
12
12
  title: string;
13
13
  component: {
14
14
  <T extends AnyProperties = AnyProperties>({ children, schema, values, onSave, onCancel, ...props }: FormRootProps<T>): React.JSX.Element;
15
15
  displayName: string;
16
16
  };
17
- render: <T extends AnyProperties = AnyProperties>({ schema, values: valuesProp, ...props }: DefaultStoryProps<T>) => React.JSX.Element;
17
+ render: <T extends AnyProperties = AnyProperties>({ schema, values: valuesProp, json, ...props }: StoryArgs<T>) => React.JSX.Element;
18
18
  decorators: import("@storybook/react").Decorator[];
19
19
  parameters: {
20
20
  layout: string;
@@ -95,66 +95,8 @@ declare const meta: {
95
95
  };
96
96
  };
97
97
  export default meta;
98
- type Story<T extends AnyProperties> = StoryObj<DefaultStoryProps<T>>;
99
- declare const PersonSchema: Schema.Schema<{
100
- readonly name: string;
101
- readonly ignore?: string | undefined;
102
- readonly active?: boolean | undefined;
103
- readonly address?: {
104
- readonly street: string;
105
- readonly city: string;
106
- readonly state: string;
107
- readonly zip: number;
108
- } | undefined;
109
- readonly employer?: import("@dxos/echo/internal").Ref<{
110
- readonly name: string;
111
- } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
112
- readonly tags?: readonly import("@dxos/echo/internal").Ref<{
113
- readonly label: string;
114
- readonly hue?: string | undefined;
115
- } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[] | undefined;
116
- readonly status?: "active" | "inactive" | undefined;
117
- readonly notes?: string | undefined;
118
- readonly location?: readonly [number, number, (number | undefined)?] | undefined;
119
- readonly birthday?: string | undefined;
120
- readonly meetingAt?: string | undefined;
121
- readonly reminderAt?: string | undefined;
122
- readonly tasks?: readonly string[] | undefined;
123
- readonly locations?: readonly (readonly [number, number, (number | undefined)?])[] | undefined;
124
- readonly identities?: readonly {
125
- readonly type: string;
126
- readonly value: string;
127
- }[] | undefined;
128
- } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>, {
129
- readonly name: string;
130
- readonly ignore?: string | undefined;
131
- readonly active?: boolean | undefined;
132
- readonly address?: {
133
- readonly street: string;
134
- readonly city: string;
135
- readonly state: string;
136
- readonly zip: number;
137
- } | undefined;
138
- readonly employer?: import("@dxos/echo/internal").Ref<{
139
- readonly name: string;
140
- } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
141
- readonly tags?: readonly import("@dxos/echo/internal").Ref<{
142
- readonly label: string;
143
- readonly hue?: string | undefined;
144
- } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[] | undefined;
145
- readonly status?: "active" | "inactive" | undefined;
146
- readonly notes?: string | undefined;
147
- readonly location?: readonly [number, number, (number | undefined)?] | undefined;
148
- readonly birthday?: string | undefined;
149
- readonly meetingAt?: string | undefined;
150
- readonly reminderAt?: string | undefined;
151
- readonly tasks?: readonly string[] | undefined;
152
- readonly locations?: readonly (readonly [number, number, (number | undefined)?])[] | undefined;
153
- readonly identities?: readonly {
154
- readonly type: string;
155
- readonly value: string;
156
- }[] | undefined;
157
- } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>, never>;
98
+ declare const PersonSchema: Schema.Schema<Person & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>, Person & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>, never>;
99
+ type Story<T extends AnyProperties> = StoryObj<StoryArgs<T>>;
158
100
  /**
159
101
  * Build a data-entry surface by handing an Effect schema to `Form.Root` — the form derives its fields,
160
102
  * types, validation, and selects from the schema, so you don't hand-wire one control per property.
@@ -171,5 +113,44 @@ declare const PersonSchema: Schema.Schema<{
171
113
  export declare const Default: Story<ExcludeId<typeof PersonSchema>>;
172
114
  export declare const Readonly: Story<ExcludeId<typeof PersonSchema>>;
173
115
  export declare const Static: Story<ExcludeId<typeof PersonSchema>>;
116
+ declare const SettingsSchema: Schema.mutable<Schema.Struct<{
117
+ viewMode: Schema.Literal<["preview", "readonly", "source"]>;
118
+ toolbar: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
119
+ fontSize: Schema.optional<Schema.SchemaClass<number, number, never>>;
120
+ }>>;
121
+ export declare const Variants: Story<Schema.Schema.Type<typeof SettingsSchema>>;
122
+ /**
123
+ * Exercises a `Ref<Text>` field carrying both `Format.TypeFormat.Markdown` and
124
+ * `FormInlineAnnotation` — the markdown editor should render inline rather than
125
+ * opening a ref picker or nested struct form.
126
+ */
127
+ export declare const InlineMarkdownText: Story<any>;
174
128
  export declare const Empty: Story<ExcludeId<typeof PersonSchema>>;
129
+ declare const DynamicFieldsSchema: Schema.mutable<Schema.Struct<{
130
+ query: Schema.SchemaClass<string, string, never>;
131
+ url: Schema.refine<string, typeof Schema.String>;
132
+ choice: Schema.optional<Schema.SchemaClass<string, string, never>>;
133
+ tag: Schema.optional<Schema.SchemaClass<string, string, never>>;
134
+ name: Schema.optional<Schema.SchemaClass<string, string, never>>;
135
+ }>>;
136
+ /**
137
+ * Exercises the dynamic-field annotations: `OptionsLookupAnnotation` (select options loaded from a
138
+ * sibling) and `AutofillAnnotation` (value derived from a sibling, gated on validity and delayed). Each
139
+ * runs a self-contained Effect from the current form values.
140
+ */
141
+ export declare const DynamicFields: Story<Schema.Schema.Type<typeof DynamicFieldsSchema>>;
142
+ declare const CreateFeedSchema: Schema.Union<[Schema.Struct<{
143
+ type: Schema.Literal<["standard-site"]>;
144
+ handle: Schema.SchemaClass<string, string, never>;
145
+ publication: Schema.SchemaClass<string, string, never>;
146
+ }>, Schema.Struct<{
147
+ type: Schema.Literal<["rss"]>;
148
+ url: Schema.refine<string, typeof Schema.String>;
149
+ name: Schema.optional<Schema.SchemaClass<string, string, never>>;
150
+ }>]>;
151
+ /**
152
+ * A discriminated-union create form: selecting `type` reveals that member's fields (combobox + select for
153
+ * `standard-site`, URL + autofill for `rss`). Mirrors the magazine create-feed schema.
154
+ */
155
+ export declare const DiscriminatedUnion: Story<Schema.Schema.Type<typeof CreateFeedSchema>>;
175
156
  //# 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,MA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CAAC;AAEF,QAAA,MAAM,cAAc;;;;GAgBnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,cAAc,CAAC,CAgBrE,CAAC;AAoCF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAKzC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,YAAY,CAAC,CAEvD,CAAC;AAqBF,QAAA,MAAM,mBAAmB;;;;;;GAgDxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAK/E,CAAC;AAkEF,QAAA,MAAM,gBAAgB;;;;;;;;IAA8C,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAKjF,CAAC"}
@@ -0,0 +1,252 @@
1
+ import { type VariantProps } from '@dxos/ui-theme';
2
+ /** Visual variants for {@link Form}. `settings` is the bordered two-column settings-panel look. */
3
+ export type FormVariant = NonNullable<VariantProps<typeof formStyles>['variant']>;
4
+ /** Non-className behavior flags, keyed by {@link FormVariant}. */
5
+ export type FormBehavior = {
6
+ showDescription: boolean;
7
+ };
8
+ declare const formStyles: import("tailwind-variants").TVReturnType<{
9
+ variant: {
10
+ default: {};
11
+ settings: {
12
+ content: string;
13
+ section: string;
14
+ sectionHeader: string;
15
+ sectionTitle: string;
16
+ sectionDescription: string;
17
+ fieldSet: string;
18
+ field: string;
19
+ fieldLabel: string;
20
+ fieldLabelText: string;
21
+ fieldDescription: string;
22
+ fieldControl: string;
23
+ fieldValidation: string;
24
+ };
25
+ };
26
+ }, {
27
+ viewport: string;
28
+ content: string;
29
+ section: string;
30
+ group: string;
31
+ sectionHeader: string;
32
+ sectionTitle: string;
33
+ sectionDescription: string;
34
+ fieldSet: string;
35
+ field: string;
36
+ fieldLabel: string;
37
+ fieldLabelText: string;
38
+ fieldDescription: string;
39
+ fieldControl: string;
40
+ fieldValidation: string;
41
+ actions: string;
42
+ submit: string;
43
+ fieldSetBody: string;
44
+ fieldSetBox: string;
45
+ fieldSetBoxOuter: string;
46
+ }, undefined, {
47
+ variant: {
48
+ default: {};
49
+ settings: {
50
+ content: string;
51
+ section: string;
52
+ sectionHeader: string;
53
+ sectionTitle: string;
54
+ sectionDescription: string;
55
+ fieldSet: string;
56
+ field: string;
57
+ fieldLabel: string;
58
+ fieldLabelText: string;
59
+ fieldDescription: string;
60
+ fieldControl: string;
61
+ fieldValidation: string;
62
+ };
63
+ };
64
+ }, {
65
+ viewport: string;
66
+ content: string;
67
+ section: string;
68
+ group: string;
69
+ sectionHeader: string;
70
+ sectionTitle: string;
71
+ sectionDescription: string;
72
+ fieldSet: string;
73
+ field: string;
74
+ fieldLabel: string;
75
+ fieldLabelText: string;
76
+ fieldDescription: string;
77
+ fieldControl: string;
78
+ fieldValidation: string;
79
+ actions: string;
80
+ submit: string;
81
+ fieldSetBody: string;
82
+ fieldSetBox: string;
83
+ fieldSetBoxOuter: string;
84
+ }, import("tailwind-variants").TVReturnType<{
85
+ variant: {
86
+ default: {};
87
+ settings: {
88
+ content: string;
89
+ section: string;
90
+ sectionHeader: string;
91
+ sectionTitle: string;
92
+ sectionDescription: string;
93
+ fieldSet: string;
94
+ field: string;
95
+ fieldLabel: string;
96
+ fieldLabelText: string;
97
+ fieldDescription: string;
98
+ fieldControl: string;
99
+ fieldValidation: string;
100
+ };
101
+ };
102
+ }, {
103
+ viewport: string;
104
+ content: string;
105
+ section: string;
106
+ group: string;
107
+ sectionHeader: string;
108
+ sectionTitle: string;
109
+ sectionDescription: string;
110
+ fieldSet: string;
111
+ field: string;
112
+ fieldLabel: string;
113
+ fieldLabelText: string;
114
+ fieldDescription: string;
115
+ fieldControl: string;
116
+ fieldValidation: string;
117
+ actions: string;
118
+ submit: string;
119
+ fieldSetBody: string;
120
+ fieldSetBox: string;
121
+ fieldSetBoxOuter: string;
122
+ }, undefined, unknown, unknown, undefined>>;
123
+ /** {@link Form} theme template: a tailwind-variants recipe (`styles`) plus non-class `behavior`. */
124
+ export declare const formTheme: {
125
+ styles: import("tailwind-variants").TVReturnType<{
126
+ variant: {
127
+ default: {};
128
+ settings: {
129
+ content: string;
130
+ section: string;
131
+ sectionHeader: string;
132
+ sectionTitle: string;
133
+ sectionDescription: string;
134
+ fieldSet: string;
135
+ field: string;
136
+ fieldLabel: string;
137
+ fieldLabelText: string;
138
+ fieldDescription: string;
139
+ fieldControl: string;
140
+ fieldValidation: string;
141
+ };
142
+ };
143
+ }, {
144
+ viewport: string;
145
+ content: string;
146
+ section: string;
147
+ group: string;
148
+ sectionHeader: string;
149
+ sectionTitle: string;
150
+ sectionDescription: string;
151
+ fieldSet: string;
152
+ field: string;
153
+ fieldLabel: string;
154
+ fieldLabelText: string;
155
+ fieldDescription: string;
156
+ fieldControl: string;
157
+ fieldValidation: string;
158
+ actions: string;
159
+ submit: string;
160
+ fieldSetBody: string;
161
+ fieldSetBox: string;
162
+ fieldSetBoxOuter: string;
163
+ }, undefined, {
164
+ variant: {
165
+ default: {};
166
+ settings: {
167
+ content: string;
168
+ section: string;
169
+ sectionHeader: string;
170
+ sectionTitle: string;
171
+ sectionDescription: string;
172
+ fieldSet: string;
173
+ field: string;
174
+ fieldLabel: string;
175
+ fieldLabelText: string;
176
+ fieldDescription: string;
177
+ fieldControl: string;
178
+ fieldValidation: string;
179
+ };
180
+ };
181
+ }, {
182
+ viewport: string;
183
+ content: string;
184
+ section: string;
185
+ group: string;
186
+ sectionHeader: string;
187
+ sectionTitle: string;
188
+ sectionDescription: string;
189
+ fieldSet: string;
190
+ field: string;
191
+ fieldLabel: string;
192
+ fieldLabelText: string;
193
+ fieldDescription: string;
194
+ fieldControl: string;
195
+ fieldValidation: string;
196
+ actions: string;
197
+ submit: string;
198
+ fieldSetBody: string;
199
+ fieldSetBox: string;
200
+ fieldSetBoxOuter: string;
201
+ }, import("tailwind-variants").TVReturnType<{
202
+ variant: {
203
+ default: {};
204
+ settings: {
205
+ content: string;
206
+ section: string;
207
+ sectionHeader: string;
208
+ sectionTitle: string;
209
+ sectionDescription: string;
210
+ fieldSet: string;
211
+ field: string;
212
+ fieldLabel: string;
213
+ fieldLabelText: string;
214
+ fieldDescription: string;
215
+ fieldControl: string;
216
+ fieldValidation: string;
217
+ };
218
+ };
219
+ }, {
220
+ viewport: string;
221
+ content: string;
222
+ section: string;
223
+ group: string;
224
+ sectionHeader: string;
225
+ sectionTitle: string;
226
+ sectionDescription: string;
227
+ fieldSet: string;
228
+ field: string;
229
+ fieldLabel: string;
230
+ fieldLabelText: string;
231
+ fieldDescription: string;
232
+ fieldControl: string;
233
+ fieldValidation: string;
234
+ actions: string;
235
+ submit: string;
236
+ fieldSetBody: string;
237
+ fieldSetBox: string;
238
+ fieldSetBoxOuter: string;
239
+ }, undefined, unknown, unknown, undefined>>;
240
+ behavior: {
241
+ default: {
242
+ showDescription: false;
243
+ };
244
+ settings: {
245
+ showDescription: true;
246
+ };
247
+ };
248
+ };
249
+ /** Slot names of {@link formTheme.styles}, for `bridgeTv` registration. */
250
+ export declare const formSlots: Array<keyof ReturnType<typeof formTheme.styles>>;
251
+ export {};
252
+ //# sourceMappingURL=Form.theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.theme.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,gBAAgB,CAAC;AAE3D,mGAAmG;AACnG,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAElF,kEAAkE;AAClE,MAAM,MAAM,YAAY,GAAG;IAAE,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC;AAExD,QAAA,MAAM,UAAU;;QA4BV,OAAO;QACP,QAAQ;YACN,OAAO;YAGP,OAAO;YACP,aAAa;YACb,YAAY;YACZ,kBAAkB;YAElB,QAAQ;YACR,KAAK;YAML,UAAU;YACV,cAAc;YACd,gBAAgB;YAChB,YAAY;YACZ,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAOrB,CAAC;AAEH,oGAAoG;AACpG,eAAO,MAAM,SAAS;;;YA/BhB,OAAO;YACP,QAAQ;gBACN,OAAO;gBAGP,OAAO;gBACP,aAAa;gBACb,YAAY;gBACZ,kBAAkB;gBAElB,QAAQ;gBACR,KAAK;gBAML,UAAU;gBACV,cAAc;gBACd,gBAAgB;gBAChB,YAAY;gBACZ,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBtB,CAAC;AAEF,2EAA2E;AAE3E,eAAO,MAAM,SAAS,EAAsC,KAAK,CAAC,MAAM,UAAU,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Form.theme.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.theme.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.theme.test.ts"],"names":[],"mappings":""}
@@ -1,10 +1,11 @@
1
1
  import React, { type PropsWithChildren } from 'react';
2
2
  import { type AnyProperties } from '@dxos/echo/internal';
3
3
  import { type ColumnRootProps, type IconButtonProps, type ThemedClassName } from '@dxos/react-ui';
4
+ import { type Merge } from '@dxos/util';
4
5
  import { type FormContextValue, type FormHandlerProps, type FormUpdateMeta } from '../../hooks';
5
6
  import { type FormFieldSetProps as NaturalFormFieldSetProps } from './FormFieldSet';
6
7
  import { type FormLayoutProps as NaturalFormLayoutProps } from './FormLayout';
7
- export type FormRootProps<T extends AnyProperties = AnyProperties> = PropsWithChildren<{
8
+ export type FormRootProps<T extends AnyProperties = AnyProperties> = Merge<PropsWithChildren<{
8
9
  /**
9
10
  * Called when the form is submitted and passes validation.
10
11
  */
@@ -13,7 +14,7 @@ export type FormRootProps<T extends AnyProperties = AnyProperties> = PropsWithCh
13
14
  * Called when the form is canceled to abandon/undo any pending changes.
14
15
  */
15
16
  onCancel?: () => void;
16
- } & Omit<FormContextValue<T>, 'form'> & Pick<FormHandlerProps<T>, 'schema' | 'autoSave' | 'values' | 'defaultValues' | 'onValidate' | 'onValuesChanged'> & Omit<NaturalFormFieldSetProps<T>, 'schema' | 'path'>>;
17
+ }>, Omit<FormContextValue<T>, 'form'>, Pick<FormHandlerProps<T>, 'schema' | 'autoSave' | 'values' | 'defaultValues' | 'onValidate' | 'onValuesChanged'>, Omit<NaturalFormFieldSetProps<T>, 'schema' | 'path'>>;
17
18
  export declare function FormRoot<T extends AnyProperties = AnyProperties>({ children, schema, values, onSave, onCancel, ...props }: FormRootProps<T>): React.JSX.Element;
18
19
  export declare namespace FormRoot {
19
20
  var displayName: string;
@@ -29,16 +30,16 @@ export type FormContentProps = ThemedClassName<PropsWithChildren<{}>>;
29
30
  export declare const FormContent: React.ForwardRefExoticComponent<Omit<FormContentProps, "className"> & {
30
31
  classNames?: import("@dxos/ui-types").ClassNameValue;
31
32
  } & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
32
- export type FormFieldSetProps = ThemedClassName<NaturalFormFieldSetProps<any>>;
33
- export declare function FormFieldSet(props: FormFieldSetProps): React.JSX.Element;
34
- export declare namespace FormFieldSet {
33
+ export type FormFieldSetControllerProps = ThemedClassName<NaturalFormFieldSetProps<any>>;
34
+ export declare function FormFieldSetController({ classNames, ...props }: FormFieldSetControllerProps): React.JSX.Element;
35
+ export declare namespace FormFieldSetController {
35
36
  var displayName: string;
36
37
  }
37
38
  export type FormLayoutProps = Omit<NaturalFormLayoutProps, 'schema'> & {
38
39
  schema?: NaturalFormLayoutProps['schema'];
39
40
  };
40
- export declare function FormLayout({ schema, ...props }: FormLayoutProps): React.JSX.Element | null;
41
- export declare namespace FormLayout {
41
+ export declare function FormLayoutController({ schema, ...props }: FormLayoutProps): React.JSX.Element | null;
42
+ export declare namespace FormLayoutController {
42
43
  var displayName: string;
43
44
  }
44
45
  export type FormActionsProps = ThemedClassName<{}>;
@@ -47,12 +48,20 @@ export declare namespace FormActions {
47
48
  var displayName: string;
48
49
  }
49
50
  export type FormSectionProps = ThemedClassName<{
50
- label?: string;
51
+ title?: string;
51
52
  description?: string;
52
53
  }>;
53
54
  export declare const FormSection: React.ForwardRefExoticComponent<Omit<FormSectionProps, "className"> & {
54
55
  classNames?: import("@dxos/ui-types").ClassNameValue;
55
56
  } & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
57
+ export type FormGroupProps = ThemedClassName<PropsWithChildren>;
58
+ /**
59
+ * A bordered card grouping related rows/controls (e.g. an entity card in a list).
60
+ * Layout-only and context-free — unlike `Form.FieldSet` it is not schema-driven.
61
+ */
62
+ export declare const FormGroup: React.ForwardRefExoticComponent<Omit<FormGroupProps, "className"> & {
63
+ classNames?: import("@dxos/ui-types").ClassNameValue;
64
+ } & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
56
65
  export type FormSubmitProps = ThemedClassName<Partial<Pick<IconButtonProps, 'icon' | 'label' | 'disabled'>>>;
57
66
  export declare function FormSubmit({ classNames, label, icon, disabled }: FormSubmitProps): React.JSX.Element | null;
58
67
  export declare namespace FormSubmit {
@@ -1 +1 @@
1
- {"version":3,"file":"FormControls.d.ts","sourceRoot":"","sources":["../../../../../src/components/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C,CAAC,CAAC,CAAC;mCAElF,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,eAAe;;;;AAoCjF,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;kCAGtC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,cAAc"}
@@ -1,7 +1,7 @@
1
1
  import * as SchemaAST from 'effect/SchemaAST';
2
2
  import React from 'react';
3
3
  import { IconButtonProps } from '@dxos/react-ui';
4
- import { type CreateOptions, type FormFieldOptions, type RefFieldDataProps } from '#types';
4
+ import { type FieldContext } from '#types';
5
5
  export type FormFieldProps = {
6
6
  /**
7
7
  * AST of the property to render.
@@ -16,12 +16,26 @@ export type FormFieldProps = {
16
16
  * would otherwise repeat the array's parent name.
17
17
  */
18
18
  name: string | null;
19
+ /**
20
+ * Explicit label, overriding the `title ?? capitalize(name)` derivation. Used by `ArrayField` to
21
+ * give scalar/ref items the array's resolved title (e.g. `Tags`) rather than re-capitalizing the
22
+ * raw array property name (e.g. `_tags`), since the element type carries no title of its own.
23
+ */
24
+ label?: string;
19
25
  /**
20
26
  * Path to the current object from the root. Used with nested forms.
21
27
  */
22
28
  path?: (string | number)[];
23
29
  autoFocus?: boolean;
24
- } & FormFieldOptions & Pick<RefFieldDataProps, 'getOptions' | 'onCreate' | 'useType'> & CreateOptions;
30
+ /** Whether the field is required (non-optional in the schema). Drives the label asterisk. */
31
+ required?: boolean;
32
+ /**
33
+ * Force a `Ref` field to render its target inline (a nested form) instead of the picker.
34
+ * Set by `ArrayField` for owned-ref arrays (`FormCreateAnnotation`); equivalent to
35
+ * `FormInlineAnnotation` but driven by the parent array rather than the element's own AST.
36
+ */
37
+ refInline?: boolean;
38
+ } & FieldContext;
25
39
  export declare function FormField(props: FormFieldProps): React.JSX.Element | null;
26
40
  export declare namespace FormField {
27
41
  var displayName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/FormField/FormField.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAyB,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAGxF,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAGrB,KAAK,iBAAiB,EACvB,MAAM,QAAQ,CAAC;AAmBhB,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;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,gBAAgB,GAClB,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC,GAC9D,aAAa,CAAC;kCAEU,KAAK,EAAE,cAAc;;;;AAiM/C,eAAO,MAAM,iBAAiB,UAAW,eAAe,sBAOvD,CAAC"}
1
+ {"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/FormField/FormField.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAc,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAG7E,OAAO,EAAE,KAAK,YAAY,EAAuD,MAAM,QAAQ,CAAC;AAwBhG,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC;IAEpB;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,YAAY,CAAC;kCAES,KAAK,EAAE,cAAc;;;;AA0O/C,eAAO,MAAM,iBAAiB,UAAW,eAAe,sBAEvD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import React, { type ReactNode } from 'react';
2
+ export type FormFieldHeaderProps = {
3
+ label: string;
4
+ /** JSON path forwarded to the label as field metadata. */
5
+ path?: string;
6
+ required?: boolean;
7
+ readonly?: boolean;
8
+ classNames?: string;
9
+ /** Trailing inline add affordance; omit to hide it. */
10
+ add?: {
11
+ icon?: string;
12
+ label: string;
13
+ disabled?: boolean;
14
+ onClick: () => void;
15
+ };
16
+ /** Extra trailing controls placed after the add affordance (e.g. a collapse toggle). */
17
+ actions?: ReactNode;
18
+ /** Header row click (e.g. toggle collapse). The add affordance stops propagation so it doesn't trigger this. */
19
+ onClick?: () => void;
20
+ };
21
+ /**
22
+ * Header row for a labelled group or list: a label with optional trailing controls (an inline add
23
+ * affordance and/or arbitrary `actions`). Shared by array/list fields ({@link ArrayField}, the view
24
+ * editor) and {@link FormFieldSetContainer}'s collapse header, so all group/list headers render identically.
25
+ */
26
+ export declare const FormFieldHeader: ({ label, path, required, readonly, classNames, add, actions, onClick, }: FormFieldHeaderProps) => React.JSX.Element;
27
+ //# sourceMappingURL=FormFieldHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/FormField/FormFieldHeader.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,GAAG,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChF,wFAAwF;IACxF,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gHAAgH;IAChH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,4EASzB,oBAAoB,sBA6BtB,CAAC"}
@@ -0,0 +1,85 @@
1
+ import React, { Component, type PropsWithChildren, type ReactNode, type Ref } from 'react';
2
+ import { type ThemedClassName } from '@dxos/react-ui';
3
+ import { type FormFieldRendererProps } from '#types';
4
+ import { type FormVariant } from '../Form.theme';
5
+ import { type FormFieldPresentation } from './presentation';
6
+ export type FormFieldLabelProps = ThemedClassName<{
7
+ /** Render a plain `<span>` instead of an input-associated `Input.Label`, for labels used outside an `Input.Root` (e.g. section/group headers). */
8
+ standalone?: boolean;
9
+ /** Class applied to the inner label text node, overriding the default size/color (e.g. `text-lg`). */
10
+ labelClassName?: string;
11
+ /** Form variant; selects the label's chrome (e.g. `settings` enlarges the text and places it in the field grid). */
12
+ variant?: FormVariant;
13
+ error?: string;
14
+ /**
15
+ * JSON path of the field this label describes (e.g. `runtime.client.storage.persistent`).
16
+ * Field metadata; accepted by callers but not currently rendered.
17
+ */
18
+ path?: string;
19
+ /**
20
+ * Trailing button rendered at the end of the label row (third grid column).
21
+ * Used by nested-object field sets to surface a collapse toggle.
22
+ */
23
+ button?: ReactNode;
24
+ onClick?: () => void;
25
+ } & Pick<FormFieldRendererProps, 'label' | 'readonly' | 'required'>>;
26
+ export declare function FormFieldLabel({ classNames, labelClassName, variant, label, error, readonly, required, standalone, button, onClick }: FormFieldLabelProps): React.JSX.Element;
27
+ export declare namespace FormFieldLabel {
28
+ var displayName: string;
29
+ }
30
+ export type FormRowProps<T = any> = ThemedClassName<Pick<FormFieldRendererProps<T>, 'readonly' | 'label' | 'description' | 'presentation' | 'required'> & Partial<Pick<FormFieldRendererProps<T>, 'getStatus' | 'getValue' | 'jsonPath' | 'format'>> & {
31
+ /**
32
+ * Ref to the row's outer element. Enables measurement/positioning (e.g. a future virtualized
33
+ * field set) without forwarding through the generic component.
34
+ */
35
+ rootRef?: Ref<HTMLDivElement>;
36
+ /**
37
+ * Render the label as a standalone `<span>` (group/multi-input fields with no single associated control).
38
+ */
39
+ standalone?: boolean;
40
+ /**
41
+ * Override the read-only/`static` rendering of the value. Fields whose value is not plain text
42
+ * (refs, selects, markdown) supply this; the default formats scalars/dates via `formatStaticValue`.
43
+ * Return `null` to render nothing (e.g. an empty/unresolved value).
44
+ */
45
+ renderStatic?: (value: T | undefined) => ReactNode;
46
+ /**
47
+ * Validation/error content rendered in the validation slot. Supplied directly in action mode; in
48
+ * field mode it is derived from `getStatus`.
49
+ */
50
+ validation?: ReactNode;
51
+ /**
52
+ * The control. A render-prop binds to the form value (field mode: `Input.Root` validation, static
53
+ * rendering, value via `getValue`). Plain nodes render an arbitrary control with no value wiring
54
+ * (action mode, e.g. a button) — the labeled-card escape hatch for an arbitrary control.
55
+ *
56
+ * `value` is `T | undefined` because `getValue()` returns no value when the field is unset (optional
57
+ * schema properties, freshly-added array items); renderers default it (e.g. `{ value = '' }`).
58
+ */
59
+ children?: ReactNode | ((props: {
60
+ value: T | undefined;
61
+ presentation: FormFieldPresentation;
62
+ }) => ReactNode);
63
+ }>;
64
+ export declare function FormRow<T>({ classNames, children, readonly, presentation, label, description, jsonPath, format, required, standalone, renderStatic, validation, getStatus, getValue, rootRef }: FormRowProps<T>): React.JSX.Element | null;
65
+ export declare namespace FormRow {
66
+ var displayName: string;
67
+ }
68
+ type FormFieldErrorState = {
69
+ error: Error | undefined;
70
+ };
71
+ type FormFieldErrorBoundaryProps = PropsWithChildren<{
72
+ path?: (string | number)[];
73
+ }>;
74
+ export declare class FormFieldErrorBoundary extends Component<FormFieldErrorBoundaryProps, FormFieldErrorState> {
75
+ static getDerivedStateFromError(error: Error): {
76
+ error: Error;
77
+ };
78
+ state: {
79
+ error: undefined;
80
+ };
81
+ componentDidUpdate(prevProps: FormFieldErrorBoundaryProps): void;
82
+ render(): string | number | bigint | boolean | React.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
83
+ private resetError;
84
+ }
85
+ //# sourceMappingURL=FormRow.d.ts.map