create-next-imagicma 0.1.11 → 0.1.13
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 +0 -2
- package/package.json +1 -1
- package/template-hono/AGENTS.md +53 -95
- package/template-hono/README.md +3 -31
- package/template-hono/client/public/imagicma-picker-bridge.js +6 -2
- package/template-hono/client/public/imagicma-preview-feedback.js +1 -0
- package/template-hono/client/src/lib/imagicma-preview-bridge.ts +1 -1
- package/template-hono/client/src/lib/imagicma-preview-picker.ts +130 -28
- package/template-hono/vite.config.ts +1 -1
- package/template/.env.example +0 -10
- package/template/AGENTS.md +0 -225
- package/template/README.md +0 -34
- package/template/app/_components/DevPreviewShield.tsx +0 -638
- package/template/app/api/greeting/route.ts +0 -27
- package/template/app/error.tsx +0 -93
- package/template/app/favicon.ico +0 -0
- package/template/app/globals.css +0 -767
- package/template/app/hello/_components/HelloClient.tsx +0 -94
- package/template/app/hello/page.tsx +0 -23
- package/template/app/layout.tsx +0 -32
- package/template/app/page.tsx +0 -27
- package/template/app/providers.tsx +0 -25
- package/template/components/ui/accordion.tsx +0 -58
- package/template/components/ui/alert-dialog.tsx +0 -141
- package/template/components/ui/alert.tsx +0 -61
- package/template/components/ui/aspect-ratio.tsx +0 -7
- package/template/components/ui/avatar.tsx +0 -51
- package/template/components/ui/badge.tsx +0 -40
- package/template/components/ui/breadcrumb.tsx +0 -117
- package/template/components/ui/button.tsx +0 -64
- package/template/components/ui/calendar.tsx +0 -72
- package/template/components/ui/card.tsx +0 -87
- package/template/components/ui/carousel.tsx +0 -262
- package/template/components/ui/chart.tsx +0 -365
- package/template/components/ui/checkbox.tsx +0 -30
- package/template/components/ui/collapsible.tsx +0 -11
- package/template/components/ui/command.tsx +0 -153
- package/template/components/ui/context-menu.tsx +0 -200
- package/template/components/ui/dialog.tsx +0 -122
- package/template/components/ui/drawer.tsx +0 -118
- package/template/components/ui/dropdown-menu.tsx +0 -200
- package/template/components/ui/form.tsx +0 -178
- package/template/components/ui/hover-card.tsx +0 -29
- package/template/components/ui/input-otp.tsx +0 -71
- package/template/components/ui/input.tsx +0 -25
- package/template/components/ui/label.tsx +0 -26
- package/template/components/ui/menubar.tsx +0 -256
- package/template/components/ui/navigation-menu.tsx +0 -130
- package/template/components/ui/pagination.tsx +0 -119
- package/template/components/ui/popover.tsx +0 -31
- package/template/components/ui/progress.tsx +0 -28
- package/template/components/ui/radio-group.tsx +0 -44
- package/template/components/ui/resizable.tsx +0 -45
- package/template/components/ui/scroll-area.tsx +0 -48
- package/template/components/ui/select.tsx +0 -160
- package/template/components/ui/separator.tsx +0 -31
- package/template/components/ui/sheet.tsx +0 -140
- package/template/components/ui/sidebar.tsx +0 -732
- package/template/components/ui/skeleton.tsx +0 -17
- package/template/components/ui/slider.tsx +0 -28
- package/template/components/ui/switch.tsx +0 -29
- package/template/components/ui/table.tsx +0 -119
- package/template/components/ui/tabs.tsx +0 -55
- package/template/components/ui/textarea.tsx +0 -24
- package/template/components/ui/toast.tsx +0 -129
- package/template/components/ui/toaster.tsx +0 -35
- package/template/components/ui/toggle-group.tsx +0 -61
- package/template/components/ui/toggle.tsx +0 -45
- package/template/components/ui/tooltip.tsx +0 -30
- package/template/drizzle.config.ts +0 -50
- package/template/eslint.config.mjs +0 -18
- package/template/gitignore +0 -46
- package/template/hooks/use-greeting.ts +0 -15
- package/template/hooks/use-mobile.ts +0 -21
- package/template/hooks/use-toast.ts +0 -194
- package/template/lib/queryClient.ts +0 -59
- package/template/lib/theme/default-theme.ts +0 -11
- package/template/lib/utils.ts +0 -6
- package/template/next.config.ts +0 -8
- package/template/package.json +0 -76
- package/template/pnpm-lock.yaml +0 -6937
- package/template/postcss.config.mjs +0 -7
- package/template/process-compose.yaml +0 -13
- package/template/public/file.svg +0 -1
- package/template/public/globe.svg +0 -1
- package/template/public/imagicma-picker-bridge.js +0 -374
- package/template/public/next.svg +0 -1
- package/template/public/vercel.svg +0 -1
- package/template/public/window.svg +0 -1
- package/template/server/db.ts +0 -24
- package/template/server/storage.ts +0 -41
- package/template/shared/routes.ts +0 -13
- package/template/shared/schema.ts +0 -17
- package/template/tailwind.config.mjs +0 -96
- package/template/tsconfig.json +0 -35
- package/template/types/pg.d.ts +0 -19
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
-
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
|
|
9
|
-
const buttonVariants = cva(
|
|
10
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0" +
|
|
11
|
-
" hover-elevate active-elevate-2",
|
|
12
|
-
{
|
|
13
|
-
variants: {
|
|
14
|
-
variant: {
|
|
15
|
-
default:
|
|
16
|
-
"bg-primary text-primary-foreground border border-primary-border",
|
|
17
|
-
destructive:
|
|
18
|
-
"bg-destructive text-destructive-foreground border border-destructive-border",
|
|
19
|
-
outline:
|
|
20
|
-
// Shows the background color of whatever card / sidebar / accent background it is inside of.
|
|
21
|
-
// Inherits the current text color.
|
|
22
|
-
" border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",
|
|
23
|
-
secondary: "border bg-secondary text-secondary-foreground border border-secondary-border ",
|
|
24
|
-
// Add a transparent border so that when someone toggles a border on later, it doesn't shift layout/size.
|
|
25
|
-
ghost: "border border-transparent",
|
|
26
|
-
},
|
|
27
|
-
// Heights are set as "min" heights, because sometimes Ai will place large amount of content
|
|
28
|
-
// inside buttons. With a min-height they will look appropriate with small amounts of content,
|
|
29
|
-
// but will expand to fit large amounts of content.
|
|
30
|
-
size: {
|
|
31
|
-
default: "min-h-9 px-4 py-2",
|
|
32
|
-
sm: "min-h-8 rounded-md px-3 text-xs",
|
|
33
|
-
lg: "min-h-10 rounded-md px-8",
|
|
34
|
-
icon: "h-9 w-9",
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
defaultVariants: {
|
|
38
|
-
variant: "default",
|
|
39
|
-
size: "default",
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
export interface ButtonProps
|
|
45
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
46
|
-
VariantProps<typeof buttonVariants> {
|
|
47
|
-
asChild?: boolean
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
51
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
52
|
-
const Comp = asChild ? Slot : "button"
|
|
53
|
-
return (
|
|
54
|
-
<Comp
|
|
55
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
56
|
-
ref={ref}
|
|
57
|
-
{...props}
|
|
58
|
-
/>
|
|
59
|
-
)
|
|
60
|
-
},
|
|
61
|
-
)
|
|
62
|
-
Button.displayName = "Button"
|
|
63
|
-
|
|
64
|
-
export { Button, buttonVariants }
|
|
@@ -1,72 +0,0 @@
|
|
|
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 }
|
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,262 +0,0 @@
|
|
|
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
|
-
}
|