@vllnt/ui 0.4.0-canary.sha2f78bdd → 0.4.0-canary.sha8741950
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/animated-text/animated-text.js +10 -5
- package/dist/components/category-filter/category-filter.js +1 -1
- package/dist/components/checklist/checklist.js +27 -21
- package/dist/components/chronological-timeline/chronological-timeline.js +0 -1
- package/dist/components/color-picker/color-picker.js +1 -1
- package/dist/components/command/command.js +14 -17
- package/dist/components/completion-dialog/completion-dialog.js +61 -38
- package/dist/components/content-intro/content-intro.js +145 -102
- package/dist/components/date-range-picker/date-range-picker.js +2 -2
- package/dist/components/filter-bar/filter-bar.js +27 -9
- package/dist/components/index.js +428 -322
- package/dist/components/inline-input/inline-input.js +4 -1
- package/dist/components/keyboard-shortcuts-help/keyboard-shortcuts-help.js +44 -36
- package/dist/components/mdx-content/mdx-content.js +0 -1
- package/dist/components/pro-tip/pro-tip.js +30 -24
- package/dist/components/progress-tracker/progress-tracker.js +296 -169
- package/dist/components/quiz/quiz.js +85 -76
- package/dist/components/range-calendar/range-calendar.js +1 -1
- package/dist/components/sidebar/sidebar.js +191 -100
- package/dist/components/slideshow/slideshow.js +24 -8
- package/dist/components/step-by-step/step-by-step.js +86 -93
- package/dist/components/step-navigation/step-navigation.js +31 -50
- package/dist/components/table-of-contents-panel/table-of-contents-panel.js +181 -134
- package/dist/components/tabs/tabs.js +23 -9
- package/dist/components/time-picker/time-picker.js +1 -1
- package/dist/components/tutorial-complete/tutorial-complete.js +155 -86
- package/dist/index.d.ts +12 -6
- package/package.json +1 -4
- package/dist/components/accordion/index.js +0 -12
- package/dist/components/activity-heatmap/index.js +0 -6
- package/dist/components/activity-log/index.js +0 -6
- package/dist/components/agent-activity/index.js +0 -18
- package/dist/components/ai-artifact/index.js +0 -24
- package/dist/components/ai-chat-input/index.js +0 -4
- package/dist/components/ai-message-bubble/index.js +0 -6
- package/dist/components/ai-sidebar/index.js +0 -22
- package/dist/components/ai-source-citation/index.js +0 -6
- package/dist/components/ai-streaming-text/index.js +0 -6
- package/dist/components/ai-tool-call-display/index.js +0 -6
- package/dist/components/alert/index.js +0 -7
- package/dist/components/alert-dialog/index.js +0 -26
- package/dist/components/alert-pulse/index.js +0 -6
- package/dist/components/anchor-port/index.js +0 -4
- package/dist/components/animated-beam/index.js +0 -4
- package/dist/components/animated-grid-pattern/index.js +0 -6
- package/dist/components/animated-list/index.js +0 -4
- package/dist/components/animated-tabs/index.js +0 -6
- package/dist/components/animated-testimonials/index.js +0 -6
- package/dist/components/animated-text/index.js +0 -4
- package/dist/components/animated-tooltip/index.js +0 -6
- package/dist/components/annotation/index.js +0 -8
- package/dist/components/aspect-ratio/index.js +0 -4
- package/dist/components/auto-reload/index.js +0 -6
- package/dist/components/avatar/index.js +0 -6
- package/dist/components/avatar-group/index.js +0 -10
- package/dist/components/badge/index.js +0 -5
- package/dist/components/banner/index.js +0 -10
- package/dist/components/bento-grid/index.js +0 -8
- package/dist/components/blog-card/index.js +0 -5
- package/dist/components/blur-reveal/index.js +0 -4
- package/dist/components/border-beam/index.js +0 -4
- package/dist/components/bottom-activity-strip/index.js +0 -6
- package/dist/components/bottom-bar/index.js +0 -4
- package/dist/components/breadcrumb/index.js +0 -4
- package/dist/components/button/index.js +0 -5
- package/dist/components/button-group/index.js +0 -8
- package/dist/components/calendar/index.js +0 -4
- package/dist/components/callout/index.js +0 -4
- package/dist/components/candlestick-chart/index.js +0 -6
- package/dist/components/canvas-shell/index.js +0 -4
- package/dist/components/canvas-view/index.js +0 -6
- package/dist/components/card/index.js +0 -16
- package/dist/components/card-flip/index.js +0 -4
- package/dist/components/carousel/index.js +0 -14
- package/dist/components/category-filter/index.js +0 -4
- package/dist/components/chain-of-thought/index.js +0 -6
- package/dist/components/chart/index.js +0 -3
- package/dist/components/chat-dock-section/index.js +0 -6
- package/dist/components/checkbox/index.js +0 -4
- package/dist/components/checkbox-group/index.js +0 -8
- package/dist/components/checklist/index.js +0 -14
- package/dist/components/choropleth-map/index.js +0 -10
- package/dist/components/chronological-timeline/index.js +0 -8
- package/dist/components/civilization-card/index.js +0 -8
- package/dist/components/code-block/index.js +0 -4
- package/dist/components/code-playground/index.js +0 -8
- package/dist/components/collapsible/index.js +0 -10
- package/dist/components/color-picker/index.js +0 -4
- package/dist/components/combobox/index.js +0 -4
- package/dist/components/command/index.js +0 -22
- package/dist/components/comment-pin/index.js +0 -6
- package/dist/components/comparison/index.js +0 -8
- package/dist/components/completion-dialog/index.js +0 -6
- package/dist/components/connector-edge/index.js +0 -6
- package/dist/components/content-intro/index.js +0 -6
- package/dist/components/context-lens/index.js +0 -6
- package/dist/components/context-menu/index.js +0 -34
- package/dist/components/contribution-graph/index.js +0 -6
- package/dist/components/conversation-thread/index.js +0 -20
- package/dist/components/cookie-consent/index.js +0 -8
- package/dist/components/copy-button/index.js +0 -8
- package/dist/components/countdown-timer/index.js +0 -4
- package/dist/components/credit-badge/index.js +0 -6
- package/dist/components/curriculum/index.js +0 -10
- package/dist/components/cursor/index.js +0 -4
- package/dist/components/data-list/index.js +0 -16
- package/dist/components/data-table/index.js +0 -6
- package/dist/components/date-field/index.js +0 -4
- package/dist/components/date-picker/index.js +0 -4
- package/dist/components/date-range-picker/index.js +0 -6
- package/dist/components/dialog/index.js +0 -24
- package/dist/components/display/index.js +0 -4
- package/dist/components/dock/index.js +0 -5
- package/dist/components/document-sibling-nav/index.js +0 -8
- package/dist/components/dot-pattern/index.js +0 -4
- package/dist/components/drawer/index.js +0 -24
- package/dist/components/dropdown-menu/index.js +0 -34
- package/dist/components/edge-label/index.js +0 -4
- package/dist/components/empty-state/index.js +0 -8
- package/dist/components/era-comparison/index.js +0 -16
- package/dist/components/exercise/index.js +0 -4
- package/dist/components/expandable-cards/index.js +0 -6
- package/dist/components/faq/index.js +0 -5
- package/dist/components/field/index.js +0 -16
- package/dist/components/fieldset/index.js +0 -10
- package/dist/components/file-upload/index.js +0 -4
- package/dist/components/filter-bar/index.js +0 -6
- package/dist/components/flashcard/index.js +0 -4
- package/dist/components/floating-action-button/index.js +0 -6
- package/dist/components/floating-navbar/index.js +0 -4
- package/dist/components/floating-toolbar/index.js +0 -6
- package/dist/components/follow-mode/index.js +0 -6
- package/dist/components/form/index.js +0 -20
- package/dist/components/gantt-chart/index.js +0 -6
- package/dist/components/gauge-chart/index.js +0 -4
- package/dist/components/geography-quiz-map/index.js +0 -12
- package/dist/components/glass-card/index.js +0 -4
- package/dist/components/glass-panel/index.js +0 -4
- package/dist/components/glass-progress/index.js +0 -4
- package/dist/components/globe-3d/index.js +0 -10
- package/dist/components/grid/index.js +0 -4
- package/dist/components/group-hull/index.js +0 -4
- package/dist/components/handoff-beacon/index.js +0 -6
- package/dist/components/heading/index.js +0 -4
- package/dist/components/heat-map-overlay/index.js +0 -6
- package/dist/components/heat-overlay/index.js +0 -6
- package/dist/components/historic-timeline/index.js +0 -6
- package/dist/components/historical-figure-card/index.js +0 -6
- package/dist/components/horizontal-scroll-row/index.js +0 -6
- package/dist/components/hover-card/index.js +0 -6
- package/dist/components/infinite-plane/index.js +0 -6
- package/dist/components/inline-input/index.js +0 -4
- package/dist/components/input/index.js +0 -4
- package/dist/components/input-group/index.js +0 -14
- package/dist/components/input-otp/index.js +0 -12
- package/dist/components/interactive-timeline/index.js +0 -16
- package/dist/components/item/index.js +0 -18
- package/dist/components/jarvis-dock/index.js +0 -6
- package/dist/components/kbd/index.js +0 -5
- package/dist/components/key-concept/index.js +0 -8
- package/dist/components/keyboard-shortcuts-help/index.js +0 -6
- package/dist/components/knowledge-check/index.js +0 -6
- package/dist/components/label/index.js +0 -4
- package/dist/components/lang-provider/index.js +0 -4
- package/dist/components/learning-objectives/index.js +0 -10
- package/dist/components/left-rail/index.js +0 -4
- package/dist/components/link/index.js +0 -5
- package/dist/components/liquid-glass/index.js +0 -4
- package/dist/components/list-box/index.js +0 -8
- package/dist/components/live-cursor/index.js +0 -6
- package/dist/components/live-feed/index.js +0 -4
- package/dist/components/magnetic/index.js +0 -4
- package/dist/components/magnetic-button/index.js +0 -4
- package/dist/components/map-2d/index.js +0 -20
- package/dist/components/map-timeline/index.js +0 -16
- package/dist/components/market-treemap/index.js +0 -6
- package/dist/components/marquee/index.js +0 -4
- package/dist/components/mdx-content/index.js +0 -4
- package/dist/components/menubar/index.js +0 -36
- package/dist/components/meteors/index.js +0 -4
- package/dist/components/meter/index.js +0 -5
- package/dist/components/metric-cluster/index.js +0 -6
- package/dist/components/metric-gauge/index.js +0 -6
- package/dist/components/mini-map-panel/index.js +0 -6
- package/dist/components/model-comparison/index.js +0 -12
- package/dist/components/model-selector/index.js +0 -6
- package/dist/components/multi-select/index.js +0 -6
- package/dist/components/multi-select-lasso/index.js +0 -6
- package/dist/components/native-select/index.js +0 -4
- package/dist/components/navbar-saas/index.js +0 -6
- package/dist/components/navigation-menu/index.js +0 -22
- package/dist/components/newsletter-signup/index.js +0 -8
- package/dist/components/number-input/index.js +0 -4
- package/dist/components/number-ticker/index.js +0 -4
- package/dist/components/object-card/index.js +0 -6
- package/dist/components/object-handle/index.js +0 -4
- package/dist/components/object-inspector/index.js +0 -6
- package/dist/components/order-book/index.js +0 -6
- package/dist/components/overview-board/index.js +0 -8
- package/dist/components/pagination/index.js +0 -4
- package/dist/components/panel/index.js +0 -16
- package/dist/components/parallel-timeline/index.js +0 -6
- package/dist/components/particles/index.js +0 -4
- package/dist/components/password-input/index.js +0 -4
- package/dist/components/phone-input/index.js +0 -6
- package/dist/components/pie-chart/index.js +0 -4
- package/dist/components/plan-badge/index.js +0 -6
- package/dist/components/playback-ghost/index.js +0 -6
- package/dist/components/policy-delivery-panel/index.js +0 -6
- package/dist/components/popover/index.js +0 -12
- package/dist/components/presence-stack/index.js +0 -6
- package/dist/components/presence-sync-indicator/index.js +0 -6
- package/dist/components/pricing-table/index.js +0 -8
- package/dist/components/primary-source-viewer/index.js +0 -26
- package/dist/components/pro-tip/index.js +0 -8
- package/dist/components/profile-section/index.js +0 -4
- package/dist/components/progress-bar/index.js +0 -4
- package/dist/components/progress-card/index.js +0 -6
- package/dist/components/progress-tracker/index.js +0 -20
- package/dist/components/progressive-blur/index.js +0 -6
- package/dist/components/prompt-input/index.js +0 -4
- package/dist/components/prompt-templates/index.js +0 -6
- package/dist/components/property-section/index.js +0 -6
- package/dist/components/prose/index.js +0 -4
- package/dist/components/qr-code/index.js +0 -4
- package/dist/components/quiz/index.js +0 -4
- package/dist/components/radar-chart/index.js +0 -6
- package/dist/components/radio-group/index.js +0 -5
- package/dist/components/range-calendar/index.js +0 -4
- package/dist/components/rating/index.js +0 -4
- package/dist/components/reasoning/index.js +0 -4
- package/dist/components/relationship-inspector/index.js +0 -6
- package/dist/components/resizable/index.js +0 -10
- package/dist/components/reveal-text/index.js +0 -6
- package/dist/components/right-dock/index.js +0 -4
- package/dist/components/role-badge/index.js +0 -6
- package/dist/components/route-map/index.js +0 -6
- package/dist/components/routing-assignment-panel/index.js +0 -6
- package/dist/components/run-timeline/index.js +0 -6
- package/dist/components/runtime-overview-panel/index.js +0 -6
- package/dist/components/sankey-chart/index.js +0 -6
- package/dist/components/scope-selector/index.js +0 -6
- package/dist/components/scramble-text/index.js +0 -4
- package/dist/components/scroll-area/index.js +0 -5
- package/dist/components/scroll-progress/index.js +0 -4
- package/dist/components/search-bar/index.js +0 -4
- package/dist/components/search-dialog/index.js +0 -4
- package/dist/components/search-field/index.js +0 -4
- package/dist/components/segmented-control/index.js +0 -12
- package/dist/components/select/index.js +0 -24
- package/dist/components/selection-halo/index.js +0 -6
- package/dist/components/selection-presence/index.js +0 -6
- package/dist/components/separator/index.js +0 -4
- package/dist/components/severity-badge/index.js +0 -8
- package/dist/components/share-dialog/index.js +0 -6
- package/dist/components/share-section/index.js +0 -6
- package/dist/components/sheet/index.js +0 -24
- package/dist/components/shimmer-button/index.js +0 -4
- package/dist/components/shimmer-text/index.js +0 -4
- package/dist/components/shine-border/index.js +0 -4
- package/dist/components/shiny-button/index.js +0 -4
- package/dist/components/sidebar/index.js +0 -4
- package/dist/components/sidebar-provider/index.js +0 -5
- package/dist/components/sidebar-toggle/index.js +0 -4
- package/dist/components/skeleton/index.js +0 -4
- package/dist/components/slider/index.js +0 -4
- package/dist/components/slideshow/index.js +0 -6
- package/dist/components/snap-guides/index.js +0 -6
- package/dist/components/social-fab/index.js +0 -6
- package/dist/components/sparkles/index.js +0 -4
- package/dist/components/sparkline-grid/index.js +0 -6
- package/dist/components/spinner/index.js +0 -8
- package/dist/components/spinning-text/index.js +0 -4
- package/dist/components/spotlight-card/index.js +0 -4
- package/dist/components/stat-card/index.js +0 -5
- package/dist/components/state-badge-overlay/index.js +0 -6
- package/dist/components/static-code/index.js +0 -4
- package/dist/components/status-board/index.js +0 -6
- package/dist/components/status-indicator/index.js +0 -10
- package/dist/components/step-by-step/index.js +0 -8
- package/dist/components/step-navigation/index.js +0 -4
- package/dist/components/stepper/index.js +0 -4
- package/dist/components/sticky-metric/index.js +0 -6
- package/dist/components/story-map/index.js +0 -8
- package/dist/components/subscription-card/index.js +0 -6
- package/dist/components/switch/index.js +0 -4
- package/dist/components/table/index.js +0 -20
- package/dist/components/table-of-contents/index.js +0 -4
- package/dist/components/table-of-contents-panel/index.js +0 -6
- package/dist/components/tabs/index.js +0 -12
- package/dist/components/tag-group/index.js +0 -8
- package/dist/components/tags-input/index.js +0 -4
- package/dist/components/terminal/index.js +0 -8
- package/dist/components/text/index.js +0 -5
- package/dist/components/text-animate/index.js +0 -6
- package/dist/components/text-field/index.js +0 -4
- package/dist/components/text-reveal/index.js +0 -4
- package/dist/components/text-shimmer/index.js +0 -4
- package/dist/components/textarea/index.js +0 -4
- package/dist/components/theme-preset-provider/index.js +0 -4
- package/dist/components/theme-provider/index.js +0 -4
- package/dist/components/theme-switcher/index.js +0 -4
- package/dist/components/theme-toggle/index.js +0 -4
- package/dist/components/thinking-block/index.js +0 -4
- package/dist/components/thread-bubble/index.js +0 -6
- package/dist/components/threshold-ring/index.js +0 -6
- package/dist/components/ticker-tape/index.js +0 -6
- package/dist/components/tilt-card/index.js +0 -4
- package/dist/components/time-field/index.js +0 -4
- package/dist/components/time-picker/index.js +0 -4
- package/dist/components/timeline/index.js +0 -12
- package/dist/components/timeline-scrubber/index.js +0 -6
- package/dist/components/tldr-section/index.js +0 -4
- package/dist/components/toast/index.js +0 -18
- package/dist/components/toggle/index.js +0 -5
- package/dist/components/toggle-group/index.js +0 -5
- package/dist/components/toolbar/index.js +0 -8
- package/dist/components/tooltip/index.js +0 -12
- package/dist/components/top-bar/index.js +0 -4
- package/dist/components/tour/index.js +0 -4
- package/dist/components/transaction-list/index.js +0 -14
- package/dist/components/tree-view/index.js +0 -6
- package/dist/components/truncated-text/index.js +0 -4
- package/dist/components/tutorial-card/index.js +0 -6
- package/dist/components/tutorial-complete/index.js +0 -6
- package/dist/components/tutorial-filters/index.js +0 -6
- package/dist/components/tutorial-intro-content/index.js +0 -6
- package/dist/components/tutorial-mdx/index.js +0 -8
- package/dist/components/typewriter/index.js +0 -4
- package/dist/components/typography/index.js +0 -26
- package/dist/components/usage-breakdown/index.js +0 -6
- package/dist/components/video-embed/index.js +0 -4
- package/dist/components/view-switcher/index.js +0 -6
- package/dist/components/viewport-bookmarks/index.js +0 -6
- package/dist/components/wallet-card/index.js +0 -4
- package/dist/components/watchlist/index.js +0 -6
- package/dist/components/workspace-switcher/index.js +0 -6
- package/dist/components/world-breadcrumbs/index.js +0 -6
- package/dist/components/world-clock-bar/index.js +0 -6
- package/dist/components/zoom-hud/index.js +0 -4
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../../lib/utils.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const glyphSegmenterCache = {};
|
|
6
|
+
function splitGlyphs(text) {
|
|
7
|
+
if (glyphSegmenterCache.segmenter === void 0) {
|
|
8
|
+
glyphSegmenterCache.segmenter = typeof Intl.Segmenter === "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
9
|
+
}
|
|
10
|
+
const { segmenter } = glyphSegmenterCache;
|
|
11
|
+
return segmenter ? Array.from(segmenter.segment(text), ({ segment }) => segment) : text.match(/./gsu) ?? [];
|
|
12
|
+
}
|
|
8
13
|
const ASCII_RANDOM_CHARACTERS = Array.from(
|
|
9
14
|
{ length: 94 },
|
|
10
15
|
(_, index) => String.fromCodePoint(index + 33)
|
|
@@ -24,12 +29,12 @@ const ANIMATED_TEXT_RANDOM_CHARACTER_PRESETS = {
|
|
|
24
29
|
const DEFAULT_RANDOM_CHARACTERS = ANIMATED_TEXT_RANDOM_CHARACTER_PRESETS.matrix;
|
|
25
30
|
function getSegments(text, splitBy) {
|
|
26
31
|
if (splitBy === "character") {
|
|
27
|
-
return
|
|
32
|
+
return splitGlyphs(text);
|
|
28
33
|
}
|
|
29
34
|
return text.match(/\S+\s*/g) ?? [];
|
|
30
35
|
}
|
|
31
36
|
function getGlyphs(text) {
|
|
32
|
-
return
|
|
37
|
+
return splitGlyphs(text);
|
|
33
38
|
}
|
|
34
39
|
function getRandomMatrixGlyph(randomCharacters) {
|
|
35
40
|
const glyphs = getGlyphs(randomCharacters);
|
|
@@ -8,7 +8,7 @@ function slugify(text) {
|
|
|
8
8
|
}
|
|
9
9
|
function CategoryFilter({ categories, lang }) {
|
|
10
10
|
const pathname = usePathname();
|
|
11
|
-
const allCategories =
|
|
11
|
+
const allCategories = [...new Set(categories)].sort();
|
|
12
12
|
if (allCategories.length === 0) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
@@ -130,6 +130,29 @@ function ChecklistHeader({
|
|
|
130
130
|
] })
|
|
131
131
|
] });
|
|
132
132
|
}
|
|
133
|
+
function readPersistedChecklist(persistKey) {
|
|
134
|
+
if (typeof window !== "undefined" && persistKey) {
|
|
135
|
+
const saved = localStorage.getItem(`checklist:${persistKey}`);
|
|
136
|
+
if (saved) {
|
|
137
|
+
return new Set(parseChecklistStorageValue(saved));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return /* @__PURE__ */ new Set();
|
|
141
|
+
}
|
|
142
|
+
function persistChecklist(persistKey, ids) {
|
|
143
|
+
try {
|
|
144
|
+
localStorage.setItem(
|
|
145
|
+
`checklist:${persistKey}`,
|
|
146
|
+
createChecklistStorageValue(ids)
|
|
147
|
+
);
|
|
148
|
+
window.dispatchEvent(
|
|
149
|
+
new CustomEvent(CHECKLIST_PROGRESS_EVENT, {
|
|
150
|
+
detail: { persistKey }
|
|
151
|
+
})
|
|
152
|
+
);
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
}
|
|
133
156
|
function Checklist({
|
|
134
157
|
as: Heading = "h4",
|
|
135
158
|
className,
|
|
@@ -138,33 +161,16 @@ function Checklist({
|
|
|
138
161
|
persistKey,
|
|
139
162
|
title
|
|
140
163
|
}) {
|
|
141
|
-
const [checked, setChecked] = useState(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (saved) {
|
|
145
|
-
return new Set(parseChecklistStorageValue(saved));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return /* @__PURE__ */ new Set();
|
|
149
|
-
});
|
|
164
|
+
const [checked, setChecked] = useState(
|
|
165
|
+
() => readPersistedChecklist(persistKey)
|
|
166
|
+
);
|
|
150
167
|
const toggleItem = (id) => {
|
|
151
168
|
const newChecked = new Set(checked);
|
|
152
169
|
if (newChecked.has(id)) newChecked.delete(id);
|
|
153
170
|
else newChecked.add(id);
|
|
154
171
|
setChecked(newChecked);
|
|
155
172
|
if (persistKey) {
|
|
156
|
-
|
|
157
|
-
localStorage.setItem(
|
|
158
|
-
`checklist:${persistKey}`,
|
|
159
|
-
createChecklistStorageValue(newChecked)
|
|
160
|
-
);
|
|
161
|
-
window.dispatchEvent(
|
|
162
|
-
new CustomEvent(CHECKLIST_PROGRESS_EVENT, {
|
|
163
|
-
detail: { persistKey }
|
|
164
|
-
})
|
|
165
|
-
);
|
|
166
|
-
} catch {
|
|
167
|
-
}
|
|
173
|
+
persistChecklist(persistKey, newChecked);
|
|
168
174
|
}
|
|
169
175
|
if (newChecked.size === items.length) {
|
|
170
176
|
onComplete?.();
|
|
@@ -175,7 +175,6 @@ const ChronoEvent = ({
|
|
|
175
175
|
return (
|
|
176
176
|
/* Passive focus tracking: the container observes focus bubbling from
|
|
177
177
|
its interactive children to drive the scroll-spy active state. */
|
|
178
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
179
178
|
/* @__PURE__ */ jsxs(
|
|
180
179
|
"article",
|
|
181
180
|
{
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cn } from "../../lib/utils.js";
|
|
5
5
|
import { Button } from "../button/button.js";
|
|
6
6
|
import { Input } from "../input/input.js";
|
|
7
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../popover/
|
|
7
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover/popover.js";
|
|
8
8
|
const presetSwatches = [
|
|
9
9
|
"#ef4444",
|
|
10
10
|
"#f97316",
|
|
@@ -30,23 +30,20 @@ const CommandInput = ({
|
|
|
30
30
|
className,
|
|
31
31
|
ref: reference,
|
|
32
32
|
...props
|
|
33
|
-
}) => (
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
className
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
48
|
-
] })
|
|
49
|
-
);
|
|
33
|
+
}) => /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Search, { className: "mr-2 size-4 shrink-0 opacity-50" }),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
CommandPrimitive.Input,
|
|
37
|
+
{
|
|
38
|
+
className: cn(
|
|
39
|
+
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
ref: reference,
|
|
43
|
+
...props
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] });
|
|
50
47
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
51
48
|
const CommandList = ({
|
|
52
49
|
className,
|
|
@@ -3,6 +3,38 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { memo, useEffect, useRef } from "react";
|
|
4
4
|
import { cn } from "../../lib/utils.js";
|
|
5
5
|
import { Button } from "../button/button.js";
|
|
6
|
+
function DialogCloseButton({
|
|
7
|
+
closeIcon,
|
|
8
|
+
onClose
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
"aria-label": "Close",
|
|
14
|
+
className: "absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 transition-opacity",
|
|
15
|
+
onClick: onClose,
|
|
16
|
+
type: "button",
|
|
17
|
+
children: closeIcon ?? /* @__PURE__ */ jsx(
|
|
18
|
+
"svg",
|
|
19
|
+
{
|
|
20
|
+
className: "size-4",
|
|
21
|
+
fill: "none",
|
|
22
|
+
stroke: "currentColor",
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
children: /* @__PURE__ */ jsx(
|
|
25
|
+
"path",
|
|
26
|
+
{
|
|
27
|
+
d: "M6 18L18 6M6 6l12 12",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
strokeWidth: 2
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
6
38
|
function DialogContent({
|
|
7
39
|
as: Heading = "h2",
|
|
8
40
|
cancelLabel = "Skip",
|
|
@@ -30,33 +62,7 @@ function DialogContent({
|
|
|
30
62
|
className
|
|
31
63
|
),
|
|
32
64
|
children: [
|
|
33
|
-
/* @__PURE__ */ jsx(
|
|
34
|
-
"button",
|
|
35
|
-
{
|
|
36
|
-
"aria-label": "Close",
|
|
37
|
-
className: "absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 transition-opacity",
|
|
38
|
-
onClick: onClose,
|
|
39
|
-
type: "button",
|
|
40
|
-
children: closeIcon ?? /* @__PURE__ */ jsx(
|
|
41
|
-
"svg",
|
|
42
|
-
{
|
|
43
|
-
className: "size-4",
|
|
44
|
-
fill: "none",
|
|
45
|
-
stroke: "currentColor",
|
|
46
|
-
viewBox: "0 0 24 24",
|
|
47
|
-
children: /* @__PURE__ */ jsx(
|
|
48
|
-
"path",
|
|
49
|
-
{
|
|
50
|
-
d: "M6 18L18 6M6 6l12 12",
|
|
51
|
-
strokeLinecap: "round",
|
|
52
|
-
strokeLinejoin: "round",
|
|
53
|
-
strokeWidth: 2
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
),
|
|
65
|
+
/* @__PURE__ */ jsx(DialogCloseButton, { closeIcon, onClose }),
|
|
60
66
|
/* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
|
|
61
67
|
/* @__PURE__ */ jsx(Heading, { className: "text-lg font-semibold", id: "completion-dialog-title", children: title }),
|
|
62
68
|
description ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground mt-1.5", children: description }) : null
|
|
@@ -83,20 +89,13 @@ function DialogContent({
|
|
|
83
89
|
}
|
|
84
90
|
);
|
|
85
91
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
cancelShortcut = "S",
|
|
90
|
-
className,
|
|
91
|
-
closeIcon,
|
|
92
|
-
confirmLabel,
|
|
93
|
-
confirmShortcut = "D",
|
|
94
|
-
description,
|
|
92
|
+
function useCompletionDialogKeyboard({
|
|
93
|
+
cancelShortcut,
|
|
94
|
+
confirmShortcut,
|
|
95
95
|
isOpen,
|
|
96
96
|
onCancel,
|
|
97
97
|
onClose,
|
|
98
|
-
onConfirm
|
|
99
|
-
title
|
|
98
|
+
onConfirm
|
|
100
99
|
}) {
|
|
101
100
|
const keyDownHandlerRef = useRef(() => {
|
|
102
101
|
return;
|
|
@@ -133,6 +132,30 @@ function CompletionDialogImpl({
|
|
|
133
132
|
document.removeEventListener("keydown", onDocumentKeyDown, true);
|
|
134
133
|
};
|
|
135
134
|
}, [isOpen]);
|
|
135
|
+
}
|
|
136
|
+
function CompletionDialogImpl({
|
|
137
|
+
as,
|
|
138
|
+
cancelLabel,
|
|
139
|
+
cancelShortcut = "S",
|
|
140
|
+
className,
|
|
141
|
+
closeIcon,
|
|
142
|
+
confirmLabel,
|
|
143
|
+
confirmShortcut = "D",
|
|
144
|
+
description,
|
|
145
|
+
isOpen,
|
|
146
|
+
onCancel,
|
|
147
|
+
onClose,
|
|
148
|
+
onConfirm,
|
|
149
|
+
title
|
|
150
|
+
}) {
|
|
151
|
+
useCompletionDialogKeyboard({
|
|
152
|
+
cancelShortcut,
|
|
153
|
+
confirmShortcut,
|
|
154
|
+
isOpen,
|
|
155
|
+
onCancel,
|
|
156
|
+
onClose,
|
|
157
|
+
onConfirm
|
|
158
|
+
});
|
|
136
159
|
if (!isOpen) return null;
|
|
137
160
|
return /* @__PURE__ */ jsxs(
|
|
138
161
|
"div",
|
|
@@ -12,22 +12,115 @@ const EMPTY_CONTENT_INTRO_LABELS = {};
|
|
|
12
12
|
function ContentIntroBody({ source }) {
|
|
13
13
|
return source();
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
additionalContent,
|
|
15
|
+
function ContentIntroToc({
|
|
17
16
|
completedSections,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
labels = EMPTY_CONTENT_INTRO_LABELS,
|
|
17
|
+
isLoading,
|
|
18
|
+
label,
|
|
21
19
|
onGoToSection,
|
|
22
|
-
onStart,
|
|
23
|
-
renderIntroContent,
|
|
24
20
|
sections,
|
|
25
|
-
|
|
26
|
-
titleAs: TitleHeading = "h2",
|
|
27
|
-
tocLabelAs: TocHeading = "h3"
|
|
21
|
+
TocHeading
|
|
28
22
|
}) {
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
return /* @__PURE__ */ jsxs("section", { className: "mt-8 py-6 border-t border-border", children: [
|
|
24
|
+
/* @__PURE__ */ jsx(TocHeading, { className: "text-lg font-semibold mb-4", children: label }),
|
|
25
|
+
/* @__PURE__ */ jsx("ol", { className: "space-y-2", children: sections.map((section, index) => {
|
|
26
|
+
const isCompleted = !isLoading && completedSections.has(section.id);
|
|
27
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
className: "w-full flex items-center gap-3 p-2 -m-2 rounded-lg hover:bg-muted/50 transition-colors text-left",
|
|
31
|
+
onClick: () => {
|
|
32
|
+
onGoToSection(index);
|
|
33
|
+
},
|
|
34
|
+
type: "button",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: cn(
|
|
40
|
+
"flex-shrink-0 size-6 rounded-full flex items-center justify-center text-xs font-medium tabular-nums transition-colors",
|
|
41
|
+
isLoading && "animate-pulse bg-muted",
|
|
42
|
+
!isLoading && isCompleted && "bg-foreground text-background",
|
|
43
|
+
!isLoading && !isCompleted && "bg-muted"
|
|
44
|
+
),
|
|
45
|
+
children: isCompleted ? /* @__PURE__ */ jsx(
|
|
46
|
+
"svg",
|
|
47
|
+
{
|
|
48
|
+
className: "size-3",
|
|
49
|
+
fill: "none",
|
|
50
|
+
stroke: "currentColor",
|
|
51
|
+
viewBox: "0 0 24 24",
|
|
52
|
+
children: /* @__PURE__ */ jsx(
|
|
53
|
+
"path",
|
|
54
|
+
{
|
|
55
|
+
d: "M5 13l4 4L19 7",
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeLinejoin: "round",
|
|
58
|
+
strokeWidth: 2
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
) : index + 1
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
className: cn(
|
|
69
|
+
"text-sm",
|
|
70
|
+
isCompleted && "line-through text-muted-foreground"
|
|
71
|
+
),
|
|
72
|
+
children: section.title
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) }, section.id);
|
|
78
|
+
}) })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
function ContentIntroStickyBar({
|
|
82
|
+
completedCount,
|
|
83
|
+
estimatedTime,
|
|
84
|
+
hasProgress,
|
|
85
|
+
labels: mergedLabels,
|
|
86
|
+
onStart,
|
|
87
|
+
sectionCount
|
|
88
|
+
}) {
|
|
89
|
+
return /* @__PURE__ */ jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-background/80 backdrop-blur-sm safe-bottom", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-3xl p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground hidden sm:block", children: hasProgress ? `${completedCount}/${sectionCount} completed` : `${sectionCount} sections \xB7 ${estimatedTime}` }),
|
|
91
|
+
/* @__PURE__ */ jsxs(
|
|
92
|
+
Button,
|
|
93
|
+
{
|
|
94
|
+
className: "flex-1 sm:flex-none px-8 py-6 text-lg font-medium gap-2",
|
|
95
|
+
onClick: onStart,
|
|
96
|
+
size: "lg",
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
"svg",
|
|
100
|
+
{
|
|
101
|
+
className: "size-5",
|
|
102
|
+
fill: "none",
|
|
103
|
+
stroke: "currentColor",
|
|
104
|
+
viewBox: "0 0 24 24",
|
|
105
|
+
children: /* @__PURE__ */ jsx(
|
|
106
|
+
"path",
|
|
107
|
+
{
|
|
108
|
+
d: "M5 3l14 9-14 9V3z",
|
|
109
|
+
strokeLinecap: "round",
|
|
110
|
+
strokeLinejoin: "round",
|
|
111
|
+
strokeWidth: 2
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsx("span", { children: hasProgress ? mergedLabels.continueLabel : mergedLabels.startLabel }),
|
|
117
|
+
/* @__PURE__ */ jsx("kbd", { className: "hidden md:inline-flex ml-1 px-1.5 py-0.5 text-xs font-mono bg-primary-foreground/20 rounded", children: "\u21B5" })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }) }) });
|
|
122
|
+
}
|
|
123
|
+
function useEnterToStart(onStart) {
|
|
31
124
|
const onStartRef = useRef(onStart);
|
|
32
125
|
useEffect(() => {
|
|
33
126
|
onStartRef.current = onStart;
|
|
@@ -44,104 +137,54 @@ function ContentIntroImpl({
|
|
|
44
137
|
document.removeEventListener("keydown", onDocumentKeyDown);
|
|
45
138
|
};
|
|
46
139
|
}, []);
|
|
140
|
+
}
|
|
141
|
+
function ContentIntroImpl({
|
|
142
|
+
additionalContent,
|
|
143
|
+
completedSections,
|
|
144
|
+
estimatedTime,
|
|
145
|
+
isLoading = false,
|
|
146
|
+
labels = EMPTY_CONTENT_INTRO_LABELS,
|
|
147
|
+
onGoToSection,
|
|
148
|
+
onStart,
|
|
149
|
+
renderIntroContent,
|
|
150
|
+
sections,
|
|
151
|
+
title,
|
|
152
|
+
titleAs: TitleHeading = "h2",
|
|
153
|
+
tocLabelAs: TocHeading = "h3"
|
|
154
|
+
}) {
|
|
155
|
+
const mergedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
156
|
+
const hasProgress = completedSections.size > 0;
|
|
157
|
+
useEnterToStart(onStart);
|
|
47
158
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
159
|
/* @__PURE__ */ jsxs("div", { className: "animate-in fade-in-0 duration-500 pb-24", children: [
|
|
49
160
|
/* @__PURE__ */ jsxs("section", { className: "py-6", children: [
|
|
50
161
|
/* @__PURE__ */ jsx(TitleHeading, { className: "text-2xl md:text-3xl font-semibold mb-6", children: title }),
|
|
51
162
|
/* @__PURE__ */ jsx("div", { className: cn("max-w-none", "[&_h2:first-of-type]:hidden"), children: /* @__PURE__ */ jsx(ContentIntroBody, { source: renderIntroContent }) })
|
|
52
163
|
] }),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
55
|
-
/* @__PURE__ */ jsx("ol", { className: "space-y-2", children: sections.map((section, index) => {
|
|
56
|
-
const isCompleted = !isLoading && completedSections.has(section.id);
|
|
57
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
58
|
-
"button",
|
|
59
|
-
{
|
|
60
|
-
className: "w-full flex items-center gap-3 p-2 -m-2 rounded-lg hover:bg-muted/50 transition-colors text-left",
|
|
61
|
-
onClick: () => {
|
|
62
|
-
onGoToSection(index);
|
|
63
|
-
},
|
|
64
|
-
type: "button",
|
|
65
|
-
children: [
|
|
66
|
-
/* @__PURE__ */ jsx(
|
|
67
|
-
"span",
|
|
68
|
-
{
|
|
69
|
-
className: cn(
|
|
70
|
-
"flex-shrink-0 size-6 rounded-full flex items-center justify-center text-xs font-medium tabular-nums transition-colors",
|
|
71
|
-
isLoading && "animate-pulse bg-muted",
|
|
72
|
-
!isLoading && isCompleted && "bg-foreground text-background",
|
|
73
|
-
!isLoading && !isCompleted && "bg-muted"
|
|
74
|
-
),
|
|
75
|
-
children: isCompleted ? /* @__PURE__ */ jsx(
|
|
76
|
-
"svg",
|
|
77
|
-
{
|
|
78
|
-
className: "size-3",
|
|
79
|
-
fill: "none",
|
|
80
|
-
stroke: "currentColor",
|
|
81
|
-
viewBox: "0 0 24 24",
|
|
82
|
-
children: /* @__PURE__ */ jsx(
|
|
83
|
-
"path",
|
|
84
|
-
{
|
|
85
|
-
d: "M5 13l4 4L19 7",
|
|
86
|
-
strokeLinecap: "round",
|
|
87
|
-
strokeLinejoin: "round",
|
|
88
|
-
strokeWidth: 2
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
) : index + 1
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ jsx(
|
|
96
|
-
"span",
|
|
97
|
-
{
|
|
98
|
-
className: cn(
|
|
99
|
-
"text-sm",
|
|
100
|
-
isCompleted && "line-through text-muted-foreground"
|
|
101
|
-
),
|
|
102
|
-
children: section.title
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
) }, section.id);
|
|
108
|
-
}) })
|
|
109
|
-
] }),
|
|
110
|
-
additionalContent
|
|
111
|
-
] }),
|
|
112
|
-
/* @__PURE__ */ jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-background/80 backdrop-blur-sm safe-bottom", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-3xl p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
113
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground hidden sm:block", children: hasProgress ? `${completedSections.size}/${sections.length} completed` : `${sections.length} sections \xB7 ${estimatedTime}` }),
|
|
114
|
-
/* @__PURE__ */ jsxs(
|
|
115
|
-
Button,
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
165
|
+
ContentIntroToc,
|
|
116
166
|
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
className: "size-5",
|
|
125
|
-
fill: "none",
|
|
126
|
-
stroke: "currentColor",
|
|
127
|
-
viewBox: "0 0 24 24",
|
|
128
|
-
children: /* @__PURE__ */ jsx(
|
|
129
|
-
"path",
|
|
130
|
-
{
|
|
131
|
-
d: "M5 3l14 9-14 9V3z",
|
|
132
|
-
strokeLinecap: "round",
|
|
133
|
-
strokeLinejoin: "round",
|
|
134
|
-
strokeWidth: 2
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ jsx("span", { children: hasProgress ? mergedLabels.continueLabel : mergedLabels.startLabel }),
|
|
140
|
-
/* @__PURE__ */ jsx("kbd", { className: "hidden md:inline-flex ml-1 px-1.5 py-0.5 text-xs font-mono bg-primary-foreground/20 rounded", children: "\u21B5" })
|
|
141
|
-
]
|
|
167
|
+
completedSections,
|
|
168
|
+
isLoading,
|
|
169
|
+
label: mergedLabels.tableOfContentsLabel,
|
|
170
|
+
onGoToSection,
|
|
171
|
+
sections,
|
|
172
|
+
TocHeading
|
|
142
173
|
}
|
|
143
|
-
)
|
|
144
|
-
|
|
174
|
+
),
|
|
175
|
+
additionalContent
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ jsx(
|
|
178
|
+
ContentIntroStickyBar,
|
|
179
|
+
{
|
|
180
|
+
completedCount: completedSections.size,
|
|
181
|
+
estimatedTime,
|
|
182
|
+
hasProgress,
|
|
183
|
+
labels: mergedLabels,
|
|
184
|
+
onStart,
|
|
185
|
+
sectionCount: sections.length
|
|
186
|
+
}
|
|
187
|
+
)
|
|
145
188
|
] });
|
|
146
189
|
}
|
|
147
190
|
const ContentIntro = memo(ContentIntroImpl);
|
|
@@ -4,8 +4,8 @@ import * as React from "react";
|
|
|
4
4
|
import { CalendarIcon } from "lucide-react";
|
|
5
5
|
import { cn } from "../../lib/utils.js";
|
|
6
6
|
import { Button } from "../button/button.js";
|
|
7
|
-
import { Calendar } from "../calendar/
|
|
8
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../popover/
|
|
7
|
+
import { Calendar } from "../calendar/calendar.js";
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover/popover.js";
|
|
9
9
|
const rangeFormatter = new Intl.DateTimeFormat("en-US", {
|
|
10
10
|
day: "numeric",
|
|
11
11
|
month: "short",
|
|
@@ -150,18 +150,11 @@ const DEFAULT_LABELS = {
|
|
|
150
150
|
tagsLabel: "Tags:"
|
|
151
151
|
};
|
|
152
152
|
const EMPTY_FILTER_BAR_LABELS = {};
|
|
153
|
-
function
|
|
154
|
-
className,
|
|
155
|
-
currentDifficulty,
|
|
153
|
+
function useFilterBarHandlers({
|
|
156
154
|
currentTags,
|
|
157
|
-
difficultyOptions,
|
|
158
|
-
labels = EMPTY_FILTER_BAR_LABELS,
|
|
159
155
|
onFiltersChange,
|
|
160
|
-
|
|
161
|
-
tags
|
|
156
|
+
startTransition
|
|
162
157
|
}) {
|
|
163
|
-
const [isPending, startTransition] = useTransition();
|
|
164
|
-
const mergedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
165
158
|
const handleDifficultyChange = useCallback(
|
|
166
159
|
(difficulty) => {
|
|
167
160
|
startTransition(() => {
|
|
@@ -188,6 +181,31 @@ function FilterBarImpl({
|
|
|
188
181
|
const input = document.querySelector("#filter-search");
|
|
189
182
|
if (input) input.value = "";
|
|
190
183
|
}, [onFiltersChange]);
|
|
184
|
+
return {
|
|
185
|
+
handleClearAll,
|
|
186
|
+
handleDifficultyChange,
|
|
187
|
+
handleSearchChange,
|
|
188
|
+
handleTagToggle
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function FilterBarImpl({
|
|
192
|
+
className,
|
|
193
|
+
currentDifficulty,
|
|
194
|
+
currentTags,
|
|
195
|
+
difficultyOptions,
|
|
196
|
+
labels = EMPTY_FILTER_BAR_LABELS,
|
|
197
|
+
onFiltersChange,
|
|
198
|
+
searchQuery,
|
|
199
|
+
tags
|
|
200
|
+
}) {
|
|
201
|
+
const [isPending, startTransition] = useTransition();
|
|
202
|
+
const mergedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
203
|
+
const {
|
|
204
|
+
handleClearAll,
|
|
205
|
+
handleDifficultyChange,
|
|
206
|
+
handleSearchChange,
|
|
207
|
+
handleTagToggle
|
|
208
|
+
} = useFilterBarHandlers({ currentTags, onFiltersChange, startTransition });
|
|
191
209
|
const activeDifficulty = currentDifficulty || "all";
|
|
192
210
|
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4 mb-8", className), children: [
|
|
193
211
|
/* @__PURE__ */ jsx(
|