@dxos/react-ui-form 0.8.4-main.c1de068 → 0.8.4-main.f5c0578

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 (59) hide show
  1. package/dist/lib/browser/index.mjs +168 -149
  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 +168 -149
  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.stories.d.ts.map +1 -1
  8. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +2 -1
  9. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
  13. package/dist/types/src/components/Form/Form.d.ts +2 -2
  14. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  15. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
  17. package/dist/types/src/components/Form/FormContent.d.ts +1 -1
  18. package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
  19. package/dist/types/src/components/Form/FormContext.d.ts +1 -1
  20. package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
  21. package/dist/types/src/components/Form/RefField.d.ts +1 -1
  22. package/dist/types/src/components/Form/RefField.d.ts.map +1 -1
  23. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
  24. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/Form/factory.d.ts.map +1 -1
  26. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  27. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
  29. package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
  30. package/dist/types/src/hooks/useForm.d.ts +1 -1
  31. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  32. package/dist/types/src/translations.d.ts +3 -2
  33. package/dist/types/src/translations.d.ts.map +1 -1
  34. package/dist/types/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +30 -29
  36. package/src/components/ControlSection/ControlSection.stories.tsx +2 -1
  37. package/src/components/FieldEditor/FieldEditor.stories.tsx +4 -3
  38. package/src/components/FieldEditor/FieldEditor.test.tsx +3 -2
  39. package/src/components/FieldEditor/FieldEditor.tsx +16 -6
  40. package/src/components/Form/ArrayField.tsx +7 -6
  41. package/src/components/Form/Defaults.tsx +2 -1
  42. package/src/components/Form/Form.stories.tsx +4 -3
  43. package/src/components/Form/Form.tsx +4 -3
  44. package/src/components/Form/FormActions.tsx +2 -1
  45. package/src/components/Form/FormContent.tsx +6 -5
  46. package/src/components/Form/FormContext.tsx +5 -5
  47. package/src/components/Form/RefField.tsx +6 -5
  48. package/src/components/Form/custom/GeoPointInput.tsx +2 -2
  49. package/src/components/Form/custom/SelectOptionsInput.stories.tsx +3 -2
  50. package/src/components/Form/custom/SelectOptionsInput.tsx +28 -29
  51. package/src/components/Form/factory.tsx +1 -1
  52. package/src/components/ViewEditor/ViewEditor.stories.tsx +5 -4
  53. package/src/components/ViewEditor/ViewEditor.test.tsx +5 -4
  54. package/src/components/ViewEditor/ViewEditor.tsx +69 -54
  55. package/src/components/deprecated/Form.stories.tsx +3 -2
  56. package/src/components/deprecated/Form.tsx +3 -3
  57. package/src/hooks/useForm.ts +5 -3
  58. package/src/hooks/useRefQueryLookupHandler.ts +1 -1
  59. package/src/translations.ts +3 -2
@@ -20,6 +20,7 @@ var translations = [
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
+ "delete field label": "Delete field",
23
24
  // TODO(burdon): Factor out?
24
25
  "button cancel": "Cancel",
25
26
  "button save": "Save",
@@ -62,8 +63,8 @@ var translations = [
62
63
  "select option delete": "Delete",
63
64
  "select option add": "Add option",
64
65
  // System schema message.
65
- "system schema title": "System Schema",
66
- "system schema description": "This is a system schema and cannot be modified."
66
+ "system schema title": "System record type",
67
+ "system schema description": "This is a system record type and cannot be modified."
67
68
  }
68
69
  }
69
70
  }
@@ -262,7 +263,7 @@ import { getFormatSchema, getSchemaProperties as getSchemaProperties3, sortPrope
262
263
 
263
264
  // src/components/Form/custom/GeoPointInput.tsx
264
265
  import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
265
- import React4, { useCallback, useState, useEffect, useMemo } from "react";
266
+ import React4, { useCallback, useEffect, useMemo, useState } from "react";
266
267
  import { GeoLocation } from "@dxos/echo-schema";
267
268
  import { Input as Input4, useTranslation as useTranslation2 } from "@dxos/react-ui";
268
269
  import { safeParseFloat } from "@dxos/util";
@@ -376,12 +377,12 @@ var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, on
376
377
 
377
378
  // src/components/Form/custom/SelectOptionsInput.tsx
378
379
  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";
380
+ import React5, { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
380
381
  import { PublicKey } from "@dxos/keys";
381
- import { Icon as Icon2, IconButton, Input as Input5, Tag, Toolbar, useTranslation as useTranslation3 } from "@dxos/react-ui";
382
+ import { IconButton, Input as Input5, Tag, useTranslation as useTranslation3 } from "@dxos/react-ui";
382
383
  import { List } from "@dxos/react-ui-list";
383
384
  import { HuePicker } from "@dxos/react-ui-pickers";
384
- import { hues, mx as mx4 } from "@dxos/react-ui-theme";
385
+ import { hues, subtleHover } from "@dxos/react-ui-theme";
385
386
  var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange }) => {
386
387
  var _effect = _useSignals5();
387
388
  try {
@@ -501,7 +502,8 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
501
502
  }, options && /* @__PURE__ */ React5.createElement(List.Root, {
502
503
  items: options,
503
504
  isItem: (item) => true,
504
- onMove: handleMove
505
+ onMove: disabled ? void 0 : handleMove,
506
+ readonly: disabled
505
507
  }, ({ items }) => /* @__PURE__ */ React5.createElement("div", {
506
508
  role: "list",
507
509
  className: "w-full overflow-auto"
@@ -511,29 +513,35 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
511
513
  role: "button",
512
514
  item,
513
515
  classNames: [
514
- "p-1 plb-2",
515
- "flex flex-col",
516
- "cursor-pointer",
517
- "hover:bg-hoverOverlay"
516
+ subtleHover,
517
+ "flex flex-col cursor-pointer rounded-sm"
518
518
  ],
519
519
  "aria-expanded": selected === item.id
520
520
  }, /* @__PURE__ */ React5.createElement("div", {
521
521
  className: "flex items-center"
522
- }, /* @__PURE__ */ React5.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React5.createElement(List.ItemTitle, {
522
+ }, /* @__PURE__ */ React5.createElement(List.ItemDragHandle, {
523
+ disabled
524
+ }), /* @__PURE__ */ React5.createElement(List.ItemTitle, {
523
525
  onClick: () => handleClick(item.id),
524
526
  classNames: "flex-1"
525
527
  }, /* @__PURE__ */ React5.createElement(Tag, {
526
528
  palette: item.color
527
- }, item.title || "\u200B")), /* @__PURE__ */ React5.createElement(Icon2, {
529
+ }, item.title || "\u200B")), /* @__PURE__ */ React5.createElement(IconButton, {
530
+ iconOnly: true,
531
+ variant: "ghost",
532
+ label: t(selected === item.id ? "collapse label" : "expand label", {
533
+ ns: "os"
534
+ }),
528
535
  icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
529
536
  onClick: () => handleClick(item.id)
530
537
  })), selected === item.id && /* @__PURE__ */ React5.createElement("div", {
531
- className: "mis-4 mbs-2 flex flex-col gap-1"
538
+ className: "pli-cardSpacingInline plb-cardSpacingBlock flex flex-col gap-1 density-fine"
532
539
  }, /* @__PURE__ */ React5.createElement(Input5.Label, {
533
540
  classNames: "text-xs"
534
541
  }, t("select option label")), /* @__PURE__ */ React5.createElement("div", {
535
- className: "flex flex-row items-center gap-1"
542
+ className: "grid grid-cols-[1fr_min-content_min-content] gap-1"
536
543
  }, /* @__PURE__ */ React5.createElement(Input5.TextInput, {
544
+ disabled,
537
545
  placeholder: t("select option label placeholder"),
538
546
  ref: selected === item.id ? inputRef : void 0,
539
547
  value: item.title,
@@ -541,30 +549,24 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
541
549
  onKeyDown: handleKeyDown,
542
550
  classNames: "flex-1",
543
551
  "data-no-submit": true
544
- }), /* @__PURE__ */ React5.createElement(Toolbar.Root, {
545
- classNames: "p-0 m-0 !is-auto"
546
- }, /* @__PURE__ */ React5.createElement(HuePicker, {
552
+ }), /* @__PURE__ */ React5.createElement(HuePicker, {
553
+ disabled,
547
554
  value: item.color,
548
- onChange: handleColorChange(item.id),
549
- rootVariant: "toolbar-button"
550
- })), /* @__PURE__ */ React5.createElement(IconButton, {
555
+ onChange: handleColorChange(item.id)
556
+ }), /* @__PURE__ */ React5.createElement(IconButton, {
557
+ disabled,
551
558
  icon: "ph--trash--fill",
552
559
  iconOnly: true,
553
560
  label: t("select option delete"),
554
561
  onClick: () => handleDelete(item.id)
555
- })))))), /* @__PURE__ */ React5.createElement("div", {
556
- role: "listitem"
557
- }, /* @__PURE__ */ React5.createElement("div", {
558
- role: "button",
559
- className: mx4("p-1 plb-2", "flex flex-col", "cursor-pointer", "hover:bg-hoverOverlay"),
560
- onClick: handleAdd
561
- }, /* @__PURE__ */ React5.createElement("div", {
562
- className: "flex items-center gap-1"
563
- }, /* @__PURE__ */ React5.createElement(Icon2, {
564
- icon: "ph--plus--regular"
565
- }), /* @__PURE__ */ React5.createElement("span", {
566
- className: "text-sm"
567
- }, t("select option add")))))))));
562
+ })))))), /* @__PURE__ */ React5.createElement(IconButton, {
563
+ variant: "ghost",
564
+ icon: "ph--plus--regular",
565
+ label: t("select option add"),
566
+ onClick: handleAdd,
567
+ disabled,
568
+ classNames: "is-full"
569
+ })))));
568
570
  } finally {
569
571
  _effect.f();
570
572
  }
@@ -574,7 +576,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
574
576
  import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
575
577
  import React6 from "react";
576
578
  import { Input as Input6 } from "@dxos/react-ui";
577
- import { mx as mx5 } from "@dxos/react-ui-theme";
579
+ import { mx as mx4 } from "@dxos/react-ui-theme";
578
580
  import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
579
581
  var gridCols = [
580
582
  "grid-cols-1",
@@ -593,7 +595,7 @@ var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValu
593
595
  error,
594
596
  label
595
597
  }), /* @__PURE__ */ React6.createElement("div", {
596
- className: mx5("grid gap-2", gridCols[binding.length - 1])
598
+ className: mx4("grid gap-2", gridCols[binding.length - 1])
597
599
  }, binding.map((prop) => /* @__PURE__ */ React6.createElement(Input6.TextInput, {
598
600
  key: prop,
599
601
  type: "number",
@@ -762,11 +764,11 @@ import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking"
762
764
  import React9 from "react";
763
765
  import { IconButton as IconButton2, useTranslation as useTranslation5 } from "@dxos/react-ui";
764
766
  import { cardSpacing } from "@dxos/react-ui-stack";
765
- import { mx as mx6 } from "@dxos/react-ui-theme";
767
+ import { mx as mx5 } from "@dxos/react-ui-theme";
766
768
 
767
769
  // src/components/Form/FormContext.tsx
768
770
  import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
769
- import React8, { createContext, useContext, useEffect as useEffect6, useMemo as useMemo3, useCallback as useCallback6 } from "react";
771
+ import React8, { createContext, useCallback as useCallback6, useContext, useEffect as useEffect6, useMemo as useMemo3 } from "react";
770
772
  import { raise } from "@dxos/debug";
771
773
  import { getValue as getValue2 } from "@dxos/echo-schema";
772
774
  import { createJsonPath as createJsonPath2 } from "@dxos/effect";
@@ -783,7 +785,7 @@ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.t
783
785
  var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave }) => {
784
786
  invariant(SchemaAST.isTypeLiteral(schema.ast), void 0, {
785
787
  F: __dxlog_file,
786
- L: 93,
788
+ L: 95,
787
789
  S: void 0,
788
790
  A: [
789
791
  "SchemaAST.isTypeLiteral(schema.ast)",
@@ -887,7 +889,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
887
889
  } catch (err) {
888
890
  log.catch(err, void 0, {
889
891
  F: __dxlog_file,
890
- L: 213,
892
+ L: 215,
891
893
  S: void 0,
892
894
  C: (f, a) => f(...a)
893
895
  });
@@ -958,7 +960,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
958
960
  var createKeySet = (obj, value) => {
959
961
  invariant(obj, void 0, {
960
962
  F: __dxlog_file,
961
- L: 275,
963
+ L: 277,
962
964
  S: void 0,
963
965
  A: [
964
966
  "obj",
@@ -1135,7 +1137,7 @@ var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
1135
1137
  const { canSave, handleSave } = useFormContext();
1136
1138
  return /* @__PURE__ */ React9.createElement("div", {
1137
1139
  role: "none",
1138
- className: mx6(outerSpacing === "scroll-fields" ? "pli-cardSpacingInline mbe-cardSpacingBlock" : outerSpacing ? cardSpacing : "mbs-cardSpacingBlock", "flex [&_button]:grow gap-1 first:mbs-0")
1140
+ className: mx5(outerSpacing === "scroll-fields" ? "pli-cardSpacingInline mbe-cardSpacingBlock" : outerSpacing ? cardSpacing : "mbs-cardSpacingBlock", "flex [&_button]:grow gap-1 first:mbs-0")
1139
1141
  }, onCancel && !readonly && /* @__PURE__ */ React9.createElement(IconButton2, {
1140
1142
  "data-testid": "cancel-button",
1141
1143
  icon: "ph--x--regular",
@@ -1160,20 +1162,10 @@ import { Schema, SchemaAST as SchemaAST4, pipe as pipe2 } from "effect";
1160
1162
  import { capitalize as capitalize2 } from "effect/String";
1161
1163
  import React12, { forwardRef, useMemo as useMemo5 } from "react";
1162
1164
  import { createJsonPath as createJsonPath3, findNode as findNode3, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
1163
- import { mx as mx8 } from "@dxos/react-ui-theme";
1165
+ import { mx as mx7 } from "@dxos/react-ui-theme";
1164
1166
  import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
1165
1167
  import { isNotFalsy } from "@dxos/util";
1166
1168
 
1167
- // src/components/Form/ArrayField.tsx
1168
- import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1169
- import { SchemaAST as SchemaAST3, pipe } from "effect";
1170
- import { capitalize } from "effect/String";
1171
- import React10, { Fragment, useCallback as useCallback7 } from "react";
1172
- import { findNode as findNode2, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
1173
- import { invariant as invariant2 } from "@dxos/invariant";
1174
- import { IconButton as IconButton3, useTranslation as useTranslation6 } from "@dxos/react-ui";
1175
- import { getSchemaProperties } from "@dxos/schema";
1176
-
1177
1169
  // src/util/field.ts
1178
1170
  import { FormatEnum, GeoLocation as GeoLocation2, TypeEnum } from "@dxos/echo-schema";
1179
1171
  var parseValue = ({ type, format, value }) => {
@@ -1482,6 +1474,14 @@ var getRefProps = (property) => {
1482
1474
  };
1483
1475
 
1484
1476
  // src/components/Form/ArrayField.tsx
1477
+ import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1478
+ import { SchemaAST as SchemaAST3, pipe } from "effect";
1479
+ import { capitalize } from "effect/String";
1480
+ import React10, { Fragment, useCallback as useCallback7 } from "react";
1481
+ import { SimpleType, findNode as findNode2, getDiscriminatedType, isDiscriminatedUnion } from "@dxos/effect";
1482
+ import { invariant as invariant2 } from "@dxos/invariant";
1483
+ import { IconButton as IconButton3, useTranslation as useTranslation6 } from "@dxos/react-ui";
1484
+ import { getSchemaProperties } from "@dxos/schema";
1485
1485
  var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
1486
1486
  var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponent }) => {
1487
1487
  var _effect = _useSignals10();
@@ -1491,7 +1491,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1491
1491
  const values = useFormValues(path ?? []) ?? [];
1492
1492
  invariant2(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
1493
1493
  F: __dxlog_file3,
1494
- L: 36,
1494
+ L: 37,
1495
1495
  S: void 0,
1496
1496
  A: [
1497
1497
  "Array.isArray(values)",
@@ -1578,16 +1578,35 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1578
1578
  }
1579
1579
  };
1580
1580
 
1581
+ // src/components/Form/factory.tsx
1582
+ import { FormatEnum as FormatEnum4 } from "@dxos/echo-schema";
1583
+ var getInputComponent = (type, format) => {
1584
+ switch (format) {
1585
+ case FormatEnum4.GeoPoint:
1586
+ return GeoPointInput;
1587
+ case FormatEnum4.Markdown:
1588
+ return MarkdownInput;
1589
+ }
1590
+ switch (type) {
1591
+ case "string":
1592
+ return TextInput;
1593
+ case "number":
1594
+ return NumberInput;
1595
+ case "boolean":
1596
+ return BooleanInput;
1597
+ }
1598
+ };
1599
+
1581
1600
  // src/components/Form/RefField.tsx
1582
1601
  import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
1583
1602
  import React11, { useCallback as useCallback8, useMemo as useMemo4 } from "react";
1584
- import { Expando, getTypeAnnotation, Ref, ReferenceAnnotationId as ReferenceAnnotationId2 } from "@dxos/echo-schema";
1603
+ import { Expando, Ref, ReferenceAnnotationId as ReferenceAnnotationId2, getTypeAnnotation } from "@dxos/echo-schema";
1585
1604
  import { findAnnotation as findAnnotation2 } from "@dxos/effect";
1586
1605
  import { DXN } from "@dxos/keys";
1587
1606
  import { DxRefTag } from "@dxos/lit-ui/react";
1588
1607
  import { Input as Input8, useTranslation as useTranslation7 } from "@dxos/react-ui";
1589
1608
  import { TagPicker } from "@dxos/react-ui-tag-picker";
1590
- import { descriptionText, mx as mx7 } from "@dxos/react-ui-theme";
1609
+ import { descriptionText, mx as mx6 } from "@dxos/react-ui-theme";
1591
1610
  import { isNonNullable as isNonNullable2 } from "@dxos/util";
1592
1611
  var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, getValue: getValue3, onBlur, onQueryRefOptions, onValueChange, ...restInputProps }) => {
1593
1612
  var _effect = _useSignals11();
@@ -1686,7 +1705,7 @@ var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, get
1686
1705
  }), /* @__PURE__ */ React11.createElement("div", {
1687
1706
  "data-no-submit": true
1688
1707
  }, disabled ? items.length < 1 ? /* @__PURE__ */ React11.createElement("p", {
1689
- className: mx7(descriptionText, "mbe-2")
1708
+ className: mx6(descriptionText, "mbe-2")
1690
1709
  }, t("empty readonly ref field label")) : items.map((item) => /* @__PURE__ */ React11.createElement(DxRefTag, {
1691
1710
  key: item.id,
1692
1711
  refid: item.id,
@@ -1745,25 +1764,6 @@ var RefFieldFallback = ({ type, label, disabled, placeholder, inputOnly, getValu
1745
1764
  }
1746
1765
  };
1747
1766
 
1748
- // src/components/Form/factory.tsx
1749
- import { FormatEnum as FormatEnum4 } from "@dxos/echo-schema";
1750
- var getInputComponent = (type, format) => {
1751
- switch (format) {
1752
- case FormatEnum4.GeoPoint:
1753
- return GeoPointInput;
1754
- case FormatEnum4.Markdown:
1755
- return MarkdownInput;
1756
- }
1757
- switch (type) {
1758
- case "string":
1759
- return TextInput;
1760
- case "number":
1761
- return NumberInput;
1762
- case "boolean":
1763
- return BooleanInput;
1764
- }
1765
- };
1766
-
1767
1767
  // src/components/Form/FormContent.tsx
1768
1768
  var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupComponent, Custom }) => {
1769
1769
  var _effect = _useSignals12();
@@ -1862,7 +1862,7 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
1862
1862
  const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode3(ast, SchemaAST4.isTypeLiteral);
1863
1863
  if (typeLiteral) {
1864
1864
  return /* @__PURE__ */ React12.createElement(React12.Fragment, null, !inline && /* @__PURE__ */ React12.createElement("h3", {
1865
- className: mx8("text-lg mlb-inputSpacingBlock first:mbs-0")
1865
+ className: mx7("text-lg mlb-inputSpacingBlock first:mbs-0")
1866
1866
  }, label), /* @__PURE__ */ React12.createElement(FormFields, {
1867
1867
  schema: Schema.make(typeLiteral),
1868
1868
  path,
@@ -1894,7 +1894,7 @@ var FormFields = /* @__PURE__ */ forwardRef(({ classNames, testId, schema, path,
1894
1894
  ]);
1895
1895
  return /* @__PURE__ */ React12.createElement("div", {
1896
1896
  role: "form",
1897
- className: mx8("is-full", classNames),
1897
+ className: mx7("is-full", classNames),
1898
1898
  ref: forwardRef2
1899
1899
  }, properties.map((property) => {
1900
1900
  return /* @__PURE__ */ React12.createElement(FormField, {
@@ -1957,7 +1957,7 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
1957
1957
  ],
1958
1958
  readonly,
1959
1959
  schema
1960
- }), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React13.createElement(FormActions, {
1960
+ }), (onCancel || onSave) && !autoSave && !readonly && /* @__PURE__ */ React13.createElement(FormActions, {
1961
1961
  readonly,
1962
1962
  onCancel,
1963
1963
  outerSpacing
@@ -1969,7 +1969,7 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
1969
1969
 
1970
1970
  // src/components/FieldEditor/FieldEditor.tsx
1971
1971
  var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
1972
- var FieldEditor = ({ projection, field, registry, onSave, onCancel, outerSpacing }) => {
1972
+ var FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel, outerSpacing }) => {
1973
1973
  var _effect = _useSignals14();
1974
1974
  try {
1975
1975
  const { t } = useTranslation8(translationKey);
@@ -2104,7 +2104,7 @@ var FieldEditor = ({ projection, field, registry, onSave, onCancel, outerSpacing
2104
2104
  props
2105
2105
  }, {
2106
2106
  F: __dxlog_file4,
2107
- L: 173,
2107
+ L: 182,
2108
2108
  S: void 0,
2109
2109
  C: (f, a) => f(...a)
2110
2110
  });
@@ -2113,6 +2113,7 @@ var FieldEditor = ({ projection, field, registry, onSave, onCancel, outerSpacing
2113
2113
  return /* @__PURE__ */ React14.createElement(Form, {
2114
2114
  key: field.id,
2115
2115
  autoFocus: true,
2116
+ readonly,
2116
2117
  values: props,
2117
2118
  schema: fieldSchema,
2118
2119
  filter: propIsNotType,
@@ -2141,13 +2142,14 @@ import { invariant as invariant3 } from "@dxos/invariant";
2141
2142
  import { Callout, IconButton as IconButton4, useTranslation as useTranslation9 } from "@dxos/react-ui";
2142
2143
  import { List as List2 } from "@dxos/react-ui-list";
2143
2144
  import { cardSpacing as cardSpacing3 } from "@dxos/react-ui-stack";
2144
- import { ghostHover, inputTextLabel, mx as mx9 } from "@dxos/react-ui-theme";
2145
- import { FieldSchema, VIEW_FIELD_LIMIT, ProjectionModel } from "@dxos/schema";
2145
+ import { inputTextLabel, mx as mx8, subtleHover as subtleHover2 } from "@dxos/react-ui-theme";
2146
+ import { FieldSchema, ProjectionModel, VIEW_FIELD_LIMIT } from "@dxos/schema";
2146
2147
  var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
2147
- var grid = "grid grid-cols-[32px_1fr_32px_32px] min-bs-[2.5rem]";
2148
+ var listGrid = "grid grid-cols-[min-content_1fr_min-content_min-content_min-content]";
2149
+ var listItemGrid = "grid grid-cols-subgrid col-span-5";
2148
2150
  var ViewMetaSchema = Schema2.Struct({
2149
2151
  typename: Format.URL.annotations({
2150
- title: "Typename"
2152
+ title: "Record type"
2151
2153
  })
2152
2154
  }).pipe(Schema2.mutable);
2153
2155
  var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, showHeading = false, onTypenameChanged, onDelete, outerSpacing = true }) => {
@@ -2161,7 +2163,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2161
2163
  schema,
2162
2164
  view.projection
2163
2165
  ]);
2164
- const [field, setField] = useState6();
2166
+ const [expandedField, setExpandedField] = useState6();
2165
2167
  const readonly = _readonly || !isMutable(schema);
2166
2168
  const viewValues = useMemo8(() => {
2167
2169
  return {
@@ -2172,26 +2174,23 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2172
2174
  }, [
2173
2175
  view.query.typename
2174
2176
  ]);
2175
- const handleSelect = useCallback10((field2) => {
2176
- if (readonly) {
2177
- return;
2178
- }
2179
- setField((f) => f === field2 ? void 0 : field2);
2177
+ const handleToggleField = useCallback10((field) => {
2178
+ setExpandedField((prevExpandedFieldId) => prevExpandedFieldId === field.id ? void 0 : field.id);
2180
2179
  }, [
2181
2180
  readonly
2182
2181
  ]);
2183
2182
  const handleAdd = useCallback10(() => {
2184
2183
  invariant3(!readonly, void 0, {
2185
2184
  F: __dxlog_file5,
2186
- L: 88,
2185
+ L: 86,
2187
2186
  S: void 0,
2188
2187
  A: [
2189
2188
  "!readonly",
2190
2189
  ""
2191
2190
  ]
2192
2191
  });
2193
- const field2 = projection.createFieldProjection();
2194
- setField(field2);
2192
+ const field = projection.createFieldProjection();
2193
+ setExpandedField(field.id);
2195
2194
  }, [
2196
2195
  schema,
2197
2196
  projection,
@@ -2200,7 +2199,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2200
2199
  const handleUpdate = useCallback10(({ typename }) => {
2201
2200
  invariant3(!readonly, void 0, {
2202
2201
  F: __dxlog_file5,
2203
- L: 95,
2202
+ L: 93,
2204
2203
  S: void 0,
2205
2204
  A: [
2206
2205
  "!readonly",
@@ -2220,26 +2219,26 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2220
2219
  const handleDelete = useCallback10((fieldId) => {
2221
2220
  invariant3(!readonly, void 0, {
2222
2221
  F: __dxlog_file5,
2223
- L: 107,
2222
+ L: 105,
2224
2223
  S: void 0,
2225
2224
  A: [
2226
2225
  "!readonly",
2227
2226
  ""
2228
2227
  ]
2229
2228
  });
2230
- if (fieldId === field?.id) {
2231
- setField(void 0);
2229
+ if (fieldId === expandedField) {
2230
+ setExpandedField(void 0);
2232
2231
  }
2233
2232
  onDelete?.(fieldId);
2234
2233
  }, [
2235
- field,
2234
+ expandedField,
2236
2235
  onDelete,
2237
2236
  readonly
2238
2237
  ]);
2239
2238
  const handleMove = useCallback10((fromIndex, toIndex) => {
2240
2239
  invariant3(!readonly, void 0, {
2241
2240
  F: __dxlog_file5,
2242
- L: 119,
2241
+ L: 117,
2243
2242
  S: void 0,
2244
2243
  A: [
2245
2244
  "!readonly",
@@ -2256,29 +2255,30 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2256
2255
  view.projection.fields,
2257
2256
  readonly
2258
2257
  ]);
2259
- const handleClose = useCallback10(() => setField(void 0), []);
2258
+ const handleClose = useCallback10(() => setExpandedField(void 0), []);
2260
2259
  const hiddenProperties = projection.getHiddenProperties();
2261
2260
  const handleHide = useCallback10((fieldId) => {
2262
- setField(void 0);
2261
+ setExpandedField(void 0);
2263
2262
  projection.hideFieldProjection(fieldId);
2264
2263
  }, [
2265
2264
  projection
2266
2265
  ]);
2267
2266
  const handleShow = useCallback10((property) => {
2268
- setField(void 0);
2267
+ setExpandedField(void 0);
2269
2268
  projection.showFieldProjection(property);
2270
2269
  }, [
2271
2270
  projection
2272
2271
  ]);
2273
2272
  return /* @__PURE__ */ React15.createElement("div", {
2274
2273
  role: "none",
2275
- className: mx9(classNames)
2276
- }, readonly && /* @__PURE__ */ React15.createElement("div", {
2277
- role: "none",
2278
- className: mx9("is-full", outerSpacing && "plb-cardSpacingBlock pli-cardSpacingInline")
2279
- }, /* @__PURE__ */ React15.createElement(Callout.Root, {
2280
- valence: "info"
2281
- }, /* @__PURE__ */ React15.createElement(Callout.Title, null, t("system schema description")))), /* @__PURE__ */ React15.createElement(Form, {
2274
+ className: mx8(classNames)
2275
+ }, readonly && /* @__PURE__ */ React15.createElement(Callout.Root, {
2276
+ valence: "info",
2277
+ classNames: [
2278
+ "is-full mlb-cardSpacingBlock",
2279
+ outerSpacing && "mli-cardSpacingInline"
2280
+ ]
2281
+ }, /* @__PURE__ */ React15.createElement(Callout.Title, null, t("system schema description"))), /* @__PURE__ */ React15.createElement(Form, {
2282
2282
  autoSave: true,
2283
2283
  schema: ViewMetaSchema,
2284
2284
  values: viewValues,
@@ -2288,63 +2288,82 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2288
2288
  }), /* @__PURE__ */ React15.createElement("div", {
2289
2289
  role: "none",
2290
2290
  className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
2291
- }, /* @__PURE__ */ React15.createElement("label", {
2292
- className: mx9(inputTextLabel)
2291
+ }, /* @__PURE__ */ React15.createElement("h2", {
2292
+ className: mx8(inputTextLabel)
2293
2293
  }, t("fields label")), /* @__PURE__ */ React15.createElement(List2.Root, {
2294
2294
  items: view.projection.fields,
2295
2295
  isItem: Schema2.is(FieldSchema),
2296
- getId: (field2) => field2.id,
2297
- readonly,
2298
- onMove: readonly ? void 0 : handleMove
2299
- }, ({ items: fields }) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, showHeading && /* @__PURE__ */ React15.createElement("div", {
2300
- role: "heading",
2301
- className: grid
2302
- }, /* @__PURE__ */ React15.createElement("div", null), /* @__PURE__ */ React15.createElement("div", {
2303
- className: "flex items-center text-sm"
2304
- }, t("field path label"))), /* @__PURE__ */ React15.createElement("div", {
2296
+ getId: (field) => field.id,
2297
+ onMove: readonly ? void 0 : handleMove,
2298
+ readonly
2299
+ }, ({ items: fields }) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, showHeading && /* @__PURE__ */ React15.createElement("h3", {
2300
+ className: "text-sm"
2301
+ }, t("field path label")), /* @__PURE__ */ React15.createElement("div", {
2305
2302
  role: "list",
2306
- className: "flex flex-col is-full"
2307
- }, fields?.map((field2) => /* @__PURE__ */ React15.createElement(List2.Item, {
2308
- key: field2.id,
2309
- item: field2,
2310
- classNames: mx9(grid, ghostHover, "overflow-hidden", !readonly && "cursor-pointer")
2311
- }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React15.createElement(List2.ItemTitle, {
2312
- onClick: () => handleSelect(field2)
2313
- }, field2.path), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
2303
+ className: listGrid
2304
+ }, fields?.map((field) => /* @__PURE__ */ React15.createElement(List2.Item, {
2305
+ key: field.id,
2306
+ item: field,
2307
+ classNames: listItemGrid,
2308
+ "aria-expanded": expandedField === field.id
2309
+ }, /* @__PURE__ */ React15.createElement("div", {
2310
+ role: "none",
2311
+ className: mx8(subtleHover2, listItemGrid, "rounded-sm cursor-pointer min-bs-10")
2312
+ }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, {
2313
+ disabled: readonly
2314
+ }), /* @__PURE__ */ React15.createElement(List2.ItemTitle, {
2315
+ onClick: () => handleToggleField(field)
2316
+ }, field.path), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
2317
+ label: t("hide field label"),
2314
2318
  "data-testid": "hide-field-button",
2315
2319
  icon: "ph--eye-slash--regular",
2320
+ autoHide: false,
2316
2321
  // TDOO(burdon): Is this the correct test?
2317
- disabled: view.projection.fields.length <= 1,
2318
- onClick: () => handleHide(field2.id)
2319
- }), !readonly && /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
2320
- disabled: view.projection.fields.length <= 1,
2321
- onClick: () => handleDelete(field2.id)
2322
- })))))), hiddenProperties.length > 0 && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement("label", {
2323
- className: mx9(inputTextLabel)
2322
+ disabled: readonly || view.projection.fields.length <= 1,
2323
+ onClick: () => handleHide(field.id)
2324
+ }), /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
2325
+ label: t("delete field label"),
2326
+ autoHide: false,
2327
+ disabled: readonly || view.projection.fields.length <= 1,
2328
+ onClick: () => handleDelete(field.id),
2329
+ "data-testid": "field.delete"
2330
+ }), /* @__PURE__ */ React15.createElement(IconButton4, {
2331
+ iconOnly: true,
2332
+ variant: "ghost",
2333
+ label: t("toggle expand label", {
2334
+ ns: "os"
2335
+ }),
2336
+ icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
2337
+ onClick: () => handleToggleField(field)
2338
+ })), expandedField === field.id && /* @__PURE__ */ React15.createElement("div", {
2339
+ role: "none",
2340
+ className: "col-span-5"
2341
+ }, /* @__PURE__ */ React15.createElement(FieldEditor, {
2342
+ readonly,
2343
+ projection,
2344
+ field,
2345
+ registry,
2346
+ onSave: handleClose
2347
+ }))))))), hiddenProperties.length > 0 && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement("h2", {
2348
+ className: mx8(inputTextLabel)
2324
2349
  }, t("hidden fields label")), /* @__PURE__ */ React15.createElement(List2.Root, {
2325
2350
  items: hiddenProperties,
2326
2351
  isItem: (item) => typeof item === "string",
2327
2352
  getId: (property) => property
2328
2353
  }, ({ items: properties }) => /* @__PURE__ */ React15.createElement("div", {
2329
2354
  role: "list",
2330
- className: "flex flex-col is-full"
2355
+ className: "grid grid-cols-[1fr_min-content]"
2331
2356
  }, properties?.map((property) => /* @__PURE__ */ React15.createElement(List2.Item, {
2332
2357
  key: property,
2333
2358
  item: property,
2334
- classNames: mx9(grid, ghostHover, !readonly && "cursor-pointer")
2335
- }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, {
2336
- disabled: true
2337
- }), /* @__PURE__ */ React15.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
2359
+ classNames: mx8("grid grid-cols-subgrid col-span-2 rounded-sm", subtleHover2)
2360
+ }, /* @__PURE__ */ React15.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
2361
+ label: t("show field label"),
2362
+ disabled: readonly,
2338
2363
  icon: "ph--eye--regular",
2339
2364
  onClick: () => handleShow(property),
2340
2365
  "data-testid": "show-field-button"
2341
- }))))))), field && /* @__PURE__ */ React15.createElement(FieldEditor, {
2342
- key: field.id,
2343
- projection,
2344
- field,
2345
- registry,
2346
- onSave: handleClose
2347
- }), !readonly && !field && /* @__PURE__ */ React15.createElement("div", {
2366
+ }))))))), !readonly && !expandedField && /* @__PURE__ */ React15.createElement("div", {
2348
2367
  role: "none",
2349
2368
  className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
2350
2369
  }, /* @__PURE__ */ React15.createElement(IconButton4, {
@@ -2353,7 +2372,7 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
2353
2372
  onClick: readonly ? void 0 : handleAdd,
2354
2373
  // TODO(burdon): Show field limit in ux (not tooltip).
2355
2374
  disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,
2356
- classNames: "flex is-full"
2375
+ classNames: "is-full"
2357
2376
  })));
2358
2377
  } finally {
2359
2378
  _effect.f();