create-app-ui 1.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/LICENSE +21 -0
- package/README.md +117 -0
- package/boilerplate/README.md +18 -0
- package/boilerplate/react-base/.env.example +1 -0
- package/boilerplate/react-base/README.md +3 -0
- package/boilerplate/react-base/components.json +19 -0
- package/boilerplate/react-base/eslint.config.js +32 -0
- package/boilerplate/react-base/index.html +12 -0
- package/boilerplate/react-base/package.json +71 -0
- package/boilerplate/react-base/postcss.config.js +6 -0
- package/boilerplate/react-base/prettier.config.js +6 -0
- package/boilerplate/react-base/src/api/axios.ts +20 -0
- package/boilerplate/react-base/src/app/store.ts +13 -0
- package/boilerplate/react-base/src/components/data-table.tsx +919 -0
- package/boilerplate/react-base/src/components/ui/accordion.tsx +44 -0
- package/boilerplate/react-base/src/components/ui/alert-dialog.tsx +105 -0
- package/boilerplate/react-base/src/components/ui/alert.tsx +40 -0
- package/boilerplate/react-base/src/components/ui/avatar.tsx +30 -0
- package/boilerplate/react-base/src/components/ui/badge.tsx +27 -0
- package/boilerplate/react-base/src/components/ui/bar-chart.tsx +76 -0
- package/boilerplate/react-base/src/components/ui/breadcrumb.tsx +87 -0
- package/boilerplate/react-base/src/components/ui/button.tsx +34 -0
- package/boilerplate/react-base/src/components/ui/calendar.tsx +63 -0
- package/boilerplate/react-base/src/components/ui/card.tsx +36 -0
- package/boilerplate/react-base/src/components/ui/chart.tsx +280 -0
- package/boilerplate/react-base/src/components/ui/checkbox.tsx +51 -0
- package/boilerplate/react-base/src/components/ui/context-menu.tsx +173 -0
- package/boilerplate/react-base/src/components/ui/date-picker.tsx +42 -0
- package/boilerplate/react-base/src/components/ui/dialog.tsx +87 -0
- package/boilerplate/react-base/src/components/ui/drawer.tsx +81 -0
- package/boilerplate/react-base/src/components/ui/dropdown-menu.tsx +81 -0
- package/boilerplate/react-base/src/components/ui/dropdown-types.ts +28 -0
- package/boilerplate/react-base/src/components/ui/field.tsx +194 -0
- package/boilerplate/react-base/src/components/ui/hover-card.tsx +26 -0
- package/boilerplate/react-base/src/components/ui/input-group.tsx +98 -0
- package/boilerplate/react-base/src/components/ui/input-otp.tsx +63 -0
- package/boilerplate/react-base/src/components/ui/input.tsx +12 -0
- package/boilerplate/react-base/src/components/ui/item.tsx +152 -0
- package/boilerplate/react-base/src/components/ui/kbd.tsx +13 -0
- package/boilerplate/react-base/src/components/ui/label.tsx +14 -0
- package/boilerplate/react-base/src/components/ui/line-chart.tsx +65 -0
- package/boilerplate/react-base/src/components/ui/menubar.tsx +217 -0
- package/boilerplate/react-base/src/components/ui/multi-select-dropdown.tsx +200 -0
- package/boilerplate/react-base/src/components/ui/navigation-menu.tsx +120 -0
- package/boilerplate/react-base/src/components/ui/pie-chart.tsx +87 -0
- package/boilerplate/react-base/src/components/ui/popover.tsx +29 -0
- package/boilerplate/react-base/src/components/ui/progress.tsx +19 -0
- package/boilerplate/react-base/src/components/ui/radio-group.tsx +36 -0
- package/boilerplate/react-base/src/components/ui/scroll-area.tsx +38 -0
- package/boilerplate/react-base/src/components/ui/searchable-dropdown.tsx +118 -0
- package/boilerplate/react-base/src/components/ui/select.tsx +140 -0
- package/boilerplate/react-base/src/components/ui/separator.tsx +20 -0
- package/boilerplate/react-base/src/components/ui/sheet.tsx +70 -0
- package/boilerplate/react-base/src/components/ui/sidebar.tsx +470 -0
- package/boilerplate/react-base/src/components/ui/skeleton.tsx +11 -0
- package/boilerplate/react-base/src/components/ui/slider.tsx +23 -0
- package/boilerplate/react-base/src/components/ui/sonner.tsx +21 -0
- package/boilerplate/react-base/src/components/ui/sparkline.tsx +38 -0
- package/boilerplate/react-base/src/components/ui/spinner.tsx +10 -0
- package/boilerplate/react-base/src/components/ui/switch.tsx +16 -0
- package/boilerplate/react-base/src/components/ui/table.tsx +80 -0
- package/boilerplate/react-base/src/components/ui/tabs.tsx +32 -0
- package/boilerplate/react-base/src/components/ui/textarea.tsx +12 -0
- package/boilerplate/react-base/src/components/ui/toggle-group.tsx +49 -0
- package/boilerplate/react-base/src/components/ui/toggle.tsx +33 -0
- package/boilerplate/react-base/src/components/ui/tooltip.tsx +23 -0
- package/boilerplate/react-base/src/components/ui/typography.tsx +76 -0
- package/boilerplate/react-base/src/config/constants.ts +3 -0
- package/boilerplate/react-base/src/config/theme.ts +432 -0
- package/boilerplate/react-base/src/config/user.ts +52 -0
- package/boilerplate/react-base/src/context/theme-provider.tsx +12 -0
- package/boilerplate/react-base/src/features/auth/authSlice.ts +19 -0
- package/boilerplate/react-base/src/hooks/index.ts +1 -0
- package/boilerplate/react-base/src/hooks/use-mobile.ts +17 -0
- package/boilerplate/react-base/src/lib/utils.ts +6 -0
- package/boilerplate/react-base/src/routes/index.tsx +7 -0
- package/boilerplate/react-base/src/styles/globals.css +15 -0
- package/boilerplate/react-base/src/vite-env.d.ts +31 -0
- package/boilerplate/react-base/tailwind.config.ts +75 -0
- package/boilerplate/react-base/tsconfig.app.json +20 -0
- package/boilerplate/react-base/tsconfig.json +7 -0
- package/boilerplate/react-base/tsconfig.node.json +16 -0
- package/boilerplate/react-base/vite.config.ts +12 -0
- package/dist/bin/index.js +8 -0
- package/dist/src/cli-args.js +52 -0
- package/dist/src/generator.js +85 -0
- package/dist/src/installer.js +7 -0
- package/dist/src/paths.js +61 -0
- package/dist/src/prompts.js +79 -0
- package/dist/src/replace-placeholders.js +22 -0
- package/dist/src/utils.js +16 -0
- package/package.json +63 -0
- package/templates/admin-portal/README.md +26 -0
- package/templates/admin-portal/src/App.tsx +85 -0
- package/templates/admin-portal/src/assets/auth-hero.jpg +0 -0
- package/templates/admin-portal/src/assets/brand-logo.png +0 -0
- package/templates/admin-portal/src/components/app-breadcrumb.tsx +41 -0
- package/templates/admin-portal/src/components/app-header.tsx +20 -0
- package/templates/admin-portal/src/components/app-sidebar.tsx +78 -0
- package/templates/admin-portal/src/components/auth-layout.tsx +66 -0
- package/templates/admin-portal/src/components/dashboard-metric-card.tsx +105 -0
- package/templates/admin-portal/src/components/data-table.tsx +919 -0
- package/templates/admin-portal/src/components/layout-shell.tsx +23 -0
- package/templates/admin-portal/src/components/notifications-sheet.tsx +91 -0
- package/templates/admin-portal/src/components/sidebar-nav.tsx +164 -0
- package/templates/admin-portal/src/components/user-avatar.tsx +26 -0
- package/templates/admin-portal/src/components/user-menu.tsx +163 -0
- package/templates/admin-portal/src/config/branding.ts +17 -0
- package/templates/admin-portal/src/config/chart-data.ts +44 -0
- package/templates/admin-portal/src/config/navigation.ts +42 -0
- package/templates/admin-portal/src/context/auth-context.tsx +32 -0
- package/templates/admin-portal/src/lib/breadcrumbs.ts +58 -0
- package/templates/admin-portal/src/main.tsx +18 -0
- package/templates/admin-portal/src/pages/components/demo-columns.tsx +170 -0
- package/templates/admin-portal/src/pages/components.tsx +1368 -0
- package/templates/admin-portal/src/pages/dashboard.tsx +143 -0
- package/templates/admin-portal/src/pages/login.tsx +81 -0
- package/templates/admin-portal/src/pages/settings/notifications.tsx +31 -0
- package/templates/admin-portal/src/pages/settings/profile.tsx +26 -0
- package/templates/admin-portal/src/pages/signup.tsx +81 -0
- package/templates/admin-portal/src/pages/users.tsx +12 -0
- package/templates/admin-portal/tsconfig.json +10 -0
- package/templates/blank/README.md +15 -0
- package/templates/blank/src/App.tsx +5 -0
- package/templates/blank/src/main.tsx +15 -0
- package/templates/blank/src/pages/home.tsx +20 -0
- package/templates/blank/tsconfig.json +10 -0
- package/templates/tsconfig.overlay.base.json +7 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
4
|
+
import { ui } from "@/config/theme";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const Accordion = AccordionPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const AccordionItem = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<AccordionPrimitive.Item ref={ref} className={cn(ui("accordionItem"), className)} {...props} />
|
|
14
|
+
));
|
|
15
|
+
AccordionItem.displayName = "AccordionItem";
|
|
16
|
+
|
|
17
|
+
const AccordionTrigger = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
20
|
+
>(({ className, children, ...props }, ref) => (
|
|
21
|
+
<AccordionPrimitive.Header className="flex">
|
|
22
|
+
<AccordionPrimitive.Trigger
|
|
23
|
+
ref={ref}
|
|
24
|
+
className={cn(ui("accordionTrigger"), className)}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
<ChevronDown className={ui("accordionChevron")} />
|
|
29
|
+
</AccordionPrimitive.Trigger>
|
|
30
|
+
</AccordionPrimitive.Header>
|
|
31
|
+
));
|
|
32
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
33
|
+
|
|
34
|
+
const AccordionContent = React.forwardRef<
|
|
35
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
36
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
37
|
+
>(({ className, children, ...props }, ref) => (
|
|
38
|
+
<AccordionPrimitive.Content ref={ref} className={ui("accordionContent")} {...props}>
|
|
39
|
+
<div className={cn(ui("accordionContentInner"), className)}>{children}</div>
|
|
40
|
+
</AccordionPrimitive.Content>
|
|
41
|
+
));
|
|
42
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
43
|
+
|
|
44
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
3
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
4
|
+
import { ui } from "@/config/theme";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const AlertDialog = AlertDialogPrimitive.Root;
|
|
8
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
9
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
10
|
+
|
|
11
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<AlertDialogPrimitive.Overlay
|
|
16
|
+
className={cn(ui("overlay"), "z-[100]", className)}
|
|
17
|
+
{...props}
|
|
18
|
+
ref={ref}
|
|
19
|
+
/>
|
|
20
|
+
));
|
|
21
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
22
|
+
|
|
23
|
+
const AlertDialogContent = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<AlertDialogPortal>
|
|
28
|
+
<AlertDialogOverlay />
|
|
29
|
+
<AlertDialogPrimitive.Content
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={cn(
|
|
32
|
+
"fixed left-[50%] top-[50%] z-[100] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg sm:rounded-lg",
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
</AlertDialogPortal>
|
|
38
|
+
));
|
|
39
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
40
|
+
|
|
41
|
+
function AlertDialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
42
|
+
return <div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />;
|
|
43
|
+
}
|
|
44
|
+
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
45
|
+
|
|
46
|
+
function AlertDialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
47
|
+
return (
|
|
48
|
+
<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
52
|
+
|
|
53
|
+
const AlertDialogTitle = React.forwardRef<
|
|
54
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
55
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
56
|
+
>(({ className, ...props }, ref) => (
|
|
57
|
+
<AlertDialogPrimitive.Title ref={ref} className={cn("text-lg font-semibold", className)} {...props} />
|
|
58
|
+
));
|
|
59
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
60
|
+
|
|
61
|
+
const AlertDialogDescription = React.forwardRef<
|
|
62
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
63
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
64
|
+
>(({ className, ...props }, ref) => (
|
|
65
|
+
<AlertDialogPrimitive.Description
|
|
66
|
+
ref={ref}
|
|
67
|
+
className={cn(ui("typographyMuted"), className)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
));
|
|
71
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
72
|
+
|
|
73
|
+
const AlertDialogAction = React.forwardRef<
|
|
74
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
75
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
76
|
+
>(({ className, ...props }, ref) => (
|
|
77
|
+
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
78
|
+
));
|
|
79
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
80
|
+
|
|
81
|
+
const AlertDialogCancel = React.forwardRef<
|
|
82
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
83
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
84
|
+
>(({ className, ...props }, ref) => (
|
|
85
|
+
<AlertDialogPrimitive.Cancel
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
));
|
|
91
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
AlertDialog,
|
|
95
|
+
AlertDialogAction,
|
|
96
|
+
AlertDialogCancel,
|
|
97
|
+
AlertDialogContent,
|
|
98
|
+
AlertDialogDescription,
|
|
99
|
+
AlertDialogFooter,
|
|
100
|
+
AlertDialogHeader,
|
|
101
|
+
AlertDialogOverlay,
|
|
102
|
+
AlertDialogPortal,
|
|
103
|
+
AlertDialogTitle,
|
|
104
|
+
AlertDialogTrigger,
|
|
105
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ui } from "@/config/theme";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
const alertVariants = cva(ui("alert"), {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: ui("alertDefault"),
|
|
10
|
+
destructive: ui("alertDestructive"),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
variant: "default",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const Alert = React.forwardRef<
|
|
19
|
+
HTMLDivElement,
|
|
20
|
+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
|
21
|
+
>(({ className, variant, ...props }, ref) => (
|
|
22
|
+
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
|
|
23
|
+
));
|
|
24
|
+
Alert.displayName = "Alert";
|
|
25
|
+
|
|
26
|
+
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
27
|
+
({ className, ...props }, ref) => (
|
|
28
|
+
<h5 ref={ref} className={cn("mb-1 font-medium leading-none tracking-tight", className)} {...props} />
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
AlertTitle.displayName = "AlertTitle";
|
|
32
|
+
|
|
33
|
+
const AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
|
34
|
+
({ className, ...props }, ref) => (
|
|
35
|
+
<div ref={ref} className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} />
|
|
36
|
+
),
|
|
37
|
+
);
|
|
38
|
+
AlertDescription.displayName = "AlertDescription";
|
|
39
|
+
|
|
40
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3
|
+
import { ui } from "@/config/theme";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
const Avatar = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<AvatarPrimitive.Root ref={ref} className={cn(ui("avatarRoot"), className)} {...props} />
|
|
11
|
+
));
|
|
12
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
13
|
+
|
|
14
|
+
const AvatarImage = React.forwardRef<
|
|
15
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
16
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
17
|
+
>(({ className, ...props }, ref) => (
|
|
18
|
+
<AvatarPrimitive.Image ref={ref} className={cn("aspect-square h-full w-full object-cover", className)} {...props} />
|
|
19
|
+
));
|
|
20
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
21
|
+
|
|
22
|
+
const AvatarFallback = React.forwardRef<
|
|
23
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
24
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
25
|
+
>(({ className, ...props }, ref) => (
|
|
26
|
+
<AvatarPrimitive.Fallback ref={ref} className={cn(ui("avatarFallback"), className)} {...props} />
|
|
27
|
+
));
|
|
28
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
29
|
+
|
|
30
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ui } from "@/config/theme";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(ui("badge"), {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: ui("badgeDefault"),
|
|
10
|
+
brand: ui("badgeBrand"),
|
|
11
|
+
secondary: ui("badgeSecondary"),
|
|
12
|
+
destructive: ui("badgeDestructive"),
|
|
13
|
+
outline: ui("badgeOutline"),
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "default",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
|
22
|
+
|
|
23
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
24
|
+
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Bar, BarChart as RechartsBarChart, CartesianGrid, XAxis, YAxis } from "recharts";
|
|
2
|
+
import {
|
|
3
|
+
ChartContainer,
|
|
4
|
+
ChartLegend,
|
|
5
|
+
ChartLegendContent,
|
|
6
|
+
ChartTooltip,
|
|
7
|
+
ChartTooltipContent,
|
|
8
|
+
type ChartConfig,
|
|
9
|
+
} from "@/components/ui/chart";
|
|
10
|
+
import { cn } from "@/lib/utils";
|
|
11
|
+
|
|
12
|
+
export type BarChartDataPoint = Record<string, string | number>;
|
|
13
|
+
|
|
14
|
+
type BarChartProps = {
|
|
15
|
+
data: BarChartDataPoint[];
|
|
16
|
+
config: ChartConfig;
|
|
17
|
+
dataKeys: string[];
|
|
18
|
+
categoryKey: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
showLegend?: boolean;
|
|
21
|
+
layout?: "horizontal" | "vertical";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function BarChart({
|
|
25
|
+
data,
|
|
26
|
+
config,
|
|
27
|
+
dataKeys,
|
|
28
|
+
categoryKey,
|
|
29
|
+
className,
|
|
30
|
+
showLegend = true,
|
|
31
|
+
layout = "horizontal",
|
|
32
|
+
}: BarChartProps) {
|
|
33
|
+
const isVertical = layout === "vertical";
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ChartContainer config={config} className={cn("aspect-auto h-[300px] w-full", className)}>
|
|
37
|
+
<RechartsBarChart
|
|
38
|
+
accessibilityLayer
|
|
39
|
+
data={data}
|
|
40
|
+
layout={isVertical ? "vertical" : "horizontal"}
|
|
41
|
+
margin={{ left: 12, right: 12, top: 12, bottom: 0 }}
|
|
42
|
+
>
|
|
43
|
+
<CartesianGrid vertical={false} strokeDasharray="3 3" />
|
|
44
|
+
{isVertical ? (
|
|
45
|
+
<>
|
|
46
|
+
<XAxis type="number" tickLine={false} axisLine={false} tickMargin={8} />
|
|
47
|
+
<YAxis
|
|
48
|
+
dataKey={categoryKey}
|
|
49
|
+
type="category"
|
|
50
|
+
tickLine={false}
|
|
51
|
+
axisLine={false}
|
|
52
|
+
tickMargin={8}
|
|
53
|
+
width={80}
|
|
54
|
+
/>
|
|
55
|
+
</>
|
|
56
|
+
) : (
|
|
57
|
+
<>
|
|
58
|
+
<XAxis
|
|
59
|
+
dataKey={categoryKey}
|
|
60
|
+
tickLine={false}
|
|
61
|
+
tickMargin={10}
|
|
62
|
+
axisLine={false}
|
|
63
|
+
tickFormatter={(value) => String(value).slice(0, 3)}
|
|
64
|
+
/>
|
|
65
|
+
<YAxis tickLine={false} axisLine={false} tickMargin={8} />
|
|
66
|
+
</>
|
|
67
|
+
)}
|
|
68
|
+
<ChartTooltip cursor={false} content={<ChartTooltipContent indicator="dashed" />} />
|
|
69
|
+
{showLegend && <ChartLegend content={<ChartLegendContent />} />}
|
|
70
|
+
{dataKeys.map((key) => (
|
|
71
|
+
<Bar key={key} dataKey={key} fill={`var(--color-${key})`} radius={[4, 4, 0, 0]} />
|
|
72
|
+
))}
|
|
73
|
+
</RechartsBarChart>
|
|
74
|
+
</ChartContainer>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
4
|
+
import { ui } from "@/config/theme";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const Breadcrumb = React.forwardRef<
|
|
8
|
+
HTMLElement,
|
|
9
|
+
React.ComponentPropsWithoutRef<"nav"> & {
|
|
10
|
+
separator?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
|
|
13
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
14
|
+
|
|
15
|
+
const BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<"ol">>(
|
|
16
|
+
({ className, ...props }, ref) => (
|
|
17
|
+
<ol ref={ref} className={cn(ui("breadcrumbList"), className)} {...props} />
|
|
18
|
+
),
|
|
19
|
+
);
|
|
20
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
21
|
+
|
|
22
|
+
const BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<"li">>(
|
|
23
|
+
({ className, ...props }, ref) => (
|
|
24
|
+
<li ref={ref} className={cn("inline-flex items-center gap-1.5", className)} {...props} />
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
28
|
+
|
|
29
|
+
const BreadcrumbLink = React.forwardRef<
|
|
30
|
+
HTMLAnchorElement,
|
|
31
|
+
React.ComponentPropsWithoutRef<"a"> & {
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
}
|
|
34
|
+
>(({ asChild, className, ...props }, ref) => {
|
|
35
|
+
const Comp = asChild ? Slot : "a";
|
|
36
|
+
|
|
37
|
+
return <Comp ref={ref} className={cn(ui("breadcrumbLink"), className)} {...props} />;
|
|
38
|
+
});
|
|
39
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
40
|
+
|
|
41
|
+
const BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<"span">>(
|
|
42
|
+
({ className, ...props }, ref) => (
|
|
43
|
+
<span
|
|
44
|
+
ref={ref}
|
|
45
|
+
role="link"
|
|
46
|
+
aria-disabled="true"
|
|
47
|
+
aria-current="page"
|
|
48
|
+
className={cn(ui("breadcrumbPage"), className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
),
|
|
52
|
+
);
|
|
53
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
54
|
+
|
|
55
|
+
function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">) {
|
|
56
|
+
return (
|
|
57
|
+
<li role="presentation" aria-hidden="true" className={cn("[&>svg]:size-3.5", className)} {...props}>
|
|
58
|
+
{children ?? <ChevronRight />}
|
|
59
|
+
</li>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
63
|
+
|
|
64
|
+
function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">) {
|
|
65
|
+
return (
|
|
66
|
+
<span
|
|
67
|
+
role="presentation"
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
className={cn("flex h-9 w-9 items-center justify-center", className)}
|
|
70
|
+
{...props}
|
|
71
|
+
>
|
|
72
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
73
|
+
<span className="sr-only">More</span>
|
|
74
|
+
</span>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
Breadcrumb,
|
|
81
|
+
BreadcrumbEllipsis,
|
|
82
|
+
BreadcrumbItem,
|
|
83
|
+
BreadcrumbLink,
|
|
84
|
+
BreadcrumbList,
|
|
85
|
+
BreadcrumbPage,
|
|
86
|
+
BreadcrumbSeparator,
|
|
87
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
import { ui } from "@/config/theme";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(ui("buttonBase"), {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: ui("buttonDefault"),
|
|
11
|
+
brand: ui("buttonBrand"),
|
|
12
|
+
destructive: ui("buttonDestructive"),
|
|
13
|
+
outline: ui("buttonOutline"),
|
|
14
|
+
},
|
|
15
|
+
size: { default: "h-10 px-4 py-2", sm: "h-9 px-3" },
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { variant: "default", size: "default" },
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export interface ButtonProps
|
|
21
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
22
|
+
VariantProps<typeof buttonVariants> {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
27
|
+
({ 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
|
+
);
|
|
32
|
+
Button.displayName = "Button";
|
|
33
|
+
|
|
34
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { DayPicker } from "react-day-picker";
|
|
4
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
5
|
+
import { ui } from "@/config/theme";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
|
|
8
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
|
|
9
|
+
|
|
10
|
+
function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) {
|
|
11
|
+
return (
|
|
12
|
+
<DayPicker
|
|
13
|
+
showOutsideDays={showOutsideDays}
|
|
14
|
+
className={cn("p-3", className)}
|
|
15
|
+
classNames={{
|
|
16
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
17
|
+
month: "space-y-4",
|
|
18
|
+
caption: "flex justify-center pt-1 relative items-center",
|
|
19
|
+
caption_label: "text-sm font-medium",
|
|
20
|
+
nav: "space-x-1 flex items-center",
|
|
21
|
+
nav_button: cn(
|
|
22
|
+
buttonVariants({ variant: "outline" }),
|
|
23
|
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
|
|
24
|
+
),
|
|
25
|
+
nav_button_previous: "absolute left-1",
|
|
26
|
+
nav_button_next: "absolute right-1",
|
|
27
|
+
table: "w-full border-collapse space-y-1",
|
|
28
|
+
head_row: "flex",
|
|
29
|
+
head_cell: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
|
|
30
|
+
row: "flex w-full mt-2",
|
|
31
|
+
cell: cn(
|
|
32
|
+
"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent",
|
|
33
|
+
props.mode === "range"
|
|
34
|
+
? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
|
|
35
|
+
: "[&:has([aria-selected])]:rounded-md",
|
|
36
|
+
),
|
|
37
|
+
day: cn(buttonVariants({ variant: "outline" }), "h-8 w-8 p-0 font-normal aria-selected:opacity-100"),
|
|
38
|
+
day_range_start: "day-range-start",
|
|
39
|
+
day_range_end: "day-range-end",
|
|
40
|
+
day_selected: ui("calendarDaySelected"),
|
|
41
|
+
day_today: "bg-accent text-accent-foreground",
|
|
42
|
+
day_outside:
|
|
43
|
+
"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
|
|
44
|
+
day_disabled: "text-muted-foreground opacity-50",
|
|
45
|
+
day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
|
|
46
|
+
day_hidden: "invisible",
|
|
47
|
+
...classNames,
|
|
48
|
+
}}
|
|
49
|
+
components={{
|
|
50
|
+
IconLeft: ({ className: iconClassName, ...iconProps }) => (
|
|
51
|
+
<ChevronLeft className={cn("h-4 w-4", iconClassName)} {...iconProps} />
|
|
52
|
+
),
|
|
53
|
+
IconRight: ({ className: iconClassName, ...iconProps }) => (
|
|
54
|
+
<ChevronRight className={cn("h-4 w-4", iconClassName)} {...iconProps} />
|
|
55
|
+
),
|
|
56
|
+
}}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
Calendar.displayName = "Calendar";
|
|
62
|
+
|
|
63
|
+
export { Calendar };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ui } from "@/config/theme";
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
export const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
6
|
+
({ className, ...props }, ref) => (
|
|
7
|
+
<div ref={ref} className={cn(ui("card"), className)} {...props} />
|
|
8
|
+
),
|
|
9
|
+
);
|
|
10
|
+
Card.displayName = "Card";
|
|
11
|
+
|
|
12
|
+
export const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
13
|
+
({ className, ...props }, ref) => (
|
|
14
|
+
<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
|
|
15
|
+
),
|
|
16
|
+
);
|
|
17
|
+
CardHeader.displayName = "CardHeader";
|
|
18
|
+
|
|
19
|
+
export const CardTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
20
|
+
({ className, ...props }, ref) => (
|
|
21
|
+
<h3 ref={ref} className={cn("text-xl font-semibold leading-none tracking-tight", className)} {...props} />
|
|
22
|
+
),
|
|
23
|
+
);
|
|
24
|
+
CardTitle.displayName = "CardTitle";
|
|
25
|
+
|
|
26
|
+
export const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
|
27
|
+
({ className, ...props }, ref) => (
|
|
28
|
+
<p ref={ref} className={cn(ui("cardDescription"), className)} {...props} />
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
CardDescription.displayName = "CardDescription";
|
|
32
|
+
|
|
33
|
+
export const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
34
|
+
({ className, ...props }, ref) => <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />,
|
|
35
|
+
);
|
|
36
|
+
CardContent.displayName = "CardContent";
|