@vllnt/ui 0.2.1-canary.b3f1dff → 0.2.1-canary.c0bc557
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 +34 -0
- 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-sidebar/ai-sidebar.js +254 -0
- package/dist/components/ai-sidebar/index.js +22 -0
- package/dist/components/alert-pulse/alert-pulse.js +93 -0
- package/dist/components/alert-pulse/index.js +6 -0
- package/dist/components/auto-reload/auto-reload.js +367 -0
- package/dist/components/auto-reload/index.js +6 -0
- package/dist/components/banner/banner.js +155 -0
- package/dist/components/banner/index.js +10 -0
- 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 +337 -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/context-lens/context-lens.js +98 -0
- package/dist/components/context-lens/index.js +6 -0
- package/dist/components/copy-button/copy-button.js +189 -0
- package/dist/components/copy-button/index.js +8 -0
- 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/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/floating-toolbar/floating-toolbar.js +66 -0
- package/dist/components/floating-toolbar/index.js +6 -0
- package/dist/components/follow-mode/follow-mode.js +89 -0
- package/dist/components/follow-mode/index.js +6 -0
- package/dist/components/gantt-chart/gantt-chart.js +331 -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/globe-3d/globe-3d.js +417 -0
- package/dist/components/globe-3d/index.js +10 -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/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 +273 -0
- package/dist/components/historical-figure-card/index.js +6 -0
- package/dist/components/index.js +368 -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/knowledge-check/index.js +6 -0
- package/dist/components/knowledge-check/knowledge-check.js +448 -0
- 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/model-comparison/index.js +12 -0
- package/dist/components/model-comparison/model-comparison.js +211 -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/newsletter-signup/index.js +8 -0
- package/dist/components/newsletter-signup/newsletter-signup.js +269 -0
- package/dist/components/object-inspector/index.js +6 -0
- package/dist/components/object-inspector/object-inspector.js +136 -0
- package/dist/components/parallel-timeline/index.js +6 -0
- package/dist/components/parallel-timeline/parallel-timeline.js +251 -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/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/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/relationship-inspector/index.js +6 -0
- package/dist/components/relationship-inspector/relationship-inspector.js +102 -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/runtime-overview-panel/index.js +6 -0
- package/dist/components/runtime-overview-panel/runtime-overview-panel.js +89 -0
- package/dist/components/selection-halo/index.js +6 -0
- package/dist/components/selection-halo/selection-halo.js +72 -0
- package/dist/components/snap-guides/index.js +6 -0
- package/dist/components/snap-guides/snap-guides.js +45 -0
- 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/threshold-ring/index.js +6 -0
- package/dist/components/threshold-ring/threshold-ring.js +160 -0
- package/dist/components/timeline/index.js +12 -0
- package/dist/components/timeline/timeline.js +239 -0
- package/dist/components/transaction-list/index.js +14 -0
- package/dist/components/transaction-list/transaction-list.js +226 -0
- package/dist/components/tree-view/index.js +6 -0
- package/dist/components/tree-view/tree-view.js +298 -0
- package/dist/index.d.ts +5854 -142
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId } from "react";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
const DEFAULT_LABELS = {
|
|
6
|
+
region: "Context lens"
|
|
7
|
+
};
|
|
8
|
+
const clamp01 = (value) => {
|
|
9
|
+
if (value < 0) {
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
if (value > 1) {
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
const safeRadius = (value) => value < 0 ? 0 : value;
|
|
18
|
+
const ContextLens = forwardRef(
|
|
19
|
+
(props, ref) => {
|
|
20
|
+
const { className, focus, labels, opacity = 0.55, ...rest } = props;
|
|
21
|
+
const maskId = useId();
|
|
22
|
+
if (!focus) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
26
|
+
const inner = safeRadius(focus.inner);
|
|
27
|
+
const outer = safeRadius(Math.max(focus.outer, inner));
|
|
28
|
+
const fillOpacity = clamp01(opacity);
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
"aria-label": resolvedLabels.region,
|
|
34
|
+
className: cn(
|
|
35
|
+
"pointer-events-none absolute inset-0 z-20 h-full w-full",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
"data-context-lens": true,
|
|
39
|
+
ref,
|
|
40
|
+
...rest,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
43
|
+
"radialGradient",
|
|
44
|
+
{
|
|
45
|
+
cx: focus.cx,
|
|
46
|
+
cy: focus.cy,
|
|
47
|
+
"data-context-lens-gradient": true,
|
|
48
|
+
gradientUnits: "userSpaceOnUse",
|
|
49
|
+
id: maskId,
|
|
50
|
+
r: outer === 0 ? 1 : outer,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "black", stopOpacity: 0 }),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"stop",
|
|
55
|
+
{
|
|
56
|
+
offset: outer === 0 ? "100%" : `${inner / outer * 100}%`,
|
|
57
|
+
stopColor: "black",
|
|
58
|
+
stopOpacity: 0
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "black", stopOpacity: 1 })
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
) }),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
"rect",
|
|
67
|
+
{
|
|
68
|
+
"data-context-lens-dim": true,
|
|
69
|
+
fill: "black",
|
|
70
|
+
fillOpacity,
|
|
71
|
+
height: "100%",
|
|
72
|
+
mask: `url(#${maskId}-mask)`,
|
|
73
|
+
width: "100%",
|
|
74
|
+
x: 0,
|
|
75
|
+
y: 0
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsxs("mask", { id: `${maskId}-mask`, children: [
|
|
79
|
+
/* @__PURE__ */ jsx("rect", { fill: "white", height: "100%", width: "100%", x: 0, y: 0 }),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"circle",
|
|
82
|
+
{
|
|
83
|
+
cx: focus.cx,
|
|
84
|
+
cy: focus.cy,
|
|
85
|
+
fill: `url(#${maskId})`,
|
|
86
|
+
r: outer
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
ContextLens.displayName = "ContextLens";
|
|
96
|
+
export {
|
|
97
|
+
ContextLens
|
|
98
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
useCallback,
|
|
6
|
+
useEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
10
|
+
import { Check, Copy } from "lucide-react";
|
|
11
|
+
import { cn } from "../../lib/utils";
|
|
12
|
+
import { Button } from "../button/button";
|
|
13
|
+
import {
|
|
14
|
+
Tooltip,
|
|
15
|
+
TooltipContent,
|
|
16
|
+
TooltipProvider,
|
|
17
|
+
TooltipTrigger
|
|
18
|
+
} from "../tooltip/tooltip";
|
|
19
|
+
const FALLBACK_TIMEOUT_MS = 2e3;
|
|
20
|
+
function useCopyToClipboard(options = {}) {
|
|
21
|
+
const { timeout = FALLBACK_TIMEOUT_MS } = options;
|
|
22
|
+
const [copied, setCopied] = useState(false);
|
|
23
|
+
const timerRef = useRef(void 0);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
return () => {
|
|
26
|
+
if (timerRef.current !== void 0) {
|
|
27
|
+
clearTimeout(timerRef.current);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
const reset = useCallback(() => {
|
|
32
|
+
if (timerRef.current !== void 0) clearTimeout(timerRef.current);
|
|
33
|
+
setCopied(false);
|
|
34
|
+
}, []);
|
|
35
|
+
const copy = useCallback(
|
|
36
|
+
async (value) => {
|
|
37
|
+
try {
|
|
38
|
+
if (typeof navigator === "undefined" || typeof navigator.clipboard?.writeText !== "function") {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
await navigator.clipboard.writeText(value);
|
|
42
|
+
if (timerRef.current !== void 0) clearTimeout(timerRef.current);
|
|
43
|
+
setCopied(true);
|
|
44
|
+
timerRef.current = setTimeout(() => {
|
|
45
|
+
setCopied(false);
|
|
46
|
+
}, timeout);
|
|
47
|
+
return true;
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
[timeout]
|
|
53
|
+
);
|
|
54
|
+
return { copied, copy, reset };
|
|
55
|
+
}
|
|
56
|
+
function CopyIcon({
|
|
57
|
+
className,
|
|
58
|
+
copied,
|
|
59
|
+
size
|
|
60
|
+
}) {
|
|
61
|
+
const Icon = copied ? Check : Copy;
|
|
62
|
+
const sizeClass = size === "xs" ? "h-3 w-3" : "h-4 w-4";
|
|
63
|
+
return /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", className: cn(sizeClass, className) });
|
|
64
|
+
}
|
|
65
|
+
const ButtonTrigger = forwardRef(
|
|
66
|
+
({
|
|
67
|
+
accessibleLabel,
|
|
68
|
+
className,
|
|
69
|
+
copied,
|
|
70
|
+
copiedText,
|
|
71
|
+
iconClassName,
|
|
72
|
+
label = "Copy",
|
|
73
|
+
onClick: _onClick,
|
|
74
|
+
onClickHandler,
|
|
75
|
+
value: _value,
|
|
76
|
+
variant = "icon",
|
|
77
|
+
...rest
|
|
78
|
+
}, ref) => {
|
|
79
|
+
if (variant === "button") {
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
Button,
|
|
82
|
+
{
|
|
83
|
+
"aria-label": accessibleLabel,
|
|
84
|
+
className: cn(className),
|
|
85
|
+
onClick: onClickHandler,
|
|
86
|
+
ref,
|
|
87
|
+
size: "sm",
|
|
88
|
+
type: "button",
|
|
89
|
+
variant: "outline",
|
|
90
|
+
...rest,
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx(CopyIcon, { className: iconClassName, copied, size: "sm" }),
|
|
93
|
+
/* @__PURE__ */ jsx("span", { children: copied ? copiedText : label })
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (variant === "inline") {
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
Button,
|
|
101
|
+
{
|
|
102
|
+
"aria-label": accessibleLabel,
|
|
103
|
+
className: cn(
|
|
104
|
+
"h-6 w-6 align-middle text-muted-foreground hover:text-foreground",
|
|
105
|
+
className
|
|
106
|
+
),
|
|
107
|
+
onClick: onClickHandler,
|
|
108
|
+
ref,
|
|
109
|
+
size: "icon",
|
|
110
|
+
type: "button",
|
|
111
|
+
variant: "ghost",
|
|
112
|
+
...rest,
|
|
113
|
+
children: /* @__PURE__ */ jsx(CopyIcon, { className: iconClassName, copied, size: "xs" })
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return /* @__PURE__ */ jsx(
|
|
118
|
+
Button,
|
|
119
|
+
{
|
|
120
|
+
"aria-label": accessibleLabel,
|
|
121
|
+
className: cn("h-8 w-8", className),
|
|
122
|
+
onClick: onClickHandler,
|
|
123
|
+
ref,
|
|
124
|
+
size: "icon",
|
|
125
|
+
type: "button",
|
|
126
|
+
variant: "ghost",
|
|
127
|
+
...rest,
|
|
128
|
+
children: /* @__PURE__ */ jsx(CopyIcon, { className: iconClassName, copied, size: "sm" })
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
ButtonTrigger.displayName = "CopyButton.Trigger";
|
|
134
|
+
const CopyButton = forwardRef(
|
|
135
|
+
({
|
|
136
|
+
"aria-label": ariaLabelOverride,
|
|
137
|
+
copiedLabel = "Copied!",
|
|
138
|
+
label = "Copy",
|
|
139
|
+
onClick,
|
|
140
|
+
showTooltip = true,
|
|
141
|
+
timeout = FALLBACK_TIMEOUT_MS,
|
|
142
|
+
value,
|
|
143
|
+
...rest
|
|
144
|
+
}, ref) => {
|
|
145
|
+
const { copied, copy } = useCopyToClipboard({ timeout });
|
|
146
|
+
const handleClick = useCallback(
|
|
147
|
+
(event) => {
|
|
148
|
+
onClick?.(event);
|
|
149
|
+
if (event.defaultPrevented) return;
|
|
150
|
+
void copy(value);
|
|
151
|
+
},
|
|
152
|
+
[copy, onClick, value]
|
|
153
|
+
);
|
|
154
|
+
const accessibleLabel = ariaLabelOverride ?? (copied ? copiedLabel : label);
|
|
155
|
+
const tooltipText = copied ? copiedLabel : label;
|
|
156
|
+
const trigger = /* @__PURE__ */ jsx(
|
|
157
|
+
ButtonTrigger,
|
|
158
|
+
{
|
|
159
|
+
...rest,
|
|
160
|
+
accessibleLabel,
|
|
161
|
+
copied,
|
|
162
|
+
copiedText: copiedLabel,
|
|
163
|
+
label,
|
|
164
|
+
onClickHandler: handleClick,
|
|
165
|
+
ref,
|
|
166
|
+
value
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
const liveRegion = /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", role: "status", children: copied ? copiedLabel : "" });
|
|
170
|
+
if (!showTooltip) {
|
|
171
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
172
|
+
trigger,
|
|
173
|
+
liveRegion
|
|
174
|
+
] });
|
|
175
|
+
}
|
|
176
|
+
return /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 200, children: [
|
|
177
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
178
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: trigger }),
|
|
179
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: tooltipText })
|
|
180
|
+
] }),
|
|
181
|
+
liveRegion
|
|
182
|
+
] });
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
CopyButton.displayName = "CopyButton";
|
|
186
|
+
export {
|
|
187
|
+
CopyButton,
|
|
188
|
+
useCopyToClipboard
|
|
189
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
forwardRef
|
|
4
|
+
} from "react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const navVariants = cva("grid w-full gap-3 text-sm sm:grid-cols-2", {
|
|
8
|
+
defaultVariants: {
|
|
9
|
+
variant: "with-title"
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
compact: "",
|
|
14
|
+
"with-meta": "",
|
|
15
|
+
"with-title": ""
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const itemVariants = cva(
|
|
20
|
+
"group flex flex-col gap-1 rounded-lg border border-border bg-background p-4 text-foreground transition-colors hover:border-foreground/30 hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
21
|
+
{
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
side: "previous"
|
|
24
|
+
},
|
|
25
|
+
variants: {
|
|
26
|
+
side: {
|
|
27
|
+
next: "items-end text-right sm:col-start-2",
|
|
28
|
+
previous: "items-start text-left"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
const DEFAULT_LABELS = {
|
|
34
|
+
navigation: "Document navigation",
|
|
35
|
+
next: "Newer",
|
|
36
|
+
previous: "Older"
|
|
37
|
+
};
|
|
38
|
+
function SiblingItem({
|
|
39
|
+
ariaLabel,
|
|
40
|
+
caption,
|
|
41
|
+
link,
|
|
42
|
+
side,
|
|
43
|
+
variant
|
|
44
|
+
}) {
|
|
45
|
+
const { anchorProps, href, meta, title } = link;
|
|
46
|
+
return /* @__PURE__ */ jsxs(
|
|
47
|
+
"a",
|
|
48
|
+
{
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
className: cn(itemVariants({ side })),
|
|
51
|
+
href,
|
|
52
|
+
...anchorProps,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: caption }),
|
|
55
|
+
variant === "compact" ? null : /* @__PURE__ */ jsx("span", { className: "line-clamp-2 text-sm font-semibold text-foreground group-hover:underline", children: title }),
|
|
56
|
+
variant === "with-meta" && meta ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: meta }) : null
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function buildAriaLabel(caption, link, variant) {
|
|
62
|
+
if (variant === "compact" || typeof link.title !== "string") {
|
|
63
|
+
return caption;
|
|
64
|
+
}
|
|
65
|
+
return `${caption}: ${link.title}`;
|
|
66
|
+
}
|
|
67
|
+
const DocumentSiblingNav = forwardRef(({ className, labels, next, previous, variant, ...rest }, ref) => {
|
|
68
|
+
if (!previous && !next) return null;
|
|
69
|
+
const resolvedVariant = variant ?? "with-title";
|
|
70
|
+
const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
71
|
+
return /* @__PURE__ */ jsxs(
|
|
72
|
+
"nav",
|
|
73
|
+
{
|
|
74
|
+
"aria-label": resolvedLabels.navigation,
|
|
75
|
+
className: cn(navVariants({ variant: resolvedVariant }), className),
|
|
76
|
+
ref,
|
|
77
|
+
...rest,
|
|
78
|
+
children: [
|
|
79
|
+
previous ? /* @__PURE__ */ jsx(
|
|
80
|
+
SiblingItem,
|
|
81
|
+
{
|
|
82
|
+
ariaLabel: buildAriaLabel(
|
|
83
|
+
resolvedLabels.previous,
|
|
84
|
+
previous,
|
|
85
|
+
resolvedVariant
|
|
86
|
+
),
|
|
87
|
+
caption: resolvedLabels.previous,
|
|
88
|
+
link: previous,
|
|
89
|
+
side: "previous",
|
|
90
|
+
variant: resolvedVariant
|
|
91
|
+
}
|
|
92
|
+
) : /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
93
|
+
next ? /* @__PURE__ */ jsx(
|
|
94
|
+
SiblingItem,
|
|
95
|
+
{
|
|
96
|
+
ariaLabel: buildAriaLabel(resolvedLabels.next, next, resolvedVariant),
|
|
97
|
+
caption: resolvedLabels.next,
|
|
98
|
+
link: next,
|
|
99
|
+
side: "next",
|
|
100
|
+
variant: resolvedVariant
|
|
101
|
+
}
|
|
102
|
+
) : /* @__PURE__ */ jsx("span", { "aria-hidden": "true" })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
DocumentSiblingNav.displayName = "DocumentSiblingNav";
|
|
108
|
+
export {
|
|
109
|
+
DocumentSiblingNav,
|
|
110
|
+
navVariants as documentSiblingNavVariants
|
|
111
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
forwardRef
|
|
4
|
+
} from "react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const emptyStateVariants = cva(
|
|
8
|
+
"flex flex-col items-center justify-center gap-3 text-center text-foreground",
|
|
9
|
+
{
|
|
10
|
+
defaultVariants: {
|
|
11
|
+
size: "md"
|
|
12
|
+
},
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
lg: "px-6 py-16",
|
|
16
|
+
md: "px-4 py-10",
|
|
17
|
+
sm: "px-3 py-6"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
const titleVariants = cva("font-semibold tracking-tight", {
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
size: "md"
|
|
25
|
+
},
|
|
26
|
+
variants: {
|
|
27
|
+
size: {
|
|
28
|
+
lg: "text-xl",
|
|
29
|
+
md: "text-lg",
|
|
30
|
+
sm: "text-base"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const descriptionVariants = cva("max-w-prose text-muted-foreground", {
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
size: "md"
|
|
37
|
+
},
|
|
38
|
+
variants: {
|
|
39
|
+
size: {
|
|
40
|
+
lg: "text-base",
|
|
41
|
+
md: "text-sm",
|
|
42
|
+
sm: "text-xs"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const iconVariants = cva(
|
|
47
|
+
"mb-1 flex items-center justify-center rounded-full bg-muted text-muted-foreground [&_svg]:h-1/2 [&_svg]:w-1/2",
|
|
48
|
+
{
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
size: "md"
|
|
51
|
+
},
|
|
52
|
+
variants: {
|
|
53
|
+
size: {
|
|
54
|
+
lg: "h-16 w-16",
|
|
55
|
+
md: "h-12 w-12",
|
|
56
|
+
sm: "h-8 w-8"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
const EmptyState = forwardRef(
|
|
62
|
+
({
|
|
63
|
+
children,
|
|
64
|
+
className,
|
|
65
|
+
description,
|
|
66
|
+
icon,
|
|
67
|
+
role: roleOverride,
|
|
68
|
+
size,
|
|
69
|
+
title,
|
|
70
|
+
...rest
|
|
71
|
+
}, ref) => {
|
|
72
|
+
return /* @__PURE__ */ jsxs(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: cn(emptyStateVariants({ size }), className),
|
|
76
|
+
ref,
|
|
77
|
+
role: roleOverride ?? "status",
|
|
78
|
+
...rest,
|
|
79
|
+
children: [
|
|
80
|
+
icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(iconVariants({ size })), children: icon }) : null,
|
|
81
|
+
title ? /* @__PURE__ */ jsx("h3", { className: cn(titleVariants({ size })), children: title }) : null,
|
|
82
|
+
description ? /* @__PURE__ */ jsx("p", { className: cn(descriptionVariants({ size })), children: description }) : null,
|
|
83
|
+
children ? /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap items-center justify-center gap-2", children }) : null
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
EmptyState.displayName = "EmptyState";
|
|
90
|
+
export {
|
|
91
|
+
EmptyState,
|
|
92
|
+
emptyStateVariants
|
|
93
|
+
};
|