@dxos/react-ui-form 0.8.2-main.12df754 → 0.8.2-main.2f9c567

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 (56) hide show
  1. package/dist/lib/browser/index.mjs +291 -121
  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 +274 -107
  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 +291 -121
  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/Form/ArrayField.d.ts.map +1 -1
  11. package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Form.d.ts +6 -3
  13. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.stories.d.ts +37 -34
  15. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/FormContent.d.ts +14 -11
  17. package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/FormContext.d.ts +2 -2
  19. package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
  20. package/dist/types/src/components/Form/RefField.d.ts +24 -0
  21. package/dist/types/src/components/Form/RefField.d.ts.map +1 -0
  22. package/dist/types/src/components/Form/custom/GeoPointInput.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/index.d.ts +1 -0
  26. package/dist/types/src/components/Form/index.d.ts.map +1 -1
  27. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  28. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/deprecated/Form.d.ts +2 -2
  30. package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
  31. package/dist/types/src/hooks/index.d.ts +1 -0
  32. package/dist/types/src/hooks/index.d.ts.map +1 -1
  33. package/dist/types/src/hooks/useForm.d.ts +2 -2
  34. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  35. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +8 -0
  36. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +1 -0
  37. package/dist/types/src/util/formatting.d.ts.map +1 -1
  38. package/package.json +25 -25
  39. package/src/components/Form/ArrayField.tsx +8 -7
  40. package/src/components/Form/Defaults.tsx +4 -1
  41. package/src/components/Form/Form.stories.tsx +90 -42
  42. package/src/components/Form/Form.tsx +7 -2
  43. package/src/components/Form/FormContent.tsx +62 -19
  44. package/src/components/Form/FormContext.tsx +10 -2
  45. package/src/components/Form/RefField.tsx +152 -0
  46. package/src/components/Form/custom/GeoPointInput.tsx +2 -2
  47. package/src/components/Form/custom/SelectOptionsInput.stories.tsx +5 -4
  48. package/src/components/Form/custom/SelectOptionsInput.tsx +2 -2
  49. package/src/components/Form/index.ts +1 -1
  50. package/src/components/ViewEditor/ViewEditor.stories.tsx +3 -2
  51. package/src/components/ViewEditor/ViewEditor.tsx +12 -10
  52. package/src/components/deprecated/Form.tsx +6 -6
  53. package/src/hooks/index.ts +1 -0
  54. package/src/hooks/useForm.ts +3 -3
  55. package/src/hooks/useRefQueryLookupHandler.ts +43 -0
  56. package/src/util/formatting.ts +15 -3
@@ -183,9 +183,9 @@ var ControlFrameItem = ({ title, description, children }) => {
183
183
  };
184
184
 
185
185
  // packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
186
- import React13, { useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo7, useState as useState4 } from "react";
186
+ import React14, { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo7, useState as useState5 } from "react";
187
187
  import { FormatEnum as FormatEnum2, FormatEnums, formatToType } from "@dxos/echo-schema";
188
- import { log as log2 } from "@dxos/log";
188
+ import { log as log3 } from "@dxos/log";
189
189
  import { useTranslation as useTranslation6 } from "@dxos/react-ui";
190
190
  import { getFormatSchema, getSchemaProperties as getSchemaProperties3, sortProperties } from "@dxos/schema";
191
191
 
@@ -548,23 +548,28 @@ var BooleanInput = ({ type, label, inputOnly, getStatus, getValue: getValue3, on
548
548
  };
549
549
  var SelectInput = ({ type, label, inputOnly, disabled, placeholder, options, getStatus, getValue: getValue3, onValueChange }) => {
550
550
  const { status, error } = getStatus();
551
+ const value = getValue3();
552
+ const handleValueChange = useCallback3((value2) => onValueChange(type, value2), [
553
+ type,
554
+ onValueChange
555
+ ]);
551
556
  return /* @__PURE__ */ React7.createElement(Input6.Root, {
552
557
  validationValence: status
553
558
  }, !inputOnly && /* @__PURE__ */ React7.createElement(InputHeader, {
554
559
  error
555
560
  }, /* @__PURE__ */ React7.createElement(Input6.Label, null, label)), /* @__PURE__ */ React7.createElement(Select.Root, {
556
- value: getValue3(),
557
- onValueChange: (value) => onValueChange(type, value)
561
+ value,
562
+ onValueChange: handleValueChange
558
563
  }, /* @__PURE__ */ React7.createElement(Select.TriggerButton, {
559
564
  classNames: "is-full",
560
565
  disabled,
561
566
  placeholder
562
- }), /* @__PURE__ */ React7.createElement(Select.Portal, null, /* @__PURE__ */ React7.createElement(Select.Content, null, /* @__PURE__ */ React7.createElement(Select.Viewport, null, options?.map(({ value, label: label2 }) => (
567
+ }), /* @__PURE__ */ React7.createElement(Select.Portal, null, /* @__PURE__ */ React7.createElement(Select.Content, null, /* @__PURE__ */ React7.createElement(Select.Viewport, null, options?.map(({ value: value2, label: label2 }) => (
563
568
  // NOTE: Numeric values are converted to and from strings.
564
569
  /* @__PURE__ */ React7.createElement(Select.Option, {
565
- key: String(value),
566
- value: String(value)
567
- }, label2 ?? String(value))
570
+ key: String(value2),
571
+ value: String(value2)
572
+ }, label2 ?? String(value2))
568
573
  )))))), inputOnly && /* @__PURE__ */ React7.createElement(Input6.DescriptionAndValidation, null, error));
569
574
  };
570
575
  var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus, getValue: getValue3, onValueChange, onBlur }) => {
@@ -608,7 +613,7 @@ var MarkdownInput = ({ type, label, inputOnly, disabled, placeholder, getStatus,
608
613
  };
609
614
 
610
615
  // packages/ui/react-ui-form/src/components/Form/Form.tsx
611
- import React12, { useEffect as useEffect6, useMemo as useMemo6, useRef as useRef3 } from "react";
616
+ import React13, { useEffect as useEffect7, useMemo as useMemo6, useRef as useRef3 } from "react";
612
617
  import { mx as mx8 } from "@dxos/react-ui-theme";
613
618
 
614
619
  // packages/ui/react-ui-form/src/components/Form/FormActions.tsx
@@ -623,7 +628,7 @@ import { getValue as getValue2 } from "@dxos/echo-schema";
623
628
  import { createJsonPath as createJsonPath2 } from "@dxos/effect";
624
629
 
625
630
  // packages/ui/react-ui-form/src/hooks/useForm.ts
626
- import { SchemaAST as AST } from "effect";
631
+ import { SchemaAST } from "effect";
627
632
  import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo2, useState as useState3 } from "react";
628
633
  import { getValue, setValue } from "@dxos/echo-schema";
629
634
  import { createJsonPath, fromEffectValidationPath } from "@dxos/effect";
@@ -632,12 +637,12 @@ import { log } from "@dxos/log";
632
637
  import { validateSchema } from "@dxos/schema";
633
638
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.ts";
634
639
  var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave }) => {
635
- invariant(AST.isTypeLiteral(schema.ast), void 0, {
640
+ invariant(SchemaAST.isTypeLiteral(schema.ast), void 0, {
636
641
  F: __dxlog_file,
637
642
  L: 93,
638
643
  S: void 0,
639
644
  A: [
640
- "AST.isTypeLiteral(schema.ast)",
645
+ "SchemaAST.isTypeLiteral(schema.ast)",
641
646
  ""
642
647
  ]
643
648
  });
@@ -831,6 +836,35 @@ var flatMap = (errors) => {
831
836
  }, {});
832
837
  };
833
838
 
839
+ // packages/ui/react-ui-form/src/hooks/useRefQueryLookupHandler.ts
840
+ import { useCallback as useCallback5 } from "react";
841
+ import { getDXN } from "@dxos/echo-schema";
842
+ import { Filter } from "@dxos/react-client/echo";
843
+ import { isNonNullable } from "@dxos/util";
844
+ var useRefQueryLookupHandler = ({ space }) => {
845
+ const handleRefQueryLookup = useCallback5(async (typeInfo) => {
846
+ if (!space) {
847
+ return [];
848
+ }
849
+ const query = space.db.query(Filter.typename(typeInfo.typename));
850
+ const { objects } = await query.run();
851
+ return objects.map((object) => {
852
+ const dxn = getDXN(object);
853
+ if (!dxn) {
854
+ return void 0;
855
+ }
856
+ const item = {
857
+ dxn,
858
+ label: object?.name ?? object?.id ?? ""
859
+ };
860
+ return item;
861
+ }).filter(isNonNullable);
862
+ }, [
863
+ space
864
+ ]);
865
+ return handleRefQueryLookup;
866
+ };
867
+
834
868
  // packages/ui/react-ui-form/src/components/Form/FormContext.tsx
835
869
  var FormContext = /* @__PURE__ */ createContext(void 0);
836
870
  var useFormContext = () => {
@@ -922,20 +956,18 @@ var FormActions = ({ onCancel, readonly }) => {
922
956
  };
923
957
 
924
958
  // packages/ui/react-ui-form/src/components/Form/FormContent.tsx
925
- import { pipe as pipe2 } from "effect";
959
+ import { Schema, SchemaAST as SchemaAST3, pipe as pipe2 } from "effect";
926
960
  import { capitalize as capitalize2 } from "effect/String";
927
- import React11, { useMemo as useMemo5 } from "react";
928
- import { AST as AST3, S } from "@dxos/echo-schema";
961
+ import React12, { useMemo as useMemo5 } from "react";
929
962
  import { createJsonPath as createJsonPath3, findNode as findNode2, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
930
963
  import { mx as mx7 } from "@dxos/react-ui-theme";
931
964
  import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
932
965
  import { isNotFalsy } from "@dxos/util";
933
966
 
934
967
  // packages/ui/react-ui-form/src/components/Form/ArrayField.tsx
935
- import { pipe } from "effect";
968
+ import { SchemaAST as SchemaAST2, pipe } from "effect";
936
969
  import { capitalize } from "effect/String";
937
- import React10, { useCallback as useCallback5, useMemo as useMemo4 } from "react";
938
- import { AST as AST2 } from "@dxos/echo-schema";
970
+ import React10, { useCallback as useCallback6, useMemo as useMemo4 } from "react";
939
971
  import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
940
972
  import { invariant as invariant2 } from "@dxos/invariant";
941
973
  import { IconButton as IconButton3, useTranslation as useTranslation5 } from "@dxos/react-ui";
@@ -946,10 +978,10 @@ var padding = "px-2";
946
978
  var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponent }) => {
947
979
  const { t } = useTranslation5(translationKey);
948
980
  const { ast, name, type, title } = property;
949
- const values = useFormValues(path ?? []);
981
+ const values = useFormValues(path ?? []) ?? [];
950
982
  invariant2(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
951
983
  F: __dxlog_file2,
952
- L: 37,
984
+ L: 38,
953
985
  S: void 0,
954
986
  A: [
955
987
  "Array.isArray(values)",
@@ -957,11 +989,11 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
957
989
  ]
958
990
  });
959
991
  const label = title ?? pipe(name, capitalize);
960
- const tupleType = findNode(ast, AST2.isTupleType);
992
+ const tupleType = findNode(ast, SchemaAST2.isTupleType);
961
993
  const elementType = tupleType?.rest[0]?.type;
962
994
  const getDefaultObjectValue = (typeNode) => {
963
995
  const baseNode = findNode(typeNode, isDiscriminatedUnion);
964
- const typeLiteral = baseNode ? getDiscriminatedType(baseNode, {}) : findNode(typeNode, AST2.isTypeLiteral);
996
+ const typeLiteral = baseNode ? getDiscriminatedType(baseNode, {}) : findNode(typeNode, SchemaAST2.isTypeLiteral);
965
997
  if (!typeLiteral) {
966
998
  return {};
967
999
  }
@@ -980,7 +1012,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
980
1012
  type,
981
1013
  elementType
982
1014
  ]);
983
- const handleAdd = useCallback5(() => {
1015
+ const handleAdd = useCallback6(() => {
984
1016
  inputProps.onValueChange(type, [
985
1017
  ...values,
986
1018
  newValue
@@ -992,7 +1024,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
992
1024
  newValue,
993
1025
  values
994
1026
  ]);
995
- const handleRemove = useCallback5((index) => {
1027
+ const handleRemove = useCallback6((index) => {
996
1028
  const newValues = values.filter((_, i) => i !== index);
997
1029
  inputProps.onValueChange(type, newValues);
998
1030
  }, [
@@ -1046,6 +1078,108 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1046
1078
  })));
1047
1079
  };
1048
1080
 
1081
+ // packages/ui/react-ui-form/src/components/Form/RefField.tsx
1082
+ import React11, { useEffect as useEffect6, useState as useState4 } from "react";
1083
+ import { Expando, getTypeAnnotation, Ref, ReferenceAnnotationId } from "@dxos/echo-schema";
1084
+ import { findAnnotation } from "@dxos/effect";
1085
+ import { DXN } from "@dxos/keys";
1086
+ import { refFromDXN } from "@dxos/live-object";
1087
+ import { log as log2 } from "@dxos/log";
1088
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/Form/RefField.tsx";
1089
+ var RefField = ({ ast, type, label, readonly, placeholder, inline, onQueryRefOptions, inputProps }) => {
1090
+ const { getValue: getValue3, onValueChange, ...restInputProps } = inputProps;
1091
+ const refTypeInfo = findAnnotation(ast, ReferenceAnnotationId);
1092
+ const [refOptions, setRefOptions] = useState4([]);
1093
+ const [loading, setLoading] = useState4(false);
1094
+ useEffect6(() => {
1095
+ if (!refTypeInfo || !onQueryRefOptions) {
1096
+ return;
1097
+ }
1098
+ const fetchOptions = async () => {
1099
+ setLoading(true);
1100
+ try {
1101
+ const options = await onQueryRefOptions(refTypeInfo);
1102
+ setRefOptions(options.map((option) => ({
1103
+ label: option.label,
1104
+ value: option.dxn.toString()
1105
+ })));
1106
+ } catch (error) {
1107
+ log2.error("Failed to fetch ref options:", error, {
1108
+ F: __dxlog_file3,
1109
+ L: 69,
1110
+ S: void 0,
1111
+ C: (f, a) => f(...a)
1112
+ });
1113
+ setRefOptions([]);
1114
+ } finally {
1115
+ setLoading(false);
1116
+ }
1117
+ };
1118
+ void fetchOptions();
1119
+ }, [
1120
+ refTypeInfo,
1121
+ onQueryRefOptions
1122
+ ]);
1123
+ if (!refTypeInfo) {
1124
+ return null;
1125
+ }
1126
+ if (refTypeInfo.typename === getTypeAnnotation(Expando)?.typename || !onQueryRefOptions) {
1127
+ const handleOnValueChange = (_type, dxnString) => {
1128
+ const dxn = DXN.tryParse(dxnString);
1129
+ if (dxn) {
1130
+ onValueChange?.("object", refFromDXN(dxn));
1131
+ } else if (dxnString === "") {
1132
+ onValueChange?.("object", void 0);
1133
+ } else {
1134
+ onValueChange?.("string", dxnString);
1135
+ }
1136
+ };
1137
+ const handleGetValue2 = () => {
1138
+ const formValue = getValue3();
1139
+ if (typeof formValue === "string") {
1140
+ return formValue;
1141
+ }
1142
+ if (Ref.isRef(formValue)) {
1143
+ return formValue.dxn.toString();
1144
+ }
1145
+ return void 0;
1146
+ };
1147
+ return /* @__PURE__ */ React11.createElement(TextInput, {
1148
+ type,
1149
+ label,
1150
+ disabled: readonly,
1151
+ placeholder,
1152
+ inputOnly: inline,
1153
+ getValue: handleGetValue2,
1154
+ onValueChange: handleOnValueChange,
1155
+ ...restInputProps
1156
+ });
1157
+ }
1158
+ const handleGetValue = () => {
1159
+ const formValue = getValue3();
1160
+ if (Ref.isRef(formValue)) {
1161
+ return formValue.dxn.toString();
1162
+ }
1163
+ return void 0;
1164
+ };
1165
+ const handleValueChanged = (_type, dxnString) => {
1166
+ const dxn = DXN.parse(dxnString);
1167
+ const ref = refFromDXN(dxn);
1168
+ onValueChange("object", ref);
1169
+ };
1170
+ return /* @__PURE__ */ React11.createElement(SelectInput, {
1171
+ type,
1172
+ label,
1173
+ disabled: readonly || loading,
1174
+ placeholder: loading ? "Loading options..." : placeholder,
1175
+ inputOnly: inline,
1176
+ getValue: handleGetValue,
1177
+ onValueChange: handleValueChanged,
1178
+ options: refOptions,
1179
+ ...restInputProps
1180
+ });
1181
+ };
1182
+
1049
1183
  // packages/ui/react-ui-form/src/components/Form/factory.tsx
1050
1184
  import { FormatEnum } from "@dxos/echo-schema";
1051
1185
  var getInputComponent = (type, format) => {
@@ -1066,7 +1200,7 @@ var getInputComponent = (type, format) => {
1066
1200
  };
1067
1201
 
1068
1202
  // packages/ui/react-ui-form/src/components/Form/FormContent.tsx
1069
- var FormField = ({ property, path, readonly, inline, lookupComponent, Custom }) => {
1203
+ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupComponent, Custom }) => {
1070
1204
  const inputProps = useInputProps(path);
1071
1205
  const { ast, name, type, format, title, description, options, examples, array } = property;
1072
1206
  const label = useMemo5(() => title ?? pipe2(name, capitalize2), [
@@ -1079,7 +1213,7 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1079
1213
  ]);
1080
1214
  const FoundComponent = lookupComponent?.({
1081
1215
  prop: name,
1082
- schema: S.make(ast),
1216
+ schema: Schema.make(ast),
1083
1217
  inputProps: {
1084
1218
  type,
1085
1219
  format,
@@ -1090,14 +1224,14 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1090
1224
  }
1091
1225
  });
1092
1226
  if (FoundComponent) {
1093
- return /* @__PURE__ */ React11.createElement("div", {
1227
+ return /* @__PURE__ */ React12.createElement("div", {
1094
1228
  role: "none"
1095
1229
  }, FoundComponent);
1096
1230
  }
1097
1231
  const jsonPath = createJsonPath3(path ?? []);
1098
1232
  const CustomComponent = Custom?.[jsonPath];
1099
1233
  if (CustomComponent) {
1100
- return /* @__PURE__ */ React11.createElement(CustomComponent, {
1234
+ return /* @__PURE__ */ React12.createElement(CustomComponent, {
1101
1235
  type,
1102
1236
  format,
1103
1237
  label,
@@ -1108,7 +1242,7 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1108
1242
  });
1109
1243
  }
1110
1244
  if (array) {
1111
- return /* @__PURE__ */ React11.createElement(ArrayField, {
1245
+ return /* @__PURE__ */ React12.createElement(ArrayField, {
1112
1246
  property,
1113
1247
  path,
1114
1248
  inputProps,
@@ -1118,9 +1252,9 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1118
1252
  }
1119
1253
  const InputComponent = getInputComponent(type, format);
1120
1254
  if (InputComponent) {
1121
- return /* @__PURE__ */ React11.createElement("div", {
1255
+ return /* @__PURE__ */ React12.createElement("div", {
1122
1256
  role: "none"
1123
- }, /* @__PURE__ */ React11.createElement(InputComponent, {
1257
+ }, /* @__PURE__ */ React12.createElement(InputComponent, {
1124
1258
  type,
1125
1259
  format,
1126
1260
  label,
@@ -1131,9 +1265,9 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1131
1265
  }));
1132
1266
  }
1133
1267
  if (options) {
1134
- return /* @__PURE__ */ React11.createElement("div", {
1268
+ return /* @__PURE__ */ React12.createElement("div", {
1135
1269
  role: "none"
1136
- }, /* @__PURE__ */ React11.createElement(SelectInput, {
1270
+ }, /* @__PURE__ */ React12.createElement(SelectInput, {
1137
1271
  type,
1138
1272
  format,
1139
1273
  disabled: readonly,
@@ -1147,23 +1281,39 @@ var FormField = ({ property, path, readonly, inline, lookupComponent, Custom })
1147
1281
  ...inputProps
1148
1282
  }));
1149
1283
  }
1284
+ if (format === "ref") {
1285
+ return /* @__PURE__ */ React12.createElement(RefField, {
1286
+ ast,
1287
+ type,
1288
+ label,
1289
+ readonly,
1290
+ placeholder,
1291
+ inline,
1292
+ onQueryRefOptions,
1293
+ inputProps
1294
+ });
1295
+ }
1150
1296
  if (type === "object") {
1151
1297
  const baseNode = findNode2(ast, isDiscriminatedUnion2);
1152
- const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode2(ast, AST3.isTypeLiteral);
1298
+ const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode2(ast, SchemaAST3.isTypeLiteral);
1153
1299
  if (typeLiteral) {
1154
- return /* @__PURE__ */ React11.createElement("div", {
1300
+ return /* @__PURE__ */ React12.createElement("div", {
1155
1301
  role: "none"
1156
- }, !inline && /* @__PURE__ */ React11.createElement("div", null, label), /* @__PURE__ */ React11.createElement(FormFields, {
1157
- schema: S.make(typeLiteral),
1302
+ }, !inline && /* @__PURE__ */ React12.createElement("h3", {
1303
+ className: "text-lg mbs-2 mbe-1"
1304
+ }, label), /* @__PURE__ */ React12.createElement(FormFields, {
1305
+ schema: Schema.make(typeLiteral),
1158
1306
  path,
1159
1307
  readonly,
1160
- Custom
1308
+ onQueryRefOptions,
1309
+ Custom,
1310
+ lookupComponent
1161
1311
  }));
1162
1312
  }
1163
1313
  }
1164
1314
  return null;
1165
1315
  };
1166
- var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custom }) => {
1316
+ var FormFields = ({ schema, path, filter, sort, readonly, onQueryRefOptions, lookupComponent, Custom }) => {
1167
1317
  const values = useFormValues(path);
1168
1318
  const properties = useMemo5(() => {
1169
1319
  const props = getSchemaProperties2(schema.ast, values);
@@ -1175,11 +1325,11 @@ var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custo
1175
1325
  filter,
1176
1326
  sort
1177
1327
  ]);
1178
- return /* @__PURE__ */ React11.createElement("div", {
1328
+ return /* @__PURE__ */ React12.createElement("div", {
1179
1329
  role: "form",
1180
1330
  className: mx7("flex flex-col w-full gap-2")
1181
1331
  }, properties.map((property) => {
1182
- return /* @__PURE__ */ React11.createElement(FormField, {
1332
+ return /* @__PURE__ */ React12.createElement(FormField, {
1183
1333
  key: property.name,
1184
1334
  property,
1185
1335
  path: [
@@ -1187,6 +1337,7 @@ var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custo
1187
1337
  property.name
1188
1338
  ],
1189
1339
  readonly,
1340
+ onQueryRefOptions,
1190
1341
  lookupComponent,
1191
1342
  Custom
1192
1343
  });
@@ -1194,13 +1345,13 @@ var FormFields = ({ schema, path, filter, sort, readonly, lookupComponent, Custo
1194
1345
  };
1195
1346
 
1196
1347
  // packages/ui/react-ui-form/src/components/Form/Form.tsx
1197
- var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel, lookupComponent, Custom }) => {
1348
+ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel, onQueryRefOptions, lookupComponent, Custom }) => {
1198
1349
  const formRef = useRef3(null);
1199
1350
  const onValid = useMemo6(() => autoSave ? onSave : void 0, [
1200
1351
  autoSave,
1201
1352
  onSave
1202
1353
  ]);
1203
- useEffect6(() => {
1354
+ useEffect7(() => {
1204
1355
  if (autoFocus && formRef.current) {
1205
1356
  const input = formRef.current.querySelector("input");
1206
1357
  if (input) {
@@ -1210,7 +1361,7 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
1210
1361
  }, [
1211
1362
  autoFocus
1212
1363
  ]);
1213
- return /* @__PURE__ */ React12.createElement(FormProvider, {
1364
+ return /* @__PURE__ */ React13.createElement(FormProvider, {
1214
1365
  formRef,
1215
1366
  schema,
1216
1367
  autoSave,
@@ -1219,36 +1370,37 @@ var Form = ({ classNames, schema, values: initialValues, path = [], autoFocus, r
1219
1370
  onValidate,
1220
1371
  onValid,
1221
1372
  onSave
1222
- }, /* @__PURE__ */ React12.createElement("div", {
1373
+ }, /* @__PURE__ */ React13.createElement("div", {
1223
1374
  ref: formRef,
1224
1375
  role: "none",
1225
1376
  className: mx8("p-2", classNames),
1226
1377
  "data-testid": testId
1227
- }, /* @__PURE__ */ React12.createElement(FormFields, {
1378
+ }, /* @__PURE__ */ React13.createElement(FormFields, {
1228
1379
  schema,
1229
1380
  path,
1230
1381
  readonly,
1231
1382
  filter,
1232
1383
  sort,
1384
+ onQueryRefOptions,
1233
1385
  lookupComponent,
1234
1386
  Custom
1235
- }), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React12.createElement(FormActions, {
1387
+ }), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React13.createElement(FormActions, {
1236
1388
  onCancel,
1237
1389
  readonly
1238
1390
  })));
1239
1391
  };
1240
1392
 
1241
1393
  // packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx
1242
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
1394
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
1243
1395
  var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1244
1396
  const { t } = useTranslation6(translationKey);
1245
- const [props, setProps] = useState4(projection.getFieldProjection(field.id).props);
1246
- useEffect7(() => setProps(projection.getFieldProjection(field.id).props), [
1397
+ const [props, setProps] = useState5(projection.getFieldProjection(field.id).props);
1398
+ useEffect8(() => setProps(projection.getFieldProjection(field.id).props), [
1247
1399
  field,
1248
1400
  projection
1249
1401
  ]);
1250
- const [schemas, setSchemas] = useState4([]);
1251
- useEffect7(() => {
1402
+ const [schemas, setSchemas] = useState5([]);
1403
+ useEffect8(() => {
1252
1404
  if (!registry) {
1253
1405
  return;
1254
1406
  }
@@ -1266,17 +1418,17 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1266
1418
  }, [
1267
1419
  registry
1268
1420
  ]);
1269
- const [referenceSchema, setReferenceSchema] = useState4();
1270
- useEffect7(() => {
1421
+ const [referenceSchema, setReferenceSchema] = useState5();
1422
+ useEffect8(() => {
1271
1423
  setReferenceSchema(schemas.find((schema) => schema.typename === props?.referenceSchema));
1272
1424
  }, [
1273
1425
  schemas,
1274
1426
  props?.referenceSchema
1275
1427
  ]);
1276
- const [{ fieldSchema }, setFieldSchema] = useState4({
1428
+ const [{ fieldSchema }, setFieldSchema] = useState5({
1277
1429
  fieldSchema: getFormatSchema(props?.format)
1278
1430
  });
1279
- const handleValuesChanged = useCallback6((_props) => {
1431
+ const handleValuesChanged = useCallback7((_props) => {
1280
1432
  setFieldSchema((prev) => {
1281
1433
  const fieldSchema2 = getFormatSchema(_props.format);
1282
1434
  if (prev.fieldSchema === fieldSchema2) {
@@ -1311,7 +1463,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1311
1463
  props.format,
1312
1464
  props.referenceSchema
1313
1465
  ]);
1314
- const handleValidate = useCallback6(({ property }) => {
1466
+ const handleValidate = useCallback7(({ property }) => {
1315
1467
  if (property && view.fields.find((f) => f.path === property && f.path !== field.path)) {
1316
1468
  return [
1317
1469
  {
@@ -1324,7 +1476,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1324
1476
  view.fields,
1325
1477
  field
1326
1478
  ]);
1327
- const handleSave = useCallback6((props2) => {
1479
+ const handleSave = useCallback7((props2) => {
1328
1480
  projection.setFieldProjection({
1329
1481
  field,
1330
1482
  props: props2
@@ -1335,51 +1487,51 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1335
1487
  field,
1336
1488
  onSave
1337
1489
  ]);
1338
- const handleCancel = useCallback6(() => {
1490
+ const handleCancel = useCallback7(() => {
1339
1491
  requestAnimationFrame(() => onCancel?.());
1340
1492
  onSave();
1341
1493
  }, [
1342
1494
  onSave
1343
1495
  ]);
1344
1496
  const Custom = useMemo7(() => ({
1345
- ["format"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
1497
+ ["format"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
1346
1498
  ...props2,
1347
1499
  options: FormatEnums.filter((value) => value !== FormatEnum2.None).map((value) => ({
1348
1500
  value,
1349
1501
  label: t(`format ${value}`)
1350
1502
  }))
1351
1503
  }),
1352
- ["referenceSchema"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
1504
+ ["referenceSchema"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
1353
1505
  ...props2,
1354
1506
  options: schemas.map((schema) => ({
1355
1507
  value: schema.typename
1356
1508
  }))
1357
1509
  }),
1358
- ["referencePath"]: (props2) => /* @__PURE__ */ React13.createElement(SelectInput, {
1510
+ ["referencePath"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
1359
1511
  ...props2,
1360
1512
  options: referenceSchema ? getSchemaProperties3(referenceSchema.ast).sort(sortProperties).map((p) => ({
1361
1513
  value: p.name
1362
1514
  })) : []
1363
1515
  }),
1364
- ["options"]: (props2) => /* @__PURE__ */ React13.createElement(SelectOptionInput, props2)
1516
+ ["options"]: (props2) => /* @__PURE__ */ React14.createElement(SelectOptionInput, props2)
1365
1517
  }), [
1366
1518
  t,
1367
1519
  schemas,
1368
1520
  referenceSchema
1369
1521
  ]);
1370
- const propIsNotType = useCallback6((props2) => props2.filter((p) => p.name !== "type"), []);
1522
+ const propIsNotType = useCallback7((props2) => props2.filter((p) => p.name !== "type"), []);
1371
1523
  if (!fieldSchema) {
1372
- log2.warn("invalid format", {
1524
+ log3.warn("invalid format", {
1373
1525
  props
1374
1526
  }, {
1375
- F: __dxlog_file3,
1527
+ F: __dxlog_file4,
1376
1528
  L: 174,
1377
1529
  S: void 0,
1378
1530
  C: (f, a) => f(...a)
1379
1531
  });
1380
1532
  return null;
1381
1533
  }
1382
- return /* @__PURE__ */ React13.createElement(Form, {
1534
+ return /* @__PURE__ */ React14.createElement(Form, {
1383
1535
  key: field.id,
1384
1536
  autoFocus: true,
1385
1537
  values: props,
@@ -1398,30 +1550,31 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel }) => {
1398
1550
  };
1399
1551
 
1400
1552
  // packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx
1401
- import React14, { useCallback as useCallback7, useMemo as useMemo8, useState as useState5 } from "react";
1402
- import { AST as AST4, Format, S as S2 } from "@dxos/echo-schema";
1553
+ import { Schema as Schema2, SchemaAST as SchemaAST4 } from "effect";
1554
+ import React15, { useCallback as useCallback8, useMemo as useMemo8, useState as useState6 } from "react";
1555
+ import { Format } from "@dxos/echo-schema";
1403
1556
  import { invariant as invariant3 } from "@dxos/invariant";
1404
1557
  import { IconButton as IconButton4, useTranslation as useTranslation7 } from "@dxos/react-ui";
1405
1558
  import { List as List2 } from "@dxos/react-ui-list";
1406
1559
  import { ghostHover, inputTextLabel, mx as mx9 } from "@dxos/react-ui-theme";
1407
1560
  import { FieldSchema, ViewProjection, VIEW_FIELD_LIMIT } from "@dxos/schema";
1408
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
1561
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
1409
1562
  var grid = "grid grid-cols-[32px_1fr_32px] min-bs-[2.5rem]";
1410
- var ViewMetaSchema = S2.Struct({
1411
- name: S2.String.annotations({
1412
- [AST4.TitleAnnotationId]: "View"
1563
+ var ViewMetaSchema = Schema2.Struct({
1564
+ name: Schema2.String.annotations({
1565
+ [SchemaAST4.TitleAnnotationId]: "View"
1413
1566
  }),
1414
1567
  typename: Format.URL.annotations({
1415
- [AST4.TitleAnnotationId]: "Typename"
1568
+ [SchemaAST4.TitleAnnotationId]: "Typename"
1416
1569
  })
1417
- }).pipe(S2.mutable);
1570
+ }).pipe(Schema2.mutable);
1418
1571
  var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading = false, onTypenameChanged, onDelete }) => {
1419
1572
  const { t } = useTranslation7(translationKey);
1420
1573
  const projection = useMemo8(() => new ViewProjection(schema.jsonSchema, view), [
1421
1574
  schema,
1422
1575
  view
1423
1576
  ]);
1424
- const [field, setField] = useState5();
1577
+ const [field, setField] = useState6();
1425
1578
  const viewValues = useMemo8(() => {
1426
1579
  return {
1427
1580
  name: view.name,
@@ -1432,13 +1585,13 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1432
1585
  }, [
1433
1586
  view
1434
1587
  ]);
1435
- const handleSelect = useCallback7((field2) => {
1588
+ const handleSelect = useCallback8((field2) => {
1436
1589
  setField((f) => f === field2 ? void 0 : field2);
1437
1590
  }, []);
1438
- const handleAdd = useCallback7(() => {
1591
+ const handleAdd = useCallback8(() => {
1439
1592
  invariant3(!schema.readonly, void 0, {
1440
- F: __dxlog_file4,
1441
- L: 76,
1593
+ F: __dxlog_file5,
1594
+ L: 77,
1442
1595
  S: void 0,
1443
1596
  A: [
1444
1597
  "!schema.readonly",
@@ -1451,10 +1604,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1451
1604
  schema,
1452
1605
  view
1453
1606
  ]);
1454
- const handleUpdate = useCallback7(({ name, typename }) => {
1607
+ const handleUpdate = useCallback8(({ name, typename }) => {
1455
1608
  invariant3(!schema.readonly, void 0, {
1456
- F: __dxlog_file4,
1457
- L: 83,
1609
+ F: __dxlog_file5,
1610
+ L: 84,
1458
1611
  S: void 0,
1459
1612
  A: [
1460
1613
  "!schema.readonly",
@@ -1474,10 +1627,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1474
1627
  view,
1475
1628
  onTypenameChanged
1476
1629
  ]);
1477
- const handleDelete = useCallback7((fieldId) => {
1630
+ const handleDelete = useCallback8((fieldId) => {
1478
1631
  invariant3(!schema.readonly, void 0, {
1479
- F: __dxlog_file4,
1480
- L: 99,
1632
+ F: __dxlog_file5,
1633
+ L: 100,
1481
1634
  S: void 0,
1482
1635
  A: [
1483
1636
  "!schema.readonly",
@@ -1493,10 +1646,10 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1493
1646
  field,
1494
1647
  onDelete
1495
1648
  ]);
1496
- const handleMove = useCallback7((fromIndex, toIndex) => {
1649
+ const handleMove = useCallback8((fromIndex, toIndex) => {
1497
1650
  invariant3(!schema.readonly, void 0, {
1498
- F: __dxlog_file4,
1499
- L: 111,
1651
+ F: __dxlog_file5,
1652
+ L: 112,
1500
1653
  S: void 0,
1501
1654
  A: [
1502
1655
  "!schema.readonly",
@@ -1513,91 +1666,95 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly, showHeading =
1513
1666
  schema,
1514
1667
  view.fields
1515
1668
  ]);
1516
- const handleClose = useCallback7(() => setField(void 0), []);
1669
+ const handleClose = useCallback8(() => setField(void 0), []);
1517
1670
  const hiddenProperties = projection.getHiddenProperties();
1518
- const handleHide = useCallback7((fieldId) => {
1671
+ const handleHide = useCallback8((fieldId) => {
1519
1672
  setField(void 0);
1520
1673
  projection.hideFieldProjection(fieldId);
1521
1674
  }, [
1522
1675
  projection
1523
1676
  ]);
1524
- const handleShow = useCallback7((property) => {
1677
+ const handleShow = useCallback8((property) => {
1525
1678
  setField(void 0);
1526
1679
  projection.showFieldProjection(property);
1527
1680
  }, [
1528
1681
  projection
1529
1682
  ]);
1530
- return /* @__PURE__ */ React14.createElement("div", {
1683
+ return /* @__PURE__ */ React15.createElement("div", {
1531
1684
  role: "none",
1532
- className: mx9("flex flex-col w-full divide-y divide-separator", classNames)
1533
- }, /* @__PURE__ */ React14.createElement(Form, {
1685
+ className: mx9("grid grid-rows-[1fr_1fr] min-bs-0", classNames)
1686
+ }, /* @__PURE__ */ React15.createElement(Form, {
1534
1687
  autoSave: true,
1535
1688
  schema: ViewMetaSchema,
1536
1689
  values: viewValues,
1537
- onSave: schema.readonly ? void 0 : handleUpdate
1538
- }), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", {
1690
+ onSave: schema.readonly ? void 0 : handleUpdate,
1691
+ classNames: "min-bs-0 overflow-y-auto"
1692
+ }), /* @__PURE__ */ React15.createElement("div", {
1693
+ role: "none",
1694
+ className: "border-bs border-separator min-bs-0 overflow-y-auto"
1695
+ }, /* @__PURE__ */ React15.createElement("div", {
1539
1696
  role: "none",
1540
1697
  className: "p-2"
1541
- }, /* @__PURE__ */ React14.createElement("label", {
1698
+ }, /* @__PURE__ */ React15.createElement("label", {
1542
1699
  className: mx9(inputTextLabel)
1543
- }, t("fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
1700
+ }, t("fields label"))), /* @__PURE__ */ React15.createElement(List2.Root, {
1544
1701
  items: view.fields,
1545
- isItem: S2.is(FieldSchema),
1702
+ isItem: Schema2.is(FieldSchema),
1546
1703
  getId: (field2) => field2.id,
1547
1704
  onMove: schema.readonly ? void 0 : handleMove
1548
- }, ({ items: fields }) => /* @__PURE__ */ React14.createElement(React14.Fragment, null, showHeading && /* @__PURE__ */ React14.createElement("div", {
1705
+ }, ({ items: fields }) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, showHeading && /* @__PURE__ */ React15.createElement("div", {
1549
1706
  role: "heading",
1550
1707
  className: grid
1551
- }, /* @__PURE__ */ React14.createElement("div", null), /* @__PURE__ */ React14.createElement("div", {
1708
+ }, /* @__PURE__ */ React15.createElement("div", null), /* @__PURE__ */ React15.createElement("div", {
1552
1709
  className: "flex items-center text-sm"
1553
- }, t("field path label"))), /* @__PURE__ */ React14.createElement("div", {
1710
+ }, t("field path label"))), /* @__PURE__ */ React15.createElement("div", {
1554
1711
  role: "list",
1555
1712
  className: "flex flex-col w-full"
1556
- }, fields?.map((field2) => /* @__PURE__ */ React14.createElement(List2.Item, {
1713
+ }, fields?.map((field2) => /* @__PURE__ */ React15.createElement(List2.Item, {
1557
1714
  key: field2.id,
1558
1715
  item: field2,
1559
1716
  classNames: mx9(grid, ghostHover, "cursor-pointer")
1560
- }, /* @__PURE__ */ React14.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, {
1717
+ }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, null), /* @__PURE__ */ React15.createElement(List2.ItemTitle, {
1561
1718
  onClick: () => handleSelect(field2)
1562
- }, field2.path), /* @__PURE__ */ React14.createElement("div", {
1719
+ }, field2.path), /* @__PURE__ */ React15.createElement("div", {
1563
1720
  className: "flex items-center gap-2 -ml-4"
1564
- }, /* @__PURE__ */ React14.createElement(List2.ItemButton, {
1721
+ }, /* @__PURE__ */ React15.createElement(List2.ItemButton, {
1565
1722
  icon: "ph--eye-slash--regular",
1566
1723
  disabled: view.fields.length <= 1,
1567
1724
  onClick: () => handleHide(field2.id)
1568
- }), !schema.readonly && /* @__PURE__ */ React14.createElement(List2.ItemDeleteButton, {
1725
+ }), !schema.readonly && /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
1569
1726
  icon: "ph--trash--regular",
1570
1727
  disabled: view.fields.length <= 1,
1571
1728
  onClick: () => handleDelete(field2.id)
1572
- }))))))), hiddenProperties.length > 0 && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", {
1729
+ }))))))), hiddenProperties.length > 0 && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement("div", {
1573
1730
  role: "none",
1574
1731
  className: "p-2"
1575
- }, /* @__PURE__ */ React14.createElement("label", {
1732
+ }, /* @__PURE__ */ React15.createElement("label", {
1576
1733
  className: mx9(inputTextLabel)
1577
- }, t("hidden fields label"))), /* @__PURE__ */ React14.createElement(List2.Root, {
1734
+ }, t("hidden fields label"))), /* @__PURE__ */ React15.createElement(List2.Root, {
1578
1735
  items: hiddenProperties,
1579
1736
  isItem: (item) => typeof item === "string",
1580
1737
  getId: (property) => property
1581
- }, ({ items: properties }) => /* @__PURE__ */ React14.createElement("div", {
1738
+ }, ({ items: properties }) => /* @__PURE__ */ React15.createElement("div", {
1582
1739
  role: "list",
1583
1740
  className: "flex flex-col w-full"
1584
- }, properties?.map((property) => /* @__PURE__ */ React14.createElement(List2.Item, {
1741
+ }, properties?.map((property) => /* @__PURE__ */ React15.createElement(List2.Item, {
1585
1742
  key: property,
1586
1743
  item: property,
1587
1744
  classNames: mx9(grid, ghostHover, "cursor-pointer")
1588
- }, /* @__PURE__ */ React14.createElement("div", null), /* @__PURE__ */ React14.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React14.createElement(List2.ItemButton, {
1745
+ }, /* @__PURE__ */ React15.createElement("div", null), /* @__PURE__ */ React15.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
1589
1746
  icon: "ph--eye--regular",
1590
1747
  onClick: () => handleShow(property)
1591
- }))))))), field && /* @__PURE__ */ React14.createElement(FieldEditor, {
1748
+ }))))))), field && /* @__PURE__ */ React15.createElement(FieldEditor, {
1592
1749
  key: field.id,
1593
1750
  view,
1594
1751
  projection,
1595
1752
  field,
1596
1753
  registry,
1597
1754
  onSave: handleClose
1598
- }), !readonly && !field && /* @__PURE__ */ React14.createElement("div", {
1755
+ }), !readonly && !field && /* @__PURE__ */ React15.createElement("div", {
1599
1756
  className: "flex p-2 justify-center"
1600
- }, /* @__PURE__ */ React14.createElement(IconButton4, {
1757
+ }, /* @__PURE__ */ React15.createElement(IconButton4, {
1601
1758
  icon: "ph--plus--regular",
1602
1759
  label: t("button add property"),
1603
1760
  onClick: schema.readonly ? void 0 : handleAdd,
@@ -1782,13 +1939,25 @@ var formatForDisplay = ({ type, format, value, locale = void 0 }) => {
1782
1939
  });
1783
1940
  }
1784
1941
  case FormatEnum4.Date: {
1785
- return formatDate(new Date(value), "yyyy-MM-dd");
1942
+ try {
1943
+ return formatDate(new Date(value), "yyyy-MM-dd");
1944
+ } catch (error) {
1945
+ return "Invalid Date";
1946
+ }
1786
1947
  }
1787
1948
  case FormatEnum4.Time: {
1788
- return formatDate(new Date(value), "HH:mm:ss");
1949
+ try {
1950
+ return formatDate(new Date(value), "HH:mm:ss");
1951
+ } catch (error) {
1952
+ return "Invalid Time";
1953
+ }
1789
1954
  }
1790
1955
  case FormatEnum4.DateTime: {
1791
- return formatDate(new Date(value), "yyyy-MM-dd HH:mm:ss");
1956
+ try {
1957
+ return formatDate(new Date(value), "yyyy-MM-dd HH:mm:ss");
1958
+ } catch (error) {
1959
+ return "Invalid DateTime";
1960
+ }
1792
1961
  }
1793
1962
  case FormatEnum4.GeoPoint: {
1794
1963
  if (value === null || value === void 0) {
@@ -1898,6 +2067,7 @@ export {
1898
2067
  useForm,
1899
2068
  useFormContext,
1900
2069
  useFormValues,
1901
- useInputProps
2070
+ useInputProps,
2071
+ useRefQueryLookupHandler
1902
2072
  };
1903
2073
  //# sourceMappingURL=index.mjs.map