@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,56 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { render } from "@testing-library/react";
3
- import {
4
- Card,
5
- CardHeader,
6
- CardTitle,
7
- CardDescription,
8
- CardContent,
9
- CardFooter,
10
- } from "./card";
11
-
12
- describe("Card", () => {
13
- it("should render card", () => {
14
- const { container } = render(<Card>Card content</Card>);
15
- const card = container.querySelector('[data-slot="card"]');
16
- expect(card).toBeInTheDocument();
17
- });
18
-
19
- it("should render card with header, content, and footer", () => {
20
- const { getByText } = render(
21
- <Card>
22
- <CardHeader>
23
- <CardTitle>Card Title</CardTitle>
24
- <CardDescription>Card Description</CardDescription>
25
- </CardHeader>
26
- <CardContent>Card Content</CardContent>
27
- <CardFooter>Card Footer</CardFooter>
28
- </Card>
29
- );
30
- expect(getByText("Card Title")).toBeInTheDocument();
31
- expect(getByText("Card Description")).toBeInTheDocument();
32
- expect(getByText("Card Content")).toBeInTheDocument();
33
- expect(getByText("Card Footer")).toBeInTheDocument();
34
- });
35
-
36
- it("should render card header", () => {
37
- const { container } = render(
38
- <Card>
39
- <CardHeader>Header</CardHeader>
40
- </Card>
41
- );
42
- const header = container.querySelector('[data-slot="card-header"]');
43
- expect(header).toBeInTheDocument();
44
- });
45
-
46
- it("should render card content", () => {
47
- const { container } = render(
48
- <Card>
49
- <CardContent>Content</CardContent>
50
- </Card>
51
- );
52
- const content = container.querySelector('[data-slot="card-content"]');
53
- expect(content).toBeInTheDocument();
54
- });
55
- });
56
-
@@ -1,92 +0,0 @@
1
- import * as React from "react"
2
-
3
- import { cn } from "@/lib/utils"
4
-
5
- function Card({ className, ...props }: React.ComponentProps<"div">) {
6
- return (
7
- <div
8
- data-slot="card"
9
- className={cn(
10
- "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
- className
12
- )}
13
- {...props}
14
- />
15
- )
16
- }
17
-
18
- function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
- return (
20
- <div
21
- data-slot="card-header"
22
- className={cn(
23
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
24
- className
25
- )}
26
- {...props}
27
- />
28
- )
29
- }
30
-
31
- function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
- return (
33
- <div
34
- data-slot="card-title"
35
- className={cn("leading-none font-semibold", className)}
36
- {...props}
37
- />
38
- )
39
- }
40
-
41
- function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
- return (
43
- <div
44
- data-slot="card-description"
45
- className={cn("text-muted-foreground text-sm", className)}
46
- {...props}
47
- />
48
- )
49
- }
50
-
51
- function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
- return (
53
- <div
54
- data-slot="card-action"
55
- className={cn(
56
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
- className
58
- )}
59
- {...props}
60
- />
61
- )
62
- }
63
-
64
- function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
- return (
66
- <div
67
- data-slot="card-content"
68
- className={cn("px-6", className)}
69
- {...props}
70
- />
71
- )
72
- }
73
-
74
- function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
- return (
76
- <div
77
- data-slot="card-footer"
78
- className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
79
- {...props}
80
- />
81
- )
82
- }
83
-
84
- export {
85
- Card,
86
- CardHeader,
87
- CardFooter,
88
- CardTitle,
89
- CardAction,
90
- CardDescription,
91
- CardContent,
92
- }
@@ -1,90 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import {
3
- Carousel,
4
- CarouselContent,
5
- CarouselItem,
6
- CarouselNext,
7
- CarouselPrevious,
8
- } from "./carousel";
9
- import { Card, CardContent } from "./card";
10
-
11
- const meta = {
12
- title: "Components/Carousel",
13
- component: Carousel,
14
- parameters: {
15
- layout: "padded",
16
- },
17
- tags: ["autodocs"],
18
- } satisfies Meta<typeof Carousel>;
19
-
20
- export default meta;
21
- type Story = StoryObj<typeof meta>;
22
-
23
- export const Default: Story = {
24
- render: () => (
25
- <Carousel className="w-full max-w-xs">
26
- <CarouselContent>
27
- {Array.from({ length: 5 }).map((_, index) => (
28
- <CarouselItem key={index}>
29
- <div className="p-1">
30
- <Card>
31
- <CardContent className="flex aspect-square items-center justify-center p-6">
32
- <span className="text-4xl font-semibold">{index + 1}</span>
33
- </CardContent>
34
- </Card>
35
- </div>
36
- </CarouselItem>
37
- ))}
38
- </CarouselContent>
39
- <CarouselPrevious />
40
- <CarouselNext />
41
- </Carousel>
42
- ),
43
- };
44
-
45
- export const MultipleItems: Story = {
46
- render: () => (
47
- <Carousel className="w-full max-w-xs">
48
- <CarouselContent className="-ml-1">
49
- {Array.from({ length: 5 }).map((_, index) => (
50
- <CarouselItem key={index} className="pl-1 md:basis-1/2 lg:basis-1/3">
51
- <div className="p-1">
52
- <Card>
53
- <CardContent className="flex aspect-square items-center justify-center p-6">
54
- <span className="text-2xl font-semibold">{index + 1}</span>
55
- </CardContent>
56
- </Card>
57
- </div>
58
- </CarouselItem>
59
- ))}
60
- </CarouselContent>
61
- <CarouselPrevious />
62
- <CarouselNext />
63
- </Carousel>
64
- ),
65
- };
66
-
67
- export const WithImages: Story = {
68
- render: () => (
69
- <Carousel className="w-full max-w-xs">
70
- <CarouselContent>
71
- {Array.from({ length: 3 }).map((_, index) => (
72
- <CarouselItem key={index}>
73
- <div className="p-1">
74
- <Card>
75
- <CardContent className="flex aspect-square items-center justify-center p-0">
76
- <div className="flex h-full w-full items-center justify-center bg-muted">
77
- <span className="text-4xl">Image {index + 1}</span>
78
- </div>
79
- </CardContent>
80
- </Card>
81
- </div>
82
- </CarouselItem>
83
- ))}
84
- </CarouselContent>
85
- <CarouselPrevious />
86
- <CarouselNext />
87
- </Carousel>
88
- ),
89
- };
90
-
@@ -1,239 +0,0 @@
1
- import * as React from "react";
2
- import useEmblaCarousel, {
3
- type UseEmblaCarouselType,
4
- } from "embla-carousel-react";
5
- import { ArrowLeft, ArrowRight } from "lucide-react";
6
-
7
- import { cn } from "@/lib/utils";
8
- import { Button } from "@/components/button";
9
-
10
- type CarouselApi = UseEmblaCarouselType[1];
11
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
12
- type CarouselOptions = UseCarouselParameters[0];
13
- type CarouselPlugin = UseCarouselParameters[1];
14
-
15
- type CarouselProps = {
16
- opts?: CarouselOptions;
17
- plugins?: CarouselPlugin;
18
- orientation?: "horizontal" | "vertical";
19
- setApi?: (api: CarouselApi) => void;
20
- };
21
-
22
- type CarouselContextProps = {
23
- carouselRef: ReturnType<typeof useEmblaCarousel>[0];
24
- api: ReturnType<typeof useEmblaCarousel>[1];
25
- scrollPrev: () => void;
26
- scrollNext: () => void;
27
- canScrollPrev: boolean;
28
- canScrollNext: boolean;
29
- } & CarouselProps;
30
-
31
- const CarouselContext = React.createContext<CarouselContextProps | null>(null);
32
-
33
- function useCarousel() {
34
- const context = React.useContext(CarouselContext);
35
-
36
- if (!context) {
37
- throw new Error("useCarousel must be used within a <Carousel />");
38
- }
39
-
40
- return context;
41
- }
42
-
43
- function Carousel({
44
- orientation = "horizontal",
45
- opts,
46
- setApi,
47
- plugins,
48
- className,
49
- children,
50
- ...props
51
- }: React.ComponentProps<"div"> & CarouselProps) {
52
- const [carouselRef, api] = useEmblaCarousel(
53
- {
54
- ...opts,
55
- axis: orientation === "horizontal" ? "x" : "y",
56
- },
57
- plugins
58
- );
59
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
60
- const [canScrollNext, setCanScrollNext] = React.useState(false);
61
-
62
- const onSelect = React.useCallback((api: CarouselApi) => {
63
- if (!api) return;
64
- setCanScrollPrev(api.canScrollPrev());
65
- setCanScrollNext(api.canScrollNext());
66
- }, []);
67
-
68
- const scrollPrev = React.useCallback(() => {
69
- api?.scrollPrev();
70
- }, [api]);
71
-
72
- const scrollNext = React.useCallback(() => {
73
- api?.scrollNext();
74
- }, [api]);
75
-
76
- const handleKeyDown = React.useCallback(
77
- (event: React.KeyboardEvent<HTMLDivElement>) => {
78
- if (event.key === "ArrowLeft") {
79
- event.preventDefault();
80
- scrollPrev();
81
- } else if (event.key === "ArrowRight") {
82
- event.preventDefault();
83
- scrollNext();
84
- }
85
- },
86
- [scrollPrev, scrollNext]
87
- );
88
-
89
- React.useEffect(() => {
90
- if (!api || !setApi) return;
91
- setApi(api);
92
- }, [api, setApi]);
93
-
94
- React.useEffect(() => {
95
- if (!api) return;
96
- onSelect(api);
97
- api.on("reInit", onSelect);
98
- api.on("select", onSelect);
99
-
100
- return () => {
101
- api?.off("select", onSelect);
102
- };
103
- }, [api, onSelect]);
104
-
105
- return (
106
- <CarouselContext.Provider
107
- value={{
108
- carouselRef,
109
- api: api,
110
- opts,
111
- orientation:
112
- orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
113
- scrollPrev,
114
- scrollNext,
115
- canScrollPrev,
116
- canScrollNext,
117
- }}
118
- >
119
- <div
120
- onKeyDownCapture={handleKeyDown}
121
- className={cn("relative", className)}
122
- role="region"
123
- aria-roledescription="carousel"
124
- data-slot="carousel"
125
- {...props}
126
- >
127
- {children}
128
- </div>
129
- </CarouselContext.Provider>
130
- );
131
- }
132
-
133
- function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
134
- const { carouselRef, orientation } = useCarousel();
135
-
136
- return (
137
- <div
138
- ref={carouselRef}
139
- className="overflow-hidden"
140
- data-slot="carousel-content"
141
- >
142
- <div
143
- className={cn(
144
- "flex",
145
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
146
- className
147
- )}
148
- {...props}
149
- />
150
- </div>
151
- );
152
- }
153
-
154
- function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
155
- const { orientation } = useCarousel();
156
-
157
- return (
158
- <div
159
- role="group"
160
- aria-roledescription="slide"
161
- data-slot="carousel-item"
162
- className={cn(
163
- "min-w-0 shrink-0 grow-0 basis-full",
164
- orientation === "horizontal" ? "pl-4" : "pt-4",
165
- className
166
- )}
167
- {...props}
168
- />
169
- );
170
- }
171
-
172
- function CarouselPrevious({
173
- className,
174
- variant = "outline",
175
- size = "icon",
176
- ...props
177
- }: React.ComponentProps<typeof Button>) {
178
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
179
-
180
- return (
181
- <Button
182
- data-slot="carousel-previous"
183
- variant={variant}
184
- size={size}
185
- className={cn(
186
- "absolute size-8 rounded-full",
187
- orientation === "horizontal"
188
- ? "top-1/2 -left-12 -translate-y-1/2"
189
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
190
- className
191
- )}
192
- disabled={!canScrollPrev}
193
- onClick={scrollPrev}
194
- {...props}
195
- >
196
- <ArrowLeft />
197
- <span className="sr-only">Previous slide</span>
198
- </Button>
199
- );
200
- }
201
-
202
- function CarouselNext({
203
- className,
204
- variant = "outline",
205
- size = "icon",
206
- ...props
207
- }: React.ComponentProps<typeof Button>) {
208
- const { orientation, scrollNext, canScrollNext } = useCarousel();
209
-
210
- return (
211
- <Button
212
- data-slot="carousel-next"
213
- variant={variant}
214
- size={size}
215
- className={cn(
216
- "absolute size-8 rounded-full",
217
- orientation === "horizontal"
218
- ? "top-1/2 -right-12 -translate-y-1/2"
219
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
220
- className
221
- )}
222
- disabled={!canScrollNext}
223
- onClick={scrollNext}
224
- {...props}
225
- >
226
- <ArrowRight />
227
- <span className="sr-only">Next slide</span>
228
- </Button>
229
- );
230
- }
231
-
232
- export {
233
- type CarouselApi,
234
- Carousel,
235
- CarouselContent,
236
- CarouselItem,
237
- CarouselPrevious,
238
- CarouselNext,
239
- };