shadcn-packaged 0.0.0
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 +50 -0
- package/hooks/use-mobile.d.ts +1 -0
- package/hooks/use-mobile.jsx +15 -0
- package/hooks/use-toast.d.ts +44 -0
- package/hooks/use-toast.js +128 -0
- package/index.d.ts +51 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +5 -0
- package/package.json +76 -0
- package/tailwind.config.js +89 -0
- package/ui/accordion.d.ts +7 -0
- package/ui/accordion.jsx +20 -0
- package/ui/alert-dialog.d.ts +20 -0
- package/ui/alert-dialog.jsx +29 -0
- package/ui/alert.d.ts +8 -0
- package/ui/alert.jsx +21 -0
- package/ui/aspect-ratio.d.ts +3 -0
- package/ui/aspect-ratio.jsx +4 -0
- package/ui/avatar.d.ts +6 -0
- package/ui/avatar.jsx +11 -0
- package/ui/badge.d.ts +9 -0
- package/ui/badge.jsx +20 -0
- package/ui/breadcrumb.d.ts +19 -0
- package/ui/breadcrumb.jsx +27 -0
- package/ui/button.d.ts +11 -0
- package/ui/button.jsx +32 -0
- package/ui/calendar.d.ts +8 -0
- package/ui/calendar.jsx +37 -0
- package/ui/card.d.ts +8 -0
- package/ui/card.jsx +15 -0
- package/ui/carousel.d.ts +18 -0
- package/ui/carousel.jsx +110 -0
- package/ui/chart.d.ts +62 -0
- package/ui/chart.jsx +164 -0
- package/ui/checkbox.d.ts +4 -0
- package/ui/checkbox.jsx +12 -0
- package/ui/collapsible.d.ts +5 -0
- package/ui/collapsible.jsx +6 -0
- package/ui/command.d.ts +80 -0
- package/ui/command.jsx +37 -0
- package/ui/context-menu.d.ts +27 -0
- package/ui/context-menu.jsx +52 -0
- package/ui/dialog.d.ts +19 -0
- package/ui/dialog.jsx +31 -0
- package/ui/drawer.d.ts +22 -0
- package/ui/drawer.jsx +28 -0
- package/ui/dropdown-menu.d.ts +27 -0
- package/ui/dropdown-menu.jsx +54 -0
- package/ui/form.d.ts +23 -0
- package/ui/form.jsx +68 -0
- package/ui/hover-card.d.ts +6 -0
- package/ui/hover-card.jsx +9 -0
- package/ui/input-otp.d.ts +34 -0
- package/ui/input-otp.jsx +25 -0
- package/ui/input.d.ts +3 -0
- package/ui/input.jsx +7 -0
- package/ui/label.d.ts +5 -0
- package/ui/label.jsx +9 -0
- package/ui/menubar.d.ts +33 -0
- package/ui/menubar.jsx +54 -0
- package/ui/navigation-menu.d.ts +12 -0
- package/ui/navigation-menu.jsx +33 -0
- package/ui/pagination.d.ts +28 -0
- package/ui/pagination.jsx +31 -0
- package/ui/popover.d.ts +6 -0
- package/ui/popover.jsx +11 -0
- package/ui/progress.d.ts +4 -0
- package/ui/progress.jsx +9 -0
- package/ui/radio-group.d.ts +5 -0
- package/ui/radio-group.jsx +18 -0
- package/ui/resizable.d.ts +23 -0
- package/ui/resizable.jsx +12 -0
- package/ui/scroll-area.d.ts +5 -0
- package/ui/scroll-area.jsx +19 -0
- package/ui/select.d.ts +13 -0
- package/ui/select.jsx +51 -0
- package/ui/separator.d.ts +4 -0
- package/ui/separator.jsx +7 -0
- package/ui/sheet.d.ts +25 -0
- package/ui/sheet.jsx +45 -0
- package/ui/sidebar.d.ts +66 -0
- package/ui/sidebar.jsx +253 -0
- package/ui/skeleton.d.ts +2 -0
- package/ui/skeleton.jsx +5 -0
- package/ui/slider.d.ts +4 -0
- package/ui/slider.jsx +12 -0
- package/ui/sonner.d.ts +4 -0
- package/ui/sonner.jsx +15 -0
- package/ui/switch.d.ts +4 -0
- package/ui/switch.jsx +9 -0
- package/ui/table.d.ts +10 -0
- package/ui/table.jsx +21 -0
- package/ui/tabs.d.ts +7 -0
- package/ui/tabs.jsx +12 -0
- package/ui/textarea.d.ts +3 -0
- package/ui/textarea.jsx +7 -0
- package/ui/toast.d.ts +15 -0
- package/ui/toast.jsx +35 -0
- package/ui/toaster.d.ts +1 -0
- package/ui/toaster.jsx +19 -0
- package/ui/toggle-group.d.ts +12 -0
- package/ui/toggle-group.jsx +26 -0
- package/ui/toggle.d.ts +12 -0
- package/ui/toggle.jsx +25 -0
- package/ui/tooltip.d.ts +7 -0
- package/ui/tooltip.jsx +10 -0
package/ui/badge.jsx
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { cva } from "class-variance-authority";
|
3
|
+
import { cn } from "../lib/utils";
|
4
|
+
const badgeVariants = cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
5
|
+
variants: {
|
6
|
+
variant: {
|
7
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
8
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
9
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
10
|
+
outline: "text-foreground",
|
11
|
+
},
|
12
|
+
},
|
13
|
+
defaultVariants: {
|
14
|
+
variant: "default",
|
15
|
+
},
|
16
|
+
});
|
17
|
+
function Badge({ className, variant, ...props }) {
|
18
|
+
return (<div className={cn(badgeVariants({ variant }), className)} {...props}/>);
|
19
|
+
}
|
20
|
+
export { Badge, badgeVariants };
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
3
|
+
separator?: React.ReactNode;
|
4
|
+
} & React.RefAttributes<HTMLElement>>;
|
5
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
6
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
7
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
8
|
+
asChild?: boolean;
|
9
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
10
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
11
|
+
declare const BreadcrumbSeparator: {
|
12
|
+
({ children, className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
13
|
+
displayName: string;
|
14
|
+
};
|
15
|
+
declare const BreadcrumbEllipsis: {
|
16
|
+
({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
17
|
+
displayName: string;
|
18
|
+
};
|
19
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
3
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
4
|
+
import { cn } from "../lib/utils";
|
5
|
+
const Breadcrumb = React.forwardRef(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props}/>);
|
6
|
+
Breadcrumb.displayName = "Breadcrumb";
|
7
|
+
const BreadcrumbList = React.forwardRef(({ className, ...props }, ref) => (<ol ref={ref} className={cn("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5", className)} {...props}/>));
|
8
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
9
|
+
const BreadcrumbItem = React.forwardRef(({ className, ...props }, ref) => (<li ref={ref} className={cn("inline-flex items-center gap-1.5", className)} {...props}/>));
|
10
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
11
|
+
const BreadcrumbLink = React.forwardRef(({ asChild, className, ...props }, ref) => {
|
12
|
+
const Comp = asChild ? Slot : "a";
|
13
|
+
return (<Comp ref={ref} className={cn("transition-colors hover:text-foreground", className)} {...props}/>);
|
14
|
+
});
|
15
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
16
|
+
const BreadcrumbPage = React.forwardRef(({ className, ...props }, ref) => (<span ref={ref} role="link" aria-disabled="true" aria-current="page" className={cn("font-normal text-foreground", className)} {...props}/>));
|
17
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
18
|
+
const BreadcrumbSeparator = ({ children, className, ...props }) => (<li role="presentation" aria-hidden="true" className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)} {...props}>
|
19
|
+
{children ?? <ChevronRight />}
|
20
|
+
</li>);
|
21
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
22
|
+
const BreadcrumbEllipsis = ({ className, ...props }) => (<span role="presentation" aria-hidden="true" className={cn("flex h-9 w-9 items-center justify-center", className)} {...props}>
|
23
|
+
<MoreHorizontal className="h-4 w-4"/>
|
24
|
+
<span className="sr-only">More</span>
|
25
|
+
</span>);
|
26
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
|
27
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
package/ui/button.d.ts
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
3
|
+
declare const buttonVariants: (props?: {
|
4
|
+
variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "ghost";
|
5
|
+
size?: "default" | "icon" | "sm" | "lg";
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
8
|
+
asChild?: boolean;
|
9
|
+
}
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
11
|
+
export { Button, buttonVariants };
|
package/ui/button.jsx
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
3
|
+
import { cva } from "class-variance-authority";
|
4
|
+
import { cn } from "../lib/utils";
|
5
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
6
|
+
variants: {
|
7
|
+
variant: {
|
8
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
9
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
10
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
11
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
12
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
13
|
+
link: "text-primary underline-offset-4 hover:underline",
|
14
|
+
},
|
15
|
+
size: {
|
16
|
+
default: "h-10 px-4 py-2",
|
17
|
+
sm: "h-9 rounded-md px-3",
|
18
|
+
lg: "h-11 rounded-md px-8",
|
19
|
+
icon: "h-10 w-10",
|
20
|
+
},
|
21
|
+
},
|
22
|
+
defaultVariants: {
|
23
|
+
variant: "default",
|
24
|
+
size: "default",
|
25
|
+
},
|
26
|
+
});
|
27
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
28
|
+
const Comp = asChild ? Slot : "button";
|
29
|
+
return (<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props}/>);
|
30
|
+
});
|
31
|
+
Button.displayName = "Button";
|
32
|
+
export { Button, buttonVariants };
|
package/ui/calendar.d.ts
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { DayPicker } from "react-day-picker";
|
3
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
|
4
|
+
declare function Calendar({ className, classNames, showOutsideDays, ...props }: CalendarProps): React.JSX.Element;
|
5
|
+
declare namespace Calendar {
|
6
|
+
var displayName: string;
|
7
|
+
}
|
8
|
+
export { Calendar };
|
package/ui/calendar.jsx
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
"use client";
|
2
|
+
import * as React from "react";
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
4
|
+
import { DayPicker } from "react-day-picker";
|
5
|
+
import { cn } from "../lib/utils";
|
6
|
+
import { buttonVariants } from "../ui/button";
|
7
|
+
function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
8
|
+
return (<DayPicker showOutsideDays={showOutsideDays} className={cn("p-3", className)} classNames={{
|
9
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
10
|
+
month: "space-y-4",
|
11
|
+
caption: "flex justify-center pt-1 relative items-center",
|
12
|
+
caption_label: "text-sm font-medium",
|
13
|
+
nav: "space-x-1 flex items-center",
|
14
|
+
nav_button: cn(buttonVariants({ variant: "outline" }), "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),
|
15
|
+
nav_button_previous: "absolute left-1",
|
16
|
+
nav_button_next: "absolute right-1",
|
17
|
+
table: "w-full border-collapse space-y-1",
|
18
|
+
head_row: "flex",
|
19
|
+
head_cell: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
20
|
+
row: "flex w-full mt-2",
|
21
|
+
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-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",
|
22
|
+
day: cn(buttonVariants({ variant: "ghost" }), "h-9 w-9 p-0 font-normal aria-selected:opacity-100"),
|
23
|
+
day_range_end: "day-range-end",
|
24
|
+
day_selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
25
|
+
day_today: "bg-accent text-accent-foreground",
|
26
|
+
day_outside: "day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
|
27
|
+
day_disabled: "text-muted-foreground opacity-50",
|
28
|
+
day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
|
29
|
+
day_hidden: "invisible",
|
30
|
+
...classNames,
|
31
|
+
}} components={{
|
32
|
+
IconLeft: ({ className, ...props }) => (<ChevronLeft className={cn("h-4 w-4", className)} {...props}/>),
|
33
|
+
IconRight: ({ className, ...props }) => (<ChevronRight className={cn("h-4 w-4", className)} {...props}/>),
|
34
|
+
}} {...props}/>);
|
35
|
+
}
|
36
|
+
Calendar.displayName = "Calendar";
|
37
|
+
export { Calendar };
|
package/ui/card.d.ts
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
5
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
6
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
7
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
8
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
package/ui/card.jsx
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { cn } from "../lib/utils";
|
3
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)} {...props}/>));
|
4
|
+
Card.displayName = "Card";
|
5
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props}/>));
|
6
|
+
CardHeader.displayName = "CardHeader";
|
7
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("text-2xl font-semibold leading-none tracking-tight", className)} {...props}/>));
|
8
|
+
CardTitle.displayName = "CardTitle";
|
9
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props}/>));
|
10
|
+
CardDescription.displayName = "CardDescription";
|
11
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("p-6 pt-0", className)} {...props}/>));
|
12
|
+
CardContent.displayName = "CardContent";
|
13
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props}/>));
|
14
|
+
CardFooter.displayName = "CardFooter";
|
15
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
package/ui/carousel.d.ts
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
3
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
4
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
5
|
+
type CarouselOptions = UseCarouselParameters[0];
|
6
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
7
|
+
type CarouselProps = {
|
8
|
+
opts?: CarouselOptions;
|
9
|
+
plugins?: CarouselPlugin;
|
10
|
+
orientation?: "horizontal" | "vertical";
|
11
|
+
setApi?: (api: CarouselApi) => void;
|
12
|
+
};
|
13
|
+
declare const Carousel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
14
|
+
declare const CarouselContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
15
|
+
declare const CarouselItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
16
|
+
declare const CarouselPrevious: React.ForwardRefExoticComponent<Omit<import("../ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
17
|
+
declare const CarouselNext: React.ForwardRefExoticComponent<Omit<import("../ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
18
|
+
export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
|
package/ui/carousel.jsx
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
"use client";
|
2
|
+
import * as React from "react";
|
3
|
+
import useEmblaCarousel from "embla-carousel-react";
|
4
|
+
import { ArrowLeft, ArrowRight } from "lucide-react";
|
5
|
+
import { cn } from "../lib/utils";
|
6
|
+
import { Button } from "../ui/button";
|
7
|
+
const CarouselContext = React.createContext(null);
|
8
|
+
function useCarousel() {
|
9
|
+
const context = React.useContext(CarouselContext);
|
10
|
+
if (!context) {
|
11
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
12
|
+
}
|
13
|
+
return context;
|
14
|
+
}
|
15
|
+
const Carousel = React.forwardRef(({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }, ref) => {
|
16
|
+
const [carouselRef, api] = useEmblaCarousel({
|
17
|
+
...opts,
|
18
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
19
|
+
}, plugins);
|
20
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
21
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
22
|
+
const onSelect = React.useCallback((api) => {
|
23
|
+
if (!api) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
setCanScrollPrev(api.canScrollPrev());
|
27
|
+
setCanScrollNext(api.canScrollNext());
|
28
|
+
}, []);
|
29
|
+
const scrollPrev = React.useCallback(() => {
|
30
|
+
api?.scrollPrev();
|
31
|
+
}, [api]);
|
32
|
+
const scrollNext = React.useCallback(() => {
|
33
|
+
api?.scrollNext();
|
34
|
+
}, [api]);
|
35
|
+
const handleKeyDown = React.useCallback((event) => {
|
36
|
+
if (event.key === "ArrowLeft") {
|
37
|
+
event.preventDefault();
|
38
|
+
scrollPrev();
|
39
|
+
}
|
40
|
+
else if (event.key === "ArrowRight") {
|
41
|
+
event.preventDefault();
|
42
|
+
scrollNext();
|
43
|
+
}
|
44
|
+
}, [scrollPrev, scrollNext]);
|
45
|
+
React.useEffect(() => {
|
46
|
+
if (!api || !setApi) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
setApi(api);
|
50
|
+
}, [api, setApi]);
|
51
|
+
React.useEffect(() => {
|
52
|
+
if (!api) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
onSelect(api);
|
56
|
+
api.on("reInit", onSelect);
|
57
|
+
api.on("select", onSelect);
|
58
|
+
return () => {
|
59
|
+
api?.off("select", onSelect);
|
60
|
+
};
|
61
|
+
}, [api, onSelect]);
|
62
|
+
return (<CarouselContext.Provider value={{
|
63
|
+
carouselRef,
|
64
|
+
api: api,
|
65
|
+
opts,
|
66
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
67
|
+
scrollPrev,
|
68
|
+
scrollNext,
|
69
|
+
canScrollPrev,
|
70
|
+
canScrollNext,
|
71
|
+
}}>
|
72
|
+
<div ref={ref} onKeyDownCapture={handleKeyDown} className={cn("relative", className)} role="region" aria-roledescription="carousel" {...props}>
|
73
|
+
{children}
|
74
|
+
</div>
|
75
|
+
</CarouselContext.Provider>);
|
76
|
+
});
|
77
|
+
Carousel.displayName = "Carousel";
|
78
|
+
const CarouselContent = React.forwardRef(({ className, ...props }, ref) => {
|
79
|
+
const { carouselRef, orientation } = useCarousel();
|
80
|
+
return (<div ref={carouselRef} className="overflow-hidden">
|
81
|
+
<div ref={ref} className={cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)} {...props}/>
|
82
|
+
</div>);
|
83
|
+
});
|
84
|
+
CarouselContent.displayName = "CarouselContent";
|
85
|
+
const CarouselItem = React.forwardRef(({ className, ...props }, ref) => {
|
86
|
+
const { orientation } = useCarousel();
|
87
|
+
return (<div ref={ref} role="group" aria-roledescription="slide" className={cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className)} {...props}/>);
|
88
|
+
});
|
89
|
+
CarouselItem.displayName = "CarouselItem";
|
90
|
+
const CarouselPrevious = React.forwardRef(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
91
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
92
|
+
return (<Button ref={ref} variant={variant} size={size} className={cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
|
93
|
+
? "-left-12 top-1/2 -translate-y-1/2"
|
94
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90", className)} disabled={!canScrollPrev} onClick={scrollPrev} {...props}>
|
95
|
+
<ArrowLeft className="h-4 w-4"/>
|
96
|
+
<span className="sr-only">Previous slide</span>
|
97
|
+
</Button>);
|
98
|
+
});
|
99
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
100
|
+
const CarouselNext = React.forwardRef(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
101
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
102
|
+
return (<Button ref={ref} variant={variant} size={size} className={cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
|
103
|
+
? "-right-12 top-1/2 -translate-y-1/2"
|
104
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className)} disabled={!canScrollNext} onClick={scrollNext} {...props}>
|
105
|
+
<ArrowRight className="h-4 w-4"/>
|
106
|
+
<span className="sr-only">Next slide</span>
|
107
|
+
</Button>);
|
108
|
+
});
|
109
|
+
CarouselNext.displayName = "CarouselNext";
|
110
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
|
package/ui/chart.d.ts
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import * as RechartsPrimitive from "recharts";
|
3
|
+
declare const THEMES: {
|
4
|
+
readonly light: "";
|
5
|
+
readonly dark: ".dark";
|
6
|
+
};
|
7
|
+
export type ChartConfig = {
|
8
|
+
[k in string]: {
|
9
|
+
label?: React.ReactNode;
|
10
|
+
icon?: React.ComponentType;
|
11
|
+
} & ({
|
12
|
+
color?: string;
|
13
|
+
theme?: never;
|
14
|
+
} | {
|
15
|
+
color?: never;
|
16
|
+
theme: Record<keyof typeof THEMES, string>;
|
17
|
+
});
|
18
|
+
};
|
19
|
+
declare const ChartContainer: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
20
|
+
config: ChartConfig;
|
21
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
22
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
23
|
+
declare const ChartStyle: ({ id, config }: {
|
24
|
+
id: string;
|
25
|
+
config: ChartConfig;
|
26
|
+
}) => React.JSX.Element;
|
27
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
28
|
+
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<RechartsPrimitive.DefaultTooltipContentProps<import("recharts/types/component/DefaultTooltipContent").ValueType, import("recharts/types/component/DefaultTooltipContent").NameType> & {
|
29
|
+
accessibilityLayer?: boolean;
|
30
|
+
active?: boolean | undefined;
|
31
|
+
includeHidden?: boolean | undefined;
|
32
|
+
allowEscapeViewBox?: import("recharts/types/util/types").AllowInDimension;
|
33
|
+
animationDuration?: import("recharts/types/util/types").AnimationDuration;
|
34
|
+
animationEasing?: import("recharts/types/util/types").AnimationTiming;
|
35
|
+
content?: import("recharts/types/component/Tooltip").ContentType<import("recharts/types/component/DefaultTooltipContent").ValueType, import("recharts/types/component/DefaultTooltipContent").NameType>;
|
36
|
+
coordinate?: Partial<import("recharts/types/util/types").Coordinate>;
|
37
|
+
cursor?: boolean | React.ReactElement | React.SVGProps<SVGElement>;
|
38
|
+
filterNull?: boolean;
|
39
|
+
defaultIndex?: number;
|
40
|
+
isAnimationActive?: boolean;
|
41
|
+
offset?: number;
|
42
|
+
payloadUniqBy?: import("recharts/types/util/payload/getUniqPayload").UniqueOption<import("recharts/types/component/DefaultTooltipContent").Payload<import("recharts/types/component/DefaultTooltipContent").ValueType, import("recharts/types/component/DefaultTooltipContent").NameType>>;
|
43
|
+
position?: Partial<import("recharts/types/util/types").Coordinate>;
|
44
|
+
reverseDirection?: import("recharts/types/util/types").AllowInDimension;
|
45
|
+
shared?: boolean;
|
46
|
+
trigger?: "hover" | "click";
|
47
|
+
useTranslate3d?: boolean;
|
48
|
+
viewBox?: import("recharts/types/util/types").CartesianViewBox;
|
49
|
+
wrapperStyle?: React.CSSProperties;
|
50
|
+
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
51
|
+
hideLabel?: boolean;
|
52
|
+
hideIndicator?: boolean;
|
53
|
+
indicator?: "line" | "dot" | "dashed";
|
54
|
+
nameKey?: string;
|
55
|
+
labelKey?: string;
|
56
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
57
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
58
|
+
declare const ChartLegendContent: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Pick<RechartsPrimitive.LegendProps, "verticalAlign" | "payload"> & {
|
59
|
+
hideIcon?: boolean;
|
60
|
+
nameKey?: string;
|
61
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
62
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
package/ui/chart.jsx
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
"use client";
|
2
|
+
import * as React from "react";
|
3
|
+
import * as RechartsPrimitive from "recharts";
|
4
|
+
import { cn } from "../lib/utils";
|
5
|
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
6
|
+
const THEMES = { light: "", dark: ".dark" };
|
7
|
+
const ChartContext = React.createContext(null);
|
8
|
+
function useChart() {
|
9
|
+
const context = React.useContext(ChartContext);
|
10
|
+
if (!context) {
|
11
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
12
|
+
}
|
13
|
+
return context;
|
14
|
+
}
|
15
|
+
const ChartContainer = React.forwardRef(({ id, className, children, config, ...props }, ref) => {
|
16
|
+
const uniqueId = React.useId();
|
17
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
18
|
+
return (<ChartContext.Provider value={{ config }}>
|
19
|
+
<div data-chart={chartId} ref={ref} className={cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none", className)} {...props}>
|
20
|
+
<ChartStyle id={chartId} config={config}/>
|
21
|
+
<RechartsPrimitive.ResponsiveContainer>
|
22
|
+
{children}
|
23
|
+
</RechartsPrimitive.ResponsiveContainer>
|
24
|
+
</div>
|
25
|
+
</ChartContext.Provider>);
|
26
|
+
});
|
27
|
+
ChartContainer.displayName = "Chart";
|
28
|
+
const ChartStyle = ({ id, config }) => {
|
29
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
30
|
+
if (!colorConfig.length) {
|
31
|
+
return null;
|
32
|
+
}
|
33
|
+
return (<style dangerouslySetInnerHTML={{
|
34
|
+
__html: Object.entries(THEMES)
|
35
|
+
.map(([theme, prefix]) => `
|
36
|
+
${prefix} [data-chart=${id}] {
|
37
|
+
${colorConfig
|
38
|
+
.map(([key, itemConfig]) => {
|
39
|
+
const color = itemConfig.theme?.[theme] ||
|
40
|
+
itemConfig.color;
|
41
|
+
return color ? ` --color-${key}: ${color};` : null;
|
42
|
+
})
|
43
|
+
.join("\n")}
|
44
|
+
}
|
45
|
+
`)
|
46
|
+
.join("\n"),
|
47
|
+
}}/>);
|
48
|
+
};
|
49
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
50
|
+
const ChartTooltipContent = React.forwardRef(({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }, ref) => {
|
51
|
+
const { config } = useChart();
|
52
|
+
const tooltipLabel = React.useMemo(() => {
|
53
|
+
if (hideLabel || !payload?.length) {
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
const [item] = payload;
|
57
|
+
const key = `${labelKey || item.dataKey || item.name || "value"}`;
|
58
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
59
|
+
const value = !labelKey && typeof label === "string"
|
60
|
+
? config[label]?.label || label
|
61
|
+
: itemConfig?.label;
|
62
|
+
if (labelFormatter) {
|
63
|
+
return (<div className={cn("font-medium", labelClassName)}>
|
64
|
+
{labelFormatter(value, payload)}
|
65
|
+
</div>);
|
66
|
+
}
|
67
|
+
if (!value) {
|
68
|
+
return null;
|
69
|
+
}
|
70
|
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>;
|
71
|
+
}, [
|
72
|
+
label,
|
73
|
+
labelFormatter,
|
74
|
+
payload,
|
75
|
+
hideLabel,
|
76
|
+
labelClassName,
|
77
|
+
config,
|
78
|
+
labelKey,
|
79
|
+
]);
|
80
|
+
if (!active || !payload?.length) {
|
81
|
+
return null;
|
82
|
+
}
|
83
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
84
|
+
return (<div ref={ref} className={cn("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className)}>
|
85
|
+
{!nestLabel ? tooltipLabel : null}
|
86
|
+
<div className="grid gap-1.5">
|
87
|
+
{payload.map((item, index) => {
|
88
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
89
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
90
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
91
|
+
return (<div key={item.dataKey} className={cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center")}>
|
92
|
+
{formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (<>
|
93
|
+
{itemConfig?.icon ? (<itemConfig.icon />) : (!hideIndicator && (<div className={cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
|
94
|
+
"h-2.5 w-2.5": indicator === "dot",
|
95
|
+
"w-1": indicator === "line",
|
96
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
97
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
98
|
+
})} style={{
|
99
|
+
"--color-bg": indicatorColor,
|
100
|
+
"--color-border": indicatorColor,
|
101
|
+
}}/>))}
|
102
|
+
<div className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}>
|
103
|
+
<div className="grid gap-1.5">
|
104
|
+
{nestLabel ? tooltipLabel : null}
|
105
|
+
<span className="text-muted-foreground">
|
106
|
+
{itemConfig?.label || item.name}
|
107
|
+
</span>
|
108
|
+
</div>
|
109
|
+
{item.value && (<span className="font-mono font-medium tabular-nums text-foreground">
|
110
|
+
{item.value.toLocaleString()}
|
111
|
+
</span>)}
|
112
|
+
</div>
|
113
|
+
</>)}
|
114
|
+
</div>);
|
115
|
+
})}
|
116
|
+
</div>
|
117
|
+
</div>);
|
118
|
+
});
|
119
|
+
ChartTooltipContent.displayName = "ChartTooltip";
|
120
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
121
|
+
const ChartLegendContent = React.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
122
|
+
const { config } = useChart();
|
123
|
+
if (!payload?.length) {
|
124
|
+
return null;
|
125
|
+
}
|
126
|
+
return (<div ref={ref} className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
|
127
|
+
{payload.map((item) => {
|
128
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
129
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
130
|
+
return (<div key={item.value} className={cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground")}>
|
131
|
+
{itemConfig?.icon && !hideIcon ? (<itemConfig.icon />) : (<div className="h-2 w-2 shrink-0 rounded-[2px]" style={{
|
132
|
+
backgroundColor: item.color,
|
133
|
+
}}/>)}
|
134
|
+
{itemConfig?.label}
|
135
|
+
</div>);
|
136
|
+
})}
|
137
|
+
</div>);
|
138
|
+
});
|
139
|
+
ChartLegendContent.displayName = "ChartLegend";
|
140
|
+
// Helper to extract item config from a payload.
|
141
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
142
|
+
if (typeof payload !== "object" || payload === null) {
|
143
|
+
return undefined;
|
144
|
+
}
|
145
|
+
const payloadPayload = "payload" in payload &&
|
146
|
+
typeof payload.payload === "object" &&
|
147
|
+
payload.payload !== null
|
148
|
+
? payload.payload
|
149
|
+
: undefined;
|
150
|
+
let configLabelKey = key;
|
151
|
+
if (key in payload &&
|
152
|
+
typeof payload[key] === "string") {
|
153
|
+
configLabelKey = payload[key];
|
154
|
+
}
|
155
|
+
else if (payloadPayload &&
|
156
|
+
key in payloadPayload &&
|
157
|
+
typeof payloadPayload[key] === "string") {
|
158
|
+
configLabelKey = payloadPayload[key];
|
159
|
+
}
|
160
|
+
return configLabelKey in config
|
161
|
+
? config[configLabelKey]
|
162
|
+
: config[key];
|
163
|
+
}
|
164
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
package/ui/checkbox.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
3
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
4
|
+
export { Checkbox };
|
package/ui/checkbox.jsx
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
"use client";
|
2
|
+
import * as React from "react";
|
3
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
4
|
+
import { Check } from "lucide-react";
|
5
|
+
import { cn } from "../lib/utils";
|
6
|
+
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (<CheckboxPrimitive.Root ref={ref} className={cn("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", className)} {...props}>
|
7
|
+
<CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
|
8
|
+
<Check className="h-4 w-4"/>
|
9
|
+
</CheckboxPrimitive.Indicator>
|
10
|
+
</CheckboxPrimitive.Root>));
|
11
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
12
|
+
export { Checkbox };
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
2
|
+
declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
|
3
|
+
declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
4
|
+
declare const CollapsibleContent: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
5
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use client";
|
2
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
3
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
4
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
5
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
6
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|