@mcp-b/react-components 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-QCM8ZKgR.d.ts +98 -0
- package/dist/CodeBlock-CttHhWcb.js +356 -0
- package/dist/CodeBlock-V6pgafSS.d.ts +174 -0
- package/dist/Select-CRsKCJ9x.d.ts +200 -0
- package/dist/class-names-9UtZwb0J.js +12 -0
- package/dist/components/Accordion.d.ts +81 -0
- package/dist/components/Accordion.js +97 -0
- package/dist/components/AgentConnection.d.ts +69 -0
- package/dist/components/AgentConnection.js +176 -0
- package/dist/components/AlertDialog.d.ts +148 -0
- package/dist/components/AlertDialog.js +141 -0
- package/dist/components/Artifact.d.ts +128 -0
- package/dist/components/Artifact.js +115 -0
- package/dist/components/Autocomplete.d.ts +186 -0
- package/dist/components/Autocomplete.js +186 -0
- package/dist/components/Avatar.d.ts +134 -0
- package/dist/components/Avatar.js +118 -0
- package/dist/components/Badge.d.ts +68 -0
- package/dist/components/Badge.js +108 -0
- package/dist/components/Button.d.ts +2 -0
- package/dist/components/Button.js +73 -0
- package/dist/components/Card.d.ts +87 -0
- package/dist/components/Card.js +81 -0
- package/dist/components/ChainOfThought.d.ts +153 -0
- package/dist/components/ChainOfThought.js +157 -0
- package/dist/components/Checkbox.d.ts +35 -0
- package/dist/components/Checkbox.js +47 -0
- package/dist/components/CheckboxGroup.d.ts +76 -0
- package/dist/components/CheckboxGroup.js +69 -0
- package/dist/components/CodeBlock.d.ts +2 -0
- package/dist/components/CodeBlock.js +2 -0
- package/dist/components/Collapsible.d.ts +127 -0
- package/dist/components/Collapsible.js +103 -0
- package/dist/components/Combobox.d.ts +177 -0
- package/dist/components/Combobox.js +179 -0
- package/dist/components/Commit.d.ts +265 -0
- package/dist/components/Commit.js +282 -0
- package/dist/components/Context.d.ts +129 -0
- package/dist/components/Context.js +309 -0
- package/dist/components/ContextMenu.d.ts +282 -0
- package/dist/components/ContextMenu.js +270 -0
- package/dist/components/Conversation.d.ts +166 -0
- package/dist/components/Conversation.js +202 -0
- package/dist/components/Dialog.d.ts +120 -0
- package/dist/components/Dialog.js +114 -0
- package/dist/components/EnvironmentVariables.d.ts +176 -0
- package/dist/components/EnvironmentVariables.js +221 -0
- package/dist/components/Field.d.ts +281 -0
- package/dist/components/Field.js +274 -0
- package/dist/components/Fieldset.d.ts +93 -0
- package/dist/components/Fieldset.js +81 -0
- package/dist/components/FileTree.d.ts +116 -0
- package/dist/components/FileTree.js +310 -0
- package/dist/components/Form.d.ts +94 -0
- package/dist/components/Form.js +88 -0
- package/dist/components/GithubMotionMark.d.ts +13 -0
- package/dist/components/GithubMotionMark.js +23 -0
- package/dist/components/Input.d.ts +33 -0
- package/dist/components/Input.js +27 -0
- package/dist/components/Label.d.ts +44 -0
- package/dist/components/Label.js +41 -0
- package/dist/components/Menu.d.ts +395 -0
- package/dist/components/Menu.js +338 -0
- package/dist/components/Menubar.d.ts +331 -0
- package/dist/components/Menubar.js +299 -0
- package/dist/components/Message.d.ts +216 -0
- package/dist/components/Message.js +245 -0
- package/dist/components/Meter.d.ts +151 -0
- package/dist/components/Meter.js +121 -0
- package/dist/components/ModelSelector.d.ts +198 -0
- package/dist/components/ModelSelector.js +306 -0
- package/dist/components/NaniteScene.d.ts +33 -0
- package/dist/components/NaniteScene.js +405 -0
- package/dist/components/NavigationMenu.d.ts +256 -0
- package/dist/components/NavigationMenu.js +228 -0
- package/dist/components/NumberField.d.ts +159 -0
- package/dist/components/NumberField.js +123 -0
- package/dist/components/Popover.d.ts +278 -0
- package/dist/components/Popover.js +245 -0
- package/dist/components/PreviewCard.d.ts +156 -0
- package/dist/components/PreviewCard.js +156 -0
- package/dist/components/PricingPage.d.ts +209 -0
- package/dist/components/PricingPage.js +506 -0
- package/dist/components/Progress.d.ts +58 -0
- package/dist/components/Progress.js +51 -0
- package/dist/components/PromptInput.d.ts +399 -0
- package/dist/components/PromptInput.js +737 -0
- package/dist/components/Queue.d.ts +241 -0
- package/dist/components/Queue.js +225 -0
- package/dist/components/RadioGroup.d.ts +78 -0
- package/dist/components/RadioGroup.js +72 -0
- package/dist/components/Reasoning.d.ts +88 -0
- package/dist/components/Reasoning.js +187 -0
- package/dist/components/ScrollArea.d.ts +160 -0
- package/dist/components/ScrollArea.js +145 -0
- package/dist/components/Select.d.ts +2 -0
- package/dist/components/Select.js +260 -0
- package/dist/components/Separator.d.ts +45 -0
- package/dist/components/Separator.js +40 -0
- package/dist/components/Shell.d.ts +163 -0
- package/dist/components/Shell.js +137 -0
- package/dist/components/Slider.d.ts +120 -0
- package/dist/components/Slider.js +115 -0
- package/dist/components/Sources.d.ts +91 -0
- package/dist/components/Sources.js +121 -0
- package/dist/components/Stepper.d.ts +190 -0
- package/dist/components/Stepper.js +315 -0
- package/dist/components/Switch.d.ts +57 -0
- package/dist/components/Switch.js +55 -0
- package/dist/components/Tabs.d.ts +84 -0
- package/dist/components/Tabs.js +78 -0
- package/dist/components/Task.d.ts +100 -0
- package/dist/components/Task.js +120 -0
- package/dist/components/Terminal.d.ts +118 -0
- package/dist/components/Terminal.js +234 -0
- package/dist/components/TestResults.d.ts +236 -0
- package/dist/components/TestResults.js +346 -0
- package/dist/components/Toast.d.ts +192 -0
- package/dist/components/Toast.js +163 -0
- package/dist/components/Toggle.d.ts +69 -0
- package/dist/components/Toggle.js +66 -0
- package/dist/components/ToggleGroup.d.ts +69 -0
- package/dist/components/ToggleGroup.js +99 -0
- package/dist/components/Tool.d.ts +119 -0
- package/dist/components/Tool.js +192 -0
- package/dist/components/Toolbar.d.ts +162 -0
- package/dist/components/Toolbar.js +126 -0
- package/dist/components/Tooltip.d.ts +81 -0
- package/dist/components/Tooltip.js +74 -0
- package/dist/components/WebPreview.d.ts +143 -0
- package/dist/components/WebPreview.js +280 -0
- package/dist/components/useStickToBottom.d.ts +30 -0
- package/dist/components/useStickToBottom.js +95 -0
- package/dist/copy-button-BIATcZWZ.d.ts +16 -0
- package/dist/copy-button-BNgclDrO.js +43 -0
- package/dist/icons-BsWc8g4E.js +221 -0
- package/dist/styles/accordion.css +10 -10
- package/dist/styles/agent-connection.css +18 -17
- package/dist/styles/alert-dialog.css +48 -29
- package/dist/styles/artifact.css +10 -10
- package/dist/styles/autocomplete.css +25 -24
- package/dist/styles/avatar.css +96 -6
- package/dist/styles/badge.css +78 -14
- package/dist/styles/base.css +9 -9
- package/dist/styles/button.css +57 -38
- package/dist/styles/card.css +57 -10
- package/dist/styles/chain-of-thought.css +47 -33
- package/dist/styles/checkbox.css +24 -10
- package/dist/styles/code-block.css +22 -15
- package/dist/styles/collapsible.css +14 -12
- package/dist/styles/combobox.css +26 -25
- package/dist/styles/commit.css +49 -24
- package/dist/styles/context-menu.css +70 -16
- package/dist/styles/context.css +15 -15
- package/dist/styles/conversation.css +12 -12
- package/dist/styles/dialog.css +52 -16
- package/dist/styles/environment-variables.css +19 -19
- package/dist/styles/field.css +184 -22
- package/dist/styles/fieldset.css +5 -4
- package/dist/styles/file-tree.css +17 -17
- package/dist/styles/index.css.d.ts +1 -0
- package/dist/styles/input.css +45 -11
- package/dist/styles/label.css +21 -4
- package/dist/styles/menu.css +55 -32
- package/dist/styles/menubar.css +80 -28
- package/dist/styles/message.css +22 -13
- package/dist/styles/meter.css +8 -8
- package/dist/styles/model-selector.css +33 -21
- package/dist/styles/navigation-menu.css +26 -24
- package/dist/styles/number-field.css +20 -18
- package/dist/styles/popover.css +38 -28
- package/dist/styles/preview-card.css +15 -13
- package/dist/styles/pricing-page.css +53 -53
- package/dist/styles/progress.css +7 -7
- package/dist/styles/prompt-input.css +73 -24
- package/dist/styles/queue.css +58 -32
- package/dist/styles/radio.css +26 -11
- package/dist/styles/reasoning.css +15 -11
- package/dist/styles/scroll-area.css +6 -6
- package/dist/styles/scrollbars.css +4 -4
- package/dist/styles/select.css +84 -25
- package/dist/styles/separator.css +1 -1
- package/dist/styles/shell.css +21 -20
- package/dist/styles/slider.css +35 -11
- package/dist/styles/sources.css +20 -20
- package/dist/styles/stepper.css +22 -22
- package/dist/styles/switch.css +29 -13
- package/dist/styles/tabs.css +23 -16
- package/dist/styles/task.css +27 -23
- package/dist/styles/terminal.css +16 -13
- package/dist/styles/test-results.css +79 -32
- package/dist/styles/toast.css +26 -25
- package/dist/styles/toggle-group.css +12 -12
- package/dist/styles/toggle.css +29 -11
- package/dist/styles/tool.css +54 -32
- package/dist/styles/toolbar.css +30 -28
- package/dist/styles/tooltip.css +10 -8
- package/dist/styles/web-preview.css +37 -21
- package/dist/utils/structured-code.d.ts +10 -0
- package/dist/utils/structured-code.js +81 -0
- package/package.json +17 -8
- package/dist/index.d.ts +0 -7236
- package/dist/index.js +0 -8945
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { c as ChevronRightIcon, l as CopyIcon, m as FileIcon, o as CheckIcon } from "../icons-BsWc8g4E.js";
|
|
2
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
|
|
5
|
+
import { Avatar } from "./Avatar.js";
|
|
6
|
+
import { Badge } from "./Badge.js";
|
|
7
|
+
import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/Commit.tsx
|
|
11
|
+
const FILE_STATUS_COLOR = {
|
|
12
|
+
added: "success",
|
|
13
|
+
modified: "warning",
|
|
14
|
+
deleted: "destructive",
|
|
15
|
+
renamed: "primary"
|
|
16
|
+
};
|
|
17
|
+
const FILE_STATUS_LABEL = {
|
|
18
|
+
added: "A",
|
|
19
|
+
modified: "M",
|
|
20
|
+
deleted: "D",
|
|
21
|
+
renamed: "R"
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A collapsible git commit card. Compose CommitHeader with metadata
|
|
25
|
+
* (CommitAuthor, CommitInfo, etc.) and CommitContent with a CommitFiles list.
|
|
26
|
+
*
|
|
27
|
+
* Built internally for git and agent review surfaces. Use it for commit
|
|
28
|
+
* summaries with expandable file details. Do not use it as a generic
|
|
29
|
+
* accordion; use Collapsible or Accordion directly.
|
|
30
|
+
*
|
|
31
|
+
* Styling consumes Sigvelo surface, border, spacing, radius, badge, and focus
|
|
32
|
+
* tokens. Add shared metadata/file affordances here instead of forking commit
|
|
33
|
+
* cards in apps.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Commit defaultOpen>
|
|
38
|
+
* <CommitHeader>
|
|
39
|
+
* <CommitAuthor>
|
|
40
|
+
* <CommitAuthorAvatar initials="AN" />
|
|
41
|
+
* <CommitInfo>
|
|
42
|
+
* <CommitMessage>Improve Storybook docs</CommitMessage>
|
|
43
|
+
* <CommitMetadata>
|
|
44
|
+
* <CommitHash hash="abc1234" />
|
|
45
|
+
* </CommitMetadata>
|
|
46
|
+
* </CommitInfo>
|
|
47
|
+
* </CommitAuthor>
|
|
48
|
+
* </CommitHeader>
|
|
49
|
+
* <CommitContent>
|
|
50
|
+
* <CommitFiles>
|
|
51
|
+
* <CommitFile status="modified">
|
|
52
|
+
* <CommitFilePath>packages/react-components/src/Button.tsx</CommitFilePath>
|
|
53
|
+
* </CommitFile>
|
|
54
|
+
* </CommitFiles>
|
|
55
|
+
* </CommitContent>
|
|
56
|
+
* </Commit>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
function Commit({ className, ref, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx(CollapsibleRoot, {
|
|
61
|
+
ref,
|
|
62
|
+
className: cx("commit", className),
|
|
63
|
+
...props,
|
|
64
|
+
unstyled: true
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function CommitHeader({ className, children, ref, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
69
|
+
ref,
|
|
70
|
+
className: cx("commit__header", className),
|
|
71
|
+
...props,
|
|
72
|
+
unstyled: true,
|
|
73
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
74
|
+
className: "commit__header-icon",
|
|
75
|
+
"aria-hidden": "true",
|
|
76
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
77
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "commit__header-body",
|
|
79
|
+
children
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function CommitAuthor({ className, children, ref, ...props }) {
|
|
84
|
+
return /* @__PURE__ */ jsx("div", {
|
|
85
|
+
ref,
|
|
86
|
+
className: cx("commit__author", className),
|
|
87
|
+
...props,
|
|
88
|
+
children
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function CommitAuthorAvatar({ className, initials, src, alt, ref, ...props }) {
|
|
92
|
+
return /* @__PURE__ */ jsxs(Avatar.Root, {
|
|
93
|
+
ref,
|
|
94
|
+
className: cx("commit__author-avatar", className),
|
|
95
|
+
...props,
|
|
96
|
+
children: [src ? /* @__PURE__ */ jsx(Avatar.Image, {
|
|
97
|
+
src,
|
|
98
|
+
alt: alt ?? initials
|
|
99
|
+
}) : null, /* @__PURE__ */ jsx(Avatar.Fallback, { children: initials })]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function CommitInfo({ className, children, ref, ...props }) {
|
|
103
|
+
return /* @__PURE__ */ jsx("div", {
|
|
104
|
+
ref,
|
|
105
|
+
className: cx("commit__info", className),
|
|
106
|
+
...props,
|
|
107
|
+
children
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function CommitMessage({ className, children, ref, ...props }) {
|
|
111
|
+
return /* @__PURE__ */ jsx("span", {
|
|
112
|
+
ref,
|
|
113
|
+
className: cx("commit__message", className),
|
|
114
|
+
...props,
|
|
115
|
+
children
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function CommitMetadata({ className, children, ref, ...props }) {
|
|
119
|
+
return /* @__PURE__ */ jsx("div", {
|
|
120
|
+
ref,
|
|
121
|
+
className: cx("commit__metadata", className),
|
|
122
|
+
...props,
|
|
123
|
+
children
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function CommitSeparator({ className, children = "•", ref, ...props }) {
|
|
127
|
+
return /* @__PURE__ */ jsx("span", {
|
|
128
|
+
ref,
|
|
129
|
+
className: cx("commit__separator", className),
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
...props,
|
|
132
|
+
children
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function CommitHash({ className, children, hash, ref, ...props }) {
|
|
136
|
+
return /* @__PURE__ */ jsx("span", {
|
|
137
|
+
ref,
|
|
138
|
+
className: cx("commit__hash", className),
|
|
139
|
+
...props,
|
|
140
|
+
children: children ?? hash?.slice(0, 7)
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function CommitCopyButton({ className, hash, label = "Copy hash", onClick, ...props }) {
|
|
144
|
+
const [copied, setCopied] = React.useState(false);
|
|
145
|
+
const handleClick = React.useCallback(async (e) => {
|
|
146
|
+
e.stopPropagation();
|
|
147
|
+
try {
|
|
148
|
+
await navigator.clipboard.writeText(hash);
|
|
149
|
+
setCopied(true);
|
|
150
|
+
window.setTimeout(() => setCopied(false), 1500);
|
|
151
|
+
} catch {}
|
|
152
|
+
onClick?.(e);
|
|
153
|
+
}, [hash, onClick]);
|
|
154
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
155
|
+
variant: "ghost",
|
|
156
|
+
size: "icon",
|
|
157
|
+
"aria-label": label,
|
|
158
|
+
className: cx("commit__copy", className),
|
|
159
|
+
...props,
|
|
160
|
+
onClick: handleClick,
|
|
161
|
+
children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
|
|
162
|
+
}) }), /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipPositioner, { children: /* @__PURE__ */ jsx(TooltipPopup, { children: copied ? "Copied" : label }) }) })] });
|
|
163
|
+
}
|
|
164
|
+
function CommitTimestamp({ className, children, date, ref, ...props }) {
|
|
165
|
+
return /* @__PURE__ */ jsx("time", {
|
|
166
|
+
ref,
|
|
167
|
+
dateTime: date.toISOString(),
|
|
168
|
+
className: cx("commit__timestamp", className),
|
|
169
|
+
title: date.toLocaleString(),
|
|
170
|
+
...props,
|
|
171
|
+
children: children ?? formatRelative(date)
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function CommitActions({ className, children, ref, ...props }) {
|
|
175
|
+
return /* @__PURE__ */ jsx("div", {
|
|
176
|
+
ref,
|
|
177
|
+
className: cx("commit__actions", className),
|
|
178
|
+
...props,
|
|
179
|
+
children
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function CommitContent({ className, children, ref, ...props }) {
|
|
183
|
+
return /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
184
|
+
ref,
|
|
185
|
+
className: cx("commit__content", className),
|
|
186
|
+
...props,
|
|
187
|
+
unstyled: true,
|
|
188
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
189
|
+
className: "commit__content-inner",
|
|
190
|
+
children
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function CommitFiles({ className, children, ref, ...props }) {
|
|
195
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
196
|
+
ref,
|
|
197
|
+
className: cx("commit__files", className),
|
|
198
|
+
...props,
|
|
199
|
+
children
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function CommitFile({ className, children, ref, ...props }) {
|
|
203
|
+
return /* @__PURE__ */ jsx("li", {
|
|
204
|
+
ref,
|
|
205
|
+
className: cx("commit__file", className),
|
|
206
|
+
...props,
|
|
207
|
+
children
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function CommitFileStatus({ className, status, ref, ...props }) {
|
|
211
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
212
|
+
...props,
|
|
213
|
+
ref,
|
|
214
|
+
color: FILE_STATUS_COLOR[status],
|
|
215
|
+
size: "sm",
|
|
216
|
+
className: cx("commit__file-status", className),
|
|
217
|
+
"aria-label": status,
|
|
218
|
+
children: FILE_STATUS_LABEL[status]
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function CommitFileIcon({ className, ref, ...props }) {
|
|
222
|
+
return /* @__PURE__ */ jsx("span", {
|
|
223
|
+
ref,
|
|
224
|
+
className: cx("commit__file-icon", className),
|
|
225
|
+
"aria-hidden": "true",
|
|
226
|
+
...props,
|
|
227
|
+
children: /* @__PURE__ */ jsx(FileIcon, {})
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function CommitFilePath({ className, children, ref, ...props }) {
|
|
231
|
+
return /* @__PURE__ */ jsx("span", {
|
|
232
|
+
ref,
|
|
233
|
+
className: cx("commit__file-path", className),
|
|
234
|
+
...props,
|
|
235
|
+
children
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
const CommitFileInfo = CommitFilePath;
|
|
239
|
+
function CommitFileAdditions({ className, count, ref, ...props }) {
|
|
240
|
+
if (count <= 0) return null;
|
|
241
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
242
|
+
ref,
|
|
243
|
+
className: cx("commit__file-additions", className),
|
|
244
|
+
"aria-label": `${count} additions`,
|
|
245
|
+
...props,
|
|
246
|
+
children: ["+", count]
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
function CommitFileDeletions({ className, count, ref, ...props }) {
|
|
250
|
+
if (count <= 0) return null;
|
|
251
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
252
|
+
ref,
|
|
253
|
+
className: cx("commit__file-deletions", className),
|
|
254
|
+
"aria-label": `${count} deletions`,
|
|
255
|
+
...props,
|
|
256
|
+
children: ["-", count]
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function CommitFileChanges({ className, additions = 0, deletions = 0, ref, ...props }) {
|
|
260
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
261
|
+
ref,
|
|
262
|
+
className: cx("commit__file-changes", className),
|
|
263
|
+
...props,
|
|
264
|
+
children: [/* @__PURE__ */ jsx(CommitFileAdditions, { count: additions }), /* @__PURE__ */ jsx(CommitFileDeletions, { count: deletions })]
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function formatRelative(date) {
|
|
268
|
+
const diffMs = Date.now() - date.getTime();
|
|
269
|
+
const diffSec = Math.round(diffMs / 1e3);
|
|
270
|
+
if (diffSec < 60) return "just now";
|
|
271
|
+
const diffMin = Math.round(diffSec / 60);
|
|
272
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
273
|
+
const diffHr = Math.round(diffMin / 60);
|
|
274
|
+
if (diffHr < 24) return `${diffHr}h ago`;
|
|
275
|
+
const diffDay = Math.round(diffHr / 24);
|
|
276
|
+
if (diffDay < 30) return `${diffDay}d ago`;
|
|
277
|
+
const diffMo = Math.round(diffDay / 30);
|
|
278
|
+
if (diffMo < 12) return `${diffMo}mo ago`;
|
|
279
|
+
return `${Math.round(diffMo / 12)}y ago`;
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
export { Commit, CommitActions, CommitAuthor, CommitAuthorAvatar, CommitContent, CommitCopyButton, CommitFile, CommitFileAdditions, CommitFileChanges, CommitFileDeletions, CommitFileIcon, CommitFileInfo, CommitFilePath, CommitFileStatus, CommitFiles, CommitHash, CommitHeader, CommitInfo, CommitMessage, CommitMetadata, CommitSeparator, CommitTimestamp };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { r as ButtonProps } from "../Button-QCM8ZKgR.js";
|
|
2
|
+
import { PopoverProps } from "./Popover.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Context.d.ts
|
|
6
|
+
interface ContextUsageCategory {
|
|
7
|
+
label: string;
|
|
8
|
+
tokens: number;
|
|
9
|
+
costUsd?: number;
|
|
10
|
+
}
|
|
11
|
+
interface ContextUsage {
|
|
12
|
+
input?: number;
|
|
13
|
+
inputTokens?: number;
|
|
14
|
+
output?: number;
|
|
15
|
+
outputTokens?: number;
|
|
16
|
+
reasoning?: number;
|
|
17
|
+
reasoningTokens?: number;
|
|
18
|
+
cache?: number;
|
|
19
|
+
cachedInputTokens?: number;
|
|
20
|
+
categories?: ContextUsageCategory[];
|
|
21
|
+
}
|
|
22
|
+
interface ContextProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
/** Tokens currently used. */
|
|
24
|
+
usedTokens: number;
|
|
25
|
+
/** Maximum context window size. */
|
|
26
|
+
maxTokens: number;
|
|
27
|
+
/** Optional usage breakdown. */
|
|
28
|
+
usage?: ContextUsage;
|
|
29
|
+
/** Optional model identifier shown in the header. */
|
|
30
|
+
modelId?: string;
|
|
31
|
+
/** Optional total cost in USD. */
|
|
32
|
+
totalCostUsd?: number;
|
|
33
|
+
open?: PopoverProps["open"];
|
|
34
|
+
defaultOpen?: PopoverProps["defaultOpen"];
|
|
35
|
+
onOpenChange?: PopoverProps["onOpenChange"];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Displays token / context usage with a hover card breakdown. The trigger is
|
|
39
|
+
* a button showing a compact percentage indicator; hovering or clicking opens
|
|
40
|
+
* a popover with category rows and total cost.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Context
|
|
45
|
+
* usedTokens={42_300}
|
|
46
|
+
* maxTokens={200_000}
|
|
47
|
+
* modelId="claude-opus-4-6"
|
|
48
|
+
* usage={{ input: 30000, output: 12300 }}
|
|
49
|
+
* totalCostUsd={0.42}
|
|
50
|
+
* >
|
|
51
|
+
* <ContextTrigger />
|
|
52
|
+
* <ContextContent>
|
|
53
|
+
* <ContextContentHeader />
|
|
54
|
+
* <ContextContentBody />
|
|
55
|
+
* <ContextContentFooter />
|
|
56
|
+
* </ContextContent>
|
|
57
|
+
* </Context>
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare function Context({
|
|
61
|
+
className,
|
|
62
|
+
usedTokens,
|
|
63
|
+
maxTokens,
|
|
64
|
+
usage,
|
|
65
|
+
modelId,
|
|
66
|
+
totalCostUsd,
|
|
67
|
+
open,
|
|
68
|
+
defaultOpen,
|
|
69
|
+
onOpenChange,
|
|
70
|
+
children,
|
|
71
|
+
ref,
|
|
72
|
+
...props
|
|
73
|
+
}: ContextProps & {
|
|
74
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
75
|
+
}): React.JSX.Element;
|
|
76
|
+
interface ContextTriggerProps extends Omit<ButtonProps, "variant" | "color" | "className"> {
|
|
77
|
+
className?: string;
|
|
78
|
+
}
|
|
79
|
+
declare function ContextTrigger({
|
|
80
|
+
className,
|
|
81
|
+
children,
|
|
82
|
+
...props
|
|
83
|
+
}: ContextTriggerProps): React.JSX.Element;
|
|
84
|
+
interface ContextContentProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
85
|
+
declare function ContextContent({
|
|
86
|
+
className,
|
|
87
|
+
children,
|
|
88
|
+
...props
|
|
89
|
+
}: ContextContentProps): React.JSX.Element;
|
|
90
|
+
interface ContextContentHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
91
|
+
declare function ContextContentHeader({
|
|
92
|
+
className,
|
|
93
|
+
children,
|
|
94
|
+
ref,
|
|
95
|
+
...props
|
|
96
|
+
}: ContextContentHeaderProps & {
|
|
97
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
98
|
+
}): React.JSX.Element;
|
|
99
|
+
interface ContextContentBodyProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
100
|
+
declare function ContextContentBody({
|
|
101
|
+
className,
|
|
102
|
+
children,
|
|
103
|
+
ref,
|
|
104
|
+
...props
|
|
105
|
+
}: ContextContentBodyProps & {
|
|
106
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
107
|
+
}): React.JSX.Element;
|
|
108
|
+
interface ContextContentFooterProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
109
|
+
declare function ContextContentFooter({
|
|
110
|
+
className,
|
|
111
|
+
children,
|
|
112
|
+
ref,
|
|
113
|
+
...props
|
|
114
|
+
}: ContextContentFooterProps & {
|
|
115
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
116
|
+
}): React.JSX.Element;
|
|
117
|
+
interface ContextUsageRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
118
|
+
label?: string;
|
|
119
|
+
}
|
|
120
|
+
type ContextInputUsageProps = ContextUsageRowProps;
|
|
121
|
+
type ContextOutputUsageProps = ContextUsageRowProps;
|
|
122
|
+
type ContextReasoningUsageProps = ContextUsageRowProps;
|
|
123
|
+
type ContextCacheUsageProps = ContextUsageRowProps;
|
|
124
|
+
declare function ContextInputUsage(props: ContextInputUsageProps): React.JSX.Element;
|
|
125
|
+
declare function ContextOutputUsage(props: ContextOutputUsageProps): React.JSX.Element;
|
|
126
|
+
declare function ContextReasoningUsage(props: ContextReasoningUsageProps): React.JSX.Element;
|
|
127
|
+
declare function ContextCacheUsage(props: ContextCacheUsageProps): React.JSX.Element;
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Context, ContextCacheUsage, ContextCacheUsageProps, ContextContent, ContextContentBody, ContextContentBodyProps, ContextContentFooter, ContextContentFooterProps, ContextContentHeader, ContextContentHeaderProps, ContextContentProps, ContextInputUsage, ContextInputUsageProps, ContextOutputUsage, ContextOutputUsageProps, ContextProps, ContextReasoningUsage, ContextReasoningUsageProps, ContextTrigger, ContextTriggerProps, ContextUsage, ContextUsageCategory, ContextUsageRowProps };
|