@dxos/react-ui-form 0.13.0 → 0.14.0

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.
@@ -412,18 +412,19 @@ var useFormHandler = ({ schema, autoSave, fieldOverrides, values: valuesProp, de
412
412
  const validate = useCallback((values) => {
413
413
  if (!schema) return false;
414
414
  let errors = validateSchema(schema, values) ?? [];
415
+ if (errors.length === 0 && onValidate) errors = onValidate(values) ?? [];
416
+ setErrors(flatMap(errors));
417
+ const valid = errors.length === 0;
415
418
  log("validate", {
416
- values,
417
- errors
419
+ valid,
420
+ errorPaths: errors.map((error) => error.path)
418
421
  }, {
419
422
  "~LogMeta": "~LogMeta",
420
423
  F: __dxlog_file$5,
421
- L: 173,
424
+ L: 181,
422
425
  S: void 0
423
426
  });
424
- if (errors.length === 0 && onValidate) errors = onValidate(values) ?? [];
425
- setErrors(flatMap(errors));
426
- return errors.length === 0;
427
+ return valid;
427
428
  }, [schema, onValidate]);
428
429
  const [schemaChanged, setSchemaChanged] = useState(false);
429
430
  useEffect(() => setSchemaChanged(true), [schema]);
@@ -510,13 +511,10 @@ var useFormHandler = ({ schema, autoSave, fieldOverrides, values: valuesProp, de
510
511
  fieldOverrides
511
512
  ]);
512
513
  const onValueChange = useCallback((path, type, value) => {
513
- log("onValueChange", {
514
- path,
515
- value
516
- }, {
514
+ log("onValueChange", { path }, {
517
515
  "~LogMeta": "~LogMeta",
518
516
  F: __dxlog_file$5,
519
- L: 306,
517
+ L: 307,
520
518
  S: void 0
521
519
  });
522
520
  const jsonPath = SchemaEx.createJsonPath(path);
@@ -527,7 +525,7 @@ var useFormHandler = ({ schema, autoSave, fieldOverrides, values: valuesProp, de
527
525
  log.catch(err, void 0, {
528
526
  "~LogMeta": "~LogMeta",
529
527
  F: __dxlog_file$5,
530
- L: 316,
528
+ L: 317,
531
529
  S: void 0
532
530
  });
533
531
  parsedValue = void 0;
@@ -1867,6 +1865,7 @@ var ObjectPicker = ({ value, placeholder, trigger, loading, createSchema, create
1867
1865
  return /* @__PURE__ */ jsxs(Combobox.Root, {
1868
1866
  items,
1869
1867
  loading,
1868
+ positioning: { sameWidth: true },
1870
1869
  open,
1871
1870
  onOpenChange: handleOpenChange,
1872
1871
  value: value ? [value] : [],
@@ -2357,7 +2356,7 @@ var TitleRows = ({ label, ids, options, targets, icon, description, ordered, rea
2357
2356
  * searchable list of candidates with their descriptions and, when the caller can persist one, an inline create form
2358
2357
  * whose row takes `createOptionLabel` and `createOptionIcon`.
2359
2358
  */
2360
- var RefField = ({ type, readonly, label, placeholder, presentation, getValue, onValueChange, createInitialValuePath, createFieldMap, createOptionIcon, ...props }) => {
2359
+ var RefField = ({ type, readonly, label, placeholder, presentation, getValue, onValueChange, onBlur, createInitialValuePath, createFieldMap, createOptionIcon, ...props }) => {
2361
2360
  const { t } = Hooks.useTranslation(translationKey);
2362
2361
  const { typename, options, createSchema, createLabel, create } = useRefCandidates({
2363
2362
  ...props,
@@ -2381,9 +2380,15 @@ var RefField = ({ type, readonly, label, placeholder, presentation, getValue, on
2381
2380
  createIcon: createOptionIcon,
2382
2381
  onCreate: create && (async (values) => {
2383
2382
  const created = await create(values);
2384
- if (created) onValueChange(type, Ref.make(created));
2383
+ if (created) {
2384
+ onValueChange(type, Ref.make(created));
2385
+ onBlur();
2386
+ }
2385
2387
  }),
2386
- onSelect: (id) => onValueChange(type, id ? Ref.fromURI(URI.make(id)) : void 0)
2388
+ onSelect: (id) => {
2389
+ onValueChange(type, id ? Ref.fromURI(URI.make(id)) : void 0);
2390
+ onBlur();
2391
+ }
2387
2392
  });
2388
2393
  };
2389
2394
  //#endregion
@@ -3233,6 +3238,7 @@ var FormViewport = Util.composable(({ children, scroll, size, width = "document"
3233
3238
  ...props,
3234
3239
  gutter: gutter ?? defaultGutter ?? "sm",
3235
3240
  width: documentWidth,
3241
+ padBlock: true,
3236
3242
  ref: forwardedRef,
3237
3243
  children
3238
3244
  });