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