@usetheo/ui 0.7.0-next.0 → 0.9.0-next.0
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 +170 -0
- package/README.md +20 -19
- package/dist/components.css +1 -1
- package/dist/index.d.ts +354 -8
- package/dist/index.js +925 -9
- package/dist/index.js.map +1 -1
- package/llms.txt +269 -0
- package/package.json +91 -48
- package/registry/index.json +61 -1
- package/registry/r/account-menu.json +1 -1
- package/registry/r/alert.json +22 -0
- package/registry/r/code-block.json +21 -0
- package/registry/r/confirm-dialog.json +25 -0
- package/registry/r/copy-button.json +22 -0
- package/registry/r/danger-zone.json +20 -0
- package/registry/r/pagination.json +22 -0
- package/registry/r/stat-tile.json +22 -0
- package/registry/r/status-dot.json +20 -0
- package/registry/r/table.json +22 -0
- package/registry/r/timestamp.json +20 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { extendTailwindMerge } from 'tailwind-merge';
|
|
3
|
-
import { createContext, forwardRef, useId, Children, isValidElement, cloneElement, useState, useMemo, Fragment as Fragment$1, memo,
|
|
3
|
+
import { createContext, forwardRef, useId, Children, isValidElement, cloneElement, useState, useMemo, Fragment as Fragment$1, memo, useContext, useEffect, useRef, useCallback, createElement } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import * as DropdownMenu2 from '@radix-ui/react-dropdown-menu';
|
|
6
|
-
import { X, AlertCircle, ChevronDown, ChevronUp, Check, Minus, Circle, Settings2, Eye, Lock, Plus, Trash2, Users, User, BookOpen, Sparkles, Globe, Pencil, Coins, TrendingUp, TrendingDown, CircleX, CheckCircle2, Loader2, CircleDashed, RotateCcw, Folder, FolderOpen, Brain, Zap, ShieldAlert, Clock, Play, Square, Server, Plug, Wrench, CalendarDays, CornerDownRight, Bot, MessageSquare, ChevronRight, ArrowRight, AlertOctagon, Network, KeyRound, ShieldOff, Database, GitBranch, ChevronsUpDown, FileText, FileCode, FileSpreadsheet, FileImage, File, Hammer, ShieldCheck, Edit3, FilePlus, FileSearch, Terminal, AlertTriangle, CircleDot, FileEdit, Cloud, RefreshCw, Maximize2, ArrowLeft, RotateCw, Search, Paperclip, Mic, Send, GitCommit, Activity, EyeOff,
|
|
6
|
+
import { X, AlertCircle, ChevronDown, ChevronUp, Check, Minus, Circle, Settings2, Eye, Lock, Plus, Trash2, Users, User, BookOpen, Sparkles, Globe, Pencil, Coins, TrendingUp, TrendingDown, CircleX, CheckCircle2, Loader2, CircleDashed, RotateCcw, Folder, FolderOpen, Brain, Zap, ShieldAlert, Clock, Play, Square, Server, Plug, Wrench, CalendarDays, CornerDownRight, Bot, MessageSquare, ChevronRight, ArrowRight, AlertOctagon, Network, KeyRound, ShieldOff, Database, GitBranch, ChevronsUpDown, FileText, FileCode, FileSpreadsheet, FileImage, File, Hammer, ShieldCheck, Edit3, FilePlus, FileSearch, Terminal, AlertTriangle, CircleDot, FileEdit, Copy, ArrowUpRight, TriangleAlert, Info, ChevronsLeft, ChevronLeft, ChevronsRight, Cloud, RefreshCw, Maximize2, ArrowLeft, RotateCw, Search, Paperclip, Mic, Send, GitCommit, Activity, EyeOff, GitPullRequest, ExternalLink, ShieldX, ArrowDownLeft, ShieldQuestion, BrainCircuitIcon, ImageIcon, FileIcon, ExternalLinkIcon, FileTextIcon, WrenchIcon, CodeIcon, ShieldIcon, AlertCircleIcon, CheckCircleIcon, LoaderIcon, Rocket, Image, Palette, Moon, Sun, ChevronLeftIcon, ChevronRightIcon, Hash, Slash, CheckIcon, CopyIcon } from 'lucide-react';
|
|
7
7
|
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -5546,12 +5546,12 @@ async function sanitizeHast(tree) {
|
|
|
5546
5546
|
return safe2.type === "root" ? safe2 : { type: "root", children: [safe2] };
|
|
5547
5547
|
}
|
|
5548
5548
|
async function hastToReact(tree, components) {
|
|
5549
|
-
const { Fragment:
|
|
5549
|
+
const { Fragment: Fragment19, jsx: jsx131, jsxs: jsxs106 } = await import('react/jsx-runtime');
|
|
5550
5550
|
const { toJsxRuntime } = await import('hast-util-to-jsx-runtime');
|
|
5551
5551
|
return toJsxRuntime(tree, {
|
|
5552
|
-
Fragment:
|
|
5553
|
-
jsx:
|
|
5554
|
-
jsxs:
|
|
5552
|
+
Fragment: Fragment19,
|
|
5553
|
+
jsx: jsx131,
|
|
5554
|
+
jsxs: jsxs106,
|
|
5555
5555
|
components
|
|
5556
5556
|
});
|
|
5557
5557
|
}
|
|
@@ -6997,6 +6997,922 @@ var AccountMenu = forwardRef(
|
|
|
6997
6997
|
}
|
|
6998
6998
|
);
|
|
6999
6999
|
AccountMenu.displayName = "AccountMenu";
|
|
7000
|
+
var TableDensityContext = createContext("default");
|
|
7001
|
+
var alignClass = {
|
|
7002
|
+
left: "text-left",
|
|
7003
|
+
center: "text-center",
|
|
7004
|
+
right: "text-right"
|
|
7005
|
+
};
|
|
7006
|
+
var Root22 = forwardRef(
|
|
7007
|
+
({ className, density = "default", children, ...props }, ref) => /* @__PURE__ */ jsx(TableDensityContext.Provider, { value: density, children: /* @__PURE__ */ jsx(
|
|
7008
|
+
"table",
|
|
7009
|
+
{
|
|
7010
|
+
ref,
|
|
7011
|
+
className: cn("w-full border-collapse font-sans text-body-sm", className),
|
|
7012
|
+
...props,
|
|
7013
|
+
children
|
|
7014
|
+
}
|
|
7015
|
+
) })
|
|
7016
|
+
);
|
|
7017
|
+
Root22.displayName = "Table";
|
|
7018
|
+
var Header5 = forwardRef(
|
|
7019
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7020
|
+
"thead",
|
|
7021
|
+
{
|
|
7022
|
+
ref,
|
|
7023
|
+
className: cn(
|
|
7024
|
+
"border-border/40 border-b text-label-caps text-muted-foreground uppercase tracking-wider",
|
|
7025
|
+
className
|
|
7026
|
+
),
|
|
7027
|
+
...props
|
|
7028
|
+
}
|
|
7029
|
+
)
|
|
7030
|
+
);
|
|
7031
|
+
Header5.displayName = "Table.Header";
|
|
7032
|
+
var Body4 = forwardRef(
|
|
7033
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn("text-foreground", className), ...props })
|
|
7034
|
+
);
|
|
7035
|
+
Body4.displayName = "Table.Body";
|
|
7036
|
+
var Row = forwardRef(
|
|
7037
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7038
|
+
"tr",
|
|
7039
|
+
{
|
|
7040
|
+
ref,
|
|
7041
|
+
className: cn(
|
|
7042
|
+
"border-border/20 border-b transition-colors last:border-0 hover:bg-muted/40",
|
|
7043
|
+
className
|
|
7044
|
+
),
|
|
7045
|
+
...props
|
|
7046
|
+
}
|
|
7047
|
+
)
|
|
7048
|
+
);
|
|
7049
|
+
Row.displayName = "Table.Row";
|
|
7050
|
+
var Cell = forwardRef(
|
|
7051
|
+
({ className, align = "left", numeric, children, ...props }, ref) => {
|
|
7052
|
+
const density = useContext(TableDensityContext);
|
|
7053
|
+
return /* @__PURE__ */ jsx(
|
|
7054
|
+
"td",
|
|
7055
|
+
{
|
|
7056
|
+
ref,
|
|
7057
|
+
className: cn(
|
|
7058
|
+
"px-3",
|
|
7059
|
+
density === "compact" ? "py-1.5" : "py-3",
|
|
7060
|
+
alignClass[align],
|
|
7061
|
+
numeric && "font-mono tabular-nums",
|
|
7062
|
+
className
|
|
7063
|
+
),
|
|
7064
|
+
...props,
|
|
7065
|
+
children
|
|
7066
|
+
}
|
|
7067
|
+
);
|
|
7068
|
+
}
|
|
7069
|
+
);
|
|
7070
|
+
Cell.displayName = "Table.Cell";
|
|
7071
|
+
var HeaderCell = forwardRef(
|
|
7072
|
+
({ className, align = "left", onSort, sortDirection = "none", children, ...props }, ref) => {
|
|
7073
|
+
const sortAffordance = onSort !== void 0 ? /* @__PURE__ */ jsxs("span", { className: "ml-1 inline-flex flex-col", children: [
|
|
7074
|
+
/* @__PURE__ */ jsx(
|
|
7075
|
+
ChevronUp,
|
|
7076
|
+
{
|
|
7077
|
+
"aria-hidden": "true",
|
|
7078
|
+
className: cn("-mb-1 size-3", sortDirection === "asc" ? "opacity-100" : "opacity-30")
|
|
7079
|
+
}
|
|
7080
|
+
),
|
|
7081
|
+
/* @__PURE__ */ jsx(
|
|
7082
|
+
ChevronDown,
|
|
7083
|
+
{
|
|
7084
|
+
"aria-hidden": "true",
|
|
7085
|
+
className: cn("size-3", sortDirection === "desc" ? "opacity-100" : "opacity-30")
|
|
7086
|
+
}
|
|
7087
|
+
)
|
|
7088
|
+
] }) : null;
|
|
7089
|
+
const ariaSort = onSort === void 0 ? void 0 : sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none";
|
|
7090
|
+
return /* @__PURE__ */ jsx(
|
|
7091
|
+
"th",
|
|
7092
|
+
{
|
|
7093
|
+
ref,
|
|
7094
|
+
scope: "col",
|
|
7095
|
+
"aria-sort": ariaSort,
|
|
7096
|
+
className: cn(
|
|
7097
|
+
"px-3 py-2.5 font-medium",
|
|
7098
|
+
alignClass[align],
|
|
7099
|
+
align === "right" && "[&_button]:justify-end",
|
|
7100
|
+
className
|
|
7101
|
+
),
|
|
7102
|
+
...props,
|
|
7103
|
+
children: onSort !== void 0 ? /* @__PURE__ */ jsxs(
|
|
7104
|
+
"button",
|
|
7105
|
+
{
|
|
7106
|
+
type: "button",
|
|
7107
|
+
onClick: onSort,
|
|
7108
|
+
className: cn(
|
|
7109
|
+
"inline-flex items-center gap-1",
|
|
7110
|
+
"text-label-caps uppercase tracking-wider",
|
|
7111
|
+
"transition-colors hover:text-foreground",
|
|
7112
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
7113
|
+
),
|
|
7114
|
+
children: [
|
|
7115
|
+
children,
|
|
7116
|
+
sortAffordance
|
|
7117
|
+
]
|
|
7118
|
+
}
|
|
7119
|
+
) : children
|
|
7120
|
+
}
|
|
7121
|
+
);
|
|
7122
|
+
}
|
|
7123
|
+
);
|
|
7124
|
+
HeaderCell.displayName = "Table.HeaderCell";
|
|
7125
|
+
var Table = Object.assign(Root22, { Header: Header5, Body: Body4, Row, Cell, HeaderCell });
|
|
7126
|
+
var DOT_COLOR = {
|
|
7127
|
+
live: "bg-success",
|
|
7128
|
+
building: "bg-warning",
|
|
7129
|
+
failed: "bg-destructive",
|
|
7130
|
+
idle: "bg-muted-foreground/40",
|
|
7131
|
+
warning: "bg-warning"
|
|
7132
|
+
};
|
|
7133
|
+
var LABEL_COLOR = {
|
|
7134
|
+
live: "text-success",
|
|
7135
|
+
building: "text-warning",
|
|
7136
|
+
failed: "text-destructive",
|
|
7137
|
+
idle: "text-muted-foreground",
|
|
7138
|
+
warning: "text-warning"
|
|
7139
|
+
};
|
|
7140
|
+
var SIZE = {
|
|
7141
|
+
xs: "size-1.5",
|
|
7142
|
+
sm: "size-2",
|
|
7143
|
+
md: "size-2.5"
|
|
7144
|
+
};
|
|
7145
|
+
var StatusDot = forwardRef(
|
|
7146
|
+
({ className, status, label, size = "sm", pulse, "aria-label": ariaLabel, ...props }, ref) => {
|
|
7147
|
+
const shouldPulse = pulse ?? status === "building";
|
|
7148
|
+
const hasVisibleLabel = label !== void 0 && label !== null;
|
|
7149
|
+
const effectiveAriaLabel = ariaLabel ?? (hasVisibleLabel ? void 0 : status);
|
|
7150
|
+
useEffect(() => {
|
|
7151
|
+
if (process.env.NODE_ENV !== "production" && !hasVisibleLabel && ariaLabel === void 0) {
|
|
7152
|
+
console.warn(
|
|
7153
|
+
`<StatusDot status="${status}" />: no \`label\` or \`aria-label\` provided. Color-only status is invisible to screen readers. Falling back to aria-label="${status}".`
|
|
7154
|
+
);
|
|
7155
|
+
}
|
|
7156
|
+
}, [hasVisibleLabel, ariaLabel, status]);
|
|
7157
|
+
const dot = /* @__PURE__ */ jsx(
|
|
7158
|
+
"span",
|
|
7159
|
+
{
|
|
7160
|
+
"aria-hidden": hasVisibleLabel ? "true" : void 0,
|
|
7161
|
+
className: cn(
|
|
7162
|
+
"inline-block shrink-0 rounded-full",
|
|
7163
|
+
SIZE[size],
|
|
7164
|
+
DOT_COLOR[status],
|
|
7165
|
+
shouldPulse && "animate-pulse"
|
|
7166
|
+
)
|
|
7167
|
+
}
|
|
7168
|
+
);
|
|
7169
|
+
if (!hasVisibleLabel) {
|
|
7170
|
+
return /* @__PURE__ */ jsx(
|
|
7171
|
+
"span",
|
|
7172
|
+
{
|
|
7173
|
+
ref,
|
|
7174
|
+
role: "status",
|
|
7175
|
+
"aria-label": effectiveAriaLabel,
|
|
7176
|
+
className: cn("inline-flex items-center", className),
|
|
7177
|
+
...props,
|
|
7178
|
+
children: dot
|
|
7179
|
+
}
|
|
7180
|
+
);
|
|
7181
|
+
}
|
|
7182
|
+
return /* @__PURE__ */ jsxs(
|
|
7183
|
+
"span",
|
|
7184
|
+
{
|
|
7185
|
+
ref,
|
|
7186
|
+
"aria-label": effectiveAriaLabel,
|
|
7187
|
+
className: cn(
|
|
7188
|
+
"inline-flex items-center gap-1.5 font-mono text-label",
|
|
7189
|
+
LABEL_COLOR[status],
|
|
7190
|
+
className
|
|
7191
|
+
),
|
|
7192
|
+
...props,
|
|
7193
|
+
children: [
|
|
7194
|
+
dot,
|
|
7195
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
7196
|
+
]
|
|
7197
|
+
}
|
|
7198
|
+
);
|
|
7199
|
+
}
|
|
7200
|
+
);
|
|
7201
|
+
StatusDot.displayName = "StatusDot";
|
|
7202
|
+
var VARIANT = {
|
|
7203
|
+
ghost: "hover:bg-muted",
|
|
7204
|
+
outline: "border border-border/60 rounded-md"
|
|
7205
|
+
};
|
|
7206
|
+
var SIZE2 = {
|
|
7207
|
+
sm: "px-2 py-1 text-label",
|
|
7208
|
+
md: "px-2.5 py-1.5 text-body-sm"
|
|
7209
|
+
};
|
|
7210
|
+
var CopyButton = forwardRef(
|
|
7211
|
+
({
|
|
7212
|
+
className,
|
|
7213
|
+
value,
|
|
7214
|
+
label,
|
|
7215
|
+
variant = "ghost",
|
|
7216
|
+
size = "sm",
|
|
7217
|
+
onCopied,
|
|
7218
|
+
feedbackDuration = 1500,
|
|
7219
|
+
...props
|
|
7220
|
+
}, ref) => {
|
|
7221
|
+
const [state, setState] = useState("idle");
|
|
7222
|
+
const timerRef = useRef(null);
|
|
7223
|
+
useEffect(() => {
|
|
7224
|
+
return () => {
|
|
7225
|
+
if (timerRef.current !== null) {
|
|
7226
|
+
clearTimeout(timerRef.current);
|
|
7227
|
+
}
|
|
7228
|
+
};
|
|
7229
|
+
}, []);
|
|
7230
|
+
const scheduleRevert = useCallback(() => {
|
|
7231
|
+
if (timerRef.current !== null) {
|
|
7232
|
+
clearTimeout(timerRef.current);
|
|
7233
|
+
}
|
|
7234
|
+
timerRef.current = setTimeout(() => {
|
|
7235
|
+
setState("idle");
|
|
7236
|
+
timerRef.current = null;
|
|
7237
|
+
}, feedbackDuration);
|
|
7238
|
+
}, [feedbackDuration]);
|
|
7239
|
+
const handleClick = useCallback(() => {
|
|
7240
|
+
if (state !== "idle") return;
|
|
7241
|
+
if (typeof navigator === "undefined" || !navigator.clipboard?.writeText) {
|
|
7242
|
+
setState("failed");
|
|
7243
|
+
scheduleRevert();
|
|
7244
|
+
return;
|
|
7245
|
+
}
|
|
7246
|
+
navigator.clipboard.writeText(value).then(
|
|
7247
|
+
() => {
|
|
7248
|
+
setState("copied");
|
|
7249
|
+
onCopied?.(value);
|
|
7250
|
+
scheduleRevert();
|
|
7251
|
+
},
|
|
7252
|
+
() => {
|
|
7253
|
+
setState("failed");
|
|
7254
|
+
scheduleRevert();
|
|
7255
|
+
}
|
|
7256
|
+
);
|
|
7257
|
+
}, [state, value, onCopied, scheduleRevert]);
|
|
7258
|
+
const Icon2 = state === "copied" ? Check : state === "failed" ? X : Copy;
|
|
7259
|
+
const liveMessage = state === "copied" ? "Copied to clipboard" : state === "failed" ? "Copy failed" : "";
|
|
7260
|
+
const labelText = label !== void 0 ? state === "copied" ? "Copied!" : state === "failed" ? "Failed" : label : null;
|
|
7261
|
+
return /* @__PURE__ */ jsxs(
|
|
7262
|
+
"button",
|
|
7263
|
+
{
|
|
7264
|
+
ref,
|
|
7265
|
+
type: "button",
|
|
7266
|
+
onClick: handleClick,
|
|
7267
|
+
"data-state": state,
|
|
7268
|
+
className: cn(
|
|
7269
|
+
"inline-flex items-center gap-1.5",
|
|
7270
|
+
"font-sans transition-colors",
|
|
7271
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card",
|
|
7272
|
+
VARIANT[variant],
|
|
7273
|
+
SIZE2[size],
|
|
7274
|
+
className
|
|
7275
|
+
),
|
|
7276
|
+
...props,
|
|
7277
|
+
children: [
|
|
7278
|
+
/* @__PURE__ */ jsx(
|
|
7279
|
+
Icon2,
|
|
7280
|
+
{
|
|
7281
|
+
"aria-hidden": "true",
|
|
7282
|
+
className: cn(
|
|
7283
|
+
"size-3.5 shrink-0 transition-opacity duration-200",
|
|
7284
|
+
state === "copied" && "text-success",
|
|
7285
|
+
state === "failed" && "text-destructive"
|
|
7286
|
+
)
|
|
7287
|
+
}
|
|
7288
|
+
),
|
|
7289
|
+
labelText !== null ? /* @__PURE__ */ jsx("span", { children: labelText }) : null,
|
|
7290
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "polite", children: liveMessage })
|
|
7291
|
+
]
|
|
7292
|
+
}
|
|
7293
|
+
);
|
|
7294
|
+
}
|
|
7295
|
+
);
|
|
7296
|
+
CopyButton.displayName = "CopyButton";
|
|
7297
|
+
function toDate(value) {
|
|
7298
|
+
const d = value instanceof Date ? value : new Date(value);
|
|
7299
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
7300
|
+
}
|
|
7301
|
+
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
7302
|
+
var UNITS = [
|
|
7303
|
+
{ unit: "year", ms: 365 * 24 * 60 * 60 * 1e3 },
|
|
7304
|
+
{ unit: "month", ms: 30 * 24 * 60 * 60 * 1e3 },
|
|
7305
|
+
{ unit: "day", ms: 24 * 60 * 60 * 1e3 },
|
|
7306
|
+
{ unit: "hour", ms: 60 * 60 * 1e3 },
|
|
7307
|
+
{ unit: "minute", ms: 60 * 1e3 }
|
|
7308
|
+
];
|
|
7309
|
+
function safeRelativeFormatter(locale) {
|
|
7310
|
+
try {
|
|
7311
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
7312
|
+
} catch {
|
|
7313
|
+
if (process.env.NODE_ENV !== "production") {
|
|
7314
|
+
console.warn(`<Timestamp locale="${locale}">: invalid locale tag, falling back to default.`);
|
|
7315
|
+
}
|
|
7316
|
+
try {
|
|
7317
|
+
return new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
7318
|
+
} catch {
|
|
7319
|
+
return null;
|
|
7320
|
+
}
|
|
7321
|
+
}
|
|
7322
|
+
}
|
|
7323
|
+
function safeAbsoluteFormat(date, locale, withYear) {
|
|
7324
|
+
try {
|
|
7325
|
+
return date.toLocaleDateString(locale, {
|
|
7326
|
+
month: "short",
|
|
7327
|
+
day: "numeric",
|
|
7328
|
+
...withYear ? { year: "numeric" } : {}
|
|
7329
|
+
});
|
|
7330
|
+
} catch {
|
|
7331
|
+
return date.toLocaleDateString(void 0, {
|
|
7332
|
+
month: "short",
|
|
7333
|
+
day: "numeric",
|
|
7334
|
+
...withYear ? { year: "numeric" } : {}
|
|
7335
|
+
});
|
|
7336
|
+
}
|
|
7337
|
+
}
|
|
7338
|
+
function formatRelative(date, now, locale) {
|
|
7339
|
+
const diffMs = date.getTime() - now.getTime();
|
|
7340
|
+
const absMs = Math.abs(diffMs);
|
|
7341
|
+
if (absMs < 6e4) return "just now";
|
|
7342
|
+
if (diffMs < 0 && absMs > SEVEN_DAYS_MS) {
|
|
7343
|
+
const sameYear = date.getFullYear() === now.getFullYear();
|
|
7344
|
+
return safeAbsoluteFormat(date, locale, !sameYear);
|
|
7345
|
+
}
|
|
7346
|
+
const rtf = safeRelativeFormatter(locale);
|
|
7347
|
+
if (rtf === null) {
|
|
7348
|
+
return safeAbsoluteFormat(date, locale, date.getFullYear() !== now.getFullYear());
|
|
7349
|
+
}
|
|
7350
|
+
for (const { unit, ms } of UNITS) {
|
|
7351
|
+
if (absMs >= ms) {
|
|
7352
|
+
return rtf.format(Math.round(diffMs / ms), unit);
|
|
7353
|
+
}
|
|
7354
|
+
}
|
|
7355
|
+
return "just now";
|
|
7356
|
+
}
|
|
7357
|
+
function formatAbsolute(date, locale) {
|
|
7358
|
+
try {
|
|
7359
|
+
return date.toLocaleString(locale, {
|
|
7360
|
+
year: "numeric",
|
|
7361
|
+
month: "short",
|
|
7362
|
+
day: "numeric",
|
|
7363
|
+
hour: "2-digit",
|
|
7364
|
+
minute: "2-digit"
|
|
7365
|
+
});
|
|
7366
|
+
} catch {
|
|
7367
|
+
return date.toLocaleString(void 0, {
|
|
7368
|
+
year: "numeric",
|
|
7369
|
+
month: "short",
|
|
7370
|
+
day: "numeric",
|
|
7371
|
+
hour: "2-digit",
|
|
7372
|
+
minute: "2-digit"
|
|
7373
|
+
});
|
|
7374
|
+
}
|
|
7375
|
+
}
|
|
7376
|
+
var Timestamp = forwardRef(
|
|
7377
|
+
({
|
|
7378
|
+
className,
|
|
7379
|
+
value,
|
|
7380
|
+
format = "relative",
|
|
7381
|
+
refreshInterval = 6e4,
|
|
7382
|
+
locale,
|
|
7383
|
+
noTooltip,
|
|
7384
|
+
...props
|
|
7385
|
+
}, ref) => {
|
|
7386
|
+
const date = toDate(value);
|
|
7387
|
+
const [now, setNow] = useState(() => /* @__PURE__ */ new Date());
|
|
7388
|
+
useEffect(() => {
|
|
7389
|
+
if (format !== "relative" || refreshInterval === 0 || date === null) return;
|
|
7390
|
+
const id = setInterval(() => setNow(/* @__PURE__ */ new Date()), refreshInterval);
|
|
7391
|
+
return () => clearInterval(id);
|
|
7392
|
+
}, [format, refreshInterval, date]);
|
|
7393
|
+
if (date === null) {
|
|
7394
|
+
return /* @__PURE__ */ jsx("time", { ref, className: cn(className), suppressHydrationWarning: true, ...props });
|
|
7395
|
+
}
|
|
7396
|
+
const iso = date.toISOString();
|
|
7397
|
+
const absolute = formatAbsolute(date, locale);
|
|
7398
|
+
const relative = formatRelative(date, now, locale);
|
|
7399
|
+
const visibleText = format === "absolute" ? absolute : format === "both" ? `${absolute} (${relative})` : relative;
|
|
7400
|
+
return /* @__PURE__ */ jsx(
|
|
7401
|
+
"time",
|
|
7402
|
+
{
|
|
7403
|
+
ref,
|
|
7404
|
+
dateTime: iso,
|
|
7405
|
+
title: noTooltip ? void 0 : absolute,
|
|
7406
|
+
"aria-label": absolute,
|
|
7407
|
+
suppressHydrationWarning: true,
|
|
7408
|
+
className: cn(className),
|
|
7409
|
+
...props,
|
|
7410
|
+
children: visibleText
|
|
7411
|
+
}
|
|
7412
|
+
);
|
|
7413
|
+
}
|
|
7414
|
+
);
|
|
7415
|
+
Timestamp.displayName = "Timestamp";
|
|
7416
|
+
var TREND = {
|
|
7417
|
+
up: { icon: TrendingUp, color: "text-success" },
|
|
7418
|
+
down: { icon: TrendingDown, color: "text-destructive" },
|
|
7419
|
+
flat: { icon: Minus, color: "text-muted-foreground" }
|
|
7420
|
+
};
|
|
7421
|
+
var StatTile = forwardRef(
|
|
7422
|
+
({ className, value, label, icon: Icon2, delta, onClick, children: _children, ...props }, ref) => {
|
|
7423
|
+
const isInteractive = onClick !== void 0;
|
|
7424
|
+
const TrendIcon = delta !== void 0 ? TREND[delta.trend].icon : null;
|
|
7425
|
+
const trendColor = delta !== void 0 ? TREND[delta.trend].color : "";
|
|
7426
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7427
|
+
(Icon2 !== void 0 || isInteractive) && /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
7428
|
+
Icon2 !== void 0 ? /* @__PURE__ */ jsx("div", { className: "flex size-8 items-center justify-center rounded-lg border border-border/40 bg-muted/40", children: /* @__PURE__ */ jsx(Icon2, { "aria-hidden": "true", className: "size-4 text-muted-foreground" }) }) : /* @__PURE__ */ jsx("div", {}),
|
|
7429
|
+
isInteractive ? /* @__PURE__ */ jsx(
|
|
7430
|
+
ArrowUpRight,
|
|
7431
|
+
{
|
|
7432
|
+
"aria-hidden": "true",
|
|
7433
|
+
className: "size-3.5 text-muted-foreground transition-colors group-hover:text-foreground"
|
|
7434
|
+
}
|
|
7435
|
+
) : null
|
|
7436
|
+
] }),
|
|
7437
|
+
/* @__PURE__ */ jsx("div", { className: "whitespace-nowrap font-bold font-display text-display-md text-foreground tabular-nums leading-none tracking-tight", children: value }),
|
|
7438
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 font-sans text-body-sm text-muted-foreground", children: label }),
|
|
7439
|
+
delta !== void 0 && TrendIcon !== null ? /* @__PURE__ */ jsxs(
|
|
7440
|
+
"div",
|
|
7441
|
+
{
|
|
7442
|
+
className: cn("mt-2 inline-flex items-center gap-1 font-mono text-label", trendColor),
|
|
7443
|
+
children: [
|
|
7444
|
+
/* @__PURE__ */ jsx(TrendIcon, { "aria-hidden": "true", className: "size-3" }),
|
|
7445
|
+
/* @__PURE__ */ jsx("span", { children: delta.value })
|
|
7446
|
+
]
|
|
7447
|
+
}
|
|
7448
|
+
) : null
|
|
7449
|
+
] });
|
|
7450
|
+
if (isInteractive) {
|
|
7451
|
+
return /* @__PURE__ */ jsx(
|
|
7452
|
+
"button",
|
|
7453
|
+
{
|
|
7454
|
+
ref,
|
|
7455
|
+
type: "button",
|
|
7456
|
+
onClick,
|
|
7457
|
+
className: cn(
|
|
7458
|
+
"group block w-full rounded-xl border border-border/40 bg-card p-5 text-left",
|
|
7459
|
+
"cursor-pointer transition-colors hover:border-primary/30",
|
|
7460
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
7461
|
+
className
|
|
7462
|
+
),
|
|
7463
|
+
...props,
|
|
7464
|
+
children: inner
|
|
7465
|
+
}
|
|
7466
|
+
);
|
|
7467
|
+
}
|
|
7468
|
+
return /* @__PURE__ */ jsx(
|
|
7469
|
+
"div",
|
|
7470
|
+
{
|
|
7471
|
+
ref,
|
|
7472
|
+
className: cn("rounded-xl border border-border/40 bg-card p-5", className),
|
|
7473
|
+
children: inner
|
|
7474
|
+
}
|
|
7475
|
+
);
|
|
7476
|
+
}
|
|
7477
|
+
);
|
|
7478
|
+
StatTile.displayName = "StatTile";
|
|
7479
|
+
var Root23 = forwardRef(
|
|
7480
|
+
({ className, title = "Danger Zone", children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
7481
|
+
"section",
|
|
7482
|
+
{
|
|
7483
|
+
ref,
|
|
7484
|
+
"aria-label": typeof title === "string" ? title : "Danger Zone",
|
|
7485
|
+
className: cn("rounded-xl border border-destructive/30 bg-destructive/[0.02]", className),
|
|
7486
|
+
...props,
|
|
7487
|
+
children: [
|
|
7488
|
+
/* @__PURE__ */ jsx("div", { className: "border-destructive/20 border-b px-5 py-3 font-sans text-destructive text-label-caps uppercase tracking-wider", children: title }),
|
|
7489
|
+
children
|
|
7490
|
+
]
|
|
7491
|
+
}
|
|
7492
|
+
)
|
|
7493
|
+
);
|
|
7494
|
+
Root23.displayName = "DangerZone";
|
|
7495
|
+
var Action2 = forwardRef(
|
|
7496
|
+
({ className, title, description, action, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
7497
|
+
"div",
|
|
7498
|
+
{
|
|
7499
|
+
ref,
|
|
7500
|
+
className: cn(
|
|
7501
|
+
"flex items-center justify-between gap-4 border-destructive/10 border-b px-5 py-4 last:border-b-0",
|
|
7502
|
+
className
|
|
7503
|
+
),
|
|
7504
|
+
...props,
|
|
7505
|
+
children: [
|
|
7506
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
7507
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium font-sans text-body-sm text-foreground", children: title }),
|
|
7508
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 font-sans text-label text-muted-foreground", children: description })
|
|
7509
|
+
] }),
|
|
7510
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: action })
|
|
7511
|
+
]
|
|
7512
|
+
}
|
|
7513
|
+
)
|
|
7514
|
+
);
|
|
7515
|
+
Action2.displayName = "DangerZone.Action";
|
|
7516
|
+
var DangerZone = Object.assign(Root23, { Action: Action2 });
|
|
7517
|
+
var ConfirmDialog = forwardRef(
|
|
7518
|
+
({
|
|
7519
|
+
open,
|
|
7520
|
+
onOpenChange,
|
|
7521
|
+
title,
|
|
7522
|
+
description,
|
|
7523
|
+
confirmLabel = "Confirm",
|
|
7524
|
+
cancelLabel = "Cancel",
|
|
7525
|
+
intent = "default",
|
|
7526
|
+
confirmationPhrase,
|
|
7527
|
+
onConfirm,
|
|
7528
|
+
loading: externalLoading
|
|
7529
|
+
}, ref) => {
|
|
7530
|
+
const [phraseInput, setPhraseInput] = useState("");
|
|
7531
|
+
const [internalLoading, setInternalLoading] = useState(false);
|
|
7532
|
+
const cancelRef = useRef(null);
|
|
7533
|
+
const phraseRequired = !!confirmationPhrase;
|
|
7534
|
+
const phraseMatched = phraseRequired ? phraseInput === confirmationPhrase : true;
|
|
7535
|
+
const showLoading = externalLoading === true || internalLoading;
|
|
7536
|
+
const canConfirm = phraseMatched && !showLoading;
|
|
7537
|
+
useEffect(() => {
|
|
7538
|
+
if (!open) setPhraseInput("");
|
|
7539
|
+
}, [open]);
|
|
7540
|
+
useEffect(() => {
|
|
7541
|
+
if (open) {
|
|
7542
|
+
const id = window.setTimeout(() => cancelRef.current?.focus(), 0);
|
|
7543
|
+
return () => window.clearTimeout(id);
|
|
7544
|
+
}
|
|
7545
|
+
}, [open]);
|
|
7546
|
+
async function handleConfirm() {
|
|
7547
|
+
if (!canConfirm) return;
|
|
7548
|
+
setInternalLoading(true);
|
|
7549
|
+
try {
|
|
7550
|
+
await onConfirm();
|
|
7551
|
+
onOpenChange(false);
|
|
7552
|
+
} catch {
|
|
7553
|
+
} finally {
|
|
7554
|
+
setInternalLoading(false);
|
|
7555
|
+
}
|
|
7556
|
+
}
|
|
7557
|
+
function handleInputKeyDown(e) {
|
|
7558
|
+
if (e.key === "Enter" && canConfirm) {
|
|
7559
|
+
e.preventDefault();
|
|
7560
|
+
void handleConfirm();
|
|
7561
|
+
}
|
|
7562
|
+
}
|
|
7563
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(Dialog.Content, { ref, children: [
|
|
7564
|
+
/* @__PURE__ */ jsxs(Dialog.Header, { children: [
|
|
7565
|
+
/* @__PURE__ */ jsx(Dialog.Title, { children: title }),
|
|
7566
|
+
/* @__PURE__ */ jsx(Dialog.Description, { children: description })
|
|
7567
|
+
] }),
|
|
7568
|
+
phraseRequired ? /* @__PURE__ */ jsxs(Dialog.Body, { children: [
|
|
7569
|
+
/* @__PURE__ */ jsxs("p", { className: "mb-2 text-body-sm text-muted-foreground", children: [
|
|
7570
|
+
"Type",
|
|
7571
|
+
" ",
|
|
7572
|
+
/* @__PURE__ */ jsx("code", { className: "rounded bg-muted px-1 py-0.5 font-mono text-foreground", children: confirmationPhrase }),
|
|
7573
|
+
" ",
|
|
7574
|
+
"to confirm"
|
|
7575
|
+
] }),
|
|
7576
|
+
/* @__PURE__ */ jsx(
|
|
7577
|
+
Input,
|
|
7578
|
+
{
|
|
7579
|
+
value: phraseInput,
|
|
7580
|
+
onChange: (e) => setPhraseInput(e.target.value),
|
|
7581
|
+
onKeyDown: handleInputKeyDown,
|
|
7582
|
+
autoComplete: "off",
|
|
7583
|
+
"aria-label": "Confirmation phrase"
|
|
7584
|
+
}
|
|
7585
|
+
)
|
|
7586
|
+
] }) : null,
|
|
7587
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
7588
|
+
/* @__PURE__ */ jsx(
|
|
7589
|
+
Button,
|
|
7590
|
+
{
|
|
7591
|
+
ref: cancelRef,
|
|
7592
|
+
variant: "secondary",
|
|
7593
|
+
onClick: () => onOpenChange(false),
|
|
7594
|
+
disabled: showLoading,
|
|
7595
|
+
children: cancelLabel
|
|
7596
|
+
}
|
|
7597
|
+
),
|
|
7598
|
+
/* @__PURE__ */ jsxs(
|
|
7599
|
+
Button,
|
|
7600
|
+
{
|
|
7601
|
+
variant: intent === "destructive" ? "destructive" : "primary",
|
|
7602
|
+
onClick: () => void handleConfirm(),
|
|
7603
|
+
disabled: !canConfirm,
|
|
7604
|
+
"data-confirm": true,
|
|
7605
|
+
children: [
|
|
7606
|
+
showLoading ? /* @__PURE__ */ jsx(Loader2, { "aria-hidden": "true", className: "size-4 animate-spin" }) : null,
|
|
7607
|
+
confirmLabel
|
|
7608
|
+
]
|
|
7609
|
+
}
|
|
7610
|
+
)
|
|
7611
|
+
] })
|
|
7612
|
+
] }) });
|
|
7613
|
+
}
|
|
7614
|
+
);
|
|
7615
|
+
ConfirmDialog.displayName = "ConfirmDialog";
|
|
7616
|
+
var CodeBlock2 = forwardRef(
|
|
7617
|
+
({ className, code, language: _language, terminal, copyable, caption, ...props }, ref) => {
|
|
7618
|
+
const lines = code.split(/\r?\n/);
|
|
7619
|
+
return /* @__PURE__ */ jsxs(
|
|
7620
|
+
"div",
|
|
7621
|
+
{
|
|
7622
|
+
ref,
|
|
7623
|
+
className: cn(
|
|
7624
|
+
"relative rounded-lg border border-border/40 bg-muted/40 font-mono text-body-sm",
|
|
7625
|
+
className
|
|
7626
|
+
),
|
|
7627
|
+
...props,
|
|
7628
|
+
children: [
|
|
7629
|
+
caption !== void 0 ? /* @__PURE__ */ jsx("div", { className: "border-border/40 border-b px-3 py-1.5 font-sans text-label text-muted-foreground", children: caption }) : null,
|
|
7630
|
+
copyable ? /* @__PURE__ */ jsx(CopyButton, { value: code, "aria-label": "Copy code", className: "absolute top-2 right-2" }) : null,
|
|
7631
|
+
/* @__PURE__ */ jsx("pre", { className: "overflow-x-auto p-3 text-foreground", children: terminal ? /* @__PURE__ */ jsx("code", { children: lines.map((line, i) => (
|
|
7632
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: code lines are positional; reorder requires consumer recompute.
|
|
7633
|
+
/* @__PURE__ */ jsxs("span", { className: "block whitespace-pre", children: [
|
|
7634
|
+
/* @__PURE__ */ jsx("span", { className: "select-none text-muted-foreground", children: "$ " }),
|
|
7635
|
+
line
|
|
7636
|
+
] }, i)
|
|
7637
|
+
)) }) : /* @__PURE__ */ jsx("code", { children: code }) })
|
|
7638
|
+
]
|
|
7639
|
+
}
|
|
7640
|
+
);
|
|
7641
|
+
}
|
|
7642
|
+
);
|
|
7643
|
+
CodeBlock2.displayName = "CodeBlock";
|
|
7644
|
+
var INTENT = {
|
|
7645
|
+
info: {
|
|
7646
|
+
icon: Info,
|
|
7647
|
+
border: "border-primary/30",
|
|
7648
|
+
bg: "bg-primary/[0.04]",
|
|
7649
|
+
iconColor: "text-primary"
|
|
7650
|
+
},
|
|
7651
|
+
success: {
|
|
7652
|
+
icon: CheckCircle2,
|
|
7653
|
+
border: "border-success/30",
|
|
7654
|
+
bg: "bg-success/[0.04]",
|
|
7655
|
+
iconColor: "text-success"
|
|
7656
|
+
},
|
|
7657
|
+
warning: {
|
|
7658
|
+
icon: TriangleAlert,
|
|
7659
|
+
border: "border-warning/30",
|
|
7660
|
+
bg: "bg-warning/[0.04]",
|
|
7661
|
+
iconColor: "text-warning"
|
|
7662
|
+
},
|
|
7663
|
+
destructive: {
|
|
7664
|
+
icon: AlertCircle,
|
|
7665
|
+
border: "border-destructive/30",
|
|
7666
|
+
bg: "bg-destructive/[0.04]",
|
|
7667
|
+
iconColor: "text-destructive"
|
|
7668
|
+
}
|
|
7669
|
+
};
|
|
7670
|
+
var Alert = forwardRef(
|
|
7671
|
+
({ className, intent = "info", title, description, action, onDismiss, ...props }, ref) => {
|
|
7672
|
+
const config = INTENT[intent];
|
|
7673
|
+
const Icon2 = config.icon;
|
|
7674
|
+
const hasTitle = title !== void 0 && title !== null;
|
|
7675
|
+
const hasDescription = description !== void 0 && description !== null;
|
|
7676
|
+
const role = intent === "destructive" ? "alert" : "status";
|
|
7677
|
+
return /* @__PURE__ */ jsx(
|
|
7678
|
+
"div",
|
|
7679
|
+
{
|
|
7680
|
+
ref,
|
|
7681
|
+
role,
|
|
7682
|
+
className: cn(
|
|
7683
|
+
"rounded-lg border",
|
|
7684
|
+
config.border,
|
|
7685
|
+
config.bg,
|
|
7686
|
+
hasTitle && hasDescription ? "p-4" : "p-3",
|
|
7687
|
+
className
|
|
7688
|
+
),
|
|
7689
|
+
...props,
|
|
7690
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
7691
|
+
/* @__PURE__ */ jsx(Icon2, { "aria-hidden": "true", className: cn("mt-0.5 size-4 shrink-0", config.iconColor) }),
|
|
7692
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
7693
|
+
hasTitle ? /* @__PURE__ */ jsx("div", { className: "font-medium font-sans text-body-sm text-foreground", children: title }) : null,
|
|
7694
|
+
hasDescription ? /* @__PURE__ */ jsx(
|
|
7695
|
+
"div",
|
|
7696
|
+
{
|
|
7697
|
+
className: cn("font-sans text-body-sm text-muted-foreground", hasTitle && "mt-0.5"),
|
|
7698
|
+
children: description
|
|
7699
|
+
}
|
|
7700
|
+
) : null
|
|
7701
|
+
] }),
|
|
7702
|
+
action !== void 0 ? /* @__PURE__ */ jsx("div", { className: "ml-auto shrink-0", children: action }) : null,
|
|
7703
|
+
onDismiss !== void 0 ? /* @__PURE__ */ jsx(
|
|
7704
|
+
"button",
|
|
7705
|
+
{
|
|
7706
|
+
type: "button",
|
|
7707
|
+
onClick: onDismiss,
|
|
7708
|
+
"aria-label": "Dismiss",
|
|
7709
|
+
className: cn(
|
|
7710
|
+
"shrink-0 rounded p-0.5 text-muted-foreground transition-colors",
|
|
7711
|
+
"hover:text-foreground",
|
|
7712
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
7713
|
+
),
|
|
7714
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-4" })
|
|
7715
|
+
}
|
|
7716
|
+
) : null
|
|
7717
|
+
] })
|
|
7718
|
+
}
|
|
7719
|
+
);
|
|
7720
|
+
}
|
|
7721
|
+
);
|
|
7722
|
+
Alert.displayName = "Alert";
|
|
7723
|
+
function computePageRange(currentPage, totalPages, siblingCount = 1) {
|
|
7724
|
+
if (totalPages <= 1) return [];
|
|
7725
|
+
const totalNumbers = siblingCount * 2 + 3;
|
|
7726
|
+
const totalWithEdges = totalNumbers + 2;
|
|
7727
|
+
if (totalPages <= totalWithEdges) {
|
|
7728
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
7729
|
+
}
|
|
7730
|
+
const leftSibling = Math.max(currentPage - siblingCount, 1);
|
|
7731
|
+
const rightSibling = Math.min(currentPage + siblingCount, totalPages);
|
|
7732
|
+
const showLeftEllipsis = leftSibling > 2;
|
|
7733
|
+
const showRightEllipsis = rightSibling < totalPages - 1;
|
|
7734
|
+
if (!showLeftEllipsis && showRightEllipsis) {
|
|
7735
|
+
const leftRangeEnd = 1 + (siblingCount * 2 + 2);
|
|
7736
|
+
const leftRange = Array.from({ length: leftRangeEnd }, (_, i) => i + 1);
|
|
7737
|
+
return [...leftRange, "ellipsis-end", totalPages];
|
|
7738
|
+
}
|
|
7739
|
+
if (showLeftEllipsis && !showRightEllipsis) {
|
|
7740
|
+
const rightStart = totalPages - (siblingCount * 2 + 2);
|
|
7741
|
+
const rightRange = Array.from(
|
|
7742
|
+
{ length: totalPages - rightStart + 1 },
|
|
7743
|
+
(_, i) => rightStart + i
|
|
7744
|
+
);
|
|
7745
|
+
return [1, "ellipsis-start", ...rightRange];
|
|
7746
|
+
}
|
|
7747
|
+
const middleRange = Array.from(
|
|
7748
|
+
{ length: rightSibling - leftSibling + 1 },
|
|
7749
|
+
(_, i) => leftSibling + i
|
|
7750
|
+
);
|
|
7751
|
+
return [1, "ellipsis-start", ...middleRange, "ellipsis-end", totalPages];
|
|
7752
|
+
}
|
|
7753
|
+
var SIZE3 = {
|
|
7754
|
+
sm: "size-7 text-label",
|
|
7755
|
+
md: "size-8 text-body-sm"
|
|
7756
|
+
};
|
|
7757
|
+
var ICON_SIZE = {
|
|
7758
|
+
sm: "size-3",
|
|
7759
|
+
md: "size-3.5"
|
|
7760
|
+
};
|
|
7761
|
+
var Pagination = forwardRef(
|
|
7762
|
+
({
|
|
7763
|
+
className,
|
|
7764
|
+
currentPage,
|
|
7765
|
+
totalPages,
|
|
7766
|
+
onPageChange,
|
|
7767
|
+
siblingCount = 1,
|
|
7768
|
+
showJumpButtons = true,
|
|
7769
|
+
size = "md",
|
|
7770
|
+
...props
|
|
7771
|
+
}, ref) => {
|
|
7772
|
+
if (totalPages <= 1) {
|
|
7773
|
+
return null;
|
|
7774
|
+
}
|
|
7775
|
+
const range = computePageRange(currentPage, totalPages, siblingCount);
|
|
7776
|
+
const prevDisabled = currentPage <= 1;
|
|
7777
|
+
const nextDisabled = currentPage >= totalPages;
|
|
7778
|
+
const sizeClass = SIZE3[size];
|
|
7779
|
+
const iconClass = ICON_SIZE[size];
|
|
7780
|
+
const buttonBase = cn(
|
|
7781
|
+
"inline-flex items-center justify-center rounded-md font-mono tabular-nums",
|
|
7782
|
+
"transition-colors",
|
|
7783
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
7784
|
+
sizeClass
|
|
7785
|
+
);
|
|
7786
|
+
function go(page) {
|
|
7787
|
+
const clamped = Math.max(1, Math.min(totalPages, page));
|
|
7788
|
+
if (clamped !== currentPage) onPageChange(clamped);
|
|
7789
|
+
}
|
|
7790
|
+
function handleKeyDown(e) {
|
|
7791
|
+
if (e.key === "ArrowLeft") {
|
|
7792
|
+
e.preventDefault();
|
|
7793
|
+
go(currentPage - 1);
|
|
7794
|
+
} else if (e.key === "ArrowRight") {
|
|
7795
|
+
e.preventDefault();
|
|
7796
|
+
go(currentPage + 1);
|
|
7797
|
+
} else if (e.key === "Home") {
|
|
7798
|
+
e.preventDefault();
|
|
7799
|
+
go(1);
|
|
7800
|
+
} else if (e.key === "End") {
|
|
7801
|
+
e.preventDefault();
|
|
7802
|
+
go(totalPages);
|
|
7803
|
+
}
|
|
7804
|
+
}
|
|
7805
|
+
return /* @__PURE__ */ jsxs(
|
|
7806
|
+
"nav",
|
|
7807
|
+
{
|
|
7808
|
+
ref,
|
|
7809
|
+
"aria-label": "Pagination",
|
|
7810
|
+
onKeyDown: handleKeyDown,
|
|
7811
|
+
className: cn("flex items-center gap-1", className),
|
|
7812
|
+
...props,
|
|
7813
|
+
children: [
|
|
7814
|
+
showJumpButtons ? /* @__PURE__ */ jsx(
|
|
7815
|
+
"button",
|
|
7816
|
+
{
|
|
7817
|
+
type: "button",
|
|
7818
|
+
onClick: () => go(1),
|
|
7819
|
+
disabled: prevDisabled,
|
|
7820
|
+
"aria-label": "Go to first page",
|
|
7821
|
+
"aria-disabled": prevDisabled || void 0,
|
|
7822
|
+
className: cn(
|
|
7823
|
+
buttonBase,
|
|
7824
|
+
"text-foreground hover:bg-muted",
|
|
7825
|
+
prevDisabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
7826
|
+
),
|
|
7827
|
+
children: /* @__PURE__ */ jsx(ChevronsLeft, { "aria-hidden": "true", className: iconClass })
|
|
7828
|
+
}
|
|
7829
|
+
) : null,
|
|
7830
|
+
/* @__PURE__ */ jsx(
|
|
7831
|
+
"button",
|
|
7832
|
+
{
|
|
7833
|
+
type: "button",
|
|
7834
|
+
onClick: () => go(currentPage - 1),
|
|
7835
|
+
disabled: prevDisabled,
|
|
7836
|
+
"aria-label": "Go to previous page",
|
|
7837
|
+
"aria-disabled": prevDisabled || void 0,
|
|
7838
|
+
className: cn(
|
|
7839
|
+
buttonBase,
|
|
7840
|
+
"text-foreground hover:bg-muted",
|
|
7841
|
+
prevDisabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
7842
|
+
),
|
|
7843
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: iconClass })
|
|
7844
|
+
}
|
|
7845
|
+
),
|
|
7846
|
+
range.map((item) => {
|
|
7847
|
+
if (item === "ellipsis-start" || item === "ellipsis-end") {
|
|
7848
|
+
return /* @__PURE__ */ jsx(
|
|
7849
|
+
"span",
|
|
7850
|
+
{
|
|
7851
|
+
"aria-hidden": "true",
|
|
7852
|
+
className: cn(
|
|
7853
|
+
"inline-flex items-center justify-center text-muted-foreground",
|
|
7854
|
+
sizeClass
|
|
7855
|
+
),
|
|
7856
|
+
children: "\u2026"
|
|
7857
|
+
},
|
|
7858
|
+
item
|
|
7859
|
+
);
|
|
7860
|
+
}
|
|
7861
|
+
const isActive = item === currentPage;
|
|
7862
|
+
return /* @__PURE__ */ jsx(
|
|
7863
|
+
"button",
|
|
7864
|
+
{
|
|
7865
|
+
type: "button",
|
|
7866
|
+
onClick: () => go(item),
|
|
7867
|
+
"aria-label": `Go to page ${item}`,
|
|
7868
|
+
"aria-current": isActive ? "page" : void 0,
|
|
7869
|
+
className: cn(
|
|
7870
|
+
buttonBase,
|
|
7871
|
+
isActive ? "bg-primary text-primary-foreground hover:bg-primary" : "text-foreground hover:bg-muted"
|
|
7872
|
+
),
|
|
7873
|
+
children: item
|
|
7874
|
+
},
|
|
7875
|
+
item
|
|
7876
|
+
);
|
|
7877
|
+
}),
|
|
7878
|
+
/* @__PURE__ */ jsx(
|
|
7879
|
+
"button",
|
|
7880
|
+
{
|
|
7881
|
+
type: "button",
|
|
7882
|
+
onClick: () => go(currentPage + 1),
|
|
7883
|
+
disabled: nextDisabled,
|
|
7884
|
+
"aria-label": "Go to next page",
|
|
7885
|
+
"aria-disabled": nextDisabled || void 0,
|
|
7886
|
+
className: cn(
|
|
7887
|
+
buttonBase,
|
|
7888
|
+
"text-foreground hover:bg-muted",
|
|
7889
|
+
nextDisabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
7890
|
+
),
|
|
7891
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: iconClass })
|
|
7892
|
+
}
|
|
7893
|
+
),
|
|
7894
|
+
showJumpButtons ? /* @__PURE__ */ jsx(
|
|
7895
|
+
"button",
|
|
7896
|
+
{
|
|
7897
|
+
type: "button",
|
|
7898
|
+
onClick: () => go(totalPages),
|
|
7899
|
+
disabled: nextDisabled,
|
|
7900
|
+
"aria-label": "Go to last page",
|
|
7901
|
+
"aria-disabled": nextDisabled || void 0,
|
|
7902
|
+
className: cn(
|
|
7903
|
+
buttonBase,
|
|
7904
|
+
"text-foreground hover:bg-muted",
|
|
7905
|
+
nextDisabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
7906
|
+
),
|
|
7907
|
+
children: /* @__PURE__ */ jsx(ChevronsRight, { "aria-hidden": "true", className: iconClass })
|
|
7908
|
+
}
|
|
7909
|
+
) : null
|
|
7910
|
+
]
|
|
7911
|
+
}
|
|
7912
|
+
);
|
|
7913
|
+
}
|
|
7914
|
+
);
|
|
7915
|
+
Pagination.displayName = "Pagination";
|
|
7000
7916
|
var statusIcon2 = {
|
|
7001
7917
|
pending: CircleDashed,
|
|
7002
7918
|
running: Loader2,
|
|
@@ -9307,7 +10223,7 @@ var EnvVarEditor = forwardRef(
|
|
|
9307
10223
|
}
|
|
9308
10224
|
) : null,
|
|
9309
10225
|
/* @__PURE__ */ jsxs("ul", { className: "divide-y divide-border/30", children: [
|
|
9310
|
-
vars.map((v) => /* @__PURE__ */ jsx(
|
|
10226
|
+
vars.map((v) => /* @__PURE__ */ jsx(Row2, { entry: v, ...onRemove ? { onRemove } : {} }, v.id)),
|
|
9311
10227
|
vars.length === 0 ? /* @__PURE__ */ jsx("li", { className: "py-8 text-center text-body-sm text-muted-foreground", children: "No environment variables yet." }) : null
|
|
9312
10228
|
] })
|
|
9313
10229
|
]
|
|
@@ -9316,7 +10232,7 @@ var EnvVarEditor = forwardRef(
|
|
|
9316
10232
|
}
|
|
9317
10233
|
);
|
|
9318
10234
|
EnvVarEditor.displayName = "EnvVarEditor";
|
|
9319
|
-
function
|
|
10235
|
+
function Row2({ entry, onRemove }) {
|
|
9320
10236
|
const [revealed, setRevealed] = useState(!entry.masked);
|
|
9321
10237
|
const value = revealed ? entry.value : "\u2022".repeat(Math.min(entry.value.length, 12) || 8);
|
|
9322
10238
|
const copy = () => {
|
|
@@ -9767,6 +10683,6 @@ function CommandPalette({
|
|
|
9767
10683
|
] }) });
|
|
9768
10684
|
}
|
|
9769
10685
|
|
|
9770
|
-
export { ALL_MODES, AccountMenu, AgentComposer, AgentEditor, AgentErrorCard, AgentEvent, AgentHandoff, AgentProfile, AgentStartingState, AgentStream, AgentStreaming, AgentTimeline, ApprovalCard, ArtifactPreview, AttachmentChip, AuditLogEntry, AutoCompactNotice, Avatar, BadgeWithDot as Badge, BrowserControls, BuildLogStream, Button, CapabilityIndicator, Card, ChatComposer, ChatMessage, ChatMessageAction, ChatMessageActions, ChatMessageBranch, ChatMessageBranchContent, ChatMessageBranchNext, ChatMessageBranchPage, ChatMessageBranchPrevious, ChatMessageBranchSelector, ChatMessageContent, ChatMessageResponse, ChatMessageRoot, ChatMessageToolbar, ChatThread, Checkbox, CommandPalette, ContextCard, ContextWindowBar, CostMeter, CreatedFilesCard, CronJobCard, CronJobsList, DataPart, DeploymentRow, Dialog, DiffViewer, DomainConfig, EmptyState, EnvVarEditor, FilePart, FolderContextCard, FolderSelector, FormField, HOOK_EVENTS, HookConfig, HookEventLog, Input, IntentSelector, Label, LaneBoard, LoginSplit, MCPServerCard, MCPServerList, MODE_LABEL, MemoryEditor, MentionMenu, MetricsPanel, ModelCard, ModelSelector, PermissionMatrix, PermissionModal, PlanBadge, PreviewEnvCard, PreviewPanel, Progress, ProgressChecklist, ProjectCard, ProjectSwitcher, QuickActionChips, RadioGroup, ReasoningPart, RecentFoldersList, RollbackUI, RuleCard, RuleEditor, RunStats, RunningTasksPanel, ScrollArea, Select, SessionListItem, SessionTimeline, Sheet, Sidebar, Skeleton, SkillCard, SkillEditor, SkillsList, SocialAuthRow, SourceDocumentPart, SourceUrlPart, StepsRail, SubAgentDispatch, Switch, SystemPromptEditor, Tabs, TaskHeader, TaskNode, TaskPlan, TerminalPanel, TextPart, Textarea, ThemeProvider, ThemeScript, ThemeSwitcher, TheoUIProvider, Toast, Toaster, TokenUsageChart, ToolCall, ToolCallCard, ToolCallPart, ToolResult, ToolsList, TooltipWithStatics as Tooltip, TopNav, UsageMeter, anthropicStyle, auroraTerminal, avatarVariants, badgeVariants, builtinThemes, buttonVariants, capabilityPresets, classicPaper, cn, defineTheme, dracula, githubDark, hex, isCustomContentUIPart, isDataUIPart, isFileUIPart, isReasoningFileUIPart, isReasoningUIPart, isSourceDocumentUIPart, isSourceUrlUIPart, isStepStartUIPart, isTextUIPart, isToolUIPart, linearGlass, modelCapabilityPresets, oneDark, openaiStyle, renderPart, rgb, sheetVariants, useDensity, useTheme, useToast, vercelMono, violetForge };
|
|
10686
|
+
export { ALL_MODES, AccountMenu, AgentComposer, AgentEditor, AgentErrorCard, AgentEvent, AgentHandoff, AgentProfile, AgentStartingState, AgentStream, AgentStreaming, AgentTimeline, Alert, ApprovalCard, ArtifactPreview, AttachmentChip, AuditLogEntry, AutoCompactNotice, Avatar, BadgeWithDot as Badge, BrowserControls, BuildLogStream, Button, CapabilityIndicator, Card, ChatComposer, ChatMessage, ChatMessageAction, ChatMessageActions, ChatMessageBranch, ChatMessageBranchContent, ChatMessageBranchNext, ChatMessageBranchPage, ChatMessageBranchPrevious, ChatMessageBranchSelector, ChatMessageContent, ChatMessageResponse, ChatMessageRoot, ChatMessageToolbar, ChatThread, Checkbox, CodeBlock2 as CodeBlock, CommandPalette, ConfirmDialog, ContextCard, ContextWindowBar, CopyButton, CostMeter, CreatedFilesCard, CronJobCard, CronJobsList, DangerZone, DataPart, DeploymentRow, Dialog, DiffViewer, DomainConfig, EmptyState, EnvVarEditor, FilePart, FolderContextCard, FolderSelector, FormField, HOOK_EVENTS, HookConfig, HookEventLog, Input, IntentSelector, Label, LaneBoard, LoginSplit, MCPServerCard, MCPServerList, MODE_LABEL, MemoryEditor, MentionMenu, MetricsPanel, ModelCard, ModelSelector, Pagination, PermissionMatrix, PermissionModal, PlanBadge, PreviewEnvCard, PreviewPanel, Progress, ProgressChecklist, ProjectCard, ProjectSwitcher, QuickActionChips, RadioGroup, ReasoningPart, RecentFoldersList, RollbackUI, RuleCard, RuleEditor, RunStats, RunningTasksPanel, ScrollArea, Select, SessionListItem, SessionTimeline, Sheet, Sidebar, Skeleton, SkillCard, SkillEditor, SkillsList, SocialAuthRow, SourceDocumentPart, SourceUrlPart, StatTile, StatusDot, StepsRail, SubAgentDispatch, Switch, SystemPromptEditor, Table, Tabs, TaskHeader, TaskNode, TaskPlan, TerminalPanel, TextPart, Textarea, ThemeProvider, ThemeScript, ThemeSwitcher, TheoUIProvider, Timestamp, Toast, Toaster, TokenUsageChart, ToolCall, ToolCallCard, ToolCallPart, ToolResult, ToolsList, TooltipWithStatics as Tooltip, TopNav, UsageMeter, anthropicStyle, auroraTerminal, avatarVariants, badgeVariants, builtinThemes, buttonVariants, capabilityPresets, classicPaper, cn, computePageRange, defineTheme, dracula, githubDark, hex, isCustomContentUIPart, isDataUIPart, isFileUIPart, isReasoningFileUIPart, isReasoningUIPart, isSourceDocumentUIPart, isSourceUrlUIPart, isStepStartUIPart, isTextUIPart, isToolUIPart, linearGlass, modelCapabilityPresets, oneDark, openaiStyle, renderPart, rgb, sheetVariants, useDensity, useTheme, useToast, vercelMono, violetForge };
|
|
9771
10687
|
//# sourceMappingURL=index.js.map
|
|
9772
10688
|
//# sourceMappingURL=index.js.map
|