@dxos/react-ui-mosaic 0.8.4-main.937b3ca → 0.8.4-main.bc674ce

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 (42) hide show
  1. package/dist/lib/browser/{chunk-QKMUWO5X.mjs → chunk-UMBPEG4F.mjs} +347 -236
  2. package/dist/lib/browser/chunk-UMBPEG4F.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +9 -3
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +78 -185
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/{chunk-BYUYHEAX.mjs → chunk-X6GV7SMK.mjs} +347 -236
  9. package/dist/lib/node-esm/chunk-X6GV7SMK.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +9 -3
  11. package/dist/lib/node-esm/index.mjs.map +1 -1
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +78 -185
  14. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  15. package/dist/types/src/components/Card/Card.d.ts +2 -1
  16. package/dist/types/src/components/Card/Card.d.ts.map +1 -1
  17. package/dist/types/src/components/Focus/Focus.d.ts.map +1 -1
  18. package/dist/types/src/components/Mosaic/Mosaic.d.ts +8 -1
  19. package/dist/types/src/components/Mosaic/Mosaic.d.ts.map +1 -1
  20. package/dist/types/src/components/Scrollable/Scrollable.d.ts +11 -4
  21. package/dist/types/src/components/Scrollable/Scrollable.d.ts.map +1 -1
  22. package/dist/types/src/components/Scrollable/Scrollable.stories.d.ts +6 -4
  23. package/dist/types/src/components/Scrollable/Scrollable.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Stack/Stack.d.ts +4 -6
  25. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
  26. package/dist/types/src/index.d.ts +1 -0
  27. package/dist/types/src/index.d.ts.map +1 -1
  28. package/dist/types/src/testing/Board.d.ts.map +1 -1
  29. package/dist/types/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +22 -22
  31. package/src/components/Card/Card.tsx +25 -2
  32. package/src/components/Focus/Focus.tsx +2 -0
  33. package/src/components/Mosaic/Mosaic.tsx +32 -33
  34. package/src/components/Scrollable/Scrollable.stories.tsx +34 -8
  35. package/src/components/Scrollable/Scrollable.tsx +7 -18
  36. package/src/components/Stack/Stack.stories.tsx +8 -8
  37. package/src/components/Stack/Stack.tsx +10 -10
  38. package/src/index.ts +1 -0
  39. package/src/testing/Board.tsx +11 -11
  40. package/src/testing/Virtualizer.stories.tsx +3 -3
  41. package/dist/lib/browser/chunk-QKMUWO5X.mjs.map +0 -7
  42. package/dist/lib/node-esm/chunk-BYUYHEAX.mjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-mosaic",
3
- "version": "0.8.4-main.937b3ca",
3
+ "version": "0.8.4-main.bc674ce",
4
4
  "description": "Modular UI components.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -51,16 +51,16 @@
51
51
  "bind-event-listener": "^3.0.0",
52
52
  "overlayscrollbars": "^2.13.0",
53
53
  "overlayscrollbars-react": "^0.5.6",
54
- "@dxos/async": "0.8.4-main.937b3ca",
55
- "@dxos/echo": "0.8.4-main.937b3ca",
56
- "@dxos/invariant": "0.8.4-main.937b3ca",
57
- "@dxos/keys": "0.8.4-main.937b3ca",
58
- "@dxos/log": "0.8.4-main.937b3ca",
59
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.937b3ca",
60
- "@dxos/react-ui-dnd": "0.8.4-main.937b3ca",
61
- "@dxos/ui-theme": "0.8.4-main.937b3ca",
62
- "@dxos/util": "0.8.4-main.937b3ca",
63
- "@dxos/react-client": "0.8.4-main.937b3ca"
54
+ "@dxos/async": "0.8.4-main.bc674ce",
55
+ "@dxos/echo": "0.8.4-main.bc674ce",
56
+ "@dxos/invariant": "0.8.4-main.bc674ce",
57
+ "@dxos/keys": "0.8.4-main.bc674ce",
58
+ "@dxos/log": "0.8.4-main.bc674ce",
59
+ "@dxos/react-client": "0.8.4-main.bc674ce",
60
+ "@dxos/react-ui-dnd": "0.8.4-main.bc674ce",
61
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.bc674ce",
62
+ "@dxos/ui-theme": "0.8.4-main.bc674ce",
63
+ "@dxos/util": "0.8.4-main.bc674ce"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/react": "~19.2.7",
@@ -69,22 +69,22 @@
69
69
  "react": "~19.2.3",
70
70
  "react-dom": "~19.2.3",
71
71
  "vite": "7.1.9",
72
- "@dxos/random": "0.8.4-main.937b3ca",
73
- "@dxos/react-ui": "0.8.4-main.937b3ca",
74
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.937b3ca",
75
- "@dxos/schema": "0.8.4-main.937b3ca",
76
- "@dxos/test-utils": "0.8.4-main.937b3ca",
77
- "@dxos/types": "0.8.4-main.937b3ca",
78
- "@dxos/ui-theme": "0.8.4-main.937b3ca",
79
- "@dxos/storybook-utils": "0.8.4-main.937b3ca"
72
+ "@dxos/random": "0.8.4-main.bc674ce",
73
+ "@dxos/react-ui": "0.8.4-main.bc674ce",
74
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.bc674ce",
75
+ "@dxos/schema": "0.8.4-main.bc674ce",
76
+ "@dxos/storybook-utils": "0.8.4-main.bc674ce",
77
+ "@dxos/test-utils": "0.8.4-main.bc674ce",
78
+ "@dxos/types": "0.8.4-main.bc674ce",
79
+ "@dxos/ui-theme": "0.8.4-main.bc674ce"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "effect": "3.19.11",
83
83
  "react": "~19.2.3",
84
84
  "react-dom": "~19.2.3",
85
- "@dxos/ui-theme": "0.8.4-main.937b3ca",
86
- "@dxos/random": "0.8.4-main.937b3ca",
87
- "@dxos/react-ui": "0.8.4-main.937b3ca"
85
+ "@dxos/random": "0.8.4-main.bc674ce",
86
+ "@dxos/ui-theme": "0.8.4-main.bc674ce",
87
+ "@dxos/react-ui": "0.8.4-main.bc674ce"
88
88
  },
89
89
  "publishConfig": {
90
90
  "access": "public"
@@ -5,6 +5,7 @@
5
5
  import { Slot } from '@radix-ui/react-slot';
6
6
  import React, {
7
7
  type ComponentPropsWithoutRef,
8
+ type HTMLAttributes,
8
9
  type PropsWithChildren,
9
10
  createContext,
10
11
  forwardRef,
@@ -392,15 +393,36 @@ const CardLink = ({ label, href }: CardLinkProps) => {
392
393
  );
393
394
  };
394
395
 
396
+ //
397
+ // IconBlock
398
+ //
399
+
400
+ const CardIconBlock = ({
401
+ classNames,
402
+ children,
403
+ role = 'none',
404
+ ...props
405
+ }: ThemedClassName<PropsWithChildren<HTMLAttributes<HTMLDivElement>>>) => {
406
+ return (
407
+ <div
408
+ {...props}
409
+ role={role}
410
+ className={mx('grid bs-[var(--rail-item)] is-[var(--rail-item)] place-items-center', classNames)}
411
+ >
412
+ {children}
413
+ </div>
414
+ );
415
+ };
416
+
395
417
  //
396
418
  // Icon
397
419
  //
398
420
 
399
421
  const CardIcon = ({ toolbar, ...props }: IconProps & { toolbar?: boolean }) => {
400
422
  return (
401
- <div role='none' className='grid bs-[var(--rail-item)] is-[var(--rail-item)] place-items-center'>
423
+ <CardIconBlock>
402
424
  <Icon {...props} size={toolbar ? 5 : 4} />
403
- </div>
425
+ </CardIconBlock>
404
426
  );
405
427
  };
406
428
 
@@ -421,6 +443,7 @@ export const Card = {
421
443
  Close: CardClose,
422
444
  Menu: CardMenu,
423
445
  Icon: CardIcon,
446
+ IconBlock: CardIconBlock,
424
447
 
425
448
  // Content
426
449
  Content: CardContent,
@@ -46,6 +46,8 @@ type GroupProps = ThemedClassName<
46
46
  >
47
47
  > & { className?: string };
48
48
 
49
+ // TODO(wittjosiah): Consider how this could integrate with with react-ui-attention.
50
+ // Perhaps react-ui-attention comes under the mosaic umbrella as it supports selection?
49
51
  const Group = forwardRef<HTMLDivElement, GroupProps>(
50
52
  ({ classNames, className, children, asChild, axis = 'vertical', ...props }: GroupProps, forwardedRef) => {
51
53
  const rootRef = useRef<HTMLDivElement>(null);
@@ -304,7 +304,6 @@ const Root = forwardRef<HTMLDivElement, RootProps>(({ classNames, children, asCh
304
304
 
305
305
  sourceHandler.onTake?.({ source: sourceData }, async (object) => {
306
306
  targetHandler.onDrop?.({
307
- // TODO(burdon): Change source!!!
308
307
  source: { ...sourceData, data: object },
309
308
  target: targetData,
310
309
  });
@@ -469,28 +468,15 @@ const Container = forwardRef<HTMLDivElement, ContainerProps>(
469
468
 
470
469
  return combine(
471
470
  ...[
472
- // Autoscroll.
473
- // TODO(burdon): Autoscroll doesn't work well horizontally.
474
- autoscrollElement && [
475
- autoScrollForElements({
476
- element: autoscrollElement,
477
- canScroll: ({ element: _ }) => {
478
- // const delta = element.scrollHeight - element.scrollTop - element.clientHeight;
479
- return true;
480
- },
481
- getAllowedAxis: () => axis,
482
- getConfiguration: () => ({
483
- maxScrollSpeed: 'fast',
484
- }),
485
- }),
486
-
487
- bind(autoscrollElement, {
488
- type: 'scroll',
489
- listener: handleScroll,
490
- }),
491
-
492
- () => setScrolling(false),
493
- ],
471
+ /**
472
+ * Custom event for dragging cancellation.
473
+ */
474
+ bind(rootRef.current, {
475
+ type: 'dnd:cancel',
476
+ listener: () => {
477
+ setState({ type: 'idle' });
478
+ },
479
+ }),
494
480
 
495
481
  // Target.
496
482
  dropTargetForElements({
@@ -544,15 +530,28 @@ const Container = forwardRef<HTMLDivElement, ContainerProps>(
544
530
  },
545
531
  }),
546
532
 
547
- /**
548
- * Custom event for dragging cancellation.
549
- */
550
- bind(rootRef.current, {
551
- type: 'dnd:cancel',
552
- listener: () => {
553
- setState({ type: 'idle' });
554
- },
555
- }),
533
+ // Autoscroll.
534
+ // NOTE: When used with Scrollable we get a spurious warning (in dev mode).
535
+ // "Auto scrolling has been attached to an element that appears not to be scrollable."
536
+ autoscrollElement && [
537
+ autoScrollForElements({
538
+ element: autoscrollElement,
539
+ // canScroll: ({ element: _ }) => {
540
+ // return true;
541
+ // },
542
+ getAllowedAxis: () => axis,
543
+ getConfiguration: () => ({
544
+ maxScrollSpeed: 'fast',
545
+ }),
546
+ }),
547
+
548
+ bind(autoscrollElement, {
549
+ type: 'scroll',
550
+ listener: handleScroll,
551
+ }),
552
+
553
+ () => setScrolling(false),
554
+ ],
556
555
  ]
557
556
  .filter(isTruthy)
558
557
  .flatMap((x) => x),
@@ -626,7 +625,7 @@ type TileProps<TData = any, TLocation = LocationType> = SlottableClassName<
626
625
  id: string;
627
626
  data: TData;
628
627
  location: TLocation;
629
- draggable?: boolean;
628
+ draggable?: boolean; // TODO(burdon): Not currently implemented.
630
629
  debug?: boolean;
631
630
  }>
632
631
  >;
@@ -6,21 +6,23 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React from 'react';
7
7
 
8
8
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
9
+ import { mx } from '@dxos/ui-theme';
9
10
 
10
- import { Scrollable } from './Scrollable';
11
+ import { Scrollable, type ScrollableProps } from './Scrollable';
11
12
 
12
- const DefaultStory = () => {
13
+ const DefaultStory = (props: ScrollableProps) => {
13
14
  return (
14
- <Scrollable axis='vertical'>
15
- <div role='none' className='bs-[200rem]' />
15
+ <Scrollable {...props} classNames='bs-full is-full'>
16
+ <div role='none' className={mx('bg-cubes', props.axis === 'vertical' ? 'bs-[200rem]' : 'bs-full is-[200rem]')} />
16
17
  </Scrollable>
17
18
  );
18
19
  };
19
20
 
20
- const meta: Meta<typeof DefaultStory> = {
21
+ const meta: Meta<typeof Scrollable> = {
21
22
  title: 'ui/react-ui-mosaic/Scrollable',
22
- component: DefaultStory,
23
- decorators: [withTheme, withLayout({ layout: 'column' })],
23
+ component: Scrollable,
24
+ render: (args) => <DefaultStory {...args} />,
25
+ decorators: [withTheme, withLayout({ layout: 'fullscreen' })],
24
26
  parameters: {
25
27
  layout: 'fullscreen',
26
28
  },
@@ -30,4 +32,28 @@ export default meta;
30
32
 
31
33
  type Story = StoryObj<typeof meta>;
32
34
 
33
- export const Default: Story = {};
35
+ export const Vertical: Story = {
36
+ args: {
37
+ axis: 'vertical',
38
+ },
39
+ };
40
+
41
+ export const Horizontal: Story = {
42
+ args: {
43
+ axis: 'horizontal',
44
+ },
45
+ };
46
+
47
+ export const VerticalPadding: Story = {
48
+ args: {
49
+ axis: 'vertical',
50
+ padding: true,
51
+ },
52
+ };
53
+
54
+ export const HorizontalPadding: Story = {
55
+ args: {
56
+ axis: 'horizontal',
57
+ padding: true,
58
+ },
59
+ };
@@ -8,7 +8,7 @@ import {
8
8
  type OverlayScrollbarsComponentProps,
9
9
  type OverlayScrollbarsComponentRef,
10
10
  } from 'overlayscrollbars-react';
11
- import React, { type RefObject, forwardRef, useEffect, useMemo, useRef } from 'react';
11
+ import React, { type RefCallback, forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
12
12
 
13
13
  import { type ThemedClassName } from '@dxos/react-ui';
14
14
  import { mx } from '@dxos/ui-theme';
@@ -26,12 +26,11 @@ const defaultOptions: ScrollableProps['options'] = {
26
26
  },
27
27
  };
28
28
 
29
- // TODO(burdon): row/column: options={{ overflow: { x: 'scroll' } }}
30
- export type ScrollableProps = ThemedClassName<OverlayScrollbarsComponentProps> & {
29
+ export type ScrollableProps = ThemedClassName<Omit<OverlayScrollbarsComponentProps, 'ref'>> & {
31
30
  axis?: Axis;
32
31
  padding?: boolean;
33
32
  onScroll?: (event: Event) => void;
34
- viewportRef?: RefObject<HTMLElement | null>;
33
+ viewportRef?: RefCallback<HTMLElement | null>;
35
34
  };
36
35
 
37
36
  /**
@@ -42,7 +41,7 @@ export const Scrollable = forwardRef<HTMLDivElement, ScrollableProps>(
42
41
  { classNames, axis = 'vertical', padding, options: optionsProp = defaultOptions, onScroll, viewportRef, ...props },
43
42
  forwardedRef,
44
43
  ) => {
45
- const osRef = useRef<OverlayScrollbarsComponentRef<'div'>>(null);
44
+ const osRef = useRef<OverlayScrollbarsComponentRef>(null);
46
45
  const options = useMemo(() => {
47
46
  const options = { ...optionsProp };
48
47
  if (axis) {
@@ -55,22 +54,12 @@ export const Scrollable = forwardRef<HTMLDivElement, ScrollableProps>(
55
54
  return options;
56
55
  }, [axis, optionsProp]);
57
56
 
58
- // Forward the host element to the forwardedRef for asChild/Slot compatibility.
59
- useEffect(() => {
60
- const hostElement = osRef.current?.getElement();
61
- if (forwardedRef) {
62
- if (typeof forwardedRef === 'function') {
63
- forwardedRef(hostElement ?? null);
64
- } else {
65
- forwardedRef.current = hostElement ?? null;
66
- }
67
- }
68
- });
57
+ useImperativeHandle(forwardedRef, () => osRef.current?.getElement() as HTMLDivElement, [osRef]);
69
58
 
70
59
  useEffect(() => {
71
60
  const instance = osRef.current?.osInstance();
72
61
  if (viewportRef) {
73
- viewportRef.current = instance?.elements().viewport ?? null;
62
+ viewportRef(instance?.elements().viewport ?? null);
74
63
  }
75
64
  }, [osRef, viewportRef]);
76
65
 
@@ -89,7 +78,7 @@ export const Scrollable = forwardRef<HTMLDivElement, ScrollableProps>(
89
78
  return (
90
79
  <OverlayScrollbarsComponent
91
80
  {...props}
92
- className={mx(padding && axis === 'vertical' ? 'pli-3' : 'pbe-3', classNames)}
81
+ className={mx(padding && (axis === 'vertical' ? 'pli-3' : 'pbe-3'), classNames)}
93
82
  options={options}
94
83
  events={events}
95
84
  ref={osRef}
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
- import React, { useRef, useState } from 'react';
6
+ import React, { useState } from 'react';
7
7
  import { useMemo } from 'react';
8
8
 
9
9
  import { Obj } from '@dxos/echo';
@@ -54,7 +54,7 @@ export const Default: Story = {
54
54
  // Create items at render time to avoid Storybook serialization issues with ECHO objects.
55
55
  const items = useMemo(() => createTestItems(NUM_ITEMS), []);
56
56
  const [DebugInfo, debugHandler] = useContainerDebug(props.debug);
57
- const viewportRef = useRef<HTMLElement | null>(null);
57
+ const [viewport, setViewport] = useState<HTMLElement | null>(null);
58
58
  return (
59
59
  <Mosaic.Root debug={props.debug} classNames='bs-full grid grid-rows-[min-content_1fr_min-content]'>
60
60
  <Toolbar.Root classNames='border-be border-separator'>
@@ -63,11 +63,11 @@ export const Default: Story = {
63
63
  <Mosaic.Container
64
64
  asChild
65
65
  axis='vertical'
66
- autoScroll={viewportRef.current}
66
+ autoScroll={viewport}
67
67
  eventHandler={{ id: 'test', canDrop: () => true }}
68
68
  debug={debugHandler}
69
69
  >
70
- <Mosaic.Viewport axis='vertical' padding viewportRef={viewportRef}>
70
+ <Mosaic.Viewport axis='vertical' padding viewportRef={setViewport}>
71
71
  <Mosaic.Stack {...props} items={items} />
72
72
  </Mosaic.Viewport>
73
73
  </Mosaic.Container>
@@ -83,7 +83,7 @@ export const Virtual: Story = {
83
83
  const items = useMemo(() => createTestItems(NUM_ITEMS), []);
84
84
  const [info, setInfo] = useState<any>(null);
85
85
  const [DebugInfo, debugHandler] = useContainerDebug(props.debug);
86
- const viewportRef = useRef<HTMLDivElement | null>(null);
86
+ const [viewport, setViewport] = useState<HTMLElement | null>(null);
87
87
  return (
88
88
  <Mosaic.Root debug={props.debug} classNames='grid grid-rows-[min-content_1fr_min-content]'>
89
89
  <Toolbar.Root>
@@ -92,15 +92,15 @@ export const Virtual: Story = {
92
92
  <Mosaic.Container
93
93
  asChild
94
94
  axis='vertical'
95
- autoScroll={viewportRef.current}
95
+ autoScroll={viewport}
96
96
  eventHandler={{ id: 'test', canDrop: () => true }}
97
97
  debug={debugHandler}
98
98
  >
99
- <Mosaic.Viewport axis='vertical' padding viewportRef={viewportRef}>
99
+ <Mosaic.Viewport axis='vertical' padding viewportRef={setViewport}>
100
100
  <Mosaic.VirtualStack
101
101
  {...props}
102
102
  items={items}
103
- getScrollElement={() => viewportRef.current}
103
+ getScrollElement={() => viewport}
104
104
  estimateSize={() => 40}
105
105
  onChange={(virtualizer) => {
106
106
  setInfo({ range: virtualizer.range });
@@ -22,15 +22,15 @@ import { mosaicStyles } from '../Mosaic';
22
22
 
23
23
  type StackTileComponent<TData = any> = FC<MosaicTileProps<TData>>;
24
24
 
25
- type StackProps<TData = any> = SlottableClassName<{
26
- role?: string;
27
- axis?: Axis;
28
- draggable?: boolean;
29
- items?: TData[];
30
- getId: GetId<TData>;
31
- Tile: StackTileComponent<TData>;
32
- debug?: boolean;
33
- }>;
25
+ type StackProps<TData = any> = SlottableClassName<
26
+ {
27
+ Tile: StackTileComponent<TData>;
28
+ getId: GetId<TData>;
29
+ role?: string;
30
+ axis?: Axis;
31
+ items?: TData[];
32
+ } & Pick<MosaicTileProps<TData>, 'draggable' | 'debug'>
33
+ >;
34
34
 
35
35
  /**
36
36
  * Linear layout of Mosaic tiles.
@@ -80,7 +80,7 @@ const Stack = StackInner as <TData = any>(props: StackProps<TData> & { ref?: Ref
80
80
 
81
81
  type VirtualStackProps<TData = any> = StackProps<TData> &
82
82
  Pick<
83
- ReactVirtualizerOptions<HTMLDivElement, HTMLDivElement>,
83
+ ReactVirtualizerOptions<HTMLElement, HTMLDivElement>,
84
84
  'estimateSize' | 'getScrollElement' | 'overscan' | 'onChange'
85
85
  >;
86
86
 
package/src/index.ts CHANGED
@@ -3,3 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './components';
6
+ export * from './hooks';
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { useComposedRefs } from '@radix-ui/react-compose-refs';
6
6
  import * as Schema from 'effect/Schema';
7
- import React, { forwardRef, useMemo, useRef } from 'react';
7
+ import React, { forwardRef, useMemo, useRef, useState } from 'react';
8
8
 
9
9
  import { Obj, Ref, Type } from '@dxos/echo';
10
10
  import { ObjectId } from '@dxos/keys';
@@ -66,7 +66,7 @@ type RootProps = {
66
66
 
67
67
  const Root = forwardRef<HTMLDivElement, RootProps>(({ id, columns, debug }, forwardedRef) => {
68
68
  const [DebugInfo, debugHandler] = useContainerDebug(debug);
69
- const viewportRef = useRef<HTMLElement | null>(null);
69
+ const [viewport, setViewport] = useState<HTMLElement | null>(null);
70
70
 
71
71
  const eventHandler = useEventHandlerAdapter({
72
72
  id,
@@ -80,19 +80,19 @@ const Root = forwardRef<HTMLDivElement, RootProps>(({ id, columns, debug }, forw
80
80
  return (
81
81
  <div
82
82
  role='none'
83
- className={mx('p-2 grid bs-full is-full overflow-hidden', debug && 'grid-cols-[1fr_20rem] gap-2')}
83
+ className={mx('plb-2 grid bs-full is-full overflow-hidden', debug && 'grid-cols-[1fr_20rem] gap-2')}
84
84
  ref={forwardedRef}
85
85
  >
86
86
  <Focus.Group asChild axis='horizontal'>
87
87
  <Mosaic.Container
88
88
  asChild
89
- axis='horizontal'
90
89
  withFocus
91
- autoScroll={viewportRef.current}
90
+ axis='horizontal'
91
+ autoScroll={viewport}
92
92
  eventHandler={eventHandler}
93
93
  debug={debugHandler}
94
94
  >
95
- <Mosaic.Viewport axis='horizontal' padding viewportRef={viewportRef}>
95
+ <Mosaic.Viewport axis='horizontal' padding viewportRef={setViewport}>
96
96
  <Mosaic.Stack axis='horizontal' items={columns} getId={(item) => item.id} Tile={Column} debug={debug} />
97
97
  </Mosaic.Viewport>
98
98
  </Mosaic.Container>
@@ -112,7 +112,7 @@ const Column = forwardRef<HTMLDivElement, ColumnProps>(({ classNames, location,
112
112
  const [column, updateColumn] = useObject(data);
113
113
  const [DebugInfo, debugHandler] = useContainerDebug(debug);
114
114
  const dragHandleRef = useRef<HTMLButtonElement>(null);
115
- const viewportRef = useRef<HTMLElement | null>(null);
115
+ const [viewport, setViewport] = useState<HTMLElement | null>(null);
116
116
  const eventHandler = useEventHandlerAdapter<Ref.Unknown>({
117
117
  id: data.id,
118
118
  items: column.items,
@@ -160,18 +160,18 @@ const Column = forwardRef<HTMLDivElement, ColumnProps>(({ classNames, location,
160
160
  <Card.Context value={{ menuItems }}>
161
161
  <Mosaic.Container
162
162
  asChild
163
- axis='vertical'
164
163
  withFocus
165
- autoScroll={viewportRef.current}
164
+ axis='vertical'
165
+ autoScroll={viewport}
166
166
  eventHandler={eventHandler}
167
167
  debug={debugHandler}
168
168
  >
169
- <Mosaic.Viewport axis='vertical' padding viewportRef={viewportRef}>
169
+ <Mosaic.Viewport axis='vertical' padding viewportRef={setViewport}>
170
170
  <Mosaic.Stack axis='vertical' items={column.items} getId={(data) => data.dxn.toString()} Tile={Item} />
171
171
  </Mosaic.Viewport>
172
172
  </Mosaic.Container>
173
173
  </Card.Context>
174
- <div>
174
+ <div role='none'>
175
175
  <div className='grow flex p-1 justify-center text-xs'>{column.items.length}</div>
176
176
  <DebugInfo />
177
177
  </div>
@@ -46,9 +46,9 @@ export const Default = {
46
46
  );
47
47
 
48
48
  const parentRef = useRef(null);
49
- const viewportRef = useRef<HTMLElement>(null);
49
+ const [viewport, setViewport] = useState<HTMLElement | null>(null);
50
50
  const virtualizer = useVirtualizer({
51
- getScrollElement: () => viewportRef.current,
51
+ getScrollElement: () => viewport,
52
52
  estimateSize: () => 40,
53
53
  count: items.length,
54
54
  gap: 8,
@@ -63,7 +63,7 @@ export const Default = {
63
63
  return (
64
64
  <div className='flex flex-col bs-full'>
65
65
  <ScrollToolbar items={items} index={index} setIndex={setIndex} />
66
- <Mosaic.Viewport axis='vertical' padding viewportRef={viewportRef} ref={parentRef}>
66
+ <Mosaic.Viewport axis='vertical' padding viewportRef={setViewport} ref={parentRef}>
67
67
  <div
68
68
  role='none'
69
69
  style={{