@dxos/react-ui-form 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (234) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/index.mjs +2772 -2208
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/translations.mjs +82 -0
  6. package/dist/lib/browser/translations.mjs.map +7 -0
  7. package/dist/lib/node-esm/index.mjs +2772 -2208
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/lib/node-esm/translations.mjs +84 -0
  11. package/dist/lib/node-esm/translations.mjs.map +7 -0
  12. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +8 -7
  13. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  14. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +69 -60
  15. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/Form.d.ts +109 -26
  17. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/Form.stories.d.ts +116 -138
  19. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/Form/FormField.d.ts +43 -0
  21. package/dist/types/src/components/Form/FormField.d.ts.map +1 -0
  22. package/dist/types/src/components/Form/FormFieldComponent.d.ts +79 -0
  23. package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -0
  24. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts +9 -0
  25. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -0
  26. package/dist/types/src/components/Form/FormFieldSet.d.ts +15 -0
  27. package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -0
  28. package/dist/types/src/components/Form/fields/ArrayField.d.ts +18 -0
  29. package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -0
  30. package/dist/types/src/components/Form/fields/BooleanField.d.ts +4 -0
  31. package/dist/types/src/components/Form/fields/BooleanField.d.ts.map +1 -0
  32. package/dist/types/src/components/Form/fields/GeoPointField.d.ts +5 -0
  33. package/dist/types/src/components/Form/fields/GeoPointField.d.ts.map +1 -0
  34. package/dist/types/src/components/Form/fields/MarkdownField.d.ts +11 -0
  35. package/dist/types/src/components/Form/fields/MarkdownField.d.ts.map +1 -0
  36. package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts +84 -0
  37. package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts.map +1 -0
  38. package/dist/types/src/components/Form/fields/NumberField.d.ts +4 -0
  39. package/dist/types/src/components/Form/fields/NumberField.d.ts.map +1 -0
  40. package/dist/types/src/components/Form/fields/RefField.d.ts +22 -0
  41. package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -0
  42. package/dist/types/src/components/Form/fields/SelectField.d.ts +10 -0
  43. package/dist/types/src/components/Form/fields/SelectField.d.ts.map +1 -0
  44. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts +5 -0
  45. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -0
  46. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +84 -0
  47. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -0
  48. package/dist/types/src/components/Form/fields/TextAreaField.d.ts +4 -0
  49. package/dist/types/src/components/Form/fields/TextAreaField.d.ts.map +1 -0
  50. package/dist/types/src/components/Form/fields/TextField.d.ts +4 -0
  51. package/dist/types/src/components/Form/fields/TextField.d.ts.map +1 -0
  52. package/dist/types/src/components/Form/fields/TupleField.d.ts +6 -0
  53. package/dist/types/src/components/Form/fields/TupleField.d.ts.map +1 -0
  54. package/dist/types/src/components/Form/fields/index.d.ts +12 -0
  55. package/dist/types/src/components/Form/fields/index.d.ts.map +1 -0
  56. package/dist/types/src/components/Form/index.d.ts +2 -4
  57. package/dist/types/src/components/Form/index.d.ts.map +1 -1
  58. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts +9 -0
  59. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -0
  60. package/dist/types/src/components/ObjectForm/index.d.ts +2 -0
  61. package/dist/types/src/components/ObjectForm/index.d.ts.map +1 -0
  62. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +68 -0
  63. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -0
  64. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +87 -0
  65. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -0
  66. package/dist/types/src/components/ObjectPicker/index.d.ts +2 -0
  67. package/dist/types/src/components/ObjectPicker/index.d.ts.map +1 -0
  68. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +9 -0
  69. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -0
  70. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts +127 -0
  71. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts.map +1 -0
  72. package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts +2 -0
  73. package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts.map +1 -0
  74. package/dist/types/src/components/ObjectProperties/index.d.ts +2 -0
  75. package/dist/types/src/components/ObjectProperties/index.d.ts.map +1 -0
  76. package/dist/types/src/components/Settings/Settings.d.ts +51 -0
  77. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
  78. package/dist/types/src/components/Settings/Settings.stories.d.ts +84 -0
  79. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
  80. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts +43 -0
  81. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts.map +1 -0
  82. package/dist/types/src/components/Settings/SettingsItem.d.ts +16 -0
  83. package/dist/types/src/components/Settings/SettingsItem.d.ts.map +1 -0
  84. package/dist/types/src/components/Settings/SettingsSelectField.d.ts +18 -0
  85. package/dist/types/src/components/Settings/SettingsSelectField.d.ts.map +1 -0
  86. package/dist/types/src/components/Settings/index.d.ts +4 -0
  87. package/dist/types/src/components/Settings/index.d.ts.map +1 -0
  88. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +22 -11
  89. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  90. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +72 -65
  91. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  92. package/dist/types/src/components/index.d.ts +4 -1
  93. package/dist/types/src/components/index.d.ts.map +1 -1
  94. package/dist/types/src/components/testing.d.ts +4 -6
  95. package/dist/types/src/components/testing.d.ts.map +1 -1
  96. package/dist/types/src/hooks/index.d.ts +2 -3
  97. package/dist/types/src/hooks/index.d.ts.map +1 -1
  98. package/dist/types/src/hooks/useFormHandler.d.ts +82 -0
  99. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -0
  100. package/dist/types/src/hooks/useKeyHandler.d.ts +7 -0
  101. package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -0
  102. package/dist/types/src/index.d.ts +0 -2
  103. package/dist/types/src/index.d.ts.map +1 -1
  104. package/dist/types/src/translations.d.ts +65 -59
  105. package/dist/types/src/translations.d.ts.map +1 -1
  106. package/dist/types/src/util/field-type.d.ts +19 -0
  107. package/dist/types/src/util/field-type.d.ts.map +1 -0
  108. package/dist/types/src/util/field.d.ts +3 -3
  109. package/dist/types/src/util/field.d.ts.map +1 -1
  110. package/dist/types/src/util/formatting.d.ts +2 -2
  111. package/dist/types/src/util/formatting.d.ts.map +1 -1
  112. package/dist/types/src/util/index.d.ts +2 -1
  113. package/dist/types/src/util/index.d.ts.map +1 -1
  114. package/dist/types/src/util/properties.d.ts +7 -0
  115. package/dist/types/src/util/properties.d.ts.map +1 -0
  116. package/dist/types/src/util/refs.d.ts +3 -3
  117. package/dist/types/src/util/refs.d.ts.map +1 -1
  118. package/dist/types/tsconfig.tsbuildinfo +1 -1
  119. package/package.json +56 -50
  120. package/src/components/FieldEditor/FieldEditor.stories.tsx +46 -26
  121. package/src/components/FieldEditor/FieldEditor.test.tsx +0 -1
  122. package/src/components/FieldEditor/FieldEditor.tsx +80 -80
  123. package/src/components/Form/AUDIT.md +17 -0
  124. package/src/components/Form/Form.stories.tsx +142 -254
  125. package/src/components/Form/Form.tsx +375 -99
  126. package/src/components/Form/FormField.tsx +306 -0
  127. package/src/components/Form/FormFieldComponent.stories.tsx +65 -0
  128. package/src/components/Form/FormFieldComponent.tsx +174 -0
  129. package/src/components/Form/FormFieldSet.tsx +144 -0
  130. package/src/components/Form/README.md +3 -0
  131. package/src/components/Form/fields/ArrayField.tsx +155 -0
  132. package/src/components/Form/fields/BooleanField.tsx +22 -0
  133. package/src/components/Form/fields/GeoPointField.tsx +121 -0
  134. package/src/components/Form/fields/MarkdownField.stories.tsx +206 -0
  135. package/src/components/Form/fields/MarkdownField.tsx +168 -0
  136. package/src/components/Form/fields/NumberField.tsx +39 -0
  137. package/src/components/Form/fields/RefField.tsx +229 -0
  138. package/src/components/Form/fields/SelectField.tsx +65 -0
  139. package/src/components/Form/fields/SelectOptionField.stories.tsx +66 -0
  140. package/src/components/Form/{custom/SelectOptionsInput.tsx → fields/SelectOptionField.tsx} +31 -25
  141. package/src/components/Form/fields/TextAreaField.tsx +38 -0
  142. package/src/components/Form/fields/TextField.tsx +38 -0
  143. package/src/components/Form/{custom/TupleInput.tsx → fields/TupleField.tsx} +16 -9
  144. package/src/components/Form/fields/index.ts +15 -0
  145. package/src/components/Form/index.ts +3 -4
  146. package/src/components/ObjectForm/ObjectForm.tsx +114 -0
  147. package/src/components/{ControlSection → ObjectForm}/index.ts +1 -1
  148. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +212 -0
  149. package/src/components/ObjectPicker/ObjectPicker.tsx +202 -0
  150. package/src/components/ObjectPicker/index.ts +5 -0
  151. package/src/components/ObjectProperties/ObjectProperties.stories.tsx +362 -0
  152. package/src/components/ObjectProperties/ObjectProperties.test.tsx +101 -0
  153. package/src/components/ObjectProperties/ObjectProperties.tsx +141 -0
  154. package/src/components/ObjectProperties/index.ts +5 -0
  155. package/src/components/Settings/AUDIT.md +52 -0
  156. package/src/components/Settings/Settings.stories.tsx +104 -0
  157. package/src/components/Settings/Settings.tsx +80 -0
  158. package/src/components/Settings/SettingsFieldSet.tsx +257 -0
  159. package/src/components/Settings/SettingsItem.tsx +58 -0
  160. package/src/components/Settings/SettingsSelectField.tsx +59 -0
  161. package/src/components/Settings/index.ts +7 -0
  162. package/src/components/ViewEditor/ViewEditor.stories.tsx +126 -75
  163. package/src/components/ViewEditor/ViewEditor.test.tsx +10 -9
  164. package/src/components/ViewEditor/ViewEditor.tsx +326 -195
  165. package/src/components/index.ts +4 -1
  166. package/src/components/testing.tsx +24 -11
  167. package/src/hooks/index.ts +2 -3
  168. package/src/hooks/useFormHandler.ts +380 -0
  169. package/src/hooks/useKeyHandler.tsx +37 -0
  170. package/src/index.ts +0 -4
  171. package/src/translations.ts +70 -64
  172. package/src/util/field-type.ts +60 -0
  173. package/src/util/field.ts +25 -25
  174. package/src/util/formatting.ts +22 -22
  175. package/src/util/index.ts +2 -1
  176. package/src/util/properties.ts +18 -0
  177. package/src/util/refs.ts +17 -19
  178. package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
  179. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
  180. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -83
  181. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
  182. package/dist/types/src/components/ControlSection/index.d.ts +0 -2
  183. package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
  184. package/dist/types/src/components/Form/ArrayField.d.ts +0 -16
  185. package/dist/types/src/components/Form/ArrayField.d.ts.map +0 -1
  186. package/dist/types/src/components/Form/Defaults.d.ts +0 -14
  187. package/dist/types/src/components/Form/Defaults.d.ts.map +0 -1
  188. package/dist/types/src/components/Form/FormActions.d.ts +0 -9
  189. package/dist/types/src/components/Form/FormActions.d.ts.map +0 -1
  190. package/dist/types/src/components/Form/FormContent.d.ts +0 -63
  191. package/dist/types/src/components/Form/FormContent.d.ts.map +0 -1
  192. package/dist/types/src/components/Form/FormContext.d.ts +0 -23
  193. package/dist/types/src/components/Form/FormContext.d.ts.map +0 -1
  194. package/dist/types/src/components/Form/Input.d.ts +0 -29
  195. package/dist/types/src/components/Form/Input.d.ts.map +0 -1
  196. package/dist/types/src/components/Form/RefField.d.ts +0 -18
  197. package/dist/types/src/components/Form/RefField.d.ts.map +0 -1
  198. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts +0 -4
  199. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +0 -1
  200. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts +0 -4
  201. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +0 -1
  202. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +0 -78
  203. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +0 -1
  204. package/dist/types/src/components/Form/custom/TupleInput.d.ts +0 -6
  205. package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +0 -1
  206. package/dist/types/src/components/Form/custom/index.d.ts +0 -4
  207. package/dist/types/src/components/Form/custom/index.d.ts.map +0 -1
  208. package/dist/types/src/components/Form/factory.d.ts +0 -8
  209. package/dist/types/src/components/Form/factory.d.ts.map +0 -1
  210. package/dist/types/src/hooks/useForm.d.ts +0 -67
  211. package/dist/types/src/hooks/useForm.d.ts.map +0 -1
  212. package/dist/types/src/hooks/useQueryRefOptions.d.ts +0 -23
  213. package/dist/types/src/hooks/useQueryRefOptions.d.ts.map +0 -1
  214. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +0 -8
  215. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +0 -1
  216. package/dist/types/src/util/schema.d.ts +0 -3
  217. package/dist/types/src/util/schema.d.ts.map +0 -1
  218. package/src/components/ControlSection/ControlSection.stories.tsx +0 -39
  219. package/src/components/ControlSection/ControlSection.tsx +0 -153
  220. package/src/components/Form/ArrayField.tsx +0 -124
  221. package/src/components/Form/Defaults.tsx +0 -205
  222. package/src/components/Form/FormActions.tsx +0 -54
  223. package/src/components/Form/FormContent.tsx +0 -302
  224. package/src/components/Form/FormContext.tsx +0 -110
  225. package/src/components/Form/Input.tsx +0 -54
  226. package/src/components/Form/RefField.tsx +0 -299
  227. package/src/components/Form/custom/GeoPointInput.tsx +0 -80
  228. package/src/components/Form/custom/SelectOptionsInput.stories.tsx +0 -62
  229. package/src/components/Form/custom/index.ts +0 -7
  230. package/src/components/Form/factory.tsx +0 -31
  231. package/src/hooks/useForm.ts +0 -293
  232. package/src/hooks/useQueryRefOptions.ts +0 -53
  233. package/src/hooks/useRefQueryLookupHandler.ts +0 -39
  234. package/src/util/schema.ts +0 -14
package/package.json CHANGED
@@ -1,81 +1,87 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-form",
3
- "version": "0.8.4-main.dedc0f3",
3
+ "version": "0.8.4-main.dfabb4ec29",
4
4
  "description": "Data components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "type": "module",
14
+ "imports": {
15
+ "#translations": "./src/translations.ts"
16
+ },
10
17
  "exports": {
11
18
  ".": {
12
19
  "source": "./src/index.ts",
13
20
  "types": "./dist/types/src/index.d.ts",
14
21
  "browser": "./dist/lib/browser/index.mjs",
15
22
  "node": "./dist/lib/node-esm/index.mjs"
23
+ },
24
+ "./translations": {
25
+ "source": "./src/translations.ts",
26
+ "types": "./dist/types/src/translations.d.ts",
27
+ "browser": "./dist/lib/browser/translations.mjs",
28
+ "node": "./dist/lib/node-esm/translations.mjs"
16
29
  }
17
30
  },
18
31
  "types": "dist/types/src/index.d.ts",
19
- "typesVersions": {
20
- "*": {}
21
- },
22
32
  "files": [
23
33
  "dist",
24
34
  "src"
25
35
  ],
26
36
  "dependencies": {
27
- "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
28
- "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
29
- "@fluentui/react-tabster": "^9.24.2",
30
- "@preact-signals/safe-react": "^0.9.0",
37
+ "@effect-atom/atom-react": "^0.5.0",
38
+ "@fluentui/react-tabster": "9.26.11",
31
39
  "@radix-ui/react-context": "1.1.1",
32
- "date-fns": "^3.3.1",
33
- "jsonpath": "^1.1.1",
34
- "@dxos/async": "0.8.4-main.dedc0f3",
35
- "@dxos/echo": "0.8.4-main.dedc0f3",
36
- "@dxos/debug": "0.8.4-main.dedc0f3",
37
- "@dxos/echo-db": "0.8.4-main.dedc0f3",
38
- "@dxos/echo-schema": "0.8.4-main.dedc0f3",
39
- "@dxos/effect": "0.8.4-main.dedc0f3",
40
- "@dxos/keys": "0.8.4-main.dedc0f3",
41
- "@dxos/lit-ui": "0.8.4-main.dedc0f3",
42
- "@dxos/live-object": "0.8.4-main.dedc0f3",
43
- "@dxos/log": "0.8.4-main.dedc0f3",
44
- "@dxos/react-client": "0.8.4-main.dedc0f3",
45
- "@dxos/invariant": "0.8.4-main.dedc0f3",
46
- "@dxos/react-ui-editor": "0.8.4-main.dedc0f3",
47
- "@dxos/react-ui-components": "0.8.4-main.dedc0f3",
48
- "@dxos/react-ui-searchlist": "0.8.4-main.dedc0f3",
49
- "@dxos/react-ui-stack": "0.8.4-main.dedc0f3",
50
- "@dxos/react-ui-tag-picker": "0.8.4-main.dedc0f3",
51
- "@dxos/react-ui-types": "0.8.4-main.dedc0f3",
52
- "@dxos/schema": "0.8.4-main.dedc0f3",
53
- "@dxos/react-ui-pickers": "0.8.4-main.dedc0f3",
54
- "@dxos/react-ui-list": "0.8.4-main.dedc0f3",
55
- "@dxos/util": "0.8.4-main.dedc0f3"
40
+ "@radix-ui/react-use-controllable-state": "1.1.0",
41
+ "date-fns": "^3.6.0",
42
+ "tabster": "^8.5.5",
43
+ "@dxos/async": "0.8.4-main.dfabb4ec29",
44
+ "@dxos/echo": "0.8.4-main.dfabb4ec29",
45
+ "@dxos/echo-atom": "0.8.4-main.dfabb4ec29",
46
+ "@dxos/echo-db": "0.8.4-main.dfabb4ec29",
47
+ "@dxos/effect": "0.8.4-main.dfabb4ec29",
48
+ "@dxos/echo-react": "0.8.4-main.dfabb4ec29",
49
+ "@dxos/keys": "0.8.4-main.dfabb4ec29",
50
+ "@dxos/lit-ui": "0.8.4-main.dfabb4ec29",
51
+ "@dxos/invariant": "0.8.4-main.dfabb4ec29",
52
+ "@dxos/log": "0.8.4-main.dfabb4ec29",
53
+ "@dxos/react-client": "0.8.4-main.dfabb4ec29",
54
+ "@dxos/react-ui-editor": "0.8.4-main.dfabb4ec29",
55
+ "@dxos/react-ui-pickers": "0.8.4-main.dfabb4ec29",
56
+ "@dxos/react-ui-components": "0.8.4-main.dfabb4ec29",
57
+ "@dxos/react-ui-list": "0.8.4-main.dfabb4ec29",
58
+ "@dxos/react-ui-search": "0.8.4-main.dfabb4ec29",
59
+ "@dxos/schema": "0.8.4-main.dfabb4ec29",
60
+ "@dxos/types": "0.8.4-main.dfabb4ec29",
61
+ "@dxos/ui-editor": "0.8.4-main.dfabb4ec29",
62
+ "@dxos/util": "0.8.4-main.dfabb4ec29"
56
63
  },
57
64
  "devDependencies": {
58
- "@types/jsonpath": "^0.2.4",
59
- "@types/react": "~18.2.0",
60
- "@types/react-dom": "~18.2.0",
61
- "effect": "3.17.7",
65
+ "@types/react": "~19.2.7",
66
+ "@types/react-dom": "~19.2.3",
67
+ "effect": "3.20.0",
62
68
  "fast-check": "^3.19.0",
63
- "react": "~18.2.0",
64
- "react-dom": "~18.2.0",
65
- "vite": "7.1.1",
66
- "@dxos/echo-signals": "0.8.4-main.dedc0f3",
67
- "@dxos/random": "0.8.4-main.dedc0f3",
68
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
69
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.dedc0f3",
70
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
71
- "@dxos/storybook-utils": "0.8.4-main.dedc0f3"
69
+ "react": "~19.2.3",
70
+ "react-dom": "~19.2.3",
71
+ "vite": "^8.0.10",
72
+ "@dxos/random": "0.8.4-main.dfabb4ec29",
73
+ "@dxos/react-client": "0.8.4-main.dfabb4ec29",
74
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29",
75
+ "@dxos/storybook-utils": "0.8.4-main.dfabb4ec29",
76
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.dfabb4ec29",
77
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29"
72
78
  },
73
79
  "peerDependencies": {
74
- "effect": "^3.13.3",
75
- "react": "~18.2.0",
76
- "react-dom": "~18.2.0",
77
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
78
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
80
+ "effect": "3.20.0",
81
+ "react": "~19.2.3",
82
+ "react-dom": "~19.2.3",
83
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29",
84
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29"
79
85
  },
80
86
  "publishConfig": {
81
87
  "access": "public"
@@ -2,31 +2,55 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React, { useEffect, useMemo } from 'react';
9
7
 
10
- import { createEchoSchema } from '@dxos/live-object/testing';
8
+ import { Filter, Query } from '@dxos/echo';
9
+ import { createEchoSchema } from '@dxos/echo/testing';
11
10
  import { log } from '@dxos/log';
12
- import { ProjectionModel } from '@dxos/schema';
13
- import { TestSchema, testView } from '@dxos/schema/testing';
14
- import { withLayout, withTheme } from '@dxos/storybook-utils';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
+ import { ProjectionModel, ViewModel, createEchoChangeCallback } from '@dxos/schema';
13
+ import { Example } from '@dxos/schema/testing';
15
14
 
16
- import { translations } from '../../translations';
17
- import { FIELD_EDITOR_DEBUG_SYMBOL, TestLayout, TestPanel } from '../testing';
15
+ import { translations } from '#translations';
18
16
 
17
+ import { FIELD_EDITOR_DEBUG_SYMBOL, TestLayout } from '../testing';
19
18
  import { FieldEditor, type FieldEditorProps } from './FieldEditor';
20
19
 
21
- // Type definition for debug objects exposed to tests.
22
20
  export type FieldEditorDebugObjects = {
23
21
  props: FieldEditorProps;
24
22
  projection: ProjectionModel;
25
23
  };
26
24
 
27
- const DefaultStory = (props: FieldEditorProps) => {
25
+ const useTestProjection = () => {
26
+ return useMemo(() => {
27
+ const schema = createEchoSchema(Example);
28
+ const view = ViewModel.make({
29
+ name: 'Test',
30
+ query: Query.select(Filter.type(Example)),
31
+ jsonSchema: schema.jsonSchema,
32
+ });
33
+ const projection = new ProjectionModel({
34
+ view,
35
+ baseSchema: schema.jsonSchema,
36
+ change: createEchoChangeCallback(view, schema),
37
+ });
38
+ projection.normalizeView();
39
+ return { view, projection };
40
+ }, []);
41
+ };
42
+
43
+ const DefaultStory = () => {
44
+ const { view, projection } = useTestProjection();
45
+
28
46
  const handleComplete: FieldEditorProps['onSave'] = () => {
29
- log.info('onClose', { props });
47
+ log.info('onClose');
48
+ };
49
+
50
+ const props: FieldEditorProps = {
51
+ projection,
52
+ field: view.projection.fields[0],
53
+ onSave: handleComplete,
30
54
  };
31
55
 
32
56
  // Expose objects on window for test access.
@@ -34,22 +58,20 @@ const DefaultStory = (props: FieldEditorProps) => {
34
58
  if (typeof window !== 'undefined') {
35
59
  (window as any)[FIELD_EDITOR_DEBUG_SYMBOL] = {
36
60
  props,
37
- projection: props.projection,
61
+ projection,
38
62
  } satisfies FieldEditorDebugObjects;
39
63
  }
40
- }, [props, props.projection]);
64
+ }, [props, projection]);
41
65
 
42
66
  // NOTE(ZaymonFC): This looks awkward but it resolves an infinite parsing issue with sb.
43
67
  const json = useMemo(
44
- () => JSON.parse(JSON.stringify({ props, projection: props.projection })),
45
- [JSON.stringify(props), JSON.stringify(props.projection)],
68
+ () => JSON.parse(JSON.stringify({ props, projection })),
69
+ [JSON.stringify(props), JSON.stringify(projection)],
46
70
  );
47
71
 
48
72
  return (
49
73
  <TestLayout json={json}>
50
- <TestPanel>
51
- <FieldEditor {...props} onSave={handleComplete} />
52
- </TestPanel>
74
+ <FieldEditor {...props} />
53
75
  </TestLayout>
54
76
  );
55
77
  };
@@ -58,9 +80,13 @@ const meta = {
58
80
  title: 'ui/react-ui-form/FieldEditor',
59
81
  component: FieldEditor as any,
60
82
  render: DefaultStory,
61
- decorators: [withLayout({ fullscreen: true }), withTheme],
83
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
62
84
  parameters: {
85
+ layout: 'fullscreen',
63
86
  translations,
87
+ controls: {
88
+ disabled: true,
89
+ },
64
90
  },
65
91
  } satisfies Meta<typeof DefaultStory>;
66
92
 
@@ -68,10 +94,4 @@ export default meta;
68
94
 
69
95
  type Story = StoryObj<typeof meta>;
70
96
 
71
- export const Default: Story = {
72
- args: {
73
- projection: new ProjectionModel(createEchoSchema(TestSchema).jsonSchema, testView.projection),
74
- field: testView.projection.fields[0],
75
- },
76
- parameters: { controls: { disabled: true } },
77
- };
97
+ export const Default: Story = {};
@@ -9,7 +9,6 @@ import { afterEach, describe, expect, test } from 'vitest';
9
9
  import { ProjectionModel } from '@dxos/schema';
10
10
 
11
11
  import { FIELD_EDITOR_DEBUG_SYMBOL } from '../testing';
12
-
13
12
  import * as stories from './FieldEditor.stories';
14
13
  import { type FieldEditorDebugObjects } from './FieldEditor.stories';
15
14
 
@@ -4,43 +4,36 @@
4
4
 
5
5
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
6
6
 
7
- import { type SchemaRegistry } from '@dxos/echo-db';
8
- import { type EchoSchema, FormatEnum, FormatEnums, formatToType } from '@dxos/echo-schema';
7
+ import { Obj, type SchemaRegistry, type View } from '@dxos/echo';
8
+ import { type EchoSchema, Format, FormatEnums, formatToType } from '@dxos/echo/internal';
9
+ import { type SchemaProperty } from '@dxos/effect';
9
10
  import { log } from '@dxos/log';
10
11
  import { useAsyncEffect, useTranslation } from '@dxos/react-ui';
11
12
  import {
12
- type FieldType,
13
13
  type ProjectionModel,
14
14
  type PropertyType,
15
- type SchemaProperty,
15
+ formatToAdditionalPropertyAttributes,
16
16
  getFormatSchema,
17
- getSchemaProperties,
18
- sortProperties,
19
17
  } from '@dxos/schema';
20
18
 
21
- import { translationKey } from '../../translations';
22
- import { Form, type FormProps, type InputComponent, SelectInput, SelectOptionInput } from '../Form';
19
+ import { translationKey } from '#translations';
20
+
21
+ import { getFormProperties } from '../../util';
22
+ import { Form, type FormFieldMap, type FormRootProps, SelectField, SelectOptionField } from '../Form';
23
23
 
24
24
  export type FieldEditorProps = {
25
25
  projection: ProjectionModel;
26
- field: FieldType;
27
- registry?: SchemaRegistry;
26
+ field: View.FieldType;
27
+ registry?: SchemaRegistry.SchemaRegistry;
28
+ view?: Obj.Unknown;
28
29
  onSave: () => void;
29
30
  onCancel?: () => void;
30
- } & Pick<FormProps<any>, 'outerSpacing' | 'readonly'>;
31
+ } & Pick<FormRootProps<any>, 'readonly'>;
31
32
 
32
33
  /**
33
34
  * Displays a Form representing the metadata for a given `Field` and `View`.
34
35
  */
35
- export const FieldEditor = ({
36
- readonly,
37
- projection,
38
- field,
39
- registry,
40
- onSave,
41
- onCancel,
42
- outerSpacing,
43
- }: FieldEditorProps) => {
36
+ export const FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCancel }: FieldEditorProps) => {
44
37
  const { t } = useTranslation(translationKey);
45
38
  const [props, setProps] = useState<PropertyType>(projection.getFieldProjection(field.id).props);
46
39
  useEffect(() => setProps(projection.getFieldProjection(field.id).props), [field, projection]);
@@ -69,11 +62,47 @@ export const FieldEditor = ({
69
62
  // Class constructor SchemaClass cannot be invoked without 'new'.
70
63
  const [{ fieldSchema }, setFieldSchema] = useState({ fieldSchema: getFormatSchema(props?.format) });
71
64
 
72
- const handleValuesChanged = useCallback<NonNullable<FormProps<PropertyType>['onValuesChanged']>>(
65
+ const fieldMap = useMemo<FormFieldMap>(
66
+ () => ({
67
+ ['format' satisfies keyof PropertyType]: (props) => (
68
+ <SelectField
69
+ {...props}
70
+ options={FormatEnums.filter((value) => value !== Format.TypeFormat.None).map((value) => ({
71
+ value,
72
+ label: t(`format.${value}.label`),
73
+ }))}
74
+ />
75
+ ),
76
+ ['referenceSchema' satisfies keyof PropertyType]: (props) => (
77
+ <SelectField
78
+ {...props}
79
+ options={schemas.map((schema) => ({
80
+ value: schema.typename,
81
+ }))}
82
+ />
83
+ ),
84
+ ['referencePath' satisfies keyof PropertyType]: (props) => (
85
+ <SelectField
86
+ {...props}
87
+ options={
88
+ referenceSchema
89
+ ? getFormProperties(referenceSchema.ast)
90
+ .sort((a, b) => a.name.toString().localeCompare(b.name.toString()))
91
+ .map((p) => ({ value: p.name.toString() }))
92
+ : []
93
+ }
94
+ />
95
+ ),
96
+ ['options' satisfies keyof PropertyType]: (props) => <SelectOptionField {...props} />,
97
+ }),
98
+ [t, schemas, referenceSchema],
99
+ );
100
+
101
+ const propIsNotType = useCallback((props: SchemaProperty[]) => props.filter((prop) => prop.name !== 'type'), []);
102
+
103
+ const handleValuesChanged = useCallback<NonNullable<FormRootProps<PropertyType>['onValuesChanged']>>(
73
104
  (_props) => {
74
- // TODO(burdon): Callback should pass `changed` to indicate which fields have changed.
75
- // TODO(Zaymon): Workout why old and new format values are the same sometimes even when
76
- // selecting novel format values.
105
+ // TODO(Zaymon): Workout why old and new format values are the same sometimes even when selecting novel format values.
77
106
  setFieldSchema((prev) => {
78
107
  const fieldSchema = getFormatSchema(_props.format);
79
108
  if (prev.fieldSchema === fieldSchema) {
@@ -94,8 +123,10 @@ export const FieldEditor = ({
94
123
 
95
124
  setProps((props) => {
96
125
  const type = formatToType[_props.format as keyof typeof formatToType];
126
+ const additionalProps =
127
+ formatToAdditionalPropertyAttributes[_props.format as keyof typeof formatToAdditionalPropertyAttributes];
97
128
  if (props.type !== type) {
98
- return { ...props, ..._props, type };
129
+ return { ...props, ..._props, ...additionalProps, type } as PropertyType;
99
130
  }
100
131
 
101
132
  return _props as PropertyType;
@@ -104,9 +135,9 @@ export const FieldEditor = ({
104
135
  [schemas, props.format, props.referenceSchema],
105
136
  );
106
137
 
107
- const handleValidate = useCallback<NonNullable<FormProps<PropertyType>['onValidate']>>(
138
+ const handleValidate = useCallback<NonNullable<FormRootProps<PropertyType>['onValidate']>>(
108
139
  ({ property }) => {
109
- if (property && projection.fields.find((f) => f.path === property && f.path !== field.path)) {
140
+ if (property && projection.getFields().find((f) => f.path === property && f.path !== field.path)) {
110
141
  return [
111
142
  {
112
143
  path: 'property',
@@ -115,84 +146,53 @@ export const FieldEditor = ({
115
146
  ];
116
147
  }
117
148
  },
118
- [projection.fields, field],
149
+ [projection.getFields(), field],
119
150
  );
120
151
 
121
- const handleSave = useCallback<NonNullable<FormProps<PropertyType>['onSave']>>(
152
+ const handleSave = useCallback<NonNullable<FormRootProps<PropertyType>['onSave']>>(
122
153
  (props) => {
123
- projection.setFieldProjection({ field, props });
154
+ if (view) {
155
+ Obj.update(view, () => {
156
+ projection.setFieldProjection({ field, props });
157
+ });
158
+ } else {
159
+ projection.setFieldProjection({ field, props });
160
+ }
124
161
  onSave();
125
162
  },
126
- [projection, field, onSave],
163
+ [projection, field, view, onSave],
127
164
  );
128
165
 
129
- const handleCancel = useCallback<NonNullable<FormProps<PropertyType>['onCancel']>>(() => {
166
+ const handleCancel = useCallback<NonNullable<FormRootProps<PropertyType>['onCancel']>>(() => {
167
+ onSave();
130
168
  // Need to defer to allow form to close.
131
169
  requestAnimationFrame(() => onCancel?.());
132
- onSave();
133
170
  }, [onSave]);
134
171
 
135
- const custom: Partial<Record<string, InputComponent>> = useMemo(
136
- () => ({
137
- ['format' satisfies keyof PropertyType]: (props) => (
138
- <SelectInput
139
- {...props}
140
- options={FormatEnums.filter((value) => value !== FormatEnum.None).map((value) => ({
141
- value,
142
- label: t(`format ${value}`),
143
- }))}
144
- />
145
- ),
146
- ['referenceSchema' satisfies keyof PropertyType]: (props) => (
147
- <SelectInput
148
- {...props}
149
- options={schemas.map((schema) => ({
150
- value: schema.typename,
151
- }))}
152
- />
153
- ),
154
- ['referencePath' satisfies keyof PropertyType]: (props) => (
155
- <SelectInput
156
- {...props}
157
- options={
158
- referenceSchema
159
- ? getSchemaProperties(referenceSchema.ast)
160
- .sort(sortProperties)
161
- .map((p) => ({ value: p.name }))
162
- : []
163
- }
164
- />
165
- ),
166
- ['options' satisfies keyof PropertyType]: (props) => <SelectOptionInput {...props} />,
167
- }),
168
- [t, schemas, referenceSchema],
169
- );
170
-
171
- const propIsNotType = useCallback(
172
- (props: SchemaProperty<PropertyType>[]) => props.filter((p) => p.name !== 'type'),
173
- [],
174
- );
175
-
176
172
  if (!fieldSchema) {
177
173
  log.warn('invalid format', { props });
178
174
  return null;
179
175
  }
180
176
 
181
177
  return (
182
- <Form<PropertyType>
178
+ <Form.Root<PropertyType>
183
179
  key={field.id}
180
+ fieldMap={fieldMap}
184
181
  autoFocus
185
182
  readonly={readonly}
186
- values={props}
187
183
  schema={fieldSchema}
188
- filter={propIsNotType}
184
+ values={props}
185
+ exclude={propIsNotType}
189
186
  sort={['property', 'format']}
190
187
  onValuesChanged={handleValuesChanged}
191
188
  onValidate={handleValidate}
192
189
  onSave={handleSave}
193
190
  onCancel={handleCancel}
194
- Custom={custom}
195
- outerSpacing={outerSpacing}
196
- />
191
+ >
192
+ <Form.Content>
193
+ <Form.FieldSet />
194
+ <Form.Actions />
195
+ </Form.Content>
196
+ </Form.Root>
197
197
  );
198
198
  };
@@ -0,0 +1,17 @@
1
+ # Form
2
+
3
+ ## New features/polish
4
+
5
+ - [x] Unify readonly/inline modes.
6
+ - [x] Refs
7
+ - [x] Single-select (fix popover)
8
+ - [x] Multi-select (array)
9
+ - [ ] auto save doesn't work for combobox + select due to only firing on blur (workaround is to use onValuesChanged).
10
+ - [ ] Don't call save/autoSave if value hasn't changed.
11
+ - [ ] Fix onCancel (restore values).
12
+ - [ ] Fix useSchema Type.AnyObj cast.
13
+ - [ ] TableCellEditor (handleEnter/ModalController).
14
+ - [ ] Use FormFieldWrapper uniformly
15
+ - [ ] Inline tables.
16
+ - [ ] Defer query until popover.
17
+ - [ ] Omit id from sub properties (tune Omit)