@vllnt/ui 0.1.4 → 0.1.6

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 (217) 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 +65 -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 +235 -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 +123 -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 +109 -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 +171 -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 +141 -0
  77. package/dist/components/hover-card/hover-card.js +26 -0
  78. package/dist/components/hover-card/index.js +6 -0
  79. package/dist/components/index.js +633 -0
  80. package/dist/components/inline-input/index.js +4 -0
  81. package/dist/components/inline-input/inline-input.js +42 -0
  82. package/dist/components/input/index.js +4 -0
  83. package/dist/components/input/input.js +23 -0
  84. package/dist/components/input-otp/index.js +12 -0
  85. package/dist/components/input-otp/input-otp.js +54 -0
  86. package/dist/components/key-concept/index.js +8 -0
  87. package/dist/components/key-concept/key-concept.js +79 -0
  88. package/dist/components/keyboard-shortcuts-help/index.js +6 -0
  89. package/dist/components/keyboard-shortcuts-help/keyboard-shortcuts-help.js +121 -0
  90. package/dist/components/label/index.js +4 -0
  91. package/dist/components/label/label.js +21 -0
  92. package/dist/components/lang-provider/index.js +4 -0
  93. package/dist/components/lang-provider/lang-provider.js +18 -0
  94. package/dist/components/learning-objectives/index.js +10 -0
  95. package/dist/components/learning-objectives/learning-objectives.js +76 -0
  96. package/dist/components/mdx-content/index.js +4 -0
  97. package/dist/components/mdx-content/mdx-content.js +140 -0
  98. package/dist/components/menubar/index.js +36 -0
  99. package/dist/components/menubar/menubar.js +183 -0
  100. package/dist/components/model-selector/index.js +6 -0
  101. package/dist/components/model-selector/model-selector.js +374 -0
  102. package/dist/components/navbar-saas/index.js +6 -0
  103. package/dist/components/navbar-saas/navbar-saas.js +68 -0
  104. package/dist/components/navbar-saas/use-mobile.js +19 -0
  105. package/dist/components/navigation-menu/index.js +22 -0
  106. package/dist/components/navigation-menu/navigation-menu.js +108 -0
  107. package/dist/components/pagination/index.js +4 -0
  108. package/dist/components/pagination/pagination.js +44 -0
  109. package/dist/components/popover/index.js +12 -0
  110. package/dist/components/popover/popover.js +28 -0
  111. package/dist/components/pro-tip/index.js +8 -0
  112. package/dist/components/pro-tip/pro-tip.js +139 -0
  113. package/dist/components/profile-section/index.js +4 -0
  114. package/dist/components/profile-section/profile-section.js +45 -0
  115. package/dist/components/progress-bar/index.js +4 -0
  116. package/dist/components/progress-bar/progress-bar.js +56 -0
  117. package/dist/components/progress-card/index.js +6 -0
  118. package/dist/components/progress-card/progress-card.js +68 -0
  119. package/dist/components/quiz/index.js +4 -0
  120. package/dist/components/quiz/quiz.js +210 -0
  121. package/dist/components/radio-group/index.js +5 -0
  122. package/dist/components/radio-group/radio-group.js +36 -0
  123. package/dist/components/resizable/index.js +10 -0
  124. package/dist/components/resizable/resizable.js +39 -0
  125. package/dist/components/scroll-area/index.js +5 -0
  126. package/dist/components/scroll-area/scroll-area.js +39 -0
  127. package/dist/components/search-bar/index.js +4 -0
  128. package/dist/components/search-bar/search-bar.js +120 -0
  129. package/dist/components/search-dialog/index.js +4 -0
  130. package/dist/components/search-dialog/search-dialog.js +102 -0
  131. package/dist/components/select/index.js +24 -0
  132. package/dist/components/select/select.js +125 -0
  133. package/dist/components/separator/index.js +4 -0
  134. package/dist/components/separator/separator.js +25 -0
  135. package/dist/components/share-dialog/index.js +6 -0
  136. package/dist/components/share-dialog/share-dialog.js +121 -0
  137. package/dist/components/share-section/index.js +6 -0
  138. package/dist/components/share-section/share-section.js +57 -0
  139. package/dist/components/sheet/index.js +24 -0
  140. package/dist/components/sheet/sheet.js +116 -0
  141. package/dist/components/sidebar/index.js +4 -0
  142. package/dist/components/sidebar/sidebar.js +188 -0
  143. package/dist/components/sidebar-provider/index.js +5 -0
  144. package/dist/components/sidebar-provider/sidebar-provider.js +25 -0
  145. package/dist/components/sidebar-toggle/index.js +4 -0
  146. package/dist/components/sidebar-toggle/sidebar-toggle.js +36 -0
  147. package/dist/components/skeleton/index.js +4 -0
  148. package/dist/components/skeleton/skeleton.js +17 -0
  149. package/dist/components/slider/index.js +4 -0
  150. package/dist/components/slider/slider.js +24 -0
  151. package/dist/components/slideshow/index.js +6 -0
  152. package/dist/components/slideshow/slideshow.js +442 -0
  153. package/dist/components/social-fab/index.js +6 -0
  154. package/dist/components/social-fab/social-fab.js +211 -0
  155. package/dist/components/social-fab/use-social-fab.js +111 -0
  156. package/dist/components/spinner/index.js +4 -0
  157. package/dist/components/spinner/spinner.js +23 -0
  158. package/dist/components/step-by-step/index.js +8 -0
  159. package/dist/components/step-by-step/step-by-step.js +194 -0
  160. package/dist/components/step-navigation/index.js +4 -0
  161. package/dist/components/step-navigation/step-navigation.js +119 -0
  162. package/dist/components/switch/index.js +4 -0
  163. package/dist/components/switch/switch.js +28 -0
  164. package/dist/components/table/index.js +20 -0
  165. package/dist/components/table/table.js +87 -0
  166. package/dist/components/table-of-contents/index.js +4 -0
  167. package/dist/components/table-of-contents/table-of-contents.js +71 -0
  168. package/dist/components/table-of-contents-panel/index.js +6 -0
  169. package/dist/components/table-of-contents-panel/table-of-contents-panel.js +202 -0
  170. package/dist/components/tabs/index.js +12 -0
  171. package/dist/components/tabs/tabs.js +84 -0
  172. package/dist/components/terminal/index.js +8 -0
  173. package/dist/components/terminal/terminal.js +119 -0
  174. package/dist/components/textarea/index.js +4 -0
  175. package/dist/components/textarea/textarea.js +22 -0
  176. package/dist/components/theme-provider/index.js +4 -0
  177. package/dist/components/theme-provider/theme-provider.js +11 -0
  178. package/dist/components/theme-toggle/index.js +4 -0
  179. package/dist/components/theme-toggle/theme-toggle.js +172 -0
  180. package/dist/components/thinking-block/index.js +4 -0
  181. package/dist/components/thinking-block/thinking-block.js +52 -0
  182. package/dist/components/tldr-section/index.js +4 -0
  183. package/dist/components/tldr-section/tldr-section.js +92 -0
  184. package/dist/components/toast/index.js +18 -0
  185. package/dist/components/toast/toast.js +84 -0
  186. package/dist/components/toast/toaster.js +38 -0
  187. package/dist/components/toggle/index.js +5 -0
  188. package/dist/components/toggle/toggle.js +39 -0
  189. package/dist/components/toggle-group/index.js +5 -0
  190. package/dist/components/toggle-group/toggle-group.js +46 -0
  191. package/dist/components/tooltip/index.js +12 -0
  192. package/dist/components/tooltip/tooltip.js +27 -0
  193. package/dist/components/truncated-text/index.js +4 -0
  194. package/dist/components/truncated-text/truncated-text.js +25 -0
  195. package/dist/components/tutorial-card/index.js +6 -0
  196. package/dist/components/tutorial-card/tutorial-card.js +75 -0
  197. package/dist/components/tutorial-complete/index.js +6 -0
  198. package/dist/components/tutorial-complete/tutorial-complete.js +134 -0
  199. package/dist/components/tutorial-filters/index.js +6 -0
  200. package/dist/components/tutorial-filters/tutorial-filters.js +205 -0
  201. package/dist/components/tutorial-intro-content/index.js +6 -0
  202. package/dist/components/tutorial-intro-content/tutorial-intro-content.js +141 -0
  203. package/dist/components/tutorial-mdx/index.js +8 -0
  204. package/dist/components/tutorial-mdx/tutorial-mdx.js +219 -0
  205. package/dist/components/video-embed/index.js +4 -0
  206. package/dist/components/video-embed/video-embed.js +77 -0
  207. package/dist/index.js +12 -8556
  208. package/dist/lib/types.js +11 -0
  209. package/dist/lib/use-debounce.js +17 -0
  210. package/dist/lib/utils.js +8 -0
  211. package/dist/tailwind-preset.d.ts +5 -0
  212. package/dist/tailwind-preset.js +9 -10
  213. package/dist/types/content.js +0 -0
  214. package/dist/types/index.js +0 -0
  215. package/package.json +1 -1
  216. package/dist/chunk-XRV5RSYH.js +0 -569
  217. package/dist/flow-diagram-N3EHM6VB.js +0 -2
@@ -0,0 +1,3 @@
1
+ export * from "./area-chart";
2
+ export * from "./bar-chart";
3
+ export * from "./line-chart";
@@ -0,0 +1,97 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/utils";
4
+ const DEFAULT_WIDTH = 320;
5
+ const DEFAULT_HEIGHT = 140;
6
+ const DEFAULT_STROKE_WIDTH = 2;
7
+ function buildCoordinates(data, dimensions) {
8
+ if (data.length === 0) return [];
9
+ const { height, strokeWidth, width } = dimensions;
10
+ const values = data.map((point) => point.value);
11
+ const minValue = Math.min(...values);
12
+ const maxValue = Math.max(...values);
13
+ const range = maxValue - minValue || 1;
14
+ const safeWidth = Math.max(width - strokeWidth * 2, 0);
15
+ const safeHeight = Math.max(height - strokeWidth * 2, 0);
16
+ return data.map((point, index) => {
17
+ const x = data.length === 1 ? strokeWidth + safeWidth / 2 : strokeWidth + index / (data.length - 1) * safeWidth;
18
+ const ratio = (point.value - minValue) / range;
19
+ const y = safeHeight - ratio * safeHeight + strokeWidth;
20
+ return { x, y };
21
+ });
22
+ }
23
+ const LineChart = React.forwardRef(
24
+ ({
25
+ className,
26
+ color = "currentColor",
27
+ data,
28
+ gradientId = "line-chart-gradient",
29
+ height = DEFAULT_HEIGHT,
30
+ strokeWidth = DEFAULT_STROKE_WIDTH,
31
+ width = DEFAULT_WIDTH,
32
+ ...props
33
+ }, reference) => {
34
+ const canvasData = React.useMemo(
35
+ () => buildCoordinates(data, { height, strokeWidth, width }),
36
+ [data, width, height, strokeWidth]
37
+ );
38
+ if (canvasData.length === 0) {
39
+ return null;
40
+ }
41
+ const linePath = canvasData.map((point, index) => `${index === 0 ? "M" : "L"}${point.x},${point.y}`).join(" ");
42
+ const areaPath = canvasData.length === 0 ? "" : `M${canvasData[0]?.x ?? 0},${height} ${linePath} L${canvasData.at(-1)?.x ?? 0},${height}Z`;
43
+ return /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ className: cn(
47
+ "rounded-lg border border-border bg-background/40 p-3",
48
+ className
49
+ ),
50
+ ref: reference,
51
+ ...props,
52
+ children: /* @__PURE__ */ jsxs(
53
+ "svg",
54
+ {
55
+ "aria-label": "Line chart",
56
+ className: "h-full w-full",
57
+ height,
58
+ role: "img",
59
+ viewBox: `0 0 ${width} ${height}`,
60
+ width,
61
+ children: [
62
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", x2: "0", y1: "0", y2: "1", children: [
63
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.45" }),
64
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
65
+ ] }) }),
66
+ /* @__PURE__ */ jsx(
67
+ "path",
68
+ {
69
+ d: areaPath,
70
+ fill: `url(#${gradientId})`,
71
+ stroke: "none",
72
+ vectorEffect: "non-scaling-stroke"
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ "path",
77
+ {
78
+ d: linePath,
79
+ fill: "none",
80
+ stroke: color,
81
+ strokeLinecap: "round",
82
+ strokeLinejoin: "round",
83
+ strokeWidth,
84
+ vectorEffect: "non-scaling-stroke"
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ )
90
+ }
91
+ );
92
+ }
93
+ );
94
+ LineChart.displayName = "LineChart";
95
+ export {
96
+ LineChart
97
+ };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
5
+ import { Check } from "lucide-react";
6
+ import { cn } from "../../lib/utils";
7
+ const Checkbox = React.forwardRef(({ className, ...props }, reference) => /* @__PURE__ */ jsx(
8
+ CheckboxPrimitive.Root,
9
+ {
10
+ className: cn(
11
+ "peer h-4 w-4 shrink-0 rounded border border-input bg-background ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary",
12
+ className
13
+ ),
14
+ ref: reference,
15
+ ...props,
16
+ children: /* @__PURE__ */ jsx(
17
+ CheckboxPrimitive.Indicator,
18
+ {
19
+ className: cn("flex items-center justify-center text-current"),
20
+ children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
21
+ }
22
+ )
23
+ }
24
+ ));
25
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
26
+ export {
27
+ Checkbox
28
+ };
@@ -0,0 +1,4 @@
1
+ import { Checkbox } from "./checkbox";
2
+ export {
3
+ Checkbox
4
+ };
@@ -0,0 +1,181 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { cn } from "../../lib/utils";
5
+ function ChecklistItemRow({
6
+ isChecked,
7
+ item,
8
+ onToggle
9
+ }) {
10
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
11
+ "button",
12
+ {
13
+ className: cn(
14
+ "w-full flex items-start gap-3 p-2 rounded-md text-left transition-colors hover:bg-muted/50",
15
+ isChecked && "opacity-60"
16
+ ),
17
+ onClick: onToggle,
18
+ type: "button",
19
+ children: [
20
+ isChecked ? /* @__PURE__ */ jsx(
21
+ "svg",
22
+ {
23
+ className: "h-5 w-5 text-green-500 flex-shrink-0 mt-0.5",
24
+ fill: "none",
25
+ stroke: "currentColor",
26
+ viewBox: "0 0 24 24",
27
+ children: /* @__PURE__ */ jsx(
28
+ "path",
29
+ {
30
+ d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",
31
+ strokeLinecap: "round",
32
+ strokeLinejoin: "round",
33
+ strokeWidth: 2
34
+ }
35
+ )
36
+ }
37
+ ) : /* @__PURE__ */ jsx(
38
+ "svg",
39
+ {
40
+ className: "h-5 w-5 text-muted-foreground flex-shrink-0 mt-0.5",
41
+ fill: "none",
42
+ stroke: "currentColor",
43
+ viewBox: "0 0 24 24",
44
+ children: /* @__PURE__ */ jsx(
45
+ "rect",
46
+ {
47
+ height: "18",
48
+ rx: "2",
49
+ strokeLinecap: "round",
50
+ strokeLinejoin: "round",
51
+ strokeWidth: 2,
52
+ width: "18",
53
+ x: "3",
54
+ y: "3"
55
+ }
56
+ )
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
60
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm", isChecked && "line-through"), children: item.label }),
61
+ item.description ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: item.description }) : null
62
+ ] })
63
+ ]
64
+ }
65
+ ) });
66
+ }
67
+ function ChecklistHeader({
68
+ checked,
69
+ progress,
70
+ title,
71
+ total
72
+ }) {
73
+ if (!title) return null;
74
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
75
+ /* @__PURE__ */ jsxs("h4", { className: "font-semibold flex items-center gap-2", children: [
76
+ /* @__PURE__ */ jsx(
77
+ "svg",
78
+ {
79
+ className: "h-5 w-5 text-primary",
80
+ fill: "none",
81
+ stroke: "currentColor",
82
+ viewBox: "0 0 24 24",
83
+ children: /* @__PURE__ */ jsx(
84
+ "path",
85
+ {
86
+ d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",
87
+ strokeLinecap: "round",
88
+ strokeLinejoin: "round",
89
+ strokeWidth: 2
90
+ }
91
+ )
92
+ }
93
+ ),
94
+ title
95
+ ] }),
96
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
97
+ checked,
98
+ "/",
99
+ total,
100
+ " (",
101
+ progress,
102
+ "%)"
103
+ ] })
104
+ ] });
105
+ }
106
+ function Checklist({
107
+ className,
108
+ items,
109
+ onComplete,
110
+ persistKey,
111
+ title
112
+ }) {
113
+ const [checked, setChecked] = useState(() => {
114
+ if (typeof window !== "undefined" && persistKey) {
115
+ const saved = localStorage.getItem(`checklist:${persistKey}`);
116
+ if (saved) {
117
+ try {
118
+ return new Set(JSON.parse(saved));
119
+ } catch {
120
+ }
121
+ }
122
+ }
123
+ return /* @__PURE__ */ new Set();
124
+ });
125
+ const toggleItem = (id) => {
126
+ const newChecked = new Set(checked);
127
+ if (newChecked.has(id)) newChecked.delete(id);
128
+ else newChecked.add(id);
129
+ setChecked(newChecked);
130
+ if (persistKey) {
131
+ try {
132
+ localStorage.setItem(
133
+ `checklist:${persistKey}`,
134
+ JSON.stringify([...newChecked])
135
+ );
136
+ } catch {
137
+ }
138
+ }
139
+ if (newChecked.size === items.length) {
140
+ onComplete?.();
141
+ }
142
+ };
143
+ const allChecked = checked.size === items.length;
144
+ const progress = items.length > 0 ? Math.round(checked.size / items.length * 100) : 0;
145
+ return /* @__PURE__ */ jsxs("div", { className: cn("my-6 rounded-lg border bg-card p-4", className), children: [
146
+ /* @__PURE__ */ jsx(
147
+ ChecklistHeader,
148
+ {
149
+ checked: checked.size,
150
+ progress,
151
+ title,
152
+ total: items.length
153
+ }
154
+ ),
155
+ /* @__PURE__ */ jsx("div", { className: "h-1 bg-muted rounded-full mb-4 overflow-hidden", children: /* @__PURE__ */ jsx(
156
+ "div",
157
+ {
158
+ className: cn(
159
+ "h-full transition-all duration-300",
160
+ allChecked ? "bg-green-500" : "bg-primary"
161
+ ),
162
+ style: { width: `${progress}%` }
163
+ }
164
+ ) }),
165
+ /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: items.map((item) => /* @__PURE__ */ jsx(
166
+ ChecklistItemRow,
167
+ {
168
+ isChecked: checked.has(item.id),
169
+ item,
170
+ onToggle: () => {
171
+ toggleItem(item.id);
172
+ }
173
+ },
174
+ item.id
175
+ )) }),
176
+ allChecked ? /* @__PURE__ */ jsx("div", { className: "mt-4 p-2 rounded bg-green-500/10 text-green-700 dark:text-green-300 text-sm text-center", children: "All items completed!" }) : null
177
+ ] });
178
+ }
179
+ export {
180
+ Checklist
181
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ Checklist
3
+ } from "./checklist";
4
+ export {
5
+ Checklist
6
+ };
@@ -0,0 +1,123 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ import { Check, Copy } from "lucide-react";
5
+ import { useTheme } from "next-themes";
6
+ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
7
+ import {
8
+ oneDark,
9
+ oneLight
10
+ } from "react-syntax-highlighter/dist/esm/styles/prism";
11
+ import { cn } from "../../lib/utils";
12
+ import { Button } from "../button/button";
13
+ function extractTextFromChildren(children) {
14
+ if (typeof children === "string") {
15
+ return children;
16
+ }
17
+ if (typeof children === "number") {
18
+ return String(children);
19
+ }
20
+ if (Array.isArray(children)) {
21
+ return children.map(extractTextFromChildren).join("");
22
+ }
23
+ if (children && typeof children === "object" && "props" in children && children.props && typeof children.props === "object" && "children" in children.props) {
24
+ return extractTextFromChildren(children.props.children);
25
+ }
26
+ return String(children ?? "");
27
+ }
28
+ function CodeBlock({
29
+ children,
30
+ className,
31
+ language = "typescript",
32
+ showLanguage = false
33
+ }) {
34
+ const [copied, setCopied] = useState(false);
35
+ const [mounted, setMounted] = useState(false);
36
+ const { systemTheme, theme } = useTheme();
37
+ useEffect(() => {
38
+ setMounted(true);
39
+ }, []);
40
+ const resolvedTheme = theme === "system" ? systemTheme : theme;
41
+ const isDark = resolvedTheme === "dark";
42
+ const codeStyle = isDark ? oneDark : oneLight;
43
+ const code = extractTextFromChildren(children);
44
+ const handleCopy = async () => {
45
+ await navigator.clipboard.writeText(code);
46
+ setCopied(true);
47
+ setTimeout(() => {
48
+ setCopied(false);
49
+ }, 2e3);
50
+ };
51
+ if (!mounted) {
52
+ return /* @__PURE__ */ jsx(
53
+ "div",
54
+ {
55
+ className: cn(
56
+ "relative w-full overflow-hidden rounded-md border bg-background",
57
+ className
58
+ ),
59
+ children: /* @__PURE__ */ jsxs("div", { className: "relative overflow-x-auto", children: [
60
+ /* @__PURE__ */ jsx("pre", { className: "p-4 text-sm font-mono bg-background", children: /* @__PURE__ */ jsx("code", { children: code }) }),
61
+ /* @__PURE__ */ jsxs("div", { className: "absolute right-2 top-2 flex items-center gap-2", children: [
62
+ showLanguage ? /* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-muted-foreground uppercase tracking-wider", children: language }) : null,
63
+ /* @__PURE__ */ jsx(
64
+ Button,
65
+ {
66
+ className: "h-8 w-8",
67
+ onClick: handleCopy,
68
+ size: "icon",
69
+ variant: "ghost",
70
+ children: /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
71
+ }
72
+ )
73
+ ] })
74
+ ] })
75
+ }
76
+ );
77
+ }
78
+ return /* @__PURE__ */ jsx(
79
+ "div",
80
+ {
81
+ className: cn(
82
+ "relative w-full overflow-hidden rounded-md border bg-background",
83
+ className
84
+ ),
85
+ children: /* @__PURE__ */ jsxs("div", { className: "relative overflow-x-auto", children: [
86
+ /* @__PURE__ */ jsx(
87
+ SyntaxHighlighter,
88
+ {
89
+ codeTagProps: {
90
+ className: "font-mono text-sm"
91
+ },
92
+ customStyle: {
93
+ background: "hsl(var(--background))",
94
+ fontSize: "0.875rem",
95
+ margin: 0,
96
+ minWidth: "fit-content",
97
+ padding: "1rem"
98
+ },
99
+ language,
100
+ style: codeStyle,
101
+ children: code
102
+ }
103
+ ),
104
+ /* @__PURE__ */ jsxs("div", { className: "absolute right-2 top-2 flex items-center gap-2", children: [
105
+ showLanguage ? /* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-muted-foreground uppercase tracking-wider", children: language }) : null,
106
+ /* @__PURE__ */ jsx(
107
+ Button,
108
+ {
109
+ className: "h-8 w-8",
110
+ onClick: handleCopy,
111
+ size: "icon",
112
+ variant: "ghost",
113
+ children: copied ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
114
+ }
115
+ )
116
+ ] })
117
+ ] })
118
+ }
119
+ );
120
+ }
121
+ export {
122
+ CodeBlock
123
+ };
@@ -0,0 +1,4 @@
1
+ import { CodeBlock } from "./code-block";
2
+ export {
3
+ CodeBlock
4
+ };
@@ -0,0 +1,86 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Check, Code, Copy, FileCode } from "lucide-react";
5
+ import { cn } from "../../lib/utils";
6
+ import { Button } from "../button";
7
+ function CodeLine({ highlightLines, line, lineNumber }) {
8
+ const isHighlighted = highlightLines.includes(lineNumber);
9
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex", isHighlighted && "bg-primary/10 -mx-4 px-4"), children: [
10
+ /* @__PURE__ */ jsx("span", { className: "select-none w-8 text-right pr-4 text-muted-foreground/50", children: lineNumber }),
11
+ /* @__PURE__ */ jsx("span", { children: line })
12
+ ] });
13
+ }
14
+ function CodePlayground({
15
+ children,
16
+ description,
17
+ filename,
18
+ highlightLines = [],
19
+ language = "typescript",
20
+ showLineNumbers = false,
21
+ title
22
+ }) {
23
+ const [copied, setCopied] = useState(false);
24
+ const code = typeof children === "string" ? children : "";
25
+ const lines = code.split("\n");
26
+ const handleCopy = async () => {
27
+ await navigator.clipboard.writeText(code);
28
+ setCopied(true);
29
+ setTimeout(() => {
30
+ setCopied(false);
31
+ }, 2e3);
32
+ };
33
+ return /* @__PURE__ */ jsxs("div", { className: "my-6 rounded-lg border bg-card overflow-hidden", children: [
34
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b bg-muted/30", children: [
35
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
36
+ /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded bg-primary/10", children: /* @__PURE__ */ jsx(Code, { className: "h-4 w-4 text-primary" }) }),
37
+ /* @__PURE__ */ jsxs("div", { children: [
38
+ /* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm", children: title }),
39
+ description ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: description }) : null
40
+ ] })
41
+ ] }),
42
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
43
+ filename ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
44
+ /* @__PURE__ */ jsx(FileCode, { className: "h-3 w-3" }),
45
+ /* @__PURE__ */ jsx("span", { className: "font-mono", children: filename })
46
+ ] }) : null,
47
+ /* @__PURE__ */ jsx(
48
+ Button,
49
+ {
50
+ className: "h-8 w-8",
51
+ onClick: handleCopy,
52
+ size: "icon",
53
+ variant: "ghost",
54
+ children: copied ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
55
+ }
56
+ )
57
+ ] })
58
+ ] }),
59
+ /* @__PURE__ */ jsx("div", { className: "relative overflow-x-auto", children: /* @__PURE__ */ jsx("pre", { className: "p-4 text-sm font-mono", children: showLineNumbers ? /* @__PURE__ */ jsx("code", { children: lines.map((line, index) => /* @__PURE__ */ jsx(
60
+ CodeLine,
61
+ {
62
+ highlightLines,
63
+ line,
64
+ lineNumber: index + 1
65
+ },
66
+ index
67
+ )) }) : /* @__PURE__ */ jsx("code", { children: code }) }) }),
68
+ /* @__PURE__ */ jsx("div", { className: "px-4 py-2 border-t bg-muted/30", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-muted-foreground uppercase tracking-wider", children: language }) })
69
+ ] });
70
+ }
71
+ function FileTree({
72
+ children,
73
+ title = "File Structure"
74
+ }) {
75
+ return /* @__PURE__ */ jsxs("div", { className: "my-6 rounded-lg border bg-card overflow-hidden", children: [
76
+ /* @__PURE__ */ jsx("div", { className: "px-4 py-2 border-b bg-muted/30", children: /* @__PURE__ */ jsxs("h4", { className: "font-semibold text-sm flex items-center gap-2", children: [
77
+ /* @__PURE__ */ jsx(FileCode, { className: "h-4 w-4" }),
78
+ title
79
+ ] }) }),
80
+ /* @__PURE__ */ jsx("div", { className: "p-4 font-mono text-sm [&>ul]:m-0 [&>ul]:list-none [&_ul]:ml-4 [&_ul]:list-none [&_li]:text-muted-foreground", children })
81
+ ] });
82
+ }
83
+ export {
84
+ CodePlayground,
85
+ FileTree
86
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ CodePlayground,
3
+ FileTree
4
+ } from "./code-playground";
5
+ export {
6
+ CodePlayground,
7
+ FileTree
8
+ };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
3
+ const Collapsible = CollapsiblePrimitive.Root;
4
+ const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
5
+ const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
6
+ export {
7
+ Collapsible,
8
+ CollapsibleContent,
9
+ CollapsibleTrigger
10
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ Collapsible,
3
+ CollapsibleContent,
4
+ CollapsibleTrigger
5
+ } from "./collapsible";
6
+ export {
7
+ Collapsible,
8
+ CollapsibleContent,
9
+ CollapsibleTrigger
10
+ };