@dxos/react-ui-form 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203

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 (95) hide show
  1. package/dist/lib/browser/index.mjs +1610 -1825
  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 +1610 -1825
  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/components/FieldEditor/FieldEditor.d.ts +3 -2
  8. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  9. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +2 -2
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/Form/Form-old.stories.d.ts +1 -42
  12. package/dist/types/src/components/Form/Form-old.stories.d.ts.map +1 -1
  13. package/dist/types/src/components/Form/Form.d.ts +9 -6
  14. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  15. package/dist/types/src/components/Form/Form.stories.d.ts +32 -32
  16. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  17. package/dist/types/src/components/Form/FormField.d.ts +2 -2
  18. package/dist/types/src/components/Form/FormField.d.ts.map +1 -1
  19. package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -1
  20. package/dist/types/src/components/Form/FormFieldSet.d.ts +3 -3
  21. package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -1
  22. package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -1
  23. package/dist/types/src/components/Form/fields/RefField.d.ts +8 -12
  24. package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -1
  25. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +1 -1
  26. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +14 -9
  27. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  28. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +1 -1
  29. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/Settings/Settings.d.ts +56 -0
  31. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
  32. package/dist/types/src/components/{ControlSection/ControlSection.stories.d.ts → Settings/Settings.stories.d.ts} +3 -9
  33. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
  34. package/dist/types/src/components/Settings/index.d.ts +2 -0
  35. package/dist/types/src/components/Settings/index.d.ts.map +1 -0
  36. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +1 -1
  37. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  38. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +1 -1
  39. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  40. package/dist/types/src/components/index.d.ts +1 -1
  41. package/dist/types/src/components/index.d.ts.map +1 -1
  42. package/dist/types/src/components/testing.d.ts.map +1 -1
  43. package/dist/types/src/hooks/index.d.ts +0 -2
  44. package/dist/types/src/hooks/index.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
  46. package/dist/types/src/translations.d.ts +2 -2
  47. package/dist/types/src/translations.d.ts.map +1 -1
  48. package/dist/types/src/util/echo.d.ts +6 -0
  49. package/dist/types/src/util/echo.d.ts.map +1 -0
  50. package/dist/types/src/util/index.d.ts +1 -0
  51. package/dist/types/src/util/index.d.ts.map +1 -1
  52. package/dist/types/tsconfig.tsbuildinfo +1 -1
  53. package/package.json +49 -45
  54. package/src/components/FieldEditor/FieldEditor.stories.tsx +39 -18
  55. package/src/components/FieldEditor/FieldEditor.tsx +13 -6
  56. package/src/components/Form/Form-old.stories.tsx +42 -42
  57. package/src/components/Form/Form.stories.tsx +12 -17
  58. package/src/components/Form/Form.tsx +52 -27
  59. package/src/components/Form/FormField.tsx +23 -17
  60. package/src/components/Form/FormFieldComponent.stories.tsx +1 -1
  61. package/src/components/Form/FormFieldComponent.tsx +17 -16
  62. package/src/components/Form/FormFieldSet.tsx +8 -5
  63. package/src/components/Form/fields/ArrayField.tsx +11 -11
  64. package/src/components/Form/fields/RefField.tsx +82 -99
  65. package/src/components/Form/fields/SelectOptionField.stories.tsx +1 -1
  66. package/src/components/Form/fields/SelectOptionField.tsx +2 -2
  67. package/src/components/Form/fields/TupleField.tsx +1 -1
  68. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +12 -5
  69. package/src/components/ObjectPicker/ObjectPicker.tsx +66 -57
  70. package/src/components/Settings/Settings.stories.tsx +56 -0
  71. package/src/components/Settings/Settings.tsx +234 -0
  72. package/src/components/{ControlSection → Settings}/index.ts +1 -1
  73. package/src/components/ViewEditor/ViewEditor.stories.tsx +18 -12
  74. package/src/components/ViewEditor/ViewEditor.test.tsx +1 -5
  75. package/src/components/ViewEditor/ViewEditor.tsx +77 -44
  76. package/src/components/index.ts +1 -1
  77. package/src/components/testing.tsx +3 -5
  78. package/src/hooks/index.ts +0 -2
  79. package/src/hooks/useFormHandler.ts +20 -6
  80. package/src/translations.ts +1 -1
  81. package/src/util/echo.ts +25 -0
  82. package/src/util/index.ts +1 -0
  83. package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
  84. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
  85. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
  86. package/dist/types/src/components/ControlSection/index.d.ts +0 -2
  87. package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
  88. package/dist/types/src/hooks/useQueryRefOptions.d.ts +0 -30
  89. package/dist/types/src/hooks/useQueryRefOptions.d.ts.map +0 -1
  90. package/dist/types/src/hooks/useRefQueryOptions.d.ts +0 -8
  91. package/dist/types/src/hooks/useRefQueryOptions.d.ts.map +0 -1
  92. package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
  93. package/src/components/ControlSection/ControlSection.tsx +0 -153
  94. package/src/hooks/useQueryRefOptions.ts +0 -70
  95. package/src/hooks/useRefQueryOptions.ts +0 -37
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-form",
3
- "version": "0.8.4-main.3c1ae3b",
3
+ "version": "0.8.4-main.3eb6e50203",
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",
@@ -24,60 +28,60 @@
24
28
  "src"
25
29
  ],
26
30
  "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",
31
- "@preact/signals-react": "^3.2.0",
31
+ "@atlaskit/pragmatic-drag-and-drop": "1.7.7",
32
+ "@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
33
+ "@effect-atom/atom-react": "^0.5.0",
34
+ "@fluentui/react-tabster": "9.26.11",
32
35
  "@radix-ui/react-context": "1.1.1",
33
- "@radix-ui/react-use-controllable-state": "^1.2.2",
36
+ "@radix-ui/react-use-controllable-state": "1.1.0",
34
37
  "date-fns": "^3.3.1",
35
38
  "jsonpath": "^1.1.1",
36
- "@dxos/async": "0.8.4-main.3c1ae3b",
37
- "@dxos/debug": "0.8.4-main.3c1ae3b",
38
- "@dxos/echo": "0.8.4-main.3c1ae3b",
39
- "@dxos/echo-db": "0.8.4-main.3c1ae3b",
40
- "@dxos/effect": "0.8.4-main.3c1ae3b",
41
- "@dxos/echo-query": "0.8.4-main.3c1ae3b",
42
- "@dxos/invariant": "0.8.4-main.3c1ae3b",
43
- "@dxos/keys": "0.8.4-main.3c1ae3b",
44
- "@dxos/lit-ui": "0.8.4-main.3c1ae3b",
45
- "@dxos/live-object": "0.8.4-main.3c1ae3b",
46
- "@dxos/log": "0.8.4-main.3c1ae3b",
47
- "@dxos/react-client": "0.8.4-main.3c1ae3b",
48
- "@dxos/react-ui-components": "0.8.4-main.3c1ae3b",
49
- "@dxos/react-ui-editor": "0.8.4-main.3c1ae3b",
50
- "@dxos/react-ui-pickers": "0.8.4-main.3c1ae3b",
51
- "@dxos/react-ui-stack": "0.8.4-main.3c1ae3b",
52
- "@dxos/react-ui-types": "0.8.4-main.3c1ae3b",
53
- "@dxos/react-ui-searchlist": "0.8.4-main.3c1ae3b",
54
- "@dxos/schema": "0.8.4-main.3c1ae3b",
55
- "@dxos/types": "0.8.4-main.3c1ae3b",
56
- "@dxos/util": "0.8.4-main.3c1ae3b",
57
- "@dxos/react-ui-list": "0.8.4-main.3c1ae3b"
39
+ "tabster": "^8.5.5",
40
+ "@dxos/echo-query": "0.8.4-main.3eb6e50203",
41
+ "@dxos/echo-react": "0.8.4-main.3eb6e50203",
42
+ "@dxos/async": "0.8.4-main.3eb6e50203",
43
+ "@dxos/effect": "0.8.4-main.3eb6e50203",
44
+ "@dxos/invariant": "0.8.4-main.3eb6e50203",
45
+ "@dxos/echo": "0.8.4-main.3eb6e50203",
46
+ "@dxos/keys": "0.8.4-main.3eb6e50203",
47
+ "@dxos/lit-ui": "0.8.4-main.3eb6e50203",
48
+ "@dxos/log": "0.8.4-main.3eb6e50203",
49
+ "@dxos/react-client": "0.8.4-main.3eb6e50203",
50
+ "@dxos/react-ui-editor": "0.8.4-main.3eb6e50203",
51
+ "@dxos/react-ui-list": "0.8.4-main.3eb6e50203",
52
+ "@dxos/react-ui-mosaic": "0.8.4-main.3eb6e50203",
53
+ "@dxos/react-ui-pickers": "0.8.4-main.3eb6e50203",
54
+ "@dxos/react-ui-searchlist": "0.8.4-main.3eb6e50203",
55
+ "@dxos/react-ui-stack": "0.8.4-main.3eb6e50203",
56
+ "@dxos/schema": "0.8.4-main.3eb6e50203",
57
+ "@dxos/types": "0.8.4-main.3eb6e50203",
58
+ "@dxos/ui-types": "0.8.4-main.3eb6e50203",
59
+ "@dxos/util": "0.8.4-main.3eb6e50203",
60
+ "@dxos/react-ui-components": "0.8.4-main.3eb6e50203",
61
+ "@dxos/debug": "0.8.4-main.3eb6e50203"
58
62
  },
59
63
  "devDependencies": {
60
64
  "@types/jsonpath": "^0.2.4",
61
- "@types/react": "~19.2.2",
62
- "@types/react-dom": "~19.2.2",
63
- "effect": "3.18.3",
65
+ "@types/react": "~19.2.7",
66
+ "@types/react-dom": "~19.2.3",
67
+ "effect": "3.19.16",
64
68
  "fast-check": "^3.19.0",
65
- "react": "~19.2.0",
66
- "react-dom": "~19.2.0",
69
+ "react": "~19.2.3",
70
+ "react-dom": "~19.2.3",
67
71
  "vite": "7.1.9",
68
- "@dxos/echo-signals": "0.8.4-main.3c1ae3b",
69
- "@dxos/random": "0.8.4-main.3c1ae3b",
70
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b",
71
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.3c1ae3b",
72
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
73
- "@dxos/storybook-utils": "0.8.4-main.3c1ae3b"
72
+ "@dxos/random": "0.8.4-main.3eb6e50203",
73
+ "@dxos/react-client": "0.8.4-main.3eb6e50203",
74
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.3eb6e50203",
75
+ "@dxos/react-ui": "0.8.4-main.3eb6e50203",
76
+ "@dxos/storybook-utils": "0.8.4-main.3eb6e50203",
77
+ "@dxos/ui-theme": "0.8.4-main.3eb6e50203"
74
78
  },
75
79
  "peerDependencies": {
76
- "effect": "^3.13.3",
77
- "react": "^19.0.0",
78
- "react-dom": "^19.0.0",
79
- "@dxos/react-ui": "0.8.4-main.3c1ae3b",
80
- "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
80
+ "effect": "3.19.16",
81
+ "react": "~19.2.3",
82
+ "react-dom": "~19.2.3",
83
+ "@dxos/react-ui": "0.8.4-main.3eb6e50203",
84
+ "@dxos/ui-theme": "0.8.4-main.3eb6e50203"
81
85
  },
82
86
  "publishConfig": {
83
87
  "access": "public"
@@ -5,11 +5,12 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useEffect, useMemo } from 'react';
7
7
 
8
+ import { Filter, Query } from '@dxos/echo';
8
9
  import { createEchoSchema } from '@dxos/echo/testing';
9
10
  import { log } from '@dxos/log';
10
11
  import { withTheme } from '@dxos/react-ui/testing';
11
- import { ProjectionModel } from '@dxos/schema';
12
- import { Example, testView } from '@dxos/schema/testing';
12
+ import { ProjectionModel, View, createEchoChangeCallback } from '@dxos/schema';
13
+ import { Example } from '@dxos/schema/testing';
13
14
 
14
15
  import { translations } from '../../translations';
15
16
  import { FIELD_EDITOR_DEBUG_SYMBOL, TestLayout } from '../testing';
@@ -22,32 +23,57 @@ export type FieldEditorDebugObjects = {
22
23
  projection: ProjectionModel;
23
24
  };
24
25
 
25
- const DefaultStory = (props: FieldEditorProps) => {
26
+ // TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
27
+ const useTestProjection = () => {
28
+ return useMemo(() => {
29
+ const schema = createEchoSchema(Example);
30
+ const view = View.make({
31
+ name: 'Test',
32
+ query: Query.select(Filter.type(Example)),
33
+ jsonSchema: schema.jsonSchema,
34
+ });
35
+ const projection = new ProjectionModel({
36
+ view,
37
+ baseSchema: schema.jsonSchema,
38
+ change: createEchoChangeCallback(view, schema),
39
+ });
40
+ projection.normalizeView();
41
+ return { view, projection };
42
+ }, []);
43
+ };
44
+
45
+ const DefaultStory = () => {
46
+ const { view, projection } = useTestProjection();
47
+
26
48
  const handleComplete: FieldEditorProps['onSave'] = () => {
27
- log.info('onClose', { props });
49
+ log.info('onClose');
50
+ };
51
+
52
+ const props: FieldEditorProps = {
53
+ projection,
54
+ field: view.projection.fields[0],
55
+ onSave: handleComplete,
28
56
  };
29
57
 
30
58
  // Expose objects on window for test access.
31
59
  useEffect(() => {
32
- props.projection.normalizeView();
33
-
34
60
  if (typeof window !== 'undefined') {
35
61
  (window as any)[FIELD_EDITOR_DEBUG_SYMBOL] = {
36
62
  props,
37
- projection: props.projection,
63
+ projection,
38
64
  } satisfies FieldEditorDebugObjects;
39
65
  }
40
- }, [props, props.projection]);
66
+ }, [props, projection]);
41
67
 
42
68
  // NOTE(ZaymonFC): This looks awkward but it resolves an infinite parsing issue with sb.
43
69
  const json = useMemo(
44
- () => JSON.parse(JSON.stringify({ props, projection: props.projection })),
45
- [JSON.stringify(props), JSON.stringify(props.projection)],
70
+ () => JSON.parse(JSON.stringify({ props, projection })),
71
+ [JSON.stringify(props), JSON.stringify(projection)],
46
72
  );
47
73
 
48
74
  return (
49
75
  <TestLayout json={json}>
50
- <FieldEditor {...props} onSave={handleComplete} />
76
+ <FieldEditor {...props} />
51
77
  </TestLayout>
52
78
  );
53
79
  };
@@ -56,7 +82,7 @@ const meta = {
56
82
  title: 'ui/react-ui-form/FieldEditor',
57
83
  component: FieldEditor as any,
58
84
  render: DefaultStory,
59
- decorators: [withTheme],
85
+ decorators: [withTheme()],
60
86
  parameters: {
61
87
  layout: 'fullscreen',
62
88
  translations,
@@ -70,9 +96,4 @@ export default meta;
70
96
 
71
97
  type Story = StoryObj<typeof meta>;
72
98
 
73
- export const Default: Story = {
74
- args: {
75
- projection: new ProjectionModel(createEchoSchema(Example).jsonSchema, testView.projection),
76
- field: testView.projection.fields[0],
77
- },
78
- };
99
+ export const Default: Story = {};
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
6
6
 
7
- import { type SchemaRegistry } from '@dxos/echo';
7
+ import { Obj, type SchemaRegistry } from '@dxos/echo';
8
8
  import { type EchoSchema, Format, FormatEnums, formatToType } from '@dxos/echo/internal';
9
9
  import { type SchemaProperty } from '@dxos/effect';
10
10
  import { log } from '@dxos/log';
@@ -25,6 +25,7 @@ export type FieldEditorProps = {
25
25
  projection: ProjectionModel;
26
26
  field: FieldType;
27
27
  registry?: SchemaRegistry.SchemaRegistry;
28
+ view?: Obj.Unknown;
28
29
  onSave: () => void;
29
30
  onCancel?: () => void;
30
31
  } & Pick<FormRootProps<any>, 'readonly'>;
@@ -32,7 +33,7 @@ export type FieldEditorProps = {
32
33
  /**
33
34
  * Displays a Form representing the metadata for a given `Field` and `View`.
34
35
  */
35
- export const FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel }: FieldEditorProps) => {
36
+ export const FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCancel }: FieldEditorProps) => {
36
37
  const { t } = useTranslation(translationKey);
37
38
  const [props, setProps] = useState<PropertyType>(projection.getFieldProjection(field.id).props);
38
39
  useEffect(() => setProps(projection.getFieldProjection(field.id).props), [field, projection]);
@@ -136,7 +137,7 @@ export const FieldEditor = ({ readonly, projection, field, registry, onSave, onC
136
137
 
137
138
  const handleValidate = useCallback<NonNullable<FormRootProps<PropertyType>['onValidate']>>(
138
139
  ({ property }) => {
139
- 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)) {
140
141
  return [
141
142
  {
142
143
  path: 'property',
@@ -145,15 +146,21 @@ export const FieldEditor = ({ readonly, projection, field, registry, onSave, onC
145
146
  ];
146
147
  }
147
148
  },
148
- [projection.fields, field],
149
+ [projection.getFields(), field],
149
150
  );
150
151
 
151
152
  const handleSave = useCallback<NonNullable<FormRootProps<PropertyType>['onSave']>>(
152
153
  (props) => {
153
- projection.setFieldProjection({ field, props });
154
+ if (view) {
155
+ Obj.change(view, () => {
156
+ projection.setFieldProjection({ field, props });
157
+ });
158
+ } else {
159
+ projection.setFieldProjection({ field, props });
160
+ }
154
161
  onSave();
155
162
  },
156
- [projection, field, onSave],
163
+ [projection, field, view, onSave],
157
164
  );
158
165
 
159
166
  const handleCancel = useCallback<NonNullable<FormRootProps<PropertyType>['onCancel']>>(() => {
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import * as Schema from 'effect/Schema';
7
7
  import React, { useCallback, useState } from 'react';
8
8
 
9
- import { Format, Obj, Ref, Type } from '@dxos/echo';
9
+ import { Format } from '@dxos/echo';
10
10
  import { type AnyProperties } from '@dxos/echo/internal';
11
11
  import { Tooltip } from '@dxos/react-ui';
12
12
  import { withLayoutVariants, withTheme } from '@dxos/react-ui/testing';
@@ -61,21 +61,21 @@ const DefaultStory = <T extends AnyProperties = any>({
61
61
  );
62
62
  };
63
63
 
64
- const RefStory = <T extends AnyProperties = any>(props: StoryProps<T>) => {
65
- const onQueryRefOptions = useCallback<NonNullable<FormRootProps<T>['onQueryRefOptions']>>(({ typename }) => {
66
- switch (typename) {
67
- case TestSchema.Person.typename:
68
- return [
69
- { dxn: Obj.getDXN(contact1), label: 'Alice' },
70
- { dxn: Obj.getDXN(contact2), label: 'Bob' },
71
- ];
72
- default:
73
- return [];
74
- }
75
- }, []);
76
-
77
- return <DefaultStory<T> onQueryRefOptions={onQueryRefOptions} {...props} />;
78
- };
64
+ // const RefStory = <T extends AnyProperties = any>(props: StoryProps<T>) => {
65
+ // const onQueryRefOptions = useCallback<NonNullable<FormRootProps<T>['onQueryRefOptions']>>(({ typename }) => {
66
+ // switch (typename) {
67
+ // case TestSchema.Person.typename:
68
+ // return [
69
+ // { dxn: Obj.getDXN(contact1), label: 'Alice' },
70
+ // { dxn: Obj.getDXN(contact2), label: 'Bob' },
71
+ // ];
72
+ // default:
73
+ // return [];
74
+ // }
75
+ // }, []);
76
+
77
+ // return <DefaultStory<T> onQueryRefOptions={onQueryRefOptions} {...props} />;
78
+ // };
79
79
 
80
80
  const AddressSchema = Schema.Struct({
81
81
  street: Schema.optional(Schema.String.annotations({ title: 'Street' })),
@@ -98,7 +98,7 @@ const meta = {
98
98
  title: 'ui/react-ui-form/Form-Old',
99
99
  component: Form.Root as any,
100
100
  render: DefaultStory,
101
- decorators: [withTheme, withLayoutVariants()],
101
+ decorators: [withTheme(), withLayoutVariants()],
102
102
  parameters: {
103
103
  layout: 'fullscreen',
104
104
  translations,
@@ -287,28 +287,28 @@ export const Enum: StoryObj<StoryProps<ColorType>> = {
287
287
  // Refs
288
288
  //
289
289
 
290
- const RefSchema = Schema.Struct({
291
- contact: Type.Ref(TestSchema.Person).annotations({ title: 'Contact Reference' }),
292
- optionalContact: Schema.optional(Type.Ref(TestSchema.Person).annotations({ title: 'Optional Contact Reference' })),
293
- refArray: Schema.optional(Schema.Array(Type.Ref(TestSchema.Person))),
294
- unknownExpando: Schema.optional(
295
- Type.Ref(Type.Expando).annotations({ title: 'Optional Ref to an Expando (DXN Input)' }),
296
- ),
297
- });
298
-
299
- type RefSchema = Schema.Schema.Type<typeof RefSchema>;
300
-
301
- const contact1 = Obj.make(TestSchema.Person, { name: 'Alice' });
302
- const contact2 = Obj.make(TestSchema.Person, { name: 'Bob' });
303
-
304
- export const Refs: StoryObj<StoryProps<RefSchema>> = {
305
- render: RefStory,
306
- args: {
307
- debug: true,
308
- schema: RefSchema,
309
- readonly: false,
310
- values: {
311
- refArray: [Ref.make(contact1), Ref.make(contact2)],
312
- },
313
- },
314
- };
290
+ // const RefSchema = Schema.Struct({
291
+ // contact: Type.Ref(TestSchema.Person).annotations({ title: 'Contact Reference' }),
292
+ // optionalContact: Schema.optional(Type.Ref(TestSchema.Person).annotations({ title: 'Optional Contact Reference' })),
293
+ // refArray: Schema.optional(Schema.Array(Type.Ref(TestSchema.Person))),
294
+ // unknownExpando: Schema.optional(
295
+ // Type.Ref(TestSchema.Expando).annotations({ title: 'Optional Ref to an Expando (DXN Input)' }),
296
+ // ),
297
+ // });
298
+
299
+ // type RefSchema = Schema.Schema.Type<typeof RefSchema>;
300
+
301
+ // const contact1 = Obj.make(TestSchema.Person, { name: 'Alice' });
302
+ // const contact2 = Obj.make(TestSchema.Person, { name: 'Bob' });
303
+
304
+ // export const Refs: StoryObj<StoryProps<RefSchema>> = {
305
+ // render: RefStory,
306
+ // args: {
307
+ // debug: true,
308
+ // schema: RefSchema,
309
+ // readonly: false,
310
+ // values: {
311
+ // refArray: [Ref.make(contact1), Ref.make(contact2)],
312
+ // },
313
+ // },
314
+ // };
@@ -6,13 +6,13 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import * as Schema from 'effect/Schema';
7
7
  import React, { useCallback, useState } from 'react';
8
8
 
9
- import { Annotation, Filter, Format, Obj, Tag, Type } from '@dxos/echo';
9
+ import { Annotation, Format, Obj, Tag, Type } from '@dxos/echo';
10
10
  import { type AnyProperties } from '@dxos/echo/internal';
11
11
  import { log } from '@dxos/log';
12
12
  import { useClient } from '@dxos/react-client';
13
13
  import { withClientProvider } from '@dxos/react-client/testing';
14
14
  import { Tooltip } from '@dxos/react-ui';
15
- import { withTheme } from '@dxos/react-ui/testing';
15
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
16
16
 
17
17
  import { translations } from '../../translations';
18
18
  import { TestLayout } from '../testing';
@@ -22,7 +22,7 @@ import { type ExcludeId, Form, type FormRootProps, omitId } from './Form';
22
22
  const Organization = Schema.Struct({
23
23
  name: Schema.String.pipe(Schema.minLength(1)).annotations({ title: 'Full name' }),
24
24
  }).pipe(
25
- Type.Obj({
25
+ Type.object({
26
26
  typename: 'example.com/type/Organization', // TODO(burdon): Change all types to /schema
27
27
  version: '0.1.0',
28
28
  }),
@@ -64,7 +64,7 @@ const Person = Schema.Struct({
64
64
  }),
65
65
  ),
66
66
  }).pipe(
67
- Type.Obj({
67
+ Type.object({
68
68
  typename: 'dxos.org/type/Person', // TODO(burdon): Change all types to /schema
69
69
  version: '0.1.0',
70
70
  }),
@@ -80,10 +80,10 @@ type StoryProps<T extends AnyProperties> = {
80
80
  const DefaultStory = <T extends AnyProperties = AnyProperties>({
81
81
  debug,
82
82
  schema,
83
- values: valuesParam,
83
+ values: valuesProp,
84
84
  ...props
85
85
  }: StoryProps<T>) => {
86
- const [values, setValues] = useState<Partial<T>>(valuesParam ?? {});
86
+ const [values, setValues] = useState<Partial<T>>(valuesProp ?? {});
87
87
  const client = useClient();
88
88
  const space = client.spaces.default;
89
89
 
@@ -94,17 +94,9 @@ const DefaultStory = <T extends AnyProperties = AnyProperties>({
94
94
 
95
95
  const handleCancel = useCallback<NonNullable<FormRootProps<T>['onCancel']>>(() => {
96
96
  log.info('cancel');
97
- setValues(valuesParam ?? {});
97
+ setValues(valuesProp ?? {});
98
98
  }, []);
99
99
 
100
- const handleQueryRefOptions = useCallback<NonNullable<FormRootProps<T>['onQueryRefOptions']>>(
101
- async ({ typename }) => {
102
- const objects = await space.db.query(Filter.typename(typename)).run();
103
- return objects.map((result: any) => ({ dxn: Obj.getDXN(result), label: Obj.getLabel(result) }));
104
- },
105
- [space],
106
- );
107
-
108
100
  return (
109
101
  <Tooltip.Provider>
110
102
  <TestLayout json={{ values, schema: schema.ast }}>
@@ -112,9 +104,9 @@ const DefaultStory = <T extends AnyProperties = AnyProperties>({
112
104
  debug={debug}
113
105
  schema={schema}
114
106
  values={values}
107
+ db={space.db}
115
108
  onSave={handleSave}
116
109
  onCancel={handleCancel}
117
- onQueryRefOptions={handleQueryRefOptions}
118
110
  {...props}
119
111
  >
120
112
  <Form.Viewport>
@@ -135,7 +127,10 @@ const meta = {
135
127
  render: DefaultStory,
136
128
 
137
129
  decorators: [
138
- withTheme,
130
+ withTheme(),
131
+ withLayout({
132
+ layout: 'fullscreen',
133
+ }),
139
134
  withClientProvider({
140
135
  createIdentity: true,
141
136
  createSpace: true,