@usetheo/ui 0.6.3-next.0 → 0.8.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 +200 -0
- package/README.md +18 -17
- package/dist/components.css +1 -1
- package/dist/index.d.ts +454 -8
- package/dist/index.js +898 -9
- package/dist/index.js.map +1 -1
- package/package.json +98 -48
- package/registry/index.json +72 -0
- package/registry/r/account-menu.json +24 -0
- package/registry/r/button.json +1 -1
- 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/plan-badge.json +20 -0
- package/registry/r/progress.json +20 -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/theme-provider.json +1 -1
- package/registry/r/theme-script.json +1 -1
- package/registry/r/timestamp.json +20 -0
- package/registry/r/usage-meter.json +21 -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, Cloud, RefreshCw, Maximize2, ArrowLeft, RotateCw, Search, Paperclip, Mic, Send, GitCommit, Activity, EyeOff, GitPullRequest, ExternalLink, ShieldX, ArrowDownLeft, TriangleAlert, Info, 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: jsx129, jsxs: jsxs104 } = 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: jsx129,
|
|
5554
|
+
jsxs: jsxs104,
|
|
5555
5555
|
components
|
|
5556
5556
|
});
|
|
5557
5557
|
}
|
|
@@ -6752,6 +6752,895 @@ var ToolResult = forwardRef(
|
|
|
6752
6752
|
}
|
|
6753
6753
|
);
|
|
6754
6754
|
ToolResult.displayName = "ToolResult";
|
|
6755
|
+
var INTENT_FILL = {
|
|
6756
|
+
default: "bg-primary",
|
|
6757
|
+
success: "bg-success",
|
|
6758
|
+
warning: "bg-warning",
|
|
6759
|
+
destructive: "bg-destructive"
|
|
6760
|
+
};
|
|
6761
|
+
var Progress = forwardRef(
|
|
6762
|
+
({
|
|
6763
|
+
className,
|
|
6764
|
+
value = 0,
|
|
6765
|
+
max = 100,
|
|
6766
|
+
intent = "default",
|
|
6767
|
+
height = "h-1",
|
|
6768
|
+
indeterminate = false,
|
|
6769
|
+
...props
|
|
6770
|
+
}, ref) => {
|
|
6771
|
+
const clampedMax = Math.max(0, max);
|
|
6772
|
+
const clampedValue = Math.min(clampedMax, Math.max(0, value));
|
|
6773
|
+
const percent = clampedMax > 0 ? clampedValue / clampedMax * 100 : 0;
|
|
6774
|
+
const fillClass = INTENT_FILL[intent];
|
|
6775
|
+
return (
|
|
6776
|
+
// biome-ignore lint/a11y/useFocusableInteractive: WAI-ARIA `progressbar` is a status role (https://www.w3.org/TR/wai-aria-1.2/#progressbar) — NOT supposed to be focusable; screen readers announce updates without keyboard navigation.
|
|
6777
|
+
/* @__PURE__ */ jsx(
|
|
6778
|
+
"div",
|
|
6779
|
+
{
|
|
6780
|
+
ref,
|
|
6781
|
+
role: "progressbar",
|
|
6782
|
+
"aria-valuemin": 0,
|
|
6783
|
+
"aria-valuemax": clampedMax,
|
|
6784
|
+
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
6785
|
+
"aria-busy": indeterminate ? true : void 0,
|
|
6786
|
+
className: cn("relative w-full overflow-hidden rounded-full bg-muted", height, className),
|
|
6787
|
+
...props,
|
|
6788
|
+
children: indeterminate ? /* @__PURE__ */ jsx(
|
|
6789
|
+
"div",
|
|
6790
|
+
{
|
|
6791
|
+
className: cn(
|
|
6792
|
+
"absolute inset-y-0 left-0 w-1/3 rounded-full",
|
|
6793
|
+
"animate-[progress-indeterminate_1.4s_ease-in-out_infinite] motion-reduce:animate-none",
|
|
6794
|
+
"motion-reduce:w-full motion-reduce:opacity-50",
|
|
6795
|
+
fillClass
|
|
6796
|
+
)
|
|
6797
|
+
}
|
|
6798
|
+
) : /* @__PURE__ */ jsx(
|
|
6799
|
+
"div",
|
|
6800
|
+
{
|
|
6801
|
+
className: cn(
|
|
6802
|
+
"h-full rounded-full transition-[width] duration-base ease-out-soft",
|
|
6803
|
+
"motion-reduce:transition-none",
|
|
6804
|
+
fillClass
|
|
6805
|
+
),
|
|
6806
|
+
style: { width: `${percent}%` }
|
|
6807
|
+
}
|
|
6808
|
+
)
|
|
6809
|
+
}
|
|
6810
|
+
)
|
|
6811
|
+
);
|
|
6812
|
+
}
|
|
6813
|
+
);
|
|
6814
|
+
Progress.displayName = "Progress";
|
|
6815
|
+
var TIER_CLASS = {
|
|
6816
|
+
free: "bg-muted/40 border-muted-foreground/20 text-muted-foreground",
|
|
6817
|
+
hobby: "bg-warning/10 border-warning/30 text-warning",
|
|
6818
|
+
pro: "bg-primary/10 border-primary/30 text-primary",
|
|
6819
|
+
team: "bg-success/10 border-success/30 text-success",
|
|
6820
|
+
enterprise: "bg-foreground/5 border-foreground/20 text-foreground"
|
|
6821
|
+
};
|
|
6822
|
+
var SIZE_CLASS = {
|
|
6823
|
+
sm: "px-1.5 py-0 text-label-caps",
|
|
6824
|
+
md: "px-2 py-0.5 text-label"
|
|
6825
|
+
};
|
|
6826
|
+
function defaultLabel2(plan) {
|
|
6827
|
+
return plan.charAt(0).toUpperCase() + plan.slice(1);
|
|
6828
|
+
}
|
|
6829
|
+
var PlanBadge = forwardRef(
|
|
6830
|
+
({ className, plan, label, size = "md", ...props }, ref) => {
|
|
6831
|
+
const tierClass = TIER_CLASS[plan] ?? TIER_CLASS.free;
|
|
6832
|
+
const displayLabel = label ?? defaultLabel2(plan);
|
|
6833
|
+
return /* @__PURE__ */ jsx(
|
|
6834
|
+
"span",
|
|
6835
|
+
{
|
|
6836
|
+
ref,
|
|
6837
|
+
className: cn(
|
|
6838
|
+
"inline-flex items-center rounded-md border",
|
|
6839
|
+
"font-mono uppercase tabular-nums tracking-wider",
|
|
6840
|
+
tierClass,
|
|
6841
|
+
SIZE_CLASS[size],
|
|
6842
|
+
className
|
|
6843
|
+
),
|
|
6844
|
+
"data-plan": plan,
|
|
6845
|
+
...props,
|
|
6846
|
+
children: displayLabel
|
|
6847
|
+
}
|
|
6848
|
+
);
|
|
6849
|
+
}
|
|
6850
|
+
);
|
|
6851
|
+
PlanBadge.displayName = "PlanBadge";
|
|
6852
|
+
function defaultFormat(value, max, unit) {
|
|
6853
|
+
return `${value} / ${max}${unit ? ` ${unit}` : ""}`;
|
|
6854
|
+
}
|
|
6855
|
+
function metricAriaLabel(metric, formatted) {
|
|
6856
|
+
const label = typeof metric.label === "string" ? metric.label : "metric";
|
|
6857
|
+
return `${label}: ${formatted}`;
|
|
6858
|
+
}
|
|
6859
|
+
var UsageMeter = forwardRef(
|
|
6860
|
+
({ className, title, action, metrics, compact = false, ...props }, ref) => {
|
|
6861
|
+
const hasHeader = Boolean(title) || Boolean(action);
|
|
6862
|
+
return /* @__PURE__ */ jsxs(
|
|
6863
|
+
"div",
|
|
6864
|
+
{
|
|
6865
|
+
ref,
|
|
6866
|
+
className: cn(
|
|
6867
|
+
"grid gap-3 rounded-xl border border-border bg-card p-4",
|
|
6868
|
+
compact && "gap-2",
|
|
6869
|
+
className
|
|
6870
|
+
),
|
|
6871
|
+
"data-theo-usage-meter": "",
|
|
6872
|
+
...props,
|
|
6873
|
+
children: [
|
|
6874
|
+
hasHeader ? /* @__PURE__ */ jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [
|
|
6875
|
+
title ? /* @__PURE__ */ jsx(
|
|
6876
|
+
"span",
|
|
6877
|
+
{
|
|
6878
|
+
className: cn(
|
|
6879
|
+
"font-mono text-label-caps text-muted-foreground uppercase tracking-wider"
|
|
6880
|
+
),
|
|
6881
|
+
children: title
|
|
6882
|
+
}
|
|
6883
|
+
) : /* @__PURE__ */ jsx("span", {}),
|
|
6884
|
+
action ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action }) : null
|
|
6885
|
+
] }) : null,
|
|
6886
|
+
metrics.map((metric, idx) => {
|
|
6887
|
+
const overQuota = metric.value > metric.max;
|
|
6888
|
+
const fmt = metric.formatter ?? defaultFormat;
|
|
6889
|
+
const formatted = fmt(metric.value, metric.max, metric.unit);
|
|
6890
|
+
const intent = overQuota ? "warning" : "default";
|
|
6891
|
+
const key = `${typeof metric.label === "string" ? metric.label : "metric"}-${idx}`;
|
|
6892
|
+
if (compact) {
|
|
6893
|
+
return /* @__PURE__ */ jsx(
|
|
6894
|
+
Progress,
|
|
6895
|
+
{
|
|
6896
|
+
value: metric.value,
|
|
6897
|
+
max: metric.max,
|
|
6898
|
+
intent,
|
|
6899
|
+
"aria-label": metricAriaLabel(metric, formatted)
|
|
6900
|
+
},
|
|
6901
|
+
key
|
|
6902
|
+
);
|
|
6903
|
+
}
|
|
6904
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
6905
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-3 text-body-sm", children: [
|
|
6906
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-muted-foreground", children: metric.label }),
|
|
6907
|
+
/* @__PURE__ */ jsx(
|
|
6908
|
+
"span",
|
|
6909
|
+
{
|
|
6910
|
+
className: cn(
|
|
6911
|
+
"shrink-0 font-mono tabular-nums",
|
|
6912
|
+
overQuota ? "text-warning" : "text-foreground"
|
|
6913
|
+
),
|
|
6914
|
+
children: formatted
|
|
6915
|
+
}
|
|
6916
|
+
)
|
|
6917
|
+
] }),
|
|
6918
|
+
/* @__PURE__ */ jsx(
|
|
6919
|
+
Progress,
|
|
6920
|
+
{
|
|
6921
|
+
value: metric.value,
|
|
6922
|
+
max: metric.max,
|
|
6923
|
+
intent,
|
|
6924
|
+
"aria-label": metricAriaLabel(metric, formatted)
|
|
6925
|
+
}
|
|
6926
|
+
)
|
|
6927
|
+
] }, key);
|
|
6928
|
+
})
|
|
6929
|
+
]
|
|
6930
|
+
}
|
|
6931
|
+
);
|
|
6932
|
+
}
|
|
6933
|
+
);
|
|
6934
|
+
UsageMeter.displayName = "UsageMeter";
|
|
6935
|
+
var URL_RE = /^(?:https?:\/\/|\/)/;
|
|
6936
|
+
function deriveInitials(name, avatar) {
|
|
6937
|
+
if (avatar && !URL_RE.test(avatar) && avatar.length <= 2) {
|
|
6938
|
+
return avatar.toUpperCase();
|
|
6939
|
+
}
|
|
6940
|
+
if (typeof name === "string" && name.length > 0) {
|
|
6941
|
+
return name.charAt(0).toUpperCase();
|
|
6942
|
+
}
|
|
6943
|
+
return "?";
|
|
6944
|
+
}
|
|
6945
|
+
var AccountMenu = forwardRef(
|
|
6946
|
+
({ className, name, avatar, plan, secondary, onClick, ...props }, ref) => {
|
|
6947
|
+
const interactive = typeof onClick === "function";
|
|
6948
|
+
const initials = deriveInitials(name, avatar);
|
|
6949
|
+
const isUrlAvatar = avatar !== void 0 && URL_RE.test(avatar);
|
|
6950
|
+
const altText = typeof name === "string" ? name : "account";
|
|
6951
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6952
|
+
/* @__PURE__ */ jsxs(Avatar, { size: "sm", children: [
|
|
6953
|
+
isUrlAvatar ? /* @__PURE__ */ jsx(Avatar.Image, { src: avatar, alt: altText }) : null,
|
|
6954
|
+
/* @__PURE__ */ jsx(Avatar.Fallback, { delayMs: 0, children: initials })
|
|
6955
|
+
] }),
|
|
6956
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
6957
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
6958
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium text-body-sm text-foreground", children: name }),
|
|
6959
|
+
plan ? /* @__PURE__ */ jsx(PlanBadge, { plan, size: "sm" }) : null
|
|
6960
|
+
] }),
|
|
6961
|
+
secondary ? /* @__PURE__ */ jsx("span", { className: "truncate text-label text-muted-foreground", children: secondary }) : null
|
|
6962
|
+
] }),
|
|
6963
|
+
interactive ? /* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-3 shrink-0 text-muted-foreground", "aria-hidden": "true" }) : null
|
|
6964
|
+
] });
|
|
6965
|
+
const baseClass = cn(
|
|
6966
|
+
"flex w-full items-center gap-3 px-3 py-2",
|
|
6967
|
+
interactive && cn(
|
|
6968
|
+
"rounded-md text-left transition-colors",
|
|
6969
|
+
"hover:bg-muted/40",
|
|
6970
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card"
|
|
6971
|
+
),
|
|
6972
|
+
className
|
|
6973
|
+
);
|
|
6974
|
+
if (interactive) {
|
|
6975
|
+
const { ...buttonProps } = props;
|
|
6976
|
+
return /* @__PURE__ */ jsx(
|
|
6977
|
+
"button",
|
|
6978
|
+
{
|
|
6979
|
+
ref,
|
|
6980
|
+
type: "button",
|
|
6981
|
+
className: baseClass,
|
|
6982
|
+
onClick,
|
|
6983
|
+
...buttonProps,
|
|
6984
|
+
children: content
|
|
6985
|
+
}
|
|
6986
|
+
);
|
|
6987
|
+
}
|
|
6988
|
+
return /* @__PURE__ */ jsx(
|
|
6989
|
+
"div",
|
|
6990
|
+
{
|
|
6991
|
+
ref,
|
|
6992
|
+
className: baseClass,
|
|
6993
|
+
...props,
|
|
6994
|
+
children: content
|
|
6995
|
+
}
|
|
6996
|
+
);
|
|
6997
|
+
}
|
|
6998
|
+
);
|
|
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";
|
|
6755
7644
|
var statusIcon2 = {
|
|
6756
7645
|
pending: CircleDashed,
|
|
6757
7646
|
running: Loader2,
|
|
@@ -9062,7 +9951,7 @@ var EnvVarEditor = forwardRef(
|
|
|
9062
9951
|
}
|
|
9063
9952
|
) : null,
|
|
9064
9953
|
/* @__PURE__ */ jsxs("ul", { className: "divide-y divide-border/30", children: [
|
|
9065
|
-
vars.map((v) => /* @__PURE__ */ jsx(
|
|
9954
|
+
vars.map((v) => /* @__PURE__ */ jsx(Row2, { entry: v, ...onRemove ? { onRemove } : {} }, v.id)),
|
|
9066
9955
|
vars.length === 0 ? /* @__PURE__ */ jsx("li", { className: "py-8 text-center text-body-sm text-muted-foreground", children: "No environment variables yet." }) : null
|
|
9067
9956
|
] })
|
|
9068
9957
|
]
|
|
@@ -9071,7 +9960,7 @@ var EnvVarEditor = forwardRef(
|
|
|
9071
9960
|
}
|
|
9072
9961
|
);
|
|
9073
9962
|
EnvVarEditor.displayName = "EnvVarEditor";
|
|
9074
|
-
function
|
|
9963
|
+
function Row2({ entry, onRemove }) {
|
|
9075
9964
|
const [revealed, setRevealed] = useState(!entry.masked);
|
|
9076
9965
|
const value = revealed ? entry.value : "\u2022".repeat(Math.min(entry.value.length, 12) || 8);
|
|
9077
9966
|
const copy = () => {
|
|
@@ -9522,6 +10411,6 @@ function CommandPalette({
|
|
|
9522
10411
|
] }) });
|
|
9523
10412
|
}
|
|
9524
10413
|
|
|
9525
|
-
export { ALL_MODES, 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, PreviewEnvCard, PreviewPanel, 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, 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 };
|
|
10414
|
+
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, 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, 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, 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 };
|
|
9526
10415
|
//# sourceMappingURL=index.js.map
|
|
9527
10416
|
//# sourceMappingURL=index.js.map
|