@vllnt/ui 0.1.4 → 0.1.7-canary.2c4792f

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 (225) hide show
  1. package/dist/components/accordion/accordion.js +172 -0
  2. package/dist/components/accordion/index.js +12 -0
  3. package/dist/components/alert/alert.js +53 -0
  4. package/dist/components/alert/index.js +7 -0
  5. package/dist/components/alert-dialog/alert-dialog.js +117 -0
  6. package/dist/components/alert-dialog/index.js +26 -0
  7. package/dist/components/aspect-ratio/aspect-ratio.js +6 -0
  8. package/dist/components/aspect-ratio/index.js +4 -0
  9. package/dist/components/avatar/avatar.js +43 -0
  10. package/dist/components/avatar/index.js +6 -0
  11. package/dist/components/badge/badge.js +26 -0
  12. package/dist/components/badge/index.js +5 -0
  13. package/dist/components/blog-card/blog-card.js +50 -0
  14. package/dist/components/blog-card/index.js +5 -0
  15. package/dist/components/breadcrumb/breadcrumb.js +61 -0
  16. package/dist/components/breadcrumb/index.js +4 -0
  17. package/dist/components/button/button.js +48 -0
  18. package/dist/components/button/index.js +5 -0
  19. package/dist/components/calendar/calendar.js +71 -0
  20. package/dist/components/calendar/index.js +4 -0
  21. package/dist/components/callout/callout.js +59 -0
  22. package/dist/components/callout/index.js +4 -0
  23. package/dist/components/card/card.js +64 -0
  24. package/dist/components/card/index.js +16 -0
  25. package/dist/components/carousel/carousel.js +239 -0
  26. package/dist/components/carousel/index.js +14 -0
  27. package/dist/components/category-filter/category-filter.js +34 -0
  28. package/dist/components/category-filter/index.js +4 -0
  29. package/dist/components/chart/area-chart.js +99 -0
  30. package/dist/components/chart/bar-chart.js +80 -0
  31. package/dist/components/chart/index.js +3 -0
  32. package/dist/components/chart/line-chart.js +97 -0
  33. package/dist/components/checkbox/checkbox.js +28 -0
  34. package/dist/components/checkbox/index.js +4 -0
  35. package/dist/components/checklist/checklist.js +181 -0
  36. package/dist/components/checklist/index.js +6 -0
  37. package/dist/components/code-block/code-block.js +126 -0
  38. package/dist/components/code-block/index.js +4 -0
  39. package/dist/components/code-playground/code-playground.js +86 -0
  40. package/dist/components/code-playground/index.js +8 -0
  41. package/dist/components/collapsible/collapsible.js +10 -0
  42. package/dist/components/collapsible/index.js +10 -0
  43. package/dist/components/command/command.js +123 -0
  44. package/dist/components/command/index.js +22 -0
  45. package/dist/components/comparison/comparison.js +121 -0
  46. package/dist/components/comparison/index.js +8 -0
  47. package/dist/components/completion-dialog/completion-dialog.js +173 -0
  48. package/dist/components/completion-dialog/index.js +6 -0
  49. package/dist/components/content-intro/content-intro.js +144 -0
  50. package/dist/components/content-intro/index.js +6 -0
  51. package/dist/components/context-menu/context-menu.js +154 -0
  52. package/dist/components/context-menu/index.js +34 -0
  53. package/dist/components/cookie-consent/cookie-consent.js +175 -0
  54. package/dist/components/cookie-consent/index.js +8 -0
  55. package/dist/components/dialog/dialog.js +105 -0
  56. package/dist/components/dialog/index.js +24 -0
  57. package/dist/components/drawer/drawer.js +102 -0
  58. package/dist/components/drawer/index.js +24 -0
  59. package/dist/components/dropdown-menu/dropdown-menu.js +151 -0
  60. package/dist/components/dropdown-menu/index.js +34 -0
  61. package/dist/components/exercise/exercise.js +112 -0
  62. package/dist/components/exercise/index.js +4 -0
  63. package/dist/components/faq/faq.js +56 -0
  64. package/dist/components/faq/index.js +5 -0
  65. package/dist/components/filter-bar/filter-bar.js +244 -0
  66. package/dist/components/filter-bar/index.js +6 -0
  67. package/dist/components/floating-action-button/floating-action-button.js +35 -0
  68. package/dist/components/floating-action-button/index.js +6 -0
  69. package/dist/components/flow-diagram/flow-canvas.js +109 -0
  70. package/dist/components/flow-diagram/flow-controls.js +140 -0
  71. package/dist/components/flow-diagram/flow-diagram.js +114 -0
  72. package/dist/components/flow-diagram/flow-error-boundary.js +63 -0
  73. package/dist/components/flow-diagram/flow-fullscreen.js +58 -0
  74. package/dist/components/flow-diagram/index.js +12 -0
  75. package/dist/components/flow-diagram/types.js +0 -0
  76. package/dist/components/flow-diagram/use-flow-diagram.js +146 -0
  77. package/dist/components/horizontal-scroll-row/horizontal-scroll-row.js +66 -0
  78. package/dist/components/horizontal-scroll-row/index.js +6 -0
  79. package/dist/components/hover-card/hover-card.js +26 -0
  80. package/dist/components/hover-card/index.js +6 -0
  81. package/dist/components/index.js +641 -0
  82. package/dist/components/inline-input/index.js +4 -0
  83. package/dist/components/inline-input/inline-input.js +42 -0
  84. package/dist/components/input/index.js +4 -0
  85. package/dist/components/input/input.js +23 -0
  86. package/dist/components/input-otp/index.js +12 -0
  87. package/dist/components/input-otp/input-otp.js +54 -0
  88. package/dist/components/key-concept/index.js +8 -0
  89. package/dist/components/key-concept/key-concept.js +79 -0
  90. package/dist/components/keyboard-shortcuts-help/index.js +6 -0
  91. package/dist/components/keyboard-shortcuts-help/keyboard-shortcuts-help.js +121 -0
  92. package/dist/components/label/index.js +4 -0
  93. package/dist/components/label/label.js +21 -0
  94. package/dist/components/lang-provider/index.js +4 -0
  95. package/dist/components/lang-provider/lang-provider.js +18 -0
  96. package/dist/components/learning-objectives/index.js +10 -0
  97. package/dist/components/learning-objectives/learning-objectives.js +76 -0
  98. package/dist/components/mdx-content/index.js +4 -0
  99. package/dist/components/mdx-content/mdx-content.js +151 -0
  100. package/dist/components/menubar/index.js +36 -0
  101. package/dist/components/menubar/menubar.js +183 -0
  102. package/dist/components/model-selector/index.js +6 -0
  103. package/dist/components/model-selector/model-selector.js +374 -0
  104. package/dist/components/navbar-saas/index.js +6 -0
  105. package/dist/components/navbar-saas/navbar-saas.js +68 -0
  106. package/dist/components/navbar-saas/use-mobile.js +19 -0
  107. package/dist/components/navigation-menu/index.js +22 -0
  108. package/dist/components/navigation-menu/navigation-menu.js +108 -0
  109. package/dist/components/pagination/index.js +4 -0
  110. package/dist/components/pagination/pagination.js +44 -0
  111. package/dist/components/popover/index.js +12 -0
  112. package/dist/components/popover/popover.js +28 -0
  113. package/dist/components/pro-tip/index.js +8 -0
  114. package/dist/components/pro-tip/pro-tip.js +139 -0
  115. package/dist/components/profile-section/index.js +4 -0
  116. package/dist/components/profile-section/profile-section.js +45 -0
  117. package/dist/components/progress-bar/index.js +4 -0
  118. package/dist/components/progress-bar/progress-bar.js +56 -0
  119. package/dist/components/progress-card/index.js +6 -0
  120. package/dist/components/progress-card/progress-card.js +71 -0
  121. package/dist/components/quiz/index.js +4 -0
  122. package/dist/components/quiz/quiz.js +210 -0
  123. package/dist/components/radio-group/index.js +5 -0
  124. package/dist/components/radio-group/radio-group.js +36 -0
  125. package/dist/components/resizable/index.js +10 -0
  126. package/dist/components/resizable/resizable.js +39 -0
  127. package/dist/components/scroll-area/index.js +5 -0
  128. package/dist/components/scroll-area/scroll-area.js +39 -0
  129. package/dist/components/search-bar/index.js +4 -0
  130. package/dist/components/search-bar/search-bar.js +122 -0
  131. package/dist/components/search-dialog/index.js +4 -0
  132. package/dist/components/search-dialog/search-dialog.js +102 -0
  133. package/dist/components/select/index.js +24 -0
  134. package/dist/components/select/select.js +125 -0
  135. package/dist/components/separator/index.js +4 -0
  136. package/dist/components/separator/separator.js +25 -0
  137. package/dist/components/share-dialog/index.js +6 -0
  138. package/dist/components/share-dialog/share-dialog.js +121 -0
  139. package/dist/components/share-section/index.js +6 -0
  140. package/dist/components/share-section/share-section.js +57 -0
  141. package/dist/components/sheet/index.js +24 -0
  142. package/dist/components/sheet/sheet.js +116 -0
  143. package/dist/components/sidebar/index.js +4 -0
  144. package/dist/components/sidebar/sidebar.js +188 -0
  145. package/dist/components/sidebar-provider/index.js +5 -0
  146. package/dist/components/sidebar-provider/sidebar-provider.js +25 -0
  147. package/dist/components/sidebar-toggle/index.js +4 -0
  148. package/dist/components/sidebar-toggle/sidebar-toggle.js +36 -0
  149. package/dist/components/skeleton/index.js +4 -0
  150. package/dist/components/skeleton/skeleton.js +17 -0
  151. package/dist/components/slider/index.js +4 -0
  152. package/dist/components/slider/slider.js +24 -0
  153. package/dist/components/slideshow/index.js +6 -0
  154. package/dist/components/slideshow/slideshow.js +440 -0
  155. package/dist/components/social-fab/index.js +6 -0
  156. package/dist/components/social-fab/social-fab.js +211 -0
  157. package/dist/components/social-fab/use-social-fab.js +111 -0
  158. package/dist/components/spinner/index.js +4 -0
  159. package/dist/components/spinner/spinner.js +23 -0
  160. package/dist/components/step-by-step/index.js +8 -0
  161. package/dist/components/step-by-step/step-by-step.js +194 -0
  162. package/dist/components/step-navigation/index.js +4 -0
  163. package/dist/components/step-navigation/step-navigation.js +119 -0
  164. package/dist/components/switch/index.js +4 -0
  165. package/dist/components/switch/switch.js +28 -0
  166. package/dist/components/table/index.js +20 -0
  167. package/dist/components/table/table.js +87 -0
  168. package/dist/components/table-of-contents/index.js +4 -0
  169. package/dist/components/table-of-contents/table-of-contents.js +71 -0
  170. package/dist/components/table-of-contents-panel/index.js +6 -0
  171. package/dist/components/table-of-contents-panel/table-of-contents-panel.js +202 -0
  172. package/dist/components/tabs/index.js +12 -0
  173. package/dist/components/tabs/tabs.js +84 -0
  174. package/dist/components/terminal/index.js +8 -0
  175. package/dist/components/terminal/terminal.js +119 -0
  176. package/dist/components/textarea/index.js +4 -0
  177. package/dist/components/textarea/textarea.js +22 -0
  178. package/dist/components/theme-provider/index.js +4 -0
  179. package/dist/components/theme-provider/theme-provider.js +11 -0
  180. package/dist/components/theme-toggle/index.js +4 -0
  181. package/dist/components/theme-toggle/theme-toggle.js +170 -0
  182. package/dist/components/thinking-block/index.js +4 -0
  183. package/dist/components/thinking-block/thinking-block.js +56 -0
  184. package/dist/components/tldr-section/index.js +4 -0
  185. package/dist/components/tldr-section/tldr-section.js +101 -0
  186. package/dist/components/toast/index.js +18 -0
  187. package/dist/components/toast/toast.js +84 -0
  188. package/dist/components/toast/toaster.js +38 -0
  189. package/dist/components/toggle/index.js +5 -0
  190. package/dist/components/toggle/toggle.js +39 -0
  191. package/dist/components/toggle-group/index.js +5 -0
  192. package/dist/components/toggle-group/toggle-group.js +46 -0
  193. package/dist/components/tooltip/index.js +12 -0
  194. package/dist/components/tooltip/tooltip.js +27 -0
  195. package/dist/components/truncated-text/index.js +4 -0
  196. package/dist/components/truncated-text/truncated-text.js +25 -0
  197. package/dist/components/tutorial-card/index.js +6 -0
  198. package/dist/components/tutorial-card/tutorial-card.js +78 -0
  199. package/dist/components/tutorial-complete/index.js +6 -0
  200. package/dist/components/tutorial-complete/tutorial-complete.js +134 -0
  201. package/dist/components/tutorial-filters/index.js +6 -0
  202. package/dist/components/tutorial-filters/tutorial-filters.js +205 -0
  203. package/dist/components/tutorial-intro-content/index.js +6 -0
  204. package/dist/components/tutorial-intro-content/tutorial-intro-content.js +141 -0
  205. package/dist/components/tutorial-mdx/index.js +8 -0
  206. package/dist/components/tutorial-mdx/tutorial-mdx.js +219 -0
  207. package/dist/components/video-embed/index.js +4 -0
  208. package/dist/components/video-embed/video-embed.js +77 -0
  209. package/dist/components/view-switcher/index.js +6 -0
  210. package/dist/components/view-switcher/view-switcher.js +92 -0
  211. package/dist/index.d.ts +44 -2
  212. package/dist/index.js +14 -8556
  213. package/dist/lib/types.js +11 -0
  214. package/dist/lib/use-debounce.js +17 -0
  215. package/dist/lib/use-horizontal-scroll.js +60 -0
  216. package/dist/lib/use-mounted.js +17 -0
  217. package/dist/lib/utils.js +8 -0
  218. package/dist/tailwind-preset.d.ts +5 -0
  219. package/dist/tailwind-preset.js +9 -10
  220. package/dist/types/content.js +0 -0
  221. package/dist/types/index.js +0 -0
  222. package/package.json +42 -23
  223. package/LICENSE +0 -21
  224. package/dist/chunk-XRV5RSYH.js +0 -569
  225. package/dist/flow-diagram-N3EHM6VB.js +0 -2
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { ChevronLeft, ChevronRight } from "lucide-react";
4
+ import { DayPicker } from "react-day-picker";
5
+ import { cn } from "../../lib/utils";
6
+ import { buttonVariants } from "../button/button";
7
+ function IconLeft() {
8
+ return /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" });
9
+ }
10
+ function IconRight() {
11
+ return /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" });
12
+ }
13
+ function ChevronComponent({
14
+ orientation = "right"
15
+ }) {
16
+ return orientation === "left" ? /* @__PURE__ */ jsx(IconLeft, {}) : /* @__PURE__ */ jsx(IconRight, {});
17
+ }
18
+ function Calendar({
19
+ className,
20
+ classNames,
21
+ showOutsideDays = true,
22
+ ...props
23
+ }) {
24
+ return /* @__PURE__ */ jsx(
25
+ DayPicker,
26
+ {
27
+ className: cn("p-3", className),
28
+ classNames: {
29
+ button_next: cn(
30
+ buttonVariants({ variant: "outline" }),
31
+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 absolute right-1"
32
+ ),
33
+ button_previous: cn(
34
+ buttonVariants({ variant: "outline" }),
35
+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 absolute left-1"
36
+ ),
37
+ caption_label: "text-sm font-medium",
38
+ day: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
39
+ day_button: cn(
40
+ buttonVariants({ variant: "ghost" }),
41
+ "h-9 w-9 p-0 font-normal aria-selected:opacity-100"
42
+ ),
43
+ disabled: "text-muted-foreground opacity-50",
44
+ hidden: "invisible",
45
+ month: "space-y-4",
46
+ month_caption: "flex justify-center pt-1 relative items-center",
47
+ month_grid: "w-full border-collapse space-y-1",
48
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
49
+ nav: "space-x-1 flex items-center",
50
+ outside: "day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
51
+ range_end: "day-range-end",
52
+ range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
53
+ selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
54
+ today: "bg-accent text-accent-foreground",
55
+ week: "flex w-full mt-2",
56
+ weekday: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
57
+ weekdays: "flex",
58
+ ...classNames
59
+ },
60
+ components: {
61
+ Chevron: ChevronComponent
62
+ },
63
+ showOutsideDays,
64
+ ...props
65
+ }
66
+ );
67
+ }
68
+ Calendar.displayName = "Calendar";
69
+ export {
70
+ Calendar
71
+ };
@@ -0,0 +1,4 @@
1
+ import { Calendar } from "./calendar";
2
+ export {
3
+ Calendar
4
+ };
@@ -0,0 +1,59 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/utils";
3
+ const variantStyles = {
4
+ danger: {
5
+ className: "border-red-500/50 bg-red-500/10 text-red-700 dark:text-red-300",
6
+ defaultTitle: "Danger"
7
+ },
8
+ info: {
9
+ className: "border-blue-500/50 bg-blue-500/10 text-blue-700 dark:text-blue-300",
10
+ defaultTitle: "Info"
11
+ },
12
+ note: {
13
+ className: "border-gray-500/50 bg-gray-500/10 text-gray-700 dark:text-gray-300",
14
+ defaultTitle: "Note"
15
+ },
16
+ success: {
17
+ className: "border-green-500/50 bg-green-500/10 text-green-700 dark:text-green-300",
18
+ defaultTitle: "Success"
19
+ },
20
+ tip: {
21
+ className: "border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-300",
22
+ defaultTitle: "Tip"
23
+ },
24
+ warning: {
25
+ className: "border-orange-500/50 bg-orange-500/10 text-orange-700 dark:text-orange-300",
26
+ defaultTitle: "Warning"
27
+ }
28
+ };
29
+ function Callout({
30
+ children,
31
+ className,
32
+ icon,
33
+ title,
34
+ variant = "info"
35
+ }) {
36
+ const config = variantStyles[variant];
37
+ const displayTitle = title ?? config.defaultTitle;
38
+ return /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ className: cn(
42
+ "my-6 rounded-lg border-l-4 p-4",
43
+ config.className,
44
+ className
45
+ ),
46
+ role: "alert",
47
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
48
+ icon ? /* @__PURE__ */ jsx("span", { className: "h-5 w-5 flex-shrink-0 mt-0.5", children: icon }) : null,
49
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
50
+ displayTitle ? /* @__PURE__ */ jsx("p", { className: "font-semibold mb-1", children: displayTitle }) : null,
51
+ /* @__PURE__ */ jsx("div", { className: "text-sm [&>p]:mb-0 [&>p:last-child]:mb-0", children })
52
+ ] })
53
+ ] })
54
+ }
55
+ );
56
+ }
57
+ export {
58
+ Callout
59
+ };
@@ -0,0 +1,4 @@
1
+ import { Callout } from "./callout";
2
+ export {
3
+ Callout
4
+ };
@@ -0,0 +1,64 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/utils";
4
+ const Card = React.forwardRef(({ className, ...props }, reference) => /* @__PURE__ */ jsx(
5
+ "div",
6
+ {
7
+ className: cn(
8
+ "rounded-lg border bg-card text-card-foreground shadow-sm",
9
+ className
10
+ ),
11
+ ref: reference,
12
+ ...props
13
+ }
14
+ ));
15
+ Card.displayName = "Card";
16
+ const CardHeader = React.forwardRef(({ className, ...props }, reference) => /* @__PURE__ */ jsx(
17
+ "div",
18
+ {
19
+ className: cn("flex flex-col space-y-1.5 p-6", className),
20
+ ref: reference,
21
+ ...props
22
+ }
23
+ ));
24
+ CardHeader.displayName = "CardHeader";
25
+ const CardTitle = React.forwardRef(({ className, ...props }, reference) => /* @__PURE__ */ jsx(
26
+ "div",
27
+ {
28
+ className: cn(
29
+ "text-2xl font-semibold leading-none tracking-tight",
30
+ className
31
+ ),
32
+ ref: reference,
33
+ ...props
34
+ }
35
+ ));
36
+ CardTitle.displayName = "CardTitle";
37
+ const CardDescription = React.forwardRef(({ className, ...props }, reference) => /* @__PURE__ */ jsx(
38
+ "div",
39
+ {
40
+ className: cn("text-sm text-muted-foreground", className),
41
+ ref: reference,
42
+ ...props
43
+ }
44
+ ));
45
+ CardDescription.displayName = "CardDescription";
46
+ const CardContent = React.forwardRef(({ className, ...props }, reference) => /* @__PURE__ */ jsx("div", { className: cn("p-6 pt-0", className), ref: reference, ...props }));
47
+ CardContent.displayName = "CardContent";
48
+ const CardFooter = React.forwardRef(({ className, ...props }, reference) => /* @__PURE__ */ jsx(
49
+ "div",
50
+ {
51
+ className: cn("flex items-center p-6 pt-0", className),
52
+ ref: reference,
53
+ ...props
54
+ }
55
+ ));
56
+ CardFooter.displayName = "CardFooter";
57
+ export {
58
+ Card,
59
+ CardContent,
60
+ CardDescription,
61
+ CardFooter,
62
+ CardHeader,
63
+ CardTitle
64
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ Card,
3
+ CardContent,
4
+ CardDescription,
5
+ CardFooter,
6
+ CardHeader,
7
+ CardTitle
8
+ } from "./card";
9
+ export {
10
+ Card,
11
+ CardContent,
12
+ CardDescription,
13
+ CardFooter,
14
+ CardHeader,
15
+ CardTitle
16
+ };
@@ -0,0 +1,239 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ createContext,
5
+ forwardRef,
6
+ useCallback,
7
+ useContext,
8
+ useEffect,
9
+ useMemo,
10
+ useState
11
+ } from "react";
12
+ import useEmblaCarousel from "embla-carousel-react";
13
+ import { ArrowLeft, ArrowRight } from "lucide-react";
14
+ import { cn } from "../../lib/utils";
15
+ import { Button } from "../button/button";
16
+ const CarouselContext = createContext(null);
17
+ function useCarousel() {
18
+ const context = useContext(CarouselContext);
19
+ if (!context) {
20
+ throw new Error("useCarousel must be used within a <Carousel />");
21
+ }
22
+ return context;
23
+ }
24
+ function useCarouselLogic({
25
+ options,
26
+ orientation,
27
+ plugins,
28
+ setApi
29
+ }) {
30
+ const [carouselRef, api] = useEmblaCarousel(
31
+ {
32
+ ...options,
33
+ axis: orientation === "horizontal" ? "x" : "y"
34
+ },
35
+ plugins
36
+ );
37
+ const [canScrollPrevious, setCanScrollPrevious] = useState(false);
38
+ const [canScrollNext, setCanScrollNext] = useState(false);
39
+ const onSelect = useCallback((api2) => {
40
+ if (!api2) {
41
+ return;
42
+ }
43
+ setCanScrollPrevious(api2.canScrollPrev());
44
+ setCanScrollNext(api2.canScrollNext());
45
+ }, []);
46
+ const scrollPrevious = useCallback(() => {
47
+ api?.scrollPrev();
48
+ }, [api]);
49
+ const scrollNext = useCallback(() => {
50
+ api?.scrollNext();
51
+ }, [api]);
52
+ const handleKeyDown = useCallback(
53
+ (event) => {
54
+ if (event.key === "ArrowLeft") {
55
+ event.preventDefault();
56
+ scrollPrevious();
57
+ } else if (event.key === "ArrowRight") {
58
+ event.preventDefault();
59
+ scrollNext();
60
+ }
61
+ },
62
+ [scrollPrevious, scrollNext]
63
+ );
64
+ useEffect(() => {
65
+ if (!api || !setApi) {
66
+ return;
67
+ }
68
+ setApi(api);
69
+ }, [api, setApi]);
70
+ useEffect(() => {
71
+ if (!api) {
72
+ return;
73
+ }
74
+ api.on("reInit", onSelect);
75
+ api.on("select", onSelect);
76
+ const rafId = requestAnimationFrame(() => {
77
+ onSelect(api);
78
+ });
79
+ return () => {
80
+ api?.off("select", onSelect);
81
+ api?.off("reInit", onSelect);
82
+ cancelAnimationFrame(rafId);
83
+ };
84
+ }, [api, onSelect]);
85
+ return {
86
+ api,
87
+ canScrollNext,
88
+ canScrollPrevious,
89
+ carouselRef,
90
+ handleKeyDown,
91
+ scrollNext,
92
+ scrollPrevious
93
+ };
94
+ }
95
+ const Carousel = forwardRef(
96
+ ({
97
+ children,
98
+ className,
99
+ opts,
100
+ orientation = "horizontal",
101
+ plugins,
102
+ setApi,
103
+ ...props
104
+ }, ref) => {
105
+ const {
106
+ api,
107
+ canScrollNext,
108
+ canScrollPrevious,
109
+ carouselRef,
110
+ handleKeyDown,
111
+ scrollNext,
112
+ scrollPrevious
113
+ } = useCarouselLogic({ options: opts, orientation, plugins, setApi });
114
+ const contextValue = useMemo(
115
+ () => ({
116
+ api,
117
+ canScrollNext,
118
+ canScrollPrev: canScrollPrevious,
119
+ carouselRef,
120
+ opts,
121
+ orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
122
+ scrollNext,
123
+ scrollPrev: scrollPrevious
124
+ }),
125
+ [
126
+ api,
127
+ canScrollNext,
128
+ canScrollPrevious,
129
+ carouselRef,
130
+ opts,
131
+ orientation,
132
+ scrollNext,
133
+ scrollPrevious
134
+ ]
135
+ );
136
+ return /* @__PURE__ */ jsx(CarouselContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
137
+ "div",
138
+ {
139
+ "aria-roledescription": "carousel",
140
+ className: cn("relative", className),
141
+ onKeyDownCapture: handleKeyDown,
142
+ ref,
143
+ role: "region",
144
+ ...props,
145
+ children
146
+ }
147
+ ) });
148
+ }
149
+ );
150
+ Carousel.displayName = "Carousel";
151
+ const CarouselContent = forwardRef(({ className, ...props }, ref) => {
152
+ const { carouselRef, orientation } = useCarousel();
153
+ return /* @__PURE__ */ jsx("div", { className: "overflow-hidden", ref: carouselRef, children: /* @__PURE__ */ jsx(
154
+ "div",
155
+ {
156
+ className: cn(
157
+ "flex",
158
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
159
+ className
160
+ ),
161
+ ref,
162
+ ...props
163
+ }
164
+ ) });
165
+ });
166
+ CarouselContent.displayName = "CarouselContent";
167
+ const CarouselItem = forwardRef(({ className, ...props }, ref) => {
168
+ const { orientation } = useCarousel();
169
+ return /* @__PURE__ */ jsx(
170
+ "div",
171
+ {
172
+ "aria-roledescription": "slide",
173
+ className: cn(
174
+ "min-w-0 shrink-0 grow-0 basis-full",
175
+ orientation === "horizontal" ? "pl-4" : "pt-4",
176
+ className
177
+ ),
178
+ ref,
179
+ role: "group",
180
+ ...props
181
+ }
182
+ );
183
+ });
184
+ CarouselItem.displayName = "CarouselItem";
185
+ const CarouselPrevious = forwardRef(({ className, size = "icon", variant = "outline", ...props }, ref) => {
186
+ const { canScrollPrev, orientation, scrollPrev } = useCarousel();
187
+ return /* @__PURE__ */ jsxs(
188
+ Button,
189
+ {
190
+ className: cn(
191
+ "absolute h-8 w-8 rounded-full",
192
+ orientation === "horizontal" ? "-left-12 top-1/2 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
193
+ className
194
+ ),
195
+ disabled: !canScrollPrev,
196
+ onClick: scrollPrev,
197
+ ref,
198
+ size,
199
+ variant,
200
+ ...props,
201
+ children: [
202
+ /* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4" }),
203
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Previous slide" })
204
+ ]
205
+ }
206
+ );
207
+ });
208
+ CarouselPrevious.displayName = "CarouselPrevious";
209
+ const CarouselNext = forwardRef(({ className, size = "icon", variant = "outline", ...props }, ref) => {
210
+ const { canScrollNext, orientation, scrollNext } = useCarousel();
211
+ return /* @__PURE__ */ jsxs(
212
+ Button,
213
+ {
214
+ className: cn(
215
+ "absolute h-8 w-8 rounded-full",
216
+ orientation === "horizontal" ? "-right-12 top-1/2 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
217
+ className
218
+ ),
219
+ disabled: !canScrollNext,
220
+ onClick: scrollNext,
221
+ ref,
222
+ size,
223
+ variant,
224
+ ...props,
225
+ children: [
226
+ /* @__PURE__ */ jsx(ArrowRight, { className: "h-4 w-4" }),
227
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Next slide" })
228
+ ]
229
+ }
230
+ );
231
+ });
232
+ CarouselNext.displayName = "CarouselNext";
233
+ export {
234
+ Carousel,
235
+ CarouselContent,
236
+ CarouselItem,
237
+ CarouselNext,
238
+ CarouselPrevious
239
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ Carousel,
3
+ CarouselContent,
4
+ CarouselItem,
5
+ CarouselNext,
6
+ CarouselPrevious
7
+ } from "./carousel";
8
+ export {
9
+ Carousel,
10
+ CarouselContent,
11
+ CarouselItem,
12
+ CarouselNext,
13
+ CarouselPrevious
14
+ };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import Link from "next/link";
4
+ import { usePathname } from "next/navigation";
5
+ import { Badge } from "../badge";
6
+ function slugify(text) {
7
+ return text.toLowerCase().normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[^\s\w-]/g, "").trim().replaceAll(/\s+/g, "-").replaceAll(/-+/g, "-").replaceAll(/^-+|-+$/g, "");
8
+ }
9
+ function CategoryFilter({ categories, lang }) {
10
+ const pathname = usePathname();
11
+ const allCategories = Array.from(new Set(categories)).sort();
12
+ if (allCategories.length === 0) {
13
+ return null;
14
+ }
15
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: allCategories.map((category) => {
16
+ const categorySlug = slugify(category);
17
+ const isSelected = pathname.includes(`/${categorySlug}`);
18
+ const href = `/${lang}/${categorySlug}`;
19
+ if (isSelected) {
20
+ return /* @__PURE__ */ jsx(Badge, { className: "cursor-default", variant: "default", children: category.charAt(0).toUpperCase() + category.slice(1) }, category);
21
+ }
22
+ return /* @__PURE__ */ jsx(Link, { href, children: /* @__PURE__ */ jsx(
23
+ Badge,
24
+ {
25
+ className: "cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",
26
+ variant: "secondary",
27
+ children: category.charAt(0).toUpperCase() + category.slice(1)
28
+ }
29
+ ) }, category);
30
+ }) });
31
+ }
32
+ export {
33
+ CategoryFilter
34
+ };
@@ -0,0 +1,4 @@
1
+ import { CategoryFilter } from "./category-filter";
2
+ export {
3
+ CategoryFilter
4
+ };
@@ -0,0 +1,99 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/utils";
4
+ const DEFAULT_WIDTH = 340;
5
+ const DEFAULT_HEIGHT = 150;
6
+ const DEFAULT_STROKE_WIDTH = 2;
7
+ function computePoints(data, dimensions) {
8
+ const { height, strokeWidth, width } = dimensions;
9
+ const values = data.map((point) => point.value);
10
+ const minValue = Math.min(...values);
11
+ const maxValue = Math.max(...values);
12
+ const range = maxValue - minValue || 1;
13
+ const safeWidth = Math.max(width - strokeWidth * 2, 0);
14
+ const safeHeight = Math.max(height - strokeWidth * 2, 0);
15
+ return data.map((point, index) => {
16
+ const x = data.length === 1 ? strokeWidth + safeWidth / 2 : strokeWidth + index / (data.length - 1) * safeWidth;
17
+ const ratio = (point.value - minValue) / range;
18
+ const y = safeHeight - ratio * safeHeight + strokeWidth;
19
+ return { x, y };
20
+ });
21
+ }
22
+ function getPathCoordinates(data, dimensions) {
23
+ if (data.length === 0) return { area: "", line: "" };
24
+ const points = computePoints(data, dimensions);
25
+ const line = points.map((point, index) => `${index === 0 ? "M" : "L"}${point.x},${point.y}`).join(" ");
26
+ const area = points.length === 0 ? "" : `M${points[0]?.x ?? 0},${dimensions.height} ${line} L${points.at(-1)?.x ?? 0},${dimensions.height}Z`;
27
+ return { area, line };
28
+ }
29
+ const AreaChart = React.forwardRef(
30
+ ({
31
+ className,
32
+ color = "currentColor",
33
+ data,
34
+ gradientId = "area-chart-gradient",
35
+ height = DEFAULT_HEIGHT,
36
+ strokeWidth = DEFAULT_STROKE_WIDTH,
37
+ width = DEFAULT_WIDTH,
38
+ ...props
39
+ }, reference) => {
40
+ const { area, line } = React.useMemo(
41
+ () => getPathCoordinates(data, { height, strokeWidth, width }),
42
+ [data, width, height, strokeWidth]
43
+ );
44
+ if (!line) return null;
45
+ return /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ className: cn(
49
+ "rounded-2xl border border-border bg-background/40 p-3",
50
+ className
51
+ ),
52
+ ref: reference,
53
+ ...props,
54
+ children: /* @__PURE__ */ jsxs(
55
+ "svg",
56
+ {
57
+ "aria-label": "Area chart",
58
+ className: "h-full w-full",
59
+ height,
60
+ role: "img",
61
+ viewBox: `0 0 ${width} ${height}`,
62
+ width,
63
+ children: [
64
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", x2: "0", y1: "0", y2: "1", children: [
65
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.5" }),
66
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
67
+ ] }) }),
68
+ /* @__PURE__ */ jsx(
69
+ "path",
70
+ {
71
+ d: area,
72
+ fill: `url(#${gradientId})`,
73
+ stroke: "none",
74
+ vectorEffect: "non-scaling-stroke"
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx(
78
+ "path",
79
+ {
80
+ d: line,
81
+ fill: "none",
82
+ stroke: color,
83
+ strokeLinecap: "round",
84
+ strokeLinejoin: "round",
85
+ strokeWidth,
86
+ vectorEffect: "non-scaling-stroke"
87
+ }
88
+ )
89
+ ]
90
+ }
91
+ )
92
+ }
93
+ );
94
+ }
95
+ );
96
+ AreaChart.displayName = "AreaChart";
97
+ export {
98
+ AreaChart
99
+ };