@dxos/react-ui-form 0.8.4-main.406dc2a → 0.8.4-main.4668b7de9b

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 (283) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +0 -1
  3. package/dist/lib/browser/index.mjs +3504 -2302
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/translations.mjs +83 -0
  7. package/dist/lib/browser/translations.mjs.map +7 -0
  8. package/dist/lib/node-esm/index.mjs +3504 -2302
  9. package/dist/lib/node-esm/index.mjs.map +4 -4
  10. package/dist/lib/node-esm/meta.json +1 -1
  11. package/dist/lib/node-esm/translations.mjs +85 -0
  12. package/dist/lib/node-esm/translations.mjs.map +7 -0
  13. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +8 -7
  14. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  15. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +69 -60
  16. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  17. package/dist/types/src/components/Form/Form.d.ts +135 -26
  18. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  19. package/dist/types/src/components/Form/Form.stories.d.ts +175 -138
  20. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  21. package/dist/types/src/components/Form/FormField.d.ts +53 -0
  22. package/dist/types/src/components/Form/FormField.d.ts.map +1 -0
  23. package/dist/types/src/components/Form/FormFieldComponent.d.ts +91 -0
  24. package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -0
  25. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts +9 -0
  26. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -0
  27. package/dist/types/src/components/Form/FormFieldSet.d.ts +21 -0
  28. package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -0
  29. package/dist/types/src/components/Form/FormTooltipsContext.d.ts +19 -0
  30. package/dist/types/src/components/Form/FormTooltipsContext.d.ts.map +1 -0
  31. package/dist/types/src/components/Form/Layout/FormLayout.d.ts +50 -0
  32. package/dist/types/src/components/Form/Layout/FormLayout.d.ts.map +1 -0
  33. package/dist/types/src/components/Form/Layout/FormLayout.stories.d.ts +119 -0
  34. package/dist/types/src/components/Form/Layout/FormLayout.stories.d.ts.map +1 -0
  35. package/dist/types/src/components/Form/Layout/FormLayout.stories.test.d.ts +2 -0
  36. package/dist/types/src/components/Form/Layout/FormLayout.stories.test.d.ts.map +1 -0
  37. package/dist/types/src/components/Form/Layout/FormLayout.test.d.ts +2 -0
  38. package/dist/types/src/components/Form/Layout/FormLayout.test.d.ts.map +1 -0
  39. package/dist/types/src/components/Form/Layout/annotation.d.ts +30 -0
  40. package/dist/types/src/components/Form/Layout/annotation.d.ts.map +1 -0
  41. package/dist/types/src/components/Form/Layout/index.d.ts +4 -0
  42. package/dist/types/src/components/Form/Layout/index.d.ts.map +1 -0
  43. package/dist/types/src/components/Form/Layout/parser.d.ts +31 -0
  44. package/dist/types/src/components/Form/Layout/parser.d.ts.map +1 -0
  45. package/dist/types/src/components/Form/Layout/parser.test.d.ts +2 -0
  46. package/dist/types/src/components/Form/Layout/parser.test.d.ts.map +1 -0
  47. package/dist/types/src/components/Form/fields/ArrayField.d.ts +18 -0
  48. package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -0
  49. package/dist/types/src/components/Form/fields/BooleanField.d.ts +4 -0
  50. package/dist/types/src/components/Form/fields/BooleanField.d.ts.map +1 -0
  51. package/dist/types/src/components/Form/fields/DateField.d.ts +4 -0
  52. package/dist/types/src/components/Form/fields/DateField.d.ts.map +1 -0
  53. package/dist/types/src/components/Form/fields/GeoPointField.d.ts +5 -0
  54. package/dist/types/src/components/Form/fields/GeoPointField.d.ts.map +1 -0
  55. package/dist/types/src/components/Form/fields/InlineRefField.d.ts +13 -0
  56. package/dist/types/src/components/Form/fields/InlineRefField.d.ts.map +1 -0
  57. package/dist/types/src/components/Form/fields/MarkdownField.d.ts +11 -0
  58. package/dist/types/src/components/Form/fields/MarkdownField.d.ts.map +1 -0
  59. package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts +85 -0
  60. package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts.map +1 -0
  61. package/dist/types/src/components/Form/fields/NumberField.d.ts +4 -0
  62. package/dist/types/src/components/Form/fields/NumberField.d.ts.map +1 -0
  63. package/dist/types/src/components/Form/fields/RefField.d.ts +22 -0
  64. package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -0
  65. package/dist/types/src/components/Form/fields/SelectField.d.ts +13 -0
  66. package/dist/types/src/components/Form/fields/SelectField.d.ts.map +1 -0
  67. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts +5 -0
  68. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -0
  69. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +85 -0
  70. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -0
  71. package/dist/types/src/components/Form/fields/TextAreaField.d.ts +4 -0
  72. package/dist/types/src/components/Form/fields/TextAreaField.d.ts.map +1 -0
  73. package/dist/types/src/components/Form/fields/TextField.d.ts +4 -0
  74. package/dist/types/src/components/Form/fields/TextField.d.ts.map +1 -0
  75. package/dist/types/src/components/Form/fields/TupleField.d.ts +6 -0
  76. package/dist/types/src/components/Form/fields/TupleField.d.ts.map +1 -0
  77. package/dist/types/src/components/Form/fields/index.d.ts +14 -0
  78. package/dist/types/src/components/Form/fields/index.d.ts.map +1 -0
  79. package/dist/types/src/components/Form/index.d.ts +5 -4
  80. package/dist/types/src/components/Form/index.d.ts.map +1 -1
  81. package/dist/types/src/components/Form/meta-tags.d.ts +30 -0
  82. package/dist/types/src/components/Form/meta-tags.d.ts.map +1 -0
  83. package/dist/types/src/components/Form/meta-tags.test.d.ts +2 -0
  84. package/dist/types/src/components/Form/meta-tags.test.d.ts.map +1 -0
  85. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts +8 -0
  86. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -0
  87. package/dist/types/src/components/ObjectForm/index.d.ts +2 -0
  88. package/dist/types/src/components/ObjectForm/index.d.ts.map +1 -0
  89. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +39 -12
  90. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  91. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +65 -59
  92. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  93. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +9 -0
  94. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -0
  95. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts +128 -0
  96. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts.map +1 -0
  97. package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts +2 -0
  98. package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts.map +1 -0
  99. package/dist/types/src/components/ObjectProperties/index.d.ts +2 -0
  100. package/dist/types/src/components/ObjectProperties/index.d.ts.map +1 -0
  101. package/dist/types/src/components/ObjectTree/ObjectTree.d.ts +9 -0
  102. package/dist/types/src/components/ObjectTree/ObjectTree.d.ts.map +1 -0
  103. package/dist/types/src/components/ObjectTree/ObjectTree.stories.d.ts +87 -0
  104. package/dist/types/src/components/ObjectTree/ObjectTree.stories.d.ts.map +1 -0
  105. package/dist/types/src/components/ObjectTree/index.d.ts +2 -0
  106. package/dist/types/src/components/ObjectTree/index.d.ts.map +1 -0
  107. package/dist/types/src/components/Settings/Settings.d.ts +51 -0
  108. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
  109. package/dist/types/src/components/Settings/Settings.stories.d.ts +85 -0
  110. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
  111. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts +43 -0
  112. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts.map +1 -0
  113. package/dist/types/src/components/Settings/SettingsItem.d.ts +16 -0
  114. package/dist/types/src/components/Settings/SettingsItem.d.ts.map +1 -0
  115. package/dist/types/src/components/Settings/SettingsSelectField.d.ts +18 -0
  116. package/dist/types/src/components/Settings/SettingsSelectField.d.ts.map +1 -0
  117. package/dist/types/src/components/Settings/index.d.ts +4 -0
  118. package/dist/types/src/components/Settings/index.d.ts.map +1 -0
  119. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +16 -20
  120. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  121. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +72 -66
  122. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  123. package/dist/types/src/components/index.d.ts +4 -1
  124. package/dist/types/src/components/index.d.ts.map +1 -1
  125. package/dist/types/src/components/testing.d.ts +13 -6
  126. package/dist/types/src/components/testing.d.ts.map +1 -1
  127. package/dist/types/src/hooks/index.d.ts +2 -3
  128. package/dist/types/src/hooks/index.d.ts.map +1 -1
  129. package/dist/types/src/hooks/useFormHandler.d.ts +82 -0
  130. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -0
  131. package/dist/types/src/hooks/useKeyHandler.d.ts +7 -0
  132. package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -0
  133. package/dist/types/src/index.d.ts +0 -2
  134. package/dist/types/src/index.d.ts.map +1 -1
  135. package/dist/types/src/translations.d.ts +66 -60
  136. package/dist/types/src/translations.d.ts.map +1 -1
  137. package/dist/types/src/util/field-type.d.ts +19 -0
  138. package/dist/types/src/util/field-type.d.ts.map +1 -0
  139. package/dist/types/src/util/field.d.ts +3 -3
  140. package/dist/types/src/util/field.d.ts.map +1 -1
  141. package/dist/types/src/util/formatting.d.ts +2 -2
  142. package/dist/types/src/util/formatting.d.ts.map +1 -1
  143. package/dist/types/src/util/index.d.ts +2 -1
  144. package/dist/types/src/util/index.d.ts.map +1 -1
  145. package/dist/types/src/util/properties.d.ts +24 -0
  146. package/dist/types/src/util/properties.d.ts.map +1 -0
  147. package/dist/types/src/util/properties.test.d.ts +2 -0
  148. package/dist/types/src/util/properties.test.d.ts.map +1 -0
  149. package/dist/types/src/util/refs.d.ts +2 -2
  150. package/dist/types/src/util/refs.d.ts.map +1 -1
  151. package/dist/types/tsconfig.tsbuildinfo +1 -1
  152. package/package.json +62 -51
  153. package/src/components/FieldEditor/FieldEditor.stories.tsx +44 -25
  154. package/src/components/FieldEditor/FieldEditor.test.tsx +4 -2
  155. package/src/components/FieldEditor/FieldEditor.tsx +88 -86
  156. package/src/components/Form/AUDIT.md +17 -0
  157. package/src/components/Form/Form.stories.tsx +134 -252
  158. package/src/components/Form/Form.tsx +461 -106
  159. package/src/components/Form/FormField.tsx +363 -0
  160. package/src/components/Form/FormFieldComponent.stories.tsx +65 -0
  161. package/src/components/Form/FormFieldComponent.tsx +229 -0
  162. package/src/components/Form/FormFieldSet.tsx +173 -0
  163. package/src/components/Form/FormTooltipsContext.ts +25 -0
  164. package/src/components/Form/Layout/FormLayout.stories.test.tsx +51 -0
  165. package/src/components/Form/Layout/FormLayout.stories.tsx +422 -0
  166. package/src/components/Form/Layout/FormLayout.test.ts +59 -0
  167. package/src/components/Form/Layout/FormLayout.tsx +251 -0
  168. package/src/components/Form/Layout/annotation.ts +38 -0
  169. package/src/components/Form/Layout/index.ts +7 -0
  170. package/src/components/Form/Layout/parser.test.ts +120 -0
  171. package/src/components/Form/Layout/parser.ts +167 -0
  172. package/src/components/Form/README.md +3 -0
  173. package/src/components/Form/fields/ArrayField.tsx +178 -0
  174. package/src/components/Form/fields/BooleanField.tsx +22 -0
  175. package/src/components/Form/fields/DateField.tsx +101 -0
  176. package/src/components/Form/fields/GeoPointField.tsx +124 -0
  177. package/src/components/Form/fields/InlineRefField.tsx +146 -0
  178. package/src/components/Form/fields/MarkdownField.stories.tsx +206 -0
  179. package/src/components/Form/fields/MarkdownField.tsx +168 -0
  180. package/src/components/Form/fields/NumberField.tsx +39 -0
  181. package/src/components/Form/fields/RefField.tsx +235 -0
  182. package/src/components/Form/fields/SelectField.tsx +77 -0
  183. package/src/components/Form/{custom/SelectOptionsInput.stories.tsx → fields/SelectOptionField.stories.tsx} +23 -18
  184. package/src/components/Form/{custom/SelectOptionsInput.tsx → fields/SelectOptionField.tsx} +31 -24
  185. package/src/components/Form/fields/TextAreaField.tsx +38 -0
  186. package/src/components/Form/fields/TextField.tsx +38 -0
  187. package/src/components/Form/{custom/TupleInput.tsx → fields/TupleField.tsx} +17 -9
  188. package/src/components/Form/fields/index.ts +17 -0
  189. package/src/components/Form/index.ts +6 -4
  190. package/src/components/Form/meta-tags.test.ts +47 -0
  191. package/src/components/Form/meta-tags.ts +33 -0
  192. package/src/components/ObjectForm/ObjectForm.tsx +109 -0
  193. package/src/components/{ControlSection → ObjectForm}/index.ts +1 -1
  194. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +30 -25
  195. package/src/components/ObjectPicker/ObjectPicker.tsx +123 -82
  196. package/src/components/ObjectProperties/ObjectProperties.stories.tsx +350 -0
  197. package/src/components/ObjectProperties/ObjectProperties.test.tsx +111 -0
  198. package/src/components/ObjectProperties/ObjectProperties.tsx +144 -0
  199. package/src/components/ObjectProperties/index.ts +5 -0
  200. package/src/components/ObjectTree/ObjectTree.stories.tsx +134 -0
  201. package/src/components/ObjectTree/ObjectTree.tsx +190 -0
  202. package/src/components/ObjectTree/index.ts +5 -0
  203. package/src/components/Settings/AUDIT.md +51 -0
  204. package/src/components/Settings/Settings.stories.tsx +104 -0
  205. package/src/components/Settings/Settings.tsx +81 -0
  206. package/src/components/Settings/SettingsFieldSet.tsx +257 -0
  207. package/src/components/Settings/SettingsItem.tsx +58 -0
  208. package/src/components/Settings/SettingsSelectField.tsx +59 -0
  209. package/src/components/Settings/index.ts +7 -0
  210. package/src/components/ViewEditor/ViewEditor.stories.tsx +75 -77
  211. package/src/components/ViewEditor/ViewEditor.test.tsx +16 -13
  212. package/src/components/ViewEditor/ViewEditor.tsx +295 -215
  213. package/src/components/index.ts +4 -1
  214. package/src/components/testing.tsx +24 -11
  215. package/src/hooks/index.ts +2 -3
  216. package/src/hooks/useFormHandler.ts +380 -0
  217. package/src/hooks/useKeyHandler.tsx +37 -0
  218. package/src/index.ts +0 -4
  219. package/src/translations.ts +71 -65
  220. package/src/util/field-type.ts +60 -0
  221. package/src/util/field.ts +25 -25
  222. package/src/util/formatting.ts +22 -22
  223. package/src/util/index.ts +2 -1
  224. package/src/util/properties.test.ts +121 -0
  225. package/src/util/properties.ts +61 -0
  226. package/src/util/refs.ts +16 -18
  227. package/src/vite-env.d.ts +10 -0
  228. package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
  229. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
  230. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -84
  231. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
  232. package/dist/types/src/components/ControlSection/index.d.ts +0 -2
  233. package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
  234. package/dist/types/src/components/Form/ArrayField.d.ts +0 -16
  235. package/dist/types/src/components/Form/ArrayField.d.ts.map +0 -1
  236. package/dist/types/src/components/Form/Defaults.d.ts +0 -14
  237. package/dist/types/src/components/Form/Defaults.d.ts.map +0 -1
  238. package/dist/types/src/components/Form/FormActions.d.ts +0 -9
  239. package/dist/types/src/components/Form/FormActions.d.ts.map +0 -1
  240. package/dist/types/src/components/Form/FormContent.d.ts +0 -63
  241. package/dist/types/src/components/Form/FormContent.d.ts.map +0 -1
  242. package/dist/types/src/components/Form/FormContext.d.ts +0 -23
  243. package/dist/types/src/components/Form/FormContext.d.ts.map +0 -1
  244. package/dist/types/src/components/Form/Input.d.ts +0 -29
  245. package/dist/types/src/components/Form/Input.d.ts.map +0 -1
  246. package/dist/types/src/components/Form/RefField.d.ts +0 -22
  247. package/dist/types/src/components/Form/RefField.d.ts.map +0 -1
  248. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts +0 -4
  249. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +0 -1
  250. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts +0 -4
  251. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +0 -1
  252. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +0 -79
  253. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +0 -1
  254. package/dist/types/src/components/Form/custom/TupleInput.d.ts +0 -6
  255. package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +0 -1
  256. package/dist/types/src/components/Form/custom/index.d.ts +0 -4
  257. package/dist/types/src/components/Form/custom/index.d.ts.map +0 -1
  258. package/dist/types/src/components/Form/factory.d.ts +0 -8
  259. package/dist/types/src/components/Form/factory.d.ts.map +0 -1
  260. package/dist/types/src/hooks/useForm.d.ts +0 -67
  261. package/dist/types/src/hooks/useForm.d.ts.map +0 -1
  262. package/dist/types/src/hooks/useQueryRefOptions.d.ts +0 -29
  263. package/dist/types/src/hooks/useQueryRefOptions.d.ts.map +0 -1
  264. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +0 -8
  265. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +0 -1
  266. package/dist/types/src/util/schema.d.ts +0 -3
  267. package/dist/types/src/util/schema.d.ts.map +0 -1
  268. package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
  269. package/src/components/ControlSection/ControlSection.tsx +0 -153
  270. package/src/components/Form/ArrayField.tsx +0 -125
  271. package/src/components/Form/Defaults.tsx +0 -205
  272. package/src/components/Form/FormActions.tsx +0 -54
  273. package/src/components/Form/FormContent.tsx +0 -322
  274. package/src/components/Form/FormContext.tsx +0 -110
  275. package/src/components/Form/Input.tsx +0 -54
  276. package/src/components/Form/RefField.tsx +0 -283
  277. package/src/components/Form/custom/GeoPointInput.tsx +0 -80
  278. package/src/components/Form/custom/index.ts +0 -7
  279. package/src/components/Form/factory.tsx +0 -31
  280. package/src/hooks/useForm.ts +0 -296
  281. package/src/hooks/useQueryRefOptions.ts +0 -62
  282. package/src/hooks/useRefQueryLookupHandler.ts +0 -39
  283. package/src/util/schema.ts +0 -12
@@ -0,0 +1,91 @@
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 Database, Format } from '@dxos/echo';
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
+ /** Database the form is editing against; populated for fields whose value is an ECHO object/Ref. */
28
+ db?: Database.Database;
29
+ type: SchemaAST.AST;
30
+ format?: Format.TypeFormat;
31
+ readonly?: boolean;
32
+ label: string;
33
+ /**
34
+ * Dotted JSON path of this field within the form values (e.g.
35
+ * `runtime.client.storage.persistent`). Forwarded to `FormFieldLabel` so
36
+ * that it can render the path as a debug hint when the enclosing
37
+ * `Form.Root` has `debug` enabled.
38
+ */
39
+ jsonPath?: string;
40
+ placeholder?: string;
41
+ autoFocus?: boolean;
42
+ layout?: Presentation;
43
+ } & FormFieldStateProps<T>;
44
+ export type FormFieldComponent = FC<FormFieldComponentProps>;
45
+ export type FormFieldMap = Record<string, FormFieldComponent>;
46
+ export type FormFieldProvider = (props: {
47
+ prop: string;
48
+ schema: Schema.Schema<any>;
49
+ fieldProps: FormFieldComponentProps;
50
+ }) => ReactElement | null | undefined;
51
+ export type FormFieldLabelProps = {
52
+ asChild?: boolean;
53
+ error?: string;
54
+ /**
55
+ * JSON path of the field this label describes (e.g. `runtime.client.storage.persistent`).
56
+ * Surfaced as a hover tooltip on the label when the enclosing `Form.Root`
57
+ * has `tooltips` enabled (the default) -- useful for spotting which field
58
+ * maps to which path when authoring schemas or filing bugs against a form.
59
+ * Callers can supply the path unconditionally; the label suppresses the
60
+ * tooltip when `Form.Root tooltips={false}`.
61
+ */
62
+ path?: string;
63
+ } & Pick<FormFieldComponentProps, 'label' | 'readonly'>;
64
+ export declare function FormFieldLabel({ label, error, readonly, asChild, path }: FormFieldLabelProps): React.JSX.Element;
65
+ export declare namespace FormFieldLabel {
66
+ var displayName: string;
67
+ }
68
+ export type FormFieldWrapperProps<T = any> = Pick<FormFieldComponentProps, 'readonly' | 'label' | 'layout' | 'getStatus' | 'getValue' | 'jsonPath' | 'format'> & {
69
+ children?: (props: {
70
+ value: T;
71
+ }) => ReactNode;
72
+ };
73
+ export declare const FormFieldWrapper: <T>(props: FormFieldWrapperProps<T>) => React.JSX.Element | null;
74
+ type FormFieldErrorState = {
75
+ error: Error | undefined;
76
+ };
77
+ type FormFieldErrorBoundaryProps = PropsWithChildren<{
78
+ path?: (string | number)[];
79
+ }>;
80
+ export declare class FormFieldErrorBoundary extends Component<FormFieldErrorBoundaryProps, FormFieldErrorState> {
81
+ static getDerivedStateFromError(error: Error): {
82
+ error: Error;
83
+ };
84
+ state: {
85
+ error: undefined;
86
+ };
87
+ componentDidUpdate(prevProps: FormFieldErrorBoundaryProps): void;
88
+ render(): string | number | bigint | boolean | React.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
89
+ private resetError;
90
+ }
91
+ //# sourceMappingURL=FormFieldComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/FormFieldComponent.tsx"],"names":[],"mappings":"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"}
@@ -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,qEAOf,uBAAuB,CAAC,MAAM,CAAC,sBAsBjC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAOnC,CAAC;eAEa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC"}
@@ -0,0 +1,21 @@
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
+ /**
11
+ * Picks a named layout out of `FormLayoutAnnotation` when present.
12
+ * Falls back to `'default'`. Ignored when the schema has no annotation
13
+ * (linear rendering then takes over).
14
+ */
15
+ layoutName?: string;
16
+ } & Pick<FormHandlerProps<T>, 'schema'> & Pick<FormFieldProps, 'path' | 'autoFocus' | 'readonly' | 'layout' | 'projection' | 'fieldMap' | 'fieldProvider' | 'createTypename' | 'createOptionLabel' | 'createOptionIcon' | 'createInitialValuePath' | 'createFieldMap' | 'db' | 'useType' | 'getOptions' | 'onCreate'>;
17
+ export declare function FormFieldSet({ label, schema, readonly, path, sort, exclude, projection, layout, layoutName, ...props }: FormFieldSetProps<any>): React.JSX.Element | null;
18
+ export declare namespace FormFieldSet {
19
+ var displayName: string;
20
+ }
21
+ //# sourceMappingURL=FormFieldSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldSet.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/FormFieldSet.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAM7D,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;IACxD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,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,SAAS,GACT,YAAY,GACZ,UAAU,CACb,CAAC;qCAKyB,EAC3B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,EACN,UAAgC,EAChC,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,GAAG,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A standalone context for the `tooltips` flag (Form.Root's only label
3
+ * decoration today: a JSON-path hover tooltip rendered by
4
+ * `FormFieldLabel`).
5
+ *
6
+ * Lives in its own module so that `FormFieldComponent.tsx` -- imported at
7
+ * the top of `Form.tsx` -- can read the flag without re-importing from
8
+ * `Form.tsx`. That round-trip used to create a circular module-eval
9
+ * dependency that intermittently hit a TDZ ("Cannot access 'FormFieldLabel'
10
+ * before initialization") in browser-mode storybook tests.
11
+ *
12
+ * Defaults to `true` both when `Form.Root` doesn't pass an explicit value
13
+ * AND when there is no enclosing `Form.Root` (e.g. `FormFieldWrapper`
14
+ * stories that render an input without a Form provider).
15
+ */
16
+ export declare const FormTooltipsContext: import("react").Context<boolean>;
17
+ /** Returns whether the enclosing `Form.Root` has field tooltips enabled. */
18
+ export declare const useFormTooltips: () => boolean;
19
+ //# sourceMappingURL=FormTooltipsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormTooltipsContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/FormTooltipsContext.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,kCAA+B,CAAC;AAEhE,4EAA4E;AAC5E,eAAO,MAAM,eAAe,QAAO,OAA0C,CAAC"}
@@ -0,0 +1,50 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import * as SchemaAST from 'effect/SchemaAST';
3
+ import React from 'react';
4
+ import { type AnyProperties } from '@dxos/echo/internal';
5
+ import { type FormFieldProps } from '../FormField';
6
+ export type FormLayoutProps = {
7
+ /**
8
+ * Template string in the FormLayout DSL (`<grid cols=…><field name=…/></grid>`).
9
+ * If omitted, the layout is read from the schema's `FormLayoutAnnotation` —
10
+ * the entry named by `name` (default: `'default'`).
11
+ */
12
+ template?: string;
13
+ /**
14
+ * Picks a named layout out of `FormLayoutAnnotation`'s map when no
15
+ * explicit `template` is supplied. Defaults to `'default'`.
16
+ */
17
+ name?: string;
18
+ } & Pick<FormFieldSetSubset, 'schema' | 'path' | 'readonly' | 'layout' | 'projection' | 'fieldMap' | 'fieldProvider'>;
19
+ type FormFieldSetSubset = Pick<FormFieldProps, 'path' | 'readonly' | 'layout' | 'projection' | 'fieldMap' | 'fieldProvider'> & {
20
+ schema: Schema.Schema<AnyProperties>;
21
+ };
22
+ export declare function FormLayout({ schema, template, name, path, readonly, layout, projection, ...props }: FormLayoutProps): React.JSX.Element;
23
+ export declare namespace FormLayout {
24
+ var displayName: string;
25
+ }
26
+ export type ResolvedLayoutField = {
27
+ /** Resolved leaf AST node for the field. */
28
+ type: SchemaAST.AST;
29
+ /** Path segments (dotted names split on `.`). */
30
+ segments: string[];
31
+ /** Last path segment; used to derive the field label when there is no `title` annotation. */
32
+ leafName: string;
33
+ /** Resolved `title` annotation for the field, if any. */
34
+ title?: string;
35
+ /**
36
+ * Set when the field resolves to a nested struct carrying a `LabelAnnotation` —
37
+ * the type literal whose computed label should render in place of the struct's
38
+ * sub-fields. Undefined for ordinary (non-auto-labelled) fields.
39
+ */
40
+ labelType?: SchemaAST.AST;
41
+ };
42
+ /**
43
+ * Resolves a (possibly dotted) layout field name against a schema.
44
+ * - `origin.code` drills through nested structs to the leaf field.
45
+ * - A name resolving to a nested struct with a `LabelAnnotation` is flagged via
46
+ * `labelType` so the layout can auto-convert it to a single read-only label.
47
+ * Returns `undefined` when the name does not resolve to a property.
48
+ */
49
+ export declare const resolveLayoutField: (schema: Schema.Schema<any>, name: string) => ResolvedLayoutField | undefined;
50
+ //# sourceMappingURL=FormLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/FormLayout.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAO9D,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,eAAe,CAAC,CAAC;AAEtH,KAAK,kBAAkB,GAAG,IAAI,CAC5B,cAAc,EACd,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,eAAe,CAC7E,GAAG;IACF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;CACtC,CAAC;mCAcyB,EACzB,MAAM,EACN,QAAQ,EACR,IAA0B,EAC1B,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,UAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe;;;;AAyElB,MAAM,MAAM,mBAAmB,GAAG;IAChC,4CAA4C;IAC5C,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC;IACpB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6FAA6F;IAC7F,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC;CAC3B,CAAC;AA4BF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,WAAY,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,MAAM,KAAG,mBAAmB,GAAG,SA8BnG,CAAC"}
@@ -0,0 +1,119 @@
1
+ import { type StoryObj } from '@storybook/react-vite';
2
+ import * as Schema from 'effect/Schema';
3
+ import React from 'react';
4
+ import { Type } from '@dxos/echo';
5
+ /**
6
+ * Sample schema: a Flight booking carries airline, flight number, route, dates,
7
+ * cabin class. Without an annotation `<Form.FieldSet/>` renders one field per
8
+ * row (see the `Linear` story). The `FormLayoutAnnotation` on this schema
9
+ * arranges the same fields in a 2-column grid with selective spans.
10
+ */
11
+ declare const Flight: Type.Obj<{
12
+ readonly airline?: string | undefined;
13
+ readonly flightNumber?: string | undefined;
14
+ readonly origin?: string | undefined;
15
+ readonly destination?: string | undefined;
16
+ readonly departAt?: string | undefined;
17
+ readonly arriveAt?: string | undefined;
18
+ readonly cabin?: "business" | "economy" | "first" | "premium" | undefined;
19
+ readonly notes?: string | undefined;
20
+ }, Schema.Struct.Fields>;
21
+ export type Flight = Type.InstanceType<typeof Flight>;
22
+ type StoryProps = {
23
+ schema: Schema.Schema<any>;
24
+ template?: string;
25
+ };
26
+ declare const meta: {
27
+ title: string;
28
+ render: ({ schema, template }: StoryProps) => React.JSX.Element;
29
+ decorators: import("@storybook/react").Decorator[];
30
+ parameters: {
31
+ layout: string;
32
+ translations: [{
33
+ readonly 'en-US': {
34
+ readonly "@dxos/react-ui-form": {
35
+ readonly 'fields.label': 'Fields';
36
+ readonly 'hidden-fields.label': 'Hidden Fields';
37
+ readonly 'empty-readonly-ref-field.label': '(none)';
38
+ readonly 'field-property.label': 'Property';
39
+ readonly 'field-property.placeholder': 'Property name';
40
+ readonly 'field-format.label': 'Type';
41
+ readonly 'field-path.label': 'Field path';
42
+ readonly 'remove-item.button': 'Delete item';
43
+ readonly 'add-item.button': 'Add item';
44
+ readonly 'add-property-button.label': 'Add property';
45
+ readonly 'boolean-input-true.value': 'Yes';
46
+ readonly 'boolean-input-false.value': 'No';
47
+ readonly 'show-field.label': 'Show field';
48
+ readonly 'hide-field.label': 'Hide field';
49
+ readonly 'delete-field.label': 'Delete field';
50
+ readonly 'create-option.label': 'Create';
51
+ readonly 'add-tag.label': 'Add tag';
52
+ readonly 'ref-field-combobox-input.placeholder': 'Search\u2026';
53
+ readonly 'ref-field.placeholder': 'Select\u2026';
54
+ readonly 'ref-field.placeholder_one': 'Select\u2026';
55
+ readonly 'ref-field.placeholder_other': 'Select items\u2026';
56
+ readonly 'example.placeholder': 'Example';
57
+ readonly 'latitude.placeholder': 'Latitude (e.g., 40.7128)';
58
+ readonly 'longitude.placeholder': 'Longitude (e.g., -74.0060)';
59
+ readonly 'cancel-button.label': 'Cancel';
60
+ readonly 'save-button.label': 'Save';
61
+ readonly 'create-text.label': 'Create text';
62
+ readonly 'format.boolean.label': 'Boolean';
63
+ readonly 'format.currency.label': 'Currency';
64
+ readonly 'format.date.label': 'Date';
65
+ readonly 'format.date-time.label': 'DateTime';
66
+ readonly 'format.did.label': 'DID';
67
+ readonly 'format.duration.label': 'Duration';
68
+ readonly 'format.dxn.label': 'DXN';
69
+ readonly 'format.email.label': 'Email';
70
+ readonly 'format.formula.label': 'Formula';
71
+ readonly 'format.hostname.label': 'Hostname';
72
+ readonly 'format.integer.label': 'Integer';
73
+ readonly 'format.json.label': 'JSON';
74
+ readonly 'format.lnglat.label': 'Geopoint';
75
+ readonly 'format.markdown.label': 'Markdown';
76
+ readonly 'format.percent.label': 'Percent';
77
+ readonly 'format.ref.label': 'Reference';
78
+ readonly 'format.regex.label': 'RegExp';
79
+ readonly 'format.string.label': 'String';
80
+ readonly 'format.single-select.label': 'Select';
81
+ readonly 'format.multi-select.label': 'Multi-select';
82
+ readonly 'format.text.label': 'Long text';
83
+ readonly 'format.time.label': 'Time';
84
+ readonly 'format.timestamp.label': 'Timestamp';
85
+ readonly 'format.user.label': 'User';
86
+ readonly 'format.number.label': 'Number';
87
+ readonly 'format.uri.label': 'URI';
88
+ readonly 'format.url.label': 'URL';
89
+ readonly 'format.uuid.label': 'UUID';
90
+ readonly 'latitude.label': 'Latitude';
91
+ readonly 'longitude.label': 'Longitude';
92
+ readonly 'select-option.label': 'Label';
93
+ readonly 'select-option-label.placeholder': 'Option label';
94
+ readonly 'select-option-delete.button': 'Delete';
95
+ readonly 'select-option-add.button': 'Add option';
96
+ readonly 'system-schema.title': 'System type';
97
+ readonly 'system-schema.description': 'System type: cannot add or remove fields.';
98
+ readonly 'remove.button': 'Delete';
99
+ };
100
+ };
101
+ }];
102
+ };
103
+ };
104
+ export default meta;
105
+ type Story = StoryObj<StoryProps>;
106
+ /** Baseline: no annotation, no override — `Form.FieldSet` renders linearly (one field per row). */
107
+ export declare const Linear: Story;
108
+ /** `Form.Layout` invoked directly with a `template` prop, bypassing any annotation. */
109
+ export declare const TemplateProp: Story;
110
+ /** Schema carries `FormLayoutAnnotation`; `Form.FieldSet` auto-detects and delegates. */
111
+ export declare const SchemaAnnotation: Story;
112
+ export declare const NamedAnnotation: Story;
113
+ export declare const NestedLabel: Story;
114
+ /** Read-only static presentation: dates render human-readable; nested structs as labels. */
115
+ export declare const NestedLabelStatic: Story;
116
+ export declare const FormPlayground: Story;
117
+ /** Same playground, but the form is rendered inside a `Card.Root` / `Card.Body`. */
118
+ export declare const CardPlayground: Story;
119
+ //# sourceMappingURL=FormLayout.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormLayout.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/FormLayout.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAoD,MAAM,OAAO,CAAC;AAEzE,OAAO,EAA2B,IAAI,EAAE,MAAM,YAAY,CAAC;AAiB3D;;;;;GAKG;AACH,QAAA,MAAM,MAAM;;;;;;;;;wBAS0D,CAAC;AAEvE,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC;AAoFtD,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAwBF,QAAA,MAAM,IAAI;;mCAtBkC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC1B,CAAC;eAEd,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAElC,mGAAmG;AACnG,eAAO,MAAM,MAAM,EAAE,KAIpB,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,gBAAgB,EAAE,KAI9B,CAAC;AAwCF,eAAO,MAAM,eAAe,EAAE,KAE7B,CAAC;AAqCF,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,EAAE,KAE/B,CAAC;AAwIF,eAAO,MAAM,cAAc,EAAE,KAE5B,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,cAAc,EAAE,KAE5B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FormLayout.stories.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormLayout.stories.test.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/FormLayout.stories.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FormLayout.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormLayout.test.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/FormLayout.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Annotation carrying one or more named `FormLayout` DSL templates that
3
+ * control how `Form.FieldSet` / `Form.Layout` arrange a schema's fields.
4
+ * Callers select a variant via the `name` prop; the implicit name is
5
+ * `DEFAULT_LAYOUT_NAME` (`'default'`).
6
+ *
7
+ * Templates use a minimal XML grammar — see `parser.ts`. Example:
8
+ *
9
+ * FormLayoutAnnotation.set({
10
+ * default: `
11
+ * <grid cols="2">
12
+ * <field name="origin"/>
13
+ * <field name="destination"/>
14
+ * <field name="provider" span="2"/>
15
+ * </grid>
16
+ * `,
17
+ * card: `
18
+ * <grid cols="1">
19
+ * <field name="provider"/>
20
+ * <field name="number"/>
21
+ * </grid>
22
+ * `,
23
+ * })
24
+ */
25
+ export declare const FormLayoutAnnotationId: unique symbol;
26
+ export type FormLayoutMap = Record<string, string>;
27
+ export declare const FormLayoutAnnotation: import("@dxos/echo/internal").AnnotationHelper<FormLayoutMap>;
28
+ /** Name used when no explicit variant is requested. */
29
+ export declare const DEFAULT_LAYOUT_NAME = "default";
30
+ //# sourceMappingURL=annotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/annotation.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,sBAAsB,eAAsD,CAAC;AAE1F,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,oBAAoB,+DAAgE,CAAC;AAElG,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './annotation';
2
+ export { FormLayout } from './FormLayout';
3
+ export { LayoutParseError, parseLayout, type LayoutNode } from './parser';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Minimal XML-style DSL for laying out schema fields in a grid.
3
+ *
4
+ * Grammar:
5
+ * <grid cols="N"> ...children... </grid>
6
+ * <field name="x" span="N"/>
7
+ *
8
+ * - Attributes accept `"…"`, `'…'`, or unquoted integers.
9
+ * - Whitespace between tags is ignored. Text content (between tags) is forbidden.
10
+ * - Self-closing form (`<field … />`) is required for `field`; `grid` must use a closing tag.
11
+ *
12
+ * The parser is hand-rolled (no HTML parser) because the grammar is tiny.
13
+ */
14
+ /** Node type for the parsed layout tree. */
15
+ export type LayoutNode = {
16
+ readonly kind: 'grid';
17
+ readonly cols: number;
18
+ readonly children: readonly LayoutNode[];
19
+ } | {
20
+ readonly kind: 'field';
21
+ readonly name: string;
22
+ readonly span?: number;
23
+ };
24
+ export declare class LayoutParseError extends Error {
25
+ readonly position?: number | undefined;
26
+ readonly _tag = "LayoutParseError";
27
+ constructor(message: string, position?: number | undefined);
28
+ }
29
+ /** Parses a layout template string into a single root node. The root must be `<grid>`. */
30
+ export declare const parseLayout: (template: string) => LayoutNode;
31
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/parser.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,GAC1F;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,qBAAa,gBAAiB,SAAQ,KAAK;IAIvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM;IAH5B,QAAQ,CAAC,IAAI,sBAAsB;IACnC,YACE,OAAO,EAAE,MAAM,EACN,QAAQ,CAAC,EAAE,MAAM,YAAA,EAG3B;CACF;AAuED,0FAA0F;AAC1F,eAAO,MAAM,WAAW,aAAc,MAAM,KAAG,UA+D9C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parser.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.test.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/Layout/parser.test.ts"],"names":[],"mappings":""}
@@ -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 function ArrayField({ type, path, label, readonly, layout, fieldProps: inputProps, ...props }: ArrayFieldProps): React.JSX.Element | null;
10
+ export declare namespace ArrayField {
11
+ var 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;AAiB3C,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACzE,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;mCAEQ,EACzB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,UAAU,EAAE,UAAU,EACtB,GAAG,KAAK,EACT,EAAE,eAAe;;;;AA+GlB;;;GAGG;AAEH,eAAO,MAAM,eAAe,SAAU,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,gDAAiD,uBAAuB,CAAC,OAAO,CAAC,sBAWzG,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
3
+ export declare const DateField: ({ type, format, readonly, placeholder: _placeholder, onValueChange, onBlur: _onBlur, ...props }: FormFieldComponentProps<string>) => React.JSX.Element;
4
+ //# sourceMappingURL=DateField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/DateField.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,uBAAuB,CAAC;AAoCvF,eAAO,MAAM,SAAS,oGAQnB,uBAAuB,CAAC,MAAM,CAAC,sBA8CjC,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, jsonPath, 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;AAMjE,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAErF,eAAO,MAAM,aAAa,6FAUvB,uBAAuB,CAAC,QAAQ,CAAC,6BAiFnC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { type RefFieldProps } from './RefField';
3
+ /**
4
+ * Renders a referenced object's own fields inline (a nested form bound to the
5
+ * target) rather than the {@link RefField} picker. Activated by
6
+ * `FormInlineAnnotation.set(true)` on the `Ref` property.
7
+ *
8
+ * The nested form edits the target object directly: each changed path is
9
+ * written back via `Obj.setValue` within an `Obj.update`, mirroring
10
+ * `ObjectProperties` (without the synthetic meta-tags row).
11
+ */
12
+ export declare const InlineRefField: (props: RefFieldProps) => React.JSX.Element | null;
13
+ //# sourceMappingURL=InlineRefField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineRefField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/fields/InlineRefField.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAmBpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,UAAW,aAAa,6BAqDlD,CAAC"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type FormFieldComponentProps } from '../FormFieldComponent';
3
+ /**
4
+ * Form field that edits a markdown value in a CodeMirror editor.
5
+ * Supports two backings:
6
+ * - `Schema.String` annotated with `Format.TypeFormat.Markdown`: edited as plain text via `getValue`/`onValueChange`.
7
+ * - `Ref<Text>` annotated with `Format.TypeFormat.Markdown`: edited in-place via an Automerge doc accessor.
8
+ * When the ref is empty and a database is available, a create button is shown to allocate a new Text.
9
+ */
10
+ export declare const MarkdownField: ({ type, readonly, label, jsonPath, placeholder, layout, db, getStatus, getValue, onValueChange, }: FormFieldComponentProps) => React.JSX.Element | null;
11
+ //# 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":"AAKA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAYpD,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAKrF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,sGAWvB,uBAAuB,6BAgDzB,CAAC"}