@dxos/react-ui-grid 0.8.4-main.b97322e → 0.8.4-main.dedc0f3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-grid",
3
- "version": "0.8.4-main.b97322e",
3
+ "version": "0.8.4-main.dedc0f3",
4
4
  "description": "React component which manages a `dx-grid` Lit web component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,6 +10,7 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
13
14
  "types": "./dist/types/src/index.d.ts",
14
15
  "browser": "./dist/lib/browser/index.mjs"
15
16
  }
@@ -23,35 +24,35 @@
23
24
  "src"
24
25
  ],
25
26
  "dependencies": {
26
- "@codemirror/autocomplete": "^6.18.1",
27
- "@codemirror/state": "^6.4.1",
28
- "@codemirror/view": "^6.34.1",
27
+ "@codemirror/autocomplete": "^6.18.7",
28
+ "@codemirror/state": "^6.5.2",
29
+ "@codemirror/view": "^6.38.2",
29
30
  "@lit/react": "^1.0.5",
30
31
  "@preact-signals/safe-react": "^0.9.0",
31
32
  "@radix-ui/react-context": "1.1.1",
32
33
  "@radix-ui/react-popper": "1.2.2",
33
34
  "@radix-ui/react-use-controllable-state": "1.1.0",
34
- "@dxos/lit-grid": "0.8.4-main.b97322e",
35
- "@dxos/util": "0.8.4-main.b97322e",
36
- "@dxos/react-ui-editor": "0.8.4-main.b97322e"
35
+ "@dxos/react-ui-editor": "0.8.4-main.dedc0f3",
36
+ "@dxos/lit-grid": "0.8.4-main.dedc0f3",
37
+ "@dxos/util": "0.8.4-main.dedc0f3"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@types/react": "~18.2.0",
40
41
  "@types/react-dom": "~18.2.0",
41
42
  "react": "~18.2.0",
42
43
  "react-dom": "~18.2.0",
43
- "vite": "5.4.7",
44
- "@dxos/random": "0.8.4-main.b97322e",
45
- "@dxos/react-ui": "0.8.4-main.b97322e",
46
- "@dxos/react-ui-searchlist": "0.8.4-main.b97322e",
47
- "@dxos/react-ui-theme": "0.8.4-main.b97322e",
48
- "@dxos/storybook-utils": "0.8.4-main.b97322e"
44
+ "vite": "7.1.1",
45
+ "@dxos/random": "0.8.4-main.dedc0f3",
46
+ "@dxos/react-ui-searchlist": "0.8.4-main.dedc0f3",
47
+ "@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
48
+ "@dxos/storybook-utils": "0.8.4-main.dedc0f3",
49
+ "@dxos/react-ui": "0.8.4-main.dedc0f3"
49
50
  },
50
51
  "peerDependencies": {
51
52
  "react": "~18.2.0",
52
53
  "react-dom": "~18.2.0",
53
- "@dxos/react-ui": "0.8.4-main.b97322e",
54
- "@dxos/react-ui-theme": "0.8.4-main.b97322e"
54
+ "@dxos/react-ui": "0.8.4-main.dedc0f3",
55
+ "@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
55
56
  },
56
57
  "publishConfig": {
57
58
  "access": "public"
@@ -11,8 +11,8 @@ import { withTheme } from '@dxos/storybook-utils';
11
11
 
12
12
  import { CellEditor, type CellEditorProps, type EditorKeyEvent, editorKeys } from './CellEditor';
13
13
 
14
- const DefaultStory = (args: CellEditorProps) => {
15
- const [value, setValue] = useState(args.value || 'Edit me');
14
+ const DefaultStory = (props: CellEditorProps) => {
15
+ const [value, setValue] = useState(props.value || 'Edit me');
16
16
  const [lastAction, setLastAction] = useState<string>('');
17
17
 
18
18
  const handleBlur = (newValue?: string) => {
@@ -32,7 +32,7 @@ const DefaultStory = (args: CellEditorProps) => {
32
32
  };
33
33
 
34
34
  // Create an extension with editor keys
35
- const extension = args.extension || [
35
+ const extensions = props.extensions || [
36
36
  editorKeys({
37
37
  onClose: handleKeyEvent,
38
38
  onNav: (value, event) => {
@@ -52,8 +52,8 @@ const DefaultStory = (args: CellEditorProps) => {
52
52
  <div className='relative border border-separator h-[100px] w-[300px]'>
53
53
  <CellEditor
54
54
  value={value}
55
- extension={extension}
56
- autoFocus={args.autoFocus}
55
+ extensions={extensions}
56
+ autoFocus={props.autoFocus}
57
57
  onBlur={handleBlur}
58
58
  box={{
59
59
  insetInlineStart: 10,
@@ -68,7 +68,7 @@ const DefaultStory = (args: CellEditorProps) => {
68
68
  );
69
69
  };
70
70
 
71
- const meta: Meta<CellEditorProps> = {
71
+ const meta = {
72
72
  title: 'ui/react-ui-grid/CellEditor',
73
73
  component: CellEditor,
74
74
  render: DefaultStory,
@@ -76,11 +76,11 @@ const meta: Meta<CellEditorProps> = {
76
76
  parameters: {
77
77
  layout: 'centered',
78
78
  },
79
- };
79
+ } satisfies Meta<typeof CellEditor>;
80
80
 
81
81
  export default meta;
82
82
 
83
- type Story = StoryObj<CellEditorProps>;
83
+ type Story = StoryObj<typeof meta>;
84
84
 
85
85
  export const Default: Story = {
86
86
  args: {
@@ -9,12 +9,12 @@ import React, { type KeyboardEvent } from 'react';
9
9
 
10
10
  import { useThemeContext } from '@dxos/react-ui';
11
11
  import {
12
+ type ThemeExtensionsOptions,
12
13
  type UseTextEditorProps,
13
14
  createBasicExtensions,
14
15
  createThemeExtensions,
15
16
  preventNewline,
16
17
  useTextEditor,
17
- type ThemeExtensionsOptions,
18
18
  } from '@dxos/react-ui-editor';
19
19
  import { mx } from '@dxos/react-ui-theme';
20
20
 
@@ -116,14 +116,14 @@ export const editorKeys = ({ onNav, onClose }: EditorKeysProps): Extension => {
116
116
 
117
117
  export type CellEditorProps = {
118
118
  value?: string;
119
- extension?: Extension;
119
+ extensions?: Extension;
120
120
  box?: GridEditBox;
121
121
  gridId?: string;
122
122
  onBlur?: EditorBlurHandler;
123
123
  } & Pick<UseTextEditorProps, 'autoFocus'> &
124
124
  Pick<ThemeExtensionsOptions, 'slots'>;
125
125
 
126
- export const CellEditor = ({ value, extension, autoFocus, onBlur, box, gridId, slots }: CellEditorProps) => {
126
+ export const CellEditor = ({ value, extensions, box, gridId, onBlur, autoFocus, slots }: CellEditorProps) => {
127
127
  const { themeMode } = useThemeContext();
128
128
  const { parentRef } = useTextEditor(() => {
129
129
  return {
@@ -131,7 +131,7 @@ export const CellEditor = ({ value, extension, autoFocus, onBlur, box, gridId, s
131
131
  initialValue: value,
132
132
  selection: { anchor: value?.length ?? 0 },
133
133
  extensions: [
134
- extension ?? [],
134
+ extensions ?? [],
135
135
  preventNewline,
136
136
  EditorView.focusChangeEffect.of((state, focusing) => {
137
137
  if (!focusing) {
@@ -149,18 +149,20 @@ export const CellEditor = ({ value, extension, autoFocus, onBlur, box, gridId, s
149
149
  slots?.editor?.className,
150
150
  ),
151
151
  },
152
- scroller: {
152
+ scroll: {
153
153
  className: mx(
154
154
  '!overflow-x-hidden !plb-[max(0,calc(var(--dx-grid-cell-editor-padding-block)-1px))] !pie-0 !pis-[--dx-grid-cell-editor-padding-inline]',
155
- slots?.scroller?.className,
155
+ slots?.scroll?.className,
156
156
  ),
157
157
  },
158
- content: { className: mx('!break-normal', slots?.content?.className) },
158
+ content: {
159
+ className: mx('!break-normal', slots?.content?.className),
160
+ },
159
161
  },
160
162
  }),
161
163
  ],
162
164
  };
163
- }, [extension, autoFocus, value, onBlur, themeMode, slots]);
165
+ }, [extensions, autoFocus, value, onBlur, themeMode, slots]);
164
166
 
165
167
  return (
166
168
  <div
@@ -4,16 +4,17 @@
4
4
 
5
5
  import React, { useCallback } from 'react';
6
6
 
7
+ import { type DxGridCellIndex, type GridScopedProps, useGridContext } from '../Grid';
8
+
7
9
  import { CellEditor, type CellEditorProps } from './CellEditor';
8
- import { type GridScopedProps, useGridContext, type DxGridCellIndex } from '../Grid';
9
10
 
10
11
  export type GridCellEditorProps = GridScopedProps<
11
- Pick<CellEditorProps, 'extension' | 'onBlur' | 'slots'> & {
12
+ Pick<CellEditorProps, 'extensions' | 'onBlur' | 'slots'> & {
12
13
  getCellContent: (index: DxGridCellIndex) => string | undefined;
13
14
  }
14
15
  >;
15
16
 
16
- export const GridCellEditor = ({ extension, getCellContent, onBlur, slots, __gridScope }: GridCellEditorProps) => {
17
+ export const GridCellEditor = ({ extensions, getCellContent, onBlur, slots, __gridScope }: GridCellEditorProps) => {
17
18
  const { id, editing, setEditing, editBox } = useGridContext('GridCellEditor', __gridScope);
18
19
 
19
20
  const handleBlur = useCallback(
@@ -30,7 +31,7 @@ export const GridCellEditor = ({ extension, getCellContent, onBlur, slots, __gri
30
31
  autoFocus
31
32
  box={editBox}
32
33
  onBlur={handleBlur}
33
- extension={extension}
34
+ extensions={extensions}
34
35
  gridId={id}
35
36
  slots={slots}
36
37
  />
@@ -13,7 +13,7 @@ import { DropdownMenu } from '@dxos/react-ui';
13
13
  import { PopoverCombobox, type PopoverComboboxRootProps } from '@dxos/react-ui-searchlist';
14
14
  import { withTheme } from '@dxos/storybook-utils';
15
15
 
16
- import { Grid, type GridEditing, type GridContentProps, type GridRootProps } from './Grid';
16
+ import { Grid, type GridContentProps, type GridEditing, type GridRootProps } from './Grid';
17
17
 
18
18
  const storybookItems = faker.helpers.uniqueArray(faker.commerce.productName, 16);
19
19
 
@@ -101,12 +101,12 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
101
101
  );
102
102
  };
103
103
 
104
- const meta: Meta<GridStoryProps> = {
104
+ const meta = {
105
105
  title: 'ui/react-ui-grid/Grid',
106
106
  component: GridStory,
107
107
  decorators: [withTheme],
108
108
  parameters: { layout: 'fullscreen' },
109
- };
109
+ } satisfies Meta<typeof GridStory>;
110
110
 
111
111
  export default meta;
112
112
 
package/src/Grid/Grid.tsx CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  import '@dxos/lit-grid/dx-grid.pcss';
6
6
 
7
- import { createComponent, type EventName } from '@lit/react';
8
- import { createContextScope, type Scope } from '@radix-ui/react-context';
7
+ import { type EventName, createComponent } from '@lit/react';
8
+ import { type Scope, createContextScope } from '@radix-ui/react-context';
9
9
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
10
10
  import React, {
11
11
  type ComponentProps,
@@ -178,6 +178,7 @@ export {
178
178
  toPlaneCellIndex,
179
179
  parseCellIndex,
180
180
  cellQuery,
181
+ DxEditRequest,
181
182
  } from '@dxos/lit-grid';
182
183
 
183
184
  export type {