@dxos/react-ui-form 0.8.4-main.c85a9c8dae → 0.8.4-main.d05673bc65

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-form",
3
- "version": "0.8.4-main.c85a9c8dae",
3
+ "version": "0.8.4-main.d05673bc65",
4
4
  "description": "Data components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -36,28 +36,28 @@
36
36
  "@radix-ui/react-use-controllable-state": "1.1.0",
37
37
  "date-fns": "^3.3.1",
38
38
  "tabster": "^8.5.5",
39
- "@dxos/async": "0.8.4-main.c85a9c8dae",
40
- "@dxos/echo": "0.8.4-main.c85a9c8dae",
41
- "@dxos/echo-react": "0.8.4-main.c85a9c8dae",
42
- "@dxos/echo-query": "0.8.4-main.c85a9c8dae",
43
- "@dxos/invariant": "0.8.4-main.c85a9c8dae",
44
- "@dxos/effect": "0.8.4-main.c85a9c8dae",
45
- "@dxos/lit-ui": "0.8.4-main.c85a9c8dae",
46
- "@dxos/keys": "0.8.4-main.c85a9c8dae",
47
- "@dxos/log": "0.8.4-main.c85a9c8dae",
48
- "@dxos/react-client": "0.8.4-main.c85a9c8dae",
49
- "@dxos/react-ui-components": "0.8.4-main.c85a9c8dae",
50
- "@dxos/react-ui-editor": "0.8.4-main.c85a9c8dae",
51
- "@dxos/debug": "0.8.4-main.c85a9c8dae",
52
- "@dxos/react-ui-list": "0.8.4-main.c85a9c8dae",
53
- "@dxos/react-ui-mosaic": "0.8.4-main.c85a9c8dae",
54
- "@dxos/react-ui-stack": "0.8.4-main.c85a9c8dae",
55
- "@dxos/react-ui-pickers": "0.8.4-main.c85a9c8dae",
56
- "@dxos/schema": "0.8.4-main.c85a9c8dae",
57
- "@dxos/react-ui-searchlist": "0.8.4-main.c85a9c8dae",
58
- "@dxos/types": "0.8.4-main.c85a9c8dae",
59
- "@dxos/ui-types": "0.8.4-main.c85a9c8dae",
60
- "@dxos/util": "0.8.4-main.c85a9c8dae"
39
+ "@dxos/async": "0.8.4-main.d05673bc65",
40
+ "@dxos/echo": "0.8.4-main.d05673bc65",
41
+ "@dxos/echo-query": "0.8.4-main.d05673bc65",
42
+ "@dxos/echo-react": "0.8.4-main.d05673bc65",
43
+ "@dxos/invariant": "0.8.4-main.d05673bc65",
44
+ "@dxos/effect": "0.8.4-main.d05673bc65",
45
+ "@dxos/log": "0.8.4-main.d05673bc65",
46
+ "@dxos/lit-ui": "0.8.4-main.d05673bc65",
47
+ "@dxos/react-client": "0.8.4-main.d05673bc65",
48
+ "@dxos/react-ui-components": "0.8.4-main.d05673bc65",
49
+ "@dxos/keys": "0.8.4-main.d05673bc65",
50
+ "@dxos/react-ui-editor": "0.8.4-main.d05673bc65",
51
+ "@dxos/debug": "0.8.4-main.d05673bc65",
52
+ "@dxos/react-ui-pickers": "0.8.4-main.d05673bc65",
53
+ "@dxos/react-ui-searchlist": "0.8.4-main.d05673bc65",
54
+ "@dxos/react-ui-mosaic": "0.8.4-main.d05673bc65",
55
+ "@dxos/react-ui-stack": "0.8.4-main.d05673bc65",
56
+ "@dxos/types": "0.8.4-main.d05673bc65",
57
+ "@dxos/schema": "0.8.4-main.d05673bc65",
58
+ "@dxos/ui-types": "0.8.4-main.d05673bc65",
59
+ "@dxos/util": "0.8.4-main.d05673bc65",
60
+ "@dxos/react-ui-list": "0.8.4-main.d05673bc65"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/react": "~19.2.7",
@@ -67,19 +67,19 @@
67
67
  "react": "~19.2.3",
68
68
  "react-dom": "~19.2.3",
69
69
  "vite": "^7.1.11",
70
- "@dxos/random": "0.8.4-main.c85a9c8dae",
71
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
72
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.c85a9c8dae",
73
- "@dxos/react-client": "0.8.4-main.c85a9c8dae",
74
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae",
75
- "@dxos/storybook-utils": "0.8.4-main.c85a9c8dae"
70
+ "@dxos/random": "0.8.4-main.d05673bc65",
71
+ "@dxos/react-ui": "0.8.4-main.d05673bc65",
72
+ "@dxos/react-client": "0.8.4-main.d05673bc65",
73
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.d05673bc65",
74
+ "@dxos/storybook-utils": "0.8.4-main.d05673bc65",
75
+ "@dxos/ui-theme": "0.8.4-main.d05673bc65"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "effect": "3.19.16",
79
79
  "react": "~19.2.3",
80
80
  "react-dom": "~19.2.3",
81
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
82
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
81
+ "@dxos/ui-theme": "0.8.4-main.d05673bc65",
82
+ "@dxos/react-ui": "0.8.4-main.d05673bc65"
83
83
  },
84
84
  "publishConfig": {
85
85
  "access": "public"
@@ -23,7 +23,7 @@ const Organization = Schema.Struct({
23
23
  name: Schema.String.pipe(Schema.minLength(1)).annotations({ title: 'Full name' }),
24
24
  }).pipe(
25
25
  Type.object({
26
- typename: 'example.com/type/Organization', // TODO(burdon): Change all types to /schema
26
+ typename: 'com.example.type.organization',
27
27
  version: '0.1.0',
28
28
  }),
29
29
  );
@@ -65,7 +65,7 @@ const Person = Schema.Struct({
65
65
  ),
66
66
  }).pipe(
67
67
  Type.object({
68
- typename: 'dxos.org/type/Person', // TODO(burdon): Change all types to /schema
68
+ typename: 'org.dxos.type.person', // TODO(burdon): Change all types to /schema
69
69
  version: '0.1.0',
70
70
  }),
71
71
  );
@@ -13,6 +13,7 @@ import { findAnnotation } from '@dxos/effect';
13
13
  import { DXN } from '@dxos/keys';
14
14
  import { DxAnchor } from '@dxos/lit-ui/react';
15
15
  import { Button, Icon, Input, useTranslation } from '@dxos/react-ui';
16
+ import { ParentLabelAnnotationId } from '@dxos/schema';
16
17
  import { mx } from '@dxos/ui-theme';
17
18
 
18
19
  import { translationKey } from '../../../translations';
@@ -25,10 +26,11 @@ const isRefSnapshot = (val: any): val is { '/': string } => {
25
26
  return typeof val === 'object' && typeof (val as any)?.['/'] === 'string';
26
27
  };
27
28
 
28
- const defaultGetOptions: NonNullable<RefFieldProps['getOptions']> = (results) =>
29
+ const defaultGetOptions: NonNullable<RefFieldProps['getOptions']> = (results, { parentLabel } = {}) =>
29
30
  results.map((result) => {
30
31
  const id = Entity.getDXN(result).toString();
31
- const label = Entity.getLabel(result);
32
+ const parent = parentLabel ? Obj.getParent(result as Obj.Unknown) : undefined;
33
+ const label = parent ? Entity.getLabel(parent) : Entity.getLabel(result);
32
34
  return { id, label: label ?? id };
33
35
  });
34
36
 
@@ -48,7 +50,7 @@ export type RefFieldProps = FormFieldComponentProps &
48
50
  db?: Database.Database;
49
51
  resultsHook?: (db?: Database.Database, typename?: string) => Entity.Any[];
50
52
  schemaHook?: (db?: Database.Database, typename?: string) => Type.AnyEntity;
51
- getOptions?: (objects: Entity.Any[]) => RefOption[];
53
+ getOptions?: (objects: Entity.Any[], options?: { parentLabel?: boolean }) => RefOption[];
52
54
  onCreate?: (schema: Type.AnyEntity, values: any) => void;
53
55
  };
54
56
 
@@ -80,7 +82,10 @@ export const RefField = (props: RefFieldProps) => {
80
82
  );
81
83
 
82
84
  const results = useResults(db, typename);
83
- const options = useMemo(() => getOptions(results), [results, getOptions]);
85
+ const options = useMemo(() => {
86
+ const parentLabel = type ? findAnnotation<boolean>(type, ParentLabelAnnotationId) === true : false;
87
+ return getOptions(results, { parentLabel });
88
+ }, [results, getOptions, type]);
84
89
 
85
90
  const handleGetValue = useCallback(() => {
86
91
  const formValue = getValue();
@@ -54,7 +54,7 @@ const DefaultStory = (props: StoryProps) => {
54
54
  salary: Format.Currency(),
55
55
  }).pipe(
56
56
  Type.object({
57
- typename: 'example.com/type/Test',
57
+ typename: 'com.example.type.test',
58
58
  version: '0.1.0',
59
59
  }),
60
60
  );
@@ -65,7 +65,7 @@ const DefaultStory = (props: StoryProps) => {
65
65
  completed: Schema.Boolean,
66
66
  }).pipe(
67
67
  Type.object({
68
- typename: 'example.com/type/Alternate',
68
+ typename: 'com.example.type.alternate',
69
69
  version: '0.1.0',
70
70
  }),
71
71
  );
@@ -17,7 +17,13 @@ import { useObject, useQuery } from '@dxos/react-client/echo';
17
17
  import { IconButton, Input, Message, type ThemedClassName, useTranslation } from '@dxos/react-ui';
18
18
  import { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';
19
19
  import { List } from '@dxos/react-ui-list';
20
- import { ProjectionModel, VIEW_FIELD_LIMIT, createEchoChangeCallback, getTypenameFromQuery } from '@dxos/schema';
20
+ import {
21
+ ParentLabelAnnotation,
22
+ ProjectionModel,
23
+ VIEW_FIELD_LIMIT,
24
+ createEchoChangeCallback,
25
+ getTypenameFromQuery,
26
+ } from '@dxos/schema';
21
27
  import { mx, osTranslations, subtleHover } from '@dxos/ui-theme';
22
28
 
23
29
  import { translationKey } from '../../translations';
@@ -124,7 +130,12 @@ export const ViewEditor = forwardRef<ProjectionModel, ViewEditorProps>(
124
130
  if (mode === 'tag') {
125
131
  return Schema.Struct({
126
132
  ...base.fields,
127
- target: Schema.optional(Ref.Ref(Feed.Feed).annotations({ title: 'Target Feed' })),
133
+ // TODO(wittjosiah): Replace Type.Feed with Dataset.Dataset when Ref.Ref supports unions.
134
+ target: Ref.Ref(Feed.Feed).pipe(
135
+ Schema.annotations({ title: 'Target Feed' }),
136
+ ParentLabelAnnotation.set(true),
137
+ Schema.optional,
138
+ ),
128
139
  }).pipe(Schema.mutable);
129
140
  }
130
141
 
@@ -329,7 +340,7 @@ const FieldList = ({ schema, view, registry, readonly, showHeading = false, onDe
329
340
  <List.ItemTitle classNames={hidden && 'text-subdued'} onClick={() => handleToggleField(field)}>
330
341
  {field.path}
331
342
  </List.ItemTitle>
332
- <List.ItemButton
343
+ <List.ItemIconButton
333
344
  label={t(hidden ? 'show field label' : 'hide field label')}
334
345
  data-testid={hidden ? 'show-field-button' : 'hide-field-button'}
335
346
  icon={hidden ? 'ph--eye-closed--regular' : 'ph--eye--regular'}
@@ -346,7 +357,7 @@ const FieldList = ({ schema, view, registry, readonly, showHeading = false, onDe
346
357
  onClick={() => handleDelete(field.id)}
347
358
  data-testid='field.delete'
348
359
  />
349
- <IconButton
360
+ <List.ItemIconButton
350
361
  iconOnly
351
362
  variant='ghost'
352
363
  label={t('toggle expand label', { ns: osTranslations })}