@dxos/react-ui-grid 0.8.4-main.7ace549 → 0.8.4-main.8360d9e660

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,12 +1,16 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-grid",
3
- "version": "0.8.4-main.7ace549",
3
+ "version": "0.8.4-main.8360d9e660",
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",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
- "sideEffects": true,
13
+ "sideEffects": false,
10
14
  "type": "module",
11
15
  "exports": {
12
16
  ".": {
@@ -28,31 +32,31 @@
28
32
  "@codemirror/state": "^6.5.2",
29
33
  "@codemirror/view": "^6.38.4",
30
34
  "@lit/react": "^1.0.8",
31
- "@preact-signals/safe-react": "^0.9.0",
32
35
  "@radix-ui/react-context": "1.1.1",
33
36
  "@radix-ui/react-popper": "1.2.2",
34
37
  "@radix-ui/react-use-controllable-state": "1.1.0",
35
- "@dxos/react-ui-editor": "0.8.4-main.7ace549",
36
- "@dxos/lit-grid": "0.8.4-main.7ace549",
37
- "@dxos/util": "0.8.4-main.7ace549"
38
+ "@dxos/lit-grid": "0.8.4-main.8360d9e660",
39
+ "@dxos/react-ui-editor": "0.8.4-main.8360d9e660",
40
+ "@dxos/ui-editor": "0.8.4-main.8360d9e660",
41
+ "@dxos/util": "0.8.4-main.8360d9e660"
38
42
  },
39
43
  "devDependencies": {
40
- "@types/react": "~19.2.2",
41
- "@types/react-dom": "~19.2.2",
42
- "react": "~19.2.0",
43
- "react-dom": "~19.2.0",
44
- "vite": "7.1.9",
45
- "@dxos/react-ui": "0.8.4-main.7ace549",
46
- "@dxos/react-ui-searchlist": "0.8.4-main.7ace549",
47
- "@dxos/random": "0.8.4-main.7ace549",
48
- "@dxos/storybook-utils": "0.8.4-main.7ace549",
49
- "@dxos/react-ui-theme": "0.8.4-main.7ace549"
44
+ "@types/react": "~19.2.7",
45
+ "@types/react-dom": "~19.2.3",
46
+ "react": "~19.2.3",
47
+ "react-dom": "~19.2.3",
48
+ "vite": "^7.1.11",
49
+ "@dxos/react-ui": "0.8.4-main.8360d9e660",
50
+ "@dxos/react-ui-searchlist": "0.8.4-main.8360d9e660",
51
+ "@dxos/storybook-utils": "0.8.4-main.8360d9e660",
52
+ "@dxos/ui-theme": "0.8.4-main.8360d9e660",
53
+ "@dxos/random": "0.8.4-main.8360d9e660"
50
54
  },
51
55
  "peerDependencies": {
52
- "react": "^19.0.0",
53
- "react-dom": "^19.0.0",
54
- "@dxos/react-ui": "0.8.4-main.7ace549",
55
- "@dxos/react-ui-theme": "0.8.4-main.7ace549"
56
+ "react": "~19.2.3",
57
+ "react-dom": "~19.2.3",
58
+ "@dxos/react-ui": "0.8.4-main.8360d9e660",
59
+ "@dxos/ui-theme": "0.8.4-main.8360d9e660"
56
60
  },
57
61
  "publishConfig": {
58
62
  "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 bs-[100px] is-[300px]'>
50
+ <div className='relative border border-separator h-[100px] w-[300px]'>
51
51
  <CellEditor
52
52
  value={value}
53
53
  extensions={extensions}
@@ -70,7 +70,7 @@ const meta = {
70
70
  title: 'ui/react-ui-grid/CellEditor',
71
71
  component: CellEditor,
72
72
  render: DefaultStory,
73
- decorators: [withTheme],
73
+ decorators: [withTheme()],
74
74
  parameters: {
75
75
  layout: 'centered',
76
76
  },
@@ -8,15 +8,14 @@ import { EditorView, keymap } from '@codemirror/view';
8
8
  import React, { type KeyboardEvent } from 'react';
9
9
 
10
10
  import { useThemeContext } from '@dxos/react-ui';
11
+ import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
11
12
  import {
12
13
  type ThemeExtensionsOptions,
13
- type UseTextEditorProps,
14
14
  createBasicExtensions,
15
15
  createThemeExtensions,
16
16
  filterChars,
17
- useTextEditor,
18
- } from '@dxos/react-ui-editor';
19
- import { mx } from '@dxos/react-ui-theme';
17
+ } from '@dxos/ui-editor';
18
+ import { mx } from '@dxos/ui-theme';
20
19
 
21
20
  import { type GridEditBox } from '../Grid';
22
21
 
@@ -123,7 +122,7 @@ export type CellEditorProps = {
123
122
  } & Pick<UseTextEditorProps, 'autoFocus'> &
124
123
  Pick<ThemeExtensionsOptions, 'slots'>;
125
124
 
126
- export const CellEditor = ({ value, extensions, box, gridId, onBlur, autoFocus, slots }: CellEditorProps) => {
125
+ export const CellEditor = ({ value, extensions, box, gridId, autoFocus, slots, onBlur }: CellEditorProps) => {
127
126
  const { themeMode } = useThemeContext();
128
127
  const { parentRef } = useTextEditor(() => {
129
128
  return {
@@ -145,18 +144,18 @@ export const CellEditor = ({ value, extensions, box, gridId, onBlur, autoFocus,
145
144
  slots: {
146
145
  editor: {
147
146
  className: mx(
148
- '!min-is-full !is-min !max-is-[--dx-grid-cell-editor-max-inline-size] !min-bs-full !max-bs-[--dx-grid-cell-editor-max-block-size]',
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)',
149
148
  slots?.editor?.className,
150
149
  ),
151
150
  },
152
151
  scroll: {
153
152
  className: mx(
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]',
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)',
155
154
  slots?.scroll?.className,
156
155
  ),
157
156
  },
158
157
  content: {
159
- className: mx('!break-normal', slots?.content?.className),
158
+ className: mx('break-normal!', slots?.content?.className),
160
159
  },
161
160
  },
162
161
  }),
@@ -174,7 +173,7 @@ export const CellEditor = ({ value, extensions, box, gridId, onBlur, autoFocus,
174
173
  insetBlockStart: box?.insetBlockStart ?? '0px',
175
174
  minInlineSize: box?.inlineSize ?? '180px',
176
175
  minBlockSize: box?.blockSize ?? '30px',
177
- ...{ '--dx-gridCellWidth': `${box?.inlineSize ?? 200}px` },
176
+ ...{ '--dx-grid-cell-width': `${box?.inlineSize ?? 200}px` },
178
177
  }}
179
178
  {...(gridId && { 'data-grid': gridId })}
180
179
  />
@@ -11,7 +11,7 @@ import { faker } from '@dxos/random';
11
11
  import { DropdownMenu } from '@dxos/react-ui';
12
12
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
13
13
  import { toPlaneCellIndex } from '@dxos/react-ui-grid';
14
- import { Combobox, type ComboboxRootProps } from '@dxos/react-ui-searchlist';
14
+ import { Combobox, type ComboboxRootProps, useSearchListResults } from '@dxos/react-ui-searchlist';
15
15
 
16
16
  import { Grid, type GridContentProps, type GridEditing, type GridRootProps } from './Grid';
17
17
 
@@ -87,24 +87,34 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
87
87
  onValueChange={setMultiselectValue}
88
88
  >
89
89
  <Combobox.VirtualTrigger virtualRef={triggerRef} />
90
- <Combobox.Content filter={(value, search) => (value.includes(search) ? 1 : 0)}>
91
- <Combobox.Input placeholder='Search...' />
92
- <Combobox.List>
93
- {storybookItems.map((value) => (
94
- <Combobox.Item key={value}>{value}</Combobox.Item>
95
- ))}
96
- </Combobox.List>
97
- <Combobox.Arrow />
98
- </Combobox.Content>
90
+ <ComboboxContentWithFiltering />
99
91
  </Combobox.Root>
100
92
  </div>
101
93
  );
102
94
  };
103
95
 
96
+ const ComboboxContentWithFiltering = () => {
97
+ const { results, handleSearch } = useSearchListResults({
98
+ items: storybookItems,
99
+ });
100
+
101
+ return (
102
+ <Combobox.Content onSearch={handleSearch}>
103
+ <Combobox.Input placeholder='Search...' />
104
+ <Combobox.List>
105
+ {results.map((value) => (
106
+ <Combobox.Item key={value} value={value} label={value} />
107
+ ))}
108
+ </Combobox.List>
109
+ <Combobox.Arrow />
110
+ </Combobox.Content>
111
+ );
112
+ };
113
+
104
114
  const meta = {
105
115
  title: 'ui/react-ui-grid/Grid',
106
116
  component: GridStory,
107
- decorators: [withTheme, withLayout({ container: 'column' })],
117
+ decorators: [withTheme(), withLayout({ layout: 'column' })],
108
118
  parameters: {
109
119
  layout: 'fullscreen',
110
120
  },
@@ -145,7 +155,7 @@ export const Basic: Story = {
145
155
  '1,1': {
146
156
  value: 'Demo decoration',
147
157
  accessoryHtml: `
148
- <button class="dx-button is-6 pli-0.5 min-bs-0 absolute inset-block-1 inline-end-1" data-story-action="menu">
158
+ <button class="dx-button w-6 px-0.5 min-h-0 absolute inset-y-1 right-1" data-story-action="menu">
149
159
  <svg><use href="/icons.svg#ph--arrow-right--regular"/></svg>
150
160
  </button>
151
161
  `,
@@ -189,7 +199,7 @@ export const Calendar: Story = {
189
199
  // TODO(burdon): Formatting changes when cell is selected.
190
200
  cells[toPlaneCellIndex({ col, row })] = {
191
201
  readonly: true,
192
- accessoryHtml: '<div class="flex bs-full is-full justify-center items-center overflow-hidden">0</div>',
202
+ accessoryHtml: '<div class="flex h-full w-full justify-center items-center overflow-hidden">0</div>',
193
203
  className: '',
194
204
  };
195
205
  }
@@ -199,8 +209,8 @@ export const Calendar: Story = {
199
209
  },
200
210
  },
201
211
  render: (args) => (
202
- <div className='bs-full flex justify-center'>
203
- <div className='bs-full is-[288px] border-x border-separator'>
212
+ <div className='h-full flex justify-center'>
213
+ <div className='h-full w-[288px] border-x border-separator'>
204
214
  <GridStory {...args} />
205
215
  </div>
206
216
  </div>
package/src/Grid/Grid.tsx CHANGED
@@ -63,20 +63,23 @@ const [createGridContext, createGridScope] = createContextScope(GRID_NAME, []);
63
63
  const [GridProvider, useGridContext] = createGridContext<GridContextValue>(GRID_NAME);
64
64
 
65
65
  type GridRootProps = PropsWithChildren<
66
- { id: string } & Partial<{
66
+ {
67
+ id: string;
68
+ } & Partial<{
67
69
  editing: GridEditing;
68
70
  defaultEditing: GridEditing;
69
71
  onEditingChange: (nextEditing: GridEditing) => void;
70
72
  }>
71
73
  >;
72
74
 
75
+ // TODO(burdon): Make headless.
73
76
  const GridRoot = ({
77
+ __gridScope,
78
+ children,
74
79
  id,
75
80
  editing: propsEditing,
76
81
  defaultEditing,
77
82
  onEditingChange,
78
- children,
79
- __gridScope,
80
83
  }: GridScopedProps<GridRootProps>) => {
81
84
  const [editing = null, setEditing] = useControllableState({
82
85
  prop: propsEditing,
@@ -150,12 +153,12 @@ GridContent.displayName = GRID_CONTENT_NAME;
150
153
  // Fragments
151
154
  //
152
155
 
153
- // NOTE(Zan): These fragments add border to inline-end and block-end of the grid using pseudo-elements.
156
+ // NOTE(Zan): These fragments add border to w-end and h-end of the grid using pseudo-elements.
154
157
  // These are offset by 1px to avoid double borders in planks.
155
158
  const gridSeparatorInlineEnd =
156
- '[&>.dx-grid]:relative [&>.dx-grid]:after:absolute [&>.dx-grid]:after:inset-block-0 [&>.dx-grid]:after:-inline-end-px [&>.dx-grid]:after:is-px [&>.dx-grid]:after:bg-subduedSeparator';
159
+ '[&>.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';
157
160
  const gridSeparatorBlockEnd =
158
- '[&>.dx-grid]:relative [&>.dx-grid]:before:absolute [&>.dx-grid]:before:inset-inline-0 [&>.dx-grid]:before:-block-end-px [&>.dx-grid]:before:bs-px [&>.dx-grid]:before:bg-subduedSeparator';
161
+ '[&>.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';
159
162
 
160
163
  //
161
164
  // Exports