@sybilion/uilib 1.4.11 → 1.4.13
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/Chat/ChatSheet/ChatSheet.js +2 -2
- package/dist/esm/components/ui/Page/PageHeader/PageHeader.js +2 -2
- package/dist/esm/components/ui/Page/PageHeader/PageHeader.styl.js +2 -2
- package/dist/esm/components/ui/Renamer/Renamer.js +4 -4
- package/dist/esm/components/ui/Renamer/Renamer.styl.js +2 -2
- package/dist/esm/components/ui/Sidebar/Sidebar.js +20 -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/DriversComparisonChart/DriversComparisonChart.js +21 -5
- package/dist/esm/components/widgets/PerformanceChart/PerformanceChart.js +10 -3
- 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 +2 -1
- package/dist/esm/types/src/components/ui/Page/PageHeader/PageHeader.d.ts +2 -1
- package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +7 -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/dist/esm/types/src/components/widgets/DriversComparisonChart/DriversComparisonChart.d.ts +3 -1
- package/dist/esm/types/src/components/widgets/PerformanceChart/PerformanceChart.d.ts +4 -1
- package/package.json +1 -1
- package/src/components/ui/Button/Button.styl +5 -10
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +5 -2
- package/src/components/ui/Page/PageHeader/PageHeader.styl +5 -0
- package/src/components/ui/Page/PageHeader/PageHeader.styl.d.ts +1 -0
- package/src/components/ui/Page/PageHeader/PageHeader.tsx +8 -1
- package/src/components/ui/Renamer/Renamer.styl +19 -4
- package/src/components/ui/Renamer/Renamer.tsx +8 -9
- package/src/components/ui/Sidebar/Sidebar.styl +61 -51
- package/src/components/ui/Sidebar/Sidebar.styl.d.ts +4 -0
- package/src/components/ui/Sidebar/Sidebar.tsx +66 -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/DriversComparisonChart/DriversComparisonChart.tsx +53 -20
- package/src/components/widgets/PerformanceChart/PerformanceChart.tsx +21 -2
- 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 +3 -17
- package/src/docs/pages/SidebarDatasetsItemsGroupedPage.tsx +4 -1
- package/src/docs/pages/SmartTextTruncatePage.styl +22 -0
- package/src/docs/pages/SmartTextTruncatePage.styl.d.ts +2 -0
- package/src/docs/pages/SmartTextTruncatePage.tsx +21 -1
|
@@ -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
|
|
@@ -122,20 +122,15 @@
|
|
|
122
122
|
// Icon buttons: square, sized per size variant, same radius as the size variant
|
|
123
123
|
.sizeIcon
|
|
124
124
|
padding 0
|
|
125
|
-
width 48px
|
|
126
|
-
height 48px
|
|
127
125
|
|
|
128
126
|
&.sizeSm
|
|
129
|
-
width
|
|
130
|
-
height 36px
|
|
127
|
+
width 30px
|
|
131
128
|
padding 0
|
|
132
129
|
|
|
133
130
|
&.sizeMd
|
|
134
|
-
width
|
|
135
|
-
height 48px
|
|
131
|
+
width 44px
|
|
136
132
|
padding 0
|
|
137
133
|
|
|
138
134
|
&.sizeLg
|
|
139
|
-
width
|
|
140
|
-
height 56px
|
|
135
|
+
width 48px
|
|
141
136
|
padding 0
|
|
@@ -26,6 +26,7 @@ export interface ChatSheetProps extends Omit<
|
|
|
26
26
|
/** Imperative open / new-chat for triggers outside `renderTrigger` (e.g. sidebar). */
|
|
27
27
|
actionsRef?: React.MutableRefObject<ChatSheetActions | null>;
|
|
28
28
|
renderTrigger?: (toggleOpen: () => void, isOpen: boolean) => React.ReactNode;
|
|
29
|
+
triggerIcon?: React.ReactNode;
|
|
29
30
|
triggerLabel?: React.ReactNode;
|
|
30
31
|
/** aria-label for icon-only trigger (required when trigger has no visible text) */
|
|
31
32
|
triggerAriaLabel?: string;
|
|
@@ -38,7 +39,8 @@ export interface ChatSheetProps extends Omit<
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export function ChatSheet({
|
|
41
|
-
|
|
42
|
+
triggerIcon,
|
|
43
|
+
triggerLabel,
|
|
42
44
|
triggerAriaLabel,
|
|
43
45
|
actionsRef,
|
|
44
46
|
renderTrigger,
|
|
@@ -107,11 +109,12 @@ export function ChatSheet({
|
|
|
107
109
|
<>
|
|
108
110
|
{renderTrigger?.(model.toggleOpen, model.isOpen) ?? (
|
|
109
111
|
<Button
|
|
112
|
+
icon={!triggerLabel}
|
|
110
113
|
variant="outline"
|
|
111
114
|
aria-label={triggerAriaLabel}
|
|
112
115
|
onClick={model.toggleOpen}
|
|
113
116
|
>
|
|
114
|
-
{triggerLabel}
|
|
117
|
+
{triggerIcon ?? triggerLabel}
|
|
115
118
|
</Button>
|
|
116
119
|
)}
|
|
117
120
|
{model.isOpen &&
|
|
@@ -19,6 +19,7 @@ export function PageHeader({
|
|
|
19
19
|
title,
|
|
20
20
|
subheader,
|
|
21
21
|
actions,
|
|
22
|
+
sticky,
|
|
22
23
|
}: {
|
|
23
24
|
breadcrumbs?: BreadcrumbItem[];
|
|
24
25
|
breadcrumbClientLogo?: React.ReactNode;
|
|
@@ -28,12 +29,18 @@ export function PageHeader({
|
|
|
28
29
|
title: React.ReactNode;
|
|
29
30
|
subheader?: React.ReactNode;
|
|
30
31
|
actions?: React.ReactNode;
|
|
32
|
+
sticky?: boolean;
|
|
31
33
|
}) {
|
|
32
34
|
const { isScrolled } = useContext(PageContext);
|
|
33
35
|
|
|
34
36
|
return (
|
|
35
37
|
<div
|
|
36
|
-
className={cn(
|
|
38
|
+
className={cn(
|
|
39
|
+
S.root,
|
|
40
|
+
actions && S.hasActions,
|
|
41
|
+
isScrolled && S.scrolled,
|
|
42
|
+
sticky && S.sticky,
|
|
43
|
+
)}
|
|
37
44
|
>
|
|
38
45
|
<div className={S.inner}>
|
|
39
46
|
<Breadcrumbs
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
display inline-block
|
|
3
3
|
max-width 100%
|
|
4
4
|
vertical-align top
|
|
@@ -35,24 +35,39 @@
|
|
|
35
35
|
background-color var(--accent) / 0.1
|
|
36
36
|
|
|
37
37
|
.button
|
|
38
|
+
position relative
|
|
38
39
|
display inline-flex
|
|
39
40
|
vertical-align middle
|
|
41
|
+
|
|
42
|
+
height fit-content !important
|
|
43
|
+
width fit-content !important
|
|
40
44
|
margin-left var(--p-2)
|
|
45
|
+
|
|
41
46
|
opacity 0.5
|
|
42
47
|
transition opacity 0.2s ease-out
|
|
43
48
|
|
|
49
|
+
// minimal clickable area
|
|
50
|
+
&::before
|
|
51
|
+
content ''
|
|
52
|
+
position absolute
|
|
53
|
+
left -18px
|
|
54
|
+
top -18px
|
|
55
|
+
display block
|
|
56
|
+
width 50px
|
|
57
|
+
height 50px
|
|
58
|
+
|
|
44
59
|
.root:hover &
|
|
45
60
|
opacity 1
|
|
46
61
|
|
|
47
62
|
// Pencil icon tracks Button `size` via --icon-size-* tokens (sm 14 / md 16 / lg 20px).
|
|
48
|
-
.size-sm
|
|
63
|
+
.size-sm .button svg
|
|
49
64
|
width var(--icon-size-sm)
|
|
50
65
|
height var(--icon-size-sm)
|
|
51
66
|
|
|
52
|
-
.size-md
|
|
67
|
+
.size-md .button svg
|
|
53
68
|
width var(--icon-size-md)
|
|
54
69
|
height var(--icon-size-md)
|
|
55
70
|
|
|
56
|
-
.size-lg
|
|
71
|
+
.size-lg .button svg
|
|
57
72
|
width var(--icon-size-lg)
|
|
58
73
|
height var(--icon-size-lg)
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import cn from 'classnames';
|
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import { Button } from '#uilib/components/ui/Button';
|
|
5
|
-
import { Input } from '#uilib/components/ui/Input';
|
|
6
1
|
import {
|
|
7
2
|
Tooltip,
|
|
8
3
|
TooltipContent,
|
|
9
4
|
TooltipTrigger,
|
|
10
5
|
} from '#uilib/components/ui/Tooltip';
|
|
11
|
-
import {
|
|
12
|
-
import { PencilSimpleIcon } from '@phosphor-icons/react';
|
|
6
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
13
7
|
|
|
14
|
-
import
|
|
8
|
+
import { Button } from '#uilib/components/ui/Button';
|
|
9
|
+
import { Input } from '#uilib/components/ui/Input';
|
|
10
|
+
import { PencilSimpleIcon } from '@phosphor-icons/react';
|
|
15
11
|
import type { RenamerProps } from './Renamer.types';
|
|
12
|
+
import S from './Renamer.styl';
|
|
13
|
+
import cn from 'classnames';
|
|
14
|
+
import { useIsMobile } from '#uilib/hooks/useIsMobile';
|
|
16
15
|
|
|
17
16
|
export function Renamer({
|
|
18
17
|
value = '',
|
|
@@ -112,7 +111,7 @@ export function Renamer({
|
|
|
112
111
|
<Button
|
|
113
112
|
icon
|
|
114
113
|
className={S.button}
|
|
115
|
-
variant="
|
|
114
|
+
variant="link"
|
|
116
115
|
onPointerDown={e => {
|
|
117
116
|
e.preventDefault();
|
|
118
117
|
e.stopPropagation();
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
// Sidebar trigger
|
|
75
75
|
.sidebarTrigger
|
|
76
76
|
width var(--p-5)
|
|
77
|
-
height var(--p-5)
|
|
77
|
+
// height var(--p-5)
|
|
78
78
|
margin-left calc(-1 * var(--p-4))
|
|
79
79
|
cursor pointer
|
|
80
80
|
|
|
@@ -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
|
|
@@ -339,9 +339,9 @@
|
|
|
339
339
|
&::before
|
|
340
340
|
content ''
|
|
341
341
|
position absolute
|
|
342
|
-
left
|
|
342
|
+
left 14px
|
|
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,27 @@
|
|
|
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
|
+
|
|
521
|
+
&.expanded
|
|
522
|
+
transform rotate(90deg)
|
|
523
|
+
|
|
524
|
+
& > svg
|
|
525
|
+
width var(--p-5)
|
|
526
|
+
height var(--p-5)
|
|
527
|
+
|
|
520
528
|
// Full-width primary CTA in sidebar (uses ui/Button variant=default; avoids nav hover conflicts)
|
|
521
529
|
.sidebarMenuButtonCta
|
|
522
530
|
display flex
|
|
@@ -604,18 +612,20 @@
|
|
|
604
612
|
|
|
605
613
|
// Menu sub button variants
|
|
606
614
|
.sidebarMenuSubButton
|
|
607
|
-
color var(--sidebar-foreground)
|
|
608
615
|
display flex
|
|
616
|
+
align-items center
|
|
617
|
+
gap var(--p-1)
|
|
618
|
+
|
|
609
619
|
width calc(100% - var(--p-3))
|
|
610
620
|
height var(--p-9)
|
|
611
621
|
min-width 0
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
622
|
+
padding var(--p-2) var(--p-3)
|
|
623
|
+
margin-left var(--p-1)
|
|
624
|
+
|
|
615
625
|
overflow hidden
|
|
626
|
+
transform translateX(-1px)
|
|
616
627
|
border-radius var(--p-3)
|
|
617
|
-
|
|
618
|
-
margin-left var(--p-3)
|
|
628
|
+
color var(--sidebar-foreground)
|
|
619
629
|
outline none
|
|
620
630
|
cursor pointer
|
|
621
631
|
text-decoration none
|
|
@@ -647,19 +657,19 @@
|
|
|
647
657
|
&[data-collapsible="icon"]
|
|
648
658
|
display none
|
|
649
659
|
|
|
650
|
-
& > span
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
660
|
+
// & > span
|
|
661
|
+
// flex-grow 1
|
|
662
|
+
// flex-shrink 1
|
|
663
|
+
// min-width 0
|
|
664
|
+
// line-height 20px
|
|
665
|
+
// white-space nowrap
|
|
666
|
+
// overflow hidden
|
|
657
667
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
668
|
+
// // Nested SmartTextTruncate (e.g. title pre-wrapped in app nav items)
|
|
669
|
+
// & > span
|
|
670
|
+
// display block
|
|
671
|
+
// width 100%
|
|
672
|
+
// min-width 0
|
|
663
673
|
|
|
664
674
|
& > svg
|
|
665
675
|
width 1rem
|
|
@@ -668,12 +678,12 @@
|
|
|
668
678
|
color var(--sidebar-accent-foreground)
|
|
669
679
|
|
|
670
680
|
// Size variants
|
|
671
|
-
&.size-sm
|
|
672
|
-
|
|
673
|
-
&.size-md
|
|
674
|
-
|
|
675
|
-
&.size-lg
|
|
676
|
-
|
|
681
|
+
// &.size-sm
|
|
682
|
+
// font-size 0.75rem
|
|
683
|
+
// &.size-md
|
|
684
|
+
// font-size 0.875rem
|
|
685
|
+
// &.size-lg
|
|
686
|
+
// font-size 1rem
|
|
677
687
|
|
|
678
688
|
// View Transition API: opacity cross-fade is the UA default on old/new pseudos.
|
|
679
689
|
// 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,65 @@ 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,
|
|
932
952
|
...props
|
|
933
|
-
}: ButtonProps & {
|
|
953
|
+
}: Omit<ButtonProps, 'icon'> & {
|
|
954
|
+
icon?: React.ReactNode;
|
|
955
|
+
isActive?: boolean;
|
|
956
|
+
/** When true, renders an expand/collapse chevron (requires a non–asChild button). */
|
|
957
|
+
hasSubItems?: boolean;
|
|
958
|
+
/** Chevron direction when `hasSubItems` is true. */
|
|
959
|
+
isExpanded?: boolean;
|
|
960
|
+
}) {
|
|
961
|
+
const effectiveAsChild = asChild && !hasSubItems;
|
|
962
|
+
|
|
963
|
+
const label = (
|
|
964
|
+
<SmartTextTruncate className={S.sidebarMenuButtonLabel}>
|
|
965
|
+
{children}
|
|
966
|
+
</SmartTextTruncate>
|
|
967
|
+
);
|
|
968
|
+
|
|
969
|
+
const chevron = hasSubItems ? (
|
|
970
|
+
<span
|
|
971
|
+
className={cn(S.sidebarMenuButtonChevron, isExpanded && S.expanded)}
|
|
972
|
+
aria-hidden="true"
|
|
973
|
+
>
|
|
974
|
+
<ChevronRight size={16} />
|
|
975
|
+
</span>
|
|
976
|
+
) : null;
|
|
977
|
+
|
|
934
978
|
return (
|
|
935
979
|
<Button
|
|
936
|
-
asChild={
|
|
980
|
+
asChild={effectiveAsChild}
|
|
937
981
|
variant={variant}
|
|
938
982
|
size={size}
|
|
939
983
|
data-slot="sidebar-menu-button"
|
|
940
984
|
data-sidebar="menu-button"
|
|
941
985
|
data-active={isActive}
|
|
986
|
+
aria-expanded={hasSubItems ? isExpanded : undefined}
|
|
942
987
|
className={cn(
|
|
943
988
|
variant === 'default' ? S.sidebarMenuButtonCta : S.sidebarMenuButton,
|
|
944
989
|
S[`size-${size}`],
|
|
945
990
|
className,
|
|
946
991
|
)}
|
|
947
992
|
{...props}
|
|
948
|
-
|
|
993
|
+
>
|
|
994
|
+
{icon}
|
|
995
|
+
{effectiveAsChild ? (
|
|
996
|
+
label
|
|
997
|
+
) : (
|
|
998
|
+
<>
|
|
999
|
+
{label}
|
|
1000
|
+
{chevron}
|
|
1001
|
+
</>
|
|
1002
|
+
)}
|
|
1003
|
+
</Button>
|
|
949
1004
|
);
|
|
950
1005
|
}
|
|
951
1006
|
|
|
@@ -1014,6 +1069,7 @@ function SidebarMenuSubButton({
|
|
|
1014
1069
|
tooltip,
|
|
1015
1070
|
className,
|
|
1016
1071
|
onClick,
|
|
1072
|
+
children,
|
|
1017
1073
|
...props
|
|
1018
1074
|
}: ComponentProps<'a'> & {
|
|
1019
1075
|
asChild?: boolean;
|
|
@@ -1040,7 +1096,11 @@ function SidebarMenuSubButton({
|
|
|
1040
1096
|
className={cn(S.sidebarMenuSubButton, S[`size-${size}`], className)}
|
|
1041
1097
|
onClick={handleClick}
|
|
1042
1098
|
{...props}
|
|
1043
|
-
|
|
1099
|
+
>
|
|
1100
|
+
<SmartTextTruncate className={S.sidebarMenuSubButtonLabel}>
|
|
1101
|
+
{children}
|
|
1102
|
+
</SmartTextTruncate>
|
|
1103
|
+
</Comp>
|
|
1044
1104
|
);
|
|
1045
1105
|
|
|
1046
1106
|
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;
|