@dxos/plugin-simple-layout 0.8.4-main.c85a9c8dae → 0.8.4-main.fcfe5033a5
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 +35 -56
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +35 -55
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/SimpleLayoutPlugin.d.ts +1 -1
- package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +21 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
- package/dist/types/src/capabilities/{state/state.d.ts → state.d.ts} +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/{url-handler/url-handler.d.ts → url-handler.d.ts} +3 -3
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/ContentError.stories.d.ts +25 -18
- package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
- package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
- package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
- package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
- package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Home/Home.d.ts.map +1 -1
- package/dist/types/src/components/Loading/Loading.d.ts +3 -0
- package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
- package/dist/types/src/components/{ContentLoading.stories.d.ts → Loading/Loading.stories.d.ts} +1 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
- package/dist/types/src/components/Loading/index.d.ts +2 -0
- package/dist/types/src/components/Loading/index.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -1
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/index.d.ts +2 -0
- package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts +5 -7
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +28 -21
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts +5 -7
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +28 -22
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +26 -25
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/hooks.d.ts +4 -2
- package/dist/types/src/components/hooks.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/actions.d.ts +4 -5
- package/dist/types/src/hooks/actions.d.ts.map +1 -1
- package/dist/types/src/hooks/useAppBarProps.d.ts +1 -1
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts +1 -1
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
- package/dist/types/src/operations/close.d.ts +5 -0
- package/dist/types/src/operations/close.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/revert-workspace.d.ts +5 -0
- package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
- package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
- package/dist/types/src/operations/set.d.ts +5 -0
- package/dist/types/src/operations/set.d.ts.map +1 -0
- package/dist/types/src/operations/state-access.d.ts +8 -0
- package/dist/types/src/operations/state-access.d.ts.map +1 -0
- package/dist/types/src/operations/switch-workspace.d.ts +5 -0
- package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/update-complementary.d.ts +5 -0
- package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
- package/dist/types/src/operations/update-dialog.d.ts +5 -0
- package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
- package/dist/types/src/operations/update-popover.d.ts +5 -0
- package/dist/types/src/operations/update-popover.d.ts.map +1 -0
- package/dist/types/src/operations/update-sidebar.d.ts +5 -0
- package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +26 -19
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +10 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -29
- package/src/SimpleLayoutPlugin.ts +16 -6
- package/src/capabilities/app-graph-builder.ts +21 -0
- package/src/capabilities/index.ts +13 -6
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +2 -2
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +16 -7
- package/src/capabilities/{state/state.tsx → state.tsx} +2 -2
- package/src/capabilities/url-handler.ts +161 -0
- package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
- package/src/components/DebugOverlay/index.ts +5 -0
- package/src/components/Dialog/Dialog.tsx +14 -3
- package/src/components/Home/Home.tsx +32 -32
- package/src/components/{ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +4 -4
- package/src/components/{ContentLoading.tsx → Loading/Loading.tsx} +1 -1
- package/src/components/Loading/index.ts +5 -0
- package/src/components/MobileLayout/MobileLayout.stories.tsx +21 -17
- package/src/components/MobileLayout/MobileLayout.tsx +118 -49
- package/src/components/{Workspace/Workspace.tsx → NavBranch/NavBranch.tsx} +44 -41
- package/src/components/{Workspace → NavBranch}/index.ts +1 -1
- package/src/components/Popover/Popover.tsx +10 -16
- package/src/components/SimpleLayout/AppBar.stories.tsx +8 -9
- package/src/components/SimpleLayout/AppBar.tsx +60 -60
- package/src/components/SimpleLayout/Drawer.tsx +30 -31
- package/src/components/SimpleLayout/Main.tsx +21 -26
- package/src/components/SimpleLayout/NavBar.stories.tsx +1 -2
- package/src/components/SimpleLayout/NavBar.tsx +8 -9
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +43 -66
- package/src/components/SimpleLayout/SimpleLayout.tsx +33 -34
- package/src/components/hooks.ts +8 -8
- package/src/components/index.ts +3 -2
- package/src/hooks/actions.ts +15 -16
- package/src/hooks/useAppBarProps.ts +10 -11
- package/src/hooks/useDrawerActions.ts +13 -11
- package/src/hooks/useNavbarActions.ts +8 -7
- package/src/hooks/useSimpleLayoutState.ts +1 -1
- package/src/meta.ts +1 -1
- package/src/operations/close.ts +34 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +63 -0
- package/src/operations/revert-workspace.ts +22 -0
- package/src/operations/set-layout-mode.ts +12 -0
- package/src/operations/set.ts +23 -0
- package/src/operations/state-access.ts +19 -0
- package/src/operations/switch-workspace.ts +26 -0
- package/src/operations/update-complementary.ts +35 -0
- package/src/operations/update-dialog.ts +28 -0
- package/src/operations/update-popover.ts +35 -0
- package/src/operations/update-sidebar.ts +12 -0
- package/src/translations.ts +21 -19
- package/src/types/capabilities.ts +4 -4
- package/dist/lib/browser/chunk-7VLT3S46.mjs +0 -29
- package/dist/lib/browser/chunk-7VLT3S46.mjs.map +0 -7
- package/dist/lib/browser/chunk-TMZNLVT2.mjs +0 -1170
- package/dist/lib/browser/chunk-TMZNLVT2.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs +0 -205
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs.map +0 -7
- package/dist/lib/browser/react-root-MMB575WY.mjs +0 -21
- package/dist/lib/browser/react-root-MMB575WY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-M6CURANW.mjs +0 -41
- package/dist/lib/browser/react-surface-M6CURANW.mjs.map +0 -7
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs +0 -66
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +0 -7
- package/dist/lib/browser/state-A3PGDWWZ.mjs +0 -48
- package/dist/lib/browser/state-A3PGDWWZ.mjs.map +0 -7
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs +0 -152
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FLOYBAHE.mjs +0 -1171
- package/dist/lib/node-esm/chunk-FLOYBAHE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIDE5UMB.mjs +0 -31
- package/dist/lib/node-esm/chunk-VIDE5UMB.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs +0 -206
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-ENZKVSY4.mjs +0 -22
- package/dist/lib/node-esm/react-root-ENZKVSY4.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ITVNQYLG.mjs +0 -42
- package/dist/lib/node-esm/react-surface-ITVNQYLG.mjs.map +0 -7
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs +0 -68
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs.map +0 -7
- package/dist/lib/node-esm/state-ZCFZTTPL.mjs +0 -49
- package/dist/lib/node-esm/state-ZCFZTTPL.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs +0 -153
- package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs.map +0 -7
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root/index.d.ts +0 -6
- package/dist/types/src/capabilities/react-root/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +0 -3
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -13
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler/index.d.ts +0 -3
- package/dist/types/src/capabilities/url-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.d.ts +0 -3
- package/dist/types/src/components/ContentLoading.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/Workspace.d.ts +0 -11
- package/dist/types/src/components/Workspace/Workspace.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/index.d.ts +0 -2
- package/dist/types/src/components/Workspace/index.d.ts.map +0 -1
- package/src/capabilities/operation-resolver/index.ts +0 -10
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -217
- package/src/capabilities/react-root/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/spotlight-dismiss/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -9
- package/src/capabilities/url-handler/index.ts +0 -7
- package/src/capabilities/url-handler/url-handler.ts +0 -157
- /package/dist/types/src/capabilities/{react-root/react-root.d.ts → react-root.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/capabilities/{spotlight-dismiss/spotlight-dismiss.d.ts → spotlight-dismiss.d.ts} +0 -0
- /package/src/capabilities/{spotlight-dismiss/spotlight-dismiss.ts → spotlight-dismiss.ts} +0 -0
|
@@ -8,15 +8,16 @@ import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
|
8
8
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
10
10
|
import { Node, useConnections } from '@dxos/plugin-graph';
|
|
11
|
-
import { Avatar, Icon,
|
|
11
|
+
import { Avatar, Icon, ScrollArea, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { Card } from '@dxos/react-ui';
|
|
13
13
|
import { Mosaic, type MosaicStackTileComponent } from '@dxos/react-ui-mosaic';
|
|
14
|
-
import {
|
|
14
|
+
import { SearchPanel, useSearchListItem, useSearchListResults } from '@dxos/react-ui-search';
|
|
15
15
|
import { mx } from '@dxos/ui-theme';
|
|
16
|
-
import { byPosition } from '@dxos/util';
|
|
16
|
+
import { byPosition, getHostPlatform, isTauri } from '@dxos/util';
|
|
17
17
|
|
|
18
|
-
import { meta } from '
|
|
19
|
-
|
|
18
|
+
import { meta } from '#meta';
|
|
19
|
+
|
|
20
|
+
import { useExpandPath } from '../hooks';
|
|
20
21
|
|
|
21
22
|
export type HomeProps = {};
|
|
22
23
|
|
|
@@ -28,7 +29,7 @@ export const Home = (_: HomeProps) => {
|
|
|
28
29
|
const userAccountItem = useItemsByDisposition('user-account')[0];
|
|
29
30
|
const pinnedItems = useItemsByDisposition('pin-end', true);
|
|
30
31
|
const workspaceItems = useItemsByDisposition('workspace');
|
|
31
|
-
|
|
32
|
+
useExpandPath(Node.RootId);
|
|
32
33
|
|
|
33
34
|
const items = useMemo(
|
|
34
35
|
() => [...(userAccountItem ? [userAccountItem] : []), ...pinnedItems, ...workspaceItems],
|
|
@@ -40,27 +41,24 @@ export const Home = (_: HomeProps) => {
|
|
|
40
41
|
extract: (node) => toLocalizedString(node.properties.label, t),
|
|
41
42
|
});
|
|
42
43
|
|
|
44
|
+
const autoFocus = !isTauri() || getHostPlatform() !== 'ios';
|
|
45
|
+
|
|
43
46
|
return (
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Mosaic.Container>
|
|
60
|
-
</SearchList.Content>
|
|
61
|
-
</Panel.Content>
|
|
62
|
-
</Panel.Root>
|
|
63
|
-
</SearchList.Root>
|
|
47
|
+
<SearchPanel onSearch={handleSearch}>
|
|
48
|
+
<Mosaic.Container asChild>
|
|
49
|
+
<ScrollArea.Root centered padding thin>
|
|
50
|
+
<ScrollArea.Viewport>
|
|
51
|
+
<Mosaic.Stack
|
|
52
|
+
classNames='gap-1'
|
|
53
|
+
draggable={false}
|
|
54
|
+
items={results}
|
|
55
|
+
getId={(item) => item.id}
|
|
56
|
+
Tile={WorkspaceTile}
|
|
57
|
+
/>
|
|
58
|
+
</ScrollArea.Viewport>
|
|
59
|
+
</ScrollArea.Root>
|
|
60
|
+
</Mosaic.Container>
|
|
61
|
+
</SearchPanel>
|
|
64
62
|
);
|
|
65
63
|
};
|
|
66
64
|
|
|
@@ -73,7 +71,7 @@ const WorkspaceTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
|
73
71
|
const isSelected = selectedValue === data.id;
|
|
74
72
|
const cardRef = useRef<HTMLDivElement>(null);
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
useExpandPath(data.id);
|
|
77
75
|
|
|
78
76
|
const handleSelect = useCallback(
|
|
79
77
|
() => invokePromise(LayoutOperation.SwitchWorkspace, { subject: data.id }),
|
|
@@ -106,17 +104,17 @@ const WorkspaceTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
|
106
104
|
onClick={handleSelect}
|
|
107
105
|
ref={cardRef}
|
|
108
106
|
>
|
|
109
|
-
<Card.Toolbar density='
|
|
107
|
+
<Card.Toolbar density='fine'>
|
|
110
108
|
<Avatar.Root>
|
|
111
109
|
<Avatar.Content
|
|
112
110
|
icon={data.properties.icon}
|
|
113
111
|
hue={data.properties.hue}
|
|
114
112
|
hueVariant='transparent'
|
|
115
113
|
variant='square'
|
|
116
|
-
size={
|
|
114
|
+
size={8}
|
|
117
115
|
fallback={name}
|
|
118
116
|
/>
|
|
119
|
-
<Avatar.Label>{name}</Avatar.Label>
|
|
117
|
+
<Avatar.Label classNames='cursor-pointer'>{name}</Avatar.Label>
|
|
120
118
|
<Icon icon='ph--caret-right--regular' />
|
|
121
119
|
</Avatar.Root>
|
|
122
120
|
</Card.Toolbar>
|
|
@@ -133,6 +131,8 @@ const filterItems = (node: Node.Node, disposition: string) => {
|
|
|
133
131
|
const useItemsByDisposition = (disposition: string, sort = false) => {
|
|
134
132
|
const { graph } = useAppGraph();
|
|
135
133
|
const connections = useConnections(graph, Node.RootId, 'child');
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
return useMemo(() => {
|
|
135
|
+
const filtered = connections.filter((node) => filterItems(node, disposition));
|
|
136
|
+
return sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
137
|
+
}, [connections, disposition, sort]);
|
|
138
138
|
};
|
|
@@ -6,16 +6,16 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
|
|
7
7
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Loading } from './Loading';
|
|
10
10
|
|
|
11
11
|
const meta = {
|
|
12
|
-
title: 'plugins/plugin-simple-layout/components/
|
|
13
|
-
component:
|
|
12
|
+
title: 'plugins/plugin-simple-layout/components/Loading',
|
|
13
|
+
component: Loading,
|
|
14
14
|
decorators: [withTheme()],
|
|
15
15
|
parameters: {
|
|
16
16
|
layout: 'centered',
|
|
17
17
|
},
|
|
18
|
-
} satisfies Meta<typeof
|
|
18
|
+
} satisfies Meta<typeof Loading>;
|
|
19
19
|
|
|
20
20
|
export default meta;
|
|
21
21
|
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
// TODO(burdon): Show skeleton: https://github.com/dxos/dxos/issues/8259
|
|
8
|
-
export const
|
|
8
|
+
export const Loading = () => {
|
|
9
9
|
return <div role='none' className='grid place-items-center dx-attention-surface' />;
|
|
10
10
|
};
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { type PropsWithChildren, useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { addEventListener, combine } from '@dxos/async';
|
|
9
|
-
import { Flex, Input, Panel, Splitter, type SplitterMode, Toolbar } from '@dxos/react-ui';
|
|
9
|
+
import { Column, Flex, Input, Panel, Splitter, type SplitterMode, Toolbar } from '@dxos/react-ui';
|
|
10
10
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
11
|
|
|
12
12
|
import { MobileLayout, type MobileLayoutRootProps } from './MobileLayout';
|
|
@@ -65,44 +65,48 @@ const StoryPanel = ({ children, label }: PropsWithChildren<{ label: string }>) =
|
|
|
65
65
|
</Toolbar.Root>
|
|
66
66
|
</Panel.Toolbar>
|
|
67
67
|
<Panel.Content asChild>
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
<Column.Root gutter='xs' classNames='py-form-chrome'>
|
|
69
|
+
<Column.Center>
|
|
70
|
+
<Flex column>
|
|
71
|
+
<Input.Root>
|
|
72
|
+
<Input.TextInput placeholder={label} />
|
|
73
|
+
</Input.Root>
|
|
74
|
+
</Flex>
|
|
75
|
+
</Column.Center>
|
|
76
|
+
</Column.Root>
|
|
73
77
|
</Panel.Content>
|
|
74
78
|
</Panel.Root>
|
|
75
79
|
);
|
|
76
80
|
};
|
|
77
81
|
|
|
78
82
|
const DefaultStory = () => {
|
|
79
|
-
const [splitterMode, setSplitterMode] = useState<SplitterMode>('
|
|
83
|
+
const [splitterMode, setSplitterMode] = useState<SplitterMode>('top');
|
|
80
84
|
const [keyboardOpen, setKeyboardOpen] = useState(false);
|
|
81
85
|
|
|
82
86
|
useEffect(() => {
|
|
83
|
-
setSplitterMode(splitterMode === '
|
|
87
|
+
setSplitterMode(splitterMode === 'split' ? 'bottom' : splitterMode);
|
|
84
88
|
}, [keyboardOpen]);
|
|
85
89
|
|
|
86
90
|
return (
|
|
87
91
|
<WithKeyboard>
|
|
88
92
|
<MobileLayout.Root onKeyboardOpenChange={setKeyboardOpen}>
|
|
89
|
-
<MobileLayout.Panel safe={{ top: true, bottom: splitterMode === '
|
|
93
|
+
<MobileLayout.Panel safe={{ top: true, bottom: splitterMode === 'top' }}>
|
|
90
94
|
<Splitter.Root mode={splitterMode} ratio={0.5}>
|
|
91
|
-
<Splitter.Panel position='
|
|
95
|
+
<Splitter.Panel position='top'>
|
|
92
96
|
<StoryPanel label='Main'>
|
|
93
|
-
{splitterMode === '
|
|
94
|
-
<Toolbar.IconButton icon='ph--plus--regular' label='Open' onClick={() => setSplitterMode('
|
|
97
|
+
{splitterMode === 'top' && (
|
|
98
|
+
<Toolbar.IconButton icon='ph--plus--regular' label='Open' onClick={() => setSplitterMode('split')} />
|
|
95
99
|
)}
|
|
96
100
|
</StoryPanel>
|
|
97
101
|
</Splitter.Panel>
|
|
98
|
-
<Splitter.Panel position='
|
|
102
|
+
<Splitter.Panel position='bottom'>
|
|
99
103
|
<StoryPanel label='Drawer'>
|
|
100
104
|
<Toolbar.IconButton
|
|
101
|
-
icon={splitterMode === '
|
|
102
|
-
label={splitterMode === '
|
|
103
|
-
onClick={() => setSplitterMode((splitterMode) => (splitterMode === '
|
|
105
|
+
icon={splitterMode === 'bottom' ? 'ph--arrow-down--regular' : 'ph--arrow-up--regular'}
|
|
106
|
+
label={splitterMode === 'bottom' ? 'Collapse' : 'Expand'}
|
|
107
|
+
onClick={() => setSplitterMode((splitterMode) => (splitterMode === 'split' ? 'bottom' : 'split'))}
|
|
104
108
|
/>
|
|
105
|
-
<Toolbar.IconButton icon='ph--x--regular' label='Close' onClick={() => setSplitterMode('
|
|
109
|
+
<Toolbar.IconButton icon='ph--x--regular' label='Close' onClick={() => setSplitterMode('top')} />
|
|
106
110
|
</StoryPanel>
|
|
107
111
|
</Splitter.Panel>
|
|
108
112
|
</Splitter.Root>
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
|
-
import React, { type PropsWithChildren, forwardRef, useEffect, useState } from 'react';
|
|
6
|
+
import React, { type PropsWithChildren, forwardRef, useEffect, useLayoutEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { addEventListener, combine } from '@dxos/async';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
10
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
11
|
import { mx } from '@dxos/ui-theme';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import { useDebugLog } from '../DebugOverlay';
|
|
14
14
|
|
|
15
15
|
const MOBILE_LAYOUT_NAME = 'MobileLayout';
|
|
16
16
|
const MOBILE_LAYOUT_ROOT_NAME = 'MobileLayout.Root';
|
|
@@ -42,11 +42,15 @@ type MobileLayoutRootProps = ThemedClassName<
|
|
|
42
42
|
*/
|
|
43
43
|
// TODO(burdon): Should this be ios-only?
|
|
44
44
|
const MobileLayoutRoot = forwardRef<HTMLDivElement, MobileLayoutRootProps>(
|
|
45
|
-
({ classNames, children, transition =
|
|
45
|
+
({ classNames, children, transition = 500, onKeyboardOpenChange, ...props }, forwardedRef) => {
|
|
46
46
|
const { open: keyboardOpen } = useIOSKeyboard();
|
|
47
|
-
useAutoScroll();
|
|
48
|
-
useEffect(() => onKeyboardOpenChange?.(keyboardOpen), [onKeyboardOpenChange, keyboardOpen]);
|
|
49
47
|
useLockBodyScroll(keyboardOpen);
|
|
48
|
+
useAutoScroll();
|
|
49
|
+
|
|
50
|
+
// Fire synchronously after DOM mutation (before paint) so SimpleLayout's Splitter mode
|
|
51
|
+
// change is batched into the same paint as the keyboard open state change, preventing
|
|
52
|
+
// intermediate render frames from showing an un-adjusted layout.
|
|
53
|
+
useLayoutEffect(() => onKeyboardOpenChange?.(keyboardOpen), [keyboardOpen, onKeyboardOpenChange]);
|
|
50
54
|
|
|
51
55
|
return (
|
|
52
56
|
<MobileLayoutProvider keyboardOpen={keyboardOpen}>
|
|
@@ -54,10 +58,11 @@ const MobileLayoutRoot = forwardRef<HTMLDivElement, MobileLayoutRootProps>(
|
|
|
54
58
|
{...props}
|
|
55
59
|
role='none'
|
|
56
60
|
style={{
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
height: 'calc(100vh - var(--kb-height, 0px))',
|
|
62
|
+
transition: `height ${keyboardOpen ? 0 : transition}ms ease-out`,
|
|
63
|
+
// transition: `height ${animationDuration}ms ease-out`,
|
|
59
64
|
}}
|
|
60
|
-
className={mx('
|
|
65
|
+
className={mx('fixed top-0 left-0 right-0 grid overflow-hidden', classNames)}
|
|
61
66
|
ref={forwardedRef}
|
|
62
67
|
>
|
|
63
68
|
{children}
|
|
@@ -95,7 +100,7 @@ const MobileLayoutPanel = forwardRef<HTMLDivElement, MobileLayoutPanelProps>(
|
|
|
95
100
|
paddingTop: safe?.top ? 'env(safe-area-inset-top)' : undefined,
|
|
96
101
|
paddingBottom: safe?.bottom ? `calc((1 - var(--kb-open, 0)) * env(safe-area-inset-bottom))` : undefined,
|
|
97
102
|
}}
|
|
98
|
-
className={mx(
|
|
103
|
+
className={mx(classNames)}
|
|
99
104
|
ref={forwardedRef}
|
|
100
105
|
>
|
|
101
106
|
{children}
|
|
@@ -120,42 +125,62 @@ export { useMobileLayout };
|
|
|
120
125
|
export type { MobileLayoutRootProps, MobileLayoutPanelProps };
|
|
121
126
|
|
|
122
127
|
/**
|
|
123
|
-
*
|
|
128
|
+
* Prevents iOS (WKWebView) from shifting the layout when the keyboard appears.
|
|
129
|
+
*
|
|
130
|
+
* Scroll events and window.scrollY stay at 0 in this WKWebView setup — the shift is
|
|
131
|
+
* caused by the browser's scroll-into-view for the focused input. We keep a window
|
|
132
|
+
* scroll reset as belt-and-suspenders, and also monitor container scroll events.
|
|
124
133
|
*/
|
|
125
134
|
const useAutoScroll = () => {
|
|
135
|
+
// TODO(burdon): Remove debug logging.
|
|
136
|
+
const { dbg } = useDebugLog('useAutoScroll');
|
|
137
|
+
|
|
126
138
|
useEffect(() => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
139
|
+
const resetScroll = () => {
|
|
140
|
+
if (window.scrollX !== 0 || window.scrollY !== 0) {
|
|
141
|
+
window.scrollTo(0, 0);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const detectContainerScroll = (event: Event) => {
|
|
146
|
+
const el = event.target as HTMLElement;
|
|
147
|
+
if (el === document.documentElement || el === document.body) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
dbg(`scroll: ${el.tagName}.${Array.from(el.classList).slice(0, 2).join('.')} top=${el.scrollTop.toFixed(0)}`);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return combine(
|
|
155
|
+
addEventListener(window, 'scroll', resetScroll),
|
|
156
|
+
window.visualViewport ? addEventListener(window.visualViewport, 'scroll' as any, resetScroll) : () => {},
|
|
157
|
+
|
|
158
|
+
// TODO(burdon): Remove debug logging.
|
|
159
|
+
addEventListener(document, 'scroll', detectContainerScroll as EventListener, { capture: true } as any),
|
|
160
|
+
|
|
161
|
+
// Prevent focus-triggered scroll-into-view on inputs.
|
|
162
|
+
(() => {
|
|
163
|
+
let focusingWithPreventScroll = false;
|
|
164
|
+
return addEventListener(
|
|
165
|
+
document,
|
|
166
|
+
'focus',
|
|
167
|
+
(event: FocusEvent) => {
|
|
168
|
+
if (focusingWithPreventScroll) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const target = event.target as HTMLElement;
|
|
173
|
+
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {
|
|
174
|
+
focusingWithPreventScroll = true;
|
|
175
|
+
target.focus({ preventScroll: true });
|
|
176
|
+
focusingWithPreventScroll = false;
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{ capture: true },
|
|
180
|
+
);
|
|
181
|
+
})(),
|
|
157
182
|
);
|
|
158
|
-
}, []);
|
|
183
|
+
}, [dbg]);
|
|
159
184
|
};
|
|
160
185
|
|
|
161
186
|
/**
|
|
@@ -231,6 +256,8 @@ const useLockBodyScroll = (enabled: boolean) => {
|
|
|
231
256
|
type IOSKeyboard = {
|
|
232
257
|
open: boolean;
|
|
233
258
|
height: number;
|
|
259
|
+
/** Native keyboard animation duration in ms, from the iOS keyboard event. */
|
|
260
|
+
duration: number | undefined;
|
|
234
261
|
};
|
|
235
262
|
|
|
236
263
|
/**
|
|
@@ -263,10 +290,13 @@ type IOSKeyboard = {
|
|
|
263
290
|
* Falls back to VisualViewport API on other platforms.
|
|
264
291
|
*/
|
|
265
292
|
const useIOSKeyboard = (): IOSKeyboard => {
|
|
293
|
+
const { dbg } = useDebugLog('useIOSKeyboard');
|
|
294
|
+
|
|
266
295
|
const [open, setOpen] = useState(false);
|
|
267
296
|
const [height, setHeight] = useState(0);
|
|
297
|
+
const [duration, setDuration] = useState<number | undefined>(undefined);
|
|
268
298
|
|
|
269
|
-
// Detect
|
|
299
|
+
// Detect keyboard state.
|
|
270
300
|
useEffect(() => {
|
|
271
301
|
const viewport = window.visualViewport;
|
|
272
302
|
if (!viewport) {
|
|
@@ -276,30 +306,69 @@ const useIOSKeyboard = (): IOSKeyboard => {
|
|
|
276
306
|
// Handler for VisualViewport resize (fallback for non-iOS).
|
|
277
307
|
const initialHeight = viewport.height ?? window.innerHeight;
|
|
278
308
|
|
|
279
|
-
const updateState = (keyboardHeight: number, keyboardOpen: boolean) => {
|
|
309
|
+
const updateState = (keyboardHeight: number, keyboardOpen: boolean, animationDuration?: number) => {
|
|
280
310
|
setOpen(keyboardOpen);
|
|
281
311
|
setHeight(keyboardHeight);
|
|
312
|
+
setDuration(animationDuration);
|
|
282
313
|
|
|
283
314
|
const vvh = initialHeight - keyboardHeight;
|
|
284
315
|
document.documentElement.style.setProperty('--vvh', `${vvh}px`);
|
|
285
316
|
document.documentElement.style.setProperty('--kb-height', `${keyboardHeight}px`);
|
|
286
317
|
document.documentElement.style.setProperty('--kb-open', keyboardOpen ? '1' : '0');
|
|
287
|
-
log.info('viewport size', { initialHeight, vvh, keyboardHeight, keyboardOpen });
|
|
318
|
+
log.info('viewport size', { initialHeight, vvh, keyboardHeight, keyboardOpen, animationDuration });
|
|
288
319
|
};
|
|
289
320
|
|
|
321
|
+
let rafId: number | undefined;
|
|
322
|
+
|
|
290
323
|
return combine(
|
|
291
324
|
// Handler for native iOS keyboard events (from KeyboardObserver.swift).
|
|
292
325
|
addEventListener(
|
|
293
326
|
window,
|
|
294
327
|
'keyboard' as any,
|
|
295
328
|
(event: CustomEvent<{ type: 'show' | 'hide'; height: number; duration: number }>) => {
|
|
296
|
-
const { type, height } = event.detail;
|
|
297
|
-
|
|
298
|
-
|
|
329
|
+
const { type, height, duration } = event.detail;
|
|
330
|
+
// iOS KeyboardObserver.swift sends duration in seconds (e.g., 0.25). Convert to ms.
|
|
331
|
+
const durationMs = duration < 1 ? duration * 1000 : duration;
|
|
332
|
+
|
|
333
|
+
// TODO(burdon): Remove debug logging.
|
|
334
|
+
const vp = window.visualViewport;
|
|
335
|
+
dbg(
|
|
336
|
+
`kb:${type} h=${height} dur=${duration} scrollY=${window.scrollY} vpOffset=${vp?.offsetTop?.toFixed(0) ?? '?'}`,
|
|
337
|
+
);
|
|
338
|
+
log.info('keyboard event', { type, height, duration });
|
|
339
|
+
|
|
340
|
+
updateState(height, type === 'show', durationMs);
|
|
341
|
+
|
|
342
|
+
// RAF loop: monitor visualViewport.offsetTop and window.scrollY every frame.
|
|
343
|
+
// TODO(burdon): Remove debug logging.
|
|
344
|
+
const end = performance.now() + durationMs + 300;
|
|
345
|
+
let prevOffsetTop = vp?.offsetTop ?? 0;
|
|
346
|
+
let prevScrollY = window.scrollY;
|
|
347
|
+
const monitorFrame = () => {
|
|
348
|
+
const offsetTop = vp?.offsetTop ?? 0;
|
|
349
|
+
const scrollY = window.scrollY;
|
|
350
|
+
if (offsetTop !== prevOffsetTop || scrollY !== prevScrollY) {
|
|
351
|
+
dbg(`Δ vpOffset=${offsetTop.toFixed(0)} scrollY=${scrollY.toFixed(0)}`);
|
|
352
|
+
prevOffsetTop = offsetTop;
|
|
353
|
+
prevScrollY = scrollY;
|
|
354
|
+
}
|
|
355
|
+
if (scrollY !== 0) {
|
|
356
|
+
window.scrollTo(0, 0);
|
|
357
|
+
}
|
|
358
|
+
if (performance.now() < end) {
|
|
359
|
+
rafId = requestAnimationFrame(monitorFrame);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
rafId = requestAnimationFrame(monitorFrame);
|
|
299
363
|
},
|
|
300
364
|
),
|
|
365
|
+
() => {
|
|
366
|
+
if (rafId !== undefined) {
|
|
367
|
+
cancelAnimationFrame(rafId);
|
|
368
|
+
}
|
|
369
|
+
},
|
|
301
370
|
);
|
|
302
|
-
}, []);
|
|
371
|
+
}, [dbg]);
|
|
303
372
|
|
|
304
|
-
return { open, height };
|
|
373
|
+
return { open, height, duration };
|
|
305
374
|
};
|
|
@@ -2,73 +2,76 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
8
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
10
10
|
import { type Node, useConnections } from '@dxos/plugin-graph';
|
|
11
|
-
import { Avatar, Icon,
|
|
11
|
+
import { Avatar, Icon, ScrollArea, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { Card } from '@dxos/react-ui';
|
|
13
13
|
import { Mosaic, type MosaicStackTileComponent } from '@dxos/react-ui-mosaic';
|
|
14
|
-
import {
|
|
14
|
+
import { SearchPanel, useSearchListItem, useSearchListResults } from '@dxos/react-ui-search';
|
|
15
15
|
import { mx } from '@dxos/ui-theme';
|
|
16
16
|
|
|
17
|
-
import { meta } from '
|
|
18
|
-
import { useLoadDescendents } from '../hooks';
|
|
17
|
+
import { meta } from '#meta';
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
import { useExpandPath } from '../hooks';
|
|
20
|
+
|
|
21
|
+
export type NavBranchProps = {
|
|
21
22
|
id: string;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Renders the children of a graph branch node as a searchable mosaic list.
|
|
27
|
+
* Used for any node with `role: 'branch'` or a workspace disposition, including
|
|
28
|
+
* spaces, collection sections, type sections, and schema nodes.
|
|
28
29
|
*/
|
|
29
|
-
export const
|
|
30
|
+
export const NavBranch = ({ id }: NavBranchProps) => {
|
|
30
31
|
const { t } = useTranslation(meta.id);
|
|
31
32
|
const { graph } = useAppGraph();
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
useLoadDescendents(id);
|
|
34
|
+
useExpandPath(id);
|
|
35
35
|
|
|
36
|
-
// Get direct children of the workspace node.
|
|
37
36
|
const children = useConnections(graph, id, 'child');
|
|
38
37
|
|
|
38
|
+
// TODO(wittjosiah): Move alternate-tree nodes to a non-child relation so they don't need filtering.
|
|
39
|
+
const visibleChildren = useMemo(
|
|
40
|
+
() =>
|
|
41
|
+
children.filter(
|
|
42
|
+
(node) => node.properties.disposition !== 'alternate-tree' && node.properties.disposition !== 'hidden',
|
|
43
|
+
),
|
|
44
|
+
[children],
|
|
45
|
+
);
|
|
46
|
+
|
|
39
47
|
const { results, handleSearch } = useSearchListResults({
|
|
40
|
-
items:
|
|
48
|
+
items: visibleChildren,
|
|
41
49
|
extract: (child) => toLocalizedString(child.properties.label, t),
|
|
42
50
|
});
|
|
43
51
|
|
|
44
52
|
return (
|
|
45
|
-
<
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</Mosaic.Container>
|
|
61
|
-
</SearchList.Content>
|
|
62
|
-
</Panel.Content>
|
|
63
|
-
</Panel.Root>
|
|
64
|
-
</SearchList.Root>
|
|
53
|
+
<SearchPanel onSearch={handleSearch}>
|
|
54
|
+
<Mosaic.Container asChild>
|
|
55
|
+
<ScrollArea.Root centered padding thin>
|
|
56
|
+
<ScrollArea.Viewport>
|
|
57
|
+
<Mosaic.Stack
|
|
58
|
+
classNames='gap-1'
|
|
59
|
+
draggable={false}
|
|
60
|
+
items={results}
|
|
61
|
+
getId={(item) => item.id}
|
|
62
|
+
Tile={NavBranchTile}
|
|
63
|
+
/>
|
|
64
|
+
</ScrollArea.Viewport>
|
|
65
|
+
</ScrollArea.Root>
|
|
66
|
+
</Mosaic.Container>
|
|
67
|
+
</SearchPanel>
|
|
65
68
|
);
|
|
66
69
|
};
|
|
67
70
|
|
|
68
|
-
const
|
|
71
|
+
const NavBranchTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
69
72
|
const data = props.data;
|
|
70
73
|
const { t } = useTranslation(meta.id);
|
|
71
|
-
const {
|
|
74
|
+
const { invokePromise } = useOperationInvoker();
|
|
72
75
|
const ref = useRef<HTMLDivElement>(null);
|
|
73
76
|
const { selectedValue, registerItem, unregisterItem } = useSearchListItem();
|
|
74
77
|
const isSelected = selectedValue === data.id;
|
|
@@ -76,8 +79,8 @@ const WorkspaceChildTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
|
76
79
|
const name = toLocalizedString(data.properties.label, t);
|
|
77
80
|
|
|
78
81
|
const handleSelect = useCallback(
|
|
79
|
-
() =>
|
|
80
|
-
[
|
|
82
|
+
() => void invokePromise(LayoutOperation.Open, { subject: [data.id] }),
|
|
83
|
+
[invokePromise, data.id],
|
|
81
84
|
);
|
|
82
85
|
|
|
83
86
|
// Register this item with the search context.
|
|
@@ -103,17 +106,17 @@ const WorkspaceChildTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
|
103
106
|
fullWidth
|
|
104
107
|
tabIndex={-1} // TODO(burdon): Use Mosaic.Focus.
|
|
105
108
|
data-selected={isSelected}
|
|
106
|
-
classNames={mx('dx-focus-ring', isSelected && 'bg-hover-overlay')}
|
|
109
|
+
classNames={mx('dx-focus-ring cursor-pointer', isSelected && 'bg-hover-overlay')}
|
|
107
110
|
onClick={handleSelect}
|
|
108
111
|
>
|
|
109
|
-
<Card.Toolbar
|
|
112
|
+
<Card.Toolbar>
|
|
110
113
|
<Avatar.Root>
|
|
111
114
|
<Avatar.Content
|
|
112
115
|
hue={data.properties.hue}
|
|
113
116
|
icon={data.properties.icon}
|
|
114
117
|
hueVariant='transparent'
|
|
115
118
|
variant='square'
|
|
116
|
-
size={
|
|
119
|
+
size={8}
|
|
117
120
|
fallback={name}
|
|
118
121
|
/>
|
|
119
122
|
<Avatar.Label>{name}</Avatar.Label>
|