@dxos/react-ui-form 0.8.3 → 0.8.4-main.1f223c7

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 (103) hide show
  1. package/dist/lib/browser/index.mjs +648 -581
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +648 -581
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/ControlSection/ControlSection.d.ts +2 -2
  8. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +1 -1
  9. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +79 -4
  10. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +4 -5
  12. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  13. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +76 -6
  14. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  15. package/dist/types/src/components/Form/ArrayField.d.ts +2 -2
  16. package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
  17. package/dist/types/src/components/Form/Defaults.d.ts +5 -5
  18. package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
  19. package/dist/types/src/components/Form/Form.d.ts +5 -4
  20. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  21. package/dist/types/src/components/Form/Form.stories.d.ts +126 -30
  22. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  23. package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
  24. package/dist/types/src/components/Form/FormContent.d.ts +16 -10
  25. package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
  26. package/dist/types/src/components/Form/FormContext.d.ts +1 -1
  27. package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
  28. package/dist/types/src/components/Form/Input.d.ts +4 -1
  29. package/dist/types/src/components/Form/Input.d.ts.map +1 -1
  30. package/dist/types/src/components/Form/RefField.d.ts +10 -4
  31. package/dist/types/src/components/Form/RefField.d.ts.map +1 -1
  32. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts +1 -1
  33. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +1 -1
  34. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts +1 -1
  35. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
  36. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +74 -3
  37. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/Form/custom/TupleInput.d.ts +1 -1
  39. package/dist/types/src/components/Form/factory.d.ts.map +1 -1
  40. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +5 -4
  41. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  42. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +78 -7
  43. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  44. package/dist/types/src/components/index.d.ts +0 -1
  45. package/dist/types/src/components/index.d.ts.map +1 -1
  46. package/dist/types/src/components/testing.d.ts +6 -3
  47. package/dist/types/src/components/testing.d.ts.map +1 -1
  48. package/dist/types/src/hooks/useForm.d.ts +1 -1
  49. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  50. package/dist/types/src/index.d.ts +1 -1
  51. package/dist/types/src/index.d.ts.map +1 -1
  52. package/dist/types/src/translations.d.ts +61 -57
  53. package/dist/types/src/translations.d.ts.map +1 -1
  54. package/dist/types/src/util/field.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +36 -33
  57. package/src/components/ControlSection/ControlSection.stories.tsx +10 -12
  58. package/src/components/ControlSection/ControlSection.tsx +26 -12
  59. package/src/components/FieldEditor/FieldEditor.stories.tsx +21 -20
  60. package/src/components/FieldEditor/FieldEditor.test.tsx +14 -13
  61. package/src/components/FieldEditor/FieldEditor.tsx +17 -22
  62. package/src/components/Form/ArrayField.tsx +9 -9
  63. package/src/components/Form/Defaults.tsx +22 -20
  64. package/src/components/Form/Form.stories.tsx +131 -95
  65. package/src/components/Form/Form.tsx +16 -12
  66. package/src/components/Form/FormActions.tsx +2 -1
  67. package/src/components/Form/FormContent.tsx +96 -34
  68. package/src/components/Form/FormContext.tsx +5 -5
  69. package/src/components/Form/Input.tsx +4 -1
  70. package/src/components/Form/RefField.tsx +126 -40
  71. package/src/components/Form/custom/GeoPointInput.tsx +29 -21
  72. package/src/components/Form/custom/SelectOptionsInput.stories.tsx +9 -8
  73. package/src/components/Form/custom/SelectOptionsInput.tsx +29 -30
  74. package/src/components/Form/custom/TupleInput.tsx +2 -2
  75. package/src/components/Form/factory.tsx +1 -1
  76. package/src/components/ViewEditor/ViewEditor.stories.tsx +70 -32
  77. package/src/components/ViewEditor/ViewEditor.test.tsx +38 -39
  78. package/src/components/ViewEditor/ViewEditor.tsx +159 -155
  79. package/src/components/index.ts +0 -2
  80. package/src/components/testing.tsx +15 -9
  81. package/src/hooks/useForm.ts +5 -3
  82. package/src/hooks/useRefQueryLookupHandler.ts +1 -1
  83. package/src/index.ts +1 -1
  84. package/src/translations.ts +15 -7
  85. package/src/util/field.ts +8 -18
  86. package/dist/lib/node/index.cjs +0 -2416
  87. package/dist/lib/node/index.cjs.map +0 -7
  88. package/dist/lib/node/meta.json +0 -1
  89. package/dist/types/src/components/ViewEditor/Test.stories.d.ts +0 -10
  90. package/dist/types/src/components/ViewEditor/Test.stories.d.ts.map +0 -1
  91. package/dist/types/src/components/deprecated/Form.d.ts +0 -15
  92. package/dist/types/src/components/deprecated/Form.d.ts.map +0 -1
  93. package/dist/types/src/components/deprecated/Form.stories.d.ts +0 -13
  94. package/dist/types/src/components/deprecated/Form.stories.d.ts.map +0 -1
  95. package/dist/types/src/components/deprecated/FormInput.d.ts +0 -16
  96. package/dist/types/src/components/deprecated/FormInput.d.ts.map +0 -1
  97. package/dist/types/src/components/deprecated/index.d.ts +0 -2
  98. package/dist/types/src/components/deprecated/index.d.ts.map +0 -1
  99. package/src/components/ViewEditor/Test.stories.tsx +0 -45
  100. package/src/components/deprecated/Form.stories.tsx +0 -62
  101. package/src/components/deprecated/Form.tsx +0 -119
  102. package/src/components/deprecated/FormInput.tsx +0 -71
  103. package/src/components/deprecated/index.ts +0 -5
@@ -1,6 +1,6 @@
1
- // packages/ui/react-ui-form/src/translations.ts
1
+ // src/translations.ts
2
2
  var translationKey = "react-ui-form";
3
- var translations_default = [
3
+ var translations = [
4
4
  {
5
5
  "en-US": {
6
6
  [translationKey]: {
@@ -18,6 +18,11 @@ var translations_default = [
18
18
  "field limit reached": "Maximum number of fields reached",
19
19
  "boolean input true value": "Yes",
20
20
  "boolean input false value": "No",
21
+ "show field label": "Show field",
22
+ "hide field label": "Hide field",
23
+ "delete field label": "Delete field",
24
+ "ref field placeholder_one": "Select\u2026",
25
+ "ref field placeholder_other": "Select items\u2026",
21
26
  // TODO(burdon): Factor out?
22
27
  "button cancel": "Cancel",
23
28
  "button save": "Save",
@@ -50,9 +55,9 @@ var translations_default = [
50
55
  "format uri": "URI",
51
56
  "format url": "URL",
52
57
  "format uuid": "UUID",
53
- // Placeholders.
54
- "placeholder latitude": "Latitude",
55
- "placeholder longitude": "Longitude",
58
+ // GeoPointInput.
59
+ "latitude label": "Latitude",
60
+ "longitude label": "Longitude",
56
61
  // SelectOptionsInput.
57
62
  "select option label": "Label",
58
63
  "select option label placeholder": "Option label",
@@ -60,86 +65,37 @@ var translations_default = [
60
65
  "select option delete": "Delete",
61
66
  "select option add": "Add option",
62
67
  // System schema message.
63
- "system schema title": "System Schema",
64
- "system schema description": "This is a system schema and cannot be modified."
68
+ "system schema title": "System record type",
69
+ "system schema description": "This is a system record type and cannot be modified, though the view can still be configured."
65
70
  }
66
71
  }
67
72
  }
68
73
  ];
69
74
 
70
- // packages/ui/react-ui-form/src/components/deprecated/FormInput.tsx
75
+ // src/components/ControlSection/ControlSection.tsx
71
76
  import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
72
77
  import React from "react";
73
- import { Input } from "@dxos/react-ui";
74
- import { mx, textBlockWidth } from "@dxos/react-ui-theme";
75
- var DeprecatedFormContainer = ({ children, classNames }) => {
76
- var _effect = _useSignals();
77
- try {
78
- return /* @__PURE__ */ React.createElement("div", {
79
- role: "none",
80
- className: "container-max-width p-4 justify-center overflow-x-hidden overflow-y-auto"
81
- }, /* @__PURE__ */ React.createElement("div", {
82
- role: "form",
83
- className: mx("flex flex-col", textBlockWidth, classNames)
84
- }, children));
85
- } finally {
86
- _effect.f();
87
- }
88
- };
89
- var DeprecatedFormInput = ({ label, description, secondary, children }) => {
78
+ import { Button, Input, toLocalizedString, useTranslation } from "@dxos/react-ui";
79
+ import { StackItem } from "@dxos/react-ui-stack";
80
+ import { mx } from "@dxos/react-ui-theme";
81
+ var ControlPage = ({ children, classNames, ...props }) => {
90
82
  var _effect = _useSignals();
91
83
  try {
92
- const primary = /* @__PURE__ */ React.createElement("div", {
93
- role: "none",
94
- className: "flex w-full gap-4 py-1"
95
- }, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
96
- role: "none",
97
- className: "flex flex-col w-full"
98
- }, /* @__PURE__ */ React.createElement(Input.Label, {
99
- classNames: "flex min-bs-[--rail-action] items-center",
100
- style: {
101
- fontSize: "unset"
102
- }
103
- }, label), description && /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, {
104
- classNames: "mbs-0.5"
105
- }, /* @__PURE__ */ React.createElement(Input.Description, null, description))), /* @__PURE__ */ React.createElement("div", {
106
- role: "none"
84
+ return /* @__PURE__ */ React.createElement(StackItem.Content, {
85
+ classNames: "block overflow-y-auto [--control-spacing:var(--dx-trimMd)]"
107
86
  }, /* @__PURE__ */ React.createElement("div", {
108
87
  role: "none",
109
- className: "flex min-bs-[--rail-action] items-center"
110
- }, children))));
111
- if (secondary) {
112
- return /* @__PURE__ */ React.createElement("div", {
113
- role: "none"
114
- }, primary, secondary);
115
- }
116
- return primary;
117
- } finally {
118
- _effect.f();
119
- }
120
- };
121
-
122
- // packages/ui/react-ui-form/src/components/ControlSection/ControlSection.tsx
123
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
124
- import React2 from "react";
125
- import { Button, Input as Input2, toLocalizedString, useTranslation } from "@dxos/react-ui";
126
- import { mx as mx2 } from "@dxos/react-ui-theme";
127
- var ControlPage = ({ children, classNames, ...props }) => {
128
- var _effect = _useSignals2();
129
- try {
130
- return /* @__PURE__ */ React2.createElement("div", {
131
- role: "none",
132
- className: mx2("pli-cardSpacingInline", classNames),
88
+ className: mx("pli-cardSpacingInline pbe-trimLg", classNames),
133
89
  ...props
134
- }, children);
90
+ }, children));
135
91
  } finally {
136
92
  _effect.f();
137
93
  }
138
94
  };
139
95
  var ControlSection = ({ title, description, children }) => {
140
- var _effect = _useSignals2();
96
+ var _effect = _useSignals();
141
97
  try {
142
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ControlSectionHeading, {
98
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ControlSectionHeading, {
143
99
  title,
144
100
  description
145
101
  }), children);
@@ -148,12 +104,12 @@ var ControlSection = ({ title, description, children }) => {
148
104
  }
149
105
  };
150
106
  var ControlSectionHeading = ({ title, description }) => {
151
- var _effect = _useSignals2();
107
+ var _effect = _useSignals();
152
108
  try {
153
109
  const { t } = useTranslation(translationKey);
154
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", {
110
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h2", {
155
111
  className: "pli-trimMd container-max-width text-xl mbs-trimLg mbe-trimMd"
156
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement("p", {
112
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
157
113
  className: "pli-trimMd mlb-trimMd container-max-width text-description"
158
114
  }, toLocalizedString(description, t)));
159
115
  } finally {
@@ -161,9 +117,9 @@ var ControlSectionHeading = ({ title, description }) => {
161
117
  }
162
118
  };
163
119
  var ControlGroupButton = ({ classNames, ...props }) => {
164
- var _effect = _useSignals2();
120
+ var _effect = _useSignals();
165
121
  try {
166
- return /* @__PURE__ */ React2.createElement(Button, {
122
+ return /* @__PURE__ */ React.createElement(Button, {
167
123
  ...props,
168
124
  classNames: [
169
125
  "md:col-span-2",
@@ -175,41 +131,46 @@ var ControlGroupButton = ({ classNames, ...props }) => {
175
131
  }
176
132
  };
177
133
  var ControlGroup = ({ children, classNames }) => {
178
- var _effect = _useSignals2();
134
+ var _effect = _useSignals();
179
135
  try {
180
- return /* @__PURE__ */ React2.createElement("div", {
136
+ return /* @__PURE__ */ React.createElement("div", {
181
137
  role: "none",
182
- className: mx2("group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-trimMd", classNames)
138
+ 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)
183
139
  }, children);
184
140
  } finally {
185
141
  _effect.f();
186
142
  }
187
143
  };
188
144
  var ControlFrame = ({ children }) => {
189
- var _effect = _useSignals2();
145
+ var _effect = _useSignals();
190
146
  try {
191
- return /* @__PURE__ */ React2.createElement("div", {
147
+ return /* @__PURE__ */ React.createElement("div", {
192
148
  role: "none",
193
- className: "p-trimMd container-max-width grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-trimSm md:gap-trimMd border border-separator rounded-md"
149
+ 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")
194
150
  }, children);
195
151
  } finally {
196
152
  _effect.f();
197
153
  }
198
154
  };
199
- var controlItemClasses = "pli-trimMd plb-trimMd container-max-width grid md:col-span-2 grid-cols-subgrid items-center gap-trimSm border border-separator rounded-md *:first:!mbs-0 *:last:!mbe-0";
200
- var controlItemTitleClasses = "text-lg font-normal";
201
- var controlItemDescriptionClasses = "text-base mlb-trimSm md:mbe-0 text-description";
155
+ var controlItemClasses = mx([
156
+ "container-max-width grid md:col-span-2 grid-cols-subgrid gap-trimSm items-center",
157
+ // TODO(burdon): Use grid gap consistently or apply margins consistently?
158
+ "mlb-[--control-spacing] *:first:!mbs-0 *:last:!mbe-0 pli-trimMd plb-trimMd",
159
+ "border border-separator rounded-md"
160
+ ]);
161
+ var controlItemTitleClasses = "mbe-0 text-lg text-baseText font-normal";
162
+ var controlItemDescriptionClasses = "mlb-trimSm md:mbe-0 text-base text-description";
202
163
  var ControlItem = ({ title, description, children }) => {
203
- var _effect = _useSignals2();
164
+ var _effect = _useSignals();
204
165
  try {
205
166
  const { t } = useTranslation(translationKey);
206
- return /* @__PURE__ */ React2.createElement("div", {
167
+ return /* @__PURE__ */ React.createElement("div", {
207
168
  className: controlItemClasses
208
- }, /* @__PURE__ */ React2.createElement("div", {
169
+ }, /* @__PURE__ */ React.createElement("div", {
209
170
  role: "none"
210
- }, /* @__PURE__ */ React2.createElement("h3", {
171
+ }, /* @__PURE__ */ React.createElement("h3", {
211
172
  className: controlItemTitleClasses
212
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement("p", {
173
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
213
174
  className: controlItemDescriptionClasses
214
175
  }, toLocalizedString(description, t))), children);
215
176
  } finally {
@@ -217,16 +178,16 @@ var ControlItem = ({ title, description, children }) => {
217
178
  }
218
179
  };
219
180
  var ControlItemInput = ({ title, description, children }) => {
220
- var _effect = _useSignals2();
181
+ var _effect = _useSignals();
221
182
  try {
222
183
  const { t } = useTranslation(translationKey);
223
- return /* @__PURE__ */ React2.createElement(Input2.Root, null, /* @__PURE__ */ React2.createElement("div", {
184
+ return /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
224
185
  className: controlItemClasses
225
- }, /* @__PURE__ */ React2.createElement("div", {
186
+ }, /* @__PURE__ */ React.createElement("div", {
226
187
  role: "none"
227
- }, /* @__PURE__ */ React2.createElement(Input2.Label, {
188
+ }, /* @__PURE__ */ React.createElement(Input.Label, {
228
189
  classNames: controlItemTitleClasses
229
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement(Input2.DescriptionAndValidation, null, /* @__PURE__ */ React2.createElement(Input2.Description, {
190
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Description, {
230
191
  classNames: controlItemDescriptionClasses
231
192
  }, toLocalizedString(description, t)))), children));
232
193
  } finally {
@@ -234,15 +195,15 @@ var ControlItemInput = ({ title, description, children }) => {
234
195
  }
235
196
  };
236
197
  var ControlFrameItem = ({ title, description, children }) => {
237
- var _effect = _useSignals2();
198
+ var _effect = _useSignals();
238
199
  try {
239
200
  const { t } = useTranslation(translationKey);
240
- return /* @__PURE__ */ React2.createElement("div", {
201
+ return /* @__PURE__ */ React.createElement("div", {
241
202
  role: "group",
242
203
  className: "min-is-0"
243
- }, /* @__PURE__ */ React2.createElement("h3", {
204
+ }, /* @__PURE__ */ React.createElement("h3", {
244
205
  className: "text-lg mbe-2"
245
- }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement("p", {
206
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React.createElement("p", {
246
207
  className: "mlb-trimSm md:mbe-0 text-description"
247
208
  }, toLocalizedString(description, t)), children);
248
209
  } finally {
@@ -250,42 +211,42 @@ var ControlFrameItem = ({ title, description, children }) => {
250
211
  }
251
212
  };
252
213
 
253
- // packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
254
- import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
255
- import React14, { useCallback as useCallback9, useEffect as useEffect8, useMemo as useMemo7, useState as useState5 } from "react";
214
+ // src/components/FieldEditor/FieldEditor.tsx
215
+ import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
216
+ import React13, { useCallback as useCallback9, useEffect as useEffect8, useMemo as useMemo7, useState as useState6 } from "react";
256
217
  import { FormatEnum as FormatEnum5, FormatEnums, formatToType } from "@dxos/echo-schema";
257
218
  import { log as log3 } from "@dxos/log";
258
- import { useTranslation as useTranslation8 } from "@dxos/react-ui";
219
+ import { useAsyncEffect, useTranslation as useTranslation8 } from "@dxos/react-ui";
259
220
  import { getFormatSchema, getSchemaProperties as getSchemaProperties3, sortProperties } from "@dxos/schema";
260
221
 
261
- // packages/ui/react-ui-form/src/components/Form/custom/GeoPointInput.tsx
262
- import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
263
- import React4, { useCallback, useState, useEffect, useMemo } from "react";
222
+ // src/components/Form/custom/GeoPointInput.tsx
223
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
224
+ import React3, { useCallback, useEffect, useMemo, useState } from "react";
264
225
  import { GeoLocation } from "@dxos/echo-schema";
265
- import { Input as Input4, useTranslation as useTranslation2 } from "@dxos/react-ui";
226
+ import { Input as Input3, useTranslation as useTranslation2 } from "@dxos/react-ui";
266
227
  import { safeParseFloat } from "@dxos/util";
267
228
 
268
- // packages/ui/react-ui-form/src/components/Form/Input.tsx
269
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
270
- import React3 from "react";
271
- import { Icon, Input as Input3, Tooltip } from "@dxos/react-ui";
229
+ // src/components/Form/Input.tsx
230
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
231
+ import React2 from "react";
232
+ import { Icon, Input as Input2, Tooltip } from "@dxos/react-ui";
272
233
  import { labelSpacing } from "@dxos/react-ui-stack";
273
- import { errorText, mx as mx3 } from "@dxos/react-ui-theme";
234
+ import { errorText, mx as mx2 } from "@dxos/react-ui-theme";
274
235
  var InputHeader = ({ error, label, readonly }) => {
275
- var _effect = _useSignals3();
236
+ var _effect = _useSignals2();
276
237
  try {
277
- const Label = readonly ? "span" : Input3.Label;
238
+ const Label = readonly ? "span" : Input2.Label;
278
239
  const labelProps = readonly ? {} : {
279
240
  classNames: "!mlb-0"
280
241
  };
281
- return /* @__PURE__ */ React3.createElement("div", {
242
+ return /* @__PURE__ */ React2.createElement("div", {
282
243
  role: "none",
283
- className: mx3("flex justify-between items-center", labelSpacing)
284
- }, /* @__PURE__ */ React3.createElement(Label, labelProps, label), error && /* @__PURE__ */ React3.createElement(Tooltip.Trigger, {
244
+ className: mx2("flex justify-between items-center", labelSpacing)
245
+ }, /* @__PURE__ */ React2.createElement(Label, labelProps, label), error && /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
285
246
  asChild: true,
286
247
  content: error,
287
248
  side: "bottom"
288
- }, /* @__PURE__ */ React3.createElement(Icon, {
249
+ }, /* @__PURE__ */ React2.createElement(Icon, {
289
250
  icon: "ph--warning--regular",
290
251
  size: 4,
291
252
  classNames: errorText
@@ -295,9 +256,9 @@ var InputHeader = ({ error, label, readonly }) => {
295
256
  }
296
257
  };
297
258
 
298
- // packages/ui/react-ui-form/src/components/Form/custom/GeoPointInput.tsx
299
- var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
300
- var _effect = _useSignals4();
259
+ // src/components/Form/custom/GeoPointInput.tsx
260
+ var GeoPointInput = ({ type, label, readonly, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
261
+ var _effect = _useSignals3();
301
262
  try {
302
263
  const { t } = useTranslation2(translationKey);
303
264
  const { status, error } = getStatus();
@@ -342,46 +303,52 @@ var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, on
342
303
  onValueChange,
343
304
  type
344
305
  ]);
345
- return /* @__PURE__ */ React4.createElement(Input4.Root, {
306
+ return /* @__PURE__ */ React3.createElement(Input3.Root, {
346
307
  validationValence: status
347
- }, /* @__PURE__ */ React4.createElement(InputHeader, {
308
+ }, /* @__PURE__ */ React3.createElement(InputHeader, {
348
309
  error,
349
310
  label
350
- }), /* @__PURE__ */ React4.createElement("div", {
311
+ }), /* @__PURE__ */ React3.createElement("div", {
351
312
  role: "none",
352
313
  className: "grid grid-cols-2 gap-2"
353
- }, /* @__PURE__ */ React4.createElement(Input4.TextInput, {
354
- type: "text",
355
- pattern: "^-?[0-9]*\\.?[0-9]*$",
356
- disabled,
357
- placeholder: t("placeholder latitude"),
314
+ }, /* @__PURE__ */ React3.createElement("div", {
315
+ role: "none"
316
+ }, /* @__PURE__ */ React3.createElement(Input3.Label, null, t("latitude label")), /* @__PURE__ */ React3.createElement(Input3.TextInput, {
317
+ type: "number",
318
+ step: "0.00001",
319
+ min: "-90",
320
+ max: "90",
321
+ disabled: !!readonly,
358
322
  value: latitudeText,
359
323
  onChange: handleCoordinateChange("latitude", setLatitudeText),
360
324
  onBlur
361
- }), /* @__PURE__ */ React4.createElement(Input4.TextInput, {
362
- type: "text",
363
- pattern: "^-?[0-9]*\\.?[0-9]*$",
364
- disabled,
365
- placeholder: t("placeholder longitude"),
325
+ })), /* @__PURE__ */ React3.createElement("div", {
326
+ role: "none"
327
+ }, /* @__PURE__ */ React3.createElement(Input3.Label, null, t("longitude label")), /* @__PURE__ */ React3.createElement(Input3.TextInput, {
328
+ type: "number",
329
+ step: "0.00001",
330
+ min: "-180",
331
+ max: "180",
332
+ disabled: !!readonly,
366
333
  value: longitudeText,
367
334
  onChange: handleCoordinateChange("longitude", setLongitudeText),
368
335
  onBlur
369
- })));
336
+ }))));
370
337
  } finally {
371
338
  _effect.f();
372
339
  }
373
340
  };
374
341
 
375
- // packages/ui/react-ui-form/src/components/Form/custom/SelectOptionsInput.tsx
376
- import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
377
- import React5, { useCallback as useCallback2, useEffect as useEffect2, useState as useState2, useRef } from "react";
342
+ // src/components/Form/custom/SelectOptionsInput.tsx
343
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
344
+ import React4, { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
378
345
  import { PublicKey } from "@dxos/keys";
379
- import { Icon as Icon2, IconButton, Input as Input5, Tag, Toolbar, useTranslation as useTranslation3 } from "@dxos/react-ui";
346
+ import { IconButton, Input as Input4, Tag, useTranslation as useTranslation3 } from "@dxos/react-ui";
380
347
  import { List } from "@dxos/react-ui-list";
381
348
  import { HuePicker } from "@dxos/react-ui-pickers";
382
- import { hues, mx as mx4 } from "@dxos/react-ui-theme";
383
- var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange }) => {
384
- var _effect = _useSignals5();
349
+ import { hues, subtleHover } from "@dxos/react-ui-theme";
350
+ var SelectOptionInput = ({ type, label, readonly, getStatus, getValue: getValue3, onValueChange }) => {
351
+ var _effect = _useSignals4();
385
352
  try {
386
353
  const [selected, setSelectedId] = useState2(null);
387
354
  const [isNewOption, setIsNewOption] = useState2(false);
@@ -489,44 +456,56 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
489
456
  selected,
490
457
  isNewOption
491
458
  ]);
492
- return /* @__PURE__ */ React5.createElement(Input5.Root, {
459
+ return /* @__PURE__ */ React4.createElement(Input4.Root, {
493
460
  validationValence: status
494
- }, /* @__PURE__ */ React5.createElement(InputHeader, {
461
+ }, /* @__PURE__ */ React4.createElement(InputHeader, {
495
462
  error,
496
463
  label
497
- }), /* @__PURE__ */ React5.createElement("div", {
464
+ }), /* @__PURE__ */ React4.createElement("div", {
498
465
  role: "none"
499
- }, options && /* @__PURE__ */ React5.createElement(List.Root, {
466
+ }, options && /* @__PURE__ */ React4.createElement(List.Root, {
500
467
  items: options,
501
468
  isItem: (item) => true,
502
- onMove: handleMove
503
- }, ({ items }) => /* @__PURE__ */ React5.createElement("div", {
469
+ onMove: readonly ? void 0 : handleMove,
470
+ readonly: !!readonly
471
+ }, ({ items }) => /* @__PURE__ */ React4.createElement("div", {
504
472
  role: "list",
505
473
  className: "w-full overflow-auto"
506
- }, items?.map((item) => /* @__PURE__ */ React5.createElement("div", {
474
+ }, items?.map((item) => /* @__PURE__ */ React4.createElement("div", {
507
475
  key: item.id
508
- }, /* @__PURE__ */ React5.createElement(List.Item, {
476
+ }, /* @__PURE__ */ React4.createElement(List.Item, {
509
477
  role: "button",
510
478
  item,
511
- classNames: mx4("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
479
+ classNames: [
480
+ subtleHover,
481
+ "flex flex-col cursor-pointer rounded-sm"
482
+ ],
512
483
  "aria-expanded": selected === item.id
513
- }, /* @__PURE__ */ React5.createElement("div", {
484
+ }, /* @__PURE__ */ React4.createElement("div", {
514
485
  className: "flex items-center"
515
- }, /* @__PURE__ */ React5.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React5.createElement(List.ItemTitle, {
486
+ }, /* @__PURE__ */ React4.createElement(List.ItemDragHandle, {
487
+ disabled: !!readonly
488
+ }), /* @__PURE__ */ React4.createElement(List.ItemTitle, {
516
489
  onClick: () => handleClick(item.id),
517
490
  classNames: "flex-1"
518
- }, /* @__PURE__ */ React5.createElement(Tag, {
491
+ }, /* @__PURE__ */ React4.createElement(Tag, {
519
492
  palette: item.color
520
- }, item.title || "\u200B")), /* @__PURE__ */ React5.createElement(Icon2, {
493
+ }, item.title || "\u200B")), /* @__PURE__ */ React4.createElement(IconButton, {
494
+ iconOnly: true,
495
+ variant: "ghost",
496
+ label: t(selected === item.id ? "collapse label" : "expand label", {
497
+ ns: "os"
498
+ }),
521
499
  icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
522
500
  onClick: () => handleClick(item.id)
523
- })), selected === item.id && /* @__PURE__ */ React5.createElement("div", {
524
- className: "mis-4 mbs-2 flex flex-col gap-1"
525
- }, /* @__PURE__ */ React5.createElement(Input5.Label, {
501
+ })), selected === item.id && /* @__PURE__ */ React4.createElement("div", {
502
+ className: "pli-cardSpacingInline plb-cardSpacingBlock flex flex-col gap-1 density-fine"
503
+ }, /* @__PURE__ */ React4.createElement(Input4.Label, {
526
504
  classNames: "text-xs"
527
- }, t("select option label")), /* @__PURE__ */ React5.createElement("div", {
528
- className: "flex flex-row items-center gap-1"
529
- }, /* @__PURE__ */ React5.createElement(Input5.TextInput, {
505
+ }, t("select option label")), /* @__PURE__ */ React4.createElement("div", {
506
+ className: "grid grid-cols-[1fr_min-content_min-content] gap-1"
507
+ }, /* @__PURE__ */ React4.createElement(Input4.TextInput, {
508
+ disabled: !!readonly,
530
509
  placeholder: t("select option label placeholder"),
531
510
  ref: selected === item.id ? inputRef : void 0,
532
511
  value: item.title,
@@ -534,40 +513,34 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
534
513
  onKeyDown: handleKeyDown,
535
514
  classNames: "flex-1",
536
515
  "data-no-submit": true
537
- }), /* @__PURE__ */ React5.createElement(Toolbar.Root, {
538
- classNames: "p-0 m-0 !is-auto"
539
- }, /* @__PURE__ */ React5.createElement(HuePicker, {
516
+ }), /* @__PURE__ */ React4.createElement(HuePicker, {
517
+ disabled: !!readonly,
540
518
  value: item.color,
541
- onChange: handleColorChange(item.id),
542
- rootVariant: "toolbar-button"
543
- })), /* @__PURE__ */ React5.createElement(IconButton, {
519
+ onChange: handleColorChange(item.id)
520
+ }), /* @__PURE__ */ React4.createElement(IconButton, {
521
+ disabled: !!readonly,
544
522
  icon: "ph--trash--fill",
545
523
  iconOnly: true,
546
524
  label: t("select option delete"),
547
525
  onClick: () => handleDelete(item.id)
548
- })))))), /* @__PURE__ */ React5.createElement("div", {
549
- role: "listitem"
550
- }, /* @__PURE__ */ React5.createElement("div", {
551
- role: "button",
552
- className: mx4("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
553
- onClick: handleAdd
554
- }, /* @__PURE__ */ React5.createElement("div", {
555
- className: "flex items-center gap-1"
556
- }, /* @__PURE__ */ React5.createElement(Icon2, {
557
- icon: "ph--plus--regular"
558
- }), /* @__PURE__ */ React5.createElement("span", {
559
- className: "text-sm"
560
- }, t("select option add")))))))));
526
+ })))))), /* @__PURE__ */ React4.createElement(IconButton, {
527
+ variant: "ghost",
528
+ icon: "ph--plus--regular",
529
+ label: t("select option add"),
530
+ onClick: handleAdd,
531
+ disabled: !!readonly,
532
+ classNames: "is-full"
533
+ })))));
561
534
  } finally {
562
535
  _effect.f();
563
536
  }
564
537
  };
565
538
 
566
- // packages/ui/react-ui-form/src/components/Form/custom/TupleInput.tsx
567
- import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
568
- import React6 from "react";
569
- import { Input as Input6 } from "@dxos/react-ui";
570
- import { mx as mx5 } from "@dxos/react-ui-theme";
539
+ // src/components/Form/custom/TupleInput.tsx
540
+ import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
541
+ import React5 from "react";
542
+ import { Input as Input5 } from "@dxos/react-ui";
543
+ import { mx as mx3 } from "@dxos/react-ui-theme";
571
544
  import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
572
545
  var gridCols = [
573
546
  "grid-cols-1",
@@ -575,22 +548,22 @@ var gridCols = [
575
548
  "grid-cols-3",
576
549
  "grid-cols-4"
577
550
  ];
578
- var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
579
- var _effect = _useSignals6();
551
+ var TupleInput = ({ binding, type, label, readonly, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
552
+ var _effect = _useSignals5();
580
553
  try {
581
554
  const { status, error } = getStatus();
582
555
  const values = getValue3() ?? {};
583
- return /* @__PURE__ */ React6.createElement(Input6.Root, {
556
+ return /* @__PURE__ */ React5.createElement(Input5.Root, {
584
557
  validationValence: status
585
- }, /* @__PURE__ */ React6.createElement(InputHeader, {
558
+ }, /* @__PURE__ */ React5.createElement(InputHeader, {
586
559
  error,
587
560
  label
588
- }), /* @__PURE__ */ React6.createElement("div", {
589
- className: mx5("grid gap-2", gridCols[binding.length - 1])
590
- }, binding.map((prop) => /* @__PURE__ */ React6.createElement(Input6.TextInput, {
561
+ }), /* @__PURE__ */ React5.createElement("div", {
562
+ className: mx3("grid gap-2", gridCols[binding.length - 1])
563
+ }, binding.map((prop) => /* @__PURE__ */ React5.createElement(Input5.TextInput, {
591
564
  key: prop,
592
565
  type: "number",
593
- disabled,
566
+ disabled: !!readonly,
594
567
  value: values[prop],
595
568
  onChange: (event) => onValueChange(type, {
596
569
  ...values,
@@ -603,72 +576,73 @@ var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValu
603
576
  }
604
577
  };
605
578
 
606
- // packages/ui/react-ui-form/src/components/Form/Defaults.tsx
607
- import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
608
- import React7, { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef2 } from "react";
609
- import { Input as Input7, Select, useTranslation as useTranslation4 } from "@dxos/react-ui";
610
- var TextInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
611
- var _effect = _useSignals7();
579
+ // src/components/Form/Defaults.tsx
580
+ import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
581
+ import React6, { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef2 } from "react";
582
+ import { Input as Input6, Select, useTranslation as useTranslation4 } from "@dxos/react-ui";
583
+ var TextInput = ({ type, label, inputOnly, readonly, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
584
+ var _effect = _useSignals6();
612
585
  try {
613
586
  const { status, error } = getStatus();
614
- return disabled && !getValue3() ? null : disabled && inputOnly ? /* @__PURE__ */ React7.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React7.createElement(Input7.Root, {
587
+ return readonly && !getValue3() ? null : readonly === "static" && inputOnly ? /* @__PURE__ */ React6.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React6.createElement(Input6.Root, {
615
588
  validationValence: status
616
- }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
589
+ }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
617
590
  error,
618
591
  label
619
- }), disabled ? /* @__PURE__ */ React7.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React7.createElement(Input7.TextInput, {
620
- disabled,
592
+ }), readonly === "static" ? /* @__PURE__ */ React6.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React6.createElement(Input6.TextInput, {
593
+ disabled: !!readonly,
621
594
  placeholder,
622
595
  value: getValue3() ?? "",
623
596
  onChange: (event) => onValueChange(type, event.target.value),
624
597
  onBlur
625
- }), inputOnly && /* @__PURE__ */ React7.createElement(Input7.Validation, null, error));
598
+ }), inputOnly && /* @__PURE__ */ React6.createElement(Input6.Validation, null, error));
626
599
  } finally {
627
600
  _effect.f();
628
601
  }
629
602
  };
630
- var NumberInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
631
- var _effect = _useSignals7();
603
+ var NumberInput = ({ type, label, inputOnly, readonly, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
604
+ var _effect = _useSignals6();
632
605
  try {
633
606
  const { status, error } = getStatus();
634
- return disabled && !getValue3() ? null : disabled && inputOnly ? /* @__PURE__ */ React7.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React7.createElement(Input7.Root, {
607
+ return readonly && !getValue3() ? null : readonly === "static" && inputOnly ? /* @__PURE__ */ React6.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React6.createElement(Input6.Root, {
635
608
  validationValence: status
636
- }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
609
+ }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
637
610
  error,
638
611
  label
639
- }), disabled ? /* @__PURE__ */ React7.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React7.createElement(Input7.TextInput, {
612
+ }), readonly === "static" ? /* @__PURE__ */ React6.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React6.createElement(Input6.TextInput, {
640
613
  type: "number",
641
- disabled,
614
+ disabled: !!readonly,
642
615
  placeholder,
643
- value: getValue3() ?? 0,
616
+ value: getValue3(),
644
617
  onChange: (event) => onValueChange(type, event.target.value),
645
618
  onBlur
646
- }), inputOnly && /* @__PURE__ */ React7.createElement(Input7.DescriptionAndValidation, null, error));
619
+ }), inputOnly && /* @__PURE__ */ React6.createElement(Input6.DescriptionAndValidation, null, error));
647
620
  } finally {
648
621
  _effect.f();
649
622
  }
650
623
  };
651
- var BooleanInput = ({ type, label, inputOnly, getStatus, getValue: getValue3, onValueChange, disabled }) => {
652
- var _effect = _useSignals7();
624
+ var BooleanInput = ({ type, label, inputOnly, getStatus, getValue: getValue3, onValueChange, readonly }) => {
625
+ var _effect = _useSignals6();
653
626
  try {
654
627
  const { status, error } = getStatus();
655
628
  const checked = Boolean(getValue3());
656
629
  const { t } = useTranslation4(translationKey);
657
- return /* @__PURE__ */ React7.createElement(Input7.Root, {
630
+ return /* @__PURE__ */ React6.createElement(Input6.Root, {
658
631
  validationValence: status
659
- }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
632
+ }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
660
633
  error,
661
634
  label
662
- }), disabled ? /* @__PURE__ */ React7.createElement("p", null, t(checked ? "boolean input true value" : "boolean input false value")) : /* @__PURE__ */ React7.createElement(Input7.Switch, {
635
+ }), readonly === "static" ? /* @__PURE__ */ React6.createElement("p", null, t(checked ? "boolean input true value" : "boolean input false value")) : /* @__PURE__ */ React6.createElement(Input6.Switch, {
636
+ disabled: !!readonly,
663
637
  checked,
664
638
  onCheckedChange: (value) => onValueChange(type, value)
665
- }), inputOnly && /* @__PURE__ */ React7.createElement(Input7.DescriptionAndValidation, null, error));
639
+ }), inputOnly && /* @__PURE__ */ React6.createElement(Input6.DescriptionAndValidation, null, error));
666
640
  } finally {
667
641
  _effect.f();
668
642
  }
669
643
  };
670
- var SelectInput = ({ type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue3, onValueChange }) => {
671
- var _effect = _useSignals7();
644
+ var SelectInput = ({ type, label, inputOnly, readonly, placeholder, options, getStatus, getValue: getValue3, onValueChange }) => {
645
+ var _effect = _useSignals6();
672
646
  try {
673
647
  const { status, error } = getStatus();
674
648
  const value = getValue3();
@@ -676,31 +650,31 @@ var SelectInput = ({ type, label, inputOnly, disabled, placeholder, options, get
676
650
  type,
677
651
  onValueChange
678
652
  ]);
679
- return disabled && !value ? null : /* @__PURE__ */ React7.createElement(Input7.Root, {
653
+ return readonly && !value ? null : /* @__PURE__ */ React6.createElement(Input6.Root, {
680
654
  validationValence: status
681
- }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
655
+ }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
682
656
  error,
683
657
  label
684
- }), disabled ? /* @__PURE__ */ React7.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value)?.label ?? String(value)) : /* @__PURE__ */ React7.createElement(Select.Root, {
658
+ }), readonly === "static" ? /* @__PURE__ */ React6.createElement("p", null, options?.find(({ value: optionValue }) => optionValue === value)?.label ?? String(value)) : /* @__PURE__ */ React6.createElement(Select.Root, {
685
659
  value,
686
660
  onValueChange: handleValueChange
687
- }, /* @__PURE__ */ React7.createElement(Select.TriggerButton, {
661
+ }, /* @__PURE__ */ React6.createElement(Select.TriggerButton, {
688
662
  classNames: "is-full",
689
- disabled,
663
+ disabled: !!readonly,
690
664
  placeholder
691
- }), /* @__PURE__ */ React7.createElement(Select.Portal, null, /* @__PURE__ */ React7.createElement(Select.Content, null, /* @__PURE__ */ React7.createElement(Select.Viewport, null, options?.map(({ value: value2, label: label2 }) => (
665
+ }), /* @__PURE__ */ React6.createElement(Select.Portal, null, /* @__PURE__ */ React6.createElement(Select.Content, null, /* @__PURE__ */ React6.createElement(Select.Viewport, null, options?.map(({ value: value2, label: label2 }) => (
692
666
  // NOTE: Numeric values are converted to and from strings.
693
- /* @__PURE__ */ React7.createElement(Select.Option, {
667
+ /* @__PURE__ */ React6.createElement(Select.Option, {
694
668
  key: String(value2),
695
669
  value: String(value2)
696
670
  }, label2 ?? String(value2))
697
- )))))), inputOnly && /* @__PURE__ */ React7.createElement(Input7.DescriptionAndValidation, null, error));
671
+ ))), /* @__PURE__ */ React6.createElement(Select.Arrow, null)))), inputOnly && /* @__PURE__ */ React6.createElement(Input6.DescriptionAndValidation, null, error));
698
672
  } finally {
699
673
  _effect.f();
700
674
  }
701
675
  };
702
- var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
703
- var _effect = _useSignals7();
676
+ var MarkdownInput = ({ type, label, inputOnly, readonly, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
677
+ var _effect = _useSignals6();
704
678
  try {
705
679
  const { status, error } = getStatus();
706
680
  const textareaRef = useRef2(null);
@@ -722,14 +696,14 @@ var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus,
722
696
  getValue3(),
723
697
  adjustHeight
724
698
  ]);
725
- return /* @__PURE__ */ React7.createElement(Input7.Root, {
699
+ return /* @__PURE__ */ React6.createElement(Input6.Root, {
726
700
  validationValence: status
727
- }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
701
+ }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
728
702
  error,
729
703
  label
730
- }), disabled ? /* @__PURE__ */ React7.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React7.createElement(Input7.TextArea, {
704
+ }), readonly === "static" ? /* @__PURE__ */ React6.createElement("p", null, getValue3() ?? "") : /* @__PURE__ */ React6.createElement(Input6.TextArea, {
731
705
  ref: textareaRef,
732
- disabled,
706
+ disabled: !!readonly,
733
707
  placeholder,
734
708
  value: getValue3() ?? "",
735
709
  classNames: "min-bs-auto max-h-40 overflow-auto",
@@ -739,32 +713,33 @@ var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus,
739
713
  resize: "none"
740
714
  },
741
715
  spellCheck: false
742
- }), inputOnly && /* @__PURE__ */ React7.createElement(Input7.Validation, null, error));
716
+ }), inputOnly && /* @__PURE__ */ React6.createElement(Input6.Validation, null, error));
743
717
  } finally {
744
718
  _effect.f();
745
719
  }
746
720
  };
747
721
 
748
- // packages/ui/react-ui-form/src/components/Form/Form.tsx
749
- import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
750
- import React13, { useEffect as useEffect7, useMemo as useMemo6, useRef as useRef3 } from "react";
722
+ // src/components/Form/Form.tsx
723
+ import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
724
+ import { useFocusFinders } from "@fluentui/react-tabster";
725
+ import React12, { useEffect as useEffect7, useMemo as useMemo6, useRef as useRef3 } from "react";
751
726
  import { cardDialogOverflow, cardSpacing as cardSpacing2 } from "@dxos/react-ui-stack";
752
727
 
753
- // packages/ui/react-ui-form/src/components/Form/FormActions.tsx
754
- import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
755
- import React9 from "react";
728
+ // src/components/Form/FormActions.tsx
729
+ import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
730
+ import React8 from "react";
756
731
  import { IconButton as IconButton2, useTranslation as useTranslation5 } from "@dxos/react-ui";
757
732
  import { cardSpacing } from "@dxos/react-ui-stack";
758
- import { mx as mx6 } from "@dxos/react-ui-theme";
733
+ import { mx as mx4 } from "@dxos/react-ui-theme";
759
734
 
760
- // packages/ui/react-ui-form/src/components/Form/FormContext.tsx
761
- import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
762
- import React8, { createContext, useContext, useEffect as useEffect6, useMemo as useMemo3, useCallback as useCallback6 } from "react";
735
+ // src/components/Form/FormContext.tsx
736
+ import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
737
+ import React7, { createContext, useCallback as useCallback6, useContext, useEffect as useEffect6, useMemo as useMemo3 } from "react";
763
738
  import { raise } from "@dxos/debug";
764
739
  import { getValue as getValue2 } from "@dxos/echo-schema";
765
740
  import { createJsonPath as createJsonPath2 } from "@dxos/effect";
766
741
 
767
- // packages/ui/react-ui-form/src/hooks/useForm.ts
742
+ // src/hooks/useForm.ts
768
743
  import { SchemaAST } from "effect";
769
744
  import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo2, useState as useState3 } from "react";
770
745
  import { getValue, setValue } from "@dxos/echo-schema";
@@ -772,11 +747,11 @@ import { createJsonPath, fromEffectValidationPath } from "@dxos/effect";
772
747
  import { invariant } from "@dxos/invariant";
773
748
  import { log } from "@dxos/log";
774
749
  import { validateSchema } from "@dxos/schema";
775
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.ts";
750
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.ts";
776
751
  var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave }) => {
777
752
  invariant(SchemaAST.isTypeLiteral(schema.ast), void 0, {
778
753
  F: __dxlog_file,
779
- L: 93,
754
+ L: 95,
780
755
  S: void 0,
781
756
  A: [
782
757
  "SchemaAST.isTypeLiteral(schema.ast)",
@@ -880,7 +855,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
880
855
  } catch (err) {
881
856
  log.catch(err, void 0, {
882
857
  F: __dxlog_file,
883
- L: 213,
858
+ L: 215,
884
859
  S: void 0,
885
860
  C: (f, a) => f(...a)
886
861
  });
@@ -951,7 +926,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
951
926
  var createKeySet = (obj, value) => {
952
927
  invariant(obj, void 0, {
953
928
  F: __dxlog_file,
954
- L: 275,
929
+ L: 277,
955
930
  S: void 0,
956
931
  A: [
957
932
  "obj",
@@ -973,7 +948,7 @@ var flatMap = (errors) => {
973
948
  }, {});
974
949
  };
975
950
 
976
- // packages/ui/react-ui-form/src/hooks/useRefQueryLookupHandler.ts
951
+ // src/hooks/useRefQueryLookupHandler.ts
977
952
  import { useCallback as useCallback5 } from "react";
978
953
  import { getObjectDXN } from "@dxos/echo-schema";
979
954
  import { Filter } from "@dxos/react-client/echo";
@@ -1001,10 +976,10 @@ var useRefQueryLookupHandler = ({ space }) => {
1001
976
  ]);
1002
977
  };
1003
978
 
1004
- // packages/ui/react-ui-form/src/hooks/useQueryRefOptions.ts
979
+ // src/hooks/useQueryRefOptions.ts
1005
980
  import { useEffect as useEffect5, useState as useState4 } from "react";
1006
981
  import { log as log2 } from "@dxos/log";
1007
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/hooks/useQueryRefOptions.ts";
982
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/hooks/useQueryRefOptions.ts";
1008
983
  var useQueryRefOptions = ({ refTypeInfo, onQueryRefOptions }) => {
1009
984
  const [options, setOptions] = useState4([]);
1010
985
  const [loading, setLoading] = useState4(false);
@@ -1047,7 +1022,7 @@ var useQueryRefOptions = ({ refTypeInfo, onQueryRefOptions }) => {
1047
1022
  };
1048
1023
  };
1049
1024
 
1050
- // packages/ui/react-ui-form/src/components/Form/FormContext.tsx
1025
+ // src/components/Form/FormContext.tsx
1051
1026
  var FormContext = /* @__PURE__ */ createContext(void 0);
1052
1027
  var useFormContext = () => {
1053
1028
  return useContext(FormContext) ?? raise(new Error("Missing FormContext"));
@@ -1076,7 +1051,7 @@ var useInputProps = (path = []) => {
1076
1051
  ]);
1077
1052
  };
1078
1053
  var FormProvider = ({ children, formRef, autoSave, ...formOptions }) => {
1079
- var _effect = _useSignals8();
1054
+ var _effect = _useSignals7();
1080
1055
  try {
1081
1056
  const form = useForm(formOptions);
1082
1057
  const handleKeyDown = useCallback6((event) => {
@@ -1112,7 +1087,7 @@ var FormProvider = ({ children, formRef, autoSave, ...formOptions }) => {
1112
1087
  form.handleSave,
1113
1088
  autoSave
1114
1089
  ]);
1115
- return /* @__PURE__ */ React8.createElement(FormContext.Provider, {
1090
+ return /* @__PURE__ */ React7.createElement(FormContext.Provider, {
1116
1091
  value: form
1117
1092
  }, children);
1118
1093
  } finally {
@@ -1120,21 +1095,21 @@ var FormProvider = ({ children, formRef, autoSave, ...formOptions }) => {
1120
1095
  }
1121
1096
  };
1122
1097
 
1123
- // packages/ui/react-ui-form/src/components/Form/FormActions.tsx
1098
+ // src/components/Form/FormActions.tsx
1124
1099
  var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
1125
- var _effect = _useSignals9();
1100
+ var _effect = _useSignals8();
1126
1101
  try {
1127
1102
  const { t } = useTranslation5(translationKey);
1128
1103
  const { canSave, handleSave } = useFormContext();
1129
- return /* @__PURE__ */ React9.createElement("div", {
1104
+ return /* @__PURE__ */ React8.createElement("div", {
1130
1105
  role: "none",
1131
- className: mx6(outerSpacing === "scroll-fields" ? "pli-cardSpacingInline mbe-cardSpacingBlock" : outerSpacing ? cardSpacing : "mbs-cardSpacingBlock", "flex [&_button]:grow gap-1 first:mbs-0")
1132
- }, onCancel && !readonly && /* @__PURE__ */ React9.createElement(IconButton2, {
1106
+ className: mx4(outerSpacing === "scroll-fields" ? "pli-cardSpacingInline mbe-cardSpacingBlock" : outerSpacing ? cardSpacing : "mbs-cardSpacingBlock", "flex [&_button]:grow gap-1 first:mbs-0")
1107
+ }, onCancel && !readonly && /* @__PURE__ */ React8.createElement(IconButton2, {
1133
1108
  "data-testid": "cancel-button",
1134
1109
  icon: "ph--x--regular",
1135
1110
  label: t("button cancel"),
1136
1111
  onClick: onCancel
1137
- }), handleSave && /* @__PURE__ */ React9.createElement(IconButton2, {
1112
+ }), handleSave && /* @__PURE__ */ React8.createElement(IconButton2, {
1138
1113
  type: "submit",
1139
1114
  "data-testid": "save-button",
1140
1115
  disabled: !canSave,
@@ -1147,27 +1122,17 @@ var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
1147
1122
  }
1148
1123
  };
1149
1124
 
1150
- // packages/ui/react-ui-form/src/components/Form/FormContent.tsx
1151
- import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
1125
+ // src/components/Form/FormContent.tsx
1126
+ import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
1152
1127
  import { Schema, SchemaAST as SchemaAST4, pipe as pipe2 } from "effect";
1153
1128
  import { capitalize as capitalize2 } from "effect/String";
1154
- import React12, { forwardRef, useMemo as useMemo5 } from "react";
1129
+ import React11, { forwardRef, useMemo as useMemo5 } from "react";
1155
1130
  import { createJsonPath as createJsonPath3, findNode as findNode3, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
1156
- import { mx as mx8 } from "@dxos/react-ui-theme";
1131
+ import { mx as mx6 } from "@dxos/react-ui-theme";
1157
1132
  import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
1158
1133
  import { isNotFalsy } from "@dxos/util";
1159
1134
 
1160
- // packages/ui/react-ui-form/src/components/Form/ArrayField.tsx
1161
- import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1162
- import { SchemaAST as SchemaAST3, pipe } from "effect";
1163
- import { capitalize } from "effect/String";
1164
- import React10, { Fragment, useCallback as useCallback7 } from "react";
1165
- import { findNode as findNode2, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
1166
- import { invariant as invariant2 } from "@dxos/invariant";
1167
- import { IconButton as IconButton3, useTranslation as useTranslation6 } from "@dxos/react-ui";
1168
- import { getSchemaProperties } from "@dxos/schema";
1169
-
1170
- // packages/ui/react-ui-form/src/util/field.ts
1135
+ // src/util/field.ts
1171
1136
  import { FormatEnum, GeoLocation as GeoLocation2, TypeEnum } from "@dxos/echo-schema";
1172
1137
  var parseValue = ({ type, format, value }) => {
1173
1138
  if (value === void 0 || value === null || value === "") {
@@ -1248,28 +1213,7 @@ var parseValue = ({ type, format, value }) => {
1248
1213
  }
1249
1214
  };
1250
1215
  var cellClassesForFieldType = ({ type, format }) => {
1251
- if (!format) {
1252
- switch (type) {
1253
- case TypeEnum.Number:
1254
- return [
1255
- "text-right",
1256
- "font-mono"
1257
- ];
1258
- case TypeEnum.Boolean:
1259
- return [
1260
- "text-right",
1261
- "font-mono"
1262
- ];
1263
- case TypeEnum.String:
1264
- return void 0;
1265
- case TypeEnum.Ref:
1266
- return void 0;
1267
- default: {
1268
- return void 0;
1269
- }
1270
- }
1271
- }
1272
- switch (format) {
1216
+ switch (format || type) {
1273
1217
  case FormatEnum.Markdown:
1274
1218
  return void 0;
1275
1219
  case FormatEnum.Time:
@@ -1290,6 +1234,16 @@ var cellClassesForFieldType = ({ type, format }) => {
1290
1234
  return [
1291
1235
  "font-mono"
1292
1236
  ];
1237
+ case TypeEnum.Number:
1238
+ case TypeEnum.Boolean:
1239
+ return [
1240
+ "text-right",
1241
+ "font-mono"
1242
+ ];
1243
+ case TypeEnum.String:
1244
+ return void 0;
1245
+ case TypeEnum.Ref:
1246
+ return void 0;
1293
1247
  default:
1294
1248
  return void 0;
1295
1249
  }
@@ -1299,7 +1253,7 @@ var pathNotUniqueError = (path) => ({
1299
1253
  message: `'${path}' is already present`
1300
1254
  });
1301
1255
 
1302
- // packages/ui/react-ui-form/src/util/formatting.ts
1256
+ // src/util/formatting.ts
1303
1257
  import { format as formatDate } from "date-fns/format";
1304
1258
  import { FormatEnum as FormatEnum2, GeoLocation as GeoLocation3, TypeEnum as TypeEnum2 } from "@dxos/echo-schema";
1305
1259
  var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
@@ -1437,11 +1391,11 @@ var formatForEditing = ({ type, format, value, locale = void 0 }) => {
1437
1391
  }
1438
1392
  };
1439
1393
 
1440
- // packages/ui/react-ui-form/src/util/refs.ts
1394
+ // src/util/refs.ts
1441
1395
  import { FormatEnum as FormatEnum3, ReferenceAnnotationId } from "@dxos/echo-schema";
1442
1396
  import { findAnnotation } from "@dxos/effect";
1443
1397
 
1444
- // packages/ui/react-ui-form/src/util/schema.ts
1398
+ // src/util/schema.ts
1445
1399
  import { SchemaAST as SchemaAST2 } from "effect";
1446
1400
  import { findNode } from "@dxos/effect";
1447
1401
  var findArrayElementType = (ast) => {
@@ -1450,7 +1404,7 @@ var findArrayElementType = (ast) => {
1450
1404
  return elementType;
1451
1405
  };
1452
1406
 
1453
- // packages/ui/react-ui-form/src/util/refs.ts
1407
+ // src/util/refs.ts
1454
1408
  var getRefProps = (property) => {
1455
1409
  const { ast, format, array } = property;
1456
1410
  if (format === FormatEnum3.Ref) {
@@ -1474,10 +1428,18 @@ var getRefProps = (property) => {
1474
1428
  return void 0;
1475
1429
  };
1476
1430
 
1477
- // packages/ui/react-ui-form/src/components/Form/ArrayField.tsx
1478
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
1431
+ // src/components/Form/ArrayField.tsx
1432
+ import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
1433
+ import { SchemaAST as SchemaAST3, pipe } from "effect";
1434
+ import { capitalize } from "effect/String";
1435
+ import React9, { Fragment, useCallback as useCallback7 } from "react";
1436
+ import { SimpleType, findNode as findNode2, getDiscriminatedType, isDiscriminatedUnion } from "@dxos/effect";
1437
+ import { invariant as invariant2 } from "@dxos/invariant";
1438
+ import { IconButton as IconButton3, useTranslation as useTranslation6 } from "@dxos/react-ui";
1439
+ import { getSchemaProperties } from "@dxos/schema";
1440
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
1479
1441
  var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponent }) => {
1480
- var _effect = _useSignals10();
1442
+ var _effect = _useSignals9();
1481
1443
  try {
1482
1444
  const { t } = useTranslation6(translationKey);
1483
1445
  const { ast, name, type, title } = property;
@@ -1527,14 +1489,14 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1527
1489
  if (!elementType) {
1528
1490
  return null;
1529
1491
  }
1530
- return readonly && values.length < 1 ? null : /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(InputHeader, {
1492
+ return readonly && values.length < 1 ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(InputHeader, {
1531
1493
  readonly: true,
1532
1494
  label
1533
- }), /* @__PURE__ */ React10.createElement("div", {
1495
+ }), /* @__PURE__ */ React9.createElement("div", {
1534
1496
  role: "none",
1535
1497
  className: readonly ? "flex flex-wrap gap-1 mlb-1" : values.length > 0 ? "grid gap-1 grid-cols-[1fr_min-content] mlb-1" : "hidden"
1536
1498
  }, values.map((_value, index) => {
1537
- const field = /* @__PURE__ */ React10.createElement(FormField, {
1499
+ const field = /* @__PURE__ */ React9.createElement(FormField, {
1538
1500
  property: {
1539
1501
  ...property,
1540
1502
  array: false,
@@ -1549,19 +1511,19 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1549
1511
  Custom,
1550
1512
  lookupComponent
1551
1513
  });
1552
- return readonly ? field : /* @__PURE__ */ React10.createElement(Fragment, {
1514
+ return readonly ? field : /* @__PURE__ */ React9.createElement(Fragment, {
1553
1515
  key: index
1554
- }, /* @__PURE__ */ React10.createElement("div", {
1516
+ }, /* @__PURE__ */ React9.createElement("div", {
1555
1517
  role: "none"
1556
- }, field), /* @__PURE__ */ React10.createElement(IconButton3, {
1518
+ }, field), /* @__PURE__ */ React9.createElement(IconButton3, {
1557
1519
  icon: "ph--trash--regular",
1558
1520
  iconOnly: true,
1559
1521
  label: t("button remove"),
1560
1522
  onClick: () => handleRemove(index),
1561
1523
  classNames: "self-center"
1562
1524
  }));
1563
- })), !readonly && /* @__PURE__ */ React10.createElement(IconButton3, {
1564
- classNames: "is-full mlb-1 flex",
1525
+ })), !readonly && /* @__PURE__ */ React9.createElement(IconButton3, {
1526
+ classNames: "is-full mlb-cardSpacingBlock flex",
1565
1527
  icon: "ph--plus--regular",
1566
1528
  label: t("add field"),
1567
1529
  onClick: handleAdd
@@ -1571,19 +1533,42 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1571
1533
  }
1572
1534
  };
1573
1535
 
1574
- // packages/ui/react-ui-form/src/components/Form/RefField.tsx
1575
- import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
1576
- import React11, { useCallback as useCallback8, useMemo as useMemo4 } from "react";
1577
- import { Expando, getTypeAnnotation, Ref, ReferenceAnnotationId as ReferenceAnnotationId2 } from "@dxos/echo-schema";
1536
+ // src/components/Form/factory.tsx
1537
+ import { FormatEnum as FormatEnum4 } from "@dxos/echo-schema";
1538
+ var getInputComponent = (type, format) => {
1539
+ switch (format) {
1540
+ case FormatEnum4.GeoPoint:
1541
+ return GeoPointInput;
1542
+ case FormatEnum4.Markdown:
1543
+ return MarkdownInput;
1544
+ }
1545
+ switch (type) {
1546
+ case "string":
1547
+ return TextInput;
1548
+ case "number":
1549
+ return NumberInput;
1550
+ case "boolean":
1551
+ return BooleanInput;
1552
+ }
1553
+ };
1554
+
1555
+ // src/components/Form/RefField.tsx
1556
+ import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1557
+ import React10, { useCallback as useCallback8, useMemo as useMemo4, useState as useState5 } from "react";
1558
+ import { Expando, Ref, ReferenceAnnotationId as ReferenceAnnotationId2, getTypeAnnotation } from "@dxos/echo-schema";
1578
1559
  import { findAnnotation as findAnnotation2 } from "@dxos/effect";
1579
1560
  import { DXN } from "@dxos/keys";
1580
- import { DxRefTag } from "@dxos/lit-ui/react";
1581
- import { Input as Input8, useTranslation as useTranslation7 } from "@dxos/react-ui";
1582
- import { TagPicker } from "@dxos/react-ui-tag-picker";
1583
- import { descriptionText, mx as mx7 } from "@dxos/react-ui-theme";
1561
+ import { DxAnchor } from "@dxos/lit-ui/react";
1562
+ import { Button as Button2, Icon as Icon2, Input as Input7, useTranslation as useTranslation7 } from "@dxos/react-ui";
1563
+ import { PopoverCombobox } from "@dxos/react-ui-searchlist";
1564
+ import { TagPickerItem } from "@dxos/react-ui-tag-picker";
1565
+ import { descriptionText, mx as mx5 } from "@dxos/react-ui-theme";
1584
1566
  import { isNonNullable as isNonNullable2 } from "@dxos/util";
1585
- var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, getValue: getValue3, onBlur, onQueryRefOptions, onValueChange, ...restInputProps }) => {
1586
- var _effect = _useSignals11();
1567
+ var isRefSnapShot = (val) => {
1568
+ return typeof val === "object" && typeof val?.["/"] === "string";
1569
+ };
1570
+ var RefField = ({ type, label, readonly, placeholder, inputOnly, array, ast, getValue: getValue3, onBlur, onQueryRefOptions, createOptionLabel, createOptionIcon, onCreateFromQuery, onValueChange, ...restInputProps }) => {
1571
+ var _effect = _useSignals10();
1587
1572
  try {
1588
1573
  const { t } = useTranslation7(translationKey);
1589
1574
  const refTypeInfo = useMemo4(() => ast ? findAnnotation2(ast, ReferenceAnnotationId2) : void 0, [
@@ -1594,11 +1579,11 @@ var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, get
1594
1579
  onQueryRefOptions
1595
1580
  });
1596
1581
  if (refTypeInfo && refTypeInfo?.typename === getTypeAnnotation(Expando)?.typename || !onQueryRefOptions) {
1597
- return /* @__PURE__ */ React11.createElement(RefFieldFallback, {
1582
+ return /* @__PURE__ */ React10.createElement(RefFieldFallback, {
1598
1583
  type,
1599
1584
  label,
1600
1585
  placeholder,
1601
- disabled,
1586
+ readonly,
1602
1587
  inputOnly,
1603
1588
  getValue: getValue3,
1604
1589
  onBlur,
@@ -1609,8 +1594,9 @@ var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, get
1609
1594
  const handleGetValue = useCallback8(() => {
1610
1595
  const formValue = getValue3();
1611
1596
  const unknownToRefOption = (val) => {
1612
- if (Ref.isRef(val)) {
1613
- const dxnString = val.dxn.toString();
1597
+ const isRef = Ref.isRef(val);
1598
+ if (isRef || isRefSnapShot(val)) {
1599
+ const dxnString = isRef ? val.dxn.toString() : val["/"];
1614
1600
  const matchingOption = availableOptions.find((option2) => option2.id === dxnString);
1615
1601
  if (matchingOption) {
1616
1602
  return matchingOption;
@@ -1633,13 +1619,6 @@ var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, get
1633
1619
  availableOptions,
1634
1620
  array
1635
1621
  ]);
1636
- const handleSearch = useCallback8((text, ids) => availableOptions.filter((option) => !ids.includes(option.id)).filter((option) => option.label.toLowerCase().includes(text.toLowerCase())).map((option) => ({
1637
- id: option.id,
1638
- label: option.label,
1639
- hue: option.hue
1640
- })), [
1641
- availableOptions
1642
- ]);
1643
1622
  const handleUpdate = useCallback8((ids) => {
1644
1623
  if (ids.length === 0) {
1645
1624
  onValueChange("object", void 0);
@@ -1663,45 +1642,115 @@ var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, get
1663
1642
  array,
1664
1643
  onValueChange
1665
1644
  ]);
1666
- const tagPickerMode = useMemo4(() => array ? "multi-select" : "single-select", [
1667
- array
1668
- ]);
1669
1645
  if (!refTypeInfo) {
1670
1646
  return null;
1671
1647
  }
1672
1648
  const { status, error } = restInputProps.getStatus();
1673
1649
  const items = handleGetValue();
1674
- return disabled && items.length < 1 ? null : /* @__PURE__ */ React11.createElement(Input8.Root, {
1650
+ const selectedIds = useMemo4(() => items.map((i) => i.id), [
1651
+ items
1652
+ ]);
1653
+ const labelById = useMemo4(() => availableOptions.reduce((acc, option) => {
1654
+ acc[option.id.toLowerCase()] = option.label.toLowerCase();
1655
+ return acc;
1656
+ }, {}), [
1657
+ availableOptions
1658
+ ]);
1659
+ const [query, setQuery] = useState5("");
1660
+ const toggleSelect = useCallback8((id) => {
1661
+ if (array) {
1662
+ const nextIds = selectedIds.includes(id) ? selectedIds.filter((x) => x !== id) : [
1663
+ ...selectedIds,
1664
+ id
1665
+ ];
1666
+ handleUpdate(nextIds);
1667
+ } else {
1668
+ if (selectedIds[0] === id) {
1669
+ handleUpdate([]);
1670
+ } else {
1671
+ handleUpdate([
1672
+ id
1673
+ ]);
1674
+ }
1675
+ }
1676
+ }, [
1677
+ array,
1678
+ selectedIds,
1679
+ handleUpdate
1680
+ ]);
1681
+ return readonly && items.length < 1 ? null : /* @__PURE__ */ React10.createElement(Input7.Root, {
1675
1682
  validationValence: status
1676
- }, !inputOnly && /* @__PURE__ */ React11.createElement(InputHeader, {
1683
+ }, !inputOnly && /* @__PURE__ */ React10.createElement(InputHeader, {
1677
1684
  error,
1678
1685
  label
1679
- }), /* @__PURE__ */ React11.createElement("div", {
1686
+ }), /* @__PURE__ */ React10.createElement("div", {
1680
1687
  "data-no-submit": true
1681
- }, disabled ? items.length < 1 ? /* @__PURE__ */ React11.createElement("p", {
1682
- className: mx7(descriptionText, "mbe-2")
1683
- }, t("empty readonly ref field label")) : items.map((item) => /* @__PURE__ */ React11.createElement(DxRefTag, {
1688
+ }, readonly ? items.length < 1 ? /* @__PURE__ */ React10.createElement("p", {
1689
+ className: mx5(descriptionText, "mbe-2")
1690
+ }, t("empty readonly ref field label")) : items.map((item) => /* @__PURE__ */ React10.createElement(DxAnchor, {
1684
1691
  key: item.id,
1685
1692
  refid: item.id,
1686
- rootclassname: "mie-1",
1687
- style: {
1688
- marginInlineEnd: ".25rem"
1693
+ rootclassname: "mie-1"
1694
+ }, item.label)) : /* @__PURE__ */ React10.createElement(PopoverCombobox.Root, null, /* @__PURE__ */ React10.createElement(PopoverCombobox.Trigger, {
1695
+ asChild: true
1696
+ }, /* @__PURE__ */ React10.createElement(Button2, {
1697
+ variant: "ghost",
1698
+ classNames: "is-full text-start gap-2"
1699
+ }, /* @__PURE__ */ React10.createElement("div", {
1700
+ role: "none",
1701
+ className: "grow"
1702
+ }, items?.length ? items?.map((item) => /* @__PURE__ */ React10.createElement(TagPickerItem, {
1703
+ key: item.id,
1704
+ itemId: item.id,
1705
+ label: item.label,
1706
+ ...item.hue ? {
1707
+ hue: item.hue
1708
+ } : {},
1709
+ removeLabel: t("remove item label"),
1710
+ onItemClick: (event) => {
1711
+ if (event.action === "remove") {
1712
+ toggleSelect(item.id);
1713
+ }
1689
1714
  }
1690
- }, item.label)) : /* @__PURE__ */ React11.createElement(TagPicker, {
1691
- readonly: disabled,
1692
- items,
1693
- mode: tagPickerMode,
1694
- onBlur: (event) => onBlur(event),
1695
- onUpdate: handleUpdate,
1696
- onSearch: handleSearch,
1697
- classNames: "rounded-sm bg-inputSurface p-1.5"
1698
- })), inputOnly && /* @__PURE__ */ React11.createElement(Input8.DescriptionAndValidation, null, error));
1715
+ })) : /* @__PURE__ */ React10.createElement("span", {
1716
+ className: "text-description"
1717
+ }, placeholder ?? t("ref field placeholder", {
1718
+ count: array ? 99 : 1
1719
+ }))), /* @__PURE__ */ React10.createElement(Icon2, {
1720
+ size: 3,
1721
+ icon: "ph--caret-down--bold"
1722
+ }))), /* @__PURE__ */ React10.createElement(PopoverCombobox.Content, {
1723
+ filter: (value, search) => value === "__create__" || labelById[value]?.includes(search.toLowerCase()) ? 1 : 0
1724
+ }, /* @__PURE__ */ React10.createElement(PopoverCombobox.Input, {
1725
+ placeholder: "Search...",
1726
+ value: query,
1727
+ onValueChange: (v) => setQuery(v),
1728
+ autoFocus: true
1729
+ }), /* @__PURE__ */ React10.createElement(PopoverCombobox.List, null, availableOptions.map((option) => /* @__PURE__ */ React10.createElement(PopoverCombobox.Item, {
1730
+ key: option.id,
1731
+ value: option.id,
1732
+ onSelect: () => toggleSelect(option.id),
1733
+ classNames: "flex items-center gap-2"
1734
+ }, /* @__PURE__ */ React10.createElement("span", {
1735
+ className: "grow"
1736
+ }, option.label), selectedIds.includes(option.id) && /* @__PURE__ */ React10.createElement(Icon2, {
1737
+ icon: "ph--check--regular"
1738
+ }))), query.length > 0 && createOptionLabel && createOptionIcon && onCreateFromQuery && /* @__PURE__ */ React10.createElement(PopoverCombobox.Item, {
1739
+ value: "__create__",
1740
+ onSelect: () => onCreateFromQuery?.(refTypeInfo, query),
1741
+ classNames: "flex items-center gap-2"
1742
+ }, /* @__PURE__ */ React10.createElement(Icon2, {
1743
+ icon: createOptionIcon
1744
+ }), t(createOptionLabel[0], {
1745
+ ns: createOptionLabel[1].ns,
1746
+ text: query
1747
+ }))), /* @__PURE__ */ React10.createElement(PopoverCombobox.Arrow, null)))), inputOnly && /* @__PURE__ */ React10.createElement(Input7.DescriptionAndValidation, null, error));
1699
1748
  } finally {
1700
1749
  _effect.f();
1701
1750
  }
1702
1751
  };
1703
- var RefFieldFallback = ({ type, label, disabled, placeholder, inputOnly, getValue: getValue3, onValueChange, ...restInputProps }) => {
1704
- var _effect = _useSignals11();
1752
+ var RefFieldFallback = ({ type, label, readonly, placeholder, inputOnly, getValue: getValue3, onValueChange, ...restInputProps }) => {
1753
+ var _effect = _useSignals10();
1705
1754
  try {
1706
1755
  const handleOnValueChange = (_type, dxnString) => {
1707
1756
  const dxn = DXN.tryParse(dxnString);
@@ -1723,10 +1772,10 @@ var RefFieldFallback = ({ type, label, disabled, placeholder, inputOnly, getValu
1723
1772
  }
1724
1773
  return void 0;
1725
1774
  };
1726
- return /* @__PURE__ */ React11.createElement(TextInput, {
1775
+ return /* @__PURE__ */ React10.createElement(TextInput, {
1727
1776
  type,
1728
1777
  label,
1729
- disabled,
1778
+ readonly,
1730
1779
  placeholder,
1731
1780
  inputOnly,
1732
1781
  getValue: handleGetValue,
@@ -1738,28 +1787,9 @@ var RefFieldFallback = ({ type, label, disabled, placeholder, inputOnly, getValu
1738
1787
  }
1739
1788
  };
1740
1789
 
1741
- // packages/ui/react-ui-form/src/components/Form/factory.tsx
1742
- import { FormatEnum as FormatEnum4 } from "@dxos/echo-schema";
1743
- var getInputComponent = (type, format) => {
1744
- switch (format) {
1745
- case FormatEnum4.GeoPoint:
1746
- return GeoPointInput;
1747
- case FormatEnum4.Markdown:
1748
- return MarkdownInput;
1749
- }
1750
- switch (type) {
1751
- case "string":
1752
- return TextInput;
1753
- case "number":
1754
- return NumberInput;
1755
- case "boolean":
1756
- return BooleanInput;
1757
- }
1758
- };
1759
-
1760
- // packages/ui/react-ui-form/src/components/Form/FormContent.tsx
1761
- var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupComponent, Custom }) => {
1762
- var _effect = _useSignals12();
1790
+ // src/components/Form/FormContent.tsx
1791
+ var FormField = ({ property, path, readonly, inline, projection, onQueryRefOptions, createOptionLabel, createOptionIcon, onCreateFromQuery, lookupComponent, Custom }) => {
1792
+ var _effect = _useSignals11();
1763
1793
  try {
1764
1794
  const { ast, name, type, format, title, description, options, examples, array } = property;
1765
1795
  const inputProps = useInputProps(path);
@@ -1778,7 +1808,7 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
1778
1808
  type,
1779
1809
  format,
1780
1810
  label,
1781
- disabled: readonly,
1811
+ readonly,
1782
1812
  placeholder,
1783
1813
  ...inputProps
1784
1814
  }
@@ -1789,33 +1819,36 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
1789
1819
  const jsonPath = createJsonPath3(path ?? []);
1790
1820
  const CustomComponent = Custom?.[jsonPath];
1791
1821
  if (CustomComponent) {
1792
- return /* @__PURE__ */ React12.createElement(CustomComponent, {
1822
+ return /* @__PURE__ */ React11.createElement(CustomComponent, {
1793
1823
  type,
1794
1824
  format,
1795
1825
  label,
1796
1826
  inputOnly: inline,
1797
1827
  placeholder,
1798
- disabled: readonly,
1828
+ readonly,
1799
1829
  ...inputProps
1800
1830
  });
1801
1831
  }
1802
1832
  const refProps = getRefProps(property);
1803
1833
  if (refProps) {
1804
- return /* @__PURE__ */ React12.createElement(RefField, {
1834
+ return /* @__PURE__ */ React11.createElement(RefField, {
1805
1835
  ast: refProps.ast,
1806
1836
  array: refProps.isArray,
1807
1837
  type,
1808
1838
  format,
1809
1839
  label,
1810
1840
  placeholder,
1811
- disabled: readonly,
1841
+ readonly,
1812
1842
  inputOnly: inline,
1813
1843
  onQueryRefOptions,
1844
+ createOptionLabel,
1845
+ createOptionIcon,
1846
+ onCreateFromQuery,
1814
1847
  ...inputProps
1815
1848
  });
1816
1849
  }
1817
1850
  if (array) {
1818
- return /* @__PURE__ */ React12.createElement(ArrayField, {
1851
+ return /* @__PURE__ */ React11.createElement(ArrayField, {
1819
1852
  property,
1820
1853
  path,
1821
1854
  inputProps,
@@ -1825,21 +1858,21 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
1825
1858
  }
1826
1859
  const InputComponent = getInputComponent(type, format);
1827
1860
  if (InputComponent) {
1828
- return /* @__PURE__ */ React12.createElement(InputComponent, {
1861
+ return /* @__PURE__ */ React11.createElement(InputComponent, {
1829
1862
  type,
1830
1863
  format,
1831
1864
  label,
1832
1865
  inputOnly: inline,
1833
1866
  placeholder,
1834
- disabled: readonly,
1867
+ readonly,
1835
1868
  ...inputProps
1836
1869
  });
1837
1870
  }
1838
1871
  if (options) {
1839
- return /* @__PURE__ */ React12.createElement(SelectInput, {
1872
+ return /* @__PURE__ */ React11.createElement(SelectInput, {
1840
1873
  type,
1841
1874
  format,
1842
- disabled: readonly,
1875
+ readonly,
1843
1876
  inputOnly: inline,
1844
1877
  label,
1845
1878
  options: options.map((option) => ({
@@ -1854,13 +1887,17 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
1854
1887
  const baseNode = findNode3(ast, isDiscriminatedUnion2);
1855
1888
  const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode3(ast, SchemaAST4.isTypeLiteral);
1856
1889
  if (typeLiteral) {
1857
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, !inline && /* @__PURE__ */ React12.createElement("h3", {
1858
- className: mx8("text-lg mlb-inputSpacingBlock first:mbs-0")
1859
- }, label), /* @__PURE__ */ React12.createElement(FormFields, {
1890
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, !inline && /* @__PURE__ */ React11.createElement("h3", {
1891
+ className: mx6("text-lg mlb-inputSpacingBlock first:mbs-0")
1892
+ }, label), /* @__PURE__ */ React11.createElement(FormFields, {
1860
1893
  schema: Schema.make(typeLiteral),
1861
1894
  path,
1862
1895
  readonly,
1896
+ projection,
1863
1897
  onQueryRefOptions,
1898
+ createOptionLabel,
1899
+ createOptionIcon,
1900
+ onCreateFromQuery,
1864
1901
  Custom,
1865
1902
  lookupComponent
1866
1903
  }));
@@ -1871,26 +1908,44 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
1871
1908
  _effect.f();
1872
1909
  }
1873
1910
  };
1874
- var FormFields = /* @__PURE__ */ forwardRef(({ classNames, testId, schema, path, filter, sort, readonly, lookupComponent, Custom, onQueryRefOptions }, forwardRef2) => {
1875
- var _effect = _useSignals12();
1911
+ var FormFields = /* @__PURE__ */ forwardRef(({ classNames, schema, path, filter, sort, projection, readonly, lookupComponent, Custom, onQueryRefOptions, ...props }, forwardRef2) => {
1912
+ var _effect = _useSignals11();
1876
1913
  try {
1877
1914
  const values = useFormValues(path);
1878
1915
  const properties = useMemo5(() => {
1879
- const props = getSchemaProperties2(schema.ast, values);
1880
- const filtered = filter ? filter(props) : props;
1916
+ const props2 = getSchemaProperties2(schema.ast, values);
1917
+ if (projection) {
1918
+ const fieldProjections = projection.getFieldProjections();
1919
+ const hiddenProperties = new Set(projection.getHiddenProperties());
1920
+ const visibleProps = props2.filter((prop) => !hiddenProperties.has(prop.name));
1921
+ const orderedProps = [];
1922
+ for (const fieldProjection of fieldProjections) {
1923
+ const fieldPath = String(fieldProjection.field.path);
1924
+ const prop = visibleProps.find((p) => p.name === fieldPath);
1925
+ if (prop) {
1926
+ orderedProps.push(prop);
1927
+ }
1928
+ }
1929
+ const projectionPaths = new Set(fieldProjections.map((fp) => String(fp.field.path)));
1930
+ const remainingProps = visibleProps.filter((prop) => !projectionPaths.has(prop.name));
1931
+ orderedProps.push(...remainingProps);
1932
+ return orderedProps;
1933
+ }
1934
+ const filtered = filter ? filter(props2) : props2;
1881
1935
  return sort ? filtered.sort((a, b) => sort.indexOf(a.name) - sort.indexOf(b.name)) : filtered;
1882
1936
  }, [
1883
1937
  schema,
1884
1938
  values,
1885
1939
  filter,
1886
- sort
1940
+ sort,
1941
+ projection?.fields
1887
1942
  ]);
1888
- return /* @__PURE__ */ React12.createElement("div", {
1943
+ return /* @__PURE__ */ React11.createElement("div", {
1889
1944
  role: "form",
1890
- className: mx8("is-full", classNames),
1945
+ className: mx6("is-full", classNames),
1891
1946
  ref: forwardRef2
1892
1947
  }, properties.map((property) => {
1893
- return /* @__PURE__ */ React12.createElement(FormField, {
1948
+ return /* @__PURE__ */ React11.createElement(FormField, {
1894
1949
  key: property.name,
1895
1950
  property,
1896
1951
  path: [
@@ -1898,9 +1953,11 @@ var FormFields = /* @__PURE__ */ forwardRef(({ classNames, testId, schema, path,
1898
1953
  property.name
1899
1954
  ],
1900
1955
  readonly,
1956
+ projection,
1901
1957
  onQueryRefOptions,
1902
1958
  lookupComponent,
1903
- Custom
1959
+ Custom,
1960
+ ...props
1904
1961
  });
1905
1962
  }).filter(isNotFalsy));
1906
1963
  } finally {
@@ -1908,26 +1965,27 @@ var FormFields = /* @__PURE__ */ forwardRef(({ classNames, testId, schema, path,
1908
1965
  }
1909
1966
  });
1910
1967
 
1911
- // packages/ui/react-ui-form/src/components/Form/Form.tsx
1912
- var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, autoSave, outerSpacing = true, onCancel, schema, onValuesChanged, onValidate, onSave, ...props }) => {
1913
- var _effect = _useSignals13();
1968
+ // src/components/Form/Form.tsx
1969
+ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, autoSave, outerSpacing = true, schema, onCancel, onValuesChanged, onValidate, onSave, ...props }) => {
1970
+ var _effect = _useSignals12();
1914
1971
  try {
1915
1972
  const formRef = useRef3(null);
1916
- const handleValid = useMemo6(() => autoSave ? onSave : void 0, [
1917
- autoSave,
1918
- onSave
1919
- ]);
1973
+ const { findFirstFocusable } = useFocusFinders();
1920
1974
  useEffect7(() => {
1921
1975
  if (autoFocus && formRef.current) {
1922
- const input = formRef.current.querySelector("input");
1923
- if (input) {
1924
- input.focus();
1976
+ const firstFocusable = findFirstFocusable(formRef.current);
1977
+ if (firstFocusable) {
1978
+ firstFocusable.focus();
1925
1979
  }
1926
1980
  }
1927
1981
  }, [
1928
1982
  autoFocus
1929
1983
  ]);
1930
- return /* @__PURE__ */ React13.createElement(FormProvider, {
1984
+ const handleValid = useMemo6(() => autoSave ? onSave : void 0, [
1985
+ autoSave,
1986
+ onSave
1987
+ ]);
1988
+ return /* @__PURE__ */ React12.createElement(FormProvider, {
1931
1989
  formRef,
1932
1990
  schema,
1933
1991
  autoSave,
@@ -1936,11 +1994,11 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
1936
1994
  onValidate,
1937
1995
  onValid: handleValid,
1938
1996
  onSave
1939
- }, /* @__PURE__ */ React13.createElement("div", {
1997
+ }, /* @__PURE__ */ React12.createElement("div", {
1940
1998
  role: "none",
1941
1999
  className: "contents",
1942
2000
  "data-testid": testId
1943
- }, /* @__PURE__ */ React13.createElement(FormFields, {
2001
+ }, /* @__PURE__ */ React12.createElement(FormFields, {
1944
2002
  ...props,
1945
2003
  ref: formRef,
1946
2004
  classNames: [
@@ -1950,7 +2008,7 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
1950
2008
  ],
1951
2009
  readonly,
1952
2010
  schema
1953
- }), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React13.createElement(FormActions, {
2011
+ }), (onCancel || onSave) && !autoSave && !readonly && /* @__PURE__ */ React12.createElement(FormActions, {
1954
2012
  readonly,
1955
2013
  onCancel,
1956
2014
  outerSpacing
@@ -1960,44 +2018,39 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
1960
2018
  }
1961
2019
  };
1962
2020
 
1963
- // packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
1964
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
1965
- var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerSpacing }) => {
1966
- var _effect = _useSignals14();
2021
+ // src/components/FieldEditor/FieldEditor.tsx
2022
+ var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
2023
+ var FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel, outerSpacing }) => {
2024
+ var _effect = _useSignals13();
1967
2025
  try {
1968
2026
  const { t } = useTranslation8(translationKey);
1969
- const [props, setProps] = useState5(projection.getFieldProjection(field.id).props);
2027
+ const [props, setProps] = useState6(projection.getFieldProjection(field.id).props);
1970
2028
  useEffect8(() => setProps(projection.getFieldProjection(field.id).props), [
1971
2029
  field,
1972
2030
  projection
1973
2031
  ]);
1974
- const [schemas, setSchemas] = useState5([]);
1975
- useEffect8(() => {
2032
+ const [schemas, setSchemas] = useState6([]);
2033
+ useAsyncEffect(async () => {
1976
2034
  if (!registry) {
1977
2035
  return;
1978
2036
  }
1979
2037
  const subscription = registry.query().subscribe((query) => setSchemas(query.results), {
1980
2038
  fire: true
1981
2039
  });
1982
- const t2 = setTimeout(async () => {
1983
- const schemas2 = await registry.query().run();
1984
- setSchemas(schemas2);
1985
- });
1986
- return () => {
1987
- clearTimeout(t2);
1988
- subscription?.();
1989
- };
2040
+ const schemas2 = await registry.query().run();
2041
+ setSchemas(schemas2);
2042
+ return () => subscription?.();
1990
2043
  }, [
1991
2044
  registry
1992
2045
  ]);
1993
- const [referenceSchema, setReferenceSchema] = useState5();
2046
+ const [referenceSchema, setReferenceSchema] = useState6();
1994
2047
  useEffect8(() => {
1995
2048
  setReferenceSchema(schemas.find((schema) => schema.typename === props?.referenceSchema));
1996
2049
  }, [
1997
2050
  schemas,
1998
2051
  props?.referenceSchema
1999
2052
  ]);
2000
- const [{ fieldSchema }, setFieldSchema] = useState5({
2053
+ const [{ fieldSchema }, setFieldSchema] = useState6({
2001
2054
  fieldSchema: getFormatSchema(props?.format)
2002
2055
  });
2003
2056
  const handleValuesChanged = useCallback9((_props) => {
@@ -2036,7 +2089,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
2036
2089
  props.referenceSchema
2037
2090
  ]);
2038
2091
  const handleValidate = useCallback9(({ property }) => {
2039
- if (property && view.fields.find((f) => f.path === property && f.path !== field.path)) {
2092
+ if (property && projection.fields.find((f) => f.path === property && f.path !== field.path)) {
2040
2093
  return [
2041
2094
  {
2042
2095
  path: "property",
@@ -2045,7 +2098,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
2045
2098
  ];
2046
2099
  }
2047
2100
  }, [
2048
- view.fields,
2101
+ projection.fields,
2049
2102
  field
2050
2103
  ]);
2051
2104
  const handleSave = useCallback9((props2) => {
@@ -2066,26 +2119,26 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
2066
2119
  onSave
2067
2120
  ]);
2068
2121
  const custom = useMemo7(() => ({
2069
- ["format"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
2122
+ ["format"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
2070
2123
  ...props2,
2071
2124
  options: FormatEnums.filter((value) => value !== FormatEnum5.None).map((value) => ({
2072
2125
  value,
2073
2126
  label: t(`format ${value}`)
2074
2127
  }))
2075
2128
  }),
2076
- ["referenceSchema"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
2129
+ ["referenceSchema"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
2077
2130
  ...props2,
2078
2131
  options: schemas.map((schema) => ({
2079
2132
  value: schema.typename
2080
2133
  }))
2081
2134
  }),
2082
- ["referencePath"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
2135
+ ["referencePath"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
2083
2136
  ...props2,
2084
2137
  options: referenceSchema ? getSchemaProperties3(referenceSchema.ast).sort(sortProperties).map((p) => ({
2085
2138
  value: p.name
2086
2139
  })) : []
2087
2140
  }),
2088
- ["options"]: (props2) => /* @__PURE__ */ React14.createElement(SelectOptionInput, props2)
2141
+ ["options"]: (props2) => /* @__PURE__ */ React13.createElement(SelectOptionInput, props2)
2089
2142
  }), [
2090
2143
  t,
2091
2144
  schemas,
@@ -2097,15 +2150,16 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
2097
2150
  props
2098
2151
  }, {
2099
2152
  F: __dxlog_file4,
2100
- L: 183,
2153
+ L: 177,
2101
2154
  S: void 0,
2102
2155
  C: (f, a) => f(...a)
2103
2156
  });
2104
2157
  return null;
2105
2158
  }
2106
- return /* @__PURE__ */ React14.createElement(Form, {
2159
+ return /* @__PURE__ */ React13.createElement(Form, {
2107
2160
  key: field.id,
2108
2161
  autoFocus: true,
2162
+ readonly,
2109
2163
  values: props,
2110
2164
  schema: fieldSchema,
2111
2165
  filter: propIsNotType,
@@ -2125,79 +2179,85 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
2125
2179
  }
2126
2180
  };
2127
2181
 
2128
- // packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx
2129
- import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
2130
- import { Schema as Schema2 } from "effect";
2131
- import React15, { useCallback as useCallback10, useMemo as useMemo8, useState as useState6 } from "react";
2182
+ // src/components/ViewEditor/ViewEditor.tsx
2183
+ import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
2184
+ import { Match, Schema as Schema2 } from "effect";
2185
+ import React14, { useCallback as useCallback10, useMemo as useMemo8, useState as useState7 } from "react";
2132
2186
  import { EchoSchema, Format, isMutable, toJsonSchema } from "@dxos/echo-schema";
2133
2187
  import { invariant as invariant3 } from "@dxos/invariant";
2188
+ import { getSpace } from "@dxos/react-client/echo";
2134
2189
  import { Callout, IconButton as IconButton4, useTranslation as useTranslation9 } from "@dxos/react-ui";
2190
+ import { QueryEditor, QuerySerializer, createExpression } from "@dxos/react-ui-components";
2135
2191
  import { List as List2 } from "@dxos/react-ui-list";
2136
2192
  import { cardSpacing as cardSpacing3 } from "@dxos/react-ui-stack";
2137
- import { ghostHover, inputTextLabel, mx as mx9 } from "@dxos/react-ui-theme";
2138
- import { FieldSchema, ViewProjection, VIEW_FIELD_LIMIT } from "@dxos/schema";
2139
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
2140
- var grid = "grid grid-cols-[32px_1fr_32px_32px] min-bs-[2.5rem]";
2141
- var ViewMetaSchema = Schema2.Struct({
2142
- name: Schema2.String.annotations({
2143
- title: "View"
2144
- }),
2145
- typename: Format.URL.annotations({
2146
- title: "Typename"
2147
- })
2148
- }).pipe(Schema2.mutable);
2149
- var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, showHeading = false, onTypenameChanged, onDelete, outerSpacing = true }) => {
2150
- var _effect = _useSignals15();
2193
+ import { inputTextLabel, mx as mx7, subtleHover as subtleHover2 } from "@dxos/react-ui-theme";
2194
+ import { FieldSchema, ProjectionModel, VIEW_FIELD_LIMIT, typenameFromQuery } from "@dxos/schema";
2195
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
2196
+ var listGrid = "grid grid-cols-[min-content_1fr_min-content_min-content_min-content]";
2197
+ var listItemGrid = "grid grid-cols-subgrid col-span-5";
2198
+ var ViewEditor = ({ classNames, schema, view, kind = "basic", registry, readonly, showHeading = false, onQueryChanged, onDelete, outerSpacing = true }) => {
2199
+ var _effect = _useSignals14();
2151
2200
  try {
2201
+ const space = getSpace(view);
2202
+ const schemaReadonly = !isMutable(schema);
2152
2203
  const { t } = useTranslation9(translationKey);
2153
- const projection = useMemo8(() => {
2204
+ const projectionModel = useMemo8(() => {
2154
2205
  const jsonSchema = schema instanceof EchoSchema ? schema.jsonSchema : toJsonSchema(schema);
2155
- return new ViewProjection(jsonSchema, view);
2206
+ return new ProjectionModel(jsonSchema, view.projection);
2156
2207
  }, [
2157
2208
  schema,
2158
- view
2209
+ view.projection
2159
2210
  ]);
2160
- const [field, setField] = useState6();
2161
- const readonly = _readonly || !isMutable(schema);
2162
- const viewValues = useMemo8(() => {
2163
- return {
2164
- name: view.name,
2165
- // TODO(burdon): Need to warn user of possible consequences of editing.
2166
- // TODO(burdon): Settings should have domain name owned by user.
2167
- typename: view.query.typename
2168
- };
2211
+ const [expandedField, setExpandedField] = useState7();
2212
+ const serializedQuery = Match.value(kind).pipe(Match.when("basic", () => typenameFromQuery(view.query)), Match.when("advanced", () => {
2213
+ if (view.query.type !== "select") {
2214
+ return "";
2215
+ }
2216
+ const serializer = new QuerySerializer();
2217
+ return serializer.serialize(createExpression(view.query.filter));
2218
+ }), Match.exhaustive);
2219
+ const viewSchema = useMemo8(() => {
2220
+ return Schema2.Struct({
2221
+ query: kind === "basic" ? Format.URL.annotations({
2222
+ title: "Record type"
2223
+ }) : Schema2.String.annotations({
2224
+ title: "Query"
2225
+ })
2226
+ }).pipe(Schema2.mutable);
2169
2227
  }, [
2170
- view
2228
+ kind
2171
2229
  ]);
2172
- const handleSelect = useCallback10((field2) => {
2173
- if (readonly) {
2174
- return;
2175
- }
2176
- setField((f) => f === field2 ? void 0 : field2);
2230
+ const viewValues = useMemo8(() => ({
2231
+ query: serializedQuery
2232
+ }), [
2233
+ serializedQuery
2234
+ ]);
2235
+ const handleToggleField = useCallback10((field) => {
2236
+ setExpandedField((prevExpandedFieldId) => prevExpandedFieldId === field.id ? void 0 : field.id);
2177
2237
  }, [
2178
2238
  readonly
2179
2239
  ]);
2180
2240
  const handleAdd = useCallback10(() => {
2181
2241
  invariant3(!readonly, void 0, {
2182
2242
  F: __dxlog_file5,
2183
- L: 92,
2243
+ L: 106,
2184
2244
  S: void 0,
2185
2245
  A: [
2186
2246
  "!readonly",
2187
2247
  ""
2188
2248
  ]
2189
2249
  });
2190
- const field2 = projection.createFieldProjection();
2191
- setField(field2);
2250
+ const field = projectionModel.createFieldProjection();
2251
+ setExpandedField(field.id);
2192
2252
  }, [
2193
2253
  schema,
2194
- view,
2254
+ projectionModel,
2195
2255
  readonly
2196
2256
  ]);
2197
- const handleUpdate = useCallback10(({ name, typename }) => {
2257
+ const handleUpdate = useCallback10(({ query }) => {
2198
2258
  invariant3(!readonly, void 0, {
2199
2259
  F: __dxlog_file5,
2200
- L: 99,
2260
+ L: 113,
2201
2261
  S: void 0,
2202
2262
  A: [
2203
2263
  "!readonly",
@@ -2205,43 +2265,38 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2205
2265
  ]
2206
2266
  });
2207
2267
  requestAnimationFrame(() => {
2208
- if (view.name !== name) {
2209
- view.name = name;
2210
- }
2211
- if (view.query.typename !== typename && !readonly) {
2212
- onTypenameChanged?.(typename);
2268
+ if (serializedQuery !== query && !readonly) {
2269
+ onQueryChanged?.(query);
2213
2270
  }
2214
2271
  });
2215
2272
  }, [
2216
- schema,
2217
- view,
2218
- onTypenameChanged,
2273
+ serializedQuery,
2274
+ onQueryChanged,
2219
2275
  readonly
2220
2276
  ]);
2221
2277
  const handleDelete = useCallback10((fieldId) => {
2222
2278
  invariant3(!readonly, void 0, {
2223
2279
  F: __dxlog_file5,
2224
- L: 115,
2280
+ L: 125,
2225
2281
  S: void 0,
2226
2282
  A: [
2227
2283
  "!readonly",
2228
2284
  ""
2229
2285
  ]
2230
2286
  });
2231
- if (fieldId === field?.id) {
2232
- setField(void 0);
2287
+ if (fieldId === expandedField) {
2288
+ setExpandedField(void 0);
2233
2289
  }
2234
2290
  onDelete?.(fieldId);
2235
2291
  }, [
2236
- schema,
2237
- field,
2292
+ expandedField,
2238
2293
  onDelete,
2239
2294
  readonly
2240
2295
  ]);
2241
2296
  const handleMove = useCallback10((fromIndex, toIndex) => {
2242
2297
  invariant3(!readonly, void 0, {
2243
2298
  F: __dxlog_file5,
2244
- L: 127,
2299
+ L: 137,
2245
2300
  S: void 0,
2246
2301
  A: [
2247
2302
  "!readonly",
@@ -2249,115 +2304,129 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2249
2304
  ]
2250
2305
  });
2251
2306
  const fields = [
2252
- ...view.fields
2307
+ ...view.projection.fields
2253
2308
  ];
2254
2309
  const [moved] = fields.splice(fromIndex, 1);
2255
2310
  fields.splice(toIndex, 0, moved);
2256
- view.fields = fields;
2311
+ view.projection.fields = fields;
2257
2312
  }, [
2258
- schema,
2259
- view.fields,
2313
+ view.projection.fields,
2260
2314
  readonly
2261
2315
  ]);
2262
- const handleClose = useCallback10(() => setField(void 0), []);
2263
- const hiddenProperties = projection.getHiddenProperties();
2316
+ const handleClose = useCallback10(() => setExpandedField(void 0), []);
2264
2317
  const handleHide = useCallback10((fieldId) => {
2265
- setField(void 0);
2266
- projection.hideFieldProjection(fieldId);
2318
+ setExpandedField(void 0);
2319
+ projectionModel.hideFieldProjection(fieldId);
2267
2320
  }, [
2268
- projection
2321
+ projectionModel
2269
2322
  ]);
2270
2323
  const handleShow = useCallback10((property) => {
2271
- setField(void 0);
2272
- projection.showFieldProjection(property);
2324
+ setExpandedField(void 0);
2325
+ projectionModel.showFieldProjection(property);
2273
2326
  }, [
2274
- projection
2327
+ projectionModel
2275
2328
  ]);
2276
- return /* @__PURE__ */ React15.createElement("div", {
2277
- role: "none",
2278
- className: mx9(classNames)
2279
- }, readonly && /* @__PURE__ */ React15.createElement("div", {
2329
+ const custom = useMemo8(() => kind === "advanced" ? {
2330
+ ["query"]: (props) => {
2331
+ const handleChange = useCallback10((text) => props.onValueChange("string", text), [
2332
+ props.onValueChange
2333
+ ]);
2334
+ return /* @__PURE__ */ React14.createElement(QueryEditor, {
2335
+ space,
2336
+ initialValue: props.getValue(),
2337
+ onChange: handleChange
2338
+ });
2339
+ }
2340
+ } : {}, []);
2341
+ return /* @__PURE__ */ React14.createElement("div", {
2280
2342
  role: "none",
2281
- className: mx9("is-full", outerSpacing && "plb-cardSpacingBlock pli-cardSpacingInline")
2282
- }, /* @__PURE__ */ React15.createElement(Callout.Root, {
2283
- valence: "info"
2284
- }, /* @__PURE__ */ React15.createElement(Callout.Title, null, t("system schema description")))), /* @__PURE__ */ React15.createElement(Form, {
2343
+ className: mx7(classNames)
2344
+ }, schemaReadonly && /* @__PURE__ */ React14.createElement(Callout.Root, {
2345
+ valence: "info",
2346
+ classNames: [
2347
+ "mlb-cardSpacingBlock",
2348
+ outerSpacing && "mli-cardSpacingInline"
2349
+ ]
2350
+ }, /* @__PURE__ */ React14.createElement(Callout.Title, null, t("system schema description"))), /* @__PURE__ */ React14.createElement(Form, {
2285
2351
  autoSave: true,
2286
- schema: ViewMetaSchema,
2352
+ schema: viewSchema,
2287
2353
  values: viewValues,
2288
- readonly,
2354
+ readonly: readonly ? "disabled-input" : false,
2289
2355
  onSave: handleUpdate,
2290
- outerSpacing
2291
- }), /* @__PURE__ */ React15.createElement("div", {
2356
+ outerSpacing,
2357
+ Custom: custom
2358
+ }), /* @__PURE__ */ React14.createElement("div", {
2292
2359
  role: "none",
2293
2360
  className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
2294
- }, /* @__PURE__ */ React15.createElement("label", {
2295
- className: mx9(inputTextLabel)
2296
- }, t("fields label")), /* @__PURE__ */ React15.createElement(List2.Root, {
2297
- items: view.fields,
2361
+ }, /* @__PURE__ */ React14.createElement("h2", {
2362
+ className: mx7(inputTextLabel)
2363
+ }, t("fields label")), /* @__PURE__ */ React14.createElement(List2.Root, {
2364
+ items: view.projection.fields,
2298
2365
  isItem: Schema2.is(FieldSchema),
2299
- getId: (field2) => field2.id,
2300
- readonly,
2301
- onMove: readonly ? void 0 : handleMove
2302
- }, ({ items: fields }) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, showHeading && /* @__PURE__ */ React15.createElement("div", {
2303
- role: "heading",
2304
- className: grid
2305
- }, /* @__PURE__ */ React15.createElement("div", null), /* @__PURE__ */ React15.createElement("div", {
2306
- className: "flex items-center text-sm"
2307
- }, t("field path label"))), /* @__PURE__ */ React15.createElement("div", {
2308
- role: "list",
2309
- className: "flex flex-col is-full"
2310
- }, fields?.map((field2) => /* @__PURE__ */ React15.createElement(List2.Item, {
2311
- key: field2.id,
2312
- item: field2,
2313
- classNames: mx9(grid, ghostHover, "overflow-hidden", !readonly && "cursor-pointer")
2314
- }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React15.createElement(List2.ItemTitle, {
2315
- onClick: () => handleSelect(field2)
2316
- }, field2.path), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
2317
- "data-testid": "hide-field-button",
2318
- icon: "ph--eye-slash--regular",
2319
- // TDOO(burdon): Is this the correct test?
2320
- disabled: view.fields.length <= 1,
2321
- onClick: () => handleHide(field2.id)
2322
- }), !readonly && /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
2323
- disabled: view.fields.length <= 1,
2324
- onClick: () => handleDelete(field2.id)
2325
- })))))), hiddenProperties.length > 0 && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement("label", {
2326
- className: mx9(inputTextLabel)
2327
- }, t("hidden fields label")), /* @__PURE__ */ React15.createElement(List2.Root, {
2328
- items: hiddenProperties,
2329
- isItem: (item) => typeof item === "string",
2330
- getId: (property) => property
2331
- }, ({ items: properties }) => /* @__PURE__ */ React15.createElement("div", {
2366
+ getId: (field) => field.id,
2367
+ onMove: readonly ? void 0 : handleMove,
2368
+ readonly
2369
+ }, ({ items: fields }) => /* @__PURE__ */ React14.createElement(React14.Fragment, null, showHeading && /* @__PURE__ */ React14.createElement("h3", {
2370
+ className: "text-sm"
2371
+ }, t("field path label")), /* @__PURE__ */ React14.createElement("div", {
2332
2372
  role: "list",
2333
- className: "flex flex-col is-full"
2334
- }, properties?.map((property) => /* @__PURE__ */ React15.createElement(List2.Item, {
2335
- key: property,
2336
- item: property,
2337
- classNames: mx9(grid, ghostHover, !readonly && "cursor-pointer")
2338
- }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, {
2339
- disabled: true
2340
- }), /* @__PURE__ */ React15.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
2341
- icon: "ph--eye--regular",
2342
- onClick: () => handleShow(property),
2343
- "data-testid": "show-field-button"
2344
- }))))))), field && /* @__PURE__ */ React15.createElement(FieldEditor, {
2345
- key: field.id,
2346
- view,
2347
- projection,
2348
- field,
2349
- registry,
2350
- onSave: handleClose
2351
- }), !readonly && !field && /* @__PURE__ */ React15.createElement("div", {
2373
+ className: listGrid
2374
+ }, fields?.map((field) => {
2375
+ const hidden = field.visible === false;
2376
+ return /* @__PURE__ */ React14.createElement(List2.Item, {
2377
+ key: field.id,
2378
+ item: field,
2379
+ classNames: listItemGrid,
2380
+ "aria-expanded": expandedField === field.id
2381
+ }, /* @__PURE__ */ React14.createElement("div", {
2382
+ role: "none",
2383
+ className: mx7(subtleHover2, listItemGrid, "rounded-sm cursor-pointer min-bs-10")
2384
+ }, /* @__PURE__ */ React14.createElement(List2.ItemDragHandle, {
2385
+ disabled: readonly
2386
+ }), /* @__PURE__ */ React14.createElement(List2.ItemTitle, {
2387
+ classNames: hidden && "text-subdued",
2388
+ onClick: () => handleToggleField(field)
2389
+ }, field.path), /* @__PURE__ */ React14.createElement(List2.ItemButton, {
2390
+ label: t(hidden ? "show field label" : "hide field label"),
2391
+ "data-testid": hidden ? "show-field-button" : "hide-field-button",
2392
+ icon: hidden ? "ph--eye-closed--regular" : "ph--eye--regular",
2393
+ autoHide: false,
2394
+ disabled: readonly || !hidden && projectionModel.fields.length <= 1,
2395
+ onClick: () => hidden ? handleShow(field.path) : handleHide(field.id)
2396
+ }), /* @__PURE__ */ React14.createElement(List2.ItemDeleteButton, {
2397
+ label: t("delete field label"),
2398
+ autoHide: false,
2399
+ disabled: readonly || schemaReadonly || view.projection.fields.length <= 1,
2400
+ onClick: () => handleDelete(field.id),
2401
+ "data-testid": "field.delete"
2402
+ }), /* @__PURE__ */ React14.createElement(IconButton4, {
2403
+ iconOnly: true,
2404
+ variant: "ghost",
2405
+ label: t("toggle expand label", {
2406
+ ns: "os"
2407
+ }),
2408
+ icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
2409
+ onClick: () => handleToggleField(field)
2410
+ })), expandedField === field.id && /* @__PURE__ */ React14.createElement("div", {
2411
+ role: "none",
2412
+ className: "col-span-5 mbs-1 mbe-1 border border-separator rounded-md"
2413
+ }, /* @__PURE__ */ React14.createElement(FieldEditor, {
2414
+ readonly: readonly || schemaReadonly ? "disabled-input" : false,
2415
+ projection: projectionModel,
2416
+ field,
2417
+ registry,
2418
+ onSave: handleClose
2419
+ })));
2420
+ }))))), !readonly && !expandedField && /* @__PURE__ */ React14.createElement("div", {
2352
2421
  role: "none",
2353
2422
  className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
2354
- }, /* @__PURE__ */ React15.createElement(IconButton4, {
2423
+ }, /* @__PURE__ */ React14.createElement(IconButton4, {
2355
2424
  icon: "ph--plus--regular",
2356
2425
  label: t("button add property"),
2357
2426
  onClick: readonly ? void 0 : handleAdd,
2358
2427
  // TODO(burdon): Show field limit in ux (not tooltip).
2359
- disabled: view.fields.length >= VIEW_FIELD_LIMIT,
2360
- classNames: "flex is-full"
2428
+ disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,
2429
+ classNames: "is-full"
2361
2430
  })));
2362
2431
  } finally {
2363
2432
  _effect.f();
@@ -2374,8 +2443,6 @@ export {
2374
2443
  ControlPage,
2375
2444
  ControlSection,
2376
2445
  ControlSectionHeading,
2377
- DeprecatedFormContainer,
2378
- DeprecatedFormInput,
2379
2446
  FieldEditor,
2380
2447
  Form,
2381
2448
  FormProvider,
@@ -2396,7 +2463,7 @@ export {
2396
2463
  getRefProps,
2397
2464
  parseValue,
2398
2465
  pathNotUniqueError,
2399
- translations_default as translations,
2466
+ translations,
2400
2467
  useForm,
2401
2468
  useFormContext,
2402
2469
  useFormValues,