@dxos/react-ui-form 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe

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 (119) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/index.mjs +989 -674
  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 +989 -674
  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 +62 -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 +23 -18
  13. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.stories.d.ts +68 -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 +8 -6
  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 +62 -61
  29. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts +9 -0
  31. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -0
  32. package/dist/types/src/components/ObjectForm/index.d.ts +2 -0
  33. package/dist/types/src/components/ObjectForm/index.d.ts.map +1 -0
  34. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +10 -2
  35. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  36. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +62 -61
  37. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +9 -0
  39. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -0
  40. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts +83 -0
  41. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts.map +1 -0
  42. package/dist/types/src/components/ObjectProperties/index.d.ts +2 -0
  43. package/dist/types/src/components/ObjectProperties/index.d.ts.map +1 -0
  44. package/dist/types/src/components/Settings/Settings.d.ts +35 -0
  45. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
  46. package/dist/types/src/components/Settings/Settings.stories.d.ts +82 -0
  47. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
  48. package/dist/types/src/components/Settings/index.d.ts +2 -0
  49. package/dist/types/src/components/Settings/index.d.ts.map +1 -0
  50. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +5 -5
  51. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  52. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +66 -64
  53. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/index.d.ts +3 -1
  55. package/dist/types/src/components/index.d.ts.map +1 -1
  56. package/dist/types/src/components/testing.d.ts.map +1 -1
  57. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
  58. package/dist/types/src/hooks/useKeyHandler.d.ts +2 -1
  59. package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -1
  60. package/dist/types/src/translations.d.ts +62 -61
  61. package/dist/types/src/translations.d.ts.map +1 -1
  62. package/dist/types/src/util/index.d.ts +0 -1
  63. package/dist/types/src/util/index.d.ts.map +1 -1
  64. package/dist/types/src/util/refs.d.ts +1 -0
  65. package/dist/types/src/util/refs.d.ts.map +1 -1
  66. package/dist/types/tsconfig.tsbuildinfo +1 -1
  67. package/package.json +37 -38
  68. package/src/components/FieldEditor/FieldEditor.stories.tsx +7 -8
  69. package/src/components/FieldEditor/FieldEditor.test.tsx +0 -1
  70. package/src/components/FieldEditor/FieldEditor.tsx +3 -4
  71. package/src/components/Form/AUDIT.md +17 -0
  72. package/src/components/Form/Form.stories.tsx +25 -26
  73. package/src/components/Form/Form.tsx +100 -66
  74. package/src/components/Form/FormField.tsx +32 -14
  75. package/src/components/Form/FormFieldComponent.stories.tsx +5 -5
  76. package/src/components/Form/FormFieldComponent.tsx +17 -20
  77. package/src/components/Form/FormFieldSet.tsx +126 -105
  78. package/src/components/Form/fields/ArrayField.tsx +11 -8
  79. package/src/components/Form/fields/GeoPointField.tsx +6 -6
  80. package/src/components/Form/fields/MarkdownField.tsx +1 -1
  81. package/src/components/Form/fields/RefField.tsx +37 -20
  82. package/src/components/Form/fields/SelectField.tsx +1 -1
  83. package/src/components/Form/fields/SelectOptionField.stories.tsx +2 -3
  84. package/src/components/Form/fields/SelectOptionField.tsx +9 -10
  85. package/src/components/Form/fields/TupleField.tsx +1 -1
  86. package/src/components/ObjectForm/ObjectForm.tsx +113 -0
  87. package/src/components/{ControlSection → ObjectForm}/index.ts +1 -1
  88. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +13 -18
  89. package/src/components/ObjectPicker/ObjectPicker.tsx +71 -60
  90. package/src/components/ObjectProperties/ObjectProperties.stories.tsx +63 -0
  91. package/src/components/ObjectProperties/ObjectProperties.tsx +129 -0
  92. package/src/components/ObjectProperties/index.ts +5 -0
  93. package/src/components/Settings/Settings.stories.tsx +55 -0
  94. package/src/components/Settings/Settings.tsx +129 -0
  95. package/src/components/Settings/index.ts +5 -0
  96. package/src/components/ViewEditor/ViewEditor.stories.tsx +36 -33
  97. package/src/components/ViewEditor/ViewEditor.test.tsx +3 -7
  98. package/src/components/ViewEditor/ViewEditor.tsx +99 -70
  99. package/src/components/index.ts +3 -1
  100. package/src/components/testing.tsx +20 -8
  101. package/src/hooks/useFormHandler.ts +42 -24
  102. package/src/hooks/useKeyHandler.tsx +7 -7
  103. package/src/translations.ts +63 -63
  104. package/src/util/index.ts +0 -1
  105. package/src/util/refs.ts +7 -3
  106. package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
  107. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
  108. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -87
  109. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
  110. package/dist/types/src/components/ControlSection/index.d.ts +0 -2
  111. package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
  112. package/dist/types/src/components/Form/Form-old.stories.d.ts +0 -131
  113. package/dist/types/src/components/Form/Form-old.stories.d.ts.map +0 -1
  114. package/dist/types/src/util/echo.d.ts +0 -6
  115. package/dist/types/src/util/echo.d.ts.map +0 -1
  116. package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
  117. package/src/components/ControlSection/ControlSection.tsx +0 -153
  118. package/src/components/Form/Form-old.stories.tsx +0 -314
  119. package/src/util/echo.ts +0 -25
@@ -4,188 +4,85 @@ 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
+ "add-tag.label": "Add tag",
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
+ // TypeFormat
33
+ "format.boolean.label": "Boolean",
34
+ "format.currency.label": "Currency",
35
+ "format.date.label": "Date",
36
+ "format.date-time.label": "DateTime",
37
+ "format.did.label": "DID",
38
+ "format.duration.label": "Duration",
39
+ "format.dxn.label": "DXN",
40
+ "format.email.label": "Email",
41
+ "format.formula.label": "Formula",
42
+ "format.hostname.label": "Hostname",
43
+ "format.integer.label": "Integer",
44
+ "format.json.label": "JSON",
45
+ "format.lnglat.label": "Geopoint",
46
+ "format.markdown.label": "Markdown",
47
+ "format.percent.label": "Percent",
48
+ "format.ref.label": "Reference",
49
+ "format.regex.label": "RegExp",
50
+ "format.string.label": "String",
51
+ "format.single-select.label": "Select",
52
+ "format.multi-select.label": "Multi-select",
53
+ "format.text.label": "Long text",
54
+ "format.time.label": "Time",
55
+ "format.timestamp.label": "Timestamp",
56
+ "format.user.label": "User",
57
+ "format.number.label": "Number",
58
+ "format.uri.label": "URI",
59
+ "format.url.label": "URL",
60
+ "format.uuid.label": "UUID",
61
61
  // GeoPointField.
62
- "latitude label": "Latitude",
63
- "longitude label": "Longitude",
62
+ "latitude.label": "Latitude",
63
+ "longitude.label": "Longitude",
64
64
  // 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",
65
+ "select-option.label": "Label",
66
+ "select-option-label.placeholder": "Option label",
67
+ "select-option-delete.button": "Delete",
68
+ "select-option-add.button": "Add option",
70
69
  // System schema message.
71
- "system schema title": "System type",
72
- "system schema description": "System type: cannot add or remove fields."
70
+ "system-schema.title": "System type",
71
+ "system-schema.description": "System type: cannot add or remove fields.",
72
+ "remove.button": "Remove"
73
73
  }
74
74
  }
75
75
  }
76
76
  ];
77
77
 
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
78
  // 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";
79
+ import React17, { useCallback as useCallback14, useEffect as useEffect6, useMemo as useMemo7, useState as useState5 } from "react";
80
+ import { Obj as Obj2 } from "@dxos/echo";
171
81
  import { Format as Format4, FormatEnums, formatToType } from "@dxos/echo/internal";
172
82
  import { log as log2 } from "@dxos/log";
173
- import { useAsyncEffect, useTranslation as useTranslation9 } from "@dxos/react-ui";
83
+ import { useAsyncEffect, useTranslation as useTranslation8 } from "@dxos/react-ui";
174
84
  import { formatToAdditionalPropertyAttributes, getFormatSchema } from "@dxos/schema";
175
85
 
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
86
  // src/util/field.ts
190
87
  import { Format, GeoLocation, TypeEnum } from "@dxos/echo/internal";
191
88
  var parseValue = ({ type, format, value: value3 }) => {
@@ -455,23 +352,28 @@ var getFormProperties = (ast) => {
455
352
 
456
353
  // src/util/refs.ts
457
354
  import { Ref } from "@dxos/echo";
458
- import { getArrayElementType, isArrayType } from "@dxos/effect";
355
+ import { ReferenceAnnotationId } from "@dxos/echo/internal";
356
+ import { findAnnotation, getArrayElementType, isArrayType } from "@dxos/effect";
459
357
  var getRefProps = (ast) => {
460
358
  if (isArrayType(ast)) {
461
359
  const elementType = getArrayElementType(ast);
462
360
  if (elementType) {
463
361
  if (Ref.isRefType(elementType)) {
362
+ const typename = findAnnotation(elementType, ReferenceAnnotationId)?.typename;
464
363
  return {
465
364
  ast: elementType,
466
- isArray: true
365
+ isArray: true,
366
+ typename
467
367
  };
468
368
  }
469
369
  }
470
370
  }
471
371
  if (Ref.isRefType(ast)) {
372
+ const typename = findAnnotation(ast, ReferenceAnnotationId)?.typename;
472
373
  return {
473
374
  ast,
474
- isArray: false
375
+ isArray: false,
376
+ typename
475
377
  };
476
378
  }
477
379
  return void 0;
@@ -479,24 +381,24 @@ var getRefProps = (ast) => {
479
381
 
480
382
  // src/components/Form/fields/ArrayField.tsx
481
383
  import * as Option3 from "effect/Option";
482
- import * as SchemaAST2 from "effect/SchemaAST";
483
- import React6, { useCallback as useCallback3 } from "react";
384
+ import * as SchemaAST3 from "effect/SchemaAST";
385
+ import React5, { useCallback as useCallback3 } from "react";
484
386
  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";
387
+ import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
486
388
 
487
389
  // src/components/Form/Form.tsx
488
390
  import { createContext } from "@radix-ui/react-context";
489
391
  import * as Schema2 from "effect/Schema";
490
- import React5, { useEffect as useEffect3, useMemo as useMemo4, useRef } from "react";
392
+ import * as SchemaAST2 from "effect/SchemaAST";
393
+ import React4, { useEffect as useEffect2, useMemo as useMemo4, useRef } from "react";
491
394
  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";
395
+ import { IconButton, ScrollArea, useMergeRefs, useTranslation as useTranslation2 } from "@dxos/react-ui";
396
+ import { composable, composableProps, mx } from "@dxos/ui-theme";
494
397
 
495
398
  // src/hooks/useFormHandler.ts
496
399
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
497
400
  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";
401
+ import { createJsonPath, fromEffectValidationPath, getValue as getValue$ } from "@dxos/effect";
500
402
  import { log } from "@dxos/log";
501
403
  import { useDefaultValue } from "@dxos/react-ui";
502
404
  import { validateSchema } from "@dxos/schema";
@@ -511,11 +413,13 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
511
413
  prop: valuesProp,
512
414
  defaultProp: defaultValues,
513
415
  onChange: () => {
514
- setValues(valuesProp ?? defaultValues);
515
- setChanged({});
516
- setTouched({});
517
- setErrors({});
518
- setSaving(false);
416
+ if (valuesProp !== void 0) {
417
+ setValues(valuesProp ?? defaultValues);
418
+ setChanged({});
419
+ setTouched({});
420
+ setErrors({});
421
+ setSaving(false);
422
+ }
519
423
  }
520
424
  });
521
425
  const values = values$;
@@ -529,7 +433,7 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
529
433
  errors: errors2
530
434
  }, {
531
435
  F: __dxlog_file,
532
- L: 160,
436
+ L: 155,
533
437
  S: void 0,
534
438
  C: (f, a) => f(...a)
535
439
  });
@@ -622,11 +526,12 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
622
526
  value: value3
623
527
  }, {
624
528
  F: __dxlog_file,
625
- L: 259,
529
+ L: 254,
626
530
  S: void 0,
627
531
  C: (f, a) => f(...a)
628
532
  });
629
533
  const jsonPath = createJsonPath(path);
534
+ const pathArray = path;
630
535
  let parsedValue = value3;
631
536
  try {
632
537
  if (type._tag === "NumberKeyword") {
@@ -635,33 +540,33 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
635
540
  } catch (err) {
636
541
  log.catch(err, void 0, {
637
542
  F: __dxlog_file,
638
- L: 268,
543
+ L: 264,
639
544
  S: void 0,
640
545
  C: (f, a) => f(...a)
641
546
  });
642
547
  parsedValue = void 0;
643
548
  }
644
- const newValues = Obj2.isObject(values) ? (setValueEchoAware(values, jsonPath, parsedValue), values) : {
645
- ...setValue$(values, jsonPath, parsedValue)
646
- };
647
- setValues(newValues);
549
+ const newValues = mergeAtPath(values, pathArray, parsedValue);
648
550
  const newChanged = {
649
551
  [jsonPath]: true
650
552
  };
651
- setChanged({
652
- ...changed,
553
+ setChanged((prev) => ({
554
+ ...prev,
653
555
  ...newChanged
654
- });
556
+ }));
655
557
  const isValid2 = validate(newValues);
656
558
  onValuesChanged?.(newValues, {
657
559
  isValid: isValid2,
658
560
  changed: newChanged
659
561
  });
562
+ if (valuesProp === void 0) {
563
+ setValues(newValues);
564
+ }
660
565
  }, [
661
566
  values,
662
- changed,
663
567
  validate,
664
- onValuesChanged
568
+ onValuesChanged,
569
+ valuesProp
665
570
  ]);
666
571
  const onBlur = useCallback(async (path) => {
667
572
  const jsonPath = createJsonPath(path);
@@ -718,6 +623,24 @@ var useFormHandler = ({ schema, autoSave, values: valuesProp, defaultValues: def
718
623
  onCancel
719
624
  ]);
720
625
  };
626
+ var mergeAtPath = (obj, path, value3) => {
627
+ if (path.length === 0) {
628
+ return value3;
629
+ }
630
+ const [head2, ...rest] = path;
631
+ const child = rest.length === 0 ? value3 : mergeAtPath(obj?.[head2], rest, value3);
632
+ if (Array.isArray(obj)) {
633
+ const copy = [
634
+ ...obj
635
+ ];
636
+ copy[head2] = child;
637
+ return copy;
638
+ }
639
+ return {
640
+ ...obj,
641
+ [head2]: child
642
+ };
643
+ };
721
644
  var flatMap = (errors) => {
722
645
  return errors.reduce((result, { path, message }) => {
723
646
  const jsonPath = fromEffectValidationPath(path);
@@ -729,9 +652,9 @@ var flatMap = (errors) => {
729
652
  };
730
653
 
731
654
  // src/hooks/useKeyHandler.tsx
732
- import { useCallback as useCallback2, useEffect as useEffect2 } from "react";
655
+ import { useCallback as useCallback2, useLayoutEffect } from "react";
733
656
  import { addEventListener } from "@dxos/async";
734
- var useKeyHandler = (formElement, form) => {
657
+ var useKeyHandler = (elRef, form) => {
735
658
  const handleKeyDown = useCallback2((event) => {
736
659
  switch (event.key) {
737
660
  case "Enter": {
@@ -747,40 +670,37 @@ var useKeyHandler = (formElement, form) => {
747
670
  form.onSave,
748
671
  form.autoSave
749
672
  ]);
750
- useEffect2(() => {
751
- if (!formElement) {
673
+ useLayoutEffect(() => {
674
+ const el = elRef.current;
675
+ if (!el) {
752
676
  return;
753
677
  }
754
- return addEventListener(formElement, "keydown", handleKeyDown);
678
+ return addEventListener(el, "keydown", handleKeyDown);
755
679
  }, [
756
- formElement,
680
+ elRef,
757
681
  handleKeyDown
758
682
  ]);
759
683
  };
760
684
 
761
685
  // 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";
686
+ import React, { Component } from "react";
687
+ import { Icon, Input, Tooltip } from "@dxos/react-ui";
688
+ import { inputTextLabel } from "@dxos/ui-theme";
766
689
  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", {
690
+ const Label = readonly || asChild ? "span" : Input.Label;
691
+ return /* @__PURE__ */ React.createElement("div", {
774
692
  role: "none",
775
- className: mx2("flex justify-between items-center", labelSpacing)
776
- }, /* @__PURE__ */ React2.createElement(Label, labelProps, label), error && /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
693
+ className: "flex items-center justify-between"
694
+ }, /* @__PURE__ */ React.createElement(Label, {
695
+ className: inputTextLabel
696
+ }, label), error && /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
777
697
  asChild: true,
778
698
  content: error,
779
699
  side: "bottom"
780
- }, /* @__PURE__ */ React2.createElement(Icon, {
700
+ }, /* @__PURE__ */ React.createElement(Icon, {
781
701
  icon: "ph--warning--regular",
782
702
  size: 4,
783
- classNames: errorText
703
+ classNames: "text-error-text"
784
704
  })));
785
705
  };
786
706
  FormFieldLabel.displayName = "Form.FieldLabel";
@@ -792,15 +712,18 @@ var FormFieldWrapper = (props) => {
792
712
  return null;
793
713
  }
794
714
  const str = String(value3 ?? "");
795
- return /* @__PURE__ */ React2.createElement(Input2.Root, {
715
+ return /* @__PURE__ */ React.createElement("div", {
716
+ role: "none",
717
+ className: "contents"
718
+ }, /* @__PURE__ */ React.createElement(Input.Root, {
796
719
  validationValence: status
797
- }, layout !== "inline" && /* @__PURE__ */ React2.createElement(FormFieldLabel, {
720
+ }, layout !== "inline" && /* @__PURE__ */ React.createElement(FormFieldLabel, {
798
721
  error,
799
722
  readonly,
800
723
  label
801
- }), layout === "static" ? /* @__PURE__ */ React2.createElement("p", null, str) : children ? children({
724
+ }), layout === "static" ? /* @__PURE__ */ React.createElement("p", null, str) : children ? children({
802
725
  value: value3
803
- }) : null, layout === "full" && /* @__PURE__ */ React2.createElement(Input2.DescriptionAndValidation, null, /* @__PURE__ */ React2.createElement(Input2.Validation, null, error)));
726
+ }) : null, layout === "full" && /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Validation, null, error))));
804
727
  };
805
728
  var FormFieldErrorBoundary = class extends Component {
806
729
  static getDerivedStateFromError(error) {
@@ -818,10 +741,10 @@ var FormFieldErrorBoundary = class extends Component {
818
741
  }
819
742
  render() {
820
743
  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"
744
+ return /* @__PURE__ */ React.createElement("div", {
745
+ className: "flex gap-2 border border-rose-fill font-mono text-sm"
746
+ }, /* @__PURE__ */ React.createElement("span", {
747
+ className: "bg-rose-fill text-surface-text px-1 font-thin"
825
748
  }, "ERROR"), String(this.props.path?.join(".")));
826
749
  }
827
750
  return this.props.children;
@@ -834,9 +757,7 @@ var FormFieldErrorBoundary = class extends Component {
834
757
  };
835
758
 
836
759
  // 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";
760
+ import React3, { useMemo as useMemo3 } from "react";
840
761
 
841
762
  // src/components/Form/FormField.tsx
842
763
  import * as Match from "effect/Match";
@@ -844,10 +765,10 @@ import * as Option2 from "effect/Option";
844
765
  import * as Schema from "effect/Schema";
845
766
  import * as SchemaAST from "effect/SchemaAST";
846
767
  import * as String2 from "effect/String";
847
- import React3, { useMemo as useMemo2 } from "react";
768
+ import React2, { useMemo as useMemo2 } from "react";
848
769
  import { Format as Format3 } from "@dxos/echo";
849
770
  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";
771
+ import { useTranslation } from "@dxos/react-ui";
851
772
  var FormField = (props) => {
852
773
  const {
853
774
  type,
@@ -859,15 +780,17 @@ var FormField = (props) => {
859
780
  readonly,
860
781
  layout,
861
782
  // RefFieldProps
783
+ createTypename,
862
784
  createOptionLabel,
863
785
  createOptionIcon,
864
786
  createInitialValuePath,
787
+ createFieldMap: createFieldMap3,
865
788
  db,
866
789
  schemaHook,
867
- getOptions: getRefOptions,
790
+ getOptions,
868
791
  onCreate
869
792
  } = props;
870
- const { t } = useTranslation2(translationKey);
793
+ const { t } = useTranslation(translationKey);
871
794
  const title = getAnnotation(SchemaAST.TitleAnnotationId)(type);
872
795
  const description = getAnnotation(SchemaAST.DescriptionAnnotationId)(type);
873
796
  const examples = getAnnotation(SchemaAST.ExamplesAnnotationId)(type);
@@ -875,7 +798,7 @@ var FormField = (props) => {
875
798
  title,
876
799
  name
877
800
  ]);
878
- const placeholder = useMemo2(() => examples?.length ? `${t("example placeholder")}: ${examples[0]}` : description ?? label, [
801
+ const placeholder = useMemo2(() => examples?.length ? `${t("example.placeholder")}: ${examples[0]}` : description ?? label, [
879
802
  examples,
880
803
  description,
881
804
  label
@@ -893,7 +816,7 @@ var FormField = (props) => {
893
816
  const jsonPath = createJsonPath2(path ?? []);
894
817
  const CustomField = fieldMap?.[jsonPath];
895
818
  if (CustomField) {
896
- return /* @__PURE__ */ React3.createElement(CustomField, fieldProps);
819
+ return /* @__PURE__ */ React2.createElement(CustomField, fieldProps);
897
820
  }
898
821
  const component = fieldProvider?.({
899
822
  schema: Schema.make(type),
@@ -904,7 +827,7 @@ var FormField = (props) => {
904
827
  return component;
905
828
  }
906
829
  if (isArrayType2(type)) {
907
- return /* @__PURE__ */ React3.createElement(ArrayField, {
830
+ return /* @__PURE__ */ React2.createElement(ArrayField, {
908
831
  fieldProps: fieldState,
909
832
  label,
910
833
  ...props
@@ -912,29 +835,37 @@ var FormField = (props) => {
912
835
  }
913
836
  const Field = getFormField(fieldProps);
914
837
  if (Field) {
915
- return /* @__PURE__ */ React3.createElement(Field, fieldProps);
838
+ return /* @__PURE__ */ React2.createElement(Field, fieldProps);
916
839
  }
917
- const options = getOptions(type);
840
+ const options = getSelectOptions(type);
918
841
  if (options) {
919
- return /* @__PURE__ */ React3.createElement(SelectField, {
842
+ const fieldProjections = projection?.getFieldProjections();
843
+ const fieldProjection = fieldProjections?.find((fp) => fp.field.path === name);
844
+ const selectOptions = fieldProjection?.props.options;
845
+ return /* @__PURE__ */ React2.createElement(SelectField, {
920
846
  ...fieldProps,
921
- options: options.map((option) => ({
922
- value: option,
923
- label: option.toString()
924
- }))
847
+ options: options.map((option) => {
848
+ const selectOption = selectOptions?.find((so) => so.id === globalThis.String(option));
849
+ return {
850
+ value: option,
851
+ label: selectOption?.title ?? option.toString()
852
+ };
853
+ })
925
854
  });
926
855
  }
927
856
  const refProps = getRefProps(type);
928
857
  if (refProps) {
929
- return /* @__PURE__ */ React3.createElement(RefField, {
858
+ const isCreateTarget = !createTypename || refProps.typename === createTypename;
859
+ return /* @__PURE__ */ React2.createElement(RefField, {
930
860
  ...fieldProps,
931
861
  ...refProps,
932
- createOptionLabel,
933
- createOptionIcon,
934
- createInitialValuePath,
862
+ createOptionLabel: isCreateTarget ? createOptionLabel : void 0,
863
+ createOptionIcon: isCreateTarget ? createOptionIcon : void 0,
864
+ createInitialValuePath: isCreateTarget ? createInitialValuePath : void 0,
865
+ createFieldMap: isCreateTarget ? createFieldMap3 : void 0,
935
866
  db,
936
867
  schemaHook,
937
- getOptions: getRefOptions,
868
+ getOptions,
938
869
  onCreate
939
870
  });
940
871
  }
@@ -943,7 +874,7 @@ var FormField = (props) => {
943
874
  const typeLiteral = baseNode ? getDiscriminatedType(baseNode, fieldState.getValue()) : findNode(type, SchemaAST.isTypeLiteral);
944
875
  if (typeLiteral) {
945
876
  const schema = Schema.make(typeLiteral);
946
- return /* @__PURE__ */ React3.createElement(FormFieldSet, {
877
+ return /* @__PURE__ */ React2.createElement(FormFieldSet, {
947
878
  schema,
948
879
  path,
949
880
  readonly,
@@ -957,7 +888,7 @@ var FormField = (props) => {
957
888
  createInitialValuePath,
958
889
  db,
959
890
  schemaHook,
960
- getOptions: getRefOptions,
891
+ getOptions,
961
892
  onCreate
962
893
  });
963
894
  }
@@ -981,7 +912,7 @@ var getFormField = ({ type, format }) => {
981
912
  return BooleanField;
982
913
  }
983
914
  };
984
- var getOptions = (ast) => {
915
+ var getSelectOptions = (ast) => {
985
916
  if (isLiteralUnion(ast)) {
986
917
  return ast.types.map((type) => type.literal).filter((v) => v !== null);
987
918
  }
@@ -989,58 +920,31 @@ var getOptions = (ast) => {
989
920
  };
990
921
 
991
922
  // 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);
994
- const properties = useMemo3(() => {
995
- if (!schema) {
996
- return [];
997
- }
998
- const props2 = getFormProperties(schema.ast);
999
- if (projection) {
1000
- const fieldProjections = projection.getFieldProjections();
1001
- const hiddenProperties = new Set(projection.getHiddenProperties());
1002
- const visibleProps = props2.filter((prop) => !hiddenProperties.has(prop.name.toString()));
1003
- const orderedProps = [];
1004
- for (const fieldProjection of fieldProjections) {
1005
- const fieldPath = String(fieldProjection.field.path);
1006
- const prop = visibleProps.find((p) => p.name === fieldPath);
1007
- if (prop) {
1008
- orderedProps.push(prop);
1009
- }
1010
- }
1011
- const projectionPaths = new Set(fieldProjections.map((projection2) => String(projection2.field.path)));
1012
- const remainingProps = visibleProps.filter((prop) => !projectionPaths.has(prop.name.toString()));
1013
- orderedProps.push(...remainingProps);
1014
- return orderedProps;
1015
- }
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;
1018
- }, [
923
+ var FORM_FIELDSET_NAME = "Form.FieldSet";
924
+ var FormFieldSet = ({ label, schema, readonly, path, sort, exclude, projection, layout, ...props }) => {
925
+ const values = useFormValues(FORM_FIELDSET_NAME, path);
926
+ const properties = useFormFieldSetProperties({
1019
927
  schema,
1020
928
  values,
1021
929
  exclude,
1022
930
  sort,
1023
- projection?.fields
1024
- ]);
931
+ projection
932
+ });
1025
933
  if ((readonly || layout === "static") && values == null) {
1026
934
  return null;
1027
935
  }
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, {
936
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, layout !== "inline" && label && /* @__PURE__ */ React3.createElement(FormFieldLabel, {
1033
937
  label,
1034
938
  asChild: true
1035
939
  }), properties.map((property) => {
1036
940
  const name = property.name.toString();
1037
- return /* @__PURE__ */ React4.createElement(FormFieldErrorBoundary, {
941
+ return /* @__PURE__ */ React3.createElement(FormFieldErrorBoundary, {
1038
942
  key: name,
1039
943
  path: [
1040
944
  ...path ?? [],
1041
945
  name
1042
946
  ]
1043
- }, /* @__PURE__ */ React4.createElement(FormField, {
947
+ }, /* @__PURE__ */ React3.createElement(FormField, {
1044
948
  type: property.type,
1045
949
  name,
1046
950
  path: [
@@ -1052,24 +956,67 @@ var FormFieldSet = /* @__PURE__ */ forwardRef(({ classNames, label, schema, read
1052
956
  projection,
1053
957
  ...props
1054
958
  }));
1055
- }).filter(isTruthy));
1056
- });
1057
- FormFieldSet.displayName = "Form.Fields";
959
+ }));
960
+ };
961
+ FormFieldSet.displayName = FORM_FIELDSET_NAME;
962
+ var useFormFieldSetProperties = ({ schema, exclude, projection, values, sort }) => {
963
+ return useMemo3(() => {
964
+ if (!schema) {
965
+ return [];
966
+ }
967
+ const schemaProps = getFormProperties(schema.ast);
968
+ const filteredProps = exclude ? exclude(schemaProps) : schemaProps;
969
+ if (projection) {
970
+ const fieldProjections = projection.getFieldProjections();
971
+ const hiddenProperties = new Set(projection.getHiddenProperties());
972
+ const visibleProps = filteredProps.filter((prop) => !hiddenProperties.has(prop.name.toString()));
973
+ const orderedProps = [];
974
+ for (const fieldProjection of fieldProjections) {
975
+ const fieldPath = String(fieldProjection.field.path);
976
+ const prop = visibleProps.find((prop2) => prop2.name === fieldPath);
977
+ if (prop) {
978
+ orderedProps.push(prop);
979
+ }
980
+ }
981
+ const projectionPaths = new Set(fieldProjections.map((projection2) => String(projection2.field.path)));
982
+ const remainingProps = visibleProps.filter((prop) => !projectionPaths.has(prop.name.toString()));
983
+ orderedProps.push(...remainingProps);
984
+ return orderedProps;
985
+ }
986
+ return sort ? [
987
+ ...filteredProps
988
+ ].sort(({ name: a }, { name: b }) => sort.indexOf(a.toString()) - sort.indexOf(b.toString())) : filteredProps;
989
+ }, [
990
+ schema,
991
+ values,
992
+ exclude,
993
+ sort,
994
+ projection
995
+ ]);
996
+ };
1058
997
 
1059
998
  // src/components/Form/Form.tsx
1060
999
  var omitId = (schema) => schema.pipe(Schema2.omit("id"));
1061
1000
  var [FormContextProvider, useFormContext] = createContext("Form");
1062
- var useFormValues = (componentName, path = [], defaultValue) => {
1063
- const jsonPath = createJsonPath3(path);
1064
- const { form: { values } } = useFormContext(componentName);
1001
+ var useFormValues = (componentName, path, defaultValue) => {
1002
+ const stablePath = useMemo4(() => path ?? [], [
1003
+ path ? path.join(".") : void 0
1004
+ ]);
1005
+ const jsonPath = createJsonPath3(stablePath);
1006
+ const { form: { values, onValueChange } } = useFormContext(componentName);
1065
1007
  const value3 = getValue$2(values, jsonPath);
1066
- useEffect3(() => {
1067
- if (!value3 && defaultValue) {
1068
- setValueEchoAware(values, jsonPath, defaultValue());
1008
+ const lastAppliedPathRef = useRef(null);
1009
+ useEffect2(() => {
1010
+ if (value3 == null && defaultValue && lastAppliedPathRef.current !== jsonPath) {
1011
+ lastAppliedPathRef.current = jsonPath;
1012
+ onValueChange(stablePath, SchemaAST2.stringKeyword, defaultValue());
1069
1013
  }
1070
1014
  }, [
1071
1015
  value3,
1072
- defaultValue
1016
+ defaultValue,
1017
+ onValueChange,
1018
+ stablePath,
1019
+ jsonPath
1073
1020
  ]);
1074
1021
  return value3;
1075
1022
  };
@@ -1099,116 +1046,142 @@ var FormRoot = ({ children, schema, values, onSave, onCancel, ...props }) => {
1099
1046
  onCancel,
1100
1047
  ...props
1101
1048
  });
1102
- return /* @__PURE__ */ React5.createElement(FormContextProvider, {
1049
+ return /* @__PURE__ */ React4.createElement(FormContextProvider, {
1103
1050
  form,
1104
1051
  ...props
1105
1052
  }, children);
1106
1053
  };
1107
1054
  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";
1119
- var FormContent = ({ classNames, children }) => {
1120
- const { form, testId } = useFormContext(FormContent.displayName);
1121
- const ref = useRef(null);
1122
- useKeyHandler(ref.current, form);
1123
- return /* @__PURE__ */ React5.createElement("div", {
1124
- ref,
1125
- role: "form",
1126
- className: mx4("flex flex-col is-full pli-cardSpacingInline density-fine", classNames),
1127
- "data-testid": testId
1055
+ var FORM_VIEWPORT_NAME = "Form.Viewport";
1056
+ var FormViewport = composable(({ children, ...props }, forwardedRef) => {
1057
+ return /* @__PURE__ */ React4.createElement(ScrollArea.Root, {
1058
+ ...composableProps(props),
1059
+ orientation: "vertical",
1060
+ centered: true,
1061
+ padding: true,
1062
+ thin: true,
1063
+ ref: forwardedRef
1064
+ }, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, children));
1065
+ });
1066
+ FormViewport.displayName = FORM_VIEWPORT_NAME;
1067
+ var FORM_CONTENT_NAME = "Form.Content";
1068
+ var FormContent = composable(({ children, ...props }, forwardedRef) => {
1069
+ const { form, testId } = useFormContext(FORM_CONTENT_NAME);
1070
+ const localRef = useRef(null);
1071
+ const mergedRef = useMergeRefs([
1072
+ forwardedRef,
1073
+ localRef
1074
+ ]);
1075
+ useKeyHandler(localRef, form);
1076
+ return /* @__PURE__ */ React4.createElement("div", {
1077
+ ...composableProps(props, {
1078
+ role: "form",
1079
+ classNames: "flex flex-col w-full pb-form-gap"
1080
+ }),
1081
+ "data-testid": testId,
1082
+ ref: mergedRef
1128
1083
  }, children);
1129
- };
1130
- FormContent.displayName = "Form.Content";
1131
- var FormFieldSet2 = ({ classNames }) => {
1132
- const { form, ...props } = useFormContext(FormFieldSet2.displayName);
1133
- return /* @__PURE__ */ React5.createElement(FormFieldSet, {
1134
- classNames,
1084
+ });
1085
+ FormContent.displayName = FORM_CONTENT_NAME;
1086
+ var FORM_FIELDSET_NAME2 = "Form.FieldSet";
1087
+ var FormFieldSet2 = (props) => {
1088
+ const { form, ...contextProps } = useFormContext(FORM_FIELDSET_NAME2);
1089
+ return /* @__PURE__ */ React4.createElement(FormFieldSet, {
1135
1090
  schema: form.schema,
1091
+ ...contextProps,
1136
1092
  ...props
1137
1093
  });
1138
1094
  };
1139
- FormFieldSet2.displayName = "Form.FieldSet";
1095
+ FormFieldSet2.displayName = FORM_FIELDSET_NAME2;
1096
+ var FORM_ACTIONS_NAME = "Form.Actions";
1140
1097
  var FormActions = ({ classNames }) => {
1141
- const { t } = useTranslation3(translationKey);
1142
- const { form: { canSave, onSave, onCancel }, readonly, layout } = useFormContext(FormActions.displayName);
1098
+ const { t } = useTranslation2(translationKey);
1099
+ const { form: { canSave, onSave, onCancel }, readonly, layout } = useFormContext(FORM_ACTIONS_NAME);
1143
1100
  if (readonly || layout === "static") {
1144
1101
  return null;
1145
1102
  }
1146
- return /* @__PURE__ */ React5.createElement("div", {
1103
+ return /* @__PURE__ */ React4.createElement("div", {
1147
1104
  role: "none",
1148
- className: mx4("grid grid-flow-col auto-cols-fr gap-2 pbs-cardSpacingBlock", classNames)
1149
- }, onCancel && /* @__PURE__ */ React5.createElement(IconButton, {
1105
+ className: mx("grid grid-flow-col gap-form-gap auto-cols-fr py-form-padding", classNames)
1106
+ }, onCancel && /* @__PURE__ */ React4.createElement(IconButton, {
1150
1107
  icon: "ph--x--regular",
1151
1108
  iconEnd: true,
1152
- label: t("cancel button label"),
1109
+ label: t("cancel-button.label"),
1153
1110
  onClick: onCancel,
1154
1111
  "data-testid": "cancel-button"
1155
- }), onSave && /* @__PURE__ */ React5.createElement(IconButton, {
1112
+ }), onSave && /* @__PURE__ */ React4.createElement(IconButton, {
1156
1113
  type: "submit",
1157
1114
  variant: "primary",
1158
1115
  disabled: !canSave,
1159
1116
  icon: "ph--check--regular",
1160
1117
  iconEnd: true,
1161
- label: t("save button label"),
1118
+ label: t("save-button.label"),
1162
1119
  onClick: onSave,
1163
1120
  "data-testid": "save-button"
1164
1121
  }));
1165
1122
  };
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);
1123
+ FormActions.displayName = FORM_ACTIONS_NAME;
1124
+ var FORM_SECTION_NAME = "Form.Section";
1125
+ var FormSection = composable(({ children, label, description, ...props }, forwardedRef) => {
1126
+ return /* @__PURE__ */ React4.createElement("div", {
1127
+ ...composableProps(props, {
1128
+ classNames: "flex flex-col pt-form-section-gap first:pt-0"
1129
+ }),
1130
+ ref: forwardedRef
1131
+ }, /* @__PURE__ */ React4.createElement("h2", {
1132
+ className: "text-lg"
1133
+ }, label), description && /* @__PURE__ */ React4.createElement("p", {
1134
+ className: "text-description"
1135
+ }, description), children);
1136
+ });
1137
+ FormSection.displayName = FORM_SECTION_NAME;
1138
+ var FORM_SUBMIT_NAME = "Form.Submit";
1139
+ var FormSubmit = ({ classNames, label, icon, disabled }) => {
1140
+ const { t } = useTranslation2(translationKey);
1141
+ const { form: { canSave, onSave }, readonly, layout } = useFormContext(FORM_SUBMIT_NAME);
1170
1142
  if (readonly || layout === "static") {
1171
1143
  return null;
1172
1144
  }
1173
- return /* @__PURE__ */ React5.createElement("div", {
1145
+ return /* @__PURE__ */ React4.createElement("div", {
1174
1146
  role: "none",
1175
- className: mx4("flex is-full pbs-cardSpacingBlock", classNames)
1176
- }, /* @__PURE__ */ React5.createElement(IconButton, {
1177
- classNames: "is-full",
1147
+ className: mx("flex w-full pt-form-padding", classNames)
1148
+ }, /* @__PURE__ */ React4.createElement(IconButton, {
1149
+ classNames: "w-full",
1178
1150
  type: "submit",
1179
1151
  variant: "primary",
1180
- disabled: !canSave,
1152
+ disabled: disabled ?? !canSave,
1181
1153
  icon: icon ?? "ph--check--regular",
1182
- label: label ?? t("save button label"),
1154
+ label: label ?? t("save-button.label"),
1183
1155
  onClick: onSave,
1184
1156
  "data-testid": "save-button"
1185
1157
  }));
1186
1158
  };
1187
- FormSubmit.displayName = "Form.Submit";
1159
+ FormSubmit.displayName = FORM_SUBMIT_NAME;
1188
1160
  var Form = {
1189
1161
  Root: FormRoot,
1190
1162
  Viewport: FormViewport,
1191
1163
  Content: FormContent,
1164
+ Section: FormSection,
1192
1165
  FieldSet: FormFieldSet2,
1166
+ Label: FormFieldLabel,
1193
1167
  Actions: FormActions,
1194
- Submit: FormSubmit,
1195
- Label: FormFieldLabel
1168
+ Submit: FormSubmit
1196
1169
  };
1197
1170
 
1198
1171
  // src/components/Form/fields/ArrayField.tsx
1199
1172
  var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps, ...props }) => {
1200
- const { t } = useTranslation4(translationKey);
1173
+ const { t } = useTranslation3(translationKey);
1201
1174
  const elementType = getArrayElementType2(type);
1202
1175
  const { onValueChange } = inputProps;
1203
1176
  const values = useFormValues(ArrayField.displayName, path, () => []);
1204
1177
  const getDefaultObjectValue = (typeNode) => {
1205
1178
  const baseNode = findNode2(typeNode, isDiscriminatedUnion2);
1206
- const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, {}) : findNode2(typeNode, SchemaAST2.isTypeLiteral);
1179
+ const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, {}) : findNode2(typeNode, SchemaAST3.isTypeLiteral);
1207
1180
  if (!typeLiteral) {
1208
1181
  return {};
1209
1182
  }
1210
1183
  return Object.fromEntries(getFormProperties(typeLiteral).map((prop) => {
1211
- const defaultValue = SchemaAST2.getDefaultAnnotation(prop.type).pipe((annotation) => Option3.getOrUndefined(annotation));
1184
+ const defaultValue = SchemaAST3.getDefaultAnnotation(prop.type).pipe((annotation) => Option3.getOrUndefined(annotation));
1212
1185
  return [
1213
1186
  prop.name,
1214
1187
  defaultValue
@@ -1237,19 +1210,19 @@ var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps,
1237
1210
  if (!elementType || (readonly || layout === "static") && values && values.length < 1) {
1238
1211
  return null;
1239
1212
  }
1240
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, (layout !== "static" || values && values.length > 0) && /* @__PURE__ */ React6.createElement(FormFieldLabel, {
1213
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, (layout !== "static" || values && values.length > 0) && /* @__PURE__ */ React5.createElement(FormFieldLabel, {
1241
1214
  readonly,
1242
1215
  label,
1243
1216
  asChild: true
1244
- }), /* @__PURE__ */ React6.createElement("div", {
1217
+ }), /* @__PURE__ */ React5.createElement("div", {
1245
1218
  role: "none",
1246
- className: "flex flex-col gap-2"
1219
+ className: "flex flex-col gap-form-gap"
1247
1220
  }, values?.map((_, index) => {
1248
- return /* @__PURE__ */ React6.createElement("div", {
1221
+ return /* @__PURE__ */ React5.createElement("div", {
1249
1222
  role: "none",
1250
1223
  key: index,
1251
- className: "grid grid-cols-[1fr_min-content] gap-2 last:mb-3"
1252
- }, /* @__PURE__ */ React6.createElement(FormField, {
1224
+ className: "flex gap-form-gap last:mb-form-gap items-center"
1225
+ }, /* @__PURE__ */ React5.createElement(FormField, {
1253
1226
  autoFocus: index === values.length - 1,
1254
1227
  type: elementType,
1255
1228
  path: [
@@ -1259,23 +1232,23 @@ var ArrayField = ({ type, path, label, readonly, layout, fieldProps: inputProps,
1259
1232
  readonly: readonly || layout === "static",
1260
1233
  layout: "inline",
1261
1234
  ...props
1262
- }), !readonly && layout !== "static" && /* @__PURE__ */ React6.createElement("div", {
1235
+ }), !readonly && layout !== "static" && /* @__PURE__ */ React5.createElement("div", {
1263
1236
  role: "none",
1264
- className: "flex flex-col bs-full justify-end"
1265
- }, /* @__PURE__ */ React6.createElement("div", {
1237
+ className: "flex flex-col h-full justify-end"
1238
+ }, /* @__PURE__ */ React5.createElement("div", {
1266
1239
  role: "none",
1267
- className: "flex items-center bs-[var(--line-height)]"
1268
- }, /* @__PURE__ */ React6.createElement(IconButton2, {
1240
+ className: "flex items-center h-[2rem]"
1241
+ }, /* @__PURE__ */ React5.createElement(IconButton2, {
1269
1242
  icon: "ph--x--regular",
1270
1243
  iconOnly: true,
1271
- label: t("button remove"),
1244
+ label: t("remove.button"),
1272
1245
  onClick: () => handleDelete(index),
1273
1246
  classNames: "self-center"
1274
1247
  }))));
1275
- })), !readonly && layout !== "static" && /* @__PURE__ */ React6.createElement(IconButton2, {
1276
- classNames: "flex is-full _mlb-cardSpacingBlock",
1248
+ })), !readonly && layout !== "static" && /* @__PURE__ */ React5.createElement(IconButton2, {
1249
+ classNames: "flex w-full",
1277
1250
  icon: "ph--plus--regular",
1278
- label: t("add field"),
1251
+ label: t("add-field.button"),
1279
1252
  onClick: handleAdd
1280
1253
  }));
1281
1254
  };
@@ -1291,6 +1264,9 @@ var getDefaultValue = (ast) => {
1291
1264
  case "BooleanKeyword": {
1292
1265
  return false;
1293
1266
  }
1267
+ case "Suspend": {
1268
+ return getDefaultValue(ast.f());
1269
+ }
1294
1270
  default: {
1295
1271
  if (ast && isNestedType2(ast)) {
1296
1272
  return {};
@@ -1302,17 +1278,17 @@ var getDefaultValue = (ast) => {
1302
1278
  };
1303
1279
 
1304
1280
  // src/components/Form/fields/BooleanField.tsx
1305
- import React7, { useCallback as useCallback4 } from "react";
1306
- import { Input as Input3 } from "@dxos/react-ui";
1281
+ import React6, { useCallback as useCallback4 } from "react";
1282
+ import { Input as Input2 } from "@dxos/react-ui";
1307
1283
  var BooleanField = ({ type, readonly, onValueChange, ...props }) => {
1308
1284
  const handleChange = useCallback4((value3) => onValueChange?.(type, value3), [
1309
1285
  type,
1310
1286
  onValueChange
1311
1287
  ]);
1312
- return /* @__PURE__ */ React7.createElement(FormFieldWrapper, {
1288
+ return /* @__PURE__ */ React6.createElement(FormFieldWrapper, {
1313
1289
  readonly,
1314
1290
  ...props
1315
- }, ({ value: value3 }) => /* @__PURE__ */ React7.createElement(Input3.Switch, {
1291
+ }, ({ value: value3 }) => /* @__PURE__ */ React6.createElement(Input2.Switch, {
1316
1292
  disabled: !!readonly,
1317
1293
  checked: value3,
1318
1294
  onCheckedChange: handleChange
@@ -1320,12 +1296,12 @@ var BooleanField = ({ type, readonly, onValueChange, ...props }) => {
1320
1296
  };
1321
1297
 
1322
1298
  // src/components/Form/fields/GeoPointField.tsx
1323
- import React8, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo5, useState as useState2 } from "react";
1299
+ import React7, { useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo5, useState as useState2 } from "react";
1324
1300
  import { GeoLocation as GeoLocation3 } from "@dxos/echo/internal";
1325
- import { Input as Input4, useTranslation as useTranslation5 } from "@dxos/react-ui";
1301
+ import { Input as Input3, useTranslation as useTranslation4 } from "@dxos/react-ui";
1326
1302
  import { safeParseFloat } from "@dxos/util";
1327
1303
  var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onValueChange, onBlur }) => {
1328
- const { t } = useTranslation5(translationKey);
1304
+ const { t } = useTranslation4(translationKey);
1329
1305
  const { status, error } = getStatus();
1330
1306
  const geoPoint = useMemo5(() => getValue() ?? [
1331
1307
  0,
@@ -1338,7 +1314,7 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
1338
1314
  ]);
1339
1315
  const [longitudeText, setLongitudeText] = useState2(value3.longitude?.toString());
1340
1316
  const [latitudeText, setLatitudeText] = useState2(value3.latitude?.toString());
1341
- useEffect4(() => {
1317
+ useEffect3(() => {
1342
1318
  const location = GeoLocation3.fromGeoPoint(geoPoint);
1343
1319
  setLongitudeText(location.longitude?.toString());
1344
1320
  setLatitudeText(location.latitude?.toString());
@@ -1371,33 +1347,33 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
1371
1347
  if ((readonly || layout === "static") && !value3?.latitude && !value3?.longitude) {
1372
1348
  return null;
1373
1349
  }
1374
- return /* @__PURE__ */ React8.createElement(Input4.Root, {
1350
+ return /* @__PURE__ */ React7.createElement(Input3.Root, {
1375
1351
  validationValence: status
1376
- }, layout !== "inline" && /* @__PURE__ */ React8.createElement(FormFieldLabel, {
1352
+ }, layout !== "inline" && /* @__PURE__ */ React7.createElement(FormFieldLabel, {
1377
1353
  error,
1378
1354
  readonly,
1379
1355
  label,
1380
1356
  asChild: true
1381
- }), layout === "static" ? /* @__PURE__ */ React8.createElement(LatLng, value3) : /* @__PURE__ */ React8.createElement("div", {
1357
+ }), layout === "static" ? /* @__PURE__ */ React7.createElement(LatLng, value3) : /* @__PURE__ */ React7.createElement("div", {
1382
1358
  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, {
1359
+ className: "grid grid-cols-2 gap-form-gap"
1360
+ }, /* @__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
1361
  type: "number",
1386
1362
  step: "0.00001",
1387
1363
  min: "-90",
1388
1364
  max: "90",
1389
1365
  disabled: !!readonly,
1390
- placeholder: t("latitude placeholder"),
1366
+ placeholder: t("latitude.placeholder"),
1391
1367
  value: latitudeText ?? "",
1392
1368
  onChange: handleChange("latitude", setLatitudeText),
1393
1369
  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, {
1370
+ }))), /* @__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
1371
  type: "number",
1396
1372
  step: "0.00001",
1397
1373
  min: "-180",
1398
1374
  max: "180",
1399
1375
  disabled: !!readonly,
1400
- placeholder: t("longitude placeholder"),
1376
+ placeholder: t("longitude.placeholder"),
1401
1377
  value: longitudeText ?? "",
1402
1378
  onChange: handleChange("longitude", setLongitudeText),
1403
1379
  onBlur
@@ -1406,18 +1382,18 @@ var GeoPointField = ({ type, label, readonly, layout, getStatus, getValue, onVal
1406
1382
  var LatLng = ({ latitude = 0, longitude = 0 }) => {
1407
1383
  const latHem = latitude >= 0 ? "N" : "S";
1408
1384
  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", {
1385
+ return /* @__PURE__ */ React7.createElement("span", {
1386
+ className: "inline-flex items-center gap-form-gap"
1387
+ }, /* @__PURE__ */ React7.createElement("span", null, /* @__PURE__ */ React7.createElement("span", null, Math.abs(latitude).toFixed(5)), /* @__PURE__ */ React7.createElement("span", {
1412
1388
  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", {
1389
+ }, "\xB0", latHem)), /* @__PURE__ */ React7.createElement("span", null, /* @__PURE__ */ React7.createElement("span", null, Math.abs(longitude).toFixed(5)), /* @__PURE__ */ React7.createElement("span", {
1414
1390
  className: "text-subdued"
1415
1391
  }, "\xB0", lngHem)));
1416
1392
  };
1417
1393
 
1418
1394
  // 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";
1395
+ import React8, { useCallback as useCallback6, useEffect as useEffect4, useRef as useRef2 } from "react";
1396
+ import { Input as Input4 } from "@dxos/react-ui";
1421
1397
  var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, getValue, onValueChange, onBlur }) => {
1422
1398
  const { status, error } = getStatus();
1423
1399
  const textareaRef = useRef2(null);
@@ -1428,12 +1404,12 @@ var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, ge
1428
1404
  textarea.style.blockSize = `${textarea.scrollHeight + 2}px`;
1429
1405
  }
1430
1406
  }, []);
1431
- useEffect5(() => {
1407
+ useEffect4(() => {
1432
1408
  adjustHeight();
1433
1409
  }, [
1434
1410
  adjustHeight
1435
1411
  ]);
1436
- useEffect5(() => {
1412
+ useEffect4(() => {
1437
1413
  adjustHeight();
1438
1414
  }, [
1439
1415
  getValue(),
@@ -1447,40 +1423,40 @@ var MarkdownField = ({ type, readonly, label, placeholder, layout, getStatus, ge
1447
1423
  if ((readonly || layout === "static") && !value3) {
1448
1424
  return null;
1449
1425
  }
1450
- return /* @__PURE__ */ React9.createElement(Input5.Root, {
1426
+ return /* @__PURE__ */ React8.createElement(Input4.Root, {
1451
1427
  validationValence: status
1452
- }, layout !== "inline" && /* @__PURE__ */ React9.createElement(FormFieldLabel, {
1428
+ }, layout !== "inline" && /* @__PURE__ */ React8.createElement(FormFieldLabel, {
1453
1429
  error,
1454
1430
  readonly,
1455
1431
  label
1456
- }), layout === "static" ? /* @__PURE__ */ React9.createElement("p", null, value3) : /* @__PURE__ */ React9.createElement(Input5.TextArea, {
1432
+ }), layout === "static" ? /* @__PURE__ */ React8.createElement("p", null, value3) : /* @__PURE__ */ React8.createElement(Input4.TextArea, {
1457
1433
  ref: textareaRef,
1458
1434
  disabled: !!readonly,
1459
1435
  placeholder,
1460
1436
  value: value3 ?? "",
1461
- classNames: "min-bs-auto max-bs-40 overflow-auto",
1437
+ classNames: "min-h-auto max-h-40 overflow-auto",
1462
1438
  onChange: handleChange,
1463
1439
  onBlur,
1464
1440
  style: {
1465
1441
  resize: "none"
1466
1442
  },
1467
1443
  spellCheck: false
1468
- }), layout === "full" && /* @__PURE__ */ React9.createElement(Input5.Validation, null, error));
1444
+ }), layout === "full" && /* @__PURE__ */ React8.createElement(Input4.Validation, null, error));
1469
1445
  };
1470
1446
 
1471
1447
  // src/components/Form/fields/NumberField.tsx
1472
- import React10, { useCallback as useCallback7 } from "react";
1473
- import { Input as Input6 } from "@dxos/react-ui";
1448
+ import React9, { useCallback as useCallback7 } from "react";
1449
+ import { Input as Input5 } from "@dxos/react-ui";
1474
1450
  import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
1475
1451
  var NumberField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
1476
1452
  const handleChange = useCallback7((event) => onValueChange(type, safeParseFloat2(event.target.value) || 0), [
1477
1453
  type,
1478
1454
  onValueChange
1479
1455
  ]);
1480
- return /* @__PURE__ */ React10.createElement(FormFieldWrapper, {
1456
+ return /* @__PURE__ */ React9.createElement(FormFieldWrapper, {
1481
1457
  readonly,
1482
1458
  ...props
1483
- }, ({ value: value3 = "" }) => /* @__PURE__ */ React10.createElement(Input6.TextInput, {
1459
+ }, ({ value: value3 = "" }) => /* @__PURE__ */ React9.createElement(Input5.TextInput, {
1484
1460
  type: "number",
1485
1461
  disabled: !!readonly,
1486
1462
  placeholder,
@@ -1491,40 +1467,24 @@ var NumberField = ({ type, readonly, placeholder, onValueChange, onBlur, ...prop
1491
1467
  };
1492
1468
 
1493
1469
  // src/components/Form/fields/RefField.tsx
1470
+ import React11, { useCallback as useCallback9, useMemo as useMemo6 } from "react";
1494
1471
  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";
1472
+ import { Entity, Filter, Obj, Ref as Ref2, Type } from "@dxos/echo";
1498
1473
  import { useQuery, useSchema as useSchema$ } from "@dxos/echo-react";
1499
- import { findAnnotation } from "@dxos/effect";
1474
+ import { ReferenceAnnotationId as ReferenceAnnotationId2 } from "@dxos/echo/internal";
1475
+ import { findAnnotation as findAnnotation2 } from "@dxos/effect";
1500
1476
  import { DXN } from "@dxos/keys";
1501
1477
  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";
1478
+ import { Button, Icon as Icon2, Input as Input6, useTranslation as useTranslation6 } from "@dxos/react-ui";
1479
+ import { ParentLabelAnnotationId } from "@dxos/schema";
1480
+ import { mx as mx2 } from "@dxos/ui-theme";
1504
1481
 
1505
1482
  // 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);
1483
+ import React10, { forwardRef, useCallback as useCallback8, useState as useState3 } from "react";
1484
+ import { Popover, useTranslation as useTranslation5 } from "@dxos/react-ui";
1485
+ import { Combobox, useSearchListInput, useSearchListResults } from "@dxos/react-ui-search";
1486
+ var ObjectPickerContent = /* @__PURE__ */ forwardRef(({ options, selectedIds, createSchema, createOptionLabel, createOptionIcon, createInitialValuePath, createFieldMap: createFieldMap3, onSelect, onCreate, ...props }, forwardedRef) => {
1487
+ const { t } = useTranslation5(translationKey);
1528
1488
  const [showForm, setShowForm] = useState3(false);
1529
1489
  const [formInitialValue, setFormInitialValue] = useState3("");
1530
1490
  const { results, handleSearch } = useSearchListResults({
@@ -1553,39 +1513,66 @@ var ObjectPickerContent = /* @__PURE__ */ forwardRef2(({ options, selectedIds, c
1553
1513
  }, [
1554
1514
  createSchema
1555
1515
  ]);
1556
- return /* @__PURE__ */ React11.createElement(Combobox.Content, {
1516
+ if (showForm && createSchema) {
1517
+ return /* @__PURE__ */ React10.createElement(Combobox.Content, {
1518
+ ...props,
1519
+ onSearch: handleSearch,
1520
+ onKeyDownCapture: handleKeyDown,
1521
+ ref: forwardedRef
1522
+ }, /* @__PURE__ */ React10.createElement(Popover.Viewport, null, /* @__PURE__ */ React10.createElement(Form.Root, {
1523
+ testId: "create-referenced-object-form",
1524
+ schema: createSchema,
1525
+ defaultValues: createInitialValuePath ? {
1526
+ [createInitialValuePath]: formInitialValue
1527
+ } : {},
1528
+ fieldMap: createFieldMap3,
1529
+ onSave: handleFormSave,
1530
+ onCancel: handleFormCancel
1531
+ }, /* @__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));
1532
+ }
1533
+ return /* @__PURE__ */ React10.createElement(Combobox.Content, {
1557
1534
  ...props,
1558
- ref,
1559
1535
  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"),
1536
+ onKeyDownCapture: handleKeyDown,
1537
+ ref: forwardedRef
1538
+ }, /* @__PURE__ */ React10.createElement(Combobox.Input, {
1539
+ placeholder: t("ref-field-combobox-input.placeholder"),
1571
1540
  autoFocus: true
1572
- }), /* @__PURE__ */ React11.createElement(Combobox.List, null, results.map((option) => /* @__PURE__ */ React11.createElement(Combobox.Item, {
1541
+ }), /* @__PURE__ */ React10.createElement(Combobox.List, null, results.map((option) => /* @__PURE__ */ React10.createElement(Combobox.Item, {
1573
1542
  key: option.id,
1574
1543
  value: option.id,
1575
1544
  label: option.label,
1576
1545
  checked: selectedIds?.includes(option.id),
1577
1546
  onSelect: () => onSelect(option.id),
1578
1547
  classNames: "flex items-center gap-2"
1579
- })), createOptionLabel && createOptionIcon && createSchema && onCreate && /* @__PURE__ */ React11.createElement(CreateItem, {
1548
+ })), createSchema && onCreate && /* @__PURE__ */ React10.createElement(CreateItem, {
1580
1549
  createOptionLabel,
1581
- createOptionIcon,
1550
+ createOptionIcon: createOptionIcon ?? "ph--plus--regular",
1582
1551
  onCreateItemSelect: (query) => {
1583
1552
  setFormInitialValue(query);
1584
1553
  setShowForm(true);
1585
1554
  }
1586
- }))), /* @__PURE__ */ React11.createElement(Combobox.Arrow, null));
1555
+ })), /* @__PURE__ */ React10.createElement(Combobox.Arrow, null));
1587
1556
  });
1588
- ObjectPickerContent.displayName = "ObjectPickerContent";
1557
+ var CreateItem = ({ createOptionLabel, createOptionIcon, onCreateItemSelect }) => {
1558
+ const { t } = useTranslation5(translationKey);
1559
+ const { query } = useSearchListInput();
1560
+ const label = createOptionLabel ? t(createOptionLabel[0], {
1561
+ ns: createOptionLabel[1].ns,
1562
+ text: query
1563
+ }) : t("create-option.label");
1564
+ return /* @__PURE__ */ React10.createElement(Combobox.Item, {
1565
+ value: "__create__",
1566
+ label,
1567
+ icon: createOptionIcon,
1568
+ classNames: "flex items-center gap-2",
1569
+ closeOnSelect: false,
1570
+ onSelect: () => {
1571
+ onCreateItemSelect(query);
1572
+ }
1573
+ });
1574
+ };
1575
+ ObjectPickerContent.displayName = "ObjectPicker.Content";
1589
1576
  var ObjectPicker = {
1590
1577
  Root: Combobox.Root,
1591
1578
  Portal: Combobox.Portal,
@@ -1598,26 +1585,33 @@ var ObjectPicker = {
1598
1585
  var isRefSnapshot = (val) => {
1599
1586
  return typeof val === "object" && typeof val?.["/"] === "string";
1600
1587
  };
1601
- var defaultGetOptions = (results) => results.map((result) => {
1588
+ var defaultGetOptions = (results, { parentLabel } = {}) => results.map((result) => {
1602
1589
  const id = Entity.getDXN(result).toString();
1603
- const label = Entity.getLabel(result);
1590
+ const parent = parentLabel ? Obj.getParent(result) : void 0;
1591
+ const label = parent ? Entity.getLabel(parent) : Entity.getLabel(result);
1604
1592
  return {
1605
1593
  id,
1606
1594
  label: label ?? id
1607
1595
  };
1608
1596
  });
1609
- var defaultResultsHook = (db, typename) => useQuery(db, typename ? Filter.typename(typename) : Filter.nothing());
1597
+ var defaultResultsHook = (db, typename) => useQuery(db, typename ? typename === Type.getTypename(Obj.Unknown) ? Filter.everything() : Filter.typename(typename) : Filter.nothing());
1610
1598
  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);
1599
+ const { type, readonly, label, placeholder, layout, getStatus, getValue, createOptionLabel, createOptionIcon, createInitialValuePath, createFieldMap: createFieldMap3, db, resultsHook: useResults = defaultResultsHook, schemaHook: useSchema = useSchema$, getOptions = defaultGetOptions, onCreate, onValueChange } = props;
1600
+ const { t } = useTranslation6(translationKey);
1613
1601
  const { status, error } = getStatus();
1614
- const typename = useMemo6(() => type ? findAnnotation(type, ReferenceAnnotationId)?.typename : void 0, [
1602
+ const typename = useMemo6(() => type ? findAnnotation2(type, ReferenceAnnotationId2)?.typename : void 0, [
1615
1603
  type
1616
1604
  ]);
1617
1605
  const results = useResults(db, typename);
1618
- const options = useMemo6(() => getOptions2(results), [
1606
+ const options = useMemo6(() => {
1607
+ const parentLabel = type ? findAnnotation2(type, ParentLabelAnnotationId) === true : false;
1608
+ return getOptions(results, {
1609
+ parentLabel
1610
+ });
1611
+ }, [
1619
1612
  results,
1620
- getOptions2
1613
+ getOptions,
1614
+ type
1621
1615
  ]);
1622
1616
  const handleGetValue = useCallback9(() => {
1623
1617
  const formValue = getValue();
@@ -1674,55 +1668,56 @@ var RefField = (props) => {
1674
1668
  if (!typename || (readonly || layout === "static") && !item) {
1675
1669
  return null;
1676
1670
  }
1677
- return /* @__PURE__ */ React12.createElement(Input7.Root, {
1671
+ return /* @__PURE__ */ React11.createElement(Input6.Root, {
1678
1672
  validationValence: status
1679
- }, layout !== "inline" && /* @__PURE__ */ React12.createElement(FormFieldLabel, {
1673
+ }, layout !== "inline" && /* @__PURE__ */ React11.createElement(FormFieldLabel, {
1680
1674
  error,
1681
1675
  readonly,
1682
1676
  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, {
1677
+ }), /* @__PURE__ */ React11.createElement("div", null, readonly ? !item ? /* @__PURE__ */ React11.createElement("p", {
1678
+ className: mx2("text-description", "mb-2")
1679
+ }, t("empty-readonly-ref-field.label")) : /* @__PURE__ */ React11.createElement(DxAnchor, {
1686
1680
  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, {
1681
+ dxn: item.id,
1682
+ rootclassname: "me-1"
1683
+ }, item.label) : /* @__PURE__ */ React11.createElement(ObjectPicker.Root, null, /* @__PURE__ */ React11.createElement(ObjectPicker.Trigger, {
1690
1684
  asChild: true,
1691
1685
  classNames: "p-0"
1692
- }, item ? /* @__PURE__ */ React12.createElement("div", {
1693
- className: "flex gap-2 is-full"
1694
- }, /* @__PURE__ */ React12.createElement(Input7.Root, {
1686
+ }, item ? /* @__PURE__ */ React11.createElement("div", {
1687
+ className: "flex gap-form-gap w-full"
1688
+ }, /* @__PURE__ */ React11.createElement(Input6.Root, {
1695
1689
  key: item.id
1696
- }, /* @__PURE__ */ React12.createElement(Input7.TextInput, {
1690
+ }, /* @__PURE__ */ React11.createElement(Input6.TextInput, {
1697
1691
  value: item.label,
1698
1692
  readOnly: true,
1699
- classNames: "is-full"
1700
- }))) : /* @__PURE__ */ React12.createElement(Button2, {
1701
- classNames: "is-full text-start gap-2"
1702
- }, /* @__PURE__ */ React12.createElement("div", {
1693
+ classNames: "w-full"
1694
+ }))) : /* @__PURE__ */ React11.createElement(Button, {
1695
+ classNames: "w-full text-start gap-form-gap"
1696
+ }, /* @__PURE__ */ React11.createElement("div", {
1703
1697
  role: "none",
1704
1698
  className: "grow overflow-hidden"
1705
- }, /* @__PURE__ */ React12.createElement("span", {
1699
+ }, /* @__PURE__ */ React11.createElement("span", {
1706
1700
  className: "flex truncate text-description"
1707
- }, placeholder ?? t("ref field placeholder"))), /* @__PURE__ */ React12.createElement(Icon2, {
1701
+ }, placeholder ?? t("ref-field.placeholder"))), /* @__PURE__ */ React11.createElement(Icon2, {
1708
1702
  size: 3,
1709
1703
  icon: "ph--caret-down--bold"
1710
- }))), /* @__PURE__ */ React12.createElement(ObjectPicker.Portal, null, /* @__PURE__ */ React12.createElement(ObjectPicker.Content, {
1711
- classNames: "popover-card-width",
1704
+ }))), /* @__PURE__ */ React11.createElement(ObjectPicker.Portal, null, /* @__PURE__ */ React11.createElement(ObjectPicker.Content, {
1705
+ classNames: "dx-card-popover-width",
1712
1706
  options,
1713
1707
  selectedIds,
1714
1708
  createSchema: createSchema && omitId(createSchema),
1715
1709
  createOptionLabel,
1716
1710
  createOptionIcon,
1717
1711
  createInitialValuePath,
1712
+ createFieldMap: createFieldMap3,
1718
1713
  onCreate: handleCreate,
1719
1714
  onSelect: handleSelect
1720
- })))), layout === "full" && /* @__PURE__ */ React12.createElement(Input7.DescriptionAndValidation, null, error));
1715
+ })))), layout === "full" && /* @__PURE__ */ React11.createElement(Input6.DescriptionAndValidation, null, error));
1721
1716
  };
1722
1717
 
1723
1718
  // src/components/Form/fields/SelectField.tsx
1724
- import React13, { useCallback as useCallback10 } from "react";
1725
- import { Input as Input8, Select } from "@dxos/react-ui";
1719
+ import React12, { useCallback as useCallback10 } from "react";
1720
+ import { Input as Input7, Select } from "@dxos/react-ui";
1726
1721
  var SelectField = ({ type, readonly, label, layout, placeholder, options, getStatus, getValue, onValueChange }) => {
1727
1722
  const { status, error } = getStatus();
1728
1723
  const value3 = getValue();
@@ -1733,43 +1728,43 @@ var SelectField = ({ type, readonly, label, layout, placeholder, options, getSta
1733
1728
  if ((readonly || layout === "static") && value3 == null) {
1734
1729
  return null;
1735
1730
  }
1736
- return /* @__PURE__ */ React13.createElement(Input8.Root, {
1731
+ return /* @__PURE__ */ React12.createElement(Input7.Root, {
1737
1732
  validationValence: status
1738
- }, layout !== "inline" && /* @__PURE__ */ React13.createElement(FormFieldLabel, {
1733
+ }, layout !== "inline" && /* @__PURE__ */ React12.createElement(FormFieldLabel, {
1739
1734
  error,
1740
1735
  readonly,
1741
1736
  label
1742
- }), layout === "static" ? /* @__PURE__ */ React13.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value3)?.label ?? String(value3)) : /* @__PURE__ */ React13.createElement(Select.Root, {
1737
+ }), layout === "static" ? /* @__PURE__ */ React12.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value3)?.label ?? String(value3)) : /* @__PURE__ */ React12.createElement(Select.Root, {
1743
1738
  value: value3,
1744
1739
  onValueChange: handleValueChange
1745
- }, /* @__PURE__ */ React13.createElement(Select.TriggerButton, {
1746
- classNames: "is-full",
1740
+ }, /* @__PURE__ */ React12.createElement(Select.TriggerButton, {
1741
+ classNames: "w-full",
1747
1742
  disabled: !!readonly,
1748
1743
  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 }) => (
1744
+ }), /* @__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
1745
  // NOTE: Numeric values are converted to and from strings.
1751
- /* @__PURE__ */ React13.createElement(Select.Option, {
1746
+ /* @__PURE__ */ React12.createElement(Select.Option, {
1752
1747
  key: String(value4),
1753
1748
  value: String(value4)
1754
1749
  }, label2 ?? String(value4))
1755
- ))), /* @__PURE__ */ React13.createElement(Select.Arrow, null)))), layout === "full" && /* @__PURE__ */ React13.createElement(Input8.DescriptionAndValidation, null, error));
1750
+ ))), /* @__PURE__ */ React12.createElement(Select.Arrow, null)))), layout === "full" && /* @__PURE__ */ React12.createElement(Input7.DescriptionAndValidation, null, error));
1756
1751
  };
1757
1752
 
1758
1753
  // src/components/Form/fields/SelectOptionField.tsx
1759
- import React14, { useCallback as useCallback11, useEffect as useEffect6, useRef as useRef3, useState as useState4 } from "react";
1754
+ import React13, { useCallback as useCallback11, useEffect as useEffect5, useRef as useRef3, useState as useState4 } from "react";
1760
1755
  import { PublicKey } from "@dxos/keys";
1761
- import { IconButton as IconButton3, Input as Input9, Tag, useTranslation as useTranslation8 } from "@dxos/react-ui";
1756
+ import { IconButton as IconButton3, Input as Input8, Tag, useTranslation as useTranslation7 } from "@dxos/react-ui";
1762
1757
  import { List } from "@dxos/react-ui-list";
1763
1758
  import { HuePicker } from "@dxos/react-ui-pickers";
1764
1759
  import { hues, osTranslations, subtleHover } from "@dxos/ui-theme";
1765
1760
  var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueChange }) => {
1766
- const { t } = useTranslation8(translationKey);
1761
+ const { t } = useTranslation7(translationKey);
1767
1762
  const { status, error } = getStatus();
1768
1763
  const [selected, setSelectedId] = useState4(null);
1769
1764
  const [isNewOption, setIsNewOption] = useState4(false);
1770
1765
  const inputRef = useRef3(null);
1771
1766
  const options = getValue();
1772
- useEffect6(() => {
1767
+ useEffect5(() => {
1773
1768
  if (options === void 0) {
1774
1769
  onValueChange(type, []);
1775
1770
  }
@@ -1860,7 +1855,7 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
1860
1855
  type,
1861
1856
  onValueChange
1862
1857
  ]);
1863
- useEffect6(() => {
1858
+ useEffect5(() => {
1864
1859
  if (selected && isNewOption && inputRef.current) {
1865
1860
  inputRef.current.focus();
1866
1861
  setIsNewOption(false);
@@ -1869,42 +1864,42 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
1869
1864
  selected,
1870
1865
  isNewOption
1871
1866
  ]);
1872
- return /* @__PURE__ */ React14.createElement(Input9.Root, {
1867
+ return /* @__PURE__ */ React13.createElement(Input8.Root, {
1873
1868
  validationValence: status
1874
- }, /* @__PURE__ */ React14.createElement(FormFieldLabel, {
1869
+ }, /* @__PURE__ */ React13.createElement(FormFieldLabel, {
1875
1870
  error,
1876
1871
  readonly,
1877
1872
  label
1878
- }), /* @__PURE__ */ React14.createElement("div", {
1873
+ }), /* @__PURE__ */ React13.createElement("div", {
1879
1874
  role: "none"
1880
- }, options && /* @__PURE__ */ React14.createElement(List.Root, {
1875
+ }, options && /* @__PURE__ */ React13.createElement(List.Root, {
1881
1876
  items: options,
1882
1877
  isItem: (_item) => true,
1883
1878
  onMove: readonly ? void 0 : handleMove,
1884
1879
  readonly: !!readonly
1885
- }, ({ items }) => /* @__PURE__ */ React14.createElement("div", {
1880
+ }, ({ items }) => /* @__PURE__ */ React13.createElement("div", {
1886
1881
  role: "list",
1887
- className: "is-full overflow-auto"
1888
- }, items?.map((item) => /* @__PURE__ */ React14.createElement("div", {
1882
+ className: "w-full overflow-auto"
1883
+ }, items?.map((item) => /* @__PURE__ */ React13.createElement("div", {
1889
1884
  key: item.id
1890
- }, /* @__PURE__ */ React14.createElement(List.Item, {
1885
+ }, /* @__PURE__ */ React13.createElement(List.Item, {
1891
1886
  role: "button",
1892
1887
  item,
1893
1888
  classNames: [
1894
1889
  subtleHover,
1895
- "flex flex-col cursor-pointer rounded-sm"
1890
+ "flex flex-col cursor-pointer rounded-xs"
1896
1891
  ],
1897
1892
  "aria-expanded": selected === item.id
1898
- }, /* @__PURE__ */ React14.createElement("div", {
1893
+ }, /* @__PURE__ */ React13.createElement("div", {
1899
1894
  className: "flex items-center"
1900
- }, /* @__PURE__ */ React14.createElement(List.ItemDragHandle, {
1895
+ }, /* @__PURE__ */ React13.createElement(List.ItemDragHandle, {
1901
1896
  disabled: !!readonly
1902
- }), /* @__PURE__ */ React14.createElement(List.ItemTitle, {
1897
+ }), /* @__PURE__ */ React13.createElement(List.ItemTitle, {
1903
1898
  onClick: () => handleClick(item.id),
1904
1899
  classNames: "flex-1"
1905
- }, /* @__PURE__ */ React14.createElement(Tag, {
1900
+ }, /* @__PURE__ */ React13.createElement(Tag, {
1906
1901
  palette: item.color
1907
- }, item.title || "\u200B")), /* @__PURE__ */ React14.createElement(IconButton3, {
1902
+ }, item.title || "\u200B")), /* @__PURE__ */ React13.createElement(IconButton3, {
1908
1903
  iconOnly: true,
1909
1904
  variant: "ghost",
1910
1905
  label: t(selected === item.id ? "collapse label" : "expand label", {
@@ -1912,52 +1907,52 @@ var SelectOptionField = ({ type, readonly, label, getStatus, getValue, onValueCh
1912
1907
  }),
1913
1908
  icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
1914
1909
  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, {
1910
+ })), selected === item.id && /* @__PURE__ */ React13.createElement("div", {
1911
+ className: "flex flex-col p-form-padding gap-form-gap dx-density-fine"
1912
+ }, /* @__PURE__ */ React13.createElement(Input8.Label, {
1918
1913
  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, {
1914
+ }, t("select-option.label")), /* @__PURE__ */ React13.createElement("div", {
1915
+ className: "grid grid-cols-[1fr_min-content_min-content] gap-form-gap"
1916
+ }, /* @__PURE__ */ React13.createElement(Input8.TextInput, {
1922
1917
  disabled: !!readonly,
1923
- placeholder: t("select option label placeholder"),
1918
+ placeholder: t("select-option-label.placeholder"),
1924
1919
  ref: selected === item.id ? inputRef : void 0,
1925
1920
  value: item.title,
1926
1921
  onChange: handleTitleChange(item.id),
1927
1922
  onKeyDown: handleKeyDown,
1928
1923
  classNames: "flex-1"
1929
- }), /* @__PURE__ */ React14.createElement(HuePicker, {
1924
+ }), /* @__PURE__ */ React13.createElement(HuePicker, {
1930
1925
  disabled: !!readonly,
1931
1926
  value: item.color,
1932
1927
  onChange: handleColorChange(item.id)
1933
- }), /* @__PURE__ */ React14.createElement(IconButton3, {
1928
+ }), /* @__PURE__ */ React13.createElement(IconButton3, {
1934
1929
  disabled: !!readonly,
1935
1930
  icon: "ph--trash--fill",
1936
1931
  iconOnly: true,
1937
- label: t("select option delete"),
1932
+ label: t("select-option-delete.button"),
1938
1933
  onClick: () => handleDelete(item.id)
1939
- })))))), /* @__PURE__ */ React14.createElement(IconButton3, {
1934
+ })))))), /* @__PURE__ */ React13.createElement(IconButton3, {
1940
1935
  variant: "ghost",
1941
1936
  icon: "ph--plus--regular",
1942
- label: t("select option add"),
1937
+ label: t("select-option-add.button"),
1943
1938
  onClick: handleAdd,
1944
1939
  disabled: !!readonly,
1945
- classNames: "is-full"
1940
+ classNames: "w-full"
1946
1941
  })))));
1947
1942
  };
1948
1943
 
1949
1944
  // src/components/Form/fields/TextField.tsx
1950
- import React15, { useCallback as useCallback12 } from "react";
1951
- import { Input as Input10 } from "@dxos/react-ui";
1945
+ import React14, { useCallback as useCallback12 } from "react";
1946
+ import { Input as Input9 } from "@dxos/react-ui";
1952
1947
  var TextField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
1953
1948
  const handleChange = useCallback12((event) => onValueChange(type, event.target.value), [
1954
1949
  type,
1955
1950
  onValueChange
1956
1951
  ]);
1957
- return /* @__PURE__ */ React15.createElement(FormFieldWrapper, {
1952
+ return /* @__PURE__ */ React14.createElement(FormFieldWrapper, {
1958
1953
  readonly,
1959
1954
  ...props
1960
- }, ({ value: value3 = "" }) => /* @__PURE__ */ React15.createElement(Input10.TextInput, {
1955
+ }, ({ value: value3 = "" }) => /* @__PURE__ */ React14.createElement(Input9.TextInput, {
1961
1956
  noAutoFill: true,
1962
1957
  disabled: !!readonly,
1963
1958
  placeholder,
@@ -1968,17 +1963,17 @@ var TextField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props
1968
1963
  };
1969
1964
 
1970
1965
  // src/components/Form/fields/TextAreaField.tsx
1971
- import React16, { useCallback as useCallback13 } from "react";
1972
- import { Input as Input11 } from "@dxos/react-ui";
1966
+ import React15, { useCallback as useCallback13 } from "react";
1967
+ import { Input as Input10 } from "@dxos/react-ui";
1973
1968
  var TextAreaField = ({ type, readonly, placeholder, onValueChange, onBlur, ...props }) => {
1974
1969
  const handleChange = useCallback13((event) => onValueChange(type, event.target.value), [
1975
1970
  type,
1976
1971
  onValueChange
1977
1972
  ]);
1978
- return /* @__PURE__ */ React16.createElement(FormFieldWrapper, {
1973
+ return /* @__PURE__ */ React15.createElement(FormFieldWrapper, {
1979
1974
  readonly,
1980
1975
  ...props
1981
- }, ({ value: value3 = "" }) => /* @__PURE__ */ React16.createElement(Input11.TextArea, {
1976
+ }, ({ value: value3 = "" }) => /* @__PURE__ */ React15.createElement(Input10.TextArea, {
1982
1977
  rows: 3,
1983
1978
  disabled: !!readonly,
1984
1979
  placeholder,
@@ -1989,9 +1984,9 @@ var TextAreaField = ({ type, readonly, placeholder, onValueChange, onBlur, ...pr
1989
1984
  };
1990
1985
 
1991
1986
  // 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";
1987
+ import React16 from "react";
1988
+ import { Input as Input11 } from "@dxos/react-ui";
1989
+ import { mx as mx3 } from "@dxos/ui-theme";
1995
1990
  import { safeParseFloat as safeParseFloat3 } from "@dxos/util";
1996
1991
  var gridCols = [
1997
1992
  "grid-cols-1",
@@ -2002,15 +1997,15 @@ var gridCols = [
2002
1997
  var TupleField = ({ binding, type, readonly, label, getStatus, getValue, onValueChange, onBlur }) => {
2003
1998
  const { status, error } = getStatus();
2004
1999
  const values = getValue() ?? {};
2005
- return /* @__PURE__ */ React17.createElement(Input12.Root, {
2000
+ return /* @__PURE__ */ React16.createElement(Input11.Root, {
2006
2001
  validationValence: status
2007
- }, /* @__PURE__ */ React17.createElement(FormFieldLabel, {
2002
+ }, /* @__PURE__ */ React16.createElement(FormFieldLabel, {
2008
2003
  error,
2009
2004
  readonly,
2010
2005
  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, {
2006
+ }), /* @__PURE__ */ React16.createElement("div", {
2007
+ className: mx3("grid gap-form-gap", gridCols[binding.length - 1])
2008
+ }, binding.map((prop) => /* @__PURE__ */ React16.createElement(Input11.TextInput, {
2014
2009
  key: prop,
2015
2010
  type: "number",
2016
2011
  disabled: !!readonly,
@@ -2028,9 +2023,9 @@ var TupleField = ({ binding, type, readonly, label, getStatus, getValue, onValue
2028
2023
  // src/components/FieldEditor/FieldEditor.tsx
2029
2024
  var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
2030
2025
  var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCancel }) => {
2031
- const { t } = useTranslation9(translationKey);
2026
+ const { t } = useTranslation8(translationKey);
2032
2027
  const [props, setProps] = useState5(projection.getFieldProjection(field.id).props);
2033
- useEffect7(() => setProps(projection.getFieldProjection(field.id).props), [
2028
+ useEffect6(() => setProps(projection.getFieldProjection(field.id).props), [
2034
2029
  field,
2035
2030
  projection
2036
2031
  ]);
@@ -2049,7 +2044,7 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2049
2044
  registry
2050
2045
  ]);
2051
2046
  const [referenceSchema, setReferenceSchema] = useState5();
2052
- useEffect7(() => {
2047
+ useEffect6(() => {
2053
2048
  setReferenceSchema(schemas.find((schema) => schema.typename === props?.referenceSchema));
2054
2049
  }, [
2055
2050
  schemas,
@@ -2059,26 +2054,26 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2059
2054
  fieldSchema: getFormatSchema(props?.format)
2060
2055
  });
2061
2056
  const fieldMap = useMemo7(() => ({
2062
- ["format"]: (props2) => /* @__PURE__ */ React18.createElement(SelectField, {
2057
+ ["format"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
2063
2058
  ...props2,
2064
2059
  options: FormatEnums.filter((value3) => value3 !== Format4.TypeFormat.None).map((value3) => ({
2065
2060
  value: value3,
2066
- label: t(`format ${value3}`)
2061
+ label: t(`format.${value3}.label`)
2067
2062
  }))
2068
2063
  }),
2069
- ["referenceSchema"]: (props2) => /* @__PURE__ */ React18.createElement(SelectField, {
2064
+ ["referenceSchema"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
2070
2065
  ...props2,
2071
2066
  options: schemas.map((schema) => ({
2072
2067
  value: schema.typename
2073
2068
  }))
2074
2069
  }),
2075
- ["referencePath"]: (props2) => /* @__PURE__ */ React18.createElement(SelectField, {
2070
+ ["referencePath"]: (props2) => /* @__PURE__ */ React17.createElement(SelectField, {
2076
2071
  ...props2,
2077
2072
  options: referenceSchema ? getFormProperties(referenceSchema.ast).sort((a, b) => a.name.toString().localeCompare(b.name.toString())).map((p) => ({
2078
2073
  value: p.name.toString()
2079
2074
  })) : []
2080
2075
  }),
2081
- ["options"]: (props2) => /* @__PURE__ */ React18.createElement(SelectOptionField, props2)
2076
+ ["options"]: (props2) => /* @__PURE__ */ React17.createElement(SelectOptionField, props2)
2082
2077
  }), [
2083
2078
  t,
2084
2079
  schemas,
@@ -2137,7 +2132,7 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2137
2132
  ]);
2138
2133
  const handleSave = useCallback14((props2) => {
2139
2134
  if (view) {
2140
- Obj3.change(view, () => {
2135
+ Obj2.change(view, () => {
2141
2136
  projection.setFieldProjection({
2142
2137
  field,
2143
2138
  props: props2
@@ -2167,13 +2162,13 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2167
2162
  props
2168
2163
  }, {
2169
2164
  F: __dxlog_file2,
2170
- L: 173,
2165
+ L: 172,
2171
2166
  S: void 0,
2172
2167
  C: (f, a) => f(...a)
2173
2168
  });
2174
2169
  return null;
2175
2170
  }
2176
- return /* @__PURE__ */ React18.createElement(Form.Root, {
2171
+ return /* @__PURE__ */ React17.createElement(Form.Root, {
2177
2172
  key: field.id,
2178
2173
  fieldMap,
2179
2174
  autoFocus: true,
@@ -2189,33 +2184,346 @@ var FieldEditor = ({ readonly, projection, field, registry, view, onSave, onCanc
2189
2184
  onValidate: handleValidate,
2190
2185
  onSave: handleSave,
2191
2186
  onCancel: handleCancel
2192
- }, /* @__PURE__ */ React18.createElement(Form.Content, null, /* @__PURE__ */ React18.createElement(Form.FieldSet, null), /* @__PURE__ */ React18.createElement(Form.Actions, null)));
2187
+ }, /* @__PURE__ */ React17.createElement(Form.Content, null, /* @__PURE__ */ React17.createElement(Form.FieldSet, null), /* @__PURE__ */ React17.createElement(Form.Actions, null)));
2188
+ };
2189
+
2190
+ // src/components/ObjectForm/ObjectForm.tsx
2191
+ import * as Schema3 from "effect/Schema";
2192
+ import React18, { useCallback as useCallback15, useMemo as useMemo8 } from "react";
2193
+ import { DXN as DXN2, Obj as Obj3, Ref as Ref3, Tag as Tag2, Type as Type2 } from "@dxos/echo";
2194
+ import { splitJsonPath } from "@dxos/echo/internal";
2195
+ import { invariant } from "@dxos/invariant";
2196
+ import { HuePicker as HuePicker2 } from "@dxos/react-ui-pickers";
2197
+ import { isNonNullable } from "@dxos/util";
2198
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ObjectForm/ObjectForm.tsx";
2199
+ var createFieldMap = {
2200
+ hue: ({ type, label, layout, getValue, onValueChange }) => {
2201
+ const handleChange = useCallback15((nextHue) => onValueChange(type, nextHue), [
2202
+ onValueChange,
2203
+ type
2204
+ ]);
2205
+ const handleReset = useCallback15(() => onValueChange(type, void 0), [
2206
+ onValueChange,
2207
+ type
2208
+ ]);
2209
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, layout !== "inline" && /* @__PURE__ */ React18.createElement(Form.Label, {
2210
+ label
2211
+ }), /* @__PURE__ */ React18.createElement(HuePicker2, {
2212
+ value: getValue(),
2213
+ onChange: handleChange,
2214
+ onReset: handleReset
2215
+ }));
2216
+ }
2217
+ };
2218
+ var ObjectForm = ({ object, schema }) => {
2219
+ const db = Obj3.getDatabase(object);
2220
+ const meta = Obj3.getMeta(object);
2221
+ const tags = (meta.tags ?? []).map((tag) => db?.makeRef(DXN2.parse(tag))).filter(isNonNullable);
2222
+ const values = useMemo8(() => ({
2223
+ tags,
2224
+ ...object
2225
+ }), [
2226
+ object,
2227
+ tags
2228
+ ]);
2229
+ const formSchema = useMemo8(() => omitId(Schema3.Struct({
2230
+ tags: Schema3.Array(Ref3.Ref(Tag2.Tag)).pipe(Schema3.optional)
2231
+ }).pipe(Schema3.extend(schema))), [
2232
+ schema
2233
+ ]);
2234
+ const handleCreate = useCallback15((schema2, values2) => {
2235
+ invariant(db, void 0, {
2236
+ F: __dxlog_file3,
2237
+ L: 51,
2238
+ S: void 0,
2239
+ A: [
2240
+ "db",
2241
+ ""
2242
+ ]
2243
+ });
2244
+ invariant(Type2.isObjectSchema(schema2), void 0, {
2245
+ F: __dxlog_file3,
2246
+ L: 52,
2247
+ S: void 0,
2248
+ A: [
2249
+ "Type.isObjectSchema(schema)",
2250
+ ""
2251
+ ]
2252
+ });
2253
+ const newObject = db.add(Obj3.make(schema2, values2));
2254
+ if (Obj3.instanceOf(Tag2.Tag, newObject)) {
2255
+ Obj3.change(object, (object2) => {
2256
+ Obj3.getMeta(object2).tags = [
2257
+ ...Obj3.getMeta(object2).tags ?? [],
2258
+ Obj3.getDXN(newObject).toString()
2259
+ ];
2260
+ });
2261
+ }
2262
+ }, []);
2263
+ const handleChange = useCallback15(({ tags: tags2, ...values2 }, { isValid, changed }) => {
2264
+ if (!isValid) {
2265
+ return;
2266
+ }
2267
+ const changedPaths = Object.keys(changed).filter((path) => changed[path]);
2268
+ const hasTagsChange = changedPaths.some((path) => splitJsonPath(path)[0] === "tags");
2269
+ if (hasTagsChange) {
2270
+ Obj3.change(object, (object2) => {
2271
+ Obj3.getMeta(object2).tags = tags2?.map((tag) => tag.dxn.toString()) ?? [];
2272
+ });
2273
+ }
2274
+ const nonTagPaths = changedPaths.filter((path) => splitJsonPath(path)[0] !== "tags");
2275
+ if (nonTagPaths.length > 0) {
2276
+ Obj3.change(object, () => {
2277
+ for (const path of nonTagPaths) {
2278
+ const parts = splitJsonPath(path);
2279
+ const value3 = Obj3.getValue(values2, parts);
2280
+ Obj3.setValue(object, parts, value3);
2281
+ }
2282
+ });
2283
+ }
2284
+ }, [
2285
+ object
2286
+ ]);
2287
+ return /* @__PURE__ */ React18.createElement(Form.Root, {
2288
+ schema: formSchema,
2289
+ defaultValues: values,
2290
+ createTypename: Type2.getTypename(Tag2.Tag),
2291
+ createOptionIcon: "ph--plus--regular",
2292
+ createOptionLabel: [
2293
+ "add-tag.label",
2294
+ {
2295
+ ns: translationKey
2296
+ }
2297
+ ],
2298
+ createInitialValuePath: "label",
2299
+ createFieldMap,
2300
+ db,
2301
+ onValuesChanged: handleChange,
2302
+ onCreate: handleCreate
2303
+ }, /* @__PURE__ */ React18.createElement(Form.Viewport, null, /* @__PURE__ */ React18.createElement(Form.Content, null, /* @__PURE__ */ React18.createElement(Form.FieldSet, null))));
2304
+ };
2305
+
2306
+ // src/components/ObjectProperties/ObjectProperties.tsx
2307
+ import * as Function from "effect/Function";
2308
+ import * as Option4 from "effect/Option";
2309
+ import * as Schema4 from "effect/Schema";
2310
+ import React19, { useCallback as useCallback16, useMemo as useMemo9 } from "react";
2311
+ import { DXN as DXN3, Obj as Obj4, Ref as Ref4, Tag as Tag3, Type as Type3 } from "@dxos/echo";
2312
+ import { splitJsonPath as splitJsonPath2 } from "@dxos/echo/internal";
2313
+ import { invariant as invariant2 } from "@dxos/invariant";
2314
+ import { HuePicker as HuePicker3 } from "@dxos/react-ui-pickers";
2315
+ import { composable as composable2, composableProps as composableProps2 } from "@dxos/ui-theme";
2316
+ import { isNonNullable as isNonNullable2 } from "@dxos/util";
2317
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ObjectProperties/ObjectProperties.tsx";
2318
+ var ObjectProperties = composable2(({ children, object, ...props }, forwardedRef) => {
2319
+ const db = Obj4.getDatabase(object);
2320
+ const meta = Obj4.getMeta(object);
2321
+ const tags = (meta.tags ?? []).map((tag) => db?.makeRef(DXN3.parse(tag))).filter(isNonNullable2);
2322
+ const values = useMemo9(() => ({
2323
+ tags,
2324
+ ...object
2325
+ }), [
2326
+ object,
2327
+ tags
2328
+ ]);
2329
+ const formSchema = useMemo9(() => {
2330
+ return Function.pipe(Obj4.getSchema(object), Option4.fromNullable, Option4.map((schema) => omitId(BaseSchema.pipe(Schema4.extend(schema)))), Option4.getOrUndefined);
2331
+ }, [
2332
+ object
2333
+ ]);
2334
+ const handleCreate = useCallback16((schema, values2) => {
2335
+ invariant2(db, void 0, {
2336
+ F: __dxlog_file4,
2337
+ L: 40,
2338
+ S: void 0,
2339
+ A: [
2340
+ "db",
2341
+ ""
2342
+ ]
2343
+ });
2344
+ invariant2(Type3.isObjectSchema(schema), void 0, {
2345
+ F: __dxlog_file4,
2346
+ L: 41,
2347
+ S: void 0,
2348
+ A: [
2349
+ "Type.isObjectSchema(schema)",
2350
+ ""
2351
+ ]
2352
+ });
2353
+ const newObject = db.add(Obj4.make(schema, values2));
2354
+ if (Obj4.instanceOf(Tag3.Tag, newObject)) {
2355
+ Obj4.change(object, (object2) => {
2356
+ Obj4.getMeta(object2).tags = [
2357
+ ...Obj4.getMeta(object2).tags ?? [],
2358
+ Obj4.getDXN(newObject).toString()
2359
+ ];
2360
+ });
2361
+ }
2362
+ }, []);
2363
+ const handleChange = useCallback16(({ tags: tags2, ...values2 }, { isValid, changed }) => {
2364
+ if (!isValid) {
2365
+ return;
2366
+ }
2367
+ const changedPaths = Object.keys(changed).filter((path) => changed[path]);
2368
+ const hasTagsChange = changedPaths.some((path) => splitJsonPath2(path)[0] === "tags");
2369
+ if (hasTagsChange) {
2370
+ Obj4.change(object, (object2) => {
2371
+ Obj4.getMeta(object2).tags = tags2?.map((tag) => tag.dxn.toString()) ?? [];
2372
+ });
2373
+ }
2374
+ const nonTagPaths = changedPaths.filter((path) => splitJsonPath2(path)[0] !== "tags");
2375
+ if (nonTagPaths.length > 0) {
2376
+ Obj4.change(object, () => {
2377
+ for (const path of nonTagPaths) {
2378
+ const parts = splitJsonPath2(path);
2379
+ const value3 = Obj4.getValue(values2, parts);
2380
+ Obj4.setValue(object, parts, value3);
2381
+ }
2382
+ });
2383
+ }
2384
+ }, [
2385
+ object
2386
+ ]);
2387
+ if (!formSchema) {
2388
+ return null;
2389
+ }
2390
+ return /* @__PURE__ */ React19.createElement(Form.Root, {
2391
+ schema: formSchema,
2392
+ defaultValues: values,
2393
+ createTypename: Type3.getTypename(Tag3.Tag),
2394
+ createOptionIcon: "ph--plus--regular",
2395
+ createOptionLabel: [
2396
+ "add-tag.label",
2397
+ {
2398
+ ns: translationKey
2399
+ }
2400
+ ],
2401
+ createInitialValuePath: "label",
2402
+ createFieldMap: createFieldMap2,
2403
+ db,
2404
+ onValuesChanged: handleChange,
2405
+ onCreate: handleCreate
2406
+ }, /* @__PURE__ */ React19.createElement(Form.Viewport, {
2407
+ ...composableProps2(props),
2408
+ ref: forwardedRef
2409
+ }, /* @__PURE__ */ React19.createElement(Form.Content, null, /* @__PURE__ */ React19.createElement(Form.FieldSet, null), children)));
2410
+ });
2411
+ var createFieldMap2 = {
2412
+ hue: ({ type, label, layout, getValue, onValueChange }) => {
2413
+ const handleChange = useCallback16((nextHue) => onValueChange(type, nextHue), [
2414
+ onValueChange,
2415
+ type
2416
+ ]);
2417
+ const handleReset = useCallback16(() => onValueChange(type, void 0), [
2418
+ onValueChange,
2419
+ type
2420
+ ]);
2421
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, layout !== "inline" && /* @__PURE__ */ React19.createElement(Form.Label, {
2422
+ label
2423
+ }), /* @__PURE__ */ React19.createElement(HuePicker3, {
2424
+ value: getValue(),
2425
+ onChange: handleChange,
2426
+ onReset: handleReset
2427
+ }));
2428
+ }
2429
+ };
2430
+ var BaseSchema = Schema4.Struct({
2431
+ tags: Schema4.Array(Ref4.Ref(Tag3.Tag)).pipe(Schema4.optional)
2432
+ });
2433
+
2434
+ // src/components/Settings/Settings.tsx
2435
+ import React20 from "react";
2436
+ import { Input as Input12, ScrollArea as ScrollArea2, toLocalizedString, useTranslation as useTranslation9 } from "@dxos/react-ui";
2437
+ import { composable as composable3, composableProps as composableProps3, mx as mx4 } from "@dxos/ui-theme";
2438
+ var SETTINGS_ROOT_NAME = "Settings.Root";
2439
+ var SETTINGS_VIEWPORT_NAME = "Settings.Viewport";
2440
+ var SETTINGS_SECTION_NAME = "Settings.Section";
2441
+ var SETTINGS_PANEL_NAME = "Settings.Panel";
2442
+ var SETTINGS_ITEM_NAME = "Settings.Item";
2443
+ var SettingsRoot = ({ children, classNames }) => {
2444
+ return /* @__PURE__ */ React20.createElement("div", {
2445
+ className: mx4("flex flex-col gap-2", classNames)
2446
+ }, children);
2447
+ };
2448
+ SettingsRoot.displayName = SETTINGS_ROOT_NAME;
2449
+ var SettingsViewport = composable3(({ children, ...props }, forwardedRef) => {
2450
+ return /* @__PURE__ */ React20.createElement(ScrollArea2.Root, {
2451
+ ...composableProps3(props),
2452
+ orientation: "vertical",
2453
+ centered: true,
2454
+ thin: true,
2455
+ ref: forwardedRef
2456
+ }, /* @__PURE__ */ React20.createElement(ScrollArea2.Viewport, {
2457
+ classNames: "px-4 pointer-coarse:px-2"
2458
+ }, /* @__PURE__ */ React20.createElement("div", {
2459
+ role: "none",
2460
+ className: "dx-document flex flex-col gap-2 py-4"
2461
+ }, children)));
2462
+ });
2463
+ SettingsViewport.displayName = SETTINGS_VIEWPORT_NAME;
2464
+ var SettingsSection = ({ title, description, children }) => {
2465
+ const { t } = useTranslation9(translationKey);
2466
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement("h2", {
2467
+ className: "px-trim-md mt-trim-md text-xl"
2468
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React20.createElement("p", {
2469
+ className: "px-trim-md text-description"
2470
+ }, toLocalizedString(description, t)), /* @__PURE__ */ React20.createElement("div", {
2471
+ className: "w-full pt-trim-md space-y-trim-md"
2472
+ }, children));
2473
+ };
2474
+ SettingsSection.displayName = SETTINGS_SECTION_NAME;
2475
+ var SettingsPanel = ({ classNames, children }) => {
2476
+ return /* @__PURE__ */ React20.createElement("div", {
2477
+ role: "none",
2478
+ className: mx4("flex flex-col gap-3 p-trim-md border border-separator rounded-sm", classNames)
2479
+ }, children);
2480
+ };
2481
+ SettingsPanel.displayName = SETTINGS_PANEL_NAME;
2482
+ var SettingsItem = ({ title, description = "", children }) => {
2483
+ const { t } = useTranslation9(translationKey);
2484
+ return /* @__PURE__ */ React20.createElement(Input12.Root, null, /* @__PURE__ */ React20.createElement(SettingsPanel, {
2485
+ classNames: "grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-x-trim-lg gap-y-0"
2486
+ }, /* @__PURE__ */ React20.createElement(Input12.Label, {
2487
+ classNames: "pb-trim-md text-base-surface-text text-lg md:col-span-2"
2488
+ }, toLocalizedString(title, t)), /* @__PURE__ */ React20.createElement(Input12.DescriptionAndValidation, null, /* @__PURE__ */ React20.createElement(Input12.Description, {
2489
+ classNames: "text-base text-description"
2490
+ }, toLocalizedString(description, t))), /* @__PURE__ */ React20.createElement("div", {
2491
+ role: "none",
2492
+ className: "text-end py-1"
2493
+ }, children)));
2494
+ };
2495
+ SettingsItem.displayName = SETTINGS_ITEM_NAME;
2496
+ var Settings = {
2497
+ Root: SettingsRoot,
2498
+ Viewport: SettingsViewport,
2499
+ Section: SettingsSection,
2500
+ Panel: SettingsPanel,
2501
+ Item: SettingsItem
2193
2502
  };
2194
2503
 
2195
2504
  // src/components/ViewEditor/ViewEditor.tsx
2196
2505
  import { RegistryContext } from "@effect-atom/atom-react";
2197
- import * as Array2 from "effect/Array";
2506
+ import * as Array4 from "effect/Array";
2198
2507
  import * as Match2 from "effect/Match";
2199
- import * as Option4 from "effect/Option";
2200
- 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";
2508
+ import * as Option5 from "effect/Option";
2509
+ import * as Schema5 from "effect/Schema";
2510
+ import React21, { forwardRef as forwardRef2, useCallback as useCallback17, useContext, useImperativeHandle, useMemo as useMemo10, useState as useState6 } from "react";
2511
+ import { Entity as Entity2, Feed, Filter as Filter2, Format as Format5, Obj as Obj5, Query, QueryAST, Ref as Ref5 } from "@dxos/echo";
2512
+ import { View } from "@dxos/echo";
2203
2513
  import { EchoSchema, isMutable, toJsonSchema } from "@dxos/echo/internal";
2204
- 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";
2514
+ import { invariant as invariant3 } from "@dxos/invariant";
2515
+ import { useObject, useQuery as useQuery2 } from "@dxos/react-client/echo";
2516
+ import { IconButton as IconButton4, Input as Input13, Message, useTranslation as useTranslation10 } from "@dxos/react-ui";
2207
2517
  import { QueryForm } from "@dxos/react-ui-components";
2208
2518
  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";
2211
- 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) => {
2519
+ import { ParentLabelAnnotation, ProjectionModel, VIEW_FIELD_LIMIT, createEchoChangeCallback, getTypenameFromQuery } from "@dxos/schema";
2520
+ import { mx as mx5, osTranslations as osTranslations2, subtleHover as subtleHover2 } from "@dxos/ui-theme";
2521
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
2522
+ var ViewEditor = /* @__PURE__ */ forwardRef2(({ classNames, schema, view, mode = "schema", registry, db, readonly, showHeading = false, types, tags, onQueryChanged, onDelete }, forwardedRef) => {
2215
2523
  const atomRegistry = useContext(RegistryContext);
2216
2524
  const schemaReadonly = !isMutable(schema);
2217
2525
  const { t } = useTranslation10(translationKey);
2218
- const projectionModel = useMemo8(() => {
2526
+ const projectionModel = useMemo10(() => {
2219
2527
  const jsonSchema = schema instanceof EchoSchema ? schema.jsonSchema : toJsonSchema(schema);
2220
2528
  const change = createEchoChangeCallback(view, schema instanceof EchoSchema ? schema : void 0);
2221
2529
  const model = new ProjectionModel({
@@ -2233,14 +2541,27 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2233
2541
  useImperativeHandle(forwardedRef, () => projectionModel, [
2234
2542
  projectionModel
2235
2543
  ]);
2236
- const [expandedField, setExpandedField] = useState6();
2237
2544
  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);
2545
+ type: "from"
2546
+ }, ({ from }) => {
2547
+ if (from._tag !== "scope") {
2548
+ return void 0;
2549
+ }
2550
+ return Option5.fromNullable(from.scope.queues).pipe(Option5.flatMap((queues) => Array4.head(queues)), Option5.map(String), Option5.getOrUndefined);
2241
2551
  }), Match2.orElse(() => void 0));
2242
- const viewSchema = useMemo8(() => {
2243
- const base = Schema3.Struct({
2552
+ const feeds = useQuery2(db, Filter2.type(Feed.Feed));
2553
+ const targetRef = useMemo10(() => {
2554
+ if (!queueTarget) {
2555
+ return void 0;
2556
+ }
2557
+ const feed = feeds.find((feed2) => Feed.getQueueDxn(feed2)?.toString() === queueTarget);
2558
+ return feed ? Ref5.fromDXN(Entity2.getDXN(feed)) : void 0;
2559
+ }, [
2560
+ queueTarget,
2561
+ feeds
2562
+ ]);
2563
+ const viewSchema = useMemo10(() => {
2564
+ const base = Schema5.Struct({
2244
2565
  query: mode === "schema" ? Format5.URL.annotations({
2245
2566
  title: "Record type"
2246
2567
  }) : QueryAST.Query.annotations({
@@ -2248,26 +2569,27 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2248
2569
  })
2249
2570
  });
2250
2571
  if (mode === "tag") {
2251
- return Schema3.Struct({
2572
+ return Schema5.Struct({
2252
2573
  ...base.fields,
2253
- target: Schema3.optional(Schema3.String.annotations({
2254
- title: "Target Queue"
2255
- }))
2256
- }).pipe(Schema3.mutable);
2574
+ // TODO(wittjosiah): Replace Type.Feed with Dataset.Dataset when Ref.Ref supports unions.
2575
+ target: Ref5.Ref(Feed.Feed).pipe(Schema5.annotations({
2576
+ title: "Target Feed"
2577
+ }), ParentLabelAnnotation.set(true), Schema5.optional)
2578
+ }).pipe(Schema5.mutable);
2257
2579
  }
2258
- return base.pipe(Schema3.mutable);
2580
+ return base.pipe(Schema5.mutable);
2259
2581
  }, [
2260
2582
  mode
2261
2583
  ]);
2262
- const viewValues = useMemo8(() => ({
2584
+ const viewValues = useMemo10(() => ({
2263
2585
  query: mode === "schema" ? getTypenameFromQuery(view.query.ast) : view.query.ast,
2264
- target: queueTarget
2586
+ target: targetRef
2265
2587
  }), [
2266
2588
  mode,
2267
2589
  view.query.ast,
2268
- queueTarget
2590
+ targetRef
2269
2591
  ]);
2270
- const fieldMap = useMemo8(() => mode === "tag" ? customFields({
2592
+ const fieldMap = useMemo10(() => mode === "tag" ? customFields({
2271
2593
  types,
2272
2594
  tags
2273
2595
  }) : void 0, [
@@ -2275,84 +2597,60 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2275
2597
  types,
2276
2598
  tags
2277
2599
  ]);
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
- 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
- });
2600
+ const handleUpdate = useCallback17((values) => {
2601
+ const targetValue = values.target;
2602
+ let queueDxn;
2603
+ if (Ref5.isRef(targetValue)) {
2604
+ const feedDxn = targetValue.dxn.toString();
2605
+ const feed = feeds.find((feed2) => Obj5.getDXN(feed2).toString() === feedDxn);
2606
+ if (feed) {
2607
+ queueDxn = Feed.getQueueDxn(feed)?.toString();
2608
+ }
2609
+ }
2610
+ const query = mode === "schema" ? Query.select(Filter2.typename(values.query)).ast : JSON.parse(JSON.stringify(values.query));
2611
+ onQueryChanged?.(query, queueDxn);
2299
2612
  }, [
2300
2613
  onQueryChanged,
2301
- view,
2302
- queueTarget,
2303
- mode
2614
+ mode,
2615
+ feeds
2304
2616
  ]);
2305
- const handleDelete = useCallback15((fieldId) => {
2306
- invariant(!readonly, void 0, {
2307
- F: __dxlog_file3,
2308
- L: 163,
2617
+ const handleDelete = useCallback17((fieldId) => {
2618
+ invariant3(!readonly, void 0, {
2619
+ F: __dxlog_file5,
2620
+ L: 185,
2309
2621
  S: void 0,
2310
2622
  A: [
2311
2623
  "!readonly",
2312
2624
  ""
2313
2625
  ]
2314
2626
  });
2315
- if (fieldId === expandedField) {
2316
- setExpandedField(void 0);
2317
- }
2318
2627
  onDelete?.(fieldId);
2319
2628
  }, [
2320
- expandedField,
2321
2629
  onDelete,
2322
2630
  readonly
2323
2631
  ]);
2324
- return /* @__PURE__ */ React19.createElement("div", {
2632
+ return /* @__PURE__ */ React21.createElement("div", {
2325
2633
  role: "none",
2326
- className: mx7(classNames)
2327
- }, schemaReadonly && !readonly && /* @__PURE__ */ React19.createElement(Callout.Root, {
2634
+ className: mx5(classNames)
2635
+ }, schemaReadonly && !readonly && /* @__PURE__ */ React21.createElement(Message.Root, {
2328
2636
  valence: "info",
2329
- classNames: "mlb-cardSpacingBlock"
2330
- }, /* @__PURE__ */ React19.createElement(Callout.Title, null, t("system schema description"))), /* @__PURE__ */ React19.createElement(Form.Root, {
2637
+ classNames: "my-form-padding"
2638
+ }, /* @__PURE__ */ React21.createElement(Message.Title, null, t("system-schema.description"))), /* @__PURE__ */ React21.createElement(Form.Root, {
2331
2639
  schema: viewSchema,
2332
2640
  values: viewValues,
2333
2641
  fieldMap,
2334
- autoSave: true,
2335
- onSave: handleUpdate
2336
- }, /* @__PURE__ */ React19.createElement(Form.FieldSet, null), /* @__PURE__ */ React19.createElement(FormFieldLabel, {
2337
- label: t("fields label"),
2642
+ db,
2643
+ onValuesChanged: handleUpdate
2644
+ }, /* @__PURE__ */ React21.createElement(Form.FieldSet, null), /* @__PURE__ */ React21.createElement(FormFieldLabel, {
2645
+ label: t("fields.label"),
2338
2646
  asChild: true
2339
- }), /* @__PURE__ */ React19.createElement(FieldList, {
2647
+ }), /* @__PURE__ */ React21.createElement(FieldList, {
2340
2648
  schema,
2341
2649
  view,
2342
2650
  registry,
2343
2651
  readonly,
2344
2652
  showHeading,
2345
2653
  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
2654
  })));
2357
2655
  });
2358
2656
  var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDelete }) => {
@@ -2360,7 +2658,7 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2360
2658
  const schemaReadonly = !isMutable(schema);
2361
2659
  const { t } = useTranslation10(translationKey);
2362
2660
  const [viewSnapshot] = useObject(view);
2363
- const projectionModel = useMemo8(() => {
2661
+ const projectionModel = useMemo10(() => {
2364
2662
  const jsonSchema = schema instanceof EchoSchema ? schema.jsonSchema : toJsonSchema(schema);
2365
2663
  const change = createEchoChangeCallback(view, schema instanceof EchoSchema ? schema : void 0);
2366
2664
  const model = new ProjectionModel({
@@ -2376,15 +2674,31 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2376
2674
  view
2377
2675
  ]);
2378
2676
  const [expandedField, setExpandedField] = useState6();
2379
- const handleToggleField = useCallback15((field) => {
2677
+ const handleAdd = useCallback17(() => {
2678
+ invariant3(!readonly, void 0, {
2679
+ F: __dxlog_file5,
2680
+ L: 250,
2681
+ S: void 0,
2682
+ A: [
2683
+ "!readonly",
2684
+ ""
2685
+ ]
2686
+ });
2687
+ const field = projectionModel.createFieldProjection();
2688
+ setExpandedField(field.id);
2689
+ }, [
2690
+ projectionModel,
2691
+ readonly
2692
+ ]);
2693
+ const handleToggleField = useCallback17((field) => {
2380
2694
  setExpandedField((prevExpandedFieldId) => prevExpandedFieldId === field.id ? void 0 : field.id);
2381
2695
  }, [
2382
2696
  readonly
2383
2697
  ]);
2384
- const handleDelete = useCallback15((fieldId) => {
2385
- invariant(!readonly, void 0, {
2386
- F: __dxlog_file3,
2387
- L: 253,
2698
+ const handleDelete = useCallback17((fieldId) => {
2699
+ invariant3(!readonly, void 0, {
2700
+ F: __dxlog_file5,
2701
+ L: 264,
2388
2702
  S: void 0,
2389
2703
  A: [
2390
2704
  "!readonly",
@@ -2400,36 +2714,36 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2400
2714
  onDelete,
2401
2715
  readonly
2402
2716
  ]);
2403
- const handleMove = useCallback15((fromIndex, toIndex) => {
2404
- invariant(!readonly, void 0, {
2405
- F: __dxlog_file3,
2406
- L: 265,
2717
+ const handleMove = useCallback17((fromIndex, toIndex) => {
2718
+ invariant3(!readonly, void 0, {
2719
+ F: __dxlog_file5,
2720
+ L: 276,
2407
2721
  S: void 0,
2408
2722
  A: [
2409
2723
  "!readonly",
2410
2724
  ""
2411
2725
  ]
2412
2726
  });
2413
- Obj4.change(view, (v) => {
2727
+ Obj5.change(view, (view2) => {
2414
2728
  const fields = [
2415
- ...v.projection.fields
2729
+ ...view2.projection.fields
2416
2730
  ];
2417
2731
  const [moved] = fields.splice(fromIndex, 1);
2418
2732
  fields.splice(toIndex, 0, moved);
2419
- v.projection.fields = fields;
2733
+ view2.projection.fields = fields;
2420
2734
  });
2421
2735
  }, [
2422
2736
  view,
2423
2737
  readonly
2424
2738
  ]);
2425
- const handleClose = useCallback15(() => setExpandedField(void 0), []);
2426
- const handleHide = useCallback15((fieldId) => {
2739
+ const handleClose = useCallback17(() => setExpandedField(void 0), []);
2740
+ const handleHide = useCallback17((fieldId) => {
2427
2741
  setExpandedField(void 0);
2428
2742
  projectionModel.hideFieldProjection(fieldId);
2429
2743
  }, [
2430
2744
  projectionModel
2431
2745
  ]);
2432
- const handleShow = useCallback15((property) => {
2746
+ const handleShow = useCallback17((property) => {
2433
2747
  setExpandedField(void 0);
2434
2748
  projectionModel.showFieldProjection(property);
2435
2749
  }, [
@@ -2438,75 +2752,84 @@ var FieldList = ({ schema, view, registry, readonly, showHeading = false, onDele
2438
2752
  if (!viewSnapshot) {
2439
2753
  return null;
2440
2754
  }
2441
- return /* @__PURE__ */ React19.createElement(List2.Root, {
2755
+ return /* @__PURE__ */ React21.createElement(List2.Root, {
2442
2756
  items: viewSnapshot.projection.fields,
2443
- isItem: Schema3.is(FieldSchema),
2757
+ isItem: Schema5.is(View.FieldSchema),
2444
2758
  getId: (field) => field.id,
2445
2759
  onMove: readonly ? void 0 : handleMove,
2446
2760
  readonly
2447
- }, ({ items: fields }) => /* @__PURE__ */ React19.createElement(React19.Fragment, null, showHeading && /* @__PURE__ */ React19.createElement("h3", {
2761
+ }, ({ items: fields }) => /* @__PURE__ */ React21.createElement(React21.Fragment, null, showHeading && /* @__PURE__ */ React21.createElement("h3", {
2448
2762
  className: "text-sm"
2449
- }, t("field path label")), /* @__PURE__ */ React19.createElement("div", {
2763
+ }, t("field-path.label")), /* @__PURE__ */ React21.createElement("div", {
2450
2764
  role: "list",
2451
- className: listGrid
2765
+ className: "grid grid-cols-[min-content_1fr_min-content_min-content_min-content]"
2452
2766
  }, fields?.map((field) => {
2453
2767
  const hidden = field.visible === false;
2454
- return /* @__PURE__ */ React19.createElement(List2.Item, {
2768
+ return /* @__PURE__ */ React21.createElement(List2.Item, {
2455
2769
  key: field.id,
2456
2770
  item: field,
2457
- classNames: listItemGrid,
2771
+ classNames: "grid grid-cols-subgrid col-span-5",
2458
2772
  "aria-expanded": expandedField === field.id
2459
- }, /* @__PURE__ */ React19.createElement("div", {
2773
+ }, /* @__PURE__ */ React21.createElement("div", {
2460
2774
  role: "none",
2461
- className: mx7(subtleHover2, listItemGrid, "rounded-sm cursor-pointer min-bs-10")
2462
- }, /* @__PURE__ */ React19.createElement(List2.ItemDragHandle, {
2775
+ className: mx5(subtleHover2, "grid grid-cols-subgrid col-span-5", "rounded-xs cursor-pointer min-h-10")
2776
+ }, /* @__PURE__ */ React21.createElement(List2.ItemDragHandle, {
2463
2777
  disabled: readonly || schemaReadonly
2464
- }), /* @__PURE__ */ React19.createElement(List2.ItemTitle, {
2778
+ }), /* @__PURE__ */ React21.createElement(List2.ItemTitle, {
2465
2779
  classNames: hidden && "text-subdued",
2466
2780
  onClick: () => handleToggleField(field)
2467
- }, field.path), /* @__PURE__ */ React19.createElement(List2.ItemButton, {
2781
+ }, field.path), /* @__PURE__ */ React21.createElement(List2.ItemIconButton, {
2468
2782
  label: t(hidden ? "show field label" : "hide field label"),
2469
2783
  "data-testid": hidden ? "show-field-button" : "hide-field-button",
2470
2784
  icon: hidden ? "ph--eye-closed--regular" : "ph--eye--regular",
2471
2785
  autoHide: false,
2472
2786
  disabled: readonly || !hidden && projectionModel.getFields().length <= 1,
2473
2787
  onClick: () => hidden ? handleShow(field.path) : handleHide(field.id)
2474
- }), !readonly && /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(List2.ItemDeleteButton, {
2475
- label: t("delete field label"),
2788
+ }), !readonly && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(List2.ItemDeleteButton, {
2789
+ label: t("delete-field.label"),
2476
2790
  autoHide: false,
2477
2791
  disabled: readonly || schemaReadonly || viewSnapshot.projection.fields.length <= 1,
2478
2792
  onClick: () => handleDelete(field.id),
2479
2793
  "data-testid": "field.delete"
2480
- }), /* @__PURE__ */ React19.createElement(IconButton4, {
2794
+ }), /* @__PURE__ */ React21.createElement(List2.ItemIconButton, {
2481
2795
  iconOnly: true,
2482
2796
  variant: "ghost",
2483
- label: t("toggle expand label", {
2797
+ label: t("toggle-expand.label", {
2484
2798
  ns: osTranslations2
2485
2799
  }),
2486
2800
  icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
2487
2801
  onClick: () => handleToggleField(field),
2488
2802
  "data-testid": "field.toggle"
2489
- }))), expandedField === field.id && !readonly && /* @__PURE__ */ React19.createElement("div", {
2803
+ }))), expandedField === field.id && !readonly && /* @__PURE__ */ React21.createElement("div", {
2490
2804
  role: "none",
2491
- className: "col-span-5 mbs-1 mbe-1 border border-separator rounded-md"
2492
- }, /* @__PURE__ */ React19.createElement(FieldEditor, {
2805
+ className: "col-span-full mt-1 mb-1 border border-separator rounded-md"
2806
+ }, /* @__PURE__ */ React21.createElement(FieldEditor, {
2493
2807
  readonly: readonly || schemaReadonly,
2494
2808
  registry,
2495
2809
  projection: projectionModel,
2496
2810
  field,
2497
2811
  onSave: handleClose
2498
2812
  })));
2813
+ })), !readonly && !expandedField && /* @__PURE__ */ React21.createElement("div", {
2814
+ role: "none",
2815
+ className: "my-form-padding"
2816
+ }, /* @__PURE__ */ React21.createElement(IconButton4, {
2817
+ icon: "ph--plus--regular",
2818
+ label: t("add-property-button.label"),
2819
+ onClick: handleAdd,
2820
+ disabled: viewSnapshot.projection.fields.length >= VIEW_FIELD_LIMIT,
2821
+ classNames: "w-full"
2499
2822
  }))));
2500
2823
  };
2501
2824
  var customFields = ({ types, tags }) => ({
2502
2825
  query: ({ type, readonly, label, getValue, onValueChange }) => {
2503
- const handleChange = useCallback15((query) => onValueChange(type, query.ast), [
2826
+ const handleChange = useCallback17((query) => onValueChange(type, query.ast), [
2504
2827
  onValueChange
2505
2828
  ]);
2506
- return /* @__PURE__ */ React19.createElement(Input13.Root, null, /* @__PURE__ */ React19.createElement(FormFieldLabel, {
2829
+ return /* @__PURE__ */ React21.createElement(Input13.Root, null, /* @__PURE__ */ React21.createElement(FormFieldLabel, {
2507
2830
  readonly,
2508
2831
  label
2509
- }), /* @__PURE__ */ React19.createElement(QueryForm, {
2832
+ }), /* @__PURE__ */ React21.createElement(QueryForm, {
2510
2833
  initialQuery: getValue(),
2511
2834
  types,
2512
2835
  tags,
@@ -2517,15 +2840,6 @@ var customFields = ({ types, tags }) => ({
2517
2840
  export {
2518
2841
  ArrayField,
2519
2842
  BooleanField,
2520
- ControlFrame,
2521
- ControlFrameItem,
2522
- ControlGroup,
2523
- ControlGroupButton,
2524
- ControlItem,
2525
- ControlItemInput,
2526
- ControlPage,
2527
- ControlSection,
2528
- ControlSectionHeading,
2529
2843
  FieldEditor,
2530
2844
  Form,
2531
2845
  FormFieldErrorBoundary,
@@ -2534,16 +2848,18 @@ export {
2534
2848
  GeoPointField,
2535
2849
  MarkdownField,
2536
2850
  NumberField,
2851
+ ObjectForm,
2537
2852
  ObjectPicker,
2853
+ ObjectProperties,
2538
2854
  RefField,
2539
2855
  SelectField,
2540
2856
  SelectOptionField,
2857
+ Settings,
2541
2858
  TextAreaField,
2542
2859
  TextField,
2543
2860
  TupleField,
2544
2861
  ViewEditor,
2545
2862
  cellClassesForFieldType,
2546
- controlItemClasses,
2547
2863
  formatForDisplay,
2548
2864
  formatForEditing,
2549
2865
  getDefaultValue,
@@ -2552,7 +2868,6 @@ export {
2552
2868
  omitId,
2553
2869
  parseValue,
2554
2870
  pathNotUniqueError,
2555
- setValueEchoAware,
2556
2871
  translations,
2557
2872
  useFormContext,
2558
2873
  useFormFieldState,