ui-arreya-components 0.0.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/.storybook/main.ts +18 -0
- package/.storybook/preview.ts +16 -0
- package/.storybook/vitest.setup.ts +9 -0
- package/README.md +54 -0
- package/components.json +21 -0
- package/dist/styles.css +3 -0
- package/dist/ui.cjs.js +31 -0
- package/dist/ui.es.js +3060 -0
- package/dist/ui.umd.js +31 -0
- package/eslint.config.js +28 -0
- package/package.json +120 -0
- package/postcss.config.js +6 -0
- package/scripts/template.sh +57 -0
- package/src/components/feature/login-form.stories.tsx +35 -0
- package/src/components/feature/login-form.tsx +97 -0
- package/src/components/index.ts +1 -0
- package/src/components/ui/accordion.stories.tsx.disabled +36 -0
- package/src/components/ui/accordion.tsx +55 -0
- package/src/components/ui/alert-dialog.stories.tsx +46 -0
- package/src/components/ui/alert-dialog.tsx +139 -0
- package/src/components/ui/alert.stories.tsx +45 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/aspect-ratio.stories.tsx +24 -0
- package/src/components/ui/aspect-ratio.tsx +5 -0
- package/src/components/ui/avatar.stories.tsx +29 -0
- package/src/components/ui/avatar.tsx +48 -0
- package/src/components/ui/badge.stories.tsx +43 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.stories.tsx +146 -0
- package/src/components/ui/breadcrumb.tsx +115 -0
- package/src/components/ui/button.stories.tsx +87 -0
- package/src/components/ui/button.tsx +57 -0
- package/src/components/ui/card.stories.tsx +99 -0
- package/src/components/ui/card.tsx +76 -0
- package/src/components/ui/carousel.stories.tsx +47 -0
- package/src/components/ui/carousel.tsx +260 -0
- package/src/components/ui/chart.tsx +363 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/context-menu.tsx +198 -0
- package/src/components/ui/dialog.tsx +120 -0
- package/src/components/ui/drawer.tsx +116 -0
- package/src/components/ui/dropdown-menu.stories.tsx +92 -0
- package/src/components/ui/dropdown-menu.tsx +199 -0
- package/src/components/ui/form.tsx +176 -0
- package/src/components/ui/hover-card.tsx +27 -0
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/input-otp.tsx +69 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/menubar.tsx +254 -0
- package/src/components/ui/navigation-menu.tsx +128 -0
- package/src/components/ui/pagination.tsx +117 -0
- package/src/components/ui/popover.tsx +31 -0
- package/src/components/ui/progress.tsx +26 -0
- package/src/components/ui/radio-group.tsx +42 -0
- package/src/components/ui/resizable.tsx +43 -0
- package/src/components/ui/scroll-area.tsx +46 -0
- package/src/components/ui/select.tsx +157 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +140 -0
- package/src/components/ui/sidebar.tsx +771 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +26 -0
- package/src/components/ui/sonner.tsx +29 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/table.tsx +120 -0
- package/src/components/ui/tabs.tsx +53 -0
- package/src/components/ui/textarea.tsx +22 -0
- package/src/components/ui/toast.tsx +127 -0
- package/src/components/ui/toaster.tsx +33 -0
- package/src/components/ui/toggle-group.tsx +59 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +30 -0
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/hooks/use-toast.ts +194 -0
- package/src/index.css +3484 -0
- package/src/index.ts +1 -0
- package/src/lib/types.ts +5 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/tailwind.css +86 -0
- package/tailwind.config.js +96 -0
- package/tsconfig.app.json +30 -0
- package/tsconfig.json +13 -0
- package/tsconfig.node.json +24 -0
- package/vite.config.ts +33 -0
- package/vitest.workspace.ts +32 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import { buttonVariants } from "@/components/ui/button"
|
|
6
|
+
|
|
7
|
+
const AlertDialog = AlertDialogPrimitive.Root
|
|
8
|
+
|
|
9
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
10
|
+
|
|
11
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
|
12
|
+
|
|
13
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
16
|
+
>(({ className, ...props }, ref) => (
|
|
17
|
+
<AlertDialogPrimitive.Overlay
|
|
18
|
+
className={cn(
|
|
19
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
ref={ref}
|
|
24
|
+
/>
|
|
25
|
+
))
|
|
26
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
|
27
|
+
|
|
28
|
+
const AlertDialogContent = React.forwardRef<
|
|
29
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
31
|
+
>(({ className, ...props }, ref) => (
|
|
32
|
+
<AlertDialogPortal>
|
|
33
|
+
<AlertDialogOverlay />
|
|
34
|
+
<AlertDialogPrimitive.Content
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn(
|
|
37
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
38
|
+
className
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
</AlertDialogPortal>
|
|
43
|
+
))
|
|
44
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
|
45
|
+
|
|
46
|
+
const AlertDialogHeader = ({
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
50
|
+
<div
|
|
51
|
+
className={cn(
|
|
52
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
AlertDialogHeader.displayName = "AlertDialogHeader"
|
|
59
|
+
|
|
60
|
+
const AlertDialogFooter = ({
|
|
61
|
+
className,
|
|
62
|
+
...props
|
|
63
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
64
|
+
<div
|
|
65
|
+
className={cn(
|
|
66
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
67
|
+
className
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
AlertDialogFooter.displayName = "AlertDialogFooter"
|
|
73
|
+
|
|
74
|
+
const AlertDialogTitle = React.forwardRef<
|
|
75
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
76
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
77
|
+
>(({ className, ...props }, ref) => (
|
|
78
|
+
<AlertDialogPrimitive.Title
|
|
79
|
+
ref={ref}
|
|
80
|
+
className={cn("text-lg font-semibold", className)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
))
|
|
84
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
|
85
|
+
|
|
86
|
+
const AlertDialogDescription = React.forwardRef<
|
|
87
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
88
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
89
|
+
>(({ className, ...props }, ref) => (
|
|
90
|
+
<AlertDialogPrimitive.Description
|
|
91
|
+
ref={ref}
|
|
92
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
))
|
|
96
|
+
AlertDialogDescription.displayName =
|
|
97
|
+
AlertDialogPrimitive.Description.displayName
|
|
98
|
+
|
|
99
|
+
const AlertDialogAction = React.forwardRef<
|
|
100
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
101
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
102
|
+
>(({ className, ...props }, ref) => (
|
|
103
|
+
<AlertDialogPrimitive.Action
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={cn(buttonVariants(), className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
))
|
|
109
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
|
110
|
+
|
|
111
|
+
const AlertDialogCancel = React.forwardRef<
|
|
112
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
113
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
114
|
+
>(({ className, ...props }, ref) => (
|
|
115
|
+
<AlertDialogPrimitive.Cancel
|
|
116
|
+
ref={ref}
|
|
117
|
+
className={cn(
|
|
118
|
+
buttonVariants({ variant: "outline" }),
|
|
119
|
+
"mt-2 sm:mt-0",
|
|
120
|
+
className
|
|
121
|
+
)}
|
|
122
|
+
{...props}
|
|
123
|
+
/>
|
|
124
|
+
))
|
|
125
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
AlertDialog,
|
|
129
|
+
AlertDialogPortal,
|
|
130
|
+
AlertDialogOverlay,
|
|
131
|
+
AlertDialogTrigger,
|
|
132
|
+
AlertDialogContent,
|
|
133
|
+
AlertDialogHeader,
|
|
134
|
+
AlertDialogFooter,
|
|
135
|
+
AlertDialogTitle,
|
|
136
|
+
AlertDialogDescription,
|
|
137
|
+
AlertDialogAction,
|
|
138
|
+
AlertDialogCancel,
|
|
139
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { AlertCircle, Terminal } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Alert,
|
|
7
|
+
AlertTitle,
|
|
8
|
+
AlertDescription
|
|
9
|
+
} from "./alert"
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: "Components/Alert",
|
|
13
|
+
component: Alert,
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: "centered",
|
|
16
|
+
},
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
} satisfies Meta<typeof Alert>
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof meta>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
render: () => (
|
|
25
|
+
<Alert>
|
|
26
|
+
<Terminal className="h-4 w-4" />
|
|
27
|
+
<AlertTitle>Heads up!</AlertTitle>
|
|
28
|
+
<AlertDescription>
|
|
29
|
+
You can add components and dependencies to your app using the cli.
|
|
30
|
+
</AlertDescription>
|
|
31
|
+
</Alert>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Destructive: Story = {
|
|
36
|
+
render: () => (
|
|
37
|
+
<Alert variant="destructive">
|
|
38
|
+
<AlertCircle className="h-4 w-4" />
|
|
39
|
+
<AlertTitle>Error</AlertTitle>
|
|
40
|
+
<AlertDescription>
|
|
41
|
+
Your session has expired. Please log in again.
|
|
42
|
+
</AlertDescription>
|
|
43
|
+
</Alert>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const alertVariants = cva(
|
|
7
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-background text-foreground",
|
|
12
|
+
destructive:
|
|
13
|
+
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "default",
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const Alert = React.forwardRef<
|
|
23
|
+
HTMLDivElement,
|
|
24
|
+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
|
25
|
+
>(({ className, variant, ...props }, ref) => (
|
|
26
|
+
<div
|
|
27
|
+
ref={ref}
|
|
28
|
+
role="alert"
|
|
29
|
+
className={cn(alertVariants({ variant }), className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
))
|
|
33
|
+
Alert.displayName = "Alert"
|
|
34
|
+
|
|
35
|
+
const AlertTitle = React.forwardRef<
|
|
36
|
+
HTMLParagraphElement,
|
|
37
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
|
38
|
+
>(({ className, ...props }, ref) => (
|
|
39
|
+
<h5
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
))
|
|
45
|
+
AlertTitle.displayName = "AlertTitle"
|
|
46
|
+
|
|
47
|
+
const AlertDescription = React.forwardRef<
|
|
48
|
+
HTMLParagraphElement,
|
|
49
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
50
|
+
>(({ className, ...props }, ref) => (
|
|
51
|
+
<div
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn("text-sm [&_p]:leading-relaxed", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
))
|
|
57
|
+
AlertDescription.displayName = "AlertDescription"
|
|
58
|
+
|
|
59
|
+
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AspectRatio
|
|
5
|
+
} from "./aspect-ratio"
|
|
6
|
+
|
|
7
|
+
const meta = { title: "Components/AspectRatio",
|
|
8
|
+
component: AspectRatio,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
},
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
} satisfies Meta<typeof AspectRatio>
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof meta>
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
render: () => (
|
|
20
|
+
<AspectRatio ratio={16 / 9}>
|
|
21
|
+
<image href="https://github.com/shadcn.png" />
|
|
22
|
+
</AspectRatio>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Avatar,
|
|
5
|
+
AvatarImage,
|
|
6
|
+
AvatarFallback
|
|
7
|
+
} from './avatar';
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Components/Avatar',
|
|
11
|
+
component: Avatar,
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: "centered"
|
|
14
|
+
},
|
|
15
|
+
tags: ["autodocs"]
|
|
16
|
+
} satisfies Meta<typeof Avatar>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<Avatar>
|
|
25
|
+
<AvatarImage src="https://github.com/shadcn.png" />
|
|
26
|
+
<AvatarFallback>CN</AvatarFallback>
|
|
27
|
+
</Avatar>
|
|
28
|
+
)
|
|
29
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const Avatar = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<AvatarPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
))
|
|
19
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName
|
|
20
|
+
|
|
21
|
+
const AvatarImage = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
24
|
+
>(({ className, ...props }, ref) => (
|
|
25
|
+
<AvatarPrimitive.Image
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn("aspect-square h-full w-full", className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
))
|
|
31
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
|
32
|
+
|
|
33
|
+
const AvatarFallback = React.forwardRef<
|
|
34
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
36
|
+
>(({ className, ...props }, ref) => (
|
|
37
|
+
<AvatarPrimitive.Fallback
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
))
|
|
46
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
|
47
|
+
|
|
48
|
+
export { Avatar, AvatarImage, AvatarFallback }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Badge
|
|
5
|
+
} from './badge';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Badge',
|
|
9
|
+
component: Badge,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered"
|
|
12
|
+
},
|
|
13
|
+
tags: ["autodocs"]
|
|
14
|
+
} satisfies Meta<typeof Badge>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
render: () => (
|
|
22
|
+
<Badge>Badge</Badge>
|
|
23
|
+
)
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Secondary: Story = {
|
|
27
|
+
render: () => (
|
|
28
|
+
<Badge variant="secondary">Badge</Badge>
|
|
29
|
+
)
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Outline: Story = {
|
|
33
|
+
render: () => (
|
|
34
|
+
<Badge variant="outline">Badge</Badge>
|
|
35
|
+
)
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Destructive: Story = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<Badge variant="destructive">Badge</Badge>
|
|
41
|
+
)
|
|
42
|
+
};
|
|
43
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default:
|
|
12
|
+
"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
|
|
13
|
+
secondary:
|
|
14
|
+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
15
|
+
destructive:
|
|
16
|
+
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
|
|
17
|
+
outline: "text-foreground",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: "default",
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
export interface BadgeProps
|
|
27
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
28
|
+
VariantProps<typeof badgeVariants> {}
|
|
29
|
+
|
|
30
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { ChevronDown, Slash } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Breadcrumb,
|
|
7
|
+
BreadcrumbEllipsis,
|
|
8
|
+
BreadcrumbItem,
|
|
9
|
+
BreadcrumbLink,
|
|
10
|
+
BreadcrumbList,
|
|
11
|
+
BreadcrumbPage,
|
|
12
|
+
BreadcrumbSeparator,
|
|
13
|
+
} from './breadcrumb';
|
|
14
|
+
import {
|
|
15
|
+
DropdownMenu,
|
|
16
|
+
DropdownMenuContent,
|
|
17
|
+
DropdownMenuItem,
|
|
18
|
+
DropdownMenuTrigger,
|
|
19
|
+
} from './dropdown-menu'
|
|
20
|
+
|
|
21
|
+
const meta = {
|
|
22
|
+
title: 'Components/Breadcrumb',
|
|
23
|
+
component: Breadcrumb,
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: "centered"
|
|
26
|
+
},
|
|
27
|
+
tags: ["autodocs"]
|
|
28
|
+
} satisfies Meta<typeof Breadcrumb>;
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
|
|
32
|
+
type Story = StoryObj<typeof meta>;
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<Breadcrumb>
|
|
37
|
+
<BreadcrumbList>
|
|
38
|
+
<BreadcrumbItem>
|
|
39
|
+
<BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
40
|
+
</BreadcrumbItem>
|
|
41
|
+
<BreadcrumbSeparator />
|
|
42
|
+
<BreadcrumbItem>
|
|
43
|
+
<DropdownMenu>
|
|
44
|
+
<DropdownMenuTrigger className="flex items-center gap-1">
|
|
45
|
+
<BreadcrumbEllipsis className="h-4 w-4" />
|
|
46
|
+
<span className="sr-only">Toggle menu</span>
|
|
47
|
+
</DropdownMenuTrigger>
|
|
48
|
+
<DropdownMenuContent align="start">
|
|
49
|
+
<DropdownMenuItem>Documentation</DropdownMenuItem>
|
|
50
|
+
<DropdownMenuItem>Themes</DropdownMenuItem>
|
|
51
|
+
<DropdownMenuItem>GitHub</DropdownMenuItem>
|
|
52
|
+
</DropdownMenuContent>
|
|
53
|
+
</DropdownMenu>
|
|
54
|
+
</BreadcrumbItem>
|
|
55
|
+
<BreadcrumbSeparator />
|
|
56
|
+
<BreadcrumbItem>
|
|
57
|
+
<BreadcrumbLink href="/docs/components">Components</BreadcrumbLink>
|
|
58
|
+
</BreadcrumbItem>
|
|
59
|
+
<BreadcrumbSeparator />
|
|
60
|
+
<BreadcrumbItem>
|
|
61
|
+
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
|
|
62
|
+
</BreadcrumbItem>
|
|
63
|
+
</BreadcrumbList>
|
|
64
|
+
</Breadcrumb>
|
|
65
|
+
)
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const CustomSeperator: Story = {
|
|
69
|
+
render: () => (
|
|
70
|
+
<Breadcrumb>
|
|
71
|
+
<BreadcrumbList>
|
|
72
|
+
<BreadcrumbItem>
|
|
73
|
+
<BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
74
|
+
</BreadcrumbItem>
|
|
75
|
+
<BreadcrumbSeparator>
|
|
76
|
+
<Slash />
|
|
77
|
+
</BreadcrumbSeparator>
|
|
78
|
+
<BreadcrumbItem>
|
|
79
|
+
<BreadcrumbLink href="/components">Components</BreadcrumbLink>
|
|
80
|
+
</BreadcrumbItem>
|
|
81
|
+
</BreadcrumbList>
|
|
82
|
+
</Breadcrumb>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const Dropdown: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<Breadcrumb>
|
|
89
|
+
<BreadcrumbList>
|
|
90
|
+
<BreadcrumbItem>
|
|
91
|
+
<BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
92
|
+
</BreadcrumbItem>
|
|
93
|
+
<BreadcrumbSeparator>
|
|
94
|
+
<Slash />
|
|
95
|
+
</BreadcrumbSeparator>
|
|
96
|
+
<BreadcrumbItem>
|
|
97
|
+
<DropdownMenu>
|
|
98
|
+
<DropdownMenuTrigger className="flex items-center gap-1">
|
|
99
|
+
Components
|
|
100
|
+
<ChevronDown />
|
|
101
|
+
</DropdownMenuTrigger>
|
|
102
|
+
<DropdownMenuContent align="start">
|
|
103
|
+
<DropdownMenuItem>Documentation</DropdownMenuItem>
|
|
104
|
+
<DropdownMenuItem>Themes</DropdownMenuItem>
|
|
105
|
+
<DropdownMenuItem>GitHub</DropdownMenuItem>
|
|
106
|
+
</DropdownMenuContent>
|
|
107
|
+
</DropdownMenu>
|
|
108
|
+
</BreadcrumbItem>
|
|
109
|
+
<BreadcrumbSeparator>
|
|
110
|
+
<Slash />
|
|
111
|
+
</BreadcrumbSeparator>
|
|
112
|
+
<BreadcrumbItem>
|
|
113
|
+
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
|
|
114
|
+
</BreadcrumbItem>
|
|
115
|
+
</BreadcrumbList>
|
|
116
|
+
</Breadcrumb>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const Collapsed: Story = {
|
|
121
|
+
render: () => (
|
|
122
|
+
<Breadcrumb>
|
|
123
|
+
<BreadcrumbList>
|
|
124
|
+
<BreadcrumbItem>
|
|
125
|
+
<BreadcrumbLink asChild>
|
|
126
|
+
<p>Home</p>
|
|
127
|
+
</BreadcrumbLink>
|
|
128
|
+
</BreadcrumbItem>
|
|
129
|
+
<BreadcrumbSeparator />
|
|
130
|
+
<BreadcrumbItem>
|
|
131
|
+
<BreadcrumbEllipsis />
|
|
132
|
+
</BreadcrumbItem>
|
|
133
|
+
<BreadcrumbSeparator />
|
|
134
|
+
<BreadcrumbItem>
|
|
135
|
+
<BreadcrumbLink asChild>
|
|
136
|
+
<p>Components</p>
|
|
137
|
+
</BreadcrumbLink>
|
|
138
|
+
</BreadcrumbItem>
|
|
139
|
+
<BreadcrumbSeparator />
|
|
140
|
+
<BreadcrumbItem>
|
|
141
|
+
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
|
|
142
|
+
</BreadcrumbItem>
|
|
143
|
+
</BreadcrumbList>
|
|
144
|
+
</Breadcrumb>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
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"
|
|
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-muted-foreground 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
|
+
asChild?: boolean
|
|
46
|
+
}
|
|
47
|
+
>(({ asChild, className, ...props }, ref) => {
|
|
48
|
+
const Comp = asChild ? Slot : "a"
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Comp
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn("transition-colors hover:text-foreground", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
})
|
|
58
|
+
BreadcrumbLink.displayName = "BreadcrumbLink"
|
|
59
|
+
|
|
60
|
+
const BreadcrumbPage = React.forwardRef<
|
|
61
|
+
HTMLSpanElement,
|
|
62
|
+
React.ComponentPropsWithoutRef<"span">
|
|
63
|
+
>(({ className, ...props }, ref) => (
|
|
64
|
+
<span
|
|
65
|
+
ref={ref}
|
|
66
|
+
role="link"
|
|
67
|
+
aria-disabled="true"
|
|
68
|
+
aria-current="page"
|
|
69
|
+
className={cn("font-normal text-foreground", className)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
))
|
|
73
|
+
BreadcrumbPage.displayName = "BreadcrumbPage"
|
|
74
|
+
|
|
75
|
+
const BreadcrumbSeparator = ({
|
|
76
|
+
children,
|
|
77
|
+
className,
|
|
78
|
+
...props
|
|
79
|
+
}: React.ComponentProps<"li">) => (
|
|
80
|
+
<li
|
|
81
|
+
role="presentation"
|
|
82
|
+
aria-hidden="true"
|
|
83
|
+
className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
|
|
84
|
+
{...props}
|
|
85
|
+
>
|
|
86
|
+
{children ?? <ChevronRight />}
|
|
87
|
+
</li>
|
|
88
|
+
)
|
|
89
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
|
|
90
|
+
|
|
91
|
+
const BreadcrumbEllipsis = ({
|
|
92
|
+
className,
|
|
93
|
+
...props
|
|
94
|
+
}: React.ComponentProps<"span">) => (
|
|
95
|
+
<span
|
|
96
|
+
role="presentation"
|
|
97
|
+
aria-hidden="true"
|
|
98
|
+
className={cn("flex h-9 w-9 items-center justify-center", className)}
|
|
99
|
+
{...props}
|
|
100
|
+
>
|
|
101
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
102
|
+
<span className="sr-only">More</span>
|
|
103
|
+
</span>
|
|
104
|
+
)
|
|
105
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
Breadcrumb,
|
|
109
|
+
BreadcrumbList,
|
|
110
|
+
BreadcrumbItem,
|
|
111
|
+
BreadcrumbLink,
|
|
112
|
+
BreadcrumbPage,
|
|
113
|
+
BreadcrumbSeparator,
|
|
114
|
+
BreadcrumbEllipsis,
|
|
115
|
+
}
|