@sybilion/uilib 1.4.14 → 1.4.16
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/agent-glossary/content-prompt.generated.ts +28 -23
- package/dist/agent-glossary/content.generated.ts +28 -23
- package/dist/agent-glossary/content.index.md +1 -1
- package/dist/agent-glossary/content.md +28 -23
- package/dist/agent-glossary/content.prompt.md +28 -23
- package/dist/agent-glossary/workspace.generated.ts +1 -1
- package/dist/agent-glossary/workspace.index.md +1 -1
- package/dist/agent-glossary/workspace.md +1 -1
- package/dist/esm/components/ui/Chat/ChatChrome/ChatChrome.js +28 -3
- package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +31 -1
- package/dist/esm/components/ui/DropdownMenu/DropdownMenu.styl.js +2 -2
- package/dist/esm/components/ui/Page/Breadcrumbs/Breadcrumbs.js +28 -1
- package/dist/esm/components/ui/PanelResizeHandle/PanelResizeHandle.js +50 -0
- package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +3 -3
- package/dist/esm/components/ui/Sidebar/SidebarAside.js +36 -0
- package/dist/esm/components/ui/Sidebar/SidebarContent/SidebarContent.js +13 -0
- package/dist/esm/components/ui/Sidebar/SidebarContent/SidebarContent.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarFooter/SidebarFooter.js +9 -0
- package/dist/esm/components/ui/Sidebar/SidebarFooter/SidebarFooter.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarGroup/SidebarGroup.js +9 -0
- package/dist/esm/components/ui/Sidebar/SidebarGroup/SidebarGroup.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.js +11 -0
- package/dist/esm/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenu/SidebarMenu.js +15 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenu/SidebarMenu.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.js +11 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.js +16 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.js +12 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.js +32 -0
- package/dist/esm/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarProvider/SidebarProvider.js +314 -0
- package/dist/esm/components/ui/Sidebar/SidebarProvider/SidebarProvider.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarRail/SidebarRail.js +11 -0
- package/dist/esm/components/ui/Sidebar/SidebarRail/SidebarRail.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.js +26 -0
- package/dist/esm/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.js +10 -0
- package/dist/esm/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.js +16 -0
- package/dist/esm/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl.js +7 -0
- package/dist/esm/components/ui/Sidebar/sidebarConstants.js +7 -0
- package/dist/esm/components/ui/Sidebar/sidebarContext.js +28 -0
- package/dist/esm/components/ui/Sidebar/sidebarUtils.js +41 -0
- package/dist/esm/components/widgets/DriverMap/DriverMap.js +8 -8
- package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.js +26 -5
- package/dist/esm/components/widgets/PerformanceChart/PerformanceChart.js +2 -2
- package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +28 -6
- package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js +28 -1
- package/dist/esm/index.js +18 -1
- package/dist/esm/types/src/components/ui/PanelResizeHandle/PanelResizeHandle.d.ts +9 -0
- package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +19 -108
- package/dist/esm/types/src/components/ui/Sidebar/Sidebar.types.d.ts +41 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarAside.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarContent/SidebarContent.d.ts +3 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.d.ts +4 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.d.ts +4 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.d.ts +5 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.d.ts +10 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.d.ts +3 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.d.ts +9 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.d.ts +11 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarRail/SidebarRail.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.d.ts +4 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.d.ts +3 -0
- package/dist/esm/types/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.d.ts +3 -0
- package/dist/esm/types/src/components/ui/Sidebar/sidebarConstants.d.ts +5 -0
- package/dist/esm/types/src/components/ui/Sidebar/sidebarContext.d.ts +7 -0
- package/dist/esm/types/src/components/ui/Sidebar/sidebarUtils.d.ts +3 -0
- package/dist/esm/types/src/components/widgets/DriverMap/DriverMap.d.ts +2 -1
- package/dist/esm/types/src/components/widgets/PerformanceChart/PerformanceChart.d.ts +2 -1
- package/dist/esm/types/src/components/widgets/PerformanceChart/PerformanceTable.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/ui/ChartAreaInteractive/AGENT.md +0 -4
- package/src/components/ui/Chat/ChatChrome/ChatChrome.tsx +5 -2
- package/src/components/ui/DropdownMenu/DropdownMenu.styl +4 -1
- package/src/components/ui/PanelResizeHandle/PanelResizeHandle.tsx +89 -0
- package/src/components/ui/Sidebar/Sidebar.styl +23 -625
- package/src/components/ui/Sidebar/Sidebar.styl.d.ts +0 -33
- package/src/components/ui/Sidebar/Sidebar.tsx +25 -1157
- package/src/components/ui/Sidebar/Sidebar.types.ts +46 -0
- package/src/components/ui/Sidebar/SidebarAside.tsx +92 -0
- package/src/components/ui/Sidebar/SidebarContent/SidebarContent.styl +27 -0
- package/src/components/ui/Sidebar/SidebarContent/SidebarContent.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarContent/SidebarContent.tsx +29 -0
- package/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.styl +7 -0
- package/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.tsx +15 -0
- package/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.styl +10 -0
- package/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.tsx +15 -0
- package/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.styl +34 -0
- package/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.tsx +23 -0
- package/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.styl +60 -0
- package/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.styl.d.ts +12 -0
- package/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.tsx +40 -0
- package/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.styl +73 -0
- package/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.styl.d.ts +8 -0
- package/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.tsx +31 -0
- package/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.styl +107 -0
- package/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.styl.d.ts +15 -0
- package/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.tsx +82 -0
- package/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.styl +39 -0
- package/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.styl.d.ts +8 -0
- package/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.tsx +29 -0
- package/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.styl +71 -0
- package/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.styl.d.ts +8 -0
- package/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.tsx +80 -0
- package/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.styl +45 -0
- package/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.styl.d.ts +9 -0
- package/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.tsx +447 -0
- package/src/components/ui/Sidebar/SidebarRail/SidebarRail.styl +42 -0
- package/src/components/ui/Sidebar/SidebarRail/SidebarRail.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarRail/SidebarRail.tsx +22 -0
- package/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.styl +37 -0
- package/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.tsx +54 -0
- package/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.styl +7 -0
- package/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.tsx +20 -0
- package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl +11 -0
- package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl.d.ts +7 -0
- package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.tsx +34 -0
- package/src/components/ui/Sidebar/sidebarConstants.ts +6 -0
- package/src/components/ui/Sidebar/sidebarContext.tsx +46 -0
- package/src/components/ui/Sidebar/sidebarUtils.ts +47 -0
- package/src/components/widgets/DriverMap/AGENT.md +0 -4
- package/src/components/widgets/DriverMap/DriverMap.tsx +11 -10
- package/src/components/widgets/DriversComparisonChart/AGENT.md +0 -4
- package/src/components/widgets/PerformanceChart/AGENT.md +0 -4
- package/src/components/widgets/PerformanceChart/PerformanceChart.tsx +3 -0
- package/src/components/widgets/PerformanceChart/PerformanceTable.tsx +3 -1
- package/src/components/widgets/SidebarDatasetsItemsGrouped/AGENT.md +28 -11
- package/src/docs/components/DocsGuidance/DocsGuidance.styl +1 -0
- package/dist/esm/components/ui/Sidebar/Sidebar.js +0 -542
|
@@ -1,1162 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import { Separator } from '#uilib/components/ui/Separator';
|
|
20
|
-
import { Sheet, SheetContent, SheetTitle } from '#uilib/components/ui/Sheet';
|
|
21
|
-
import {
|
|
22
|
-
SmartTextTruncate,
|
|
23
|
-
notifyPanelWidthDragEnd,
|
|
24
|
-
notifyPanelWidthDragStart,
|
|
25
|
-
} from '#uilib/components/ui/SmartTextTruncate/SmartTextTruncate';
|
|
26
|
-
import {
|
|
27
|
-
Tooltip,
|
|
28
|
-
TooltipContent,
|
|
29
|
-
TooltipProvider,
|
|
30
|
-
TooltipTrigger,
|
|
31
|
-
} from '#uilib/components/ui/Tooltip';
|
|
32
|
-
import {
|
|
33
|
-
CHAT_WIDTH_DEFAULT_PX,
|
|
34
|
-
CHAT_WIDTH_MIN_PX,
|
|
35
|
-
CHAT_WIDTH_STORAGE_KEY,
|
|
36
|
-
SIDEBAR_WIDTH_DEFAULT_PX,
|
|
37
|
-
SIDEBAR_WIDTH_MIN_PX,
|
|
38
|
-
SIDEBAR_WIDTH_STORAGE_KEY_PCT,
|
|
39
|
-
SIDEBAR_WIDTH_STORAGE_KEY_PX,
|
|
40
|
-
clampChatWidthPx,
|
|
41
|
-
clampSidebarWidthPx,
|
|
42
|
-
defaultChatWidthPx,
|
|
43
|
-
shellFitsSidebarsLayout,
|
|
44
|
-
} from '#uilib/hooks/panelWidth';
|
|
45
|
-
import useElemDrag, { Delta } from '#uilib/hooks/useDragElem';
|
|
46
|
-
import useEvent from '#uilib/hooks/useEvent';
|
|
47
|
-
import { useIsSidebarSheetLayout } from '#uilib/hooks/useIsSidebarSheetLayout';
|
|
48
|
-
import { useShellWidthObserver } from '#uilib/hooks/useShellWidthObserver';
|
|
49
|
-
import { getCookie, setCookie } from '#uilib/lib/cookie';
|
|
50
|
-
import { getCookiePreferences } from '#uilib/lib/cookie-consent/cookie-consent';
|
|
51
|
-
import { LS, Scroll } from '@homecode/ui';
|
|
52
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
53
|
-
import { ChevronDown, ChevronRight, PanelLeft } from 'lucide-react';
|
|
54
|
-
|
|
55
|
-
import S from './Sidebar.styl';
|
|
56
|
-
|
|
57
|
-
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
58
|
-
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
59
|
-
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
60
|
-
|
|
61
|
-
/** Fired when nav open closes chat for layout; ChatSheet clears `?chat=` so URL sync does not reopen chat. */
|
|
62
|
-
export const DISMISS_CHAT_FOR_LAYOUT_EVENT = 'sybilion:dismiss-chat-for-layout';
|
|
63
|
-
|
|
64
|
-
function isEditableKeyboardTarget(el: Element | null): boolean {
|
|
65
|
-
if (!el) return false;
|
|
66
|
-
if (el instanceof HTMLElement && el.isContentEditable) return true;
|
|
67
|
-
const tag = el.tagName;
|
|
68
|
-
return tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function readInitialSidebarWidthPx(storageKeyPx: string): number {
|
|
72
|
-
if (typeof window === 'undefined') return SIDEBAR_WIDTH_DEFAULT_PX;
|
|
73
|
-
const stored = LS.get(storageKeyPx);
|
|
74
|
-
if (typeof stored === 'number' && stored >= SIDEBAR_WIDTH_MIN_PX) {
|
|
75
|
-
return stored;
|
|
76
|
-
}
|
|
77
|
-
if (storageKeyPx === SIDEBAR_WIDTH_STORAGE_KEY_PX) {
|
|
78
|
-
const legacyPct = LS.get(SIDEBAR_WIDTH_STORAGE_KEY_PCT);
|
|
79
|
-
if (typeof legacyPct === 'number' && legacyPct > 0) {
|
|
80
|
-
const w = window.innerWidth;
|
|
81
|
-
return clampSidebarWidthPx(Math.round((legacyPct / 100) * w), w, {
|
|
82
|
-
chatPanelOpen: false,
|
|
83
|
-
chatWidthPx: 0,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return SIDEBAR_WIDTH_DEFAULT_PX;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function readInitialChatWidthPx(): number {
|
|
91
|
-
if (typeof window === 'undefined') return CHAT_WIDTH_DEFAULT_PX;
|
|
92
|
-
const stored = LS.get(CHAT_WIDTH_STORAGE_KEY);
|
|
93
|
-
if (typeof stored === 'number' && stored >= CHAT_WIDTH_MIN_PX) {
|
|
94
|
-
return stored;
|
|
95
|
-
}
|
|
96
|
-
return defaultChatWidthPx(window.innerWidth);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
type SetPanelWidthOptions = { persist?: boolean };
|
|
100
|
-
|
|
101
|
-
/** Pass `viewTransition: false` to avoid nesting `document.startViewTransition` (e.g. chat open already animating). */
|
|
102
|
-
export type SetSidebarOpenOptions = {
|
|
103
|
-
viewTransition?: boolean;
|
|
104
|
-
/** Nav closed for layout (chat/width); restore when chat closes — do not persist closed cookie. */
|
|
105
|
-
layoutAutoClose?: boolean;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
type SidebarActionsContextProps = {
|
|
109
|
-
setOpen: (open: boolean, options?: SetSidebarOpenOptions) => void;
|
|
110
|
-
toggleSidebar: () => void;
|
|
111
|
-
setSidebarWidthPx: (px: number, options?: SetPanelWidthOptions) => void;
|
|
112
|
-
setChatWidthPx: (px: number, options?: SetPanelWidthOptions) => void;
|
|
113
|
-
setChatPanelOpen: (open: boolean) => void;
|
|
114
|
-
getShellWidth: () => number;
|
|
115
|
-
/** Read shell chat open without subscribing to SidebarStateContext. */
|
|
116
|
-
getChatPanelOpen: () => boolean;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
type SidebarStateContextProps = {
|
|
120
|
-
isOpen: boolean;
|
|
121
|
-
sidebarWidthPx: number;
|
|
122
|
-
chatWidthPx: number;
|
|
123
|
-
chatPanelOpen: boolean;
|
|
124
|
-
/** Portal target for the AI chat side panel (right column). */
|
|
125
|
-
chatPanelContainer: HTMLDivElement | null;
|
|
126
|
-
/** App shell wrapper; used to set `--chat-panel-width` (and `--chat-panel-height` on mobile only). */
|
|
127
|
-
sidebarWrapperRef: RefObject<HTMLDivElement | null>;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
type SidebarContextProps = SidebarStateContextProps &
|
|
131
|
-
SidebarActionsContextProps;
|
|
132
|
-
|
|
133
|
-
type SidebarProps = ComponentProps<'div'> & {
|
|
134
|
-
defaultOpen?: boolean;
|
|
135
|
-
open?: boolean;
|
|
136
|
-
onOpenChange?: (open: boolean) => void;
|
|
137
|
-
side?: 'left' | 'right';
|
|
138
|
-
variant?: 'sidebar' | 'floating' | 'inset';
|
|
139
|
-
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
140
|
-
fullHeightResizer?: boolean;
|
|
141
|
-
brandText?: string;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const SidebarActionsContext = createContext<SidebarActionsContextProps | null>(
|
|
145
|
-
null,
|
|
146
|
-
);
|
|
147
|
-
const SidebarStateContext = createContext<SidebarStateContextProps | null>(
|
|
148
|
-
null,
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
function useSidebarActions() {
|
|
152
|
-
const context = useContext(SidebarActionsContext);
|
|
153
|
-
if (!context) {
|
|
154
|
-
throw new Error('useSidebarActions must be used within a SidebarProvider.');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return context;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function useSidebarState() {
|
|
161
|
-
const context = useContext(SidebarStateContext);
|
|
162
|
-
if (!context) {
|
|
163
|
-
throw new Error('useSidebarState must be used within a SidebarProvider.');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return context;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function useSidebar(): SidebarContextProps {
|
|
170
|
-
const actions = useSidebarActions();
|
|
171
|
-
const state = useSidebarState();
|
|
172
|
-
return useMemo(
|
|
173
|
-
() => ({
|
|
174
|
-
...state,
|
|
175
|
-
...actions,
|
|
176
|
-
}),
|
|
177
|
-
[state, actions],
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function SidebarProvider({
|
|
182
|
-
defaultOpen = (getCookie('isSidebarOpen') as unknown as boolean) ?? true,
|
|
183
|
-
className,
|
|
184
|
-
style,
|
|
185
|
-
children,
|
|
186
|
-
userId,
|
|
187
|
-
sidebarWidthStorageKey,
|
|
188
|
-
persistSidebarWidthWithoutConsent = false,
|
|
189
|
-
...props
|
|
190
|
-
}: ComponentProps<'div'> & {
|
|
191
|
-
defaultOpen?: boolean;
|
|
192
|
-
open?: boolean;
|
|
193
|
-
onOpenChange?: (open: boolean) => void;
|
|
194
|
-
userId?: string | number | null;
|
|
195
|
-
/** LocalStorage key for sidebar width (pixels). Defaults to `sidebarWidthPx`. */
|
|
196
|
-
sidebarWidthStorageKey?: string;
|
|
197
|
-
/** When true, sidebar width is saved without functional cookie consent (e.g. internal docs). */
|
|
198
|
-
persistSidebarWidthWithoutConsent?: boolean;
|
|
199
|
-
}) {
|
|
200
|
-
const sidebarLsKey = sidebarWidthStorageKey ?? SIDEBAR_WIDTH_STORAGE_KEY_PX;
|
|
201
|
-
const allowPersistSidebarWidth =
|
|
202
|
-
persistSidebarWidthWithoutConsent ||
|
|
203
|
-
Boolean(getCookiePreferences(userId)?.functional);
|
|
204
|
-
|
|
205
|
-
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
206
|
-
const [isOpen, setIsOpen] = useState(
|
|
207
|
-
isSidebarSheetLayout ? false : defaultOpen,
|
|
208
|
-
);
|
|
209
|
-
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
210
|
-
const shellWidthRef = useRef(0);
|
|
211
|
-
const prevShellWidthRef = useRef(0);
|
|
212
|
-
const [shellEl, setShellEl] = useState<HTMLDivElement | null>(null);
|
|
213
|
-
const [chatPanelContainer, setChatPanelContainer] =
|
|
214
|
-
useState<HTMLDivElement | null>(null);
|
|
215
|
-
const onChatPanelMount = useCallback((node: HTMLDivElement | null) => {
|
|
216
|
-
setChatPanelContainer(node);
|
|
217
|
-
}, []);
|
|
218
|
-
|
|
219
|
-
const [sidebarWidthPx, _setSidebarWidthPx] = useState(() =>
|
|
220
|
-
readInitialSidebarWidthPx(sidebarLsKey),
|
|
221
|
-
);
|
|
222
|
-
const [chatWidthPx, _setChatWidthPx] = useState(readInitialChatWidthPx);
|
|
223
|
-
const [chatPanelOpen, _setChatPanelOpen] = useState(false);
|
|
224
|
-
const sidebarWidthRef = useRef(sidebarWidthPx);
|
|
225
|
-
const chatWidthRef = useRef(chatWidthPx);
|
|
226
|
-
const isOpenRef = useRef(isOpen);
|
|
227
|
-
const chatPanelOpenRef = useRef(chatPanelOpen);
|
|
228
|
-
/** Left nav was auto-closed because chat opened on a narrow shell; reopen when chat closes. */
|
|
229
|
-
const sidebarAutoClosedForChatRef = useRef(false);
|
|
230
|
-
sidebarWidthRef.current = sidebarWidthPx;
|
|
231
|
-
chatWidthRef.current = chatWidthPx;
|
|
232
|
-
isOpenRef.current = isOpen;
|
|
233
|
-
chatPanelOpenRef.current = chatPanelOpen;
|
|
234
|
-
|
|
235
|
-
const mergeWrapperRef = useCallback((el: HTMLDivElement | null) => {
|
|
236
|
-
wrapperRef.current = el;
|
|
237
|
-
setShellEl(el);
|
|
238
|
-
}, []);
|
|
239
|
-
|
|
240
|
-
const getShellWidth = useCallback((): number => {
|
|
241
|
-
const w = shellWidthRef.current;
|
|
242
|
-
if (w > 0) return w;
|
|
243
|
-
if (wrapperRef.current) {
|
|
244
|
-
const cw = wrapperRef.current.getBoundingClientRect().width;
|
|
245
|
-
if (cw > 0) return cw;
|
|
246
|
-
}
|
|
247
|
-
return typeof window !== 'undefined' ? window.innerWidth : 1200;
|
|
248
|
-
}, []);
|
|
249
|
-
|
|
250
|
-
const getChatPanelOpen = useCallback(
|
|
251
|
-
(): boolean => chatPanelOpenRef.current,
|
|
252
|
-
[],
|
|
253
|
-
);
|
|
254
|
-
|
|
255
|
-
const setSidebarWidthPx = useCallback(
|
|
256
|
-
(px: number, options?: SetPanelWidthOptions) => {
|
|
257
|
-
const persist = options?.persist !== false;
|
|
258
|
-
const shellW = getShellWidth();
|
|
259
|
-
const next = clampSidebarWidthPx(px, shellW, {
|
|
260
|
-
chatPanelOpen: chatPanelOpenRef.current,
|
|
261
|
-
chatWidthPx: chatWidthRef.current,
|
|
262
|
-
});
|
|
263
|
-
sidebarWidthRef.current = next;
|
|
264
|
-
|
|
265
|
-
// Live drag: update CSS var only — avoid re-rendering the whole nav tree each frame.
|
|
266
|
-
if (wrapperRef.current) {
|
|
267
|
-
wrapperRef.current.style.setProperty('--sidebar-width', `${next}px`);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (!persist) return;
|
|
271
|
-
|
|
272
|
-
_setSidebarWidthPx(next);
|
|
273
|
-
if (allowPersistSidebarWidth) {
|
|
274
|
-
LS.set(sidebarLsKey, next);
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
[getShellWidth, sidebarLsKey, allowPersistSidebarWidth],
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
const setChatWidthPx = useCallback(
|
|
281
|
-
(px: number, options?: SetPanelWidthOptions) => {
|
|
282
|
-
const persist = options?.persist !== false;
|
|
283
|
-
const shellW = getShellWidth();
|
|
284
|
-
const effectiveSidebarW = isOpenRef.current ? sidebarWidthRef.current : 0;
|
|
285
|
-
const next = clampChatWidthPx(px, shellW, effectiveSidebarW);
|
|
286
|
-
_setChatWidthPx(next);
|
|
287
|
-
if (persist && getCookiePreferences(userId)?.functional) {
|
|
288
|
-
LS.set(CHAT_WIDTH_STORAGE_KEY, next);
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
[getShellWidth, userId],
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
const handleShellResize = useCallback(
|
|
295
|
-
(shellW: number) => {
|
|
296
|
-
shellWidthRef.current = shellW;
|
|
297
|
-
const prev = prevShellWidthRef.current;
|
|
298
|
-
if (prev > 0 && shellW > 0) {
|
|
299
|
-
const s = sidebarWidthRef.current;
|
|
300
|
-
const c = chatWidthRef.current;
|
|
301
|
-
const sScaled = Math.round((s * shellW) / prev);
|
|
302
|
-
const cScaled = Math.round((c * shellW) / prev);
|
|
303
|
-
const effS = (navOpen: boolean, sidebarPx: number) =>
|
|
304
|
-
navOpen ? sidebarPx : 0;
|
|
305
|
-
let cNext = clampChatWidthPx(
|
|
306
|
-
cScaled,
|
|
307
|
-
shellW,
|
|
308
|
-
effS(isOpenRef.current, sScaled),
|
|
309
|
-
);
|
|
310
|
-
let sNext = clampSidebarWidthPx(sScaled, shellW, {
|
|
311
|
-
chatPanelOpen: chatPanelOpenRef.current,
|
|
312
|
-
chatWidthPx: cNext,
|
|
313
|
-
});
|
|
314
|
-
cNext = clampChatWidthPx(
|
|
315
|
-
cScaled,
|
|
316
|
-
shellW,
|
|
317
|
-
effS(isOpenRef.current, sNext),
|
|
318
|
-
);
|
|
319
|
-
sNext = clampSidebarWidthPx(sScaled, shellW, {
|
|
320
|
-
chatPanelOpen: chatPanelOpenRef.current,
|
|
321
|
-
chatWidthPx: cNext,
|
|
322
|
-
});
|
|
323
|
-
_setSidebarWidthPx(sNext);
|
|
324
|
-
_setChatWidthPx(cNext);
|
|
325
|
-
if (allowPersistSidebarWidth) {
|
|
326
|
-
LS.set(sidebarLsKey, sNext);
|
|
327
|
-
}
|
|
328
|
-
if (getCookiePreferences(userId)?.functional) {
|
|
329
|
-
LS.set(CHAT_WIDTH_STORAGE_KEY, cNext);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
prevShellWidthRef.current = shellW;
|
|
333
|
-
},
|
|
334
|
-
[userId, sidebarLsKey, allowPersistSidebarWidth],
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
const fitPanelWidthsToShell = useCallback(() => {
|
|
338
|
-
const shellW = getShellWidth();
|
|
339
|
-
if (shellW <= 0) return;
|
|
340
|
-
const s = sidebarWidthRef.current;
|
|
341
|
-
const c = chatWidthRef.current;
|
|
342
|
-
const effS = isOpenRef.current ? s : 0;
|
|
343
|
-
let cNext = clampChatWidthPx(c, shellW, effS);
|
|
344
|
-
let sNext = clampSidebarWidthPx(s, shellW, {
|
|
345
|
-
chatPanelOpen: chatPanelOpenRef.current,
|
|
346
|
-
chatWidthPx: cNext,
|
|
347
|
-
});
|
|
348
|
-
cNext = clampChatWidthPx(c, shellW, isOpenRef.current ? sNext : 0);
|
|
349
|
-
sNext = clampSidebarWidthPx(s, shellW, {
|
|
350
|
-
chatPanelOpen: chatPanelOpenRef.current,
|
|
351
|
-
chatWidthPx: cNext,
|
|
352
|
-
});
|
|
353
|
-
if (sNext !== s || cNext !== c) {
|
|
354
|
-
_setSidebarWidthPx(sNext);
|
|
355
|
-
_setChatWidthPx(cNext);
|
|
356
|
-
if (allowPersistSidebarWidth) {
|
|
357
|
-
LS.set(sidebarLsKey, sNext);
|
|
358
|
-
}
|
|
359
|
-
if (getCookiePreferences(userId)?.functional) {
|
|
360
|
-
LS.set(CHAT_WIDTH_STORAGE_KEY, cNext);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}, [getShellWidth, userId, sidebarLsKey, allowPersistSidebarWidth]);
|
|
364
|
-
|
|
365
|
-
useLayoutEffect(() => {
|
|
366
|
-
if (!shellEl || isSidebarSheetLayout) return;
|
|
367
|
-
fitPanelWidthsToShell();
|
|
368
|
-
}, [
|
|
369
|
-
shellEl,
|
|
370
|
-
chatPanelOpen,
|
|
371
|
-
isSidebarSheetLayout,
|
|
372
|
-
isOpen,
|
|
373
|
-
fitPanelWidthsToShell,
|
|
374
|
-
]);
|
|
375
|
-
|
|
376
|
-
useShellWidthObserver(shellEl, handleShellResize);
|
|
377
|
-
|
|
378
|
-
const closeOppositeSidebarIfNoSpace = useCallback(
|
|
379
|
-
(openingMain: boolean, openingChat: boolean) => {
|
|
380
|
-
if (isSidebarSheetLayout) return;
|
|
381
|
-
const shellW = getShellWidth();
|
|
382
|
-
const layoutAfterOpen = {
|
|
383
|
-
mainSidebarOpen: openingMain || isOpenRef.current,
|
|
384
|
-
chatPanelOpen: openingChat || chatPanelOpenRef.current,
|
|
385
|
-
sidebarWidthPx: sidebarWidthRef.current,
|
|
386
|
-
chatWidthPx: chatWidthRef.current,
|
|
387
|
-
};
|
|
388
|
-
if (shellFitsSidebarsLayout(shellW, layoutAfterOpen)) return;
|
|
389
|
-
if (openingMain && chatPanelOpenRef.current) {
|
|
390
|
-
_setChatPanelOpen(false);
|
|
391
|
-
if (typeof window !== 'undefined') {
|
|
392
|
-
window.dispatchEvent(new CustomEvent(DISMISS_CHAT_FOR_LAYOUT_EVENT));
|
|
393
|
-
}
|
|
394
|
-
} else if (openingChat && isOpenRef.current) {
|
|
395
|
-
sidebarAutoClosedForChatRef.current = true;
|
|
396
|
-
setIsOpen(false);
|
|
397
|
-
}
|
|
398
|
-
},
|
|
399
|
-
[isSidebarSheetLayout, getShellWidth],
|
|
400
|
-
);
|
|
401
|
-
|
|
402
|
-
const setChatPanelOpen = useCallback(
|
|
403
|
-
(open: boolean) => {
|
|
404
|
-
if (open) {
|
|
405
|
-
closeOppositeSidebarIfNoSpace(false, true);
|
|
406
|
-
const shellW = getShellWidth();
|
|
407
|
-
if (shellW > 0 && !isSidebarSheetLayout) {
|
|
408
|
-
const navOpenAfter =
|
|
409
|
-
isOpenRef.current && !sidebarAutoClosedForChatRef.current;
|
|
410
|
-
const effNav = navOpenAfter ? sidebarWidthRef.current : 0;
|
|
411
|
-
const cNext = clampChatWidthPx(chatWidthRef.current, shellW, effNav);
|
|
412
|
-
if (cNext !== chatWidthRef.current) {
|
|
413
|
-
_setChatWidthPx(cNext);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
_setChatPanelOpen(true);
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
_setChatPanelOpen(false);
|
|
420
|
-
if (sidebarAutoClosedForChatRef.current) {
|
|
421
|
-
sidebarAutoClosedForChatRef.current = false;
|
|
422
|
-
setIsOpen(true);
|
|
423
|
-
if (getCookiePreferences(userId)?.functional) {
|
|
424
|
-
setCookie('isSidebarOpen', 'true', 60 * 60 * 24 * 7);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
[
|
|
429
|
-
closeOppositeSidebarIfNoSpace,
|
|
430
|
-
getShellWidth,
|
|
431
|
-
isSidebarSheetLayout,
|
|
432
|
-
userId,
|
|
433
|
-
],
|
|
434
|
-
);
|
|
435
|
-
|
|
436
|
-
const setOpen = useCallback(
|
|
437
|
-
(value: boolean, options?: SetSidebarOpenOptions) => {
|
|
438
|
-
const layoutAutoClose = options?.layoutAutoClose === true;
|
|
439
|
-
|
|
440
|
-
if (value) {
|
|
441
|
-
sidebarAutoClosedForChatRef.current = false;
|
|
442
|
-
closeOppositeSidebarIfNoSpace(true, false);
|
|
443
|
-
} else if (layoutAutoClose) {
|
|
444
|
-
sidebarAutoClosedForChatRef.current = true;
|
|
445
|
-
} else {
|
|
446
|
-
sidebarAutoClosedForChatRef.current = false;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
const useViewTransition =
|
|
450
|
-
options?.viewTransition !== false &&
|
|
451
|
-
!isSidebarSheetLayout &&
|
|
452
|
-
'startViewTransition' in document &&
|
|
453
|
-
document.startViewTransition;
|
|
454
|
-
|
|
455
|
-
if (useViewTransition) {
|
|
456
|
-
document.startViewTransition(() => {
|
|
457
|
-
setIsOpen(value);
|
|
458
|
-
});
|
|
459
|
-
} else {
|
|
460
|
-
setIsOpen(value);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
if (!layoutAutoClose && getCookiePreferences(userId)?.functional) {
|
|
464
|
-
setCookie('isSidebarOpen', value.toString(), 60 * 60 * 24 * 7);
|
|
465
|
-
}
|
|
466
|
-
},
|
|
467
|
-
[isSidebarSheetLayout, userId, closeOppositeSidebarIfNoSpace],
|
|
468
|
-
);
|
|
469
|
-
|
|
470
|
-
const toggleSidebar = useCallback(
|
|
471
|
-
() => setOpen(!isOpenRef.current),
|
|
472
|
-
[setOpen],
|
|
473
|
-
);
|
|
474
|
-
|
|
475
|
-
useEffect(() => {
|
|
476
|
-
const shell = wrapperRef.current;
|
|
477
|
-
if (!shell) return;
|
|
478
|
-
if (chatPanelOpen) {
|
|
479
|
-
shell.setAttribute('data-chat-open', '');
|
|
480
|
-
if (isSidebarSheetLayout) {
|
|
481
|
-
shell.style.setProperty('--chat-panel-width', '100%');
|
|
482
|
-
shell.style.setProperty('--chat-panel-height', '100dvh');
|
|
483
|
-
} else {
|
|
484
|
-
shell.style.setProperty('--chat-panel-width', `${chatWidthPx}px`);
|
|
485
|
-
shell.style.removeProperty('--chat-panel-height');
|
|
486
|
-
}
|
|
487
|
-
} else {
|
|
488
|
-
shell.removeAttribute('data-chat-open');
|
|
489
|
-
shell.style.setProperty('--chat-panel-width', '0px');
|
|
490
|
-
shell.style.removeProperty('--chat-panel-height');
|
|
491
|
-
}
|
|
492
|
-
}, [chatPanelOpen, isSidebarSheetLayout, chatWidthPx]);
|
|
493
|
-
|
|
494
|
-
useEffect(() => {
|
|
495
|
-
return () => {
|
|
496
|
-
const shell = wrapperRef.current;
|
|
497
|
-
if (!shell) return;
|
|
498
|
-
shell.removeAttribute('data-chat-open');
|
|
499
|
-
shell.style.setProperty('--chat-panel-width', '0px');
|
|
500
|
-
shell.style.removeProperty('--chat-panel-height');
|
|
501
|
-
};
|
|
502
|
-
}, []);
|
|
503
|
-
|
|
504
|
-
useEvent({
|
|
505
|
-
event: 'keydown',
|
|
506
|
-
callback: (e: KeyboardEvent) => {
|
|
507
|
-
const isToggleShortcut =
|
|
508
|
-
(e.key === SIDEBAR_KEYBOARD_SHORTCUT && (e.metaKey || e.ctrlKey)) ||
|
|
509
|
-
(e.key === '/' && !isEditableKeyboardTarget(document.activeElement));
|
|
510
|
-
|
|
511
|
-
if (isToggleShortcut) {
|
|
512
|
-
e.preventDefault();
|
|
513
|
-
toggleSidebar();
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
const sidebarActionsValue = useMemo<SidebarActionsContextProps>(
|
|
519
|
-
() => ({
|
|
520
|
-
setOpen,
|
|
521
|
-
toggleSidebar,
|
|
522
|
-
setSidebarWidthPx,
|
|
523
|
-
setChatWidthPx,
|
|
524
|
-
setChatPanelOpen,
|
|
525
|
-
getShellWidth,
|
|
526
|
-
getChatPanelOpen,
|
|
527
|
-
}),
|
|
528
|
-
[
|
|
529
|
-
setOpen,
|
|
530
|
-
toggleSidebar,
|
|
531
|
-
setSidebarWidthPx,
|
|
532
|
-
setChatWidthPx,
|
|
533
|
-
setChatPanelOpen,
|
|
534
|
-
getShellWidth,
|
|
535
|
-
getChatPanelOpen,
|
|
536
|
-
],
|
|
537
|
-
);
|
|
538
|
-
|
|
539
|
-
const sidebarStateValue = useMemo<SidebarStateContextProps>(
|
|
540
|
-
() => ({
|
|
541
|
-
isOpen,
|
|
542
|
-
sidebarWidthPx,
|
|
543
|
-
chatWidthPx,
|
|
544
|
-
chatPanelOpen,
|
|
545
|
-
chatPanelContainer,
|
|
546
|
-
sidebarWrapperRef: wrapperRef,
|
|
547
|
-
}),
|
|
548
|
-
[isOpen, sidebarWidthPx, chatWidthPx, chatPanelOpen, chatPanelContainer],
|
|
549
|
-
);
|
|
550
|
-
|
|
551
|
-
return (
|
|
552
|
-
<SidebarActionsContext.Provider value={sidebarActionsValue}>
|
|
553
|
-
<SidebarStateContext.Provider value={sidebarStateValue}>
|
|
554
|
-
<TooltipProvider delayDuration={0}>
|
|
555
|
-
<div
|
|
556
|
-
ref={mergeWrapperRef}
|
|
557
|
-
data-slot="sidebar-wrapper"
|
|
558
|
-
data-state={isOpen ? 'expanded' : 'collapsed'}
|
|
559
|
-
style={
|
|
560
|
-
{
|
|
561
|
-
'--sidebar-width': `${sidebarWidthPx}px`,
|
|
562
|
-
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
563
|
-
...style,
|
|
564
|
-
} as CSSProperties
|
|
565
|
-
}
|
|
566
|
-
className={cn(S.sidebarWrapper, className)}
|
|
567
|
-
{...props}
|
|
568
|
-
>
|
|
569
|
-
<div
|
|
570
|
-
className={S.sidebarMainShell}
|
|
571
|
-
// style={{ viewTransitionName: 'sidebar-gap' }}
|
|
572
|
-
>
|
|
573
|
-
{children}
|
|
574
|
-
</div>
|
|
575
|
-
<div
|
|
576
|
-
ref={onChatPanelMount}
|
|
577
|
-
className={S.chatPanelMount}
|
|
578
|
-
data-slot="chat-panel-mount"
|
|
579
|
-
// style={{ viewTransitionName: 'sidebar-container' }}
|
|
580
|
-
/>
|
|
581
|
-
</div>
|
|
582
|
-
</TooltipProvider>
|
|
583
|
-
</SidebarStateContext.Provider>
|
|
584
|
-
</SidebarActionsContext.Provider>
|
|
585
|
-
);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
function Sidebar({
|
|
589
|
-
defaultOpen = true,
|
|
590
|
-
open: openProp,
|
|
591
|
-
onOpenChange: setOpenProp,
|
|
592
|
-
className,
|
|
593
|
-
side = 'left',
|
|
594
|
-
variant = 'sidebar',
|
|
595
|
-
collapsible = 'offcanvas',
|
|
596
|
-
children,
|
|
597
|
-
fullHeightResizer = false,
|
|
598
|
-
brandText = 'Sybilion',
|
|
599
|
-
...props
|
|
600
|
-
}: SidebarProps) {
|
|
601
|
-
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
602
|
-
const { isOpen } = useSidebarState();
|
|
603
|
-
const { setOpen } = useSidebarActions();
|
|
604
|
-
|
|
605
|
-
const prevSheetLayoutRef = useRef(isSidebarSheetLayout);
|
|
606
|
-
|
|
607
|
-
/** Narrow shell: sidebar is a sheet; collapse only when crossing into this mode. */
|
|
608
|
-
useEffect(() => {
|
|
609
|
-
const enteredSheetLayout =
|
|
610
|
-
isSidebarSheetLayout && !prevSheetLayoutRef.current;
|
|
611
|
-
prevSheetLayoutRef.current = isSidebarSheetLayout;
|
|
612
|
-
if (enteredSheetLayout) setOpen(false);
|
|
613
|
-
}, [isSidebarSheetLayout, setOpen]);
|
|
614
|
-
|
|
615
|
-
if (collapsible === 'none') {
|
|
616
|
-
return (
|
|
617
|
-
<div
|
|
618
|
-
data-slot="sidebar"
|
|
619
|
-
className={cn(S.sidebarNone, className)}
|
|
620
|
-
{...props}
|
|
621
|
-
>
|
|
622
|
-
{children}
|
|
623
|
-
</div>
|
|
624
|
-
);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
if (isSidebarSheetLayout) {
|
|
628
|
-
return (
|
|
629
|
-
<Sheet open={isOpen} onOpenChange={setOpen} {...props}>
|
|
630
|
-
<SheetContent
|
|
631
|
-
data-sidebar="sidebar"
|
|
632
|
-
data-slot="sidebar"
|
|
633
|
-
className={cn(S.sheetContentSidebar, className)}
|
|
634
|
-
style={
|
|
635
|
-
{
|
|
636
|
-
'--gap-top': '40px',
|
|
637
|
-
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
638
|
-
} as CSSProperties
|
|
639
|
-
}
|
|
640
|
-
side={side}
|
|
641
|
-
>
|
|
642
|
-
<div className={cn(S.sheetSidebarInner)}>
|
|
643
|
-
<div className={S.sheetSidebarLogo}>
|
|
644
|
-
<Logo size="md" brandText={brandText} />
|
|
645
|
-
</div>
|
|
646
|
-
{children}
|
|
647
|
-
</div>
|
|
648
|
-
</SheetContent>
|
|
649
|
-
</Sheet>
|
|
650
|
-
);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
return (
|
|
654
|
-
<aside
|
|
655
|
-
className={cn(
|
|
656
|
-
S.sidebar,
|
|
657
|
-
S[`variant-${variant}`],
|
|
658
|
-
className,
|
|
659
|
-
fullHeightResizer && S.fullHeightResizer,
|
|
660
|
-
)}
|
|
661
|
-
data-state={isOpen ? 'expanded' : 'collapsed'}
|
|
662
|
-
data-collapsible={!isOpen ? collapsible : ''}
|
|
663
|
-
data-variant={variant}
|
|
664
|
-
data-side={side}
|
|
665
|
-
{...props}
|
|
666
|
-
>
|
|
667
|
-
{children}
|
|
668
|
-
<SidebarResizeHandle side={side} />
|
|
669
|
-
</aside>
|
|
670
|
-
);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
function SidebarTrigger({
|
|
674
|
-
className,
|
|
675
|
-
onClick,
|
|
676
|
-
...props
|
|
677
|
-
}: ComponentProps<typeof Button>) {
|
|
678
|
-
const { toggleSidebar } = useSidebarActions();
|
|
679
|
-
|
|
680
|
-
return (
|
|
681
|
-
<Button
|
|
682
|
-
data-sidebar="trigger"
|
|
683
|
-
data-slot="sidebar-trigger"
|
|
684
|
-
variant="ghost"
|
|
685
|
-
icon
|
|
686
|
-
className={cn(S.sidebarTrigger, className)}
|
|
687
|
-
onClick={event => {
|
|
688
|
-
onClick?.(event);
|
|
689
|
-
toggleSidebar();
|
|
690
|
-
}}
|
|
691
|
-
{...props}
|
|
692
|
-
>
|
|
693
|
-
<PanelLeft size={20} strokeWidth={1.5} className="text-foreground" />
|
|
694
|
-
{/* <span className="sr-only">Toggle Sidebar</span> */}
|
|
695
|
-
</Button>
|
|
696
|
-
);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
function SidebarRail({ className, ...props }: ComponentProps<'button'>) {
|
|
700
|
-
const { toggleSidebar } = useSidebarActions();
|
|
701
|
-
|
|
702
|
-
return (
|
|
703
|
-
<button
|
|
704
|
-
data-sidebar="rail"
|
|
705
|
-
data-slot="sidebar-rail"
|
|
706
|
-
aria-label="Toggle Sidebar"
|
|
707
|
-
tabIndex={-1}
|
|
708
|
-
onClick={toggleSidebar}
|
|
709
|
-
title="Toggle Sidebar"
|
|
710
|
-
className={cn(S.sidebarRail, className)}
|
|
711
|
-
{...props}
|
|
712
|
-
/>
|
|
713
|
-
);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
function PanelResizeHandle({
|
|
717
|
-
className,
|
|
718
|
-
edge,
|
|
719
|
-
isActive,
|
|
720
|
-
startWidthPx,
|
|
721
|
-
getShellWidth,
|
|
722
|
-
onDragWidth,
|
|
723
|
-
onDragComplete,
|
|
724
|
-
...props
|
|
725
|
-
}: ComponentProps<'div'> & {
|
|
726
|
-
edge: 'leading' | 'trailing';
|
|
727
|
-
isActive: boolean;
|
|
728
|
-
startWidthPx: number;
|
|
729
|
-
getShellWidth: () => number;
|
|
730
|
-
onDragWidth: (rawPx: number) => void;
|
|
731
|
-
onDragComplete?: (finalRawPx: number) => void;
|
|
732
|
-
}) {
|
|
733
|
-
const handleRef = useRef<HTMLDivElement>(null);
|
|
734
|
-
const startWidthRef = useRef(0);
|
|
735
|
-
const lastRawRef = useRef(0);
|
|
736
|
-
|
|
737
|
-
const handleDrag = useCallback(
|
|
738
|
-
(delta: Delta) => {
|
|
739
|
-
notifyPanelWidthDragStart();
|
|
740
|
-
const shellW = getShellWidth();
|
|
741
|
-
if (shellW <= 0) return;
|
|
742
|
-
const raw =
|
|
743
|
-
edge === 'trailing'
|
|
744
|
-
? startWidthRef.current + delta.x
|
|
745
|
-
: startWidthRef.current - delta.x;
|
|
746
|
-
lastRawRef.current = raw;
|
|
747
|
-
onDragWidth(raw);
|
|
748
|
-
},
|
|
749
|
-
[edge, getShellWidth, onDragWidth],
|
|
750
|
-
);
|
|
751
|
-
|
|
752
|
-
const handleDragStart = useCallback(
|
|
753
|
-
(e: PointerEvent) => {
|
|
754
|
-
startWidthRef.current = startWidthPx;
|
|
755
|
-
lastRawRef.current = startWidthPx;
|
|
756
|
-
handleRef.current?.setPointerCapture(e.pointerId);
|
|
757
|
-
},
|
|
758
|
-
[startWidthPx],
|
|
759
|
-
);
|
|
760
|
-
|
|
761
|
-
const handleDragEnd = useCallback(
|
|
762
|
-
(e: PointerEvent) => {
|
|
763
|
-
onDragComplete?.(lastRawRef.current);
|
|
764
|
-
notifyPanelWidthDragEnd();
|
|
765
|
-
try {
|
|
766
|
-
handleRef.current?.releasePointerCapture(e.pointerId);
|
|
767
|
-
} catch {
|
|
768
|
-
// Capture already released
|
|
769
|
-
}
|
|
770
|
-
startWidthRef.current = 0;
|
|
771
|
-
},
|
|
772
|
-
[onDragComplete],
|
|
773
|
-
);
|
|
774
|
-
|
|
775
|
-
useElemDrag({
|
|
776
|
-
elem: handleRef,
|
|
777
|
-
onDrag: handleDrag,
|
|
778
|
-
onDragStart: handleDragStart,
|
|
779
|
-
onDragEnd: handleDragEnd,
|
|
780
|
-
isActive,
|
|
781
|
-
});
|
|
782
|
-
|
|
783
|
-
if (!isActive) {
|
|
784
|
-
return null;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
return (
|
|
788
|
-
<div
|
|
789
|
-
ref={handleRef}
|
|
790
|
-
data-slot="panel-resize-handle"
|
|
791
|
-
data-edge={edge}
|
|
792
|
-
className={className}
|
|
793
|
-
{...props}
|
|
794
|
-
/>
|
|
795
|
-
);
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
function SidebarResizeHandle({
|
|
799
|
-
className,
|
|
800
|
-
side = 'left',
|
|
801
|
-
...props
|
|
802
|
-
}: ComponentProps<'div'> & { side?: 'left' | 'right' }) {
|
|
803
|
-
const { isOpen, sidebarWidthPx } = useSidebarState();
|
|
804
|
-
const { setSidebarWidthPx, getShellWidth } = useSidebarActions();
|
|
805
|
-
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
806
|
-
|
|
807
|
-
const edge: 'leading' | 'trailing' = side === 'left' ? 'trailing' : 'leading';
|
|
808
|
-
|
|
809
|
-
const onDragWidth = useCallback(
|
|
810
|
-
(rawPx: number) => {
|
|
811
|
-
setSidebarWidthPx(rawPx, { persist: false });
|
|
812
|
-
},
|
|
813
|
-
[setSidebarWidthPx],
|
|
814
|
-
);
|
|
815
|
-
|
|
816
|
-
const onDragComplete = useCallback(
|
|
817
|
-
(finalRawPx: number) => {
|
|
818
|
-
setSidebarWidthPx(finalRawPx, { persist: true });
|
|
819
|
-
},
|
|
820
|
-
[setSidebarWidthPx],
|
|
821
|
-
);
|
|
822
|
-
|
|
823
|
-
if (isSidebarSheetLayout || !isOpen) {
|
|
824
|
-
return null;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
return (
|
|
828
|
-
<PanelResizeHandle
|
|
829
|
-
edge={edge}
|
|
830
|
-
isActive={isOpen && !isSidebarSheetLayout}
|
|
831
|
-
startWidthPx={sidebarWidthPx}
|
|
832
|
-
getShellWidth={getShellWidth}
|
|
833
|
-
onDragWidth={onDragWidth}
|
|
834
|
-
onDragComplete={onDragComplete}
|
|
835
|
-
data-sidebar="resize-handle"
|
|
836
|
-
data-slot="sidebar-resize-handle"
|
|
837
|
-
data-side={side}
|
|
838
|
-
className={cn(S.sidebarResizeHandle, className)}
|
|
839
|
-
{...props}
|
|
840
|
-
/>
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
function SidebarFooter({ className, ...props }: ComponentProps<'div'>) {
|
|
845
|
-
return (
|
|
846
|
-
<div
|
|
847
|
-
data-slot="sidebar-footer"
|
|
848
|
-
data-sidebar="footer"
|
|
849
|
-
className={cn(S.sidebarFooter, className)}
|
|
850
|
-
{...props}
|
|
851
|
-
/>
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
function SidebarSeparator({
|
|
856
|
-
className,
|
|
857
|
-
...props
|
|
858
|
-
}: ComponentProps<typeof Separator>) {
|
|
859
|
-
return (
|
|
860
|
-
<Separator
|
|
861
|
-
data-slot="sidebar-separator"
|
|
862
|
-
data-sidebar="separator"
|
|
863
|
-
className={cn(S.sidebarSeparator, className)}
|
|
864
|
-
{...props}
|
|
865
|
-
/>
|
|
866
|
-
);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
function SidebarContent({
|
|
870
|
-
className,
|
|
871
|
-
innerClassName,
|
|
872
|
-
children,
|
|
873
|
-
}: ComponentProps<typeof Scroll>) {
|
|
874
|
-
// const sidebarContentTransition = useViewTransition({
|
|
875
|
-
// transitionName: 'sidebar-content',
|
|
876
|
-
// });
|
|
877
|
-
|
|
878
|
-
return (
|
|
879
|
-
<Scroll
|
|
880
|
-
y
|
|
881
|
-
autoHide
|
|
882
|
-
fadeSize="l"
|
|
883
|
-
offset={{ y: { before: 40, after: 20 } }}
|
|
884
|
-
className={cn(S.sidebarContent, className)}
|
|
885
|
-
innerClassName={innerClassName}
|
|
886
|
-
>
|
|
887
|
-
{children}
|
|
888
|
-
</Scroll>
|
|
889
|
-
);
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
function SidebarGroup({ className, ...props }: ComponentProps<'div'>) {
|
|
893
|
-
return (
|
|
894
|
-
<div
|
|
895
|
-
data-slot="sidebar-group"
|
|
896
|
-
data-sidebar="group"
|
|
897
|
-
className={cn(S.sidebarGroup, className)}
|
|
898
|
-
{...props}
|
|
899
|
-
/>
|
|
900
|
-
);
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
function SidebarGroupAction({
|
|
904
|
-
className,
|
|
905
|
-
asChild = false,
|
|
906
|
-
...props
|
|
907
|
-
}: ComponentProps<'button'> & { asChild?: boolean }) {
|
|
908
|
-
const Comp = asChild ? Slot : 'button';
|
|
909
|
-
|
|
910
|
-
return (
|
|
911
|
-
<Comp
|
|
912
|
-
data-slot="sidebar-group-action"
|
|
913
|
-
data-sidebar="group-action"
|
|
914
|
-
className={cn(S.sidebarGroupAction, className)}
|
|
915
|
-
{...props}
|
|
916
|
-
/>
|
|
917
|
-
);
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
function SidebarMenu({ className, ...props }: ComponentProps<'ul'>) {
|
|
921
|
-
return (
|
|
922
|
-
<ul
|
|
923
|
-
data-slot="sidebar-menu"
|
|
924
|
-
data-sidebar="menu"
|
|
925
|
-
className={cn(S.sidebarMenu, className)}
|
|
926
|
-
{...props}
|
|
927
|
-
/>
|
|
928
|
-
);
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
function SidebarMenuItem({ className, ...props }: ComponentProps<'li'>) {
|
|
932
|
-
return (
|
|
933
|
-
<li
|
|
934
|
-
data-slot="sidebar-menu-item"
|
|
935
|
-
data-sidebar="menu-item"
|
|
936
|
-
className={cn(S.sidebarMenuItem, className)}
|
|
937
|
-
{...props}
|
|
938
|
-
/>
|
|
939
|
-
);
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
function SidebarMenuButton({
|
|
943
|
-
asChild = false,
|
|
944
|
-
isActive = false,
|
|
945
|
-
hasSubItems = false,
|
|
946
|
-
isExpanded = false,
|
|
947
|
-
variant = 'ghost',
|
|
948
|
-
size = 'sm',
|
|
949
|
-
className,
|
|
950
|
-
icon,
|
|
951
|
-
children,
|
|
952
|
-
addon,
|
|
953
|
-
...props
|
|
954
|
-
}: Omit<ButtonProps, 'icon'> & {
|
|
955
|
-
icon?: React.ReactNode;
|
|
956
|
-
addon?: React.ReactNode;
|
|
957
|
-
isActive?: boolean;
|
|
958
|
-
/** When true, renders an expand/collapse chevron (requires a non–asChild button). */
|
|
959
|
-
hasSubItems?: boolean;
|
|
960
|
-
/** Chevron direction when `hasSubItems` is true. */
|
|
961
|
-
isExpanded?: boolean;
|
|
962
|
-
}) {
|
|
963
|
-
const effectiveAsChild = asChild && !hasSubItems;
|
|
964
|
-
|
|
965
|
-
const label = (
|
|
966
|
-
<SmartTextTruncate className={S.sidebarMenuButtonLabel}>
|
|
967
|
-
{children}
|
|
968
|
-
</SmartTextTruncate>
|
|
969
|
-
);
|
|
970
|
-
|
|
971
|
-
const chevron = hasSubItems ? (
|
|
972
|
-
<span
|
|
973
|
-
className={cn(S.sidebarMenuButtonChevron, isExpanded && S.expanded)}
|
|
974
|
-
aria-hidden="true"
|
|
975
|
-
>
|
|
976
|
-
<ChevronRight size={16} />
|
|
977
|
-
</span>
|
|
978
|
-
) : null;
|
|
979
|
-
|
|
980
|
-
const userContent = (
|
|
981
|
-
<>
|
|
982
|
-
{label}
|
|
983
|
-
{addon}
|
|
984
|
-
</>
|
|
985
|
-
);
|
|
986
|
-
|
|
987
|
-
return (
|
|
988
|
-
<Button
|
|
989
|
-
asChild={effectiveAsChild}
|
|
990
|
-
variant={variant}
|
|
991
|
-
size={size}
|
|
992
|
-
data-slot="sidebar-menu-button"
|
|
993
|
-
data-sidebar="menu-button"
|
|
994
|
-
data-active={isActive}
|
|
995
|
-
aria-expanded={hasSubItems ? isExpanded : undefined}
|
|
996
|
-
className={cn(
|
|
997
|
-
variant === 'default' ? S.sidebarMenuButtonCta : S.sidebarMenuButton,
|
|
998
|
-
S[`size-${size}`],
|
|
999
|
-
className,
|
|
1000
|
-
)}
|
|
1001
|
-
{...props}
|
|
1002
|
-
>
|
|
1003
|
-
{icon}
|
|
1004
|
-
{effectiveAsChild ? (
|
|
1005
|
-
userContent
|
|
1006
|
-
) : (
|
|
1007
|
-
<>
|
|
1008
|
-
{userContent}
|
|
1009
|
-
{chevron}
|
|
1010
|
-
</>
|
|
1011
|
-
)}
|
|
1012
|
-
</Button>
|
|
1013
|
-
);
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
function SidebarMenuAction({
|
|
1017
|
-
className,
|
|
1018
|
-
asChild = false,
|
|
1019
|
-
showOnHover = false,
|
|
1020
|
-
...props
|
|
1021
|
-
}: ComponentProps<'button'> & {
|
|
1022
|
-
asChild?: boolean;
|
|
1023
|
-
showOnHover?: boolean;
|
|
1024
|
-
}) {
|
|
1025
|
-
const Comp = asChild ? Slot : 'button';
|
|
1026
|
-
|
|
1027
|
-
return (
|
|
1028
|
-
<Comp
|
|
1029
|
-
data-slot="sidebar-menu-action"
|
|
1030
|
-
data-sidebar="menu-action"
|
|
1031
|
-
className={cn(
|
|
1032
|
-
S.sidebarMenuAction,
|
|
1033
|
-
showOnHover && S.showOnHover,
|
|
1034
|
-
className,
|
|
1035
|
-
)}
|
|
1036
|
-
{...props}
|
|
1037
|
-
/>
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
function SidebarMenuBadge({ className, ...props }: ComponentProps<'div'>) {
|
|
1042
|
-
return (
|
|
1043
|
-
<div
|
|
1044
|
-
data-slot="sidebar-menu-badge"
|
|
1045
|
-
data-sidebar="menu-badge"
|
|
1046
|
-
className={cn(S.sidebarMenuBadge, className)}
|
|
1047
|
-
{...props}
|
|
1048
|
-
/>
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
function SidebarMenuSub({ className, ...props }: ComponentProps<'ul'>) {
|
|
1053
|
-
return (
|
|
1054
|
-
<ul
|
|
1055
|
-
data-slot="sidebar-menu-sub"
|
|
1056
|
-
data-sidebar="menu-sub"
|
|
1057
|
-
className={cn(S.sidebarMenuSub, className)}
|
|
1058
|
-
{...props}
|
|
1059
|
-
/>
|
|
1060
|
-
);
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
function SidebarMenuSubItem({ className, ...props }: ComponentProps<'li'>) {
|
|
1064
|
-
return (
|
|
1065
|
-
<li
|
|
1066
|
-
data-slot="sidebar-menu-sub-item"
|
|
1067
|
-
data-sidebar="menu-sub-item"
|
|
1068
|
-
className={cn(S.sidebarMenuSubItem, className)}
|
|
1069
|
-
{...props}
|
|
1070
|
-
/>
|
|
1071
|
-
);
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
function SidebarMenuSubButton({
|
|
1075
|
-
asChild = false,
|
|
1076
|
-
size = 'md',
|
|
1077
|
-
isActive = false,
|
|
1078
|
-
tooltip,
|
|
1079
|
-
className,
|
|
1080
|
-
onClick,
|
|
1081
|
-
children,
|
|
1082
|
-
addon,
|
|
1083
|
-
...props
|
|
1084
|
-
}: ComponentProps<'a'> & {
|
|
1085
|
-
asChild?: boolean;
|
|
1086
|
-
size?: 'sm' | 'md' | 'lg';
|
|
1087
|
-
isActive?: boolean;
|
|
1088
|
-
tooltip?: string | ComponentProps<typeof TooltipContent>;
|
|
1089
|
-
addon?: React.ReactNode;
|
|
1090
|
-
}) {
|
|
1091
|
-
const Comp = asChild ? Slot : 'a';
|
|
1092
|
-
const { isOpen } = useSidebarState();
|
|
1093
|
-
const { setOpen } = useSidebarActions();
|
|
1094
|
-
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
1095
|
-
|
|
1096
|
-
const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
|
|
1097
|
-
if (isSidebarSheetLayout && isOpen) setOpen(false);
|
|
1098
|
-
onClick?.(event);
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
const button = (
|
|
1102
|
-
<Comp
|
|
1103
|
-
data-slot="sidebar-menu-sub-button"
|
|
1104
|
-
data-sidebar="menu-sub-button"
|
|
1105
|
-
data-size={size}
|
|
1106
|
-
data-active={isActive}
|
|
1107
|
-
className={cn(S.sidebarMenuSubButton, S[`size-${size}`], className)}
|
|
1108
|
-
onClick={handleClick}
|
|
1109
|
-
{...props}
|
|
1110
|
-
>
|
|
1111
|
-
<SmartTextTruncate className={S.sidebarMenuSubButtonLabel}>
|
|
1112
|
-
{children}
|
|
1113
|
-
</SmartTextTruncate>
|
|
1114
|
-
{addon}
|
|
1115
|
-
</Comp>
|
|
1116
|
-
);
|
|
1117
|
-
|
|
1118
|
-
if (!tooltip) return button;
|
|
1119
|
-
|
|
1120
|
-
if (typeof tooltip === 'string') {
|
|
1121
|
-
tooltip = {
|
|
1122
|
-
children: tooltip,
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
return (
|
|
1127
|
-
<Tooltip>
|
|
1128
|
-
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
1129
|
-
<TooltipContent
|
|
1130
|
-
side="right"
|
|
1131
|
-
align="center"
|
|
1132
|
-
hidden={!isOpen || isSidebarSheetLayout}
|
|
1133
|
-
{...tooltip}
|
|
1134
|
-
/>
|
|
1135
|
-
</Tooltip>
|
|
1136
|
-
);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1
|
+
export { DISMISS_CHAT_FOR_LAYOUT_EVENT } from './sidebarConstants';
|
|
2
|
+
export type { SetSidebarOpenOptions } from './Sidebar.types';
|
|
3
|
+
export {
|
|
4
|
+
useSidebar,
|
|
5
|
+
useSidebarActions,
|
|
6
|
+
useSidebarState,
|
|
7
|
+
} from './sidebarContext';
|
|
8
|
+
export { SidebarProvider } from './SidebarProvider/SidebarProvider';
|
|
9
|
+
export { Sidebar } from './SidebarAside';
|
|
10
|
+
export { SidebarTrigger } from './SidebarTrigger/SidebarTrigger';
|
|
11
|
+
export { SidebarRail } from './SidebarRail/SidebarRail';
|
|
12
|
+
export { PanelResizeHandle } from '../PanelResizeHandle/PanelResizeHandle';
|
|
13
|
+
export { SidebarResizeHandle } from './SidebarResizeHandle/SidebarResizeHandle';
|
|
14
|
+
export { SidebarFooter } from './SidebarFooter/SidebarFooter';
|
|
15
|
+
export { SidebarSeparator } from './SidebarSeparator/SidebarSeparator';
|
|
16
|
+
export { SidebarContent } from './SidebarContent/SidebarContent';
|
|
17
|
+
export { SidebarGroup } from './SidebarGroup/SidebarGroup';
|
|
18
|
+
export { SidebarGroupAction } from './SidebarGroupAction/SidebarGroupAction';
|
|
1139
19
|
export {
|
|
1140
|
-
PanelResizeHandle,
|
|
1141
|
-
Sidebar,
|
|
1142
|
-
SidebarContent,
|
|
1143
|
-
SidebarFooter,
|
|
1144
|
-
SidebarGroup,
|
|
1145
|
-
SidebarGroupAction,
|
|
1146
20
|
SidebarMenu,
|
|
1147
|
-
SidebarMenuAction,
|
|
1148
|
-
SidebarMenuBadge,
|
|
1149
|
-
SidebarMenuButton,
|
|
1150
21
|
SidebarMenuItem,
|
|
22
|
+
SidebarMenuBadge,
|
|
23
|
+
} from './SidebarMenu/SidebarMenu';
|
|
24
|
+
export { SidebarMenuButton } from './SidebarMenuButton/SidebarMenuButton';
|
|
25
|
+
export { SidebarMenuAction } from './SidebarMenuAction/SidebarMenuAction';
|
|
26
|
+
export {
|
|
1151
27
|
SidebarMenuSub,
|
|
1152
|
-
SidebarMenuSubButton,
|
|
1153
28
|
SidebarMenuSubItem,
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
SidebarResizeHandle,
|
|
1157
|
-
SidebarSeparator,
|
|
1158
|
-
SidebarTrigger,
|
|
1159
|
-
useSidebar,
|
|
1160
|
-
useSidebarActions,
|
|
1161
|
-
useSidebarState,
|
|
1162
|
-
};
|
|
29
|
+
} from './SidebarMenuSub/SidebarMenuSub';
|
|
30
|
+
export { SidebarMenuSubButton } from './SidebarMenuSubButton/SidebarMenuSubButton';
|