@dxos/react-ui-form 0.8.1-staging.5be625a → 0.8.1-staging.9eaf14f

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 (32) hide show
  1. package/dist/lib/browser/index.mjs +228 -159
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +311 -237
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +228 -159
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/ControlSection.d.ts +20 -0
  11. package/dist/types/src/components/ControlSection.d.ts.map +1 -0
  12. package/dist/types/src/components/Form/Form.stories.d.ts +2 -2
  13. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Input.d.ts +1 -1
  15. package/dist/types/src/components/Form/Input.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
  17. package/dist/types/src/components/index.d.ts +1 -0
  18. package/dist/types/src/components/index.d.ts.map +1 -1
  19. package/dist/types/src/util/field.d.ts +0 -1
  20. package/dist/types/src/util/field.d.ts.map +1 -1
  21. package/dist/types/src/util/formatting.d.ts.map +1 -1
  22. package/package.json +24 -24
  23. package/src/components/ControlSection.tsx +113 -0
  24. package/src/components/FieldEditor/FieldEditor.stories.tsx +1 -1
  25. package/src/components/Form/Form.stories.tsx +2 -2
  26. package/src/components/Form/Input.tsx +1 -1
  27. package/src/components/Form/custom/SelectOptionsInput.tsx +5 -1
  28. package/src/components/ViewEditor/ViewEditor.stories.tsx +1 -1
  29. package/src/components/ViewEditor/ViewEditor.tsx +1 -1
  30. package/src/components/index.ts +1 -1
  31. package/src/util/field.ts +3 -4
  32. package/src/util/formatting.ts +9 -10
@@ -101,41 +101,105 @@ var DeprecatedFormInput = ({ label, description, secondary, children }) => {
101
101
  return primary;
102
102
  };
103
103
 
104
+ // packages/ui/react-ui-form/src/components/ControlSection.tsx
105
+ import React2 from "react";
106
+ import { toLocalizedString, useTranslation, Input as Input2 } from "@dxos/react-ui";
107
+ var ControlSectionHeading = ({ title, description }) => {
108
+ const { t } = useTranslation(translationKey);
109
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", {
110
+ className: "pli-4 container-max-width text-xl mbs-6 mbe-4"
111
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement("p", {
112
+ className: "pli-4 mlb-4 container-max-width text-description"
113
+ }, toLocalizedString(description, t)));
114
+ };
115
+ var ControlSection = ({ title, description, children }) => {
116
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ControlSectionHeading, {
117
+ title,
118
+ description
119
+ }), children);
120
+ };
121
+ var ControlGroup = ({ children }) => /* @__PURE__ */ React2.createElement("div", {
122
+ role: "none",
123
+ className: "group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-4"
124
+ }, children);
125
+ var ControlFrame = ({ children }) => /* @__PURE__ */ React2.createElement("div", {
126
+ role: "none",
127
+ className: "p-4 border border-separator rounded-lg container-max-width grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-2 md:gap-8"
128
+ }, children);
129
+ var controlItemClasses = "p-4 border border-separator rounded-lg container-max-width grid md:col-span-2 grid-cols-subgrid items-center";
130
+ var controlItemTitleClasses = "text-lg font-normal mbe-2";
131
+ var controlItemDescriptionClasses = "text-base mlb-2 md:mbe-0 text-description";
132
+ var ControlItem = ({ title, description, children }) => {
133
+ const { t } = useTranslation(translationKey);
134
+ return /* @__PURE__ */ React2.createElement("div", {
135
+ className: controlItemClasses
136
+ }, /* @__PURE__ */ React2.createElement("div", {
137
+ role: "none"
138
+ }, /* @__PURE__ */ React2.createElement("h3", {
139
+ className: controlItemTitleClasses
140
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement("p", {
141
+ className: controlItemDescriptionClasses
142
+ }, toLocalizedString(description, t))), children);
143
+ };
144
+ var ControlItemInput = ({ title, description, children }) => {
145
+ const { t } = useTranslation(translationKey);
146
+ return /* @__PURE__ */ React2.createElement(Input2.Root, null, /* @__PURE__ */ React2.createElement("div", {
147
+ className: controlItemClasses
148
+ }, /* @__PURE__ */ React2.createElement("div", {
149
+ role: "none"
150
+ }, /* @__PURE__ */ React2.createElement(Input2.Label, {
151
+ classNames: controlItemTitleClasses
152
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement(Input2.DescriptionAndValidation, null, /* @__PURE__ */ React2.createElement(Input2.Description, {
153
+ classNames: controlItemDescriptionClasses
154
+ }, toLocalizedString(description, t)))), children));
155
+ };
156
+ var ControlFrameItem = ({ title, description, children }) => {
157
+ const { t } = useTranslation(translationKey);
158
+ return /* @__PURE__ */ React2.createElement("div", {
159
+ role: "group",
160
+ className: "min-is-0"
161
+ }, /* @__PURE__ */ React2.createElement("h3", {
162
+ className: "text-lg mbe-2"
163
+ }, toLocalizedString(title, t)), description && /* @__PURE__ */ React2.createElement("p", {
164
+ className: "mlb-2 md:mbe-0 text-description"
165
+ }, toLocalizedString(description, t)), children);
166
+ };
167
+
104
168
  // packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
105
- import React12, { useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo7, useState as useState4 } from "react";
169
+ import React13, { useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo7, useState as useState4 } from "react";
106
170
  import { FormatEnum as FormatEnum2, FormatEnums, formatToType } from "@dxos/echo-schema";
107
171
  import { log as log2 } from "@dxos/log";
108
- import { useTranslation as useTranslation5 } from "@dxos/react-ui";
172
+ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
109
173
  import { getFormatSchema, getSchemaProperties as getSchemaProperties3, sortProperties } from "@dxos/schema";
110
174
 
111
175
  // packages/ui/react-ui-form/src/components/Form/custom/GeoPointInput.tsx
112
- import React3, { useCallback, useState, useEffect, useMemo } from "react";
176
+ import React4, { useCallback, useState, useEffect, useMemo } from "react";
113
177
  import { GeoLocation } from "@dxos/echo-schema";
114
- import { Input as Input2, useTranslation } from "@dxos/react-ui";
178
+ import { Input as Input3, useTranslation as useTranslation2 } from "@dxos/react-ui";
115
179
  import { safeParseFloat } from "@dxos/util";
116
180
 
117
181
  // packages/ui/react-ui-form/src/components/Form/Input.tsx
118
- import React2 from "react";
182
+ import React3 from "react";
119
183
  import { Icon, Tooltip } from "@dxos/react-ui";
120
184
  import { errorText } from "@dxos/react-ui-theme";
121
185
  var InputHeader = ({ children, error }) => {
122
- return /* @__PURE__ */ React2.createElement("div", {
186
+ return /* @__PURE__ */ React3.createElement("div", {
123
187
  role: "none",
124
188
  className: "flex justify-between items-center mb-1"
125
- }, children, error && /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
189
+ }, children, error && /* @__PURE__ */ React3.createElement(Tooltip.Root, null, /* @__PURE__ */ React3.createElement(Tooltip.Trigger, {
126
190
  asChild: true
127
- }, /* @__PURE__ */ React2.createElement(Icon, {
191
+ }, /* @__PURE__ */ React3.createElement(Icon, {
128
192
  icon: "ph--warning--regular",
129
193
  size: 4,
130
194
  classNames: errorText
131
- })), /* @__PURE__ */ React2.createElement(Tooltip.Content, {
195
+ })), /* @__PURE__ */ React3.createElement(Tooltip.Content, {
132
196
  side: "bottom"
133
- }, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), error)));
197
+ }, /* @__PURE__ */ React3.createElement(Tooltip.Arrow, null), error)));
134
198
  };
135
199
 
136
200
  // packages/ui/react-ui-form/src/components/Form/custom/GeoPointInput.tsx
137
201
  var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
138
- const { t } = useTranslation(translationKey);
202
+ const { t } = useTranslation2(translationKey);
139
203
  const { status, error } = getStatus();
140
204
  const geoPoint = useMemo(() => getValue3() ?? [
141
205
  0,
@@ -178,14 +242,14 @@ var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, on
178
242
  onValueChange,
179
243
  type
180
244
  ]);
181
- return /* @__PURE__ */ React3.createElement(Input2.Root, {
245
+ return /* @__PURE__ */ React4.createElement(Input3.Root, {
182
246
  validationValence: status
183
- }, /* @__PURE__ */ React3.createElement(InputHeader, {
247
+ }, /* @__PURE__ */ React4.createElement(InputHeader, {
184
248
  error
185
- }, /* @__PURE__ */ React3.createElement(Input2.Label, null, label)), /* @__PURE__ */ React3.createElement("div", {
249
+ }, /* @__PURE__ */ React4.createElement(Input3.Label, null, label)), /* @__PURE__ */ React4.createElement("div", {
186
250
  role: "none",
187
251
  className: "grid grid-cols-2 gap-2"
188
- }, /* @__PURE__ */ React3.createElement(Input2.TextInput, {
252
+ }, /* @__PURE__ */ React4.createElement(Input3.TextInput, {
189
253
  type: "text",
190
254
  pattern: "^-?[0-9]*\\.?[0-9]*$",
191
255
  disabled,
@@ -193,7 +257,7 @@ var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, on
193
257
  value: latitudeText,
194
258
  onChange: handleCoordinateChange("latitude", setLatitudeText),
195
259
  onBlur
196
- }), /* @__PURE__ */ React3.createElement(Input2.TextInput, {
260
+ }), /* @__PURE__ */ React4.createElement(Input3.TextInput, {
197
261
  type: "text",
198
262
  pattern: "^-?[0-9]*\\.?[0-9]*$",
199
263
  disabled,
@@ -205,9 +269,9 @@ var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, on
205
269
  };
206
270
 
207
271
  // packages/ui/react-ui-form/src/components/Form/custom/SelectOptionsInput.tsx
208
- import React4, { useCallback as useCallback2, useEffect as useEffect2, useState as useState2, useRef } from "react";
272
+ import React5, { useCallback as useCallback2, useEffect as useEffect2, useState as useState2, useRef } from "react";
209
273
  import { PublicKey } from "@dxos/keys";
210
- import { Icon as Icon2, IconButton, Input as Input3, Tag, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
274
+ import { Icon as Icon2, IconButton, Input as Input4, Tag, Toolbar, useTranslation as useTranslation3 } from "@dxos/react-ui";
211
275
  import { List } from "@dxos/react-ui-list";
212
276
  import { HuePicker } from "@dxos/react-ui-pickers";
213
277
  import { hues, mx as mx2 } from "@dxos/react-ui-theme";
@@ -215,7 +279,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
215
279
  const [selected, setSelectedId] = useState2(null);
216
280
  const [isNewOption, setIsNewOption] = useState2(false);
217
281
  const inputRef = useRef(null);
218
- const { t } = useTranslation2(translationKey);
282
+ const { t } = useTranslation3(translationKey);
219
283
  const { status, error } = getStatus();
220
284
  const options = getValue3();
221
285
  useEffect2(() => {
@@ -318,43 +382,43 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
318
382
  selected,
319
383
  isNewOption
320
384
  ]);
321
- return /* @__PURE__ */ React4.createElement(Input3.Root, {
385
+ return /* @__PURE__ */ React5.createElement(Input4.Root, {
322
386
  validationValence: status
323
- }, /* @__PURE__ */ React4.createElement(InputHeader, {
387
+ }, /* @__PURE__ */ React5.createElement(InputHeader, {
324
388
  error
325
- }, /* @__PURE__ */ React4.createElement(Input3.Label, null, label)), /* @__PURE__ */ React4.createElement("div", {
389
+ }, /* @__PURE__ */ React5.createElement(Input4.Label, null, label)), /* @__PURE__ */ React5.createElement("div", {
326
390
  role: "none"
327
- }, options && /* @__PURE__ */ React4.createElement(List.Root, {
391
+ }, options && /* @__PURE__ */ React5.createElement(List.Root, {
328
392
  items: options,
329
393
  isItem: (item) => true,
330
394
  onMove: handleMove
331
- }, ({ items }) => /* @__PURE__ */ React4.createElement("div", {
395
+ }, ({ items }) => /* @__PURE__ */ React5.createElement("div", {
332
396
  role: "list",
333
397
  className: "w-full overflow-auto"
334
- }, items?.map((item) => /* @__PURE__ */ React4.createElement("div", {
398
+ }, items?.map((item) => /* @__PURE__ */ React5.createElement("div", {
335
399
  key: item.id
336
- }, /* @__PURE__ */ React4.createElement(List.Item, {
400
+ }, /* @__PURE__ */ React5.createElement(List.Item, {
337
401
  role: "button",
338
402
  item,
339
403
  classNames: mx2("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
340
404
  "aria-expanded": selected === item.id
341
- }, /* @__PURE__ */ React4.createElement("div", {
405
+ }, /* @__PURE__ */ React5.createElement("div", {
342
406
  className: "flex items-center"
343
- }, /* @__PURE__ */ React4.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React4.createElement(List.ItemTitle, {
407
+ }, /* @__PURE__ */ React5.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React5.createElement(List.ItemTitle, {
344
408
  onClick: () => handleClick(item.id),
345
409
  classNames: "flex-1"
346
- }, /* @__PURE__ */ React4.createElement(Tag, {
410
+ }, /* @__PURE__ */ React5.createElement(Tag, {
347
411
  palette: item.color
348
- }, item.title || "\u200B")), /* @__PURE__ */ React4.createElement(Icon2, {
412
+ }, item.title || "\u200B")), /* @__PURE__ */ React5.createElement(Icon2, {
349
413
  icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
350
414
  onClick: () => handleClick(item.id)
351
- })), selected === item.id && /* @__PURE__ */ React4.createElement("div", {
415
+ })), selected === item.id && /* @__PURE__ */ React5.createElement("div", {
352
416
  className: "mis-4 mbs-2 flex flex-col gap-1"
353
- }, /* @__PURE__ */ React4.createElement(Input3.Label, {
417
+ }, /* @__PURE__ */ React5.createElement(Input4.Label, {
354
418
  classNames: "text-xs"
355
- }, t("select option label")), /* @__PURE__ */ React4.createElement("div", {
419
+ }, t("select option label")), /* @__PURE__ */ React5.createElement("div", {
356
420
  className: "flex flex-row items-center gap-1"
357
- }, /* @__PURE__ */ React4.createElement(Input3.TextInput, {
421
+ }, /* @__PURE__ */ React5.createElement(Input4.TextInput, {
358
422
  placeholder: t("select option label placeholder"),
359
423
  ref: selected === item.id ? inputRef : void 0,
360
424
  value: item.title,
@@ -362,34 +426,35 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
362
426
  onKeyDown: handleKeyDown,
363
427
  classNames: "flex-1",
364
428
  "data-no-submit": true
365
- }), /* @__PURE__ */ React4.createElement(Toolbar.Root, {
429
+ }), /* @__PURE__ */ React5.createElement(Toolbar.Root, {
366
430
  classNames: "p-0 m-0 !is-auto"
367
- }, /* @__PURE__ */ React4.createElement(HuePicker, {
431
+ }, /* @__PURE__ */ React5.createElement(HuePicker, {
368
432
  value: item.color,
369
- onChange: handleColorChange(item.id)
370
- })), /* @__PURE__ */ React4.createElement(IconButton, {
433
+ onChange: handleColorChange(item.id),
434
+ rootVariant: "toolbar-button"
435
+ })), /* @__PURE__ */ React5.createElement(IconButton, {
371
436
  icon: "ph--trash--fill",
372
437
  iconOnly: true,
373
438
  label: t("select option delete"),
374
439
  onClick: () => handleDelete(item.id)
375
- })))))), /* @__PURE__ */ React4.createElement("div", {
440
+ })))))), /* @__PURE__ */ React5.createElement("div", {
376
441
  role: "listitem"
377
- }, /* @__PURE__ */ React4.createElement("div", {
442
+ }, /* @__PURE__ */ React5.createElement("div", {
378
443
  role: "button",
379
444
  className: mx2("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
380
445
  onClick: handleAdd
381
- }, /* @__PURE__ */ React4.createElement("div", {
446
+ }, /* @__PURE__ */ React5.createElement("div", {
382
447
  className: "flex items-center gap-1"
383
- }, /* @__PURE__ */ React4.createElement(Icon2, {
448
+ }, /* @__PURE__ */ React5.createElement(Icon2, {
384
449
  icon: "ph--plus--regular"
385
- }), /* @__PURE__ */ React4.createElement("span", {
450
+ }), /* @__PURE__ */ React5.createElement("span", {
386
451
  className: "text-sm"
387
452
  }, t("select option add")))))))));
388
453
  };
389
454
 
390
455
  // packages/ui/react-ui-form/src/components/Form/custom/TupleInput.tsx
391
- import React5 from "react";
392
- import { Input as Input4 } from "@dxos/react-ui";
456
+ import React6 from "react";
457
+ import { Input as Input5 } from "@dxos/react-ui";
393
458
  import { mx as mx3 } from "@dxos/react-ui-theme";
394
459
  import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
395
460
  var gridCols = [
@@ -401,13 +466,13 @@ var gridCols = [
401
466
  var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
402
467
  const { status, error } = getStatus();
403
468
  const values = getValue3() ?? {};
404
- return /* @__PURE__ */ React5.createElement(Input4.Root, {
469
+ return /* @__PURE__ */ React6.createElement(Input5.Root, {
405
470
  validationValence: status
406
- }, /* @__PURE__ */ React5.createElement(InputHeader, {
471
+ }, /* @__PURE__ */ React6.createElement(InputHeader, {
407
472
  error
408
- }, /* @__PURE__ */ React5.createElement(Input4.Label, null, label)), /* @__PURE__ */ React5.createElement("div", {
473
+ }, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement("div", {
409
474
  className: mx3("grid gap-2", gridCols[binding.length - 1])
410
- }, binding.map((prop) => /* @__PURE__ */ React5.createElement(Input4.TextInput, {
475
+ }, binding.map((prop) => /* @__PURE__ */ React6.createElement(Input5.TextInput, {
411
476
  key: prop,
412
477
  type: "number",
413
478
  disabled,
@@ -421,69 +486,69 @@ var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValu
421
486
  };
422
487
 
423
488
  // packages/ui/react-ui-form/src/components/Form/Defaults.tsx
424
- import React6, { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef2 } from "react";
425
- import { Input as Input5, Select } from "@dxos/react-ui";
489
+ import React7, { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef2 } from "react";
490
+ import { Input as Input6, Select } from "@dxos/react-ui";
426
491
  var TextInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
427
492
  const { status, error } = getStatus();
428
- return /* @__PURE__ */ React6.createElement(Input5.Root, {
493
+ return /* @__PURE__ */ React7.createElement(Input6.Root, {
429
494
  validationValence: status
430
- }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
495
+ }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
431
496
  error
432
- }, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement(Input5.TextInput, {
497
+ }, /* @__PURE__ */ React7.createElement(Input6.Label, null, label)), /* @__PURE__ */ React7.createElement(Input6.TextInput, {
433
498
  disabled,
434
499
  placeholder,
435
500
  value: getValue3() ?? "",
436
501
  onChange: (event) => onValueChange(type, event.target.value),
437
502
  onBlur
438
- }), inputOnly && /* @__PURE__ */ React6.createElement(Input5.Validation, null, error));
503
+ }), inputOnly && /* @__PURE__ */ React7.createElement(Input6.Validation, null, error));
439
504
  };
440
505
  var NumberInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
441
506
  const { status, error } = getStatus();
442
- return /* @__PURE__ */ React6.createElement(Input5.Root, {
507
+ return /* @__PURE__ */ React7.createElement(Input6.Root, {
443
508
  validationValence: status
444
- }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
509
+ }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
445
510
  error
446
- }, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement(Input5.TextInput, {
511
+ }, /* @__PURE__ */ React7.createElement(Input6.Label, null, label)), /* @__PURE__ */ React7.createElement(Input6.TextInput, {
447
512
  type: "number",
448
513
  disabled,
449
514
  placeholder,
450
515
  value: getValue3() ?? 0,
451
516
  onChange: (event) => onValueChange(type, event.target.value),
452
517
  onBlur
453
- }), inputOnly && /* @__PURE__ */ React6.createElement(Input5.DescriptionAndValidation, null, error));
518
+ }), inputOnly && /* @__PURE__ */ React7.createElement(Input6.DescriptionAndValidation, null, error));
454
519
  };
455
520
  var BooleanInput = ({ type, label, inputOnly, getStatus, getValue: getValue3, onValueChange }) => {
456
521
  const { status, error } = getStatus();
457
522
  const checked = Boolean(getValue3());
458
- return /* @__PURE__ */ React6.createElement(Input5.Root, {
523
+ return /* @__PURE__ */ React7.createElement(Input6.Root, {
459
524
  validationValence: status
460
- }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
525
+ }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
461
526
  error
462
- }, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement(Input5.Switch, {
527
+ }, /* @__PURE__ */ React7.createElement(Input6.Label, null, label)), /* @__PURE__ */ React7.createElement(Input6.Switch, {
463
528
  checked,
464
529
  onCheckedChange: (value) => onValueChange(type, value)
465
- }), inputOnly && /* @__PURE__ */ React6.createElement(Input5.DescriptionAndValidation, null, error));
530
+ }), inputOnly && /* @__PURE__ */ React7.createElement(Input6.DescriptionAndValidation, null, error));
466
531
  };
467
532
  var SelectInput = ({ type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue3, onValueChange }) => {
468
533
  const { status, error } = getStatus();
469
- return /* @__PURE__ */ React6.createElement(Input5.Root, {
534
+ return /* @__PURE__ */ React7.createElement(Input6.Root, {
470
535
  validationValence: status
471
- }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
536
+ }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
472
537
  error
473
- }, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement(Select.Root, {
538
+ }, /* @__PURE__ */ React7.createElement(Input6.Label, null, label)), /* @__PURE__ */ React7.createElement(Select.Root, {
474
539
  value: getValue3(),
475
540
  onValueChange: (value) => onValueChange(type, value)
476
- }, /* @__PURE__ */ React6.createElement(Select.TriggerButton, {
541
+ }, /* @__PURE__ */ React7.createElement(Select.TriggerButton, {
477
542
  classNames: "is-full",
478
543
  disabled,
479
544
  placeholder
480
- }), /* @__PURE__ */ React6.createElement(Select.Portal, null, /* @__PURE__ */ React6.createElement(Select.Content, null, /* @__PURE__ */ React6.createElement(Select.Viewport, null, options?.map(({ value, label: label2 }) => (
545
+ }), /* @__PURE__ */ React7.createElement(Select.Portal, null, /* @__PURE__ */ React7.createElement(Select.Content, null, /* @__PURE__ */ React7.createElement(Select.Viewport, null, options?.map(({ value, label: label2 }) => (
481
546
  // NOTE: Numeric values are converted to and from strings.
482
- /* @__PURE__ */ React6.createElement(Select.Option, {
547
+ /* @__PURE__ */ React7.createElement(Select.Option, {
483
548
  key: String(value),
484
549
  value: String(value)
485
550
  }, label2 ?? String(value))
486
- )))))), inputOnly && /* @__PURE__ */ React6.createElement(Input5.DescriptionAndValidation, null, error));
551
+ )))))), inputOnly && /* @__PURE__ */ React7.createElement(Input6.DescriptionAndValidation, null, error));
487
552
  };
488
553
  var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
489
554
  const { status, error } = getStatus();
@@ -506,11 +571,11 @@ var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus,
506
571
  getValue3(),
507
572
  adjustHeight
508
573
  ]);
509
- return /* @__PURE__ */ React6.createElement(Input5.Root, {
574
+ return /* @__PURE__ */ React7.createElement(Input6.Root, {
510
575
  validationValence: status
511
- }, !inputOnly && /* @__PURE__ */ React6.createElement(InputHeader, {
576
+ }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
512
577
  error
513
- }, /* @__PURE__ */ React6.createElement(Input5.Label, null, label)), /* @__PURE__ */ React6.createElement(Input5.TextArea, {
578
+ }, /* @__PURE__ */ React7.createElement(Input6.Label, null, label)), /* @__PURE__ */ React7.createElement(Input6.TextArea, {
514
579
  ref: textareaRef,
515
580
  disabled,
516
581
  placeholder,
@@ -522,20 +587,20 @@ var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus,
522
587
  resize: "none"
523
588
  },
524
589
  spellCheck: false
525
- }), inputOnly && /* @__PURE__ */ React6.createElement(Input5.Validation, null, error));
590
+ }), inputOnly && /* @__PURE__ */ React7.createElement(Input6.Validation, null, error));
526
591
  };
527
592
 
528
593
  // packages/ui/react-ui-form/src/components/Form/Form.tsx
529
- import React11, { useEffect as useEffect6, useMemo as useMemo6, useRef as useRef3 } from "react";
594
+ import React12, { useEffect as useEffect6, useMemo as useMemo6, useRef as useRef3 } from "react";
530
595
  import { mx as mx7 } from "@dxos/react-ui-theme";
531
596
 
532
597
  // packages/ui/react-ui-form/src/components/Form/FormActions.tsx
533
- import React8 from "react";
534
- import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
598
+ import React9 from "react";
599
+ import { IconButton as IconButton2, useTranslation as useTranslation4 } from "@dxos/react-ui";
535
600
  import { mx as mx4 } from "@dxos/react-ui-theme";
536
601
 
537
602
  // packages/ui/react-ui-form/src/components/Form/FormContext.tsx
538
- import React7, { createContext, useContext, useEffect as useEffect5, useMemo as useMemo3 } from "react";
603
+ import React8, { createContext, useContext, useEffect as useEffect5, useMemo as useMemo3 } from "react";
539
604
  import { raise } from "@dxos/debug";
540
605
  import { getValue as getValue2 } from "@dxos/echo-schema";
541
606
  import { createJsonPath as createJsonPath2 } from "@dxos/effect";
@@ -809,27 +874,27 @@ var FormProvider = ({ children, formRef, autoSave, ...formOptions }) => {
809
874
  form.handleSave,
810
875
  autoSave
811
876
  ]);
812
- return /* @__PURE__ */ React7.createElement(FormContext.Provider, {
877
+ return /* @__PURE__ */ React8.createElement(FormContext.Provider, {
813
878
  value: form
814
879
  }, children);
815
880
  };
816
881
 
817
882
  // packages/ui/react-ui-form/src/components/Form/FormActions.tsx
818
883
  var FormActions = ({ onCancel, readonly }) => {
819
- const { t } = useTranslation3(translationKey);
884
+ const { t } = useTranslation4(translationKey);
820
885
  const { canSave, handleSave } = useFormContext();
821
- return /* @__PURE__ */ React8.createElement("div", {
886
+ return /* @__PURE__ */ React9.createElement("div", {
822
887
  role: "none",
823
888
  className: "mt-2 flex justify-center"
824
- }, /* @__PURE__ */ React8.createElement("div", {
889
+ }, /* @__PURE__ */ React9.createElement("div", {
825
890
  role: "none",
826
891
  className: mx4(onCancel && !readonly && "grid grid-cols-2 gap-2")
827
- }, onCancel && !readonly && /* @__PURE__ */ React8.createElement(IconButton2, {
892
+ }, onCancel && !readonly && /* @__PURE__ */ React9.createElement(IconButton2, {
828
893
  "data-testid": "cancel-button",
829
894
  icon: "ph--x--regular",
830
895
  label: t("button cancel"),
831
896
  onClick: onCancel
832
- }), handleSave && /* @__PURE__ */ React8.createElement(IconButton2, {
897
+ }), handleSave && /* @__PURE__ */ React9.createElement(IconButton2, {
833
898
  type: "submit",
834
899
  "data-testid": "save-button",
835
900
  disabled: !canSave,
@@ -842,7 +907,7 @@ var FormActions = ({ onCancel, readonly }) => {
842
907
  // packages/ui/react-ui-form/src/components/Form/FormContent.tsx
843
908
  import { pipe as pipe2 } from "effect";
844
909
  import { capitalize as capitalize2 } from "effect/String";
845
- import React10, { useMemo as useMemo5 } from "react";
910
+ import React11, { useMemo as useMemo5 } from "react";
846
911
  import { AST as AST3, S } from "@dxos/echo-schema";
847
912
  import { createJsonPath as createJsonPath3, findNode as findNode2, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
848
913
  import { mx as mx6 } from "@dxos/react-ui-theme";
@@ -852,17 +917,17 @@ import { isNotFalsy } from "@dxos/util";
852
917
  // packages/ui/react-ui-form/src/components/Form/ArrayField.tsx
853
918
  import { pipe } from "effect";
854
919
  import { capitalize } from "effect/String";
855
- import React9, { useCallback as useCallback5, useMemo as useMemo4 } from "react";
920
+ import React10, { useCallback as useCallback5, useMemo as useMemo4 } from "react";
856
921
  import { AST as AST2 } from "@dxos/echo-schema";
857
922
  import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
858
923
  import { invariant as invariant2 } from "@dxos/invariant";
859
- import { IconButton as IconButton3, useTranslation as useTranslation4 } from "@dxos/react-ui";
924
+ import { IconButton as IconButton3, useTranslation as useTranslation5 } from "@dxos/react-ui";
860
925
  import { mx as mx5 } from "@dxos/react-ui-theme";
861
926
  import { getSchemaProperties } from "@dxos/schema";
862
927
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
863
928
  var padding = "px-2";
864
929
  var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponent }) => {
865
- const { t } = useTranslation4(translationKey);
930
+ const { t } = useTranslation5(translationKey);
866
931
  const { ast, name, type, title } = property;
867
932
  const values = useFormValues(path ?? []);
868
933
  invariant2(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
@@ -921,20 +986,20 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
921
986
  if (!elementType) {
922
987
  return null;
923
988
  }
924
- return /* @__PURE__ */ React9.createElement("div", {
989
+ return /* @__PURE__ */ React10.createElement("div", {
925
990
  role: "none",
926
991
  className: mx5(padding)
927
- }, /* @__PURE__ */ React9.createElement(InputHeader, null, label), /* @__PURE__ */ React9.createElement("div", {
992
+ }, /* @__PURE__ */ React10.createElement(InputHeader, null, label), /* @__PURE__ */ React10.createElement("div", {
928
993
  role: "none",
929
994
  className: "flex flex-col gap-1"
930
- }, values.map((_value, index) => /* @__PURE__ */ React9.createElement("div", {
995
+ }, values.map((_value, index) => /* @__PURE__ */ React10.createElement("div", {
931
996
  key: index,
932
997
  role: "none",
933
998
  className: "flex items-center gap-1"
934
- }, /* @__PURE__ */ React9.createElement("div", {
999
+ }, /* @__PURE__ */ React10.createElement("div", {
935
1000
  role: "none",
936
1001
  className: "flex-1"
937
- }, /* @__PURE__ */ React9.createElement(FormField, {
1002
+ }, /* @__PURE__ */ React10.createElement(FormField, {
938
1003
  property: {
939
1004
  ...property,
940
1005
  array: false,
@@ -948,15 +1013,15 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
948
1013
  inline: true,
949
1014
  Custom,
950
1015
  lookupComponent
951
- })), /* @__PURE__ */ React9.createElement(IconButton3, {
1016
+ })), /* @__PURE__ */ React10.createElement(IconButton3, {
952
1017
  icon: "ph--trash--regular",
953
1018
  iconOnly: true,
954
1019
  label: t("button remove"),
955
1020
  onClick: () => handleRemove(index)
956
- })))), /* @__PURE__ */ React9.createElement("div", {
1021
+ })))), /* @__PURE__ */ React10.createElement("div", {
957
1022
  role: "none",
958
1023
  className: "flex justify-between items-center plb-1"
959
- }, /* @__PURE__ */ React9.createElement(IconButton3, {
1024
+ }, /* @__PURE__ */ React10.createElement(IconButton3, {
960
1025
  icon: "ph--plus--regular",
961
1026
  iconOnly: true,
962
1027
  label: t("button add"),
@@ -1008,14 +1073,14 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1008
1073
  }
1009
1074
  });
1010
1075
  if (FoundComponent) {
1011
- return /* @__PURE__ */ React10.createElement("div", {
1076
+ return /* @__PURE__ */ React11.createElement("div", {
1012
1077
  role: "none"
1013
1078
  }, FoundComponent);
1014
1079
  }
1015
1080
  const jsonPath = createJsonPath3(path ?? []);
1016
1081
  const CustomComponent = Custom?.[jsonPath];
1017
1082
  if (CustomComponent) {
1018
- return /* @__PURE__ */ React10.createElement(CustomComponent, {
1083
+ return /* @__PURE__ */ React11.createElement(CustomComponent, {
1019
1084
  type,
1020
1085
  format,
1021
1086
  label,
@@ -1026,7 +1091,7 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1026
1091
  });
1027
1092
  }
1028
1093
  if (array) {
1029
- return /* @__PURE__ */ React10.createElement(ArrayField, {
1094
+ return /* @__PURE__ */ React11.createElement(ArrayField, {
1030
1095
  property,
1031
1096
  path,
1032
1097
  inputProps,
@@ -1036,9 +1101,9 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1036
1101
  }
1037
1102
  const InputComponent = getInputComponent(type, format);
1038
1103
  if (InputComponent) {
1039
- return /* @__PURE__ */ React10.createElement("div", {
1104
+ return /* @__PURE__ */ React11.createElement("div", {
1040
1105
  role: "none"
1041
- }, /* @__PURE__ */ React10.createElement(InputComponent, {
1106
+ }, /* @__PURE__ */ React11.createElement(InputComponent, {
1042
1107
  type,
1043
1108
  format,
1044
1109
  label,
@@ -1049,9 +1114,9 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1049
1114
  }));
1050
1115
  }
1051
1116
  if (options) {
1052
- return /* @__PURE__ */ React10.createElement("div", {
1117
+ return /* @__PURE__ */ React11.createElement("div", {
1053
1118
  role: "none"
1054
- }, /* @__PURE__ */ React10.createElement(SelectInput, {
1119
+ }, /* @__PURE__ */ React11.createElement(SelectInput, {
1055
1120
  type,
1056
1121
  format,
1057
1122
  disabled: readonly,
@@ -1069,9 +1134,9 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1069
1134
  const baseNode = findNode2(ast, isDiscriminatedUnion2);
1070
1135
  const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode2(ast, AST3.isTypeLiteral);
1071
1136
  if (typeLiteral) {
1072
- return /* @__PURE__ */ React10.createElement("div", {
1137
+ return /* @__PURE__ */ React11.createElement("div", {
1073
1138
  role: "none"
1074
- }, !inline && /* @__PURE__ */ React10.createElement("div", null, label), /* @__PURE__ */ React10.createElement(FormFields, {
1139
+ }, !inline && /* @__PURE__ */ React11.createElement("div", null, label), /* @__PURE__ */ React11.createElement(FormFields, {
1075
1140
  schema: S.make(typeLiteral),
1076
1141
  path,
1077
1142
  readonly,
@@ -1093,11 +1158,11 @@ var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custo
1093
1158
  filter,
1094
1159
  sort
1095
1160
  ]);
1096
- return /* @__PURE__ */ React10.createElement("div", {
1161
+ return /* @__PURE__ */ React11.createElement("div", {
1097
1162
  role: "form",
1098
1163
  className: mx6("flex flex-col w-full gap-2")
1099
1164
  }, properties.map((property) => {
1100
- return /* @__PURE__ */ React10.createElement(FormField, {
1165
+ return /* @__PURE__ */ React11.createElement(FormField, {
1101
1166
  key: property.name,
1102
1167
  property,
1103
1168
  path: [
@@ -1128,7 +1193,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
1128
1193
  }, [
1129
1194
  autoFocus
1130
1195
  ]);
1131
- return /* @__PURE__ */ React11.createElement(FormProvider, {
1196
+ return /* @__PURE__ */ React12.createElement(FormProvider, {
1132
1197
  formRef,
1133
1198
  schema,
1134
1199
  autoSave,
@@ -1137,12 +1202,12 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
1137
1202
  onValidate,
1138
1203
  onValid,
1139
1204
  onSave
1140
- }, /* @__PURE__ */ React11.createElement("div", {
1205
+ }, /* @__PURE__ */ React12.createElement("div", {
1141
1206
  ref: formRef,
1142
1207
  role: "none",
1143
1208
  className: mx7("p-2", classNames),
1144
1209
  "data-testid": testId
1145
- }, /* @__PURE__ */ React11.createElement(FormFields, {
1210
+ }, /* @__PURE__ */ React12.createElement(FormFields, {
1146
1211
  schema,
1147
1212
  path,
1148
1213
  readonly,
@@ -1150,7 +1215,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
1150
1215
  sort,
1151
1216
  lookupComponent,
1152
1217
  Custom
1153
- }), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React11.createElement(FormActions, {
1218
+ }), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React12.createElement(FormActions, {
1154
1219
  onCancel,
1155
1220
  readonly
1156
1221
  })));
@@ -1159,7 +1224,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
1159
1224
  // packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
1160
1225
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
1161
1226
  var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1162
- const { t } = useTranslation5(translationKey);
1227
+ const { t } = useTranslation6(translationKey);
1163
1228
  const [props, setProps] = useState4(projection.getFieldProjection(field.id).props);
1164
1229
  useEffect7(() => setProps(projection.getFieldProjection(field.id).props), [
1165
1230
  field,
@@ -1260,26 +1325,26 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1260
1325
  onSave
1261
1326
  ]);
1262
1327
  const Custom = useMemo7(() => ({
1263
- ["format"]: (props2) => /* @__PURE__ */ React12.createElement(SelectInput, {
1328
+ ["format"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
1264
1329
  ...props2,
1265
1330
  options: FormatEnums.filter((value) => value !== FormatEnum2.None).map((value) => ({
1266
1331
  value,
1267
1332
  label: t(`format ${value}`)
1268
1333
  }))
1269
1334
  }),
1270
- ["referenceSchema"]: (props2) => /* @__PURE__ */ React12.createElement(SelectInput, {
1335
+ ["referenceSchema"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
1271
1336
  ...props2,
1272
1337
  options: schemas.map((schema) => ({
1273
1338
  value: schema.typename
1274
1339
  }))
1275
1340
  }),
1276
- ["referencePath"]: (props2) => /* @__PURE__ */ React12.createElement(SelectInput, {
1341
+ ["referencePath"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
1277
1342
  ...props2,
1278
1343
  options: referenceSchema ? getSchemaProperties3(referenceSchema.ast).sort(sortProperties).map((p) => ({
1279
1344
  value: p.name
1280
1345
  })) : []
1281
1346
  }),
1282
- ["options"]: (props2) => /* @__PURE__ */ React12.createElement(SelectOptionInput, props2)
1347
+ ["options"]: (props2) => /* @__PURE__ */ React13.createElement(SelectOptionInput, props2)
1283
1348
  }), [
1284
1349
  t,
1285
1350
  schemas,
@@ -1297,7 +1362,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1297
1362
  });
1298
1363
  return null;
1299
1364
  }
1300
- return /* @__PURE__ */ React12.createElement(Form, {
1365
+ return /* @__PURE__ */ React13.createElement(Form, {
1301
1366
  key: field.id,
1302
1367
  autoFocus: true,
1303
1368
  values: props,
@@ -1316,10 +1381,10 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1316
1381
  };
1317
1382
 
1318
1383
  // packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx
1319
- import React13, { useCallback as useCallback7, useMemo as useMemo8, useState as useState5 } from "react";
1384
+ import React14, { useCallback as useCallback7, useMemo as useMemo8, useState as useState5 } from "react";
1320
1385
  import { AST as AST4, Format, S as S2 } from "@dxos/echo-schema";
1321
1386
  import { invariant as invariant3 } from "@dxos/invariant";
1322
- import { IconButton as IconButton4, useTranslation as useTranslation6 } from "@dxos/react-ui";
1387
+ import { IconButton as IconButton4, useTranslation as useTranslation7 } from "@dxos/react-ui";
1323
1388
  import { List as List2 } from "@dxos/react-ui-list";
1324
1389
  import { ghostHover, inputTextLabel, mx as mx8 } from "@dxos/react-ui-theme";
1325
1390
  import { FieldSchema, ViewProjection, VIEW_FIELD_LIMIT } from "@dxos/schema";
@@ -1334,8 +1399,8 @@ var ViewMetaSchema = S2.Struct({
1334
1399
  })
1335
1400
  }).pipe(S2.mutable);
1336
1401
  var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading = false, onTypenameChanged, onDelete }) => {
1337
- const { t } = useTranslation6(translationKey);
1338
- const projection = useMemo8(() => new ViewProjection(schema, view), [
1402
+ const { t } = useTranslation7(translationKey);
1403
+ const projection = useMemo8(() => new ViewProjection(schema.jsonSchema, view), [
1339
1404
  schema,
1340
1405
  view
1341
1406
  ]);
@@ -1445,77 +1510,77 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1445
1510
  }, [
1446
1511
  projection
1447
1512
  ]);
1448
- return /* @__PURE__ */ React13.createElement("div", {
1513
+ return /* @__PURE__ */ React14.createElement("div", {
1449
1514
  role: "none",
1450
1515
  className: mx8("flex flex-col w-full divide-y divide-separator", classNames)
1451
- }, /* @__PURE__ */ React13.createElement(Form, {
1516
+ }, /* @__PURE__ */ React14.createElement(Form, {
1452
1517
  autoSave: true,
1453
1518
  schema: ViewMetaSchema,
1454
1519
  values: viewValues,
1455
1520
  onSave: schema.readonly ? void 0 : handleUpdate
1456
- }), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", {
1521
+ }), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", {
1457
1522
  role: "none",
1458
1523
  className: "p-2"
1459
- }, /* @__PURE__ */ React13.createElement("label", {
1524
+ }, /* @__PURE__ */ React14.createElement("label", {
1460
1525
  className: mx8(inputTextLabel)
1461
- }, t("fields label"))), /* @__PURE__ */ React13.createElement(List2.Root, {
1526
+ }, t("fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
1462
1527
  items: view.fields,
1463
1528
  isItem: S2.is(FieldSchema),
1464
1529
  getId: (field2) => field2.id,
1465
1530
  onMove: schema.readonly ? void 0 : handleMove
1466
- }, ({ items: fields }) => /* @__PURE__ */ React13.createElement(React13.Fragment, null, showHeading && /* @__PURE__ */ React13.createElement("div", {
1531
+ }, ({ items: fields }) => /* @__PURE__ */ React14.createElement(React14.Fragment, null, showHeading && /* @__PURE__ */ React14.createElement("div", {
1467
1532
  role: "heading",
1468
1533
  className: grid
1469
- }, /* @__PURE__ */ React13.createElement("div", null), /* @__PURE__ */ React13.createElement("div", {
1534
+ }, /* @__PURE__ */ React14.createElement("div", null), /* @__PURE__ */ React14.createElement("div", {
1470
1535
  className: "flex items-center text-sm"
1471
- }, t("field path label"))), /* @__PURE__ */ React13.createElement("div", {
1536
+ }, t("field path label"))), /* @__PURE__ */ React14.createElement("div", {
1472
1537
  role: "list",
1473
1538
  className: "flex flex-col w-full"
1474
- }, fields?.map((field2) => /* @__PURE__ */ React13.createElement(List2.Item, {
1539
+ }, fields?.map((field2) => /* @__PURE__ */ React14.createElement(List2.Item, {
1475
1540
  key: field2.id,
1476
1541
  item: field2,
1477
1542
  classNames: mx8(grid, ghostHover, "cursor-pointer")
1478
- }, /* @__PURE__ */ React13.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React13.createElement(List2.ItemTitle, {
1543
+ }, /* @__PURE__ */ React14.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, {
1479
1544
  onClick: () => handleSelect(field2)
1480
- }, field2.path), /* @__PURE__ */ React13.createElement("div", {
1545
+ }, field2.path), /* @__PURE__ */ React14.createElement("div", {
1481
1546
  className: "flex items-center gap-2 -ml-4"
1482
- }, /* @__PURE__ */ React13.createElement(List2.ItemButton, {
1547
+ }, /* @__PURE__ */ React14.createElement(List2.ItemButton, {
1483
1548
  icon: "ph--eye-slash--regular",
1484
1549
  disabled: view.fields.length <= 1,
1485
1550
  onClick: () => handleHide(field2.id)
1486
- }), !schema.readonly && /* @__PURE__ */ React13.createElement(List2.ItemDeleteButton, {
1551
+ }), !schema.readonly && /* @__PURE__ */ React14.createElement(List2.ItemDeleteButton, {
1487
1552
  icon: "ph--trash--regular",
1488
1553
  disabled: view.fields.length <= 1,
1489
1554
  onClick: () => handleDelete(field2.id)
1490
- }))))))), hiddenProperties.length > 0 && /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", {
1555
+ }))))))), hiddenProperties.length > 0 && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", {
1491
1556
  role: "none",
1492
1557
  className: "p-2"
1493
- }, /* @__PURE__ */ React13.createElement("label", {
1558
+ }, /* @__PURE__ */ React14.createElement("label", {
1494
1559
  className: mx8(inputTextLabel)
1495
- }, t("hidden fields label"))), /* @__PURE__ */ React13.createElement(List2.Root, {
1560
+ }, t("hidden fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
1496
1561
  items: hiddenProperties,
1497
1562
  isItem: (item) => typeof item === "string",
1498
1563
  getId: (property) => property
1499
- }, ({ items: properties }) => /* @__PURE__ */ React13.createElement("div", {
1564
+ }, ({ items: properties }) => /* @__PURE__ */ React14.createElement("div", {
1500
1565
  role: "list",
1501
1566
  className: "flex flex-col w-full"
1502
- }, properties?.map((property) => /* @__PURE__ */ React13.createElement(List2.Item, {
1567
+ }, properties?.map((property) => /* @__PURE__ */ React14.createElement(List2.Item, {
1503
1568
  key: property,
1504
1569
  item: property,
1505
1570
  classNames: mx8(grid, ghostHover, "cursor-pointer")
1506
- }, /* @__PURE__ */ React13.createElement("div", null), /* @__PURE__ */ React13.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React13.createElement(List2.ItemButton, {
1571
+ }, /* @__PURE__ */ React14.createElement("div", null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React14.createElement(List2.ItemButton, {
1507
1572
  icon: "ph--eye--regular",
1508
1573
  onClick: () => handleShow(property)
1509
- }))))))), field && /* @__PURE__ */ React13.createElement(FieldEditor, {
1574
+ }))))))), field && /* @__PURE__ */ React14.createElement(FieldEditor, {
1510
1575
  key: field.id,
1511
1576
  view,
1512
1577
  projection,
1513
1578
  field,
1514
1579
  registry,
1515
1580
  onSave: handleClose
1516
- }), !readonly && !field && /* @__PURE__ */ React13.createElement("div", {
1581
+ }), !readonly && !field && /* @__PURE__ */ React14.createElement("div", {
1517
1582
  className: "flex p-2 justify-center"
1518
- }, /* @__PURE__ */ React13.createElement(IconButton4, {
1583
+ }, /* @__PURE__ */ React14.createElement(IconButton4, {
1519
1584
  icon: "ph--plus--regular",
1520
1585
  label: t("button add property"),
1521
1586
  onClick: schema.readonly ? void 0 : handleAdd,
@@ -1629,12 +1694,14 @@ var cellClassesForFieldType = ({ type, format }) => {
1629
1694
  switch (format) {
1630
1695
  case FormatEnum3.Markdown:
1631
1696
  return void 0;
1697
+ case FormatEnum3.Time:
1632
1698
  case FormatEnum3.Timestamp:
1633
1699
  case FormatEnum3.DateTime:
1634
1700
  case FormatEnum3.Date:
1635
- case FormatEnum3.Time:
1701
+ case FormatEnum3.Duration:
1636
1702
  return [
1637
- "font-mono"
1703
+ "font-mono",
1704
+ "text-right"
1638
1705
  ];
1639
1706
  case FormatEnum3.Currency:
1640
1707
  return [
@@ -1649,15 +1716,13 @@ var cellClassesForFieldType = ({ type, format }) => {
1649
1716
  return void 0;
1650
1717
  }
1651
1718
  };
1652
- var cellClassesForRowSelection = (selected) => selected ? [
1653
- "!bg-gridCellSelected"
1654
- ] : void 0;
1655
1719
  var pathNotUniqueError = (path) => ({
1656
1720
  path: "path",
1657
1721
  message: `'${path}' is already present`
1658
1722
  });
1659
1723
 
1660
1724
  // packages/ui/react-ui-form/src/util/formatting.ts
1725
+ import { format as formatDate } from "date-fns/format";
1661
1726
  import { FormatEnum as FormatEnum4, GeoLocation as GeoLocation3, TypeEnum as TypeEnum2 } from "@dxos/echo-schema";
1662
1727
  var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
1663
1728
  const formatScalar = (type2) => {
@@ -1699,17 +1764,14 @@ var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
1699
1764
  maximumFractionDigits: 2
1700
1765
  });
1701
1766
  }
1702
- case FormatEnum4.DateTime:
1703
- case FormatEnum4.Date:
1767
+ case FormatEnum4.Date: {
1768
+ return formatDate(new Date(value), "yyyy-MM-dd");
1769
+ }
1704
1770
  case FormatEnum4.Time: {
1705
- const date = new Date(value);
1706
- if (format === FormatEnum4.DateTime) {
1707
- return date.toLocaleString(locale);
1708
- } else if (format === FormatEnum4.Date) {
1709
- return date.toLocaleDateString(locale);
1710
- } else {
1711
- return date.toLocaleTimeString(locale);
1712
- }
1771
+ return formatDate(new Date(value), "HH:mm:ss");
1772
+ }
1773
+ case FormatEnum4.DateTime: {
1774
+ return formatDate(new Date(value), "yyyy-MM-dd HH:mm:ss");
1713
1775
  }
1714
1776
  case FormatEnum4.GeoPoint: {
1715
1777
  if (value === null || value === void 0) {
@@ -1786,6 +1848,13 @@ var formatForEditing = ({ type, format, value, locale = void 0 }) => {
1786
1848
  };
1787
1849
  export {
1788
1850
  BooleanInput,
1851
+ ControlFrame,
1852
+ ControlFrameItem,
1853
+ ControlGroup,
1854
+ ControlItem,
1855
+ ControlItemInput,
1856
+ ControlSection,
1857
+ ControlSectionHeading,
1789
1858
  DeprecatedFormContainer,
1790
1859
  DeprecatedFormInput,
1791
1860
  FieldEditor,
@@ -1801,7 +1870,7 @@ export {
1801
1870
  TupleInput,
1802
1871
  ViewEditor,
1803
1872
  cellClassesForFieldType,
1804
- cellClassesForRowSelection,
1873
+ controlItemClasses,
1805
1874
  formatForDisplay,
1806
1875
  formatForEditing,
1807
1876
  parseValue,