@tioelvis/next-template 2.4.8 → 3.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 +42 -42
- package/package.json +44 -92
- package/src/actions/configure-package-json.js +32 -0
- package/src/actions/init-project.js +40 -0
- package/src/actions/init-shadcn-ui.js +48 -0
- package/src/actions/init-theme.js +28 -0
- package/src/actions/init-tioelvis-components.js +42 -0
- package/src/actions/install-main-packages.js +51 -0
- package/src/constants.js +234 -97
- package/src/lib/exception.js +9 -0
- package/src/lib/utils.js +55 -0
- package/src/main.js +158 -229
- package/src/template/eslint.config.mjs +15 -13
- package/src/template/postcss.config.mjs +3 -1
- package/src/template/src/app/globals.css +0 -122
- package/src/template/src/app/layout.tsx +7 -15
- package/src/template/src/app/page.tsx +6 -2
- package/src/template/tsconfig.json +9 -2
- package/src/themes/blue.css +141 -0
- package/src/themes/default.css +141 -0
- package/src/themes/green.css +141 -0
- package/src/themes/orange.css +141 -0
- package/src/themes/red.css +141 -0
- package/src/themes/rose.css +141 -0
- package/src/themes/violet.css +141 -0
- package/src/themes/yellow.css +141 -0
- package/src/tioelvis-components/max-width-wrapper.tsx +21 -0
- package/src/app/components/ui/accordion.json +0 -6
- package/src/app/components/ui/accordion.tsx +0 -64
- package/src/app/components/ui/alert-dialog.json +0 -6
- package/src/app/components/ui/alert-dialog.tsx +0 -157
- package/src/app/components/ui/alert.json +0 -6
- package/src/app/components/ui/alert.tsx +0 -66
- package/src/app/components/ui/aspect-ratio.json +0 -6
- package/src/app/components/ui/aspect-ratio.tsx +0 -11
- package/src/app/components/ui/avatar.json +0 -6
- package/src/app/components/ui/avatar.tsx +0 -53
- package/src/app/components/ui/badge.json +0 -6
- package/src/app/components/ui/badge.tsx +0 -46
- package/src/app/components/ui/breadcrumb.json +0 -6
- package/src/app/components/ui/breadcrumb.tsx +0 -107
- package/src/app/components/ui/button.json +0 -6
- package/src/app/components/ui/button.tsx +0 -58
- package/src/app/components/ui/calendar.json +0 -6
- package/src/app/components/ui/calendar.tsx +0 -213
- package/src/app/components/ui/card.json +0 -6
- package/src/app/components/ui/card.tsx +0 -92
- package/src/app/components/ui/carousel.json +0 -6
- package/src/app/components/ui/carousel.tsx +0 -236
- package/src/app/components/ui/chart.json +0 -6
- package/src/app/components/ui/chart.tsx +0 -347
- package/src/app/components/ui/checkbox.json +0 -6
- package/src/app/components/ui/checkbox.tsx +0 -30
- package/src/app/components/ui/collapsible.json +0 -6
- package/src/app/components/ui/collapsible.tsx +0 -33
- package/src/app/components/ui/command.json +0 -6
- package/src/app/components/ui/command.tsx +0 -182
- package/src/app/components/ui/context-menu.json +0 -6
- package/src/app/components/ui/context-menu.tsx +0 -249
- package/src/app/components/ui/dialog.json +0 -6
- package/src/app/components/ui/dialog.tsx +0 -141
- package/src/app/components/ui/drawer.json +0 -6
- package/src/app/components/ui/drawer.tsx +0 -134
- package/src/app/components/ui/dropdown-menu.json +0 -6
- package/src/app/components/ui/dropdown-menu.tsx +0 -256
- package/src/app/components/ui/form.json +0 -12
- package/src/app/components/ui/form.tsx +0 -167
- package/src/app/components/ui/hover-card.json +0 -6
- package/src/app/components/ui/hover-card.tsx +0 -49
- package/src/app/components/ui/input-otp.json +0 -6
- package/src/app/components/ui/input-otp.tsx +0 -76
- package/src/app/components/ui/input.json +0 -6
- package/src/app/components/ui/input.tsx +0 -21
- package/src/app/components/ui/label.json +0 -6
- package/src/app/components/ui/label.tsx +0 -24
- package/src/app/components/ui/menubar.json +0 -6
- package/src/app/components/ui/menubar.tsx +0 -273
- package/src/app/components/ui/navigation-menu.json +0 -6
- package/src/app/components/ui/navigation-menu.tsx +0 -164
- package/src/app/components/ui/pagination.json +0 -6
- package/src/app/components/ui/pagination.tsx +0 -124
- package/src/app/components/ui/popover.json +0 -6
- package/src/app/components/ui/popover.tsx +0 -55
- package/src/app/components/ui/progress.json +0 -6
- package/src/app/components/ui/progress.tsx +0 -30
- package/src/app/components/ui/radio-group.json +0 -6
- package/src/app/components/ui/radio-group.tsx +0 -43
- package/src/app/components/ui/resizable.json +0 -6
- package/src/app/components/ui/resizable.tsx +0 -55
- package/src/app/components/ui/scroll-area.json +0 -6
- package/src/app/components/ui/scroll-area.tsx +0 -55
- package/src/app/components/ui/select.json +0 -6
- package/src/app/components/ui/select.tsx +0 -179
- package/src/app/components/ui/separator.json +0 -6
- package/src/app/components/ui/separator.tsx +0 -28
- package/src/app/components/ui/sheet.json +0 -6
- package/src/app/components/ui/sheet.tsx +0 -145
- package/src/app/components/ui/sidebar.json +0 -6
- package/src/app/components/ui/sidebar.tsx +0 -718
- package/src/app/components/ui/skeleton.json +0 -6
- package/src/app/components/ui/skeleton.tsx +0 -13
- package/src/app/components/ui/slider.json +0 -6
- package/src/app/components/ui/slider.tsx +0 -61
- package/src/app/components/ui/sonner.json +0 -6
- package/src/app/components/ui/sonner.tsx +0 -25
- package/src/app/components/ui/switch.json +0 -6
- package/src/app/components/ui/switch.tsx +0 -30
- package/src/app/components/ui/table.json +0 -6
- package/src/app/components/ui/table.tsx +0 -115
- package/src/app/components/ui/tabs.json +0 -6
- package/src/app/components/ui/tabs.tsx +0 -66
- package/src/app/components/ui/textarea.json +0 -6
- package/src/app/components/ui/textarea.tsx +0 -18
- package/src/app/components/ui/toggle-group.json +0 -6
- package/src/app/components/ui/toggle-group.tsx +0 -71
- package/src/app/components/ui/toggle.json +0 -6
- package/src/app/components/ui/toggle.tsx +0 -47
- package/src/app/components/ui/tooltip.json +0 -6
- package/src/app/components/ui/tooltip.tsx +0 -60
- package/src/app/hooks/use-mobile.ts +0 -21
- package/src/app/lib/utils.ts +0 -6
- package/src/app/tsconfig.json +0 -27
- package/src/template/components.json +0 -21
- package/src/template/next-env.d.ts +0 -5
- package/src/template/public/.gitkeep +0 -0
- package/src/template/src/lib/axios.ts +0 -39
- package/src/template/src/lib/constants.ts +0 -1
- package/src/template/src/lib/utils.ts +0 -6
- package/src/template/src/providers/query.provider.tsx +0 -12
- package/src/template/src/providers/theme.provider.tsx +0 -8
- package/src/utils.js +0 -113
- /package/src/template/{src/app → public}/favicon.ico +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils";
|
|
5
|
-
|
|
6
|
-
const alertVariants = cva(
|
|
7
|
-
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: "bg-card text-card-foreground",
|
|
12
|
-
destructive:
|
|
13
|
-
"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
variant: "default",
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
function Alert({
|
|
23
|
-
className,
|
|
24
|
-
variant,
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
27
|
-
return (
|
|
28
|
-
<div
|
|
29
|
-
data-slot="alert"
|
|
30
|
-
role="alert"
|
|
31
|
-
className={cn(alertVariants({ variant }), className)}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
38
|
-
return (
|
|
39
|
-
<div
|
|
40
|
-
data-slot="alert-title"
|
|
41
|
-
className={cn(
|
|
42
|
-
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
|
|
43
|
-
className
|
|
44
|
-
)}
|
|
45
|
-
{...props}
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function AlertDescription({
|
|
51
|
-
className,
|
|
52
|
-
...props
|
|
53
|
-
}: React.ComponentProps<"div">) {
|
|
54
|
-
return (
|
|
55
|
-
<div
|
|
56
|
-
data-slot="alert-description"
|
|
57
|
-
className={cn(
|
|
58
|
-
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
59
|
-
className
|
|
60
|
-
)}
|
|
61
|
-
{...props}
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
|
|
4
|
-
|
|
5
|
-
function AspectRatio({
|
|
6
|
-
...props
|
|
7
|
-
}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
|
|
8
|
-
return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { AspectRatio };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils";
|
|
7
|
-
|
|
8
|
-
function Avatar({
|
|
9
|
-
className,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
|
|
12
|
-
return (
|
|
13
|
-
<AvatarPrimitive.Root
|
|
14
|
-
data-slot="avatar"
|
|
15
|
-
className={cn(
|
|
16
|
-
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
17
|
-
className
|
|
18
|
-
)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function AvatarImage({
|
|
25
|
-
className,
|
|
26
|
-
...props
|
|
27
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
28
|
-
return (
|
|
29
|
-
<AvatarPrimitive.Image
|
|
30
|
-
data-slot="avatar-image"
|
|
31
|
-
className={cn("aspect-square size-full", className)}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function AvatarFallback({
|
|
38
|
-
className,
|
|
39
|
-
...props
|
|
40
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
41
|
-
return (
|
|
42
|
-
<AvatarPrimitive.Fallback
|
|
43
|
-
data-slot="avatar-fallback"
|
|
44
|
-
className={cn(
|
|
45
|
-
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
46
|
-
className
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils";
|
|
6
|
-
|
|
7
|
-
const badgeVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default:
|
|
13
|
-
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
14
|
-
secondary:
|
|
15
|
-
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
16
|
-
destructive:
|
|
17
|
-
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
18
|
-
outline:
|
|
19
|
-
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
variant: "default",
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
function Badge({
|
|
29
|
-
className,
|
|
30
|
-
variant,
|
|
31
|
-
asChild = false,
|
|
32
|
-
...props
|
|
33
|
-
}: React.ComponentProps<"span"> &
|
|
34
|
-
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
35
|
-
const Comp = asChild ? Slot : "span";
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Comp
|
|
39
|
-
data-slot="badge"
|
|
40
|
-
className={cn(badgeVariants({ variant }), className)}
|
|
41
|
-
{...props}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { Badge, badgeVariants };
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
-
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils";
|
|
6
|
-
|
|
7
|
-
function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
|
|
8
|
-
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
12
|
-
return (
|
|
13
|
-
<ol
|
|
14
|
-
data-slot="breadcrumb-list"
|
|
15
|
-
className={cn(
|
|
16
|
-
"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
|
|
17
|
-
className
|
|
18
|
-
)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
25
|
-
return (
|
|
26
|
-
<li
|
|
27
|
-
data-slot="breadcrumb-item"
|
|
28
|
-
className={cn("inline-flex items-center gap-1.5", className)}
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function BreadcrumbLink({
|
|
35
|
-
asChild,
|
|
36
|
-
className,
|
|
37
|
-
...props
|
|
38
|
-
}: React.ComponentProps<"a"> & {
|
|
39
|
-
asChild?: boolean;
|
|
40
|
-
}) {
|
|
41
|
-
const Comp = asChild ? Slot : "a";
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Comp
|
|
45
|
-
data-slot="breadcrumb-link"
|
|
46
|
-
className={cn("hover:text-foreground transition-colors", className)}
|
|
47
|
-
{...props}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
53
|
-
return (
|
|
54
|
-
<span
|
|
55
|
-
data-slot="breadcrumb-page"
|
|
56
|
-
role="link"
|
|
57
|
-
aria-disabled="true"
|
|
58
|
-
aria-current="page"
|
|
59
|
-
className={cn("text-foreground font-normal", className)}
|
|
60
|
-
{...props}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function BreadcrumbSeparator({
|
|
66
|
-
children,
|
|
67
|
-
className,
|
|
68
|
-
...props
|
|
69
|
-
}: React.ComponentProps<"li">) {
|
|
70
|
-
return (
|
|
71
|
-
<li
|
|
72
|
-
data-slot="breadcrumb-separator"
|
|
73
|
-
role="presentation"
|
|
74
|
-
aria-hidden="true"
|
|
75
|
-
className={cn("[&>svg]:size-3.5", className)}
|
|
76
|
-
{...props}>
|
|
77
|
-
{children ?? <ChevronRight />}
|
|
78
|
-
</li>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function BreadcrumbEllipsis({
|
|
83
|
-
className,
|
|
84
|
-
...props
|
|
85
|
-
}: React.ComponentProps<"span">) {
|
|
86
|
-
return (
|
|
87
|
-
<span
|
|
88
|
-
data-slot="breadcrumb-ellipsis"
|
|
89
|
-
role="presentation"
|
|
90
|
-
aria-hidden="true"
|
|
91
|
-
className={cn("flex size-9 items-center justify-center", className)}
|
|
92
|
-
{...props}>
|
|
93
|
-
<MoreHorizontal className="size-4" />
|
|
94
|
-
<span className="sr-only">More</span>
|
|
95
|
-
</span>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export {
|
|
100
|
-
Breadcrumb,
|
|
101
|
-
BreadcrumbList,
|
|
102
|
-
BreadcrumbItem,
|
|
103
|
-
BreadcrumbLink,
|
|
104
|
-
BreadcrumbPage,
|
|
105
|
-
BreadcrumbSeparator,
|
|
106
|
-
BreadcrumbEllipsis,
|
|
107
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils";
|
|
6
|
-
|
|
7
|
-
const buttonVariants = cva(
|
|
8
|
-
"cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-white shadow-xs hover:bg-primary/90",
|
|
13
|
-
destructive:
|
|
14
|
-
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
15
|
-
outline:
|
|
16
|
-
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
17
|
-
secondary:
|
|
18
|
-
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
19
|
-
ghost:
|
|
20
|
-
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
21
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
-
icon: "size-9",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
defaultVariants: {
|
|
31
|
-
variant: "default",
|
|
32
|
-
size: "default",
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
function Button({
|
|
38
|
-
className,
|
|
39
|
-
variant,
|
|
40
|
-
size,
|
|
41
|
-
asChild = false,
|
|
42
|
-
...props
|
|
43
|
-
}: React.ComponentProps<"button"> &
|
|
44
|
-
VariantProps<typeof buttonVariants> & {
|
|
45
|
-
asChild?: boolean;
|
|
46
|
-
}) {
|
|
47
|
-
const Comp = asChild ? Slot : "button";
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Comp
|
|
51
|
-
data-slot="button"
|
|
52
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
53
|
-
{...props}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { Button, buttonVariants };
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import {
|
|
5
|
-
ChevronDownIcon,
|
|
6
|
-
ChevronLeftIcon,
|
|
7
|
-
ChevronRightIcon,
|
|
8
|
-
} from "lucide-react";
|
|
9
|
-
import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
10
|
-
|
|
11
|
-
import { cn } from "@/lib/utils";
|
|
12
|
-
import { Button, buttonVariants } from "@/components/ui/button";
|
|
13
|
-
|
|
14
|
-
function Calendar({
|
|
15
|
-
className,
|
|
16
|
-
classNames,
|
|
17
|
-
showOutsideDays = true,
|
|
18
|
-
captionLayout = "label",
|
|
19
|
-
buttonVariant = "ghost",
|
|
20
|
-
formatters,
|
|
21
|
-
components,
|
|
22
|
-
...props
|
|
23
|
-
}: React.ComponentProps<typeof DayPicker> & {
|
|
24
|
-
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
25
|
-
}) {
|
|
26
|
-
const defaultClassNames = getDefaultClassNames();
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<DayPicker
|
|
30
|
-
showOutsideDays={showOutsideDays}
|
|
31
|
-
className={cn(
|
|
32
|
-
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
33
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
34
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
35
|
-
className
|
|
36
|
-
)}
|
|
37
|
-
captionLayout={captionLayout}
|
|
38
|
-
formatters={{
|
|
39
|
-
formatMonthDropdown: (date) =>
|
|
40
|
-
date.toLocaleString("default", { month: "short" }),
|
|
41
|
-
...formatters,
|
|
42
|
-
}}
|
|
43
|
-
classNames={{
|
|
44
|
-
root: cn("w-fit", defaultClassNames.root),
|
|
45
|
-
months: cn(
|
|
46
|
-
"flex gap-4 flex-col md:flex-row relative",
|
|
47
|
-
defaultClassNames.months
|
|
48
|
-
),
|
|
49
|
-
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
50
|
-
nav: cn(
|
|
51
|
-
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
52
|
-
defaultClassNames.nav
|
|
53
|
-
),
|
|
54
|
-
button_previous: cn(
|
|
55
|
-
buttonVariants({ variant: buttonVariant }),
|
|
56
|
-
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
57
|
-
defaultClassNames.button_previous
|
|
58
|
-
),
|
|
59
|
-
button_next: cn(
|
|
60
|
-
buttonVariants({ variant: buttonVariant }),
|
|
61
|
-
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
62
|
-
defaultClassNames.button_next
|
|
63
|
-
),
|
|
64
|
-
month_caption: cn(
|
|
65
|
-
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
66
|
-
defaultClassNames.month_caption
|
|
67
|
-
),
|
|
68
|
-
dropdowns: cn(
|
|
69
|
-
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
70
|
-
defaultClassNames.dropdowns
|
|
71
|
-
),
|
|
72
|
-
dropdown_root: cn(
|
|
73
|
-
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
74
|
-
defaultClassNames.dropdown_root
|
|
75
|
-
),
|
|
76
|
-
dropdown: cn(
|
|
77
|
-
"absolute bg-popover inset-0 opacity-0",
|
|
78
|
-
defaultClassNames.dropdown
|
|
79
|
-
),
|
|
80
|
-
caption_label: cn(
|
|
81
|
-
"select-none font-medium",
|
|
82
|
-
captionLayout === "label"
|
|
83
|
-
? "text-sm"
|
|
84
|
-
: "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
85
|
-
defaultClassNames.caption_label
|
|
86
|
-
),
|
|
87
|
-
table: "w-full border-collapse",
|
|
88
|
-
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
89
|
-
weekday: cn(
|
|
90
|
-
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
91
|
-
defaultClassNames.weekday
|
|
92
|
-
),
|
|
93
|
-
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
94
|
-
week_number_header: cn(
|
|
95
|
-
"select-none w-(--cell-size)",
|
|
96
|
-
defaultClassNames.week_number_header
|
|
97
|
-
),
|
|
98
|
-
week_number: cn(
|
|
99
|
-
"text-[0.8rem] select-none text-muted-foreground",
|
|
100
|
-
defaultClassNames.week_number
|
|
101
|
-
),
|
|
102
|
-
day: cn(
|
|
103
|
-
"relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
104
|
-
defaultClassNames.day
|
|
105
|
-
),
|
|
106
|
-
range_start: cn(
|
|
107
|
-
"rounded-l-md bg-accent",
|
|
108
|
-
defaultClassNames.range_start
|
|
109
|
-
),
|
|
110
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
111
|
-
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
112
|
-
today: cn(
|
|
113
|
-
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
114
|
-
defaultClassNames.today
|
|
115
|
-
),
|
|
116
|
-
outside: cn(
|
|
117
|
-
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
118
|
-
defaultClassNames.outside
|
|
119
|
-
),
|
|
120
|
-
disabled: cn(
|
|
121
|
-
"text-muted-foreground opacity-50",
|
|
122
|
-
defaultClassNames.disabled
|
|
123
|
-
),
|
|
124
|
-
hidden: cn("invisible", defaultClassNames.hidden),
|
|
125
|
-
...classNames,
|
|
126
|
-
}}
|
|
127
|
-
components={{
|
|
128
|
-
Root: ({ className, rootRef, ...props }) => {
|
|
129
|
-
return (
|
|
130
|
-
<div
|
|
131
|
-
data-slot="calendar"
|
|
132
|
-
ref={rootRef}
|
|
133
|
-
className={cn(className)}
|
|
134
|
-
{...props}
|
|
135
|
-
/>
|
|
136
|
-
);
|
|
137
|
-
},
|
|
138
|
-
Chevron: ({ className, orientation, ...props }) => {
|
|
139
|
-
if (orientation === "left") {
|
|
140
|
-
return (
|
|
141
|
-
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (orientation === "right") {
|
|
146
|
-
return (
|
|
147
|
-
<ChevronRightIcon
|
|
148
|
-
className={cn("size-4", className)}
|
|
149
|
-
{...props}
|
|
150
|
-
/>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
156
|
-
);
|
|
157
|
-
},
|
|
158
|
-
DayButton: CalendarDayButton,
|
|
159
|
-
WeekNumber: ({ children, ...props }) => {
|
|
160
|
-
return (
|
|
161
|
-
<td {...props}>
|
|
162
|
-
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
163
|
-
{children}
|
|
164
|
-
</div>
|
|
165
|
-
</td>
|
|
166
|
-
);
|
|
167
|
-
},
|
|
168
|
-
...components,
|
|
169
|
-
}}
|
|
170
|
-
{...props}
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function CalendarDayButton({
|
|
176
|
-
className,
|
|
177
|
-
day,
|
|
178
|
-
modifiers,
|
|
179
|
-
...props
|
|
180
|
-
}: React.ComponentProps<typeof DayButton>) {
|
|
181
|
-
const defaultClassNames = getDefaultClassNames();
|
|
182
|
-
|
|
183
|
-
const ref = React.useRef<HTMLButtonElement>(null);
|
|
184
|
-
React.useEffect(() => {
|
|
185
|
-
if (modifiers.focused) ref.current?.focus();
|
|
186
|
-
}, [modifiers.focused]);
|
|
187
|
-
|
|
188
|
-
return (
|
|
189
|
-
<Button
|
|
190
|
-
ref={ref}
|
|
191
|
-
variant="ghost"
|
|
192
|
-
size="icon"
|
|
193
|
-
data-day={day.date.toLocaleDateString()}
|
|
194
|
-
data-selected-single={
|
|
195
|
-
modifiers.selected &&
|
|
196
|
-
!modifiers.range_start &&
|
|
197
|
-
!modifiers.range_end &&
|
|
198
|
-
!modifiers.range_middle
|
|
199
|
-
}
|
|
200
|
-
data-range-start={modifiers.range_start}
|
|
201
|
-
data-range-end={modifiers.range_end}
|
|
202
|
-
data-range-middle={modifiers.range_middle}
|
|
203
|
-
className={cn(
|
|
204
|
-
"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 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
205
|
-
defaultClassNames.day,
|
|
206
|
-
className
|
|
207
|
-
)}
|
|
208
|
-
{...props}
|
|
209
|
-
/>
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export { Calendar, CalendarDayButton };
|