apex-design-cli 1.0.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.
Files changed (66) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +747 -0
  3. package/package.json +57 -0
  4. package/registry/components/accordion.json +26 -0
  5. package/registry/components/alert.json +25 -0
  6. package/registry/components/avatar.json +26 -0
  7. package/registry/components/badge.json +24 -0
  8. package/registry/components/breadcrumb.json +28 -0
  9. package/registry/components/button.json +25 -0
  10. package/registry/components/card.json +28 -0
  11. package/registry/components/checkbox.json +23 -0
  12. package/registry/components/command.json +31 -0
  13. package/registry/components/dialog.json +32 -0
  14. package/registry/components/divider.json +22 -0
  15. package/registry/components/dropdown-menu.json +36 -0
  16. package/registry/components/empty-state.json +21 -0
  17. package/registry/components/error-message.json +20 -0
  18. package/registry/components/field-group.json +20 -0
  19. package/registry/components/helper-text.json +20 -0
  20. package/registry/components/input.json +21 -0
  21. package/registry/components/label.json +20 -0
  22. package/registry/components/progress.json +22 -0
  23. package/registry/components/radio.json +23 -0
  24. package/registry/components/select.json +32 -0
  25. package/registry/components/spinner.json +20 -0
  26. package/registry/components/switch.json +22 -0
  27. package/registry/components/table.json +27 -0
  28. package/registry/components/tabs.json +25 -0
  29. package/registry/components/textarea.json +21 -0
  30. package/registry/components/theme-toggler.json +24 -0
  31. package/registry/components/toast.json +31 -0
  32. package/registry/components/tooltip.json +26 -0
  33. package/registry/components/use-theme.json +19 -0
  34. package/registry/components/utils.json +21 -0
  35. package/registry/registry.json +35 -0
  36. package/registry/source/accordion.tsx +55 -0
  37. package/registry/source/alert.tsx +102 -0
  38. package/registry/source/avatar.tsx +137 -0
  39. package/registry/source/badge.tsx +38 -0
  40. package/registry/source/breadcrumb.tsx +109 -0
  41. package/registry/source/button.tsx +58 -0
  42. package/registry/source/card.tsx +108 -0
  43. package/registry/source/checkbox.tsx +170 -0
  44. package/registry/source/command.tsx +195 -0
  45. package/registry/source/dialog.tsx +133 -0
  46. package/registry/source/divider.tsx +84 -0
  47. package/registry/source/dropdown-menu.tsx +209 -0
  48. package/registry/source/empty-state.tsx +88 -0
  49. package/registry/source/error-message.tsx +49 -0
  50. package/registry/source/field-group.tsx +53 -0
  51. package/registry/source/helper-text.tsx +40 -0
  52. package/registry/source/input.tsx +219 -0
  53. package/registry/source/label.tsx +60 -0
  54. package/registry/source/progress.tsx +84 -0
  55. package/registry/source/radio.tsx +161 -0
  56. package/registry/source/select.tsx +278 -0
  57. package/registry/source/spinner.tsx +84 -0
  58. package/registry/source/switch.tsx +104 -0
  59. package/registry/source/table.tsx +116 -0
  60. package/registry/source/tabs.tsx +55 -0
  61. package/registry/source/textarea.tsx +129 -0
  62. package/registry/source/theme-toggler.tsx +94 -0
  63. package/registry/source/toast.tsx +166 -0
  64. package/registry/source/tooltip.tsx +55 -0
  65. package/registry/source/use-theme.tsx +102 -0
  66. package/registry/source/utils.ts +13 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "tabs",
3
+ "type": "registry:ui",
4
+ "title": "Tabs",
5
+ "description": "A set of layered panels that display one at a time via tab navigation.",
6
+ "category": "navigation",
7
+ "files": [
8
+ {
9
+ "path": "registry/source/tabs.tsx",
10
+ "target": "components/ui/tabs.tsx"
11
+ }
12
+ ],
13
+ "dependencies": [
14
+ "@radix-ui/react-tabs@^1.0.0"
15
+ ],
16
+ "registryDependencies": [
17
+ "utils"
18
+ ],
19
+ "exports": [
20
+ "Tabs",
21
+ "TabsList",
22
+ "TabsTrigger",
23
+ "TabsContent"
24
+ ]
25
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "textarea",
3
+ "type": "registry:ui",
4
+ "title": "Textarea",
5
+ "description": "A multi-line text input field for longer content.",
6
+ "category": "inputs",
7
+ "files": [
8
+ {
9
+ "path": "registry/source/textarea.tsx",
10
+ "target": "components/ui/textarea.tsx"
11
+ }
12
+ ],
13
+ "dependencies": [],
14
+ "registryDependencies": [
15
+ "utils"
16
+ ],
17
+ "exports": [
18
+ "Textarea",
19
+ "TextareaProps"
20
+ ]
21
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "theme-toggler",
3
+ "type": "registry:ui",
4
+ "title": "ThemeToggler",
5
+ "description": "A three-way toggle for switching between light, dark, and system theme modes.",
6
+ "category": "utility",
7
+ "files": [
8
+ {
9
+ "path": "registry/source/theme-toggler.tsx",
10
+ "target": "components/ui/theme-toggler.tsx"
11
+ }
12
+ ],
13
+ "dependencies": [
14
+ "lucide-react@^0.563.0"
15
+ ],
16
+ "registryDependencies": [
17
+ "utils",
18
+ "use-theme"
19
+ ],
20
+ "exports": [
21
+ "ThemeToggler",
22
+ "ThemeTogglerProps"
23
+ ]
24
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "toast",
3
+ "type": "registry:ui",
4
+ "title": "Toast",
5
+ "description": "A brief, auto-dismissing notification message that appears temporarily.",
6
+ "category": "feedback",
7
+ "files": [
8
+ {
9
+ "path": "registry/source/toast.tsx",
10
+ "target": "components/ui/toast.tsx"
11
+ }
12
+ ],
13
+ "dependencies": [
14
+ "@radix-ui/react-toast@^1.0.0",
15
+ "lucide-react@^0.563.0",
16
+ "class-variance-authority@^0.7.1"
17
+ ],
18
+ "registryDependencies": [
19
+ "utils"
20
+ ],
21
+ "exports": [
22
+ "ToastProvider",
23
+ "ToastViewport",
24
+ "Toast",
25
+ "ToastTitle",
26
+ "ToastDescription",
27
+ "ToastClose",
28
+ "ToastAction",
29
+ "ToastContent"
30
+ ]
31
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "tooltip",
3
+ "type": "registry:ui",
4
+ "title": "Tooltip",
5
+ "description": "A popup that displays additional information on hover or focus.",
6
+ "category": "overlay",
7
+ "files": [
8
+ {
9
+ "path": "registry/source/tooltip.tsx",
10
+ "target": "components/ui/tooltip.tsx"
11
+ }
12
+ ],
13
+ "dependencies": [
14
+ "@radix-ui/react-tooltip@^1.0.0"
15
+ ],
16
+ "registryDependencies": [
17
+ "utils"
18
+ ],
19
+ "exports": [
20
+ "TooltipProvider",
21
+ "Tooltip",
22
+ "TooltipTrigger",
23
+ "TooltipContent",
24
+ "SimpleTooltip"
25
+ ]
26
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "use-theme",
3
+ "type": "registry:hook",
4
+ "title": "useTheme",
5
+ "description": "Theme hook and provider for managing light, dark, and system theme modes.",
6
+ "category": "utility",
7
+ "files": [
8
+ {
9
+ "path": "registry/source/use-theme.tsx",
10
+ "target": "hooks/use-theme.tsx"
11
+ }
12
+ ],
13
+ "dependencies": [],
14
+ "registryDependencies": [],
15
+ "exports": [
16
+ "useTheme",
17
+ "ThemeProvider"
18
+ ]
19
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "utils",
3
+ "type": "registry:lib",
4
+ "title": "Utils",
5
+ "description": "Utility function cn() for merging Tailwind CSS classes with conditional logic.",
6
+ "category": "utility",
7
+ "files": [
8
+ {
9
+ "path": "registry/source/utils.ts",
10
+ "target": "lib/utils.ts"
11
+ }
12
+ ],
13
+ "dependencies": [
14
+ "clsx@^2.1.1",
15
+ "tailwind-merge@^3.4.0"
16
+ ],
17
+ "registryDependencies": [],
18
+ "exports": [
19
+ "cn"
20
+ ]
21
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "apex-design-system",
3
+ "version": "1.0.0",
4
+ "components": [
5
+ "accordion",
6
+ "alert",
7
+ "avatar",
8
+ "badge",
9
+ "breadcrumb",
10
+ "button",
11
+ "card",
12
+ "checkbox",
13
+ "command",
14
+ "dialog",
15
+ "divider",
16
+ "dropdown-menu",
17
+ "empty-state",
18
+ "error-message",
19
+ "field-group",
20
+ "helper-text",
21
+ "input",
22
+ "label",
23
+ "progress",
24
+ "radio",
25
+ "select",
26
+ "spinner",
27
+ "switch",
28
+ "table",
29
+ "tabs",
30
+ "textarea",
31
+ "theme-toggler",
32
+ "toast",
33
+ "tooltip"
34
+ ]
35
+ }
@@ -0,0 +1,55 @@
1
+ import * as React from 'react';
2
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
3
+ import { ChevronDown } from 'lucide-react';
4
+ import { cn } from '../../lib/utils';
5
+
6
+ const Accordion = AccordionPrimitive.Root;
7
+
8
+ const AccordionItem = React.forwardRef<
9
+ React.ElementRef<typeof AccordionPrimitive.Item>,
10
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
11
+ >(({ className, ...props }, ref) => (
12
+ <AccordionPrimitive.Item
13
+ ref={ref}
14
+ className={cn('border-b border-semantic-border-default', className)}
15
+ {...props}
16
+ />
17
+ ));
18
+ AccordionItem.displayName = 'AccordionItem';
19
+
20
+ const AccordionTrigger = React.forwardRef<
21
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
22
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
23
+ >(({ className, children, ...props }, ref) => (
24
+ <AccordionPrimitive.Header className="flex">
25
+ <AccordionPrimitive.Trigger
26
+ ref={ref}
27
+ className={cn(
28
+ 'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
29
+ className
30
+ )}
31
+ {...props}
32
+ >
33
+ {children}
34
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
35
+ </AccordionPrimitive.Trigger>
36
+ </AccordionPrimitive.Header>
37
+ ));
38
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
39
+
40
+ const AccordionContent = React.forwardRef<
41
+ React.ElementRef<typeof AccordionPrimitive.Content>,
42
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
43
+ >(({ className, children, ...props }, ref) => (
44
+ <AccordionPrimitive.Content
45
+ ref={ref}
46
+ className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
47
+ {...props}
48
+ >
49
+ <div className={cn('pb-4 pt-0', className)}>{children}</div>
50
+ </AccordionPrimitive.Content>
51
+ ));
52
+
53
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
54
+
55
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
@@ -0,0 +1,102 @@
1
+ import * as React from 'react';
2
+ import { cva, type VariantProps } from 'class-variance-authority';
3
+ import { cn } from '../../lib/utils';
4
+ import { AlertCircle, CheckCircle2, Info, XCircle, X } from 'lucide-react';
5
+
6
+ const alertVariants = cva(
7
+ 'relative w-full rounded-lg border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-semantic-fg-primary',
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: 'bg-semantic-bg-elevated text-semantic-fg-primary border-semantic-border-default',
12
+ info: 'border-semantic-status-info-border bg-semantic-status-info-bg text-semantic-status-info-fg [&>svg]:text-semantic-status-info-icon',
13
+ success: 'border-semantic-status-success-border bg-semantic-status-success-bg text-semantic-status-success-fg [&>svg]:text-semantic-status-success-icon',
14
+ warning: 'border-semantic-status-warning-border bg-semantic-status-warning-bg text-semantic-status-warning-fg [&>svg]:text-semantic-status-warning-icon',
15
+ error: 'border-semantic-status-error-border bg-semantic-status-error-bg text-semantic-status-error-fg [&>svg]:text-semantic-status-error-icon',
16
+ },
17
+ },
18
+ defaultVariants: {
19
+ variant: 'default',
20
+ },
21
+ }
22
+ );
23
+
24
+ export interface AlertProps
25
+ extends React.HTMLAttributes<HTMLDivElement>,
26
+ VariantProps<typeof alertVariants> {
27
+ icon?: React.ReactNode;
28
+ showIcon?: boolean;
29
+ closable?: boolean;
30
+ onClose?: () => void;
31
+ }
32
+
33
+ const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
34
+ ({ className, variant, icon, showIcon = true, closable, onClose, children, ...props }, ref) => {
35
+ const [visible, setVisible] = React.useState(true);
36
+
37
+ const handleClose = () => {
38
+ setVisible(false);
39
+ onClose?.();
40
+ };
41
+
42
+ if (!visible) return null;
43
+
44
+ const defaultIcons = {
45
+ default: <Info className="h-4 w-4" />,
46
+ info: <Info className="h-4 w-4" />,
47
+ success: <CheckCircle2 className="h-4 w-4" />,
48
+ warning: <AlertCircle className="h-4 w-4" />,
49
+ error: <XCircle className="h-4 w-4" />,
50
+ };
51
+
52
+ const iconToRender = icon || defaultIcons[variant || 'default'];
53
+
54
+ return (
55
+ <div
56
+ ref={ref}
57
+ role="alert"
58
+ className={cn(alertVariants({ variant }), className)}
59
+ {...props}
60
+ >
61
+ {showIcon && <span aria-hidden="true">{iconToRender}</span>}
62
+ <div className={cn(showIcon && 'pl-7', closable && 'pr-8')}>{children}</div>
63
+ {closable && (
64
+ <button
65
+ onClick={handleClose}
66
+ className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-semantic-offset transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-semantic-focus focus:ring-offset-2"
67
+ >
68
+ <X className="h-4 w-4" />
69
+ <span className="sr-only">Close</span>
70
+ </button>
71
+ )}
72
+ </div>
73
+ );
74
+ }
75
+ );
76
+ Alert.displayName = 'Alert';
77
+
78
+ const AlertTitle = React.forwardRef<
79
+ HTMLParagraphElement,
80
+ React.HTMLAttributes<HTMLHeadingElement>
81
+ >(({ className, ...props }, ref) => (
82
+ <h5
83
+ ref={ref}
84
+ className={cn('mb-1 font-medium leading-none tracking-tight', className)}
85
+ {...props}
86
+ />
87
+ ));
88
+ AlertTitle.displayName = 'AlertTitle';
89
+
90
+ const AlertDescription = React.forwardRef<
91
+ HTMLParagraphElement,
92
+ React.HTMLAttributes<HTMLParagraphElement>
93
+ >(({ className, ...props }, ref) => (
94
+ <div
95
+ ref={ref}
96
+ className={cn('text-sm [&_p]:leading-relaxed', className)}
97
+ {...props}
98
+ />
99
+ ));
100
+ AlertDescription.displayName = 'AlertDescription';
101
+
102
+ export { Alert, AlertTitle, AlertDescription, alertVariants };
@@ -0,0 +1,137 @@
1
+ import * as React from 'react';
2
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
3
+ import { cva, type VariantProps } from 'class-variance-authority';
4
+ import { cn } from '../../lib/utils';
5
+
6
+ const avatarVariants = cva(
7
+ 'relative flex shrink-0 overflow-hidden rounded-full',
8
+ {
9
+ variants: {
10
+ size: {
11
+ sm: 'h-8 w-8 text-xs',
12
+ md: 'h-10 w-10 text-sm',
13
+ lg: 'h-12 w-12 text-base',
14
+ xl: 'h-16 w-16 text-lg',
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ size: 'md',
19
+ },
20
+ }
21
+ );
22
+
23
+ const Avatar = React.forwardRef<
24
+ React.ElementRef<typeof AvatarPrimitive.Root>,
25
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> &
26
+ VariantProps<typeof avatarVariants>
27
+ >(({ className, size, ...props }, ref) => (
28
+ <AvatarPrimitive.Root
29
+ ref={ref}
30
+ className={cn(avatarVariants({ size }), className)}
31
+ {...props}
32
+ />
33
+ ));
34
+ Avatar.displayName = AvatarPrimitive.Root.displayName;
35
+
36
+ interface AvatarImageProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> {
37
+ alt: string;
38
+ }
39
+
40
+ const AvatarImage = React.forwardRef<
41
+ React.ElementRef<typeof AvatarPrimitive.Image>,
42
+ AvatarImageProps
43
+ >(({ className, alt, ...props }, ref) => (
44
+ <AvatarPrimitive.Image
45
+ ref={ref}
46
+ className={cn('aspect-square h-full w-full object-cover', className)}
47
+ alt={alt}
48
+ {...props}
49
+ />
50
+ ));
51
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName;
52
+
53
+ const AvatarFallback = React.forwardRef<
54
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
55
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
56
+ >(({ className, ...props }, ref) => (
57
+ <AvatarPrimitive.Fallback
58
+ ref={ref}
59
+ className={cn(
60
+ 'flex h-full w-full items-center justify-center rounded-full bg-semantic-bg-sunken font-medium text-semantic-fg-primary',
61
+ className
62
+ )}
63
+ {...props}
64
+ />
65
+ ));
66
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
67
+
68
+ export interface AvatarWithLabelProps
69
+ extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> {
70
+ src?: string;
71
+ alt?: string;
72
+ fallback?: string;
73
+ size?: 'sm' | 'md' | 'lg' | 'xl';
74
+ label?: string;
75
+ description?: string;
76
+ status?: 'online' | 'offline' | 'away' | 'busy';
77
+ }
78
+
79
+ const AvatarWithLabel = React.forwardRef<
80
+ React.ElementRef<typeof AvatarPrimitive.Root>,
81
+ AvatarWithLabelProps
82
+ >(({ src, alt, fallback, size = 'md', label, description, status, className, ...props }, ref) => {
83
+ const statusColors = {
84
+ online: 'bg-semantic-indicator-online',
85
+ offline: 'bg-semantic-indicator-offline',
86
+ away: 'bg-semantic-indicator-away',
87
+ busy: 'bg-semantic-indicator-busy',
88
+ };
89
+
90
+ const statusSizes = {
91
+ sm: 'h-2 w-2 border',
92
+ md: 'h-2.5 w-2.5 border-2',
93
+ lg: 'h-3 w-3 border-2',
94
+ xl: 'h-4 w-4 border-2',
95
+ };
96
+
97
+ const avatarComponent = (
98
+ <div className="relative">
99
+ <Avatar size={size} className={className} ref={ref} {...props}>
100
+ {src && <AvatarImage src={src} alt={alt || ''} />}
101
+ <AvatarFallback>{fallback}</AvatarFallback>
102
+ </Avatar>
103
+ {status && (
104
+ <span
105
+ className={cn(
106
+ 'absolute bottom-0 right-0 block rounded-full border-semantic-indicator-border',
107
+ statusColors[status],
108
+ statusSizes[size]
109
+ )}
110
+ role="status"
111
+ aria-label={status.charAt(0).toUpperCase() + status.slice(1)}
112
+ />
113
+ )}
114
+ </div>
115
+ );
116
+
117
+ if (!label && !description) {
118
+ return avatarComponent;
119
+ }
120
+
121
+ return (
122
+ <div className="flex items-center gap-3">
123
+ {avatarComponent}
124
+ <div className="flex flex-col">
125
+ {label && (
126
+ <span className="text-sm font-medium text-semantic-fg-primary">{label}</span>
127
+ )}
128
+ {description && (
129
+ <span className="text-xs text-semantic-fg-secondary">{description}</span>
130
+ )}
131
+ </div>
132
+ </div>
133
+ );
134
+ });
135
+ AvatarWithLabel.displayName = 'AvatarWithLabel';
136
+
137
+ export { Avatar, AvatarImage, AvatarFallback, AvatarWithLabel };
@@ -0,0 +1,38 @@
1
+ import * as React from 'react';
2
+ import { cva, type VariantProps } from 'class-variance-authority';
3
+ import { cn } from '../../lib/utils';
4
+
5
+ const badgeVariants = cva(
6
+ 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ring-offset-semantic-offset',
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: 'border-transparent bg-semantic-badge-default-bg text-semantic-badge-default-fg hover:opacity-80',
11
+ secondary: 'border-transparent bg-semantic-badge-secondary-bg text-semantic-badge-secondary-fg hover:opacity-80',
12
+ success: 'border-transparent bg-semantic-status-success-solid text-semantic-fg-inverse hover:opacity-80',
13
+ warning: 'border-transparent bg-semantic-status-warning-solid text-semantic-fg-inverse hover:opacity-80',
14
+ error: 'border-transparent bg-semantic-status-error-icon text-semantic-fg-inverse hover:opacity-80',
15
+ outline: 'text-semantic-badge-outline-fg border-semantic-badge-outline-border hover:bg-semantic-bg-hover',
16
+ },
17
+ size: {
18
+ sm: 'px-2 py-0 text-xs',
19
+ md: 'px-2.5 py-0.5 text-xs',
20
+ lg: 'px-3 py-1 text-sm',
21
+ },
22
+ },
23
+ defaultVariants: {
24
+ variant: 'default',
25
+ size: 'md',
26
+ },
27
+ }
28
+ );
29
+
30
+ export interface BadgeProps
31
+ extends React.HTMLAttributes<HTMLSpanElement>,
32
+ VariantProps<typeof badgeVariants> {}
33
+
34
+ function Badge({ className, variant, size, ...props }: BadgeProps) {
35
+ return <span className={cn(badgeVariants({ variant, size }), className)} {...props} />;
36
+ }
37
+
38
+ export { Badge, badgeVariants };
@@ -0,0 +1,109 @@
1
+ import * as React from 'react';
2
+ import { ChevronRight, MoreHorizontal } from 'lucide-react';
3
+ import { cn } from '../../lib/utils';
4
+
5
+ const Breadcrumb = React.forwardRef<
6
+ HTMLElement,
7
+ React.ComponentPropsWithoutRef<'nav'> & {
8
+ separator?: React.ReactNode;
9
+ }
10
+ >(({ className, ...props }, ref) => (
11
+ <nav ref={ref} aria-label="breadcrumb" {...props} />
12
+ ));
13
+ Breadcrumb.displayName = 'Breadcrumb';
14
+
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-semantic-fg-muted sm:gap-2.5',
23
+ className
24
+ )}
25
+ {...props}
26
+ />
27
+ ));
28
+ BreadcrumbList.displayName = 'BreadcrumbList';
29
+
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';
41
+
42
+ const BreadcrumbLink = React.forwardRef<
43
+ HTMLAnchorElement,
44
+ React.ComponentPropsWithoutRef<'a'>
45
+ >(({ className, ...props }, ref) => (
46
+ <a
47
+ ref={ref}
48
+ className={cn('transition-colors hover:text-semantic-fg-primary', className)}
49
+ {...props}
50
+ />
51
+ ));
52
+ BreadcrumbLink.displayName = 'BreadcrumbLink';
53
+
54
+ const BreadcrumbPage = React.forwardRef<
55
+ HTMLSpanElement,
56
+ React.ComponentPropsWithoutRef<'span'>
57
+ >(({ className, ...props }, ref) => (
58
+ <span
59
+ ref={ref}
60
+ role="link"
61
+ aria-disabled="true"
62
+ aria-current="page"
63
+ className={cn('font-medium text-semantic-fg-primary', className)}
64
+ {...props}
65
+ />
66
+ ));
67
+ BreadcrumbPage.displayName = 'BreadcrumbPage';
68
+
69
+ const BreadcrumbSeparator = ({
70
+ children,
71
+ className,
72
+ ...props
73
+ }: React.ComponentProps<'li'>) => (
74
+ <li
75
+ role="presentation"
76
+ aria-hidden="true"
77
+ className={cn('[&>svg]:h-3.5 [&>svg]:w-3.5', className)}
78
+ {...props}
79
+ >
80
+ {children || <ChevronRight />}
81
+ </li>
82
+ );
83
+ BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
84
+
85
+ const BreadcrumbEllipsis = ({
86
+ className,
87
+ ...props
88
+ }: React.ComponentProps<'span'>) => (
89
+ <span
90
+ role="presentation"
91
+ aria-hidden="true"
92
+ className={cn('flex h-9 w-9 items-center justify-center', className)}
93
+ {...props}
94
+ >
95
+ <MoreHorizontal className="h-4 w-4" />
96
+ <span className="sr-only">More</span>
97
+ </span>
98
+ );
99
+ BreadcrumbEllipsis.displayName = 'BreadcrumbElipssis';
100
+
101
+ export {
102
+ Breadcrumb,
103
+ BreadcrumbList,
104
+ BreadcrumbItem,
105
+ BreadcrumbLink,
106
+ BreadcrumbPage,
107
+ BreadcrumbSeparator,
108
+ BreadcrumbEllipsis,
109
+ };