@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,187 @@
|
|
|
1
|
+
import { a as BrainIcon, c as ChevronRightIcon } from "../icons-BsWc8g4E.js";
|
|
2
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
+
import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cjk } from "@streamdown/cjk";
|
|
7
|
+
import { code } from "@streamdown/code";
|
|
8
|
+
import { math } from "@streamdown/math";
|
|
9
|
+
import { mermaid } from "@streamdown/mermaid";
|
|
10
|
+
import { Streamdown } from "streamdown";
|
|
11
|
+
//#region src/components/Reasoning.tsx
|
|
12
|
+
const ReasoningContext = React.createContext(null);
|
|
13
|
+
const AUTO_CLOSE_DELAY_MS = 1e3;
|
|
14
|
+
const MS_IN_S = 1e3;
|
|
15
|
+
function useReasoning() {
|
|
16
|
+
const ctx = React.useContext(ReasoningContext);
|
|
17
|
+
if (!ctx) throw new Error("Reasoning subcomponents must be used inside <Reasoning>.");
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A collapsible "thinking" block for showing model reasoning (e.g. DeepSeek
|
|
22
|
+
* R1, OpenAI o-series). Auto-expands while streaming and collapses when done.
|
|
23
|
+
* Adapted from Vercel AI Elements and restyled with Sigvelo CSS tokens.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Reasoning isStreaming={isThinking} duration={elapsed}>
|
|
28
|
+
* <ReasoningTrigger />
|
|
29
|
+
* <ReasoningContent>{reasoningText}</ReasoningContent>
|
|
30
|
+
* </Reasoning>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see {@link https://elements.ai-sdk.dev/components/reasoning | AI Elements Reasoning}
|
|
34
|
+
*/
|
|
35
|
+
function Reasoning({ className, isStreaming = false, duration, open, defaultOpen, onOpenChange, children, ref, ...props }) {
|
|
36
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? isStreaming);
|
|
37
|
+
const [internalDuration, setInternalDuration] = React.useState(duration);
|
|
38
|
+
const previousStreamingRef = React.useRef(isStreaming);
|
|
39
|
+
const startTimeRef = React.useRef(isStreaming ? Date.now() : null);
|
|
40
|
+
const hasEverStreamedRef = React.useRef(isStreaming);
|
|
41
|
+
const [hasAutoClosed, setHasAutoClosed] = React.useState(false);
|
|
42
|
+
const isControlled = open !== void 0;
|
|
43
|
+
const currentOpen = isControlled ? open : internalOpen;
|
|
44
|
+
const preventAutoOpen = defaultOpen === false;
|
|
45
|
+
const resolvedDuration = duration ?? internalDuration;
|
|
46
|
+
const setOpenState = React.useCallback((next) => {
|
|
47
|
+
if (next === currentOpen) return;
|
|
48
|
+
if (!isControlled) setInternalOpen(next);
|
|
49
|
+
onOpenChange?.(next);
|
|
50
|
+
}, [
|
|
51
|
+
currentOpen,
|
|
52
|
+
isControlled,
|
|
53
|
+
onOpenChange
|
|
54
|
+
]);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (duration !== void 0) setInternalDuration(duration);
|
|
57
|
+
}, [duration]);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
if (isStreaming) {
|
|
60
|
+
hasEverStreamedRef.current = true;
|
|
61
|
+
setHasAutoClosed(false);
|
|
62
|
+
if (duration === void 0) setInternalDuration(void 0);
|
|
63
|
+
if (startTimeRef.current === null) startTimeRef.current = Date.now();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (startTimeRef.current !== null) {
|
|
67
|
+
if (duration === void 0) setInternalDuration(Math.max(1, Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S)));
|
|
68
|
+
startTimeRef.current = null;
|
|
69
|
+
}
|
|
70
|
+
}, [duration, isStreaming]);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
const wasStreaming = previousStreamingRef.current;
|
|
73
|
+
if (isStreaming && !currentOpen && !preventAutoOpen) setOpenState(true);
|
|
74
|
+
if (!isStreaming && wasStreaming && hasEverStreamedRef.current && currentOpen && !hasAutoClosed) {
|
|
75
|
+
const closeTimer = window.setTimeout(() => {
|
|
76
|
+
setOpenState(false);
|
|
77
|
+
setHasAutoClosed(true);
|
|
78
|
+
}, AUTO_CLOSE_DELAY_MS);
|
|
79
|
+
previousStreamingRef.current = isStreaming;
|
|
80
|
+
return () => window.clearTimeout(closeTimer);
|
|
81
|
+
}
|
|
82
|
+
previousStreamingRef.current = isStreaming;
|
|
83
|
+
}, [
|
|
84
|
+
currentOpen,
|
|
85
|
+
hasAutoClosed,
|
|
86
|
+
isStreaming,
|
|
87
|
+
preventAutoOpen,
|
|
88
|
+
setOpenState
|
|
89
|
+
]);
|
|
90
|
+
const handleOpenChange = React.useCallback((next) => {
|
|
91
|
+
setOpenState(next);
|
|
92
|
+
}, [setOpenState]);
|
|
93
|
+
const ctx = React.useMemo(() => ({
|
|
94
|
+
isStreaming,
|
|
95
|
+
isOpen: currentOpen,
|
|
96
|
+
setIsOpen: setOpenState,
|
|
97
|
+
duration: resolvedDuration
|
|
98
|
+
}), [
|
|
99
|
+
currentOpen,
|
|
100
|
+
isStreaming,
|
|
101
|
+
resolvedDuration,
|
|
102
|
+
setOpenState
|
|
103
|
+
]);
|
|
104
|
+
return /* @__PURE__ */ jsx(ReasoningContext.Provider, {
|
|
105
|
+
value: ctx,
|
|
106
|
+
children: /* @__PURE__ */ jsx(CollapsibleRoot, {
|
|
107
|
+
ref,
|
|
108
|
+
className: cx("reasoning", className),
|
|
109
|
+
open: currentOpen,
|
|
110
|
+
onOpenChange: handleOpenChange,
|
|
111
|
+
"data-streaming": isStreaming ? "" : void 0,
|
|
112
|
+
...props,
|
|
113
|
+
unstyled: true,
|
|
114
|
+
children
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function defaultGetThinkingMessage(isStreaming, duration) {
|
|
119
|
+
if (isStreaming || duration === 0) return "Thinking...";
|
|
120
|
+
if (duration === void 0) return "Thought for a few seconds";
|
|
121
|
+
return `Thought for ${duration} second${duration === 1 ? "" : "s"}`;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Trigger that toggles the reasoning panel. Shows "Thinking..." while
|
|
125
|
+
* streaming and "Thought for Ns" afterward.
|
|
126
|
+
*/
|
|
127
|
+
function ReasoningTrigger({ className, children, getThinkingMessage = defaultGetThinkingMessage, ref, ...props }) {
|
|
128
|
+
const { isStreaming, duration } = useReasoning();
|
|
129
|
+
if (children !== void 0 && children !== null) return /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
130
|
+
ref,
|
|
131
|
+
className: cx("reasoning__trigger", className),
|
|
132
|
+
"data-streaming": isStreaming ? "" : void 0,
|
|
133
|
+
...props,
|
|
134
|
+
unstyled: true,
|
|
135
|
+
children
|
|
136
|
+
});
|
|
137
|
+
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
138
|
+
ref,
|
|
139
|
+
className: cx("reasoning__trigger", className),
|
|
140
|
+
"data-streaming": isStreaming ? "" : void 0,
|
|
141
|
+
...props,
|
|
142
|
+
unstyled: true,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsx("span", {
|
|
145
|
+
className: "reasoning__trigger-leading-icon",
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
children: /* @__PURE__ */ jsx(BrainIcon, {})
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ jsx("span", {
|
|
150
|
+
className: "reasoning__trigger-label",
|
|
151
|
+
children: getThinkingMessage(isStreaming, duration)
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "reasoning__trigger-icon",
|
|
155
|
+
"aria-hidden": "true",
|
|
156
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
const streamdownPlugins = {
|
|
162
|
+
cjk,
|
|
163
|
+
code,
|
|
164
|
+
math,
|
|
165
|
+
mermaid
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* The reasoning text panel. Accepts any React node but is optimized for
|
|
169
|
+
* long-form text; a muted left border visually distinguishes the block.
|
|
170
|
+
*/
|
|
171
|
+
function ReasoningContent({ className, children, ref, ...props }) {
|
|
172
|
+
return /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
173
|
+
ref,
|
|
174
|
+
className: cx("reasoning__content", className),
|
|
175
|
+
...props,
|
|
176
|
+
unstyled: true,
|
|
177
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
178
|
+
className: "reasoning__text",
|
|
179
|
+
children: typeof children === "string" ? /* @__PURE__ */ jsx(Streamdown, {
|
|
180
|
+
plugins: streamdownPlugins,
|
|
181
|
+
children
|
|
182
|
+
}) : children
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { Reasoning, ReasoningContent, ReasoningTrigger, useReasoning };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ScrollArea.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props for the ScrollArea.Root component.
|
|
7
|
+
*/
|
|
8
|
+
interface ScrollAreaRootProps extends Omit<React.ComponentPropsWithoutRef<typeof ScrollArea$1.Root>, "className"> {
|
|
9
|
+
/** Additional CSS class names */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Props for the ScrollArea.Viewport component.
|
|
14
|
+
*/
|
|
15
|
+
interface ScrollAreaViewportProps extends Omit<React.ComponentPropsWithoutRef<typeof ScrollArea$1.Viewport>, "className"> {
|
|
16
|
+
/** Additional CSS class names */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Props for the ScrollArea.Scrollbar component.
|
|
21
|
+
*/
|
|
22
|
+
interface ScrollAreaScrollbarProps extends Omit<React.ComponentPropsWithoutRef<typeof ScrollArea$1.Scrollbar>, "className"> {
|
|
23
|
+
/** Additional CSS class names */
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for the ScrollArea.Thumb component.
|
|
28
|
+
*/
|
|
29
|
+
interface ScrollAreaThumbProps extends Omit<React.ComponentPropsWithoutRef<typeof ScrollArea$1.Thumb>, "className"> {
|
|
30
|
+
/** Additional CSS class names */
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Props for the ScrollArea.Corner component.
|
|
35
|
+
*/
|
|
36
|
+
interface ScrollAreaCornerProps extends Omit<React.ComponentPropsWithoutRef<typeof ScrollArea$1.Corner>, "className"> {
|
|
37
|
+
/** Additional CSS class names */
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Container that groups all scroll area parts. Renders a `<div>` element.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <ScrollArea.Root>
|
|
46
|
+
* <ScrollArea.Viewport>
|
|
47
|
+
* <div>Scrollable content...</div>
|
|
48
|
+
* </ScrollArea.Viewport>
|
|
49
|
+
* <ScrollArea.Scrollbar>
|
|
50
|
+
* <ScrollArea.Thumb />
|
|
51
|
+
* </ScrollArea.Scrollbar>
|
|
52
|
+
* </ScrollArea.Root>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @see {@link https://base-ui.com/react/components/scroll-area | Base UI ScrollArea}
|
|
56
|
+
*/
|
|
57
|
+
declare function ScrollAreaRoot({
|
|
58
|
+
className,
|
|
59
|
+
ref,
|
|
60
|
+
...props
|
|
61
|
+
}: ScrollAreaRootProps & {
|
|
62
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
63
|
+
}): React.JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* The scrollable viewport container.
|
|
66
|
+
*/
|
|
67
|
+
declare function ScrollAreaViewport({
|
|
68
|
+
className,
|
|
69
|
+
tabIndex,
|
|
70
|
+
role,
|
|
71
|
+
"aria-label": ariaLabel,
|
|
72
|
+
"aria-labelledby": ariaLabelledBy,
|
|
73
|
+
ref,
|
|
74
|
+
...props
|
|
75
|
+
}: ScrollAreaViewportProps & {
|
|
76
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
77
|
+
}): React.JSX.Element;
|
|
78
|
+
/**
|
|
79
|
+
* The scrollbar track, either vertical or horizontal.
|
|
80
|
+
*/
|
|
81
|
+
declare function ScrollAreaScrollbar({
|
|
82
|
+
className,
|
|
83
|
+
orientation,
|
|
84
|
+
ref,
|
|
85
|
+
...props
|
|
86
|
+
}: ScrollAreaScrollbarProps & {
|
|
87
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
88
|
+
}): React.JSX.Element;
|
|
89
|
+
declare const ScrollBar: typeof ScrollAreaScrollbar;
|
|
90
|
+
/**
|
|
91
|
+
* The draggable scrollbar thumb indicator.
|
|
92
|
+
*/
|
|
93
|
+
declare function ScrollAreaThumb({
|
|
94
|
+
className,
|
|
95
|
+
ref,
|
|
96
|
+
...props
|
|
97
|
+
}: ScrollAreaThumbProps & {
|
|
98
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
99
|
+
}): React.JSX.Element;
|
|
100
|
+
/**
|
|
101
|
+
* Small rectangle at the intersection of scrollbars.
|
|
102
|
+
*/
|
|
103
|
+
declare function ScrollAreaCorner({
|
|
104
|
+
className,
|
|
105
|
+
ref,
|
|
106
|
+
...props
|
|
107
|
+
}: ScrollAreaCornerProps & {
|
|
108
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
109
|
+
}): React.JSX.Element;
|
|
110
|
+
declare function ScrollAreaDefault({
|
|
111
|
+
children,
|
|
112
|
+
...props
|
|
113
|
+
}: ScrollAreaRootProps & {
|
|
114
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
115
|
+
}): React.JSX.Element;
|
|
116
|
+
/**
|
|
117
|
+
* A native scroll container with custom-styled scrollbars.
|
|
118
|
+
* Provides smooth scrolling and customizable appearance.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* // Vertical scroll
|
|
123
|
+
* <ScrollArea.Root style={{ height: 200 }}>
|
|
124
|
+
* <ScrollArea.Viewport>
|
|
125
|
+
* <div>Long content...</div>
|
|
126
|
+
* </ScrollArea.Viewport>
|
|
127
|
+
* <ScrollArea.Scrollbar>
|
|
128
|
+
* <ScrollArea.Thumb />
|
|
129
|
+
* </ScrollArea.Scrollbar>
|
|
130
|
+
* </ScrollArea.Root>
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* // Both scrollbars
|
|
136
|
+
* <ScrollArea.Root style={{ height: 200, width: 300 }}>
|
|
137
|
+
* <ScrollArea.Viewport>
|
|
138
|
+
* <div style={{ width: 600 }}>Wide and tall content...</div>
|
|
139
|
+
* </ScrollArea.Viewport>
|
|
140
|
+
* <ScrollArea.Scrollbar orientation="vertical">
|
|
141
|
+
* <ScrollArea.Thumb />
|
|
142
|
+
* </ScrollArea.Scrollbar>
|
|
143
|
+
* <ScrollArea.Scrollbar orientation="horizontal">
|
|
144
|
+
* <ScrollArea.Thumb />
|
|
145
|
+
* </ScrollArea.Scrollbar>
|
|
146
|
+
* <ScrollArea.Corner />
|
|
147
|
+
* </ScrollArea.Root>
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @see {@link https://base-ui.com/react/components/scroll-area | Base UI ScrollArea}
|
|
151
|
+
*/
|
|
152
|
+
declare const ScrollArea: typeof ScrollAreaDefault & {
|
|
153
|
+
Root: typeof ScrollAreaRoot;
|
|
154
|
+
Viewport: typeof ScrollAreaViewport;
|
|
155
|
+
Scrollbar: typeof ScrollAreaScrollbar;
|
|
156
|
+
Thumb: typeof ScrollAreaThumb;
|
|
157
|
+
Corner: typeof ScrollAreaCorner;
|
|
158
|
+
};
|
|
159
|
+
//#endregion
|
|
160
|
+
export { ScrollArea, ScrollAreaCorner, ScrollAreaCornerProps, ScrollAreaRoot, ScrollAreaRootProps, ScrollAreaScrollbar, ScrollAreaScrollbarProps, ScrollAreaThumb, ScrollAreaThumbProps, ScrollAreaViewport, ScrollAreaViewportProps, ScrollBar };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
4
|
+
//#region src/components/ScrollArea.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Container that groups all scroll area parts. Renders a `<div>` element.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <ScrollArea.Root>
|
|
11
|
+
* <ScrollArea.Viewport>
|
|
12
|
+
* <div>Scrollable content...</div>
|
|
13
|
+
* </ScrollArea.Viewport>
|
|
14
|
+
* <ScrollArea.Scrollbar>
|
|
15
|
+
* <ScrollArea.Thumb />
|
|
16
|
+
* </ScrollArea.Scrollbar>
|
|
17
|
+
* </ScrollArea.Root>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @see {@link https://base-ui.com/react/components/scroll-area | Base UI ScrollArea}
|
|
21
|
+
*/
|
|
22
|
+
function ScrollAreaRoot({ className = "", ref, ...props }) {
|
|
23
|
+
const classes = ["scroll-area", className].filter(Boolean).join(" ");
|
|
24
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.Root, {
|
|
25
|
+
ref,
|
|
26
|
+
"data-slot": "scroll-area",
|
|
27
|
+
className: classes,
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The scrollable viewport container.
|
|
33
|
+
*/
|
|
34
|
+
function ScrollAreaViewport({ className = "", tabIndex = 0, role = "group", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...props }) {
|
|
35
|
+
const classes = ["scroll-area__viewport", className].filter(Boolean).join(" ");
|
|
36
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
|
|
37
|
+
ref,
|
|
38
|
+
"data-slot": "scroll-area-viewport",
|
|
39
|
+
role,
|
|
40
|
+
"aria-label": ariaLabel ?? (ariaLabelledBy ? void 0 : "Scrollable content"),
|
|
41
|
+
"aria-labelledby": ariaLabelledBy,
|
|
42
|
+
tabIndex,
|
|
43
|
+
className: classes,
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The scrollbar track, either vertical or horizontal.
|
|
49
|
+
*/
|
|
50
|
+
function ScrollAreaScrollbar({ className = "", orientation = "vertical", ref, ...props }) {
|
|
51
|
+
const classes = ["scroll-area__scrollbar", className].filter(Boolean).join(" ");
|
|
52
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
|
|
53
|
+
ref,
|
|
54
|
+
"data-slot": "scroll-area-scrollbar",
|
|
55
|
+
orientation,
|
|
56
|
+
className: classes,
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const ScrollBar = ScrollAreaScrollbar;
|
|
61
|
+
/**
|
|
62
|
+
* The draggable scrollbar thumb indicator.
|
|
63
|
+
*/
|
|
64
|
+
function ScrollAreaThumb({ className = "", ref, ...props }) {
|
|
65
|
+
const classes = ["scroll-area__thumb", className].filter(Boolean).join(" ");
|
|
66
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.Thumb, {
|
|
67
|
+
ref,
|
|
68
|
+
"data-slot": "scroll-area-thumb",
|
|
69
|
+
className: classes,
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Small rectangle at the intersection of scrollbars.
|
|
75
|
+
*/
|
|
76
|
+
function ScrollAreaCorner({ className = "", ref, ...props }) {
|
|
77
|
+
const classes = ["scroll-area__corner", className].filter(Boolean).join(" ");
|
|
78
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.Corner, {
|
|
79
|
+
ref,
|
|
80
|
+
className: classes,
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function hasScrollAreaParts(children) {
|
|
85
|
+
return React.Children.toArray(children).some((child) => React.isValidElement(child) && (child.type === ScrollAreaViewport || child.type === ScrollAreaScrollbar || child.type === ScrollAreaCorner));
|
|
86
|
+
}
|
|
87
|
+
function ScrollAreaDefault({ children, ...props }) {
|
|
88
|
+
if (hasScrollAreaParts(children)) return /* @__PURE__ */ jsx(ScrollAreaRoot, {
|
|
89
|
+
...props,
|
|
90
|
+
children
|
|
91
|
+
});
|
|
92
|
+
return /* @__PURE__ */ jsxs(ScrollAreaRoot, {
|
|
93
|
+
...props,
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx(ScrollAreaViewport, { children }),
|
|
96
|
+
/* @__PURE__ */ jsx(ScrollAreaScrollbar, { children: /* @__PURE__ */ jsx(ScrollAreaThumb, {}) }),
|
|
97
|
+
/* @__PURE__ */ jsx(ScrollAreaCorner, {})
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A native scroll container with custom-styled scrollbars.
|
|
103
|
+
* Provides smooth scrolling and customizable appearance.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* // Vertical scroll
|
|
108
|
+
* <ScrollArea.Root style={{ height: 200 }}>
|
|
109
|
+
* <ScrollArea.Viewport>
|
|
110
|
+
* <div>Long content...</div>
|
|
111
|
+
* </ScrollArea.Viewport>
|
|
112
|
+
* <ScrollArea.Scrollbar>
|
|
113
|
+
* <ScrollArea.Thumb />
|
|
114
|
+
* </ScrollArea.Scrollbar>
|
|
115
|
+
* </ScrollArea.Root>
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```tsx
|
|
120
|
+
* // Both scrollbars
|
|
121
|
+
* <ScrollArea.Root style={{ height: 200, width: 300 }}>
|
|
122
|
+
* <ScrollArea.Viewport>
|
|
123
|
+
* <div style={{ width: 600 }}>Wide and tall content...</div>
|
|
124
|
+
* </ScrollArea.Viewport>
|
|
125
|
+
* <ScrollArea.Scrollbar orientation="vertical">
|
|
126
|
+
* <ScrollArea.Thumb />
|
|
127
|
+
* </ScrollArea.Scrollbar>
|
|
128
|
+
* <ScrollArea.Scrollbar orientation="horizontal">
|
|
129
|
+
* <ScrollArea.Thumb />
|
|
130
|
+
* </ScrollArea.Scrollbar>
|
|
131
|
+
* <ScrollArea.Corner />
|
|
132
|
+
* </ScrollArea.Root>
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @see {@link https://base-ui.com/react/components/scroll-area | Base UI ScrollArea}
|
|
136
|
+
*/
|
|
137
|
+
const ScrollArea = Object.assign(ScrollAreaDefault, {
|
|
138
|
+
Root: ScrollAreaRoot,
|
|
139
|
+
Viewport: ScrollAreaViewport,
|
|
140
|
+
Scrollbar: ScrollAreaScrollbar,
|
|
141
|
+
Thumb: ScrollAreaThumb,
|
|
142
|
+
Corner: ScrollAreaCorner
|
|
143
|
+
});
|
|
144
|
+
//#endregion
|
|
145
|
+
export { ScrollArea, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, ScrollBar };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as SelectTriggerProps, C as SelectScrollDownButton, D as SelectSeparator, E as SelectScrollUpButtonProps, M as SelectValueProps, O as SelectSeparatorProps, S as SelectProps, T as SelectScrollUpButton, _ as SelectPopupProps, a as SelectGroupProps, b as SelectPositioner, c as SelectLabel, d as SelectListProps, f as SelectOption, g as SelectPopup, h as SelectOptionProps, i as SelectGroup, j as SelectValue, k as SelectTrigger, l as SelectLabelProps, m as SelectOptionGroupProps, n as SelectContent, o as SelectItem, p as SelectOptionGroup, r as SelectContentProps, s as SelectItemProps, t as Select, u as SelectList, v as SelectPortal, w as SelectScrollDownButtonProps, x as SelectPositionerProps, y as SelectPortalProps } from "../Select-CRsKCJ9x.js";
|
|
2
|
+
export { Select, SelectContent, SelectContentProps, SelectGroup, SelectGroupProps, SelectItem, SelectItemProps, SelectLabel, SelectLabelProps, SelectList, SelectListProps, SelectOption, SelectOptionGroup, SelectOptionGroupProps, SelectOptionProps, SelectPopup, SelectPopupProps, SelectPortal, SelectPortalProps, SelectPositioner, SelectPositionerProps, SelectProps, SelectScrollDownButton, SelectScrollDownButtonProps, SelectScrollUpButton, SelectScrollUpButtonProps, SelectSeparator, SelectSeparatorProps, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps };
|