@dxos/react-ui-form 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d

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 (63) hide show
  1. package/dist/lib/browser/index.mjs +184 -171
  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 +184 -171
  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 +4 -4
  9. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +2 -2
  11. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
  13. package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.d.ts +2 -2
  15. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  17. package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/FormContent.d.ts +1 -1
  19. package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
  20. package/dist/types/src/components/Form/FormContext.d.ts +1 -1
  21. package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
  22. package/dist/types/src/components/Form/RefField.d.ts +1 -1
  23. package/dist/types/src/components/Form/RefField.d.ts.map +1 -1
  24. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
  25. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
  26. package/dist/types/src/components/Form/factory.d.ts.map +1 -1
  27. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +2 -2
  28. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  29. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +3 -3
  30. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  31. package/dist/types/src/components/deprecated/Form.d.ts +3 -3
  32. package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
  33. package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
  34. package/dist/types/src/hooks/useForm.d.ts +1 -1
  35. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  36. package/dist/types/src/translations.d.ts +3 -2
  37. package/dist/types/src/translations.d.ts.map +1 -1
  38. package/dist/types/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +30 -29
  40. package/src/components/ControlSection/ControlSection.stories.tsx +2 -1
  41. package/src/components/FieldEditor/FieldEditor.stories.tsx +16 -13
  42. package/src/components/FieldEditor/FieldEditor.test.tsx +14 -13
  43. package/src/components/FieldEditor/FieldEditor.tsx +11 -11
  44. package/src/components/Form/ArrayField.tsx +8 -7
  45. package/src/components/Form/Defaults.tsx +2 -1
  46. package/src/components/Form/Form.stories.tsx +4 -3
  47. package/src/components/Form/Form.tsx +4 -3
  48. package/src/components/Form/FormActions.tsx +2 -1
  49. package/src/components/Form/FormContent.tsx +6 -5
  50. package/src/components/Form/FormContext.tsx +5 -5
  51. package/src/components/Form/RefField.tsx +6 -5
  52. package/src/components/Form/custom/GeoPointInput.tsx +2 -2
  53. package/src/components/Form/custom/SelectOptionsInput.stories.tsx +3 -2
  54. package/src/components/Form/custom/SelectOptionsInput.tsx +28 -29
  55. package/src/components/Form/factory.tsx +1 -1
  56. package/src/components/ViewEditor/ViewEditor.stories.tsx +19 -12
  57. package/src/components/ViewEditor/ViewEditor.test.tsx +18 -15
  58. package/src/components/ViewEditor/ViewEditor.tsx +81 -81
  59. package/src/components/deprecated/Form.stories.tsx +6 -5
  60. package/src/components/deprecated/Form.tsx +6 -6
  61. package/src/hooks/useForm.ts +5 -3
  62. package/src/hooks/useRefQueryLookupHandler.ts +1 -1
  63. package/src/translations.ts +3 -2
@@ -2,16 +2,16 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { SchemaAST, type Schema, Option, pipe } from 'effect';
5
+ import { Option, type Schema, SchemaAST, pipe } from 'effect';
6
6
  import React, { useState } from 'react';
7
7
 
8
8
  import { findProperty } from '@dxos/effect';
9
- import { Input, type ThemedClassName, type TextInputProps as NativeTextInputProps } from '@dxos/react-ui';
9
+ import { Input, type TextInputProps as NativeTextInputProps, type ThemedClassName } from '@dxos/react-ui';
10
10
  import { mx } from '@dxos/react-ui-theme';
11
- import { type ViewType, getFieldValue, setFieldValue } from '@dxos/schema';
11
+ import { type Projection, getFieldValue, setFieldValue } from '@dxos/schema';
12
12
 
13
13
  export type DeprecatedFormProps<T extends {} = {}> = ThemedClassName<{
14
- view: ViewType;
14
+ projection: Projection;
15
15
  object: T;
16
16
  schema?: Schema.Schema<T>;
17
17
  readonly?: boolean;
@@ -22,14 +22,14 @@ export type DeprecatedFormProps<T extends {} = {}> = ThemedClassName<{
22
22
  */
23
23
  export const DeprecatedForm = <T extends {} = {}>({
24
24
  classNames,
25
- view,
25
+ projection,
26
26
  object,
27
27
  schema,
28
28
  readonly,
29
29
  }: DeprecatedFormProps<T>) => {
30
30
  return (
31
31
  <div role='none' className={mx('flex flex-col w-full gap-2 p-2', classNames)}>
32
- {view.fields.map((field) => {
32
+ {projection.fields.map((field) => {
33
33
  const prop = schema && findProperty(schema, field.path);
34
34
  const title = (prop && pipe(SchemaAST.getTitleAnnotation(prop), Option.getOrUndefined)) ?? '';
35
35
  const description = (prop && pipe(SchemaAST.getDescriptionAnnotation(prop), Option.getOrUndefined)) ?? title;
@@ -2,14 +2,14 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { SchemaAST, type Schema } from 'effect';
5
+ import { type Schema, SchemaAST } from 'effect';
6
6
  import { useCallback, useEffect, useMemo, useState } from 'react';
7
7
 
8
8
  import { type BaseObject, getValue, setValue } from '@dxos/echo-schema';
9
- import { type SimpleType, type JsonPath, createJsonPath, fromEffectValidationPath } from '@dxos/effect';
9
+ import { type JsonPath, type SimpleType, createJsonPath, fromEffectValidationPath } from '@dxos/effect';
10
10
  import { invariant } from '@dxos/invariant';
11
11
  import { log } from '@dxos/log';
12
- import { validateSchema, type ValidationError } from '@dxos/schema';
12
+ import { type ValidationError, validateSchema } from '@dxos/schema';
13
13
  import { type MaybePromise } from '@dxos/util';
14
14
 
15
15
  /**
@@ -26,6 +26,8 @@ export type FormHandler<T extends BaseObject> = {
26
26
  changed: Record<JsonPath, boolean>;
27
27
  canSave: boolean;
28
28
  formIsValid: boolean;
29
+
30
+ // TODO(burdon): Return onSave.
29
31
  handleSave: () => void;
30
32
 
31
33
  //
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { useCallback } from 'react';
6
6
 
7
- import { getObjectDXN, type TypeAnnotation } from '@dxos/echo-schema';
7
+ import { type TypeAnnotation, getObjectDXN } from '@dxos/echo-schema';
8
8
  import { Filter, type Space } from '@dxos/react-client/echo';
9
9
  import { isNonNullable } from '@dxos/util';
10
10
 
@@ -25,6 +25,7 @@ export const translations = [
25
25
  'field limit reached': 'Maximum number of fields reached',
26
26
  'boolean input true value': 'Yes',
27
27
  'boolean input false value': 'No',
28
+ 'delete field label': 'Delete field',
28
29
 
29
30
  // TODO(burdon): Factor out?
30
31
  'button cancel': 'Cancel',
@@ -72,8 +73,8 @@ export const translations = [
72
73
  'select option add': 'Add option',
73
74
 
74
75
  // System schema message.
75
- 'system schema title': 'System Schema',
76
- 'system schema description': 'This is a system schema and cannot be modified.',
76
+ 'system schema title': 'System record type',
77
+ 'system schema description': 'This is a system record type and cannot be modified.',
77
78
  },
78
79
  },
79
80
  },