@brightlocal/ui-components 0.1.2 → 0.1.4
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/accordion.cjs +1 -1
- package/dist/accordion.d.ts +74 -4
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +100 -105
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +30 -10
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +129 -132
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +22 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +1 -1
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.d.ts +11 -1
- package/dist/aspect-ratio.d.ts.map +1 -1
- package/dist/aspect-ratio.js +16 -20
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.d.ts +43 -3
- package/dist/avatar.d.ts.map +1 -1
- package/dist/avatar.js +18 -16
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +24 -9
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +34 -32
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +177 -170
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +38 -307
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +411 -508
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +63 -8
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +97 -93
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +17 -45
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +49 -50
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts +16 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +31 -29
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +58 -18
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +60 -51
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +99 -9
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +142 -128
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +18 -15
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +44 -33
- package/dist/chart.cjs +4 -4
- package/dist/chart.d.ts +70 -7
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +71 -66
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +9 -5
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +61 -82
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.d.ts +65 -8
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +41 -55
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +28 -18
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +191 -160
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +115 -9
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +176 -152
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts +188 -20
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +120 -122
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +75 -9
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +221 -82
- package/dist/description.cjs +1 -0
- package/dist/description.d.ts +37 -0
- package/dist/description.d.ts.map +1 -0
- package/dist/description.js +25 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +73 -9
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +103 -112
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +92 -0
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +67 -52
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +95 -11
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +146 -106
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +26 -6
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +55 -53
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +27 -17
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +86 -79
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +36 -6
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +44 -42
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +367 -386
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +21 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +51 -41
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +25 -26
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts +38 -24
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +68 -136
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts +20 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +31 -18
- package/dist/link.cjs +1 -1
- package/dist/link.js +1 -1
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +9 -4
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +20 -21
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +43 -6
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +100 -78
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +6 -54
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +73 -84
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +8 -10
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +78 -86
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts +59 -4
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +42 -34
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +9 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +71 -59
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.d.ts +33 -10
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/radio-group.js +56 -66
- package/dist/rating.d.ts +4 -0
- package/dist/rating.d.ts.map +1 -1
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +58 -6
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +38 -37
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +46 -5
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +42 -38
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts +30 -0
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +64 -54
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +52 -5
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +45 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +85 -19
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +117 -115
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +24 -2
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +15 -9
- package/dist/slider.cjs +1 -1
- package/dist/slider.d.ts +18 -4
- package/dist/slider.d.ts.map +1 -1
- package/dist/slider.js +72 -66
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +21 -22
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +46 -48
- package/dist/split-layout.d.ts +4 -1
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts +2 -12
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +37 -41
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +16 -12
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +56 -58
- package/dist/tabs.d.ts +27 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.d.ts +57 -7
- package/dist/toggle-group.d.ts.map +1 -1
- package/dist/toggle-group.js +60 -67
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.d.ts +12 -26
- package/dist/toggle.d.ts.map +1 -1
- package/dist/toggle.js +16 -20
- package/package.json +9 -3
- package/src/blocks/data-table.tsx +43 -33
- package/src/blocks/sidebar.tsx +158 -541
- package/src/components/accordion.tsx +164 -78
- package/src/components/alert-dialog.tsx +156 -111
- package/src/components/alert.tsx +27 -14
- package/src/components/aspect-ratio.tsx +25 -16
- package/src/components/avatar.tsx +56 -8
- package/src/components/badge.tsx +65 -42
- package/src/components/breadcrumb.tsx +159 -83
- package/src/components/button.tsx +42 -63
- package/src/components/calendar.tsx +22 -6
- package/src/components/card.tsx +92 -40
- package/src/components/carousel.tsx +240 -115
- package/src/components/centred-layout.tsx +68 -49
- package/src/components/chart.tsx +118 -47
- package/src/components/checkbox.tsx +43 -79
- package/src/components/collapsible.tsx +95 -26
- package/src/components/combobox.tsx +243 -153
- package/src/components/command.tsx +295 -121
- package/src/components/context-menu.tsx +279 -82
- package/src/components/date-picker.tsx +282 -31
- package/src/components/description.tsx +60 -0
- package/src/components/dialog.tsx +163 -87
- package/src/components/drawer.tsx +76 -2
- package/src/components/dropdown-menu.tsx +143 -37
- package/src/components/field.tsx +38 -11
- package/src/components/global-layout.tsx +116 -77
- package/src/components/hover-card.tsx +54 -14
- package/src/components/input-group.tsx +56 -18
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +4 -5
- package/src/components/input.tsx +93 -186
- package/src/components/label.tsx +56 -15
- package/src/components/link.tsx +1 -1
- package/src/components/logo.tsx +12 -7
- package/src/components/menubar.tsx +61 -5
- package/src/components/navigation-menu.tsx +37 -99
- package/src/components/pagination.tsx +13 -19
- package/src/components/popover.tsx +103 -20
- package/src/components/progress.tsx +82 -60
- package/src/components/radio-group.tsx +44 -25
- package/src/components/rating.tsx +4 -0
- package/src/components/resizable.tsx +88 -38
- package/src/components/scroll-area.tsx +123 -56
- package/src/components/select.tsx +22 -2
- package/src/components/separator.tsx +101 -24
- package/src/components/sheet.tsx +186 -90
- package/src/components/skeleton.tsx +40 -10
- package/src/components/slider.tsx +83 -57
- package/src/components/sonner.tsx +34 -34
- package/src/components/split-layout.tsx +4 -1
- package/src/components/switch.figma.tsx +7 -11
- package/src/components/switch.tsx +9 -19
- package/src/components/table.tsx +23 -18
- package/src/components/tabs.tsx +27 -3
- package/src/components/toggle-group.tsx +115 -86
- package/src/components/toggle.figma.tsx +13 -19
- package/src/components/toggle.tsx +20 -34
- package/src/index.ts +1 -1
- package/dist/input-base.cjs +0 -1
- package/dist/input-base.d.ts +0 -28
- package/dist/input-base.d.ts.map +0 -1
- package/dist/input-base.js +0 -56
- package/src/components/input-base.tsx +0 -86
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -11,21 +11,13 @@ import {
|
|
|
11
11
|
Minus,
|
|
12
12
|
PanelLeft,
|
|
13
13
|
Ellipsis,
|
|
14
|
-
} from "
|
|
14
|
+
} from "@brightlocal/icons";
|
|
15
15
|
|
|
16
16
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
17
|
-
import {
|
|
18
|
-
Button,
|
|
19
|
-
ButtonSize,
|
|
20
|
-
ButtonVariant,
|
|
21
|
-
} from "../components/button";
|
|
17
|
+
import { Button } from "../components/button";
|
|
22
18
|
import { Input } from "../components/input";
|
|
23
19
|
import { Separator } from "../components/separator";
|
|
24
|
-
import {
|
|
25
|
-
Sheet,
|
|
26
|
-
SheetContent,
|
|
27
|
-
SheetSide,
|
|
28
|
-
} from "../components/sheet";
|
|
20
|
+
import { Sheet, SheetContent } from "../components/sheet";
|
|
29
21
|
import { Skeleton } from "../components/skeleton";
|
|
30
22
|
import {
|
|
31
23
|
Tooltip,
|
|
@@ -406,7 +398,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
406
398
|
data-hook={`${dataHook}-mobile-content`}
|
|
407
399
|
data-mobile="true"
|
|
408
400
|
data-sidebar="sidebar"
|
|
409
|
-
side=
|
|
401
|
+
side="left"
|
|
410
402
|
style={
|
|
411
403
|
{
|
|
412
404
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
@@ -465,80 +457,52 @@ Sidebar.displayName = "Sidebar";
|
|
|
465
457
|
/**
|
|
466
458
|
* Props for the SidebarTrigger component
|
|
467
459
|
*/
|
|
468
|
-
interface SidebarTriggerProps extends
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
*/
|
|
473
|
-
dataHook: string;
|
|
460
|
+
interface SidebarTriggerProps extends Omit<
|
|
461
|
+
React.ComponentProps<typeof Button>,
|
|
462
|
+
"dataHook"
|
|
463
|
+
> {
|
|
474
464
|
/**
|
|
475
|
-
*
|
|
476
|
-
*
|
|
465
|
+
* Data hook for automated testing
|
|
466
|
+
* @default "sidebar-trigger"
|
|
477
467
|
*/
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Tracking label for analytics context
|
|
481
|
-
*/
|
|
482
|
-
trackingLabel?: string;
|
|
468
|
+
dataHook?: string;
|
|
483
469
|
}
|
|
484
470
|
|
|
485
471
|
const SidebarTrigger = React.forwardRef<
|
|
486
472
|
React.ElementRef<typeof Button>,
|
|
487
473
|
SidebarTriggerProps
|
|
488
|
-
>(
|
|
489
|
-
(
|
|
490
|
-
{ dataHook, trackingEl, trackingLabel, className, onClick, ...props },
|
|
491
|
-
ref
|
|
492
|
-
) => {
|
|
493
|
-
const { toggleSidebar } = useSidebar();
|
|
474
|
+
>(({ className, onClick, dataHook = "sidebar-trigger", ...props }, ref) => {
|
|
475
|
+
const { toggleSidebar } = useSidebar();
|
|
494
476
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
>
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
);
|
|
477
|
+
return (
|
|
478
|
+
<Button
|
|
479
|
+
ref={ref}
|
|
480
|
+
aria-label="Toggle Sidebar"
|
|
481
|
+
className={cn("h-7 w-7", className)}
|
|
482
|
+
data-slot="sidebar-trigger"
|
|
483
|
+
dataHook={dataHook}
|
|
484
|
+
size="sm"
|
|
485
|
+
variant="ghost"
|
|
486
|
+
onClick={(event) => {
|
|
487
|
+
onClick?.(event);
|
|
488
|
+
toggleSidebar();
|
|
489
|
+
}}
|
|
490
|
+
{...props}
|
|
491
|
+
>
|
|
492
|
+
<PanelLeft />
|
|
493
|
+
<span className="sr-only">Toggle Sidebar</span>
|
|
494
|
+
</Button>
|
|
495
|
+
);
|
|
496
|
+
});
|
|
518
497
|
SidebarTrigger.displayName = "SidebarTrigger";
|
|
519
498
|
|
|
520
499
|
/**
|
|
521
500
|
* Props for the SidebarRail component
|
|
522
501
|
*/
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Data hook for automated testing (REQUIRED)
|
|
526
|
-
* Used to identify component in tests and E2E automation
|
|
527
|
-
*/
|
|
528
|
-
dataHook: string;
|
|
529
|
-
/**
|
|
530
|
-
* Tracking element identifier for analytics
|
|
531
|
-
* Defaults to "sidebar-rail" if not provided
|
|
532
|
-
*/
|
|
533
|
-
trackingEl?: string;
|
|
534
|
-
/**
|
|
535
|
-
* Tracking label for analytics context
|
|
536
|
-
*/
|
|
537
|
-
trackingLabel?: string;
|
|
538
|
-
}
|
|
502
|
+
type SidebarRailProps = React.ComponentProps<"button">;
|
|
539
503
|
|
|
540
504
|
const SidebarRail = React.forwardRef<HTMLButtonElement, SidebarRailProps>(
|
|
541
|
-
({
|
|
505
|
+
({ className, ...props }, ref) => {
|
|
542
506
|
const { toggleSidebar } = useSidebar();
|
|
543
507
|
|
|
544
508
|
return (
|
|
@@ -553,10 +517,7 @@ const SidebarRail = React.forwardRef<HTMLButtonElement, SidebarRailProps>(
|
|
|
553
517
|
"[[data-collapsible=offcanvas]_&]:-right-2",
|
|
554
518
|
className
|
|
555
519
|
)}
|
|
556
|
-
data-hook={dataHook}
|
|
557
520
|
data-slot="sidebar-rail"
|
|
558
|
-
data-tracking-el={trackingEl || "sidebar-rail"}
|
|
559
|
-
data-tracking-label={trackingLabel}
|
|
560
521
|
tabIndex={-1}
|
|
561
522
|
title="Toggle Sidebar"
|
|
562
523
|
onClick={toggleSidebar}
|
|
@@ -572,10 +533,10 @@ SidebarRail.displayName = "SidebarRail";
|
|
|
572
533
|
*/
|
|
573
534
|
interface SidebarInsetProps extends React.ComponentProps<"main"> {
|
|
574
535
|
/**
|
|
575
|
-
* Data hook for automated testing
|
|
536
|
+
* Data hook for automated testing
|
|
576
537
|
* Used to identify component in tests and E2E automation
|
|
577
538
|
*/
|
|
578
|
-
dataHook
|
|
539
|
+
dataHook?: string;
|
|
579
540
|
/**
|
|
580
541
|
* Tracking element identifier for analytics
|
|
581
542
|
* Defaults to "sidebar-inset" if not provided
|
|
@@ -588,7 +549,7 @@ interface SidebarInsetProps extends React.ComponentProps<"main"> {
|
|
|
588
549
|
}
|
|
589
550
|
|
|
590
551
|
const SidebarInset = React.forwardRef<HTMLDivElement, SidebarInsetProps>(
|
|
591
|
-
({ dataHook, trackingEl, trackingLabel,
|
|
552
|
+
({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
|
|
592
553
|
return (
|
|
593
554
|
<main
|
|
594
555
|
ref={ref}
|
|
@@ -610,27 +571,12 @@ SidebarInset.displayName = "SidebarInset";
|
|
|
610
571
|
/**
|
|
611
572
|
* Props for the SidebarInput component
|
|
612
573
|
*/
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Data hook for automated testing (REQUIRED)
|
|
616
|
-
* Used to identify component in tests and E2E automation
|
|
617
|
-
*/
|
|
618
|
-
dataHook: string;
|
|
619
|
-
/**
|
|
620
|
-
* Tracking element identifier for analytics
|
|
621
|
-
* Defaults to "sidebar-input" if not provided
|
|
622
|
-
*/
|
|
623
|
-
trackingEl?: string;
|
|
624
|
-
/**
|
|
625
|
-
* Tracking label for analytics context
|
|
626
|
-
*/
|
|
627
|
-
trackingLabel?: string;
|
|
628
|
-
}
|
|
574
|
+
type SidebarInputProps = Omit<React.ComponentProps<typeof Input>, "dataHook">;
|
|
629
575
|
|
|
630
576
|
const SidebarInput = React.forwardRef<
|
|
631
577
|
React.ElementRef<typeof Input>,
|
|
632
578
|
SidebarInputProps
|
|
633
|
-
>(({
|
|
579
|
+
>(({ className, ...props }, ref) => {
|
|
634
580
|
return (
|
|
635
581
|
<Input
|
|
636
582
|
ref={ref}
|
|
@@ -639,9 +585,7 @@ const SidebarInput = React.forwardRef<
|
|
|
639
585
|
className
|
|
640
586
|
)}
|
|
641
587
|
data-slot="sidebar-input"
|
|
642
|
-
|
|
643
|
-
data-tracking-label={trackingLabel}
|
|
644
|
-
dataHook={dataHook}
|
|
588
|
+
dataHook="sidebar-input"
|
|
645
589
|
{...props}
|
|
646
590
|
/>
|
|
647
591
|
);
|
|
@@ -652,32 +596,18 @@ SidebarInput.displayName = "SidebarInput";
|
|
|
652
596
|
* Props for the SidebarHeader component
|
|
653
597
|
*/
|
|
654
598
|
interface SidebarHeaderProps extends React.ComponentProps<"div"> {
|
|
655
|
-
/**
|
|
656
|
-
|
|
657
|
-
* Used to identify component in tests and E2E automation
|
|
658
|
-
*/
|
|
659
|
-
dataHook: string;
|
|
660
|
-
/**
|
|
661
|
-
* Tracking element identifier for analytics
|
|
662
|
-
* Defaults to "sidebar-header" if not provided
|
|
663
|
-
*/
|
|
664
|
-
trackingEl?: string;
|
|
665
|
-
/**
|
|
666
|
-
* Tracking label for analytics context
|
|
667
|
-
*/
|
|
668
|
-
trackingLabel?: string;
|
|
599
|
+
/** Data hook for automated testing */
|
|
600
|
+
dataHook?: string;
|
|
669
601
|
}
|
|
670
602
|
|
|
671
603
|
const SidebarHeader = React.forwardRef<HTMLDivElement, SidebarHeaderProps>(
|
|
672
|
-
({
|
|
604
|
+
({ className, dataHook, ...props }, ref) => {
|
|
673
605
|
return (
|
|
674
606
|
<div
|
|
675
607
|
ref={ref}
|
|
676
608
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
677
609
|
data-hook={dataHook}
|
|
678
610
|
data-slot="sidebar-header"
|
|
679
|
-
data-tracking-el={trackingEl || "sidebar-header"}
|
|
680
|
-
data-tracking-label={trackingLabel}
|
|
681
611
|
{...props}
|
|
682
612
|
/>
|
|
683
613
|
);
|
|
@@ -689,32 +619,18 @@ SidebarHeader.displayName = "SidebarHeader";
|
|
|
689
619
|
* Props for the SidebarFooter component
|
|
690
620
|
*/
|
|
691
621
|
interface SidebarFooterProps extends React.ComponentProps<"div"> {
|
|
692
|
-
/**
|
|
693
|
-
|
|
694
|
-
* Used to identify component in tests and E2E automation
|
|
695
|
-
*/
|
|
696
|
-
dataHook: string;
|
|
697
|
-
/**
|
|
698
|
-
* Tracking element identifier for analytics
|
|
699
|
-
* Defaults to "sidebar-footer" if not provided
|
|
700
|
-
*/
|
|
701
|
-
trackingEl?: string;
|
|
702
|
-
/**
|
|
703
|
-
* Tracking label for analytics context
|
|
704
|
-
*/
|
|
705
|
-
trackingLabel?: string;
|
|
622
|
+
/** Data hook for automated testing */
|
|
623
|
+
dataHook?: string;
|
|
706
624
|
}
|
|
707
625
|
|
|
708
626
|
const SidebarFooter = React.forwardRef<HTMLDivElement, SidebarFooterProps>(
|
|
709
|
-
({
|
|
627
|
+
({ className, dataHook, ...props }, ref) => {
|
|
710
628
|
return (
|
|
711
629
|
<div
|
|
712
630
|
ref={ref}
|
|
713
631
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
714
632
|
data-hook={dataHook}
|
|
715
633
|
data-slot="sidebar-footer"
|
|
716
|
-
data-tracking-el={trackingEl || "sidebar-footer"}
|
|
717
|
-
data-tracking-label={trackingLabel}
|
|
718
634
|
{...props}
|
|
719
635
|
/>
|
|
720
636
|
);
|
|
@@ -725,27 +641,12 @@ SidebarFooter.displayName = "SidebarFooter";
|
|
|
725
641
|
/**
|
|
726
642
|
* Props for the SidebarSeparator component
|
|
727
643
|
*/
|
|
728
|
-
|
|
729
|
-
/**
|
|
730
|
-
* Data hook for automated testing (REQUIRED)
|
|
731
|
-
* Used to identify component in tests and E2E automation
|
|
732
|
-
*/
|
|
733
|
-
dataHook: string;
|
|
734
|
-
/**
|
|
735
|
-
* Tracking element identifier for analytics
|
|
736
|
-
* Defaults to "sidebar-separator" if not provided
|
|
737
|
-
*/
|
|
738
|
-
trackingEl?: string;
|
|
739
|
-
/**
|
|
740
|
-
* Tracking label for analytics context
|
|
741
|
-
*/
|
|
742
|
-
trackingLabel?: string;
|
|
743
|
-
}
|
|
644
|
+
type SidebarSeparatorProps = React.ComponentProps<typeof Separator>;
|
|
744
645
|
|
|
745
646
|
const SidebarSeparator = React.forwardRef<
|
|
746
647
|
React.ElementRef<typeof Separator>,
|
|
747
648
|
SidebarSeparatorProps
|
|
748
|
-
>(({
|
|
649
|
+
>(({ className, ...props }, ref) => {
|
|
749
650
|
return (
|
|
750
651
|
<Separator
|
|
751
652
|
ref={ref}
|
|
@@ -753,10 +654,7 @@ const SidebarSeparator = React.forwardRef<
|
|
|
753
654
|
"bg-sidebar-border mx-2 w-auto group-data-[collapsible=icon]:mx-0",
|
|
754
655
|
className
|
|
755
656
|
)}
|
|
756
|
-
data-hook={dataHook}
|
|
757
657
|
data-slot="sidebar-separator"
|
|
758
|
-
data-tracking-el={trackingEl || "sidebar-separator"}
|
|
759
|
-
data-tracking-label={trackingLabel}
|
|
760
658
|
{...props}
|
|
761
659
|
/>
|
|
762
660
|
);
|
|
@@ -767,24 +665,12 @@ SidebarSeparator.displayName = "SidebarSeparator";
|
|
|
767
665
|
* Props for the SidebarContent component
|
|
768
666
|
*/
|
|
769
667
|
interface SidebarContentProps extends React.ComponentProps<"div"> {
|
|
770
|
-
/**
|
|
771
|
-
|
|
772
|
-
* Used to identify component in tests and E2E automation
|
|
773
|
-
*/
|
|
774
|
-
dataHook: string;
|
|
775
|
-
/**
|
|
776
|
-
* Tracking element identifier for analytics
|
|
777
|
-
* Defaults to "sidebar-content" if not provided
|
|
778
|
-
*/
|
|
779
|
-
trackingEl?: string;
|
|
780
|
-
/**
|
|
781
|
-
* Tracking label for analytics context
|
|
782
|
-
*/
|
|
783
|
-
trackingLabel?: string;
|
|
668
|
+
/** Data hook for automated testing */
|
|
669
|
+
dataHook?: string;
|
|
784
670
|
}
|
|
785
671
|
|
|
786
672
|
const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
787
|
-
({
|
|
673
|
+
({ className, dataHook, ...props }, ref) => {
|
|
788
674
|
return (
|
|
789
675
|
<div
|
|
790
676
|
ref={ref}
|
|
@@ -794,8 +680,6 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
794
680
|
)}
|
|
795
681
|
data-hook={dataHook}
|
|
796
682
|
data-slot="sidebar-content"
|
|
797
|
-
data-tracking-el={trackingEl || "sidebar-content"}
|
|
798
|
-
data-tracking-label={trackingLabel}
|
|
799
683
|
{...props}
|
|
800
684
|
/>
|
|
801
685
|
);
|
|
@@ -807,32 +691,18 @@ SidebarContent.displayName = "SidebarContent";
|
|
|
807
691
|
* Props for the SidebarGroup component
|
|
808
692
|
*/
|
|
809
693
|
interface SidebarGroupProps extends React.ComponentProps<"div"> {
|
|
810
|
-
/**
|
|
811
|
-
|
|
812
|
-
* Used to identify component in tests and E2E automation
|
|
813
|
-
*/
|
|
814
|
-
dataHook: string;
|
|
815
|
-
/**
|
|
816
|
-
* Tracking element identifier for analytics
|
|
817
|
-
* Defaults to "sidebar-group" if not provided
|
|
818
|
-
*/
|
|
819
|
-
trackingEl?: string;
|
|
820
|
-
/**
|
|
821
|
-
* Tracking label for analytics context
|
|
822
|
-
*/
|
|
823
|
-
trackingLabel?: string;
|
|
694
|
+
/** Data hook for automated testing */
|
|
695
|
+
dataHook?: string;
|
|
824
696
|
}
|
|
825
697
|
|
|
826
698
|
const SidebarGroup = React.forwardRef<HTMLDivElement, SidebarGroupProps>(
|
|
827
|
-
({
|
|
699
|
+
({ className, dataHook, ...props }, ref) => {
|
|
828
700
|
return (
|
|
829
701
|
<div
|
|
830
702
|
ref={ref}
|
|
831
703
|
className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
|
|
832
704
|
data-hook={dataHook}
|
|
833
705
|
data-slot="sidebar-group"
|
|
834
|
-
data-tracking-el={trackingEl || "sidebar-group"}
|
|
835
|
-
data-tracking-label={trackingLabel}
|
|
836
706
|
{...props}
|
|
837
707
|
/>
|
|
838
708
|
);
|
|
@@ -871,20 +741,8 @@ interface SidebarGroupLabelProps
|
|
|
871
741
|
extends
|
|
872
742
|
React.ComponentProps<"div">,
|
|
873
743
|
VariantProps<typeof sidebarGroupLabelVariants> {
|
|
874
|
-
/**
|
|
875
|
-
|
|
876
|
-
* Used to identify component in tests and E2E automation
|
|
877
|
-
*/
|
|
878
|
-
dataHook: string;
|
|
879
|
-
/**
|
|
880
|
-
* Tracking element identifier for analytics
|
|
881
|
-
* Defaults to "sidebar-group-label" if not provided
|
|
882
|
-
*/
|
|
883
|
-
trackingEl?: string;
|
|
884
|
-
/**
|
|
885
|
-
* Tracking label for analytics context
|
|
886
|
-
*/
|
|
887
|
-
trackingLabel?: string;
|
|
744
|
+
/** Data hook for automated testing */
|
|
745
|
+
dataHook?: string;
|
|
888
746
|
/**
|
|
889
747
|
* Render as a different element (Radix Slot pattern)
|
|
890
748
|
*/
|
|
@@ -919,10 +777,8 @@ const SidebarGroupLabel = React.forwardRef<
|
|
|
919
777
|
>(
|
|
920
778
|
(
|
|
921
779
|
{
|
|
922
|
-
dataHook,
|
|
923
|
-
trackingEl,
|
|
924
|
-
trackingLabel,
|
|
925
780
|
className,
|
|
781
|
+
dataHook,
|
|
926
782
|
asChild = false,
|
|
927
783
|
size = SidebarGroupLabelSize.SM,
|
|
928
784
|
variant = SidebarGroupLabelVariant.DEFAULT,
|
|
@@ -957,8 +813,6 @@ const SidebarGroupLabel = React.forwardRef<
|
|
|
957
813
|
className={cn(sidebarGroupLabelVariants({ size, variant }), className)}
|
|
958
814
|
data-hook={dataHook}
|
|
959
815
|
data-slot="sidebar-group-label"
|
|
960
|
-
data-tracking-el={trackingEl || "sidebar-group-label"}
|
|
961
|
-
data-tracking-label={trackingLabel}
|
|
962
816
|
data-variant={variant}
|
|
963
817
|
role={
|
|
964
818
|
variant !== SidebarGroupLabelVariant.DEFAULT ? "button" : undefined
|
|
@@ -996,20 +850,6 @@ SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
|
996
850
|
* Props for the SidebarGroupAction component
|
|
997
851
|
*/
|
|
998
852
|
interface SidebarGroupActionProps extends React.ComponentProps<"button"> {
|
|
999
|
-
/**
|
|
1000
|
-
* Data hook for automated testing (REQUIRED)
|
|
1001
|
-
* Used to identify component in tests and E2E automation
|
|
1002
|
-
*/
|
|
1003
|
-
dataHook: string;
|
|
1004
|
-
/**
|
|
1005
|
-
* Tracking element identifier for analytics
|
|
1006
|
-
* Defaults to "sidebar-group-action" if not provided
|
|
1007
|
-
*/
|
|
1008
|
-
trackingEl?: string;
|
|
1009
|
-
/**
|
|
1010
|
-
* Tracking label for analytics context
|
|
1011
|
-
*/
|
|
1012
|
-
trackingLabel?: string;
|
|
1013
853
|
/**
|
|
1014
854
|
* Render as a different element (Radix Slot pattern)
|
|
1015
855
|
*/
|
|
@@ -1019,72 +859,43 @@ interface SidebarGroupActionProps extends React.ComponentProps<"button"> {
|
|
|
1019
859
|
const SidebarGroupAction = React.forwardRef<
|
|
1020
860
|
HTMLButtonElement,
|
|
1021
861
|
SidebarGroupActionProps
|
|
1022
|
-
>(
|
|
1023
|
-
|
|
1024
|
-
{
|
|
1025
|
-
dataHook,
|
|
1026
|
-
trackingEl,
|
|
1027
|
-
trackingLabel,
|
|
1028
|
-
className,
|
|
1029
|
-
asChild = false,
|
|
1030
|
-
...props
|
|
1031
|
-
},
|
|
1032
|
-
ref
|
|
1033
|
-
) => {
|
|
1034
|
-
const Comp = asChild ? Slot : "button";
|
|
862
|
+
>(({ className, asChild = false, ...props }, ref) => {
|
|
863
|
+
const Comp = asChild ? Slot : "button";
|
|
1035
864
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
/>
|
|
1052
|
-
);
|
|
1053
|
-
}
|
|
1054
|
-
);
|
|
865
|
+
return (
|
|
866
|
+
<Comp
|
|
867
|
+
ref={ref}
|
|
868
|
+
className={cn(
|
|
869
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
870
|
+
// Increases the hit area of the button on mobile.
|
|
871
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
872
|
+
"group-data-[collapsible=icon]:hidden",
|
|
873
|
+
className
|
|
874
|
+
)}
|
|
875
|
+
data-slot="sidebar-group-action"
|
|
876
|
+
{...props}
|
|
877
|
+
/>
|
|
878
|
+
);
|
|
879
|
+
});
|
|
1055
880
|
SidebarGroupAction.displayName = "SidebarGroupAction";
|
|
1056
881
|
|
|
1057
882
|
/**
|
|
1058
883
|
* Props for the SidebarGroupContent component
|
|
1059
884
|
*/
|
|
1060
885
|
interface SidebarGroupContentProps extends React.ComponentProps<"div"> {
|
|
1061
|
-
/**
|
|
1062
|
-
|
|
1063
|
-
* Used to identify component in tests and E2E automation
|
|
1064
|
-
*/
|
|
1065
|
-
dataHook: string;
|
|
1066
|
-
/**
|
|
1067
|
-
* Tracking element identifier for analytics
|
|
1068
|
-
* Defaults to "sidebar-group-content" if not provided
|
|
1069
|
-
*/
|
|
1070
|
-
trackingEl?: string;
|
|
1071
|
-
/**
|
|
1072
|
-
* Tracking label for analytics context
|
|
1073
|
-
*/
|
|
1074
|
-
trackingLabel?: string;
|
|
886
|
+
/** Data hook for automated testing */
|
|
887
|
+
dataHook?: string;
|
|
1075
888
|
}
|
|
1076
889
|
|
|
1077
890
|
const SidebarGroupContent = React.forwardRef<
|
|
1078
891
|
HTMLDivElement,
|
|
1079
892
|
SidebarGroupContentProps
|
|
1080
|
-
>(({
|
|
893
|
+
>(({ className, dataHook, ...props }, ref) => (
|
|
1081
894
|
<div
|
|
1082
895
|
ref={ref}
|
|
1083
896
|
className={cn("w-full text-sm", className)}
|
|
1084
897
|
data-hook={dataHook}
|
|
1085
898
|
data-slot="sidebar-group-content"
|
|
1086
|
-
data-tracking-el={trackingEl || "sidebar-group-content"}
|
|
1087
|
-
data-tracking-label={trackingLabel}
|
|
1088
899
|
{...props}
|
|
1089
900
|
/>
|
|
1090
901
|
));
|
|
@@ -1094,31 +905,17 @@ SidebarGroupContent.displayName = "SidebarGroupContent";
|
|
|
1094
905
|
* Props for the SidebarMenu component
|
|
1095
906
|
*/
|
|
1096
907
|
interface SidebarMenuProps extends React.ComponentProps<"ul"> {
|
|
1097
|
-
/**
|
|
1098
|
-
|
|
1099
|
-
* Used to identify component in tests and E2E automation
|
|
1100
|
-
*/
|
|
1101
|
-
dataHook: string;
|
|
1102
|
-
/**
|
|
1103
|
-
* Tracking element identifier for analytics
|
|
1104
|
-
* Defaults to "sidebar-menu" if not provided
|
|
1105
|
-
*/
|
|
1106
|
-
trackingEl?: string;
|
|
1107
|
-
/**
|
|
1108
|
-
* Tracking label for analytics context
|
|
1109
|
-
*/
|
|
1110
|
-
trackingLabel?: string;
|
|
908
|
+
/** Data hook for automated testing */
|
|
909
|
+
dataHook?: string;
|
|
1111
910
|
}
|
|
1112
911
|
|
|
1113
912
|
const SidebarMenu = React.forwardRef<HTMLUListElement, SidebarMenuProps>(
|
|
1114
|
-
({
|
|
913
|
+
({ className, dataHook, ...props }, ref) => (
|
|
1115
914
|
<ul
|
|
1116
915
|
ref={ref}
|
|
1117
916
|
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
1118
917
|
data-hook={dataHook}
|
|
1119
918
|
data-slot="sidebar-menu"
|
|
1120
|
-
data-tracking-el={trackingEl || "sidebar-menu"}
|
|
1121
|
-
data-tracking-label={trackingLabel}
|
|
1122
919
|
{...props}
|
|
1123
920
|
/>
|
|
1124
921
|
)
|
|
@@ -1129,31 +926,17 @@ SidebarMenu.displayName = "SidebarMenu";
|
|
|
1129
926
|
* Props for the SidebarMenuItem component
|
|
1130
927
|
*/
|
|
1131
928
|
interface SidebarMenuItemProps extends React.ComponentProps<"li"> {
|
|
1132
|
-
/**
|
|
1133
|
-
|
|
1134
|
-
* Used to identify component in tests and E2E automation
|
|
1135
|
-
*/
|
|
1136
|
-
dataHook: string;
|
|
1137
|
-
/**
|
|
1138
|
-
* Tracking element identifier for analytics
|
|
1139
|
-
* Defaults to "sidebar-menu-item" if not provided
|
|
1140
|
-
*/
|
|
1141
|
-
trackingEl?: string;
|
|
1142
|
-
/**
|
|
1143
|
-
* Tracking label for analytics context
|
|
1144
|
-
*/
|
|
1145
|
-
trackingLabel?: string;
|
|
929
|
+
/** Data hook for automated testing */
|
|
930
|
+
dataHook?: string;
|
|
1146
931
|
}
|
|
1147
932
|
|
|
1148
933
|
const SidebarMenuItem = React.forwardRef<HTMLLIElement, SidebarMenuItemProps>(
|
|
1149
|
-
({
|
|
934
|
+
({ className, dataHook, ...props }, ref) => (
|
|
1150
935
|
<li
|
|
1151
936
|
ref={ref}
|
|
1152
937
|
className={cn("group/menu-item relative", className)}
|
|
1153
938
|
data-hook={dataHook}
|
|
1154
939
|
data-slot="sidebar-menu-item"
|
|
1155
|
-
data-tracking-el={trackingEl || "sidebar-menu-item"}
|
|
1156
|
-
data-tracking-label={trackingLabel}
|
|
1157
940
|
{...props}
|
|
1158
941
|
/>
|
|
1159
942
|
)
|
|
@@ -1164,20 +947,6 @@ SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
|
1164
947
|
* Props for the SidebarCollapseIcon component
|
|
1165
948
|
*/
|
|
1166
949
|
interface SidebarCollapseIconProps extends React.ComponentProps<"svg"> {
|
|
1167
|
-
/**
|
|
1168
|
-
* Data hook for automated testing (REQUIRED)
|
|
1169
|
-
* Used to identify component in tests and E2E automation
|
|
1170
|
-
*/
|
|
1171
|
-
dataHook: string;
|
|
1172
|
-
/**
|
|
1173
|
-
* Tracking element identifier for analytics
|
|
1174
|
-
* Defaults to "sidebar-collapse-icon" if not provided
|
|
1175
|
-
*/
|
|
1176
|
-
trackingEl?: string;
|
|
1177
|
-
/**
|
|
1178
|
-
* Tracking label for analytics context
|
|
1179
|
-
*/
|
|
1180
|
-
trackingLabel?: string;
|
|
1181
950
|
/**
|
|
1182
951
|
* Icon type variant
|
|
1183
952
|
* @default SidebarCollapseIconType.CARET
|
|
@@ -1195,9 +964,6 @@ const SidebarCollapseIcon = React.forwardRef<
|
|
|
1195
964
|
>(
|
|
1196
965
|
(
|
|
1197
966
|
{
|
|
1198
|
-
dataHook,
|
|
1199
|
-
trackingEl,
|
|
1200
|
-
trackingLabel,
|
|
1201
967
|
type = SidebarCollapseIconType.CARET,
|
|
1202
968
|
isActive = false,
|
|
1203
969
|
className,
|
|
@@ -1212,10 +978,7 @@ const SidebarCollapseIcon = React.forwardRef<
|
|
|
1212
978
|
isActive && type === SidebarCollapseIconType.CARET && "rotate-90",
|
|
1213
979
|
className
|
|
1214
980
|
),
|
|
1215
|
-
"data-hook": dataHook,
|
|
1216
981
|
"data-slot": "sidebar-collapse-icon",
|
|
1217
|
-
"data-tracking-el": trackingEl || "sidebar-collapse-icon",
|
|
1218
|
-
"data-tracking-label": trackingLabel,
|
|
1219
982
|
...props,
|
|
1220
983
|
};
|
|
1221
984
|
|
|
@@ -1281,20 +1044,8 @@ interface SidebarMenuButtonProps
|
|
|
1281
1044
|
extends
|
|
1282
1045
|
React.ComponentProps<"button">,
|
|
1283
1046
|
VariantProps<typeof sidebarMenuButtonVariants> {
|
|
1284
|
-
/**
|
|
1285
|
-
|
|
1286
|
-
* Used to identify component in tests and E2E automation
|
|
1287
|
-
*/
|
|
1288
|
-
dataHook: string;
|
|
1289
|
-
/**
|
|
1290
|
-
* Tracking element identifier for analytics
|
|
1291
|
-
* Defaults to "sidebar-menu-button" if not provided
|
|
1292
|
-
*/
|
|
1293
|
-
trackingEl?: string;
|
|
1294
|
-
/**
|
|
1295
|
-
* Tracking label for analytics context
|
|
1296
|
-
*/
|
|
1297
|
-
trackingLabel?: string;
|
|
1047
|
+
/** Data hook for automated testing */
|
|
1048
|
+
dataHook?: string;
|
|
1298
1049
|
/**
|
|
1299
1050
|
* Render as a different element (Radix Slot pattern)
|
|
1300
1051
|
*/
|
|
@@ -1325,15 +1076,13 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
1325
1076
|
>(
|
|
1326
1077
|
(
|
|
1327
1078
|
{
|
|
1328
|
-
dataHook,
|
|
1329
|
-
trackingEl,
|
|
1330
|
-
trackingLabel,
|
|
1331
1079
|
asChild = false,
|
|
1332
1080
|
isActive = false,
|
|
1333
1081
|
variant = SidebarMenuButtonVariant.SIMPLE,
|
|
1334
1082
|
size = SidebarMenuButtonSize.DEFAULT,
|
|
1335
1083
|
tooltip,
|
|
1336
1084
|
className,
|
|
1085
|
+
dataHook,
|
|
1337
1086
|
...props
|
|
1338
1087
|
},
|
|
1339
1088
|
ref
|
|
@@ -1349,8 +1098,6 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
1349
1098
|
data-hook={dataHook}
|
|
1350
1099
|
data-size={size}
|
|
1351
1100
|
data-slot="sidebar-menu-button"
|
|
1352
|
-
data-tracking-el={trackingEl || "sidebar-menu-button"}
|
|
1353
|
-
data-tracking-label={trackingLabel}
|
|
1354
1101
|
data-variant={variant}
|
|
1355
1102
|
{...props}
|
|
1356
1103
|
/>
|
|
@@ -1363,7 +1110,7 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
1363
1110
|
if (typeof tooltip === "string") {
|
|
1364
1111
|
tooltip = {
|
|
1365
1112
|
children: tooltip,
|
|
1366
|
-
dataHook:
|
|
1113
|
+
dataHook: "sidebar-menu-button-tooltip",
|
|
1367
1114
|
};
|
|
1368
1115
|
}
|
|
1369
1116
|
|
|
@@ -1392,20 +1139,6 @@ SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
|
1392
1139
|
* Props for the SidebarMenuAction component
|
|
1393
1140
|
*/
|
|
1394
1141
|
interface SidebarMenuActionProps extends React.ComponentProps<"button"> {
|
|
1395
|
-
/**
|
|
1396
|
-
* Data hook for automated testing (REQUIRED)
|
|
1397
|
-
* Used to identify component in tests and E2E automation
|
|
1398
|
-
*/
|
|
1399
|
-
dataHook: string;
|
|
1400
|
-
/**
|
|
1401
|
-
* Tracking element identifier for analytics
|
|
1402
|
-
* Defaults to "sidebar-menu-action" if not provided
|
|
1403
|
-
*/
|
|
1404
|
-
trackingEl?: string;
|
|
1405
|
-
/**
|
|
1406
|
-
* Tracking label for analytics context
|
|
1407
|
-
*/
|
|
1408
|
-
trackingLabel?: string;
|
|
1409
1142
|
/**
|
|
1410
1143
|
* Render as a different element (Radix Slot pattern)
|
|
1411
1144
|
*/
|
|
@@ -1419,73 +1152,42 @@ interface SidebarMenuActionProps extends React.ComponentProps<"button"> {
|
|
|
1419
1152
|
const SidebarMenuAction = React.forwardRef<
|
|
1420
1153
|
HTMLButtonElement,
|
|
1421
1154
|
SidebarMenuActionProps
|
|
1422
|
-
>(
|
|
1423
|
-
|
|
1424
|
-
{
|
|
1425
|
-
dataHook,
|
|
1426
|
-
trackingEl,
|
|
1427
|
-
trackingLabel,
|
|
1428
|
-
className,
|
|
1429
|
-
asChild = false,
|
|
1430
|
-
showOnHover = false,
|
|
1431
|
-
...props
|
|
1432
|
-
},
|
|
1433
|
-
ref
|
|
1434
|
-
) => {
|
|
1435
|
-
const Comp = asChild ? Slot : "button";
|
|
1155
|
+
>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
1156
|
+
const Comp = asChild ? Slot : "button";
|
|
1436
1157
|
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
/>
|
|
1460
|
-
);
|
|
1461
|
-
}
|
|
1462
|
-
);
|
|
1158
|
+
return (
|
|
1159
|
+
<Comp
|
|
1160
|
+
ref={ref}
|
|
1161
|
+
className={cn(
|
|
1162
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
1163
|
+
// Increases the hit area of the button on mobile.
|
|
1164
|
+
"after:absolute after:-inset-2 after:md:hidden",
|
|
1165
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
1166
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
1167
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
1168
|
+
"peer-data-[size=bigIcon]/menu-button:top-2.5",
|
|
1169
|
+
"peer-data-[size=tree]/menu-button:top-1.5",
|
|
1170
|
+
"group-data-[collapsible=icon]:hidden",
|
|
1171
|
+
showOnHover &&
|
|
1172
|
+
"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
|
|
1173
|
+
className
|
|
1174
|
+
)}
|
|
1175
|
+
data-slot="sidebar-menu-action"
|
|
1176
|
+
{...props}
|
|
1177
|
+
/>
|
|
1178
|
+
);
|
|
1179
|
+
});
|
|
1463
1180
|
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
1464
1181
|
|
|
1465
1182
|
/**
|
|
1466
1183
|
* Props for the SidebarMenuBadge component
|
|
1467
1184
|
*/
|
|
1468
|
-
|
|
1469
|
-
/**
|
|
1470
|
-
* Data hook for automated testing (REQUIRED)
|
|
1471
|
-
* Used to identify component in tests and E2E automation
|
|
1472
|
-
*/
|
|
1473
|
-
dataHook: string;
|
|
1474
|
-
/**
|
|
1475
|
-
* Tracking element identifier for analytics
|
|
1476
|
-
* Defaults to "sidebar-menu-badge" if not provided
|
|
1477
|
-
*/
|
|
1478
|
-
trackingEl?: string;
|
|
1479
|
-
/**
|
|
1480
|
-
* Tracking label for analytics context
|
|
1481
|
-
*/
|
|
1482
|
-
trackingLabel?: string;
|
|
1483
|
-
}
|
|
1185
|
+
type SidebarMenuBadgeProps = React.ComponentProps<"div">;
|
|
1484
1186
|
|
|
1485
1187
|
const SidebarMenuBadge = React.forwardRef<
|
|
1486
1188
|
HTMLDivElement,
|
|
1487
1189
|
SidebarMenuBadgeProps
|
|
1488
|
-
>(({
|
|
1190
|
+
>(({ className, ...props }, ref) => (
|
|
1489
1191
|
<div
|
|
1490
1192
|
ref={ref}
|
|
1491
1193
|
className={cn(
|
|
@@ -1499,10 +1201,7 @@ const SidebarMenuBadge = React.forwardRef<
|
|
|
1499
1201
|
"group-data-[collapsible=icon]:hidden",
|
|
1500
1202
|
className
|
|
1501
1203
|
)}
|
|
1502
|
-
data-hook={dataHook}
|
|
1503
1204
|
data-slot="sidebar-menu-badge"
|
|
1504
|
-
data-tracking-el={trackingEl || "sidebar-menu-badge"}
|
|
1505
|
-
data-tracking-label={trackingLabel}
|
|
1506
1205
|
{...props}
|
|
1507
1206
|
/>
|
|
1508
1207
|
));
|
|
@@ -1512,20 +1211,6 @@ SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
|
1512
1211
|
* Props for the SidebarMenuSkeleton component
|
|
1513
1212
|
*/
|
|
1514
1213
|
interface SidebarMenuSkeletonProps extends React.ComponentProps<"div"> {
|
|
1515
|
-
/**
|
|
1516
|
-
* Data hook for automated testing (REQUIRED)
|
|
1517
|
-
* Used to identify component in tests and E2E automation
|
|
1518
|
-
*/
|
|
1519
|
-
dataHook: string;
|
|
1520
|
-
/**
|
|
1521
|
-
* Tracking element identifier for analytics
|
|
1522
|
-
* Defaults to "sidebar-menu-skeleton" if not provided
|
|
1523
|
-
*/
|
|
1524
|
-
trackingEl?: string;
|
|
1525
|
-
/**
|
|
1526
|
-
* Tracking label for analytics context
|
|
1527
|
-
*/
|
|
1528
|
-
trackingLabel?: string;
|
|
1529
1214
|
/**
|
|
1530
1215
|
* Show icon skeleton placeholder
|
|
1531
1216
|
*/
|
|
@@ -1535,61 +1220,44 @@ interface SidebarMenuSkeletonProps extends React.ComponentProps<"div"> {
|
|
|
1535
1220
|
const SidebarMenuSkeleton = React.forwardRef<
|
|
1536
1221
|
HTMLDivElement,
|
|
1537
1222
|
SidebarMenuSkeletonProps
|
|
1538
|
-
>(
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
)
|
|
1550
|
-
// Generate a stable random-looking width using useId
|
|
1551
|
-
const id = React.useId();
|
|
1552
|
-
const width = React.useMemo(() => {
|
|
1553
|
-
// Simple hash from id to get a deterministic "random" width between 50-90%
|
|
1554
|
-
let hash = 0;
|
|
1555
|
-
for (let i = 0; i < id.length; i++) {
|
|
1556
|
-
hash = (hash << 5) - hash + id.charCodeAt(i);
|
|
1557
|
-
hash |= 0;
|
|
1558
|
-
}
|
|
1559
|
-
return `${(Math.abs(hash) % 40) + 50}%`;
|
|
1560
|
-
}, [id]);
|
|
1223
|
+
>(({ className, showIcon = false, ...props }, ref) => {
|
|
1224
|
+
// Generate a stable random-looking width using useId
|
|
1225
|
+
const id = React.useId();
|
|
1226
|
+
const width = React.useMemo(() => {
|
|
1227
|
+
// Simple hash from id to get a deterministic "random" width between 50-90%
|
|
1228
|
+
let hash = 0;
|
|
1229
|
+
for (let i = 0; i < id.length; i++) {
|
|
1230
|
+
hash = (hash << 5) - hash + id.charCodeAt(i);
|
|
1231
|
+
hash |= 0;
|
|
1232
|
+
}
|
|
1233
|
+
return `${(Math.abs(hash) % 40) + 50}%`;
|
|
1234
|
+
}, [id]);
|
|
1561
1235
|
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
{...props}
|
|
1571
|
-
>
|
|
1572
|
-
{showIcon && (
|
|
1573
|
-
<Skeleton
|
|
1574
|
-
className="size-4 rounded-md"
|
|
1575
|
-
data-hook={`${dataHook}-icon`}
|
|
1576
|
-
data-slot="sidebar-menu-skeleton-icon"
|
|
1577
|
-
/>
|
|
1578
|
-
)}
|
|
1236
|
+
return (
|
|
1237
|
+
<div
|
|
1238
|
+
ref={ref}
|
|
1239
|
+
className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
|
|
1240
|
+
data-slot="sidebar-menu-skeleton"
|
|
1241
|
+
{...props}
|
|
1242
|
+
>
|
|
1243
|
+
{showIcon && (
|
|
1579
1244
|
<Skeleton
|
|
1580
|
-
className="
|
|
1581
|
-
data-
|
|
1582
|
-
data-slot="sidebar-menu-skeleton-text"
|
|
1583
|
-
style={
|
|
1584
|
-
{
|
|
1585
|
-
"--skeleton-width": width,
|
|
1586
|
-
} as React.CSSProperties
|
|
1587
|
-
}
|
|
1245
|
+
className="size-4 rounded-md"
|
|
1246
|
+
data-slot="sidebar-menu-skeleton-icon"
|
|
1588
1247
|
/>
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1248
|
+
)}
|
|
1249
|
+
<Skeleton
|
|
1250
|
+
className="h-4 max-w-[--skeleton-width] flex-1"
|
|
1251
|
+
data-slot="sidebar-menu-skeleton-text"
|
|
1252
|
+
style={
|
|
1253
|
+
{
|
|
1254
|
+
"--skeleton-width": width,
|
|
1255
|
+
} as React.CSSProperties
|
|
1256
|
+
}
|
|
1257
|
+
/>
|
|
1258
|
+
</div>
|
|
1259
|
+
);
|
|
1260
|
+
});
|
|
1593
1261
|
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
1594
1262
|
|
|
1595
1263
|
const sidebarMenuSubVariants = cva(
|
|
@@ -1615,20 +1283,8 @@ interface SidebarMenuSubProps
|
|
|
1615
1283
|
extends
|
|
1616
1284
|
React.ComponentProps<"ul">,
|
|
1617
1285
|
VariantProps<typeof sidebarMenuSubVariants> {
|
|
1618
|
-
/**
|
|
1619
|
-
|
|
1620
|
-
* Used to identify component in tests and E2E automation
|
|
1621
|
-
*/
|
|
1622
|
-
dataHook: string;
|
|
1623
|
-
/**
|
|
1624
|
-
* Tracking element identifier for analytics
|
|
1625
|
-
* Defaults to "sidebar-menu-sub" if not provided
|
|
1626
|
-
*/
|
|
1627
|
-
trackingEl?: string;
|
|
1628
|
-
/**
|
|
1629
|
-
* Tracking label for analytics context
|
|
1630
|
-
*/
|
|
1631
|
-
trackingLabel?: string;
|
|
1286
|
+
/** Data hook for automated testing */
|
|
1287
|
+
dataHook?: string;
|
|
1632
1288
|
/**
|
|
1633
1289
|
* Visual variant
|
|
1634
1290
|
* @default SidebarMenuSubVariant.BORDER
|
|
@@ -1638,14 +1294,7 @@ interface SidebarMenuSubProps
|
|
|
1638
1294
|
|
|
1639
1295
|
const SidebarMenuSub = React.forwardRef<HTMLUListElement, SidebarMenuSubProps>(
|
|
1640
1296
|
(
|
|
1641
|
-
{
|
|
1642
|
-
dataHook,
|
|
1643
|
-
trackingEl,
|
|
1644
|
-
trackingLabel,
|
|
1645
|
-
className,
|
|
1646
|
-
variant = SidebarMenuSubVariant.BORDER,
|
|
1647
|
-
...props
|
|
1648
|
-
},
|
|
1297
|
+
{ className, variant = SidebarMenuSubVariant.BORDER, dataHook, ...props },
|
|
1649
1298
|
ref
|
|
1650
1299
|
) => (
|
|
1651
1300
|
<ul
|
|
@@ -1653,8 +1302,6 @@ const SidebarMenuSub = React.forwardRef<HTMLUListElement, SidebarMenuSubProps>(
|
|
|
1653
1302
|
className={cn(sidebarMenuSubVariants({ variant }), className)}
|
|
1654
1303
|
data-hook={dataHook}
|
|
1655
1304
|
data-slot="sidebar-menu-sub"
|
|
1656
|
-
data-tracking-el={trackingEl || "sidebar-menu-sub"}
|
|
1657
|
-
data-tracking-label={trackingLabel}
|
|
1658
1305
|
{...props}
|
|
1659
1306
|
/>
|
|
1660
1307
|
)
|
|
@@ -1665,32 +1312,18 @@ SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
|
1665
1312
|
* Props for the SidebarMenuSubItem component
|
|
1666
1313
|
*/
|
|
1667
1314
|
interface SidebarMenuSubItemProps extends React.ComponentProps<"li"> {
|
|
1668
|
-
/**
|
|
1669
|
-
|
|
1670
|
-
* Used to identify component in tests and E2E automation
|
|
1671
|
-
*/
|
|
1672
|
-
dataHook: string;
|
|
1673
|
-
/**
|
|
1674
|
-
* Tracking element identifier for analytics
|
|
1675
|
-
* Defaults to "sidebar-menu-sub-item" if not provided
|
|
1676
|
-
*/
|
|
1677
|
-
trackingEl?: string;
|
|
1678
|
-
/**
|
|
1679
|
-
* Tracking label for analytics context
|
|
1680
|
-
*/
|
|
1681
|
-
trackingLabel?: string;
|
|
1315
|
+
/** Data hook for automated testing */
|
|
1316
|
+
dataHook?: string;
|
|
1682
1317
|
}
|
|
1683
1318
|
|
|
1684
1319
|
const SidebarMenuSubItem = React.forwardRef<
|
|
1685
1320
|
HTMLLIElement,
|
|
1686
1321
|
SidebarMenuSubItemProps
|
|
1687
|
-
>(({ dataHook,
|
|
1322
|
+
>(({ dataHook, ...props }, ref) => (
|
|
1688
1323
|
<li
|
|
1689
1324
|
ref={ref}
|
|
1690
1325
|
data-hook={dataHook}
|
|
1691
1326
|
data-slot="sidebar-menu-sub-item"
|
|
1692
|
-
data-tracking-el={trackingEl || "sidebar-menu-sub-item"}
|
|
1693
|
-
data-tracking-label={trackingLabel}
|
|
1694
1327
|
{...props}
|
|
1695
1328
|
/>
|
|
1696
1329
|
));
|
|
@@ -1700,20 +1333,8 @@ SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
|
1700
1333
|
* Props for the SidebarMenuSubButton component
|
|
1701
1334
|
*/
|
|
1702
1335
|
interface SidebarMenuSubButtonProps extends React.ComponentProps<"a"> {
|
|
1703
|
-
/**
|
|
1704
|
-
|
|
1705
|
-
* Used to identify component in tests and E2E automation
|
|
1706
|
-
*/
|
|
1707
|
-
dataHook: string;
|
|
1708
|
-
/**
|
|
1709
|
-
* Tracking element identifier for analytics
|
|
1710
|
-
* Defaults to "sidebar-menu-sub-button" if not provided
|
|
1711
|
-
*/
|
|
1712
|
-
trackingEl?: string;
|
|
1713
|
-
/**
|
|
1714
|
-
* Tracking label for analytics context
|
|
1715
|
-
*/
|
|
1716
|
-
trackingLabel?: string;
|
|
1336
|
+
/** Data hook for automated testing */
|
|
1337
|
+
dataHook?: string;
|
|
1717
1338
|
/**
|
|
1718
1339
|
* Render as a different element (Radix Slot pattern)
|
|
1719
1340
|
*/
|
|
@@ -1735,13 +1356,11 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1735
1356
|
>(
|
|
1736
1357
|
(
|
|
1737
1358
|
{
|
|
1738
|
-
dataHook,
|
|
1739
|
-
trackingEl,
|
|
1740
|
-
trackingLabel,
|
|
1741
1359
|
asChild = false,
|
|
1742
1360
|
size = SidebarMenuSubButtonSize.MD,
|
|
1743
1361
|
isActive,
|
|
1744
1362
|
className,
|
|
1363
|
+
dataHook,
|
|
1745
1364
|
...props
|
|
1746
1365
|
},
|
|
1747
1366
|
ref
|
|
@@ -1763,8 +1382,6 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1763
1382
|
data-hook={dataHook}
|
|
1764
1383
|
data-size={size}
|
|
1765
1384
|
data-slot="sidebar-menu-sub-button"
|
|
1766
|
-
data-tracking-el={trackingEl || "sidebar-menu-sub-button"}
|
|
1767
|
-
data-tracking-label={trackingLabel}
|
|
1768
1385
|
{...props}
|
|
1769
1386
|
/>
|
|
1770
1387
|
);
|