@dxos/plugin-simple-layout 0.0.0 → 0.8.4-main.1068cf700f
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/chunk-7VLT3S46.mjs +29 -0
- package/dist/lib/browser/chunk-7VLT3S46.mjs.map +7 -0
- package/dist/lib/browser/chunk-O3BQBYMW.mjs +1165 -0
- package/dist/lib/browser/chunk-O3BQBYMW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +101 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs +205 -0
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs.map +7 -0
- package/dist/lib/browser/react-root-GPTKI5H2.mjs +21 -0
- package/dist/lib/browser/react-root-GPTKI5H2.mjs.map +7 -0
- package/dist/lib/browser/react-surface-LT5JJTPR.mjs +41 -0
- package/dist/lib/browser/react-surface-LT5JJTPR.mjs.map +7 -0
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs +66 -0
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +7 -0
- package/dist/lib/browser/state-A3PGDWWZ.mjs +48 -0
- package/dist/lib/browser/state-A3PGDWWZ.mjs.map +7 -0
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs +152 -0
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UAWM4B2S.mjs +1166 -0
- package/dist/lib/node-esm/chunk-UAWM4B2S.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VIDE5UMB.mjs +31 -0
- package/dist/lib/node-esm/chunk-VIDE5UMB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +102 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs +206 -0
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs.map +7 -0
- package/dist/lib/node-esm/react-root-GRG2OAI2.mjs +22 -0
- package/dist/lib/node-esm/react-root-GRG2OAI2.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-TCUSDIN2.mjs +42 -0
- package/dist/lib/node-esm/react-surface-TCUSDIN2.mjs.map +7 -0
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs +68 -0
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs.map +7 -0
- package/dist/lib/node-esm/state-ZCFZTTPL.mjs +49 -0
- package/dist/lib/node-esm/state-ZCFZTTPL.mjs.map +7 -0
- package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs +153 -0
- package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs.map +7 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts +7 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
- package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +3 -0
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts +14 -0
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +13 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +19 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +12 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/ContentError.d.ts +5 -0
- package/dist/types/src/components/ContentError.d.ts.map +1 -0
- package/dist/types/src/components/ContentError.stories.d.ts +41 -0
- package/dist/types/src/components/ContentError.stories.d.ts.map +1 -0
- package/dist/types/src/components/ContentLoading.d.ts +3 -0
- package/dist/types/src/components/ContentLoading.d.ts.map +1 -0
- package/dist/types/src/components/ContentLoading.stories.d.ts +13 -0
- package/dist/types/src/components/ContentLoading.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts +3 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/index.d.ts +2 -0
- package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/src/components/Home/Home.d.ts +7 -0
- package/dist/types/src/components/Home/Home.d.ts.map +1 -0
- package/dist/types/src/components/Home/index.d.ts +2 -0
- package/dist/types/src/components/Home/index.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +35 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts +7 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/index.d.ts +2 -0
- package/dist/types/src/components/MobileLayout/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.d.ts +4 -0
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -0
- package/dist/types/src/components/Popover/index.d.ts +2 -0
- package/dist/types/src/components/Popover/index.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts +26 -0
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +47 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts +9 -0
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/Main.d.ts +9 -0
- package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts +18 -0
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +43 -0
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts +3 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +47 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/index.d.ts +5 -0
- package/dist/types/src/components/SimpleLayout/index.d.ts.map +1 -0
- package/dist/types/src/components/Workspace/Workspace.d.ts +11 -0
- package/dist/types/src/components/Workspace/Workspace.d.ts.map +1 -0
- package/dist/types/src/components/Workspace/index.d.ts +2 -0
- package/dist/types/src/components/Workspace/index.d.ts.map +1 -0
- package/dist/types/src/components/hooks.d.ts +5 -0
- package/dist/types/src/components/hooks.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +7 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/hooks/actions.d.ts +20 -0
- package/dist/types/src/hooks/actions.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +7 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useAppBarProps.d.ts +7 -0
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -0
- package/dist/types/src/hooks/useCompanions.d.ts +12 -0
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
- package/dist/types/src/hooks/useDrawerActions.d.ts +13 -0
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts +14 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts +7 -0
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +3 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +26 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +36 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +6 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +39 -29
- package/src/SimpleLayoutPlugin.ts +25 -8
- package/src/capabilities/index.ts +3 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +135 -53
- package/src/capabilities/react-root/react-root.tsx +2 -2
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +41 -0
- package/src/capabilities/spotlight-dismiss/index.ts +7 -0
- package/src/{hooks/useSpotlightDismiss.ts → capabilities/spotlight-dismiss/spotlight-dismiss.ts} +31 -40
- package/src/capabilities/state/state.tsx +25 -33
- package/src/capabilities/url-handler/index.ts +7 -0
- package/src/capabilities/url-handler/url-handler.ts +157 -0
- package/src/components/ContentError.stories.tsx +1 -1
- package/src/components/ContentLoading.stories.tsx +1 -1
- package/src/components/Dialog/Dialog.tsx +14 -14
- package/src/components/Home/Home.tsx +64 -70
- package/src/components/MobileLayout/MobileLayout.stories.tsx +125 -0
- package/src/components/MobileLayout/MobileLayout.tsx +305 -0
- package/src/components/MobileLayout/index.ts +5 -0
- package/src/components/Popover/Popover.tsx +45 -27
- package/src/components/SimpleLayout/AppBar.stories.tsx +144 -0
- package/src/components/SimpleLayout/AppBar.tsx +101 -0
- package/src/components/SimpleLayout/Drawer.tsx +102 -0
- package/src/components/SimpleLayout/Main.tsx +53 -57
- package/src/components/SimpleLayout/NavBar.stories.tsx +164 -0
- package/src/components/SimpleLayout/NavBar.tsx +29 -86
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +24 -18
- package/src/components/SimpleLayout/SimpleLayout.tsx +45 -7
- package/src/components/SimpleLayout/index.ts +3 -0
- package/src/components/Workspace/Workspace.tsx +119 -0
- package/src/components/Workspace/index.ts +5 -0
- package/src/components/hooks.ts +26 -0
- package/src/components/index.ts +2 -0
- package/src/hooks/actions.ts +85 -0
- package/src/hooks/index.ts +6 -1
- package/src/hooks/useAppBarProps.ts +112 -0
- package/src/hooks/useCompanions.ts +22 -0
- package/src/hooks/useDrawerActions.ts +98 -0
- package/src/hooks/useNavbarActions.ts +86 -0
- package/src/hooks/useSimpleLayoutState.ts +30 -0
- package/src/translations.ts +6 -0
- package/src/types/capabilities.ts +20 -4
- package/src/types/events.ts +15 -0
- package/src/types/index.ts +1 -0
- package/src/components/SimpleLayout/Banner.tsx +0 -60
- package/src/components/SimpleLayout/NavBarstories.tsx +0 -59
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { RegistryContext, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { useCallback, useContext } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
9
|
+
|
|
10
|
+
import { SimpleLayoutState } from '../types';
|
|
11
|
+
|
|
12
|
+
export type UseSimpleLayoutState = {
|
|
13
|
+
state: SimpleLayoutState;
|
|
14
|
+
updateState: (fn: (current: SimpleLayoutState) => SimpleLayoutState) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const useSimpleLayoutState = (): UseSimpleLayoutState => {
|
|
18
|
+
const registry = useContext(RegistryContext);
|
|
19
|
+
const stateAtom = useCapability(SimpleLayoutState);
|
|
20
|
+
const state = useAtomValue(stateAtom);
|
|
21
|
+
|
|
22
|
+
const updateState = useCallback(
|
|
23
|
+
(fn: (current: SimpleLayoutState) => SimpleLayoutState) => {
|
|
24
|
+
registry.set(stateAtom, fn(registry.get(stateAtom)));
|
|
25
|
+
},
|
|
26
|
+
[registry, stateAtom],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return { state, updateState };
|
|
30
|
+
};
|
package/src/translations.ts
CHANGED
|
@@ -20,8 +20,14 @@ export const translations = [
|
|
|
20
20
|
'profile label': 'Profile',
|
|
21
21
|
'app menu label': 'App menu',
|
|
22
22
|
'main menu label': 'Main menu',
|
|
23
|
+
'companions menu label': 'Companions',
|
|
23
24
|
'error fallback message': 'An error occurred',
|
|
24
25
|
'search placeholder': 'Search...',
|
|
26
|
+
'drawer label': 'Drawer',
|
|
27
|
+
'close drawer label': 'Close drawer',
|
|
28
|
+
'expand drawer label': 'Expand drawer',
|
|
29
|
+
'collapse drawer label': 'Collapse drawer',
|
|
30
|
+
'actions menu label': 'Actions',
|
|
25
31
|
},
|
|
26
32
|
},
|
|
27
33
|
},
|
|
@@ -2,15 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
|
|
5
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { type Label } from '@dxos/react-ui';
|
|
6
9
|
|
|
7
10
|
import { meta } from '../meta';
|
|
8
11
|
|
|
12
|
+
export type DrawerState = 'closed' | 'open' | 'expanded';
|
|
13
|
+
|
|
9
14
|
// TODO(wittjosiah): Handle toasts.
|
|
10
15
|
export type SimpleLayoutState = {
|
|
11
16
|
/** Data to be passed to the main content Surface. */
|
|
12
17
|
content?: any;
|
|
13
18
|
|
|
19
|
+
previousWorkspace: string;
|
|
20
|
+
workspace: string;
|
|
21
|
+
active?: string;
|
|
22
|
+
|
|
14
23
|
dialogOpen: boolean;
|
|
15
24
|
dialogType?: 'default' | 'alert';
|
|
16
25
|
dialogBlockAlign?: 'start' | 'center' | 'end';
|
|
@@ -24,14 +33,21 @@ export type SimpleLayoutState = {
|
|
|
24
33
|
popoverVariant?: 'virtual' | 'react';
|
|
25
34
|
popoverAnchor?: HTMLButtonElement;
|
|
26
35
|
popoverAnchorId?: string;
|
|
36
|
+
popoverKind?: 'base' | 'card';
|
|
37
|
+
popoverTitle?: Label;
|
|
27
38
|
popoverContent?: any;
|
|
28
39
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
/** Bottom drawer state. */
|
|
41
|
+
drawerState: DrawerState;
|
|
42
|
+
|
|
43
|
+
/** Stack of previously active item IDs for back navigation. */
|
|
44
|
+
history: string[];
|
|
32
45
|
|
|
33
46
|
/** Whether running in popover window context (hides mobile-specific UI). */
|
|
34
47
|
isPopover?: boolean;
|
|
48
|
+
|
|
49
|
+
/** Variant of the companion to display in the drawer (e.g., "comments", "assistant-chat"). */
|
|
50
|
+
companionVariant?: string;
|
|
35
51
|
};
|
|
36
52
|
|
|
37
|
-
export const SimpleLayoutState = Capability.make<SimpleLayoutState
|
|
53
|
+
export const SimpleLayoutState = Capability.make<Atom.Writable<SimpleLayoutState>>(`${meta.id}/state`);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { SimpleLayoutState } from './capabilities';
|
|
9
|
+
|
|
10
|
+
export namespace SimpleLayoutEvents {
|
|
11
|
+
/** Fired when SimpleLayoutState capability is ready. */
|
|
12
|
+
export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
13
|
+
SimpleLayoutState.identifier,
|
|
14
|
+
);
|
|
15
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Common } from '@dxos/app-framework';
|
|
8
|
-
import { useCapability, useOperationInvoker } from '@dxos/app-framework/react';
|
|
9
|
-
import { type Node } from '@dxos/plugin-graph';
|
|
10
|
-
import { IconButton, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { mx, osTranslations, surfaceZIndex } from '@dxos/ui-theme';
|
|
12
|
-
|
|
13
|
-
import { meta } from '../../meta';
|
|
14
|
-
import { SimpleLayoutState } from '../../types';
|
|
15
|
-
|
|
16
|
-
export type BannerProps = {
|
|
17
|
-
node?: Node.Node;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const Banner = ({ node }: BannerProps) => {
|
|
21
|
-
const { t } = useTranslation(meta.id);
|
|
22
|
-
const layout = useCapability(SimpleLayoutState);
|
|
23
|
-
const { invokePromise } = useOperationInvoker();
|
|
24
|
-
const label = node ? toLocalizedString(node.properties.label, t) : t('current app name', { ns: osTranslations });
|
|
25
|
-
|
|
26
|
-
const handleClick = useCallback(async () => {
|
|
27
|
-
if (layout.active) {
|
|
28
|
-
await invokePromise(Common.LayoutOperation.Close, { subject: [layout.active] });
|
|
29
|
-
} else {
|
|
30
|
-
await invokePromise(Common.LayoutOperation.SwitchWorkspace, { subject: 'default' });
|
|
31
|
-
}
|
|
32
|
-
}, [invokePromise, layout.active]);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
// Note that the HTML5 element `header` has a default role of `banner`, hence the name of this component.
|
|
36
|
-
// It should not be confused with the `heading` role (elements h1-6).
|
|
37
|
-
// TODO(burdon): Fixed or not?
|
|
38
|
-
<header
|
|
39
|
-
className={mx(
|
|
40
|
-
'_fixed flex items-center gap-2 pli-2 block-start-0 inset-inline-0 bs-[--dx-mobile-topbar-content-height,48px] bg-baseSurface border-be border-separator',
|
|
41
|
-
'grid grid-cols-[min-content_1fr_min-content]',
|
|
42
|
-
surfaceZIndex({ level: 'menu' }),
|
|
43
|
-
)}
|
|
44
|
-
>
|
|
45
|
-
{node ? (
|
|
46
|
-
<IconButton
|
|
47
|
-
iconOnly
|
|
48
|
-
variant='ghost'
|
|
49
|
-
icon='ph--caret-left--regular'
|
|
50
|
-
label={t('back label')}
|
|
51
|
-
onClick={handleClick}
|
|
52
|
-
/>
|
|
53
|
-
) : (
|
|
54
|
-
<div />
|
|
55
|
-
)}
|
|
56
|
-
<h1 className={'grow text-center truncate font-medium'}>{label}</h1>
|
|
57
|
-
{/* TODO(burdon): Menu. */}
|
|
58
|
-
</header>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
|
|
7
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
8
|
-
import { corePlugins } from '@dxos/plugin-testing';
|
|
9
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
10
|
-
|
|
11
|
-
import { translations } from '../../translations';
|
|
12
|
-
|
|
13
|
-
import { NavBar } from './NavBar';
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: 'plugins/plugin-simple-layout/NavBar',
|
|
17
|
-
component: NavBar,
|
|
18
|
-
decorators: [
|
|
19
|
-
withTheme,
|
|
20
|
-
withPluginManager({
|
|
21
|
-
plugins: [...corePlugins()],
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
24
|
-
parameters: {
|
|
25
|
-
layout: 'fullscreen',
|
|
26
|
-
translations,
|
|
27
|
-
},
|
|
28
|
-
argTypes: {
|
|
29
|
-
onActiveIdChange: { action: 'activeIdChanged' },
|
|
30
|
-
},
|
|
31
|
-
} satisfies Meta<typeof NavBar>;
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
|
|
35
|
-
type Story = StoryObj<typeof meta>;
|
|
36
|
-
|
|
37
|
-
export const Default: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
activeId: undefined,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const BrowseActive: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
activeId: 'some-document',
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const NotificationsActive: Story = {
|
|
50
|
-
args: {
|
|
51
|
-
activeId: 'notifications',
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const ProfileActive: Story = {
|
|
56
|
-
args: {
|
|
57
|
-
activeId: 'profile',
|
|
58
|
-
},
|
|
59
|
-
};
|