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