@dxos/plugin-navtree 0.8.3-staging.0fa589b → 0.8.4-main.3a94e84
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/{app-graph-builder-P7AY3K72.mjs → app-graph-builder-5J4LRWDX.mjs} +3 -3
- package/dist/lib/browser/{chunk-IEW3JD5C.mjs → chunk-ERDGQTH5.mjs} +2 -2
- package/dist/lib/browser/{chunk-ZJPL4XJD.mjs → chunk-SICQTLXC.mjs} +63 -50
- package/dist/lib/browser/chunk-SICQTLXC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-33VLL4IJ.mjs → chunk-WCARAZ7J.mjs} +3 -3
- package/dist/lib/browser/index.mjs +10 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-NAYKKAOP.mjs → intent-resolver-3XYN2CBU.mjs} +5 -5
- package/dist/lib/browser/{keyboard-DDFATRUG.mjs → keyboard-QRS6WOQH.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-H3JRTVNU.mjs → react-surface-WURHCBQQ.mjs} +5 -5
- package/dist/lib/browser/{state-J6AKZRB4.mjs → state-54DY3DOY.mjs} +4 -4
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.d.ts +5 -5
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +13 -13
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -42
- package/src/NavTreePlugin.tsx +1 -1
- package/src/components/CommandsDialog/CommandsTrigger.tsx +2 -4
- package/src/components/NavTree/NavTree.stories.tsx +2 -2
- package/src/components/NavTreeContainer.tsx +3 -4
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +1 -1
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +4 -4
- package/src/components/Sidebar/L1Panel.tsx +2 -3
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +1 -1
- package/src/components/index.ts +1 -1
- package/src/experimental/Tree.stories.tsx +9 -9
- package/src/experimental/Tree.tsx +15 -16
- package/src/translations.ts +6 -4
- package/dist/lib/browser/chunk-ZJPL4XJD.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-builder-P7AY3K72.mjs.map → app-graph-builder-5J4LRWDX.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-IEW3JD5C.mjs.map → chunk-ERDGQTH5.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-33VLL4IJ.mjs.map → chunk-WCARAZ7J.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-NAYKKAOP.mjs.map → intent-resolver-3XYN2CBU.mjs.map} +0 -0
- /package/dist/lib/browser/{keyboard-DDFATRUG.mjs.map → keyboard-QRS6WOQH.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-H3JRTVNU.mjs.map → react-surface-WURHCBQQ.mjs.map} +0 -0
- /package/dist/lib/browser/{state-J6AKZRB4.mjs.map → state-54DY3DOY.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-navtree",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.3a94e84",
|
|
4
4
|
"description": "DXOS Surface plugin for a tree view visualization of the graph.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -30,60 +30,58 @@
|
|
|
30
30
|
"@radix-ui/react-dismissable-layer": "1.1.5",
|
|
31
31
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
32
32
|
"date-fns": "^3.3.1",
|
|
33
|
-
"effect": "
|
|
34
|
-
"@dxos/app-framework": "0.8.
|
|
35
|
-
"@dxos/app-graph": "0.8.
|
|
36
|
-
"@dxos/async": "0.8.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/log": "0.8.
|
|
45
|
-
"@dxos/plugin-
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/plugin-observability": "0.8.
|
|
48
|
-
"@dxos/protocols": "0.8.
|
|
49
|
-
"@dxos/react-client": "0.8.
|
|
50
|
-
"@dxos/react-ui-attention": "0.8.
|
|
51
|
-
"@dxos/react-ui-list": "0.8.
|
|
52
|
-
"@dxos/react-ui-menu": "0.8.
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-tabs": "0.8.
|
|
56
|
-
"@dxos/util": "0.8.
|
|
33
|
+
"effect": "3.17.0",
|
|
34
|
+
"@dxos/app-framework": "0.8.4-main.3a94e84",
|
|
35
|
+
"@dxos/app-graph": "0.8.4-main.3a94e84",
|
|
36
|
+
"@dxos/async": "0.8.4-main.3a94e84",
|
|
37
|
+
"@dxos/echo": "0.8.4-main.3a94e84",
|
|
38
|
+
"@dxos/debug": "0.8.4-main.3a94e84",
|
|
39
|
+
"@dxos/echo-schema": "0.8.4-main.3a94e84",
|
|
40
|
+
"@dxos/keyboard": "0.8.4-main.3a94e84",
|
|
41
|
+
"@dxos/live-object": "0.8.4-main.3a94e84",
|
|
42
|
+
"@dxos/local-storage": "0.8.4-main.3a94e84",
|
|
43
|
+
"@dxos/invariant": "0.8.4-main.3a94e84",
|
|
44
|
+
"@dxos/log": "0.8.4-main.3a94e84",
|
|
45
|
+
"@dxos/plugin-deck": "0.8.4-main.3a94e84",
|
|
46
|
+
"@dxos/plugin-graph": "0.8.4-main.3a94e84",
|
|
47
|
+
"@dxos/plugin-observability": "0.8.4-main.3a94e84",
|
|
48
|
+
"@dxos/protocols": "0.8.4-main.3a94e84",
|
|
49
|
+
"@dxos/react-client": "0.8.4-main.3a94e84",
|
|
50
|
+
"@dxos/react-ui-attention": "0.8.4-main.3a94e84",
|
|
51
|
+
"@dxos/react-ui-list": "0.8.4-main.3a94e84",
|
|
52
|
+
"@dxos/react-ui-menu": "0.8.4-main.3a94e84",
|
|
53
|
+
"@dxos/react-ui-stack": "0.8.4-main.3a94e84",
|
|
54
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.3a94e84",
|
|
55
|
+
"@dxos/react-ui-tabs": "0.8.4-main.3a94e84",
|
|
56
|
+
"@dxos/util": "0.8.4-main.3a94e84"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@effect-rx/rx-react": "
|
|
60
|
-
"@effect/platform": "0.
|
|
61
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
59
|
+
"@effect-rx/rx-react": "0.38.0",
|
|
60
|
+
"@effect/platform": "0.89.0",
|
|
62
61
|
"@types/react": "~18.2.0",
|
|
63
62
|
"@types/react-dom": "~18.2.0",
|
|
64
63
|
"react": "~18.2.0",
|
|
65
64
|
"react-dom": "~18.2.0",
|
|
66
65
|
"vite": "5.4.7",
|
|
67
|
-
"@dxos/echo-signals": "0.8.
|
|
68
|
-
"@dxos/plugin-attention": "0.8.
|
|
69
|
-
"@dxos/plugin-client": "0.8.
|
|
70
|
-
"@dxos/plugin-space": "0.8.
|
|
71
|
-
"@dxos/plugin-storybook-layout": "0.8.
|
|
72
|
-
"@dxos/plugin-theme": "0.8.
|
|
73
|
-
"@dxos/random": "0.8.
|
|
74
|
-
"@dxos/react-ui": "0.8.
|
|
75
|
-
"@dxos/react-ui-theme": "0.8.
|
|
76
|
-
"@dxos/storybook-utils": "0.8.
|
|
66
|
+
"@dxos/echo-signals": "0.8.4-main.3a94e84",
|
|
67
|
+
"@dxos/plugin-attention": "0.8.4-main.3a94e84",
|
|
68
|
+
"@dxos/plugin-client": "0.8.4-main.3a94e84",
|
|
69
|
+
"@dxos/plugin-space": "0.8.4-main.3a94e84",
|
|
70
|
+
"@dxos/plugin-storybook-layout": "0.8.4-main.3a94e84",
|
|
71
|
+
"@dxos/plugin-theme": "0.8.4-main.3a94e84",
|
|
72
|
+
"@dxos/random": "0.8.4-main.3a94e84",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.3a94e84",
|
|
74
|
+
"@dxos/react-ui-theme": "0.8.4-main.3a94e84",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.3a94e84"
|
|
77
76
|
},
|
|
78
77
|
"peerDependencies": {
|
|
79
78
|
"@effect-rx/rx-react": "^0.34.1",
|
|
80
|
-
"@effect/platform": "0.80.12",
|
|
81
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
79
|
+
"@effect/platform": "^0.80.12",
|
|
82
80
|
"effect": "^3.13.3",
|
|
83
81
|
"react": "~18.2.0",
|
|
84
82
|
"react-dom": "~18.2.0",
|
|
85
|
-
"@dxos/react-ui": "0.8.
|
|
86
|
-
"@dxos/react-ui-theme": "0.8.
|
|
83
|
+
"@dxos/react-ui": "0.8.4-main.3a94e84",
|
|
84
|
+
"@dxos/react-ui-theme": "0.8.4-main.3a94e84"
|
|
87
85
|
},
|
|
88
86
|
"publishConfig": {
|
|
89
87
|
"access": "public"
|
package/src/NavTreePlugin.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import { AppGraphBuilder, IntentResolver, Keyboard, ReactSurface, State } from '
|
|
|
18
18
|
import { NODE_TYPE } from './components';
|
|
19
19
|
import { NavTreeEvents } from './events';
|
|
20
20
|
import { meta } from './meta';
|
|
21
|
-
import translations from './translations';
|
|
21
|
+
import { translations } from './translations';
|
|
22
22
|
|
|
23
23
|
export const NavTreePlugin = () =>
|
|
24
24
|
definePlugin(meta, [
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { MagnifyingGlass } from '@phosphor-icons/react';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
-
import { Button, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { getSize } from '@dxos/react-ui-theme';
|
|
8
|
+
import { Button, Icon, useTranslation } from '@dxos/react-ui';
|
|
11
9
|
|
|
12
10
|
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../../meta';
|
|
13
11
|
|
|
@@ -31,7 +29,7 @@ export const CommandsTrigger = () => {
|
|
|
31
29
|
}
|
|
32
30
|
>
|
|
33
31
|
<span className='text-description font-normal grow text-start'>{t('command list input placeholder')}</span>
|
|
34
|
-
<
|
|
32
|
+
<Icon icon='ph--magnifying-glass--regular' size={5} />
|
|
35
33
|
</Button>
|
|
36
34
|
);
|
|
37
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
8
8
|
import { Schema } from 'effect';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
|
|
@@ -35,7 +35,7 @@ import { withLayout } from '@dxos/storybook-utils';
|
|
|
35
35
|
|
|
36
36
|
import { NavTreePlugin } from '../../NavTreePlugin';
|
|
37
37
|
import { storybookGraphBuilders } from '../../testing';
|
|
38
|
-
import translations from '../../translations';
|
|
38
|
+
import { translations } from '../../translations';
|
|
39
39
|
import { NavTreeContainer } from '../NavTreeContainer';
|
|
40
40
|
|
|
41
41
|
faker.seed(1234);
|
|
@@ -59,10 +59,9 @@ const getItems = (graph: ReadableGraph, node?: Node, disposition?: string) => {
|
|
|
59
59
|
|
|
60
60
|
const useItems = (node?: Node, options?: { disposition?: string; sort?: boolean }) => {
|
|
61
61
|
const { graph } = useAppGraph();
|
|
62
|
-
const connections = useConnections(graph, node?.id ?? ROOT_ID)
|
|
63
|
-
|
|
64
|
-
);
|
|
65
|
-
return options?.sort ? connections.toSorted((a, b) => byPosition(a.properties, b.properties)) : connections;
|
|
62
|
+
const connections = useConnections(graph, node?.id ?? ROOT_ID);
|
|
63
|
+
const filtered = connections.filter((node) => filterItems(node, options?.disposition));
|
|
64
|
+
return options?.sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
66
65
|
};
|
|
67
66
|
|
|
68
67
|
export type NavTreeContainerProps = {
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { type Action, type Node } from '@dxos/app-graph';
|
|
8
8
|
import { useTranslation, toLocalizedString, IconButton, useDensityContext } from '@dxos/react-ui';
|
|
9
9
|
import { DropdownMenu, MenuProvider, type MenuItem } from '@dxos/react-ui-menu';
|
|
10
|
-
import { hoverableControlItem, hoverableOpenControlItem
|
|
10
|
+
import { hoverableControlItem, hoverableOpenControlItem } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
12
|
import { NAVTREE_PLUGIN } from '../../meta';
|
|
13
13
|
import { type ActionProperties } from '../../types';
|
|
@@ -46,7 +46,7 @@ export const NavTreeItemActionDropdownMenu = ({
|
|
|
46
46
|
<DropdownMenu.Trigger asChild>
|
|
47
47
|
<IconButton
|
|
48
48
|
{...(density === 'coarse' ? coarseActionButtonProps : fineActionButtonProps)}
|
|
49
|
-
classNames={
|
|
49
|
+
classNames={['shrink-0 pli-2 pointer-fine:pli-1', hoverableControlItem, hoverableOpenControlItem]}
|
|
50
50
|
variant='ghost'
|
|
51
51
|
icon={icon ?? fallbackIcon}
|
|
52
52
|
iconOnly
|
|
@@ -70,12 +70,12 @@ export const NavTreeItemMonolithicAction = ({
|
|
|
70
70
|
<IconButton
|
|
71
71
|
{...(density === 'coarse' ? coarseActionButtonProps : fineActionButtonProps)}
|
|
72
72
|
variant={variant}
|
|
73
|
-
classNames={
|
|
73
|
+
classNames={[
|
|
74
74
|
'shrink-0',
|
|
75
75
|
hoverableControlItem,
|
|
76
76
|
hoverableOpenControlItem,
|
|
77
77
|
iconOnly ? 'pli-2 pointer-fine:pli-1' : 'p-2 pointer-fine:p-2 mie-1',
|
|
78
|
-
|
|
78
|
+
]}
|
|
79
79
|
icon={icon ?? fallbackIcon}
|
|
80
80
|
iconOnly={iconOnly}
|
|
81
81
|
label={baseLabel}
|
|
@@ -83,7 +83,7 @@ const L1Panel = ({ open, item, path, currentItemId, onBack }: L1PanelProps) => {
|
|
|
83
83
|
>
|
|
84
84
|
{item.id === currentItemId && (
|
|
85
85
|
<>
|
|
86
|
-
<h2 className='flex items-center border-be border-subduedSeparator app-drag pli-1'>
|
|
86
|
+
<h2 className='flex items-center border-be border-subduedSeparator app-drag pli-1 density-coarse'>
|
|
87
87
|
{backCapable ? (
|
|
88
88
|
<TitleButton title={title} onClick={handleBack} />
|
|
89
89
|
) : (
|
|
@@ -92,10 +92,9 @@ const L1Panel = ({ open, item, path, currentItemId, onBack }: L1PanelProps) => {
|
|
|
92
92
|
{alternateTree && !isAlternate && (
|
|
93
93
|
<IconButton
|
|
94
94
|
variant='ghost'
|
|
95
|
-
classNames={
|
|
95
|
+
classNames={['shrink-0', hoverableControlItem, hoverableOpenControlItem, 'pli-2 pointer-fine:pli-1']}
|
|
96
96
|
iconOnly
|
|
97
97
|
size={5}
|
|
98
|
-
density='coarse'
|
|
99
98
|
icon={alternateTree.properties.icon ?? 'ph--placeholder--regular'}
|
|
100
99
|
label={toLocalizedString(alternateTree.properties.label ?? alternateTree.id, t)}
|
|
101
100
|
data-testid='treeView.alternateTreeButton'
|
package/src/components/index.ts
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { type Meta } from '@storybook/react';
|
|
7
|
+
import { type Meta } from '@storybook/react-vite';
|
|
9
8
|
import React, { type JSX, type PropsWithChildren, useEffect, useState } from 'react';
|
|
10
9
|
|
|
11
10
|
import { faker } from '@dxos/random';
|
|
11
|
+
import { Icon, IconButton } from '@dxos/react-ui';
|
|
12
12
|
import { modalSurface, mx } from '@dxos/react-ui-theme';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
14
|
|
|
@@ -48,7 +48,7 @@ const data: TreeNodeData[] = [
|
|
|
48
48
|
id: faker.string.uuid(),
|
|
49
49
|
title: 'plugins/Personal Space',
|
|
50
50
|
color: 'text-green-400',
|
|
51
|
-
|
|
51
|
+
iconName: 'ph--house--regular',
|
|
52
52
|
children: [
|
|
53
53
|
{
|
|
54
54
|
id: faker.string.uuid(),
|
|
@@ -83,7 +83,7 @@ const data: TreeNodeData[] = [
|
|
|
83
83
|
{
|
|
84
84
|
id: faker.string.uuid(),
|
|
85
85
|
title: faker.commerce.productName(),
|
|
86
|
-
|
|
86
|
+
iconName: 'ph--planet--regular',
|
|
87
87
|
children: [
|
|
88
88
|
{
|
|
89
89
|
id: faker.string.uuid(),
|
|
@@ -94,12 +94,12 @@ const data: TreeNodeData[] = [
|
|
|
94
94
|
{
|
|
95
95
|
id: faker.string.uuid(),
|
|
96
96
|
title: faker.commerce.productName(),
|
|
97
|
-
|
|
97
|
+
iconName: 'ph--sailboat--regular',
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
id: faker.string.uuid(),
|
|
101
101
|
title: faker.commerce.productName(),
|
|
102
|
-
|
|
102
|
+
iconName: 'ph--planet--regular',
|
|
103
103
|
},
|
|
104
104
|
],
|
|
105
105
|
},
|
|
@@ -181,7 +181,7 @@ const Sidebar = ({ mutate }: { mutate?: boolean }) => {
|
|
|
181
181
|
setItems((items) => {
|
|
182
182
|
items[0].children?.push({
|
|
183
183
|
id: faker.string.uuid(),
|
|
184
|
-
|
|
184
|
+
iconName: 'ph--planet--regular',
|
|
185
185
|
title: faker.commerce.productName(),
|
|
186
186
|
});
|
|
187
187
|
|
|
@@ -213,11 +213,11 @@ const Sidebar = ({ mutate }: { mutate?: boolean }) => {
|
|
|
213
213
|
</div>
|
|
214
214
|
|
|
215
215
|
<div className='flex items-center my-2 px-2 gap-2'>
|
|
216
|
-
<
|
|
216
|
+
<IconButton icon='ph--plus-circle--regular' iconOnly label='Create space' onClick={handleCreateSpace} />
|
|
217
217
|
<span className='grow text-sm' onClick={handleCreateSpace}>
|
|
218
218
|
New space
|
|
219
219
|
</span>
|
|
220
|
-
<
|
|
220
|
+
<Icon icon='ph--list--regular' />
|
|
221
221
|
</div>
|
|
222
222
|
</div>
|
|
223
223
|
);
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { CaretRight, Circle, File, Folder, type Icon, type IconProps, Plus, UserCircle } from '@phosphor-icons/react';
|
|
6
5
|
import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
|
|
7
6
|
|
|
8
|
-
import { type ClassNameValue, type Size } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
7
|
+
import { type ClassNameValue, Icon, type Size } from '@dxos/react-ui';
|
|
8
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
10
9
|
|
|
11
10
|
// TODO(burdon): Rounded border if first/last.
|
|
12
11
|
const styles = {
|
|
@@ -15,21 +14,21 @@ const styles = {
|
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
export const IconButton = ({
|
|
18
|
-
|
|
17
|
+
iconName,
|
|
19
18
|
classNames,
|
|
20
19
|
size = 4,
|
|
21
20
|
onClick,
|
|
22
|
-
|
|
21
|
+
weight = 'regular',
|
|
23
22
|
}: {
|
|
24
|
-
|
|
23
|
+
iconName: string;
|
|
25
24
|
classNames?: ClassNameValue;
|
|
26
25
|
size?: Size;
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
weight?: 'regular' | 'duotone' | 'fill';
|
|
27
|
+
} & Pick<HTMLAttributes<HTMLDivElement>, 'onClick'>) => {
|
|
29
28
|
// TODO(burdon): Density aware.
|
|
30
29
|
return (
|
|
31
30
|
<div className={mx('flex w-6 h-6 items-center justify-center select-none', classNames)} onClick={onClick}>
|
|
32
|
-
<Icon
|
|
31
|
+
<Icon icon={iconName} classNames='cursor-pointer' size={size} />
|
|
33
32
|
</div>
|
|
34
33
|
);
|
|
35
34
|
};
|
|
@@ -37,7 +36,7 @@ export const IconButton = ({
|
|
|
37
36
|
export type TreeNodeData = {
|
|
38
37
|
id: string;
|
|
39
38
|
title: string;
|
|
40
|
-
|
|
39
|
+
iconName?: string;
|
|
41
40
|
color?: string;
|
|
42
41
|
children?: TreeNodeData[];
|
|
43
42
|
};
|
|
@@ -123,7 +122,7 @@ const StateIcon = ({ node, open, selected, active }: TreeNodeProps) => {
|
|
|
123
122
|
// TODO(burdon): No animation if opening/closing folder.
|
|
124
123
|
return (
|
|
125
124
|
<IconButton
|
|
126
|
-
|
|
125
|
+
iconName={isActive ? 'ph--user-circle--regular' : 'ph--circle--regular'}
|
|
127
126
|
size={4}
|
|
128
127
|
weight={selected?.[id] ? 'fill' : 'duotone'}
|
|
129
128
|
classNames={mx(
|
|
@@ -143,7 +142,7 @@ const OpenIcon = ({
|
|
|
143
142
|
return (
|
|
144
143
|
(children?.length && open && (
|
|
145
144
|
<IconButton
|
|
146
|
-
|
|
145
|
+
iconName='ph--caret-right--regular'
|
|
147
146
|
size={3}
|
|
148
147
|
classNames={mx('transition duration-200', open?.[id] ? 'rotate-90' : 'transform-none')}
|
|
149
148
|
onClick={(ev) => {
|
|
@@ -157,12 +156,12 @@ const OpenIcon = ({
|
|
|
157
156
|
|
|
158
157
|
// TODO(burdon): Drag handle,
|
|
159
158
|
const ItemIcon = ({
|
|
160
|
-
node: { children,
|
|
159
|
+
node: { children, iconName = children?.length ? 'ph--folder--regular' : 'ph--file--regular', color },
|
|
161
160
|
}: Pick<TreeNodeProps, 'node'>) => {
|
|
162
161
|
return (
|
|
163
|
-
(
|
|
162
|
+
(iconName && (
|
|
164
163
|
<IconButton
|
|
165
|
-
|
|
164
|
+
iconName={iconName}
|
|
166
165
|
classNames={color ?? 'text-neutral-700 dark:text-neutral-300'}
|
|
167
166
|
weight={color ? 'duotone' : 'regular'}
|
|
168
167
|
/>
|
|
@@ -173,7 +172,7 @@ const ItemIcon = ({
|
|
|
173
172
|
const MenuItem = ({ node: { id }, onMenuAction }: Pick<TreeNodeProps, 'node' | 'onMenuAction'>) => {
|
|
174
173
|
return (
|
|
175
174
|
<IconButton
|
|
176
|
-
|
|
175
|
+
iconName='ph--plus--regular'
|
|
177
176
|
classNames='invisible group-hover:visible'
|
|
178
177
|
onClick={(ev) => {
|
|
179
178
|
ev.stopPropagation();
|
package/src/translations.ts
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const translations = [
|
|
8
10
|
{
|
|
9
11
|
'en-US': {
|
|
10
|
-
[
|
|
12
|
+
[meta.id]: {
|
|
11
13
|
'app menu label': 'App menu',
|
|
12
14
|
'open settings label': 'Settings',
|
|
13
15
|
'open commands label': 'Search commands',
|
|
@@ -19,4 +21,4 @@ export default [
|
|
|
19
21
|
},
|
|
20
22
|
},
|
|
21
23
|
},
|
|
22
|
-
];
|
|
24
|
+
] as const satisfies Resource[];
|