ui-arreya-components 0.0.15 → 0.1.2

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 (103) hide show
  1. package/dist/index.d.mts +342 -0
  2. package/dist/index.d.ts +342 -0
  3. package/dist/index.js +1682 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +1495 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +61 -106
  8. package/.storybook/main.ts +0 -18
  9. package/.storybook/preview.ts +0 -16
  10. package/.storybook/vitest.setup.ts +0 -9
  11. package/README.md +0 -54
  12. package/components.json +0 -21
  13. package/dist/styles.css +0 -3
  14. package/dist/ui.cjs.js +0 -119
  15. package/dist/ui.es.js +0 -7364
  16. package/dist/ui.umd.js +0 -119
  17. package/eslint.config.js +0 -28
  18. package/postcss.config.js +0 -6
  19. package/scripts/template.sh +0 -57
  20. package/src/components/feature/header.stories.tsx +0 -129
  21. package/src/components/feature/header.tsx +0 -78
  22. package/src/components/feature/login-form.stories.tsx +0 -35
  23. package/src/components/feature/login-form.tsx +0 -97
  24. package/src/components/index.ts +0 -1
  25. package/src/components/ui/accordion.stories.tsx.disabled +0 -36
  26. package/src/components/ui/accordion.tsx +0 -55
  27. package/src/components/ui/alert-dialog.stories.tsx +0 -46
  28. package/src/components/ui/alert-dialog.tsx +0 -139
  29. package/src/components/ui/alert.stories.tsx +0 -45
  30. package/src/components/ui/alert.tsx +0 -59
  31. package/src/components/ui/aspect-ratio.stories.tsx +0 -24
  32. package/src/components/ui/aspect-ratio.tsx +0 -5
  33. package/src/components/ui/avatar.stories.tsx +0 -29
  34. package/src/components/ui/avatar.tsx +0 -48
  35. package/src/components/ui/badge.stories.tsx +0 -43
  36. package/src/components/ui/badge.tsx +0 -36
  37. package/src/components/ui/breadcrumb.stories.tsx +0 -146
  38. package/src/components/ui/breadcrumb.tsx +0 -115
  39. package/src/components/ui/button.stories.tsx +0 -87
  40. package/src/components/ui/button.tsx +0 -57
  41. package/src/components/ui/card.stories.tsx +0 -99
  42. package/src/components/ui/card.tsx +0 -76
  43. package/src/components/ui/carousel.stories.tsx +0 -47
  44. package/src/components/ui/carousel.tsx +0 -260
  45. package/src/components/ui/chart.stories.tsx.disabled +0 -44
  46. package/src/components/ui/chart.tsx +0 -363
  47. package/src/components/ui/checkbox.stories.tsx +0 -56
  48. package/src/components/ui/checkbox.tsx +0 -28
  49. package/src/components/ui/collapsible.stories.tsx +0 -58
  50. package/src/components/ui/collapsible.tsx +0 -9
  51. package/src/components/ui/context-menu.stories.tsx +0 -34
  52. package/src/components/ui/context-menu.tsx +0 -198
  53. package/src/components/ui/dialog.stories.tsx +0 -40
  54. package/src/components/ui/dialog.tsx +0 -120
  55. package/src/components/ui/drawer.stories.tsx +0 -48
  56. package/src/components/ui/drawer.tsx +0 -116
  57. package/src/components/ui/dropdown-menu.stories.tsx +0 -92
  58. package/src/components/ui/dropdown-menu.tsx +0 -199
  59. package/src/components/ui/form.tsx +0 -176
  60. package/src/components/ui/hover-card.stories.tsx +0 -31
  61. package/src/components/ui/hover-card.tsx +0 -27
  62. package/src/components/ui/index.ts +0 -1
  63. package/src/components/ui/input-otp.tsx +0 -69
  64. package/src/components/ui/input.stories.tsx +0 -63
  65. package/src/components/ui/input.tsx +0 -22
  66. package/src/components/ui/label.tsx +0 -24
  67. package/src/components/ui/menubar.tsx +0 -254
  68. package/src/components/ui/navigation-menu.tsx +0 -128
  69. package/src/components/ui/pagination.tsx +0 -117
  70. package/src/components/ui/popover.tsx +0 -31
  71. package/src/components/ui/progress.tsx +0 -26
  72. package/src/components/ui/radio-group.tsx +0 -42
  73. package/src/components/ui/resizable.tsx +0 -43
  74. package/src/components/ui/scroll-area.tsx +0 -46
  75. package/src/components/ui/select.tsx +0 -157
  76. package/src/components/ui/separator.tsx +0 -29
  77. package/src/components/ui/sheet.tsx +0 -140
  78. package/src/components/ui/sidebar.tsx +0 -771
  79. package/src/components/ui/skeleton.tsx +0 -15
  80. package/src/components/ui/slider.tsx +0 -26
  81. package/src/components/ui/sonner.tsx +0 -29
  82. package/src/components/ui/switch.tsx +0 -27
  83. package/src/components/ui/table.tsx +0 -120
  84. package/src/components/ui/tabs.tsx +0 -53
  85. package/src/components/ui/textarea.tsx +0 -22
  86. package/src/components/ui/toast.tsx +0 -127
  87. package/src/components/ui/toaster.tsx +0 -33
  88. package/src/components/ui/toggle-group.tsx +0 -59
  89. package/src/components/ui/toggle.tsx +0 -43
  90. package/src/components/ui/tooltip.tsx +0 -30
  91. package/src/hooks/use-mobile.tsx +0 -19
  92. package/src/hooks/use-toast.ts +0 -194
  93. package/src/index.css +0 -3509
  94. package/src/index.ts +0 -51
  95. package/src/lib/types.ts +0 -5
  96. package/src/lib/utils.ts +0 -6
  97. package/src/styles/tailwind.css +0 -100
  98. package/tailwind.config.js +0 -96
  99. package/tsconfig.app.json +0 -30
  100. package/tsconfig.json +0 -13
  101. package/tsconfig.node.json +0 -24
  102. package/vite.config.ts +0 -33
  103. package/vitest.workspace.ts +0 -32
@@ -1,59 +0,0 @@
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 }
@@ -1,24 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
2
-
3
- const AspectRatio = AspectRatioPrimitive.Root
4
-
5
- export { AspectRatio }
@@ -1,29 +0,0 @@
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
- };
@@ -1,48 +0,0 @@
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 }
@@ -1,43 +0,0 @@
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
-
@@ -1,36 +0,0 @@
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 }
@@ -1,146 +0,0 @@
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
- }
@@ -1,115 +0,0 @@
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
- }
@@ -1,87 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react"
2
-
3
- import { ChevronRight, Loader2, MailOpen } from 'lucide-react'
4
- import {
5
- Button,
6
- } from "./button"
7
-
8
- const meta = {
9
- title: "Components/Button",
10
- component: Button,
11
- parameters: {
12
- layout: "centered",
13
- },
14
- tags: ["autodocs"],
15
- } satisfies Meta<typeof Button>
16
-
17
- export default meta
18
- type Story = StoryObj<typeof meta>
19
-
20
- export const Default: Story = {
21
- render: () => (
22
- <Button>Button</Button>
23
- )
24
- }
25
-
26
- export const Secondary: Story = {
27
- render: () => (
28
- <Button variant="secondary">Secondary</Button>
29
- )
30
- }
31
-
32
- export const Destructive: Story = {
33
- render: () => (
34
- <Button variant="destructive">Secondary</Button>
35
- )
36
- }
37
-
38
- export const Outline: Story = {
39
- render: () => (
40
- <Button variant="outline">Secondary</Button>
41
- )
42
- }
43
-
44
- export const Ghost: Story = {
45
- render: () => (
46
- <Button variant="ghost">Secondary</Button>
47
- )
48
- }
49
-
50
- export const Link: Story = {
51
- render: () => (
52
- <Button variant="link">Secondary</Button>
53
- )
54
- }
55
-
56
- export const Icon: Story = {
57
- render: () => (
58
- <Button variant="outline" size="icon">
59
- <ChevronRight />
60
- </Button>
61
- )
62
- }
63
-
64
- export const WithIcon: Story = {
65
- render: () => (
66
- <Button>
67
- <MailOpen /> Login with Email
68
- </Button>
69
- )
70
- }
71
-
72
- export const Loading: Story = {
73
- render: () => (
74
- <Button disabled>
75
- <Loader2 className="animate-spin" />
76
- Please wait
77
- </Button>
78
- )
79
- }
80
-
81
- export const ButtonAsChild: Story = {
82
- render: () => (
83
- <Button asChild>
84
- <p>This is a button</p>
85
- </Button>
86
- )
87
- }
@@ -1,57 +0,0 @@
1
- import * as React from "react"
2
- import { Slot } from "@radix-ui/react-slot"
3
- import { cva, type VariantProps } from "class-variance-authority"
4
-
5
- import { cn } from "@/lib/utils"
6
-
7
- const buttonVariants = cva(
8
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9
- {
10
- variants: {
11
- variant: {
12
- default:
13
- "bg-primary text-primary-foreground shadow hover:bg-primary/90",
14
- destructive:
15
- "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
16
- outline:
17
- "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
18
- secondary:
19
- "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
20
- ghost: "hover:bg-accent hover:text-accent-foreground",
21
- link: "text-primary underline-offset-4 hover:underline",
22
- },
23
- size: {
24
- default: "h-9 px-4 py-2",
25
- sm: "h-8 rounded-md px-3 text-xs",
26
- lg: "h-10 rounded-md px-8",
27
- icon: "h-9 w-9",
28
- },
29
- },
30
- defaultVariants: {
31
- variant: "default",
32
- size: "default",
33
- },
34
- }
35
- )
36
-
37
- export interface ButtonProps
38
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39
- VariantProps<typeof buttonVariants> {
40
- asChild?: boolean
41
- }
42
-
43
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44
- ({ className, variant, size, asChild = false, ...props }, ref) => {
45
- const Comp = asChild ? Slot : "button"
46
- return (
47
- <Comp
48
- className={cn(buttonVariants({ variant, size, className }))}
49
- ref={ref}
50
- {...props}
51
- />
52
- )
53
- }
54
- )
55
- Button.displayName = "Button"
56
-
57
- export { Button, buttonVariants }