@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,315 @@
|
|
|
1
|
+
import { C as SpinnerIcon, o as CheckIcon } from "../icons-BsWc8g4E.js";
|
|
2
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Stepper.tsx
|
|
6
|
+
const StepperContext = React.createContext(void 0);
|
|
7
|
+
const StepItemContext = React.createContext(void 0);
|
|
8
|
+
function useStepper() {
|
|
9
|
+
const context = React.useContext(StepperContext);
|
|
10
|
+
if (!context) throw new Error("useStepper must be used within a Stepper");
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
13
|
+
function useStepItem() {
|
|
14
|
+
const context = React.useContext(StepItemContext);
|
|
15
|
+
if (!context) throw new Error("useStepItem must be used within a StepperItem");
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A composable stepper for setup flows, onboarding, and other ordered workflows.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Stepper defaultValue={1}>
|
|
24
|
+
* <StepperNav>
|
|
25
|
+
* <StepperItem step={1}>
|
|
26
|
+
* <StepperTrigger>
|
|
27
|
+
* <StepperIndicator>1</StepperIndicator>
|
|
28
|
+
* <StepperTitle>Connect account</StepperTitle>
|
|
29
|
+
* </StepperTrigger>
|
|
30
|
+
* <StepperSeparator />
|
|
31
|
+
* </StepperItem>
|
|
32
|
+
* </StepperNav>
|
|
33
|
+
* </Stepper>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://reui.io/docs/components/base/stepper | ReUI Stepper}
|
|
37
|
+
*/
|
|
38
|
+
function Stepper({ defaultValue = 1, value, onValueChange, orientation = "horizontal", indicators = {}, className, children, ref, ...props }) {
|
|
39
|
+
const idPrefix = `stepper-${React.useId()}`;
|
|
40
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
41
|
+
const triggerNodes = React.useRef(/* @__PURE__ */ new Map());
|
|
42
|
+
const [triggerSteps, setTriggerSteps] = React.useState([]);
|
|
43
|
+
const activeStep = value ?? uncontrolledValue;
|
|
44
|
+
const setActiveStep = React.useCallback((step) => {
|
|
45
|
+
if (value === void 0) setUncontrolledValue(step);
|
|
46
|
+
onValueChange?.(step);
|
|
47
|
+
}, [onValueChange, value]);
|
|
48
|
+
const registerTrigger = React.useCallback((step, node) => {
|
|
49
|
+
if (node) {
|
|
50
|
+
triggerNodes.current.set(step, node);
|
|
51
|
+
setTriggerSteps((steps) => steps.includes(step) ? steps : [...steps, step]);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
triggerNodes.current.delete(step);
|
|
55
|
+
setTriggerSteps((steps) => steps.filter((currentStep) => currentStep !== step));
|
|
56
|
+
}, []);
|
|
57
|
+
const focusStep = React.useCallback((step) => {
|
|
58
|
+
triggerNodes.current.get(step)?.focus();
|
|
59
|
+
}, []);
|
|
60
|
+
const getEnabledSteps = React.useCallback(() => triggerSteps.filter((step) => {
|
|
61
|
+
const node = triggerNodes.current.get(step);
|
|
62
|
+
return node && !node.disabled;
|
|
63
|
+
}), [triggerSteps]);
|
|
64
|
+
const focusNext = React.useCallback((step) => {
|
|
65
|
+
const enabledSteps = getEnabledSteps();
|
|
66
|
+
const currentIndex = enabledSteps.indexOf(step);
|
|
67
|
+
if (currentIndex === -1 || enabledSteps.length === 0) return;
|
|
68
|
+
focusStep(enabledSteps[(currentIndex + 1) % enabledSteps.length]);
|
|
69
|
+
}, [focusStep, getEnabledSteps]);
|
|
70
|
+
const focusPrev = React.useCallback((step) => {
|
|
71
|
+
const enabledSteps = getEnabledSteps();
|
|
72
|
+
const currentIndex = enabledSteps.indexOf(step);
|
|
73
|
+
if (currentIndex === -1 || enabledSteps.length === 0) return;
|
|
74
|
+
focusStep(enabledSteps[(currentIndex - 1 + enabledSteps.length) % enabledSteps.length]);
|
|
75
|
+
}, [focusStep, getEnabledSteps]);
|
|
76
|
+
const focusFirst = React.useCallback(() => {
|
|
77
|
+
const [firstStep] = getEnabledSteps();
|
|
78
|
+
if (firstStep !== void 0) focusStep(firstStep);
|
|
79
|
+
}, [focusStep, getEnabledSteps]);
|
|
80
|
+
const focusLast = React.useCallback(() => {
|
|
81
|
+
const enabledSteps = getEnabledSteps();
|
|
82
|
+
const lastStep = enabledSteps[enabledSteps.length - 1];
|
|
83
|
+
if (lastStep !== void 0) focusStep(lastStep);
|
|
84
|
+
}, [focusStep, getEnabledSteps]);
|
|
85
|
+
const contextValue = React.useMemo(() => ({
|
|
86
|
+
activeStep,
|
|
87
|
+
setActiveStep,
|
|
88
|
+
stepsCount: triggerSteps.length,
|
|
89
|
+
orientation,
|
|
90
|
+
indicators,
|
|
91
|
+
idPrefix,
|
|
92
|
+
registerTrigger,
|
|
93
|
+
focusNext,
|
|
94
|
+
focusPrev,
|
|
95
|
+
focusFirst,
|
|
96
|
+
focusLast
|
|
97
|
+
}), [
|
|
98
|
+
activeStep,
|
|
99
|
+
focusFirst,
|
|
100
|
+
focusLast,
|
|
101
|
+
focusNext,
|
|
102
|
+
focusPrev,
|
|
103
|
+
idPrefix,
|
|
104
|
+
indicators,
|
|
105
|
+
orientation,
|
|
106
|
+
registerTrigger,
|
|
107
|
+
setActiveStep,
|
|
108
|
+
triggerSteps.length
|
|
109
|
+
]);
|
|
110
|
+
return /* @__PURE__ */ jsx(StepperContext.Provider, {
|
|
111
|
+
value: contextValue,
|
|
112
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
113
|
+
ref,
|
|
114
|
+
className: cx("stepper", className),
|
|
115
|
+
"data-orientation": orientation,
|
|
116
|
+
...props,
|
|
117
|
+
children
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function StepperNav({ className, ref, role, ...props }) {
|
|
122
|
+
const { activeStep, orientation } = useStepper();
|
|
123
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
124
|
+
ref,
|
|
125
|
+
role: role ?? "tablist",
|
|
126
|
+
"aria-orientation": orientation,
|
|
127
|
+
className: cx("stepper__nav", className),
|
|
128
|
+
"data-active-step": activeStep,
|
|
129
|
+
"data-orientation": orientation,
|
|
130
|
+
...props
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function StepperItem({ step, completed = false, disabled = false, loading = false, className, ref, ...props }) {
|
|
134
|
+
const { activeStep } = useStepper();
|
|
135
|
+
const isLoading = loading && step === activeStep;
|
|
136
|
+
const state = isLoading ? "loading" : completed || step < activeStep ? "completed" : activeStep === step ? "active" : "inactive";
|
|
137
|
+
return /* @__PURE__ */ jsx(StepItemContext.Provider, {
|
|
138
|
+
value: {
|
|
139
|
+
step,
|
|
140
|
+
state,
|
|
141
|
+
isDisabled: disabled,
|
|
142
|
+
isLoading
|
|
143
|
+
},
|
|
144
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
145
|
+
ref,
|
|
146
|
+
role: "presentation",
|
|
147
|
+
className: cx("stepper__item", className),
|
|
148
|
+
"data-disabled": disabled ? "" : void 0,
|
|
149
|
+
"data-loading": isLoading ? "" : void 0,
|
|
150
|
+
"data-state": state,
|
|
151
|
+
...props
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function StepperTrigger({ className, children, disabled, id, "aria-controls": ariaControls, tabIndex, onClick, onKeyDown, ref, ...props }) {
|
|
156
|
+
const { activeStep, focusFirst, focusLast, focusNext, focusPrev, idPrefix, registerTrigger, setActiveStep } = useStepper();
|
|
157
|
+
const { isDisabled, isLoading, state, step } = useStepItem();
|
|
158
|
+
const isSelected = activeStep === step;
|
|
159
|
+
const triggerId = id ?? `${idPrefix}-trigger-${step}`;
|
|
160
|
+
const setTriggerRef = React.useCallback((node) => {
|
|
161
|
+
registerTrigger(step, node);
|
|
162
|
+
assignRef(ref, node);
|
|
163
|
+
}, [
|
|
164
|
+
ref,
|
|
165
|
+
registerTrigger,
|
|
166
|
+
step
|
|
167
|
+
]);
|
|
168
|
+
const handleClick = (event) => {
|
|
169
|
+
onClick?.(event);
|
|
170
|
+
if (!event.defaultPrevented) setActiveStep(step);
|
|
171
|
+
};
|
|
172
|
+
const handleKeyDown = (event) => {
|
|
173
|
+
onKeyDown?.(event);
|
|
174
|
+
if (event.defaultPrevented) return;
|
|
175
|
+
switch (event.key) {
|
|
176
|
+
case "ArrowDown":
|
|
177
|
+
case "ArrowRight":
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
focusNext(step);
|
|
180
|
+
break;
|
|
181
|
+
case "ArrowLeft":
|
|
182
|
+
case "ArrowUp":
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
focusPrev(step);
|
|
185
|
+
break;
|
|
186
|
+
case "End":
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
focusLast();
|
|
189
|
+
break;
|
|
190
|
+
case "Home":
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
focusFirst();
|
|
193
|
+
break;
|
|
194
|
+
case " ":
|
|
195
|
+
case "Enter":
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
setActiveStep(step);
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
return /* @__PURE__ */ jsx("button", {
|
|
202
|
+
ref: setTriggerRef,
|
|
203
|
+
role: "tab",
|
|
204
|
+
id: triggerId,
|
|
205
|
+
"aria-controls": ariaControls,
|
|
206
|
+
"aria-current": isSelected ? "step" : void 0,
|
|
207
|
+
"aria-selected": isSelected,
|
|
208
|
+
className: cx("stepper__trigger", className),
|
|
209
|
+
"data-loading": isLoading ? "" : void 0,
|
|
210
|
+
"data-state": state,
|
|
211
|
+
disabled: disabled ?? isDisabled,
|
|
212
|
+
onClick: handleClick,
|
|
213
|
+
onKeyDown: handleKeyDown,
|
|
214
|
+
tabIndex: typeof tabIndex === "number" ? tabIndex : isSelected ? 0 : -1,
|
|
215
|
+
...props,
|
|
216
|
+
children
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function StepperIndicator({ className, children, ref, ...props }) {
|
|
220
|
+
const { indicators } = useStepper();
|
|
221
|
+
const { isLoading, state, step } = useStepItem();
|
|
222
|
+
const indicator = getIndicatorContent({
|
|
223
|
+
children,
|
|
224
|
+
indicators,
|
|
225
|
+
isLoading,
|
|
226
|
+
state,
|
|
227
|
+
step
|
|
228
|
+
});
|
|
229
|
+
return /* @__PURE__ */ jsx("span", {
|
|
230
|
+
ref,
|
|
231
|
+
"aria-hidden": "true",
|
|
232
|
+
className: cx("stepper__indicator", className),
|
|
233
|
+
"data-loading": isLoading ? "" : void 0,
|
|
234
|
+
"data-state": state,
|
|
235
|
+
...props,
|
|
236
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
237
|
+
className: "stepper__indicator-content",
|
|
238
|
+
children: indicator
|
|
239
|
+
})
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function StepperSeparator({ className, ref, ...props }) {
|
|
243
|
+
const { state } = useStepItem();
|
|
244
|
+
return /* @__PURE__ */ jsx("span", {
|
|
245
|
+
ref,
|
|
246
|
+
"aria-hidden": "true",
|
|
247
|
+
className: cx("stepper__separator", className),
|
|
248
|
+
"data-state": state,
|
|
249
|
+
...props
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function StepperTitle({ className, children, ref, ...props }) {
|
|
253
|
+
const { state } = useStepItem();
|
|
254
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
255
|
+
ref,
|
|
256
|
+
className: cx("stepper__title", className),
|
|
257
|
+
"data-state": state,
|
|
258
|
+
...props,
|
|
259
|
+
children
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function StepperDescription({ className, ref, ...props }) {
|
|
263
|
+
const { state } = useStepItem();
|
|
264
|
+
return /* @__PURE__ */ jsx("div", {
|
|
265
|
+
ref,
|
|
266
|
+
className: cx("stepper__description", className),
|
|
267
|
+
"data-state": state,
|
|
268
|
+
...props
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function StepperPanel({ className, ref, ...props }) {
|
|
272
|
+
const { activeStep } = useStepper();
|
|
273
|
+
return /* @__PURE__ */ jsx("div", {
|
|
274
|
+
ref,
|
|
275
|
+
className: cx("stepper__panel", className),
|
|
276
|
+
"data-active-step": activeStep,
|
|
277
|
+
...props
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function StepperContent({ value, forceMount = false, className, children, id, "aria-labelledby": ariaLabelledBy, ref, ...props }) {
|
|
281
|
+
const { activeStep, idPrefix } = useStepper();
|
|
282
|
+
const isActive = activeStep === value;
|
|
283
|
+
if (!forceMount && !isActive) return null;
|
|
284
|
+
return /* @__PURE__ */ jsx("div", {
|
|
285
|
+
ref,
|
|
286
|
+
role: "tabpanel",
|
|
287
|
+
id: id ?? `${idPrefix}-panel-${value}`,
|
|
288
|
+
"aria-labelledby": ariaLabelledBy ?? `${idPrefix}-trigger-${value}`,
|
|
289
|
+
className: cx("stepper__content", !isActive && "stepper__content--hidden", className),
|
|
290
|
+
"data-state": isActive ? "active" : "inactive",
|
|
291
|
+
hidden: !isActive,
|
|
292
|
+
tabIndex: 0,
|
|
293
|
+
...props,
|
|
294
|
+
children
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function getIndicatorContent({ children, indicators, isLoading, state, step }) {
|
|
298
|
+
if (isLoading && indicators.loading !== void 0) return indicators.loading;
|
|
299
|
+
if (state === "completed" && indicators.completed !== void 0) return indicators.completed;
|
|
300
|
+
if (state === "active" && indicators.active !== void 0) return indicators.active;
|
|
301
|
+
if (state === "inactive" && indicators.inactive !== void 0) return indicators.inactive;
|
|
302
|
+
if (children !== void 0 && children !== null) return children;
|
|
303
|
+
if (isLoading) return /* @__PURE__ */ jsx(SpinnerIcon, {});
|
|
304
|
+
if (state === "completed") return /* @__PURE__ */ jsx(CheckIcon, {});
|
|
305
|
+
return step;
|
|
306
|
+
}
|
|
307
|
+
function assignRef(ref, value) {
|
|
308
|
+
if (typeof ref === "function") {
|
|
309
|
+
ref(value);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (ref) ref.current = value;
|
|
313
|
+
}
|
|
314
|
+
//#endregion
|
|
315
|
+
export { Stepper, StepperContent, StepperDescription, StepperIndicator, StepperItem, StepperNav, StepperPanel, StepperSeparator, StepperTitle, StepperTrigger, useStepItem, useStepper };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Switch.d.ts
|
|
5
|
+
interface SwitchProps extends Omit<React.ComponentPropsWithRef<typeof Switch$1.Root>, "className"> {
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The size of the switch.
|
|
9
|
+
* @default 'default'
|
|
10
|
+
*/
|
|
11
|
+
size?: "sm" | "md" | "lg" | "default";
|
|
12
|
+
}
|
|
13
|
+
interface SwitchThumbProps extends Omit<React.ComponentPropsWithRef<typeof Switch$1.Thumb>, "className"> {
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A toggle switch component for binary choices.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Switch defaultChecked>
|
|
22
|
+
* <SwitchThumb />
|
|
23
|
+
* </Switch>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Controlled
|
|
29
|
+
* const [checked, setChecked] = React.useState(false);
|
|
30
|
+
* <Switch checked={checked} onCheckedChange={setChecked}>
|
|
31
|
+
* <SwitchThumb />
|
|
32
|
+
* </Switch>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link https://base-ui.com/react/components/switch | Base UI Switch}
|
|
36
|
+
*/
|
|
37
|
+
declare function Switch({
|
|
38
|
+
size,
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
ref,
|
|
42
|
+
...props
|
|
43
|
+
}: SwitchProps & {
|
|
44
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
45
|
+
}): React.JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* The thumb indicator for the Switch component.
|
|
48
|
+
*/
|
|
49
|
+
declare function SwitchThumb({
|
|
50
|
+
className,
|
|
51
|
+
ref,
|
|
52
|
+
...props
|
|
53
|
+
}: SwitchThumbProps & {
|
|
54
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
55
|
+
}): React.JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Switch, SwitchProps, SwitchThumb, SwitchThumbProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
4
|
+
//#region src/components/Switch.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A toggle switch component for binary choices.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Switch defaultChecked>
|
|
11
|
+
* <SwitchThumb />
|
|
12
|
+
* </Switch>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Controlled
|
|
18
|
+
* const [checked, setChecked] = React.useState(false);
|
|
19
|
+
* <Switch checked={checked} onCheckedChange={setChecked}>
|
|
20
|
+
* <SwitchThumb />
|
|
21
|
+
* </Switch>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://base-ui.com/react/components/switch | Base UI Switch}
|
|
25
|
+
*/
|
|
26
|
+
function Switch({ size = "default", className = "", children, ref, ...props }) {
|
|
27
|
+
const normalizedSize = size === "md" ? "default" : size;
|
|
28
|
+
const classes = [
|
|
29
|
+
"switch",
|
|
30
|
+
normalizedSize !== "default" && `switch--${normalizedSize}`,
|
|
31
|
+
className
|
|
32
|
+
].filter(Boolean).join(" ");
|
|
33
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
34
|
+
ref,
|
|
35
|
+
"data-slot": "switch",
|
|
36
|
+
"data-size": normalizedSize,
|
|
37
|
+
className: classes,
|
|
38
|
+
...props,
|
|
39
|
+
children: children ?? /* @__PURE__ */ jsx(SwitchThumb, {})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The thumb indicator for the Switch component.
|
|
44
|
+
*/
|
|
45
|
+
function SwitchThumb({ className = "", ref, ...props }) {
|
|
46
|
+
const classes = ["switch__thumb", className].filter(Boolean).join(" ");
|
|
47
|
+
return /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
48
|
+
ref,
|
|
49
|
+
"data-slot": "switch-thumb",
|
|
50
|
+
className: classes,
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Switch, SwitchThumb };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Tabs.d.ts
|
|
5
|
+
interface TabsProps extends Omit<Tabs$1.Root.Props, "className"> {
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The visual style variant.
|
|
9
|
+
* @default 'default'
|
|
10
|
+
*/
|
|
11
|
+
variant?: "default" | "bordered";
|
|
12
|
+
}
|
|
13
|
+
interface TabsListProps extends Omit<Tabs$1.List.Props, "className"> {
|
|
14
|
+
className?: string;
|
|
15
|
+
variant?: "default" | "line" | null;
|
|
16
|
+
}
|
|
17
|
+
interface TabProps extends Omit<Tabs$1.Tab.Props, "className"> {
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
interface TabPanelProps extends Omit<Tabs$1.Panel.Props, "className"> {
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
type TabsTriggerProps = TabProps;
|
|
24
|
+
type TabsContentProps = TabPanelProps;
|
|
25
|
+
interface TabsListVariantsOptions {
|
|
26
|
+
variant?: "default" | "line" | null;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
declare function tabsListVariants({
|
|
30
|
+
variant,
|
|
31
|
+
className
|
|
32
|
+
}?: TabsListVariantsOptions): string;
|
|
33
|
+
/**
|
|
34
|
+
* A tabs component for organizing content into separate views.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <Tabs defaultValue="tab1">
|
|
39
|
+
* <TabsList>
|
|
40
|
+
* <Tab value="tab1">Tab 1</Tab>
|
|
41
|
+
* <Tab value="tab2">Tab 2</Tab>
|
|
42
|
+
* </TabsList>
|
|
43
|
+
* <TabPanel value="tab1">Content 1</TabPanel>
|
|
44
|
+
* <TabPanel value="tab2">Content 2</TabPanel>
|
|
45
|
+
* </Tabs>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @see {@link https://base-ui.com/react/components/tabs | Base UI Tabs}
|
|
49
|
+
*/
|
|
50
|
+
declare function Tabs({
|
|
51
|
+
orientation,
|
|
52
|
+
variant,
|
|
53
|
+
className,
|
|
54
|
+
ref,
|
|
55
|
+
...props
|
|
56
|
+
}: TabsProps & {
|
|
57
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
58
|
+
}): React.JSX.Element;
|
|
59
|
+
declare function TabsList({
|
|
60
|
+
className,
|
|
61
|
+
variant,
|
|
62
|
+
ref,
|
|
63
|
+
...props
|
|
64
|
+
}: TabsListProps & {
|
|
65
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
66
|
+
}): React.JSX.Element;
|
|
67
|
+
declare function Tab({
|
|
68
|
+
className,
|
|
69
|
+
ref,
|
|
70
|
+
...props
|
|
71
|
+
}: TabProps & {
|
|
72
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
73
|
+
}): React.JSX.Element;
|
|
74
|
+
declare function TabPanel({
|
|
75
|
+
className,
|
|
76
|
+
ref,
|
|
77
|
+
...props
|
|
78
|
+
}: TabPanelProps & {
|
|
79
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
80
|
+
}): React.JSX.Element;
|
|
81
|
+
declare const TabsTrigger: typeof Tab;
|
|
82
|
+
declare const TabsContent: typeof TabPanel;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { Tab, TabPanel, TabPanelProps, TabProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsListVariantsOptions, TabsProps, TabsTrigger, TabsTriggerProps, tabsListVariants };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
4
|
+
//#region src/components/Tabs.tsx
|
|
5
|
+
function tabsListVariants({ variant = "default", className } = {}) {
|
|
6
|
+
return [
|
|
7
|
+
"tabs__list",
|
|
8
|
+
variant === "line" && "tabs__list--line",
|
|
9
|
+
className
|
|
10
|
+
].filter(Boolean).join(" ");
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A tabs component for organizing content into separate views.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Tabs defaultValue="tab1">
|
|
18
|
+
* <TabsList>
|
|
19
|
+
* <Tab value="tab1">Tab 1</Tab>
|
|
20
|
+
* <Tab value="tab2">Tab 2</Tab>
|
|
21
|
+
* </TabsList>
|
|
22
|
+
* <TabPanel value="tab1">Content 1</TabPanel>
|
|
23
|
+
* <TabPanel value="tab2">Content 2</TabPanel>
|
|
24
|
+
* </Tabs>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://base-ui.com/react/components/tabs | Base UI Tabs}
|
|
28
|
+
*/
|
|
29
|
+
function Tabs({ orientation = "horizontal", variant = "default", className = "", ref, ...props }) {
|
|
30
|
+
const classes = [
|
|
31
|
+
"tabs",
|
|
32
|
+
variant !== "default" && `tabs--${variant}`,
|
|
33
|
+
className
|
|
34
|
+
].filter(Boolean).join(" ");
|
|
35
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
36
|
+
ref,
|
|
37
|
+
"data-orientation": orientation,
|
|
38
|
+
"data-slot": "tabs",
|
|
39
|
+
orientation,
|
|
40
|
+
className: classes,
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function TabsList({ className = "", variant = "default", ref, ...props }) {
|
|
45
|
+
const classes = tabsListVariants({
|
|
46
|
+
variant,
|
|
47
|
+
className
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ jsx(Tabs$1.List, {
|
|
50
|
+
ref,
|
|
51
|
+
"data-slot": "tabs-list",
|
|
52
|
+
"data-variant": variant,
|
|
53
|
+
className: classes,
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function Tab({ className = "", ref, ...props }) {
|
|
58
|
+
const classes = ["tabs__tab", className].filter(Boolean).join(" ");
|
|
59
|
+
return /* @__PURE__ */ jsx(Tabs$1.Tab, {
|
|
60
|
+
ref,
|
|
61
|
+
"data-slot": "tabs-trigger",
|
|
62
|
+
className: classes,
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function TabPanel({ className = "", ref, ...props }) {
|
|
67
|
+
const classes = ["tabs__panel", className].filter(Boolean).join(" ");
|
|
68
|
+
return /* @__PURE__ */ jsx(Tabs$1.Panel, {
|
|
69
|
+
ref,
|
|
70
|
+
"data-slot": "tabs-content",
|
|
71
|
+
className: classes,
|
|
72
|
+
...props
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const TabsTrigger = Tab;
|
|
76
|
+
const TabsContent = TabPanel;
|
|
77
|
+
//#endregion
|
|
78
|
+
export { Tab, TabPanel, Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps } from "./Collapsible.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Task.d.ts
|
|
5
|
+
interface TaskProps extends Omit<CollapsibleRootProps, "className" | "unstyled"> {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A collapsible task/workflow list. Compose with TaskTrigger, TaskContent,
|
|
10
|
+
* TaskItem, and TaskItemFile to show structured progress for a multi-step
|
|
11
|
+
* workflow like file edits. Adapted from Vercel AI Elements and restyled
|
|
12
|
+
* with Sigvelo CSS tokens.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Task defaultOpen>
|
|
17
|
+
* <TaskTrigger title="Refactoring authentication module" />
|
|
18
|
+
* <TaskContent>
|
|
19
|
+
* <TaskItem>
|
|
20
|
+
* Updated <TaskItemFile name="auth.ts" /> to export the new interface
|
|
21
|
+
* </TaskItem>
|
|
22
|
+
* <TaskItem>
|
|
23
|
+
* Added tests in <TaskItemFile name="auth.test.ts" />
|
|
24
|
+
* </TaskItem>
|
|
25
|
+
* </TaskContent>
|
|
26
|
+
* </Task>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @see {@link https://elements.ai-sdk.dev/components/task | AI Elements Task}
|
|
30
|
+
*/
|
|
31
|
+
declare function Task({
|
|
32
|
+
className,
|
|
33
|
+
defaultOpen,
|
|
34
|
+
ref,
|
|
35
|
+
...props
|
|
36
|
+
}: TaskProps & {
|
|
37
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
38
|
+
}): React.JSX.Element;
|
|
39
|
+
interface TaskTriggerProps extends Omit<CollapsibleTriggerProps, "className" | "unstyled"> {
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Heading text shown in the trigger row. */
|
|
42
|
+
title: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Clickable header that toggles the task content.
|
|
46
|
+
*/
|
|
47
|
+
declare function TaskTrigger({
|
|
48
|
+
className,
|
|
49
|
+
title,
|
|
50
|
+
children,
|
|
51
|
+
ref,
|
|
52
|
+
...props
|
|
53
|
+
}: TaskTriggerProps & {
|
|
54
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
55
|
+
}): React.JSX.Element;
|
|
56
|
+
interface TaskContentProps extends Omit<CollapsiblePanelProps, "className" | "unstyled"> {
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The collapsible panel containing TaskItem children.
|
|
61
|
+
*/
|
|
62
|
+
declare function TaskContent({
|
|
63
|
+
className,
|
|
64
|
+
children,
|
|
65
|
+
ref,
|
|
66
|
+
...props
|
|
67
|
+
}: TaskContentProps & {
|
|
68
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
69
|
+
}): React.JSX.Element;
|
|
70
|
+
interface TaskItemProps extends React.HTMLAttributes<HTMLLIElement> {}
|
|
71
|
+
/**
|
|
72
|
+
* A single task row. Free-form content; compose with TaskItemFile to
|
|
73
|
+
* reference a file inline.
|
|
74
|
+
*/
|
|
75
|
+
declare function TaskItem({
|
|
76
|
+
className,
|
|
77
|
+
children,
|
|
78
|
+
ref,
|
|
79
|
+
...props
|
|
80
|
+
}: TaskItemProps & {
|
|
81
|
+
ref?: React.Ref<HTMLLIElement>;
|
|
82
|
+
}): React.JSX.Element;
|
|
83
|
+
interface TaskItemFileProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
84
|
+
/** The file name or path to display. Used to derive the language badge. */
|
|
85
|
+
name?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Inline file reference badge used inside TaskItem content.
|
|
89
|
+
*/
|
|
90
|
+
declare function TaskItemFile({
|
|
91
|
+
className,
|
|
92
|
+
name,
|
|
93
|
+
children,
|
|
94
|
+
ref,
|
|
95
|
+
...props
|
|
96
|
+
}: TaskItemFileProps & {
|
|
97
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
98
|
+
}): React.JSX.Element;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { Task, TaskContent, TaskContentProps, TaskItem, TaskItemFile, TaskItemFileProps, TaskItemProps, TaskProps, TaskTrigger, TaskTriggerProps };
|