@mcp-b/react-components 0.1.1 → 0.1.2

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.
Files changed (203) hide show
  1. package/dist/Button-QCM8ZKgR.d.ts +98 -0
  2. package/dist/CodeBlock-CttHhWcb.js +356 -0
  3. package/dist/CodeBlock-V6pgafSS.d.ts +174 -0
  4. package/dist/Select-CRsKCJ9x.d.ts +200 -0
  5. package/dist/class-names-9UtZwb0J.js +12 -0
  6. package/dist/components/Accordion.d.ts +81 -0
  7. package/dist/components/Accordion.js +97 -0
  8. package/dist/components/AgentConnection.d.ts +69 -0
  9. package/dist/components/AgentConnection.js +176 -0
  10. package/dist/components/AlertDialog.d.ts +148 -0
  11. package/dist/components/AlertDialog.js +141 -0
  12. package/dist/components/Artifact.d.ts +128 -0
  13. package/dist/components/Artifact.js +115 -0
  14. package/dist/components/Autocomplete.d.ts +186 -0
  15. package/dist/components/Autocomplete.js +186 -0
  16. package/dist/components/Avatar.d.ts +134 -0
  17. package/dist/components/Avatar.js +118 -0
  18. package/dist/components/Badge.d.ts +68 -0
  19. package/dist/components/Badge.js +108 -0
  20. package/dist/components/Button.d.ts +2 -0
  21. package/dist/components/Button.js +73 -0
  22. package/dist/components/Card.d.ts +87 -0
  23. package/dist/components/Card.js +81 -0
  24. package/dist/components/ChainOfThought.d.ts +153 -0
  25. package/dist/components/ChainOfThought.js +157 -0
  26. package/dist/components/Checkbox.d.ts +35 -0
  27. package/dist/components/Checkbox.js +47 -0
  28. package/dist/components/CheckboxGroup.d.ts +76 -0
  29. package/dist/components/CheckboxGroup.js +69 -0
  30. package/dist/components/CodeBlock.d.ts +2 -0
  31. package/dist/components/CodeBlock.js +2 -0
  32. package/dist/components/Collapsible.d.ts +127 -0
  33. package/dist/components/Collapsible.js +103 -0
  34. package/dist/components/Combobox.d.ts +177 -0
  35. package/dist/components/Combobox.js +179 -0
  36. package/dist/components/Commit.d.ts +265 -0
  37. package/dist/components/Commit.js +282 -0
  38. package/dist/components/Context.d.ts +129 -0
  39. package/dist/components/Context.js +309 -0
  40. package/dist/components/ContextMenu.d.ts +282 -0
  41. package/dist/components/ContextMenu.js +270 -0
  42. package/dist/components/Conversation.d.ts +166 -0
  43. package/dist/components/Conversation.js +202 -0
  44. package/dist/components/Dialog.d.ts +120 -0
  45. package/dist/components/Dialog.js +114 -0
  46. package/dist/components/EnvironmentVariables.d.ts +176 -0
  47. package/dist/components/EnvironmentVariables.js +221 -0
  48. package/dist/components/Field.d.ts +281 -0
  49. package/dist/components/Field.js +274 -0
  50. package/dist/components/Fieldset.d.ts +93 -0
  51. package/dist/components/Fieldset.js +81 -0
  52. package/dist/components/FileTree.d.ts +116 -0
  53. package/dist/components/FileTree.js +310 -0
  54. package/dist/components/Form.d.ts +94 -0
  55. package/dist/components/Form.js +88 -0
  56. package/dist/components/GithubMotionMark.d.ts +13 -0
  57. package/dist/components/GithubMotionMark.js +23 -0
  58. package/dist/components/Input.d.ts +33 -0
  59. package/dist/components/Input.js +27 -0
  60. package/dist/components/Label.d.ts +44 -0
  61. package/dist/components/Label.js +41 -0
  62. package/dist/components/Menu.d.ts +395 -0
  63. package/dist/components/Menu.js +338 -0
  64. package/dist/components/Menubar.d.ts +331 -0
  65. package/dist/components/Menubar.js +299 -0
  66. package/dist/components/Message.d.ts +216 -0
  67. package/dist/components/Message.js +245 -0
  68. package/dist/components/Meter.d.ts +151 -0
  69. package/dist/components/Meter.js +121 -0
  70. package/dist/components/ModelSelector.d.ts +198 -0
  71. package/dist/components/ModelSelector.js +306 -0
  72. package/dist/components/NaniteScene.d.ts +33 -0
  73. package/dist/components/NaniteScene.js +405 -0
  74. package/dist/components/NavigationMenu.d.ts +256 -0
  75. package/dist/components/NavigationMenu.js +228 -0
  76. package/dist/components/NumberField.d.ts +159 -0
  77. package/dist/components/NumberField.js +123 -0
  78. package/dist/components/Popover.d.ts +278 -0
  79. package/dist/components/Popover.js +245 -0
  80. package/dist/components/PreviewCard.d.ts +156 -0
  81. package/dist/components/PreviewCard.js +156 -0
  82. package/dist/components/PricingPage.d.ts +209 -0
  83. package/dist/components/PricingPage.js +506 -0
  84. package/dist/components/Progress.d.ts +58 -0
  85. package/dist/components/Progress.js +51 -0
  86. package/dist/components/PromptInput.d.ts +399 -0
  87. package/dist/components/PromptInput.js +737 -0
  88. package/dist/components/Queue.d.ts +241 -0
  89. package/dist/components/Queue.js +225 -0
  90. package/dist/components/RadioGroup.d.ts +78 -0
  91. package/dist/components/RadioGroup.js +72 -0
  92. package/dist/components/Reasoning.d.ts +88 -0
  93. package/dist/components/Reasoning.js +187 -0
  94. package/dist/components/ScrollArea.d.ts +160 -0
  95. package/dist/components/ScrollArea.js +145 -0
  96. package/dist/components/Select.d.ts +2 -0
  97. package/dist/components/Select.js +260 -0
  98. package/dist/components/Separator.d.ts +45 -0
  99. package/dist/components/Separator.js +40 -0
  100. package/dist/components/Shell.d.ts +163 -0
  101. package/dist/components/Shell.js +137 -0
  102. package/dist/components/Slider.d.ts +120 -0
  103. package/dist/components/Slider.js +115 -0
  104. package/dist/components/Sources.d.ts +91 -0
  105. package/dist/components/Sources.js +121 -0
  106. package/dist/components/Stepper.d.ts +190 -0
  107. package/dist/components/Stepper.js +315 -0
  108. package/dist/components/Switch.d.ts +57 -0
  109. package/dist/components/Switch.js +55 -0
  110. package/dist/components/Tabs.d.ts +84 -0
  111. package/dist/components/Tabs.js +78 -0
  112. package/dist/components/Task.d.ts +100 -0
  113. package/dist/components/Task.js +120 -0
  114. package/dist/components/Terminal.d.ts +118 -0
  115. package/dist/components/Terminal.js +234 -0
  116. package/dist/components/TestResults.d.ts +236 -0
  117. package/dist/components/TestResults.js +346 -0
  118. package/dist/components/Toast.d.ts +192 -0
  119. package/dist/components/Toast.js +163 -0
  120. package/dist/components/Toggle.d.ts +69 -0
  121. package/dist/components/Toggle.js +66 -0
  122. package/dist/components/ToggleGroup.d.ts +69 -0
  123. package/dist/components/ToggleGroup.js +99 -0
  124. package/dist/components/Tool.d.ts +119 -0
  125. package/dist/components/Tool.js +192 -0
  126. package/dist/components/Toolbar.d.ts +162 -0
  127. package/dist/components/Toolbar.js +126 -0
  128. package/dist/components/Tooltip.d.ts +81 -0
  129. package/dist/components/Tooltip.js +74 -0
  130. package/dist/components/WebPreview.d.ts +143 -0
  131. package/dist/components/WebPreview.js +280 -0
  132. package/dist/components/useStickToBottom.d.ts +30 -0
  133. package/dist/components/useStickToBottom.js +95 -0
  134. package/dist/copy-button-BIATcZWZ.d.ts +16 -0
  135. package/dist/copy-button-BNgclDrO.js +43 -0
  136. package/dist/icons-BsWc8g4E.js +221 -0
  137. package/dist/styles/accordion.css +10 -10
  138. package/dist/styles/agent-connection.css +18 -17
  139. package/dist/styles/alert-dialog.css +48 -29
  140. package/dist/styles/artifact.css +10 -10
  141. package/dist/styles/autocomplete.css +25 -24
  142. package/dist/styles/avatar.css +96 -6
  143. package/dist/styles/badge.css +78 -14
  144. package/dist/styles/base.css +9 -9
  145. package/dist/styles/button.css +57 -38
  146. package/dist/styles/card.css +57 -10
  147. package/dist/styles/chain-of-thought.css +47 -33
  148. package/dist/styles/checkbox.css +24 -10
  149. package/dist/styles/code-block.css +22 -15
  150. package/dist/styles/collapsible.css +14 -12
  151. package/dist/styles/combobox.css +26 -25
  152. package/dist/styles/commit.css +49 -24
  153. package/dist/styles/context-menu.css +70 -16
  154. package/dist/styles/context.css +15 -15
  155. package/dist/styles/conversation.css +12 -12
  156. package/dist/styles/dialog.css +52 -16
  157. package/dist/styles/environment-variables.css +19 -19
  158. package/dist/styles/field.css +184 -22
  159. package/dist/styles/fieldset.css +5 -4
  160. package/dist/styles/file-tree.css +17 -17
  161. package/dist/styles/index.css.d.ts +1 -0
  162. package/dist/styles/input.css +45 -11
  163. package/dist/styles/label.css +21 -4
  164. package/dist/styles/menu.css +55 -32
  165. package/dist/styles/menubar.css +80 -28
  166. package/dist/styles/message.css +22 -13
  167. package/dist/styles/meter.css +8 -8
  168. package/dist/styles/model-selector.css +33 -21
  169. package/dist/styles/navigation-menu.css +26 -24
  170. package/dist/styles/number-field.css +20 -18
  171. package/dist/styles/popover.css +38 -28
  172. package/dist/styles/preview-card.css +15 -13
  173. package/dist/styles/pricing-page.css +53 -53
  174. package/dist/styles/progress.css +7 -7
  175. package/dist/styles/prompt-input.css +73 -24
  176. package/dist/styles/queue.css +58 -32
  177. package/dist/styles/radio.css +26 -11
  178. package/dist/styles/reasoning.css +15 -11
  179. package/dist/styles/scroll-area.css +6 -6
  180. package/dist/styles/scrollbars.css +4 -4
  181. package/dist/styles/select.css +84 -25
  182. package/dist/styles/separator.css +1 -1
  183. package/dist/styles/shell.css +21 -20
  184. package/dist/styles/slider.css +35 -11
  185. package/dist/styles/sources.css +20 -20
  186. package/dist/styles/stepper.css +22 -22
  187. package/dist/styles/switch.css +29 -13
  188. package/dist/styles/tabs.css +23 -16
  189. package/dist/styles/task.css +27 -23
  190. package/dist/styles/terminal.css +16 -13
  191. package/dist/styles/test-results.css +79 -32
  192. package/dist/styles/toast.css +26 -25
  193. package/dist/styles/toggle-group.css +12 -12
  194. package/dist/styles/toggle.css +29 -11
  195. package/dist/styles/tool.css +54 -32
  196. package/dist/styles/toolbar.css +30 -28
  197. package/dist/styles/tooltip.css +10 -8
  198. package/dist/styles/web-preview.css +37 -21
  199. package/dist/utils/structured-code.d.ts +10 -0
  200. package/dist/utils/structured-code.js +81 -0
  201. package/package.json +16 -7
  202. package/dist/index.d.ts +0 -7236
  203. package/dist/index.js +0 -8945
@@ -0,0 +1,346 @@
1
+ import { C as SpinnerIcon, O as XIcon, c as ChevronRightIcon, o as CheckIcon } from "../icons-BsWc8g4E.js";
2
+ import { t as cx } from "../class-names-9UtZwb0J.js";
3
+ import { Badge } from "./Badge.js";
4
+ import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
5
+ import * as React from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/TestResults.tsx
8
+ const STATUS_COLOR = {
9
+ passed: "success",
10
+ failed: "destructive",
11
+ skipped: "warning",
12
+ running: "primary"
13
+ };
14
+ const STATUS_LABEL = {
15
+ passed: "PASS",
16
+ failed: "FAIL",
17
+ skipped: "SKIP",
18
+ running: "RUN"
19
+ };
20
+ const TestResultsContext = React.createContext({});
21
+ /**
22
+ * Displays a test suite report with summary stats, progress bar, and
23
+ * collapsible per-suite results.
24
+ *
25
+ * Built internally for CI/test output in agent and developer workflows. Use it
26
+ * for structured test reports. Do not use it for generic status dashboards.
27
+ *
28
+ * Sigvelo changes: composes Collapsible, Badge, and Progress; maps status
29
+ * color and spacing to Sigvelo CSS tokens; opens failed suites by default.
30
+ *
31
+ * Suite triggers inherit Collapsible keyboard behavior. Error stacks should be
32
+ * text, not images. Add new statuses here before apps fork their own report UI.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <TestResults summary={{ passed: 10, failed: 1, skipped: 0, total: 11 }}>
37
+ * <TestSuite name="auth.test.ts" status="failed">
38
+ * <Test name="rejects bad tokens" status="failed">
39
+ * <TestError message="Expected 401, received 500" />
40
+ * </Test>
41
+ * </TestSuite>
42
+ * </TestResults>
43
+ * ```
44
+ */
45
+ function TestResults({ className, summary, children, ref, ...props }) {
46
+ const overall = summary && summary.failed > 0 ? "failed" : "passed";
47
+ const contextValue = React.useMemo(() => ({ summary }), [summary]);
48
+ return /* @__PURE__ */ jsx(TestResultsContext.Provider, {
49
+ value: contextValue,
50
+ children: /* @__PURE__ */ jsx("div", {
51
+ ref,
52
+ className: cx("test-results", className),
53
+ "data-status": overall,
54
+ ...props,
55
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(TestResultsHeader, { children: [/* @__PURE__ */ jsx(TestResultsSummary, {}), /* @__PURE__ */ jsx(TestResultsProgress, {})] }), /* @__PURE__ */ jsx(TestResultsContent, {})] })
56
+ })
57
+ });
58
+ }
59
+ function TestResultsHeader({ className, children, ref, ...props }) {
60
+ return /* @__PURE__ */ jsx("div", {
61
+ ref,
62
+ className: cx("test-results__header", className),
63
+ ...props,
64
+ children
65
+ });
66
+ }
67
+ function TestResultsDuration({ className, children, ref, ...props }) {
68
+ const { summary } = React.useContext(TestResultsContext);
69
+ if (!summary?.duration) return null;
70
+ return /* @__PURE__ */ jsx("span", {
71
+ ref,
72
+ className: cx("test-results__stat", className),
73
+ ...props,
74
+ children: children ?? formatDuration(summary.duration)
75
+ });
76
+ }
77
+ function TestResultsSummary({ className, children, ref, ...props }) {
78
+ const { summary } = React.useContext(TestResultsContext);
79
+ if (!summary) return null;
80
+ const overall = summary.failed > 0 ? "failed" : "passed";
81
+ return /* @__PURE__ */ jsx("div", {
82
+ ref,
83
+ className: cx("test-results__summary", className),
84
+ ...props,
85
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Badge, {
86
+ color: STATUS_COLOR[overall],
87
+ className: "test-results__overall",
88
+ children: overall === "passed" ? "All tests passed" : `${summary.failed} failed`
89
+ }), /* @__PURE__ */ jsxs("span", {
90
+ className: "test-results__stats",
91
+ children: [
92
+ /* @__PURE__ */ jsxs("span", {
93
+ className: "test-results__stat test-results__stat--passed",
94
+ children: [summary.passed, " passed"]
95
+ }),
96
+ /* @__PURE__ */ jsxs("span", {
97
+ className: "test-results__stat test-results__stat--failed",
98
+ children: [summary.failed, " failed"]
99
+ }),
100
+ /* @__PURE__ */ jsxs("span", {
101
+ className: "test-results__stat test-results__stat--skipped",
102
+ children: [summary.skipped, " skipped"]
103
+ }),
104
+ /* @__PURE__ */ jsx(TestResultsDuration, {})
105
+ ]
106
+ })] })
107
+ });
108
+ }
109
+ function TestResultsProgress({ className, children, ref, ...props }) {
110
+ const { summary } = React.useContext(TestResultsContext);
111
+ if (!summary) return null;
112
+ const passedPercent = summary.total > 0 ? summary.passed / summary.total * 100 : 0;
113
+ const failedPercent = summary.total > 0 ? summary.failed / summary.total * 100 : 0;
114
+ if (children) return /* @__PURE__ */ jsx("div", {
115
+ ref,
116
+ className: cx("test-results__progress", className),
117
+ ...props,
118
+ children
119
+ });
120
+ return /* @__PURE__ */ jsxs("div", {
121
+ ref,
122
+ className: cx("test-results__progress", className),
123
+ ...props,
124
+ children: [/* @__PURE__ */ jsxs("div", {
125
+ "aria-label": "Test progress",
126
+ "aria-valuemax": summary.total,
127
+ "aria-valuemin": 0,
128
+ "aria-valuenow": summary.passed,
129
+ "aria-valuetext": `${summary.passed}/${summary.total} tests passed, ${summary.failed} failed`,
130
+ className: "test-results__progress-track",
131
+ role: "progressbar",
132
+ children: [/* @__PURE__ */ jsx("div", {
133
+ className: "test-results__progress-segment test-results__progress-segment--passed",
134
+ style: { width: `${passedPercent}%` }
135
+ }), /* @__PURE__ */ jsx("div", {
136
+ className: "test-results__progress-segment test-results__progress-segment--failed",
137
+ style: { width: `${failedPercent}%` }
138
+ })]
139
+ }), /* @__PURE__ */ jsxs("span", {
140
+ className: "test-results__progress-label",
141
+ children: [
142
+ summary.passed,
143
+ "/",
144
+ summary.total,
145
+ " tests passed - ",
146
+ failedPercent.toFixed(0),
147
+ "% failed"
148
+ ]
149
+ })]
150
+ });
151
+ }
152
+ function TestResultsContent({ className, children, ref, ...props }) {
153
+ return /* @__PURE__ */ jsx("div", {
154
+ ref,
155
+ className: cx("test-results__body", className),
156
+ ...props,
157
+ children
158
+ });
159
+ }
160
+ const TestSuiteContext = React.createContext({
161
+ name: "",
162
+ status: "passed"
163
+ });
164
+ function TestSuite({ className, name, status, defaultOpen, children, ref, ...props }) {
165
+ const contextValue = React.useMemo(() => ({
166
+ name,
167
+ status
168
+ }), [name, status]);
169
+ const isComposable = hasComposableTestSuiteChildren(children);
170
+ return /* @__PURE__ */ jsx(TestSuiteContext.Provider, {
171
+ value: contextValue,
172
+ children: /* @__PURE__ */ jsx(CollapsibleRoot, {
173
+ ref,
174
+ className: cx("test-results__suite", className),
175
+ defaultOpen: defaultOpen ?? status === "failed",
176
+ "data-status": status,
177
+ ...props,
178
+ unstyled: true,
179
+ children: isComposable ? children : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TestSuiteName, {}), /* @__PURE__ */ jsx(TestSuiteContent, { children: /* @__PURE__ */ jsx("div", {
180
+ className: "test-results__suite-tests",
181
+ children
182
+ }) })] })
183
+ })
184
+ });
185
+ }
186
+ function TestSuiteName({ className, children, ref, ...props }) {
187
+ const { name, status } = React.useContext(TestSuiteContext);
188
+ return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
189
+ ref,
190
+ className: cx("test-results__suite-trigger", className),
191
+ ...props,
192
+ unstyled: true,
193
+ children: [
194
+ /* @__PURE__ */ jsx("span", {
195
+ className: "test-results__suite-icon",
196
+ "aria-hidden": "true",
197
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
198
+ }),
199
+ /* @__PURE__ */ jsx(Badge, {
200
+ color: STATUS_COLOR[status],
201
+ size: "sm",
202
+ children: STATUS_LABEL[status]
203
+ }),
204
+ /* @__PURE__ */ jsx("span", {
205
+ className: "test-results__suite-name",
206
+ children: children ?? name
207
+ })
208
+ ]
209
+ });
210
+ }
211
+ function TestSuiteStats({ className, passed = 0, failed = 0, skipped = 0, children, ref, ...props }) {
212
+ return /* @__PURE__ */ jsx("div", {
213
+ ref,
214
+ className: cx("test-results__suite-stats", className),
215
+ ...props,
216
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
217
+ passed > 0 ? /* @__PURE__ */ jsxs("span", {
218
+ className: "test-results__stat test-results__stat--passed",
219
+ children: [passed, " passed"]
220
+ }) : null,
221
+ failed > 0 ? /* @__PURE__ */ jsxs("span", {
222
+ className: "test-results__stat test-results__stat--failed",
223
+ children: [failed, " failed"]
224
+ }) : null,
225
+ skipped > 0 ? /* @__PURE__ */ jsxs("span", {
226
+ className: "test-results__stat test-results__stat--skipped",
227
+ children: [skipped, " skipped"]
228
+ }) : null
229
+ ] })
230
+ });
231
+ }
232
+ function TestSuiteContent({ className, children, ref, ...props }) {
233
+ return /* @__PURE__ */ jsx(CollapsiblePanel, {
234
+ ref,
235
+ className: cx("test-results__suite-content", className),
236
+ ...props,
237
+ unstyled: true,
238
+ children
239
+ });
240
+ }
241
+ function hasComposableTestSuiteChildren(children) {
242
+ return React.Children.toArray(children).some((child) => React.isValidElement(child) && (child.type === TestSuiteName || child.type === TestSuiteContent));
243
+ }
244
+ const TestContext = React.createContext({
245
+ name: "",
246
+ status: "passed"
247
+ });
248
+ function Test({ className, name, status, duration, children, ref, ...props }) {
249
+ const contextValue = React.useMemo(() => ({
250
+ duration,
251
+ name,
252
+ status
253
+ }), [
254
+ duration,
255
+ name,
256
+ status
257
+ ]);
258
+ const isComposable = hasComposableTestChildren(children);
259
+ return /* @__PURE__ */ jsx(TestContext.Provider, {
260
+ value: contextValue,
261
+ children: /* @__PURE__ */ jsx("div", {
262
+ ref,
263
+ className: cx("test-results__test", `test-results__test--${status}`, className),
264
+ "data-status": status,
265
+ ...props,
266
+ children: isComposable ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
267
+ /* @__PURE__ */ jsx(TestStatus, {}),
268
+ /* @__PURE__ */ jsx(TestName, {}),
269
+ /* @__PURE__ */ jsx(TestDuration, {}),
270
+ children ? /* @__PURE__ */ jsx("div", {
271
+ className: "test-results__test-children",
272
+ children
273
+ }) : null
274
+ ] })
275
+ })
276
+ });
277
+ }
278
+ function TestStatus({ className, children, status, ref, ...props }) {
279
+ const testContext = React.useContext(TestContext);
280
+ const testStatus = status ?? testContext.status;
281
+ const icon = testStatus === "passed" ? /* @__PURE__ */ jsx(CheckIcon, {}) : testStatus === "failed" ? /* @__PURE__ */ jsx(XIcon, {}) : testStatus === "running" ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx("span", {
282
+ "aria-hidden": "true",
283
+ children: "."
284
+ });
285
+ return /* @__PURE__ */ jsx("span", {
286
+ ref,
287
+ className: cx("test-results__test-status", `test-results__test-status--${testStatus}`, className),
288
+ title: testStatus,
289
+ ...props,
290
+ children: children ?? icon
291
+ });
292
+ }
293
+ function TestName({ className, children, ref, ...props }) {
294
+ const { name } = React.useContext(TestContext);
295
+ return /* @__PURE__ */ jsx("span", {
296
+ ref,
297
+ className: cx("test-results__test-name", className),
298
+ ...props,
299
+ children: children ?? name
300
+ });
301
+ }
302
+ function TestDuration({ className, children, ref, ...props }) {
303
+ const { duration } = React.useContext(TestContext);
304
+ if (duration === void 0) return null;
305
+ return /* @__PURE__ */ jsx("span", {
306
+ ref,
307
+ className: cx("test-results__test-duration", className),
308
+ ...props,
309
+ children: children ?? `${duration}ms`
310
+ });
311
+ }
312
+ function hasComposableTestChildren(children) {
313
+ return React.Children.toArray(children).some((child) => React.isValidElement(child) && (child.type === TestStatus || child.type === TestName || child.type === TestDuration));
314
+ }
315
+ function TestError({ className, message, children, ref, ...props }) {
316
+ return /* @__PURE__ */ jsx("div", {
317
+ ref,
318
+ className: cx("test-results__error", className),
319
+ ...props,
320
+ children: children ?? /* @__PURE__ */ jsx("pre", {
321
+ className: "test-results__error-text",
322
+ children: message
323
+ })
324
+ });
325
+ }
326
+ function TestErrorMessage({ className, children, ref, ...props }) {
327
+ return /* @__PURE__ */ jsx("p", {
328
+ ref,
329
+ className: cx("test-results__error-message", className),
330
+ ...props,
331
+ children
332
+ });
333
+ }
334
+ function TestErrorStack({ className, children, ref, ...props }) {
335
+ return /* @__PURE__ */ jsx("pre", {
336
+ ref,
337
+ className: cx("test-results__error-text", className),
338
+ ...props,
339
+ children
340
+ });
341
+ }
342
+ function formatDuration(ms) {
343
+ return ms < 1e3 ? `${ms}ms` : `${(ms / 1e3).toFixed(2)}s`;
344
+ }
345
+ //#endregion
346
+ export { Test, TestDuration, TestError, TestErrorMessage, TestErrorStack, TestName, TestResults, TestResultsContent, TestResultsDuration, TestResultsHeader, TestResultsProgress, TestResultsSummary, TestStatus, TestSuite, TestSuiteContent, TestSuiteName, TestSuiteStats };
@@ -0,0 +1,192 @@
1
+ import * as React from "react";
2
+ import { Toast as Toast$1 } from "@base-ui/react/toast";
3
+
4
+ //#region src/components/Toast.d.ts
5
+ /**
6
+ * Props for the Toast.Provider component.
7
+ */
8
+ interface ToastProviderProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Provider> {}
9
+ /**
10
+ * Props for the Toast.Viewport component.
11
+ */
12
+ interface ToastViewportProps extends Omit<React.ComponentPropsWithoutRef<typeof Toast$1.Viewport>, "className"> {
13
+ /** Additional CSS class names */
14
+ className?: string;
15
+ }
16
+ /**
17
+ * Props for the Toast.Root component.
18
+ */
19
+ interface ToastRootProps extends Omit<React.ComponentPropsWithoutRef<typeof Toast$1.Root>, "className"> {
20
+ /** Additional CSS class names */
21
+ className?: string;
22
+ }
23
+ /**
24
+ * Props for the Toast.Content component.
25
+ */
26
+ interface ToastContentProps extends Omit<React.ComponentPropsWithoutRef<typeof Toast$1.Content>, "className"> {
27
+ /** Additional CSS class names */
28
+ className?: string;
29
+ }
30
+ /**
31
+ * Props for the Toast.Title component.
32
+ */
33
+ interface ToastTitleProps extends Omit<React.ComponentPropsWithoutRef<typeof Toast$1.Title>, "className"> {
34
+ /** Additional CSS class names */
35
+ className?: string;
36
+ }
37
+ /**
38
+ * Props for the Toast.Description component.
39
+ */
40
+ interface ToastDescriptionProps extends Omit<React.ComponentPropsWithoutRef<typeof Toast$1.Description>, "className"> {
41
+ /** Additional CSS class names */
42
+ className?: string;
43
+ }
44
+ /**
45
+ * Props for the Toast.Action component.
46
+ */
47
+ interface ToastActionProps extends Omit<React.ComponentPropsWithoutRef<typeof Toast$1.Action>, "className"> {
48
+ /** Additional CSS class names */
49
+ className?: string;
50
+ }
51
+ /**
52
+ * Props for the Toast.Close component.
53
+ */
54
+ interface ToastCloseProps extends Omit<React.ComponentPropsWithoutRef<typeof Toast$1.Close>, "className"> {
55
+ /** Additional CSS class names */
56
+ className?: string;
57
+ }
58
+ /**
59
+ * Container for displaying toasts.
60
+ */
61
+ declare function ToastViewport({
62
+ className,
63
+ ref,
64
+ ...props
65
+ }: ToastViewportProps & {
66
+ ref?: React.Ref<HTMLDivElement>;
67
+ }): React.JSX.Element;
68
+ /**
69
+ * Individual toast wrapper.
70
+ */
71
+ declare function ToastRoot({
72
+ className,
73
+ ref,
74
+ ...props
75
+ }: ToastRootProps & {
76
+ ref?: React.Ref<HTMLDivElement>;
77
+ }): React.JSX.Element;
78
+ /**
79
+ * Container for the contents of a toast.
80
+ */
81
+ declare function ToastContent({
82
+ className,
83
+ ref,
84
+ ...props
85
+ }: ToastContentProps & {
86
+ ref?: React.Ref<HTMLDivElement>;
87
+ }): React.JSX.Element;
88
+ /**
89
+ * Title that labels the toast. Renders an `<h2>` element.
90
+ */
91
+ declare function ToastTitle({
92
+ className,
93
+ ref,
94
+ ...props
95
+ }: ToastTitleProps & {
96
+ ref?: React.Ref<HTMLHeadingElement>;
97
+ }): React.JSX.Element;
98
+ /**
99
+ * Description text for the toast. Renders a `<p>` element.
100
+ */
101
+ declare function ToastDescription({
102
+ className,
103
+ ref,
104
+ ...props
105
+ }: ToastDescriptionProps & {
106
+ ref?: React.Ref<HTMLParagraphElement>;
107
+ }): React.JSX.Element;
108
+ /**
109
+ * Action button within the toast.
110
+ */
111
+ declare function ToastAction({
112
+ className,
113
+ ref,
114
+ ...props
115
+ }: ToastActionProps & {
116
+ ref?: React.Ref<HTMLButtonElement>;
117
+ }): React.JSX.Element;
118
+ /**
119
+ * Close button that dismisses the toast.
120
+ */
121
+ declare function ToastClose({
122
+ className,
123
+ ref,
124
+ ...props
125
+ }: ToastCloseProps & {
126
+ ref?: React.Ref<HTMLButtonElement>;
127
+ }): React.JSX.Element;
128
+ /**
129
+ * A toast notification system for displaying temporary messages.
130
+ * Supports multiple toasts, swipe-to-dismiss, and customizable positioning.
131
+ *
132
+ * @example
133
+ * ```tsx
134
+ * // Setup in your app root
135
+ * function App() {
136
+ * return (
137
+ * <Toast.Provider timeout={5000} limit={3}>
138
+ * <YourApp />
139
+ * <ToastViewport />
140
+ * </Toast.Provider>
141
+ * );
142
+ * }
143
+ *
144
+ * // Custom viewport that renders toasts
145
+ * function ToastViewport() {
146
+ * const { toasts } = Toast.useToastManager();
147
+ *
148
+ * return (
149
+ * <Toast.Viewport>
150
+ * {toasts.map((toast) => (
151
+ * <Toast.Root key={toast.id} toast={toast}>
152
+ * <Toast.Content>
153
+ * <Toast.Title>{toast.title}</Toast.Title>
154
+ * <Toast.Description>{toast.description}</Toast.Description>
155
+ * </Toast.Content>
156
+ * <Toast.Close>Dismiss</Toast.Close>
157
+ * </Toast.Root>
158
+ * ))}
159
+ * </Toast.Viewport>
160
+ * );
161
+ * }
162
+ *
163
+ * // Trigger toasts from anywhere
164
+ * function SomeComponent() {
165
+ * const toastManager = Toast.useToastManager();
166
+ *
167
+ * return (
168
+ * <button onClick={() => toastManager.add({
169
+ * title: 'Success',
170
+ * description: 'Your changes have been saved.'
171
+ * })}>
172
+ * Show Toast
173
+ * </button>
174
+ * );
175
+ * }
176
+ * ```
177
+ *
178
+ * @see {@link https://base-ui.com/react/components/toast | Base UI Toast}
179
+ */
180
+ declare const Toast: {
181
+ Provider: (props: ToastProviderProps) => React.JSX.Element;
182
+ Viewport: typeof ToastViewport;
183
+ Root: typeof ToastRoot;
184
+ Content: typeof ToastContent;
185
+ Title: typeof ToastTitle;
186
+ Description: typeof ToastDescription;
187
+ Action: typeof ToastAction;
188
+ Close: typeof ToastClose; /** Hook to access the toast manager for adding/removing toasts */
189
+ useToastManager: typeof Toast$1.useToastManager;
190
+ };
191
+ //#endregion
192
+ export { Toast, ToastActionProps, ToastCloseProps, ToastContentProps, ToastDescriptionProps, ToastProviderProps, ToastRootProps, ToastTitleProps, ToastViewportProps };
@@ -0,0 +1,163 @@
1
+ import "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Toast as Toast$1 } from "@base-ui/react/toast";
4
+ //#region src/components/Toast.tsx
5
+ /**
6
+ * Wraps your application to manage toast state.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <Toast.Provider>
11
+ * <App />
12
+ * <Toast.Viewport />
13
+ * </Toast.Provider>
14
+ * ```
15
+ *
16
+ * @see {@link https://base-ui.com/react/components/toast | Base UI Toast}
17
+ */
18
+ const ToastProvider = (props) => {
19
+ return /* @__PURE__ */ jsx(Toast$1.Provider, { ...props });
20
+ };
21
+ /**
22
+ * Container for displaying toasts.
23
+ */
24
+ function ToastViewport({ className = "", ref, ...props }) {
25
+ const classes = ["toast__viewport", className].filter(Boolean).join(" ");
26
+ return /* @__PURE__ */ jsx(Toast$1.Viewport, {
27
+ ref,
28
+ className: classes,
29
+ ...props
30
+ });
31
+ }
32
+ /**
33
+ * Individual toast wrapper.
34
+ */
35
+ function ToastRoot({ className = "", ref, ...props }) {
36
+ const classes = ["toast", className].filter(Boolean).join(" ");
37
+ return /* @__PURE__ */ jsx(Toast$1.Root, {
38
+ ref,
39
+ className: classes,
40
+ ...props
41
+ });
42
+ }
43
+ /**
44
+ * Container for the contents of a toast.
45
+ */
46
+ function ToastContent({ className = "", ref, ...props }) {
47
+ const classes = ["toast__content", className].filter(Boolean).join(" ");
48
+ return /* @__PURE__ */ jsx(Toast$1.Content, {
49
+ ref,
50
+ className: classes,
51
+ ...props
52
+ });
53
+ }
54
+ /**
55
+ * Title that labels the toast. Renders an `<h2>` element.
56
+ */
57
+ function ToastTitle({ className = "", ref, ...props }) {
58
+ const classes = ["toast__title", className].filter(Boolean).join(" ");
59
+ return /* @__PURE__ */ jsx(Toast$1.Title, {
60
+ ref,
61
+ className: classes,
62
+ ...props
63
+ });
64
+ }
65
+ /**
66
+ * Description text for the toast. Renders a `<p>` element.
67
+ */
68
+ function ToastDescription({ className = "", ref, ...props }) {
69
+ const classes = ["toast__description", className].filter(Boolean).join(" ");
70
+ return /* @__PURE__ */ jsx(Toast$1.Description, {
71
+ ref,
72
+ className: classes,
73
+ ...props
74
+ });
75
+ }
76
+ /**
77
+ * Action button within the toast.
78
+ */
79
+ function ToastAction({ className = "", ref, ...props }) {
80
+ const classes = ["toast__action", className].filter(Boolean).join(" ");
81
+ return /* @__PURE__ */ jsx(Toast$1.Action, {
82
+ ref,
83
+ className: classes,
84
+ ...props
85
+ });
86
+ }
87
+ /**
88
+ * Close button that dismisses the toast.
89
+ */
90
+ function ToastClose({ className = "", ref, ...props }) {
91
+ const classes = ["toast__close", className].filter(Boolean).join(" ");
92
+ return /* @__PURE__ */ jsx(Toast$1.Close, {
93
+ ref,
94
+ className: classes,
95
+ ...props
96
+ });
97
+ }
98
+ /**
99
+ * A toast notification system for displaying temporary messages.
100
+ * Supports multiple toasts, swipe-to-dismiss, and customizable positioning.
101
+ *
102
+ * @example
103
+ * ```tsx
104
+ * // Setup in your app root
105
+ * function App() {
106
+ * return (
107
+ * <Toast.Provider timeout={5000} limit={3}>
108
+ * <YourApp />
109
+ * <ToastViewport />
110
+ * </Toast.Provider>
111
+ * );
112
+ * }
113
+ *
114
+ * // Custom viewport that renders toasts
115
+ * function ToastViewport() {
116
+ * const { toasts } = Toast.useToastManager();
117
+ *
118
+ * return (
119
+ * <Toast.Viewport>
120
+ * {toasts.map((toast) => (
121
+ * <Toast.Root key={toast.id} toast={toast}>
122
+ * <Toast.Content>
123
+ * <Toast.Title>{toast.title}</Toast.Title>
124
+ * <Toast.Description>{toast.description}</Toast.Description>
125
+ * </Toast.Content>
126
+ * <Toast.Close>Dismiss</Toast.Close>
127
+ * </Toast.Root>
128
+ * ))}
129
+ * </Toast.Viewport>
130
+ * );
131
+ * }
132
+ *
133
+ * // Trigger toasts from anywhere
134
+ * function SomeComponent() {
135
+ * const toastManager = Toast.useToastManager();
136
+ *
137
+ * return (
138
+ * <button onClick={() => toastManager.add({
139
+ * title: 'Success',
140
+ * description: 'Your changes have been saved.'
141
+ * })}>
142
+ * Show Toast
143
+ * </button>
144
+ * );
145
+ * }
146
+ * ```
147
+ *
148
+ * @see {@link https://base-ui.com/react/components/toast | Base UI Toast}
149
+ */
150
+ const Toast = {
151
+ Provider: ToastProvider,
152
+ Viewport: ToastViewport,
153
+ Root: ToastRoot,
154
+ Content: ToastContent,
155
+ Title: ToastTitle,
156
+ Description: ToastDescription,
157
+ Action: ToastAction,
158
+ Close: ToastClose,
159
+ /** Hook to access the toast manager for adding/removing toasts */
160
+ useToastManager: Toast$1.useToastManager
161
+ };
162
+ //#endregion
163
+ export { Toast };