@brightlocal/ui-components 2.10.0 → 2.12.0
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/README.md +3 -1
- package/component-meta.json +200 -17
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +42 -25
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +16 -4
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +57 -53
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts +7 -1
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +82 -81
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +19 -10
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +173 -169
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +14 -2
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +37 -37
- package/dist/button.cjs +1 -1
- package/dist/button.js +25 -25
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +3 -3
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +2 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +10 -1
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +85 -82
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +37 -4
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +213 -163
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +11 -0
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +43 -38
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +12 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +235 -230
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +106 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +385 -120
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +10 -0
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +96 -96
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +38 -30
- package/dist/drawer.d.ts +2 -2
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +5 -0
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +15 -7
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +10 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +406 -395
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +8 -5
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +164 -170
- package/dist/input-group.d.ts +1 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +10 -0
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +108 -106
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +36 -37
- package/dist/list.d.ts +1 -1
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +6 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +25 -22
- package/dist/map.cjs +1 -0
- package/dist/map.d.ts +207 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/map.js +256 -0
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +29 -3
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +26 -25
- package/dist/rating.cjs +1 -1
- package/dist/rating.d.ts +6 -0
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +27 -19
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +7 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +52 -51
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +16 -4
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +38 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +6 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +42 -41
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +13 -11
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +32 -30
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +4 -0
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +101 -52
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.d.ts +5 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/text-reveal-motion.js +111 -110
- package/dist/typography.cjs +1 -1
- package/dist/typography.d.ts +1 -2
- package/dist/typography.d.ts.map +1 -1
- package/dist/typography.js +49 -50
- package/package.json +4 -5
- package/src/blocks/data-table.tsx +26 -9
- package/src/blocks/input-list.tsx +12 -1
- package/src/blocks/sidebar.tsx +61 -44
- package/src/components/badge.tsx +22 -5
- package/src/components/breadcrumb.tsx +43 -26
- package/src/components/button.tsx +13 -13
- package/src/components/callout.tsx +5 -4
- package/src/components/card.tsx +35 -19
- package/src/components/carousel.tsx +134 -13
- package/src/components/chip.tsx +22 -2
- package/src/components/combobox.tsx +18 -3
- package/src/components/command.tsx +644 -17
- package/src/components/date-picker.tsx +17 -3
- package/src/components/dialog.tsx +17 -4
- package/src/components/drawer.tsx +2 -2
- package/src/components/global-layout.tsx +15 -2
- package/src/components/input-chip.tsx +114 -66
- package/src/components/input-password.tsx +73 -49
- package/src/components/link.tsx +29 -17
- package/src/components/logo.tsx +10 -2
- package/src/components/map.tsx +597 -0
- package/src/components/pagination.tsx +44 -11
- package/src/components/rating.tsx +20 -2
- package/src/components/select.tsx +9 -1
- package/src/components/separator.tsx +40 -25
- package/src/components/sheet.tsx +28 -20
- package/src/components/skeleton.tsx +13 -2
- package/src/components/sonner.tsx +9 -3
- package/src/components/tabs.tsx +118 -22
- package/src/components/text-reveal-motion.tsx +7 -1
- package/src/components/typography.tsx +6 -7
- package/src/hooks/use-breakpoint.ts +2 -3
- package/src/index.ts +1 -0
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -102,8 +102,6 @@ export enum SidebarMenuButtonVariant {
|
|
|
102
102
|
COLLAPSIBLE = "collapsible",
|
|
103
103
|
/** Has action menu (dots) on hover */
|
|
104
104
|
DROPDOWN = "dropdown",
|
|
105
|
-
/** Has a chevron for tree navigation */
|
|
106
|
-
TREE = "tree",
|
|
107
105
|
/** Has a number badge on the right */
|
|
108
106
|
BADGE = "badge",
|
|
109
107
|
/** Larger icon with title and subtitle */
|
|
@@ -393,8 +391,8 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
393
391
|
collapsible = SidebarCollapsible.OFFCANVAS,
|
|
394
392
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- accepted for backward compat
|
|
395
393
|
embedded,
|
|
396
|
-
mobileTitle
|
|
397
|
-
mobileDescription
|
|
394
|
+
mobileTitle,
|
|
395
|
+
mobileDescription,
|
|
398
396
|
className,
|
|
399
397
|
children,
|
|
400
398
|
...props
|
|
@@ -408,7 +406,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
408
406
|
<div
|
|
409
407
|
ref={ref}
|
|
410
408
|
className={cn(
|
|
411
|
-
"text-sidebar-foreground flex h-full w-
|
|
409
|
+
"text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
|
412
410
|
className
|
|
413
411
|
)}
|
|
414
412
|
data-hook={dataHook}
|
|
@@ -426,7 +424,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
426
424
|
return (
|
|
427
425
|
<Sheet open={openMobile} onOpenChange={setOpenMobile}>
|
|
428
426
|
<SheetContent
|
|
429
|
-
className="bg-sidebar-background text-sidebar-foreground w-
|
|
427
|
+
className="bg-sidebar-background text-sidebar-foreground w-(--sidebar-width) p-6"
|
|
430
428
|
data-hook={`${dataHook}-mobile-content`}
|
|
431
429
|
data-mobile="true"
|
|
432
430
|
data-sidebar="sidebar"
|
|
@@ -437,9 +435,11 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
437
435
|
} as React.CSSProperties
|
|
438
436
|
}
|
|
439
437
|
>
|
|
440
|
-
<SheetTitle className="sr-only">
|
|
438
|
+
<SheetTitle className="sr-only">
|
|
439
|
+
{mobileTitle ?? "Navigation"}
|
|
440
|
+
</SheetTitle>
|
|
441
441
|
<SheetDescription className="sr-only">
|
|
442
|
-
{mobileDescription}
|
|
442
|
+
{mobileDescription ?? "Main navigation menu"}
|
|
443
443
|
</SheetDescription>
|
|
444
444
|
<div className="flex h-full w-full flex-col">{children}</div>
|
|
445
445
|
</SheetContent>
|
|
@@ -452,10 +452,10 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
452
452
|
ref={ref}
|
|
453
453
|
className={cn(
|
|
454
454
|
"group text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",
|
|
455
|
-
state === "expanded" && "w-
|
|
455
|
+
state === "expanded" && "w-(--sidebar-width)",
|
|
456
456
|
collapsible === SidebarCollapsible.ICON &&
|
|
457
457
|
state === "collapsed" &&
|
|
458
|
-
"w-
|
|
458
|
+
"w-(--sidebar-width-icon)",
|
|
459
459
|
collapsible === SidebarCollapsible.OFFCANVAS &&
|
|
460
460
|
state === "collapsed" &&
|
|
461
461
|
"w-0",
|
|
@@ -490,23 +490,36 @@ interface SidebarTriggerProps extends Omit<
|
|
|
490
490
|
* @default "sidebar-trigger"
|
|
491
491
|
*/
|
|
492
492
|
dataHook?: string;
|
|
493
|
+
/**
|
|
494
|
+
* Accessible label for the toggle button.
|
|
495
|
+
* @default "Toggle Sidebar"
|
|
496
|
+
*/
|
|
497
|
+
toggleAriaLabel?: string;
|
|
493
498
|
}
|
|
494
499
|
|
|
495
500
|
const SidebarTrigger = React.forwardRef<
|
|
496
|
-
React.
|
|
501
|
+
React.ComponentRef<typeof Button>,
|
|
497
502
|
SidebarTriggerProps
|
|
498
503
|
>(
|
|
499
504
|
(
|
|
500
|
-
{
|
|
505
|
+
{
|
|
506
|
+
className,
|
|
507
|
+
onClick,
|
|
508
|
+
dataHook = "sidebar-trigger",
|
|
509
|
+
toggleAriaLabel,
|
|
510
|
+
children,
|
|
511
|
+
...props
|
|
512
|
+
},
|
|
501
513
|
ref
|
|
502
514
|
) => {
|
|
503
515
|
const { toggleSidebar } = useSidebar();
|
|
516
|
+
const resolvedLabel = toggleAriaLabel ?? "Toggle Sidebar";
|
|
504
517
|
|
|
505
518
|
return (
|
|
506
519
|
<Button
|
|
507
520
|
ref={ref}
|
|
508
521
|
iconOnly
|
|
509
|
-
aria-label=
|
|
522
|
+
aria-label={resolvedLabel}
|
|
510
523
|
className={cn("h-7 w-7", className)}
|
|
511
524
|
data-slot="sidebar-trigger"
|
|
512
525
|
dataHook={dataHook}
|
|
@@ -519,7 +532,7 @@ const SidebarTrigger = React.forwardRef<
|
|
|
519
532
|
{...props}
|
|
520
533
|
>
|
|
521
534
|
{children || <PanelLeft />}
|
|
522
|
-
<span className="sr-only">
|
|
535
|
+
<span className="sr-only">{resolvedLabel}</span>
|
|
523
536
|
</Button>
|
|
524
537
|
);
|
|
525
538
|
}
|
|
@@ -529,27 +542,34 @@ SidebarTrigger.displayName = "SidebarTrigger";
|
|
|
529
542
|
/**
|
|
530
543
|
* Props for the SidebarRail component
|
|
531
544
|
*/
|
|
532
|
-
|
|
545
|
+
interface SidebarRailProps extends React.ComponentProps<"button"> {
|
|
546
|
+
/**
|
|
547
|
+
* Accessible label and tooltip for the rail toggle.
|
|
548
|
+
* @default "Toggle Sidebar"
|
|
549
|
+
*/
|
|
550
|
+
toggleAriaLabel?: string;
|
|
551
|
+
}
|
|
533
552
|
|
|
534
553
|
const SidebarRail = React.forwardRef<HTMLButtonElement, SidebarRailProps>(
|
|
535
|
-
({ className, ...props }, ref) => {
|
|
554
|
+
({ className, toggleAriaLabel, ...props }, ref) => {
|
|
536
555
|
const { toggleSidebar } = useSidebar();
|
|
556
|
+
const resolvedLabel = toggleAriaLabel ?? "Toggle Sidebar";
|
|
537
557
|
|
|
538
558
|
return (
|
|
539
559
|
<button
|
|
540
560
|
ref={ref}
|
|
541
|
-
aria-label=
|
|
561
|
+
aria-label={resolvedLabel}
|
|
542
562
|
className={cn(
|
|
543
|
-
"hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-
|
|
563
|
+
"hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 sm:flex",
|
|
544
564
|
"cursor-w-resize",
|
|
545
|
-
"
|
|
565
|
+
"in-data-[state=collapsed]:cursor-e-resize",
|
|
546
566
|
"group-data-[collapsible=offcanvas]:hover:bg-sidebar-background group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
547
|
-
"
|
|
567
|
+
"in-data-[collapsible=offcanvas]:-right-2",
|
|
548
568
|
className
|
|
549
569
|
)}
|
|
550
570
|
data-slot="sidebar-rail"
|
|
551
571
|
tabIndex={-1}
|
|
552
|
-
title=
|
|
572
|
+
title={resolvedLabel}
|
|
553
573
|
onClick={toggleSidebar}
|
|
554
574
|
{...props}
|
|
555
575
|
/>
|
|
@@ -604,7 +624,7 @@ SidebarInset.displayName = "SidebarInset";
|
|
|
604
624
|
type SidebarInputProps = Omit<React.ComponentProps<typeof Input>, "dataHook">;
|
|
605
625
|
|
|
606
626
|
const SidebarInput = React.forwardRef<
|
|
607
|
-
React.
|
|
627
|
+
React.ComponentRef<typeof Input>,
|
|
608
628
|
SidebarInputProps
|
|
609
629
|
>(({ className, ...props }, ref) => {
|
|
610
630
|
return (
|
|
@@ -625,15 +645,15 @@ SidebarInput.displayName = "SidebarInput";
|
|
|
625
645
|
/**
|
|
626
646
|
* Props for the SidebarHeader component
|
|
627
647
|
*/
|
|
628
|
-
interface SidebarHeaderProps extends React.ComponentProps<"
|
|
648
|
+
interface SidebarHeaderProps extends React.ComponentProps<"header"> {
|
|
629
649
|
/** Data hook for automated testing */
|
|
630
650
|
dataHook?: string;
|
|
631
651
|
}
|
|
632
652
|
|
|
633
|
-
const SidebarHeader = React.forwardRef<
|
|
653
|
+
const SidebarHeader = React.forwardRef<HTMLElement, SidebarHeaderProps>(
|
|
634
654
|
({ className, dataHook, ...props }, ref) => {
|
|
635
655
|
return (
|
|
636
|
-
<
|
|
656
|
+
<header
|
|
637
657
|
ref={ref}
|
|
638
658
|
className={cn(
|
|
639
659
|
"pr-section-xs flex flex-col gap-2 pt-2 pb-9 pl-8",
|
|
@@ -651,15 +671,15 @@ SidebarHeader.displayName = "SidebarHeader";
|
|
|
651
671
|
/**
|
|
652
672
|
* Props for the SidebarFooter component
|
|
653
673
|
*/
|
|
654
|
-
interface SidebarFooterProps extends React.ComponentProps<"
|
|
674
|
+
interface SidebarFooterProps extends React.ComponentProps<"footer"> {
|
|
655
675
|
/** Data hook for automated testing */
|
|
656
676
|
dataHook?: string;
|
|
657
677
|
}
|
|
658
678
|
|
|
659
|
-
const SidebarFooter = React.forwardRef<
|
|
679
|
+
const SidebarFooter = React.forwardRef<HTMLElement, SidebarFooterProps>(
|
|
660
680
|
({ className, dataHook, ...props }, ref) => {
|
|
661
681
|
return (
|
|
662
|
-
<
|
|
682
|
+
<footer
|
|
663
683
|
ref={ref}
|
|
664
684
|
className={cn("flex flex-col gap-2 p-2", className)}
|
|
665
685
|
data-hook={dataHook}
|
|
@@ -677,14 +697,14 @@ SidebarFooter.displayName = "SidebarFooter";
|
|
|
677
697
|
type SidebarSeparatorProps = React.ComponentProps<typeof Separator>;
|
|
678
698
|
|
|
679
699
|
const SidebarSeparator = React.forwardRef<
|
|
680
|
-
React.
|
|
700
|
+
React.ComponentRef<typeof Separator>,
|
|
681
701
|
SidebarSeparatorProps
|
|
682
702
|
>(({ className, ...props }, ref) => {
|
|
683
703
|
return (
|
|
684
704
|
<Separator
|
|
685
705
|
ref={ref}
|
|
686
706
|
className={cn(
|
|
687
|
-
"bg-sidebar-border mx-2 my-
|
|
707
|
+
"bg-sidebar-border mx-2 my-5 w-auto group-data-[collapsible=icon]:mx-0",
|
|
688
708
|
className
|
|
689
709
|
)}
|
|
690
710
|
data-slot="sidebar-separator"
|
|
@@ -713,7 +733,7 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
713
733
|
<ScrollArea
|
|
714
734
|
ref={ref}
|
|
715
735
|
className={cn(
|
|
716
|
-
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [
|
|
736
|
+
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden *:data-[slot=scroll-area-viewport]:p-0 [&_[data-slot=scroll-area-viewport]>div]:block!",
|
|
717
737
|
className
|
|
718
738
|
)}
|
|
719
739
|
dataHook={dataHook ?? "sidebar-content-scroll"}
|
|
@@ -1049,7 +1069,7 @@ const SidebarCollapseIcon = React.forwardRef<
|
|
|
1049
1069
|
SidebarCollapseIcon.displayName = "SidebarCollapseIcon";
|
|
1050
1070
|
|
|
1051
1071
|
const sidebarMenuButtonVariants = cva(
|
|
1052
|
-
"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-
|
|
1072
|
+
"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-of-type]: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",
|
|
1053
1073
|
{
|
|
1054
1074
|
variants: {
|
|
1055
1075
|
variant: {
|
|
@@ -1060,8 +1080,6 @@ const sidebarMenuButtonVariants = cva(
|
|
|
1060
1080
|
"[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform data-[state=open]:[&>[data-collapse-icon]]:rotate-90",
|
|
1061
1081
|
// Dropdown - has action menu (dots) on hover
|
|
1062
1082
|
dropdown: "group-has-[[data-sidebar=menu-action]]/menu-item:pr-8",
|
|
1063
|
-
// Tree - has a chevron for tree navigation
|
|
1064
|
-
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",
|
|
1065
1083
|
// Badge - has a number badge on the right (handled via SidebarMenuBadge)
|
|
1066
1084
|
badge: "group-has-[[data-sidebar=menu-badge]]/menu-item:pr-16",
|
|
1067
1085
|
// Big Icon - larger icon with title and subtitle
|
|
@@ -1069,7 +1087,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
1069
1087
|
"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-background [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar-background 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",
|
|
1070
1088
|
// Checkbox - has a checkbox indicator
|
|
1071
1089
|
checkbox:
|
|
1072
|
-
"[&>[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",
|
|
1090
|
+
"px-3 [&>[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",
|
|
1073
1091
|
},
|
|
1074
1092
|
size: {
|
|
1075
1093
|
default: "h-12 text-sm/4",
|
|
@@ -1213,7 +1231,6 @@ const SidebarMenuAction = React.forwardRef<
|
|
|
1213
1231
|
"peer-data-[size=default]/menu-button:top-1.5",
|
|
1214
1232
|
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
1215
1233
|
"peer-data-[size=bigIcon]/menu-button:top-2.5",
|
|
1216
|
-
"peer-data-[size=tree]/menu-button:top-1.5",
|
|
1217
1234
|
"group-data-[collapsible=icon]:hidden",
|
|
1218
1235
|
showOnHover &&
|
|
1219
1236
|
"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",
|
|
@@ -1303,13 +1320,13 @@ const SidebarMenuSkeleton = React.forwardRef<
|
|
|
1303
1320
|
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
1304
1321
|
|
|
1305
1322
|
const sidebarMenuSubVariants = cva(
|
|
1306
|
-
"
|
|
1323
|
+
"flex min-w-0 flex-col items-start gap-1 py-0.5 group-data-[collapsible=icon]:hidden",
|
|
1307
1324
|
{
|
|
1308
1325
|
variants: {
|
|
1309
1326
|
variant: {
|
|
1310
|
-
default: "",
|
|
1311
|
-
border: "border-l border-sidebar-border",
|
|
1312
|
-
indent: "
|
|
1327
|
+
default: "px-10",
|
|
1328
|
+
border: "border-l border-sidebar-border ml-10 pl-1 pr-10",
|
|
1329
|
+
indent: "px-10",
|
|
1313
1330
|
},
|
|
1314
1331
|
},
|
|
1315
1332
|
defaultVariants: {
|
|
@@ -1413,7 +1430,7 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1413
1430
|
<Comp
|
|
1414
1431
|
ref={ref}
|
|
1415
1432
|
className={cn(
|
|
1416
|
-
"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
|
|
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 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-of-type]:truncate [&>svg]:shrink-0",
|
|
1417
1434
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
1418
1435
|
size === SidebarMenuSubButtonSize.SM && "text-xs",
|
|
1419
1436
|
size === SidebarMenuSubButtonSize.MD && "text-sm",
|
|
@@ -1507,16 +1524,16 @@ const SidebarMenuCollapsibleTrigger = React.forwardRef<
|
|
|
1507
1524
|
<AccordionPrimitive.Trigger asChild>
|
|
1508
1525
|
<SidebarMenuButton
|
|
1509
1526
|
ref={ref}
|
|
1510
|
-
className={
|
|
1527
|
+
className={className}
|
|
1511
1528
|
variant={SidebarMenuButtonVariant.COLLAPSIBLE}
|
|
1512
1529
|
{...props}
|
|
1513
1530
|
>
|
|
1531
|
+
{children}
|
|
1514
1532
|
<ChevronRight
|
|
1515
1533
|
data-collapse-icon
|
|
1516
|
-
className="
|
|
1534
|
+
className="opacity-100! transition-transform duration-200 ease-out group-data-[collapsible=icon]:hidden"
|
|
1517
1535
|
size={12}
|
|
1518
1536
|
/>
|
|
1519
|
-
{children}
|
|
1520
1537
|
</SidebarMenuButton>
|
|
1521
1538
|
</AccordionPrimitive.Trigger>
|
|
1522
1539
|
));
|
package/src/components/badge.tsx
CHANGED
|
@@ -5,18 +5,35 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
5
5
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
|
|
7
7
|
const badgeVariants = cva(
|
|
8
|
-
|
|
8
|
+
[
|
|
9
|
+
// Layout
|
|
10
|
+
"inline-flex items-center justify-center gap-1 w-fit shrink-0 overflow-hidden",
|
|
11
|
+
// Spacing & shape
|
|
12
|
+
"rounded-full border px-2 py-1",
|
|
13
|
+
// Typography
|
|
14
|
+
"text-xs font-semibold whitespace-nowrap leading-none",
|
|
15
|
+
// Icons
|
|
16
|
+
"[&>svg]:size-3 [&>svg]:pointer-events-none",
|
|
17
|
+
// Transition
|
|
18
|
+
"transition-[color,background-color,border-color,box-shadow] duration-150 ease-in-out",
|
|
19
|
+
// Focus
|
|
20
|
+
"focus-visible:outline-none",
|
|
21
|
+
"focus-visible:shadow-[0_0_0_1px_white,0_0_0_2px_var(--color-ring),0_0_0_4px_rgba(0,0,0,0.1)]",
|
|
22
|
+
"dark:focus-visible:shadow-[0_0_0_1px_var(--background),0_0_0_2px_var(--color-ring),0_0_0_4px_rgba(255,255,255,0.1)]",
|
|
23
|
+
// Number badge (single digit)
|
|
24
|
+
"data-[number=true]:size-5 data-[number=true]:p-0 data-[number=true]:aspect-square",
|
|
25
|
+
],
|
|
9
26
|
{
|
|
10
27
|
variants: {
|
|
11
28
|
variant: {
|
|
12
29
|
primary:
|
|
13
|
-
"border-transparent bg-
|
|
30
|
+
"border-transparent bg-success-background text-success-foreground",
|
|
14
31
|
secondary:
|
|
15
|
-
"border-transparent bg-secondary text-secondary-foreground
|
|
32
|
+
"border-transparent bg-secondary text-secondary-foreground focus-visible:border-ring",
|
|
16
33
|
destructive:
|
|
17
|
-
"border-transparent bg-destructive text-destructive-foreground
|
|
34
|
+
"border-transparent bg-destructive text-destructive-foreground",
|
|
18
35
|
outline:
|
|
19
|
-
"bg-background border-border text-foreground
|
|
36
|
+
"bg-background border-border text-foreground focus-visible:border-ring",
|
|
20
37
|
},
|
|
21
38
|
},
|
|
22
39
|
defaultVariants: {
|
|
@@ -20,6 +20,11 @@ interface BreadcrumbProps extends React.ComponentProps<"nav"> {
|
|
|
20
20
|
* Tracking label for analytics context
|
|
21
21
|
*/
|
|
22
22
|
trackingLabel?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Accessible label for the breadcrumb navigation.
|
|
25
|
+
* @default "breadcrumb"
|
|
26
|
+
*/
|
|
27
|
+
ariaLabel?: string;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -27,17 +32,19 @@ interface BreadcrumbProps extends React.ComponentProps<"nav"> {
|
|
|
27
32
|
* Provides navigation context and allows users to navigate back through the hierarchy.
|
|
28
33
|
*/
|
|
29
34
|
const Breadcrumb = React.forwardRef<HTMLElement, BreadcrumbProps>(
|
|
30
|
-
({ dataHook, trackingEl, trackingLabel, ...props }, ref) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
({ dataHook, trackingEl, trackingLabel, ariaLabel, ...props }, ref) => {
|
|
36
|
+
return (
|
|
37
|
+
<nav
|
|
38
|
+
ref={ref}
|
|
39
|
+
aria-label={ariaLabel ?? "breadcrumb"}
|
|
40
|
+
data-hook={dataHook}
|
|
41
|
+
data-slot="breadcrumb"
|
|
42
|
+
data-tracking-el={trackingEl}
|
|
43
|
+
data-tracking-label={trackingLabel}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
41
48
|
);
|
|
42
49
|
Breadcrumb.displayName = "Breadcrumb";
|
|
43
50
|
|
|
@@ -158,22 +165,32 @@ BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
|
158
165
|
* Ellipsis indicator for collapsed breadcrumb sections.
|
|
159
166
|
* Used when the breadcrumb trail is too long to display fully.
|
|
160
167
|
*/
|
|
168
|
+
interface BreadcrumbEllipsisProps extends React.ComponentProps<"span"> {
|
|
169
|
+
/**
|
|
170
|
+
* Screen-reader-only label for the ellipsis.
|
|
171
|
+
* @default "More"
|
|
172
|
+
*/
|
|
173
|
+
srLabel?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
161
176
|
const BreadcrumbEllipsis = React.forwardRef<
|
|
162
177
|
HTMLSpanElement,
|
|
163
|
-
|
|
164
|
-
>(({ className, ...props }, ref) =>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
BreadcrumbEllipsisProps
|
|
179
|
+
>(({ className, srLabel = "More", ...props }, ref) => {
|
|
180
|
+
return (
|
|
181
|
+
<span
|
|
182
|
+
ref={ref}
|
|
183
|
+
aria-hidden="true"
|
|
184
|
+
className={cn("flex size-9 items-center justify-center", className)}
|
|
185
|
+
data-slot="breadcrumb-ellipsis"
|
|
186
|
+
role="presentation"
|
|
187
|
+
{...props}
|
|
188
|
+
>
|
|
189
|
+
<MoreHorizontal />
|
|
190
|
+
<span className="sr-only">{srLabel}</span>
|
|
191
|
+
</span>
|
|
192
|
+
);
|
|
193
|
+
});
|
|
177
194
|
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
178
195
|
|
|
179
196
|
export {
|
|
@@ -185,4 +202,4 @@ export {
|
|
|
185
202
|
BreadcrumbSeparator,
|
|
186
203
|
BreadcrumbEllipsis,
|
|
187
204
|
};
|
|
188
|
-
export type { BreadcrumbProps, BreadcrumbLinkProps };
|
|
205
|
+
export type { BreadcrumbProps, BreadcrumbLinkProps, BreadcrumbEllipsisProps };
|
|
@@ -69,10 +69,22 @@ const ButtonVariants = cva(
|
|
|
69
69
|
"hover:bg-primary/90",
|
|
70
70
|
"focus-visible:shadow-default",
|
|
71
71
|
],
|
|
72
|
+
secondary: [
|
|
73
|
+
"bg-secondary",
|
|
74
|
+
"text-secondary-foreground",
|
|
75
|
+
"hover:bg-secondary/80",
|
|
76
|
+
"focus-visible:shadow-default",
|
|
77
|
+
],
|
|
78
|
+
warning: [
|
|
79
|
+
"bg-warning-background",
|
|
80
|
+
"hover:bg-warning-background/80",
|
|
81
|
+
"text-warning-foreground",
|
|
82
|
+
"focus-visible:shadow-default",
|
|
83
|
+
],
|
|
72
84
|
destructive: [
|
|
73
85
|
"bg-destructive",
|
|
74
86
|
"dark:bg-red-400/90",
|
|
75
|
-
"hover:bg-destructive/
|
|
87
|
+
"hover:bg-destructive/80",
|
|
76
88
|
"dark:hover:bg-red-400/90",
|
|
77
89
|
"text-destructive-foreground",
|
|
78
90
|
"dark:text-red-950",
|
|
@@ -92,12 +104,6 @@ const ButtonVariants = cva(
|
|
|
92
104
|
"focus-visible:shadow-default",
|
|
93
105
|
"focus-visible:border-ring",
|
|
94
106
|
],
|
|
95
|
-
secondary: [
|
|
96
|
-
"bg-secondary",
|
|
97
|
-
"text-secondary-foreground",
|
|
98
|
-
"hover:bg-secondary/80",
|
|
99
|
-
"focus-visible:shadow-default",
|
|
100
|
-
],
|
|
101
107
|
ghost: [
|
|
102
108
|
"bg-transparent",
|
|
103
109
|
"text-foreground",
|
|
@@ -105,12 +111,6 @@ const ButtonVariants = cva(
|
|
|
105
111
|
"data-[state=open]:bg-accent",
|
|
106
112
|
"focus-visible:shadow-default",
|
|
107
113
|
],
|
|
108
|
-
warning: [
|
|
109
|
-
"bg-warning-light",
|
|
110
|
-
"text-warning-foreground",
|
|
111
|
-
"hover:bg-warning-light/90",
|
|
112
|
-
"focus-visible:shadow-default",
|
|
113
|
-
],
|
|
114
114
|
},
|
|
115
115
|
size: {
|
|
116
116
|
default: "px-4 py-2 h-9 text-sm",
|
|
@@ -50,7 +50,7 @@ const CalloutContext = React.createContext<{ variant: CalloutVariant }>({
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
/** Props for the Callout component */
|
|
53
|
-
interface CalloutProps extends React.ComponentPropsWithoutRef<"
|
|
53
|
+
interface CalloutProps extends React.ComponentPropsWithoutRef<"aside"> {
|
|
54
54
|
/** Required test hook identifier */
|
|
55
55
|
dataHook: string;
|
|
56
56
|
/**
|
|
@@ -75,7 +75,7 @@ interface CalloutProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
|
75
75
|
*
|
|
76
76
|
* Use with `CalloutHeading` and optionally `CalloutCitation` as children.
|
|
77
77
|
*/
|
|
78
|
-
const Callout = React.forwardRef<
|
|
78
|
+
const Callout = React.forwardRef<HTMLElement, CalloutProps>(
|
|
79
79
|
(
|
|
80
80
|
{
|
|
81
81
|
className,
|
|
@@ -93,13 +93,14 @@ const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(
|
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
95
|
<CalloutContext.Provider value={contextValue}>
|
|
96
|
-
<
|
|
96
|
+
<aside
|
|
97
97
|
ref={ref}
|
|
98
98
|
className={cn(calloutVariants({ variant }), className)}
|
|
99
99
|
data-hook={dataHook}
|
|
100
100
|
data-slot="callout"
|
|
101
101
|
data-tracking-el={trackingEl || `callout-${variant}`}
|
|
102
102
|
data-tracking-label={trackingLabel}
|
|
103
|
+
role="note"
|
|
103
104
|
{...props}
|
|
104
105
|
>
|
|
105
106
|
<div className="flex flex-col gap-8">{children}</div>
|
|
@@ -114,7 +115,7 @@ const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(
|
|
|
114
115
|
data-slot="callout-pointer"
|
|
115
116
|
/>
|
|
116
117
|
)}
|
|
117
|
-
</
|
|
118
|
+
</aside>
|
|
118
119
|
</CalloutContext.Provider>
|
|
119
120
|
);
|
|
120
121
|
}
|