@dxos/react-ui-form 0.8.0 → 0.8.1-main.a06ad20

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 (53) hide show
  1. package/dist/lib/browser/index.mjs +56 -6
  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 +75 -25
  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 +56 -6
  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 -1
  11. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/ArrayField.d.ts +2 -1
  13. package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Defaults.d.ts +6 -5
  15. package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/Form.d.ts +2 -2
  17. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/Form.stories.d.ts +7 -7
  19. package/dist/types/src/components/Form/FormActions.d.ts +2 -1
  20. package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
  21. package/dist/types/src/components/Form/FormContent.d.ts +3 -2
  22. package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
  23. package/dist/types/src/components/Form/FormContext.d.ts +1 -1
  24. package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
  25. package/dist/types/src/components/Form/Input.d.ts +2 -2
  26. package/dist/types/src/components/Form/Input.d.ts.map +1 -1
  27. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts +2 -1
  28. package/dist/types/src/components/Form/custom/GeoPointInput.d.ts.map +1 -1
  29. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts +2 -1
  30. package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
  31. package/dist/types/src/components/Form/custom/TupleInput.d.ts +2 -1
  32. package/dist/types/src/components/Form/custom/TupleInput.d.ts.map +1 -1
  33. package/dist/types/src/components/ViewEditor/Test.stories.d.ts +2 -1
  34. package/dist/types/src/components/ViewEditor/Test.stories.d.ts.map +1 -1
  35. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +2 -1
  36. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  37. package/dist/types/src/components/deprecated/Form.d.ts +3 -2
  38. package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
  39. package/dist/types/src/components/deprecated/Form.stories.d.ts +2 -1
  40. package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
  41. package/dist/types/src/components/deprecated/FormInput.d.ts +2 -2
  42. package/dist/types/src/components/deprecated/FormInput.d.ts.map +1 -1
  43. package/dist/types/src/components/testing.d.ts +3 -3
  44. package/dist/types/src/components/testing.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useForm.d.ts +2 -1
  46. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  47. package/dist/types/src/translations.d.ts +1 -0
  48. package/dist/types/src/translations.d.ts.map +1 -1
  49. package/package.json +26 -28
  50. package/src/components/ViewEditor/ViewEditor.tsx +71 -2
  51. package/src/components/deprecated/Form.tsx +2 -2
  52. package/src/hooks/useForm.ts +2 -1
  53. package/src/translations.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9C,wBA4DE"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9C,wBA6DE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-form",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-main.a06ad20",
4
4
  "description": "Data components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -25,51 +25,49 @@
25
25
  "dependencies": {
26
26
  "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
27
27
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
28
- "@effect/schema": "^0.75.5",
29
28
  "@radix-ui/react-context": "1.1.1",
30
29
  "date-fns": "^3.3.1",
31
30
  "jsonpath": "^1.1.1",
32
- "@dxos/async": "0.8.0",
33
- "@dxos/echo-schema": "0.8.0",
34
- "@dxos/debug": "0.8.0",
35
- "@dxos/echo-db": "0.8.0",
36
- "@dxos/invariant": "0.8.0",
37
- "@dxos/keys": "0.8.0",
38
- "@dxos/live-object": "0.8.0",
39
- "@dxos/log": "0.8.0",
40
- "@dxos/effect": "0.8.0",
41
- "@dxos/react-ui-list": "0.8.0",
42
- "@dxos/react-client": "0.8.0",
43
- "@dxos/react-ui-pickers": "0.8.0",
44
- "@dxos/react-ui-types": "0.8.0",
45
- "@dxos/schema": "0.8.0",
46
- "@dxos/util": "0.8.0"
31
+ "@dxos/async": "0.8.1-main.a06ad20",
32
+ "@dxos/debug": "0.8.1-main.a06ad20",
33
+ "@dxos/echo-db": "0.8.1-main.a06ad20",
34
+ "@dxos/echo-schema": "0.8.1-main.a06ad20",
35
+ "@dxos/invariant": "0.8.1-main.a06ad20",
36
+ "@dxos/keys": "0.8.1-main.a06ad20",
37
+ "@dxos/effect": "0.8.1-main.a06ad20",
38
+ "@dxos/live-object": "0.8.1-main.a06ad20",
39
+ "@dxos/log": "0.8.1-main.a06ad20",
40
+ "@dxos/react-client": "0.8.1-main.a06ad20",
41
+ "@dxos/react-ui-list": "0.8.1-main.a06ad20",
42
+ "@dxos/react-ui-pickers": "0.8.1-main.a06ad20",
43
+ "@dxos/schema": "0.8.1-main.a06ad20",
44
+ "@dxos/util": "0.8.1-main.a06ad20",
45
+ "@dxos/react-ui-types": "0.8.1-main.a06ad20"
47
46
  },
48
47
  "devDependencies": {
49
48
  "@phosphor-icons/react": "^2.1.5",
50
49
  "@types/jsonpath": "^0.2.4",
51
50
  "@types/react": "~18.2.0",
52
51
  "@types/react-dom": "~18.2.0",
53
- "effect": "^3.12.3",
52
+ "effect": "3.13.3",
54
53
  "fast-check": "^3.19.0",
55
54
  "react": "~18.2.0",
56
55
  "react-dom": "~18.2.0",
57
56
  "vite": "5.4.7",
58
- "@dxos/echo-signals": "0.8.0",
59
- "@dxos/random": "0.8.0",
60
- "@dxos/react-ui-syntax-highlighter": "0.8.0",
61
- "@dxos/react-ui": "0.8.0",
62
- "@dxos/storybook-utils": "0.8.0",
63
- "@dxos/react-ui-theme": "0.8.0"
57
+ "@dxos/echo-signals": "0.8.1-main.a06ad20",
58
+ "@dxos/random": "0.8.1-main.a06ad20",
59
+ "@dxos/react-ui": "0.8.1-main.a06ad20",
60
+ "@dxos/react-ui-syntax-highlighter": "0.8.1-main.a06ad20",
61
+ "@dxos/react-ui-theme": "0.8.1-main.a06ad20",
62
+ "@dxos/storybook-utils": "0.8.1-main.a06ad20"
64
63
  },
65
64
  "peerDependencies": {
66
- "@effect/schema": "^0.75.5",
67
65
  "@phosphor-icons/react": "^2.1.5",
68
- "effect": "^3.12.3",
66
+ "effect": "3.13.3",
69
67
  "react": "~18.2.0",
70
68
  "react-dom": "~18.2.0",
71
- "@dxos/react-ui": "0.8.0",
72
- "@dxos/react-ui-theme": "0.8.0"
69
+ "@dxos/react-ui": "0.8.1-main.a06ad20",
70
+ "@dxos/react-ui-theme": "0.8.1-main.a06ad20"
73
71
  },
74
72
  "publishConfig": {
75
73
  "access": "public"
@@ -5,7 +5,7 @@
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 EchoSchema, S } from '@dxos/echo-schema';
8
+ import { AST, Format, type EchoSchema, S, type JsonProp } from '@dxos/echo-schema';
9
9
  import { IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
10
10
  import { List } from '@dxos/react-ui-list';
11
11
  import { ghostHover, inputTextLabel, mx } from '@dxos/react-ui-theme';
@@ -88,6 +88,16 @@ export const ViewEditor = ({
88
88
  setField(field);
89
89
  }, [view]);
90
90
 
91
+ const handleDelete = useCallback(
92
+ (fieldId: string) => {
93
+ if (fieldId === field?.id) {
94
+ setField(undefined);
95
+ }
96
+ onDelete(fieldId);
97
+ },
98
+ [onDelete, field],
99
+ );
100
+
91
101
  const handleMove = useCallback(
92
102
  (fromIndex: number, toIndex: number) => {
93
103
  // NOTE(ZaymonFC): Using arrayMove here causes a race condition with the kanban model.
@@ -101,6 +111,24 @@ export const ViewEditor = ({
101
111
 
102
112
  const handleClose = useCallback(() => setField(undefined), []);
103
113
 
114
+ const hiddenProperties = projection.getHiddenProperties();
115
+
116
+ const handleHide = useCallback(
117
+ (fieldId: string) => {
118
+ setField(undefined);
119
+ projection.hideFieldProjection(fieldId);
120
+ },
121
+ [projection],
122
+ );
123
+
124
+ const handleShow = useCallback(
125
+ (property: string) => {
126
+ setField(undefined);
127
+ projection.showFieldProjection(property as JsonProp);
128
+ },
129
+ [projection],
130
+ );
131
+
104
132
  return (
105
133
  <div role='none' className={mx('flex flex-col w-full divide-y divide-separator', classNames)}>
106
134
  <Form<ViewMetaType> autoSave schema={ViewMetaSchema} values={viewValues} onSave={handleViewUpdate} />
@@ -131,13 +159,54 @@ export const ViewEditor = ({
131
159
  <List.Item<FieldType> key={field.id} item={field} classNames={mx(grid, ghostHover, 'cursor-pointer')}>
132
160
  <List.ItemDragHandle />
133
161
  <List.ItemTitle onClick={() => handleSelect(field)}>{field.path}</List.ItemTitle>
134
- <List.ItemDeleteButton disabled={view.fields.length <= 1} onClick={() => onDelete(field.id)} />
162
+ <div className='flex items-center gap-2 -ml-4'>
163
+ <List.ItemButton
164
+ icon='ph--eye-slash--regular'
165
+ disabled={view.fields.length <= 1}
166
+ onClick={() => handleHide(field.id)}
167
+ />
168
+ <List.ItemDeleteButton
169
+ icon='ph--trash--regular'
170
+ disabled={view.fields.length <= 1}
171
+ onClick={() => handleDelete(field.id)}
172
+ />
173
+ </div>
135
174
  </List.Item>
136
175
  ))}
137
176
  </div>
138
177
  </>
139
178
  )}
140
179
  </List.Root>
180
+
181
+ {hiddenProperties.length > 0 && (
182
+ <div>
183
+ <div role='none' className='p-2'>
184
+ <label className={mx(inputTextLabel)}>{t('hidden fields label')}</label>
185
+ </div>
186
+
187
+ <List.Root<string>
188
+ items={hiddenProperties}
189
+ isItem={(item): item is string => typeof item === 'string'}
190
+ getId={(property) => property}
191
+ >
192
+ {({ items: properties }) => (
193
+ <div role='list' className='flex flex-col w-full'>
194
+ {properties?.map((property) => (
195
+ <List.Item<string>
196
+ key={property}
197
+ item={property}
198
+ classNames={mx(grid, ghostHover, 'cursor-pointer')}
199
+ >
200
+ <div />
201
+ <List.ItemTitle>{property}</List.ItemTitle>
202
+ <List.ItemButton icon='ph--eye--regular' onClick={() => handleShow(property)} />
203
+ </List.Item>
204
+ ))}
205
+ </div>
206
+ )}
207
+ </List.Root>
208
+ </div>
209
+ )}
141
210
  </div>
142
211
 
143
212
  {field && (
@@ -2,10 +2,10 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Option, pipe } from 'effect';
5
+ import { SchemaAST as AST, type Schema as S, Option, pipe } from 'effect';
6
6
  import React, { useState } from 'react';
7
7
 
8
- import { AST, type S, findProperty } from '@dxos/effect';
8
+ import { findProperty } from '@dxos/effect';
9
9
  import { Input, type ThemedClassName, type TextInputProps as NativeTextInputProps } from '@dxos/react-ui';
10
10
  import { mx } from '@dxos/react-ui-theme';
11
11
  import { type ViewType, getFieldValue, setFieldValue } from '@dxos/schema';
@@ -2,10 +2,11 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { SchemaAST as AST, type Schema as S } from 'effect';
5
6
  import { useCallback, useEffect, useMemo, useState } from 'react';
6
7
 
7
8
  import { type BaseObject, getValue, setValue } from '@dxos/echo-schema';
8
- import { AST, type S, type SimpleType, type JsonPath, createJsonPath, fromEffectValidationPath } from '@dxos/effect';
9
+ import { type SimpleType, type JsonPath, createJsonPath, fromEffectValidationPath } from '@dxos/effect';
9
10
  import { invariant } from '@dxos/invariant';
10
11
  import { log } from '@dxos/log';
11
12
  import { validateSchema, type ValidationError } from '@dxos/schema';
@@ -9,6 +9,7 @@ export default [
9
9
  'en-US': {
10
10
  [translationKey]: {
11
11
  'fields label': 'Fields',
12
+ 'hidden fields label': 'Hidden Fields',
12
13
 
13
14
  // TODO(burdon): Standardize field/property.
14
15
  'button add property': 'Add property',