@dxos/react-ui-grid 0.8.4-main.3eb6e50203 → 0.8.4-main.3fbcb4aa9b
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 +8 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/CellEditor/CellEditor.d.ts.map +1 -1
- package/dist/types/src/CellEditor/CellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/CellEditor/GridCellEditor.d.ts.map +1 -1
- package/dist/types/src/Grid/Grid.d.ts +7 -7
- package/dist/types/src/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -18
- package/src/CellEditor/CellEditor.stories.tsx +1 -1
- package/src/CellEditor/CellEditor.tsx +6 -6
- package/src/CellEditor/GridCellEditor.tsx +0 -1
- package/src/Grid/Grid.stories.tsx +13 -12
- package/src/Grid/Grid.tsx +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-grid",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.3fbcb4aa9b",
|
|
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",
|
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"source": "./src/index.ts",
|
|
18
18
|
"types": "./dist/types/src/index.d.ts",
|
|
19
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
19
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
20
|
+
"node": "./dist/lib/browser/index.mjs"
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"types": "dist/types/src/index.d.ts",
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"*": {}
|
|
25
|
-
},
|
|
26
24
|
"files": [
|
|
27
25
|
"dist",
|
|
28
26
|
"src"
|
|
@@ -30,33 +28,34 @@
|
|
|
30
28
|
"dependencies": {
|
|
31
29
|
"@codemirror/autocomplete": "^6.19.0",
|
|
32
30
|
"@codemirror/state": "^6.5.2",
|
|
33
|
-
"@codemirror/view": "^6.38.
|
|
31
|
+
"@codemirror/view": "^6.38.5",
|
|
34
32
|
"@lit/react": "^1.0.8",
|
|
35
33
|
"@radix-ui/react-context": "1.1.1",
|
|
36
34
|
"@radix-ui/react-popper": "1.2.2",
|
|
37
35
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
38
|
-
"@dxos/lit-grid": "0.8.4-main.
|
|
39
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
40
|
-
"@dxos/util": "0.8.4-main.
|
|
41
|
-
"@dxos/ui-editor": "0.8.4-main.
|
|
36
|
+
"@dxos/lit-grid": "0.8.4-main.3fbcb4aa9b",
|
|
37
|
+
"@dxos/react-ui-editor": "0.8.4-main.3fbcb4aa9b",
|
|
38
|
+
"@dxos/util": "0.8.4-main.3fbcb4aa9b",
|
|
39
|
+
"@dxos/ui-editor": "0.8.4-main.3fbcb4aa9b"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
44
42
|
"@types/react": "~19.2.7",
|
|
45
43
|
"@types/react-dom": "~19.2.3",
|
|
46
44
|
"react": "~19.2.3",
|
|
47
45
|
"react-dom": "~19.2.3",
|
|
48
|
-
"vite": "
|
|
49
|
-
"@dxos/random": "0.8.4-main.
|
|
50
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
51
|
-
"@dxos/react-ui-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
46
|
+
"vite": "^8.0.10",
|
|
47
|
+
"@dxos/random": "0.8.4-main.3fbcb4aa9b",
|
|
48
|
+
"@dxos/react-ui": "0.8.4-main.3fbcb4aa9b",
|
|
49
|
+
"@dxos/react-ui-search": "0.8.4-main.3fbcb4aa9b",
|
|
50
|
+
"@dxos/react-ui-list": "0.8.4-main.3fbcb4aa9b",
|
|
51
|
+
"@dxos/ui-theme": "0.8.4-main.3fbcb4aa9b",
|
|
52
|
+
"@dxos/storybook-utils": "0.8.4-main.3fbcb4aa9b"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
55
|
"react": "~19.2.3",
|
|
57
56
|
"react-dom": "~19.2.3",
|
|
58
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
59
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
57
|
+
"@dxos/react-ui": "0.8.4-main.3fbcb4aa9b",
|
|
58
|
+
"@dxos/ui-theme": "0.8.4-main.3fbcb4aa9b"
|
|
60
59
|
},
|
|
61
60
|
"publishConfig": {
|
|
62
61
|
"access": "public"
|
|
@@ -47,7 +47,7 @@ const DefaultStory = (props: CellEditorProps) => {
|
|
|
47
47
|
<div className='text-sm'>
|
|
48
48
|
Last action: <span className='font-mono'>{lastAction}</span>
|
|
49
49
|
</div>
|
|
50
|
-
<div className='relative border border-separator
|
|
50
|
+
<div className='relative border border-separator h-[100px] w-[300px]'>
|
|
51
51
|
<CellEditor
|
|
52
52
|
value={value}
|
|
53
53
|
extensions={extensions}
|
|
@@ -144,18 +144,18 @@ export const CellEditor = ({ value, extensions, box, gridId, autoFocus, slots, o
|
|
|
144
144
|
slots: {
|
|
145
145
|
editor: {
|
|
146
146
|
className: mx(
|
|
147
|
-
'
|
|
147
|
+
'min-w-full! w-min! !max-w-(--dx-grid-cell-editor-max-w-size) min-h-full! !max-h-(--dx-grid-cell-editor-max-h-size)',
|
|
148
148
|
slots?.editor?.className,
|
|
149
149
|
),
|
|
150
150
|
},
|
|
151
|
-
|
|
151
|
+
scroller: {
|
|
152
152
|
className: mx(
|
|
153
|
-
'
|
|
154
|
-
slots?.
|
|
153
|
+
'overflow-x-hidden! !py-[max(0,calc(var(--dx-grid-cell-editor-padding-block)-1px))] pe-0! !pl-(--dx-grid-cell-editor-padding-inline)',
|
|
154
|
+
slots?.scroller?.className,
|
|
155
155
|
),
|
|
156
156
|
},
|
|
157
157
|
content: {
|
|
158
|
-
className: mx('
|
|
158
|
+
className: mx('break-normal!', slots?.content?.className),
|
|
159
159
|
},
|
|
160
160
|
},
|
|
161
161
|
}),
|
|
@@ -173,7 +173,7 @@ export const CellEditor = ({ value, extensions, box, gridId, autoFocus, slots, o
|
|
|
173
173
|
insetBlockStart: box?.insetBlockStart ?? '0px',
|
|
174
174
|
minInlineSize: box?.inlineSize ?? '180px',
|
|
175
175
|
minBlockSize: box?.blockSize ?? '30px',
|
|
176
|
-
...{ '--dx-
|
|
176
|
+
...{ '--dx-grid-cell-width': `${box?.inlineSize ?? 200}px` },
|
|
177
177
|
}}
|
|
178
178
|
{...(gridId && { 'data-grid': gridId })}
|
|
179
179
|
/>
|
|
@@ -7,15 +7,16 @@ import React, { type MouseEvent, type MutableRefObject, useCallback, useRef, use
|
|
|
7
7
|
|
|
8
8
|
import { defaultRowSize } from '@dxos/lit-grid';
|
|
9
9
|
import { type DxGridPlaneCells } from '@dxos/lit-grid';
|
|
10
|
-
import {
|
|
10
|
+
import { random } from '@dxos/random';
|
|
11
11
|
import { DropdownMenu } from '@dxos/react-ui';
|
|
12
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
12
|
import { toPlaneCellIndex } from '@dxos/react-ui-grid';
|
|
14
|
-
import { Combobox, type ComboboxRootProps
|
|
13
|
+
import { Combobox, type ComboboxRootProps } from '@dxos/react-ui-list';
|
|
14
|
+
import { useSearchListResults } from '@dxos/react-ui-search';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
16
|
|
|
16
17
|
import { Grid, type GridContentProps, type GridEditing, type GridRootProps } from './Grid';
|
|
17
18
|
|
|
18
|
-
const storybookItems =
|
|
19
|
+
const storybookItems = random.helpers.uniqueArray(random.commerce.productName, 16);
|
|
19
20
|
|
|
20
21
|
type GridStoryProps = GridContentProps & Pick<GridRootProps, 'onEditingChange'>;
|
|
21
22
|
|
|
@@ -64,7 +65,7 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
64
65
|
}, []);
|
|
65
66
|
|
|
66
67
|
return (
|
|
67
|
-
<div
|
|
68
|
+
<div className='contents'>
|
|
68
69
|
<Grid.Root id='story' editing={editing} onEditingChange={handleEditingChange}>
|
|
69
70
|
{/* TODO(burdon): Why is this property not just "cells" or "values" */}
|
|
70
71
|
<Grid.Content {...props} initialCells={cells} onClick={handleClick} />
|
|
@@ -94,13 +95,13 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
const ComboboxContentWithFiltering = () => {
|
|
97
|
-
const { results, handleSearch } = useSearchListResults({
|
|
98
|
+
const { results, query, handleSearch } = useSearchListResults({
|
|
98
99
|
items: storybookItems,
|
|
99
100
|
});
|
|
100
101
|
|
|
101
102
|
return (
|
|
102
|
-
<Combobox.Content
|
|
103
|
-
<Combobox.Input placeholder='Search...' />
|
|
103
|
+
<Combobox.Content>
|
|
104
|
+
<Combobox.Input placeholder='Search...' value={query} onValueChange={handleSearch} />
|
|
104
105
|
<Combobox.List>
|
|
105
106
|
{results.map((value) => (
|
|
106
107
|
<Combobox.Item key={value} value={value} label={value} />
|
|
@@ -155,7 +156,7 @@ export const Basic: Story = {
|
|
|
155
156
|
'1,1': {
|
|
156
157
|
value: 'Demo decoration',
|
|
157
158
|
accessoryHtml: `
|
|
158
|
-
<button class="dx-button
|
|
159
|
+
<button class="dx-button w-6 px-0.5 min-h-0 absolute inset-y-1 right-1" data-story-action="menu">
|
|
159
160
|
<svg><use href="/icons.svg#ph--arrow-right--regular"/></svg>
|
|
160
161
|
</button>
|
|
161
162
|
`,
|
|
@@ -199,7 +200,7 @@ export const Calendar: Story = {
|
|
|
199
200
|
// TODO(burdon): Formatting changes when cell is selected.
|
|
200
201
|
cells[toPlaneCellIndex({ col, row })] = {
|
|
201
202
|
readonly: true,
|
|
202
|
-
accessoryHtml: '<div class="flex
|
|
203
|
+
accessoryHtml: '<div class="flex h-full w-full justify-center items-center overflow-hidden">0</div>',
|
|
203
204
|
className: '',
|
|
204
205
|
};
|
|
205
206
|
}
|
|
@@ -209,8 +210,8 @@ export const Calendar: Story = {
|
|
|
209
210
|
},
|
|
210
211
|
},
|
|
211
212
|
render: (args) => (
|
|
212
|
-
<div className='
|
|
213
|
-
<div className='
|
|
213
|
+
<div className='h-full flex justify-center'>
|
|
214
|
+
<div className='h-full w-[288px] border-x border-separator'>
|
|
214
215
|
<GridStory {...args} />
|
|
215
216
|
</div>
|
|
216
217
|
</div>
|
package/src/Grid/Grid.tsx
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos/lit-grid/dx-grid.pcss';
|
|
6
|
-
|
|
7
5
|
import { type EventName, createComponent } from '@lit/react';
|
|
8
6
|
import { type Scope, createContextScope } from '@radix-ui/react-context';
|
|
9
7
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
@@ -16,6 +14,7 @@ import React, {
|
|
|
16
14
|
useState,
|
|
17
15
|
} from 'react';
|
|
18
16
|
|
|
17
|
+
import '@dxos/lit-grid/dx-grid.pcss';
|
|
19
18
|
import { type DxAxisResize, type DxEditRequest, type DxGridCellsSelect, DxGrid as NaturalDxGrid } from '@dxos/lit-grid';
|
|
20
19
|
|
|
21
20
|
type DxGridElement = NaturalDxGrid;
|
|
@@ -72,6 +71,7 @@ type GridRootProps = PropsWithChildren<
|
|
|
72
71
|
}>
|
|
73
72
|
>;
|
|
74
73
|
|
|
74
|
+
// TODO(burdon): Make headless.
|
|
75
75
|
const GridRoot = ({
|
|
76
76
|
__gridScope,
|
|
77
77
|
children,
|
|
@@ -152,12 +152,12 @@ GridContent.displayName = GRID_CONTENT_NAME;
|
|
|
152
152
|
// Fragments
|
|
153
153
|
//
|
|
154
154
|
|
|
155
|
-
// NOTE(Zan): These fragments add border to
|
|
155
|
+
// NOTE(Zan): These fragments add border to w-end and h-end of the grid using pseudo-elements.
|
|
156
156
|
// These are offset by 1px to avoid double borders in planks.
|
|
157
157
|
const gridSeparatorInlineEnd =
|
|
158
|
-
'[&>.dx-grid]:relative [&>.dx-grid]:after:absolute [&>.dx-grid]:after:inset-
|
|
158
|
+
'[&>.dx-grid]:relative [&>.dx-grid]:after:absolute [&>.dx-grid]:after:inset-y-0 [&>.dx-grid]:after:-right-px [&>.dx-grid]:after:w-px [&>.dx-grid]:after:bg-subdued-separator';
|
|
159
159
|
const gridSeparatorBlockEnd =
|
|
160
|
-
'[&>.dx-grid]:relative [&>.dx-grid]:before:absolute [&>.dx-grid]:before:inset-
|
|
160
|
+
'[&>.dx-grid]:relative [&>.dx-grid]:before:absolute [&>.dx-grid]:before:inset-x-0 [&>.dx-grid]:before:-bottom-px [&>.dx-grid]:before:h-px [&>.dx-grid]:before:bg-subdued-separator';
|
|
161
161
|
|
|
162
162
|
//
|
|
163
163
|
// Exports
|