@brightlocal/ui-components 2.5.0 → 2.6.1
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/component-meta.json +1 -1
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +81 -3
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +415 -295
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +52 -26
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +111 -50
- package/dist/hooks/use-mobile.cjs +1 -1
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/hooks/use-mobile.js +17 -12
- package/dist/index.cjs +1 -1
- package/dist/index.js +356 -347
- package/package.json +3 -3
- package/src/blocks/sidebar.tsx +263 -21
- package/src/components/global-layout.tsx +166 -49
- package/src/hooks/use-mobile.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
"vite-bundle-visualizer": "^1.2.1",
|
|
131
131
|
"vite-plugin-dts": "^4.5.4",
|
|
132
132
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
133
|
-
"@workspace/
|
|
134
|
-
"@workspace/
|
|
133
|
+
"@workspace/typescript-config": "0.0.0",
|
|
134
|
+
"@workspace/eslint-config": "0.0.0"
|
|
135
135
|
},
|
|
136
136
|
"publishConfig": {
|
|
137
137
|
"access": "public",
|
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
Minus,
|
|
12
12
|
PanelLeft,
|
|
13
13
|
Ellipsis,
|
|
14
|
+
Menu,
|
|
14
15
|
} from "@brightlocal/icons";
|
|
15
16
|
|
|
16
17
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -18,6 +19,20 @@ import { Button } from "../components/button";
|
|
|
18
19
|
import { Input } from "../components/input";
|
|
19
20
|
import { Separator } from "../components/separator";
|
|
20
21
|
import { Sheet, SheetContent } from "../components/sheet";
|
|
22
|
+
import {
|
|
23
|
+
Drawer,
|
|
24
|
+
DrawerContent,
|
|
25
|
+
DrawerDescription,
|
|
26
|
+
DrawerTitle,
|
|
27
|
+
DrawerTrigger,
|
|
28
|
+
} from "../components/drawer";
|
|
29
|
+
import {
|
|
30
|
+
Accordion,
|
|
31
|
+
AccordionItem,
|
|
32
|
+
AccordionContent,
|
|
33
|
+
} from "../components/accordion";
|
|
34
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
35
|
+
import { ScrollArea } from "../components/scroll-area";
|
|
21
36
|
import { Skeleton } from "../components/skeleton";
|
|
22
37
|
import {
|
|
23
38
|
Tooltip,
|
|
@@ -352,6 +367,12 @@ interface SidebarProps extends React.ComponentProps<"div"> {
|
|
|
352
367
|
* @default SidebarCollapsible.OFFCANVAS
|
|
353
368
|
*/
|
|
354
369
|
collapsible?: SidebarCollapsible;
|
|
370
|
+
/**
|
|
371
|
+
* Render in flow layout instead of fixed positioning.
|
|
372
|
+
* Use when the Sidebar is placed inside a layout container (e.g. GlobalLayout).
|
|
373
|
+
* Mobile rendering (Sheet) is skipped — handle mobile navigation separately with Drawer.
|
|
374
|
+
*/
|
|
375
|
+
embedded?: boolean;
|
|
355
376
|
}
|
|
356
377
|
|
|
357
378
|
const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
@@ -363,6 +384,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
363
384
|
side = SidebarSide.LEFT,
|
|
364
385
|
variant = SidebarVariant.SIDEBAR,
|
|
365
386
|
collapsible = SidebarCollapsible.OFFCANVAS,
|
|
387
|
+
embedded = false,
|
|
366
388
|
className,
|
|
367
389
|
children,
|
|
368
390
|
...props
|
|
@@ -390,6 +412,36 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
390
412
|
);
|
|
391
413
|
}
|
|
392
414
|
|
|
415
|
+
if (embedded) {
|
|
416
|
+
return (
|
|
417
|
+
<div
|
|
418
|
+
ref={ref}
|
|
419
|
+
className={cn(
|
|
420
|
+
"group bg-sidebar text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",
|
|
421
|
+
state === "expanded" && "w-[var(--sidebar-width)]",
|
|
422
|
+
collapsible === SidebarCollapsible.ICON &&
|
|
423
|
+
state === "collapsed" &&
|
|
424
|
+
"w-[var(--sidebar-width-icon)]",
|
|
425
|
+
collapsible === SidebarCollapsible.OFFCANVAS &&
|
|
426
|
+
state === "collapsed" &&
|
|
427
|
+
"w-0",
|
|
428
|
+
className
|
|
429
|
+
)}
|
|
430
|
+
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
431
|
+
data-hook={dataHook}
|
|
432
|
+
data-side={side}
|
|
433
|
+
data-slot="sidebar"
|
|
434
|
+
data-state={state}
|
|
435
|
+
data-tracking-el={trackingEl || "sidebar"}
|
|
436
|
+
data-tracking-label={trackingLabel}
|
|
437
|
+
data-variant={variant}
|
|
438
|
+
{...props}
|
|
439
|
+
>
|
|
440
|
+
{children}
|
|
441
|
+
</div>
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
393
445
|
if (isMobile) {
|
|
394
446
|
return (
|
|
395
447
|
<Sheet open={openMobile} onOpenChange={setOpenMobile}>
|
|
@@ -605,7 +657,7 @@ const SidebarHeader = React.forwardRef<HTMLDivElement, SidebarHeaderProps>(
|
|
|
605
657
|
return (
|
|
606
658
|
<div
|
|
607
659
|
ref={ref}
|
|
608
|
-
className={cn("flex flex-col gap-2
|
|
660
|
+
className={cn("px-section-xs flex flex-col gap-2 pt-2 pb-9", className)}
|
|
609
661
|
data-hook={dataHook}
|
|
610
662
|
data-slot="sidebar-header"
|
|
611
663
|
{...props}
|
|
@@ -651,7 +703,7 @@ const SidebarSeparator = React.forwardRef<
|
|
|
651
703
|
<Separator
|
|
652
704
|
ref={ref}
|
|
653
705
|
className={cn(
|
|
654
|
-
"bg-sidebar-border mx-2 w-auto group-data-[collapsible=icon]:mx-0",
|
|
706
|
+
"bg-sidebar-border mx-2 my-2 w-auto group-data-[collapsible=icon]:mx-0",
|
|
655
707
|
className
|
|
656
708
|
)}
|
|
657
709
|
data-slot="sidebar-separator"
|
|
@@ -664,24 +716,35 @@ SidebarSeparator.displayName = "SidebarSeparator";
|
|
|
664
716
|
/**
|
|
665
717
|
* Props for the SidebarContent component
|
|
666
718
|
*/
|
|
667
|
-
interface SidebarContentProps extends React.ComponentProps<"div"> {
|
|
719
|
+
interface SidebarContentProps extends Omit<React.ComponentProps<"div">, "dir"> {
|
|
668
720
|
/** Data hook for automated testing */
|
|
669
721
|
dataHook?: string;
|
|
722
|
+
/** Accessible label for the sidebar navigation landmark. Override for i18n.
|
|
723
|
+
* @default "Sidebar"
|
|
724
|
+
*/
|
|
725
|
+
ariaLabel?: string;
|
|
670
726
|
}
|
|
671
727
|
|
|
672
728
|
const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
673
|
-
({ className, dataHook, ...props }, ref) => {
|
|
729
|
+
({ className, dataHook, ariaLabel = "Sidebar", children, ...props }, ref) => {
|
|
674
730
|
return (
|
|
675
|
-
<
|
|
731
|
+
<ScrollArea
|
|
676
732
|
ref={ref}
|
|
677
733
|
className={cn(
|
|
678
|
-
"
|
|
734
|
+
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&>[data-slot=scroll-area-viewport]]:p-0",
|
|
679
735
|
className
|
|
680
736
|
)}
|
|
681
|
-
|
|
682
|
-
data-slot="sidebar-content"
|
|
737
|
+
dataHook={dataHook ?? "sidebar-content-scroll"}
|
|
683
738
|
{...props}
|
|
684
|
-
|
|
739
|
+
>
|
|
740
|
+
<nav
|
|
741
|
+
aria-label={ariaLabel}
|
|
742
|
+
className="flex flex-col gap-2"
|
|
743
|
+
data-slot="sidebar-content"
|
|
744
|
+
>
|
|
745
|
+
{children}
|
|
746
|
+
</nav>
|
|
747
|
+
</ScrollArea>
|
|
685
748
|
);
|
|
686
749
|
}
|
|
687
750
|
);
|
|
@@ -1003,7 +1066,7 @@ const SidebarCollapseIcon = React.forwardRef<
|
|
|
1003
1066
|
SidebarCollapseIcon.displayName = "SidebarCollapseIcon";
|
|
1004
1067
|
|
|
1005
1068
|
const sidebarMenuButtonVariants = cva(
|
|
1006
|
-
"peer/menu-button flex w-full items-center gap-
|
|
1069
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none ring-sidebar-ring transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-150 ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:last-child]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",
|
|
1007
1070
|
{
|
|
1008
1071
|
variants: {
|
|
1009
1072
|
variant: {
|
|
@@ -1017,7 +1080,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
1017
1080
|
// Tree - has a chevron for tree navigation
|
|
1018
1081
|
tree: "[&>[data-tree-icon]]:size-4 [&>[data-tree-icon]]:shrink-0 [&>[data-tree-icon]]:opacity-70 [&>[data-tree-icon]]:transition-transform data-[state=open]:[&>[data-tree-icon]]:rotate-90 group-data-[collapsible=icon]:[&>[data-tree-icon]]:hidden",
|
|
1019
1082
|
// Badge - has a number badge on the right (handled via SidebarMenuBadge)
|
|
1020
|
-
badge: "group-has-[[data-sidebar=menu-badge]]/menu-item:pr-
|
|
1083
|
+
badge: "group-has-[[data-sidebar=menu-badge]]/menu-item:pr-16",
|
|
1021
1084
|
// Big Icon - larger icon with title and subtitle
|
|
1022
1085
|
bigIcon:
|
|
1023
1086
|
"h-auto flex-col items-start gap-1 rounded-lg p-3 [&>svg]:size-6 [&>svg]:rounded-md [&>svg]:bg-sidebar-foreground [&>svg]:p-1 [&>svg]:text-sidebar [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar group-data-[collapsible=icon]:!size-10 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:[&>svg]:size-6",
|
|
@@ -1026,9 +1089,9 @@ const sidebarMenuButtonVariants = cva(
|
|
|
1026
1089
|
"[&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground",
|
|
1027
1090
|
},
|
|
1028
1091
|
size: {
|
|
1029
|
-
default: "h-
|
|
1030
|
-
sm: "h-7 text-xs",
|
|
1031
|
-
lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
|
|
1092
|
+
default: "h-12 text-sm/4",
|
|
1093
|
+
sm: "h-7 text-xs/4",
|
|
1094
|
+
lg: "h-12 text-sm/4 group-data-[collapsible=icon]:!p-0",
|
|
1032
1095
|
},
|
|
1033
1096
|
},
|
|
1034
1097
|
defaultVariants: {
|
|
@@ -1192,13 +1255,8 @@ const SidebarMenuBadge = React.forwardRef<
|
|
|
1192
1255
|
<div
|
|
1193
1256
|
ref={ref}
|
|
1194
1257
|
className={cn(
|
|
1195
|
-
"text-sidebar-foreground pointer-events-none absolute right-
|
|
1258
|
+
"text-sidebar-foreground pointer-events-none absolute inset-y-0 right-4 my-auto flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
|
|
1196
1259
|
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
1197
|
-
"peer-data-[size=sm]/menu-button:top-1",
|
|
1198
|
-
"peer-data-[size=default]/menu-button:top-1.5",
|
|
1199
|
-
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
1200
|
-
"peer-data-[size=bigIcon]/menu-button:top-2.5",
|
|
1201
|
-
"peer-data-[size=tree]/menu-button:top-1.5",
|
|
1202
1260
|
"group-data-[collapsible=icon]:hidden",
|
|
1203
1261
|
className
|
|
1204
1262
|
)}
|
|
@@ -1372,7 +1430,7 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1372
1430
|
<Comp
|
|
1373
1431
|
ref={ref}
|
|
1374
1432
|
className={cn(
|
|
1375
|
-
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",
|
|
1433
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",
|
|
1376
1434
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
1377
1435
|
size === SidebarMenuSubButtonSize.SM && "text-xs",
|
|
1378
1436
|
size === SidebarMenuSubButtonSize.MD && "text-sm",
|
|
@@ -1390,11 +1448,188 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1390
1448
|
);
|
|
1391
1449
|
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
1392
1450
|
|
|
1451
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1452
|
+
* SidebarMenuCollapsible (Collapsible menu item with sub-items)
|
|
1453
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* Props for the SidebarMenuCollapsible component
|
|
1457
|
+
*/
|
|
1458
|
+
interface SidebarMenuCollapsibleProps {
|
|
1459
|
+
/**
|
|
1460
|
+
* Data hook for automated testing
|
|
1461
|
+
*/
|
|
1462
|
+
dataHook?: string;
|
|
1463
|
+
/**
|
|
1464
|
+
* Whether the collapsible is open by default
|
|
1465
|
+
*/
|
|
1466
|
+
defaultOpen?: boolean;
|
|
1467
|
+
/**
|
|
1468
|
+
* Controlled open state
|
|
1469
|
+
*/
|
|
1470
|
+
open?: boolean;
|
|
1471
|
+
/**
|
|
1472
|
+
* Callback when open state changes
|
|
1473
|
+
*/
|
|
1474
|
+
onOpenChange?: (open: boolean) => void;
|
|
1475
|
+
/**
|
|
1476
|
+
* Additional CSS classes
|
|
1477
|
+
*/
|
|
1478
|
+
className?: string;
|
|
1479
|
+
children?: React.ReactNode;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
function SidebarMenuCollapsible({
|
|
1483
|
+
dataHook,
|
|
1484
|
+
className,
|
|
1485
|
+
children,
|
|
1486
|
+
defaultOpen,
|
|
1487
|
+
open,
|
|
1488
|
+
onOpenChange,
|
|
1489
|
+
}: SidebarMenuCollapsibleProps) {
|
|
1490
|
+
return (
|
|
1491
|
+
<SidebarMenuItem>
|
|
1492
|
+
<Accordion
|
|
1493
|
+
collapsible
|
|
1494
|
+
className={className}
|
|
1495
|
+
dataHook={dataHook ?? "sidebar-menu-collapsible"}
|
|
1496
|
+
defaultValue={defaultOpen ? "item" : undefined}
|
|
1497
|
+
type="single"
|
|
1498
|
+
value={open !== undefined ? (open ? "item" : "") : undefined}
|
|
1499
|
+
onValueChange={
|
|
1500
|
+
onOpenChange ? (val) => onOpenChange(val === "item") : undefined
|
|
1501
|
+
}
|
|
1502
|
+
>
|
|
1503
|
+
<AccordionItem className="group/collapsible border-none" value="item">
|
|
1504
|
+
{children}
|
|
1505
|
+
</AccordionItem>
|
|
1506
|
+
</Accordion>
|
|
1507
|
+
</SidebarMenuItem>
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
SidebarMenuCollapsible.displayName = "SidebarMenuCollapsible";
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* Props for the SidebarMenuCollapsibleTrigger component
|
|
1514
|
+
*/
|
|
1515
|
+
type SidebarMenuCollapsibleTriggerProps = Omit<
|
|
1516
|
+
SidebarMenuButtonProps,
|
|
1517
|
+
"variant"
|
|
1518
|
+
>;
|
|
1519
|
+
|
|
1520
|
+
const SidebarMenuCollapsibleTrigger = React.forwardRef<
|
|
1521
|
+
HTMLButtonElement,
|
|
1522
|
+
SidebarMenuCollapsibleTriggerProps
|
|
1523
|
+
>(({ children, className, ...props }, ref) => (
|
|
1524
|
+
<AccordionPrimitive.Trigger asChild>
|
|
1525
|
+
<SidebarMenuButton
|
|
1526
|
+
ref={ref}
|
|
1527
|
+
className={cn("relative", className)}
|
|
1528
|
+
variant={SidebarMenuButtonVariant.COLLAPSIBLE}
|
|
1529
|
+
{...props}
|
|
1530
|
+
>
|
|
1531
|
+
<ChevronRight
|
|
1532
|
+
data-collapse-icon
|
|
1533
|
+
className="absolute left-2.5 !opacity-100 transition-transform duration-200 ease-out group-data-[state=open]/collapsible:rotate-90"
|
|
1534
|
+
size={12}
|
|
1535
|
+
/>
|
|
1536
|
+
{children}
|
|
1537
|
+
</SidebarMenuButton>
|
|
1538
|
+
</AccordionPrimitive.Trigger>
|
|
1539
|
+
));
|
|
1540
|
+
SidebarMenuCollapsibleTrigger.displayName = "SidebarMenuCollapsibleTrigger";
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* Props for the SidebarMenuCollapsibleContent component
|
|
1544
|
+
*/
|
|
1545
|
+
type SidebarMenuCollapsibleContentProps = SidebarMenuSubProps;
|
|
1546
|
+
|
|
1547
|
+
const SidebarMenuCollapsibleContent = React.forwardRef<
|
|
1548
|
+
HTMLUListElement,
|
|
1549
|
+
SidebarMenuCollapsibleContentProps
|
|
1550
|
+
>(({ dataHook, children, ...props }, ref) => (
|
|
1551
|
+
<AccordionContent className="p-0">
|
|
1552
|
+
<SidebarMenuSub ref={ref} dataHook={dataHook} {...props}>
|
|
1553
|
+
{children}
|
|
1554
|
+
</SidebarMenuSub>
|
|
1555
|
+
</AccordionContent>
|
|
1556
|
+
));
|
|
1557
|
+
SidebarMenuCollapsibleContent.displayName = "SidebarMenuCollapsibleContent";
|
|
1558
|
+
|
|
1559
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1560
|
+
* SidebarDrawer (Mobile navigation drawer with burger trigger)
|
|
1561
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
1562
|
+
|
|
1563
|
+
interface SidebarDrawerProps extends React.ComponentProps<"div"> {
|
|
1564
|
+
/**
|
|
1565
|
+
* Data hook for automated testing (required)
|
|
1566
|
+
*/
|
|
1567
|
+
dataHook: string;
|
|
1568
|
+
/**
|
|
1569
|
+
* Accessible label for the drawer
|
|
1570
|
+
* @default "Navigation"
|
|
1571
|
+
*/
|
|
1572
|
+
title?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* Accessible description for the drawer
|
|
1575
|
+
* @default "Main navigation menu"
|
|
1576
|
+
*/
|
|
1577
|
+
description?: string;
|
|
1578
|
+
/**
|
|
1579
|
+
* Tracking element identifier for analytics
|
|
1580
|
+
*/
|
|
1581
|
+
trackingEl?: string;
|
|
1582
|
+
/**
|
|
1583
|
+
* Tracking label for analytics context
|
|
1584
|
+
*/
|
|
1585
|
+
trackingLabel?: string;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
function SidebarDrawer({
|
|
1589
|
+
dataHook,
|
|
1590
|
+
title = "Navigation",
|
|
1591
|
+
description = "Main navigation menu",
|
|
1592
|
+
trackingEl,
|
|
1593
|
+
trackingLabel,
|
|
1594
|
+
children,
|
|
1595
|
+
className,
|
|
1596
|
+
...props
|
|
1597
|
+
}: SidebarDrawerProps) {
|
|
1598
|
+
return (
|
|
1599
|
+
<Drawer direction="left">
|
|
1600
|
+
<DrawerTrigger asChild>
|
|
1601
|
+
<Button
|
|
1602
|
+
iconOnly
|
|
1603
|
+
aria-label="Open menu"
|
|
1604
|
+
dataHook={`${dataHook}-trigger`}
|
|
1605
|
+
size="sm"
|
|
1606
|
+
trackingEl={trackingEl}
|
|
1607
|
+
trackingLabel={trackingLabel}
|
|
1608
|
+
variant="ghost"
|
|
1609
|
+
>
|
|
1610
|
+
<Menu size={24} />
|
|
1611
|
+
</Button>
|
|
1612
|
+
</DrawerTrigger>
|
|
1613
|
+
<DrawerContent
|
|
1614
|
+
className={cn("max-w-96", className)}
|
|
1615
|
+
dataHook={dataHook}
|
|
1616
|
+
{...props}
|
|
1617
|
+
>
|
|
1618
|
+
<DrawerTitle className="sr-only">{title}</DrawerTitle>
|
|
1619
|
+
<DrawerDescription className="sr-only">{description}</DrawerDescription>
|
|
1620
|
+
<div className="flex h-full flex-col p-6">{children}</div>
|
|
1621
|
+
</DrawerContent>
|
|
1622
|
+
</Drawer>
|
|
1623
|
+
);
|
|
1624
|
+
}
|
|
1625
|
+
SidebarDrawer.displayName = "SidebarDrawer";
|
|
1626
|
+
|
|
1393
1627
|
// Component exports
|
|
1394
1628
|
export {
|
|
1395
1629
|
Sidebar,
|
|
1396
1630
|
SidebarCollapseIcon,
|
|
1397
1631
|
SidebarContent,
|
|
1632
|
+
SidebarDrawer,
|
|
1398
1633
|
SidebarFooter,
|
|
1399
1634
|
SidebarGroup,
|
|
1400
1635
|
SidebarGroupAction,
|
|
@@ -1407,6 +1642,9 @@ export {
|
|
|
1407
1642
|
SidebarMenuAction,
|
|
1408
1643
|
SidebarMenuBadge,
|
|
1409
1644
|
SidebarMenuButton,
|
|
1645
|
+
SidebarMenuCollapsible,
|
|
1646
|
+
SidebarMenuCollapsibleContent,
|
|
1647
|
+
SidebarMenuCollapsibleTrigger,
|
|
1410
1648
|
SidebarMenuItem,
|
|
1411
1649
|
SidebarMenuSkeleton,
|
|
1412
1650
|
SidebarMenuSub,
|
|
@@ -1431,6 +1669,7 @@ export type {
|
|
|
1431
1669
|
SidebarFooterProps,
|
|
1432
1670
|
SidebarSeparatorProps,
|
|
1433
1671
|
SidebarContentProps,
|
|
1672
|
+
SidebarDrawerProps,
|
|
1434
1673
|
SidebarGroupProps,
|
|
1435
1674
|
SidebarGroupLabelProps,
|
|
1436
1675
|
SidebarGroupActionProps,
|
|
@@ -1439,6 +1678,9 @@ export type {
|
|
|
1439
1678
|
SidebarMenuItemProps,
|
|
1440
1679
|
SidebarCollapseIconProps,
|
|
1441
1680
|
SidebarMenuButtonProps,
|
|
1681
|
+
SidebarMenuCollapsibleProps,
|
|
1682
|
+
SidebarMenuCollapsibleTriggerProps,
|
|
1683
|
+
SidebarMenuCollapsibleContentProps,
|
|
1442
1684
|
SidebarMenuActionProps,
|
|
1443
1685
|
SidebarMenuBadgeProps,
|
|
1444
1686
|
SidebarMenuSkeletonProps,
|