@dxos/react-ui-form 0.8.1-main.ae460ac → 0.8.1-staging.31c3ee1
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.
- package/dist/lib/browser/index.mjs +672 -499
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +744 -565
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +672 -499
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/ControlSection.d.ts +20 -0
- package/dist/types/src/components/ControlSection.d.ts.map +1 -0
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +2 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/Form/ArrayField.d.ts +2 -1
- package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
- package/dist/types/src/components/Form/Defaults.d.ts +6 -5
- package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +2 -2
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +9 -9
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormActions.d.ts +2 -1
- package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContent.d.ts +3 -2
- package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContext.d.ts +1 -1
- package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
- package/dist/types/src/components/Form/Input.d.ts +3 -3
- package/dist/types/src/components/Form/Input.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/GeoPointInput.d.ts +2 -1
- package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts +2 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/TupleInput.d.ts +2 -1
- package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +1 -1
- package/dist/types/src/components/Form/index.d.ts +1 -2
- package/dist/types/src/components/Form/index.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/Test.stories.d.ts +2 -1
- package/dist/types/src/components/ViewEditor/Test.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +6 -5
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/Form.d.ts +2 -1
- package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/Form.stories.d.ts +2 -1
- package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/FormInput.d.ts +2 -2
- package/dist/types/src/components/deprecated/FormInput.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +3 -3
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useForm.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/field.d.ts +0 -1
- package/dist/types/src/util/field.d.ts.map +1 -1
- package/dist/types/src/util/formatting.d.ts.map +1 -1
- package/package.json +26 -26
- package/src/components/ControlSection.tsx +113 -0
- package/src/components/FieldEditor/FieldEditor.stories.tsx +1 -1
- package/src/components/Form/Form.stories.tsx +2 -2
- package/src/components/Form/Input.tsx +1 -1
- package/src/components/Form/custom/SelectOptionsInput.tsx +5 -1
- package/src/components/Form/index.ts +1 -3
- package/src/components/ViewEditor/ViewEditor.stories.tsx +1 -1
- package/src/components/ViewEditor/ViewEditor.tsx +105 -20
- package/src/components/index.ts +1 -1
- package/src/hooks/useForm.ts +10 -1
- package/src/translations.ts +1 -0
- package/src/util/field.ts +4 -4
- package/src/util/formatting.ts +9 -10
|
@@ -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;
|
|
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"}
|
|
@@ -3,7 +3,7 @@ import { type ThemedClassName } from '@dxos/react-ui';
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated
|
|
5
5
|
*/
|
|
6
|
-
export declare const DeprecatedFormContainer: ({ children, classNames }: ThemedClassName<PropsWithChildren>) =>
|
|
6
|
+
export declare const DeprecatedFormContainer: ({ children, classNames }: ThemedClassName<PropsWithChildren>) => JSX.Element;
|
|
7
7
|
export type DeprecatedFormInputProps = {
|
|
8
8
|
label: string;
|
|
9
9
|
description?: JSX.Element;
|
|
@@ -12,5 +12,5 @@ export type DeprecatedFormInputProps = {
|
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated
|
|
14
14
|
*/
|
|
15
|
-
export declare const DeprecatedFormInput: ({ label, description, secondary, children, }: PropsWithChildren<DeprecatedFormInputProps>) =>
|
|
15
|
+
export declare const DeprecatedFormInput: ({ label, description, secondary, children, }: PropsWithChildren<DeprecatedFormInputProps>) => JSX.Element;
|
|
16
16
|
//# sourceMappingURL=FormInput.d.ts.map
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type PropsWithChildren } from 'react';
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
2
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
export declare const TestPanel: ({ classNames, children }: ThemedClassName<PropsWithChildren>) =>
|
|
3
|
+
export declare const TestPanel: ({ classNames, children }: ThemedClassName<PropsWithChildren>) => React.JSX.Element;
|
|
4
4
|
export declare const TestLayout: ({ classNames, json, children }: ThemedClassName<PropsWithChildren<{
|
|
5
5
|
json?: any;
|
|
6
|
-
}>>) =>
|
|
6
|
+
}>>) => React.JSX.Element;
|
|
7
7
|
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/components/testing.tsx"],"names":[],"mappings":"AAIA,
|
|
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,6B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,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,UAAU;IAC/C;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEpB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAE/C;;;;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,CAmLhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,kBAAkB,CAAC
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9C,wBA6DE"}
|
|
@@ -17,6 +17,5 @@ export type CellClassesForFieldTypeProps = {
|
|
|
17
17
|
format?: FormatEnum;
|
|
18
18
|
};
|
|
19
19
|
export declare const cellClassesForFieldType: ({ type, format }: CellClassesForFieldTypeProps) => string[] | undefined;
|
|
20
|
-
export declare const cellClassesForRowSelection: (selected: boolean) => string[] | undefined;
|
|
21
20
|
export declare const pathNotUniqueError: (path: string) => ValidationError;
|
|
22
21
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../src/util/formatting.ts"],"names":[],"mappings":"
|
|
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,MAyEhG,CAAC;AAEF,eAAO,MAAM,gBAAgB,oCAAiD,gBAAgB,KAAG,MA8DhG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-form",
|
|
3
|
-
"version": "0.8.1-
|
|
3
|
+
"version": "0.8.1-staging.31c3ee1",
|
|
4
4
|
"description": "Data components.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -28,46 +28,46 @@
|
|
|
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.1-
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/echo-
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/log": "0.8.1-
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/react-
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/react-ui-
|
|
43
|
-
"@dxos/react-
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
31
|
+
"@dxos/async": "0.8.1-staging.31c3ee1",
|
|
32
|
+
"@dxos/debug": "0.8.1-staging.31c3ee1",
|
|
33
|
+
"@dxos/effect": "0.8.1-staging.31c3ee1",
|
|
34
|
+
"@dxos/echo-db": "0.8.1-staging.31c3ee1",
|
|
35
|
+
"@dxos/echo-schema": "0.8.1-staging.31c3ee1",
|
|
36
|
+
"@dxos/invariant": "0.8.1-staging.31c3ee1",
|
|
37
|
+
"@dxos/keys": "0.8.1-staging.31c3ee1",
|
|
38
|
+
"@dxos/log": "0.8.1-staging.31c3ee1",
|
|
39
|
+
"@dxos/live-object": "0.8.1-staging.31c3ee1",
|
|
40
|
+
"@dxos/react-client": "0.8.1-staging.31c3ee1",
|
|
41
|
+
"@dxos/react-ui-list": "0.8.1-staging.31c3ee1",
|
|
42
|
+
"@dxos/react-ui-pickers": "0.8.1-staging.31c3ee1",
|
|
43
|
+
"@dxos/react-ui-types": "0.8.1-staging.31c3ee1",
|
|
44
|
+
"@dxos/util": "0.8.1-staging.31c3ee1",
|
|
45
|
+
"@dxos/schema": "0.8.1-staging.31c3ee1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@phosphor-icons/react": "^2.1.5",
|
|
49
49
|
"@types/jsonpath": "^0.2.4",
|
|
50
50
|
"@types/react": "~18.2.0",
|
|
51
51
|
"@types/react-dom": "~18.2.0",
|
|
52
|
-
"effect": "
|
|
52
|
+
"effect": "3.13.3",
|
|
53
53
|
"fast-check": "^3.19.0",
|
|
54
54
|
"react": "~18.2.0",
|
|
55
55
|
"react-dom": "~18.2.0",
|
|
56
56
|
"vite": "5.4.7",
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-ui": "0.8.1-
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
57
|
+
"@dxos/random": "0.8.1-staging.31c3ee1",
|
|
58
|
+
"@dxos/react-ui": "0.8.1-staging.31c3ee1",
|
|
59
|
+
"@dxos/echo-signals": "0.8.1-staging.31c3ee1",
|
|
60
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.1-staging.31c3ee1",
|
|
61
|
+
"@dxos/storybook-utils": "0.8.1-staging.31c3ee1",
|
|
62
|
+
"@dxos/react-ui-theme": "0.8.1-staging.31c3ee1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@phosphor-icons/react": "^2.1.5",
|
|
66
|
-
"effect": "
|
|
66
|
+
"effect": "3.13.3",
|
|
67
67
|
"react": "~18.2.0",
|
|
68
68
|
"react-dom": "~18.2.0",
|
|
69
|
-
"@dxos/react-ui": "0.8.1-
|
|
70
|
-
"@dxos/react-ui
|
|
69
|
+
"@dxos/react-ui-theme": "0.8.1-staging.31c3ee1",
|
|
70
|
+
"@dxos/react-ui": "0.8.1-staging.31c3ee1"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type PropsWithChildren } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Label, toLocalizedString, useTranslation, Input } from '@dxos/react-ui';
|
|
8
|
+
|
|
9
|
+
import { translationKey } from '../translations';
|
|
10
|
+
|
|
11
|
+
// TODO(wittjosiah): Copied from @dxos/plugin-client. Reconcile/factor out.
|
|
12
|
+
|
|
13
|
+
export type ControlSectionProps = PropsWithChildren<{
|
|
14
|
+
title: Label;
|
|
15
|
+
description?: Label;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
export const ControlSectionHeading = ({ title, description }: Omit<ControlSectionProps, 'children'>) => {
|
|
19
|
+
const { t } = useTranslation(translationKey);
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<h2 className='pli-4 container-max-width text-xl mbs-6 mbe-4'>{toLocalizedString(title, t)}</h2>
|
|
23
|
+
{description && (
|
|
24
|
+
<p className='pli-4 mlb-4 container-max-width text-description'>{toLocalizedString(description, t)}</p>
|
|
25
|
+
)}
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const ControlSection = ({ title, description, children }: ControlSectionProps) => {
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<ControlSectionHeading title={title} description={description} />
|
|
34
|
+
{children}
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type ControlGroupProps = PropsWithChildren<{}>;
|
|
40
|
+
|
|
41
|
+
export const ControlGroup = ({ children }: ControlGroupProps) => (
|
|
42
|
+
<div role='none' className='group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-4'>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export const ControlFrame = ({ children }: ControlGroupProps) => (
|
|
48
|
+
<div
|
|
49
|
+
role='none'
|
|
50
|
+
className='p-4 border border-separator rounded-lg container-max-width grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-2 md:gap-8'
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
export type ControlItemProps = PropsWithChildren<{
|
|
57
|
+
title: Label;
|
|
58
|
+
description?: Label;
|
|
59
|
+
}>;
|
|
60
|
+
|
|
61
|
+
export const controlItemClasses =
|
|
62
|
+
'p-4 border border-separator rounded-lg container-max-width grid md:col-span-2 grid-cols-subgrid items-center';
|
|
63
|
+
|
|
64
|
+
const controlItemTitleClasses = 'text-lg font-normal mbe-2';
|
|
65
|
+
const controlItemDescriptionClasses = 'text-base mlb-2 md:mbe-0 text-description';
|
|
66
|
+
|
|
67
|
+
export const ControlItem = ({ title, description, children }: ControlItemProps) => {
|
|
68
|
+
const { t } = useTranslation(translationKey);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div className={controlItemClasses}>
|
|
72
|
+
<div role='none'>
|
|
73
|
+
<h3 className={controlItemTitleClasses}>{toLocalizedString(title, t)}</h3>
|
|
74
|
+
{description && <p className={controlItemDescriptionClasses}>{toLocalizedString(description, t)}</p>}
|
|
75
|
+
</div>
|
|
76
|
+
{children}
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const ControlItemInput = ({ title, description, children }: ControlItemProps) => {
|
|
82
|
+
const { t } = useTranslation(translationKey);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Input.Root>
|
|
86
|
+
<div className={controlItemClasses}>
|
|
87
|
+
<div role='none'>
|
|
88
|
+
<Input.Label classNames={controlItemTitleClasses}>{toLocalizedString(title, t)}</Input.Label>
|
|
89
|
+
{description && (
|
|
90
|
+
<Input.DescriptionAndValidation>
|
|
91
|
+
<Input.Description classNames={controlItemDescriptionClasses}>
|
|
92
|
+
{toLocalizedString(description, t)}
|
|
93
|
+
</Input.Description>
|
|
94
|
+
</Input.DescriptionAndValidation>
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
{children}
|
|
98
|
+
</div>
|
|
99
|
+
</Input.Root>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const ControlFrameItem = ({ title, description, children }: ControlItemProps) => {
|
|
104
|
+
const { t } = useTranslation(translationKey);
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div role='group' className='min-is-0'>
|
|
108
|
+
<h3 className='text-lg mbe-2'>{toLocalizedString(title, t)}</h3>
|
|
109
|
+
{description && <p className='mlb-2 md:mbe-0 text-description'>{toLocalizedString(description, t)}</p>}
|
|
110
|
+
{children}
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
@@ -49,7 +49,7 @@ type Story = StoryObj<StoryProps>;
|
|
|
49
49
|
|
|
50
50
|
export const Default: Story = {
|
|
51
51
|
args: {
|
|
52
|
-
projection: new ViewProjection(createEchoSchema(TestSchema), testView),
|
|
52
|
+
projection: new ViewProjection(createEchoSchema(TestSchema).jsonSchema, testView),
|
|
53
53
|
view: testView,
|
|
54
54
|
field: testView.fields[0],
|
|
55
55
|
},
|
|
@@ -78,7 +78,7 @@ export const Default: Story<TestType> = {
|
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
export const Org: Story<Testing.
|
|
81
|
+
export const Org: Story<Testing.Org> = {
|
|
82
82
|
args: {
|
|
83
83
|
schema: Testing.OrgSchema,
|
|
84
84
|
values: {
|
|
@@ -88,7 +88,7 @@ export const Org: Story<Testing.OrgSchemaType> = {
|
|
|
88
88
|
},
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
export const OrgAutoSave: Story<Testing.
|
|
91
|
+
export const OrgAutoSave: Story<Testing.Org> = {
|
|
92
92
|
args: {
|
|
93
93
|
schema: Testing.OrgSchema,
|
|
94
94
|
values: {
|
|
@@ -154,7 +154,11 @@ export const SelectOptionInput = ({ type, label, disabled, getStatus, getValue,
|
|
|
154
154
|
data-no-submit
|
|
155
155
|
/>
|
|
156
156
|
<Toolbar.Root classNames='p-0 m-0 !is-auto'>
|
|
157
|
-
<HuePicker
|
|
157
|
+
<HuePicker
|
|
158
|
+
value={item.color}
|
|
159
|
+
onChange={handleColorChange(item.id)}
|
|
160
|
+
rootVariant='toolbar-button'
|
|
161
|
+
/>
|
|
158
162
|
</Toolbar.Root>
|
|
159
163
|
<IconButton
|
|
160
164
|
icon='ph--trash--fill'
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useFormValues } from './FormContext';
|
|
6
|
-
|
|
7
5
|
export * from './custom';
|
|
8
6
|
|
|
9
7
|
export * from './Defaults';
|
|
10
8
|
export * from './Form';
|
|
9
|
+
export * from './FormContext';
|
|
11
10
|
export * from './Input';
|
|
12
|
-
export { useFormValues };
|
|
@@ -33,7 +33,7 @@ const DefaultStory = () => {
|
|
|
33
33
|
|
|
34
34
|
const [schema] = await space.db.schemaRegistry.register([TestSchema]);
|
|
35
35
|
const view = createView({ name: 'Test', typename: schema.typename, jsonSchema: toJsonSchema(TestSchema) });
|
|
36
|
-
const projection = new ViewProjection(schema, view);
|
|
36
|
+
const projection = new ViewProjection(schema.jsonSchema, view);
|
|
37
37
|
|
|
38
38
|
setSchema(schema);
|
|
39
39
|
setView(view);
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type SchemaRegistry } from '@dxos/echo-db';
|
|
8
|
-
import { AST, Format, type
|
|
8
|
+
import { AST, Format, type BaseSchema, S, type JsonProp } from '@dxos/echo-schema';
|
|
9
|
+
import { invariant } from '@dxos/invariant';
|
|
9
10
|
import { IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { List } from '@dxos/react-ui-list';
|
|
11
12
|
import { ghostHover, inputTextLabel, mx } from '@dxos/react-ui-theme';
|
|
@@ -29,13 +30,13 @@ const ViewMetaSchema = S.Struct({
|
|
|
29
30
|
type ViewMetaType = S.Schema.Type<typeof ViewMetaSchema>;
|
|
30
31
|
|
|
31
32
|
export type ViewEditorProps = ThemedClassName<{
|
|
32
|
-
schema:
|
|
33
|
+
schema: BaseSchema;
|
|
33
34
|
view: ViewType;
|
|
34
35
|
registry?: SchemaRegistry;
|
|
35
36
|
readonly?: boolean;
|
|
36
37
|
showHeading?: boolean;
|
|
37
|
-
onTypenameChanged
|
|
38
|
-
onDelete
|
|
38
|
+
onTypenameChanged?: (typename: string) => void;
|
|
39
|
+
onDelete?: (fieldId: string) => void;
|
|
39
40
|
}>;
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -52,7 +53,7 @@ export const ViewEditor = ({
|
|
|
52
53
|
onDelete,
|
|
53
54
|
}: ViewEditorProps) => {
|
|
54
55
|
const { t } = useTranslation(translationKey);
|
|
55
|
-
const projection = useMemo(() => new ViewProjection(schema, view), [schema, view]);
|
|
56
|
+
const projection = useMemo(() => new ViewProjection(schema.jsonSchema, view), [schema, view]);
|
|
56
57
|
const [field, setField] = useState<FieldType>();
|
|
57
58
|
|
|
58
59
|
// TODO(burdon): Should be reactive.
|
|
@@ -65,45 +66,86 @@ export const ViewEditor = ({
|
|
|
65
66
|
};
|
|
66
67
|
}, [view]);
|
|
67
68
|
|
|
68
|
-
const
|
|
69
|
+
const handleSelect = useCallback((field: FieldType) => {
|
|
70
|
+
setField((f) => (f === field ? undefined : field));
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
// TODO(burdon): Check if mutable; variant of useCallback that return undefined if readonly?
|
|
74
|
+
|
|
75
|
+
const handleAdd = useCallback(() => {
|
|
76
|
+
invariant(!schema.readonly);
|
|
77
|
+
const field = projection.createFieldProjection();
|
|
78
|
+
setField(field);
|
|
79
|
+
}, [schema, view]);
|
|
80
|
+
|
|
81
|
+
const handleUpdate = useCallback(
|
|
69
82
|
({ name, typename }: ViewMetaType) => {
|
|
83
|
+
invariant(!schema.readonly);
|
|
70
84
|
requestAnimationFrame(() => {
|
|
71
85
|
if (view.name !== name) {
|
|
72
86
|
view.name = name;
|
|
73
87
|
}
|
|
88
|
+
|
|
74
89
|
if (view.query.typename !== typename) {
|
|
75
|
-
onTypenameChanged(typename);
|
|
90
|
+
onTypenameChanged?.(typename);
|
|
76
91
|
}
|
|
77
92
|
});
|
|
78
93
|
},
|
|
79
|
-
[
|
|
94
|
+
[schema, view, onTypenameChanged],
|
|
80
95
|
);
|
|
81
96
|
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
const handleDelete = useCallback(
|
|
98
|
+
(fieldId: string) => {
|
|
99
|
+
invariant(!schema.readonly);
|
|
100
|
+
if (fieldId === field?.id) {
|
|
101
|
+
setField(undefined);
|
|
102
|
+
}
|
|
85
103
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
104
|
+
onDelete?.(fieldId);
|
|
105
|
+
},
|
|
106
|
+
[schema, field, onDelete],
|
|
107
|
+
);
|
|
90
108
|
|
|
91
109
|
const handleMove = useCallback(
|
|
92
110
|
(fromIndex: number, toIndex: number) => {
|
|
111
|
+
invariant(!schema.readonly);
|
|
93
112
|
// NOTE(ZaymonFC): Using arrayMove here causes a race condition with the kanban model.
|
|
94
113
|
const fields = [...view.fields];
|
|
95
114
|
const [moved] = fields.splice(fromIndex, 1);
|
|
96
115
|
fields.splice(toIndex, 0, moved);
|
|
97
116
|
view.fields = fields;
|
|
98
117
|
},
|
|
99
|
-
[view.fields],
|
|
118
|
+
[schema, view.fields],
|
|
100
119
|
);
|
|
101
120
|
|
|
102
121
|
const handleClose = useCallback(() => setField(undefined), []);
|
|
103
122
|
|
|
123
|
+
const hiddenProperties = projection.getHiddenProperties();
|
|
124
|
+
|
|
125
|
+
const handleHide = useCallback(
|
|
126
|
+
(fieldId: string) => {
|
|
127
|
+
setField(undefined);
|
|
128
|
+
projection.hideFieldProjection(fieldId);
|
|
129
|
+
},
|
|
130
|
+
[projection],
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const handleShow = useCallback(
|
|
134
|
+
(property: string) => {
|
|
135
|
+
setField(undefined);
|
|
136
|
+
projection.showFieldProjection(property as JsonProp);
|
|
137
|
+
},
|
|
138
|
+
[projection],
|
|
139
|
+
);
|
|
140
|
+
|
|
104
141
|
return (
|
|
105
142
|
<div role='none' className={mx('flex flex-col w-full divide-y divide-separator', classNames)}>
|
|
106
|
-
<Form<ViewMetaType>
|
|
143
|
+
<Form<ViewMetaType>
|
|
144
|
+
autoSave
|
|
145
|
+
schema={ViewMetaSchema}
|
|
146
|
+
values={viewValues}
|
|
147
|
+
onSave={schema.readonly ? undefined : handleUpdate}
|
|
148
|
+
/>
|
|
107
149
|
|
|
108
150
|
<div>
|
|
109
151
|
{/* TODO(burdon): Clean up common form ux. */}
|
|
@@ -115,7 +157,7 @@ export const ViewEditor = ({
|
|
|
115
157
|
items={view.fields}
|
|
116
158
|
isItem={S.is(FieldSchema)}
|
|
117
159
|
getId={(field) => field.id}
|
|
118
|
-
onMove={handleMove}
|
|
160
|
+
onMove={schema.readonly ? undefined : handleMove}
|
|
119
161
|
>
|
|
120
162
|
{({ items: fields }) => (
|
|
121
163
|
<>
|
|
@@ -131,13 +173,56 @@ export const ViewEditor = ({
|
|
|
131
173
|
<List.Item<FieldType> key={field.id} item={field} classNames={mx(grid, ghostHover, 'cursor-pointer')}>
|
|
132
174
|
<List.ItemDragHandle />
|
|
133
175
|
<List.ItemTitle onClick={() => handleSelect(field)}>{field.path}</List.ItemTitle>
|
|
134
|
-
<
|
|
176
|
+
<div className='flex items-center gap-2 -ml-4'>
|
|
177
|
+
<List.ItemButton
|
|
178
|
+
icon='ph--eye-slash--regular'
|
|
179
|
+
disabled={view.fields.length <= 1}
|
|
180
|
+
onClick={() => handleHide(field.id)}
|
|
181
|
+
/>
|
|
182
|
+
{!schema.readonly && (
|
|
183
|
+
<List.ItemDeleteButton
|
|
184
|
+
icon='ph--trash--regular'
|
|
185
|
+
disabled={view.fields.length <= 1}
|
|
186
|
+
onClick={() => handleDelete(field.id)}
|
|
187
|
+
/>
|
|
188
|
+
)}
|
|
189
|
+
</div>
|
|
135
190
|
</List.Item>
|
|
136
191
|
))}
|
|
137
192
|
</div>
|
|
138
193
|
</>
|
|
139
194
|
)}
|
|
140
195
|
</List.Root>
|
|
196
|
+
|
|
197
|
+
{hiddenProperties.length > 0 && (
|
|
198
|
+
<div>
|
|
199
|
+
<div role='none' className='p-2'>
|
|
200
|
+
<label className={mx(inputTextLabel)}>{t('hidden fields label')}</label>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<List.Root<string>
|
|
204
|
+
items={hiddenProperties}
|
|
205
|
+
isItem={(item): item is string => typeof item === 'string'}
|
|
206
|
+
getId={(property) => property}
|
|
207
|
+
>
|
|
208
|
+
{({ items: properties }) => (
|
|
209
|
+
<div role='list' className='flex flex-col w-full'>
|
|
210
|
+
{properties?.map((property) => (
|
|
211
|
+
<List.Item<string>
|
|
212
|
+
key={property}
|
|
213
|
+
item={property}
|
|
214
|
+
classNames={mx(grid, ghostHover, 'cursor-pointer')}
|
|
215
|
+
>
|
|
216
|
+
<div />
|
|
217
|
+
<List.ItemTitle>{property}</List.ItemTitle>
|
|
218
|
+
<List.ItemButton icon='ph--eye--regular' onClick={() => handleShow(property)} />
|
|
219
|
+
</List.Item>
|
|
220
|
+
))}
|
|
221
|
+
</div>
|
|
222
|
+
)}
|
|
223
|
+
</List.Root>
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
141
226
|
</div>
|
|
142
227
|
|
|
143
228
|
{field && (
|
|
@@ -156,7 +241,7 @@ export const ViewEditor = ({
|
|
|
156
241
|
<IconButton
|
|
157
242
|
icon='ph--plus--regular'
|
|
158
243
|
label={t('button add property')}
|
|
159
|
-
onClick={handleAdd}
|
|
244
|
+
onClick={schema.readonly ? undefined : handleAdd}
|
|
160
245
|
// TODO(burdon): Show field limit in ux (not tooltip).
|
|
161
246
|
disabled={view.fields.length >= VIEW_FIELD_LIMIT}
|
|
162
247
|
/>
|
package/src/components/index.ts
CHANGED
package/src/hooks/useForm.ts
CHANGED
|
@@ -176,12 +176,21 @@ export const useForm = <T extends BaseObject>({
|
|
|
176
176
|
errorPath === jsonPath || errorPath.startsWith(`${jsonPath}.`) || errorPath.startsWith(`${jsonPath}[`),
|
|
177
177
|
);
|
|
178
178
|
|
|
179
|
+
// Only show errors for touched fields.
|
|
180
|
+
const isTouched = touched[jsonPath as JsonPath];
|
|
181
|
+
if (!isTouched) {
|
|
182
|
+
return {
|
|
183
|
+
status: undefined,
|
|
184
|
+
error: undefined,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
179
188
|
return {
|
|
180
189
|
status: matchingError ? 'error' : undefined,
|
|
181
190
|
error: matchingError ? matchingError[1] : undefined,
|
|
182
191
|
};
|
|
183
192
|
},
|
|
184
|
-
[errors],
|
|
193
|
+
[errors, touched],
|
|
185
194
|
);
|
|
186
195
|
|
|
187
196
|
const getFormValue = useCallback<FormHandler<T>['getValue']>(
|