@dxos/plugin-navtree 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7
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/CommandsDialogContent-2DKIOLJL.mjs +113 -0
- package/dist/lib/browser/CommandsDialogContent-2DKIOLJL.mjs.map +7 -0
- package/dist/lib/browser/CommandsTrigger-ABODVVMP.mjs +33 -0
- package/dist/lib/browser/CommandsTrigger-ABODVVMP.mjs.map +7 -0
- package/dist/lib/browser/NavTreeContainer-TLSYS4KK.mjs +12 -0
- package/dist/lib/browser/NavTreeContainer-TLSYS4KK.mjs.map +7 -0
- package/dist/lib/browser/NavTreeDocumentTitle-L6NLLWLD.mjs +26 -0
- package/dist/lib/browser/NavTreeDocumentTitle-L6NLLWLD.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-RSMA6I22.mjs → app-graph-builder-Z43OTNI2.mjs} +6 -5
- package/dist/lib/browser/app-graph-builder-Z43OTNI2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YKTYPINZ.mjs → chunk-A4VDCIJC.mjs} +3 -3
- package/dist/lib/browser/{chunk-YKTYPINZ.mjs.map → chunk-A4VDCIJC.mjs.map} +1 -1
- package/dist/lib/browser/chunk-AYF2TX65.mjs +14 -0
- package/dist/lib/browser/chunk-AYF2TX65.mjs.map +7 -0
- package/dist/lib/browser/chunk-JT37R5HS.mjs +1468 -0
- package/dist/lib/browser/chunk-JT37R5HS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AGQDZBPL.mjs → chunk-KF26WA4O.mjs} +5 -5
- package/dist/lib/browser/{chunk-AGQDZBPL.mjs.map → chunk-KF26WA4O.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +35 -31
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{keyboard-32EH3N4K.mjs → keyboard-HYGFQO7T.mjs} +11 -6
- package/dist/lib/browser/keyboard-HYGFQO7T.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-VDWVUII5.mjs +49 -0
- package/dist/lib/browser/operation-resolver-VDWVUII5.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-F6CVMS3Y.mjs → react-surface-D2RLMV4Z.mjs} +15 -14
- package/dist/lib/browser/react-surface-D2RLMV4Z.mjs.map +7 -0
- package/dist/lib/browser/{state-EVYQOUI3.mjs → state-CWMNNF7K.mjs} +34 -23
- package/dist/lib/browser/state-CWMNNF7K.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts +1 -1
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/state.d.ts +1 -1
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts +10 -32
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +2 -5
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/{NavTreeContext.d.ts → NavTreeContext/NavTreeContext.d.ts} +1 -1
- package/dist/types/src/components/NavTreeContext/NavTreeContext.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts +2 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +4 -2
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +4 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +3 -6
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +3 -2
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +5 -13
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/{components/CommandsDialog/CommandsDialog.d.ts → containers/CommandsDialogContent/CommandsDialogContent.d.ts} +1 -1
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts +3 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/CommandsTrigger.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts +3 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts +9 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts +3 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts +3 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/experimental/Tree.stories.d.ts +18 -4
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useActions.d.ts +5 -0
- package/dist/types/src/hooks/useActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts +6 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts +7 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -0
- package/dist/types/src/{hooks.d.ts → hooks/useNavTreeState.d.ts} +2 -14
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +3 -3
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +5 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -42
- package/src/NavTreePlugin.tsx +22 -24
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +4 -3
- package/src/capabilities/keyboard/keyboard.ts +6 -5
- package/src/capabilities/operation-resolver/operation-resolver.ts +23 -19
- package/src/capabilities/react-surface/react-surface.tsx +12 -13
- package/src/capabilities/state/state.ts +41 -13
- package/src/components/NavTree/NavTree.stories.tsx +21 -19
- package/src/components/NavTree/NavTree.tsx +61 -20
- package/src/components/{NavTreeContext.tsx → NavTreeContext/NavTreeContext.tsx} +1 -1
- package/src/components/NavTreeContext/index.ts +5 -0
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +40 -23
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +40 -14
- package/src/components/Sidebar/L0Menu.tsx +90 -74
- package/src/components/Sidebar/L1Panel.tsx +244 -90
- package/src/components/Sidebar/L1Tabs.tsx +13 -3
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +2 -3
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +1 -1
- package/src/components/index.ts +0 -3
- package/src/components/types.ts +12 -17
- package/src/{components/CommandsDialog/CommandsDialog.tsx → containers/CommandsDialogContent/CommandsDialogContent.tsx} +19 -13
- package/src/containers/CommandsDialogContent/index.ts +7 -0
- package/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.tsx +4 -4
- package/src/containers/CommandsTrigger/index.ts +7 -0
- package/src/{components → containers/NavTreeContainer}/NavTreeContainer.tsx +75 -141
- package/src/containers/NavTreeContainer/index.ts +6 -0
- package/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.tsx +1 -1
- package/src/containers/NavTreeDocumentTitle/index.ts +7 -0
- package/src/containers/index.ts +12 -0
- package/src/experimental/Tree.stories.tsx +54 -57
- package/src/experimental/Tree.tsx +3 -3
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useActions.ts +34 -0
- package/src/hooks/useLoadDescendents.ts +23 -0
- package/src/hooks/useNavTreeModel.ts +118 -0
- package/src/{hooks.ts → hooks/useNavTreeState.ts} +3 -34
- package/src/meta.ts +2 -2
- package/src/testing/app-graph-builder.ts +5 -5
- package/src/testing/generator.ts +4 -4
- package/src/types/capabilities.ts +1 -1
- package/src/types/events.ts +3 -2
- package/src/util.ts +18 -4
- package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs.map +0 -7
- package/dist/lib/browser/chunk-6YPQ625I.mjs +0 -1293
- package/dist/lib/browser/chunk-6YPQ625I.mjs.map +0 -7
- package/dist/lib/browser/keyboard-32EH3N4K.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs +0 -52
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs.map +0 -7
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs.map +0 -7
- package/dist/lib/browser/state-EVYQOUI3.mjs.map +0 -7
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/index.d.ts +0 -3
- package/dist/types/src/components/CommandsDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeContainer.d.ts +0 -16
- package/dist/types/src/components/NavTreeContainer.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeContext.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +0 -1
- package/dist/types/src/hooks.d.ts.map +0 -1
- package/src/components/CommandsDialog/index.ts +0 -6
- /package/dist/types/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.d.ts +0 -0
- /package/dist/types/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.d.ts +0 -0
|
@@ -11,10 +11,12 @@ import {
|
|
|
11
11
|
attachClosestEdge,
|
|
12
12
|
extractClosestEdge,
|
|
13
13
|
} from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
14
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
14
15
|
import React, {
|
|
15
16
|
type MouseEvent,
|
|
16
17
|
type PropsWithChildren,
|
|
17
18
|
forwardRef,
|
|
19
|
+
memo,
|
|
18
20
|
useCallback,
|
|
19
21
|
useLayoutEffect,
|
|
20
22
|
useMemo,
|
|
@@ -35,7 +37,7 @@ import {
|
|
|
35
37
|
useMediaQuery,
|
|
36
38
|
useTranslation,
|
|
37
39
|
} from '@dxos/react-ui';
|
|
38
|
-
import {
|
|
40
|
+
import { Menu, type MenuItem } from '@dxos/react-ui-menu';
|
|
39
41
|
import type { StackItemRearrangeHandler } from '@dxos/react-ui-stack';
|
|
40
42
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
41
43
|
import { mx } from '@dxos/ui-theme';
|
|
@@ -60,6 +62,7 @@ type L0ItemRootProps = {
|
|
|
60
62
|
item: Node.Node;
|
|
61
63
|
parent?: Node.Node;
|
|
62
64
|
path: string[];
|
|
65
|
+
onMouseEnter?: () => void;
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
type L0ItemProps = L0ItemRootProps & {
|
|
@@ -68,10 +71,11 @@ type L0ItemProps = L0ItemRootProps & {
|
|
|
68
71
|
path: string[];
|
|
69
72
|
pinned?: boolean;
|
|
70
73
|
onRearrange?: StackItemRearrangeHandler<L0ItemData>;
|
|
74
|
+
onItemHover?: (params: { item: Node.Node }) => void;
|
|
71
75
|
};
|
|
72
76
|
|
|
73
77
|
const useL0ItemClick = ({ item, parent, path }: L0ItemProps, type: string) => {
|
|
74
|
-
const {
|
|
78
|
+
const { onSelect, onTabChange } = useNavTreeContext();
|
|
75
79
|
const { getItem } = useNavTreeState();
|
|
76
80
|
const [isLg] = useMediaQuery('lg');
|
|
77
81
|
const runAction = useActionRunner();
|
|
@@ -81,7 +85,7 @@ const useL0ItemClick = ({ item, parent, path }: L0ItemProps, type: string) => {
|
|
|
81
85
|
switch (type) {
|
|
82
86
|
case 'action': {
|
|
83
87
|
const { properties: { caller } = {} } = item;
|
|
84
|
-
return void runAction(item as Node.Action, caller ? { parent, caller } : { parent });
|
|
88
|
+
return void runAction(item as Node.Action, caller ? { parent, path, caller } : { parent, path });
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
case 'tab':
|
|
@@ -91,7 +95,7 @@ const useL0ItemClick = ({ item, parent, path }: L0ItemProps, type: string) => {
|
|
|
91
95
|
return onSelect?.({ item, path, current: !getItem(path).current, option: event.altKey });
|
|
92
96
|
}
|
|
93
97
|
},
|
|
94
|
-
[item, parent, type,
|
|
98
|
+
[item, parent, type, getItem, onSelect, onTabChange, isLg, runAction],
|
|
95
99
|
);
|
|
96
100
|
};
|
|
97
101
|
|
|
@@ -100,53 +104,56 @@ const l0Breakpoints: Record<string, string> = {
|
|
|
100
104
|
};
|
|
101
105
|
|
|
102
106
|
const l0ItemRoot =
|
|
103
|
-
'group/l0item flex
|
|
107
|
+
'group/l0item flex w-full justify-center items-center relative data[type!="collection"]:cursor-pointer dx-app-no-drag dx-focus-ring-group';
|
|
104
108
|
|
|
105
109
|
const l0ItemContent = 'flex justify-center items-center dx-focus-ring-group-indicator transition-colors rounded-sm';
|
|
106
110
|
|
|
107
|
-
const L0ItemRoot =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
111
|
+
const L0ItemRoot = memo(
|
|
112
|
+
forwardRef<HTMLElement, PropsWithChildren<L0ItemRootProps>>(
|
|
113
|
+
({ item, parent, path, onMouseEnter, children }, forwardedRef) => {
|
|
114
|
+
const { model } = useNavTreeContext();
|
|
115
|
+
const itemPath = useMemo(() => [...path, item.id], [item.id, path]);
|
|
116
|
+
const { id, testId } = useAtomValue(model.itemProps(itemPath));
|
|
117
|
+
const type = l0ItemType(item);
|
|
118
|
+
|
|
119
|
+
const { t } = useTranslation(meta.id);
|
|
120
|
+
const localizedString = toLocalizedString(item.properties.label, t);
|
|
121
|
+
|
|
122
|
+
const handleClick = useL0ItemClick({ item, parent, path: itemPath }, type);
|
|
123
|
+
const rootProps =
|
|
124
|
+
type === 'tab'
|
|
125
|
+
? { value: item.id, tabIndex: 0, onClick: handleClick, 'data-testid': testId, 'data-object-id': id }
|
|
126
|
+
: { onClick: handleClick, 'data-testid': testId, 'data-object-id': id };
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<Tooltip.Trigger asChild delayDuration={0} side='right' content={localizedString}>
|
|
130
|
+
<Tabs.TabPrimitive
|
|
131
|
+
{...(rootProps as any)}
|
|
132
|
+
data-type={type}
|
|
133
|
+
className={mx(l0ItemRoot, l0Breakpoints[item.properties.l0Breakpoint])}
|
|
134
|
+
ref={forwardedRef}
|
|
135
|
+
onMouseEnter={onMouseEnter}
|
|
136
|
+
>
|
|
137
|
+
{children}
|
|
138
|
+
</Tabs.TabPrimitive>
|
|
139
|
+
</Tooltip.Trigger>
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
),
|
|
136
143
|
);
|
|
137
144
|
|
|
138
145
|
export const L0ItemActiveTabIndicator = ({ classNames }: ThemedClassName<{}>) => (
|
|
139
146
|
<div
|
|
140
147
|
role='none'
|
|
141
148
|
className={mx(
|
|
142
|
-
'hidden group-aria-selected/l0item:block absolute
|
|
149
|
+
'hidden group-aria-selected/l0item:block absolute start-0 inset-y-2 w-1 bg-accent-surface rounded-ie',
|
|
143
150
|
classNames,
|
|
144
151
|
)}
|
|
145
152
|
/>
|
|
146
153
|
);
|
|
147
154
|
|
|
148
155
|
// TODO(burdon): Factor out pinned (non-draggable) items.
|
|
149
|
-
const L0Item = ({ item, parent, path, pinned, onRearrange }: L0ItemProps) => {
|
|
156
|
+
const L0Item = memo(({ item, parent, path, pinned, onRearrange, onItemHover }: L0ItemProps) => {
|
|
150
157
|
const { t } = useTranslation(meta.id);
|
|
151
158
|
const itemElement = useRef<HTMLElement | null>(null);
|
|
152
159
|
const [closestEdge, setEdge] = useState<Edge | null>(null);
|
|
@@ -209,17 +216,19 @@ const L0Item = ({ item, parent, path, pinned, onRearrange }: L0ItemProps) => {
|
|
|
209
216
|
);
|
|
210
217
|
}, [item, onRearrange]);
|
|
211
218
|
|
|
219
|
+
const handleMouseEnter = useCallback(() => onItemHover?.({ item }), [item, onItemHover]);
|
|
220
|
+
|
|
212
221
|
return (
|
|
213
|
-
<L0ItemRoot ref={itemElement} item={item} parent={parent} path={path}>
|
|
222
|
+
<L0ItemRoot ref={itemElement} item={item} parent={parent} path={path} onMouseEnter={handleMouseEnter}>
|
|
214
223
|
<div
|
|
215
224
|
role='none'
|
|
216
225
|
data-frame={true}
|
|
217
|
-
{...(hue && { style: { background: `var(--
|
|
226
|
+
{...(hue && { style: { background: `var(--color-${hue}-surface)` } })}
|
|
218
227
|
className={mx(
|
|
219
228
|
l0ItemContent,
|
|
220
229
|
pinned
|
|
221
|
-
? 'p-2 group-hover/l0item:bg-
|
|
222
|
-
: '
|
|
230
|
+
? 'p-2 group-hover/l0item:bg-active-surface'
|
|
231
|
+
: 'w-(--dx-l0-avatar-size) h-(--dx-l0-avatar-size) bg-active-surface',
|
|
223
232
|
)}
|
|
224
233
|
>
|
|
225
234
|
<ItemAvatar item={item} />
|
|
@@ -231,14 +240,14 @@ const L0Item = ({ item, parent, path, pinned, onRearrange }: L0ItemProps) => {
|
|
|
231
240
|
{closestEdge && <ListItem.DropIndicator edge={closestEdge} />}
|
|
232
241
|
</L0ItemRoot>
|
|
233
242
|
);
|
|
234
|
-
};
|
|
243
|
+
});
|
|
235
244
|
|
|
236
245
|
const ItemAvatar = ({ item }: Pick<L0ItemProps, 'item'>) => {
|
|
237
246
|
const { t } = useTranslation(meta.id);
|
|
238
247
|
const type = l0ItemType(item);
|
|
239
248
|
if (item.properties.icon) {
|
|
240
249
|
const hue = item.properties.hue ?? null;
|
|
241
|
-
const hueFgStyle = hue && { style: { color: `var(--
|
|
250
|
+
const hueFgStyle = hue && { style: { color: `var(--color-${hue}-surface-text)` } };
|
|
242
251
|
return <Icon icon={item.properties.icon} size={6} {...hueFgStyle} />;
|
|
243
252
|
}
|
|
244
253
|
|
|
@@ -262,9 +271,18 @@ export type L0MenuProps = {
|
|
|
262
271
|
userAccountItem?: Node.Node;
|
|
263
272
|
parent?: Node.Node;
|
|
264
273
|
path: string[];
|
|
274
|
+
onItemHover?: (params: { item: Node.Node }) => void;
|
|
265
275
|
};
|
|
266
276
|
|
|
267
|
-
export const L0Menu = ({
|
|
277
|
+
export const L0Menu = ({
|
|
278
|
+
menuActions,
|
|
279
|
+
topLevelItems,
|
|
280
|
+
pinnedItems,
|
|
281
|
+
userAccountItem,
|
|
282
|
+
parent,
|
|
283
|
+
path,
|
|
284
|
+
onItemHover,
|
|
285
|
+
}: L0MenuProps) => {
|
|
268
286
|
const { t } = useTranslation(meta.id);
|
|
269
287
|
const runAction = useActionRunner();
|
|
270
288
|
const handleAction = useCallback(
|
|
@@ -300,48 +318,48 @@ export const L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountIte
|
|
|
300
318
|
return (
|
|
301
319
|
<Tabs.Tablist
|
|
302
320
|
classNames={[
|
|
303
|
-
'group/l0 absolute z-[1] inset-
|
|
304
|
-
'grid grid-cols-[var(--l0-size)] grid-rows-[var(--rail-size)_1fr_min-content_var(--l0-size)] contain-layout',
|
|
305
|
-
'!
|
|
321
|
+
'group/l0 absolute z-[1] inset-y-0 start-0 rounded-is',
|
|
322
|
+
'grid grid-cols-[var(--dx-l0-size)] grid-rows-[var(--dx-rail-size)_1fr_min-content_var(--dx-l0-size)] dx-contain-layout',
|
|
323
|
+
'!w-(--dx-l0-size) bg-toolbar-surface border-e border-subdued-separator dx-app-drag pb-[env(safe-area-inset-bottom)]',
|
|
306
324
|
]}
|
|
307
325
|
>
|
|
308
326
|
{/* TODO(wittjosiah): Use L0Item trigger. */}
|
|
309
|
-
<
|
|
310
|
-
<
|
|
327
|
+
<Menu.Root onAction={handleAction}>
|
|
328
|
+
<Menu.Trigger
|
|
329
|
+
asChild
|
|
330
|
+
data-testid='spacePlugin.addSpace'
|
|
331
|
+
className={mx(
|
|
332
|
+
l0ItemRoot,
|
|
333
|
+
'grid place-items-center dx-focus-ring-group',
|
|
334
|
+
'[body[data-platform="macos"]_&]:mt-[30px]',
|
|
335
|
+
)}
|
|
336
|
+
>
|
|
311
337
|
<Tooltip.Trigger content={t('app menu label')} side='right' asChild>
|
|
312
338
|
<Tabs.TabPrimitive value='options' asChild role='button'>
|
|
313
|
-
<
|
|
314
|
-
|
|
339
|
+
<div
|
|
340
|
+
role='none'
|
|
315
341
|
className={mx(
|
|
316
|
-
|
|
317
|
-
'
|
|
318
|
-
'[body[data-platform="macos"]_&]:mt-[30px]',
|
|
342
|
+
l0ItemContent,
|
|
343
|
+
'h-(--dx-rail-action) w-(--dx-rail-action) group-hover/l0item:bg-hover-surface',
|
|
319
344
|
)}
|
|
320
345
|
>
|
|
321
|
-
<
|
|
322
|
-
|
|
323
|
-
className={mx(
|
|
324
|
-
l0ItemContent,
|
|
325
|
-
'is-[--rail-action] bs-[--rail-action] group-hover/l0item:bg-hoverSurface',
|
|
326
|
-
)}
|
|
327
|
-
>
|
|
328
|
-
<Icon icon='ph--list--regular' size={5} />
|
|
329
|
-
</div>
|
|
330
|
-
</DropdownMenu.Trigger>
|
|
346
|
+
<Icon icon='ph--list--regular' size={5} />
|
|
347
|
+
</div>
|
|
331
348
|
</Tabs.TabPrimitive>
|
|
332
349
|
</Tooltip.Trigger>
|
|
333
|
-
</
|
|
334
|
-
|
|
350
|
+
</Menu.Trigger>
|
|
351
|
+
<Menu.Content group={parent} items={menuActions} />
|
|
352
|
+
</Menu.Root>
|
|
335
353
|
|
|
336
354
|
{/* Space list. */}
|
|
337
|
-
<ScrollArea.Root>
|
|
355
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
338
356
|
<ScrollArea.Viewport>
|
|
339
357
|
<div
|
|
340
358
|
role='none'
|
|
341
359
|
className={mx([
|
|
342
|
-
'flex flex-col gap-1
|
|
343
|
-
'[body[data-platform="macos"]_&]:
|
|
344
|
-
'[body[data-platform="ios"]_&]:
|
|
360
|
+
'flex flex-col gap-1 pt-1',
|
|
361
|
+
'[body[data-platform="macos"]_&]:py-[30px]',
|
|
362
|
+
'[body[data-platform="ios"]_&]:py-[max(env(safe-area-inset-top),0.25rem)]',
|
|
345
363
|
])}
|
|
346
364
|
>
|
|
347
365
|
{topLevelItems.map((item) => (
|
|
@@ -350,25 +368,23 @@ export const L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountIte
|
|
|
350
368
|
item={item}
|
|
351
369
|
parent={parent}
|
|
352
370
|
path={path}
|
|
371
|
+
onItemHover={onItemHover}
|
|
353
372
|
{...(hasRearrangeableItems && { onRearrange: handleRearrange })}
|
|
354
373
|
/>
|
|
355
374
|
))}
|
|
356
375
|
</div>
|
|
357
|
-
<ScrollArea.Scrollbar orientation='vertical'>
|
|
358
|
-
<ScrollArea.Thumb />
|
|
359
|
-
</ScrollArea.Scrollbar>
|
|
360
376
|
</ScrollArea.Viewport>
|
|
361
377
|
</ScrollArea.Root>
|
|
362
378
|
|
|
363
379
|
{/* Actions. */}
|
|
364
|
-
<div role='none' className='grid grid-cols-1 auto-rows-
|
|
380
|
+
<div role='none' className='grid grid-cols-1 auto-rows-(--dx-rail-action) pt-2'>
|
|
365
381
|
{pinnedItems.map((item) => (
|
|
366
382
|
<L0Item key={item.id} item={item} parent={parent} path={path} pinned />
|
|
367
383
|
))}
|
|
368
384
|
</div>
|
|
369
385
|
|
|
370
386
|
{userAccountItem && (
|
|
371
|
-
<div role='none' className='grid app-no-drag'>
|
|
387
|
+
<div role='none' className='grid dx-app-no-drag'>
|
|
372
388
|
<L0ItemRoot key={userAccountItem.id} item={userAccountItem} parent={parent} path={path}>
|
|
373
389
|
<UserAccountAvatar
|
|
374
390
|
userId={userAccountItem.properties.userId}
|