@dxos/react-ui-form 0.8.3 → 0.8.4-main.84f28bd

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 (41) hide show
  1. package/dist/lib/browser/index.mjs +40 -40
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +40 -40
  5. package/dist/lib/node-esm/index.mjs.map +3 -3
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +1 -1
  8. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +1 -1
  9. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +1 -1
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/Form/Form.stories.d.ts +1 -1
  12. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  13. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +1 -1
  14. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
  15. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +1 -1
  16. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  17. package/dist/types/src/components/deprecated/Form.stories.d.ts +1 -1
  18. package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
  19. package/dist/types/src/index.d.ts +1 -1
  20. package/dist/types/src/index.d.ts.map +1 -1
  21. package/dist/types/src/translations.d.ts +56 -57
  22. package/dist/types/src/translations.d.ts.map +1 -1
  23. package/dist/types/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +30 -32
  25. package/src/components/ControlSection/ControlSection.stories.tsx +2 -2
  26. package/src/components/FieldEditor/FieldEditor.stories.tsx +2 -2
  27. package/src/components/Form/Form.stories.tsx +2 -2
  28. package/src/components/Form/RefField.tsx +1 -1
  29. package/src/components/Form/custom/SelectOptionsInput.stories.tsx +2 -2
  30. package/src/components/ViewEditor/ViewEditor.stories.tsx +2 -2
  31. package/src/components/ViewEditor/ViewEditor.test.tsx +23 -23
  32. package/src/components/deprecated/Form.stories.tsx +2 -2
  33. package/src/components/testing.tsx +1 -1
  34. package/src/index.ts +1 -1
  35. package/src/translations.ts +4 -2
  36. package/dist/lib/node/index.cjs +0 -2416
  37. package/dist/lib/node/index.cjs.map +0 -7
  38. package/dist/lib/node/meta.json +0 -1
  39. package/dist/types/src/components/ViewEditor/Test.stories.d.ts +0 -10
  40. package/dist/types/src/components/ViewEditor/Test.stories.d.ts.map +0 -1
  41. package/src/components/ViewEditor/Test.stories.tsx +0 -45
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-form",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-main.84f28bd",
4
4
  "description": "Data components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -29,50 +29,48 @@
29
29
  "@radix-ui/react-context": "1.1.1",
30
30
  "date-fns": "^3.3.1",
31
31
  "jsonpath": "^1.1.1",
32
- "@dxos/debug": "0.8.3",
33
- "@dxos/echo": "0.8.3",
34
- "@dxos/effect": "0.8.3",
35
- "@dxos/echo-db": "0.8.3",
36
- "@dxos/async": "0.8.3",
37
- "@dxos/invariant": "0.8.3",
38
- "@dxos/echo-schema": "0.8.3",
39
- "@dxos/keys": "0.8.3",
40
- "@dxos/lit-ui": "0.8.3",
41
- "@dxos/live-object": "0.8.3",
42
- "@dxos/log": "0.8.3",
43
- "@dxos/react-client": "0.8.3",
44
- "@dxos/react-ui-list": "0.8.3",
45
- "@dxos/react-ui-pickers": "0.8.3",
46
- "@dxos/react-ui-stack": "0.8.3",
47
- "@dxos/react-ui-tag-picker": "0.8.3",
48
- "@dxos/react-ui-types": "0.8.3",
49
- "@dxos/util": "0.8.3",
50
- "@dxos/schema": "0.8.3"
32
+ "@dxos/async": "0.8.4-main.84f28bd",
33
+ "@dxos/debug": "0.8.4-main.84f28bd",
34
+ "@dxos/echo": "0.8.4-main.84f28bd",
35
+ "@dxos/echo-db": "0.8.4-main.84f28bd",
36
+ "@dxos/echo-schema": "0.8.4-main.84f28bd",
37
+ "@dxos/effect": "0.8.4-main.84f28bd",
38
+ "@dxos/invariant": "0.8.4-main.84f28bd",
39
+ "@dxos/keys": "0.8.4-main.84f28bd",
40
+ "@dxos/lit-ui": "0.8.4-main.84f28bd",
41
+ "@dxos/live-object": "0.8.4-main.84f28bd",
42
+ "@dxos/log": "0.8.4-main.84f28bd",
43
+ "@dxos/react-client": "0.8.4-main.84f28bd",
44
+ "@dxos/react-ui-list": "0.8.4-main.84f28bd",
45
+ "@dxos/react-ui-pickers": "0.8.4-main.84f28bd",
46
+ "@dxos/react-ui-stack": "0.8.4-main.84f28bd",
47
+ "@dxos/react-ui-tag-picker": "0.8.4-main.84f28bd",
48
+ "@dxos/react-ui-types": "0.8.4-main.84f28bd",
49
+ "@dxos/schema": "0.8.4-main.84f28bd",
50
+ "@dxos/util": "0.8.4-main.84f28bd"
51
51
  },
52
52
  "devDependencies": {
53
- "@phosphor-icons/react": "^2.1.5",
54
53
  "@types/jsonpath": "^0.2.4",
55
54
  "@types/react": "~18.2.0",
56
55
  "@types/react-dom": "~18.2.0",
57
- "effect": "3.14.21",
56
+ "effect": "3.16.13",
58
57
  "fast-check": "^3.19.0",
59
58
  "react": "~18.2.0",
60
59
  "react-dom": "~18.2.0",
61
60
  "vite": "5.4.7",
62
- "@dxos/echo-signals": "0.8.3",
63
- "@dxos/random": "0.8.3",
64
- "@dxos/react-ui": "0.8.3",
65
- "@dxos/react-ui-syntax-highlighter": "0.8.3",
66
- "@dxos/react-ui-theme": "0.8.3",
67
- "@dxos/storybook-utils": "0.8.3"
61
+ "@dxos/echo-signals": "0.8.4-main.84f28bd",
62
+ "@dxos/random": "0.8.4-main.84f28bd",
63
+ "@dxos/react-ui": "0.8.4-main.84f28bd",
64
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.84f28bd",
65
+ "@dxos/react-ui-theme": "0.8.4-main.84f28bd",
66
+ "@dxos/storybook-utils": "0.8.4-main.84f28bd"
68
67
  },
69
68
  "peerDependencies": {
70
- "@phosphor-icons/react": "^2.1.5",
71
- "effect": "3.13.3",
69
+ "effect": "^3.13.3",
72
70
  "react": "~18.2.0",
73
71
  "react-dom": "~18.2.0",
74
- "@dxos/react-ui": "0.8.3",
75
- "@dxos/react-ui-theme": "0.8.3"
72
+ "@dxos/react-ui": "0.8.4-main.84f28bd",
73
+ "@dxos/react-ui-theme": "0.8.4-main.84f28bd"
76
74
  },
77
75
  "publishConfig": {
78
76
  "access": "public"
@@ -4,14 +4,14 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta, type StoryObj } from '@storybook/react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import React from 'react';
9
9
 
10
10
  import { StackItem } from '@dxos/react-ui-stack';
11
11
  import { withLayout, withTheme } from '@dxos/storybook-utils';
12
12
 
13
13
  import { ControlPage, ControlSection, type ControlSectionProps } from './ControlSection';
14
- import translations from '../../translations';
14
+ import { translations } from '../../translations';
15
15
 
16
16
  const meta: Meta<ControlSectionProps> = {
17
17
  title: 'ui/react-ui-form/ControlSection',
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta, type StoryObj } from '@storybook/react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import React, { useMemo, useEffect } from 'react';
9
9
 
10
10
  import { createEchoSchema } from '@dxos/live-object/testing';
@@ -14,7 +14,7 @@ import { TestSchema, testView } from '@dxos/schema/testing';
14
14
  import { withLayout, withTheme } from '@dxos/storybook-utils';
15
15
 
16
16
  import { FieldEditor, type FieldEditorProps } from './FieldEditor';
17
- import translations from '../../translations';
17
+ import { translations } from '../../translations';
18
18
  import { TestLayout, TestPanel, FIELD_EDITOR_DEBUG_SYMBOL } from '../testing';
19
19
 
20
20
  // Type definition for debug objects exposed to tests.
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta, type StoryObj } from '@storybook/react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import { Schema } from 'effect';
9
9
  import React, { useCallback, useState } from 'react';
10
10
 
@@ -17,7 +17,7 @@ import { withLayout, withTheme } from '@dxos/storybook-utils';
17
17
 
18
18
  import { SelectInput } from './Defaults';
19
19
  import { Form, type FormProps } from './Form';
20
- import translations from '../../translations';
20
+ import { translations } from '../../translations';
21
21
  import { TestLayout, TestPanel } from '../testing';
22
22
 
23
23
  const AddressSchema = Schema.Struct({
@@ -156,7 +156,7 @@ export const RefField = ({
156
156
  onBlur={(event) => onBlur(event as unknown as FocusEvent<HTMLElement>)}
157
157
  onUpdate={handleUpdate}
158
158
  onSearch={handleSearch}
159
- classNames='rounded-sm bg-inputSurface p-1.5'
159
+ classNames='bg-inputSurface p-1.5 rounded-sm'
160
160
  />
161
161
  )}
162
162
  </div>
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta, type StoryObj } from '@storybook/react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import { Schema } from 'effect';
9
9
  import React, { useState } from 'react';
10
10
 
@@ -12,7 +12,7 @@ import { SelectOptionSchema, type SelectOption } from '@dxos/echo-schema';
12
12
  import { withLayout, withTheme } from '@dxos/storybook-utils';
13
13
 
14
14
  import { SelectOptionInput } from './SelectOptionsInput';
15
- import translations from '../../../translations';
15
+ import { translations } from '../../../translations';
16
16
  import { TestLayout, TestPanel } from '../../testing';
17
17
  import { Form } from '../Form';
18
18
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta, type StoryObj } from '@storybook/react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import { Schema } from 'effect';
9
9
  import React, { useCallback, useMemo, useState, useEffect } from 'react';
10
10
 
@@ -16,7 +16,7 @@ import { ViewProjection, ViewType, createView } from '@dxos/schema';
16
16
  import { withTheme, withLayout } from '@dxos/storybook-utils';
17
17
 
18
18
  import { ViewEditor, type ViewEditorProps } from './ViewEditor';
19
- import translations from '../../translations';
19
+ import { translations } from '../../translations';
20
20
  import { TestLayout, TestPanel, VIEW_EDITOR_DEBUG_SYMBOL } from '../testing';
21
21
 
22
22
  // Type definition for debug objects exposed to tests.
@@ -58,7 +58,7 @@ describe('ViewEditor', () => {
58
58
 
59
59
  fireEvent.click(screen.getByTestId('save-button'));
60
60
 
61
- // Wait for the changes to propagate to both UI and schema
61
+ // Wait for the changes to propagate to both UI and schema.
62
62
  await waitFor(() => {
63
63
  expect(screen.getByText('new_property')).toBeInTheDocument();
64
64
  });
@@ -66,18 +66,18 @@ describe('ViewEditor', () => {
66
66
  // Access the live objects directly from window using symbol.
67
67
  const debugObjects = getViewEditorDebugObjects();
68
68
 
69
- // Check schema contains new_property
69
+ // Check schema contains new_property.
70
70
  const schemaProperties = debugObjects.schema.jsonSchema.properties;
71
71
  expect(schemaProperties).toBeDefined();
72
72
  expect(schemaProperties!.new_property).toBeDefined();
73
73
  expect(schemaProperties!.name).toBeUndefined();
74
74
 
75
- // Check view contains new_property field
75
+ // Check view contains new_property field.
76
76
  const newPropertyField = debugObjects.view.fields.find((field: any) => field.path === 'new_property');
77
77
  expect(newPropertyField).toBeDefined();
78
78
  expect(newPropertyField!.path).toBe('new_property');
79
79
 
80
- // Check projection contains new_property
80
+ // Check projection contains new_property.
81
81
  const fieldProjections = debugObjects.projection.getFieldProjections();
82
82
  const newPropertyProjection = fieldProjections.find((proj: any) => proj.field.path === 'new_property');
83
83
  expect(newPropertyProjection).toBeDefined();
@@ -88,25 +88,25 @@ describe('ViewEditor', () => {
88
88
  await Default.run();
89
89
  await waitForViewEditor();
90
90
 
91
- // Click the add property button
91
+ // Click the add property button.
92
92
  const addButton = screen.getByText('Add property');
93
93
  fireEvent.click(addButton);
94
94
 
95
- // Fill out the property field
95
+ // Fill out the property field.
96
96
  const fieldInput = screen.getByPlaceholderText('Field name.');
97
97
  fireEvent.change(fieldInput, { target: { value: 'added_property' } });
98
98
 
99
- // Click the format combo box and select the first option
99
+ // Click the format combo box and select the first option.
100
100
  const formatCombo = screen.getByRole('combobox');
101
101
  fireEvent.click(formatCombo);
102
102
 
103
103
  const firstOption = screen.getAllByRole('option')[0];
104
104
  fireEvent.click(firstOption);
105
105
 
106
- // Save the changes
106
+ // Save the changes.
107
107
  fireEvent.click(screen.getByTestId('save-button'));
108
108
 
109
- // Wait for the changes to propagate
109
+ // Wait for the changes to propagate.
110
110
  await waitFor(() => {
111
111
  expect(screen.getByText('added_property')).toBeInTheDocument();
112
112
  });
@@ -114,17 +114,17 @@ describe('ViewEditor', () => {
114
114
  // Access the live objects directly from window using symbol.
115
115
  const debugObjects = getViewEditorDebugObjects();
116
116
 
117
- // Check schema contains added_property
117
+ // Check schema contains added_property.
118
118
  const schemaProperties = debugObjects.schema.jsonSchema.properties;
119
119
  expect(schemaProperties).toBeDefined();
120
120
  expect(schemaProperties!.added_property).toBeDefined();
121
121
 
122
- // Check view contains added_property field
122
+ // Check view contains added_property field.
123
123
  const addedPropertyField = debugObjects.view.fields.find((field: any) => field.path === 'added_property');
124
124
  expect(addedPropertyField).toBeDefined();
125
125
  expect(addedPropertyField!.path).toBe('added_property');
126
126
 
127
- // Check projection contains added_property
127
+ // Check projection contains added_property.
128
128
  const fieldProjections = debugObjects.projection.getFieldProjections();
129
129
  const addedPropertyProjection = fieldProjections.find((proj: any) => proj.field.path === 'added_property');
130
130
  expect(addedPropertyProjection).toBeDefined();
@@ -135,7 +135,7 @@ describe('ViewEditor', () => {
135
135
  await Default.run();
136
136
  await waitForViewEditor();
137
137
 
138
- // Find the delete button for the 'name' property
138
+ // Find the delete button for the 'name' property.
139
139
  const nameProperty = screen.getByText('name');
140
140
  const propertyRow = nameProperty.closest('[role="listitem"]');
141
141
  const deleteButton = propertyRow?.querySelector('button:last-child');
@@ -144,10 +144,10 @@ describe('ViewEditor', () => {
144
144
  throw new Error('Delete button not found');
145
145
  }
146
146
 
147
- // Click the delete button
147
+ // Click the delete button.
148
148
  fireEvent.click(deleteButton);
149
149
 
150
- // Wait for the changes to propagate
150
+ // Wait for the changes to propagate.
151
151
  await waitFor(() => {
152
152
  expect(screen.queryByText('name')).not.toBeInTheDocument();
153
153
  });
@@ -155,16 +155,16 @@ describe('ViewEditor', () => {
155
155
  // Access the live objects directly from window using symbol.
156
156
  const debugObjects = getViewEditorDebugObjects();
157
157
 
158
- // Check schema no longer contains the name property
158
+ // Check schema no longer contains the name property.
159
159
  const schemaProperties = debugObjects.schema.jsonSchema.properties;
160
160
  expect(schemaProperties).toBeDefined();
161
161
  expect(schemaProperties!.name).toBeUndefined();
162
162
 
163
- // Check view no longer contains the name field
163
+ // Check view no longer contains the name field.
164
164
  const nameField = debugObjects.view.fields.find((field: any) => field.path === 'name');
165
165
  expect(nameField).toBeUndefined();
166
166
 
167
- // Check projection no longer contains the name property
167
+ // Check projection no longer contains the name property.
168
168
  const fieldProjections = debugObjects.projection.getFieldProjections();
169
169
  const nameProjection = fieldProjections.find((proj: any) => proj.field.path === 'name');
170
170
  expect(nameProjection).toBeUndefined();
@@ -174,11 +174,11 @@ describe('ViewEditor', () => {
174
174
  await Default.run();
175
175
  await waitForViewEditor();
176
176
 
177
- // Click the first hide button
177
+ // Click the first hide button.
178
178
  const hideButtons = screen.getAllByTestId('hide-field-button');
179
179
  fireEvent.click(hideButtons[0]);
180
180
 
181
- // Check that hiddenFields is non-empty
181
+ // Check that hiddenFields is non-empty.
182
182
  await waitFor(() => {
183
183
  expect(screen.getByTestId('show-field-button')).toBeInTheDocument();
184
184
  });
@@ -186,19 +186,19 @@ describe('ViewEditor', () => {
186
186
  // Access the live objects directly from window using symbol.
187
187
  const debugObjects = getViewEditorDebugObjects();
188
188
 
189
- // Check that hiddenFields is non-empty
189
+ // Check that hiddenFields is non-empty.
190
190
  expect(debugObjects.view.hiddenFields).toBeDefined();
191
191
  expect(debugObjects.view.hiddenFields!.length).toBeGreaterThan(0);
192
192
 
193
193
  // Click the show button
194
194
  fireEvent.click(screen.getByTestId('show-field-button'));
195
195
 
196
- // Wait for the data to update and check that hiddenFields is empty
196
+ // Wait for the data to update and check that hiddenFields is empty.
197
197
  await waitFor(() => {
198
198
  expect(debugObjects.view.hiddenFields!.length).toBe(0);
199
199
  });
200
200
 
201
- // Also verify that the field is back in the visible fields list
201
+ // Also verify that the field is back in the visible fields list.
202
202
  expect(debugObjects.view.fields.length).toBeGreaterThan(0);
203
203
  });
204
204
  });
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta, type StoryObj } from '@storybook/react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import React from 'react';
9
9
 
10
10
  import { live } from '@dxos/live-object';
@@ -12,7 +12,7 @@ import { testData, TestSchema, testView, type TestType } from '@dxos/schema/test
12
12
  import { withLayout, withTheme } from '@dxos/storybook-utils';
13
13
 
14
14
  import { DeprecatedForm, type DeprecatedFormProps } from './Form';
15
- import translations from '../../translations';
15
+ import { translations } from '../../translations';
16
16
  import { TestLayout, TestPanel } from '../testing';
17
17
 
18
18
  const DefaultStory = (props: DeprecatedFormProps) => (
@@ -17,7 +17,7 @@ export const TestLayout = ({ classNames, json, children }: ThemedClassName<Props
17
17
  );
18
18
 
19
19
  export const TestPanel = ({ classNames, children }: ThemedClassName<PropsWithChildren>) => (
20
- <Card.Content classNames={[textBlockWidth, classNames]}>{children}</Card.Content>
20
+ <Card.StaticRoot classNames={[textBlockWidth, classNames]}>{children}</Card.StaticRoot>
21
21
  );
22
22
 
23
23
  // Symbol for accessing debug objects in tests.
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import translations from './translations';
5
+ import { translations } from './translations';
6
6
 
7
7
  export * from './components';
8
8
  export * from './hooks';
@@ -2,9 +2,11 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ import { type Resource } from '@dxos/react-ui';
6
+
5
7
  export const translationKey = 'react-ui-form';
6
8
 
7
- export default [
9
+ export const translations = [
8
10
  {
9
11
  'en-US': {
10
12
  [translationKey]: {
@@ -75,4 +77,4 @@ export default [
75
77
  },
76
78
  },
77
79
  },
78
- ];
80
+ ] as const satisfies Resource[];