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

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