@vllnt/ui 0.1.4 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion.js +172 -0
- package/dist/components/accordion/index.js +12 -0
- package/dist/components/alert/alert.js +53 -0
- package/dist/components/alert/index.js +7 -0
- package/dist/components/alert-dialog/alert-dialog.js +117 -0
- package/dist/components/alert-dialog/index.js +26 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +6 -0
- package/dist/components/aspect-ratio/index.js +4 -0
- package/dist/components/avatar/avatar.js +43 -0
- package/dist/components/avatar/index.js +6 -0
- package/dist/components/badge/badge.js +26 -0
- package/dist/components/badge/index.js +5 -0
- package/dist/components/blog-card/blog-card.js +50 -0
- package/dist/components/blog-card/index.js +5 -0
- package/dist/components/breadcrumb/breadcrumb.js +65 -0
- package/dist/components/breadcrumb/index.js +4 -0
- package/dist/components/button/button.js +48 -0
- package/dist/components/button/index.js +5 -0
- package/dist/components/calendar/calendar.js +71 -0
- package/dist/components/calendar/index.js +4 -0
- package/dist/components/callout/callout.js +59 -0
- package/dist/components/callout/index.js +4 -0
- package/dist/components/card/card.js +64 -0
- package/dist/components/card/index.js +16 -0
- package/dist/components/carousel/carousel.js +235 -0
- package/dist/components/carousel/index.js +14 -0
- package/dist/components/category-filter/category-filter.js +34 -0
- package/dist/components/category-filter/index.js +4 -0
- package/dist/components/chart/area-chart.js +99 -0
- package/dist/components/chart/bar-chart.js +80 -0
- package/dist/components/chart/index.js +3 -0
- package/dist/components/chart/line-chart.js +97 -0
- package/dist/components/checkbox/checkbox.js +28 -0
- package/dist/components/checkbox/index.js +4 -0
- package/dist/components/checklist/checklist.js +181 -0
- package/dist/components/checklist/index.js +6 -0
- package/dist/components/code-block/code-block.js +123 -0
- package/dist/components/code-block/index.js +4 -0
- package/dist/components/code-playground/code-playground.js +86 -0
- package/dist/components/code-playground/index.js +8 -0
- package/dist/components/collapsible/collapsible.js +10 -0
- package/dist/components/collapsible/index.js +10 -0
- package/dist/components/command/command.js +123 -0
- package/dist/components/command/index.js +22 -0
- package/dist/components/comparison/comparison.js +109 -0
- package/dist/components/comparison/index.js +8 -0
- package/dist/components/completion-dialog/completion-dialog.js +173 -0
- package/dist/components/completion-dialog/index.js +6 -0
- package/dist/components/content-intro/content-intro.js +144 -0
- package/dist/components/content-intro/index.js +6 -0
- package/dist/components/context-menu/context-menu.js +154 -0
- package/dist/components/context-menu/index.js +34 -0
- package/dist/components/cookie-consent/cookie-consent.js +171 -0
- package/dist/components/cookie-consent/index.js +8 -0
- package/dist/components/dialog/dialog.js +105 -0
- package/dist/components/dialog/index.js +24 -0
- package/dist/components/drawer/drawer.js +102 -0
- package/dist/components/drawer/index.js +24 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +151 -0
- package/dist/components/dropdown-menu/index.js +34 -0
- package/dist/components/exercise/exercise.js +112 -0
- package/dist/components/exercise/index.js +4 -0
- package/dist/components/faq/faq.js +56 -0
- package/dist/components/faq/index.js +5 -0
- package/dist/components/filter-bar/filter-bar.js +244 -0
- package/dist/components/filter-bar/index.js +6 -0
- package/dist/components/floating-action-button/floating-action-button.js +35 -0
- package/dist/components/floating-action-button/index.js +6 -0
- package/dist/components/flow-diagram/flow-canvas.js +109 -0
- package/dist/components/flow-diagram/flow-controls.js +140 -0
- package/dist/components/flow-diagram/flow-diagram.js +114 -0
- package/dist/components/flow-diagram/flow-error-boundary.js +63 -0
- package/dist/components/flow-diagram/flow-fullscreen.js +58 -0
- package/dist/components/flow-diagram/index.js +12 -0
- package/dist/components/flow-diagram/types.js +0 -0
- package/dist/components/flow-diagram/use-flow-diagram.js +141 -0
- package/dist/components/hover-card/hover-card.js +26 -0
- package/dist/components/hover-card/index.js +6 -0
- package/dist/components/index.js +633 -0
- package/dist/components/inline-input/index.js +4 -0
- package/dist/components/inline-input/inline-input.js +42 -0
- package/dist/components/input/index.js +4 -0
- package/dist/components/input/input.js +23 -0
- package/dist/components/input-otp/index.js +12 -0
- package/dist/components/input-otp/input-otp.js +54 -0
- package/dist/components/key-concept/index.js +8 -0
- package/dist/components/key-concept/key-concept.js +79 -0
- package/dist/components/keyboard-shortcuts-help/index.js +6 -0
- package/dist/components/keyboard-shortcuts-help/keyboard-shortcuts-help.js +121 -0
- package/dist/components/label/index.js +4 -0
- package/dist/components/label/label.js +21 -0
- package/dist/components/lang-provider/index.js +4 -0
- package/dist/components/lang-provider/lang-provider.js +18 -0
- package/dist/components/learning-objectives/index.js +10 -0
- package/dist/components/learning-objectives/learning-objectives.js +76 -0
- package/dist/components/mdx-content/index.js +4 -0
- package/dist/components/mdx-content/mdx-content.js +140 -0
- package/dist/components/menubar/index.js +36 -0
- package/dist/components/menubar/menubar.js +183 -0
- package/dist/components/model-selector/index.js +6 -0
- package/dist/components/model-selector/model-selector.js +374 -0
- package/dist/components/navbar-saas/index.js +6 -0
- package/dist/components/navbar-saas/navbar-saas.js +68 -0
- package/dist/components/navbar-saas/use-mobile.js +19 -0
- package/dist/components/navigation-menu/index.js +22 -0
- package/dist/components/navigation-menu/navigation-menu.js +108 -0
- package/dist/components/pagination/index.js +4 -0
- package/dist/components/pagination/pagination.js +44 -0
- package/dist/components/popover/index.js +12 -0
- package/dist/components/popover/popover.js +28 -0
- package/dist/components/pro-tip/index.js +8 -0
- package/dist/components/pro-tip/pro-tip.js +139 -0
- package/dist/components/profile-section/index.js +4 -0
- package/dist/components/profile-section/profile-section.js +45 -0
- package/dist/components/progress-bar/index.js +4 -0
- package/dist/components/progress-bar/progress-bar.js +56 -0
- package/dist/components/progress-card/index.js +6 -0
- package/dist/components/progress-card/progress-card.js +68 -0
- package/dist/components/quiz/index.js +4 -0
- package/dist/components/quiz/quiz.js +210 -0
- package/dist/components/radio-group/index.js +5 -0
- package/dist/components/radio-group/radio-group.js +36 -0
- package/dist/components/resizable/index.js +10 -0
- package/dist/components/resizable/resizable.js +39 -0
- package/dist/components/scroll-area/index.js +5 -0
- package/dist/components/scroll-area/scroll-area.js +39 -0
- package/dist/components/search-bar/index.js +4 -0
- package/dist/components/search-bar/search-bar.js +120 -0
- package/dist/components/search-dialog/index.js +4 -0
- package/dist/components/search-dialog/search-dialog.js +102 -0
- package/dist/components/select/index.js +24 -0
- package/dist/components/select/select.js +125 -0
- package/dist/components/separator/index.js +4 -0
- package/dist/components/separator/separator.js +25 -0
- package/dist/components/share-dialog/index.js +6 -0
- package/dist/components/share-dialog/share-dialog.js +121 -0
- package/dist/components/share-section/index.js +6 -0
- package/dist/components/share-section/share-section.js +57 -0
- package/dist/components/sheet/index.js +24 -0
- package/dist/components/sheet/sheet.js +116 -0
- package/dist/components/sidebar/index.js +4 -0
- package/dist/components/sidebar/sidebar.js +188 -0
- package/dist/components/sidebar-provider/index.js +5 -0
- package/dist/components/sidebar-provider/sidebar-provider.js +25 -0
- package/dist/components/sidebar-toggle/index.js +4 -0
- package/dist/components/sidebar-toggle/sidebar-toggle.js +36 -0
- package/dist/components/skeleton/index.js +4 -0
- package/dist/components/skeleton/skeleton.js +17 -0
- package/dist/components/slider/index.js +4 -0
- package/dist/components/slider/slider.js +24 -0
- package/dist/components/slideshow/index.js +6 -0
- package/dist/components/slideshow/slideshow.js +442 -0
- package/dist/components/social-fab/index.js +6 -0
- package/dist/components/social-fab/social-fab.js +211 -0
- package/dist/components/social-fab/use-social-fab.js +111 -0
- package/dist/components/spinner/index.js +4 -0
- package/dist/components/spinner/spinner.js +23 -0
- package/dist/components/step-by-step/index.js +8 -0
- package/dist/components/step-by-step/step-by-step.js +194 -0
- package/dist/components/step-navigation/index.js +4 -0
- package/dist/components/step-navigation/step-navigation.js +119 -0
- package/dist/components/switch/index.js +4 -0
- package/dist/components/switch/switch.js +28 -0
- package/dist/components/table/index.js +20 -0
- package/dist/components/table/table.js +87 -0
- package/dist/components/table-of-contents/index.js +4 -0
- package/dist/components/table-of-contents/table-of-contents.js +71 -0
- package/dist/components/table-of-contents-panel/index.js +6 -0
- package/dist/components/table-of-contents-panel/table-of-contents-panel.js +202 -0
- package/dist/components/tabs/index.js +12 -0
- package/dist/components/tabs/tabs.js +84 -0
- package/dist/components/terminal/index.js +8 -0
- package/dist/components/terminal/terminal.js +119 -0
- package/dist/components/textarea/index.js +4 -0
- package/dist/components/textarea/textarea.js +22 -0
- package/dist/components/theme-provider/index.js +4 -0
- package/dist/components/theme-provider/theme-provider.js +11 -0
- package/dist/components/theme-toggle/index.js +4 -0
- package/dist/components/theme-toggle/theme-toggle.js +172 -0
- package/dist/components/thinking-block/index.js +4 -0
- package/dist/components/thinking-block/thinking-block.js +52 -0
- package/dist/components/tldr-section/index.js +4 -0
- package/dist/components/tldr-section/tldr-section.js +92 -0
- package/dist/components/toast/index.js +18 -0
- package/dist/components/toast/toast.js +84 -0
- package/dist/components/toast/toaster.js +38 -0
- package/dist/components/toggle/index.js +5 -0
- package/dist/components/toggle/toggle.js +39 -0
- package/dist/components/toggle-group/index.js +5 -0
- package/dist/components/toggle-group/toggle-group.js +46 -0
- package/dist/components/tooltip/index.js +12 -0
- package/dist/components/tooltip/tooltip.js +27 -0
- package/dist/components/truncated-text/index.js +4 -0
- package/dist/components/truncated-text/truncated-text.js +25 -0
- package/dist/components/tutorial-card/index.js +6 -0
- package/dist/components/tutorial-card/tutorial-card.js +75 -0
- package/dist/components/tutorial-complete/index.js +6 -0
- package/dist/components/tutorial-complete/tutorial-complete.js +134 -0
- package/dist/components/tutorial-filters/index.js +6 -0
- package/dist/components/tutorial-filters/tutorial-filters.js +205 -0
- package/dist/components/tutorial-intro-content/index.js +6 -0
- package/dist/components/tutorial-intro-content/tutorial-intro-content.js +141 -0
- package/dist/components/tutorial-mdx/index.js +8 -0
- package/dist/components/tutorial-mdx/tutorial-mdx.js +219 -0
- package/dist/components/video-embed/index.js +4 -0
- package/dist/components/video-embed/video-embed.js +77 -0
- package/dist/index.js +12 -8556
- package/dist/lib/types.js +11 -0
- package/dist/lib/use-debounce.js +17 -0
- package/dist/lib/utils.js +8 -0
- package/dist/tailwind-preset.d.ts +5 -0
- package/dist/tailwind-preset.js +9 -10
- package/dist/types/content.js +0 -0
- package/dist/types/index.js +0 -0
- package/package.json +1 -1
- package/dist/chunk-XRV5RSYH.js +0 -569
- package/dist/flow-diagram-N3EHM6VB.js +0 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState
|
|
8
|
+
} from "react";
|
|
9
|
+
const SidebarContext = createContext(void 0);
|
|
10
|
+
function useSidebar() {
|
|
11
|
+
const context = useContext(SidebarContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error("useSidebar must be used within SidebarProvider");
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
function SidebarProvider({ children }) {
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const value = useMemo(() => ({ open, setOpen }), [open]);
|
|
20
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value, children });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
SidebarProvider,
|
|
24
|
+
useSidebar
|
|
25
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Menu, X } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
import { Button } from "../button";
|
|
6
|
+
function SidebarToggle({
|
|
7
|
+
className,
|
|
8
|
+
onToggle,
|
|
9
|
+
open
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(
|
|
13
|
+
Button,
|
|
14
|
+
{
|
|
15
|
+
className: cn("lg:hidden", className),
|
|
16
|
+
onClick: onToggle,
|
|
17
|
+
size: "icon",
|
|
18
|
+
variant: "ghost",
|
|
19
|
+
children: open ? /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx(Menu, { className: "h-5 w-5" })
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
Button,
|
|
24
|
+
{
|
|
25
|
+
className: cn("hidden lg:flex", className),
|
|
26
|
+
onClick: onToggle,
|
|
27
|
+
size: "icon",
|
|
28
|
+
variant: "ghost",
|
|
29
|
+
children: /* @__PURE__ */ jsx(Menu, { className: "h-5 w-5" })
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
SidebarToggle
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
function Skeleton({
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: cn("animate-pulse rounded-md bg-muted", className),
|
|
11
|
+
...props
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
Skeleton
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const Slider = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
7
|
+
SliderPrimitive.Root,
|
|
8
|
+
{
|
|
9
|
+
className: cn(
|
|
10
|
+
"relative flex w-full touch-none select-none items-center",
|
|
11
|
+
className
|
|
12
|
+
),
|
|
13
|
+
ref,
|
|
14
|
+
...props,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
|
|
17
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
));
|
|
21
|
+
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
22
|
+
export {
|
|
23
|
+
Slider
|
|
24
|
+
};
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { memo, useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
import { CompletionDialog } from "../completion-dialog";
|
|
7
|
+
const DEFAULT_LABELS = {
|
|
8
|
+
closeLabel: "Close",
|
|
9
|
+
closeTocLabel: "Close table of contents",
|
|
10
|
+
exitLabel: "Exit",
|
|
11
|
+
finishLabel: "Finish",
|
|
12
|
+
nextLabel: "Next",
|
|
13
|
+
openTocLabel: "Open table of contents",
|
|
14
|
+
prevLabel: "Prev",
|
|
15
|
+
sectionsLabel: "Sections"
|
|
16
|
+
};
|
|
17
|
+
function SlideshowImpl({
|
|
18
|
+
completedSections,
|
|
19
|
+
completionDialogTitle = "Mark section as complete?",
|
|
20
|
+
currentIndex,
|
|
21
|
+
labels = {},
|
|
22
|
+
onComplete,
|
|
23
|
+
onExit,
|
|
24
|
+
onNavigate,
|
|
25
|
+
onToggleSection,
|
|
26
|
+
renderContent,
|
|
27
|
+
sections,
|
|
28
|
+
title
|
|
29
|
+
}) {
|
|
30
|
+
const mergedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
31
|
+
const [animationDirection, setAnimationDirection] = useState(null);
|
|
32
|
+
const [isCompletionDialogOpen, setIsCompletionDialogOpen] = useState(false);
|
|
33
|
+
const [isTocOpen, setIsTocOpen] = useState(false);
|
|
34
|
+
const [mounted, setMounted] = useState(false);
|
|
35
|
+
const currentSection = sections[currentIndex];
|
|
36
|
+
const isCurrentCompleted = currentSection ? completedSections.has(currentSection.id) : false;
|
|
37
|
+
const isLastSection = currentIndex === sections.length - 1;
|
|
38
|
+
const canGoNext = currentIndex < sections.length - 1;
|
|
39
|
+
const canGoPrevious = currentIndex > 0;
|
|
40
|
+
const progress = (currentIndex + 1) / sections.length * 100;
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setMounted(true);
|
|
43
|
+
}, []);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
document.body.style.overflow = "hidden";
|
|
46
|
+
return () => {
|
|
47
|
+
document.body.style.overflow = "";
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
const goToSection = useCallback(
|
|
51
|
+
(index, direction) => {
|
|
52
|
+
setAnimationDirection(direction);
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
onNavigate(index);
|
|
55
|
+
setAnimationDirection(null);
|
|
56
|
+
}, 150);
|
|
57
|
+
},
|
|
58
|
+
[onNavigate]
|
|
59
|
+
);
|
|
60
|
+
const handlePrevious = useCallback(() => {
|
|
61
|
+
if (canGoPrevious) goToSection(currentIndex - 1, "right");
|
|
62
|
+
}, [canGoPrevious, currentIndex, goToSection]);
|
|
63
|
+
const handleNext = useCallback(() => {
|
|
64
|
+
if (!canGoNext) {
|
|
65
|
+
if (isCurrentCompleted) onComplete();
|
|
66
|
+
else setIsCompletionDialogOpen(true);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (isCurrentCompleted) goToSection(currentIndex + 1, "left");
|
|
70
|
+
else setIsCompletionDialogOpen(true);
|
|
71
|
+
}, [canGoNext, currentIndex, goToSection, isCurrentCompleted, onComplete]);
|
|
72
|
+
const handleMarkComplete = useCallback(() => {
|
|
73
|
+
if (currentSection) onToggleSection(currentSection.id);
|
|
74
|
+
setIsCompletionDialogOpen(false);
|
|
75
|
+
if (isLastSection) onComplete();
|
|
76
|
+
else goToSection(currentIndex + 1, "left");
|
|
77
|
+
}, [
|
|
78
|
+
currentSection,
|
|
79
|
+
onToggleSection,
|
|
80
|
+
isLastSection,
|
|
81
|
+
onComplete,
|
|
82
|
+
goToSection,
|
|
83
|
+
currentIndex
|
|
84
|
+
]);
|
|
85
|
+
const handleSkip = useCallback(() => {
|
|
86
|
+
setIsCompletionDialogOpen(false);
|
|
87
|
+
if (isLastSection) onComplete();
|
|
88
|
+
else goToSection(currentIndex + 1, "left");
|
|
89
|
+
}, [isLastSection, onComplete, goToSection, currentIndex]);
|
|
90
|
+
const handleTocNavigate = useCallback(
|
|
91
|
+
(index) => {
|
|
92
|
+
setIsTocOpen(false);
|
|
93
|
+
goToSection(index, index > currentIndex ? "left" : "right");
|
|
94
|
+
},
|
|
95
|
+
[currentIndex, goToSection]
|
|
96
|
+
);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
const handleKeyDown = (event) => {
|
|
99
|
+
if (isCompletionDialogOpen) return;
|
|
100
|
+
if (event.key === "Escape") {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
if (isTocOpen) setIsTocOpen(false);
|
|
103
|
+
else onExit();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (event.key === "t" || event.key === "T") {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
setIsTocOpen((p) => !p);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (event.key === "ArrowRight" || event.key === "j") {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
handleNext();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (event.key === "ArrowLeft" || event.key === "k") {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
handlePrevious();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
122
|
+
return () => {
|
|
123
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
124
|
+
};
|
|
125
|
+
}, [handleNext, handlePrevious, onExit, isTocOpen, isCompletionDialogOpen]);
|
|
126
|
+
if (!currentSection || !mounted) return null;
|
|
127
|
+
return createPortal(
|
|
128
|
+
/* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-[9999] bg-background flex flex-col", children: [
|
|
129
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-0 left-0 right-0 h-1 bg-muted z-10", children: /* @__PURE__ */ jsx(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: "h-full bg-foreground transition-all duration-300 ease-out",
|
|
133
|
+
style: { width: `${progress}%` }
|
|
134
|
+
}
|
|
135
|
+
) }),
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 mt-1 border-b border-border bg-background", children: [
|
|
137
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 min-w-0 flex-1", children: [
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
"aria-label": isTocOpen ? mergedLabels.closeTocLabel : mergedLabels.openTocLabel,
|
|
142
|
+
className: "flex-shrink-0 p-2 rounded-lg hover:bg-muted transition-colors",
|
|
143
|
+
onClick: () => {
|
|
144
|
+
setIsTocOpen((p) => !p);
|
|
145
|
+
},
|
|
146
|
+
type: "button",
|
|
147
|
+
children: isTocOpen ? /* @__PURE__ */ jsx(
|
|
148
|
+
"svg",
|
|
149
|
+
{
|
|
150
|
+
className: "h-5 w-5",
|
|
151
|
+
fill: "none",
|
|
152
|
+
stroke: "currentColor",
|
|
153
|
+
viewBox: "0 0 24 24",
|
|
154
|
+
children: /* @__PURE__ */ jsx(
|
|
155
|
+
"path",
|
|
156
|
+
{
|
|
157
|
+
d: "M6 18L18 6M6 6l12 12",
|
|
158
|
+
strokeLinecap: "round",
|
|
159
|
+
strokeLinejoin: "round",
|
|
160
|
+
strokeWidth: 2
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
) : /* @__PURE__ */ jsx(
|
|
165
|
+
"svg",
|
|
166
|
+
{
|
|
167
|
+
className: "h-5 w-5",
|
|
168
|
+
fill: "none",
|
|
169
|
+
stroke: "currentColor",
|
|
170
|
+
viewBox: "0 0 24 24",
|
|
171
|
+
children: /* @__PURE__ */ jsx(
|
|
172
|
+
"path",
|
|
173
|
+
{
|
|
174
|
+
d: "M4 6h16M4 12h16M4 18h16",
|
|
175
|
+
strokeLinecap: "round",
|
|
176
|
+
strokeLinejoin: "round",
|
|
177
|
+
strokeWidth: 2
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
185
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate", children: title }),
|
|
186
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: currentSection.title })
|
|
187
|
+
] })
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
|
|
190
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground tabular-nums hidden sm:inline", children: [
|
|
191
|
+
currentIndex + 1,
|
|
192
|
+
"/",
|
|
193
|
+
sections.length
|
|
194
|
+
] }),
|
|
195
|
+
/* @__PURE__ */ jsx(
|
|
196
|
+
"button",
|
|
197
|
+
{
|
|
198
|
+
"aria-label": mergedLabels.exitLabel,
|
|
199
|
+
className: "p-2 rounded-lg hover:bg-muted transition-colors",
|
|
200
|
+
onClick: onExit,
|
|
201
|
+
type: "button",
|
|
202
|
+
children: /* @__PURE__ */ jsx(
|
|
203
|
+
"svg",
|
|
204
|
+
{
|
|
205
|
+
className: "h-5 w-5",
|
|
206
|
+
fill: "none",
|
|
207
|
+
stroke: "currentColor",
|
|
208
|
+
viewBox: "0 0 24 24",
|
|
209
|
+
children: /* @__PURE__ */ jsx(
|
|
210
|
+
"path",
|
|
211
|
+
{
|
|
212
|
+
d: "M6 18L18 6M6 6l12 12",
|
|
213
|
+
strokeLinecap: "round",
|
|
214
|
+
strokeLinejoin: "round",
|
|
215
|
+
strokeWidth: 2
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
] })
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex-1 overflow-hidden", children: [
|
|
225
|
+
isTocOpen ? /* @__PURE__ */ jsxs(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: "absolute inset-0 z-20 flex animate-in fade-in-0 duration-200",
|
|
229
|
+
onClick: () => {
|
|
230
|
+
setIsTocOpen(false);
|
|
231
|
+
},
|
|
232
|
+
onKeyDown: (event) => {
|
|
233
|
+
if (event.key === "Enter" || event.key === " ")
|
|
234
|
+
setIsTocOpen(false);
|
|
235
|
+
},
|
|
236
|
+
role: "button",
|
|
237
|
+
tabIndex: 0,
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/40" }),
|
|
240
|
+
/* @__PURE__ */ jsxs(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
className: "relative w-full sm:max-w-sm bg-background border-r border-border h-full overflow-auto shadow-2xl",
|
|
244
|
+
onClick: (event) => {
|
|
245
|
+
event.stopPropagation();
|
|
246
|
+
},
|
|
247
|
+
onKeyDown: (event) => {
|
|
248
|
+
event.stopPropagation();
|
|
249
|
+
},
|
|
250
|
+
role: "dialog",
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ jsxs("div", { className: "sticky top-0 flex items-center justify-between px-4 py-3 border-b border-border bg-background", children: [
|
|
253
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: mergedLabels.sectionsLabel }),
|
|
254
|
+
/* @__PURE__ */ jsx(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
"aria-label": mergedLabels.closeLabel,
|
|
258
|
+
className: "p-2 rounded-lg hover:bg-muted transition-colors",
|
|
259
|
+
onClick: () => {
|
|
260
|
+
setIsTocOpen(false);
|
|
261
|
+
},
|
|
262
|
+
type: "button",
|
|
263
|
+
children: /* @__PURE__ */ jsx(
|
|
264
|
+
"svg",
|
|
265
|
+
{
|
|
266
|
+
className: "h-4 w-4",
|
|
267
|
+
fill: "none",
|
|
268
|
+
stroke: "currentColor",
|
|
269
|
+
viewBox: "0 0 24 24",
|
|
270
|
+
children: /* @__PURE__ */ jsx(
|
|
271
|
+
"path",
|
|
272
|
+
{
|
|
273
|
+
d: "M6 18L18 6M6 6l12 12",
|
|
274
|
+
strokeLinecap: "round",
|
|
275
|
+
strokeLinejoin: "round",
|
|
276
|
+
strokeWidth: 2
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ jsx("div", { className: "p-2", children: sections.map((section, index) => {
|
|
285
|
+
const isCompleted = completedSections.has(section.id);
|
|
286
|
+
const isCurrent = index === currentIndex;
|
|
287
|
+
return /* @__PURE__ */ jsxs(
|
|
288
|
+
"button",
|
|
289
|
+
{
|
|
290
|
+
className: cn(
|
|
291
|
+
"w-full flex items-center gap-3 p-3 rounded-lg text-left transition-colors",
|
|
292
|
+
isCurrent ? "bg-muted" : "hover:bg-muted/50"
|
|
293
|
+
),
|
|
294
|
+
onClick: () => {
|
|
295
|
+
handleTocNavigate(index);
|
|
296
|
+
},
|
|
297
|
+
type: "button",
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ jsx(
|
|
300
|
+
"div",
|
|
301
|
+
{
|
|
302
|
+
className: cn(
|
|
303
|
+
"flex-shrink-0 w-5 h-5 rounded-full border-2 flex items-center justify-center",
|
|
304
|
+
isCompleted ? "bg-foreground border-foreground" : "border-muted-foreground"
|
|
305
|
+
),
|
|
306
|
+
children: isCompleted ? /* @__PURE__ */ jsx(
|
|
307
|
+
"svg",
|
|
308
|
+
{
|
|
309
|
+
className: "h-3 w-3 text-background",
|
|
310
|
+
fill: "none",
|
|
311
|
+
stroke: "currentColor",
|
|
312
|
+
viewBox: "0 0 24 24",
|
|
313
|
+
children: /* @__PURE__ */ jsx(
|
|
314
|
+
"path",
|
|
315
|
+
{
|
|
316
|
+
d: "M5 13l4 4L19 7",
|
|
317
|
+
strokeLinecap: "round",
|
|
318
|
+
strokeLinejoin: "round",
|
|
319
|
+
strokeWidth: 2
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
) : null
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
/* @__PURE__ */ jsx(
|
|
327
|
+
"span",
|
|
328
|
+
{
|
|
329
|
+
className: cn(
|
|
330
|
+
"flex-1 text-sm truncate",
|
|
331
|
+
isCompleted && "line-through opacity-60"
|
|
332
|
+
),
|
|
333
|
+
children: section.title
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
`${section.id}-${index}`
|
|
339
|
+
);
|
|
340
|
+
}) })
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
) : null,
|
|
347
|
+
/* @__PURE__ */ jsx("div", { className: "h-full overflow-auto px-4 py-8 md:px-8 lg:px-16", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-3xl", children: /* @__PURE__ */ jsx(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
className: cn(
|
|
351
|
+
"transition-all duration-150 ease-out",
|
|
352
|
+
animationDirection === "left" && "opacity-0 -translate-x-4",
|
|
353
|
+
animationDirection === "right" && "opacity-0 translate-x-4",
|
|
354
|
+
!animationDirection && "opacity-100 translate-x-0"
|
|
355
|
+
),
|
|
356
|
+
children: renderContent(currentSection)
|
|
357
|
+
}
|
|
358
|
+
) }) })
|
|
359
|
+
] }),
|
|
360
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-20 flex items-center justify-between px-4 py-4 border-t border-border bg-background", children: [
|
|
361
|
+
/* @__PURE__ */ jsxs(
|
|
362
|
+
"button",
|
|
363
|
+
{
|
|
364
|
+
className: "min-w-[100px] gap-1 inline-flex items-center justify-center px-4 py-2 rounded-md hover:bg-muted transition-colors disabled:opacity-50 disabled:pointer-events-none",
|
|
365
|
+
disabled: !canGoPrevious,
|
|
366
|
+
onClick: handlePrevious,
|
|
367
|
+
type: "button",
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ jsx(
|
|
370
|
+
"svg",
|
|
371
|
+
{
|
|
372
|
+
className: "h-4 w-4",
|
|
373
|
+
fill: "none",
|
|
374
|
+
stroke: "currentColor",
|
|
375
|
+
viewBox: "0 0 24 24",
|
|
376
|
+
children: /* @__PURE__ */ jsx(
|
|
377
|
+
"path",
|
|
378
|
+
{
|
|
379
|
+
d: "m15 19-7-7 7-7",
|
|
380
|
+
strokeLinecap: "round",
|
|
381
|
+
strokeLinejoin: "round",
|
|
382
|
+
strokeWidth: 2
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
/* @__PURE__ */ jsx("span", { children: mergedLabels.prevLabel })
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ jsxs(
|
|
392
|
+
"button",
|
|
393
|
+
{
|
|
394
|
+
className: "min-w-[100px] gap-1 inline-flex items-center justify-center px-4 py-2 rounded-md bg-foreground text-background hover:bg-foreground/90 transition-colors",
|
|
395
|
+
onClick: handleNext,
|
|
396
|
+
type: "button",
|
|
397
|
+
children: [
|
|
398
|
+
/* @__PURE__ */ jsx("span", { children: isLastSection ? mergedLabels.finishLabel : mergedLabels.nextLabel }),
|
|
399
|
+
!isLastSection && /* @__PURE__ */ jsx(
|
|
400
|
+
"svg",
|
|
401
|
+
{
|
|
402
|
+
className: "h-4 w-4",
|
|
403
|
+
fill: "none",
|
|
404
|
+
stroke: "currentColor",
|
|
405
|
+
viewBox: "0 0 24 24",
|
|
406
|
+
children: /* @__PURE__ */ jsx(
|
|
407
|
+
"path",
|
|
408
|
+
{
|
|
409
|
+
d: "m9 5 7 7-7 7",
|
|
410
|
+
strokeLinecap: "round",
|
|
411
|
+
strokeLinejoin: "round",
|
|
412
|
+
strokeWidth: 2
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
)
|
|
420
|
+
] }),
|
|
421
|
+
/* @__PURE__ */ jsx(
|
|
422
|
+
CompletionDialog,
|
|
423
|
+
{
|
|
424
|
+
description: `You're about to ${isLastSection ? "finish" : "move to the next section from"}: ${currentSection.title}`,
|
|
425
|
+
isOpen: isCompletionDialogOpen,
|
|
426
|
+
onCancel: handleSkip,
|
|
427
|
+
onClose: () => {
|
|
428
|
+
setIsCompletionDialogOpen(false);
|
|
429
|
+
},
|
|
430
|
+
onConfirm: handleMarkComplete,
|
|
431
|
+
title: completionDialogTitle
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
] }),
|
|
435
|
+
document.body
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
const Slideshow = memo(SlideshowImpl);
|
|
439
|
+
Slideshow.displayName = "Slideshow";
|
|
440
|
+
export {
|
|
441
|
+
Slideshow
|
|
442
|
+
};
|