create-next-imagicma 0.0.4 → 0.0.6
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.
- package/README.md +30 -13
- package/bin/create-next-imagicma.mjs +138 -22
- package/package.json +2 -1
- package/template/app/globals.css +331 -0
- package/template/app/layout.tsx +4 -6
- package/template/app/page.tsx +18 -40
- package/template/package.json +1 -1
- package/template/public/imagicma-picker-bridge.js +374 -0
- package/template-hono/.env.example +8 -0
- package/template-hono/.imagicma/AGENTS.md +7 -0
- package/template-hono/.imagicma/port.json +5 -0
- package/template-hono/AGENTS.md +39 -0
- package/template-hono/README.md +48 -0
- package/template-hono/client/src/App.tsx +13 -0
- package/template-hono/client/src/components/ErrorBoundary.tsx +74 -0
- package/template-hono/client/src/components/HelloClient.tsx +69 -0
- package/template-hono/client/src/globals.css +767 -0
- package/template-hono/client/src/main.tsx +24 -0
- package/template-hono/client/src/pages/HelloPage.tsx +22 -0
- package/template-hono/client/src/pages/HomePage.tsx +30 -0
- package/template-hono/client/src/providers.tsx +21 -0
- package/template-hono/components/ui/accordion.tsx +58 -0
- package/template-hono/components/ui/alert-dialog.tsx +141 -0
- package/template-hono/components/ui/alert.tsx +61 -0
- package/template-hono/components/ui/aspect-ratio.tsx +7 -0
- package/template-hono/components/ui/avatar.tsx +51 -0
- package/template-hono/components/ui/badge.tsx +40 -0
- package/template-hono/components/ui/breadcrumb.tsx +117 -0
- package/template-hono/components/ui/button.tsx +64 -0
- package/template-hono/components/ui/calendar.tsx +72 -0
- package/template-hono/components/ui/card.tsx +87 -0
- package/template-hono/components/ui/carousel.tsx +262 -0
- package/template-hono/components/ui/chart.tsx +365 -0
- package/template-hono/components/ui/checkbox.tsx +30 -0
- package/template-hono/components/ui/collapsible.tsx +11 -0
- package/template-hono/components/ui/command.tsx +153 -0
- package/template-hono/components/ui/context-menu.tsx +200 -0
- package/template-hono/components/ui/dialog.tsx +122 -0
- package/template-hono/components/ui/drawer.tsx +118 -0
- package/template-hono/components/ui/dropdown-menu.tsx +200 -0
- package/template-hono/components/ui/form.tsx +178 -0
- package/template-hono/components/ui/hover-card.tsx +29 -0
- package/template-hono/components/ui/input-otp.tsx +71 -0
- package/template-hono/components/ui/input.tsx +25 -0
- package/template-hono/components/ui/label.tsx +26 -0
- package/template-hono/components/ui/menubar.tsx +256 -0
- package/template-hono/components/ui/navigation-menu.tsx +130 -0
- package/template-hono/components/ui/pagination.tsx +119 -0
- package/template-hono/components/ui/popover.tsx +31 -0
- package/template-hono/components/ui/progress.tsx +28 -0
- package/template-hono/components/ui/radio-group.tsx +44 -0
- package/template-hono/components/ui/resizable.tsx +45 -0
- package/template-hono/components/ui/scroll-area.tsx +48 -0
- package/template-hono/components/ui/select.tsx +160 -0
- package/template-hono/components/ui/separator.tsx +31 -0
- package/template-hono/components/ui/sheet.tsx +140 -0
- package/template-hono/components/ui/sidebar.tsx +732 -0
- package/template-hono/components/ui/skeleton.tsx +17 -0
- package/template-hono/components/ui/slider.tsx +28 -0
- package/template-hono/components/ui/switch.tsx +29 -0
- package/template-hono/components/ui/table.tsx +119 -0
- package/template-hono/components/ui/tabs.tsx +55 -0
- package/template-hono/components/ui/textarea.tsx +24 -0
- package/template-hono/components/ui/toast.tsx +129 -0
- package/template-hono/components/ui/toaster.tsx +35 -0
- package/template-hono/components/ui/toggle-group.tsx +61 -0
- package/template-hono/components/ui/toggle.tsx +45 -0
- package/template-hono/components/ui/tooltip.tsx +30 -0
- package/template-hono/drizzle.config.ts +50 -0
- package/template-hono/eslint.config.mjs +13 -0
- package/template-hono/gitignore +40 -0
- package/template-hono/hooks/use-greeting.ts +15 -0
- package/template-hono/hooks/use-mobile.ts +21 -0
- package/template-hono/hooks/use-toast.ts +194 -0
- package/template-hono/index.html +13 -0
- package/template-hono/lib/queryClient.ts +59 -0
- package/template-hono/lib/theme/default-theme.ts +11 -0
- package/template-hono/lib/utils.ts +6 -0
- package/template-hono/package.json +82 -0
- package/template-hono/pnpm-lock.yaml +5162 -0
- package/template-hono/postcss.config.mjs +7 -0
- package/template-hono/process-compose.yaml +13 -0
- package/template-hono/public/favicon.ico +0 -0
- package/template-hono/public/file.svg +1 -0
- package/template-hono/public/globe.svg +1 -0
- package/template-hono/public/imagicma-picker-bridge.js +374 -0
- package/template-hono/public/next.svg +1 -0
- package/template-hono/public/vercel.svg +1 -0
- package/template-hono/public/window.svg +1 -0
- package/template-hono/scripts/imagicma-common.mjs +118 -0
- package/template-hono/scripts/imagicma-dev.mjs +29 -0
- package/template-hono/scripts/imagicma-guard.mjs +17 -0
- package/template-hono/scripts/imagicma-start.mjs +24 -0
- package/template-hono/server/app.ts +40 -0
- package/template-hono/server/db.ts +22 -0
- package/template-hono/server/dev-app.ts +5 -0
- package/template-hono/server/index.ts +94 -0
- package/template-hono/server/routes/greeting.ts +25 -0
- package/template-hono/server/storage.ts +39 -0
- package/template-hono/shared/routes.ts +13 -0
- package/template-hono/shared/schema.ts +17 -0
- package/template-hono/tailwind.config.mjs +97 -0
- package/template-hono/tsconfig.json +39 -0
- package/template-hono/tsconfig.server.json +15 -0
- package/template-hono/types/pg.d.ts +19 -0
- package/template-hono/vite.config.ts +125 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { ChevronLeft, ChevronRight } from "lucide-react"
|
|
5
|
+
import { DayPicker } from "react-day-picker"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { buttonVariants } from "@/components/ui/button"
|
|
9
|
+
|
|
10
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>
|
|
11
|
+
|
|
12
|
+
function Calendar({
|
|
13
|
+
className,
|
|
14
|
+
classNames,
|
|
15
|
+
showOutsideDays = true,
|
|
16
|
+
...props
|
|
17
|
+
}: CalendarProps) {
|
|
18
|
+
return (
|
|
19
|
+
<DayPicker
|
|
20
|
+
showOutsideDays={showOutsideDays}
|
|
21
|
+
className={cn("p-3", className)}
|
|
22
|
+
classNames={{
|
|
23
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
24
|
+
month: "space-y-4",
|
|
25
|
+
month_caption: "flex justify-center pt-1 relative items-center",
|
|
26
|
+
caption_label: "text-sm font-medium",
|
|
27
|
+
nav: "space-x-1 flex items-center",
|
|
28
|
+
button_previous: cn(
|
|
29
|
+
buttonVariants({ variant: "outline" }),
|
|
30
|
+
"absolute left-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
31
|
+
),
|
|
32
|
+
button_next: cn(
|
|
33
|
+
buttonVariants({ variant: "outline" }),
|
|
34
|
+
"absolute right-1 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
35
|
+
),
|
|
36
|
+
month_grid: "w-full border-collapse space-y-1",
|
|
37
|
+
weekdays: "flex",
|
|
38
|
+
weekday:
|
|
39
|
+
"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
|
40
|
+
week: "flex w-full mt-2",
|
|
41
|
+
day: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].range-end)]:rounded-r-md [&:has([aria-selected].outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
|
42
|
+
day_button: cn(
|
|
43
|
+
buttonVariants({ variant: "ghost" }),
|
|
44
|
+
"h-9 w-9 p-0 font-normal aria-selected:opacity-100"
|
|
45
|
+
),
|
|
46
|
+
range_end: "day-range-end",
|
|
47
|
+
selected:
|
|
48
|
+
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
49
|
+
today: "bg-accent text-accent-foreground",
|
|
50
|
+
outside:
|
|
51
|
+
"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
|
|
52
|
+
disabled: "text-muted-foreground opacity-50",
|
|
53
|
+
range_middle:
|
|
54
|
+
"aria-selected:bg-accent aria-selected:text-accent-foreground",
|
|
55
|
+
hidden: "invisible",
|
|
56
|
+
...classNames,
|
|
57
|
+
}}
|
|
58
|
+
components={{
|
|
59
|
+
Chevron: ({ orientation, className, ...props }) =>
|
|
60
|
+
orientation === "left" ? (
|
|
61
|
+
<ChevronLeft className={cn("h-4 w-4", className)} {...props} />
|
|
62
|
+
) : (
|
|
63
|
+
<ChevronRight className={cn("h-4 w-4", className)} {...props} />
|
|
64
|
+
),
|
|
65
|
+
}}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
Calendar.displayName = "Calendar"
|
|
71
|
+
|
|
72
|
+
export { Calendar }
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const Card = React.forwardRef<
|
|
8
|
+
HTMLDivElement,
|
|
9
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<div
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn(
|
|
14
|
+
"shadcn-card rounded-xl border bg-card border-card-border text-card-foreground shadow-sm",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
));
|
|
20
|
+
Card.displayName = "Card"
|
|
21
|
+
|
|
22
|
+
const CardHeader = React.forwardRef<
|
|
23
|
+
HTMLDivElement,
|
|
24
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
25
|
+
>(({ className, ...props }, ref) => (
|
|
26
|
+
<div
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
));
|
|
32
|
+
CardHeader.displayName = "CardHeader"
|
|
33
|
+
|
|
34
|
+
const CardTitle = React.forwardRef<
|
|
35
|
+
HTMLDivElement,
|
|
36
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
37
|
+
>(({ className, ...props }, ref) => (
|
|
38
|
+
<div
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={cn(
|
|
41
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
))
|
|
47
|
+
CardTitle.displayName = "CardTitle"
|
|
48
|
+
|
|
49
|
+
const CardDescription = React.forwardRef<
|
|
50
|
+
HTMLDivElement,
|
|
51
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
52
|
+
>(({ className, ...props }, ref) => (
|
|
53
|
+
<div
|
|
54
|
+
ref={ref}
|
|
55
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
));
|
|
59
|
+
CardDescription.displayName = "CardDescription"
|
|
60
|
+
|
|
61
|
+
const CardContent = React.forwardRef<
|
|
62
|
+
HTMLDivElement,
|
|
63
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
64
|
+
>(({ className, ...props }, ref) => (
|
|
65
|
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
66
|
+
))
|
|
67
|
+
CardContent.displayName = "CardContent"
|
|
68
|
+
|
|
69
|
+
const CardFooter = React.forwardRef<
|
|
70
|
+
HTMLDivElement,
|
|
71
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
72
|
+
>(({ className, ...props }, ref) => (
|
|
73
|
+
<div
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn("flex items-center p-6 pt-0", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
))
|
|
79
|
+
CardFooter.displayName = "CardFooter"
|
|
80
|
+
export {
|
|
81
|
+
Card,
|
|
82
|
+
CardHeader,
|
|
83
|
+
CardFooter,
|
|
84
|
+
CardTitle,
|
|
85
|
+
CardDescription,
|
|
86
|
+
CardContent,
|
|
87
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import useEmblaCarousel, {
|
|
5
|
+
type UseEmblaCarouselType,
|
|
6
|
+
} from "embla-carousel-react"
|
|
7
|
+
import { ArrowLeft, ArrowRight } from "lucide-react"
|
|
8
|
+
|
|
9
|
+
import { cn } from "@/lib/utils"
|
|
10
|
+
import { Button } from "@/components/ui/button"
|
|
11
|
+
|
|
12
|
+
type CarouselApi = UseEmblaCarouselType[1]
|
|
13
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
|
14
|
+
type CarouselOptions = UseCarouselParameters[0]
|
|
15
|
+
type CarouselPlugin = UseCarouselParameters[1]
|
|
16
|
+
|
|
17
|
+
type CarouselProps = {
|
|
18
|
+
opts?: CarouselOptions
|
|
19
|
+
plugins?: CarouselPlugin
|
|
20
|
+
orientation?: "horizontal" | "vertical"
|
|
21
|
+
setApi?: (api: CarouselApi) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type CarouselContextProps = {
|
|
25
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
|
26
|
+
api: ReturnType<typeof useEmblaCarousel>[1]
|
|
27
|
+
scrollPrev: () => void
|
|
28
|
+
scrollNext: () => void
|
|
29
|
+
canScrollPrev: boolean
|
|
30
|
+
canScrollNext: boolean
|
|
31
|
+
} & CarouselProps
|
|
32
|
+
|
|
33
|
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
|
34
|
+
|
|
35
|
+
function useCarousel() {
|
|
36
|
+
const context = React.useContext(CarouselContext)
|
|
37
|
+
|
|
38
|
+
if (!context) {
|
|
39
|
+
throw new Error("useCarousel must be used within a <Carousel />")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return context
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const Carousel = React.forwardRef<
|
|
46
|
+
HTMLDivElement,
|
|
47
|
+
React.HTMLAttributes<HTMLDivElement> & CarouselProps
|
|
48
|
+
>(
|
|
49
|
+
(
|
|
50
|
+
{
|
|
51
|
+
orientation = "horizontal",
|
|
52
|
+
opts,
|
|
53
|
+
setApi,
|
|
54
|
+
plugins,
|
|
55
|
+
className,
|
|
56
|
+
children,
|
|
57
|
+
...props
|
|
58
|
+
},
|
|
59
|
+
ref
|
|
60
|
+
) => {
|
|
61
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
62
|
+
{
|
|
63
|
+
...opts,
|
|
64
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
65
|
+
},
|
|
66
|
+
plugins
|
|
67
|
+
)
|
|
68
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
|
69
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
|
70
|
+
|
|
71
|
+
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
72
|
+
if (!api) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
setCanScrollPrev(api.canScrollPrev())
|
|
77
|
+
setCanScrollNext(api.canScrollNext())
|
|
78
|
+
}, [])
|
|
79
|
+
|
|
80
|
+
const scrollPrev = React.useCallback(() => {
|
|
81
|
+
api?.scrollPrev()
|
|
82
|
+
}, [api])
|
|
83
|
+
|
|
84
|
+
const scrollNext = React.useCallback(() => {
|
|
85
|
+
api?.scrollNext()
|
|
86
|
+
}, [api])
|
|
87
|
+
|
|
88
|
+
const handleKeyDown = React.useCallback(
|
|
89
|
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
90
|
+
if (event.key === "ArrowLeft") {
|
|
91
|
+
event.preventDefault()
|
|
92
|
+
scrollPrev()
|
|
93
|
+
} else if (event.key === "ArrowRight") {
|
|
94
|
+
event.preventDefault()
|
|
95
|
+
scrollNext()
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[scrollPrev, scrollNext]
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
if (!api || !setApi) {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
setApi(api)
|
|
107
|
+
}, [api, setApi])
|
|
108
|
+
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
if (!api) {
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
onSelect(api)
|
|
115
|
+
api.on("reInit", onSelect)
|
|
116
|
+
api.on("select", onSelect)
|
|
117
|
+
|
|
118
|
+
return () => {
|
|
119
|
+
api?.off("select", onSelect)
|
|
120
|
+
}
|
|
121
|
+
}, [api, onSelect])
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<CarouselContext.Provider
|
|
125
|
+
value={{
|
|
126
|
+
carouselRef,
|
|
127
|
+
api: api,
|
|
128
|
+
opts,
|
|
129
|
+
orientation:
|
|
130
|
+
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
131
|
+
scrollPrev,
|
|
132
|
+
scrollNext,
|
|
133
|
+
canScrollPrev,
|
|
134
|
+
canScrollNext,
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
<div
|
|
138
|
+
ref={ref}
|
|
139
|
+
onKeyDownCapture={handleKeyDown}
|
|
140
|
+
className={cn("relative", className)}
|
|
141
|
+
role="region"
|
|
142
|
+
aria-roledescription="carousel"
|
|
143
|
+
{...props}
|
|
144
|
+
>
|
|
145
|
+
{children}
|
|
146
|
+
</div>
|
|
147
|
+
</CarouselContext.Provider>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
Carousel.displayName = "Carousel"
|
|
152
|
+
|
|
153
|
+
const CarouselContent = React.forwardRef<
|
|
154
|
+
HTMLDivElement,
|
|
155
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
156
|
+
>(({ className, ...props }, ref) => {
|
|
157
|
+
const { carouselRef, orientation } = useCarousel()
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<div ref={carouselRef} className="overflow-hidden">
|
|
161
|
+
<div
|
|
162
|
+
ref={ref}
|
|
163
|
+
className={cn(
|
|
164
|
+
"flex",
|
|
165
|
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
166
|
+
className
|
|
167
|
+
)}
|
|
168
|
+
{...props}
|
|
169
|
+
/>
|
|
170
|
+
</div>
|
|
171
|
+
)
|
|
172
|
+
})
|
|
173
|
+
CarouselContent.displayName = "CarouselContent"
|
|
174
|
+
|
|
175
|
+
const CarouselItem = React.forwardRef<
|
|
176
|
+
HTMLDivElement,
|
|
177
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
178
|
+
>(({ className, ...props }, ref) => {
|
|
179
|
+
const { orientation } = useCarousel()
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<div
|
|
183
|
+
ref={ref}
|
|
184
|
+
role="group"
|
|
185
|
+
aria-roledescription="slide"
|
|
186
|
+
className={cn(
|
|
187
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
188
|
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
189
|
+
className
|
|
190
|
+
)}
|
|
191
|
+
{...props}
|
|
192
|
+
/>
|
|
193
|
+
)
|
|
194
|
+
})
|
|
195
|
+
CarouselItem.displayName = "CarouselItem"
|
|
196
|
+
|
|
197
|
+
const CarouselPrevious = React.forwardRef<
|
|
198
|
+
HTMLButtonElement,
|
|
199
|
+
React.ComponentProps<typeof Button>
|
|
200
|
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
|
201
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<Button
|
|
205
|
+
ref={ref}
|
|
206
|
+
variant={variant}
|
|
207
|
+
size={size}
|
|
208
|
+
className={cn(
|
|
209
|
+
"absolute h-8 w-8 rounded-full",
|
|
210
|
+
orientation === "horizontal"
|
|
211
|
+
? "-left-12 top-1/2 -translate-y-1/2"
|
|
212
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
213
|
+
className
|
|
214
|
+
)}
|
|
215
|
+
disabled={!canScrollPrev}
|
|
216
|
+
onClick={scrollPrev}
|
|
217
|
+
{...props}
|
|
218
|
+
>
|
|
219
|
+
<ArrowLeft className="h-4 w-4" />
|
|
220
|
+
<span className="sr-only">Previous slide</span>
|
|
221
|
+
</Button>
|
|
222
|
+
)
|
|
223
|
+
})
|
|
224
|
+
CarouselPrevious.displayName = "CarouselPrevious"
|
|
225
|
+
|
|
226
|
+
const CarouselNext = React.forwardRef<
|
|
227
|
+
HTMLButtonElement,
|
|
228
|
+
React.ComponentProps<typeof Button>
|
|
229
|
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
|
230
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<Button
|
|
234
|
+
ref={ref}
|
|
235
|
+
variant={variant}
|
|
236
|
+
size={size}
|
|
237
|
+
className={cn(
|
|
238
|
+
"absolute h-8 w-8 rounded-full",
|
|
239
|
+
orientation === "horizontal"
|
|
240
|
+
? "-right-12 top-1/2 -translate-y-1/2"
|
|
241
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
242
|
+
className
|
|
243
|
+
)}
|
|
244
|
+
disabled={!canScrollNext}
|
|
245
|
+
onClick={scrollNext}
|
|
246
|
+
{...props}
|
|
247
|
+
>
|
|
248
|
+
<ArrowRight className="h-4 w-4" />
|
|
249
|
+
<span className="sr-only">Next slide</span>
|
|
250
|
+
</Button>
|
|
251
|
+
)
|
|
252
|
+
})
|
|
253
|
+
CarouselNext.displayName = "CarouselNext"
|
|
254
|
+
|
|
255
|
+
export {
|
|
256
|
+
type CarouselApi,
|
|
257
|
+
Carousel,
|
|
258
|
+
CarouselContent,
|
|
259
|
+
CarouselItem,
|
|
260
|
+
CarouselPrevious,
|
|
261
|
+
CarouselNext,
|
|
262
|
+
}
|