@blips/ui 0.0.1
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/dist/index.cjs +2675 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +514 -0
- package/dist/index.d.ts +514 -0
- package/dist/index.js +2418 -0
- package/dist/index.js.map +1 -0
- package/package.json +153 -0
- package/src/components/accordion.tsx +56 -0
- package/src/components/alert-dialog.tsx +138 -0
- package/src/components/alert.tsx +59 -0
- package/src/components/aspect-ratio.tsx +5 -0
- package/src/components/avatar.tsx +50 -0
- package/src/components/badge.tsx +36 -0
- package/src/components/breadcrumb.tsx +115 -0
- package/src/components/button.tsx +56 -0
- package/src/components/calendar.tsx +216 -0
- package/src/components/card.tsx +86 -0
- package/src/components/carousel.tsx +259 -0
- package/src/components/checkbox.tsx +28 -0
- package/src/components/collapsible.tsx +11 -0
- package/src/components/command.tsx +150 -0
- package/src/components/context-menu.tsx +198 -0
- package/src/components/dialog.tsx +122 -0
- package/src/components/drawer.tsx +116 -0
- package/src/components/dropdown-menu.tsx +200 -0
- package/src/components/hover-card.tsx +27 -0
- package/src/components/input-otp.tsx +69 -0
- package/src/components/input.tsx +22 -0
- package/src/components/label.tsx +26 -0
- package/src/components/menubar.tsx +254 -0
- package/src/components/navigation-menu.tsx +128 -0
- package/src/components/pagination.tsx +116 -0
- package/src/components/popover.tsx +29 -0
- package/src/components/progress.tsx +28 -0
- package/src/components/radio-group.tsx +42 -0
- package/src/components/resizable.tsx +45 -0
- package/src/components/scroll-area.tsx +46 -0
- package/src/components/select.tsx +160 -0
- package/src/components/separator.tsx +29 -0
- package/src/components/sheet.tsx +140 -0
- package/src/components/skeleton.tsx +15 -0
- package/src/components/slider.tsx +26 -0
- package/src/components/sonner.tsx +45 -0
- package/src/components/switch.tsx +27 -0
- package/src/components/table.tsx +117 -0
- package/src/components/tabs.tsx +53 -0
- package/src/components/textarea.tsx +22 -0
- package/src/components/toggle-group.tsx +60 -0
- package/src/components/toggle.tsx +43 -0
- package/src/components/tooltip.tsx +30 -0
- package/src/globals.css +77 -0
- package/src/index.ts +322 -0
- package/src/lib/utils.ts +6 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ChevronDownIcon,
|
|
5
|
+
ChevronLeftIcon,
|
|
6
|
+
ChevronRightIcon,
|
|
7
|
+
} from "lucide-react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import {
|
|
10
|
+
type DayButton,
|
|
11
|
+
DayPicker,
|
|
12
|
+
getDefaultClassNames,
|
|
13
|
+
} from "react-day-picker";
|
|
14
|
+
import { Button, buttonVariants } from "./button";
|
|
15
|
+
import { cn } from "../lib/utils";
|
|
16
|
+
|
|
17
|
+
function Calendar({
|
|
18
|
+
className,
|
|
19
|
+
classNames,
|
|
20
|
+
showOutsideDays = true,
|
|
21
|
+
captionLayout = "label",
|
|
22
|
+
buttonVariant = "ghost",
|
|
23
|
+
formatters,
|
|
24
|
+
components,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
27
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
28
|
+
}) {
|
|
29
|
+
const defaultClassNames = getDefaultClassNames();
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<DayPicker
|
|
33
|
+
showOutsideDays={showOutsideDays}
|
|
34
|
+
className={cn(
|
|
35
|
+
"bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
36
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
37
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
38
|
+
className
|
|
39
|
+
)}
|
|
40
|
+
captionLayout={captionLayout}
|
|
41
|
+
formatters={{
|
|
42
|
+
formatMonthDropdown: (date) =>
|
|
43
|
+
date.toLocaleString("default", { month: "short" }),
|
|
44
|
+
...formatters,
|
|
45
|
+
}}
|
|
46
|
+
classNames={{
|
|
47
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
48
|
+
months: cn(
|
|
49
|
+
"relative flex flex-col gap-4 md:flex-row",
|
|
50
|
+
defaultClassNames.months
|
|
51
|
+
),
|
|
52
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
53
|
+
nav: cn(
|
|
54
|
+
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
55
|
+
defaultClassNames.nav
|
|
56
|
+
),
|
|
57
|
+
button_previous: cn(
|
|
58
|
+
buttonVariants({ variant: buttonVariant }),
|
|
59
|
+
"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
|
|
60
|
+
defaultClassNames.button_previous
|
|
61
|
+
),
|
|
62
|
+
button_next: cn(
|
|
63
|
+
buttonVariants({ variant: buttonVariant }),
|
|
64
|
+
"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
|
|
65
|
+
defaultClassNames.button_next
|
|
66
|
+
),
|
|
67
|
+
month_caption: cn(
|
|
68
|
+
"flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",
|
|
69
|
+
defaultClassNames.month_caption
|
|
70
|
+
),
|
|
71
|
+
dropdowns: cn(
|
|
72
|
+
"flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
73
|
+
defaultClassNames.dropdowns
|
|
74
|
+
),
|
|
75
|
+
dropdown_root: cn(
|
|
76
|
+
"has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",
|
|
77
|
+
defaultClassNames.dropdown_root
|
|
78
|
+
),
|
|
79
|
+
dropdown: cn(
|
|
80
|
+
"bg-popover absolute inset-0 opacity-0",
|
|
81
|
+
defaultClassNames.dropdown
|
|
82
|
+
),
|
|
83
|
+
caption_label: cn(
|
|
84
|
+
"select-none font-medium",
|
|
85
|
+
captionLayout === "label"
|
|
86
|
+
? "text-sm"
|
|
87
|
+
: "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",
|
|
88
|
+
defaultClassNames.caption_label
|
|
89
|
+
),
|
|
90
|
+
table: "w-full border-collapse",
|
|
91
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
92
|
+
weekday: cn(
|
|
93
|
+
"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",
|
|
94
|
+
defaultClassNames.weekday
|
|
95
|
+
),
|
|
96
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
97
|
+
week_number_header: cn(
|
|
98
|
+
"w-[--cell-size] select-none",
|
|
99
|
+
defaultClassNames.week_number_header
|
|
100
|
+
),
|
|
101
|
+
week_number: cn(
|
|
102
|
+
"text-muted-foreground select-none text-[0.8rem]",
|
|
103
|
+
defaultClassNames.week_number
|
|
104
|
+
),
|
|
105
|
+
day: cn(
|
|
106
|
+
"group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
|
|
107
|
+
defaultClassNames.day
|
|
108
|
+
),
|
|
109
|
+
range_start: cn(
|
|
110
|
+
"bg-accent rounded-l-md",
|
|
111
|
+
defaultClassNames.range_start
|
|
112
|
+
),
|
|
113
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
114
|
+
range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
|
|
115
|
+
today: cn(
|
|
116
|
+
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
117
|
+
defaultClassNames.today
|
|
118
|
+
),
|
|
119
|
+
outside: cn(
|
|
120
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
121
|
+
defaultClassNames.outside
|
|
122
|
+
),
|
|
123
|
+
disabled: cn(
|
|
124
|
+
"text-muted-foreground opacity-50",
|
|
125
|
+
defaultClassNames.disabled
|
|
126
|
+
),
|
|
127
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
128
|
+
...classNames,
|
|
129
|
+
}}
|
|
130
|
+
components={{
|
|
131
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
132
|
+
return (
|
|
133
|
+
<div
|
|
134
|
+
data-slot="calendar"
|
|
135
|
+
ref={rootRef}
|
|
136
|
+
className={cn(className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
142
|
+
if (orientation === "left") {
|
|
143
|
+
return (
|
|
144
|
+
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (orientation === "right") {
|
|
149
|
+
return (
|
|
150
|
+
<ChevronRightIcon
|
|
151
|
+
className={cn("size-4", className)}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
DayButton: CalendarDayButton,
|
|
162
|
+
WeekNumber: ({ children, ...props }) => {
|
|
163
|
+
return (
|
|
164
|
+
<td {...props}>
|
|
165
|
+
<div className="flex size-[--cell-size] items-center justify-center text-center">
|
|
166
|
+
{children}
|
|
167
|
+
</div>
|
|
168
|
+
</td>
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
...components,
|
|
172
|
+
}}
|
|
173
|
+
{...props}
|
|
174
|
+
/>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function CalendarDayButton({
|
|
179
|
+
className,
|
|
180
|
+
day,
|
|
181
|
+
modifiers,
|
|
182
|
+
...props
|
|
183
|
+
}: React.ComponentProps<typeof DayButton>) {
|
|
184
|
+
const defaultClassNames = getDefaultClassNames();
|
|
185
|
+
|
|
186
|
+
const ref = React.useRef<HTMLButtonElement>(null);
|
|
187
|
+
React.useEffect(() => {
|
|
188
|
+
if (modifiers.focused) ref.current?.focus();
|
|
189
|
+
}, [modifiers.focused]);
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<Button
|
|
193
|
+
ref={ref}
|
|
194
|
+
variant="ghost"
|
|
195
|
+
size="icon"
|
|
196
|
+
data-day={day.date.toLocaleDateString()}
|
|
197
|
+
data-selected-single={
|
|
198
|
+
modifiers.selected &&
|
|
199
|
+
!modifiers.range_start &&
|
|
200
|
+
!modifiers.range_end &&
|
|
201
|
+
!modifiers.range_middle
|
|
202
|
+
}
|
|
203
|
+
data-range-start={modifiers.range_start}
|
|
204
|
+
data-range-end={modifiers.range_end}
|
|
205
|
+
data-range-middle={modifiers.range_middle}
|
|
206
|
+
className={cn(
|
|
207
|
+
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",
|
|
208
|
+
defaultClassNames.day,
|
|
209
|
+
className
|
|
210
|
+
)}
|
|
211
|
+
{...props}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Card = React.forwardRef<
|
|
6
|
+
HTMLDivElement,
|
|
7
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<div
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(
|
|
12
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
));
|
|
18
|
+
Card.displayName = "Card";
|
|
19
|
+
|
|
20
|
+
const CardHeader = React.forwardRef<
|
|
21
|
+
HTMLDivElement,
|
|
22
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<div
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
30
|
+
CardHeader.displayName = "CardHeader";
|
|
31
|
+
|
|
32
|
+
const CardTitle = React.forwardRef<
|
|
33
|
+
HTMLDivElement,
|
|
34
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
35
|
+
>(({ className, ...props }, ref) => (
|
|
36
|
+
<div
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(
|
|
39
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
));
|
|
45
|
+
CardTitle.displayName = "CardTitle";
|
|
46
|
+
|
|
47
|
+
const CardDescription = React.forwardRef<
|
|
48
|
+
HTMLDivElement,
|
|
49
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
50
|
+
>(({ className, ...props }, ref) => (
|
|
51
|
+
<div
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
));
|
|
57
|
+
CardDescription.displayName = "CardDescription";
|
|
58
|
+
|
|
59
|
+
const CardContent = React.forwardRef<
|
|
60
|
+
HTMLDivElement,
|
|
61
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
62
|
+
>(({ className, ...props }, ref) => (
|
|
63
|
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
64
|
+
));
|
|
65
|
+
CardContent.displayName = "CardContent";
|
|
66
|
+
|
|
67
|
+
const CardFooter = React.forwardRef<
|
|
68
|
+
HTMLDivElement,
|
|
69
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
70
|
+
>(({ className, ...props }, ref) => (
|
|
71
|
+
<div
|
|
72
|
+
ref={ref}
|
|
73
|
+
className={cn("flex items-center p-6 pt-0", className)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
));
|
|
77
|
+
CardFooter.displayName = "CardFooter";
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
Card,
|
|
81
|
+
CardHeader,
|
|
82
|
+
CardFooter,
|
|
83
|
+
CardTitle,
|
|
84
|
+
CardDescription,
|
|
85
|
+
CardContent,
|
|
86
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import useEmblaCarousel, {
|
|
2
|
+
type UseEmblaCarouselType,
|
|
3
|
+
} from "embla-carousel-react";
|
|
4
|
+
import { ArrowLeft, ArrowRight } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Button } from "./button";
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
10
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
11
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
12
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
13
|
+
|
|
14
|
+
type CarouselProps = {
|
|
15
|
+
opts?: CarouselOptions;
|
|
16
|
+
plugins?: CarouselPlugin;
|
|
17
|
+
orientation?: "horizontal" | "vertical";
|
|
18
|
+
setApi?: (api: CarouselApi) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type CarouselContextProps = {
|
|
22
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
23
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
24
|
+
scrollPrev: () => void;
|
|
25
|
+
scrollNext: () => void;
|
|
26
|
+
canScrollPrev: boolean;
|
|
27
|
+
canScrollNext: boolean;
|
|
28
|
+
} & CarouselProps;
|
|
29
|
+
|
|
30
|
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null);
|
|
31
|
+
|
|
32
|
+
function useCarousel() {
|
|
33
|
+
const context = React.useContext(CarouselContext);
|
|
34
|
+
|
|
35
|
+
if (!context) {
|
|
36
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return context;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const Carousel = React.forwardRef<
|
|
43
|
+
HTMLDivElement,
|
|
44
|
+
React.HTMLAttributes<HTMLDivElement> & CarouselProps
|
|
45
|
+
>(
|
|
46
|
+
(
|
|
47
|
+
{
|
|
48
|
+
orientation = "horizontal",
|
|
49
|
+
opts,
|
|
50
|
+
setApi,
|
|
51
|
+
plugins,
|
|
52
|
+
className,
|
|
53
|
+
children,
|
|
54
|
+
...props
|
|
55
|
+
},
|
|
56
|
+
ref
|
|
57
|
+
) => {
|
|
58
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
59
|
+
{
|
|
60
|
+
...opts,
|
|
61
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
62
|
+
},
|
|
63
|
+
plugins
|
|
64
|
+
);
|
|
65
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
66
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
67
|
+
|
|
68
|
+
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
69
|
+
if (!api) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
74
|
+
setCanScrollNext(api.canScrollNext());
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
const scrollPrev = React.useCallback(() => {
|
|
78
|
+
api?.scrollPrev();
|
|
79
|
+
}, [api]);
|
|
80
|
+
|
|
81
|
+
const scrollNext = React.useCallback(() => {
|
|
82
|
+
api?.scrollNext();
|
|
83
|
+
}, [api]);
|
|
84
|
+
|
|
85
|
+
const handleKeyDown = React.useCallback(
|
|
86
|
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
87
|
+
if (event.key === "ArrowLeft") {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
scrollPrev();
|
|
90
|
+
} else if (event.key === "ArrowRight") {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
scrollNext();
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
[scrollPrev, scrollNext]
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
if (!api || !setApi) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setApi(api);
|
|
104
|
+
}, [api, setApi]);
|
|
105
|
+
|
|
106
|
+
React.useEffect(() => {
|
|
107
|
+
if (!api) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
onSelect(api);
|
|
112
|
+
api.on("reInit", onSelect);
|
|
113
|
+
api.on("select", onSelect);
|
|
114
|
+
|
|
115
|
+
return () => {
|
|
116
|
+
api?.off("select", onSelect);
|
|
117
|
+
};
|
|
118
|
+
}, [api, onSelect]);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<CarouselContext.Provider
|
|
122
|
+
value={{
|
|
123
|
+
carouselRef,
|
|
124
|
+
api: api,
|
|
125
|
+
opts,
|
|
126
|
+
orientation:
|
|
127
|
+
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
128
|
+
scrollPrev,
|
|
129
|
+
scrollNext,
|
|
130
|
+
canScrollPrev,
|
|
131
|
+
canScrollNext,
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<div
|
|
135
|
+
ref={ref}
|
|
136
|
+
onKeyDownCapture={handleKeyDown}
|
|
137
|
+
className={cn("relative", className)}
|
|
138
|
+
role="region"
|
|
139
|
+
aria-roledescription="carousel"
|
|
140
|
+
{...props}
|
|
141
|
+
>
|
|
142
|
+
{children}
|
|
143
|
+
</div>
|
|
144
|
+
</CarouselContext.Provider>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
Carousel.displayName = "Carousel";
|
|
149
|
+
|
|
150
|
+
const CarouselContent = React.forwardRef<
|
|
151
|
+
HTMLDivElement,
|
|
152
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
153
|
+
>(({ className, ...props }, ref) => {
|
|
154
|
+
const { carouselRef, orientation } = useCarousel();
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div ref={carouselRef} className="overflow-hidden">
|
|
158
|
+
<div
|
|
159
|
+
ref={ref}
|
|
160
|
+
className={cn(
|
|
161
|
+
"flex",
|
|
162
|
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
163
|
+
className
|
|
164
|
+
)}
|
|
165
|
+
{...props}
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
);
|
|
169
|
+
});
|
|
170
|
+
CarouselContent.displayName = "CarouselContent";
|
|
171
|
+
|
|
172
|
+
const CarouselItem = React.forwardRef<
|
|
173
|
+
HTMLDivElement,
|
|
174
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
175
|
+
>(({ className, ...props }, ref) => {
|
|
176
|
+
const { orientation } = useCarousel();
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<div
|
|
180
|
+
ref={ref}
|
|
181
|
+
role="group"
|
|
182
|
+
aria-roledescription="slide"
|
|
183
|
+
className={cn(
|
|
184
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
185
|
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
186
|
+
className
|
|
187
|
+
)}
|
|
188
|
+
{...props}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
CarouselItem.displayName = "CarouselItem";
|
|
193
|
+
|
|
194
|
+
const CarouselPrevious = React.forwardRef<
|
|
195
|
+
HTMLButtonElement,
|
|
196
|
+
React.ComponentProps<typeof Button>
|
|
197
|
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
|
198
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<Button
|
|
202
|
+
ref={ref}
|
|
203
|
+
variant={variant}
|
|
204
|
+
size={size}
|
|
205
|
+
className={cn(
|
|
206
|
+
"absolute h-8 w-8 rounded-full",
|
|
207
|
+
orientation === "horizontal"
|
|
208
|
+
? "-left-12 top-1/2 -translate-y-1/2"
|
|
209
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
210
|
+
className
|
|
211
|
+
)}
|
|
212
|
+
disabled={!canScrollPrev}
|
|
213
|
+
onClick={scrollPrev}
|
|
214
|
+
{...props}
|
|
215
|
+
>
|
|
216
|
+
<ArrowLeft className="h-4 w-4" />
|
|
217
|
+
<span className="sr-only">Previous slide</span>
|
|
218
|
+
</Button>
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
222
|
+
|
|
223
|
+
const CarouselNext = React.forwardRef<
|
|
224
|
+
HTMLButtonElement,
|
|
225
|
+
React.ComponentProps<typeof Button>
|
|
226
|
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
|
227
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<Button
|
|
231
|
+
ref={ref}
|
|
232
|
+
variant={variant}
|
|
233
|
+
size={size}
|
|
234
|
+
className={cn(
|
|
235
|
+
"absolute h-8 w-8 rounded-full",
|
|
236
|
+
orientation === "horizontal"
|
|
237
|
+
? "-right-12 top-1/2 -translate-y-1/2"
|
|
238
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
239
|
+
className
|
|
240
|
+
)}
|
|
241
|
+
disabled={!canScrollNext}
|
|
242
|
+
onClick={scrollNext}
|
|
243
|
+
{...props}
|
|
244
|
+
>
|
|
245
|
+
<ArrowRight className="h-4 w-4" />
|
|
246
|
+
<span className="sr-only">Next slide</span>
|
|
247
|
+
</Button>
|
|
248
|
+
);
|
|
249
|
+
});
|
|
250
|
+
CarouselNext.displayName = "CarouselNext";
|
|
251
|
+
|
|
252
|
+
export {
|
|
253
|
+
type CarouselApi,
|
|
254
|
+
Carousel,
|
|
255
|
+
CarouselContent,
|
|
256
|
+
CarouselItem,
|
|
257
|
+
CarouselPrevious,
|
|
258
|
+
CarouselNext,
|
|
259
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
2
|
+
import { Check } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
|
|
7
|
+
const Checkbox = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<CheckboxPrimitive.Root
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn(
|
|
14
|
+
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<CheckboxPrimitive.Indicator
|
|
20
|
+
className={cn("grid place-content-center text-current")}
|
|
21
|
+
>
|
|
22
|
+
<Check className="h-4 w-4" />
|
|
23
|
+
</CheckboxPrimitive.Indicator>
|
|
24
|
+
</CheckboxPrimitive.Root>
|
|
25
|
+
));
|
|
26
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
27
|
+
|
|
28
|
+
export { Checkbox };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
+
|
|
5
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
6
|
+
|
|
7
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
8
|
+
|
|
9
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
10
|
+
|
|
11
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|