1- import * as React from "react" ;
2- import { Slot } from "@radix-ui/react-slot" ;
3- import { ChevronRight , MoreHorizontal } from "lucide-react" ;
1+ import * as React from "react"
2+ import { Slot } from "@radix-ui/react-slot"
3+ import { ChevronRight , MoreHorizontal } from "lucide-react"
44
5- import { cn } from "@/lib/utils" ;
5+ import { cn } from "@/lib/utils"
66
7- const Breadcrumb = React . forwardRef <
8- HTMLElement ,
9- React . ComponentPropsWithoutRef < "nav" > & {
10- separator ?: React . ReactNode ;
11- }
12- > ( ( { ...props } , ref ) => < nav ref = { ref } aria-label = "breadcrumb" { ...props } /> ) ;
13- Breadcrumb . displayName = "Breadcrumb" ;
7+ function Breadcrumb ( { ...props } : React . ComponentProps < "nav" > ) {
8+ return < nav aria-label = "breadcrumb" data-slot = "breadcrumb" { ...props } />
9+ }
1410
15- const BreadcrumbList = React . forwardRef <
16- HTMLOListElement ,
17- React . ComponentPropsWithoutRef < "ol" >
18- > ( ( { className, ...props } , ref ) => (
19- < ol
20- ref = { ref }
21- className = { cn (
22- "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5" ,
23- className ,
24- ) }
25- { ...props }
26- />
27- ) ) ;
28- BreadcrumbList . displayName = "BreadcrumbList" ;
11+ function BreadcrumbList ( { className, ...props } : React . ComponentProps < "ol" > ) {
12+ return (
13+ < ol
14+ data-slot = "breadcrumb-list"
15+ className = { cn (
16+ "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5" ,
17+ className
18+ ) }
19+ { ...props }
20+ />
21+ )
22+ }
2923
30- const BreadcrumbItem = React . forwardRef <
31- HTMLLIElement ,
32- React . ComponentPropsWithoutRef < "li" >
33- > ( ( { className, ...props } , ref ) => (
34- < li
35- ref = { ref }
36- className = { cn ( "inline-flex items-center gap-1.5" , className ) }
37- { ...props }
38- />
39- ) ) ;
40- BreadcrumbItem . displayName = "BreadcrumbItem" ;
24+ function BreadcrumbItem ( { className, ...props } : React . ComponentProps < "li" > ) {
25+ return (
26+ < li
27+ data-slot = "breadcrumb-item"
28+ className = { cn ( "inline-flex items-center gap-1.5" , className ) }
29+ { ...props }
30+ />
31+ )
32+ }
4133
42- const BreadcrumbLink = React . forwardRef <
43- HTMLAnchorElement ,
44- React . ComponentPropsWithoutRef < "a" > & {
45- asChild ?: boolean ;
46- }
47- > ( ( { asChild, className, ...props } , ref ) => {
48- const Comp = asChild ? Slot : "a" ;
34+ function BreadcrumbLink ( {
35+ asChild,
36+ className,
37+ ...props
38+ } : React . ComponentProps < "a" > & {
39+ asChild ?: boolean
40+ } ) {
41+ const Comp = asChild ? Slot : "a"
4942
5043 return (
5144 < Comp
52- ref = { ref }
53- className = { cn (
54- "transition-colors hover:text-foreground" ,
55- className ,
56- ) }
45+ data-slot = "breadcrumb-link"
46+ className = { cn ( "hover:text-foreground transition-colors" , className ) }
5747 { ...props }
5848 />
59- ) ;
60- } ) ;
61- BreadcrumbLink . displayName = "BreadcrumbLink" ;
49+ )
50+ }
6251
63- const BreadcrumbPage = React . forwardRef <
64- HTMLSpanElement ,
65- React . ComponentPropsWithoutRef < "span" >
66- > ( ( { className, ...props } , ref ) => (
67- < span
68- ref = { ref }
69- role = "link"
70- aria-disabled = "true"
71- aria-current = "page"
72- className = { cn ( "font-normal text-foreground" , className ) }
73- { ...props }
74- />
75- ) ) ;
76- BreadcrumbPage . displayName = "BreadcrumbPage" ;
52+ function BreadcrumbPage ( { className, ...props } : React . ComponentProps < "span" > ) {
53+ return (
54+ < span
55+ data-slot = "breadcrumb-page"
56+ role = "link"
57+ aria-disabled = "true"
58+ aria-current = "page"
59+ className = { cn ( "text-foreground font-normal" , className ) }
60+ { ...props }
61+ />
62+ )
63+ }
7764
78- const BreadcrumbSeparator = ( {
65+ function BreadcrumbSeparator ( {
7966 children,
8067 className,
8168 ...props
82- } : React . ComponentProps < "li" > ) => (
83- < li
84- role = "presentation"
85- aria-hidden = "true"
86- className = { cn ( "[&>svg]:size-3.5" , className ) }
87- { ...props }
88- >
89- { children ?? < ChevronRight /> }
90- </ li >
91- ) ;
92- BreadcrumbSeparator . displayName = "BreadcrumbSeparator" ;
69+ } : React . ComponentProps < "li" > ) {
70+ return (
71+ < li
72+ data-slot = "breadcrumb-separator"
73+ role = "presentation"
74+ aria-hidden = "true"
75+ className = { cn ( "[&>svg]:size-3.5" , className ) }
76+ { ...props }
77+ >
78+ { children ?? < ChevronRight /> }
79+ </ li >
80+ )
81+ }
9382
94- const BreadcrumbEllipsis = ( {
83+ function BreadcrumbEllipsis ( {
9584 className,
9685 ...props
97- } : React . ComponentProps < "span" > ) => (
98- < span
99- role = "presentation"
100- aria-hidden = "true"
101- className = { cn ( "flex h-9 w-9 items-center justify-center" , className ) }
102- { ...props }
103- >
104- < MoreHorizontal className = "h-4 w-4" />
105- < span className = "sr-only" > More</ span >
106- </ span >
107- ) ;
108- BreadcrumbEllipsis . displayName = "BreadcrumbElipssis" ;
86+ } : React . ComponentProps < "span" > ) {
87+ return (
88+ < span
89+ data-slot = "breadcrumb-ellipsis"
90+ role = "presentation"
91+ aria-hidden = "true"
92+ className = { cn ( "flex size-9 items-center justify-center" , className ) }
93+ { ...props }
94+ >
95+ < MoreHorizontal className = "size-4" />
96+ < span className = "sr-only" > More</ span >
97+ </ span >
98+ )
99+ }
109100
110101export {
111102 Breadcrumb ,
@@ -115,4 +106,4 @@ export {
115106 BreadcrumbPage ,
116107 BreadcrumbSeparator ,
117108 BreadcrumbEllipsis ,
118- } ;
109+ }
0 commit comments