@mzc-fe/design-system 0.0.1 → 0.0.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 (219) hide show
  1. package/dist/components/accordion.d.ts +7 -0
  2. package/dist/components/alert-dialog.d.ts +14 -0
  3. package/dist/components/alert.d.ts +9 -0
  4. package/dist/components/aspect-ratio.d.ts +3 -0
  5. package/dist/components/avatar.d.ts +6 -0
  6. package/dist/components/badge.d.ts +9 -0
  7. package/dist/components/breadcrumb.d.ts +11 -0
  8. package/dist/components/button-group.d.ts +11 -0
  9. package/dist/components/button.d.ts +10 -0
  10. package/dist/components/calendar.d.ts +8 -0
  11. package/dist/components/card.d.ts +9 -0
  12. package/dist/components/carousel.d.ts +19 -0
  13. package/dist/components/chart.d.ts +40 -0
  14. package/dist/components/checkbox.d.ts +4 -0
  15. package/dist/components/collapsible.d.ts +5 -0
  16. package/dist/components/command.d.ts +18 -0
  17. package/dist/components/context-menu.d.ts +25 -0
  18. package/dist/components/dialog.d.ts +15 -0
  19. package/dist/components/drawer.d.ts +13 -0
  20. package/dist/components/dropdown-menu.d.ts +25 -0
  21. package/dist/components/empty.d.ts +11 -0
  22. package/dist/components/field.d.ts +24 -0
  23. package/dist/components/form.d.ts +24 -0
  24. package/dist/components/hover-card.d.ts +6 -0
  25. package/dist/components/input-group.d.ts +16 -0
  26. package/dist/components/input-otp.d.ts +11 -0
  27. package/dist/components/input.d.ts +3 -0
  28. package/dist/components/item.d.ts +23 -0
  29. package/dist/components/kbd.d.ts +3 -0
  30. package/dist/components/label.d.ts +4 -0
  31. package/dist/components/menubar.d.ts +26 -0
  32. package/dist/components/navigation-menu.d.ts +14 -0
  33. package/dist/components/pagination.d.ts +13 -0
  34. package/dist/components/popover.d.ts +7 -0
  35. package/dist/components/progress.d.ts +4 -0
  36. package/dist/components/radio-group.d.ts +5 -0
  37. package/dist/components/resizable.d.ts +8 -0
  38. package/dist/components/scroll-area.d.ts +5 -0
  39. package/dist/components/select.d.ts +15 -0
  40. package/dist/components/separator.d.ts +4 -0
  41. package/dist/components/sheet.d.ts +13 -0
  42. package/dist/components/sidebar.d.ts +69 -0
  43. package/dist/components/skeleton.d.ts +2 -0
  44. package/dist/components/slider.d.ts +4 -0
  45. package/dist/components/sonner.d.ts +3 -0
  46. package/dist/components/spinner.d.ts +2 -0
  47. package/dist/components/switch.d.ts +4 -0
  48. package/dist/components/table.d.ts +10 -0
  49. package/dist/components/tabs.d.ts +7 -0
  50. package/dist/components/textarea.d.ts +3 -0
  51. package/dist/components/toggle-group.d.ts +9 -0
  52. package/dist/components/toggle.d.ts +9 -0
  53. package/dist/components/tooltip.d.ts +7 -0
  54. package/dist/design-system.css +1 -0
  55. package/dist/design-system.es.js +30200 -0
  56. package/dist/design-system.umd.js +260 -0
  57. package/dist/foundations/ThemeProvider.d.ts +13 -0
  58. package/dist/hooks/use-mobile.d.ts +1 -0
  59. package/dist/index.d.ts +54 -0
  60. package/dist/lib/utils.d.ts +2 -0
  61. package/package.json +14 -1
  62. package/.husky/pre-push +0 -21
  63. package/.storybook/main.ts +0 -11
  64. package/.storybook/preview.tsx +0 -30
  65. package/.vscode/settings.json +0 -12
  66. package/.vscode/tailwind.json +0 -105
  67. package/bitbucket-pipelines.yml +0 -50
  68. package/components.json +0 -21
  69. package/eslint.config.js +0 -38
  70. package/src/components/accordion.stories.tsx +0 -258
  71. package/src/components/accordion.test.tsx +0 -390
  72. package/src/components/accordion.tsx +0 -64
  73. package/src/components/alert-dialog.stories.tsx +0 -213
  74. package/src/components/alert-dialog.test.tsx +0 -80
  75. package/src/components/alert-dialog.tsx +0 -155
  76. package/src/components/alert.stories.tsx +0 -84
  77. package/src/components/alert.test.tsx +0 -35
  78. package/src/components/alert.tsx +0 -66
  79. package/src/components/aspect-ratio.stories.tsx +0 -97
  80. package/src/components/aspect-ratio.test.tsx +0 -47
  81. package/src/components/aspect-ratio.tsx +0 -11
  82. package/src/components/avatar.stories.tsx +0 -76
  83. package/src/components/avatar.test.tsx +0 -50
  84. package/src/components/avatar.tsx +0 -51
  85. package/src/components/badge.stories.tsx +0 -64
  86. package/src/components/badge.test.tsx +0 -34
  87. package/src/components/badge.tsx +0 -46
  88. package/src/components/breadcrumb.stories.tsx +0 -86
  89. package/src/components/breadcrumb.test.tsx +0 -74
  90. package/src/components/breadcrumb.tsx +0 -109
  91. package/src/components/button-group.stories.tsx +0 -62
  92. package/src/components/button-group.tsx +0 -83
  93. package/src/components/button.stories.tsx +0 -118
  94. package/src/components/button.test.tsx +0 -64
  95. package/src/components/button.tsx +0 -62
  96. package/src/components/calendar.stories.tsx +0 -81
  97. package/src/components/calendar.tsx +0 -220
  98. package/src/components/card.stories.tsx +0 -110
  99. package/src/components/card.test.tsx +0 -56
  100. package/src/components/card.tsx +0 -92
  101. package/src/components/carousel.stories.tsx +0 -90
  102. package/src/components/carousel.tsx +0 -239
  103. package/src/components/chart.tsx +0 -357
  104. package/src/components/checkbox.stories.tsx +0 -108
  105. package/src/components/checkbox.test.tsx +0 -67
  106. package/src/components/checkbox.tsx +0 -32
  107. package/src/components/collapsible.stories.tsx +0 -106
  108. package/src/components/collapsible.test.tsx +0 -92
  109. package/src/components/collapsible.tsx +0 -31
  110. package/src/components/command.stories.tsx +0 -90
  111. package/src/components/command.tsx +0 -182
  112. package/src/components/context-menu.stories.tsx +0 -63
  113. package/src/components/context-menu.tsx +0 -252
  114. package/src/components/dialog.stories.tsx +0 -128
  115. package/src/components/dialog.tsx +0 -141
  116. package/src/components/drawer.stories.tsx +0 -104
  117. package/src/components/drawer.tsx +0 -135
  118. package/src/components/dropdown-menu.stories.tsx +0 -97
  119. package/src/components/dropdown-menu.tsx +0 -255
  120. package/src/components/empty.stories.tsx +0 -90
  121. package/src/components/empty.test.tsx +0 -55
  122. package/src/components/empty.tsx +0 -104
  123. package/src/components/field.tsx +0 -246
  124. package/src/components/form.tsx +0 -168
  125. package/src/components/hover-card.stories.tsx +0 -66
  126. package/src/components/hover-card.tsx +0 -44
  127. package/src/components/input-group.stories.tsx +0 -57
  128. package/src/components/input-group.test.tsx +0 -40
  129. package/src/components/input-group.tsx +0 -170
  130. package/src/components/input-otp.stories.tsx +0 -94
  131. package/src/components/input-otp.test.tsx +0 -60
  132. package/src/components/input-otp.tsx +0 -75
  133. package/src/components/input.stories.tsx +0 -94
  134. package/src/components/input.test.tsx +0 -53
  135. package/src/components/input.tsx +0 -21
  136. package/src/components/item.tsx +0 -193
  137. package/src/components/kbd.stories.tsx +0 -100
  138. package/src/components/kbd.test.tsx +0 -28
  139. package/src/components/kbd.tsx +0 -28
  140. package/src/components/label.stories.tsx +0 -48
  141. package/src/components/label.test.tsx +0 -28
  142. package/src/components/label.tsx +0 -24
  143. package/src/components/menubar.tsx +0 -274
  144. package/src/components/navigation-menu.tsx +0 -168
  145. package/src/components/pagination.stories.tsx +0 -107
  146. package/src/components/pagination.tsx +0 -127
  147. package/src/components/popover.stories.tsx +0 -102
  148. package/src/components/popover.tsx +0 -48
  149. package/src/components/progress.stories.tsx +0 -76
  150. package/src/components/progress.test.tsx +0 -36
  151. package/src/components/progress.tsx +0 -29
  152. package/src/components/radio-group.stories.tsx +0 -73
  153. package/src/components/radio-group.test.tsx +0 -74
  154. package/src/components/radio-group.tsx +0 -45
  155. package/src/components/resizable.stories.tsx +0 -120
  156. package/src/components/resizable.tsx +0 -54
  157. package/src/components/scroll-area.stories.tsx +0 -64
  158. package/src/components/scroll-area.test.tsx +0 -46
  159. package/src/components/scroll-area.tsx +0 -58
  160. package/src/components/select.stories.tsx +0 -111
  161. package/src/components/select.test.tsx +0 -90
  162. package/src/components/select.tsx +0 -188
  163. package/src/components/separator.stories.tsx +0 -76
  164. package/src/components/separator.test.tsx +0 -24
  165. package/src/components/separator.tsx +0 -28
  166. package/src/components/sheet.stories.tsx +0 -122
  167. package/src/components/sheet.tsx +0 -137
  168. package/src/components/sidebar.tsx +0 -726
  169. package/src/components/skeleton.stories.tsx +0 -53
  170. package/src/components/skeleton.test.tsx +0 -24
  171. package/src/components/skeleton.tsx +0 -13
  172. package/src/components/slider.stories.tsx +0 -97
  173. package/src/components/slider.test.tsx +0 -49
  174. package/src/components/slider.tsx +0 -63
  175. package/src/components/sonner.stories.tsx +0 -96
  176. package/src/components/sonner.tsx +0 -38
  177. package/src/components/spinner.stories.tsx +0 -54
  178. package/src/components/spinner.test.tsx +0 -30
  179. package/src/components/spinner.tsx +0 -16
  180. package/src/components/switch.stories.tsx +0 -108
  181. package/src/components/switch.test.tsx +0 -62
  182. package/src/components/switch.tsx +0 -31
  183. package/src/components/table.stories.tsx +0 -139
  184. package/src/components/table.test.tsx +0 -85
  185. package/src/components/table.tsx +0 -114
  186. package/src/components/tabs.stories.tsx +0 -99
  187. package/src/components/tabs.test.tsx +0 -64
  188. package/src/components/tabs.tsx +0 -66
  189. package/src/components/textarea.stories.tsx +0 -89
  190. package/src/components/textarea.test.tsx +0 -53
  191. package/src/components/textarea.tsx +0 -18
  192. package/src/components/toggle-group.stories.tsx +0 -108
  193. package/src/components/toggle-group.test.tsx +0 -66
  194. package/src/components/toggle-group.tsx +0 -81
  195. package/src/components/toggle.stories.tsx +0 -98
  196. package/src/components/toggle.test.tsx +0 -42
  197. package/src/components/toggle.tsx +0 -45
  198. package/src/components/tooltip.stories.tsx +0 -111
  199. package/src/components/tooltip.tsx +0 -61
  200. package/src/foundations/README.md +0 -141
  201. package/src/foundations/ThemeProvider.tsx +0 -77
  202. package/src/foundations/color.css +0 -232
  203. package/src/foundations/color.stories.tsx +0 -719
  204. package/src/foundations/palette.css +0 -249
  205. package/src/foundations/spacing.css +0 -8
  206. package/src/foundations/typography.css +0 -143
  207. package/src/foundations/typography.stories.tsx +0 -17
  208. package/src/hooks/use-mobile.ts +0 -19
  209. package/src/index.css +0 -176
  210. package/src/index.ts +0 -336
  211. package/src/lib/utils.ts +0 -6
  212. package/src/test/setup.ts +0 -8
  213. package/src/vite-env.d.ts +0 -1
  214. package/tsconfig.app.json +0 -33
  215. package/tsconfig.json +0 -13
  216. package/tsconfig.node.json +0 -25
  217. package/vite.config.ts +0 -30
  218. package/vitest.config.ts +0 -25
  219. /package/{public → dist}/vite.svg +0 -0
@@ -1,80 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { render } from "@testing-library/react";
3
- import userEvent from "@testing-library/user-event";
4
- import {
5
- AlertDialog,
6
- AlertDialogAction,
7
- AlertDialogCancel,
8
- AlertDialogContent,
9
- AlertDialogDescription,
10
- AlertDialogFooter,
11
- AlertDialogHeader,
12
- AlertDialogTitle,
13
- AlertDialogTrigger,
14
- } from "./alert-dialog";
15
-
16
- describe("AlertDialog", () => {
17
- it("should render alert dialog trigger", () => {
18
- const { getByText } = render(
19
- <AlertDialog>
20
- <AlertDialogTrigger>Open</AlertDialogTrigger>
21
- <AlertDialogContent>
22
- <AlertDialogHeader>
23
- <AlertDialogTitle>Title</AlertDialogTitle>
24
- <AlertDialogDescription>Description</AlertDialogDescription>
25
- </AlertDialogHeader>
26
- <AlertDialogFooter>
27
- <AlertDialogCancel>Cancel</AlertDialogCancel>
28
- <AlertDialogAction>Confirm</AlertDialogAction>
29
- </AlertDialogFooter>
30
- </AlertDialogContent>
31
- </AlertDialog>
32
- );
33
- expect(getByText("Open")).toBeInTheDocument();
34
- });
35
-
36
- it("should open dialog when trigger is clicked", async () => {
37
- const user = userEvent.setup();
38
- const { getByText } = render(
39
- <AlertDialog>
40
- <AlertDialogTrigger>Open</AlertDialogTrigger>
41
- <AlertDialogContent>
42
- <AlertDialogHeader>
43
- <AlertDialogTitle>Title</AlertDialogTitle>
44
- <AlertDialogDescription>Description</AlertDialogDescription>
45
- </AlertDialogHeader>
46
- <AlertDialogFooter>
47
- <AlertDialogCancel>Cancel</AlertDialogCancel>
48
- <AlertDialogAction>Confirm</AlertDialogAction>
49
- </AlertDialogFooter>
50
- </AlertDialogContent>
51
- </AlertDialog>
52
- );
53
- const trigger = getByText("Open");
54
- await user.click(trigger);
55
- expect(getByText("Title")).toBeInTheDocument();
56
- expect(getByText("Description")).toBeInTheDocument();
57
- });
58
-
59
- it("should call onAction when action button is clicked", async () => {
60
- const user = userEvent.setup();
61
- const handleAction = vi.fn();
62
- const { getByText } = render(
63
- <AlertDialog>
64
- <AlertDialogTrigger>Open</AlertDialogTrigger>
65
- <AlertDialogContent>
66
- <AlertDialogHeader>
67
- <AlertDialogTitle>Title</AlertDialogTitle>
68
- </AlertDialogHeader>
69
- <AlertDialogFooter>
70
- <AlertDialogAction onClick={handleAction}>Confirm</AlertDialogAction>
71
- </AlertDialogFooter>
72
- </AlertDialogContent>
73
- </AlertDialog>
74
- );
75
- await user.click(getByText("Open"));
76
- await user.click(getByText("Confirm"));
77
- expect(handleAction).toHaveBeenCalled();
78
- });
79
- });
80
-
@@ -1,155 +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/button";
6
-
7
- function AlertDialog({
8
- ...props
9
- }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
10
- return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
11
- }
12
-
13
- function AlertDialogTrigger({
14
- ...props
15
- }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
16
- return (
17
- <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
18
- );
19
- }
20
-
21
- function AlertDialogPortal({
22
- ...props
23
- }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
24
- return (
25
- <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
26
- );
27
- }
28
-
29
- function AlertDialogOverlay({
30
- className,
31
- ...props
32
- }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
33
- return (
34
- <AlertDialogPrimitive.Overlay
35
- data-slot="alert-dialog-overlay"
36
- className={cn(
37
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
38
- className
39
- )}
40
- {...props}
41
- />
42
- );
43
- }
44
-
45
- function AlertDialogContent({
46
- className,
47
- ...props
48
- }: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
49
- return (
50
- <AlertDialogPortal>
51
- <AlertDialogOverlay />
52
- <AlertDialogPrimitive.Content
53
- data-slot="alert-dialog-content"
54
- className={cn(
55
- "bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
56
- className
57
- )}
58
- {...props}
59
- />
60
- </AlertDialogPortal>
61
- );
62
- }
63
-
64
- function AlertDialogHeader({
65
- className,
66
- ...props
67
- }: React.ComponentProps<"div">) {
68
- return (
69
- <div
70
- data-slot="alert-dialog-header"
71
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
72
- {...props}
73
- />
74
- );
75
- }
76
-
77
- function AlertDialogFooter({
78
- className,
79
- ...props
80
- }: React.ComponentProps<"div">) {
81
- return (
82
- <div
83
- data-slot="alert-dialog-footer"
84
- className={cn(
85
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
86
- className
87
- )}
88
- {...props}
89
- />
90
- );
91
- }
92
-
93
- function AlertDialogTitle({
94
- className,
95
- ...props
96
- }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
97
- return (
98
- <AlertDialogPrimitive.Title
99
- data-slot="alert-dialog-title"
100
- className={cn("text-lg font-semibold", className)}
101
- {...props}
102
- />
103
- );
104
- }
105
-
106
- function AlertDialogDescription({
107
- className,
108
- ...props
109
- }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
110
- return (
111
- <AlertDialogPrimitive.Description
112
- data-slot="alert-dialog-description"
113
- className={cn("text-muted-foreground text-sm", className)}
114
- {...props}
115
- />
116
- );
117
- }
118
-
119
- function AlertDialogAction({
120
- className,
121
- ...props
122
- }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
123
- return (
124
- <AlertDialogPrimitive.Action
125
- className={cn(buttonVariants(), className)}
126
- {...props}
127
- />
128
- );
129
- }
130
-
131
- function AlertDialogCancel({
132
- className,
133
- ...props
134
- }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
135
- return (
136
- <AlertDialogPrimitive.Cancel
137
- className={cn(buttonVariants({ variant: "outline" }), className)}
138
- {...props}
139
- />
140
- );
141
- }
142
-
143
- export {
144
- AlertDialog,
145
- AlertDialogPortal,
146
- AlertDialogOverlay,
147
- AlertDialogTrigger,
148
- AlertDialogContent,
149
- AlertDialogHeader,
150
- AlertDialogFooter,
151
- AlertDialogTitle,
152
- AlertDialogDescription,
153
- AlertDialogAction,
154
- AlertDialogCancel,
155
- };
@@ -1,84 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { Alert, AlertTitle, AlertDescription } from "./alert";
3
- import { AlertCircleIcon, InfoIcon } from "lucide-react";
4
-
5
- const meta = {
6
- title: "Components/Alert",
7
- component: Alert,
8
- parameters: {
9
- layout: "padded",
10
- },
11
- tags: ["autodocs"],
12
- argTypes: {
13
- variant: {
14
- control: "select",
15
- options: ["default", "destructive"],
16
- description: "The visual style variant of the alert.",
17
- },
18
- },
19
- } satisfies Meta<typeof Alert>;
20
-
21
- export default meta;
22
- type Story = StoryObj<typeof meta>;
23
-
24
- export const Default: Story = {
25
- args: {
26
- variant: "default",
27
- },
28
- render: (args) => (
29
- <Alert {...args}>
30
- <InfoIcon />
31
- <AlertTitle>Heads up!</AlertTitle>
32
- <AlertDescription>
33
- You can add components to your app using the cli.
34
- </AlertDescription>
35
- </Alert>
36
- ),
37
- };
38
-
39
- export const Destructive: Story = {
40
- args: {
41
- variant: "destructive",
42
- },
43
- render: (args) => (
44
- <Alert {...args}>
45
- <AlertCircleIcon />
46
- <AlertTitle>Error</AlertTitle>
47
- <AlertDescription>
48
- Your session has expired. Please log in again.
49
- </AlertDescription>
50
- </Alert>
51
- ),
52
- };
53
-
54
- export const WithoutIcon: Story = {
55
- render: () => (
56
- <Alert>
57
- <AlertTitle>Notice</AlertTitle>
58
- <AlertDescription>
59
- This alert doesn't have an icon, but the layout still works correctly.
60
- </AlertDescription>
61
- </Alert>
62
- ),
63
- };
64
-
65
- export const LongContent: Story = {
66
- render: () => (
67
- <Alert>
68
- <InfoIcon />
69
- <AlertTitle>Important Information</AlertTitle>
70
- <AlertDescription>
71
- <p>
72
- This is a longer alert message that demonstrates how the component
73
- handles multiple paragraphs and extended content. The alert should
74
- maintain proper spacing and readability even with longer text.
75
- </p>
76
- <p className="mt-2">
77
- You can include additional information, links, or any other content
78
- within the alert description.
79
- </p>
80
- </AlertDescription>
81
- </Alert>
82
- ),
83
- };
84
-
@@ -1,35 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { render } from "@testing-library/react";
3
- import { Alert, AlertTitle, AlertDescription } from "./alert";
4
-
5
- describe("Alert", () => {
6
- it("should render alert with role", () => {
7
- const { container } = render(<Alert>Test alert</Alert>);
8
- const alert = container.querySelector('[data-slot="alert"]');
9
- expect(alert).toHaveAttribute("role", "alert");
10
- });
11
-
12
- it("should render alert title and description", () => {
13
- const { getByText } = render(
14
- <Alert>
15
- <AlertTitle>Alert Title</AlertTitle>
16
- <AlertDescription>Alert description</AlertDescription>
17
- </Alert>
18
- );
19
- expect(getByText("Alert Title")).toBeInTheDocument();
20
- expect(getByText("Alert description")).toBeInTheDocument();
21
- });
22
-
23
- it("should apply variant classes", () => {
24
- const { container } = render(<Alert variant="destructive">Error</Alert>);
25
- const alert = container.querySelector('[data-slot="alert"]');
26
- expect(alert).toHaveClass("text-destructive");
27
- });
28
-
29
- it("should render with default variant", () => {
30
- const { container } = render(<Alert>Default alert</Alert>);
31
- const alert = container.querySelector('[data-slot="alert"]');
32
- expect(alert).toBeInTheDocument();
33
- });
34
- });
35
-
@@ -1,66 +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 grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
8
- {
9
- variants: {
10
- variant: {
11
- default: "bg-card text-card-foreground",
12
- destructive:
13
- "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
14
- },
15
- },
16
- defaultVariants: {
17
- variant: "default",
18
- },
19
- }
20
- )
21
-
22
- function Alert({
23
- className,
24
- variant,
25
- ...props
26
- }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
27
- return (
28
- <div
29
- data-slot="alert"
30
- role="alert"
31
- className={cn(alertVariants({ variant }), className)}
32
- {...props}
33
- />
34
- )
35
- }
36
-
37
- function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
38
- return (
39
- <div
40
- data-slot="alert-title"
41
- className={cn(
42
- "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
43
- className
44
- )}
45
- {...props}
46
- />
47
- )
48
- }
49
-
50
- function AlertDescription({
51
- className,
52
- ...props
53
- }: React.ComponentProps<"div">) {
54
- return (
55
- <div
56
- data-slot="alert-description"
57
- className={cn(
58
- "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
59
- className
60
- )}
61
- {...props}
62
- />
63
- )
64
- }
65
-
66
- export { Alert, AlertTitle, AlertDescription }
@@ -1,97 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { AspectRatio } from "./aspect-ratio";
3
-
4
- const meta = {
5
- title: "Components/AspectRatio",
6
- component: AspectRatio,
7
- parameters: {
8
- layout: "padded",
9
- },
10
- tags: ["autodocs"],
11
- argTypes: {
12
- ratio: {
13
- control: "number",
14
- description: "The aspect ratio (width / height).",
15
- },
16
- },
17
- } satisfies Meta<typeof AspectRatio>;
18
-
19
- export default meta;
20
- type Story = StoryObj<typeof meta>;
21
-
22
- export const Default: Story = {
23
- args: {
24
- ratio: 16 / 9,
25
- },
26
- render: (args) => (
27
- <div className="w-[450px]">
28
- <AspectRatio {...args} className="bg-muted rounded-md overflow-hidden">
29
- <img
30
- src="http://placecats.com/500/500"
31
- alt="Photo"
32
- className="h-full w-full object-cover"
33
- />
34
- </AspectRatio>
35
- </div>
36
- ),
37
- };
38
-
39
- export const Ratios: Story = {
40
- render: () => (
41
- <div className="space-y-4 w-[450px]">
42
- <div>
43
- <p className="mb-2 text-sm font-medium">16:9</p>
44
- <AspectRatio ratio={16 / 9} className="bg-muted rounded-md">
45
- <div className="flex h-full w-full items-center justify-center">
46
- 16:9
47
- </div>
48
- </AspectRatio>
49
- </div>
50
- <div>
51
- <p className="mb-2 text-sm font-medium">4:3</p>
52
- <AspectRatio ratio={4 / 3} className="bg-muted rounded-md">
53
- <div className="flex h-full w-full items-center justify-center">
54
- 4:3
55
- </div>
56
- </AspectRatio>
57
- </div>
58
- <div>
59
- <p className="mb-2 text-sm font-medium">1:1</p>
60
- <AspectRatio ratio={1} className="bg-muted rounded-md">
61
- <div className="flex h-full w-full items-center justify-center">
62
- 1:1
63
- </div>
64
- </AspectRatio>
65
- </div>
66
- </div>
67
- ),
68
- };
69
-
70
- export const WithImage: Story = {
71
- render: () => (
72
- <div className="w-[450px]">
73
- <AspectRatio
74
- ratio={16 / 9}
75
- className="bg-muted rounded-md overflow-hidden"
76
- >
77
- <img
78
- src="http://placecats.com/800/450"
79
- alt="Photo"
80
- className="h-full w-full object-cover"
81
- />
82
- </AspectRatio>
83
- </div>
84
- ),
85
- };
86
-
87
- export const Square: Story = {
88
- render: () => (
89
- <div className="w-[300px]">
90
- <AspectRatio ratio={1} className="bg-muted rounded-md">
91
- <div className="flex h-full w-full items-center justify-center">
92
- Square
93
- </div>
94
- </AspectRatio>
95
- </div>
96
- ),
97
- };
@@ -1,47 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { render } from "@testing-library/react";
3
- import { AspectRatio } from "./aspect-ratio";
4
-
5
- describe("AspectRatio", () => {
6
- it("should render aspect ratio container", () => {
7
- const { container } = render(
8
- <AspectRatio ratio={16 / 9}>
9
- <div>Content</div>
10
- </AspectRatio>
11
- );
12
- const aspectRatio = container.querySelector('[data-slot="aspect-ratio"]');
13
- expect(aspectRatio).toBeInTheDocument();
14
- });
15
-
16
- it("should apply ratio style", () => {
17
- const { container } = render(
18
- <AspectRatio ratio={16 / 9}>
19
- <div>Content</div>
20
- </AspectRatio>
21
- );
22
- const aspectRatio = container.querySelector('[data-slot="aspect-ratio"]') as HTMLElement;
23
- // Radix UI AspectRatio uses CSS custom properties, check for ratio attribute or style
24
- expect(aspectRatio).toBeInTheDocument();
25
- });
26
-
27
- it("should render children", () => {
28
- const { getByText } = render(
29
- <AspectRatio ratio={1}>
30
- <div>Aspect ratio content</div>
31
- </AspectRatio>
32
- );
33
- expect(getByText("Aspect ratio content")).toBeInTheDocument();
34
- });
35
-
36
- it("should support different ratios", () => {
37
- const { container } = render(
38
- <AspectRatio ratio={4 / 3}>
39
- <div>Content</div>
40
- </AspectRatio>
41
- );
42
- const aspectRatio = container.querySelector('[data-slot="aspect-ratio"]') as HTMLElement;
43
- // Radix UI AspectRatio uses CSS custom properties
44
- expect(aspectRatio).toBeInTheDocument();
45
- });
46
- });
47
-
@@ -1,11 +0,0 @@
1
- "use client"
2
-
3
- import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
4
-
5
- function AspectRatio({
6
- ...props
7
- }: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
8
- return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
9
- }
10
-
11
- export { AspectRatio }
@@ -1,76 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { Avatar, AvatarImage, AvatarFallback } from "./avatar";
3
-
4
- const meta = {
5
- title: "Components/Avatar",
6
- component: Avatar,
7
- parameters: {
8
- layout: "padded",
9
- },
10
- tags: ["autodocs"],
11
- } satisfies Meta<typeof Avatar>;
12
-
13
- export default meta;
14
- type Story = StoryObj<typeof meta>;
15
-
16
- export const Default: Story = {
17
- render: () => (
18
- <Avatar>
19
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
20
- <AvatarFallback>CN</AvatarFallback>
21
- </Avatar>
22
- ),
23
- };
24
-
25
- export const WithFallback: Story = {
26
- render: () => (
27
- <div className="flex gap-4">
28
- <Avatar>
29
- <AvatarImage src="https://invalid-url.png" alt="Invalid" />
30
- <AvatarFallback>JD</AvatarFallback>
31
- </Avatar>
32
- <Avatar>
33
- <AvatarFallback>AB</AvatarFallback>
34
- </Avatar>
35
- </div>
36
- ),
37
- };
38
-
39
- export const Sizes: Story = {
40
- render: () => (
41
- <div className="flex items-center gap-4">
42
- <Avatar className="size-8">
43
- <AvatarFallback>SM</AvatarFallback>
44
- </Avatar>
45
- <Avatar className="size-12">
46
- <AvatarFallback>MD</AvatarFallback>
47
- </Avatar>
48
- <Avatar className="size-16">
49
- <AvatarFallback>LG</AvatarFallback>
50
- </Avatar>
51
- </div>
52
- ),
53
- };
54
-
55
- export const Group: Story = {
56
- render: () => (
57
- <div className="flex -space-x-2">
58
- <Avatar className="border-2 border-background">
59
- <AvatarImage src="https://github.com/shadcn.png" alt="User 1" />
60
- <AvatarFallback>U1</AvatarFallback>
61
- </Avatar>
62
- <Avatar className="border-2 border-background">
63
- <AvatarImage src="https://github.com/shadcn.png" alt="User 2" />
64
- <AvatarFallback>U2</AvatarFallback>
65
- </Avatar>
66
- <Avatar className="border-2 border-background">
67
- <AvatarImage src="https://github.com/shadcn.png" alt="User 3" />
68
- <AvatarFallback>U3</AvatarFallback>
69
- </Avatar>
70
- <Avatar className="border-2 border-background">
71
- <AvatarFallback>+5</AvatarFallback>
72
- </Avatar>
73
- </div>
74
- ),
75
- };
76
-