@codefast/ui 0.3.16-canary.2 → 0.3.16-canary.3

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 (223) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -1
  3. package/dist/components/accordion.mjs +2 -2
  4. package/dist/components/alert-dialog.d.mts +1 -1
  5. package/dist/components/alert-dialog.mjs +4 -4
  6. package/dist/components/alert.d.mts +3 -13
  7. package/dist/components/alert.mjs +3 -23
  8. package/dist/components/badge.d.mts +3 -15
  9. package/dist/components/badge.mjs +2 -44
  10. package/dist/components/breadcrumb.mjs +1 -1
  11. package/dist/components/button-group.d.mts +3 -13
  12. package/dist/components/button-group.mjs +3 -24
  13. package/dist/components/button.d.mts +3 -25
  14. package/dist/components/button.mjs +2 -72
  15. package/dist/components/calendar.mjs +2 -1
  16. package/dist/components/carousel.d.mts +1 -2
  17. package/dist/components/chart.d.mts +2 -4
  18. package/dist/components/checkbox.mjs +2 -2
  19. package/dist/components/context-menu.mjs +2 -2
  20. package/dist/components/dialog.d.mts +1 -1
  21. package/dist/components/dialog.mjs +4 -4
  22. package/dist/components/drawer.d.mts +1 -1
  23. package/dist/components/drawer.mjs +2 -2
  24. package/dist/components/dropdown-menu.mjs +2 -2
  25. package/dist/components/empty.d.mts +3 -13
  26. package/dist/components/empty.mjs +3 -18
  27. package/dist/components/field.d.mts +3 -14
  28. package/dist/components/field.mjs +3 -32
  29. package/dist/components/form.d.mts +2 -4
  30. package/dist/components/hover-card.mjs +1 -1
  31. package/dist/components/input-group.d.mts +4 -31
  32. package/dist/components/input-group.mjs +3 -90
  33. package/dist/components/input-number.mjs +4 -4
  34. package/dist/components/input-otp.mjs +2 -2
  35. package/dist/components/input.mjs +1 -1
  36. package/dist/components/item.d.mts +4 -29
  37. package/dist/components/item.mjs +3 -56
  38. package/dist/components/menubar.mjs +2 -2
  39. package/dist/components/native-select.mjs +1 -1
  40. package/dist/components/navigation-menu.d.mts +1 -6
  41. package/dist/components/navigation-menu.mjs +8 -15
  42. package/dist/components/pagination.d.mts +1 -1
  43. package/dist/components/pagination.mjs +1 -1
  44. package/dist/components/popover.mjs +1 -1
  45. package/dist/components/progress-circle.d.mts +3 -47
  46. package/dist/components/progress-circle.mjs +2 -47
  47. package/dist/components/progress.mjs +1 -1
  48. package/dist/components/radio-group.mjs +1 -1
  49. package/dist/components/radio.mjs +1 -1
  50. package/dist/components/scroll-area.d.mts +3 -19
  51. package/dist/components/scroll-area.mjs +4 -61
  52. package/dist/components/select.d.mts +1 -1
  53. package/dist/components/select.mjs +3 -3
  54. package/dist/components/separator.d.mts +3 -18
  55. package/dist/components/separator.mjs +3 -23
  56. package/dist/components/sheet.d.mts +6 -18
  57. package/dist/components/sheet.mjs +6 -49
  58. package/dist/components/sidebar.d.mts +4 -19
  59. package/dist/components/sidebar.mjs +10 -46
  60. package/dist/components/skeleton.mjs +1 -1
  61. package/dist/components/slider.mjs +1 -1
  62. package/dist/components/spinner.mjs +1 -1
  63. package/dist/components/switch.mjs +2 -2
  64. package/dist/components/table.mjs +1 -1
  65. package/dist/components/tabs.mjs +1 -1
  66. package/dist/components/textarea.mjs +1 -1
  67. package/dist/components/toggle-group.d.mts +3 -2
  68. package/dist/components/toggle-group.mjs +1 -1
  69. package/dist/components/toggle.d.mts +2 -21
  70. package/dist/components/toggle.mjs +2 -39
  71. package/dist/components/tooltip.mjs +1 -1
  72. package/dist/index.d.mts +31 -16
  73. package/dist/index.mjs +30 -15
  74. package/dist/lib/utils.d.mts +1 -12
  75. package/dist/lib/utils.mjs +1 -9
  76. package/dist/primitives/checkbox-group.d.mts +1 -2
  77. package/dist/primitives/input-number.d.mts +1 -2
  78. package/dist/primitives/input.d.mts +1 -2
  79. package/dist/primitives/progress-circle.d.mts +1 -2
  80. package/dist/variants/alert.d.mts +18 -0
  81. package/dist/variants/alert.mjs +25 -0
  82. package/dist/variants/badge.d.mts +20 -0
  83. package/dist/variants/badge.mjs +46 -0
  84. package/dist/variants/button-group.d.mts +18 -0
  85. package/dist/variants/button-group.mjs +26 -0
  86. package/dist/variants/button.d.mts +30 -0
  87. package/dist/variants/button.mjs +76 -0
  88. package/dist/variants/empty.d.mts +18 -0
  89. package/dist/variants/empty.mjs +20 -0
  90. package/dist/variants/field.d.mts +19 -0
  91. package/dist/variants/field.mjs +34 -0
  92. package/dist/variants/input-group.d.mts +43 -0
  93. package/dist/variants/input-group.mjs +93 -0
  94. package/dist/variants/item.d.mts +37 -0
  95. package/dist/variants/item.mjs +60 -0
  96. package/dist/variants/navigation-menu.d.mts +13 -0
  97. package/dist/variants/navigation-menu.mjs +12 -0
  98. package/dist/variants/progress-circle.d.mts +52 -0
  99. package/dist/variants/progress-circle.mjs +49 -0
  100. package/dist/variants/scroll-area.d.mts +24 -0
  101. package/dist/variants/scroll-area.mjs +63 -0
  102. package/dist/variants/separator.d.mts +23 -0
  103. package/dist/variants/separator.mjs +25 -0
  104. package/dist/variants/sheet.d.mts +20 -0
  105. package/dist/variants/sheet.mjs +50 -0
  106. package/dist/variants/sidebar.d.mts +23 -0
  107. package/dist/variants/sidebar.mjs +42 -0
  108. package/dist/variants/toggle.d.mts +23 -0
  109. package/dist/variants/toggle.mjs +43 -0
  110. package/package.json +168 -20
  111. package/src/components/accordion.tsx +156 -0
  112. package/src/components/alert-dialog.tsx +314 -0
  113. package/src/components/alert.tsx +86 -0
  114. package/src/components/aspect-ratio.tsx +28 -0
  115. package/src/components/avatar.tsx +84 -0
  116. package/src/components/badge.tsx +38 -0
  117. package/src/components/breadcrumb.tsx +197 -0
  118. package/src/components/button-group.tsx +107 -0
  119. package/src/components/button.tsx +66 -0
  120. package/src/components/calendar.tsx +277 -0
  121. package/src/components/card.tsx +175 -0
  122. package/src/components/carousel.tsx +367 -0
  123. package/src/components/chart.tsx +587 -0
  124. package/src/components/checkbox-cards.tsx +92 -0
  125. package/src/components/checkbox-group.tsx +83 -0
  126. package/src/components/checkbox.tsx +65 -0
  127. package/src/components/collapsible.tsx +60 -0
  128. package/src/components/command.tsx +311 -0
  129. package/src/components/context-menu.tsx +489 -0
  130. package/src/components/dialog.tsx +295 -0
  131. package/src/components/drawer.tsx +271 -0
  132. package/src/components/dropdown-menu.tsx +498 -0
  133. package/src/components/empty.tsx +169 -0
  134. package/src/components/field.tsx +362 -0
  135. package/src/components/form.tsx +300 -0
  136. package/src/components/hover-card.tsx +116 -0
  137. package/src/components/input-group.tsx +224 -0
  138. package/src/components/input-number.tsx +161 -0
  139. package/src/components/input-otp.tsx +151 -0
  140. package/src/components/input-password.tsx +74 -0
  141. package/src/components/input-search.tsx +98 -0
  142. package/src/components/input.tsx +52 -0
  143. package/src/components/item.tsx +280 -0
  144. package/src/components/kbd.tsx +59 -0
  145. package/src/components/label.tsx +44 -0
  146. package/src/components/menubar.tsx +531 -0
  147. package/src/components/native-select.tsx +96 -0
  148. package/src/components/navigation-menu.tsx +295 -0
  149. package/src/components/pagination.tsx +204 -0
  150. package/src/components/popover.tsx +139 -0
  151. package/src/components/progress-circle.tsx +203 -0
  152. package/src/components/progress.tsx +54 -0
  153. package/src/components/radio-cards.tsx +85 -0
  154. package/src/components/radio-group.tsx +79 -0
  155. package/src/components/radio.tsx +61 -0
  156. package/src/components/resizable.tsx +99 -0
  157. package/src/components/scroll-area.tsx +115 -0
  158. package/src/components/select.tsx +319 -0
  159. package/src/components/separator.tsx +74 -0
  160. package/src/components/sheet.tsx +278 -0
  161. package/src/components/sidebar.tsx +1056 -0
  162. package/src/components/skeleton.tsx +37 -0
  163. package/src/components/slider.tsx +95 -0
  164. package/src/components/sonner.tsx +47 -0
  165. package/src/components/spinner.tsx +75 -0
  166. package/src/components/switch.tsx +66 -0
  167. package/src/components/table.tsx +200 -0
  168. package/src/components/tabs.tsx +128 -0
  169. package/src/components/textarea.tsx +49 -0
  170. package/src/components/toggle-group.tsx +141 -0
  171. package/src/components/toggle.tsx +39 -0
  172. package/src/components/tooltip.tsx +141 -0
  173. package/src/css/amber.css +59 -22
  174. package/src/css/blue.css +59 -22
  175. package/src/css/cyan.css +59 -22
  176. package/src/css/emerald.css +59 -22
  177. package/src/css/fuchsia.css +59 -22
  178. package/src/css/gray.css +59 -22
  179. package/src/css/green.css +59 -22
  180. package/src/css/indigo.css +59 -22
  181. package/src/css/lime.css +59 -22
  182. package/src/css/neutral.css +59 -22
  183. package/src/css/orange.css +59 -22
  184. package/src/css/pink.css +59 -22
  185. package/src/css/preset.css +32 -13
  186. package/src/css/purple.css +59 -22
  187. package/src/css/red.css +59 -22
  188. package/src/css/rose.css +59 -22
  189. package/src/css/sky.css +59 -22
  190. package/src/css/slate.css +59 -22
  191. package/src/css/stone.css +59 -22
  192. package/src/css/teal.css +59 -22
  193. package/src/css/violet.css +59 -22
  194. package/src/css/yellow.css +59 -22
  195. package/src/css/zinc.css +59 -22
  196. package/src/hooks/use-animated-value.ts +97 -0
  197. package/src/hooks/use-copy-to-clipboard.ts +63 -0
  198. package/src/hooks/use-is-mobile.ts +27 -0
  199. package/src/hooks/use-media-query.ts +71 -0
  200. package/src/hooks/use-mutation-observer.ts +54 -0
  201. package/src/hooks/use-pagination.ts +166 -0
  202. package/src/index.ts +720 -0
  203. package/src/lib/utils.ts +5 -0
  204. package/src/primitives/checkbox-group.tsx +360 -0
  205. package/src/primitives/input-number.tsx +1013 -0
  206. package/src/primitives/input.tsx +243 -0
  207. package/src/primitives/progress-circle.tsx +537 -0
  208. package/src/variants/alert.ts +45 -0
  209. package/src/variants/badge.ts +66 -0
  210. package/src/variants/button-group.ts +49 -0
  211. package/src/variants/button.ts +93 -0
  212. package/src/variants/empty.ts +43 -0
  213. package/src/variants/field.ts +50 -0
  214. package/src/variants/input-group.ts +132 -0
  215. package/src/variants/item.ts +90 -0
  216. package/src/variants/navigation-menu.ts +32 -0
  217. package/src/variants/progress-circle.ts +47 -0
  218. package/src/variants/scroll-area.ts +79 -0
  219. package/src/variants/separator.ts +41 -0
  220. package/src/variants/sheet.ts +70 -0
  221. package/src/variants/sidebar.ts +61 -0
  222. package/src/variants/toggle.ts +59 -0
  223. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
@@ -0,0 +1,175 @@
1
+ import type { ComponentProps, JSX } from "react";
2
+
3
+ import { cn } from "#/lib/utils";
4
+
5
+ /* -----------------------------------------------------------------------------
6
+ * Component: Card
7
+ * -------------------------------------------------------------------------- */
8
+
9
+ /**
10
+ * @since 0.3.16-canary.0
11
+ */
12
+ type CardProps = ComponentProps<"div">;
13
+
14
+ /**
15
+ * @since 0.3.16-canary.0
16
+ */
17
+ function Card({ className, ...props }: CardProps): JSX.Element {
18
+ return (
19
+ <div
20
+ className={cn(
21
+ "flex flex-col gap-6 overflow-auto py-6",
22
+ "rounded-xl border",
23
+ "bg-card text-card-foreground shadow-sm",
24
+ className,
25
+ )}
26
+ data-slot="card"
27
+ {...props}
28
+ />
29
+ );
30
+ }
31
+
32
+ /* -----------------------------------------------------------------------------
33
+ * Component: CardHeader
34
+ * -------------------------------------------------------------------------- */
35
+
36
+ /**
37
+ * @since 0.3.16-canary.0
38
+ */
39
+ type CardHeaderProps = ComponentProps<"div">;
40
+
41
+ /**
42
+ * @since 0.3.16-canary.0
43
+ */
44
+ function CardHeader({ className, ...props }: CardHeaderProps): JSX.Element {
45
+ return (
46
+ <div
47
+ className={cn(
48
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5",
49
+ "px-6",
50
+ "has-[data-slot=card-action]:grid-cols-[1fr_auto]",
51
+ "[.border-b]:pb-6",
52
+ className,
53
+ )}
54
+ data-slot="card-header"
55
+ {...props}
56
+ />
57
+ );
58
+ }
59
+
60
+ /* -----------------------------------------------------------------------------
61
+ * Component: CardTitle
62
+ * -------------------------------------------------------------------------- */
63
+
64
+ /**
65
+ * @since 0.3.16-canary.0
66
+ */
67
+ type CardTitleProps = ComponentProps<"div">;
68
+
69
+ /**
70
+ * @since 0.3.16-canary.0
71
+ */
72
+ function CardTitle({ children, className, ...props }: CardTitleProps): JSX.Element {
73
+ return (
74
+ <div className={cn("leading-none font-semibold", className)} data-slot="card-title" {...props}>
75
+ {children}
76
+ </div>
77
+ );
78
+ }
79
+
80
+ /* -----------------------------------------------------------------------------
81
+ * Component: CardDescription
82
+ * -------------------------------------------------------------------------- */
83
+
84
+ /**
85
+ * @since 0.3.16-canary.0
86
+ */
87
+ type CardDescriptionProps = ComponentProps<"div">;
88
+
89
+ /**
90
+ * @since 0.3.16-canary.0
91
+ */
92
+ function CardDescription({ className, ...props }: CardDescriptionProps): JSX.Element {
93
+ return (
94
+ <div
95
+ className={cn("text-sm text-muted-foreground", className)}
96
+ data-slot="card-description"
97
+ {...props}
98
+ />
99
+ );
100
+ }
101
+
102
+ /* -----------------------------------------------------------------------------
103
+ * Component: CardContent
104
+ * -------------------------------------------------------------------------- */
105
+
106
+ /**
107
+ * @since 0.3.16-canary.0
108
+ */
109
+ type CardContentProps = ComponentProps<"div">;
110
+
111
+ /**
112
+ * @since 0.3.16-canary.0
113
+ */
114
+ function CardContent({ className, ...props }: CardContentProps): JSX.Element {
115
+ return <div className={cn("px-6", className)} data-slot="card-content" {...props} />;
116
+ }
117
+
118
+ /* -----------------------------------------------------------------------------
119
+ * Component: CardFooter
120
+ * -------------------------------------------------------------------------- */
121
+
122
+ /**
123
+ * @since 0.3.16-canary.0
124
+ */
125
+ type CardFooterProps = ComponentProps<"div">;
126
+
127
+ /**
128
+ * @since 0.3.16-canary.0
129
+ */
130
+ function CardFooter({ className, ...props }: CardFooterProps): JSX.Element {
131
+ return (
132
+ <div
133
+ className={cn("flex items-center", "px-6", "[.border-t]:pt-6", className)}
134
+ data-slot="card-footer"
135
+ {...props}
136
+ />
137
+ );
138
+ }
139
+
140
+ /* -----------------------------------------------------------------------------
141
+ * Component: CardAction
142
+ * -------------------------------------------------------------------------- */
143
+
144
+ /**
145
+ * @since 0.3.16-canary.0
146
+ */
147
+ type CardActionProps = ComponentProps<"div">;
148
+
149
+ /**
150
+ * @since 0.3.16-canary.0
151
+ */
152
+ function CardAction({ className, ...props }: CardActionProps): JSX.Element {
153
+ return (
154
+ <div
155
+ className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
156
+ data-slot="card-action"
157
+ {...props}
158
+ />
159
+ );
160
+ }
161
+
162
+ /* -----------------------------------------------------------------------------
163
+ * Exports
164
+ * -------------------------------------------------------------------------- */
165
+
166
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
167
+ export type {
168
+ CardActionProps,
169
+ CardContentProps,
170
+ CardDescriptionProps,
171
+ CardFooterProps,
172
+ CardHeaderProps,
173
+ CardProps,
174
+ CardTitleProps,
175
+ };
@@ -0,0 +1,367 @@
1
+ "use client";
2
+
3
+ import type { Scope } from "@radix-ui/react-context";
4
+ import type { UseEmblaCarouselType } from "embla-carousel-react";
5
+ import type { ComponentProps, JSX, KeyboardEvent } from "react";
6
+
7
+ import { cn } from "#/lib/utils";
8
+ import { createContextScope } from "@radix-ui/react-context";
9
+ import useEmblaCarousel from "embla-carousel-react";
10
+ import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
11
+ import { useCallback, useEffect, useState } from "react";
12
+
13
+ import { Button } from "#/components/button";
14
+
15
+ /* -----------------------------------------------------------------------------
16
+ * Context: Carousel
17
+ * -------------------------------------------------------------------------- */
18
+
19
+ const CAROUSEL_NAME = "Carousel";
20
+
21
+ type ScopedProps<P> = P & { __scopeCarousel?: Scope };
22
+
23
+ const [createCarouselContext, createCarouselScope] = createContextScope(CAROUSEL_NAME);
24
+
25
+ /**
26
+ * @since 0.3.16-canary.0
27
+ */
28
+ type CarouselApi = UseEmblaCarouselType[1];
29
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
30
+ type CarouselOptions = UseCarouselParameters[0];
31
+ type CarouselPlugin = UseCarouselParameters[1];
32
+
33
+ interface BaseCarouselProps {
34
+ opts?: CarouselOptions;
35
+ orientation?: "horizontal" | "vertical";
36
+ plugins?: CarouselPlugin;
37
+ setApi?: (api: CarouselApi) => void;
38
+ }
39
+
40
+ type CarouselContextValue = BaseCarouselProps & {
41
+ api: ReturnType<typeof useEmblaCarousel>[1];
42
+ canScrollNext: boolean;
43
+ canScrollPrev: boolean;
44
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0];
45
+ scrollNext: () => void;
46
+ scrollPrev: () => void;
47
+ };
48
+
49
+ const [CarouselContextProvider, useCarouselContext] =
50
+ createCarouselContext<CarouselContextValue>(CAROUSEL_NAME);
51
+
52
+ /* -----------------------------------------------------------------------------
53
+ * Component: Carousel
54
+ * -------------------------------------------------------------------------- */
55
+
56
+ /**
57
+ * @since 0.3.16-canary.0
58
+ */
59
+ interface CarouselProps extends BaseCarouselProps, ComponentProps<"div"> {}
60
+
61
+ /**
62
+ * @since 0.3.16-canary.0
63
+ */
64
+ function Carousel({
65
+ __scopeCarousel,
66
+ children,
67
+ className,
68
+ opts,
69
+ orientation,
70
+ plugins,
71
+ setApi,
72
+ ...props
73
+ }: ScopedProps<CarouselProps>): JSX.Element {
74
+ const [carouselRef, api] = useEmblaCarousel(
75
+ {
76
+ ...opts,
77
+ axis: orientation === "vertical" ? "y" : "x",
78
+ },
79
+ plugins,
80
+ );
81
+
82
+ const [canScrollPrevious, setCanScrollPrevious] = useState(false);
83
+ const [canScrollNext, setCanScrollNext] = useState(false);
84
+
85
+ const onSelect = useCallback((carouselApi: CarouselApi) => {
86
+ if (!carouselApi) {
87
+ return;
88
+ }
89
+
90
+ setCanScrollPrevious(carouselApi.canScrollPrev());
91
+ setCanScrollNext(carouselApi.canScrollNext());
92
+ }, []);
93
+
94
+ const scrollPrevious = useCallback(() => {
95
+ api?.scrollPrev();
96
+ }, [api]);
97
+
98
+ const scrollNext = useCallback(() => {
99
+ api?.scrollNext();
100
+ }, [api]);
101
+
102
+ const handleKeyDown = useCallback(
103
+ (event: KeyboardEvent<HTMLDivElement>) => {
104
+ if (event.key === "ArrowLeft") {
105
+ event.preventDefault();
106
+ scrollPrevious();
107
+ } else if (event.key === "ArrowRight") {
108
+ event.preventDefault();
109
+ scrollNext();
110
+ }
111
+ },
112
+ [scrollPrevious, scrollNext],
113
+ );
114
+
115
+ useEffect(() => {
116
+ if (!api || !setApi) {
117
+ return;
118
+ }
119
+
120
+ setApi(api);
121
+ }, [api, setApi]);
122
+
123
+ useEffect(() => {
124
+ if (!api) {
125
+ return;
126
+ }
127
+
128
+ // Defer onSelect to avoid synchronous setState in effect
129
+ queueMicrotask(() => {
130
+ onSelect(api);
131
+ });
132
+ api.on("reInit", onSelect);
133
+ api.on("select", onSelect);
134
+
135
+ return (): void => {
136
+ api.off("select", onSelect);
137
+ };
138
+ }, [api, onSelect]);
139
+
140
+ return (
141
+ <CarouselContextProvider
142
+ api={api}
143
+ canScrollNext={canScrollNext}
144
+ canScrollPrev={canScrollPrevious}
145
+ carouselRef={carouselRef}
146
+ opts={opts}
147
+ orientation={orientation ?? (opts?.axis === "y" ? "vertical" : "horizontal")}
148
+ scope={__scopeCarousel}
149
+ scrollNext={scrollNext}
150
+ scrollPrev={scrollPrevious}
151
+ >
152
+ <div
153
+ className={cn("relative", className)}
154
+ data-slot="carousel"
155
+ onKeyDownCapture={handleKeyDown}
156
+ {...props}
157
+ >
158
+ {children}
159
+ </div>
160
+ </CarouselContextProvider>
161
+ );
162
+ }
163
+
164
+ /* -----------------------------------------------------------------------------
165
+ * Component: CarouselContent
166
+ * -------------------------------------------------------------------------- */
167
+
168
+ const CAROUSEL_CONTENT_NAME = "CarouselContent";
169
+
170
+ /**
171
+ * @since 0.3.16-canary.0
172
+ */
173
+ interface CarouselContentProps extends ComponentProps<"div"> {
174
+ classNames?: {
175
+ content?: string;
176
+ wrapper?: string;
177
+ };
178
+ }
179
+
180
+ /**
181
+ * @since 0.3.16-canary.0
182
+ */
183
+ function CarouselContent({
184
+ __scopeCarousel,
185
+ className,
186
+ classNames,
187
+ ...props
188
+ }: ScopedProps<CarouselContentProps>): JSX.Element {
189
+ const { carouselRef, orientation } = useCarouselContext(CAROUSEL_CONTENT_NAME, __scopeCarousel);
190
+
191
+ return (
192
+ <div
193
+ ref={carouselRef}
194
+ className={cn("overflow-hidden", classNames?.wrapper)}
195
+ data-slot="carousel-content"
196
+ >
197
+ <div
198
+ className={cn(
199
+ "flex",
200
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
201
+ classNames?.content,
202
+ className,
203
+ )}
204
+ {...props}
205
+ />
206
+ </div>
207
+ );
208
+ }
209
+
210
+ /* -----------------------------------------------------------------------------
211
+ * Component: CarouselItem
212
+ * -------------------------------------------------------------------------- */
213
+
214
+ const CAROUSEL_ITEM_NAME = "CarouselItem";
215
+
216
+ /**
217
+ * @since 0.3.16-canary.0
218
+ */
219
+ type CarouselItemProps = ComponentProps<"div">;
220
+
221
+ /**
222
+ * @since 0.3.16-canary.0
223
+ */
224
+ function CarouselItem({
225
+ __scopeCarousel,
226
+ className,
227
+ ...props
228
+ }: ScopedProps<CarouselItemProps>): JSX.Element {
229
+ const { orientation } = useCarouselContext(CAROUSEL_ITEM_NAME, __scopeCarousel);
230
+
231
+ return (
232
+ <div
233
+ aria-roledescription="slide"
234
+ className={cn(
235
+ "min-w-0 shrink-0 grow-0 basis-full",
236
+ orientation === "horizontal" ? "pl-4" : "pt-4",
237
+ className,
238
+ )}
239
+ data-slot="carousel-item"
240
+ role="group"
241
+ {...props}
242
+ />
243
+ );
244
+ }
245
+
246
+ /* -----------------------------------------------------------------------------
247
+ * Component: CarouselPrevious
248
+ * -------------------------------------------------------------------------- */
249
+
250
+ const CAROUSEL_PREVIOUS_NAME = "CarouselPrevious";
251
+
252
+ /**
253
+ * @since 0.3.16-canary.0
254
+ */
255
+ type CarouselPreviousProps = ComponentProps<typeof Button>;
256
+
257
+ /**
258
+ * @since 0.3.16-canary.0
259
+ */
260
+ function CarouselPrevious({
261
+ __scopeCarousel,
262
+ className,
263
+ size = "icon",
264
+ variant = "outline",
265
+ ...props
266
+ }: ScopedProps<CarouselPreviousProps>): JSX.Element {
267
+ const { canScrollPrev, orientation, scrollPrev } = useCarouselContext(
268
+ CAROUSEL_PREVIOUS_NAME,
269
+ __scopeCarousel,
270
+ );
271
+
272
+ return (
273
+ <Button
274
+ aria-label="Previous slide"
275
+ className={cn(
276
+ "absolute",
277
+ "size-8",
278
+ "shadow-none",
279
+ orientation === "horizontal"
280
+ ? "top-1/2 -left-12 -translate-y-1/2"
281
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
282
+ className,
283
+ )}
284
+ data-slot="carousel-previous"
285
+ disabled={!canScrollPrev}
286
+ size={size}
287
+ variant={variant}
288
+ onClick={scrollPrev}
289
+ {...props}
290
+ >
291
+ <ArrowLeftIcon />
292
+ <span className="sr-only">Previous slide</span>
293
+ </Button>
294
+ );
295
+ }
296
+
297
+ /* -----------------------------------------------------------------------------
298
+ * Component: CarouselNext
299
+ * -------------------------------------------------------------------------- */
300
+
301
+ const CAROUSEL_NEXT_NAME = "CarouselNext";
302
+
303
+ /**
304
+ * @since 0.3.16-canary.0
305
+ */
306
+ type CarouselNextProps = ComponentProps<typeof Button>;
307
+
308
+ /**
309
+ * @since 0.3.16-canary.0
310
+ */
311
+ function CarouselNext({
312
+ __scopeCarousel,
313
+ className,
314
+ size = "icon",
315
+ variant = "outline",
316
+ ...props
317
+ }: ScopedProps<CarouselNextProps>): JSX.Element {
318
+ const { canScrollNext, orientation, scrollNext } = useCarouselContext(
319
+ CAROUSEL_NEXT_NAME,
320
+ __scopeCarousel,
321
+ );
322
+
323
+ return (
324
+ <Button
325
+ aria-label="Next slide"
326
+ className={cn(
327
+ "absolute",
328
+ "size-8",
329
+ "shadow-none",
330
+ orientation === "horizontal"
331
+ ? "top-1/2 -right-12 -translate-y-1/2"
332
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
333
+ className,
334
+ )}
335
+ data-slot="carousel-next"
336
+ disabled={!canScrollNext}
337
+ size={size}
338
+ variant={variant}
339
+ onClick={scrollNext}
340
+ {...props}
341
+ >
342
+ <ArrowRightIcon />
343
+ <span className="sr-only">Next slide</span>
344
+ </Button>
345
+ );
346
+ }
347
+
348
+ /* -----------------------------------------------------------------------------
349
+ * Exports
350
+ * -------------------------------------------------------------------------- */
351
+
352
+ export type {
353
+ CarouselApi,
354
+ CarouselContentProps,
355
+ CarouselItemProps,
356
+ CarouselNextProps,
357
+ CarouselPreviousProps,
358
+ CarouselProps,
359
+ };
360
+ export {
361
+ Carousel,
362
+ CarouselContent,
363
+ CarouselItem,
364
+ CarouselNext,
365
+ CarouselPrevious,
366
+ createCarouselScope,
367
+ };