@promakeai/cli 0.0.5

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.
Files changed (285) hide show
  1. package/dist/index.js +212 -0
  2. package/dist/registry/about-page.json +45 -0
  3. package/dist/registry/about-section.json +40 -0
  4. package/dist/registry/animations.json +69 -0
  5. package/dist/registry/bento-grid-section.json +42 -0
  6. package/dist/registry/blog-core.json +74 -0
  7. package/dist/registry/blog-list-page.json +48 -0
  8. package/dist/registry/blog-section.json +43 -0
  9. package/dist/registry/cards-carousel-section.json +46 -0
  10. package/dist/registry/cart-drawer.json +43 -0
  11. package/dist/registry/cart-page.json +47 -0
  12. package/dist/registry/category-section.json +43 -0
  13. package/dist/registry/checkout-page.json +47 -0
  14. package/dist/registry/contact-info-grid.json +40 -0
  15. package/dist/registry/contact-page-centered.json +50 -0
  16. package/dist/registry/contact-page-map-overlay.json +54 -0
  17. package/dist/registry/contact-page-map-split.json +54 -0
  18. package/dist/registry/contact-page-split.json +49 -0
  19. package/dist/registry/contact-page.json +45 -0
  20. package/dist/registry/content-section.json +40 -0
  21. package/dist/registry/cookies-page.json +45 -0
  22. package/dist/registry/cta-section.json +40 -0
  23. package/dist/registry/docs/about-page.md +32 -0
  24. package/dist/registry/docs/about-section.md +33 -0
  25. package/dist/registry/docs/animations.md +44 -0
  26. package/dist/registry/docs/bento-grid-section.md +40 -0
  27. package/dist/registry/docs/blog-core.md +37 -0
  28. package/dist/registry/docs/blog-list-page.md +38 -0
  29. package/dist/registry/docs/blog-section.md +39 -0
  30. package/dist/registry/docs/cards-carousel-section.md +39 -0
  31. package/dist/registry/docs/cart-drawer.md +42 -0
  32. package/dist/registry/docs/cart-page.md +37 -0
  33. package/dist/registry/docs/category-section.md +34 -0
  34. package/dist/registry/docs/checkout-page.md +38 -0
  35. package/dist/registry/docs/contact-info-grid.md +33 -0
  36. package/dist/registry/docs/contact-page-centered.md +41 -0
  37. package/dist/registry/docs/contact-page-map-overlay.md +44 -0
  38. package/dist/registry/docs/contact-page-map-split.md +44 -0
  39. package/dist/registry/docs/contact-page-split.md +40 -0
  40. package/dist/registry/docs/contact-page.md +33 -0
  41. package/dist/registry/docs/content-section.md +35 -0
  42. package/dist/registry/docs/cookies-page.md +32 -0
  43. package/dist/registry/docs/cta-section.md +32 -0
  44. package/dist/registry/docs/ecommerce-core.md +41 -0
  45. package/dist/registry/docs/empty-page.md +31 -0
  46. package/dist/registry/docs/faq-categorized.md +38 -0
  47. package/dist/registry/docs/faq-simple.md +38 -0
  48. package/dist/registry/docs/favorites-blog-block.md +38 -0
  49. package/dist/registry/docs/favorites-ecommerce-block.md +38 -0
  50. package/dist/registry/docs/feature-section.md +33 -0
  51. package/dist/registry/docs/featured-products.md +38 -0
  52. package/dist/registry/docs/footer-detailed.md +33 -0
  53. package/dist/registry/docs/footer-minimal.md +32 -0
  54. package/dist/registry/docs/footer.md +32 -0
  55. package/dist/registry/docs/google-map.md +36 -0
  56. package/dist/registry/docs/header-centered-pill.md +37 -0
  57. package/dist/registry/docs/header-ecommerce.md +38 -0
  58. package/dist/registry/docs/header-mega.md +40 -0
  59. package/dist/registry/docs/header-minimal.md +38 -0
  60. package/dist/registry/docs/header-simple.md +32 -0
  61. package/dist/registry/docs/hero-cta.md +38 -0
  62. package/dist/registry/docs/hero-gradient.md +33 -0
  63. package/dist/registry/docs/hero-grid.md +40 -0
  64. package/dist/registry/docs/hero-profile.md +33 -0
  65. package/dist/registry/docs/hero.md +32 -0
  66. package/dist/registry/docs/login-page-split.md +40 -0
  67. package/dist/registry/docs/login-page.md +39 -0
  68. package/dist/registry/docs/newsletter-section.md +40 -0
  69. package/dist/registry/docs/order-card-compact.md +37 -0
  70. package/dist/registry/docs/order-detail-block.md +37 -0
  71. package/dist/registry/docs/orders-list-block.md +40 -0
  72. package/dist/registry/docs/payment-success-block.md +32 -0
  73. package/dist/registry/docs/post-card.md +37 -0
  74. package/dist/registry/docs/post-detail-block.md +37 -0
  75. package/dist/registry/docs/pricing-card.md +37 -0
  76. package/dist/registry/docs/pricing-section.md +39 -0
  77. package/dist/registry/docs/privacy-page.md +32 -0
  78. package/dist/registry/docs/product-card-detailed.md +42 -0
  79. package/dist/registry/docs/product-card-hover.md +35 -0
  80. package/dist/registry/docs/product-card.md +37 -0
  81. package/dist/registry/docs/product-detail-block.md +37 -0
  82. package/dist/registry/docs/product-detail-section.md +45 -0
  83. package/dist/registry/docs/products-page.md +39 -0
  84. package/dist/registry/docs/related-posts-block.md +38 -0
  85. package/dist/registry/docs/related-products-block.md +38 -0
  86. package/dist/registry/docs/service-card.md +34 -0
  87. package/dist/registry/docs/skill-card.md +33 -0
  88. package/dist/registry/docs/terms-page.md +32 -0
  89. package/dist/registry/docs/testimonials-carousel.md +40 -0
  90. package/dist/registry/docs/testimonials-grid.md +39 -0
  91. package/dist/registry/ecommerce-core.json +95 -0
  92. package/dist/registry/empty-page.json +45 -0
  93. package/dist/registry/faq-categorized.json +42 -0
  94. package/dist/registry/faq-simple.json +42 -0
  95. package/dist/registry/favorites-blog-block.json +43 -0
  96. package/dist/registry/favorites-ecommerce-block.json +43 -0
  97. package/dist/registry/feature-section.json +40 -0
  98. package/dist/registry/featured-products.json +43 -0
  99. package/dist/registry/footer-detailed.json +43 -0
  100. package/dist/registry/footer-minimal.json +40 -0
  101. package/dist/registry/footer.json +40 -0
  102. package/dist/registry/google-map.json +31 -0
  103. package/dist/registry/header-centered-pill.json +45 -0
  104. package/dist/registry/header-ecommerce.json +42 -0
  105. package/dist/registry/header-mega.json +47 -0
  106. package/dist/registry/header-minimal.json +45 -0
  107. package/dist/registry/header-simple.json +43 -0
  108. package/dist/registry/hero-cta.json +42 -0
  109. package/dist/registry/hero-gradient.json +40 -0
  110. package/dist/registry/hero-grid.json +42 -0
  111. package/dist/registry/hero-profile.json +62 -0
  112. package/dist/registry/hero.json +40 -0
  113. package/dist/registry/index.json +70 -0
  114. package/dist/registry/login-page-split.json +47 -0
  115. package/dist/registry/login-page.json +49 -0
  116. package/dist/registry/newsletter-section.json +44 -0
  117. package/dist/registry/order-card-compact.json +42 -0
  118. package/dist/registry/order-detail-block.json +42 -0
  119. package/dist/registry/orders-list-block.json +45 -0
  120. package/dist/registry/payment-success-block.json +40 -0
  121. package/dist/registry/post-card.json +42 -0
  122. package/dist/registry/post-detail-block.json +42 -0
  123. package/dist/registry/pricing-card.json +40 -0
  124. package/dist/registry/pricing-section.json +43 -0
  125. package/dist/registry/privacy-page.json +45 -0
  126. package/dist/registry/product-card-detailed.json +45 -0
  127. package/dist/registry/product-card-hover.json +40 -0
  128. package/dist/registry/product-card.json +42 -0
  129. package/dist/registry/product-detail-block.json +42 -0
  130. package/dist/registry/product-detail-section.json +46 -0
  131. package/dist/registry/products-page.json +48 -0
  132. package/dist/registry/related-posts-block.json +43 -0
  133. package/dist/registry/related-products-block.json +43 -0
  134. package/dist/registry/service-card.json +28 -0
  135. package/dist/registry/skill-card.json +28 -0
  136. package/dist/registry/terms-page.json +45 -0
  137. package/dist/registry/testimonials-carousel.json +44 -0
  138. package/dist/registry/testimonials-grid.json +43 -0
  139. package/package.json +52 -0
  140. package/template/.env +6 -0
  141. package/template/.prettierignore +3 -0
  142. package/template/.prettierrc +1 -0
  143. package/template/README.md +73 -0
  144. package/template/bun.lock +1007 -0
  145. package/template/components.json +22 -0
  146. package/template/eslint.config.js +32 -0
  147. package/template/index.html +285 -0
  148. package/template/package.json +92 -0
  149. package/template/promake.json +6 -0
  150. package/template/public/_redirects +1 -0
  151. package/template/public/data/database.db +0 -0
  152. package/template/public/favicon.svg +1 -0
  153. package/template/public/images/placeholder.png +0 -0
  154. package/template/public/robots.txt +14 -0
  155. package/template/scripts/init-db.ts +131 -0
  156. package/template/src/App.tsx +33 -0
  157. package/template/src/components/Footer.tsx +100 -0
  158. package/template/src/components/Header.tsx +79 -0
  159. package/template/src/components/Hero.tsx +69 -0
  160. package/template/src/components/LanguageSwitcher.tsx +47 -0
  161. package/template/src/components/Layout.tsx +25 -0
  162. package/template/src/components/Logo.tsx +64 -0
  163. package/template/src/components/ThemeSwitcher.tsx +58 -0
  164. package/template/src/components/ui/accordion.tsx +64 -0
  165. package/template/src/components/ui/alert-dialog.tsx +155 -0
  166. package/template/src/components/ui/alert.tsx +66 -0
  167. package/template/src/components/ui/aspect-ratio.tsx +11 -0
  168. package/template/src/components/ui/avatar.tsx +51 -0
  169. package/template/src/components/ui/badge.tsx +46 -0
  170. package/template/src/components/ui/breadcrumb.tsx +109 -0
  171. package/template/src/components/ui/button-group.tsx +83 -0
  172. package/template/src/components/ui/button.tsx +62 -0
  173. package/template/src/components/ui/calendar.tsx +220 -0
  174. package/template/src/components/ui/card.tsx +92 -0
  175. package/template/src/components/ui/carousel.tsx +239 -0
  176. package/template/src/components/ui/chart.tsx +357 -0
  177. package/template/src/components/ui/checkbox.tsx +32 -0
  178. package/template/src/components/ui/collapsible.tsx +31 -0
  179. package/template/src/components/ui/command.tsx +182 -0
  180. package/template/src/components/ui/context-menu.tsx +252 -0
  181. package/template/src/components/ui/dialog.tsx +141 -0
  182. package/template/src/components/ui/drawer.tsx +135 -0
  183. package/template/src/components/ui/dropdown-menu.tsx +255 -0
  184. package/template/src/components/ui/empty.tsx +104 -0
  185. package/template/src/components/ui/field.tsx +246 -0
  186. package/template/src/components/ui/form.tsx +168 -0
  187. package/template/src/components/ui/hover-card.tsx +44 -0
  188. package/template/src/components/ui/input-group.tsx +170 -0
  189. package/template/src/components/ui/input-otp.tsx +75 -0
  190. package/template/src/components/ui/input.tsx +21 -0
  191. package/template/src/components/ui/item.tsx +193 -0
  192. package/template/src/components/ui/kbd.tsx +28 -0
  193. package/template/src/components/ui/label.tsx +24 -0
  194. package/template/src/components/ui/menubar.tsx +274 -0
  195. package/template/src/components/ui/navigation-menu.tsx +168 -0
  196. package/template/src/components/ui/pagination.tsx +127 -0
  197. package/template/src/components/ui/popover.tsx +48 -0
  198. package/template/src/components/ui/progress.tsx +29 -0
  199. package/template/src/components/ui/radio-group.tsx +45 -0
  200. package/template/src/components/ui/resizable.tsx +54 -0
  201. package/template/src/components/ui/scroll-area.tsx +58 -0
  202. package/template/src/components/ui/select.tsx +188 -0
  203. package/template/src/components/ui/separator.tsx +28 -0
  204. package/template/src/components/ui/sheet.tsx +137 -0
  205. package/template/src/components/ui/sidebar.tsx +726 -0
  206. package/template/src/components/ui/skeleton.tsx +13 -0
  207. package/template/src/components/ui/slider.tsx +63 -0
  208. package/template/src/components/ui/sonner.tsx +38 -0
  209. package/template/src/components/ui/spinner.tsx +16 -0
  210. package/template/src/components/ui/switch.tsx +31 -0
  211. package/template/src/components/ui/table.tsx +114 -0
  212. package/template/src/components/ui/tabs.tsx +66 -0
  213. package/template/src/components/ui/textarea.tsx +18 -0
  214. package/template/src/components/ui/toggle-group.tsx +81 -0
  215. package/template/src/components/ui/toggle.tsx +45 -0
  216. package/template/src/components/ui/tooltip.tsx +61 -0
  217. package/template/src/constants/constants.json +58 -0
  218. package/template/src/hooks/use-is-mobile.ts +21 -0
  219. package/template/src/hooks/use-page-title.ts +49 -0
  220. package/template/src/hooks/use-theme.ts +57 -0
  221. package/template/src/index.css +128 -0
  222. package/template/src/lang/en/about.json +4 -0
  223. package/template/src/lang/en/contact.json +39 -0
  224. package/template/src/lang/en/cookies.json +4 -0
  225. package/template/src/lang/en/footer.json +12 -0
  226. package/template/src/lang/en/forgotPassword.json +37 -0
  227. package/template/src/lang/en/header.json +10 -0
  228. package/template/src/lang/en/hero.json +8 -0
  229. package/template/src/lang/en/index.json +30 -0
  230. package/template/src/lang/en/login.json +18 -0
  231. package/template/src/lang/en/notfound.json +7 -0
  232. package/template/src/lang/en/privacy.json +4 -0
  233. package/template/src/lang/en/register.json +25 -0
  234. package/template/src/lang/en/terms.json +4 -0
  235. package/template/src/lang/index.ts +86 -0
  236. package/template/src/lang/tr/about.json +4 -0
  237. package/template/src/lang/tr/contact.json +39 -0
  238. package/template/src/lang/tr/cookies.json +4 -0
  239. package/template/src/lang/tr/footer.json +12 -0
  240. package/template/src/lang/tr/forgotPassword.json +37 -0
  241. package/template/src/lang/tr/header.json +10 -0
  242. package/template/src/lang/tr/hero.json +8 -0
  243. package/template/src/lang/tr/index.json +30 -0
  244. package/template/src/lang/tr/login.json +18 -0
  245. package/template/src/lang/tr/notfound.json +7 -0
  246. package/template/src/lang/tr/privacy.json +4 -0
  247. package/template/src/lang/tr/register.json +25 -0
  248. package/template/src/lang/tr/terms.json +4 -0
  249. package/template/src/lib/api.ts +237 -0
  250. package/template/src/lib/storage.ts +109 -0
  251. package/template/src/lib/utils.ts +15 -0
  252. package/template/src/main.tsx +13 -0
  253. package/template/src/modules/api/USAGE.md +515 -0
  254. package/template/src/modules/api/customer-client.ts +20 -0
  255. package/template/src/modules/api/get-error-message.ts +18 -0
  256. package/template/src/modules/api/validation/en.json +29 -0
  257. package/template/src/modules/api/validation/tr.json +29 -0
  258. package/template/src/modules/auth/USAGE.md +248 -0
  259. package/template/src/modules/auth/auth-header-menu.tsx +123 -0
  260. package/template/src/modules/auth/auth-store.ts +57 -0
  261. package/template/src/modules/auth/forgot-password-page.tsx +371 -0
  262. package/template/src/modules/auth/login-page.tsx +183 -0
  263. package/template/src/modules/auth/register-page.tsx +252 -0
  264. package/template/src/modules/auth/use-auth.ts +273 -0
  265. package/template/src/modules/db/adapters/IDataAdapter.ts +26 -0
  266. package/template/src/modules/db/adapters/SqliteAdapter.ts +364 -0
  267. package/template/src/modules/db/adapters/index.ts +2 -0
  268. package/template/src/modules/db/config.ts +59 -0
  269. package/template/src/modules/db/core/DataManager.ts +125 -0
  270. package/template/src/modules/db/core/types.ts +101 -0
  271. package/template/src/modules/db/index.ts +42 -0
  272. package/template/src/modules/db/react/QueryProvider.tsx +16 -0
  273. package/template/src/modules/db/react/index.ts +23 -0
  274. package/template/src/modules/db/react/queryClient.ts +64 -0
  275. package/template/src/modules/db/react/useRepository.ts +400 -0
  276. package/template/src/modules/db/utils/parsers.ts +96 -0
  277. package/template/src/pages/Index.tsx +108 -0
  278. package/template/src/pages/NotFound.tsx +35 -0
  279. package/template/src/router.tsx +14 -0
  280. package/template/src/types/index.ts +0 -0
  281. package/template/src/vite-env.d.ts +1 -0
  282. package/template/tsconfig.app.json +32 -0
  283. package/template/tsconfig.json +17 -0
  284. package/template/tsconfig.node.json +26 -0
  285. package/template/vite.config.ts +74 -0
@@ -0,0 +1,92 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ data-slot="card"
9
+ className={cn(
10
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
+ className,
12
+ )}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <div
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
24
+ className,
25
+ )}
26
+ {...props}
27
+ />
28
+ );
29
+ }
30
+
31
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn("leading-none font-semibold", className)}
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
43
+ <div
44
+ data-slot="card-description"
45
+ className={cn("text-muted-foreground text-sm", className)}
46
+ {...props}
47
+ />
48
+ );
49
+ }
50
+
51
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
+ className,
58
+ )}
59
+ {...props}
60
+ />
61
+ );
62
+ }
63
+
64
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn("px-6", className)}
69
+ {...props}
70
+ />
71
+ );
72
+ }
73
+
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
79
+ {...props}
80
+ />
81
+ );
82
+ }
83
+
84
+ export {
85
+ Card,
86
+ CardHeader,
87
+ CardFooter,
88
+ CardTitle,
89
+ CardAction,
90
+ CardDescription,
91
+ CardContent,
92
+ };
@@ -0,0 +1,239 @@
1
+ import * as React from "react";
2
+ import useEmblaCarousel, {
3
+ type UseEmblaCarouselType,
4
+ } from "embla-carousel-react";
5
+ import { ArrowLeft, ArrowRight } from "lucide-react";
6
+
7
+ import { cn } from "@/lib/utils";
8
+ import { Button } from "@/components/ui/button";
9
+
10
+ type CarouselApi = UseEmblaCarouselType[1];
11
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
12
+ type CarouselOptions = UseCarouselParameters[0];
13
+ type CarouselPlugin = UseCarouselParameters[1];
14
+
15
+ type CarouselProps = {
16
+ opts?: CarouselOptions;
17
+ plugins?: CarouselPlugin;
18
+ orientation?: "horizontal" | "vertical";
19
+ setApi?: (api: CarouselApi) => void;
20
+ };
21
+
22
+ type CarouselContextProps = {
23
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0];
24
+ api: ReturnType<typeof useEmblaCarousel>[1];
25
+ scrollPrev: () => void;
26
+ scrollNext: () => void;
27
+ canScrollPrev: boolean;
28
+ canScrollNext: boolean;
29
+ } & CarouselProps;
30
+
31
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null);
32
+
33
+ function useCarousel() {
34
+ const context = React.useContext(CarouselContext);
35
+
36
+ if (!context) {
37
+ throw new Error("useCarousel must be used within a <Carousel />");
38
+ }
39
+
40
+ return context;
41
+ }
42
+
43
+ function Carousel({
44
+ orientation = "horizontal",
45
+ opts,
46
+ setApi,
47
+ plugins,
48
+ className,
49
+ children,
50
+ ...props
51
+ }: React.ComponentProps<"div"> & CarouselProps) {
52
+ const [carouselRef, api] = useEmblaCarousel(
53
+ {
54
+ ...opts,
55
+ axis: orientation === "horizontal" ? "x" : "y",
56
+ },
57
+ plugins,
58
+ );
59
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
60
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
61
+
62
+ const onSelect = React.useCallback((api: CarouselApi) => {
63
+ if (!api) return;
64
+ setCanScrollPrev(api.canScrollPrev());
65
+ setCanScrollNext(api.canScrollNext());
66
+ }, []);
67
+
68
+ const scrollPrev = React.useCallback(() => {
69
+ api?.scrollPrev();
70
+ }, [api]);
71
+
72
+ const scrollNext = React.useCallback(() => {
73
+ api?.scrollNext();
74
+ }, [api]);
75
+
76
+ const handleKeyDown = React.useCallback(
77
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
78
+ if (event.key === "ArrowLeft") {
79
+ event.preventDefault();
80
+ scrollPrev();
81
+ } else if (event.key === "ArrowRight") {
82
+ event.preventDefault();
83
+ scrollNext();
84
+ }
85
+ },
86
+ [scrollPrev, scrollNext],
87
+ );
88
+
89
+ React.useEffect(() => {
90
+ if (!api || !setApi) return;
91
+ setApi(api);
92
+ }, [api, setApi]);
93
+
94
+ React.useEffect(() => {
95
+ if (!api) return;
96
+ onSelect(api);
97
+ api.on("reInit", onSelect);
98
+ api.on("select", onSelect);
99
+
100
+ return () => {
101
+ api?.off("select", onSelect);
102
+ };
103
+ }, [api, onSelect]);
104
+
105
+ return (
106
+ <CarouselContext.Provider
107
+ value={{
108
+ carouselRef,
109
+ api: api,
110
+ opts,
111
+ orientation:
112
+ orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
113
+ scrollPrev,
114
+ scrollNext,
115
+ canScrollPrev,
116
+ canScrollNext,
117
+ }}
118
+ >
119
+ <div
120
+ onKeyDownCapture={handleKeyDown}
121
+ className={cn("relative", className)}
122
+ role="region"
123
+ aria-roledescription="carousel"
124
+ data-slot="carousel"
125
+ {...props}
126
+ >
127
+ {children}
128
+ </div>
129
+ </CarouselContext.Provider>
130
+ );
131
+ }
132
+
133
+ function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
134
+ const { carouselRef, orientation } = useCarousel();
135
+
136
+ return (
137
+ <div
138
+ ref={carouselRef}
139
+ className="overflow-hidden"
140
+ data-slot="carousel-content"
141
+ >
142
+ <div
143
+ className={cn(
144
+ "flex",
145
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
146
+ className,
147
+ )}
148
+ {...props}
149
+ />
150
+ </div>
151
+ );
152
+ }
153
+
154
+ function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
155
+ const { orientation } = useCarousel();
156
+
157
+ return (
158
+ <div
159
+ role="group"
160
+ aria-roledescription="slide"
161
+ data-slot="carousel-item"
162
+ className={cn(
163
+ "min-w-0 shrink-0 grow-0 basis-full",
164
+ orientation === "horizontal" ? "pl-4" : "pt-4",
165
+ className,
166
+ )}
167
+ {...props}
168
+ />
169
+ );
170
+ }
171
+
172
+ function CarouselPrevious({
173
+ className,
174
+ variant = "outline",
175
+ size = "icon",
176
+ ...props
177
+ }: React.ComponentProps<typeof Button>) {
178
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
179
+
180
+ return (
181
+ <Button
182
+ data-slot="carousel-previous"
183
+ variant={variant}
184
+ size={size}
185
+ className={cn(
186
+ "absolute size-8 rounded-full",
187
+ orientation === "horizontal"
188
+ ? "top-1/2 -left-12 -translate-y-1/2"
189
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
190
+ className,
191
+ )}
192
+ disabled={!canScrollPrev}
193
+ onClick={scrollPrev}
194
+ {...props}
195
+ >
196
+ <ArrowLeft />
197
+ <span className="sr-only">Previous slide</span>
198
+ </Button>
199
+ );
200
+ }
201
+
202
+ function CarouselNext({
203
+ className,
204
+ variant = "outline",
205
+ size = "icon",
206
+ ...props
207
+ }: React.ComponentProps<typeof Button>) {
208
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
209
+
210
+ return (
211
+ <Button
212
+ data-slot="carousel-next"
213
+ variant={variant}
214
+ size={size}
215
+ className={cn(
216
+ "absolute size-8 rounded-full",
217
+ orientation === "horizontal"
218
+ ? "top-1/2 -right-12 -translate-y-1/2"
219
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
220
+ className,
221
+ )}
222
+ disabled={!canScrollNext}
223
+ onClick={scrollNext}
224
+ {...props}
225
+ >
226
+ <ArrowRight />
227
+ <span className="sr-only">Next slide</span>
228
+ </Button>
229
+ );
230
+ }
231
+
232
+ export {
233
+ type CarouselApi,
234
+ Carousel,
235
+ CarouselContent,
236
+ CarouselItem,
237
+ CarouselPrevious,
238
+ CarouselNext,
239
+ };
@@ -0,0 +1,357 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as RechartsPrimitive from "recharts";
5
+
6
+ import { cn } from "@/lib/utils";
7
+
8
+ // Format: { THEME_NAME: CSS_SELECTOR }
9
+ const THEMES = { light: "", dark: ".dark" } as const;
10
+
11
+ export type ChartConfig = {
12
+ [k in string]: {
13
+ label?: React.ReactNode;
14
+ icon?: React.ComponentType;
15
+ } & (
16
+ | { color?: string; theme?: never }
17
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
18
+ );
19
+ };
20
+
21
+ type ChartContextProps = {
22
+ config: ChartConfig;
23
+ };
24
+
25
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
26
+
27
+ function useChart() {
28
+ const context = React.useContext(ChartContext);
29
+
30
+ if (!context) {
31
+ throw new Error("useChart must be used within a <ChartContainer />");
32
+ }
33
+
34
+ return context;
35
+ }
36
+
37
+ function ChartContainer({
38
+ id,
39
+ className,
40
+ children,
41
+ config,
42
+ ...props
43
+ }: React.ComponentProps<"div"> & {
44
+ config: ChartConfig;
45
+ children: React.ComponentProps<
46
+ typeof RechartsPrimitive.ResponsiveContainer
47
+ >["children"];
48
+ }) {
49
+ const uniqueId = React.useId();
50
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
51
+
52
+ return (
53
+ <ChartContext.Provider value={{ config }}>
54
+ <div
55
+ data-slot="chart"
56
+ data-chart={chartId}
57
+ className={cn(
58
+ "[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
59
+ className,
60
+ )}
61
+ {...props}
62
+ >
63
+ <ChartStyle id={chartId} config={config} />
64
+ <RechartsPrimitive.ResponsiveContainer>
65
+ {children}
66
+ </RechartsPrimitive.ResponsiveContainer>
67
+ </div>
68
+ </ChartContext.Provider>
69
+ );
70
+ }
71
+
72
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
73
+ const colorConfig = Object.entries(config).filter(
74
+ ([, config]) => config.theme || config.color,
75
+ );
76
+
77
+ if (!colorConfig.length) {
78
+ return null;
79
+ }
80
+
81
+ return (
82
+ <style
83
+ dangerouslySetInnerHTML={{
84
+ __html: Object.entries(THEMES)
85
+ .map(
86
+ ([theme, prefix]) => `
87
+ ${prefix} [data-chart=${id}] {
88
+ ${colorConfig
89
+ .map(([key, itemConfig]) => {
90
+ const color =
91
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
92
+ itemConfig.color;
93
+ return color ? ` --color-${key}: ${color};` : null;
94
+ })
95
+ .join("\n")}
96
+ }
97
+ `,
98
+ )
99
+ .join("\n"),
100
+ }}
101
+ />
102
+ );
103
+ };
104
+
105
+ const ChartTooltip = RechartsPrimitive.Tooltip;
106
+
107
+ function ChartTooltipContent({
108
+ active,
109
+ payload,
110
+ className,
111
+ indicator = "dot",
112
+ hideLabel = false,
113
+ hideIndicator = false,
114
+ label,
115
+ labelFormatter,
116
+ labelClassName,
117
+ formatter,
118
+ color,
119
+ nameKey,
120
+ labelKey,
121
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
122
+ React.ComponentProps<"div"> & {
123
+ hideLabel?: boolean;
124
+ hideIndicator?: boolean;
125
+ indicator?: "line" | "dot" | "dashed";
126
+ nameKey?: string;
127
+ labelKey?: string;
128
+ }) {
129
+ const { config } = useChart();
130
+
131
+ const tooltipLabel = React.useMemo(() => {
132
+ if (hideLabel || !payload?.length) {
133
+ return null;
134
+ }
135
+
136
+ const [item] = payload;
137
+ const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
138
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
139
+ const value =
140
+ !labelKey && typeof label === "string"
141
+ ? config[label as keyof typeof config]?.label || label
142
+ : itemConfig?.label;
143
+
144
+ if (labelFormatter) {
145
+ return (
146
+ <div className={cn("font-medium", labelClassName)}>
147
+ {labelFormatter(value, payload)}
148
+ </div>
149
+ );
150
+ }
151
+
152
+ if (!value) {
153
+ return null;
154
+ }
155
+
156
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>;
157
+ }, [
158
+ label,
159
+ labelFormatter,
160
+ payload,
161
+ hideLabel,
162
+ labelClassName,
163
+ config,
164
+ labelKey,
165
+ ]);
166
+
167
+ if (!active || !payload?.length) {
168
+ return null;
169
+ }
170
+
171
+ const nestLabel = payload.length === 1 && indicator !== "dot";
172
+
173
+ return (
174
+ <div
175
+ className={cn(
176
+ "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
177
+ className,
178
+ )}
179
+ >
180
+ {!nestLabel ? tooltipLabel : null}
181
+ <div className="grid gap-1.5">
182
+ {payload
183
+ .filter((item) => item.type !== "none")
184
+ .map((item, index) => {
185
+ const key = `${nameKey || item.name || item.dataKey || "value"}`;
186
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
187
+ const indicatorColor = color || item.payload.fill || item.color;
188
+
189
+ return (
190
+ <div
191
+ key={item.dataKey}
192
+ className={cn(
193
+ "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
194
+ indicator === "dot" && "items-center",
195
+ )}
196
+ >
197
+ {formatter && item?.value !== undefined && item.name ? (
198
+ formatter(item.value, item.name, item, index, item.payload)
199
+ ) : (
200
+ <>
201
+ {itemConfig?.icon ? (
202
+ <itemConfig.icon />
203
+ ) : (
204
+ !hideIndicator && (
205
+ <div
206
+ className={cn(
207
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
208
+ {
209
+ "h-2.5 w-2.5": indicator === "dot",
210
+ "w-1": indicator === "line",
211
+ "w-0 border-[1.5px] border-dashed bg-transparent":
212
+ indicator === "dashed",
213
+ "my-0.5": nestLabel && indicator === "dashed",
214
+ },
215
+ )}
216
+ style={
217
+ {
218
+ "--color-bg": indicatorColor,
219
+ "--color-border": indicatorColor,
220
+ } as React.CSSProperties
221
+ }
222
+ />
223
+ )
224
+ )}
225
+ <div
226
+ className={cn(
227
+ "flex flex-1 justify-between leading-none",
228
+ nestLabel ? "items-end" : "items-center",
229
+ )}
230
+ >
231
+ <div className="grid gap-1.5">
232
+ {nestLabel ? tooltipLabel : null}
233
+ <span className="text-muted-foreground">
234
+ {itemConfig?.label || item.name}
235
+ </span>
236
+ </div>
237
+ {item.value && (
238
+ <span className="text-foreground font-mono font-medium tabular-nums">
239
+ {item.value.toLocaleString()}
240
+ </span>
241
+ )}
242
+ </div>
243
+ </>
244
+ )}
245
+ </div>
246
+ );
247
+ })}
248
+ </div>
249
+ </div>
250
+ );
251
+ }
252
+
253
+ const ChartLegend = RechartsPrimitive.Legend;
254
+
255
+ function ChartLegendContent({
256
+ className,
257
+ hideIcon = false,
258
+ payload,
259
+ verticalAlign = "bottom",
260
+ nameKey,
261
+ }: React.ComponentProps<"div"> &
262
+ Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
263
+ hideIcon?: boolean;
264
+ nameKey?: string;
265
+ }) {
266
+ const { config } = useChart();
267
+
268
+ if (!payload?.length) {
269
+ return null;
270
+ }
271
+
272
+ return (
273
+ <div
274
+ className={cn(
275
+ "flex items-center justify-center gap-4",
276
+ verticalAlign === "top" ? "pb-3" : "pt-3",
277
+ className,
278
+ )}
279
+ >
280
+ {payload
281
+ .filter((item) => item.type !== "none")
282
+ .map((item) => {
283
+ const key = `${nameKey || item.dataKey || "value"}`;
284
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
285
+
286
+ return (
287
+ <div
288
+ key={item.value}
289
+ className={cn(
290
+ "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3",
291
+ )}
292
+ >
293
+ {itemConfig?.icon && !hideIcon ? (
294
+ <itemConfig.icon />
295
+ ) : (
296
+ <div
297
+ className="h-2 w-2 shrink-0 rounded-[2px]"
298
+ style={{
299
+ backgroundColor: item.color,
300
+ }}
301
+ />
302
+ )}
303
+ {itemConfig?.label}
304
+ </div>
305
+ );
306
+ })}
307
+ </div>
308
+ );
309
+ }
310
+
311
+ // Helper to extract item config from a payload.
312
+ function getPayloadConfigFromPayload(
313
+ config: ChartConfig,
314
+ payload: unknown,
315
+ key: string,
316
+ ) {
317
+ if (typeof payload !== "object" || payload === null) {
318
+ return undefined;
319
+ }
320
+
321
+ const payloadPayload =
322
+ "payload" in payload &&
323
+ typeof payload.payload === "object" &&
324
+ payload.payload !== null
325
+ ? payload.payload
326
+ : undefined;
327
+
328
+ let configLabelKey: string = key;
329
+
330
+ if (
331
+ key in payload &&
332
+ typeof payload[key as keyof typeof payload] === "string"
333
+ ) {
334
+ configLabelKey = payload[key as keyof typeof payload] as string;
335
+ } else if (
336
+ payloadPayload &&
337
+ key in payloadPayload &&
338
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
339
+ ) {
340
+ configLabelKey = payloadPayload[
341
+ key as keyof typeof payloadPayload
342
+ ] as string;
343
+ }
344
+
345
+ return configLabelKey in config
346
+ ? config[configLabelKey]
347
+ : config[key as keyof typeof config];
348
+ }
349
+
350
+ export {
351
+ ChartContainer,
352
+ ChartTooltip,
353
+ ChartTooltipContent,
354
+ ChartLegend,
355
+ ChartLegendContent,
356
+ ChartStyle,
357
+ };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
5
+ import { CheckIcon } from "lucide-react";
6
+
7
+ import { cn } from "@/lib/utils";
8
+
9
+ function Checkbox({
10
+ className,
11
+ ...props
12
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
13
+ return (
14
+ <CheckboxPrimitive.Root
15
+ data-slot="checkbox"
16
+ className={cn(
17
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
18
+ className,
19
+ )}
20
+ {...props}
21
+ >
22
+ <CheckboxPrimitive.Indicator
23
+ data-slot="checkbox-indicator"
24
+ className="grid place-content-center text-current transition-none"
25
+ >
26
+ <CheckIcon className="size-3.5" />
27
+ </CheckboxPrimitive.Indicator>
28
+ </CheckboxPrimitive.Root>
29
+ );
30
+ }
31
+
32
+ export { Checkbox };