@dxos/react-ui-form 0.7.2 → 0.7.3-staging.0905f03

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 (33) hide show
  1. package/dist/lib/browser/index.mjs +228 -58
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +228 -57
  5. package/dist/lib/node/index.cjs.map +3 -3
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +228 -58
  8. package/dist/lib/node-esm/index.mjs.map +3 -3
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +2 -2
  11. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Defaults.d.ts +4 -4
  13. package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.d.ts +11 -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 +20 -5
  17. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/Input.d.ts +5 -4
  19. package/dist/types/src/components/Form/Input.d.ts.map +1 -1
  20. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  21. package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
  22. package/dist/types/src/hooks/useForm.d.ts +19 -11
  23. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  24. package/package.json +23 -22
  25. package/src/components/FieldEditor/FieldEditor.stories.tsx +3 -3
  26. package/src/components/FieldEditor/FieldEditor.tsx +8 -8
  27. package/src/components/Form/Defaults.tsx +28 -13
  28. package/src/components/Form/Form.stories.tsx +81 -19
  29. package/src/components/Form/Form.tsx +216 -29
  30. package/src/components/Form/Input.tsx +5 -4
  31. package/src/components/ViewEditor/ViewEditor.tsx +8 -7
  32. package/src/components/deprecated/Form.stories.tsx +4 -4
  33. package/src/hooks/useForm.ts +65 -32
@@ -14,14 +14,23 @@ export type FormProps<T extends BaseObject> = ThemedClassName<{
14
14
  filter?: PropsFilter<T>;
15
15
  sort?: PropertyKey<T>[];
16
16
  autoSave?: boolean;
17
+ testId?: string;
17
18
  onCancel?: () => void;
18
19
  /**
19
20
  * Map of custom renderers for specific properties.
20
21
  */
21
22
  Custom?: Partial<Record<string, InputComponent<T>>>;
22
- } & Pick<FormOptions<T>, 'schema' | 'onValuesChanged' | 'onValidate' | 'onSubmit'>>;
23
+ } & Pick<FormOptions<T>, 'schema' | 'onValuesChanged' | 'onValidate' | 'onSave'>>;
23
24
  /**
24
25
  * General purpose form component that displays field controls based on the given schema.
25
26
  */
26
- export declare const Form: <T extends BaseObject>({ classNames, schema, values: initialValues, path, readonly, filter, sort, autoSave, onValuesChanged, onValidate, onSubmit, onCancel, Custom, }: FormProps<T>) => React.JSX.Element;
27
+ export declare const Form: <T extends BaseObject>({ classNames, schema, values: initialValues, path, readonly, filter, sort, autoSave, testId, onValuesChanged, onValidate, onSave, onCancel, Custom, }: FormProps<T>) => React.JSX.Element;
28
+ type FormActionsProps = {
29
+ readonly?: boolean;
30
+ canSubmit: boolean;
31
+ onCancel?: () => void;
32
+ onSubmit: () => void;
33
+ };
34
+ export declare const FormActions: ({ onCancel, onSubmit, canSubmit, readonly }: FormActionsProps) => React.JSX.Element;
35
+ export {};
27
36
  //# sourceMappingURL=Form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAElD,OAAO,EAAO,KAAK,UAAU,EAAK,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAc,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAuB,KAAK,c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AE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,gDAAiD,gBAAgB,sBAsBxF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import '@dxos-theme';
2
2
  import { type Meta, type StoryObj } from '@storybook/react';
3
- import { S } from '@dxos/echo-schema';
3
+ import { type BaseObject, S } from '@dxos/echo-schema';
4
+ import { Testing } from '@dxos/schema/testing';
4
5
  import { type FormProps } from './Form';
5
6
  declare const TestSchema: S.mutable<S.Struct<{
6
7
  name: S.optional<S.SchemaClass<string, string, never>>;
@@ -15,11 +16,14 @@ declare const TestSchema: S.mutable<S.Struct<{
15
16
  }>>;
16
17
  }>>;
17
18
  type TestType = S.Schema.Type<typeof TestSchema>;
18
- type StoryProps = FormProps<TestType>;
19
- declare const meta: Meta<StoryProps>;
19
+ type StoryProps<T extends BaseObject> = {
20
+ schema: S.Schema<T>;
21
+ } & FormProps<T>;
22
+ declare const meta: Meta<StoryProps<any>>;
20
23
  export default meta;
21
- type Story = StoryObj<StoryProps>;
22
- export declare const Default: Story;
24
+ type Story<T extends BaseObject> = StoryObj<StoryProps<T>>;
25
+ export declare const Default: Story<TestType>;
26
+ export declare const Org: Story<Testing.OrgSchemaType>;
23
27
  declare const ShapeSchema: S.mutable<S.Struct<{
24
28
  shape: S.optional<S.Union<[S.Struct<{
25
29
  type: S.Literal<["circle"]>;
@@ -32,4 +36,15 @@ declare const ShapeSchema: S.mutable<S.Struct<{
32
36
  type ShapeType = S.Schema.Type<typeof ShapeSchema>;
33
37
  type DiscriminatedUnionStoryProps = FormProps<ShapeType>;
34
38
  export declare const DiscriminatedShape: StoryObj<DiscriminatedUnionStoryProps>;
39
+ declare const ArraysSchema: S.mutable<S.Struct<{
40
+ names: S.Array$<S.filter<S.Schema<string, string, never>>>;
41
+ addresses: S.Array$<S.Struct<{
42
+ street: S.optional<S.SchemaClass<string, string, never>>;
43
+ city: S.optional<S.SchemaClass<string, string, never>>;
44
+ zip: S.optional<S.refine<string, S.Schema<string, string, never>>>;
45
+ location: S.optional<S.Tuple<[S.refine<number, S.Schema<number, number, never>>, S.refine<number, S.Schema<number, number, never>>, S.Element<typeof S.Number, "?">]>>;
46
+ }>>;
47
+ }>>;
48
+ type ArraysType = S.Schema.Type<typeof ArraysSchema>;
49
+ export declare const Arrays: StoryObj<FormProps<ArraysType>>;
35
50
  //# sourceMappingURL=Form.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAK9C,QAAA,MAAM,UAAU;;;;;;;;;;;GAaE,CAAC;AAEnB,KAAK,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAEjD,KAAK,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAiBtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAQ1B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAElC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;GAaC,CAAC;AAEnB,KAAK,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AACnD,KAAK,4BAA4B,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;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CAAC,SAAS,CAAC,CAAC;AAgCzD,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,4BAA4B,CAUrE,CAAC;AAEF,QAAA,MAAM,YAAY;;;;;;;;GAGA,CAAC;AAEnB,KAAK,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC;AAiBrD,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAQlD,CAAC"}
@@ -1,17 +1,18 @@
1
1
  import React, { type FC, type PropsWithChildren } from 'react';
2
- import { type BaseObject, type FormatEnum, type PropertyKey } from '@dxos/echo-schema';
2
+ import { type BaseObject, type FormatEnum } from '@dxos/echo-schema';
3
3
  import { type SimpleType } from '@dxos/effect';
4
- import { type FormHandler } from '../../hooks';
4
+ import { type FormPath, type FormHandler } from '../../hooks';
5
5
  /**
6
6
  * Props passed to input components.
7
7
  */
8
8
  export type InputProps<T extends BaseObject> = {
9
- property: PropertyKey<T>;
9
+ property: FormPath<T>;
10
10
  type: SimpleType;
11
11
  format?: FormatEnum;
12
- label: string;
12
+ label?: string;
13
13
  disabled?: boolean;
14
14
  placeholder?: string;
15
+ inputOnly?: boolean;
15
16
  } & Pick<FormHandler<T>, 'getStatus' | 'getValue' | 'onValueChange' | 'onBlur'>;
16
17
  /**
17
18
  * Form input component.
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Input.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;A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6EAQpB,eAAe,sBA0GjB,CAAC"}
1
+ {"version":3,"file":"ViewEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/ViewEditor/ViewEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAe,KAAK,aAAa,EAAK,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAc,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAGlF,OAAO,EAA+B,KAAK,QAAQ,EAAoC,MAAM,cAAc,CAAC;AAoB5G,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC;IAC5C,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU,6EAQpB,eAAe,sBA2GjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Form.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/deprecated/Form.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAkC,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrF,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,QAAQ,CAAC;AAIlE,QAAA,MAAM,YAAY,UAAW,mBAAmB,sBAM/C,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAQnC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAErD,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC"}
1
+ {"version":3,"file":"Form.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/deprecated/Form.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAkC,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrF,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAIlE,QAAA,MAAM,YAAY,UAAW,mBAAmB,sBAM/C,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAQnC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAErD,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC"}
@@ -2,29 +2,37 @@ import { type FocusEvent } from 'react';
2
2
  import { type BaseObject, type PropertyKey } from '@dxos/echo-schema';
3
3
  import { type SimpleType, type S } from '@dxos/effect';
4
4
  import { type ValidationError } from '@dxos/schema';
5
+ import { type MaybePromise } from '@dxos/util';
6
+ export type FormPath<T extends object = {}> = PropertyKey<T> | `${PropertyKey<T>}.${number}`;
5
7
  /**
6
8
  * Return type from `useForm` hook.
7
9
  */
8
10
  export type FormHandler<T extends BaseObject> = {
9
11
  values: T;
10
- errors: Record<PropertyKey<T>, string>;
11
- touched: Record<PropertyKey<T>, boolean>;
12
- changed: Record<PropertyKey<T>, boolean>;
13
- canSubmit: boolean;
14
- handleSubmit: () => void;
15
- getStatus: (property: PropertyKey<T>) => {
12
+ errors: Record<FormPath<T>, string>;
13
+ touched: Record<FormPath<T>, boolean>;
14
+ changed: Record<FormPath<T>, boolean>;
15
+ canSave: boolean;
16
+ handleSave: () => void;
17
+ getStatus: (property: FormPath<T>) => {
16
18
  status?: 'error';
17
19
  error?: string;
18
20
  };
19
- getValue: <V>(property: PropertyKey<T>) => V;
20
- onValueChange: <V>(property: PropertyKey<T>, type: SimpleType, value: V) => void;
21
+ getValue: <V>(property: FormPath<T>) => V;
22
+ onValueChange: <V>(property: FormPath<T>, type: SimpleType, value: V) => void;
21
23
  onBlur: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
22
24
  };
23
25
  /**
24
26
  * Hook options.
25
27
  */
26
28
  export interface FormOptions<T extends BaseObject> {
29
+ /**
30
+ * Effect schema.
31
+ */
27
32
  schema: S.Schema<T>;
33
+ /**
34
+ * Initial values (which may not pass validation).
35
+ */
28
36
  initialValues: T;
29
37
  /**
30
38
  * Callback for value changes. Note: This is called even when values are invalid.
@@ -47,13 +55,13 @@ export interface FormOptions<T extends BaseObject> {
47
55
  /**
48
56
  * Called when the form is submitted and passes validation.
49
57
  */
50
- onSubmit?: (values: T, meta: {
58
+ onSave?: (values: T, meta: {
51
59
  changed: FormHandler<T>['changed'];
52
- }) => void;
60
+ }) => MaybePromise<void>;
53
61
  }
54
62
  /**
55
63
  * Creates a hook for managing form state, including values, validation, and submission.
56
64
  * Deeply integrated with `@dxos/schema` for schema-based validation.
57
65
  */
58
- export declare const useForm: <T extends BaseObject>({ schema, initialValues, onValuesChanged, onValidate, onValid, onSubmit, }: FormOptions<T>) => FormHandler<T>;
66
+ export declare const useForm: <T extends BaseObject>({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave, }: FormOptions<T>) => FormHandler<T>;
59
67
  //# sourceMappingURL=useForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAA6C,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,IAAI;IAK9C,MAAM,EAAE,CAAC,CAAC;IACV,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;IAMzB,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9E,QAAQ,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7C,aAAa,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACjF,MAAM,EAAE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M,CAAC,CAAC,CAAC,CAAC;IAEpB;;OAEG;IAEH,aAAa,EAAE,CAAC,CAAC;IAEjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAEtC;;;;OAIG;IAEH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,eAAe,EAAE,GAAG,SAAS,CAAC;IAE1D;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;IAE5E;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;KAAE,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC1F;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,UAAU,4EAOzC,WAAW,CAAC,CAAC,CAAC,KAAG,WAAW,CAAC,CAAC,CAwIhC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-form",
3
- "version": "0.7.2",
3
+ "version": "0.7.3-staging.0905f03",
4
4
  "description": "Data components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -29,19 +29,20 @@
29
29
  "date-fns": "^3.3.1",
30
30
  "effect": "^3.9.2",
31
31
  "jsonpath": "^1.1.1",
32
- "@dxos/async": "0.7.2",
33
- "@dxos/debug": "0.7.2",
34
- "@dxos/echo-db": "0.7.2",
35
- "@dxos/echo-schema": "0.7.2",
36
- "@dxos/effect": "0.7.2",
37
- "@dxos/keys": "0.7.2",
38
- "@dxos/invariant": "0.7.2",
39
- "@dxos/log": "0.7.2",
40
- "@dxos/react-client": "0.7.2",
41
- "@dxos/react-ui-list": "0.7.2",
42
- "@dxos/react-ui-types": "0.7.2",
43
- "@dxos/schema": "0.7.2",
44
- "@dxos/util": "0.7.2"
32
+ "@dxos/debug": "0.7.3-staging.0905f03",
33
+ "@dxos/async": "0.7.3-staging.0905f03",
34
+ "@dxos/echo-schema": "0.7.3-staging.0905f03",
35
+ "@dxos/echo-db": "0.7.3-staging.0905f03",
36
+ "@dxos/effect": "0.7.3-staging.0905f03",
37
+ "@dxos/invariant": "0.7.3-staging.0905f03",
38
+ "@dxos/keys": "0.7.3-staging.0905f03",
39
+ "@dxos/live-object": "0.7.3-staging.0905f03",
40
+ "@dxos/log": "0.7.3-staging.0905f03",
41
+ "@dxos/react-ui-types": "0.7.3-staging.0905f03",
42
+ "@dxos/react-client": "0.7.3-staging.0905f03",
43
+ "@dxos/react-ui-list": "0.7.3-staging.0905f03",
44
+ "@dxos/util": "0.7.3-staging.0905f03",
45
+ "@dxos/schema": "0.7.3-staging.0905f03"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@phosphor-icons/react": "^2.1.5",
@@ -52,12 +53,12 @@
52
53
  "react": "~18.2.0",
53
54
  "react-dom": "~18.2.0",
54
55
  "vite": "5.4.7",
55
- "@dxos/echo-signals": "0.7.2",
56
- "@dxos/random": "0.7.2",
57
- "@dxos/react-ui-syntax-highlighter": "0.7.2",
58
- "@dxos/react-ui": "0.7.2",
59
- "@dxos/react-ui-theme": "0.7.2",
60
- "@dxos/storybook-utils": "0.7.2"
56
+ "@dxos/echo-signals": "0.7.3-staging.0905f03",
57
+ "@dxos/random": "0.7.3-staging.0905f03",
58
+ "@dxos/react-ui": "0.7.3-staging.0905f03",
59
+ "@dxos/react-ui-syntax-highlighter": "0.7.3-staging.0905f03",
60
+ "@dxos/react-ui-theme": "0.7.3-staging.0905f03",
61
+ "@dxos/storybook-utils": "0.7.3-staging.0905f03"
61
62
  },
62
63
  "peerDependencies": {
63
64
  "@effect/schema": "^0.75.5",
@@ -65,8 +66,8 @@
65
66
  "effect": "^3.9.2",
66
67
  "react": "~18.2.0",
67
68
  "react-dom": "~18.2.0",
68
- "@dxos/react-ui-theme": "0.7.2",
69
- "@dxos/react-ui": "0.7.2"
69
+ "@dxos/react-ui": "0.7.3-staging.0905f03",
70
+ "@dxos/react-ui-theme": "0.7.3-staging.0905f03"
70
71
  },
71
72
  "publishConfig": {
72
73
  "access": "public"
@@ -7,7 +7,7 @@ import '@dxos-theme';
7
7
  import { type Meta, type StoryObj } from '@storybook/react';
8
8
  import React from 'react';
9
9
 
10
- import { createMutableSchema } from '@dxos/echo-schema/testing';
10
+ import { createMutableSchema } from '@dxos/live-object/testing';
11
11
  import { log } from '@dxos/log';
12
12
  import { ViewProjection } from '@dxos/schema';
13
13
  import { TestSchema, testView } from '@dxos/schema/testing';
@@ -20,14 +20,14 @@ import { TestLayout, TestPanel } from '../testing';
20
20
  type StoryProps = FieldEditorProps;
21
21
 
22
22
  const DefaultStory = (props: FieldEditorProps) => {
23
- const handleComplete: FieldEditorProps['onClose'] = () => {
23
+ const handleComplete: FieldEditorProps['onSave'] = () => {
24
24
  log.info('onClose', { props });
25
25
  };
26
26
 
27
27
  return (
28
28
  <TestLayout json={{ props }}>
29
29
  <TestPanel>
30
- <FieldEditor {...props} onClose={handleComplete} />
30
+ <FieldEditor {...props} onSave={handleComplete} />
31
31
  </TestPanel>
32
32
  </TestLayout>
33
33
  );
@@ -26,14 +26,14 @@ export type FieldEditorProps = {
26
26
  projection: ViewProjection;
27
27
  field: FieldType;
28
28
  registry?: SchemaResolver;
29
- onClose: () => void;
29
+ onSave: () => void;
30
30
  onCancel?: () => void;
31
31
  };
32
32
 
33
33
  /**
34
34
  * Displays a Form representing the metadata for a given `Field` and `View`.
35
35
  */
36
- export const FieldEditor = ({ view, projection, field, registry, onClose, onCancel }: FieldEditorProps) => {
36
+ export const FieldEditor = ({ view, projection, field, registry, onSave, onCancel }: FieldEditorProps) => {
37
37
  const { t } = useTranslation(translationKey);
38
38
  const [props, setProps] = useState<PropertyType>(projection.getFieldProjection(field.id).props);
39
39
  useEffect(() => setProps(projection.getFieldProjection(field.id).props), [field, projection]);
@@ -100,19 +100,19 @@ export const FieldEditor = ({ view, projection, field, registry, onClose, onCanc
100
100
  [view.fields, field],
101
101
  );
102
102
 
103
- const handleSubmit = useCallback<NonNullable<FormProps<PropertyType>['onSubmit']>>(
103
+ const handleSave = useCallback<NonNullable<FormProps<PropertyType>['onSave']>>(
104
104
  (props) => {
105
105
  projection.setFieldProjection({ field, props });
106
- onClose();
106
+ onSave();
107
107
  },
108
- [projection, field, onClose],
108
+ [projection, field, onSave],
109
109
  );
110
110
 
111
111
  const handleCancel = useCallback<NonNullable<FormProps<PropertyType>['onCancel']>>(() => {
112
112
  // Need to defer to allow form to close.
113
113
  requestAnimationFrame(() => onCancel?.());
114
- onClose();
115
- }, [onClose]);
114
+ onSave();
115
+ }, [onSave]);
116
116
 
117
117
  if (!fieldSchema) {
118
118
  log.warn('invalid format', { props });
@@ -129,7 +129,7 @@ export const FieldEditor = ({ view, projection, field, registry, onClose, onCanc
129
129
  sort={['property', 'format']}
130
130
  onValuesChanged={handleValuesChanged}
131
131
  onValidate={handleValidate}
132
- onSubmit={handleSubmit}
132
+ onSave={handleSave}
133
133
  onCancel={handleCancel}
134
134
  Custom={{
135
135
  ['format' satisfies keyof PropertyType]: (props) => (
@@ -13,6 +13,7 @@ export const TextInput = <T extends BaseObject>({
13
13
  property,
14
14
  type,
15
15
  label,
16
+ inputOnly,
16
17
  disabled,
17
18
  placeholder,
18
19
  getStatus,
@@ -24,9 +25,11 @@ export const TextInput = <T extends BaseObject>({
24
25
 
25
26
  return (
26
27
  <Input.Root validationValence={status}>
27
- <InputHeader error={error}>
28
- <Input.Label>{label}</Input.Label>
29
- </InputHeader>
28
+ {!inputOnly && (
29
+ <InputHeader error={error}>
30
+ <Input.Label>{label}</Input.Label>
31
+ </InputHeader>
32
+ )}
30
33
  <Input.TextInput
31
34
  disabled={disabled}
32
35
  placeholder={placeholder}
@@ -34,6 +37,7 @@ export const TextInput = <T extends BaseObject>({
34
37
  onChange={(event) => onValueChange(property, type, event.target.value)}
35
38
  onBlur={onBlur}
36
39
  />
40
+ {inputOnly && <Input.Validation>{error}</Input.Validation>}
37
41
  </Input.Root>
38
42
  );
39
43
  };
@@ -42,6 +46,7 @@ export const NumberInput = <T extends BaseObject>({
42
46
  property,
43
47
  type,
44
48
  label,
49
+ inputOnly,
45
50
  disabled,
46
51
  placeholder,
47
52
  getStatus,
@@ -51,12 +56,13 @@ export const NumberInput = <T extends BaseObject>({
51
56
  }: InputProps<T>) => {
52
57
  const { status, error } = getStatus?.(property);
53
58
 
54
- // TODO(burdon): Only show stepper if bounded integer.
55
59
  return (
56
60
  <Input.Root validationValence={status}>
57
- <InputHeader error={error}>
58
- <Input.Label>{label}</Input.Label>
59
- </InputHeader>
61
+ {!inputOnly && (
62
+ <InputHeader error={error}>
63
+ <Input.Label>{label}</Input.Label>
64
+ </InputHeader>
65
+ )}
60
66
  <Input.TextInput
61
67
  type='number'
62
68
  disabled={disabled}
@@ -65,6 +71,7 @@ export const NumberInput = <T extends BaseObject>({
65
71
  onChange={(event) => onValueChange(property, type, event.target.value)}
66
72
  onBlur={onBlur}
67
73
  />
74
+ {inputOnly && <Input.DescriptionAndValidation>{error}</Input.DescriptionAndValidation>}
68
75
  </Input.Root>
69
76
  );
70
77
  };
@@ -73,6 +80,7 @@ export const BooleanInput = <T extends BaseObject>({
73
80
  property,
74
81
  type,
75
82
  label,
83
+ inputOnly,
76
84
  getStatus,
77
85
  getValue,
78
86
  onValueChange,
@@ -81,13 +89,16 @@ export const BooleanInput = <T extends BaseObject>({
81
89
 
82
90
  return (
83
91
  <Input.Root validationValence={status}>
84
- <InputHeader error={error}>
85
- <Input.Label>{label}</Input.Label>
86
- </InputHeader>
92
+ {!inputOnly && (
93
+ <InputHeader error={error}>
94
+ <Input.Label>{label}</Input.Label>
95
+ </InputHeader>
96
+ )}
87
97
  <Input.Switch
88
98
  checked={getValue<boolean>(property)}
89
99
  onCheckedChange={(value) => onValueChange(property, type, value)}
90
100
  />
101
+ {inputOnly && <Input.DescriptionAndValidation>{error}</Input.DescriptionAndValidation>}
91
102
  </Input.Root>
92
103
  );
93
104
  };
@@ -100,6 +111,7 @@ export const SelectInput = <T extends BaseObject>({
100
111
  property,
101
112
  type,
102
113
  label,
114
+ inputOnly,
103
115
  disabled,
104
116
  placeholder,
105
117
  options,
@@ -111,9 +123,11 @@ export const SelectInput = <T extends BaseObject>({
111
123
 
112
124
  return (
113
125
  <Input.Root validationValence={status}>
114
- <InputHeader error={error}>
115
- <Input.Label>{label}</Input.Label>
116
- </InputHeader>
126
+ {!inputOnly && (
127
+ <InputHeader error={error}>
128
+ <Input.Label>{label}</Input.Label>
129
+ </InputHeader>
130
+ )}
117
131
  <Select.Root value={getValue(property)} onValueChange={(value) => onValueChange(property, type, value)}>
118
132
  {/* TODO(burdon): Placeholder not working? */}
119
133
  <Select.TriggerButton classNames='is-full' disabled={disabled} placeholder={placeholder} />
@@ -130,6 +144,7 @@ export const SelectInput = <T extends BaseObject>({
130
144
  </Select.Content>
131
145
  </Select.Portal>
132
146
  </Select.Root>
147
+ {inputOnly && <Input.DescriptionAndValidation>{error}</Input.DescriptionAndValidation>}
133
148
  </Input.Root>
134
149
  );
135
150
  };