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,129 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react"
2
- import { Header } from "./header"
3
-
4
- const meta: Meta<typeof Header> = {
5
- title: "Components/Header",
6
- component: Header,
7
- parameters: {
8
- layout: "fullscreen",
9
- },
10
- tags: ["autodocs"],
11
- argTypes: {
12
- title: {
13
- control: "text",
14
- description: "The main title displayed in the header",
15
- },
16
- breadcrumbItems: {
17
- control: "object",
18
- description: "Array of breadcrumb items to display in the navigation",
19
- },
20
- showHomeLink: {
21
- control: "boolean",
22
- description: "Whether to show the home link at the start of the breadcrumb",
23
- },
24
- className: {
25
- control: "text",
26
- description: "Additional CSS classes to apply to the header",
27
- },
28
- children: {
29
- control: { type: undefined },
30
- description: "Additional content to render within the header",
31
- },
32
- },
33
- }
34
-
35
- export default meta
36
- type Story = StoryObj<typeof Header>
37
-
38
- // Basic header with just a title
39
- export const Basic: Story = {
40
- args: {
41
- title: "Dashboard",
42
- showHomeLink: true,
43
- breadcrumbItems: [],
44
- },
45
- }
46
-
47
- // Header with a single breadcrumb (current page)
48
- export const SingleBreadcrumb: Story = {
49
- args: {
50
- title: "Products",
51
- showHomeLink: true,
52
- breadcrumbItems: [
53
- { label: "Products", isCurrentPage: true },
54
- ],
55
- },
56
- }
57
-
58
- // Header with multiple breadcrumb levels
59
- export const MultipleBreadcrumbs: Story = {
60
- args: {
61
- title: "Edit Product",
62
- showHomeLink: true,
63
- breadcrumbItems: [
64
- { label: "Products", href: "/products" },
65
- { label: "Electronics", href: "/products/electronics" },
66
- { label: "Edit Product", isCurrentPage: true },
67
- ],
68
- },
69
- }
70
-
71
- // Header without home link
72
- export const NoHomeLink: Story = {
73
- args: {
74
- title: "Settings",
75
- showHomeLink: false,
76
- breadcrumbItems: [
77
- { label: "Account", href: "/account" },
78
- { label: "Settings", isCurrentPage: true },
79
- ],
80
- },
81
- }
82
-
83
- // Header with custom content
84
- export const WithCustomContent: Story = {
85
- args: {
86
- title: "Dashboard",
87
- showHomeLink: true,
88
- breadcrumbItems: [
89
- { label: "Dashboard", isCurrentPage: true },
90
- ],
91
- },
92
- render: (args) => (
93
- <Header {...args}>
94
- <div className="flex justify-between items-center mt-4">
95
- <p className="text-muted-foreground">Last updated: Yesterday</p>
96
- <button className="bg-primary text-primary-foreground px-4 py-2 rounded-md text-sm">
97
- Refresh Data
98
- </button>
99
- </div>
100
- </Header>
101
- ),
102
- }
103
-
104
- // Header with a very long breadcrumb path
105
- export const LongBreadcrumbPath: Story = {
106
- args: {
107
- title: "Edit User Profile",
108
- showHomeLink: true,
109
- breadcrumbItems: [
110
- { label: "Administration", href: "/admin" },
111
- { label: "User Management", href: "/admin/users" },
112
- { label: "Enterprise Accounts", href: "/admin/users/enterprise" },
113
- { label: "ACME Corporation", href: "/admin/users/enterprise/acme" },
114
- { label: "Department Leads", href: "/admin/users/enterprise/acme/leads" },
115
- { label: "John Doe", isCurrentPage: true },
116
- ],
117
- },
118
- }
119
-
120
- // Header with minimal styling
121
- export const Minimalist: Story = {
122
- args: {
123
- title: "Analytics",
124
- showHomeLink: false,
125
- breadcrumbItems: [],
126
- className: "border-0 pb-0",
127
- },
128
- }
129
-
@@ -1,78 +0,0 @@
1
- import React from "react"
2
- import {
3
- Breadcrumb,
4
- BreadcrumbItem as BreadcrumbItemComponent,
5
- BreadcrumbLink,
6
- BreadcrumbList,
7
- BreadcrumbPage,
8
- BreadcrumbSeparator,
9
- } from "@/components/ui/breadcrumb"
10
- import { ChevronRight, Home } from "lucide-react"
11
-
12
- export type BreadcrumbItem = {
13
- label: string
14
- href?: string
15
- isCurrentPage?: boolean
16
- }
17
-
18
- interface HeaderProps {
19
- title?: string
20
- breadcrumbItems?: BreadcrumbItem[]
21
- showHomeLink?: boolean
22
- className?: string
23
- children?: React.ReactNode
24
- }
25
-
26
- export function Header({ title, breadcrumbItems = [], showHomeLink = true, className = "", children }: HeaderProps) {
27
- return (
28
- <header className={`border-b pb-4 ${className}`}>
29
- <div className="container mx-auto px-4">
30
- {(breadcrumbItems.length > 0 || showHomeLink) && (
31
- <Breadcrumb className="mb-2">
32
- <BreadcrumbList>
33
- {showHomeLink && (
34
- <>
35
- <BreadcrumbItemComponent>
36
- <BreadcrumbLink href="/" className="flex items-center">
37
- <Home className="h-3.5 w-3.5 mr-1" />
38
- Home
39
- </BreadcrumbLink>
40
- </BreadcrumbItemComponent>
41
- {breadcrumbItems.length > 0 && (
42
- <BreadcrumbSeparator>
43
- <ChevronRight className="h-3.5 w-3.5" />
44
- </BreadcrumbSeparator>
45
- )}
46
- </>
47
- )}
48
-
49
- {breadcrumbItems.map((item, index) => (
50
- <React.Fragment key={index}>
51
- <BreadcrumbItemComponent>
52
- {item.isCurrentPage ? (
53
- <BreadcrumbPage>{item.label}</BreadcrumbPage>
54
- ) : (
55
- <BreadcrumbLink href={item.href || "#"}>{item.label}</BreadcrumbLink>
56
- )}
57
- </BreadcrumbItemComponent>
58
- {index < breadcrumbItems.length - 1 && (
59
- <BreadcrumbSeparator>
60
- <ChevronRight className="h-3.5 w-3.5" />
61
- </BreadcrumbSeparator>
62
- )}
63
- </React.Fragment>
64
- ))}
65
- </BreadcrumbList>
66
- </Breadcrumb>
67
- )}
68
-
69
- <div className="flex items-center justify-between">
70
- {title && <h1 className="text-2xl font-bold tracking-tight">{title}</h1>}
71
- {children && <div className="flex items-center">{children}</div>}
72
- </div>
73
- </div>
74
- </header>
75
- )
76
- }
77
-
78
-
@@ -1,35 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react"
2
-
3
- import { GalleryVerticalEnd } from 'lucide-react'
4
-
5
- import {
6
- LoginForm
7
- } from "./login-form"
8
-
9
- const meta = {
10
- title: "Feature/LoginForm",
11
- component: LoginForm,
12
- parameters: {
13
- layout: "centered",
14
- },
15
- tags: ["autodocs"],
16
- } satisfies Meta<typeof LoginForm>
17
-
18
- export default meta
19
- type Story = StoryObj<typeof meta>
20
-
21
- export const Default: Story = {
22
- render: () => (
23
- <div className="flex min-h-svh flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10">
24
- <div className="flex w-full max-w-sm flex-col gap-6">
25
- <a href="#" className="flex items-center gap-2 self-center font-medium">
26
- <div className="flex h-6 w-6 items-center justify-center rounded-md bg-primary text-primary-foreground">
27
- <GalleryVerticalEnd className="size-4" />
28
- </div>
29
- Acme Inc.
30
- </a>
31
- <LoginForm />
32
- </div>
33
- </div>)
34
- }
35
-
@@ -1,97 +0,0 @@
1
- import { cn } from "@/lib/utils"
2
- import { Button } from "@/components/ui/button"
3
- import {
4
- Card,
5
- CardContent,
6
- CardDescription,
7
- CardHeader,
8
- CardTitle,
9
- } from "@/components/ui/card"
10
- import { Input } from "@/components/ui/input"
11
- import { Label } from "@/components/ui/label"
12
-
13
- export function LoginForm({
14
- className,
15
- ...props
16
- }: React.ComponentPropsWithoutRef<"div">) {
17
- return (
18
- <div className={cn("flex flex-col gap-6", className)} {...props}>
19
- <Card>
20
- <CardHeader className="text-center">
21
- <CardTitle className="text-xl">Welcome back</CardTitle>
22
- <CardDescription>
23
- Login with your Apple or Google account
24
- </CardDescription>
25
- </CardHeader>
26
- <CardContent>
27
- <form>
28
- <div className="grid gap-6">
29
- <div className="flex flex-col gap-4">
30
- <Button variant="outline" className="w-full">
31
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
32
- <path
33
- d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"
34
- fill="currentColor"
35
- />
36
- </svg>
37
- Login with Apple
38
- </Button>
39
- <Button variant="outline" className="w-full">
40
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
41
- <path
42
- d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"
43
- fill="currentColor"
44
- />
45
- </svg>
46
- Login with Google
47
- </Button>
48
- </div>
49
- <div className="relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t after:border-border">
50
- <span className="relative z-10 bg-background px-2 text-muted-foreground">
51
- Or continue with
52
- </span>
53
- </div>
54
- <div className="grid gap-6">
55
- <div className="grid gap-2">
56
- <Label htmlFor="email">Email</Label>
57
- <Input
58
- id="email"
59
- type="email"
60
- placeholder="m@example.com"
61
- required
62
- />
63
- </div>
64
- <div className="grid gap-2">
65
- <div className="flex items-center">
66
- <Label htmlFor="password">Password</Label>
67
- <a
68
- href="#"
69
- className="ml-auto text-sm underline-offset-4 hover:underline"
70
- >
71
- Forgot your password?
72
- </a>
73
- </div>
74
- <Input id="password" type="password" required />
75
- </div>
76
- <Button type="submit" className="w-full">
77
- Login
78
- </Button>
79
- </div>
80
- <div className="text-center text-sm">
81
- Don&apos;t have an account?{" "}
82
- <a href="#" className="underline underline-offset-4">
83
- Sign up
84
- </a>
85
- </div>
86
- </div>
87
- </form>
88
- </CardContent>
89
- </Card>
90
- <div className="text-balance text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary ">
91
- By clicking continue, you agree to our <a href="#">Terms of Service</a>{" "}
92
- and <a href="#">Privacy Policy</a>.
93
- </div>
94
- </div>
95
- )
96
- }
97
-
@@ -1 +0,0 @@
1
- export * from './ui/accordion'
@@ -1,36 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react"
2
-
3
- import {
4
- Accordion,
5
- AccordionTrigger,
6
- AccordionContent,
7
- AccordionItem,
8
- } from "./accordion"
9
-
10
- const meta = {
11
- title: "Components/Accordion",
12
- component: Accordion,
13
- parameters: {
14
- layout: "centered",
15
- },
16
- tags: ["autodocs"],
17
- } satisfies Meta<typeof Accordion>
18
-
19
- export default meta
20
- type Story = StoryObj<typeof meta>
21
-
22
- export const Default: Story = {
23
- args: {
24
- collapsible: true
25
- },
26
- render: () => (
27
- <Accordion type="single" collapsible>
28
- <AccordionItem value="item-1">
29
- <AccordionTrigger>Is it accessible?</AccordionTrigger>
30
- <AccordionContent>
31
- Yes. It adheres to the WAI-ARIA design pattern.
32
- </AccordionContent>
33
- </AccordionItem>
34
- </Accordion>
35
- )
36
- }
@@ -1,55 +0,0 @@
1
- import * as React from "react"
2
- import * as AccordionPrimitive from "@radix-ui/react-accordion"
3
- import { ChevronDown } from "lucide-react"
4
-
5
- import { cn } from "@/lib/utils"
6
-
7
- const Accordion = AccordionPrimitive.Root
8
-
9
- const AccordionItem = React.forwardRef<
10
- React.ElementRef<typeof AccordionPrimitive.Item>,
11
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
12
- >(({ className, ...props }, ref) => (
13
- <AccordionPrimitive.Item
14
- ref={ref}
15
- className={cn("border-b", className)}
16
- {...props}
17
- />
18
- ))
19
- AccordionItem.displayName = "AccordionItem"
20
-
21
- const AccordionTrigger = React.forwardRef<
22
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
23
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
24
- >(({ className, children, ...props }, ref) => (
25
- <AccordionPrimitive.Header className="flex">
26
- <AccordionPrimitive.Trigger
27
- ref={ref}
28
- className={cn(
29
- "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
30
- className
31
- )}
32
- {...props}
33
- >
34
- {children}
35
- <ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
36
- </AccordionPrimitive.Trigger>
37
- </AccordionPrimitive.Header>
38
- ))
39
- AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
40
-
41
- const AccordionContent = React.forwardRef<
42
- React.ElementRef<typeof AccordionPrimitive.Content>,
43
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
44
- >(({ className, children, ...props }, ref) => (
45
- <AccordionPrimitive.Content
46
- ref={ref}
47
- className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
48
- {...props}
49
- >
50
- <div className={cn("pb-4 pt-0", className)}>{children}</div>
51
- </AccordionPrimitive.Content>
52
- ))
53
- AccordionContent.displayName = AccordionPrimitive.Content.displayName
54
-
55
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -1,46 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react"
2
-
3
- import {
4
- AlertDialog,
5
- AlertDialogAction,
6
- AlertDialogCancel,
7
- AlertDialogContent,
8
- AlertDialogDescription,
9
- AlertDialogFooter,
10
- AlertDialogHeader,
11
- AlertDialogTitle,
12
- AlertDialogTrigger
13
- } from "./alert-dialog"
14
-
15
- const meta = {
16
- title: "Components/AlertDialog",
17
- component: AlertDialog,
18
- parameters: {
19
- layout: "centered",
20
- },
21
- tags: ["autodocs"],
22
- } satisfies Meta<typeof AlertDialog>
23
-
24
- export default meta
25
- type Story = StoryObj<typeof meta>
26
-
27
- export const Default: Story = {
28
- render: () => (
29
- <AlertDialog>
30
- <AlertDialogTrigger>Open</AlertDialogTrigger>
31
- <AlertDialogContent>
32
- <AlertDialogHeader>
33
- <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
34
- <AlertDialogDescription>
35
- This action cannot be undone. This will permanently delete your account
36
- and remove your data from our servers.
37
- </AlertDialogDescription>
38
- </AlertDialogHeader>
39
- <AlertDialogFooter>
40
- <AlertDialogCancel>Cancel</AlertDialogCancel>
41
- <AlertDialogAction>Continue</AlertDialogAction>
42
- </AlertDialogFooter>
43
- </AlertDialogContent>
44
- </AlertDialog>
45
- )
46
- }
@@ -1,139 +0,0 @@
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
- }
@@ -1,45 +0,0 @@
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
- }