@vllnt/ui 0.2.0 → 0.2.1-canary.0aaaad2
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/CHANGELOG.md +46 -1
- package/README.md +27 -12
- package/dist/components/accordion/accordion.js +2 -2
- package/dist/components/activity-heatmap/activity-heatmap.js +15 -13
- package/dist/components/activity-log/activity-log.js +6 -5
- package/dist/components/agent-activity/agent-activity.js +311 -0
- package/dist/components/agent-activity/index.js +18 -0
- package/dist/components/ai-artifact/ai-artifact.js +422 -0
- package/dist/components/ai-artifact/index.js +24 -0
- package/dist/components/ai-chat-input/ai-chat-input.js +2 -2
- package/dist/components/ai-message-bubble/ai-message-bubble.js +1 -1
- package/dist/components/ai-sidebar/ai-sidebar.js +254 -0
- package/dist/components/ai-sidebar/index.js +22 -0
- package/dist/components/ai-source-citation/ai-source-citation.js +2 -2
- package/dist/components/ai-tool-call-display/ai-tool-call-display.js +4 -4
- package/dist/components/alert-pulse/alert-pulse.js +93 -0
- package/dist/components/alert-pulse/index.js +6 -0
- package/dist/components/anchor-port/anchor-port.js +51 -0
- package/dist/components/anchor-port/index.js +4 -0
- package/dist/components/animated-text/animated-text.js +2 -4
- package/dist/components/auto-reload/auto-reload.js +377 -0
- package/dist/components/auto-reload/index.js +6 -0
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/avatar-group/avatar-group.js +4 -4
- package/dist/components/banner/banner.js +155 -0
- package/dist/components/banner/index.js +10 -0
- package/dist/components/bottom-activity-strip/bottom-activity-strip.js +91 -0
- package/dist/components/bottom-activity-strip/index.js +6 -0
- package/dist/components/bottom-bar/bottom-bar.js +25 -0
- package/dist/components/bottom-bar/index.js +4 -0
- package/dist/components/breadcrumb/breadcrumb.js +33 -26
- package/dist/components/button/button.js +1 -1
- package/dist/components/calendar/calendar.js +6 -6
- package/dist/components/callout/callout.js +1 -1
- package/dist/components/candlestick-chart/candlestick-chart.js +1 -1
- package/dist/components/canvas-shell/canvas-foundation-demo.js +183 -0
- package/dist/components/canvas-shell/canvas-shell-route-config.js +0 -0
- package/dist/components/canvas-shell/canvas-shell.js +261 -0
- package/dist/components/canvas-shell/index.js +4 -0
- package/dist/components/canvas-view/canvas-view.js +461 -0
- package/dist/components/canvas-view/index.js +6 -0
- package/dist/components/carousel/carousel.js +4 -4
- package/dist/components/chart/area-chart.js +1 -0
- package/dist/components/chart/line-chart.js +1 -0
- package/dist/components/chat-dock-section/chat-dock-section.js +56 -0
- package/dist/components/chat-dock-section/index.js +6 -0
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/checklist/checklist.js +10 -3
- package/dist/components/checklist/index.js +3 -1
- package/dist/components/choropleth-map/choropleth-map.js +373 -0
- package/dist/components/choropleth-map/index.js +10 -0
- package/dist/components/chronological-timeline/chronological-timeline.js +338 -0
- package/dist/components/chronological-timeline/index.js +8 -0
- package/dist/components/civilization-card/civilization-card.js +258 -0
- package/dist/components/civilization-card/index.js +8 -0
- package/dist/components/code-block/code-block.js +2 -2
- package/dist/components/code-playground/code-playground.js +8 -7
- package/dist/components/combobox/combobox.js +46 -22
- package/dist/components/command/command.js +1 -1
- package/dist/components/comment-pin/comment-pin.js +104 -0
- package/dist/components/comment-pin/index.js +6 -0
- package/dist/components/comparison/comparison.js +9 -9
- package/dist/components/completion-dialog/completion-dialog.js +1 -1
- package/dist/components/connector-edge/connector-edge.js +66 -0
- package/dist/components/connector-edge/index.js +6 -0
- package/dist/components/content-intro/content-intro.js +7 -6
- package/dist/components/context-lens/context-lens.js +98 -0
- package/dist/components/context-lens/index.js +6 -0
- package/dist/components/context-menu/context-menu.js +4 -4
- package/dist/components/conversation-thread/conversation-thread.js +348 -0
- package/dist/components/conversation-thread/index.js +20 -0
- package/dist/components/cookie-consent/cookie-consent.js +1 -1
- package/dist/components/copy-button/copy-button.js +189 -0
- package/dist/components/copy-button/index.js +8 -0
- package/dist/components/countdown-timer/countdown-timer.js +8 -7
- package/dist/components/credit-badge/credit-badge.js +1 -7
- package/dist/components/curriculum/curriculum.js +349 -0
- package/dist/components/curriculum/index.js +10 -0
- package/dist/components/data-list/data-list.js +2 -1
- package/dist/components/data-table/data-table.js +5 -4
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/document-sibling-nav/document-sibling-nav.js +111 -0
- package/dist/components/document-sibling-nav/index.js +8 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/edge-label/edge-label.js +26 -0
- package/dist/components/edge-label/index.js +4 -0
- package/dist/components/empty-state/empty-state.js +93 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/era-comparison/era-comparison.js +198 -0
- package/dist/components/era-comparison/index.js +16 -0
- package/dist/components/exercise/exercise.js +4 -4
- package/dist/components/faq/faq.js +2 -2
- package/dist/components/file-upload/file-upload.js +3 -3
- package/dist/components/filter-bar/filter-bar.js +2 -1
- package/dist/components/flashcard/flashcard.js +1 -1
- package/dist/components/floating-action-button/floating-action-button.js +1 -1
- package/dist/components/floating-toolbar/floating-toolbar.js +66 -0
- package/dist/components/floating-toolbar/index.js +6 -0
- package/dist/components/flow-diagram/flow-controls.js +9 -9
- package/dist/components/flow-diagram/flow-error-boundary.js +2 -2
- package/dist/components/flow-diagram/flow-fullscreen.js +2 -2
- package/dist/components/follow-mode/follow-mode.js +89 -0
- package/dist/components/follow-mode/index.js +6 -0
- package/dist/components/form/form.js +432 -0
- package/dist/components/form/index.js +20 -0
- package/dist/components/gantt-chart/gantt-chart.js +333 -0
- package/dist/components/gantt-chart/index.js +6 -0
- package/dist/components/geography-quiz-map/geography-quiz-map.js +343 -0
- package/dist/components/geography-quiz-map/index.js +12 -0
- package/dist/components/glass-panel/glass-panel.js +21 -0
- package/dist/components/glass-panel/index.js +4 -0
- package/dist/components/globe-3d/globe-3d.js +417 -0
- package/dist/components/globe-3d/index.js +10 -0
- package/dist/components/group-hull/group-hull.js +29 -0
- package/dist/components/group-hull/index.js +4 -0
- package/dist/components/handoff-beacon/handoff-beacon.js +78 -0
- package/dist/components/handoff-beacon/index.js +6 -0
- package/dist/components/heat-map-overlay/heat-map-overlay.js +215 -0
- package/dist/components/heat-map-overlay/index.js +6 -0
- package/dist/components/heat-overlay/heat-overlay.js +92 -0
- package/dist/components/heat-overlay/index.js +6 -0
- package/dist/components/historic-timeline/historic-timeline.js +342 -0
- package/dist/components/historic-timeline/index.js +6 -0
- package/dist/components/historical-figure-card/historical-figure-card.js +270 -0
- package/dist/components/historical-figure-card/index.js +6 -0
- package/dist/components/horizontal-scroll-row/horizontal-scroll-row.js +4 -4
- package/dist/components/index.js +568 -1
- package/dist/components/infinite-plane/index.js +6 -0
- package/dist/components/infinite-plane/infinite-plane.js +75 -0
- package/dist/components/input-otp/input-otp.js +1 -1
- package/dist/components/interactive-timeline/index.js +16 -0
- package/dist/components/interactive-timeline/interactive-timeline.js +708 -0
- package/dist/components/jarvis-dock/index.js +6 -0
- package/dist/components/jarvis-dock/jarvis-dock.js +98 -0
- package/dist/components/kbd/index.js +5 -0
- package/dist/components/kbd/kbd.js +117 -0
- package/dist/components/key-concept/key-concept.js +4 -4
- package/dist/components/keyboard-shortcuts-help/keyboard-shortcuts-help.js +2 -2
- package/dist/components/knowledge-check/index.js +6 -0
- package/dist/components/knowledge-check/knowledge-check.js +448 -0
- package/dist/components/learning-objectives/learning-objectives.js +12 -12
- package/dist/components/left-rail/index.js +4 -0
- package/dist/components/left-rail/left-rail.js +25 -0
- package/dist/components/live-cursor/index.js +6 -0
- package/dist/components/live-cursor/live-cursor.js +62 -0
- package/dist/components/live-feed/live-feed.js +15 -13
- package/dist/components/map-2d/index.js +20 -0
- package/dist/components/map-2d/map-2d.js +455 -0
- package/dist/components/map-timeline/index.js +16 -0
- package/dist/components/map-timeline/map-timeline.js +506 -0
- package/dist/components/market-treemap/market-treemap.js +1 -1
- package/dist/components/mdx-content/mdx-content.js +2 -1
- package/dist/components/menubar/menubar.js +4 -4
- package/dist/components/metric-cluster/index.js +6 -0
- package/dist/components/metric-cluster/metric-cluster.js +96 -0
- package/dist/components/metric-gauge/metric-gauge.js +1 -1
- package/dist/components/mini-map-panel/index.js +6 -0
- package/dist/components/mini-map-panel/mini-map-panel.js +74 -0
- package/dist/components/model-comparison/index.js +12 -0
- package/dist/components/model-comparison/model-comparison.js +211 -0
- package/dist/components/model-selector/model-selector.js +2 -2
- package/dist/components/multi-select/index.js +6 -0
- package/dist/components/multi-select/multi-select.js +258 -0
- package/dist/components/multi-select-lasso/index.js +6 -0
- package/dist/components/multi-select-lasso/multi-select-lasso.js +76 -0
- package/dist/components/navbar-saas/navbar-saas.js +3 -2
- package/dist/components/navigation-menu/navigation-menu.js +2 -2
- package/dist/components/newsletter-signup/index.js +8 -0
- package/dist/components/newsletter-signup/newsletter-signup.js +269 -0
- package/dist/components/number-input/number-input.js +1 -1
- package/dist/components/number-ticker/number-ticker.js +11 -4
- package/dist/components/object-card/index.js +6 -0
- package/dist/components/object-card/object-card.js +126 -0
- package/dist/components/object-handle/index.js +4 -0
- package/dist/components/object-handle/object-handle.js +38 -0
- package/dist/components/object-inspector/index.js +6 -0
- package/dist/components/object-inspector/object-inspector.js +136 -0
- package/dist/components/overview-board/index.js +8 -0
- package/dist/components/overview-board/overview-board.js +127 -0
- package/dist/components/parallel-timeline/index.js +6 -0
- package/dist/components/parallel-timeline/parallel-timeline.js +251 -0
- package/dist/components/password-input/password-input.js +1 -1
- package/dist/components/plan-badge/plan-badge.js +1 -7
- package/dist/components/playback-ghost/index.js +6 -0
- package/dist/components/playback-ghost/playback-ghost.js +83 -0
- package/dist/components/policy-delivery-panel/index.js +6 -0
- package/dist/components/policy-delivery-panel/policy-delivery-panel.js +99 -0
- package/dist/components/presence-stack/index.js +6 -0
- package/dist/components/presence-stack/presence-stack.js +108 -0
- package/dist/components/presence-sync-indicator/index.js +6 -0
- package/dist/components/presence-sync-indicator/presence-sync-indicator.js +73 -0
- package/dist/components/pricing-table/index.js +8 -0
- package/dist/components/pricing-table/pricing-table.js +247 -0
- package/dist/components/primary-source-viewer/index.js +26 -0
- package/dist/components/primary-source-viewer/primary-source-viewer.js +439 -0
- package/dist/components/pro-tip/pro-tip.js +6 -6
- package/dist/components/profile-section/profile-section.js +1 -1
- package/dist/components/progress-card/progress-card.js +4 -3
- package/dist/components/progress-tracker/index.js +20 -0
- package/dist/components/progress-tracker/progress-tracker.js +529 -0
- package/dist/components/prompt-templates/index.js +6 -0
- package/dist/components/prompt-templates/prompt-templates.js +403 -0
- package/dist/components/property-section/index.js +6 -0
- package/dist/components/property-section/property-section.js +101 -0
- package/dist/components/quiz/quiz.js +5 -5
- package/dist/components/radio-group/radio-group.js +2 -2
- package/dist/components/rating/rating.js +3 -3
- package/dist/components/relationship-inspector/index.js +6 -0
- package/dist/components/relationship-inspector/relationship-inspector.js +102 -0
- package/dist/components/resizable/resizable.js +1 -1
- package/dist/components/right-dock/index.js +4 -0
- package/dist/components/right-dock/right-dock.js +28 -0
- package/dist/components/route-map/index.js +6 -0
- package/dist/components/route-map/route-map.js +339 -0
- package/dist/components/routing-assignment-panel/index.js +6 -0
- package/dist/components/routing-assignment-panel/routing-assignment-panel.js +122 -0
- package/dist/components/run-timeline/index.js +6 -0
- package/dist/components/run-timeline/run-timeline.js +221 -0
- package/dist/components/runtime-overview-panel/index.js +6 -0
- package/dist/components/runtime-overview-panel/runtime-overview-panel.js +89 -0
- package/dist/components/scope-selector/scope-selector.js +7 -7
- package/dist/components/search-bar/search-bar.js +24 -2
- package/dist/components/search-dialog/search-dialog.js +1 -1
- package/dist/components/segmented-control/index.js +12 -0
- package/dist/components/segmented-control/segmented-control.js +61 -0
- package/dist/components/select/select.js +5 -5
- package/dist/components/selection-halo/index.js +6 -0
- package/dist/components/selection-halo/selection-halo.js +72 -0
- package/dist/components/selection-presence/index.js +6 -0
- package/dist/components/selection-presence/selection-presence.js +50 -0
- package/dist/components/severity-badge/severity-badge.js +2 -2
- package/dist/components/sheet/sheet.js +1 -1
- package/dist/components/sidebar/sidebar.js +1 -1
- package/dist/components/sidebar-toggle/sidebar-toggle.js +2 -2
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/slideshow/slideshow.js +12 -11
- package/dist/components/snap-guides/index.js +6 -0
- package/dist/components/snap-guides/snap-guides.js +45 -0
- package/dist/components/social-fab/social-fab.js +2 -1
- package/dist/components/sparkline-grid/sparkline-grid.js +1 -1
- package/dist/components/spinner/spinner.js +3 -3
- package/dist/components/spinner/unicode-spinner.js +1 -0
- package/dist/components/stat-card/stat-card.js +3 -3
- package/dist/components/state-badge-overlay/index.js +6 -0
- package/dist/components/state-badge-overlay/state-badge-overlay.js +90 -0
- package/dist/components/status-board/status-board.js +1 -1
- package/dist/components/status-indicator/status-indicator.js +3 -3
- package/dist/components/step-by-step/step-by-step.js +8 -7
- package/dist/components/step-navigation/step-navigation.js +2 -2
- package/dist/components/stepper/stepper.js +3 -3
- package/dist/components/sticky-metric/index.js +6 -0
- package/dist/components/sticky-metric/sticky-metric.js +83 -0
- package/dist/components/story-map/index.js +8 -0
- package/dist/components/story-map/story-map.js +414 -0
- package/dist/components/subscription-card/subscription-card.js +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/table-of-contents-panel/table-of-contents-panel.js +5 -5
- package/dist/components/tags-input/index.js +4 -0
- package/dist/components/tags-input/tags-input.js +178 -0
- package/dist/components/terminal/terminal.js +48 -34
- package/dist/components/thinking-block/thinking-block.js +1 -1
- package/dist/components/thread-bubble/index.js +6 -0
- package/dist/components/thread-bubble/thread-bubble.js +85 -0
- package/dist/components/threshold-ring/index.js +6 -0
- package/dist/components/threshold-ring/threshold-ring.js +160 -0
- package/dist/components/ticker-tape/ticker-tape.js +3 -3
- package/dist/components/timeline/index.js +12 -0
- package/dist/components/timeline/timeline.js +239 -0
- package/dist/components/timeline-scrubber/index.js +6 -0
- package/dist/components/timeline-scrubber/timeline-scrubber.js +179 -0
- package/dist/components/tldr-section/tldr-section.js +2 -2
- package/dist/components/top-bar/index.js +4 -0
- package/dist/components/top-bar/top-bar.js +31 -0
- package/dist/components/tour/tour.js +1 -1
- package/dist/components/transaction-list/index.js +14 -0
- package/dist/components/transaction-list/transaction-list.js +247 -0
- package/dist/components/tree-view/index.js +6 -0
- package/dist/components/tree-view/tree-view.js +298 -0
- package/dist/components/tutorial-complete/tutorial-complete.js +8 -8
- package/dist/components/usage-breakdown/usage-breakdown.js +10 -5
- package/dist/components/video-embed/video-embed.js +2 -2
- package/dist/components/viewport-bookmarks/index.js +6 -0
- package/dist/components/viewport-bookmarks/viewport-bookmarks.js +116 -0
- package/dist/components/wallet-card/wallet-card.js +1 -1
- package/dist/components/watchlist/watchlist.js +5 -5
- package/dist/components/workspace-switcher/index.js +6 -0
- package/dist/components/workspace-switcher/workspace-switcher.js +61 -0
- package/dist/components/world-breadcrumbs/index.js +6 -0
- package/dist/components/world-breadcrumbs/world-breadcrumbs.js +114 -0
- package/dist/components/world-clock-bar/world-clock-bar.js +32 -12
- package/dist/components/zoom-hud/index.js +4 -0
- package/dist/components/zoom-hud/zoom-hud.js +61 -0
- package/dist/index.d.ts +7907 -226
- package/dist/index.js +3 -1
- package/package.json +9 -5
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
useCallback,
|
|
6
|
+
useId,
|
|
7
|
+
useMemo,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
10
|
+
import { cn } from "../../lib/utils";
|
|
11
|
+
import { Button } from "../button/button";
|
|
12
|
+
import { Input } from "../input/input";
|
|
13
|
+
import { Switch } from "../switch/switch";
|
|
14
|
+
const CENTS_PER_UNIT = 100;
|
|
15
|
+
const DEFAULT_LOCALE = "en-US";
|
|
16
|
+
const DEFAULT_CURRENCY = "USD";
|
|
17
|
+
const DEFAULT_STEP_CENTS = 100;
|
|
18
|
+
const DEFAULT_LABELS = {
|
|
19
|
+
disabledFallback: "Auto-reload is unavailable for this account.",
|
|
20
|
+
heading: "Auto-reload",
|
|
21
|
+
helper: "Automatically reload credits when balance is low.",
|
|
22
|
+
reloadHelper: "Amount to add when the threshold is hit.",
|
|
23
|
+
reloadLabel: "Reload amount",
|
|
24
|
+
save: "Save settings",
|
|
25
|
+
saving: "Saving\u2026",
|
|
26
|
+
thresholdHelper: "Reload when the balance drops below this.",
|
|
27
|
+
thresholdLabel: "Threshold"
|
|
28
|
+
};
|
|
29
|
+
function centsToValue(cents) {
|
|
30
|
+
return (cents / CENTS_PER_UNIT).toFixed(2);
|
|
31
|
+
}
|
|
32
|
+
function valueToCents(value) {
|
|
33
|
+
const parsed = Number.parseFloat(value);
|
|
34
|
+
if (Number.isNaN(parsed)) return 0;
|
|
35
|
+
return Math.round(parsed * CENTS_PER_UNIT);
|
|
36
|
+
}
|
|
37
|
+
const CURRENCY_FORMATTER_CACHE = /* @__PURE__ */ new Map();
|
|
38
|
+
function getCurrencyFormatter(locale, currency) {
|
|
39
|
+
const key = `${locale}|${currency}`;
|
|
40
|
+
let formatter = CURRENCY_FORMATTER_CACHE.get(key);
|
|
41
|
+
if (!formatter) {
|
|
42
|
+
formatter = new Intl.NumberFormat(locale, {
|
|
43
|
+
currency,
|
|
44
|
+
style: "currency"
|
|
45
|
+
});
|
|
46
|
+
CURRENCY_FORMATTER_CACHE.set(key, formatter);
|
|
47
|
+
}
|
|
48
|
+
return formatter;
|
|
49
|
+
}
|
|
50
|
+
function getCurrencySymbol(locale, currency) {
|
|
51
|
+
const formatted = getCurrencyFormatter(locale, currency).format(0);
|
|
52
|
+
const symbol = formatted.replaceAll(/[\d\s,.]/g, "");
|
|
53
|
+
return symbol.length > 0 ? symbol : currency;
|
|
54
|
+
}
|
|
55
|
+
function ReloadFormFields({
|
|
56
|
+
currencyDisplay,
|
|
57
|
+
isSaving,
|
|
58
|
+
labels,
|
|
59
|
+
maxAmountCents,
|
|
60
|
+
minAmountCents,
|
|
61
|
+
onSave,
|
|
62
|
+
reloadAmount,
|
|
63
|
+
reloadAmountId,
|
|
64
|
+
setReloadAmount,
|
|
65
|
+
setThreshold,
|
|
66
|
+
stepCents,
|
|
67
|
+
threshold,
|
|
68
|
+
thresholdId
|
|
69
|
+
}) {
|
|
70
|
+
const handleThreshold = useCallback(
|
|
71
|
+
(event) => {
|
|
72
|
+
setThreshold(valueToCents(event.target.value));
|
|
73
|
+
},
|
|
74
|
+
[setThreshold]
|
|
75
|
+
);
|
|
76
|
+
const handleReload = useCallback(
|
|
77
|
+
(event) => {
|
|
78
|
+
setReloadAmount(valueToCents(event.target.value));
|
|
79
|
+
},
|
|
80
|
+
[setReloadAmount]
|
|
81
|
+
);
|
|
82
|
+
const step = (stepCents / CENTS_PER_UNIT).toFixed(2);
|
|
83
|
+
const min = (minAmountCents / CENTS_PER_UNIT).toFixed(2);
|
|
84
|
+
const max = maxAmountCents === void 0 ? void 0 : (maxAmountCents / CENTS_PER_UNIT).toFixed(2);
|
|
85
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
NumericField,
|
|
89
|
+
{
|
|
90
|
+
currencyDisplay,
|
|
91
|
+
helper: labels.thresholdHelper,
|
|
92
|
+
id: thresholdId,
|
|
93
|
+
label: labels.thresholdLabel,
|
|
94
|
+
max,
|
|
95
|
+
min,
|
|
96
|
+
onChange: handleThreshold,
|
|
97
|
+
step,
|
|
98
|
+
value: centsToValue(threshold)
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
NumericField,
|
|
103
|
+
{
|
|
104
|
+
currencyDisplay,
|
|
105
|
+
helper: labels.reloadHelper,
|
|
106
|
+
id: reloadAmountId,
|
|
107
|
+
label: labels.reloadLabel,
|
|
108
|
+
max,
|
|
109
|
+
min,
|
|
110
|
+
onChange: handleReload,
|
|
111
|
+
step,
|
|
112
|
+
value: centsToValue(reloadAmount)
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, { disabled: isSaving, onClick: onSave, type: "button", children: isSaving ? labels.saving : labels.save }) })
|
|
117
|
+
] });
|
|
118
|
+
}
|
|
119
|
+
function NumericField({
|
|
120
|
+
currencyDisplay,
|
|
121
|
+
helper,
|
|
122
|
+
id,
|
|
123
|
+
label,
|
|
124
|
+
max,
|
|
125
|
+
min,
|
|
126
|
+
onChange,
|
|
127
|
+
step,
|
|
128
|
+
value
|
|
129
|
+
}) {
|
|
130
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
131
|
+
/* @__PURE__ */ jsxs("label", { className: "text-sm font-medium text-foreground", htmlFor: id, children: [
|
|
132
|
+
label,
|
|
133
|
+
" (",
|
|
134
|
+
currencyDisplay,
|
|
135
|
+
")"
|
|
136
|
+
] }),
|
|
137
|
+
/* @__PURE__ */ jsx(
|
|
138
|
+
Input,
|
|
139
|
+
{
|
|
140
|
+
id,
|
|
141
|
+
inputMode: "decimal",
|
|
142
|
+
max,
|
|
143
|
+
min,
|
|
144
|
+
onChange,
|
|
145
|
+
step,
|
|
146
|
+
type: "number",
|
|
147
|
+
value
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
helper ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: helper }) : null
|
|
151
|
+
] });
|
|
152
|
+
}
|
|
153
|
+
function ToggleHeader({
|
|
154
|
+
enabled,
|
|
155
|
+
heading,
|
|
156
|
+
helper,
|
|
157
|
+
id,
|
|
158
|
+
onCheckedChange
|
|
159
|
+
}) {
|
|
160
|
+
const helperId = `${id}-helper`;
|
|
161
|
+
return /* @__PURE__ */ jsxs("header", { className: "flex items-start justify-between gap-3", children: [
|
|
162
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
163
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-foreground", id, children: heading }),
|
|
164
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", id: helperId, children: helper })
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ jsx(
|
|
167
|
+
Switch,
|
|
168
|
+
{
|
|
169
|
+
"aria-describedby": helperId,
|
|
170
|
+
"aria-labelledby": id,
|
|
171
|
+
checked: enabled,
|
|
172
|
+
onCheckedChange
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
function useAutoReloadController(options) {
|
|
178
|
+
const {
|
|
179
|
+
defaultEnabled,
|
|
180
|
+
defaultReloadAmountCents,
|
|
181
|
+
defaultThresholdCents,
|
|
182
|
+
enabled: controlledEnabled,
|
|
183
|
+
onToggle,
|
|
184
|
+
reloadAmountCents: controlledReload,
|
|
185
|
+
thresholdCents: controlledThreshold
|
|
186
|
+
} = options;
|
|
187
|
+
const [uncontrolledEnabled, setUncontrolledEnabled] = useState(defaultEnabled);
|
|
188
|
+
const [threshold, setThreshold] = useState(defaultThresholdCents);
|
|
189
|
+
const [reloadAmount, setReloadAmount] = useState(defaultReloadAmountCents);
|
|
190
|
+
const enabled = controlledEnabled ?? uncontrolledEnabled;
|
|
191
|
+
const handleToggle = useCallback(
|
|
192
|
+
(next) => {
|
|
193
|
+
if (controlledEnabled === void 0) setUncontrolledEnabled(next);
|
|
194
|
+
onToggle?.(next);
|
|
195
|
+
},
|
|
196
|
+
[controlledEnabled, onToggle]
|
|
197
|
+
);
|
|
198
|
+
return {
|
|
199
|
+
enabled,
|
|
200
|
+
handleToggle,
|
|
201
|
+
reloadAmount: controlledReload ?? reloadAmount,
|
|
202
|
+
setReloadAmount,
|
|
203
|
+
setThreshold,
|
|
204
|
+
threshold: controlledThreshold ?? threshold
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const DisabledBanner = forwardRef(
|
|
208
|
+
({ className, message, ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
"aria-disabled": "true",
|
|
212
|
+
className: cn(
|
|
213
|
+
"flex items-start gap-3 rounded-2xl border border-dashed border-border bg-muted/30 p-4 text-sm text-muted-foreground",
|
|
214
|
+
className
|
|
215
|
+
),
|
|
216
|
+
ref,
|
|
217
|
+
...rest,
|
|
218
|
+
children: message
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
DisabledBanner.displayName = "AutoReload.DisabledBanner";
|
|
223
|
+
const ActivePanel = forwardRef(
|
|
224
|
+
(props, ref) => {
|
|
225
|
+
const {
|
|
226
|
+
className,
|
|
227
|
+
controller,
|
|
228
|
+
currencyDisplay,
|
|
229
|
+
isSaving,
|
|
230
|
+
labels,
|
|
231
|
+
maxAmountCents,
|
|
232
|
+
minAmountCents,
|
|
233
|
+
onSave,
|
|
234
|
+
reloadAmountId,
|
|
235
|
+
stepCents,
|
|
236
|
+
thresholdId,
|
|
237
|
+
toggleId,
|
|
238
|
+
...rest
|
|
239
|
+
} = props;
|
|
240
|
+
return /* @__PURE__ */ jsxs(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
className: cn(
|
|
244
|
+
"flex flex-col gap-4 rounded-2xl border bg-background p-4",
|
|
245
|
+
className
|
|
246
|
+
),
|
|
247
|
+
ref,
|
|
248
|
+
...rest,
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ jsx(
|
|
251
|
+
ToggleHeader,
|
|
252
|
+
{
|
|
253
|
+
enabled: controller.enabled,
|
|
254
|
+
heading: labels.heading,
|
|
255
|
+
helper: labels.helper,
|
|
256
|
+
id: toggleId,
|
|
257
|
+
onCheckedChange: controller.handleToggle
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
controller.enabled ? /* @__PURE__ */ jsx(
|
|
261
|
+
ReloadFormFields,
|
|
262
|
+
{
|
|
263
|
+
currencyDisplay,
|
|
264
|
+
isSaving,
|
|
265
|
+
labels,
|
|
266
|
+
maxAmountCents,
|
|
267
|
+
minAmountCents,
|
|
268
|
+
onSave,
|
|
269
|
+
reloadAmount: controller.reloadAmount,
|
|
270
|
+
reloadAmountId,
|
|
271
|
+
setReloadAmount: controller.setReloadAmount,
|
|
272
|
+
setThreshold: controller.setThreshold,
|
|
273
|
+
stepCents,
|
|
274
|
+
threshold: controller.threshold,
|
|
275
|
+
thresholdId
|
|
276
|
+
}
|
|
277
|
+
) : null
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
ActivePanel.displayName = "AutoReload.ActivePanel";
|
|
284
|
+
function useAutoReloadInternals(props) {
|
|
285
|
+
const {
|
|
286
|
+
currency = DEFAULT_CURRENCY,
|
|
287
|
+
currencySymbol,
|
|
288
|
+
defaultEnabled = false,
|
|
289
|
+
defaultReloadAmountCents = 2e3,
|
|
290
|
+
defaultThresholdCents = 1e3,
|
|
291
|
+
enabled: controlledEnabled,
|
|
292
|
+
labels,
|
|
293
|
+
locale = DEFAULT_LOCALE,
|
|
294
|
+
onSave,
|
|
295
|
+
onToggle,
|
|
296
|
+
reloadAmountCents: controlledReload,
|
|
297
|
+
thresholdCents: controlledThreshold
|
|
298
|
+
} = props;
|
|
299
|
+
const resolvedLabels = useMemo(
|
|
300
|
+
() => ({ ...DEFAULT_LABELS, ...labels }),
|
|
301
|
+
[labels]
|
|
302
|
+
);
|
|
303
|
+
const toggleId = useId();
|
|
304
|
+
const thresholdId = useId();
|
|
305
|
+
const reloadAmountId = useId();
|
|
306
|
+
const controller = useAutoReloadController({
|
|
307
|
+
defaultEnabled,
|
|
308
|
+
defaultReloadAmountCents,
|
|
309
|
+
defaultThresholdCents,
|
|
310
|
+
enabled: controlledEnabled,
|
|
311
|
+
onToggle,
|
|
312
|
+
reloadAmountCents: controlledReload,
|
|
313
|
+
thresholdCents: controlledThreshold
|
|
314
|
+
});
|
|
315
|
+
const currencyDisplay = currencySymbol ?? getCurrencySymbol(locale, currency);
|
|
316
|
+
const handleSave = useCallback(() => {
|
|
317
|
+
onSave?.({
|
|
318
|
+
reloadAmountCents: controller.reloadAmount,
|
|
319
|
+
thresholdCents: controller.threshold
|
|
320
|
+
});
|
|
321
|
+
}, [controller.reloadAmount, controller.threshold, onSave]);
|
|
322
|
+
return {
|
|
323
|
+
controller,
|
|
324
|
+
currencyDisplay,
|
|
325
|
+
handleSave,
|
|
326
|
+
reloadAmountId,
|
|
327
|
+
resolvedLabels,
|
|
328
|
+
thresholdId,
|
|
329
|
+
toggleId
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const AutoReload = forwardRef(
|
|
333
|
+
(props, ref) => {
|
|
334
|
+
const {
|
|
335
|
+
className,
|
|
336
|
+
disabled = false,
|
|
337
|
+
disabledMessage,
|
|
338
|
+
isSaving = false,
|
|
339
|
+
maxAmountCents,
|
|
340
|
+
minAmountCents = 100,
|
|
341
|
+
stepCents = DEFAULT_STEP_CENTS
|
|
342
|
+
} = props;
|
|
343
|
+
const internals = useAutoReloadInternals(props);
|
|
344
|
+
if (disabled) {
|
|
345
|
+
return /* @__PURE__ */ jsx(
|
|
346
|
+
DisabledBanner,
|
|
347
|
+
{
|
|
348
|
+
className,
|
|
349
|
+
message: disabledMessage ?? internals.resolvedLabels.disabledFallback,
|
|
350
|
+
ref
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
return /* @__PURE__ */ jsx(
|
|
355
|
+
ActivePanel,
|
|
356
|
+
{
|
|
357
|
+
className,
|
|
358
|
+
controller: internals.controller,
|
|
359
|
+
currencyDisplay: internals.currencyDisplay,
|
|
360
|
+
isSaving,
|
|
361
|
+
labels: internals.resolvedLabels,
|
|
362
|
+
maxAmountCents,
|
|
363
|
+
minAmountCents,
|
|
364
|
+
onSave: internals.handleSave,
|
|
365
|
+
ref,
|
|
366
|
+
reloadAmountId: internals.reloadAmountId,
|
|
367
|
+
stepCents,
|
|
368
|
+
thresholdId: internals.thresholdId,
|
|
369
|
+
toggleId: internals.toggleId
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
AutoReload.displayName = "AutoReload";
|
|
375
|
+
export {
|
|
376
|
+
AutoReload
|
|
377
|
+
};
|
|
@@ -7,7 +7,7 @@ const Avatar = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
|
7
7
|
AvatarPrimitive.Root,
|
|
8
8
|
{
|
|
9
9
|
className: cn(
|
|
10
|
-
"relative flex
|
|
10
|
+
"relative flex size-10 shrink-0 overflow-hidden rounded-full",
|
|
11
11
|
className
|
|
12
12
|
),
|
|
13
13
|
ref,
|
|
@@ -23,9 +23,9 @@ const avatarItemVariants = cva(
|
|
|
23
23
|
},
|
|
24
24
|
variants: {
|
|
25
25
|
size: {
|
|
26
|
-
lg: "
|
|
27
|
-
md: "
|
|
28
|
-
sm: "
|
|
26
|
+
lg: "size-12 text-sm",
|
|
27
|
+
md: "size-10 text-xs",
|
|
28
|
+
sm: "size-8 text-[11px]"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -66,7 +66,7 @@ const AvatarGroup = React.forwardRef(
|
|
|
66
66
|
/* @__PURE__ */ jsx(AvatarFallback, { children: item.fallback })
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
|
-
|
|
69
|
+
item.src ?? item.alt
|
|
70
70
|
)),
|
|
71
71
|
hiddenCount > 0 ? /* @__PURE__ */ jsx("span", { className: overflowBadgeVariants({ size }), children: overflowLabel ? overflowLabel(hiddenCount) : `+${hiddenCount}` }) : null
|
|
72
72
|
]
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
useCallback,
|
|
6
|
+
useState,
|
|
7
|
+
useSyncExternalStore
|
|
8
|
+
} from "react";
|
|
9
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
import { X } from "lucide-react";
|
|
12
|
+
import { cn } from "../../lib/utils";
|
|
13
|
+
const bannerVariants = cva(
|
|
14
|
+
"flex w-full items-start gap-3 border-b px-4 py-3 text-sm transition-all motion-safe:animate-in motion-safe:slide-in-from-top-1",
|
|
15
|
+
{
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "info"
|
|
18
|
+
},
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
destructive: "border-destructive/50 bg-destructive/10 text-destructive dark:border-destructive [&_svg]:text-destructive",
|
|
22
|
+
info: "border-border bg-muted text-foreground [&_svg]:text-muted-foreground",
|
|
23
|
+
success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-900 dark:text-emerald-200 [&_svg]:text-emerald-600 dark:[&_svg]:text-emerald-300",
|
|
24
|
+
warning: "border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200 [&_svg]:text-amber-600 dark:[&_svg]:text-amber-300"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const URGENT_VARIANTS = /* @__PURE__ */ new Set([
|
|
30
|
+
"destructive",
|
|
31
|
+
"warning"
|
|
32
|
+
]);
|
|
33
|
+
const STORAGE_PREFIX = "vllnt-ui:banner-dismissed:";
|
|
34
|
+
function safeStorageGet(key) {
|
|
35
|
+
if (typeof window === "undefined") return null;
|
|
36
|
+
try {
|
|
37
|
+
return window.localStorage.getItem(key);
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function safeStorageSet(key, value) {
|
|
43
|
+
if (typeof window === "undefined") return;
|
|
44
|
+
try {
|
|
45
|
+
window.localStorage.setItem(key, value);
|
|
46
|
+
} catch {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function subscribeToStorage(callback) {
|
|
51
|
+
if (typeof window === "undefined") {
|
|
52
|
+
return () => {
|
|
53
|
+
return;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
window.addEventListener("storage", callback);
|
|
57
|
+
return () => {
|
|
58
|
+
window.removeEventListener("storage", callback);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function usePersistedDismissed(storageKey) {
|
|
62
|
+
const getClientSnapshot = useCallback(() => {
|
|
63
|
+
if (!storageKey) return false;
|
|
64
|
+
return safeStorageGet(storageKey) === "1";
|
|
65
|
+
}, [storageKey]);
|
|
66
|
+
const getServerSnapshot = useCallback(() => false, []);
|
|
67
|
+
return useSyncExternalStore(
|
|
68
|
+
subscribeToStorage,
|
|
69
|
+
getClientSnapshot,
|
|
70
|
+
getServerSnapshot
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const Banner = forwardRef(
|
|
74
|
+
({
|
|
75
|
+
children,
|
|
76
|
+
className,
|
|
77
|
+
dismissible = false,
|
|
78
|
+
dismissLabel = "Dismiss",
|
|
79
|
+
icon,
|
|
80
|
+
id,
|
|
81
|
+
onDismiss,
|
|
82
|
+
persistDismissal = false,
|
|
83
|
+
role: roleOverride,
|
|
84
|
+
variant,
|
|
85
|
+
...rest
|
|
86
|
+
}, ref) => {
|
|
87
|
+
const storageKey = persistDismissal && id ? `${STORAGE_PREFIX}${id}` : void 0;
|
|
88
|
+
const persistedDismissed = usePersistedDismissed(storageKey);
|
|
89
|
+
const [locallyDismissed, setLocallyDismissed] = useState(false);
|
|
90
|
+
const handleDismiss = useCallback(() => {
|
|
91
|
+
setLocallyDismissed(true);
|
|
92
|
+
if (storageKey) safeStorageSet(storageKey, "1");
|
|
93
|
+
onDismiss?.();
|
|
94
|
+
}, [onDismiss, storageKey]);
|
|
95
|
+
if (locallyDismissed || persistedDismissed) return null;
|
|
96
|
+
const resolvedVariant = variant ?? "info";
|
|
97
|
+
const role = roleOverride ?? (URGENT_VARIANTS.has(resolvedVariant) ? "alert" : "status");
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: cn(bannerVariants({ variant }), className),
|
|
102
|
+
id,
|
|
103
|
+
ref,
|
|
104
|
+
role,
|
|
105
|
+
...rest,
|
|
106
|
+
children: [
|
|
107
|
+
icon ? /* @__PURE__ */ jsx(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
"aria-hidden": "true",
|
|
111
|
+
className: "mt-0.5 flex size-4 shrink-0 items-center justify-center [&>svg]:h-4 [&>svg]:w-4",
|
|
112
|
+
children: icon
|
|
113
|
+
}
|
|
114
|
+
) : null,
|
|
115
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children }),
|
|
116
|
+
dismissible ? /* @__PURE__ */ jsx(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
"aria-label": dismissLabel,
|
|
120
|
+
className: "ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded-md opacity-70 transition-colors hover:bg-foreground/10 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
121
|
+
onClick: handleDismiss,
|
|
122
|
+
type: "button",
|
|
123
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-4" })
|
|
124
|
+
}
|
|
125
|
+
) : null
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
Banner.displayName = "Banner";
|
|
132
|
+
const BannerAction = forwardRef(
|
|
133
|
+
({ asChild = false, children, className, type, ...rest }, ref) => {
|
|
134
|
+
const Comp = asChild ? Slot : "button";
|
|
135
|
+
const buttonProps = asChild ? rest : { type: type ?? "button", ...rest };
|
|
136
|
+
return /* @__PURE__ */ jsx(
|
|
137
|
+
Comp,
|
|
138
|
+
{
|
|
139
|
+
className: cn(
|
|
140
|
+
"inline-flex h-7 items-center justify-center rounded-md border border-foreground/20 bg-transparent px-3 text-xs font-medium underline-offset-4 transition-colors hover:bg-foreground/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
141
|
+
className
|
|
142
|
+
),
|
|
143
|
+
ref,
|
|
144
|
+
...buttonProps,
|
|
145
|
+
children
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
BannerAction.displayName = "BannerAction";
|
|
151
|
+
export {
|
|
152
|
+
Banner,
|
|
153
|
+
BannerAction,
|
|
154
|
+
bannerVariants
|
|
155
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "react";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const TONE_DOT = {
|
|
8
|
+
danger: "bg-red-500",
|
|
9
|
+
info: "bg-blue-500",
|
|
10
|
+
neutral: "bg-muted-foreground",
|
|
11
|
+
success: "bg-emerald-500",
|
|
12
|
+
warn: "bg-amber-500"
|
|
13
|
+
};
|
|
14
|
+
const DEFAULT_LABELS = {
|
|
15
|
+
empty: "No recent activity",
|
|
16
|
+
region: "Recent activity"
|
|
17
|
+
};
|
|
18
|
+
const ChipBody = (props) => {
|
|
19
|
+
const { event } = props;
|
|
20
|
+
const tone = event.tone ?? "neutral";
|
|
21
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 whitespace-nowrap", children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
"span",
|
|
24
|
+
{
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
className: cn("size-1.5 rounded-full", TONE_DOT[tone])
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: event.label }),
|
|
30
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", "data-strip-event-ts": true, children: event.ts })
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
33
|
+
const Chip = (props) => {
|
|
34
|
+
const { event } = props;
|
|
35
|
+
const tone = event.tone ?? "neutral";
|
|
36
|
+
if (event.onActivate) {
|
|
37
|
+
const handleClick = () => {
|
|
38
|
+
event.onActivate?.();
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
className: "flex items-center rounded-full border border-border bg-background px-2 py-1 text-[11px] transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
44
|
+
"data-strip-event": event.id,
|
|
45
|
+
"data-strip-event-tone": tone,
|
|
46
|
+
onClick: handleClick,
|
|
47
|
+
type: "button",
|
|
48
|
+
children: /* @__PURE__ */ jsx(ChipBody, { event })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
className: "flex items-center rounded-full border border-border bg-background px-2 py-1 text-[11px]",
|
|
56
|
+
"data-strip-event": event.id,
|
|
57
|
+
"data-strip-event-tone": tone,
|
|
58
|
+
children: /* @__PURE__ */ jsx(ChipBody, { event })
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
const BottomActivityStrip = forwardRef((props, ref) => {
|
|
63
|
+
const { className, events, labels, maxEvents, ...rest } = props;
|
|
64
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
65
|
+
const visible = maxEvents === void 0 || maxEvents >= events.length ? events : events.slice(0, maxEvents);
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
"section",
|
|
68
|
+
{
|
|
69
|
+
"aria-label": resolvedLabels.region,
|
|
70
|
+
className: cn(
|
|
71
|
+
"flex w-full items-center gap-2 overflow-x-auto rounded-md border border-border bg-background/90 px-2 py-1 text-foreground",
|
|
72
|
+
className
|
|
73
|
+
),
|
|
74
|
+
"data-bottom-activity-strip": true,
|
|
75
|
+
ref,
|
|
76
|
+
...rest,
|
|
77
|
+
children: visible.length === 0 ? /* @__PURE__ */ jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
className: "px-2 text-[11px] text-muted-foreground",
|
|
81
|
+
"data-strip-state": "empty",
|
|
82
|
+
children: resolvedLabels.empty
|
|
83
|
+
}
|
|
84
|
+
) : visible.map((event) => /* @__PURE__ */ jsx(Chip, { event }, event.id))
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
BottomActivityStrip.displayName = "BottomActivityStrip";
|
|
89
|
+
export {
|
|
90
|
+
BottomActivityStrip
|
|
91
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
const BottomBar = forwardRef(
|
|
5
|
+
({ center, className, leading, trailing, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
className: cn(
|
|
9
|
+
"flex min-h-14 items-center gap-3 px-4 py-3 text-sm",
|
|
10
|
+
className
|
|
11
|
+
),
|
|
12
|
+
ref,
|
|
13
|
+
...props,
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: leading }),
|
|
16
|
+
center ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center justify-center gap-2", children: center }) : null,
|
|
17
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center justify-end gap-2", children: trailing })
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
BottomBar.displayName = "BottomBar";
|
|
23
|
+
export {
|
|
24
|
+
BottomBar
|
|
25
|
+
};
|