@sybilion/uilib 1.4.12 → 1.4.14
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/esm/components/ui/Button/Button.styl.js +1 -1
- package/dist/esm/components/ui/Sidebar/Sidebar.js +21 -7
- package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +2 -2
- package/dist/esm/components/ui/SmartTextTruncate/SmartTextTruncate.js +260 -67
- package/dist/esm/components/ui/SmartTextTruncate/SmartTextTruncate.styl.js +7 -0
- package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js +5 -5
- package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSheet.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +9 -2
- package/dist/esm/types/src/components/ui/SmartTextTruncate/SmartTextTruncate.d.ts +5 -3
- package/dist/esm/types/src/components/ui/SmartTextTruncate/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/ui/Button/Button.styl +2 -2
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +1 -1
- package/src/components/ui/Sidebar/Sidebar.styl +63 -49
- package/src/components/ui/Sidebar/Sidebar.styl.d.ts +4 -0
- package/src/components/ui/Sidebar/Sidebar.tsx +78 -6
- package/src/components/ui/SmartTextTruncate/SmartTextTruncate.styl +34 -0
- package/src/components/ui/SmartTextTruncate/SmartTextTruncate.styl.d.ts +10 -0
- package/src/components/ui/SmartTextTruncate/SmartTextTruncate.tsx +335 -81
- package/src/components/ui/SmartTextTruncate/index.ts +5 -1
- package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl +0 -24
- package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.d.ts +0 -2
- package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.tsx +5 -11
- package/src/docs/components/DocsSidebar/DocsSidebar.tsx +17 -25
- package/src/docs/pages/SidebarDatasetsItemsGroupedPage.tsx +4 -1
- package/src/docs/pages/SmartTextTruncatePage.styl +13 -3
- package/src/docs/pages/SmartTextTruncatePage.styl.d.ts +2 -1
- package/src/docs/pages/SmartTextTruncatePage.tsx +16 -2
|
@@ -82,8 +82,14 @@ declare function SidebarGroupAction({ className, asChild, ...props }: ComponentP
|
|
|
82
82
|
}): import("react/jsx-runtime").JSX.Element;
|
|
83
83
|
declare function SidebarMenu({ className, ...props }: ComponentProps<'ul'>): import("react/jsx-runtime").JSX.Element;
|
|
84
84
|
declare function SidebarMenuItem({ className, ...props }: ComponentProps<'li'>): import("react/jsx-runtime").JSX.Element;
|
|
85
|
-
declare function SidebarMenuButton({ asChild, isActive, variant, size, className, ...props }: ButtonProps & {
|
|
85
|
+
declare function SidebarMenuButton({ asChild, isActive, hasSubItems, isExpanded, variant, size, className, icon, children, addon, ...props }: Omit<ButtonProps, 'icon'> & {
|
|
86
|
+
icon?: React.ReactNode;
|
|
87
|
+
addon?: React.ReactNode;
|
|
86
88
|
isActive?: boolean;
|
|
89
|
+
/** When true, renders an expand/collapse chevron (requires a non–asChild button). */
|
|
90
|
+
hasSubItems?: boolean;
|
|
91
|
+
/** Chevron direction when `hasSubItems` is true. */
|
|
92
|
+
isExpanded?: boolean;
|
|
87
93
|
}): import("react/jsx-runtime").JSX.Element;
|
|
88
94
|
declare function SidebarMenuAction({ className, asChild, showOnHover, ...props }: ComponentProps<'button'> & {
|
|
89
95
|
asChild?: boolean;
|
|
@@ -92,10 +98,11 @@ declare function SidebarMenuAction({ className, asChild, showOnHover, ...props }
|
|
|
92
98
|
declare function SidebarMenuBadge({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
93
99
|
declare function SidebarMenuSub({ className, ...props }: ComponentProps<'ul'>): import("react/jsx-runtime").JSX.Element;
|
|
94
100
|
declare function SidebarMenuSubItem({ className, ...props }: ComponentProps<'li'>): import("react/jsx-runtime").JSX.Element;
|
|
95
|
-
declare function SidebarMenuSubButton({ asChild, size, isActive, tooltip, className, onClick, ...props }: ComponentProps<'a'> & {
|
|
101
|
+
declare function SidebarMenuSubButton({ asChild, size, isActive, tooltip, className, onClick, children, addon, ...props }: ComponentProps<'a'> & {
|
|
96
102
|
asChild?: boolean;
|
|
97
103
|
size?: 'sm' | 'md' | 'lg';
|
|
98
104
|
isActive?: boolean;
|
|
99
105
|
tooltip?: string | ComponentProps<typeof TooltipContent>;
|
|
106
|
+
addon?: React.ReactNode;
|
|
100
107
|
}): import("react/jsx-runtime").JSX.Element;
|
|
101
108
|
export { PanelResizeHandle, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarResizeHandle, SidebarSeparator, SidebarTrigger, useSidebar, useSidebarActions, useSidebarState, };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
declare function
|
|
3
|
-
|
|
1
|
+
/** Panel resize handle — call on first pointer move after press, not on pointer down. */
|
|
2
|
+
declare function notifyPanelWidthDragStart(): void;
|
|
3
|
+
declare function notifyPanelWidthDragEnd(): void;
|
|
4
|
+
declare const SmartTextTruncate: import("react").NamedExoticComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
5
|
+
export { SmartTextTruncate, notifyPanelWidthDragStart, notifyPanelWidthDragEnd, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SmartTextTruncate } from './SmartTextTruncate';
|
|
1
|
+
export { SmartTextTruncate, notifyPanelWidthDragStart, notifyPanelWidthDragEnd, } from './SmartTextTruncate';
|
|
2
2
|
export type { SmartTextTruncateProps } from './SmartTextTruncate.types';
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
display inline-flex
|
|
4
4
|
align-items center
|
|
5
5
|
justify-content center
|
|
6
|
-
gap
|
|
6
|
+
gap var(--p-2)
|
|
7
7
|
flex-shrink 0
|
|
8
8
|
white-space nowrap
|
|
9
9
|
border-radius var(--radius-button)
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
.sizeSm
|
|
106
106
|
height 30px
|
|
107
107
|
padding 0 14px
|
|
108
|
-
font-size
|
|
108
|
+
font-size var(--text-sm)
|
|
109
109
|
border-radius var(--p-5)
|
|
110
110
|
|
|
111
111
|
.sizeMd
|
|
@@ -27,7 +27,7 @@ export interface ChatSheetProps extends Omit<
|
|
|
27
27
|
actionsRef?: React.MutableRefObject<ChatSheetActions | null>;
|
|
28
28
|
renderTrigger?: (toggleOpen: () => void, isOpen: boolean) => React.ReactNode;
|
|
29
29
|
triggerIcon?: React.ReactNode;
|
|
30
|
-
triggerLabel?:
|
|
30
|
+
triggerLabel?: React.ReactNode;
|
|
31
31
|
/** aria-label for icon-only trigger (required when trigger has no visible text) */
|
|
32
32
|
triggerAriaLabel?: string;
|
|
33
33
|
label?: string;
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
border-radius 0.375rem
|
|
287
287
|
padding-left 0.25rem
|
|
288
288
|
padding-right 0.25rem
|
|
289
|
-
font-size 0.75rem
|
|
289
|
+
// font-size 0.75rem
|
|
290
290
|
font-weight 500
|
|
291
291
|
user-select none
|
|
292
292
|
&[data-size="sm"]
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
position relative
|
|
324
324
|
display flex
|
|
325
325
|
flex-direction column
|
|
326
|
-
gap var(--p-
|
|
326
|
+
gap var(--p-1)
|
|
327
327
|
|
|
328
328
|
min-width 0
|
|
329
329
|
padding 0
|
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
position absolute
|
|
342
342
|
left var(--p-5)
|
|
343
343
|
top 0
|
|
344
|
-
bottom
|
|
344
|
+
bottom 0
|
|
345
345
|
width 1px
|
|
346
346
|
background var(--sidebar-border)
|
|
347
347
|
pointer-events none
|
|
@@ -353,19 +353,7 @@
|
|
|
353
353
|
.sidebarMenuSubItem
|
|
354
354
|
position relative
|
|
355
355
|
min-width 0
|
|
356
|
-
margin-left var(--p-
|
|
357
|
-
|
|
358
|
-
&::before
|
|
359
|
-
content ''
|
|
360
|
-
position absolute
|
|
361
|
-
left calc(var(--p-1) * -1)
|
|
362
|
-
top var(--p-2)
|
|
363
|
-
bottom 0
|
|
364
|
-
width var(--p-3)
|
|
365
|
-
height var(--p-3)
|
|
366
|
-
border-left 1px solid var(--sidebar-border)
|
|
367
|
-
border-bottom 1px solid var(--sidebar-border)
|
|
368
|
-
border-bottom-left-radius var(--p-2)
|
|
356
|
+
margin-left var(--p-4)
|
|
369
357
|
|
|
370
358
|
a:hover
|
|
371
359
|
text-decoration: none;
|
|
@@ -447,7 +435,6 @@
|
|
|
447
435
|
border-radius var(--p-3)
|
|
448
436
|
padding var(--p-6) var(--p-3)
|
|
449
437
|
text-align left
|
|
450
|
-
font-size 0.875rem
|
|
451
438
|
outline none
|
|
452
439
|
cursor pointer
|
|
453
440
|
transition all
|
|
@@ -484,11 +471,11 @@
|
|
|
484
471
|
height 2rem !important
|
|
485
472
|
padding 0.5rem !important
|
|
486
473
|
|
|
487
|
-
& > span
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
474
|
+
// & > span
|
|
475
|
+
// flex-grow 1
|
|
476
|
+
// line-height 20px
|
|
477
|
+
// white-space nowrap
|
|
478
|
+
// overflow hidden
|
|
492
479
|
|
|
493
480
|
& > svg
|
|
494
481
|
width var(--p-5)
|
|
@@ -498,13 +485,13 @@
|
|
|
498
485
|
// Size variants
|
|
499
486
|
&.size-sm
|
|
500
487
|
height 1.75rem
|
|
501
|
-
font-size 0.75rem
|
|
488
|
+
// font-size 0.75rem
|
|
502
489
|
&.size-md
|
|
503
490
|
height var(--p-12)
|
|
504
|
-
font-size 0.875rem
|
|
491
|
+
// font-size 0.875rem
|
|
505
492
|
&.size-lg
|
|
506
493
|
height 3rem
|
|
507
|
-
font-size 0.875rem
|
|
494
|
+
// font-size 0.875rem
|
|
508
495
|
&[data-collapsible="icon"]
|
|
509
496
|
padding 0 !important
|
|
510
497
|
|
|
@@ -517,6 +504,31 @@
|
|
|
517
504
|
color var(--sidebar-accent-foreground)
|
|
518
505
|
box-shadow 0 0 0 1px var(--sidebar-accent)
|
|
519
506
|
|
|
507
|
+
.sidebarMenuButtonLabel
|
|
508
|
+
flex-grow 1
|
|
509
|
+
|
|
510
|
+
.sidebarMenuSubButtonLabel
|
|
511
|
+
flex-grow 1
|
|
512
|
+
min-width 0
|
|
513
|
+
|
|
514
|
+
.sidebarMenuButtonChevron
|
|
515
|
+
margin-left auto
|
|
516
|
+
display flex
|
|
517
|
+
flex-shrink 0
|
|
518
|
+
align-items center
|
|
519
|
+
transition transform 0.1s ease-out
|
|
520
|
+
opacity 0.5
|
|
521
|
+
|
|
522
|
+
.sidebarMenuButton:hover &
|
|
523
|
+
opacity 1
|
|
524
|
+
|
|
525
|
+
&.expanded
|
|
526
|
+
transform rotate(90deg)
|
|
527
|
+
|
|
528
|
+
& > svg
|
|
529
|
+
width var(--p-5)
|
|
530
|
+
height var(--p-5)
|
|
531
|
+
|
|
520
532
|
// Full-width primary CTA in sidebar (uses ui/Button variant=default; avoids nav hover conflicts)
|
|
521
533
|
.sidebarMenuButtonCta
|
|
522
534
|
display flex
|
|
@@ -604,18 +616,20 @@
|
|
|
604
616
|
|
|
605
617
|
// Menu sub button variants
|
|
606
618
|
.sidebarMenuSubButton
|
|
607
|
-
color var(--sidebar-foreground)
|
|
608
619
|
display flex
|
|
620
|
+
align-items center
|
|
621
|
+
gap var(--p-1)
|
|
622
|
+
|
|
609
623
|
width calc(100% - var(--p-3))
|
|
610
624
|
height var(--p-9)
|
|
611
625
|
min-width 0
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
626
|
+
padding var(--p-2) var(--p-3)
|
|
627
|
+
margin-left var(--p-3)
|
|
628
|
+
|
|
615
629
|
overflow hidden
|
|
630
|
+
transform translateX(-1px)
|
|
616
631
|
border-radius var(--p-3)
|
|
617
|
-
|
|
618
|
-
margin-left var(--p-3)
|
|
632
|
+
color var(--sidebar-foreground)
|
|
619
633
|
outline none
|
|
620
634
|
cursor pointer
|
|
621
635
|
text-decoration none
|
|
@@ -647,19 +661,19 @@
|
|
|
647
661
|
&[data-collapsible="icon"]
|
|
648
662
|
display none
|
|
649
663
|
|
|
650
|
-
& > span
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
664
|
+
// & > span
|
|
665
|
+
// flex-grow 1
|
|
666
|
+
// flex-shrink 1
|
|
667
|
+
// min-width 0
|
|
668
|
+
// line-height 20px
|
|
669
|
+
// white-space nowrap
|
|
670
|
+
// overflow hidden
|
|
657
671
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
672
|
+
// // Nested SmartTextTruncate (e.g. title pre-wrapped in app nav items)
|
|
673
|
+
// & > span
|
|
674
|
+
// display block
|
|
675
|
+
// width 100%
|
|
676
|
+
// min-width 0
|
|
663
677
|
|
|
664
678
|
& > svg
|
|
665
679
|
width 1rem
|
|
@@ -668,12 +682,12 @@
|
|
|
668
682
|
color var(--sidebar-accent-foreground)
|
|
669
683
|
|
|
670
684
|
// Size variants
|
|
671
|
-
&.size-sm
|
|
672
|
-
|
|
673
|
-
&.size-md
|
|
674
|
-
|
|
675
|
-
&.size-lg
|
|
676
|
-
|
|
685
|
+
// &.size-sm
|
|
686
|
+
// font-size 0.75rem
|
|
687
|
+
// &.size-md
|
|
688
|
+
// font-size 0.875rem
|
|
689
|
+
// &.size-lg
|
|
690
|
+
// font-size 1rem
|
|
677
691
|
|
|
678
692
|
// View Transition API: opacity cross-fade is the UA default on old/new pseudos.
|
|
679
693
|
// Setting animation-name below replaces that default; keyframes keep opacity + add blur.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Please do not change this file!
|
|
3
3
|
interface CssExports {
|
|
4
4
|
'chatPanelMount': string;
|
|
5
|
+
'expanded': string;
|
|
5
6
|
'fullHeightResizer': string;
|
|
6
7
|
'sheetContentSidebar': string;
|
|
7
8
|
'sheetSidebarInner': string;
|
|
@@ -19,13 +20,16 @@ interface CssExports {
|
|
|
19
20
|
'sidebarMenuAction': string;
|
|
20
21
|
'sidebarMenuBadge': string;
|
|
21
22
|
'sidebarMenuButton': string;
|
|
23
|
+
'sidebarMenuButtonChevron': string;
|
|
22
24
|
'sidebarMenuButtonCta': string;
|
|
25
|
+
'sidebarMenuButtonLabel': string;
|
|
23
26
|
'sidebarMenuItem': string;
|
|
24
27
|
'sidebarMenuSkeleton': string;
|
|
25
28
|
'sidebarMenuSkeletonIcon': string;
|
|
26
29
|
'sidebarMenuSkeletonText': string;
|
|
27
30
|
'sidebarMenuSub': string;
|
|
28
31
|
'sidebarMenuSubButton': string;
|
|
32
|
+
'sidebarMenuSubButtonLabel': string;
|
|
29
33
|
'sidebarMenuSubItem': string;
|
|
30
34
|
'sidebarNone': string;
|
|
31
35
|
'sidebarRail': string;
|
|
@@ -18,6 +18,11 @@ import type { ButtonProps } from '#uilib/components/ui/Button/Button.types';
|
|
|
18
18
|
import { Logo } from '#uilib/components/ui/Logo/Logo';
|
|
19
19
|
import { Separator } from '#uilib/components/ui/Separator';
|
|
20
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';
|
|
21
26
|
import {
|
|
22
27
|
Tooltip,
|
|
23
28
|
TooltipContent,
|
|
@@ -45,7 +50,7 @@ import { getCookie, setCookie } from '#uilib/lib/cookie';
|
|
|
45
50
|
import { getCookiePreferences } from '#uilib/lib/cookie-consent/cookie-consent';
|
|
46
51
|
import { LS, Scroll } from '@homecode/ui';
|
|
47
52
|
import { Slot } from '@radix-ui/react-slot';
|
|
48
|
-
import { PanelLeft } from 'lucide-react';
|
|
53
|
+
import { ChevronDown, ChevronRight, PanelLeft } from 'lucide-react';
|
|
49
54
|
|
|
50
55
|
import S from './Sidebar.styl';
|
|
51
56
|
|
|
@@ -255,8 +260,17 @@ function SidebarProvider({
|
|
|
255
260
|
chatPanelOpen: chatPanelOpenRef.current,
|
|
256
261
|
chatWidthPx: chatWidthRef.current,
|
|
257
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
|
+
|
|
258
272
|
_setSidebarWidthPx(next);
|
|
259
|
-
if (
|
|
273
|
+
if (allowPersistSidebarWidth) {
|
|
260
274
|
LS.set(sidebarLsKey, next);
|
|
261
275
|
}
|
|
262
276
|
},
|
|
@@ -722,6 +736,7 @@ function PanelResizeHandle({
|
|
|
722
736
|
|
|
723
737
|
const handleDrag = useCallback(
|
|
724
738
|
(delta: Delta) => {
|
|
739
|
+
notifyPanelWidthDragStart();
|
|
725
740
|
const shellW = getShellWidth();
|
|
726
741
|
if (shellW <= 0) return;
|
|
727
742
|
const raw =
|
|
@@ -746,6 +761,7 @@ function PanelResizeHandle({
|
|
|
746
761
|
const handleDragEnd = useCallback(
|
|
747
762
|
(e: PointerEvent) => {
|
|
748
763
|
onDragComplete?.(lastRawRef.current);
|
|
764
|
+
notifyPanelWidthDragEnd();
|
|
749
765
|
try {
|
|
750
766
|
handleRef.current?.releasePointerCapture(e.pointerId);
|
|
751
767
|
} catch {
|
|
@@ -926,26 +942,74 @@ function SidebarMenuItem({ className, ...props }: ComponentProps<'li'>) {
|
|
|
926
942
|
function SidebarMenuButton({
|
|
927
943
|
asChild = false,
|
|
928
944
|
isActive = false,
|
|
945
|
+
hasSubItems = false,
|
|
946
|
+
isExpanded = false,
|
|
929
947
|
variant = 'ghost',
|
|
930
948
|
size = 'sm',
|
|
931
949
|
className,
|
|
950
|
+
icon,
|
|
951
|
+
children,
|
|
952
|
+
addon,
|
|
932
953
|
...props
|
|
933
|
-
}: ButtonProps & {
|
|
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
|
+
|
|
934
987
|
return (
|
|
935
988
|
<Button
|
|
936
|
-
asChild={
|
|
989
|
+
asChild={effectiveAsChild}
|
|
937
990
|
variant={variant}
|
|
938
991
|
size={size}
|
|
939
992
|
data-slot="sidebar-menu-button"
|
|
940
993
|
data-sidebar="menu-button"
|
|
941
994
|
data-active={isActive}
|
|
995
|
+
aria-expanded={hasSubItems ? isExpanded : undefined}
|
|
942
996
|
className={cn(
|
|
943
997
|
variant === 'default' ? S.sidebarMenuButtonCta : S.sidebarMenuButton,
|
|
944
998
|
S[`size-${size}`],
|
|
945
999
|
className,
|
|
946
1000
|
)}
|
|
947
1001
|
{...props}
|
|
948
|
-
|
|
1002
|
+
>
|
|
1003
|
+
{icon}
|
|
1004
|
+
{effectiveAsChild ? (
|
|
1005
|
+
userContent
|
|
1006
|
+
) : (
|
|
1007
|
+
<>
|
|
1008
|
+
{userContent}
|
|
1009
|
+
{chevron}
|
|
1010
|
+
</>
|
|
1011
|
+
)}
|
|
1012
|
+
</Button>
|
|
949
1013
|
);
|
|
950
1014
|
}
|
|
951
1015
|
|
|
@@ -1014,12 +1078,15 @@ function SidebarMenuSubButton({
|
|
|
1014
1078
|
tooltip,
|
|
1015
1079
|
className,
|
|
1016
1080
|
onClick,
|
|
1081
|
+
children,
|
|
1082
|
+
addon,
|
|
1017
1083
|
...props
|
|
1018
1084
|
}: ComponentProps<'a'> & {
|
|
1019
1085
|
asChild?: boolean;
|
|
1020
1086
|
size?: 'sm' | 'md' | 'lg';
|
|
1021
1087
|
isActive?: boolean;
|
|
1022
1088
|
tooltip?: string | ComponentProps<typeof TooltipContent>;
|
|
1089
|
+
addon?: React.ReactNode;
|
|
1023
1090
|
}) {
|
|
1024
1091
|
const Comp = asChild ? Slot : 'a';
|
|
1025
1092
|
const { isOpen } = useSidebarState();
|
|
@@ -1040,7 +1107,12 @@ function SidebarMenuSubButton({
|
|
|
1040
1107
|
className={cn(S.sidebarMenuSubButton, S[`size-${size}`], className)}
|
|
1041
1108
|
onClick={handleClick}
|
|
1042
1109
|
{...props}
|
|
1043
|
-
|
|
1110
|
+
>
|
|
1111
|
+
<SmartTextTruncate className={S.sidebarMenuSubButtonLabel}>
|
|
1112
|
+
{children}
|
|
1113
|
+
</SmartTextTruncate>
|
|
1114
|
+
{addon}
|
|
1115
|
+
</Comp>
|
|
1044
1116
|
);
|
|
1045
1117
|
|
|
1046
1118
|
if (!tooltip) return button;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.root
|
|
2
|
+
position relative
|
|
3
|
+
overflow hidden
|
|
4
|
+
min-width 0
|
|
5
|
+
|
|
6
|
+
// Middle-truncated label — visible when settled.
|
|
7
|
+
.measuredLabel
|
|
8
|
+
display block
|
|
9
|
+
white-space nowrap
|
|
10
|
+
overflow hidden
|
|
11
|
+
min-width 0
|
|
12
|
+
|
|
13
|
+
// Full text + end ellipsis — visible only while dragging/resizing (html flag).
|
|
14
|
+
.liveLabel
|
|
15
|
+
display none
|
|
16
|
+
white-space nowrap
|
|
17
|
+
overflow hidden
|
|
18
|
+
text-overflow ellipsis
|
|
19
|
+
min-width 0
|
|
20
|
+
|
|
21
|
+
:global(html[data-smart-text-truncate-fast]) .measuredLabel
|
|
22
|
+
display none
|
|
23
|
+
|
|
24
|
+
:global(html[data-smart-text-truncate-fast]) .liveLabel
|
|
25
|
+
display block
|
|
26
|
+
|
|
27
|
+
:global(html[data-smart-text-truncate-fast]) .fullText
|
|
28
|
+
display none
|
|
29
|
+
|
|
30
|
+
.fullText
|
|
31
|
+
position absolute
|
|
32
|
+
visibility hidden
|
|
33
|
+
white-space nowrap
|
|
34
|
+
top -9999px
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file is automatically generated.
|
|
2
|
+
// Please do not change this file!
|
|
3
|
+
interface CssExports {
|
|
4
|
+
'fullText': string;
|
|
5
|
+
'liveLabel': string;
|
|
6
|
+
'measuredLabel': string;
|
|
7
|
+
'root': string;
|
|
8
|
+
}
|
|
9
|
+
export const cssExports: CssExports;
|
|
10
|
+
export default cssExports;
|