@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.
- 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 +16 -7
- package/dist/index.d.ts +0 -7236
- package/dist/index.js +0 -8945
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { n as ArrowLeftIcon, r as ArrowRightIcon } 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 * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { cjk } from "@streamdown/cjk";
|
|
8
|
+
import { code } from "@streamdown/code";
|
|
9
|
+
import { math } from "@streamdown/math";
|
|
10
|
+
import { mermaid } from "@streamdown/mermaid";
|
|
11
|
+
import { Streamdown } from "streamdown";
|
|
12
|
+
//#region src/components/Message.tsx
|
|
13
|
+
/**
|
|
14
|
+
* A chat message row. Aligns and styles itself based on {@link from}.
|
|
15
|
+
* Adapted from Vercel AI Elements and restyled with Sigvelo CSS tokens.
|
|
16
|
+
*
|
|
17
|
+
* Compose with {@link MessageContent} for the bubble, {@link MessageActions}
|
|
18
|
+
* for toolbar actions, and {@link MessageBranch} for multi-version responses.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <Message from="assistant">
|
|
23
|
+
* <MessageContent>Hello there!</MessageContent>
|
|
24
|
+
* <MessageActions>
|
|
25
|
+
* <MessageAction label="Copy" tooltip="Copy to clipboard">
|
|
26
|
+
* <CopyIcon />
|
|
27
|
+
* </MessageAction>
|
|
28
|
+
* </MessageActions>
|
|
29
|
+
* </Message>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @see {@link https://elements.ai-sdk.dev/components/message | AI Elements Message}
|
|
33
|
+
*/
|
|
34
|
+
function Message({ className, from = "assistant", children, ref, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsx("div", {
|
|
36
|
+
ref,
|
|
37
|
+
className: cx("message", className),
|
|
38
|
+
"data-from": from,
|
|
39
|
+
...props,
|
|
40
|
+
children
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The visible bubble/body of a message. Styled differently based on the
|
|
45
|
+
* parent {@link Message}'s `from` attribute.
|
|
46
|
+
*/
|
|
47
|
+
function MessageContent({ className, children, ref, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
ref,
|
|
50
|
+
className: cx("message__content", className),
|
|
51
|
+
...props,
|
|
52
|
+
children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const streamdownPlugins = {
|
|
56
|
+
cjk,
|
|
57
|
+
code,
|
|
58
|
+
math,
|
|
59
|
+
mermaid
|
|
60
|
+
};
|
|
61
|
+
const MessageResponse = React.memo(function MessageResponse({ className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx(Streamdown, {
|
|
63
|
+
className: cx("message__response", className),
|
|
64
|
+
plugins: streamdownPlugins,
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Horizontal list of action buttons (copy, retry, thumbs-up, etc.) shown
|
|
70
|
+
* alongside or beneath a message.
|
|
71
|
+
*/
|
|
72
|
+
function MessageActions({ className, children, ref, ...props }) {
|
|
73
|
+
return /* @__PURE__ */ jsx("div", {
|
|
74
|
+
ref,
|
|
75
|
+
className: cx("message__actions", className),
|
|
76
|
+
role: "toolbar",
|
|
77
|
+
...props,
|
|
78
|
+
children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A single icon button inside {@link MessageActions}. Always has an accessible
|
|
83
|
+
* name; shows a tooltip on hover/focus when {@link tooltip} is set.
|
|
84
|
+
*/
|
|
85
|
+
function MessageAction({ className, label, tooltip, variant = "ghost", color = "neutral", size = "sm", children, ref, ...props }) {
|
|
86
|
+
const button = /* @__PURE__ */ jsx(Button, {
|
|
87
|
+
ref,
|
|
88
|
+
type: "button",
|
|
89
|
+
variant,
|
|
90
|
+
color,
|
|
91
|
+
size,
|
|
92
|
+
className: cx("message__action", className),
|
|
93
|
+
"aria-label": label ?? tooltip,
|
|
94
|
+
...props,
|
|
95
|
+
children
|
|
96
|
+
});
|
|
97
|
+
if (!tooltip) return button;
|
|
98
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
99
|
+
sideOffset: 6,
|
|
100
|
+
children: /* @__PURE__ */ jsx(TooltipPopup, { children: tooltip })
|
|
101
|
+
}) })] });
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Horizontal container that places children in a row with space between —
|
|
105
|
+
* typically a {@link MessageBranchSelector} on one side and
|
|
106
|
+
* {@link MessageActions} on the other.
|
|
107
|
+
*/
|
|
108
|
+
function MessageToolbar({ className, children, ref, ...props }) {
|
|
109
|
+
return /* @__PURE__ */ jsx("div", {
|
|
110
|
+
ref,
|
|
111
|
+
className: cx("message__toolbar", className),
|
|
112
|
+
...props,
|
|
113
|
+
children
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const MessageBranchContext = React.createContext(null);
|
|
117
|
+
function useMessageBranch(component) {
|
|
118
|
+
const ctx = React.useContext(MessageBranchContext);
|
|
119
|
+
if (!ctx) throw new Error(`${component} must be used inside a <MessageBranch>.`);
|
|
120
|
+
return ctx;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Container for a message response with multiple versions. Tracks which
|
|
124
|
+
* branch is active and exposes navigation through {@link MessageBranchSelector},
|
|
125
|
+
* {@link MessageBranchPrevious}, {@link MessageBranchNext}, and {@link MessageBranchPage}.
|
|
126
|
+
*/
|
|
127
|
+
function MessageBranch({ className, defaultBranch = 0, branch, onBranchChange, children, ref, ...props }) {
|
|
128
|
+
const [internalIndex, setInternalIndex] = React.useState(defaultBranch);
|
|
129
|
+
const [branchCount, setBranchCount] = React.useState(0);
|
|
130
|
+
const isControlled = branch !== void 0;
|
|
131
|
+
const branchIndex = isControlled ? branch : internalIndex;
|
|
132
|
+
const setBranchIndex = React.useCallback((next) => {
|
|
133
|
+
if (!isControlled) setInternalIndex(next);
|
|
134
|
+
onBranchChange?.(next);
|
|
135
|
+
}, [isControlled, onBranchChange]);
|
|
136
|
+
const ctx = React.useMemo(() => ({
|
|
137
|
+
branchIndex,
|
|
138
|
+
branchCount,
|
|
139
|
+
setBranchIndex,
|
|
140
|
+
registerCount: setBranchCount
|
|
141
|
+
}), [
|
|
142
|
+
branchCount,
|
|
143
|
+
branchIndex,
|
|
144
|
+
setBranchIndex
|
|
145
|
+
]);
|
|
146
|
+
return /* @__PURE__ */ jsx(MessageBranchContext.Provider, {
|
|
147
|
+
value: ctx,
|
|
148
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
149
|
+
ref,
|
|
150
|
+
className: cx("message__branch", className),
|
|
151
|
+
...props,
|
|
152
|
+
children
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Renders only the active branch's child. Expects siblings to represent
|
|
158
|
+
* alternative versions of the same response.
|
|
159
|
+
*/
|
|
160
|
+
function MessageBranchContent({ className, children, ref, ...props }) {
|
|
161
|
+
const { branchIndex, registerCount } = useMessageBranch("MessageBranchContent");
|
|
162
|
+
const items = React.Children.toArray(children);
|
|
163
|
+
React.useEffect(() => {
|
|
164
|
+
registerCount(items.length);
|
|
165
|
+
}, [items.length, registerCount]);
|
|
166
|
+
const safeIndex = items.length === 0 ? 0 : Math.min(Math.max(branchIndex, 0), items.length - 1);
|
|
167
|
+
return /* @__PURE__ */ jsx("div", {
|
|
168
|
+
ref,
|
|
169
|
+
className: cx("message__branch-content", className),
|
|
170
|
+
...props,
|
|
171
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx("div", {
|
|
172
|
+
className: "message__branch-panel",
|
|
173
|
+
hidden: index !== safeIndex,
|
|
174
|
+
children: item
|
|
175
|
+
}, React.isValidElement(item) && item.key != null ? item.key : index))
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Inline group containing branch navigation controls (previous / page /
|
|
180
|
+
* next). Hidden automatically when there is only one branch.
|
|
181
|
+
*/
|
|
182
|
+
function MessageBranchSelector({ className, children, ref, ...props }) {
|
|
183
|
+
const { branchCount } = useMessageBranch("MessageBranchSelector");
|
|
184
|
+
if (branchCount <= 1) return null;
|
|
185
|
+
return /* @__PURE__ */ jsx("div", {
|
|
186
|
+
ref,
|
|
187
|
+
className: cx("message__branch-selector", className),
|
|
188
|
+
...props,
|
|
189
|
+
children
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/** Button that selects the previous branch. Disabled at the first branch. */
|
|
193
|
+
function MessageBranchPrevious({ className, label = "Previous response", variant = "ghost", color = "neutral", size = "sm", children, onClick, ref, ...props }) {
|
|
194
|
+
const { branchIndex, branchCount, setBranchIndex } = useMessageBranch("MessageBranchPrevious");
|
|
195
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
196
|
+
ref,
|
|
197
|
+
type: "button",
|
|
198
|
+
variant,
|
|
199
|
+
color,
|
|
200
|
+
size,
|
|
201
|
+
disabled: branchCount <= 1,
|
|
202
|
+
className: cx("message__branch-prev", className),
|
|
203
|
+
"aria-label": label,
|
|
204
|
+
onClick: (event) => {
|
|
205
|
+
onClick?.(event);
|
|
206
|
+
if (!event.defaultPrevented) setBranchIndex(branchIndex > 0 ? branchIndex - 1 : branchCount - 1);
|
|
207
|
+
},
|
|
208
|
+
...props,
|
|
209
|
+
children: children ?? /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
/** Button that selects the next branch. Disabled at the last branch. */
|
|
213
|
+
function MessageBranchNext({ className, label = "Next response", variant = "ghost", color = "neutral", size = "sm", children, onClick, ref, ...props }) {
|
|
214
|
+
const { branchIndex, branchCount, setBranchIndex } = useMessageBranch("MessageBranchNext");
|
|
215
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
216
|
+
ref,
|
|
217
|
+
type: "button",
|
|
218
|
+
variant,
|
|
219
|
+
color,
|
|
220
|
+
size,
|
|
221
|
+
disabled: branchCount <= 1,
|
|
222
|
+
className: cx("message__branch-next", className),
|
|
223
|
+
"aria-label": label,
|
|
224
|
+
onClick: (event) => {
|
|
225
|
+
onClick?.(event);
|
|
226
|
+
if (!event.defaultPrevented) setBranchIndex(branchIndex < branchCount - 1 ? branchIndex + 1 : 0);
|
|
227
|
+
},
|
|
228
|
+
...props,
|
|
229
|
+
children: children ?? /* @__PURE__ */ jsx(ArrowRightIcon, {})
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/** Page indicator (e.g. "1 / 3") for the current branch selection. */
|
|
233
|
+
function MessageBranchPage({ className, format, ref, ...props }) {
|
|
234
|
+
const { branchIndex, branchCount } = useMessageBranch("MessageBranchPage");
|
|
235
|
+
const label = format ? format(branchIndex + 1, branchCount) : `${branchIndex + 1} / ${branchCount}`;
|
|
236
|
+
return /* @__PURE__ */ jsx("span", {
|
|
237
|
+
ref,
|
|
238
|
+
className: cx("message__branch-page", className),
|
|
239
|
+
"aria-live": "polite",
|
|
240
|
+
...props,
|
|
241
|
+
children: label
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
export { Message, MessageAction, MessageActions, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageResponse, MessageToolbar };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Meter as Meter$1 } from "@base-ui/react/meter";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Meter.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props for the Meter.Root component.
|
|
7
|
+
*/
|
|
8
|
+
interface MeterRootProps extends Omit<React.ComponentPropsWithoutRef<typeof Meter$1.Root>, "className"> {
|
|
9
|
+
/** Additional CSS class names */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Props for the Meter.Track component.
|
|
14
|
+
*/
|
|
15
|
+
interface MeterTrackProps extends Omit<React.ComponentPropsWithoutRef<typeof Meter$1.Track>, "className"> {
|
|
16
|
+
/** Additional CSS class names */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Props for the Meter.Indicator component.
|
|
21
|
+
*/
|
|
22
|
+
interface MeterIndicatorProps extends Omit<React.ComponentPropsWithoutRef<typeof Meter$1.Indicator>, "className"> {
|
|
23
|
+
/** Additional CSS class names */
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for the Meter.Label component.
|
|
28
|
+
*/
|
|
29
|
+
interface MeterLabelProps extends Omit<React.ComponentPropsWithoutRef<typeof Meter$1.Label>, "className"> {
|
|
30
|
+
/** Additional CSS class names */
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Props for the Meter.Value component.
|
|
35
|
+
*/
|
|
36
|
+
interface MeterValueProps extends Omit<React.ComponentPropsWithoutRef<typeof Meter$1.Value>, "className"> {
|
|
37
|
+
/** Additional CSS class names */
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Container that groups all meter parts. Renders a `<div>` element.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <Meter.Root value={75}>
|
|
46
|
+
* <Meter.Label>Progress</Meter.Label>
|
|
47
|
+
* <Meter.Value />
|
|
48
|
+
* <Meter.Track>
|
|
49
|
+
* <Meter.Indicator />
|
|
50
|
+
* </Meter.Track>
|
|
51
|
+
* </Meter.Root>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @see {@link https://base-ui.com/react/components/meter | Base UI Meter}
|
|
55
|
+
*/
|
|
56
|
+
declare function MeterRoot({
|
|
57
|
+
className,
|
|
58
|
+
ref,
|
|
59
|
+
...props
|
|
60
|
+
}: MeterRootProps & {
|
|
61
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
62
|
+
}): React.JSX.Element;
|
|
63
|
+
/**
|
|
64
|
+
* The track that contains the indicator. Represents the full range.
|
|
65
|
+
*/
|
|
66
|
+
declare function MeterTrack({
|
|
67
|
+
className,
|
|
68
|
+
ref,
|
|
69
|
+
...props
|
|
70
|
+
}: MeterTrackProps & {
|
|
71
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
72
|
+
}): React.JSX.Element;
|
|
73
|
+
/**
|
|
74
|
+
* The indicator that visualizes the current value.
|
|
75
|
+
*/
|
|
76
|
+
declare function MeterIndicator({
|
|
77
|
+
className,
|
|
78
|
+
ref,
|
|
79
|
+
...props
|
|
80
|
+
}: MeterIndicatorProps & {
|
|
81
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
82
|
+
}): React.JSX.Element;
|
|
83
|
+
/**
|
|
84
|
+
* Accessible label for the meter.
|
|
85
|
+
*/
|
|
86
|
+
declare function MeterLabel({
|
|
87
|
+
className,
|
|
88
|
+
ref,
|
|
89
|
+
...props
|
|
90
|
+
}: MeterLabelProps & {
|
|
91
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
92
|
+
}): React.JSX.Element;
|
|
93
|
+
/**
|
|
94
|
+
* Displays the current value as text.
|
|
95
|
+
*/
|
|
96
|
+
declare function MeterValue({
|
|
97
|
+
className,
|
|
98
|
+
ref,
|
|
99
|
+
...props
|
|
100
|
+
}: MeterValueProps & {
|
|
101
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
102
|
+
}): React.JSX.Element;
|
|
103
|
+
/**
|
|
104
|
+
* A graphical display of a numeric value within a range.
|
|
105
|
+
* Unlike Progress, Meter is for displaying a value, not task completion.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* // Basic usage
|
|
110
|
+
* <Meter.Root value={75}>
|
|
111
|
+
* <Meter.Track>
|
|
112
|
+
* <Meter.Indicator />
|
|
113
|
+
* </Meter.Track>
|
|
114
|
+
* </Meter.Root>
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* // With label and value display
|
|
120
|
+
* <Meter.Root value={24} max={100}>
|
|
121
|
+
* <div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
122
|
+
* <Meter.Label>Storage Used</Meter.Label>
|
|
123
|
+
* <Meter.Value />
|
|
124
|
+
* </div>
|
|
125
|
+
* <Meter.Track>
|
|
126
|
+
* <Meter.Indicator />
|
|
127
|
+
* </Meter.Track>
|
|
128
|
+
* </Meter.Root>
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* // With custom formatting
|
|
134
|
+
* <Meter.Root value={0.75} min={0} max={1} format={{ style: 'percent' }}>
|
|
135
|
+
* <Meter.Track>
|
|
136
|
+
* <Meter.Indicator />
|
|
137
|
+
* </Meter.Track>
|
|
138
|
+
* </Meter.Root>
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @see {@link https://base-ui.com/react/components/meter | Base UI Meter}
|
|
142
|
+
*/
|
|
143
|
+
declare const Meter: {
|
|
144
|
+
Root: typeof MeterRoot;
|
|
145
|
+
Track: typeof MeterTrack;
|
|
146
|
+
Indicator: typeof MeterIndicator;
|
|
147
|
+
Label: typeof MeterLabel;
|
|
148
|
+
Value: typeof MeterValue;
|
|
149
|
+
};
|
|
150
|
+
//#endregion
|
|
151
|
+
export { Meter, MeterIndicatorProps, MeterLabelProps, MeterRootProps, MeterTrackProps, MeterValueProps };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Meter as Meter$1 } from "@base-ui/react/meter";
|
|
4
|
+
//#region src/components/Meter.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Container that groups all meter parts. Renders a `<div>` element.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Meter.Root value={75}>
|
|
11
|
+
* <Meter.Label>Progress</Meter.Label>
|
|
12
|
+
* <Meter.Value />
|
|
13
|
+
* <Meter.Track>
|
|
14
|
+
* <Meter.Indicator />
|
|
15
|
+
* </Meter.Track>
|
|
16
|
+
* </Meter.Root>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://base-ui.com/react/components/meter | Base UI Meter}
|
|
20
|
+
*/
|
|
21
|
+
function MeterRoot({ className = "", ref, ...props }) {
|
|
22
|
+
const classes = ["meter", className].filter(Boolean).join(" ");
|
|
23
|
+
return /* @__PURE__ */ jsx(Meter$1.Root, {
|
|
24
|
+
ref,
|
|
25
|
+
className: classes,
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The track that contains the indicator. Represents the full range.
|
|
31
|
+
*/
|
|
32
|
+
function MeterTrack({ className = "", ref, ...props }) {
|
|
33
|
+
const classes = ["meter__track", className].filter(Boolean).join(" ");
|
|
34
|
+
return /* @__PURE__ */ jsx(Meter$1.Track, {
|
|
35
|
+
ref,
|
|
36
|
+
className: classes,
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The indicator that visualizes the current value.
|
|
42
|
+
*/
|
|
43
|
+
function MeterIndicator({ className = "", ref, ...props }) {
|
|
44
|
+
const classes = ["meter__indicator", className].filter(Boolean).join(" ");
|
|
45
|
+
return /* @__PURE__ */ jsx(Meter$1.Indicator, {
|
|
46
|
+
ref,
|
|
47
|
+
className: classes,
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Accessible label for the meter.
|
|
53
|
+
*/
|
|
54
|
+
function MeterLabel({ className = "", ref, ...props }) {
|
|
55
|
+
const classes = ["meter__label", className].filter(Boolean).join(" ");
|
|
56
|
+
return /* @__PURE__ */ jsx(Meter$1.Label, {
|
|
57
|
+
ref,
|
|
58
|
+
className: classes,
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Displays the current value as text.
|
|
64
|
+
*/
|
|
65
|
+
function MeterValue({ className = "", ref, ...props }) {
|
|
66
|
+
const classes = ["meter__value", className].filter(Boolean).join(" ");
|
|
67
|
+
return /* @__PURE__ */ jsx(Meter$1.Value, {
|
|
68
|
+
ref,
|
|
69
|
+
className: classes,
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A graphical display of a numeric value within a range.
|
|
75
|
+
* Unlike Progress, Meter is for displaying a value, not task completion.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* // Basic usage
|
|
80
|
+
* <Meter.Root value={75}>
|
|
81
|
+
* <Meter.Track>
|
|
82
|
+
* <Meter.Indicator />
|
|
83
|
+
* </Meter.Track>
|
|
84
|
+
* </Meter.Root>
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* // With label and value display
|
|
90
|
+
* <Meter.Root value={24} max={100}>
|
|
91
|
+
* <div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
92
|
+
* <Meter.Label>Storage Used</Meter.Label>
|
|
93
|
+
* <Meter.Value />
|
|
94
|
+
* </div>
|
|
95
|
+
* <Meter.Track>
|
|
96
|
+
* <Meter.Indicator />
|
|
97
|
+
* </Meter.Track>
|
|
98
|
+
* </Meter.Root>
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* // With custom formatting
|
|
104
|
+
* <Meter.Root value={0.75} min={0} max={1} format={{ style: 'percent' }}>
|
|
105
|
+
* <Meter.Track>
|
|
106
|
+
* <Meter.Indicator />
|
|
107
|
+
* </Meter.Track>
|
|
108
|
+
* </Meter.Root>
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @see {@link https://base-ui.com/react/components/meter | Base UI Meter}
|
|
112
|
+
*/
|
|
113
|
+
const Meter = {
|
|
114
|
+
Root: MeterRoot,
|
|
115
|
+
Track: MeterTrack,
|
|
116
|
+
Indicator: MeterIndicator,
|
|
117
|
+
Label: MeterLabel,
|
|
118
|
+
Value: MeterValue
|
|
119
|
+
};
|
|
120
|
+
//#endregion
|
|
121
|
+
export { Meter };
|