@dxos/plugin-deck 0.6.8-main.3be982f → 0.6.8-staging.77f93a3

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.
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { Plus } from '@phosphor-icons/react';
6
- import React, { useCallback } from 'react';
6
+ import React, { useCallback, useLayoutEffect, useRef } from 'react';
7
7
 
8
8
  import {
9
9
  LayoutAction,
@@ -24,7 +24,6 @@ import { Plank as NaturalPlank } from '@dxos/react-ui-deck';
24
24
  import { NodePlankHeading } from './NodePlankHeading';
25
25
  import { PlankContentError, PlankError } from './PlankError';
26
26
  import { PlankLoading } from './PlankLoading';
27
- import { NAV_ID } from './constants';
28
27
  import { DeckAction } from '../../DeckPlugin';
29
28
  import { useNode } from '../../hooks';
30
29
  import { DECK_PLUGIN } from '../../meta';
@@ -62,21 +61,23 @@ export const Plank = ({ entry, layoutParts, part, resizeable, flatDeck, searchEn
62
61
 
63
62
  const coordinate: LayoutCoordinate = { part, entryId: entry.id };
64
63
 
64
+ const ref = useRef<HTMLDivElement | null>(null);
65
+ useLayoutEffect(() => {
66
+ if (scrollIntoView === entry.id) {
67
+ ref.current?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
68
+ }
69
+ }, [scrollIntoView]);
70
+
65
71
  return (
66
72
  <NaturalPlank.Root size={size} setSize={setSize}>
67
- <NaturalPlank.Content
68
- {...attendableAttrs}
69
- classNames={[!flatDeck && 'surface-base', classNames]}
70
- scrollIntoViewOnMount={entry.id === scrollIntoView}
71
- suppressAutofocus={entry.id === NAV_ID || !!node?.properties?.managesAutofocus}
72
- >
73
+ <NaturalPlank.Content {...attendableAttrs} ref={ref} classNames={[!flatDeck && 'surface-base', classNames]}>
73
74
  {node ? (
74
75
  <>
75
76
  <NodePlankHeading
77
+ id={entry.id}
78
+ node={node}
76
79
  layoutPart={coordinate.part}
77
80
  layoutParts={layoutParts}
78
- node={node}
79
- id={entry.id}
80
81
  popoverAnchorId={popoverAnchorId}
81
82
  flatDeck={flatDeck}
82
83
  />
@@ -9,10 +9,10 @@ import { type Overscroll } from '../types';
9
9
 
10
10
  export const calculateOverscroll = (
11
11
  layoutMode: LayoutMode,
12
- sidebarOpen: boolean,
13
- complementarySidebarOpen: boolean,
14
12
  layoutParts: LayoutParts,
15
13
  plankSizing: Record<string, number>,
14
+ sidebarOpen: boolean,
15
+ complementarySidebarOpen: boolean,
16
16
  overscroll: Overscroll,
17
17
  ) => {
18
18
  if (!(layoutMode === 'deck' && overscroll === 'centering')) {