@dxos/react-ui-form 0.8.4-main.406dc2a → 0.8.4-main.548089c

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 (37) hide show
  1. package/dist/lib/browser/index.mjs +30 -23
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +30 -23
  5. package/dist/lib/node-esm/index.mjs.map +3 -3
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +2 -3
  8. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +1 -1
  9. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +2 -3
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/Form/Form.d.ts +2 -1
  12. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  13. package/dist/types/src/components/Form/Form.stories.d.ts +3 -4
  14. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  15. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +2 -3
  16. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
  17. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +2 -3
  18. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +5 -5
  20. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  21. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +4 -5
  22. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  23. package/dist/types/src/translations.d.ts +2 -3
  24. package/dist/types/src/translations.d.ts.map +1 -1
  25. package/dist/types/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +32 -31
  27. package/src/components/Form/Defaults.tsx +1 -1
  28. package/src/components/Form/Form.stories.tsx +3 -3
  29. package/src/components/Form/Form.tsx +3 -1
  30. package/src/components/Form/FormActions.tsx +2 -2
  31. package/src/components/Form/custom/SelectOptionsInput.tsx +1 -1
  32. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +5 -5
  33. package/src/components/ViewEditor/ViewEditor.stories.tsx +11 -10
  34. package/src/components/ViewEditor/ViewEditor.test.tsx +2 -2
  35. package/src/components/ViewEditor/ViewEditor.tsx +10 -7
  36. package/src/translations.ts +2 -3
  37. package/src/util/refs.ts +5 -5
@@ -8,7 +8,7 @@ var translations = [
8
8
  "hidden fields label": "Hidden Fields",
9
9
  "empty readonly ref field label": "(none)",
10
10
  // TODO(burdon): Standardize field/property.
11
- "button add property": "Add property",
11
+ "add property button": "Add property",
12
12
  "field property label": "Property",
13
13
  "field property placeholder": "Property name",
14
14
  "field format label": "Type",
@@ -25,8 +25,7 @@ var translations = [
25
25
  "ref field placeholder_one": "Select\u2026",
26
26
  "ref field placeholder_other": "Select items\u2026",
27
27
  // TODO(burdon): Factor out?
28
- "button cancel": "Cancel",
29
- "button save": "Save",
28
+ "save button": "Save",
30
29
  // FormatEnum
31
30
  "format boolean": "Boolean",
32
31
  "format currency": "Currency",
@@ -472,7 +471,7 @@ var SelectOptionInput = ({ type, label, readonly, getStatus, getValue: getValue3
472
471
  readonly: !!readonly
473
472
  }, ({ items }) => /* @__PURE__ */ React4.createElement("div", {
474
473
  role: "list",
475
- className: "w-full overflow-auto"
474
+ className: "is-full overflow-auto"
476
475
  }, items?.map((item) => /* @__PURE__ */ React4.createElement("div", {
477
476
  key: item.id
478
477
  }, /* @__PURE__ */ React4.createElement(List.Item, {
@@ -708,7 +707,7 @@ var MarkdownInput = ({ type, label, inputOnly, readonly, placeholder, getStatus,
708
707
  disabled: !!readonly,
709
708
  placeholder,
710
709
  value: getValue3() ?? "",
711
- classNames: "min-bs-auto max-h-40 overflow-auto",
710
+ classNames: "min-bs-auto max-bs-40 overflow-auto",
712
711
  onChange: (event) => onValueChange(type, event.target.value),
713
712
  onBlur,
714
713
  style: {
@@ -1117,14 +1116,14 @@ var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
1117
1116
  }, onCancel && !readonly && /* @__PURE__ */ React8.createElement(IconButton2, {
1118
1117
  "data-testid": "cancel-button",
1119
1118
  icon: "ph--x--regular",
1120
- label: t("button cancel"),
1119
+ label: t("cancel button"),
1121
1120
  onClick: onCancel
1122
1121
  }), handleSave && /* @__PURE__ */ React8.createElement(IconButton2, {
1123
1122
  type: "submit",
1124
1123
  "data-testid": "save-button",
1125
1124
  disabled: !canSave,
1126
1125
  icon: "ph--check--regular",
1127
- label: t("button save"),
1126
+ label: t("save button"),
1128
1127
  onClick: handleSave
1129
1128
  }));
1130
1129
  } finally {
@@ -1418,12 +1417,6 @@ var findArrayElementType = (ast) => {
1418
1417
  // src/util/refs.ts
1419
1418
  var getRefProps = (property) => {
1420
1419
  const { ast, format, array } = property;
1421
- if (format === FormatEnum3.Ref) {
1422
- return {
1423
- ast,
1424
- isArray: false
1425
- };
1426
- }
1427
1420
  if (array) {
1428
1421
  const elementType = findArrayElementType(ast);
1429
1422
  if (elementType) {
@@ -1436,6 +1429,12 @@ var getRefProps = (property) => {
1436
1429
  }
1437
1430
  }
1438
1431
  }
1432
+ if (format === FormatEnum3.Ref) {
1433
+ return {
1434
+ ast,
1435
+ isArray: false
1436
+ };
1437
+ }
1439
1438
  return void 0;
1440
1439
  };
1441
1440
 
@@ -2060,7 +2059,7 @@ var FormFields = /* @__PURE__ */ forwardRef2(({ classNames, schema, path, filter
2060
2059
  });
2061
2060
 
2062
2061
  // src/components/Form/Form.tsx
2063
- var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, autoSave, outerSpacing = true, schema, onCancel, onValuesChanged, onValidate, onSave, ...props }) => {
2062
+ var Form = ({ classNames, id, testId, values: initialValues, autoFocus, readonly, autoSave, outerSpacing = true, schema, onCancel, onValuesChanged, onValidate, onSave, ...props }) => {
2064
2063
  var _effect = _useSignals13();
2065
2064
  try {
2066
2065
  const formRef = useRef3(null);
@@ -2095,6 +2094,9 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
2095
2094
  }, /* @__PURE__ */ React13.createElement("div", {
2096
2095
  role: "none",
2097
2096
  className: "contents",
2097
+ ...id && {
2098
+ "data-object-id": id
2099
+ },
2098
2100
  "data-testid": testId
2099
2101
  }, /* @__PURE__ */ React13.createElement(FormFields, {
2100
2102
  ...props,
@@ -2328,12 +2330,17 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2328
2330
  title: "Query"
2329
2331
  })
2330
2332
  });
2331
- if (mode === "query") {
2332
- return Schema2.Struct({
2333
+ if (mode === "query" || mode === "named-query") {
2334
+ const name = Schema2.Struct({
2333
2335
  name: Schema2.optional(Schema2.String.annotations({
2334
2336
  title: "Name"
2335
- })),
2336
- ...base.fields,
2337
+ }))
2338
+ });
2339
+ return Schema2.Struct({
2340
+ ...mode === "named-query" ? {
2341
+ ...name.fields,
2342
+ ...base.fields
2343
+ } : base.fields,
2337
2344
  target: Schema2.optional(Schema2.String.annotations({
2338
2345
  title: "Target Queue"
2339
2346
  }))
@@ -2361,7 +2368,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2361
2368
  const handleAdd = useCallback13(() => {
2362
2369
  invariant3(!readonly, void 0, {
2363
2370
  F: __dxlog_file5,
2364
- L: 131,
2371
+ L: 134,
2365
2372
  S: void 0,
2366
2373
  A: [
2367
2374
  "!readonly",
@@ -2378,7 +2385,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2378
2385
  const handleUpdate = useCallback13((values) => {
2379
2386
  invariant3(!readonly, void 0, {
2380
2387
  F: __dxlog_file5,
2381
- L: 138,
2388
+ L: 141,
2382
2389
  S: void 0,
2383
2390
  A: [
2384
2391
  "!readonly",
@@ -2403,7 +2410,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2403
2410
  const handleDelete = useCallback13((fieldId) => {
2404
2411
  invariant3(!readonly, void 0, {
2405
2412
  F: __dxlog_file5,
2406
- L: 154,
2413
+ L: 157,
2407
2414
  S: void 0,
2408
2415
  A: [
2409
2416
  "!readonly",
@@ -2422,7 +2429,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2422
2429
  const handleMove = useCallback13((fromIndex, toIndex) => {
2423
2430
  invariant3(!readonly, void 0, {
2424
2431
  F: __dxlog_file5,
2425
- L: 166,
2432
+ L: 169,
2426
2433
  S: void 0,
2427
2434
  A: [
2428
2435
  "!readonly",
@@ -2544,7 +2551,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2544
2551
  className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
2545
2552
  }, /* @__PURE__ */ React15.createElement(IconButton4, {
2546
2553
  icon: "ph--plus--regular",
2547
- label: t("button add property"),
2554
+ label: t("add property button"),
2548
2555
  onClick: readonly ? void 0 : handleAdd,
2549
2556
  // TODO(burdon): Show field limit in ux (not tooltip).
2550
2557
  disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,