@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,338 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
4
|
+
//#region src/components/Menu.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Root component that manages menu state.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Menu.Root>
|
|
11
|
+
* <Menu.Trigger>Actions</Menu.Trigger>
|
|
12
|
+
* <Menu.Portal>
|
|
13
|
+
* <Menu.Positioner>
|
|
14
|
+
* <Menu.Popup>
|
|
15
|
+
* <Menu.Item>Edit</Menu.Item>
|
|
16
|
+
* <Menu.Item>Delete</Menu.Item>
|
|
17
|
+
* </Menu.Popup>
|
|
18
|
+
* </Menu.Positioner>
|
|
19
|
+
* </Menu.Portal>
|
|
20
|
+
* </Menu.Root>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @see {@link https://base-ui.com/react/components/menu | Base UI Menu}
|
|
24
|
+
*/
|
|
25
|
+
const MenuRoot = (props) => {
|
|
26
|
+
return /* @__PURE__ */ jsx(Menu$1.Root, {
|
|
27
|
+
"data-slot": "dropdown-menu",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Button that toggles the menu visibility.
|
|
33
|
+
*/
|
|
34
|
+
function MenuTrigger({ className = "", ref, ...props }) {
|
|
35
|
+
const classes = ["menu__trigger", className].filter(Boolean).join(" ");
|
|
36
|
+
return /* @__PURE__ */ jsx(Menu$1.Trigger, {
|
|
37
|
+
ref,
|
|
38
|
+
"data-slot": "dropdown-menu-trigger",
|
|
39
|
+
className: classes,
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Renders menu content in a portal.
|
|
45
|
+
*/
|
|
46
|
+
const MenuPortal = (props) => {
|
|
47
|
+
return /* @__PURE__ */ jsx(Menu$1.Portal, {
|
|
48
|
+
"data-slot": "dropdown-menu-portal",
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Positions the menu popup relative to the trigger.
|
|
54
|
+
*/
|
|
55
|
+
function MenuPositioner({ className = "", ref, ...props }) {
|
|
56
|
+
const classes = ["menu__positioner", className].filter(Boolean).join(" ");
|
|
57
|
+
return /* @__PURE__ */ jsx(Menu$1.Positioner, {
|
|
58
|
+
ref,
|
|
59
|
+
"data-slot": "dropdown-menu-positioner",
|
|
60
|
+
className: classes,
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Container for menu items.
|
|
66
|
+
*/
|
|
67
|
+
function MenuPopup({ className = "", ref, ...props }) {
|
|
68
|
+
const classes = ["menu__popup", className].filter(Boolean).join(" ");
|
|
69
|
+
return /* @__PURE__ */ jsx(Menu$1.Popup, {
|
|
70
|
+
ref,
|
|
71
|
+
"data-slot": "dropdown-menu-content",
|
|
72
|
+
className: classes,
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function MenuContent({ anchor, positionMethod, side, sideOffset = 4, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuPositioner, {
|
|
78
|
+
anchor,
|
|
79
|
+
positionMethod,
|
|
80
|
+
side,
|
|
81
|
+
sideOffset,
|
|
82
|
+
align,
|
|
83
|
+
alignOffset,
|
|
84
|
+
collisionBoundary,
|
|
85
|
+
collisionPadding,
|
|
86
|
+
sticky,
|
|
87
|
+
arrowPadding,
|
|
88
|
+
disableAnchorTracking,
|
|
89
|
+
collisionAvoidance,
|
|
90
|
+
children: /* @__PURE__ */ jsx(MenuPopup, { ...props })
|
|
91
|
+
}) });
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Interactive menu item.
|
|
95
|
+
*/
|
|
96
|
+
function MenuItem({ className = "", inset, variant = "default", ref, ...props }) {
|
|
97
|
+
const classes = [
|
|
98
|
+
"menu__item",
|
|
99
|
+
inset && "menu__item--inset",
|
|
100
|
+
className
|
|
101
|
+
].filter(Boolean).join(" ");
|
|
102
|
+
return /* @__PURE__ */ jsx(Menu$1.Item, {
|
|
103
|
+
ref,
|
|
104
|
+
"data-slot": "dropdown-menu-item",
|
|
105
|
+
"data-inset": inset || void 0,
|
|
106
|
+
"data-variant": variant,
|
|
107
|
+
className: classes,
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Groups related menu items.
|
|
113
|
+
*/
|
|
114
|
+
function MenuGroup({ className = "", ref, ...props }) {
|
|
115
|
+
const classes = ["menu__group", className].filter(Boolean).join(" ");
|
|
116
|
+
return /* @__PURE__ */ jsx(Menu$1.Group, {
|
|
117
|
+
ref,
|
|
118
|
+
"data-slot": "dropdown-menu-group",
|
|
119
|
+
className: classes,
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Label for a group of menu items.
|
|
125
|
+
*/
|
|
126
|
+
function MenuGroupLabel({ className = "", inset, ref, ...props }) {
|
|
127
|
+
const classes = [
|
|
128
|
+
"menu__group-label",
|
|
129
|
+
inset && "menu__group-label--inset",
|
|
130
|
+
className
|
|
131
|
+
].filter(Boolean).join(" ");
|
|
132
|
+
return /* @__PURE__ */ jsx(Menu$1.GroupLabel, {
|
|
133
|
+
ref,
|
|
134
|
+
"data-slot": "dropdown-menu-label",
|
|
135
|
+
"data-inset": inset || void 0,
|
|
136
|
+
className: classes,
|
|
137
|
+
...props
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const MenuLabel = MenuGroupLabel;
|
|
141
|
+
/**
|
|
142
|
+
* Arrow pointing to the trigger.
|
|
143
|
+
*/
|
|
144
|
+
function MenuArrow({ className = "", ref, ...props }) {
|
|
145
|
+
const classes = ["menu__arrow", className].filter(Boolean).join(" ");
|
|
146
|
+
return /* @__PURE__ */ jsx(Menu$1.Arrow, {
|
|
147
|
+
ref,
|
|
148
|
+
"data-slot": "dropdown-menu-arrow",
|
|
149
|
+
className: classes,
|
|
150
|
+
...props
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Visual separator between menu sections.
|
|
155
|
+
*/
|
|
156
|
+
function MenuSeparator({ className = "", ref, ...props }) {
|
|
157
|
+
const classes = ["menu__separator", className].filter(Boolean).join(" ");
|
|
158
|
+
return /* @__PURE__ */ jsx(Menu$1.Separator, {
|
|
159
|
+
ref,
|
|
160
|
+
"data-slot": "dropdown-menu-separator",
|
|
161
|
+
className: classes,
|
|
162
|
+
...props
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Group for exclusive radio selection.
|
|
167
|
+
*/
|
|
168
|
+
function MenuRadioGroup({ className = "", ref, ...props }) {
|
|
169
|
+
const classes = ["menu__radio-group", className].filter(Boolean).join(" ");
|
|
170
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioGroup, {
|
|
171
|
+
ref,
|
|
172
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
173
|
+
className: classes,
|
|
174
|
+
...props
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Radio item for exclusive selection.
|
|
179
|
+
*/
|
|
180
|
+
function MenuRadioItem({ className = "", children, ref, ...props }) {
|
|
181
|
+
const classes = ["menu__radio-item", className].filter(Boolean).join(" ");
|
|
182
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioItem, {
|
|
183
|
+
ref,
|
|
184
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
185
|
+
className: classes,
|
|
186
|
+
...props,
|
|
187
|
+
children: hasChildOfType(children, MenuRadioItemIndicator) ? children : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuRadioItemIndicator, {}), children] })
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Indicator for selected radio item.
|
|
192
|
+
*/
|
|
193
|
+
function MenuRadioItemIndicator({ className = "", ref, ...props }) {
|
|
194
|
+
const classes = ["menu__radio-indicator", className].filter(Boolean).join(" ");
|
|
195
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioItemIndicator, {
|
|
196
|
+
ref,
|
|
197
|
+
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
198
|
+
className: classes,
|
|
199
|
+
...props
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Checkbox item for toggling options.
|
|
204
|
+
*/
|
|
205
|
+
function MenuCheckboxItem({ className = "", children, ref, ...props }) {
|
|
206
|
+
const classes = ["menu__checkbox-item", className].filter(Boolean).join(" ");
|
|
207
|
+
return /* @__PURE__ */ jsx(Menu$1.CheckboxItem, {
|
|
208
|
+
ref,
|
|
209
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
210
|
+
className: classes,
|
|
211
|
+
...props,
|
|
212
|
+
children: hasChildOfType(children, MenuCheckboxItemIndicator) ? children : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuCheckboxItemIndicator, {}), children] })
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Indicator for checked checkbox item.
|
|
217
|
+
*/
|
|
218
|
+
function MenuCheckboxItemIndicator({ className = "", ref, ...props }) {
|
|
219
|
+
const classes = ["menu__checkbox-indicator", className].filter(Boolean).join(" ");
|
|
220
|
+
return /* @__PURE__ */ jsx(Menu$1.CheckboxItemIndicator, {
|
|
221
|
+
ref,
|
|
222
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
223
|
+
className: classes,
|
|
224
|
+
...props
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function MenuShortcut({ className = "", ref, ...props }) {
|
|
228
|
+
return /* @__PURE__ */ jsx("span", {
|
|
229
|
+
ref,
|
|
230
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
231
|
+
className: ["menu__shortcut", className].filter(Boolean).join(" "),
|
|
232
|
+
...props
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function MenuSub(props) {
|
|
236
|
+
return /* @__PURE__ */ jsx(Menu$1.SubmenuRoot, {
|
|
237
|
+
"data-slot": "dropdown-menu-sub",
|
|
238
|
+
...props
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function MenuSubContent({ side = "right", align, sideOffset = 4, ...props }) {
|
|
242
|
+
return /* @__PURE__ */ jsx(MenuContent, {
|
|
243
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
244
|
+
side,
|
|
245
|
+
align,
|
|
246
|
+
sideOffset,
|
|
247
|
+
...props
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Trigger that opens a submenu.
|
|
252
|
+
*/
|
|
253
|
+
function MenuSubmenuTrigger({ className = "", inset, ref, ...props }) {
|
|
254
|
+
const classes = [
|
|
255
|
+
"menu__submenu-trigger",
|
|
256
|
+
inset && "menu__item--inset",
|
|
257
|
+
className
|
|
258
|
+
].filter(Boolean).join(" ");
|
|
259
|
+
return /* @__PURE__ */ jsx(Menu$1.SubmenuTrigger, {
|
|
260
|
+
ref,
|
|
261
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
262
|
+
"data-inset": inset || void 0,
|
|
263
|
+
className: classes,
|
|
264
|
+
...props
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
const MenuSubTrigger = MenuSubmenuTrigger;
|
|
268
|
+
function hasChildOfType(children, type) {
|
|
269
|
+
return React.Children.toArray(children).some((child) => React.isValidElement(child) && child.type === type);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* A dropdown menu with keyboard navigation support.
|
|
273
|
+
* Provides items, groups, checkboxes, radio selections, and nested submenus.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```tsx
|
|
277
|
+
* // Basic menu
|
|
278
|
+
* <Menu.Root>
|
|
279
|
+
* <Menu.Trigger>Actions</Menu.Trigger>
|
|
280
|
+
* <Menu.Portal>
|
|
281
|
+
* <Menu.Positioner>
|
|
282
|
+
* <Menu.Popup>
|
|
283
|
+
* <Menu.Item onClick={() => console.log('Edit')}>Edit</Menu.Item>
|
|
284
|
+
* <Menu.Item onClick={() => console.log('Copy')}>Copy</Menu.Item>
|
|
285
|
+
* <Menu.Separator />
|
|
286
|
+
* <Menu.Item onClick={() => console.log('Delete')}>Delete</Menu.Item>
|
|
287
|
+
* </Menu.Popup>
|
|
288
|
+
* </Menu.Positioner>
|
|
289
|
+
* </Menu.Portal>
|
|
290
|
+
* </Menu.Root>
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```tsx
|
|
295
|
+
* // Menu with checkbox items
|
|
296
|
+
* <Menu.Root>
|
|
297
|
+
* <Menu.Trigger>View Options</Menu.Trigger>
|
|
298
|
+
* <Menu.Portal>
|
|
299
|
+
* <Menu.Positioner>
|
|
300
|
+
* <Menu.Popup>
|
|
301
|
+
* <Menu.CheckboxItem checked={showGrid} onCheckedChange={setShowGrid}>
|
|
302
|
+
* <Menu.CheckboxItemIndicator />
|
|
303
|
+
* Show Grid
|
|
304
|
+
* </Menu.CheckboxItem>
|
|
305
|
+
* </Menu.Popup>
|
|
306
|
+
* </Menu.Positioner>
|
|
307
|
+
* </Menu.Portal>
|
|
308
|
+
* </Menu.Root>
|
|
309
|
+
* ```
|
|
310
|
+
*
|
|
311
|
+
* @see {@link https://base-ui.com/react/components/menu | Base UI Menu}
|
|
312
|
+
*/
|
|
313
|
+
const Menu = Object.assign(MenuRoot, {
|
|
314
|
+
Root: MenuRoot,
|
|
315
|
+
Trigger: MenuTrigger,
|
|
316
|
+
Portal: MenuPortal,
|
|
317
|
+
Positioner: MenuPositioner,
|
|
318
|
+
Popup: MenuPopup,
|
|
319
|
+
Content: MenuContent,
|
|
320
|
+
Item: MenuItem,
|
|
321
|
+
Group: MenuGroup,
|
|
322
|
+
GroupLabel: MenuGroupLabel,
|
|
323
|
+
Label: MenuLabel,
|
|
324
|
+
Arrow: MenuArrow,
|
|
325
|
+
Separator: MenuSeparator,
|
|
326
|
+
RadioGroup: MenuRadioGroup,
|
|
327
|
+
RadioItem: MenuRadioItem,
|
|
328
|
+
RadioItemIndicator: MenuRadioItemIndicator,
|
|
329
|
+
CheckboxItem: MenuCheckboxItem,
|
|
330
|
+
CheckboxItemIndicator: MenuCheckboxItemIndicator,
|
|
331
|
+
Shortcut: MenuShortcut,
|
|
332
|
+
Sub: MenuSub,
|
|
333
|
+
SubContent: MenuSubContent,
|
|
334
|
+
SubTrigger: MenuSubTrigger,
|
|
335
|
+
SubmenuTrigger: MenuSubmenuTrigger
|
|
336
|
+
});
|
|
337
|
+
//#endregion
|
|
338
|
+
export { Menu, MenuArrow, MenuCheckboxItem, MenuCheckboxItemIndicator, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuLabel, MenuPopup, MenuPortal, MenuPositioner, MenuRadioGroup, MenuRadioItem, MenuRadioItemIndicator, MenuRoot, MenuSeparator, MenuShortcut, MenuSub, MenuSubContent, MenuSubTrigger, MenuSubmenuTrigger, MenuTrigger };
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Menu } from "@base-ui/react/menu";
|
|
3
|
+
import { Menubar as Menubar$1 } from "@base-ui/react/menubar";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Menubar.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Props for the Menubar component.
|
|
8
|
+
*/
|
|
9
|
+
interface MenubarProps extends Omit<React.ComponentPropsWithoutRef<typeof Menubar$1>, "className"> {
|
|
10
|
+
/** Additional CSS class names */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Props for the Menubar.Menu component.
|
|
15
|
+
*/
|
|
16
|
+
interface MenubarMenuProps extends React.ComponentPropsWithoutRef<typeof Menu.Root> {}
|
|
17
|
+
/**
|
|
18
|
+
* Props for the Menubar.Trigger component.
|
|
19
|
+
*/
|
|
20
|
+
interface MenubarTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.Trigger>, "className"> {
|
|
21
|
+
/** Additional CSS class names */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Props for the Menubar.Portal component.
|
|
26
|
+
*/
|
|
27
|
+
interface MenubarPortalProps extends React.ComponentPropsWithoutRef<typeof Menu.Portal> {}
|
|
28
|
+
/**
|
|
29
|
+
* Props for the Menubar.Positioner component.
|
|
30
|
+
*/
|
|
31
|
+
interface MenubarPositionerProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.Positioner>, "className"> {
|
|
32
|
+
/** Additional CSS class names */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Props for the Menubar.Popup component.
|
|
37
|
+
*/
|
|
38
|
+
interface MenubarPopupProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.Popup>, "className"> {
|
|
39
|
+
/** Additional CSS class names */
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Props for the Menubar.Item component.
|
|
44
|
+
*/
|
|
45
|
+
interface MenubarItemProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.Item>, "className"> {
|
|
46
|
+
/** Additional CSS class names */
|
|
47
|
+
className?: string;
|
|
48
|
+
inset?: boolean;
|
|
49
|
+
variant?: "default" | "destructive";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Props for the Menubar.Separator component.
|
|
53
|
+
*/
|
|
54
|
+
interface MenubarSeparatorProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.Separator>, "className"> {
|
|
55
|
+
/** Additional CSS class names */
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Props for the Menubar.Group component.
|
|
60
|
+
*/
|
|
61
|
+
interface MenubarGroupProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.Group>, "className"> {
|
|
62
|
+
/** Additional CSS class names */
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Props for the Menubar.GroupLabel component.
|
|
67
|
+
*/
|
|
68
|
+
interface MenubarGroupLabelProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.GroupLabel>, "className"> {
|
|
69
|
+
/** Additional CSS class names */
|
|
70
|
+
className?: string;
|
|
71
|
+
inset?: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface MenubarCheckboxItemProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.CheckboxItem>, "className"> {
|
|
74
|
+
className?: string;
|
|
75
|
+
}
|
|
76
|
+
interface MenubarRadioGroupProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.RadioGroup>, "className"> {
|
|
77
|
+
className?: string;
|
|
78
|
+
}
|
|
79
|
+
interface MenubarRadioItemProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.RadioItem>, "className"> {
|
|
80
|
+
className?: string;
|
|
81
|
+
}
|
|
82
|
+
interface MenubarShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {}
|
|
83
|
+
interface MenubarSubProps extends React.ComponentPropsWithoutRef<typeof Menu.SubmenuRoot> {}
|
|
84
|
+
interface MenubarSubTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof Menu.SubmenuTrigger>, "className"> {
|
|
85
|
+
className?: string;
|
|
86
|
+
inset?: boolean;
|
|
87
|
+
}
|
|
88
|
+
type MenubarPlacementProps = Pick<MenubarPositionerProps, "anchor" | "positionMethod" | "side" | "sideOffset" | "align" | "alignOffset" | "collisionBoundary" | "collisionPadding" | "sticky" | "arrowPadding" | "disableAnchorTracking" | "collisionAvoidance">;
|
|
89
|
+
type MenubarContentProps = MenubarPopupProps & MenubarPlacementProps;
|
|
90
|
+
type MenubarSubContentProps = MenubarContentProps;
|
|
91
|
+
/**
|
|
92
|
+
* Root menubar container.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <Menubar.Root>
|
|
97
|
+
* <Menubar.Menu>
|
|
98
|
+
* <Menubar.Trigger>File</Menubar.Trigger>
|
|
99
|
+
* <Menubar.Portal>
|
|
100
|
+
* <Menubar.Positioner>
|
|
101
|
+
* <Menubar.Popup>
|
|
102
|
+
* <Menubar.Item>New</Menubar.Item>
|
|
103
|
+
* <Menubar.Item>Open</Menubar.Item>
|
|
104
|
+
* <Menubar.Item>Save</Menubar.Item>
|
|
105
|
+
* </Menubar.Popup>
|
|
106
|
+
* </Menubar.Positioner>
|
|
107
|
+
* </Menubar.Portal>
|
|
108
|
+
* </Menubar.Menu>
|
|
109
|
+
* </Menubar.Root>
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @see {@link https://base-ui.com/react/components/menubar | Base UI Menubar}
|
|
113
|
+
*/
|
|
114
|
+
declare function MenubarRoot({
|
|
115
|
+
className,
|
|
116
|
+
ref,
|
|
117
|
+
...props
|
|
118
|
+
}: MenubarProps & {
|
|
119
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
120
|
+
}): React.JSX.Element;
|
|
121
|
+
/**
|
|
122
|
+
* Individual menu within the menubar.
|
|
123
|
+
*/
|
|
124
|
+
declare const MenubarMenu: (props: MenubarMenuProps) => React.JSX.Element;
|
|
125
|
+
/**
|
|
126
|
+
* Button that opens the menu.
|
|
127
|
+
*/
|
|
128
|
+
declare function MenubarTrigger({
|
|
129
|
+
className,
|
|
130
|
+
ref,
|
|
131
|
+
...props
|
|
132
|
+
}: MenubarTriggerProps & {
|
|
133
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
134
|
+
}): React.JSX.Element;
|
|
135
|
+
/**
|
|
136
|
+
* Renders menu content in a portal.
|
|
137
|
+
*/
|
|
138
|
+
declare const MenubarPortal: (props: MenubarPortalProps) => React.JSX.Element;
|
|
139
|
+
/**
|
|
140
|
+
* Positions the menu popup.
|
|
141
|
+
*/
|
|
142
|
+
declare function MenubarPositioner({
|
|
143
|
+
className,
|
|
144
|
+
ref,
|
|
145
|
+
...props
|
|
146
|
+
}: MenubarPositionerProps & {
|
|
147
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
148
|
+
}): React.JSX.Element;
|
|
149
|
+
/**
|
|
150
|
+
* Container for menu items.
|
|
151
|
+
*/
|
|
152
|
+
declare function MenubarPopup({
|
|
153
|
+
className,
|
|
154
|
+
ref,
|
|
155
|
+
...props
|
|
156
|
+
}: MenubarPopupProps & {
|
|
157
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
158
|
+
}): React.JSX.Element;
|
|
159
|
+
declare function MenubarContent({
|
|
160
|
+
anchor,
|
|
161
|
+
positionMethod,
|
|
162
|
+
side,
|
|
163
|
+
sideOffset,
|
|
164
|
+
align,
|
|
165
|
+
alignOffset,
|
|
166
|
+
collisionBoundary,
|
|
167
|
+
collisionPadding,
|
|
168
|
+
sticky,
|
|
169
|
+
arrowPadding,
|
|
170
|
+
disableAnchorTracking,
|
|
171
|
+
collisionAvoidance,
|
|
172
|
+
...props
|
|
173
|
+
}: MenubarContentProps & {
|
|
174
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
175
|
+
}): React.JSX.Element;
|
|
176
|
+
/**
|
|
177
|
+
* Interactive menu item.
|
|
178
|
+
*/
|
|
179
|
+
declare function MenubarItem({
|
|
180
|
+
className,
|
|
181
|
+
inset,
|
|
182
|
+
variant,
|
|
183
|
+
ref,
|
|
184
|
+
...props
|
|
185
|
+
}: MenubarItemProps & {
|
|
186
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
187
|
+
}): React.JSX.Element;
|
|
188
|
+
/**
|
|
189
|
+
* Visual separator between menu sections.
|
|
190
|
+
*/
|
|
191
|
+
declare function MenubarSeparator({
|
|
192
|
+
className,
|
|
193
|
+
ref,
|
|
194
|
+
...props
|
|
195
|
+
}: MenubarSeparatorProps & {
|
|
196
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
197
|
+
}): React.JSX.Element;
|
|
198
|
+
/**
|
|
199
|
+
* Groups related menu items.
|
|
200
|
+
*/
|
|
201
|
+
declare function MenubarGroup({
|
|
202
|
+
className,
|
|
203
|
+
ref,
|
|
204
|
+
...props
|
|
205
|
+
}: MenubarGroupProps & {
|
|
206
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
207
|
+
}): React.JSX.Element;
|
|
208
|
+
/**
|
|
209
|
+
* Label for a menu item group.
|
|
210
|
+
*/
|
|
211
|
+
declare function MenubarGroupLabel({
|
|
212
|
+
className,
|
|
213
|
+
inset,
|
|
214
|
+
ref,
|
|
215
|
+
...props
|
|
216
|
+
}: MenubarGroupLabelProps & {
|
|
217
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
218
|
+
}): React.JSX.Element;
|
|
219
|
+
declare const MenubarLabel: typeof MenubarGroupLabel;
|
|
220
|
+
declare function MenubarCheckboxItem({
|
|
221
|
+
className,
|
|
222
|
+
children,
|
|
223
|
+
ref,
|
|
224
|
+
...props
|
|
225
|
+
}: MenubarCheckboxItemProps & {
|
|
226
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
227
|
+
}): React.JSX.Element;
|
|
228
|
+
declare function MenubarRadioGroup({
|
|
229
|
+
className,
|
|
230
|
+
ref,
|
|
231
|
+
...props
|
|
232
|
+
}: MenubarRadioGroupProps & {
|
|
233
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
234
|
+
}): React.JSX.Element;
|
|
235
|
+
declare function MenubarRadioItem({
|
|
236
|
+
className,
|
|
237
|
+
children,
|
|
238
|
+
ref,
|
|
239
|
+
...props
|
|
240
|
+
}: MenubarRadioItemProps & {
|
|
241
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
242
|
+
}): React.JSX.Element;
|
|
243
|
+
declare function MenubarShortcut({
|
|
244
|
+
className,
|
|
245
|
+
ref,
|
|
246
|
+
...props
|
|
247
|
+
}: MenubarShortcutProps & {
|
|
248
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
249
|
+
}): React.JSX.Element;
|
|
250
|
+
declare function MenubarSub(props: MenubarSubProps): React.JSX.Element;
|
|
251
|
+
declare function MenubarSubContent({
|
|
252
|
+
side,
|
|
253
|
+
align,
|
|
254
|
+
sideOffset,
|
|
255
|
+
...props
|
|
256
|
+
}: MenubarSubContentProps & {
|
|
257
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
258
|
+
}): React.JSX.Element;
|
|
259
|
+
declare function MenubarSubTrigger({
|
|
260
|
+
className,
|
|
261
|
+
inset,
|
|
262
|
+
children,
|
|
263
|
+
ref,
|
|
264
|
+
...props
|
|
265
|
+
}: MenubarSubTriggerProps & {
|
|
266
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
267
|
+
}): React.JSX.Element;
|
|
268
|
+
/**
|
|
269
|
+
* A horizontal menu bar component typically used for application menus.
|
|
270
|
+
* Provides keyboard navigation and supports nested submenus.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```tsx
|
|
274
|
+
* // Application menubar
|
|
275
|
+
* <Menubar.Root>
|
|
276
|
+
* <Menubar.Menu>
|
|
277
|
+
* <Menubar.Trigger>File</Menubar.Trigger>
|
|
278
|
+
* <Menubar.Portal>
|
|
279
|
+
* <Menubar.Positioner>
|
|
280
|
+
* <Menubar.Popup>
|
|
281
|
+
* <Menubar.Item onClick={() => newFile()}>New</Menubar.Item>
|
|
282
|
+
* <Menubar.Item onClick={() => openFile()}>Open</Menubar.Item>
|
|
283
|
+
* <Menubar.Separator />
|
|
284
|
+
* <Menubar.Item onClick={() => saveFile()}>Save</Menubar.Item>
|
|
285
|
+
* </Menubar.Popup>
|
|
286
|
+
* </Menubar.Positioner>
|
|
287
|
+
* </Menubar.Portal>
|
|
288
|
+
* </Menubar.Menu>
|
|
289
|
+
* <Menubar.Menu>
|
|
290
|
+
* <Menubar.Trigger>Edit</Menubar.Trigger>
|
|
291
|
+
* <Menubar.Portal>
|
|
292
|
+
* <Menubar.Positioner>
|
|
293
|
+
* <Menubar.Popup>
|
|
294
|
+
* <Menubar.Item>Undo</Menubar.Item>
|
|
295
|
+
* <Menubar.Item>Redo</Menubar.Item>
|
|
296
|
+
* <Menubar.Separator />
|
|
297
|
+
* <Menubar.Item>Cut</Menubar.Item>
|
|
298
|
+
* <Menubar.Item>Copy</Menubar.Item>
|
|
299
|
+
* <Menubar.Item>Paste</Menubar.Item>
|
|
300
|
+
* </Menubar.Popup>
|
|
301
|
+
* </Menubar.Positioner>
|
|
302
|
+
* </Menubar.Portal>
|
|
303
|
+
* </Menubar.Menu>
|
|
304
|
+
* </Menubar.Root>
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* @see {@link https://base-ui.com/react/components/menubar | Base UI Menubar}
|
|
308
|
+
*/
|
|
309
|
+
declare const Menubar: typeof MenubarRoot & {
|
|
310
|
+
Root: typeof MenubarRoot;
|
|
311
|
+
Menu: (props: MenubarMenuProps) => React.JSX.Element;
|
|
312
|
+
Trigger: typeof MenubarTrigger;
|
|
313
|
+
Portal: (props: MenubarPortalProps) => React.JSX.Element;
|
|
314
|
+
Positioner: typeof MenubarPositioner;
|
|
315
|
+
Popup: typeof MenubarPopup;
|
|
316
|
+
Content: typeof MenubarContent;
|
|
317
|
+
Item: typeof MenubarItem;
|
|
318
|
+
Separator: typeof MenubarSeparator;
|
|
319
|
+
Group: typeof MenubarGroup;
|
|
320
|
+
GroupLabel: typeof MenubarGroupLabel;
|
|
321
|
+
Label: typeof MenubarGroupLabel;
|
|
322
|
+
CheckboxItem: typeof MenubarCheckboxItem;
|
|
323
|
+
RadioGroup: typeof MenubarRadioGroup;
|
|
324
|
+
RadioItem: typeof MenubarRadioItem;
|
|
325
|
+
Shortcut: typeof MenubarShortcut;
|
|
326
|
+
Sub: typeof MenubarSub;
|
|
327
|
+
SubContent: typeof MenubarSubContent;
|
|
328
|
+
SubTrigger: typeof MenubarSubTrigger;
|
|
329
|
+
};
|
|
330
|
+
//#endregion
|
|
331
|
+
export { Menubar, MenubarCheckboxItem, MenubarCheckboxItemProps, MenubarContent, MenubarContentProps, MenubarGroup, MenubarGroupLabel, MenubarGroupLabelProps, MenubarGroupProps, MenubarItem, MenubarItemProps, MenubarLabel, MenubarMenu, MenubarMenuProps, MenubarPopup, MenubarPopupProps, MenubarPortal, MenubarPortalProps, MenubarPositioner, MenubarPositionerProps, MenubarProps, MenubarRadioGroup, MenubarRadioGroupProps, MenubarRadioItem, MenubarRadioItemProps, MenubarRoot, MenubarSeparator, MenubarSeparatorProps, MenubarShortcut, MenubarShortcutProps, MenubarSub, MenubarSubContent, MenubarSubContentProps, MenubarSubProps, MenubarSubTrigger, MenubarSubTriggerProps, MenubarTrigger, MenubarTriggerProps };
|