@dxos/react-ui-form 0.8.2-main.f11618f → 0.8.2-main.fbd8ed0

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 (81) hide show
  1. package/dist/lib/browser/index.mjs +731 -573
  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 +748 -598
  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 +731 -573
  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/ControlSection/ControlSection.d.ts.map +1 -1
  11. package/dist/types/src/components/FieldEditor/FieldEditor.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 +4 -4
  15. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/Form.stories.d.ts +33 -32
  17. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
  19. package/dist/types/src/components/Form/FormContent.d.ts +3 -3
  20. package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
  21. package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
  22. package/dist/types/src/components/Form/Input.d.ts.map +1 -1
  23. package/dist/types/src/components/Form/RefField.d.ts +7 -18
  24. package/dist/types/src/components/Form/RefField.d.ts.map +1 -1
  25. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +1 -1
  26. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
  27. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +1 -1
  29. package/dist/types/src/components/Form/factory.d.ts +1 -1
  30. package/dist/types/src/components/Form/factory.d.ts.map +1 -1
  31. package/dist/types/src/components/Form/index.d.ts.map +1 -1
  32. package/dist/types/src/components/ViewEditor/Test.stories.d.ts.map +1 -1
  33. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +2 -2
  34. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  35. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/deprecated/Form.d.ts +2 -2
  37. package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
  38. package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
  39. package/dist/types/src/components/deprecated/FormInput.d.ts.map +1 -1
  40. package/dist/types/src/components/testing.d.ts.map +1 -1
  41. package/dist/types/src/hooks/index.d.ts +2 -0
  42. package/dist/types/src/hooks/index.d.ts.map +1 -1
  43. package/dist/types/src/hooks/useForm.d.ts +2 -2
  44. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useQueryRefOptions.d.ts +23 -0
  46. package/dist/types/src/hooks/useQueryRefOptions.d.ts.map +1 -0
  47. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts +8 -0
  48. package/dist/types/src/hooks/useRefQueryLookupHandler.d.ts.map +1 -0
  49. package/dist/types/src/util/field.d.ts.map +1 -1
  50. package/dist/types/src/util/formatting.d.ts.map +1 -1
  51. package/dist/types/src/util/index.d.ts +2 -0
  52. package/dist/types/src/util/index.d.ts.map +1 -1
  53. package/dist/types/src/util/refs.d.ts +9 -0
  54. package/dist/types/src/util/refs.d.ts.map +1 -0
  55. package/dist/types/src/util/schema.d.ts +3 -0
  56. package/dist/types/src/util/schema.d.ts.map +1 -0
  57. package/dist/types/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +26 -25
  59. package/src/components/ControlSection/ControlSection.stories.tsx +1 -1
  60. package/src/components/FieldEditor/FieldEditor.stories.tsx +1 -1
  61. package/src/components/Form/ArrayField.tsx +10 -16
  62. package/src/components/Form/Defaults.tsx +4 -1
  63. package/src/components/Form/Form.stories.tsx +48 -42
  64. package/src/components/Form/Form.tsx +4 -4
  65. package/src/components/Form/FormContent.tsx +49 -22
  66. package/src/components/Form/FormContext.tsx +3 -1
  67. package/src/components/Form/Input.tsx +3 -9
  68. package/src/components/Form/RefField.tsx +147 -101
  69. package/src/components/Form/custom/SelectOptionsInput.stories.tsx +6 -5
  70. package/src/components/Form/factory.tsx +1 -1
  71. package/src/components/Form/index.ts +0 -1
  72. package/src/components/ViewEditor/ViewEditor.stories.tsx +5 -4
  73. package/src/components/ViewEditor/ViewEditor.tsx +23 -20
  74. package/src/components/deprecated/Form.tsx +6 -6
  75. package/src/hooks/index.ts +3 -1
  76. package/src/hooks/useForm.ts +4 -3
  77. package/src/hooks/useQueryRefOptions.ts +53 -0
  78. package/src/hooks/useRefQueryLookupHandler.ts +41 -0
  79. package/src/util/index.ts +3 -1
  80. package/src/util/refs.ts +38 -0
  81. package/src/util/schema.ts +14 -0
@@ -1 +1 @@
1
- {"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/deprecated/FormInput.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,GAAG,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG7D;;GAEG;AACH,eAAO,MAAM,uBAAuB,6BAA8B,eAAe,CAAC,iBAAiB,CAAC,gBAQnG,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,iDAK7B,iBAAiB,CAAC,wBAAwB,CAAC,gBAkC7C,CAAC"}
1
+ {"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/deprecated/FormInput.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,GAAG,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG7D;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,0BAA0B,eAAe,CAAC,iBAAiB,CAAC,gBAQnG,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,8CAKjC,iBAAiB,CAAC,wBAAwB,CAAC,gBAkC7C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/components/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD,eAAO,MAAM,SAAS,6BAA8B,eAAe,CAAC,iBAAiB,CAAC,sBAIrF,CAAC;AAEF,eAAO,MAAM,UAAU,mCAAoC,eAAe,CAAC,iBAAiB,CAAC;IAAE,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,CAAC,sBAO5G,CAAC"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/components/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD,eAAO,MAAM,SAAS,GAAI,0BAA0B,eAAe,CAAC,iBAAiB,CAAC,sBAIrF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,gCAAgC,eAAe,CAAC,iBAAiB,CAAC;IAAE,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,CAAC,sBAO5G,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export * from './useForm';
2
+ export * from './useRefQueryLookupHandler';
3
+ export * from './useQueryRefOptions';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type Schema as S } from 'effect';
1
+ import { type Schema } from 'effect';
2
2
  import { type BaseObject } from '@dxos/echo-schema';
3
3
  import { type SimpleType, type JsonPath } from '@dxos/effect';
4
4
  import { type ValidationError } from '@dxos/schema';
@@ -29,7 +29,7 @@ export interface FormOptions<T extends BaseObject> {
29
29
  /**
30
30
  * Effect schema (Type literal).
31
31
  */
32
- schema: S.Schema<T>;
32
+ schema: Schema.Schema<T, any>;
33
33
  /**
34
34
  * Initial values (which may not pass validation).
35
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG5D,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAA4C,MAAM,cAAc,CAAC;AAGxG,OAAO,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E,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,EAAE,0EAO3C,WAAW,CAAC,CAAC,CAAC,KAAG,WAAW,CAAC,CAAC,CAoLhC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type TypeAnnotation } from '@dxos/echo-schema';
2
+ import { type DXN } from '@dxos/keys';
3
+ import { type TagPickerItemData } from '@dxos/react-ui-tag-picker';
4
+ import { type MaybePromise } from '@dxos/util';
5
+ export type RefOption = {
6
+ dxn: DXN;
7
+ label?: string;
8
+ };
9
+ export type QueryRefOptions = (type: TypeAnnotation) => MaybePromise<RefOption[]>;
10
+ type UseQueryRefOptionsProps = {
11
+ refTypeInfo: TypeAnnotation | undefined;
12
+ onQueryRefOptions?: QueryRefOptions;
13
+ };
14
+ /**
15
+ * Hook to query reference options based on type information.
16
+ * Used internally within forms to fetch and format reference options for reference fields.
17
+ */
18
+ export declare const useQueryRefOptions: ({ refTypeInfo, onQueryRefOptions }: UseQueryRefOptionsProps) => {
19
+ options: TagPickerItemData[];
20
+ loading: boolean;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=useQueryRefOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQueryRefOptions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useQueryRefOptions.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,cAAc,KAAK,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;AAElF,KAAK,uBAAuB,GAAG;IAAE,WAAW,EAAE,cAAc,GAAG,SAAS,CAAC;IAAC,iBAAiB,CAAC,EAAE,eAAe,CAAA;CAAE,CAAC;AAEhH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,oCAAoC,uBAAuB;;;CA+B7F,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Space } from '@dxos/react-client/echo';
2
+ import { type QueryRefOptions } from './useQueryRefOptions';
3
+ type UseRefQueryLookupProps = {
4
+ space?: Space;
5
+ };
6
+ export declare const useRefQueryLookupHandler: ({ space }: UseRefQueryLookupProps) => QueryRefOptions;
7
+ export {};
8
+ //# sourceMappingURL=useRefQueryLookupHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRefQueryLookupHandler.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useRefQueryLookupHandler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,KAAK,sBAAsB,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhD,eAAO,MAAM,wBAAwB,GAAI,WAAW,sBAAsB,KAAG,eA0B5E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/util/field.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAe,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,UAAU,4BAA6B,UAAU,QAsF7D,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,uBAAuB,qBAAsB,4BAA4B,KAAG,MAAM,EAAE,GAAG,SAmCnG,CAAC;AAGF,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,eAGhD,CAAC"}
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/util/field.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAe,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,yBAAyB,UAAU,QAsF7D,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,kBAAkB,4BAA4B,KAAG,MAAM,EAAE,GAAG,SAmCnG,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,eAGhD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../src/util/formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAe,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEtE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AAGH,eAAO,MAAM,gBAAgB,oCAAiD,gBAAgB,KAAG,MAqFhG,CAAC;AAEF,eAAO,MAAM,gBAAgB,oCAAiD,gBAAgB,KAAG,MA8DhG,CAAC"}
1
+ {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../src/util/formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAe,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEtE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AAGH,eAAO,MAAM,gBAAgB,GAAI,iCAA6C,gBAAgB,KAAG,MAqFhG,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,iCAA6C,gBAAgB,KAAG,MA8DhG,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export * from './field';
2
2
  export * from './formatting';
3
+ export * from './refs';
4
+ export * from './schema';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type SchemaAST } from 'effect';
2
+ import { type SchemaProperty } from '@dxos/schema';
3
+ type RefProps = {
4
+ ast: SchemaAST.AST;
5
+ isArray: boolean;
6
+ };
7
+ export declare const getRefProps: (property: SchemaProperty<any>) => RefProps | undefined;
8
+ export {};
9
+ //# sourceMappingURL=refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../../src/util/refs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIxC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAInD,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,UAAU,cAAc,CAAC,GAAG,CAAC,KAAG,QAAQ,GAAG,SAoBtE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { SchemaAST } from 'effect';
2
+ export declare const findArrayElementType: (ast: SchemaAST.AST) => SchemaAST.AST | undefined;
3
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/util/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAInC,eAAO,MAAM,oBAAoB,GAAI,KAAK,SAAS,CAAC,GAAG,8BAKtD,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.3"}
1
+ {"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-form",
3
- "version": "0.8.2-main.f11618f",
3
+ "version": "0.8.2-main.fbd8ed0",
4
4
  "description": "Data components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -28,46 +28,47 @@
28
28
  "@radix-ui/react-context": "1.1.1",
29
29
  "date-fns": "^3.3.1",
30
30
  "jsonpath": "^1.1.1",
31
- "@dxos/async": "0.8.2-main.f11618f",
32
- "@dxos/echo-schema": "0.8.2-main.f11618f",
33
- "@dxos/effect": "0.8.2-main.f11618f",
34
- "@dxos/echo-db": "0.8.2-main.f11618f",
35
- "@dxos/invariant": "0.8.2-main.f11618f",
36
- "@dxos/debug": "0.8.2-main.f11618f",
37
- "@dxos/keys": "0.8.2-main.f11618f",
38
- "@dxos/live-object": "0.8.2-main.f11618f",
39
- "@dxos/react-ui-list": "0.8.2-main.f11618f",
40
- "@dxos/log": "0.8.2-main.f11618f",
41
- "@dxos/react-client": "0.8.2-main.f11618f",
42
- "@dxos/react-ui-types": "0.8.2-main.f11618f",
43
- "@dxos/react-ui-pickers": "0.8.2-main.f11618f",
44
- "@dxos/schema": "0.8.2-main.f11618f",
45
- "@dxos/util": "0.8.2-main.f11618f"
31
+ "@dxos/async": "0.8.2-main.fbd8ed0",
32
+ "@dxos/debug": "0.8.2-main.fbd8ed0",
33
+ "@dxos/echo-db": "0.8.2-main.fbd8ed0",
34
+ "@dxos/echo-schema": "0.8.2-main.fbd8ed0",
35
+ "@dxos/effect": "0.8.2-main.fbd8ed0",
36
+ "@dxos/invariant": "0.8.2-main.fbd8ed0",
37
+ "@dxos/keys": "0.8.2-main.fbd8ed0",
38
+ "@dxos/live-object": "0.8.2-main.fbd8ed0",
39
+ "@dxos/log": "0.8.2-main.fbd8ed0",
40
+ "@dxos/react-client": "0.8.2-main.fbd8ed0",
41
+ "@dxos/react-ui-list": "0.8.2-main.fbd8ed0",
42
+ "@dxos/react-ui-pickers": "0.8.2-main.fbd8ed0",
43
+ "@dxos/react-ui-tag-picker": "0.8.2-main.fbd8ed0",
44
+ "@dxos/react-ui-types": "0.8.2-main.fbd8ed0",
45
+ "@dxos/schema": "0.8.2-main.fbd8ed0",
46
+ "@dxos/util": "0.8.2-main.fbd8ed0"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@phosphor-icons/react": "^2.1.5",
49
50
  "@types/jsonpath": "^0.2.4",
50
51
  "@types/react": "~18.2.0",
51
52
  "@types/react-dom": "~18.2.0",
52
- "effect": "3.13.3",
53
+ "effect": "3.14.21",
53
54
  "fast-check": "^3.19.0",
54
55
  "react": "~18.2.0",
55
56
  "react-dom": "~18.2.0",
56
57
  "vite": "5.4.7",
57
- "@dxos/random": "0.8.2-main.f11618f",
58
- "@dxos/echo-signals": "0.8.2-main.f11618f",
59
- "@dxos/react-ui-syntax-highlighter": "0.8.2-main.f11618f",
60
- "@dxos/react-ui": "0.8.2-main.f11618f",
61
- "@dxos/storybook-utils": "0.8.2-main.f11618f",
62
- "@dxos/react-ui-theme": "0.8.2-main.f11618f"
58
+ "@dxos/echo-signals": "0.8.2-main.fbd8ed0",
59
+ "@dxos/random": "0.8.2-main.fbd8ed0",
60
+ "@dxos/react-ui": "0.8.2-main.fbd8ed0",
61
+ "@dxos/react-ui-syntax-highlighter": "0.8.2-main.fbd8ed0",
62
+ "@dxos/react-ui-theme": "0.8.2-main.fbd8ed0",
63
+ "@dxos/storybook-utils": "0.8.2-main.fbd8ed0"
63
64
  },
64
65
  "peerDependencies": {
65
66
  "@phosphor-icons/react": "^2.1.5",
66
67
  "effect": "3.13.3",
67
68
  "react": "~18.2.0",
68
69
  "react-dom": "~18.2.0",
69
- "@dxos/react-ui": "0.8.2-main.f11618f",
70
- "@dxos/react-ui-theme": "0.8.2-main.f11618f"
70
+ "@dxos/react-ui-theme": "0.8.2-main.fbd8ed0",
71
+ "@dxos/react-ui": "0.8.2-main.fbd8ed0"
71
72
  },
72
73
  "publishConfig": {
73
74
  "access": "public"
@@ -14,7 +14,7 @@ import translations from '../../translations';
14
14
  const meta: Meta<ControlSectionProps> = {
15
15
  title: 'ui/react-ui-form/ControlSection',
16
16
  component: ControlSection,
17
- decorators: [withLayout({ tooltips: true }), withTheme],
17
+ decorators: [withLayout(), withTheme],
18
18
  parameters: {
19
19
  translations,
20
20
  },
@@ -37,7 +37,7 @@ const meta: Meta<StoryProps> = {
37
37
  title: 'ui/react-ui-form/FieldEditor',
38
38
  component: FieldEditor,
39
39
  render: DefaultStory,
40
- decorators: [withLayout({ fullscreen: true, tooltips: true }), withTheme],
40
+ decorators: [withLayout({ fullscreen: true }), withTheme],
41
41
  parameters: {
42
42
  translations,
43
43
  },
@@ -2,11 +2,10 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { pipe } from 'effect';
5
+ import { SchemaAST, pipe } from 'effect';
6
6
  import { capitalize } from 'effect/String';
7
- import React, { useCallback, useMemo } from 'react';
7
+ import React, { useCallback } from 'react';
8
8
 
9
- import { AST } from '@dxos/echo-schema';
10
9
  import { findNode, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from '@dxos/effect';
11
10
  import { invariant } from '@dxos/invariant';
12
11
  import { IconButton, useTranslation } from '@dxos/react-ui';
@@ -18,6 +17,7 @@ import { FormField } from './FormContent';
18
17
  import { useFormValues, type FormInputStateProps } from './FormContext';
19
18
  import { InputHeader, type InputComponent } from './Input';
20
19
  import { translationKey } from '../../translations';
20
+ import { findArrayElementType } from '../../util';
21
21
 
22
22
  const padding = 'px-2';
23
23
 
@@ -39,12 +39,11 @@ export const ArrayField = ({ property, readonly, path, inputProps, Custom, looku
39
39
  invariant(Array.isArray(values), `Values at path ${path?.join('.')} must be an array.`);
40
40
  const label = title ?? pipe(name, capitalize);
41
41
 
42
- const tupleType = findNode(ast, AST.isTupleType);
43
- const elementType = (tupleType as AST.TupleType | undefined)?.rest[0]?.type;
42
+ const elementType = findArrayElementType(ast);
44
43
 
45
- const getDefaultObjectValue = (typeNode: AST.AST): any => {
44
+ const getDefaultObjectValue = (typeNode: SchemaAST.AST): any => {
46
45
  const baseNode = findNode(typeNode, isDiscriminatedUnion);
47
- const typeLiteral = baseNode ? getDiscriminatedType(baseNode, {}) : findNode(typeNode, AST.isTypeLiteral);
46
+ const typeLiteral = baseNode ? getDiscriminatedType(baseNode, {}) : findNode(typeNode, SchemaAST.isTypeLiteral);
48
47
  if (!typeLiteral) {
49
48
  return {};
50
49
  }
@@ -52,17 +51,12 @@ export const ArrayField = ({ property, readonly, path, inputProps, Custom, looku
52
51
  return Object.fromEntries(getSchemaProperties(typeLiteral, {}).map((prop) => [prop.name, prop.defaultValue]));
53
52
  };
54
53
 
55
- const newValue = useMemo(() => {
56
- if (type === 'object' && elementType) {
57
- return getDefaultObjectValue(elementType);
58
- } else {
59
- return SimpleType.getDefaultValue(type);
60
- }
61
- }, [type, elementType]);
54
+ const getDefaultValue = () =>
55
+ type === 'object' && elementType ? getDefaultObjectValue(elementType) : SimpleType.getDefaultValue(type);
62
56
 
63
57
  const handleAdd = useCallback(() => {
64
- inputProps.onValueChange(type, [...values, newValue]);
65
- }, [type, elementType, inputProps, newValue, values]);
58
+ inputProps.onValueChange(type, [...values, getDefaultValue()]);
59
+ }, [type, elementType, inputProps, values]);
66
60
 
67
61
  const handleRemove = useCallback(
68
62
  (index: number) => {
@@ -107,6 +107,9 @@ export const SelectInput = ({
107
107
  }: SelectInputOptions) => {
108
108
  const { status, error } = getStatus();
109
109
 
110
+ const value = getValue() as string | undefined;
111
+ const handleValueChange = useCallback((value: string | number) => onValueChange(type, value), [type, onValueChange]);
112
+
110
113
  return (
111
114
  <Input.Root validationValence={status}>
112
115
  {!inputOnly && (
@@ -114,7 +117,7 @@ export const SelectInput = ({
114
117
  <Input.Label>{label}</Input.Label>
115
118
  </InputHeader>
116
119
  )}
117
- <Select.Root value={getValue()} onValueChange={(value) => onValueChange(type, value)}>
120
+ <Select.Root value={value} onValueChange={handleValueChange}>
118
121
  {/* TODO(burdon): Placeholder not working? */}
119
122
  <Select.TriggerButton classNames='is-full' disabled={disabled} placeholder={placeholder} />
120
123
  <Select.Portal>
@@ -5,10 +5,11 @@
5
5
  import '@dxos-theme';
6
6
 
7
7
  import { type Meta, type StoryObj } from '@storybook/react';
8
+ import { Schema, SchemaAST } from 'effect';
8
9
  import React, { useCallback, useState } from 'react';
9
10
 
10
11
  import { ContactType } from '@dxos/client/testing';
11
- import { AST, type BaseObject, Expando, Format, getDXN, Ref, S, type TypeAnnotation } from '@dxos/echo-schema';
12
+ import { type BaseObject, Expando, Format, getDXN, Ref, type TypeAnnotation } from '@dxos/echo-schema';
12
13
  import { live } from '@dxos/live-object';
13
14
  import { Testing } from '@dxos/schema/testing';
14
15
  import { withLayout, withTheme } from '@dxos/storybook-utils';
@@ -18,25 +19,27 @@ import { Form, type FormProps } from './Form';
18
19
  import translations from '../../translations';
19
20
  import { TestLayout, TestPanel } from '../testing';
20
21
 
21
- const AddressSchema = S.Struct({
22
- street: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Street' })),
23
- city: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'City' })),
24
- zip: S.optional(S.String.pipe(S.pattern(/^\d{5}(-\d{4})?$/)).annotations({ [AST.TitleAnnotationId]: 'ZIP' })),
25
- location: S.optional(Format.GeoPoint.annotations({ [AST.TitleAnnotationId]: 'Location' })),
26
- }).annotations({ [AST.TitleAnnotationId]: 'Address' });
22
+ const AddressSchema = Schema.Struct({
23
+ street: Schema.optional(Schema.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Street' })),
24
+ city: Schema.optional(Schema.String.annotations({ [SchemaAST.TitleAnnotationId]: 'City' })),
25
+ zip: Schema.optional(
26
+ Schema.String.pipe(Schema.pattern(/^\d{5}(-\d{4})?$/)).annotations({ [SchemaAST.TitleAnnotationId]: 'ZIP' }),
27
+ ),
28
+ location: Schema.optional(Format.GeoPoint.annotations({ [SchemaAST.TitleAnnotationId]: 'Location' })),
29
+ }).annotations({ [SchemaAST.TitleAnnotationId]: 'Address' });
27
30
 
28
31
  // TODO(burdon): Translations?
29
- const TestSchema = S.Struct({
30
- name: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Name' })),
31
- active: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Active' })),
32
- rank: S.optional(S.Number.annotations({ [AST.TitleAnnotationId]: 'Rank' })),
33
- website: S.optional(Format.URL.annotations({ [AST.TitleAnnotationId]: 'Website' })),
34
- address: S.optional(AddressSchema),
35
- }).pipe(S.mutable);
32
+ const TestSchema = Schema.Struct({
33
+ name: Schema.optional(Schema.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Name' })),
34
+ active: Schema.optional(Schema.Boolean.annotations({ [SchemaAST.TitleAnnotationId]: 'Active' })),
35
+ rank: Schema.optional(Schema.Number.annotations({ [SchemaAST.TitleAnnotationId]: 'Rank' })),
36
+ website: Schema.optional(Format.URL.annotations({ [SchemaAST.TitleAnnotationId]: 'Website' })),
37
+ address: Schema.optional(AddressSchema),
38
+ }).pipe(Schema.mutable);
36
39
 
37
- type TestType = S.Schema.Type<typeof TestSchema>;
40
+ type TestType = Schema.Schema.Type<typeof TestSchema>;
38
41
 
39
- type StoryProps<T extends BaseObject> = { schema: S.Schema<T> } & FormProps<T>;
42
+ type StoryProps<T extends BaseObject> = { schema: Schema.Schema<T> } & FormProps<T>;
40
43
 
41
44
  const DefaultStory = <T extends BaseObject>({ schema, values: initialValues, ...props }: StoryProps<T>) => {
42
45
  const [values, setValues] = useState(initialValues);
@@ -57,7 +60,7 @@ const meta: Meta<StoryProps<any>> = {
57
60
  title: 'ui/react-ui-form/Form',
58
61
  component: Form,
59
62
  render: DefaultStory,
60
- decorators: [withLayout({ fullscreen: true, tooltips: true }), withTheme],
63
+ decorators: [withLayout({ fullscreen: true }), withTheme],
61
64
  parameters: {
62
65
  translations,
63
66
  },
@@ -117,22 +120,24 @@ export const OrganizationAutoSave: Story<Testing.Organization> = {
117
120
  // TODO(burdon): Move into separate storybook and use test types.
118
121
  //
119
122
 
120
- const ShapeSchema = S.Struct({
121
- shape: S.optional(
122
- S.Union(
123
- S.Struct({
124
- type: S.Literal('circle').annotations({ [AST.TitleAnnotationId]: 'Type' }),
125
- radius: S.optional(S.Number.annotations({ [AST.TitleAnnotationId]: 'Radius' })),
123
+ const ShapeSchema = Schema.Struct({
124
+ shape: Schema.optional(
125
+ Schema.Union(
126
+ Schema.Struct({
127
+ type: Schema.Literal('circle').annotations({ [SchemaAST.TitleAnnotationId]: 'Type' }),
128
+ radius: Schema.optional(Schema.Number.annotations({ [SchemaAST.TitleAnnotationId]: 'Radius' })),
126
129
  }),
127
- S.Struct({
128
- type: S.Literal('square').annotations({ [AST.TitleAnnotationId]: 'Type' }),
129
- size: S.optional(S.Number.pipe(S.nonNegative()).annotations({ [AST.TitleAnnotationId]: 'Size' })),
130
+ Schema.Struct({
131
+ type: Schema.Literal('square').annotations({ [SchemaAST.TitleAnnotationId]: 'Type' }),
132
+ size: Schema.optional(
133
+ Schema.Number.pipe(Schema.nonNegative()).annotations({ [SchemaAST.TitleAnnotationId]: 'Size' }),
134
+ ),
130
135
  }),
131
- ).annotations({ [AST.TitleAnnotationId]: 'Shape' }),
136
+ ).annotations({ [SchemaAST.TitleAnnotationId]: 'Shape' }),
132
137
  ),
133
- }).pipe(S.mutable);
138
+ }).pipe(Schema.mutable);
134
139
 
135
- type ShapeType = S.Schema.Type<typeof ShapeSchema>;
140
+ type ShapeType = Schema.Schema.Type<typeof ShapeSchema>;
136
141
 
137
142
  type DiscriminatedUnionStoryProps = FormProps<ShapeType>;
138
143
 
@@ -178,12 +183,12 @@ export const DiscriminatedShape: StoryObj<DiscriminatedUnionStoryProps> = {
178
183
  },
179
184
  };
180
185
 
181
- const ArraysSchema = S.Struct({
182
- names: S.Array(S.String.pipe(S.nonEmptyString())),
183
- addresses: S.Array(AddressSchema),
184
- }).pipe(S.mutable);
186
+ const ArraysSchema = Schema.Struct({
187
+ names: Schema.Array(Schema.String.pipe(Schema.nonEmptyString())),
188
+ addresses: Schema.Array(AddressSchema),
189
+ }).pipe(Schema.mutable);
185
190
 
186
- type ArraysType = S.Schema.Type<typeof ArraysSchema>;
191
+ type ArraysType = Schema.Schema.Type<typeof ArraysSchema>;
187
192
 
188
193
  const ArraysStory = ({ values: initialValues }: FormProps<ArraysType>) => {
189
194
  const [values, setValues] = useState(initialValues);
@@ -210,13 +215,13 @@ export const Arrays: StoryObj<FormProps<ArraysType>> = {
210
215
  },
211
216
  };
212
217
 
213
- const ColorSchema = S.Struct({
214
- color: S.Union(S.Literal('red'), S.Literal('green'), S.Literal('blue')).annotations({
215
- [AST.TitleAnnotationId]: 'Color',
218
+ const ColorSchema = Schema.Struct({
219
+ color: Schema.Union(Schema.Literal('red'), Schema.Literal('green'), Schema.Literal('blue')).annotations({
220
+ [SchemaAST.TitleAnnotationId]: 'Color',
216
221
  }),
217
- }).pipe(S.mutable);
222
+ }).pipe(Schema.mutable);
218
223
 
219
- type ColorType = S.Schema.Type<typeof ColorSchema>;
224
+ type ColorType = Schema.Schema.Type<typeof ColorSchema>;
220
225
 
221
226
  const EnumStory = ({ values: initialValues }: FormProps<ColorType>) => {
222
227
  const [values, setValues] = useState(initialValues);
@@ -242,10 +247,11 @@ export const Enum: StoryObj<FormProps<ColorType>> = {
242
247
  },
243
248
  };
244
249
 
245
- const RefSchema = S.Struct({
250
+ const RefSchema = Schema.Struct({
246
251
  contact: Ref(ContactType).annotations({ title: 'Contact Reference' }),
247
- optionalContact: S.optional(Ref(ContactType).annotations({ title: 'Optional Contact Reference' })),
248
- unknownExpando: S.optional(Ref(Expando).annotations({ title: 'Optional Ref to an Expando (DXN Input)' })),
252
+ optionalContact: Schema.optional(Ref(ContactType).annotations({ title: 'Optional Contact Reference' })),
253
+ refArray: Schema.optional(Schema.Array(Ref(ContactType))),
254
+ unknownExpando: Schema.optional(Ref(Expando).annotations({ title: 'Optional Ref to an Expando (DXN Input)' })),
249
255
  });
250
256
 
251
257
  const RefStory = ({ values: initialValues }: FormProps<any>) => {
@@ -2,9 +2,10 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { type Schema } from 'effect';
5
6
  import React, { type ReactElement, useEffect, useMemo, useRef } from 'react';
6
7
 
7
- import { type BaseObject, type S, type PropertyKey } from '@dxos/echo-schema';
8
+ import { type BaseObject, type PropertyKey } from '@dxos/echo-schema';
8
9
  import { type ThemedClassName } from '@dxos/react-ui';
9
10
  import { mx } from '@dxos/react-ui-theme';
10
11
  import { type SchemaProperty } from '@dxos/schema';
@@ -13,14 +14,13 @@ import { FormActions } from './FormActions';
13
14
  import { FormFields } from './FormContent';
14
15
  import { FormProvider } from './FormContext';
15
16
  import { type InputProps, type InputComponent } from './Input';
16
- import { type QueryRefOptions } from './RefField';
17
- import { type FormOptions } from '../../hooks';
17
+ import { type FormOptions, type QueryRefOptions } from '../../hooks';
18
18
 
19
19
  export type PropsFilter<T extends BaseObject> = (props: SchemaProperty<T>[]) => SchemaProperty<T>[];
20
20
 
21
21
  export type ComponentLookup = (args: {
22
22
  prop: string;
23
- schema: S.Schema<any>;
23
+ schema: Schema.Schema<any>;
24
24
  inputProps: InputProps;
25
25
  }) => ReactElement | undefined;
26
26