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