@dxos/react-ui-form 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

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 (99) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/index.mjs +620 -583
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/node-esm/index.mjs +620 -583
  6. package/dist/lib/node-esm/index.mjs.map +4 -4
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +3 -3
  9. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +61 -61
  11. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Form.d.ts +18 -15
  13. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.stories.d.ts +67 -67
  15. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/FormField.d.ts +7 -1
  17. package/dist/types/src/components/Form/FormField.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/FormFieldComponent.d.ts +0 -1
  19. package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -1
  20. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts +2 -2
  21. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -1
  22. package/dist/types/src/components/Form/FormFieldSet.d.ts +9 -10
  23. package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -1
  24. package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -1
  25. package/dist/types/src/components/Form/fields/RefField.d.ts +7 -5
  26. package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -1
  27. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -1
  28. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +61 -61
  29. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +10 -2
  30. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  31. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +61 -61
  32. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  33. package/dist/types/src/components/Settings/Settings.d.ts +39 -0
  34. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
  35. package/dist/types/src/components/Settings/Settings.stories.d.ts +81 -0
  36. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
  37. package/dist/types/src/components/Settings/index.d.ts +2 -0
  38. package/dist/types/src/components/Settings/index.d.ts.map +1 -0
  39. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +5 -5
  40. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  41. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +65 -64
  42. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  43. package/dist/types/src/components/index.d.ts +1 -1
  44. package/dist/types/src/components/index.d.ts.map +1 -1
  45. package/dist/types/src/components/testing.d.ts.map +1 -1
  46. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
  47. package/dist/types/src/translations.d.ts +61 -61
  48. package/dist/types/src/translations.d.ts.map +1 -1
  49. package/dist/types/src/util/index.d.ts +0 -1
  50. package/dist/types/src/util/index.d.ts.map +1 -1
  51. package/dist/types/src/util/refs.d.ts +1 -0
  52. package/dist/types/src/util/refs.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +36 -38
  55. package/src/components/FieldEditor/FieldEditor.stories.tsx +4 -6
  56. package/src/components/FieldEditor/FieldEditor.tsx +3 -4
  57. package/src/components/Form/AUDIT.md +17 -0
  58. package/src/components/Form/Form.stories.tsx +23 -24
  59. package/src/components/Form/Form.tsx +58 -65
  60. package/src/components/Form/FormField.tsx +27 -8
  61. package/src/components/Form/FormFieldComponent.stories.tsx +5 -5
  62. package/src/components/Form/FormFieldComponent.tsx +17 -20
  63. package/src/components/Form/FormFieldSet.tsx +108 -104
  64. package/src/components/Form/fields/ArrayField.tsx +11 -8
  65. package/src/components/Form/fields/GeoPointField.tsx +6 -6
  66. package/src/components/Form/fields/MarkdownField.tsx +1 -1
  67. package/src/components/Form/fields/RefField.tsx +35 -17
  68. package/src/components/Form/fields/SelectField.tsx +1 -1
  69. package/src/components/Form/fields/SelectOptionField.stories.tsx +2 -2
  70. package/src/components/Form/fields/SelectOptionField.tsx +9 -10
  71. package/src/components/Form/fields/TupleField.tsx +1 -1
  72. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +10 -14
  73. package/src/components/ObjectPicker/ObjectPicker.tsx +71 -60
  74. package/src/components/Settings/Settings.stories.tsx +56 -0
  75. package/src/components/Settings/Settings.tsx +129 -0
  76. package/src/components/{ControlSection → Settings}/index.ts +1 -1
  77. package/src/components/ViewEditor/ViewEditor.stories.tsx +22 -20
  78. package/src/components/ViewEditor/ViewEditor.test.tsx +3 -6
  79. package/src/components/ViewEditor/ViewEditor.tsx +99 -70
  80. package/src/components/index.ts +1 -1
  81. package/src/components/testing.tsx +20 -8
  82. package/src/hooks/useFormHandler.ts +42 -24
  83. package/src/translations.ts +62 -63
  84. package/src/util/index.ts +0 -1
  85. package/src/util/refs.ts +7 -3
  86. package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
  87. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
  88. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -87
  89. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
  90. package/dist/types/src/components/ControlSection/index.d.ts +0 -2
  91. package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
  92. package/dist/types/src/components/Form/Form-old.stories.d.ts +0 -131
  93. package/dist/types/src/components/Form/Form-old.stories.d.ts.map +0 -1
  94. package/dist/types/src/util/echo.d.ts +0 -6
  95. package/dist/types/src/util/echo.d.ts.map +0 -1
  96. package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
  97. package/src/components/ControlSection/ControlSection.tsx +0 -153
  98. package/src/components/Form/Form-old.stories.tsx +0 -314
  99. package/src/util/echo.ts +0 -25
@@ -6,188 +6,84 @@ var translations = [
6
6
  {
7
7
  "en-US": {
8
8
  [translationKey]: {
9
- "fields label": "Fields",
10
- "hidden fields label": "Hidden Fields",
11
- "empty readonly ref field label": "(none)",
12
- // TODO(burdon): Standardize field/property.
13
- "add property button label": "Add property",
14
- "field property label": "Property",
15
- "field property placeholder": "Property name",
16
- "field format label": "Type",
17
- "field path label": "Field path",
18
- "add field": "Add field",
19
- "delete field": "Delete field",
20
- "field limit reached": "Maximum number of fields reached",
21
- "boolean input true value": "Yes",
22
- "boolean input false value": "No",
23
- "show field label": "Show field",
24
- "hide field label": "Hide field",
25
- "delete field label": "Delete field",
26
- "ref field combobox input placeholder": "Search\u2026",
27
- "ref field placeholder_one": "Select\u2026",
28
- "ref field placeholder_other": "Select items\u2026",
29
- "example placeholder": "Example",
30
- "latitude placeholder": "Latitude (e.g., 40.7128)",
31
- "longitude placeholder": "Longitude (e.g., -74.0060)",
32
- "cancel button label": "Cancel",
33
- "save button label": "Save",
34
- // FormatEnum
35
- "format boolean": "Boolean",
36
- "format currency": "Currency",
37
- "format date": "Date",
38
- "format date-time": "DateTime",
39
- "format did": "DID",
40
- "format duration": "Duration",
41
- "format dxn": "DXN",
42
- "format email": "Email",
43
- "format formula": "Formula",
44
- "format hostname": "Hostname",
45
- "format integer": "Integer",
46
- "format json": "JSON",
47
- "format lnglat": "Geopoint",
48
- "format markdown": "Markdown",
49
- "format percent": "Percent",
50
- "format ref": "Reference",
51
- "format regex": "RegExp",
52
- "format string": "String",
53
- "format single-select": "Select",
54
- "format multi-select": "Multi-select",
55
- "format text": "Long text",
56
- "format time": "Time",
57
- "format timestamp": "Timestamp",
58
- "format user": "User",
59
- "format number": "Number",
60
- "format uri": "URI",
61
- "format url": "URL",
62
- "format uuid": "UUID",
9
+ "fields.label": "Fields",
10
+ "hidden-fields.label": "Hidden Fields",
11
+ "empty-readonly-ref-field.label": "(none)",
12
+ "add-property-button.label": "Add property",
13
+ "field-property.label": "Property",
14
+ "field-property.placeholder": "Property name",
15
+ "field-format.label": "Type",
16
+ "field-path.label": "Field path",
17
+ "add-field.button": "Add field",
18
+ "boolean-input-true.value": "Yes",
19
+ "boolean-input-false.value": "No",
20
+ "show-field.label": "Show field",
21
+ "hide-field.label": "Hide field",
22
+ "delete-field.label": "Delete field",
23
+ "ref-field-combobox-input.placeholder": "Search\u2026",
24
+ "ref-field.placeholder": "Select\u2026",
25
+ "ref-field.placeholder_one": "Select\u2026",
26
+ "ref-field.placeholder_other": "Select items\u2026",
27
+ "create-option.label": "Create",
28
+ "example.placeholder": "Example",
29
+ "latitude.placeholder": "Latitude (e.g., 40.7128)",
30
+ "longitude.placeholder": "Longitude (e.g., -74.0060)",
31
+ "cancel-button.label": "Cancel",
32
+ "save-button.label": "Save",
33
+ // TypeFormat
34
+ "format.boolean.label": "Boolean",
35
+ "format.currency.label": "Currency",
36
+ "format.date.label": "Date",
37
+ "format.date-time.label": "DateTime",
38
+ "format.did.label": "DID",
39
+ "format.duration.label": "Duration",
40
+ "format.dxn.label": "DXN",
41
+ "format.email.label": "Email",
42
+ "format.formula.label": "Formula",
43
+ "format.hostname.label": "Hostname",
44
+ "format.integer.label": "Integer",
45
+ "format.json.label": "JSON",
46
+ "format.lnglat.label": "Geopoint",
47
+ "format.markdown.label": "Markdown",
48
+ "format.percent.label": "Percent",
49
+ "format.ref.label": "Reference",
50
+ "format.regex.label": "RegExp",
51
+ "format.string.label": "String",
52
+ "format.single-select.label": "Select",
53
+ "format.multi-select.label": "Multi-select",
54
+ "format.text.label": "Long text",
55
+ "format.time.label": "Time",
56
+ "format.timestamp.label": "Timestamp",
57
+ "format.user.label": "User",
58
+ "format.number.label": "Number",
59
+ "format.uri.label": "URI",
60
+ "format.url.label": "URL",
61
+ "format.uuid.label": "UUID",
63
62
  // GeoPointField.
64
- "latitude label": "Latitude",
65
- "longitude label": "Longitude",
63
+ "latitude.label": "Latitude",
64
+ "longitude.label": "Longitude",
66
65
  // SelectOptionsField.
67
- "select option label": "Label",
68
- "select option label placeholder": "Option label",
69
- "select option color": "Color",
70
- "select option delete": "Delete",
71
- "select option add": "Add option",
66
+ "select-option.label": "Label",
67
+ "select-option-label.placeholder": "Option label",
68
+ "select-option-delete.button": "Delete",
69
+ "select-option-add.button": "Add option",
72
70
  // System schema message.
73
- "system schema title": "System type",
74
- "system schema description": "System type: cannot add or remove fields."
71
+ "system-schema.title": "System type",
72
+ "system-schema.description": "System type: cannot add or remove fields.",
73
+ "remove.button": "Remove"
75
74
  }
76
75
  }
77
76
  }
78
77
  ];
79
78
 
80
- // src/components/ControlSection/ControlSection.tsx
81
- import React from "react";
82
- import { Button, Input, toLocalizedString, useTranslation } from "@dxos/react-ui";
83
- import { Layout } from "@dxos/react-ui-mosaic";
84
- import { mx } from "@dxos/ui-theme";
85
- var ControlPage = ({ children, classNames, ...props }) => {
86
- return /* @__PURE__ */ React.createElement(Layout.Container, {
87
- scrollable: true,
88
- classNames: "[--control-spacing:var(--dx-trimMd)]"
89
- }, /* @__PURE__ */ React.createElement("div", {
90
- role: "none",
91
- className: mx("pli-cardSpacingInline pbe-trimMd", classNames),
92
- ...props
93
- }, children));
94
- };
95
- var ControlSection = ({ title, description, children }) => {
96
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ControlSectionHeading, {
97
- title,
98
- description
99
- }), children);
100
- };
101
- var ControlSectionHeading = ({ title, description }) => {
102
- const { t } = useTranslation(translationKey);
103
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h2", {
104
- className: "pli-trimMd container-max-width text-xl mbs-trimMd mbe-trimMd"
105
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
106
- className: "pli-trimMd mlb-trimMd container-max-width text-description"
107
- }, toLocalizedString(description, t)));
108
- };
109
- var ControlGroupButton = ({ classNames, ...props }) => {
110
- return /* @__PURE__ */ React.createElement(Button, {
111
- ...props,
112
- classNames: [
113
- "md:col-span-2",
114
- classNames
115
- ]
116
- });
117
- };
118
- var ControlGroup = ({ children, classNames }) => /* @__PURE__ */ React.createElement("div", {
119
- role: "none",
120
- className: mx("group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-trimMd", "[--control-spacing:0px] [&_input]:justify-self-end [&_button]:justify-self-end", classNames)
121
- }, children);
122
- var ControlFrame = ({ children }) => /* @__PURE__ */ React.createElement("div", {
123
- role: "none",
124
- className: mx("container-max-width grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-trimSm md:gap-trimMd p-trimMd", "border border-separator rounded-md")
125
- }, children);
126
- var controlItemClasses = mx([
127
- "container-max-width grid md:col-span-2 grid-cols-subgrid gap-trimSm items-center",
128
- // TODO(burdon): Use grid gap consistently or apply margins consistently?
129
- "mlb-[--control-spacing] *:first:!mbs-0 *:last:!mbe-0 pli-trimMd plb-trimMd",
130
- "border border-separator rounded-md"
131
- ]);
132
- var controlItemTitleClasses = "mbe-0 text-lg text-baseText font-normal";
133
- var controlItemDescriptionClasses = "mlb-trimSm md:mbe-0 text-base text-description";
134
- var ControlItem = ({ title, description, children }) => {
135
- const { t } = useTranslation(translationKey);
136
- return /* @__PURE__ */ React.createElement("div", {
137
- className: controlItemClasses
138
- }, /* @__PURE__ */ React.createElement("div", {
139
- role: "none"
140
- }, /* @__PURE__ */ React.createElement("h3", {
141
- className: controlItemTitleClasses
142
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
143
- className: controlItemDescriptionClasses
144
- }, toLocalizedString(description, t))), children);
145
- };
146
- var ControlItemInput = ({ title, description, children }) => {
147
- const { t } = useTranslation(translationKey);
148
- return /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
149
- className: controlItemClasses
150
- }, /* @__PURE__ */ React.createElement("div", {
151
- role: "none"
152
- }, /* @__PURE__ */ React.createElement(Input.Label, {
153
- classNames: controlItemTitleClasses
154
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Description, {
155
- classNames: controlItemDescriptionClasses
156
- }, toLocalizedString(description, t)))), children));
157
- };
158
- var ControlFrameItem = ({ title, description, children }) => {
159
- const { t } = useTranslation(translationKey);
160
- return /* @__PURE__ */ React.createElement("div", {
161
- role: "group",
162
- className: "min-is-0"
163
- }, /* @__PURE__ */ React.createElement("h3", {
164
- className: "text-lg mbe-2"
165
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
166
- className: "mlb-trimSm md:mbe-0 text-description"
167
- }, toLocalizedString(description, t)), children);
168
- };
169
-
170
79
  // src/components/FieldEditor/FieldEditor.tsx
171
- import React18, { useCallback as useCallback14, useEffect as useEffect7, useMemo as useMemo7, useState as useState5 } from "react";
172
- import { Obj as Obj3 } from "@dxos/echo";
80
+ import React17, { useCallback as useCallback14, useEffect as useEffect7, useMemo as useMemo7, useState as useState5 } from "react";
81
+ import { Obj as Obj2 } from "@dxos/echo";
173
82
  import { Format as Format4, FormatEnums, formatToType } from "@dxos/echo/internal";
174
83
  import { log as log2 } from "@dxos/log";
175
- import { useAsyncEffect, useTranslation as useTranslation9 } from "@dxos/react-ui";
84
+ import { useAsyncEffect, useTranslation as useTranslation8 } from "@dxos/react-ui";
176
85
  import { formatToAdditionalPropertyAttributes, getFormatSchema } from "@dxos/schema";
177
86
 
178
- // src/util/echo.ts
179
- import { Obj } from "@dxos/echo";
180
- import { setValue as setValuePlain, splitJsonPath } from "@dxos/effect";
181
- var setValueEchoAware = (obj, path, value3) => {
182
- if (Obj.isObject(obj)) {
183
- Obj.change(obj, (mutableObj) => {
184
- Obj.setValue(mutableObj, splitJsonPath(path), value3);
185
- });
186
- return obj;
187
- }
188
- return setValuePlain(obj, path, value3);
189
- };
190
-
191
87
  // src/util/field.ts
192
88
  import { Format, GeoLocation, TypeEnum } from "@dxos/echo/internal";
193
89
  var parseValue = ({ type, format, value: value3 }) => {
@@ -457,23 +353,28 @@ var getFormProperties = (ast) => {
457
353
 
458
354
  // src/util/refs.ts
459
355
  import { Ref } from "@dxos/echo";
460
- import { getArrayElementType, isArrayType } from "@dxos/effect";
356
+ import { ReferenceAnnotationId } from "@dxos/echo/internal";
357
+ import { findAnnotation, getArrayElementType, isArrayType } from "@dxos/effect";
461
358
  var getRefProps = (ast) => {
462
359
  if (isArrayType(ast)) {
463
360
  const elementType = getArrayElementType(ast);
464
361
  if (elementType) {
465
362
  if (Ref.isRefType(elementType)) {
363
+ const typename = findAnnotation(elementType, ReferenceAnnotationId)?.typename;
466
364
  return {
467
365
  ast: elementType,
468
- isArray: true
366
+ isArray: true,
367
+ typename
469
368
  };
470
369
  }
471
370
  }
472
371
  }
473
372
  if (Ref.isRefType(ast)) {
373
+ const typename = findAnnotation(ast, ReferenceAnnotationId)?.typename;
474
374
  return {
475
375
  ast,
476
- isArray: false
376
+ isArray: false,
377
+ typename
477
378
  };
478
379
  }
479
380
  return void 0;
@@ -481,24 +382,24 @@ var getRefProps = (ast) => {
481
382
 
482
383
  // src/components/Form/fields/ArrayField.tsx
483
384
  import * as Option3 from "effect/Option";
484
- import * as SchemaAST2 from "effect/SchemaAST";
485
- import React6, { useCallback as useCallback3 } from "react";
385
+ import * as SchemaAST3 from "effect/SchemaAST";
386
+ import React5, { useCallback as useCallback3 } from "react";
486
387
  import { findNode as findNode2, getArrayElementType as getArrayElementType2, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2, isNestedType as isNestedType2 } from "@dxos/effect";
487
- import { IconButton as IconButton2, useTranslation as useTranslation4 } from "@dxos/react-ui";
388
+ import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
488
389
 
489
390
  // src/components/Form/Form.tsx
490
391
  import { createContext } from "@radix-ui/react-context";
491
392
  import * as Schema2 from "effect/Schema";
492
- import React5, { useEffect as useEffect3, useMemo as useMemo4, useRef } from "react";
393
+ import * as SchemaAST2 from "effect/SchemaAST";
394
+ import React4, { useEffect as useEffect3, useMemo as useMemo4, useRef } from "react";
493
395
  import { createJsonPath as createJsonPath3, getValue as getValue$2 } from "@dxos/effect";
494
- import { IconButton, ScrollArea, useTranslation as useTranslation3 } from "@dxos/react-ui";
495
- import { mx as mx4 } from "@dxos/ui-theme";
396
+ import { IconButton, ScrollArea, useTranslation as useTranslation2 } from "@dxos/react-ui";
397
+ import { composable, composableProps, mx } from "@dxos/ui-theme";
496
398
 
497
399
  // src/hooks/useFormHandler.ts
498
400
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
499
401
  import { useCallback, useEffect, useMemo, useState } from "react";
500
- import { Obj as Obj2 } from "@dxos/echo";
501
- import { createJsonPath, fromEffectValidationPath, getValue as getValue$, setValue as setValue$ } from "@dxos/effect";
402
+ import { createJsonPath, fromEffectValidationPath, getValue as getValue$ } from "@dxos/effect";
502
403
  import { log } from "@dxos/log";
503
404
  import { useDefaultValue } from "@dxos/react-ui";
504
405
  import { validateSchema } from "@dxos/schema";
@@ -513,11 +414,13 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
513
414
  prop: valuesProp,
514
415
  defaultProp: defaultValues,
515
416
  onChange: () => {
516
- setValues(valuesProp ?? defaultValues);
517
- setChanged({});
518
- setTouched({});
519
- setErrors({});
520
- setSaving(false);
417
+ if (valuesProp !== void 0) {
418
+ setValues(valuesProp ?? defaultValues);
419
+ setChanged({});
420
+ setTouched({});
421
+ setErrors({});
422
+ setSaving(false);
423
+ }
521
424
  }
522
425
  });
523
426
  const values = values$;
@@ -531,7 +434,7 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
531
434
  errors: errors2
532
435
  }, {
533
436
  F: __dxlog_file,
534
- L: 160,
437
+ L: 155,
535
438
  S: void 0,
536
439
  C: (f, a) => f(...a)
537
440
  });
@@ -624,11 +527,12 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
624
527
  value: value3
625
528
  }, {
626
529
  F: __dxlog_file,
627
- L: 259,
530
+ L: 254,
628
531
  S: void 0,
629
532
  C: (f, a) => f(...a)
630
533
  });
631
534
  const jsonPath = createJsonPath(path);
535
+ const pathArray = path;
632
536
  let parsedValue = value3;
633
537
  try {
634
538
  if (type._tag === "NumberKeyword") {
@@ -637,33 +541,33 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
637
541
  } catch (err) {
638
542
  log.catch(err, void 0, {
639
543
  F: __dxlog_file,
640
- L: 268,
544
+ L: 264,
641
545
  S: void 0,
642
546
  C: (f, a) => f(...a)
643
547
  });
644
548
  parsedValue = void 0;
645
549
  }
646
- const newValues = Obj2.isObject(values) ? (setValueEchoAware(values, jsonPath, parsedValue), values) : {
647
- ...setValue$(values, jsonPath, parsedValue)
648
- };
649
- setValues(newValues);
550
+ const newValues = mergeAtPath(values, pathArray, parsedValue);
650
551
  const newChanged = {
651
552
  [jsonPath]: true
652
553
  };
653
- setChanged({
654
- ...changed,
554
+ setChanged((prev) => ({
555
+ ...prev,
655
556
  ...newChanged
656
- });
557
+ }));
657
558
  const isValid2 = validate(newValues);
658
559
  onValuesChanged?.(newValues, {
659
560
  isValid: isValid2,
660
561
  changed: newChanged
661
562
  });
563
+ if (valuesProp === void 0) {
564
+ setValues(newValues);
565
+ }
662
566
  }, [
663
567
  values,
664
- changed,
665
568
  validate,
666
- onValuesChanged
569
+ onValuesChanged,
570
+ valuesProp
667
571
  ]);
668
572
  const onBlur = useCallback(async (path) => {
669
573
  const jsonPath = createJsonPath(path);
@@ -720,6 +624,24 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
720
624
  onCancel
721
625
  ]);
722
626
  };
627
+ var mergeAtPath = (obj, path, value3) => {
628
+ if (path.length === 0) {
629
+ return value3;
630
+ }
631
+ const [head2, ...rest] = path;
632
+ const child = rest.length === 0 ? value3 : mergeAtPath(obj?.[head2], rest, value3);
633
+ if (Array.isArray(obj)) {
634
+ const copy = [
635
+ ...obj
636
+ ];
637
+ copy[head2] = child;
638
+ return copy;
639
+ }
640
+ return {
641
+ ...obj,
642
+ [head2]: child
643
+ };
644
+ };
723
645
  var flatMap = (errors) => {
724
646
  return errors.reduce((result, { path, message }) => {
725
647
  const jsonPath = fromEffectValidationPath(path);
@@ -761,28 +683,24 @@ var useKeyHandler = (formElement, form) => {
761
683
  };
762
684
 
763
685
  // src/components/Form/FormFieldComponent.tsx
764
- import React2, { Component } from "react";
765
- import { Icon, Input as Input2, Tooltip } from "@dxos/react-ui";
766
- import { errorText, mx as mx2 } from "@dxos/ui-theme";
767
- var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
686
+ import React, { Component } from "react";
687
+ import { Icon, Input, Tooltip } from "@dxos/react-ui";
688
+ import { inputTextLabel } from "@dxos/ui-theme";
768
689
  var FormFieldLabel = ({ label, error, readonly, asChild }) => {
769
- const Label = readonly || asChild ? "span" : Input2.Label;
770
- const labelProps = readonly || asChild ? {
771
- className: "text-description text-sm"
772
- } : {
773
- classNames: "!mlb-0 text-sm"
774
- };
775
- return /* @__PURE__ */ React2.createElement("div", {
690
+ const Label = readonly || asChild ? "span" : Input.Label;
691
+ return /* @__PURE__ */ React.createElement("div", {
776
692
  role: "none",
777
- className: mx2("flex justify-between items-center", labelSpacing)
778
- }, /* @__PURE__ */ React2.createElement(Label, labelProps, label), error && /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
693
+ className: "flex items-center justify-between"
694
+ }, /* @__PURE__ */ React.createElement(Label, {
695
+ className: inputTextLabel
696
+ }, label), error && /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
779
697
  asChild: true,
780
698
  content: error,
781
699
  side: "bottom"
782
- }, /* @__PURE__ */ React2.createElement(Icon, {
700
+ }, /* @__PURE__ */ React.createElement(Icon, {
783
701
  icon: "ph--warning--regular",
784
702
  size: 4,
785
- classNames: errorText
703
+ classNames: "text-error-text"
786
704
  })));
787
705
  };
788
706
  FormFieldLabel.displayName = "Form.FieldLabel";
@@ -794,15 +712,18 @@ var FormFieldWrapper = (props) => {
794
712
  return null;
795
713
  }
796
714
  const str = String(value3 ?? "");
797
- return /* @__PURE__ */ React2.createElement(Input2.Root, {
715
+ return /* @__PURE__ */ React.createElement("div", {
716
+ role: "none",
717
+ className: "contents"
718
+ }, /* @__PURE__ */ React.createElement(Input.Root, {
798
719
  validationValence: status
799
- }, layout !== "inline" && /* @__PURE__ */ React2.createElement(FormFieldLabel, {
720
+ }, layout !== "inline" && /* @__PURE__ */ React.createElement(FormFieldLabel, {
800
721
  error,
801
722
  readonly,
802
723
  label
803
- }), layout === "static" ? /* @__PURE__ */ React2.createElement("p", null, str) : children ? children({
724
+ }), layout === "static" ? /* @__PURE__ */ React.createElement("p", null, str) : children ? children({
804
725
  value: value3
805
- }) : null, layout === "full" && /* @__PURE__ */ React2.createElement(Input2.DescriptionAndValidation, null, /* @__PURE__ */ React2.createElement(Input2.Validation, null, error)));
726
+ }) : null, layout === "full" && /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Validation, null, error))));
806
727
  };
807
728
  var FormFieldErrorBoundary = class extends Component {
808
729
  static getDerivedStateFromError(error) {
@@ -820,10 +741,10 @@ var FormFieldErrorBoundary = class extends Component {
820
741
  }
821
742
  render() {
822
743
  if (this.state.error) {
823
- return /* @__PURE__ */ React2.createElement("div", {
824
- className: "flex gap-2 border border-roseFill font-mono text-sm"
825
- }, /* @__PURE__ */ React2.createElement("span", {
826
- className: "bg-roseFill text-surfaceText pli-1 font-thin"
744
+ return /* @__PURE__ */ React.createElement("div", {
745
+ className: "flex gap-2 border border-rose-fill font-mono text-sm"
746
+ }, /* @__PURE__ */ React.createElement("span", {
747
+ className: "bg-rose-fill text-surface-text px-1 font-thin"
827
748
  }, "ERROR"), String(this.props.path?.join(".")));
828
749
  }
829
750
  return this.props.children;
@@ -836,9 +757,7 @@ var FormFieldErrorBoundary = class extends Component {
836
757
  };
837
758
 
838
759
  // src/components/Form/FormFieldSet.tsx
839
- import React4, { forwardRef, useMemo as useMemo3 } from "react";
840
- import { mx as mx3 } from "@dxos/ui-theme";
841
- import { isTruthy } from "@dxos/util";
760
+ import React3, { useMemo as useMemo3 } from "react";
842
761
 
843
762
  // src/components/Form/FormField.tsx
844
763
  import * as Match from "effect/Match";
@@ -846,10 +765,10 @@ import * as Option2 from "effect/Option";
846
765
  import * as Schema from "effect/Schema";
847
766
  import * as SchemaAST from "effect/SchemaAST";
848
767
  import * as String2 from "effect/String";
849
- import React3, { useMemo as useMemo2 } from "react";
768
+ import React2, { useMemo as useMemo2 } from "react";
850
769
  import { Format as Format3 } from "@dxos/echo";
851
770
  import { createJsonPath as createJsonPath2, findNode, getAnnotation, getDiscriminatedType, isArrayType as isArrayType2, isDiscriminatedUnion, isLiteralUnion, isNestedType } from "@dxos/effect";
852
- import { useTranslation as useTranslation2 } from "@dxos/react-ui";
771
+ import { useTranslation } from "@dxos/react-ui";
853
772
  var FormField = (props) => {
854
773
  const {
855
774
  type,
@@ -861,15 +780,17 @@ var FormField = (props) => {
861
780
  readonly,
862
781
  layout,
863
782
  // RefFieldProps
783
+ createTypename,
864
784
  createOptionLabel,
865
785
  createOptionIcon,
866
786
  createInitialValuePath,
787
+ createFieldMap,
867
788
  db,
868
789
  schemaHook,
869
790
  getOptions: getRefOptions,
870
791
  onCreate
871
792
  } = props;
872
- const { t } = useTranslation2(translationKey);
793
+ const { t } = useTranslation(translationKey);
873
794
  const title = getAnnotation(SchemaAST.TitleAnnotationId)(type);
874
795
  const description = getAnnotation(SchemaAST.DescriptionAnnotationId)(type);
875
796
  const examples = getAnnotation(SchemaAST.ExamplesAnnotationId)(type);
@@ -877,7 +798,7 @@ var FormField = (props) => {
877
798
  title,
878
799
  name
879
800
  ]);
880
- const placeholder = useMemo2(() => examples?.length ? `${t("example placeholder")}: ${examples[0]}` : description ?? label, [
801
+ const placeholder = useMemo2(() => examples?.length ? `${t("example.placeholder")}: ${examples[0]}` : description ?? label, [
881
802
  examples,
882
803
  description,
883
804
  label
@@ -895,7 +816,7 @@ var FormField = (props) => {
895
816
  const jsonPath = createJsonPath2(path ?? []);
896
817
  const CustomField = fieldMap?.[jsonPath];
897
818
  if (CustomField) {
898
- return /* @__PURE__ */ React3.createElement(CustomField, fieldProps);
819
+ return /* @__PURE__ */ React2.createElement(CustomField, fieldProps);
899
820
  }
900
821
  const component = fieldProvider?.({
901
822
  schema: Schema.make(type),
@@ -906,7 +827,7 @@ var FormField = (props) => {
906
827
  return component;
907
828
  }
908
829
  if (isArrayType2(type)) {
909
- return /* @__PURE__ */ React3.createElement(ArrayField, {
830
+ return /* @__PURE__ */ React2.createElement(ArrayField, {
910
831
  fieldProps: fieldState,
911
832
  label,
912
833
  ...props
@@ -914,26 +835,34 @@ var FormField = (props) => {
914
835
  }
915
836
  const Field = getFormField(fieldProps);
916
837
  if (Field) {
917
- return /* @__PURE__ */ React3.createElement(Field, fieldProps);
838
+ return /* @__PURE__ */ React2.createElement(Field, fieldProps);
918
839
  }
919
840
  const options = getOptions(type);
920
841
  if (options) {
921
- return /* @__PURE__ */ React3.createElement(SelectField, {
842
+ const fieldProjections = projection?.getFieldProjections();
843
+ const fieldProjection = fieldProjections?.find((fp) => fp.field.path === name);
844
+ const selectOptions = fieldProjection?.props.options;
845
+ return /* @__PURE__ */ React2.createElement(SelectField, {
922
846
  ...fieldProps,
923
- options: options.map((option) => ({
924
- value: option,
925
- label: option.toString()
926
- }))
847
+ options: options.map((option) => {
848
+ const selectOption = selectOptions?.find((so) => so.id === globalThis.String(option));
849
+ return {
850
+ value: option,
851
+ label: selectOption?.title ?? option.toString()
852
+ };
853
+ })
927
854
  });
928
855
  }
929
856
  const refProps = getRefProps(type);
930
857
  if (refProps) {
931
- return /* @__PURE__ */ React3.createElement(RefField, {
858
+ const isCreateTarget = !createTypename || refProps.typename === createTypename;
859
+ return /* @__PURE__ */ React2.createElement(RefField, {
932
860
  ...fieldProps,
933
861
  ...refProps,
934
- createOptionLabel,
935
- createOptionIcon,
936
- createInitialValuePath,
862
+ createOptionLabel: isCreateTarget ? createOptionLabel : void 0,
863
+ createOptionIcon: isCreateTarget ? createOptionIcon : void 0,
864
+ createInitialValuePath: isCreateTarget ? createInitialValuePath : void 0,
865
+ createFieldMap: isCreateTarget ? createFieldMap : void 0,
937
866
  db,
938
867
  schemaHook,
939
868
  getOptions: getRefOptions,
@@ -945,7 +874,7 @@ var FormField = (props) => {
945
874
  const typeLiteral = baseNode ? getDiscriminatedType(baseNode, fieldState.getValue()) : findNode(type, SchemaAST.isTypeLiteral);
946
875
  if (typeLiteral) {
947
876
  const schema = Schema.make(typeLiteral);
948
- return /* @__PURE__ */ React3.createElement(FormFieldSet, {
877
+ return /* @__PURE__ */ React2.createElement(FormFieldSet, {
949
878
  schema,
950
879
  path,
951
880
  readonly,
@@ -991,17 +920,19 @@ var getOptions = (ast) => {
991
920
  };
992
921
 
993
922
  // src/components/Form/FormFieldSet.tsx
994
- var FormFieldSet = /* @__PURE__ */ forwardRef(({ classNames, label, schema, readonly, path, exclude, sort, projection, layout, ...props }, forwardRef4) => {
995
- const values = useFormValues(FormFieldSet.displayName, path);
923
+ var FORM_FIELDSET_NAME = "Form.FieldSet";
924
+ var FormFieldSet = ({ label, schema, readonly, path, sort, exclude, projection, layout, ...props }) => {
925
+ const values = useFormValues(FORM_FIELDSET_NAME, path);
996
926
  const properties = useMemo3(() => {
997
927
  if (!schema) {
998
928
  return [];
999
929
  }
1000
- const props2 = getFormProperties(schema.ast);
930
+ const schemaProps = getFormProperties(schema.ast);
931
+ const filteredProps = exclude ? exclude(schemaProps) : schemaProps;
1001
932
  if (projection) {
1002
933
  const fieldProjections = projection.getFieldProjections();
1003
934
  const hiddenProperties = new Set(projection.getHiddenProperties());
1004
- const visibleProps = props2.filter((prop) => !hiddenProperties.has(prop.name.toString()));
935
+ const visibleProps = filteredProps.filter((prop) => !hiddenProperties.has(prop.name.toString()));
1005
936
  const orderedProps = [];
1006
937
  for (const fieldProjection of fieldProjections) {
1007
938
  const fieldPath = String(fieldProjection.field.path);
@@ -1015,34 +946,31 @@ var FormFieldSet = /* @__PURE__ */ forwardRef(({ classNames, label, schema, read
1015
946
  orderedProps.push(...remainingProps);
1016
947
  return orderedProps;
1017
948
  }
1018
- const filtered = exclude ? exclude(props2) : props2;
1019
- return sort ? filtered.sort(({ name: a }, { name: b }) => sort.indexOf(a.toString()) - sort.indexOf(b.toString())) : filtered;
949
+ return sort ? [
950
+ ...filteredProps
951
+ ].sort(({ name: a }, { name: b }) => sort.indexOf(a.toString()) - sort.indexOf(b.toString())) : filteredProps;
1020
952
  }, [
1021
953
  schema,
1022
954
  values,
1023
955
  exclude,
1024
956
  sort,
1025
- projection?.fields
957
+ projection
1026
958
  ]);
1027
959
  if ((readonly || layout === "static") && values == null) {
1028
960
  return null;
1029
961
  }
1030
- return /* @__PURE__ */ React4.createElement("div", {
1031
- role: "form",
1032
- className: mx3("is-full", layout === "inline" && "flex flex-col gap-2", classNames),
1033
- ref: forwardRef4
1034
- }, layout !== "inline" && label && /* @__PURE__ */ React4.createElement(FormFieldLabel, {
962
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, layout !== "inline" && label && /* @__PURE__ */ React3.createElement(FormFieldLabel, {
1035
963
  label,
1036
964
  asChild: true
1037
965
  }), properties.map((property) => {
1038
966
  const name = property.name.toString();
1039
- return /* @__PURE__ */ React4.createElement(FormFieldErrorBoundary, {
967
+ return /* @__PURE__ */ React3.createElement(FormFieldErrorBoundary, {
1040
968
  key: name,
1041
969
  path: [
1042
970
  ...path ?? [],
1043
971
  name
1044
972
  ]
1045
- }, /* @__PURE__ */ React4.createElement(FormField, {
973
+ }, /* @__PURE__ */ React3.createElement(FormField, {
1046
974
  type: property.type,
1047
975
  name,
1048
976
  path: [
@@ -1054,24 +982,32 @@ var FormFieldSet = /* @__PURE__ */ forwardRef(({ classNames, label, schema, read
1054
982
  projection,
1055
983
  ...props
1056
984
  }));
1057
- }).filter(isTruthy));
1058
- });
1059
- FormFieldSet.displayName = "Form.Fields";
985
+ }));
986
+ };
987
+ FormFieldSet.displayName = FORM_FIELDSET_NAME;
1060
988
 
1061
989
  // src/components/Form/Form.tsx
1062
990
  var omitId = (schema) => schema.pipe(Schema2.omit("id"));
1063
991
  var [FormContextProvider, useFormContext] = createContext("Form");
1064
- var useFormValues = (componentName, path = [], defaultValue) => {
1065
- const jsonPath = createJsonPath3(path);
1066
- const { form: { values } } = useFormContext(componentName);
992
+ var useFormValues = (componentName, path, defaultValue) => {
993
+ const stablePath = useMemo4(() => path ?? [], [
994
+ path ? path.join(".") : void 0
995
+ ]);
996
+ const jsonPath = createJsonPath3(stablePath);
997
+ const { form: { values, onValueChange } } = useFormContext(componentName);
1067
998
  const value3 = getValue$2(values, jsonPath);
999
+ const lastAppliedPathRef = useRef(null);
1068
1000
  useEffect3(() => {
1069
- if (!value3 && defaultValue) {
1070
- setValueEchoAware(values, jsonPath, defaultValue());
1001
+ if (value3 == null && defaultValue && lastAppliedPathRef.current !== jsonPath) {
1002
+ lastAppliedPathRef.current = jsonPath;
1003
+ onValueChange(stablePath, SchemaAST2.stringKeyword, defaultValue());
1071
1004
  }
1072
1005
  }, [
1073
1006
  value3,
1074
- defaultValue
1007
+ defaultValue,
1008
+ onValueChange,
1009
+ stablePath,
1010
+ jsonPath
1075
1011
  ]);
1076
1012
  return value3;
1077
1013
  };
@@ -1101,116 +1037,121 @@ var FormRoot = ({ children, schema, values, onSave, onCancel, ...props }) => {
1101
1037
  onCancel,
1102
1038
  ...props
1103
1039
  });
1104
- return /* @__PURE__ */ React5.createElement(FormContextProvider, {
1040
+ return /* @__PURE__ */ React4.createElement(FormContextProvider, {
1105
1041
  form,
1106
1042
  ...props
1107
1043
  }, children);
1108
1044
  };
1109
1045
  FormRoot.displayName = "Form.Root";
1110
- var FormViewport = ({ classNames, children }) => {
1111
- return /* @__PURE__ */ React5.createElement(ScrollArea.Root, null, /* @__PURE__ */ React5.createElement(ScrollArea.Viewport, {
1112
- classNames: [
1113
- "plb-cardSpacingBlock",
1114
- classNames
1115
- ]
1116
- }, children), /* @__PURE__ */ React5.createElement(ScrollArea.Scrollbar, {
1117
- orientation: "vertical"
1118
- }, /* @__PURE__ */ React5.createElement(ScrollArea.Thumb, null)));
1119
- };
1120
- FormViewport.displayName = "Form.Viewport";
1046
+ var FORM_VIEWPORT_NAME = "Form.Viewport";
1047
+ var FormViewport = composable(({ children, ...props }, forwardedRef) => {
1048
+ return /* @__PURE__ */ React4.createElement(ScrollArea.Root, {
1049
+ ...composableProps(props),
1050
+ orientation: "vertical",
1051
+ centered: true,
1052
+ padding: true,
1053
+ thin: true,
1054
+ ref: forwardedRef
1055
+ }, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, children));
1056
+ });
1057
+ FormViewport.displayName = FORM_VIEWPORT_NAME;
1058
+ var FORM_CONTENT_NAME = "Form.Content";
1121
1059
  var FormContent = ({ classNames, children }) => {
1122
- const { form, testId } = useFormContext(FormContent.displayName);
1060
+ const { form, testId } = useFormContext(FORM_CONTENT_NAME);
1123
1061
  const ref = useRef(null);
1124
1062
  useKeyHandler(ref.current, form);
1125
- return /* @__PURE__ */ React5.createElement("div", {
1063
+ return /* @__PURE__ */ React4.createElement("div", {
1126
1064
  ref,
1127
1065
  role: "form",
1128
- className: mx4("flex flex-col is-full pli-cardSpacingInline density-fine", classNames),
1066
+ className: mx("flex flex-col w-full", classNames),
1129
1067
  "data-testid": testId
1130
1068
  }, children);
1131
1069
  };
1132
- FormContent.displayName = "Form.Content";
1133
- var FormFieldSet2 = ({ classNames }) => {
1134
- const { form, ...props } = useFormContext(FormFieldSet2.displayName);
1135
- return /* @__PURE__ */ React5.createElement(FormFieldSet, {
1136
- classNames,
1070
+ FormContent.displayName = FORM_CONTENT_NAME;
1071
+ var FORM_FIELDSET_NAME2 = "Form.FieldSet";
1072
+ var FormFieldSet2 = (props) => {
1073
+ const { form, ...contextProps } = useFormContext(FORM_FIELDSET_NAME2);
1074
+ return /* @__PURE__ */ React4.createElement(FormFieldSet, {
1137
1075
  schema: form.schema,
1076
+ ...contextProps,
1138
1077
  ...props
1139
1078
  });
1140
1079
  };
1141
- FormFieldSet2.displayName = "Form.FieldSet";
1080
+ FormFieldSet2.displayName = FORM_FIELDSET_NAME2;
1081
+ var FORM_ACTIONS_NAME = "Form.Actions";
1142
1082
  var FormActions = ({ classNames }) => {
1143
- const { t } = useTranslation3(translationKey);
1144
- const { form: { canSave, onSave, onCancel }, readonly, layout } = useFormContext(FormActions.displayName);
1083
+ const { t } = useTranslation2(translationKey);
1084
+ const { form: { canSave, onSave, onCancel }, readonly, layout } = useFormContext(FORM_ACTIONS_NAME);
1145
1085
  if (readonly || layout === "static") {
1146
1086
  return null;
1147
1087
  }
1148
- return /* @__PURE__ */ React5.createElement("div", {
1088
+ return /* @__PURE__ */ React4.createElement("div", {
1149
1089
  role: "none",
1150
- className: mx4("grid grid-flow-col auto-cols-fr gap-2 pbs-cardSpacingBlock", classNames)
1151
- }, onCancel && /* @__PURE__ */ React5.createElement(IconButton, {
1090
+ className: mx("grid grid-flow-col gap-form-gap auto-cols-fr py-form-padding", classNames)
1091
+ }, onCancel && /* @__PURE__ */ React4.createElement(IconButton, {
1152
1092
  icon: "ph--x--regular",
1153
1093
  iconEnd: true,
1154
- label: t("cancel button label"),
1094
+ label: t("cancel-button.label"),
1155
1095
  onClick: onCancel,
1156
1096
  "data-testid": "cancel-button"
1157
- }), onSave && /* @__PURE__ */ React5.createElement(IconButton, {
1097
+ }), onSave && /* @__PURE__ */ React4.createElement(IconButton, {
1158
1098
  type: "submit",
1159
1099
  variant: "primary",
1160
1100
  disabled: !canSave,
1161
1101
  icon: "ph--check--regular",
1162
1102
  iconEnd: true,
1163
- label: t("save button label"),
1103
+ label: t("save-button.label"),
1164
1104
  onClick: onSave,
1165
1105
  "data-testid": "save-button"
1166
1106
  }));
1167
1107
  };
1168
- FormActions.displayName = "Form.Actions";
1169
- var FormSubmit = ({ classNames, label, icon }) => {
1170
- const { t } = useTranslation3(translationKey);
1171
- const { form: { canSave, onSave }, readonly, layout } = useFormContext(FormSubmit.displayName);
1108
+ FormActions.displayName = FORM_ACTIONS_NAME;
1109
+ var FORM_SUBMIT_NAME = "Form.Submit";
1110
+ var FormSubmit = ({ classNames, label, icon, disabled }) => {
1111
+ const { t } = useTranslation2(translationKey);
1112
+ const { form: { canSave, onSave }, readonly, layout } = useFormContext(FORM_SUBMIT_NAME);
1172
1113
  if (readonly || layout === "static") {
1173
1114
  return null;
1174
1115
  }
1175
- return /* @__PURE__ */ React5.createElement("div", {
1116
+ return /* @__PURE__ */ React4.createElement("div", {
1176
1117
  role: "none",
1177
- className: mx4("flex is-full pbs-cardSpacingBlock", classNames)
1178
- }, /* @__PURE__ */ React5.createElement(IconButton, {
1179
- classNames: "is-full",
1118
+ className: mx("flex w-full pt-form-padding", classNames)
1119
+ }, /* @__PURE__ */ React4.createElement(IconButton, {
1120
+ classNames: "w-full",
1180
1121
  type: "submit",
1181
1122
  variant: "primary",
1182
- disabled: !canSave,
1123
+ disabled: disabled ?? !canSave,
1183
1124
  icon: icon ?? "ph--check--regular",
1184
- label: label ?? t("save button label"),
1125
+ label: label ?? t("save-button.label"),
1185
1126
  onClick: onSave,
1186
1127
  "data-testid": "save-button"
1187
1128
  }));
1188
1129
  };
1189
- FormSubmit.displayName = "Form.Submit";
1130
+ FormSubmit.displayName = FORM_SUBMIT_NAME;
1190
1131
  var Form = {
1191
1132
  Root: FormRoot,
1192
1133
  Viewport: FormViewport,
1193
1134
  Content: FormContent,
1194
1135
  FieldSet: FormFieldSet2,
1136
+ Label: FormFieldLabel,
1195
1137
  Actions: FormActions,
1196
- Submit: FormSubmit,
1197
- Label: FormFieldLabel
1138
+ Submit: FormSubmit
1198
1139
  };
1199
1140
 
1200
1141
  // src/components/Form/fields/ArrayField.tsx
1201
1142
  var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps, ...props }) => {
1202
- const { t } = useTranslation4(translationKey);
1143
+ const { t } = useTranslation3(translationKey);
1203
1144
  const elementType = getArrayElementType2(type);
1204
1145
  const { onValueChange } = inputProps;
1205
1146
  const values = useFormValues(ArrayField.displayName, path, () => []);
1206
1147
  const getDefaultObjectValue = (typeNode) => {
1207
1148
  const baseNode = findNode2(typeNode, isDiscriminatedUnion2);
1208
- const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, {}) : findNode2(typeNode, SchemaAST2.isTypeLiteral);
1149
+ const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, {}) : findNode2(typeNode, SchemaAST3.isTypeLiteral);
1209
1150
  if (!typeLiteral) {
1210
1151
  return {};
1211
1152
  }
1212
1153
  return Object.fromEntries(getFormProperties(typeLiteral).map((prop) => {
1213
- const defaultValue = SchemaAST2.getDefaultAnnotation(prop.type).pipe((annotation) => Option3.getOrUndefined(annotation));
1154
+ const defaultValue = SchemaAST3.getDefaultAnnotation(prop.type).pipe((annotation) => Option3.getOrUndefined(annotation));
1214
1155
  return [
1215
1156
  prop.name,
1216
1157
  defaultValue
@@ -1239,19 +1180,19 @@ var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps,
1239
1180
  if (!elementType || (readonly || layout === "static") && values && values.length < 1) {
1240
1181
  return null;
1241
1182
  }
1242
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, (layout !== "static" || values && values.length > 0) && /* @__PURE__ */ React6.createElement(FormFieldLabel, {
1183
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, (layout !== "static" || values && values.length > 0) && /* @__PURE__ */ React5.createElement(FormFieldLabel, {
1243
1184
  readonly,
1244
1185
  label,
1245
1186
  asChild: true
1246
- }), /* @__PURE__ */ React6.createElement("div", {
1187
+ }), /* @__PURE__ */ React5.createElement("div", {
1247
1188
  role: "none",
1248
- className: "flex flex-col gap-2"
1189
+ className: "flex flex-col gap-form-gap"
1249
1190
  }, values?.map((_, index) => {
1250
- return /* @__PURE__ */ React6.createElement("div", {
1191
+ return /* @__PURE__ */ React5.createElement("div", {
1251
1192
  role: "none",
1252
1193
  key: index,
1253
- className: "grid grid-cols-[1fr_min-content] gap-2 last:mb-3"
1254
- }, /* @__PURE__ */ React6.createElement(FormField, {
1194
+ className: "flex gap-form-gap last:mb-form-gap"
1195
+ }, /* @__PURE__ */ React5.createElement(FormField, {
1255
1196
  autoFocus: index === values.length - 1,
1256
1197
  type: elementType,
1257
1198
  path: [
@@ -1261,23 +1202,23 @@ var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps,
1261
1202
  readonly: readonly || layout === "static",
1262
1203
  layout: "inline",
1263
1204
  ...props
1264
- }), !readonly && layout !== "static" && /* @__PURE__ */ React6.createElement("div", {
1205
+ }), !readonly && layout !== "static" && /* @__PURE__ */ React5.createElement("div", {
1265
1206
  role: "none",
1266
- className: "flex flex-col bs-full justify-end"
1267
- }, /* @__PURE__ */ React6.createElement("div", {
1207
+ className: "flex flex-col h-full justify-end"
1208
+ }, /* @__PURE__ */ React5.createElement("div", {
1268
1209
  role: "none",
1269
- className: "flex items-center bs-[var(--line-height)]"
1270
- }, /* @__PURE__ */ React6.createElement(IconButton2, {
1210
+ className: "flex items-center h-[2rem]"
1211
+ }, /* @__PURE__ */ React5.createElement(IconButton2, {
1271
1212
  icon: "ph--x--regular",
1272
1213
  iconOnly: true,
1273
- label: t("button remove"),
1214
+ label: t("remove.button"),
1274
1215
  onClick: () => handleDelete(index),
1275
1216
  classNames: "self-center"
1276
1217
  }))));
1277
- })), !readonly && layout !== "static" && /* @__PURE__ */ React6.createElement(IconButton2, {
1278
- classNames: "flex is-full _mlb-cardSpacingBlock",
1218
+ })), !readonly && layout !== "static" && /* @__PURE__ */ React5.createElement(IconButton2, {
1219
+ classNames: "flex w-full",
1279
1220
  icon: "ph--plus--regular",
1280
- label: t("add field"),
1221
+ label: t("add-field.button"),
1281
1222
  onClick: handleAdd
1282
1223
  }));
1283
1224
  };
@@ -1293,6 +1234,9 @@ var getDefaultValue = (ast) => {
1293
1234
  case "BooleanKeyword": {
1294
1235
  return false;
1295
1236
  }
1237
+ case "Suspend": {
1238
+ return getDefaultValue(ast.f());
1239
+ }
1296
1240
  default: {
1297
1241
  if (ast && isNestedType2(ast)) {
1298
1242
  return {};
@@ -1304,17 +1248,17 @@ var getDefaultValue = (ast) => {
1304
1248
  };
1305
1249
 
1306
1250
  // src/components/Form/fields/BooleanField.tsx
1307
- import React7, { useCallback as useCallback4 } from "react";
1308
- import { Input as Input3 } from "@dxos/react-ui";
1251
+ import React6, { useCallback as useCallback4 } from "react";
1252
+ import { Input as Input2 } from "@dxos/react-ui";
1309
1253
  var BooleanField = ({ type, readonly, onValueChange, ...props }) => {
1310
1254
  const handleChange = useCallback4((value3) => onValueChange?.(type, value3), [
1311
1255
  type,
1312
1256
  onValueChange
1313
1257
  ]);
1314
- return /* @__PURE__ */ React7.createElement(FormFieldWrapper, {
1258
+ return /* @__PURE__ */ React6.createElement(FormFieldWrapper, {
1315
1259
  readonly,
1316
1260
  ...props
1317
- }, ({ value: value3 }) => /* @__PURE__ */ React7.createElement(Input3.Switch, {
1261
+ }, ({ value: value3 }) => /* @__PURE__ */ React6.createElement(Input2.Switch, {
1318
1262
  disabled: !!readonly,
1319
1263
  checked: value3,
1320
1264
  onCheckedChange: handleChange
@@ -1322,12 +1266,12 @@ var BooleanField = ({ type, readonly, onValueChange, ...props }) => {
1322
1266
  };
1323
1267
 
1324
1268
  // src/components/Form/fields/GeoPointField.tsx
1325
- import React8, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo5, useState as useState2 } from "react";
1269
+ import React7, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo5, useState as useState2 } from "react";
1326
1270
  import { GeoLocation as GeoLocation3 } from "@dxos/echo/internal";
1327
- import { Input as Input4, useTranslation as useTranslation5 } from "@dxos/react-ui";
1271
+ import { Input as Input3, useTranslation as useTranslation4 } from "@dxos/react-ui";
1328
1272
  import { safeParseFloat } from "@dxos/util";
1329
1273
  var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onValueChange, onBlur }) => {
1330
- const { t } = useTranslation5(translationKey);
1274
+ const { t } = useTranslation4(translationKey);
1331
1275
  const { status, error } = getStatus();
1332
1276
  const geoPoint = useMemo5(() => getValue() ?? [
1333
1277
  0,
@@ -1373,33 +1317,33 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
1373
1317
  if ((readonly || layout === "static") && !value3?.latitude && !value3?.longitude) {
1374
1318
  return null;
1375
1319
  }
1376
- return /* @__PURE__ */ React8.createElement(Input4.Root, {
1320
+ return /* @__PURE__ */ React7.createElement(Input3.Root, {
1377
1321
  validationValence: status
1378
- }, layout !== "inline" && /* @__PURE__ */ React8.createElement(FormFieldLabel, {
1322
+ }, layout !== "inline" && /* @__PURE__ */ React7.createElement(FormFieldLabel, {
1379
1323
  error,
1380
1324
  readonly,
1381
1325
  label,
1382
1326
  asChild: true
1383
- }), layout === "static" ? /* @__PURE__ */ React8.createElement(LatLng, value3) : /* @__PURE__ */ React8.createElement("div", {
1327
+ }), layout === "static" ? /* @__PURE__ */ React7.createElement(LatLng, value3) : /* @__PURE__ */ React7.createElement("div", {
1384
1328
  role: "none",
1385
- className: "grid grid-cols-2 gap-2"
1386
- }, /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(Input4.Root, null, layout !== "inline" && /* @__PURE__ */ React8.createElement(Input4.Label, null, t("latitude label")), /* @__PURE__ */ React8.createElement(Input4.TextInput, {
1329
+ className: "grid grid-cols-2 gap-form-gap"
1330
+ }, /* @__PURE__ */ React7.createElement("div", null, /* @__PURE__ */ React7.createElement(Input3.Root, null, layout !== "inline" && /* @__PURE__ */ React7.createElement(Input3.Label, null, t("latitude.label")), /* @__PURE__ */ React7.createElement(Input3.TextInput, {
1387
1331
  type: "number",
1388
1332
  step: "0.00001",
1389
1333
  min: "-90",
1390
1334
  max: "90",
1391
1335
  disabled: !!readonly,
1392
- placeholder: t("latitude placeholder"),
1336
+ placeholder: t("latitude.placeholder"),
1393
1337
  value: latitudeText ?? "",
1394
1338
  onChange: handleChange("latitude", setLatitudeText),
1395
1339
  onBlur
1396
- }))), /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(Input4.Root, null, layout !== "inline" && /* @__PURE__ */ React8.createElement(Input4.Label, null, t("longitude label")), /* @__PURE__ */ React8.createElement(Input4.TextInput, {
1340
+ }))), /* @__PURE__ */ React7.createElement("div", null, /* @__PURE__ */ React7.createElement(Input3.Root, null, layout !== "inline" && /* @__PURE__ */ React7.createElement(Input3.Label, null, t("longitude.label")), /* @__PURE__ */ React7.createElement(Input3.TextInput, {
1397
1341
  type: "number",
1398
1342
  step: "0.00001",
1399
1343
  min: "-180",
1400
1344
  max: "180",
1401
1345
  disabled: !!readonly,
1402
- placeholder: t("longitude placeholder"),
1346
+ placeholder: t("longitude.placeholder"),
1403
1347
  value: longitudeText ?? "",
1404
1348
  onChange: handleChange("longitude", setLongitudeText),
1405
1349
  onBlur
@@ -1408,18 +1352,18 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
1408
1352
  var LatLng = ({ latitude = 0, longitude = 0 }) => {
1409
1353
  const latHem = latitude >= 0 ? "N" : "S";
1410
1354
  const lngHem = longitude >= 0 ? "E" : "W";
1411
- return /* @__PURE__ */ React8.createElement("span", {
1412
- className: "inline-flex items-center gap-1"
1413
- }, /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement("span", null, Math.abs(latitude).toFixed(5)), /* @__PURE__ */ React8.createElement("span", {
1355
+ return /* @__PURE__ */ React7.createElement("span", {
1356
+ className: "inline-flex items-center gap-form-gap"
1357
+ }, /* @__PURE__ */ React7.createElement("span", null, /* @__PURE__ */ React7.createElement("span", null, Math.abs(latitude).toFixed(5)), /* @__PURE__ */ React7.createElement("span", {
1414
1358
  className: "text-subdued"
1415
- }, "\xB0", latHem)), /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement("span", null, Math.abs(longitude).toFixed(5)), /* @__PURE__ */ React8.createElement("span", {
1359
+ }, "\xB0", latHem)), /* @__PURE__ */ React7.createElement("span", null, /* @__PURE__ */ React7.createElement("span", null, Math.abs(longitude).toFixed(5)), /* @__PURE__ */ React7.createElement("span", {
1416
1360
  className: "text-subdued"
1417
1361
  }, "\xB0", lngHem)));
1418
1362
  };
1419
1363
 
1420
1364
  // src/components/Form/fields/MarkdownField.tsx
1421
- import React9, { useCallback as useCallback6, useEffect as useEffect5, useRef as useRef2 } from "react";
1422
- import { Input as Input5 } from "@dxos/react-ui";
1365
+ import React8, { useCallback as useCallback6, useEffect as useEffect5, useRef as useRef2 } from "react";
1366
+ import { Input as Input4 } from "@dxos/react-ui";
1423
1367
  var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, getValue, onValueChange, onBlur }) => {
1424
1368
  const { status, error } = getStatus();
1425
1369
  const textareaRef = useRef2(null);
@@ -1449,40 +1393,40 @@ var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, ge
1449
1393
  if ((readonly || layout === "static") && !value3) {
1450
1394
  return null;
1451
1395
  }
1452
- return /* @__PURE__ */ React9.createElement(Input5.Root, {
1396
+ return /* @__PURE__ */ React8.createElement(Input4.Root, {
1453
1397
  validationValence: status
1454
- }, layout !== "inline" && /* @__PURE__ */ React9.createElement(FormFieldLabel, {
1398
+ }, layout !== "inline" && /* @__PURE__ */ React8.createElement(FormFieldLabel, {
1455
1399
  error,
1456
1400
  readonly,
1457
1401
  label
1458
- }), layout === "static" ? /* @__PURE__ */ React9.createElement("p", null, value3) : /* @__PURE__ */ React9.createElement(Input5.TextArea, {
1402
+ }), layout === "static" ? /* @__PURE__ */ React8.createElement("p", null, value3) : /* @__PURE__ */ React8.createElement(Input4.TextArea, {
1459
1403
  ref: textareaRef,
1460
1404
  disabled: !!readonly,
1461
1405
  placeholder,
1462
1406
  value: value3 ?? "",
1463
- classNames: "min-bs-auto max-bs-40 overflow-auto",
1407
+ classNames: "min-h-auto max-h-40 overflow-auto",
1464
1408
  onChange: handleChange,
1465
1409
  onBlur,
1466
1410
  style: {
1467
1411
  resize: "none"
1468
1412
  },
1469
1413
  spellCheck: false
1470
- }), layout === "full" && /* @__PURE__ */ React9.createElement(Input5.Validation, null, error));
1414
+ }), layout === "full" && /* @__PURE__ */ React8.createElement(Input4.Validation, null, error));
1471
1415
  };
1472
1416
 
1473
1417
  // src/components/Form/fields/NumberField.tsx
1474
- import React10, { useCallback as useCallback7 } from "react";
1475
- import { Input as Input6 } from "@dxos/react-ui";
1418
+ import React9, { useCallback as useCallback7 } from "react";
1419
+ import { Input as Input5 } from "@dxos/react-ui";
1476
1420
  import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
1477
1421
  var NumberField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
1478
1422
  const handleChange = useCallback7((event) => onValueChange(type, safeParseFloat2(event.target.value) || 0), [
1479
1423
  type,
1480
1424
  onValueChange
1481
1425
  ]);
1482
- return /* @__PURE__ */ React10.createElement(FormFieldWrapper, {
1426
+ return /* @__PURE__ */ React9.createElement(FormFieldWrapper, {
1483
1427
  readonly,
1484
1428
  ...props
1485
- }, ({ value: value3 = "" }) => /* @__PURE__ */ React10.createElement(Input6.TextInput, {
1429
+ }, ({ value: value3 = "" }) => /* @__PURE__ */ React9.createElement(Input5.TextInput, {
1486
1430
  type: "number",
1487
1431
  disabled: !!readonly,
1488
1432
  placeholder,
@@ -1494,39 +1438,23 @@ var NumberField = ({ type, readonly, placeholder, onValueChange, onBlur, ...prop
1494
1438
 
1495
1439
  // src/components/Form/fields/RefField.tsx
1496
1440
  import "@dxos/lit-ui/dx-tag-picker.pcss";
1497
- import React12, { useCallback as useCallback9, useMemo as useMemo6 } from "react";
1498
- import { Entity, Filter, Ref as Ref2 } from "@dxos/echo";
1499
- import { ReferenceAnnotationId } from "@dxos/echo/internal";
1441
+ import React11, { useCallback as useCallback9, useMemo as useMemo6 } from "react";
1442
+ import { Entity, Filter, Obj, Ref as Ref2, Type } from "@dxos/echo";
1443
+ import { ReferenceAnnotationId as ReferenceAnnotationId2 } from "@dxos/echo/internal";
1500
1444
  import { useQuery, useSchema as useSchema$ } from "@dxos/echo-react";
1501
- import { findAnnotation } from "@dxos/effect";
1445
+ import { findAnnotation as findAnnotation2 } from "@dxos/effect";
1502
1446
  import { DXN } from "@dxos/keys";
1503
1447
  import { DxAnchor } from "@dxos/lit-ui/react";
1504
- import { Button as Button2, Icon as Icon2, Input as Input7, useTranslation as useTranslation7 } from "@dxos/react-ui";
1505
- import { descriptionText, mx as mx5 } from "@dxos/ui-theme";
1448
+ import { Button, Icon as Icon2, Input as Input6, useTranslation as useTranslation6 } from "@dxos/react-ui";
1449
+ import { ParentLabelAnnotationId } from "@dxos/schema";
1450
+ import { mx as mx2 } from "@dxos/ui-theme";
1506
1451
 
1507
1452
  // src/components/ObjectPicker/ObjectPicker.tsx
1508
- import React11, { forwardRef as forwardRef2, useCallback as useCallback8, useState as useState3 } from "react";
1509
- import { Popover, useTranslation as useTranslation6 } from "@dxos/react-ui";
1510
- import { Combobox, useSearchListInput, useSearchListResults } from "@dxos/react-ui-searchlist";
1511
- var CreateItem = ({ createOptionLabel, createOptionIcon, onCreateItemSelect }) => {
1512
- const { t } = useTranslation6(translationKey);
1513
- const { query } = useSearchListInput();
1514
- return /* @__PURE__ */ React11.createElement(Combobox.Item, {
1515
- value: "__create__",
1516
- label: t(createOptionLabel[0], {
1517
- ns: createOptionLabel[1].ns,
1518
- text: query
1519
- }),
1520
- icon: createOptionIcon,
1521
- classNames: "flex items-center gap-2",
1522
- closeOnSelect: false,
1523
- onSelect: () => {
1524
- onCreateItemSelect(query);
1525
- }
1526
- });
1527
- };
1528
- var ObjectPickerContent = /* @__PURE__ */ forwardRef2(({ options, selectedIds, createSchema, createOptionLabel, createOptionIcon, createInitialValuePath, onSelect, onCreate, ...props }, ref) => {
1529
- const { t } = useTranslation6(translationKey);
1453
+ import React10, { forwardRef, useCallback as useCallback8, useState as useState3 } from "react";
1454
+ import { Popover, useTranslation as useTranslation5 } from "@dxos/react-ui";
1455
+ import { Combobox, useSearchListInput, useSearchListResults } from "@dxos/react-ui-search";
1456
+ var ObjectPickerContent = /* @__PURE__ */ forwardRef(({ options, selectedIds, createSchema, createOptionLabel, createOptionIcon, createInitialValuePath, createFieldMap, onSelect, onCreate, ...props }, forwardedRef) => {
1457
+ const { t } = useTranslation5(translationKey);
1530
1458
  const [showForm, setShowForm] = useState3(false);
1531
1459
  const [formInitialValue, setFormInitialValue] = useState3("");
1532
1460
  const { results, handleSearch } = useSearchListResults({
@@ -1555,39 +1483,66 @@ var ObjectPickerContent = /* @__PURE__ */ forwardRef2(({ options, selectedIds, c
1555
1483
  }, [
1556
1484
  createSchema
1557
1485
  ]);
1558
- return /* @__PURE__ */ React11.createElement(Combobox.Content, {
1486
+ if (showForm && createSchema) {
1487
+ return /* @__PURE__ */ React10.createElement(Combobox.Content, {
1488
+ ...props,
1489
+ onSearch: handleSearch,
1490
+ onKeyDownCapture: handleKeyDown,
1491
+ ref: forwardedRef
1492
+ }, /* @__PURE__ */ React10.createElement(Popover.Viewport, null, /* @__PURE__ */ React10.createElement(Form.Root, {
1493
+ testId: "create-referenced-object-form",
1494
+ schema: createSchema,
1495
+ defaultValues: createInitialValuePath ? {
1496
+ [createInitialValuePath]: formInitialValue
1497
+ } : {},
1498
+ fieldMap: createFieldMap,
1499
+ onSave: handleFormSave,
1500
+ onCancel: handleFormCancel
1501
+ }, /* @__PURE__ */ React10.createElement(Form.Viewport, null, /* @__PURE__ */ React10.createElement(Form.Content, null, /* @__PURE__ */ React10.createElement(Form.FieldSet, null), /* @__PURE__ */ React10.createElement(Form.Actions, null))))), /* @__PURE__ */ React10.createElement(Combobox.Arrow, null));
1502
+ }
1503
+ return /* @__PURE__ */ React10.createElement(Combobox.Content, {
1559
1504
  ...props,
1560
- ref,
1561
1505
  onSearch: handleSearch,
1562
- onKeyDownCapture: handleKeyDown
1563
- }, showForm && createSchema ? /* @__PURE__ */ React11.createElement(Popover.Viewport, null, /* @__PURE__ */ React11.createElement(Form.Root, {
1564
- testId: "create-referenced-object-form",
1565
- schema: createSchema,
1566
- values: createInitialValuePath ? {
1567
- [createInitialValuePath]: formInitialValue
1568
- } : {},
1569
- onSave: handleFormSave,
1570
- onCancel: handleFormCancel
1571
- }, /* @__PURE__ */ React11.createElement(Form.Viewport, null, /* @__PURE__ */ React11.createElement(Form.Content, null, /* @__PURE__ */ React11.createElement(Form.FieldSet, null), /* @__PURE__ */ React11.createElement(Form.Actions, null))))) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Combobox.Input, {
1572
- placeholder: t("ref field combobox input placeholder"),
1506
+ onKeyDownCapture: handleKeyDown,
1507
+ ref: forwardedRef
1508
+ }, /* @__PURE__ */ React10.createElement(Combobox.Input, {
1509
+ placeholder: t("ref-field-combobox-input.placeholder"),
1573
1510
  autoFocus: true
1574
- }), /* @__PURE__ */ React11.createElement(Combobox.List, null, results.map((option) => /* @__PURE__ */ React11.createElement(Combobox.Item, {
1511
+ }), /* @__PURE__ */ React10.createElement(Combobox.List, null, results.map((option) => /* @__PURE__ */ React10.createElement(Combobox.Item, {
1575
1512
  key: option.id,
1576
1513
  value: option.id,
1577
1514
  label: option.label,
1578
1515
  checked: selectedIds?.includes(option.id),
1579
1516
  onSelect: () => onSelect(option.id),
1580
1517
  classNames: "flex items-center gap-2"
1581
- })), createOptionLabel && createOptionIcon && createSchema && onCreate && /* @__PURE__ */ React11.createElement(CreateItem, {
1518
+ })), createSchema && onCreate && /* @__PURE__ */ React10.createElement(CreateItem, {
1582
1519
  createOptionLabel,
1583
- createOptionIcon,
1520
+ createOptionIcon: createOptionIcon ?? "ph--plus--regular",
1584
1521
  onCreateItemSelect: (query) => {
1585
1522
  setFormInitialValue(query);
1586
1523
  setShowForm(true);
1587
1524
  }
1588
- }))), /* @__PURE__ */ React11.createElement(Combobox.Arrow, null));
1525
+ })), /* @__PURE__ */ React10.createElement(Combobox.Arrow, null));
1589
1526
  });
1590
- ObjectPickerContent.displayName = "ObjectPickerContent";
1527
+ var CreateItem = ({ createOptionLabel, createOptionIcon, onCreateItemSelect }) => {
1528
+ const { t } = useTranslation5(translationKey);
1529
+ const { query } = useSearchListInput();
1530
+ const label = createOptionLabel ? t(createOptionLabel[0], {
1531
+ ns: createOptionLabel[1].ns,
1532
+ text: query
1533
+ }) : t("create-option.label");
1534
+ return /* @__PURE__ */ React10.createElement(Combobox.Item, {
1535
+ value: "__create__",
1536
+ label,
1537
+ icon: createOptionIcon,
1538
+ classNames: "flex items-center gap-2",
1539
+ closeOnSelect: false,
1540
+ onSelect: () => {
1541
+ onCreateItemSelect(query);
1542
+ }
1543
+ });
1544
+ };
1545
+ ObjectPickerContent.displayName = "ObjectPicker.Content";
1591
1546
  var ObjectPicker = {
1592
1547
  Root: Combobox.Root,
1593
1548
  Portal: Combobox.Portal,
@@ -1600,26 +1555,33 @@ var ObjectPicker = {
1600
1555
  var isRefSnapshot = (val) => {
1601
1556
  return typeof val === "object" && typeof val?.["/"] === "string";
1602
1557
  };
1603
- var defaultGetOptions = (results) => results.map((result) => {
1558
+ var defaultGetOptions = (results, { parentLabel } = {}) => results.map((result) => {
1604
1559
  const id = Entity.getDXN(result).toString();
1605
- const label = Entity.getLabel(result);
1560
+ const parent = parentLabel ? Obj.getParent(result) : void 0;
1561
+ const label = parent ? Entity.getLabel(parent) : Entity.getLabel(result);
1606
1562
  return {
1607
1563
  id,
1608
1564
  label: label ?? id
1609
1565
  };
1610
1566
  });
1611
- var defaultResultsHook = (db, typename) => useQuery(db, typename ? Filter.typename(typename) : Filter.nothing());
1567
+ var defaultResultsHook = (db, typename) => useQuery(db, typename ? typename === Type.getTypename(Obj.Unknown) ? Filter.everything() : Filter.typename(typename) : Filter.nothing());
1612
1568
  var RefField = (props) => {
1613
- const { type, readonly, label, placeholder, layout, getStatus, getValue, createOptionLabel, createOptionIcon, createInitialValuePath, db, resultsHook: useResults = defaultResultsHook, schemaHook: useSchema = useSchema$, getOptions: getOptions2 = defaultGetOptions, onCreate, onValueChange } = props;
1614
- const { t } = useTranslation7(translationKey);
1569
+ const { type, readonly, label, placeholder, layout, getStatus, getValue, createOptionLabel, createOptionIcon, createInitialValuePath, createFieldMap, db, resultsHook: useResults = defaultResultsHook, schemaHook: useSchema = useSchema$, getOptions: getOptions2 = defaultGetOptions, onCreate, onValueChange } = props;
1570
+ const { t } = useTranslation6(translationKey);
1615
1571
  const { status, error } = getStatus();
1616
- const typename = useMemo6(() => type ? findAnnotation(type, ReferenceAnnotationId)?.typename : void 0, [
1572
+ const typename = useMemo6(() => type ? findAnnotation2(type, ReferenceAnnotationId2)?.typename : void 0, [
1617
1573
  type
1618
1574
  ]);
1619
1575
  const results = useResults(db, typename);
1620
- const options = useMemo6(() => getOptions2(results), [
1576
+ const options = useMemo6(() => {
1577
+ const parentLabel = type ? findAnnotation2(type, ParentLabelAnnotationId) === true : false;
1578
+ return getOptions2(results, {
1579
+ parentLabel
1580
+ });
1581
+ }, [
1621
1582
  results,
1622
- getOptions2
1583
+ getOptions2,
1584
+ type
1623
1585
  ]);
1624
1586
  const handleGetValue = useCallback9(() => {
1625
1587
  const formValue = getValue();
@@ -1676,55 +1638,56 @@ var RefField = (props) => {
1676
1638
  if (!typename || (readonly || layout === "static") && !item) {
1677
1639
  return null;
1678
1640
  }
1679
- return /* @__PURE__ */ React12.createElement(Input7.Root, {
1641
+ return /* @__PURE__ */ React11.createElement(Input6.Root, {
1680
1642
  validationValence: status
1681
- }, layout !== "inline" && /* @__PURE__ */ React12.createElement(FormFieldLabel, {
1643
+ }, layout !== "inline" && /* @__PURE__ */ React11.createElement(FormFieldLabel, {
1682
1644
  error,
1683
1645
  readonly,
1684
1646
  label
1685
- }), /* @__PURE__ */ React12.createElement("div", null, readonly ? !item ? /* @__PURE__ */ React12.createElement("p", {
1686
- className: mx5(descriptionText, "mbe-2")
1687
- }, t("empty readonly ref field label")) : /* @__PURE__ */ React12.createElement(DxAnchor, {
1647
+ }), /* @__PURE__ */ React11.createElement("div", null, readonly ? !item ? /* @__PURE__ */ React11.createElement("p", {
1648
+ className: mx2("text-description", "mb-2")
1649
+ }, t("empty-readonly-ref-field.label")) : /* @__PURE__ */ React11.createElement(DxAnchor, {
1688
1650
  key: item.id,
1689
- refid: item.id,
1690
- rootclassname: "mie-1"
1691
- }, item.label) : /* @__PURE__ */ React12.createElement(ObjectPicker.Root, null, /* @__PURE__ */ React12.createElement(ObjectPicker.Trigger, {
1651
+ dxn: item.id,
1652
+ rootclassname: "me-1"
1653
+ }, item.label) : /* @__PURE__ */ React11.createElement(ObjectPicker.Root, null, /* @__PURE__ */ React11.createElement(ObjectPicker.Trigger, {
1692
1654
  asChild: true,
1693
1655
  classNames: "p-0"
1694
- }, item ? /* @__PURE__ */ React12.createElement("div", {
1695
- className: "flex gap-2 is-full"
1696
- }, /* @__PURE__ */ React12.createElement(Input7.Root, {
1656
+ }, item ? /* @__PURE__ */ React11.createElement("div", {
1657
+ className: "flex gap-form-gap w-full"
1658
+ }, /* @__PURE__ */ React11.createElement(Input6.Root, {
1697
1659
  key: item.id
1698
- }, /* @__PURE__ */ React12.createElement(Input7.TextInput, {
1660
+ }, /* @__PURE__ */ React11.createElement(Input6.TextInput, {
1699
1661
  value: item.label,
1700
1662
  readOnly: true,
1701
- classNames: "is-full"
1702
- }))) : /* @__PURE__ */ React12.createElement(Button2, {
1703
- classNames: "is-full text-start gap-2"
1704
- }, /* @__PURE__ */ React12.createElement("div", {
1663
+ classNames: "w-full"
1664
+ }))) : /* @__PURE__ */ React11.createElement(Button, {
1665
+ classNames: "w-full text-start gap-form-gap"
1666
+ }, /* @__PURE__ */ React11.createElement("div", {
1705
1667
  role: "none",
1706
1668
  className: "grow overflow-hidden"
1707
- }, /* @__PURE__ */ React12.createElement("span", {
1669
+ }, /* @__PURE__ */ React11.createElement("span", {
1708
1670
  className: "flex truncate text-description"
1709
- }, placeholder ?? t("ref field placeholder"))), /* @__PURE__ */ React12.createElement(Icon2, {
1671
+ }, placeholder ?? t("ref-field.placeholder"))), /* @__PURE__ */ React11.createElement(Icon2, {
1710
1672
  size: 3,
1711
1673
  icon: "ph--caret-down--bold"
1712
- }))), /* @__PURE__ */ React12.createElement(ObjectPicker.Portal, null, /* @__PURE__ */ React12.createElement(ObjectPicker.Content, {
1713
- classNames: "popover-card-width",
1674
+ }))), /* @__PURE__ */ React11.createElement(ObjectPicker.Portal, null, /* @__PURE__ */ React11.createElement(ObjectPicker.Content, {
1675
+ classNames: "dx-card-popover-width",
1714
1676
  options,
1715
1677
  selectedIds,
1716
1678
  createSchema: createSchema && omitId(createSchema),
1717
1679
  createOptionLabel,
1718
1680
  createOptionIcon,
1719
1681
  createInitialValuePath,
1682
+ createFieldMap,
1720
1683
  onCreate: handleCreate,
1721
1684
  onSelect: handleSelect
1722
- })))), layout === "full" && /* @__PURE__ */ React12.createElement(Input7.DescriptionAndValidation, null, error));
1685
+ })))), layout === "full" && /* @__PURE__ */ React11.createElement(Input6.DescriptionAndValidation, null, error));
1723
1686
  };
1724
1687
 
1725
1688
  // src/components/Form/fields/SelectField.tsx
1726
- import React13, { useCallback as useCallback10 } from "react";
1727
- import { Input as Input8, Select } from "@dxos/react-ui";
1689
+ import React12, { useCallback as useCallback10 } from "react";
1690
+ import { Input as Input7, Select } from "@dxos/react-ui";
1728
1691
  var SelectField = ({ type, readonly, label, layout, placeholder, options, getStatus, getValue, onValueChange }) => {
1729
1692
  const { status, error } = getStatus();
1730
1693
  const value3 = getValue();
@@ -1735,37 +1698,37 @@ var SelectField = ({ type, readonly, label, layout, placeholder, options, getSta
1735
1698
  if ((readonly || layout === "static") && value3 == null) {
1736
1699
  return null;
1737
1700
  }
1738
- return /* @__PURE__ */ React13.createElement(Input8.Root, {
1701
+ return /* @__PURE__ */ React12.createElement(Input7.Root, {
1739
1702
  validationValence: status
1740
- }, layout !== "inline" && /* @__PURE__ */ React13.createElement(FormFieldLabel, {
1703
+ }, layout !== "inline" && /* @__PURE__ */ React12.createElement(FormFieldLabel, {
1741
1704
  error,
1742
1705
  readonly,
1743
1706
  label
1744
- }), layout === "static" ? /* @__PURE__ */ React13.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value3)?.label ?? String(value3)) : /* @__PURE__ */ React13.createElement(Select.Root, {
1707
+ }), layout === "static" ? /* @__PURE__ */ React12.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value3)?.label ?? String(value3)) : /* @__PURE__ */ React12.createElement(Select.Root, {
1745
1708
  value: value3,
1746
1709
  onValueChange: handleValueChange
1747
- }, /* @__PURE__ */ React13.createElement(Select.TriggerButton, {
1748
- classNames: "is-full",
1710
+ }, /* @__PURE__ */ React12.createElement(Select.TriggerButton, {
1711
+ classNames: "w-full",
1749
1712
  disabled: !!readonly,
1750
1713
  placeholder
1751
- }), /* @__PURE__ */ React13.createElement(Select.Portal, null, /* @__PURE__ */ React13.createElement(Select.Content, null, /* @__PURE__ */ React13.createElement(Select.Viewport, null, options?.map(({ value: value4, label: label2 }) => (
1714
+ }), /* @__PURE__ */ React12.createElement(Select.Portal, null, /* @__PURE__ */ React12.createElement(Select.Content, null, /* @__PURE__ */ React12.createElement(Select.Viewport, null, options?.map(({ value: value4, label: label2 }) => (
1752
1715
  // NOTE: Numeric values are converted to and from strings.
1753
- /* @__PURE__ */ React13.createElement(Select.Option, {
1716
+ /* @__PURE__ */ React12.createElement(Select.Option, {
1754
1717
  key: String(value4),
1755
1718
  value: String(value4)
1756
1719
  }, label2 ?? String(value4))
1757
- ))), /* @__PURE__ */ React13.createElement(Select.Arrow, null)))), layout === "full" && /* @__PURE__ */ React13.createElement(Input8.DescriptionAndValidation, null, error));
1720
+ ))), /* @__PURE__ */ React12.createElement(Select.Arrow, null)))), layout === "full" && /* @__PURE__ */ React12.createElement(Input7.DescriptionAndValidation, null, error));
1758
1721
  };
1759
1722
 
1760
1723
  // src/components/Form/fields/SelectOptionField.tsx
1761
- import React14, { useCallback as useCallback11, useEffect as useEffect6, useRef as useRef3, useState as useState4 } from "react";
1724
+ import React13, { useCallback as useCallback11, useEffect as useEffect6, useRef as useRef3, useState as useState4 } from "react";
1762
1725
  import { PublicKey } from "@dxos/keys";
1763
- import { IconButton as IconButton3, Input as Input9, Tag, useTranslation as useTranslation8 } from "@dxos/react-ui";
1726
+ import { IconButton as IconButton3, Input as Input8, Tag, useTranslation as useTranslation7 } from "@dxos/react-ui";
1764
1727
  import { List } from "@dxos/react-ui-list";
1765
1728
  import { HuePicker } from "@dxos/react-ui-pickers";
1766
1729
  import { hues, osTranslations, subtleHover } from "@dxos/ui-theme";
1767
1730
  var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueChange }) => {
1768
- const { t } = useTranslation8(translationKey);
1731
+ const { t } = useTranslation7(translationKey);
1769
1732
  const { status, error } = getStatus();
1770
1733
  const [selected, setSelectedId] = useState4(null);
1771
1734
  const [isNewOption, setIsNewOption] = useState4(false);
@@ -1871,42 +1834,42 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
1871
1834
  selected,
1872
1835
  isNewOption
1873
1836
  ]);
1874
- return /* @__PURE__ */ React14.createElement(Input9.Root, {
1837
+ return /* @__PURE__ */ React13.createElement(Input8.Root, {
1875
1838
  validationValence: status
1876
- }, /* @__PURE__ */ React14.createElement(FormFieldLabel, {
1839
+ }, /* @__PURE__ */ React13.createElement(FormFieldLabel, {
1877
1840
  error,
1878
1841
  readonly,
1879
1842
  label
1880
- }), /* @__PURE__ */ React14.createElement("div", {
1843
+ }), /* @__PURE__ */ React13.createElement("div", {
1881
1844
  role: "none"
1882
- }, options && /* @__PURE__ */ React14.createElement(List.Root, {
1845
+ }, options && /* @__PURE__ */ React13.createElement(List.Root, {
1883
1846
  items: options,
1884
1847
  isItem: (_item) => true,
1885
1848
  onMove: readonly ? void 0 : handleMove,
1886
1849
  readonly: !!readonly
1887
- }, ({ items }) => /* @__PURE__ */ React14.createElement("div", {
1850
+ }, ({ items }) => /* @__PURE__ */ React13.createElement("div", {
1888
1851
  role: "list",
1889
- className: "is-full overflow-auto"
1890
- }, items?.map((item) => /* @__PURE__ */ React14.createElement("div", {
1852
+ className: "w-full overflow-auto"
1853
+ }, items?.map((item) => /* @__PURE__ */ React13.createElement("div", {
1891
1854
  key: item.id
1892
- }, /* @__PURE__ */ React14.createElement(List.Item, {
1855
+ }, /* @__PURE__ */ React13.createElement(List.Item, {
1893
1856
  role: "button",
1894
1857
  item,
1895
1858
  classNames: [
1896
1859
  subtleHover,
1897
- "flex flex-col cursor-pointer rounded-sm"
1860
+ "flex flex-col cursor-pointer rounded-xs"
1898
1861
  ],
1899
1862
  "aria-expanded": selected === item.id
1900
- }, /* @__PURE__ */ React14.createElement("div", {
1863
+ }, /* @__PURE__ */ React13.createElement("div", {
1901
1864
  className: "flex items-center"
1902
- }, /* @__PURE__ */ React14.createElement(List.ItemDragHandle, {
1865
+ }, /* @__PURE__ */ React13.createElement(List.ItemDragHandle, {
1903
1866
  disabled: !!readonly
1904
- }), /* @__PURE__ */ React14.createElement(List.ItemTitle, {
1867
+ }), /* @__PURE__ */ React13.createElement(List.ItemTitle, {
1905
1868
  onClick: () => handleClick(item.id),
1906
1869
  classNames: "flex-1"
1907
- }, /* @__PURE__ */ React14.createElement(Tag, {
1870
+ }, /* @__PURE__ */ React13.createElement(Tag, {
1908
1871
  palette: item.color
1909
- }, item.title || "\u200B")), /* @__PURE__ */ React14.createElement(IconButton3, {
1872
+ }, item.title || "\u200B")), /* @__PURE__ */ React13.createElement(IconButton3, {
1910
1873
  iconOnly: true,
1911
1874
  variant: "ghost",
1912
1875
  label: t(selected === item.id ? "collapse label" : "expand label", {
@@ -1914,52 +1877,52 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
1914
1877
  }),
1915
1878
  icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
1916
1879
  onClick: () => handleClick(item.id)
1917
- })), selected === item.id && /* @__PURE__ */ React14.createElement("div", {
1918
- className: "pli-cardSpacingInline plb-cardSpacingBlock flex flex-col gap-1 density-fine"
1919
- }, /* @__PURE__ */ React14.createElement(Input9.Label, {
1880
+ })), selected === item.id && /* @__PURE__ */ React13.createElement("div", {
1881
+ className: "flex flex-col p-form-padding gap-form-gap dx-density-fine"
1882
+ }, /* @__PURE__ */ React13.createElement(Input8.Label, {
1920
1883
  classNames: "text-xs"
1921
- }, t("select option label")), /* @__PURE__ */ React14.createElement("div", {
1922
- className: "grid grid-cols-[1fr_min-content_min-content] gap-1"
1923
- }, /* @__PURE__ */ React14.createElement(Input9.TextInput, {
1884
+ }, t("select-option.label")), /* @__PURE__ */ React13.createElement("div", {
1885
+ className: "grid grid-cols-[1fr_min-content_min-content] gap-form-gap"
1886
+ }, /* @__PURE__ */ React13.createElement(Input8.TextInput, {
1924
1887
  disabled: !!readonly,
1925
- placeholder: t("select option label placeholder"),
1888
+ placeholder: t("select-option-label.placeholder"),
1926
1889
  ref: selected === item.id ? inputRef : void 0,
1927
1890
  value: item.title,
1928
1891
  onChange: handleTitleChange(item.id),
1929
1892
  onKeyDown: handleKeyDown,
1930
1893
  classNames: "flex-1"
1931
- }), /* @__PURE__ */ React14.createElement(HuePicker, {
1894
+ }), /* @__PURE__ */ React13.createElement(HuePicker, {
1932
1895
  disabled: !!readonly,
1933
1896
  value: item.color,
1934
1897
  onChange: handleColorChange(item.id)
1935
- }), /* @__PURE__ */ React14.createElement(IconButton3, {
1898
+ }), /* @__PURE__ */ React13.createElement(IconButton3, {
1936
1899
  disabled: !!readonly,
1937
1900
  icon: "ph--trash--fill",
1938
1901
  iconOnly: true,
1939
- label: t("select option delete"),
1902
+ label: t("select-option-delete.button"),
1940
1903
  onClick: () => handleDelete(item.id)
1941
- })))))), /* @__PURE__ */ React14.createElement(IconButton3, {
1904
+ })))))), /* @__PURE__ */ React13.createElement(IconButton3, {
1942
1905
  variant: "ghost",
1943
1906
  icon: "ph--plus--regular",
1944
- label: t("select option add"),
1907
+ label: t("select-option-add.button"),
1945
1908
  onClick: handleAdd,
1946
1909
  disabled: !!readonly,
1947
- classNames: "is-full"
1910
+ classNames: "w-full"
1948
1911
  })))));
1949
1912
  };
1950
1913
 
1951
1914
  // src/components/Form/fields/TextField.tsx
1952
- import React15, { useCallback as useCallback12 } from "react";
1953
- import { Input as Input10 } from "@dxos/react-ui";
1915
+ import React14, { useCallback as useCallback12 } from "react";
1916
+ import { Input as Input9 } from "@dxos/react-ui";
1954
1917
  var TextField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
1955
1918
  const handleChange = useCallback12((event) => onValueChange(type, event.target.value), [
1956
1919
  type,
1957
1920
  onValueChange
1958
1921
  ]);
1959
- return /* @__PURE__ */ React15.createElement(FormFieldWrapper, {
1922
+ return /* @__PURE__ */ React14.createElement(FormFieldWrapper, {
1960
1923
  readonly,
1961
1924
  ...props
1962
- }, ({ value: value3 = "" }) => /* @__PURE__ */ React15.createElement(Input10.TextInput, {
1925
+ }, ({ value: value3 = "" }) => /* @__PURE__ */ React14.createElement(Input9.TextInput, {
1963
1926
  noAutoFill: true,
1964
1927
  disabled: !!readonly,
1965
1928
  placeholder,
@@ -1970,17 +1933,17 @@ var TextField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props
1970
1933
  };
1971
1934
 
1972
1935
  // src/components/Form/fields/TextAreaField.tsx
1973
- import React16, { useCallback as useCallback13 } from "react";
1974
- import { Input as Input11 } from "@dxos/react-ui";
1936
+ import React15, { useCallback as useCallback13 } from "react";
1937
+ import { Input as Input10 } from "@dxos/react-ui";
1975
1938
  var TextAreaField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
1976
1939
  const handleChange = useCallback13((event) => onValueChange(type, event.target.value), [
1977
1940
  type,
1978
1941
  onValueChange
1979
1942
  ]);
1980
- return /* @__PURE__ */ React16.createElement(FormFieldWrapper, {
1943
+ return /* @__PURE__ */ React15.createElement(FormFieldWrapper, {
1981
1944
  readonly,
1982
1945
  ...props
1983
- }, ({ value: value3 = "" }) => /* @__PURE__ */ React16.createElement(Input11.TextArea, {
1946
+ }, ({ value: value3 = "" }) => /* @__PURE__ */ React15.createElement(Input10.TextArea, {
1984
1947
  rows: 3,
1985
1948
  disabled: !!readonly,
1986
1949
  placeholder,
@@ -1991,9 +1954,9 @@ var TextAreaField = ({ type, readonly, placeholder, onValueChange, onBlur, ...pr
1991
1954
  };
1992
1955
 
1993
1956
  // src/components/Form/fields/TupleField.tsx
1994
- import React17 from "react";
1995
- import { Input as Input12 } from "@dxos/react-ui";
1996
- import { mx as mx6 } from "@dxos/ui-theme";
1957
+ import React16 from "react";
1958
+ import { Input as Input11 } from "@dxos/react-ui";
1959
+ import { mx as mx3 } from "@dxos/ui-theme";
1997
1960
  import { safeParseFloat as safeParseFloat3 } from "@dxos/util";
1998
1961
  var gridCols = [
1999
1962
  "grid-cols-1",
@@ -2004,15 +1967,15 @@ var gridCols = [
2004
1967
  var TupleField = ({ binding, type, readonly, label, getStatus, getValue, onValueChange, onBlur }) => {
2005
1968
  const { status, error } = getStatus();
2006
1969
  const values = getValue() ?? {};
2007
- return /* @__PURE__ */ React17.createElement(Input12.Root, {
1970
+ return /* @__PURE__ */ React16.createElement(Input11.Root, {
2008
1971
  validationValence: status
2009
- }, /* @__PURE__ */ React17.createElement(FormFieldLabel, {
1972
+ }, /* @__PURE__ */ React16.createElement(FormFieldLabel, {
2010
1973
  error,
2011
1974
  readonly,
2012
1975
  label
2013
- }), /* @__PURE__ */ React17.createElement("div", {
2014
- className: mx6("grid gap-2", gridCols[binding.length - 1])
2015
- }, binding.map((prop) => /* @__PURE__ */ React17.createElement(Input12.TextInput, {
1976
+ }), /* @__PURE__ */ React16.createElement("div", {
1977
+ className: mx3("grid gap-form-gap", gridCols[binding.length - 1])
1978
+ }, binding.map((prop) => /* @__PURE__ */ React16.createElement(Input11.TextInput, {
2016
1979
  key: prop,
2017
1980
  type: "number",
2018
1981
  disabled: !!readonly,
@@ -2030,7 +1993,7 @@ var TupleField = ({ binding, type, readonly, label, getStatus, getValue, onValue
2030
1993
  // src/components/FieldEditor/FieldEditor.tsx
2031
1994
  var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
2032
1995
  var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCancel }) => {
2033
- const { t } = useTranslation9(translationKey);
1996
+ const { t } = useTranslation8(translationKey);
2034
1997
  const [props, setProps] = useState5(projection.getFieldProjection(field.id).props);
2035
1998
  useEffect7(() => setProps(projection.getFieldProjection(field.id).props), [
2036
1999
  field,
@@ -2061,26 +2024,26 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2061
2024
  fieldSchema: getFormatSchema(props?.format)
2062
2025
  });
2063
2026
  const fieldMap = useMemo7(() => ({
2064
- ["format"]: (props2) => /* @__PURE__ */ React18.createElement(SelectField, {
2027
+ ["format"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
2065
2028
  ...props2,
2066
2029
  options: FormatEnums.filter((value3) => value3 !== Format4.TypeFormat.None).map((value3) => ({
2067
2030
  value: value3,
2068
- label: t(`format ${value3}`)
2031
+ label: t(`format.${value3}.label`)
2069
2032
  }))
2070
2033
  }),
2071
- ["referenceSchema"]: (props2) => /* @__PURE__ */ React18.createElement(SelectField, {
2034
+ ["referenceSchema"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
2072
2035
  ...props2,
2073
2036
  options: schemas.map((schema) => ({
2074
2037
  value: schema.typename
2075
2038
  }))
2076
2039
  }),
2077
- ["referencePath"]: (props2) => /* @__PURE__ */ React18.createElement(SelectField, {
2040
+ ["referencePath"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
2078
2041
  ...props2,
2079
2042
  options: referenceSchema ? getFormProperties(referenceSchema.ast).sort((a, b) => a.name.toString().localeCompare(b.name.toString())).map((p) => ({
2080
2043
  value: p.name.toString()
2081
2044
  })) : []
2082
2045
  }),
2083
- ["options"]: (props2) => /* @__PURE__ */ React18.createElement(SelectOptionField, props2)
2046
+ ["options"]: (props2) => /* @__PURE__ */ React17.createElement(SelectOptionField, props2)
2084
2047
  }), [
2085
2048
  t,
2086
2049
  schemas,
@@ -2139,7 +2102,7 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2139
2102
  ]);
2140
2103
  const handleSave = useCallback14((props2) => {
2141
2104
  if (view) {
2142
- Obj3.change(view, () => {
2105
+ Obj2.change(view, () => {
2143
2106
  projection.setFieldProjection({
2144
2107
  field,
2145
2108
  props: props2
@@ -2169,13 +2132,13 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2169
2132
  props
2170
2133
  }, {
2171
2134
  F: __dxlog_file2,
2172
- L: 173,
2135
+ L: 172,
2173
2136
  S: void 0,
2174
2137
  C: (f, a) => f(...a)
2175
2138
  });
2176
2139
  return null;
2177
2140
  }
2178
- return /* @__PURE__ */ React18.createElement(Form.Root, {
2141
+ return /* @__PURE__ */ React17.createElement(Form.Root, {
2179
2142
  key: field.id,
2180
2143
  fieldMap,
2181
2144
  autoFocus: true,
@@ -2191,7 +2154,77 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2191
2154
  onValidate: handleValidate,
2192
2155
  onSave: handleSave,
2193
2156
  onCancel: handleCancel
2194
- }, /* @__PURE__ */ React18.createElement(Form.Content, null, /* @__PURE__ */ React18.createElement(Form.FieldSet, null), /* @__PURE__ */ React18.createElement(Form.Actions, null)));
2157
+ }, /* @__PURE__ */ React17.createElement(Form.Content, null, /* @__PURE__ */ React17.createElement(Form.FieldSet, null), /* @__PURE__ */ React17.createElement(Form.Actions, null)));
2158
+ };
2159
+
2160
+ // src/components/Settings/Settings.tsx
2161
+ import React18 from "react";
2162
+ import { Input as Input12, ScrollArea as ScrollArea2, toLocalizedString, useTranslation as useTranslation9 } from "@dxos/react-ui";
2163
+ import { composable as composable2, composableProps as composableProps2, mx as mx4 } from "@dxos/ui-theme";
2164
+ var SETTINGS_ROOT_NAME = "Settings.Root";
2165
+ var SETTINGS_VIEWPORT_NAME = "Settings.Viewport";
2166
+ var SETTINGS_SECTION_NAME = "Settings.Section";
2167
+ var SETTINGS_PANEL_NAME = "Settings.Panel";
2168
+ var SETTINGS_ITEM_NAME = "Settings.Item";
2169
+ var SettingsRoot = ({ children, classNames }) => {
2170
+ return /* @__PURE__ */ React18.createElement("div", {
2171
+ className: mx4("flex flex-col gap-2", classNames)
2172
+ }, children);
2173
+ };
2174
+ SettingsRoot.displayName = SETTINGS_ROOT_NAME;
2175
+ var SettingsViewport = composable2(({ children, ...props }, forwardedRef) => {
2176
+ return /* @__PURE__ */ React18.createElement(ScrollArea2.Root, {
2177
+ ...composableProps2(props),
2178
+ orientation: "vertical",
2179
+ centered: true,
2180
+ thin: true,
2181
+ ref: forwardedRef
2182
+ }, /* @__PURE__ */ React18.createElement(ScrollArea2.Viewport, {
2183
+ classNames: "px-4 pointer-coarse:px-2"
2184
+ }, /* @__PURE__ */ React18.createElement("div", {
2185
+ role: "none",
2186
+ className: "dx-document flex flex-col gap-2 py-4"
2187
+ }, children)));
2188
+ });
2189
+ SettingsViewport.displayName = SETTINGS_VIEWPORT_NAME;
2190
+ var SettingsSection = ({ title, description, children }) => {
2191
+ const { t } = useTranslation9(translationKey);
2192
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("h2", {
2193
+ className: "px-trim-md mt-trim-md text-xl"
2194
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React18.createElement("p", {
2195
+ className: "px-trim-md text-description"
2196
+ }, toLocalizedString(description, t)), /* @__PURE__ */ React18.createElement("div", {
2197
+ className: "w-full pt-trim-md space-y-trim-md"
2198
+ }, children));
2199
+ };
2200
+ SettingsSection.displayName = SETTINGS_SECTION_NAME;
2201
+ var SettingsPanel = ({ classNames, children }) => {
2202
+ return /* @__PURE__ */ React18.createElement("div", {
2203
+ role: "none",
2204
+ className: mx4("flex flex-col gap-3 p-trim-md border border-separator rounded-sm", classNames)
2205
+ }, children);
2206
+ };
2207
+ SettingsPanel.displayName = SETTINGS_PANEL_NAME;
2208
+ var SettingsItem = ({ title, description = "", children }) => {
2209
+ const { t } = useTranslation9(translationKey);
2210
+ return /* @__PURE__ */ React18.createElement(Input12.Root, null, /* @__PURE__ */ React18.createElement(SettingsPanel, {
2211
+ classNames: "grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-x-trim-lg gap-y-0"
2212
+ }, /* @__PURE__ */ React18.createElement(Input12.Label, {
2213
+ classNames: "pb-trim-md text-base-surface-text text-lg md:col-span-2"
2214
+ }, toLocalizedString(title, t)), /* @__PURE__ */ React18.createElement(Input12.DescriptionAndValidation, null, /* @__PURE__ */ React18.createElement(Input12.Description, {
2215
+ classNames: "text-base text-description"
2216
+ }, toLocalizedString(description, t))), /* @__PURE__ */ React18.createElement("div", {
2217
+ role: "none",
2218
+ className: "text-end py-1"
2219
+ }, children)));
2220
+ };
2221
+ SettingsItem.displayName = SETTINGS_ITEM_NAME;
2222
+ var Settings = {
2223
+ Root: SettingsRoot,
2224
+ Viewport: SettingsViewport,
2225
+ Section: SettingsSection,
2226
+ Panel: SettingsPanel,
2227
+ Item: SettingsItem
2195
2228
  };
2196
2229
 
2197
2230
  // src/components/ViewEditor/ViewEditor.tsx
@@ -2200,20 +2233,19 @@ import * as Array2 from "effect/Array";
2200
2233
  import * as Match2 from "effect/Match";
2201
2234
  import * as Option4 from "effect/Option";
2202
2235
  import * as Schema3 from "effect/Schema";
2203
- import React19, { forwardRef as forwardRef3, useCallback as useCallback15, useContext, useImperativeHandle, useMemo as useMemo8, useState as useState6 } from "react";
2204
- import { Filter as Filter2, Format as Format5, Obj as Obj4, Query, QueryAST } from "@dxos/echo";
2236
+ import React19, { forwardRef as forwardRef2, useCallback as useCallback15, useContext, useImperativeHandle, useMemo as useMemo8, useState as useState6 } from "react";
2237
+ import { Entity as Entity2, Feed, Filter as Filter2, Format as Format5, Obj as Obj3, Query, QueryAST, Ref as Ref3 } from "@dxos/echo";
2238
+ import { View } from "@dxos/echo";
2205
2239
  import { EchoSchema, isMutable, toJsonSchema } from "@dxos/echo/internal";
2206
2240
  import { invariant } from "@dxos/invariant";
2207
- import { useObject } from "@dxos/react-client/echo";
2208
- import { Callout, IconButton as IconButton4, Input as Input13, useTranslation as useTranslation10 } from "@dxos/react-ui";
2241
+ import { useObject, useQuery as useQuery2 } from "@dxos/react-client/echo";
2242
+ import { IconButton as IconButton4, Input as Input13, Message, useTranslation as useTranslation10 } from "@dxos/react-ui";
2209
2243
  import { QueryForm } from "@dxos/react-ui-components";
2210
2244
  import { List as List2 } from "@dxos/react-ui-list";
2211
- import { FieldSchema, ProjectionModel, VIEW_FIELD_LIMIT, createEchoChangeCallback, getTypenameFromQuery } from "@dxos/schema";
2212
- import { mx as mx7, osTranslations as osTranslations2, subtleHover as subtleHover2 } from "@dxos/ui-theme";
2245
+ import { ParentLabelAnnotation, ProjectionModel, VIEW_FIELD_LIMIT, createEchoChangeCallback, getTypenameFromQuery } from "@dxos/schema";
2246
+ import { mx as mx5, osTranslations as osTranslations2, subtleHover as subtleHover2 } from "@dxos/ui-theme";
2213
2247
  var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
2214
- var listGrid = "grid grid-cols-[min-content_1fr_min-content_min-content_min-content]";
2215
- var listItemGrid = "grid grid-cols-subgrid col-span-5";
2216
- var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode = "schema", registry, readonly, showHeading = false, types, tags, onQueryChanged, onDelete }, forwardedRef) => {
2248
+ var ViewEditor = /* @__PURE__ */ forwardRef2(({ classNames, schema, view, mode = "schema", registry, db, readonly, showHeading = false, types, tags, onQueryChanged, onDelete }, forwardedRef) => {
2217
2249
  const atomRegistry = useContext(RegistryContext);
2218
2250
  const schemaReadonly = !isMutable(schema);
2219
2251
  const { t } = useTranslation10(translationKey);
@@ -2235,12 +2267,25 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2235
2267
  useImperativeHandle(forwardedRef, () => projectionModel, [
2236
2268
  projectionModel
2237
2269
  ]);
2238
- const [expandedField, setExpandedField] = useState6();
2239
2270
  const queueTarget = Match2.value(view.query.ast).pipe(Match2.when({
2240
- type: "options"
2241
- }, ({ options }) => {
2242
- return Option4.fromNullable(options.queues).pipe(Option4.flatMap((queues) => Array2.head(queues)), Option4.getOrUndefined);
2271
+ type: "from"
2272
+ }, ({ from }) => {
2273
+ if (from._tag !== "scope") {
2274
+ return void 0;
2275
+ }
2276
+ return Option4.fromNullable(from.scope.queues).pipe(Option4.flatMap((queues) => Array2.head(queues)), Option4.map(String), Option4.getOrUndefined);
2243
2277
  }), Match2.orElse(() => void 0));
2278
+ const feeds = useQuery2(db, Filter2.type(Feed.Feed));
2279
+ const targetRef = useMemo8(() => {
2280
+ if (!queueTarget) {
2281
+ return void 0;
2282
+ }
2283
+ const feed = feeds.find((feed2) => Feed.getQueueDxn(feed2)?.toString() === queueTarget);
2284
+ return feed ? Ref3.fromDXN(Entity2.getDXN(feed)) : void 0;
2285
+ }, [
2286
+ queueTarget,
2287
+ feeds
2288
+ ]);
2244
2289
  const viewSchema = useMemo8(() => {
2245
2290
  const base = Schema3.Struct({
2246
2291
  query: mode === "schema" ? Format5.URL.annotations({
@@ -2252,9 +2297,10 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2252
2297
  if (mode === "tag") {
2253
2298
  return Schema3.Struct({
2254
2299
  ...base.fields,
2255
- target: Schema3.optional(Schema3.String.annotations({
2256
- title: "Target Queue"
2257
- }))
2300
+ // TODO(wittjosiah): Replace Type.Feed with Dataset.Dataset when Ref.Ref supports unions.
2301
+ target: Ref3.Ref(Feed.Feed).pipe(Schema3.annotations({
2302
+ title: "Target Feed"
2303
+ }), ParentLabelAnnotation.set(true), Schema3.optional)
2258
2304
  }).pipe(Schema3.mutable);
2259
2305
  }
2260
2306
  return base.pipe(Schema3.mutable);
@@ -2263,11 +2309,11 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2263
2309
  ]);
2264
2310
  const viewValues = useMemo8(() => ({
2265
2311
  query: mode === "schema" ? getTypenameFromQuery(view.query.ast) : view.query.ast,
2266
- target: queueTarget
2312
+ target: targetRef
2267
2313
  }), [
2268
2314
  mode,
2269
2315
  view.query.ast,
2270
- queueTarget
2316
+ targetRef
2271
2317
  ]);
2272
2318
  const fieldMap = useMemo8(() => mode === "tag" ? customFields({
2273
2319
  types,
@@ -2277,66 +2323,52 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2277
2323
  types,
2278
2324
  tags
2279
2325
  ]);
2280
- const handleAdd = useCallback15(() => {
2281
- invariant(!readonly, void 0, {
2282
- F: __dxlog_file3,
2283
- L: 146,
2284
- S: void 0,
2285
- A: [
2286
- "!readonly",
2287
- ""
2288
- ]
2289
- });
2290
- const field = projectionModel.createFieldProjection();
2291
- setExpandedField(field.id);
2292
- }, [
2293
- projectionModel,
2294
- readonly
2295
- ]);
2296
2326
  const handleUpdate = useCallback15((values) => {
2297
- requestAnimationFrame(() => {
2298
- const query = mode === "schema" ? Query.select(Filter2.typename(values.query)).ast : values.query;
2299
- onQueryChanged?.(query, values.target);
2300
- });
2327
+ const targetValue = values.target;
2328
+ let queueDxn;
2329
+ if (Ref3.isRef(targetValue)) {
2330
+ const feedDxn = targetValue.dxn.toString();
2331
+ const feed = feeds.find((feed2) => Obj3.getDXN(feed2).toString() === feedDxn);
2332
+ if (feed) {
2333
+ queueDxn = Feed.getQueueDxn(feed)?.toString();
2334
+ }
2335
+ }
2336
+ const query = mode === "schema" ? Query.select(Filter2.typename(values.query)).ast : JSON.parse(JSON.stringify(values.query));
2337
+ onQueryChanged?.(query, queueDxn);
2301
2338
  }, [
2302
2339
  onQueryChanged,
2303
- view,
2304
- queueTarget,
2305
- mode
2340
+ mode,
2341
+ feeds
2306
2342
  ]);
2307
2343
  const handleDelete = useCallback15((fieldId) => {
2308
2344
  invariant(!readonly, void 0, {
2309
2345
  F: __dxlog_file3,
2310
- L: 163,
2346
+ L: 185,
2311
2347
  S: void 0,
2312
2348
  A: [
2313
2349
  "!readonly",
2314
2350
  ""
2315
2351
  ]
2316
2352
  });
2317
- if (fieldId === expandedField) {
2318
- setExpandedField(void 0);
2319
- }
2320
2353
  onDelete?.(fieldId);
2321
2354
  }, [
2322
- expandedField,
2323
2355
  onDelete,
2324
2356
  readonly
2325
2357
  ]);
2326
2358
  return /* @__PURE__ */ React19.createElement("div", {
2327
2359
  role: "none",
2328
- className: mx7(classNames)
2329
- }, schemaReadonly && !readonly && /* @__PURE__ */ React19.createElement(Callout.Root, {
2360
+ className: mx5(classNames)
2361
+ }, schemaReadonly && !readonly && /* @__PURE__ */ React19.createElement(Message.Root, {
2330
2362
  valence: "info",
2331
- classNames: "mlb-cardSpacingBlock"
2332
- }, /* @__PURE__ */ React19.createElement(Callout.Title, null, t("system schema description"))), /* @__PURE__ */ React19.createElement(Form.Root, {
2363
+ classNames: "my-form-padding"
2364
+ }, /* @__PURE__ */ React19.createElement(Message.Title, null, t("system-schema.description"))), /* @__PURE__ */ React19.createElement(Form.Root, {
2333
2365
  schema: viewSchema,
2334
2366
  values: viewValues,
2335
2367
  fieldMap,
2336
- autoSave: true,
2337
- onSave: handleUpdate
2368
+ db,
2369
+ onValuesChanged: handleUpdate
2338
2370
  }, /* @__PURE__ */ React19.createElement(Form.FieldSet, null), /* @__PURE__ */ React19.createElement(FormFieldLabel, {
2339
- label: t("fields label"),
2371
+ label: t("fields.label"),
2340
2372
  asChild: true
2341
2373
  }), /* @__PURE__ */ React19.createElement(FieldList, {
2342
2374
  schema,
@@ -2345,16 +2377,6 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2345
2377
  readonly,
2346
2378
  showHeading,
2347
2379
  onDelete: handleDelete
2348
- })), !readonly && !expandedField && /* @__PURE__ */ React19.createElement("div", {
2349
- role: "none",
2350
- className: "mlb-cardSpacingBlock"
2351
- }, /* @__PURE__ */ React19.createElement(IconButton4, {
2352
- icon: "ph--plus--regular",
2353
- label: t("add property button label"),
2354
- onClick: readonly ? void 0 : handleAdd,
2355
- // TODO(burdon): Show field limit in ux (not tooltip).
2356
- disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,
2357
- classNames: "is-full"
2358
2380
  })));
2359
2381
  });
2360
2382
  var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDelete }) => {
@@ -2378,6 +2400,22 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2378
2400
  view
2379
2401
  ]);
2380
2402
  const [expandedField, setExpandedField] = useState6();
2403
+ const handleAdd = useCallback15(() => {
2404
+ invariant(!readonly, void 0, {
2405
+ F: __dxlog_file3,
2406
+ L: 250,
2407
+ S: void 0,
2408
+ A: [
2409
+ "!readonly",
2410
+ ""
2411
+ ]
2412
+ });
2413
+ const field = projectionModel.createFieldProjection();
2414
+ setExpandedField(field.id);
2415
+ }, [
2416
+ projectionModel,
2417
+ readonly
2418
+ ]);
2381
2419
  const handleToggleField = useCallback15((field) => {
2382
2420
  setExpandedField((prevExpandedFieldId) => prevExpandedFieldId === field.id ? void 0 : field.id);
2383
2421
  }, [
@@ -2386,7 +2424,7 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2386
2424
  const handleDelete = useCallback15((fieldId) => {
2387
2425
  invariant(!readonly, void 0, {
2388
2426
  F: __dxlog_file3,
2389
- L: 253,
2427
+ L: 264,
2390
2428
  S: void 0,
2391
2429
  A: [
2392
2430
  "!readonly",
@@ -2405,20 +2443,20 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2405
2443
  const handleMove = useCallback15((fromIndex, toIndex) => {
2406
2444
  invariant(!readonly, void 0, {
2407
2445
  F: __dxlog_file3,
2408
- L: 265,
2446
+ L: 276,
2409
2447
  S: void 0,
2410
2448
  A: [
2411
2449
  "!readonly",
2412
2450
  ""
2413
2451
  ]
2414
2452
  });
2415
- Obj4.change(view, (v) => {
2453
+ Obj3.change(view, (obj) => {
2416
2454
  const fields = [
2417
- ...v.projection.fields
2455
+ ...obj.projection.fields
2418
2456
  ];
2419
2457
  const [moved] = fields.splice(fromIndex, 1);
2420
2458
  fields.splice(toIndex, 0, moved);
2421
- v.projection.fields = fields;
2459
+ obj.projection.fields = fields;
2422
2460
  });
2423
2461
  }, [
2424
2462
  view,
@@ -2442,31 +2480,31 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2442
2480
  }
2443
2481
  return /* @__PURE__ */ React19.createElement(List2.Root, {
2444
2482
  items: viewSnapshot.projection.fields,
2445
- isItem: Schema3.is(FieldSchema),
2483
+ isItem: Schema3.is(View.FieldSchema),
2446
2484
  getId: (field) => field.id,
2447
2485
  onMove: readonly ? void 0 : handleMove,
2448
2486
  readonly
2449
2487
  }, ({ items: fields }) => /* @__PURE__ */ React19.createElement(React19.Fragment, null, showHeading && /* @__PURE__ */ React19.createElement("h3", {
2450
2488
  className: "text-sm"
2451
- }, t("field path label")), /* @__PURE__ */ React19.createElement("div", {
2489
+ }, t("field-path.label")), /* @__PURE__ */ React19.createElement("div", {
2452
2490
  role: "list",
2453
- className: listGrid
2491
+ className: "grid grid-cols-[min-content_1fr_min-content_min-content_min-content]"
2454
2492
  }, fields?.map((field) => {
2455
2493
  const hidden = field.visible === false;
2456
2494
  return /* @__PURE__ */ React19.createElement(List2.Item, {
2457
2495
  key: field.id,
2458
2496
  item: field,
2459
- classNames: listItemGrid,
2497
+ classNames: "grid grid-cols-subgrid col-span-5",
2460
2498
  "aria-expanded": expandedField === field.id
2461
2499
  }, /* @__PURE__ */ React19.createElement("div", {
2462
2500
  role: "none",
2463
- className: mx7(subtleHover2, listItemGrid, "rounded-sm cursor-pointer min-bs-10")
2501
+ className: mx5(subtleHover2, "grid grid-cols-subgrid col-span-5", "rounded-xs cursor-pointer min-h-10")
2464
2502
  }, /* @__PURE__ */ React19.createElement(List2.ItemDragHandle, {
2465
2503
  disabled: readonly || schemaReadonly
2466
2504
  }), /* @__PURE__ */ React19.createElement(List2.ItemTitle, {
2467
2505
  classNames: hidden && "text-subdued",
2468
2506
  onClick: () => handleToggleField(field)
2469
- }, field.path), /* @__PURE__ */ React19.createElement(List2.ItemButton, {
2507
+ }, field.path), /* @__PURE__ */ React19.createElement(List2.ItemIconButton, {
2470
2508
  label: t(hidden ? "show field label" : "hide field label"),
2471
2509
  "data-testid": hidden ? "show-field-button" : "hide-field-button",
2472
2510
  icon: hidden ? "ph--eye-closed--regular" : "ph--eye--regular",
@@ -2474,15 +2512,15 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2474
2512
  disabled: readonly || !hidden && projectionModel.getFields().length <= 1,
2475
2513
  onClick: () => hidden ? handleShow(field.path) : handleHide(field.id)
2476
2514
  }), !readonly && /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(List2.ItemDeleteButton, {
2477
- label: t("delete field label"),
2515
+ label: t("delete-field.label"),
2478
2516
  autoHide: false,
2479
2517
  disabled: readonly || schemaReadonly || viewSnapshot.projection.fields.length <= 1,
2480
2518
  onClick: () => handleDelete(field.id),
2481
2519
  "data-testid": "field.delete"
2482
- }), /* @__PURE__ */ React19.createElement(IconButton4, {
2520
+ }), /* @__PURE__ */ React19.createElement(List2.ItemIconButton, {
2483
2521
  iconOnly: true,
2484
2522
  variant: "ghost",
2485
- label: t("toggle expand label", {
2523
+ label: t("toggle-expand.label", {
2486
2524
  ns: osTranslations2
2487
2525
  }),
2488
2526
  icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
@@ -2490,7 +2528,7 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2490
2528
  "data-testid": "field.toggle"
2491
2529
  }))), expandedField === field.id && !readonly && /* @__PURE__ */ React19.createElement("div", {
2492
2530
  role: "none",
2493
- className: "col-span-5 mbs-1 mbe-1 border border-separator rounded-md"
2531
+ className: "col-span-5 mt-1 mb-1 border border-separator rounded-md"
2494
2532
  }, /* @__PURE__ */ React19.createElement(FieldEditor, {
2495
2533
  readonly: readonly || schemaReadonly,
2496
2534
  registry,
@@ -2498,6 +2536,15 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2498
2536
  field,
2499
2537
  onSave: handleClose
2500
2538
  })));
2539
+ })), !readonly && !expandedField && /* @__PURE__ */ React19.createElement("div", {
2540
+ role: "none",
2541
+ className: "my-form-padding"
2542
+ }, /* @__PURE__ */ React19.createElement(IconButton4, {
2543
+ icon: "ph--plus--regular",
2544
+ label: t("add-property-button.label"),
2545
+ onClick: handleAdd,
2546
+ disabled: viewSnapshot.projection.fields.length >= VIEW_FIELD_LIMIT,
2547
+ classNames: "w-full"
2501
2548
  }))));
2502
2549
  };
2503
2550
  var customFields = ({ types, tags }) => ({
@@ -2519,15 +2566,6 @@ var customFields = ({ types, tags }) => ({
2519
2566
  export {
2520
2567
  ArrayField,
2521
2568
  BooleanField,
2522
- ControlFrame,
2523
- ControlFrameItem,
2524
- ControlGroup,
2525
- ControlGroupButton,
2526
- ControlItem,
2527
- ControlItemInput,
2528
- ControlPage,
2529
- ControlSection,
2530
- ControlSectionHeading,
2531
2569
  FieldEditor,
2532
2570
  Form,
2533
2571
  FormFieldErrorBoundary,
@@ -2540,12 +2578,12 @@ export {
2540
2578
  RefField,
2541
2579
  SelectField,
2542
2580
  SelectOptionField,
2581
+ Settings,
2543
2582
  TextAreaField,
2544
2583
  TextField,
2545
2584
  TupleField,
2546
2585
  ViewEditor,
2547
2586
  cellClassesForFieldType,
2548
- controlItemClasses,
2549
2587
  formatForDisplay,
2550
2588
  formatForEditing,
2551
2589
  getDefaultValue,
@@ -2554,7 +2592,6 @@ export {
2554
2592
  omitId,
2555
2593
  parseValue,
2556
2594
  pathNotUniqueError,
2557
- setValueEchoAware,
2558
2595
  translations,
2559
2596
  useFormContext,
2560
2597
  useFormFieldState,