@sybilion/uilib 1.4.14 → 1.4.15
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/DriversComparisonChart/DriversComparisonChart.js +26 -5
- package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +26 -4
- 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/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/DriversComparisonChart/AGENT.md +0 -4
- package/src/components/widgets/PerformanceChart/AGENT.md +0 -4
- 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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This file is automatically generated.
|
|
2
|
+
// Please do not change this file!
|
|
3
|
+
interface CssExports {
|
|
4
|
+
'expanded': string;
|
|
5
|
+
'sidebarMenuButton': string;
|
|
6
|
+
'sidebarMenuButtonChevron': string;
|
|
7
|
+
'sidebarMenuButtonCta': string;
|
|
8
|
+
'sidebarMenuButtonLabel': string;
|
|
9
|
+
'size-lg': string;
|
|
10
|
+
'size-md': string;
|
|
11
|
+
'size-sm': string;
|
|
12
|
+
'variant-outline': string;
|
|
13
|
+
}
|
|
14
|
+
export const cssExports: CssExports;
|
|
15
|
+
export default cssExports;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { Button } from '#uilib/components/ui/Button';
|
|
4
|
+
import type { ButtonProps } from '#uilib/components/ui/Button/Button.types';
|
|
5
|
+
import { SmartTextTruncate } from '#uilib/components/ui/SmartTextTruncate/SmartTextTruncate';
|
|
6
|
+
import { ChevronRight } from 'lucide-react';
|
|
7
|
+
|
|
8
|
+
import S from './SidebarMenuButton.styl';
|
|
9
|
+
|
|
10
|
+
export function SidebarMenuButton({
|
|
11
|
+
asChild = false,
|
|
12
|
+
isActive = false,
|
|
13
|
+
hasSubItems = false,
|
|
14
|
+
isExpanded = false,
|
|
15
|
+
variant = 'ghost',
|
|
16
|
+
size = 'sm',
|
|
17
|
+
className,
|
|
18
|
+
icon,
|
|
19
|
+
children,
|
|
20
|
+
addon,
|
|
21
|
+
...props
|
|
22
|
+
}: Omit<ButtonProps, 'icon'> & {
|
|
23
|
+
icon?: React.ReactNode;
|
|
24
|
+
addon?: React.ReactNode;
|
|
25
|
+
isActive?: boolean;
|
|
26
|
+
/** When true, renders an expand/collapse chevron (requires a non–asChild button). */
|
|
27
|
+
hasSubItems?: boolean;
|
|
28
|
+
/** Chevron direction when `hasSubItems` is true. */
|
|
29
|
+
isExpanded?: boolean;
|
|
30
|
+
}) {
|
|
31
|
+
const effectiveAsChild = asChild && !hasSubItems;
|
|
32
|
+
|
|
33
|
+
const label = (
|
|
34
|
+
<SmartTextTruncate className={S.sidebarMenuButtonLabel}>
|
|
35
|
+
{children}
|
|
36
|
+
</SmartTextTruncate>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const chevron = hasSubItems ? (
|
|
40
|
+
<span
|
|
41
|
+
className={cn(S.sidebarMenuButtonChevron, isExpanded && S.expanded)}
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
>
|
|
44
|
+
<ChevronRight size={16} />
|
|
45
|
+
</span>
|
|
46
|
+
) : null;
|
|
47
|
+
|
|
48
|
+
const userContent = (
|
|
49
|
+
<>
|
|
50
|
+
{label}
|
|
51
|
+
{addon}
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Button
|
|
57
|
+
asChild={effectiveAsChild}
|
|
58
|
+
variant={variant}
|
|
59
|
+
size={size}
|
|
60
|
+
data-slot="sidebar-menu-button"
|
|
61
|
+
data-sidebar="menu-button"
|
|
62
|
+
data-active={isActive}
|
|
63
|
+
aria-expanded={hasSubItems ? isExpanded : undefined}
|
|
64
|
+
className={cn(
|
|
65
|
+
variant === 'default' ? S.sidebarMenuButtonCta : S.sidebarMenuButton,
|
|
66
|
+
S[`size-${size}`],
|
|
67
|
+
className,
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
>
|
|
71
|
+
{icon}
|
|
72
|
+
{effectiveAsChild ? (
|
|
73
|
+
userContent
|
|
74
|
+
) : (
|
|
75
|
+
<>
|
|
76
|
+
{userContent}
|
|
77
|
+
{chevron}
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
80
|
+
</Button>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@import '../../../../lib/theme.styl';
|
|
2
|
+
|
|
3
|
+
.sidebarMenuSub
|
|
4
|
+
position relative
|
|
5
|
+
display flex
|
|
6
|
+
flex-direction column
|
|
7
|
+
gap var(--p-1)
|
|
8
|
+
|
|
9
|
+
min-width 0
|
|
10
|
+
padding 0
|
|
11
|
+
padding-top var(--p-1)
|
|
12
|
+
margin-left 0
|
|
13
|
+
margin-right 0
|
|
14
|
+
list-style none
|
|
15
|
+
|
|
16
|
+
border-color var(--sidebar-border)
|
|
17
|
+
transform translateX(1px)
|
|
18
|
+
border-left none
|
|
19
|
+
|
|
20
|
+
&::before
|
|
21
|
+
content ''
|
|
22
|
+
position absolute
|
|
23
|
+
left var(--p-5)
|
|
24
|
+
top 0
|
|
25
|
+
bottom 0
|
|
26
|
+
width 1px
|
|
27
|
+
background var(--sidebar-border)
|
|
28
|
+
pointer-events none
|
|
29
|
+
|
|
30
|
+
&[data-collapsible="icon"]
|
|
31
|
+
display none
|
|
32
|
+
|
|
33
|
+
.sidebarMenuSubItem
|
|
34
|
+
position relative
|
|
35
|
+
min-width 0
|
|
36
|
+
margin-left var(--p-4)
|
|
37
|
+
|
|
38
|
+
a:hover
|
|
39
|
+
text-decoration: none;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
import S from './SidebarMenuSub.styl';
|
|
5
|
+
|
|
6
|
+
export function SidebarMenuSub({ className, ...props }: ComponentProps<'ul'>) {
|
|
7
|
+
return (
|
|
8
|
+
<ul
|
|
9
|
+
data-slot="sidebar-menu-sub"
|
|
10
|
+
data-sidebar="menu-sub"
|
|
11
|
+
className={cn(S.sidebarMenuSub, className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function SidebarMenuSubItem({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: ComponentProps<'li'>) {
|
|
21
|
+
return (
|
|
22
|
+
<li
|
|
23
|
+
data-slot="sidebar-menu-sub-item"
|
|
24
|
+
data-sidebar="menu-sub-item"
|
|
25
|
+
className={cn(S.sidebarMenuSubItem, className)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@import '../../../../lib/theme.styl';
|
|
2
|
+
|
|
3
|
+
.sidebarMenuSubButton > span
|
|
4
|
+
text-transform capitalize
|
|
5
|
+
min-width 0
|
|
6
|
+
|
|
7
|
+
&:first-child
|
|
8
|
+
flex-grow 1
|
|
9
|
+
|
|
10
|
+
.sidebarMenuSubButton
|
|
11
|
+
display flex
|
|
12
|
+
align-items center
|
|
13
|
+
gap var(--p-1)
|
|
14
|
+
|
|
15
|
+
width calc(100% - var(--p-3))
|
|
16
|
+
height var(--p-9)
|
|
17
|
+
min-width 0
|
|
18
|
+
padding var(--p-2) var(--p-3)
|
|
19
|
+
margin-left var(--p-3)
|
|
20
|
+
|
|
21
|
+
overflow hidden
|
|
22
|
+
transform translateX(-1px)
|
|
23
|
+
border-radius var(--p-3)
|
|
24
|
+
color var(--sidebar-foreground)
|
|
25
|
+
outline none
|
|
26
|
+
cursor pointer
|
|
27
|
+
text-decoration none
|
|
28
|
+
|
|
29
|
+
&:visited
|
|
30
|
+
color var(--sidebar-foreground)
|
|
31
|
+
|
|
32
|
+
&:hover
|
|
33
|
+
text-decoration none
|
|
34
|
+
|
|
35
|
+
[data-slot="sidebar-menu-sub-item"]:hover &, [data-slot="sidebar-menu-sub-item"]:active &
|
|
36
|
+
background-color var(--sidebar-accent)
|
|
37
|
+
color var(--sidebar-accent-foreground)
|
|
38
|
+
|
|
39
|
+
&:focus-visible
|
|
40
|
+
box-shadow 0 0 0 2px var(--sidebar-ring)
|
|
41
|
+
|
|
42
|
+
&:disabled, &[aria-disabled="true"]
|
|
43
|
+
pointer-events none
|
|
44
|
+
opacity 0.5
|
|
45
|
+
|
|
46
|
+
&[data-active="true"]
|
|
47
|
+
background-color var(--sidebar-accent)
|
|
48
|
+
color var(--sidebar-accent-foreground)
|
|
49
|
+
|
|
50
|
+
&:visited
|
|
51
|
+
color var(--sidebar-accent-foreground)
|
|
52
|
+
|
|
53
|
+
&[data-collapsible="icon"]
|
|
54
|
+
display none
|
|
55
|
+
|
|
56
|
+
& > svg
|
|
57
|
+
width 1rem
|
|
58
|
+
height 1rem
|
|
59
|
+
flex-shrink 0
|
|
60
|
+
color var(--sidebar-accent-foreground)
|
|
61
|
+
|
|
62
|
+
&.size-sm
|
|
63
|
+
// size hook for API parity
|
|
64
|
+
&.size-md
|
|
65
|
+
// size hook for API parity
|
|
66
|
+
&.size-lg
|
|
67
|
+
// size hook for API parity
|
|
68
|
+
|
|
69
|
+
.sidebarMenuSubButtonLabel
|
|
70
|
+
flex-grow 1
|
|
71
|
+
min-width 0
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
import { SmartTextTruncate } from '#uilib/components/ui/SmartTextTruncate/SmartTextTruncate';
|
|
5
|
+
import {
|
|
6
|
+
Tooltip,
|
|
7
|
+
TooltipContent,
|
|
8
|
+
TooltipTrigger,
|
|
9
|
+
} from '#uilib/components/ui/Tooltip';
|
|
10
|
+
import { useIsSidebarSheetLayout } from '#uilib/hooks/useIsSidebarSheetLayout';
|
|
11
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
12
|
+
|
|
13
|
+
import S from './SidebarMenuSubButton.styl';
|
|
14
|
+
import { useSidebarActions, useSidebarState } from '../sidebarContext';
|
|
15
|
+
|
|
16
|
+
export function SidebarMenuSubButton({
|
|
17
|
+
asChild = false,
|
|
18
|
+
size = 'md',
|
|
19
|
+
isActive = false,
|
|
20
|
+
tooltip,
|
|
21
|
+
className,
|
|
22
|
+
onClick,
|
|
23
|
+
children,
|
|
24
|
+
addon,
|
|
25
|
+
...props
|
|
26
|
+
}: ComponentProps<'a'> & {
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
size?: 'sm' | 'md' | 'lg';
|
|
29
|
+
isActive?: boolean;
|
|
30
|
+
tooltip?: string | ComponentProps<typeof TooltipContent>;
|
|
31
|
+
addon?: React.ReactNode;
|
|
32
|
+
}) {
|
|
33
|
+
const Comp = asChild ? Slot : 'a';
|
|
34
|
+
const { isOpen } = useSidebarState();
|
|
35
|
+
const { setOpen } = useSidebarActions();
|
|
36
|
+
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
37
|
+
|
|
38
|
+
const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
|
|
39
|
+
if (isSidebarSheetLayout && isOpen) setOpen(false);
|
|
40
|
+
onClick?.(event);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const button = (
|
|
44
|
+
<Comp
|
|
45
|
+
data-slot="sidebar-menu-sub-button"
|
|
46
|
+
data-sidebar="menu-sub-button"
|
|
47
|
+
data-size={size}
|
|
48
|
+
data-active={isActive}
|
|
49
|
+
className={cn(S.sidebarMenuSubButton, S[`size-${size}`], className)}
|
|
50
|
+
onClick={handleClick}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
<SmartTextTruncate className={S.sidebarMenuSubButtonLabel}>
|
|
54
|
+
{children}
|
|
55
|
+
</SmartTextTruncate>
|
|
56
|
+
{addon}
|
|
57
|
+
</Comp>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (!tooltip) return button;
|
|
61
|
+
|
|
62
|
+
let tooltipProps = tooltip;
|
|
63
|
+
if (typeof tooltipProps === 'string') {
|
|
64
|
+
tooltipProps = {
|
|
65
|
+
children: tooltipProps,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Tooltip>
|
|
71
|
+
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
72
|
+
<TooltipContent
|
|
73
|
+
side="right"
|
|
74
|
+
align="center"
|
|
75
|
+
hidden={!isOpen || isSidebarSheetLayout}
|
|
76
|
+
{...tooltipProps}
|
|
77
|
+
/>
|
|
78
|
+
</Tooltip>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@import '../../../../lib/theme.styl';
|
|
2
|
+
|
|
3
|
+
// Base sidebar wrapper styles (row: main app | chat panel mount)
|
|
4
|
+
.sidebarWrapper
|
|
5
|
+
display flex
|
|
6
|
+
flex-direction row
|
|
7
|
+
align-items stretch
|
|
8
|
+
height 100%
|
|
9
|
+
width 100%
|
|
10
|
+
min-height 0
|
|
11
|
+
|
|
12
|
+
:global(#page-sidebar-actions)
|
|
13
|
+
min-height 100%
|
|
14
|
+
|
|
15
|
+
@media (max-width MOBILE)
|
|
16
|
+
flex-direction column
|
|
17
|
+
// Pin shell height so PageScroll (was 100vh) does not push chat below the viewport
|
|
18
|
+
height 100dvh
|
|
19
|
+
max-height 100dvh
|
|
20
|
+
|
|
21
|
+
// Left: full app grid (PageScroll)
|
|
22
|
+
.sidebarMainShell
|
|
23
|
+
flex 1
|
|
24
|
+
min-width 0
|
|
25
|
+
min-height 0
|
|
26
|
+
display flex
|
|
27
|
+
flex-direction column
|
|
28
|
+
|
|
29
|
+
// Right: AI chat portal target
|
|
30
|
+
.chatPanelMount
|
|
31
|
+
flex 0 0 var(--chat-panel-width, 0px)
|
|
32
|
+
width var(--chat-panel-width, 0px)
|
|
33
|
+
min-width 0
|
|
34
|
+
min-height 0
|
|
35
|
+
overflow hidden
|
|
36
|
+
border-left 1px solid var(--border)
|
|
37
|
+
background var(--background)
|
|
38
|
+
|
|
39
|
+
@media (max-width MOBILE)
|
|
40
|
+
flex 0 0 var(--chat-panel-height, 0px)
|
|
41
|
+
width 100%
|
|
42
|
+
height var(--chat-panel-height, 0px)
|
|
43
|
+
border-left none
|
|
44
|
+
border-top 1px solid var(--border)
|
|
45
|
+
transition flex-basis 0.2s ease, height 0.2s ease
|