@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,278 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Popover.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props for the Popover.Root component.
|
|
7
|
+
*/
|
|
8
|
+
interface PopoverProps extends React.ComponentPropsWithoutRef<typeof Popover$1.Root> {}
|
|
9
|
+
/**
|
|
10
|
+
* Props for the Popover.Trigger component.
|
|
11
|
+
*/
|
|
12
|
+
interface PopoverTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Trigger>, "className"> {
|
|
13
|
+
/** Additional CSS class names */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
interface PopoverAnchorProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
17
|
+
/**
|
|
18
|
+
* Props for the Popover.Portal component.
|
|
19
|
+
*/
|
|
20
|
+
interface PopoverPortalProps extends React.ComponentPropsWithoutRef<typeof Popover$1.Portal> {}
|
|
21
|
+
/**
|
|
22
|
+
* Props for the Popover.Backdrop component.
|
|
23
|
+
*/
|
|
24
|
+
interface PopoverBackdropProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Backdrop>, "className"> {
|
|
25
|
+
/** Additional CSS class names */
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Props for the Popover.Positioner component.
|
|
30
|
+
*/
|
|
31
|
+
interface PopoverPositionerProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Positioner>, "className"> {
|
|
32
|
+
/** Additional CSS class names */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Props for the Popover.Popup component.
|
|
37
|
+
*/
|
|
38
|
+
interface PopoverPopupProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Popup>, "className"> {
|
|
39
|
+
/** Additional CSS class names */
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Props for the Popover.Arrow component.
|
|
44
|
+
*/
|
|
45
|
+
interface PopoverArrowProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Arrow>, "className"> {
|
|
46
|
+
/** Additional CSS class names */
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props for the Popover.Title component.
|
|
51
|
+
*/
|
|
52
|
+
interface PopoverTitleProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Title>, "className"> {
|
|
53
|
+
/** Additional CSS class names */
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Props for the Popover.Description component.
|
|
58
|
+
*/
|
|
59
|
+
interface PopoverDescriptionProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Description>, "className"> {
|
|
60
|
+
/** Additional CSS class names */
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Props for the Popover.Close component.
|
|
65
|
+
*/
|
|
66
|
+
interface PopoverCloseProps extends Omit<React.ComponentPropsWithoutRef<typeof Popover$1.Close>, "className"> {
|
|
67
|
+
/** Additional CSS class names */
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
type PopoverPlacementProps = Pick<PopoverPositionerProps, "anchor" | "positionMethod" | "side" | "sideOffset" | "align" | "alignOffset" | "collisionBoundary" | "collisionPadding" | "sticky" | "arrowPadding" | "disableAnchorTracking" | "collisionAvoidance">;
|
|
71
|
+
type PopoverContentProps = PopoverPopupProps & PopoverPlacementProps;
|
|
72
|
+
interface PopoverHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
73
|
+
/**
|
|
74
|
+
* Controls the popover's open state and manages triggers.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <Popover.Root>
|
|
79
|
+
* <Popover.Trigger>Open</Popover.Trigger>
|
|
80
|
+
* <Popover.Portal>
|
|
81
|
+
* <Popover.Positioner>
|
|
82
|
+
* <Popover.Popup>
|
|
83
|
+
* <Popover.Title>Popover Title</Popover.Title>
|
|
84
|
+
* <Popover.Description>Content here</Popover.Description>
|
|
85
|
+
* </Popover.Popup>
|
|
86
|
+
* </Popover.Positioner>
|
|
87
|
+
* </Popover.Portal>
|
|
88
|
+
* </Popover.Root>
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @see {@link https://base-ui.com/react/components/popover | Base UI Popover}
|
|
92
|
+
*/
|
|
93
|
+
declare const PopoverRoot: (props: PopoverProps) => React.JSX.Element;
|
|
94
|
+
declare function PopoverAnchor({
|
|
95
|
+
className,
|
|
96
|
+
ref,
|
|
97
|
+
...props
|
|
98
|
+
}: PopoverAnchorProps & {
|
|
99
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
100
|
+
}): React.JSX.Element;
|
|
101
|
+
/**
|
|
102
|
+
* Button that toggles the popover visibility.
|
|
103
|
+
* Renders a `<button>` element.
|
|
104
|
+
*/
|
|
105
|
+
declare function PopoverTrigger({
|
|
106
|
+
className,
|
|
107
|
+
ref,
|
|
108
|
+
...props
|
|
109
|
+
}: PopoverTriggerProps & {
|
|
110
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
111
|
+
}): React.JSX.Element;
|
|
112
|
+
/**
|
|
113
|
+
* Renders popover content in a portal outside the DOM hierarchy.
|
|
114
|
+
*/
|
|
115
|
+
declare const PopoverPortal: (props: PopoverPortalProps) => React.JSX.Element;
|
|
116
|
+
/**
|
|
117
|
+
* Optional backdrop that appears behind the popover.
|
|
118
|
+
*/
|
|
119
|
+
declare function PopoverBackdrop({
|
|
120
|
+
className,
|
|
121
|
+
ref,
|
|
122
|
+
...props
|
|
123
|
+
}: PopoverBackdropProps & {
|
|
124
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
125
|
+
}): React.JSX.Element;
|
|
126
|
+
/**
|
|
127
|
+
* Positions the popup relative to the trigger element.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```tsx
|
|
131
|
+
* // Position on the right with offset
|
|
132
|
+
* <Popover.Positioner side="right" sideOffset={8}>
|
|
133
|
+
* <Popover.Popup>...</Popover.Popup>
|
|
134
|
+
* </Popover.Positioner>
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
declare function PopoverPositioner({
|
|
138
|
+
className,
|
|
139
|
+
anchor,
|
|
140
|
+
ref,
|
|
141
|
+
...props
|
|
142
|
+
}: PopoverPositionerProps & {
|
|
143
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
144
|
+
}): React.JSX.Element;
|
|
145
|
+
/**
|
|
146
|
+
* The popup container that holds the popover content.
|
|
147
|
+
*/
|
|
148
|
+
declare function PopoverPopup({
|
|
149
|
+
className,
|
|
150
|
+
ref,
|
|
151
|
+
...props
|
|
152
|
+
}: PopoverPopupProps & {
|
|
153
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
154
|
+
}): React.JSX.Element;
|
|
155
|
+
declare function PopoverContent({
|
|
156
|
+
anchor,
|
|
157
|
+
positionMethod,
|
|
158
|
+
side,
|
|
159
|
+
sideOffset,
|
|
160
|
+
align,
|
|
161
|
+
alignOffset,
|
|
162
|
+
collisionBoundary,
|
|
163
|
+
collisionPadding,
|
|
164
|
+
sticky,
|
|
165
|
+
arrowPadding,
|
|
166
|
+
disableAnchorTracking,
|
|
167
|
+
collisionAvoidance,
|
|
168
|
+
...props
|
|
169
|
+
}: PopoverContentProps & {
|
|
170
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
171
|
+
}): React.JSX.Element;
|
|
172
|
+
declare function PopoverHeader({
|
|
173
|
+
className,
|
|
174
|
+
ref,
|
|
175
|
+
...props
|
|
176
|
+
}: PopoverHeaderProps & {
|
|
177
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
178
|
+
}): React.JSX.Element;
|
|
179
|
+
/**
|
|
180
|
+
* Directional arrow pointing to the trigger element.
|
|
181
|
+
*/
|
|
182
|
+
declare function PopoverArrow({
|
|
183
|
+
className,
|
|
184
|
+
ref,
|
|
185
|
+
...props
|
|
186
|
+
}: PopoverArrowProps & {
|
|
187
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
188
|
+
}): React.JSX.Element;
|
|
189
|
+
/**
|
|
190
|
+
* Semantic title for the popover content.
|
|
191
|
+
* Renders an `<h2>` element.
|
|
192
|
+
*/
|
|
193
|
+
declare function PopoverTitle({
|
|
194
|
+
className,
|
|
195
|
+
ref,
|
|
196
|
+
...props
|
|
197
|
+
}: PopoverTitleProps & {
|
|
198
|
+
ref?: React.Ref<HTMLHeadingElement>;
|
|
199
|
+
}): React.JSX.Element;
|
|
200
|
+
/**
|
|
201
|
+
* Description text for the popover content.
|
|
202
|
+
* Renders a `<p>` element.
|
|
203
|
+
*/
|
|
204
|
+
declare function PopoverDescription({
|
|
205
|
+
className,
|
|
206
|
+
ref,
|
|
207
|
+
...props
|
|
208
|
+
}: PopoverDescriptionProps & {
|
|
209
|
+
ref?: React.Ref<HTMLParagraphElement>;
|
|
210
|
+
}): React.JSX.Element;
|
|
211
|
+
/**
|
|
212
|
+
* Button that closes the popover.
|
|
213
|
+
*/
|
|
214
|
+
declare function PopoverClose({
|
|
215
|
+
className,
|
|
216
|
+
ref,
|
|
217
|
+
...props
|
|
218
|
+
}: PopoverCloseProps & {
|
|
219
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
220
|
+
}): React.JSX.Element;
|
|
221
|
+
/**
|
|
222
|
+
* An accessible popup anchored to a trigger button.
|
|
223
|
+
* Supports flexible positioning, animations, and optional backdrop.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```tsx
|
|
227
|
+
* // Basic popover
|
|
228
|
+
* <Popover.Root>
|
|
229
|
+
* <Popover.Trigger>Click me</Popover.Trigger>
|
|
230
|
+
* <Popover.Portal>
|
|
231
|
+
* <Popover.Positioner>
|
|
232
|
+
* <Popover.Popup>
|
|
233
|
+
* <Popover.Title>Settings</Popover.Title>
|
|
234
|
+
* <Popover.Description>
|
|
235
|
+
* Configure your preferences here.
|
|
236
|
+
* </Popover.Description>
|
|
237
|
+
* <Popover.Close>Close</Popover.Close>
|
|
238
|
+
* </Popover.Popup>
|
|
239
|
+
* </Popover.Positioner>
|
|
240
|
+
* </Popover.Portal>
|
|
241
|
+
* </Popover.Root>
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```tsx
|
|
246
|
+
* // With arrow and custom positioning
|
|
247
|
+
* <Popover.Root>
|
|
248
|
+
* <Popover.Trigger>Info</Popover.Trigger>
|
|
249
|
+
* <Popover.Portal>
|
|
250
|
+
* <Popover.Positioner side="right" sideOffset={8}>
|
|
251
|
+
* <Popover.Popup>
|
|
252
|
+
* <Popover.Arrow />
|
|
253
|
+
* <p>Additional information</p>
|
|
254
|
+
* </Popover.Popup>
|
|
255
|
+
* </Popover.Positioner>
|
|
256
|
+
* </Popover.Portal>
|
|
257
|
+
* </Popover.Root>
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* @see {@link https://base-ui.com/react/components/popover | Base UI Popover}
|
|
261
|
+
*/
|
|
262
|
+
declare const Popover: ((props: PopoverProps) => React.JSX.Element) & {
|
|
263
|
+
Root: (props: PopoverProps) => React.JSX.Element;
|
|
264
|
+
Anchor: typeof PopoverAnchor;
|
|
265
|
+
Trigger: typeof PopoverTrigger;
|
|
266
|
+
Portal: (props: PopoverPortalProps) => React.JSX.Element;
|
|
267
|
+
Backdrop: typeof PopoverBackdrop;
|
|
268
|
+
Positioner: typeof PopoverPositioner;
|
|
269
|
+
Popup: typeof PopoverPopup;
|
|
270
|
+
Content: typeof PopoverContent;
|
|
271
|
+
Header: typeof PopoverHeader;
|
|
272
|
+
Arrow: typeof PopoverArrow;
|
|
273
|
+
Title: typeof PopoverTitle;
|
|
274
|
+
Description: typeof PopoverDescription;
|
|
275
|
+
Close: typeof PopoverClose;
|
|
276
|
+
};
|
|
277
|
+
//#endregion
|
|
278
|
+
export { Popover, PopoverAnchor, PopoverAnchorProps, PopoverArrow, PopoverArrowProps, PopoverBackdrop, PopoverBackdropProps, PopoverClose, PopoverCloseProps, PopoverContent, PopoverContentProps, PopoverDescription, PopoverDescriptionProps, PopoverHeader, PopoverHeaderProps, PopoverPopup, PopoverPopupProps, PopoverPortal, PopoverPortalProps, PopoverPositioner, PopoverPositionerProps, PopoverProps, PopoverRoot, PopoverTitle, PopoverTitleProps, PopoverTrigger, PopoverTriggerProps };
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
4
|
+
//#region src/components/Popover.tsx
|
|
5
|
+
const PopoverAnchorContext = React.createContext(null);
|
|
6
|
+
function setRefs(node, ...refs) {
|
|
7
|
+
for (const ref of refs) if (typeof ref === "function") ref(node);
|
|
8
|
+
else if (ref) ref.current = node;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Controls the popover's open state and manages triggers.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Popover.Root>
|
|
16
|
+
* <Popover.Trigger>Open</Popover.Trigger>
|
|
17
|
+
* <Popover.Portal>
|
|
18
|
+
* <Popover.Positioner>
|
|
19
|
+
* <Popover.Popup>
|
|
20
|
+
* <Popover.Title>Popover Title</Popover.Title>
|
|
21
|
+
* <Popover.Description>Content here</Popover.Description>
|
|
22
|
+
* </Popover.Popup>
|
|
23
|
+
* </Popover.Positioner>
|
|
24
|
+
* </Popover.Portal>
|
|
25
|
+
* </Popover.Root>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://base-ui.com/react/components/popover | Base UI Popover}
|
|
29
|
+
*/
|
|
30
|
+
const PopoverRoot = (props) => {
|
|
31
|
+
const anchorRef = React.useRef(null);
|
|
32
|
+
return /* @__PURE__ */ jsx(PopoverAnchorContext.Provider, {
|
|
33
|
+
value: anchorRef,
|
|
34
|
+
children: /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
35
|
+
"data-slot": "popover",
|
|
36
|
+
...props
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
function PopoverAnchor({ className = "", ref, ...props }) {
|
|
41
|
+
const anchorRef = React.useContext(PopoverAnchorContext);
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
ref: (node) => setRefs(node, anchorRef, ref),
|
|
44
|
+
"data-slot": "popover-anchor",
|
|
45
|
+
className: ["popover__anchor", className].filter(Boolean).join(" "),
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Button that toggles the popover visibility.
|
|
51
|
+
* Renders a `<button>` element.
|
|
52
|
+
*/
|
|
53
|
+
function PopoverTrigger({ className = "", ref, ...props }) {
|
|
54
|
+
const classes = ["popover__trigger", className].filter(Boolean).join(" ");
|
|
55
|
+
return /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
56
|
+
ref,
|
|
57
|
+
"data-slot": "popover-trigger",
|
|
58
|
+
className: classes,
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Renders popover content in a portal outside the DOM hierarchy.
|
|
64
|
+
*/
|
|
65
|
+
const PopoverPortal = (props) => {
|
|
66
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { ...props });
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Optional backdrop that appears behind the popover.
|
|
70
|
+
*/
|
|
71
|
+
function PopoverBackdrop({ className = "", ref, ...props }) {
|
|
72
|
+
const classes = ["popover__backdrop", className].filter(Boolean).join(" ");
|
|
73
|
+
return /* @__PURE__ */ jsx(Popover$1.Backdrop, {
|
|
74
|
+
ref,
|
|
75
|
+
"data-slot": "popover-backdrop",
|
|
76
|
+
className: classes,
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Positions the popup relative to the trigger element.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* // Position on the right with offset
|
|
86
|
+
* <Popover.Positioner side="right" sideOffset={8}>
|
|
87
|
+
* <Popover.Popup>...</Popover.Popup>
|
|
88
|
+
* </Popover.Positioner>
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
function PopoverPositioner({ className = "", anchor, ref, ...props }) {
|
|
92
|
+
const anchorRef = React.useContext(PopoverAnchorContext);
|
|
93
|
+
const classes = ["popover__positioner", className].filter(Boolean).join(" ");
|
|
94
|
+
return /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
95
|
+
ref,
|
|
96
|
+
anchor: anchor ?? anchorRef ?? void 0,
|
|
97
|
+
className: classes,
|
|
98
|
+
...props
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The popup container that holds the popover content.
|
|
103
|
+
*/
|
|
104
|
+
function PopoverPopup({ className = "", ref, ...props }) {
|
|
105
|
+
const classes = ["popover__popup", className].filter(Boolean).join(" ");
|
|
106
|
+
return /* @__PURE__ */ jsx(Popover$1.Popup, {
|
|
107
|
+
ref,
|
|
108
|
+
"data-slot": "popover-content",
|
|
109
|
+
className: classes,
|
|
110
|
+
...props
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function PopoverContent({ anchor, positionMethod, side, sideOffset = 4, align = "center", alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, ...props }) {
|
|
114
|
+
return /* @__PURE__ */ jsx(PopoverPortal, { children: /* @__PURE__ */ jsx(PopoverPositioner, {
|
|
115
|
+
anchor,
|
|
116
|
+
positionMethod,
|
|
117
|
+
side,
|
|
118
|
+
sideOffset,
|
|
119
|
+
align,
|
|
120
|
+
alignOffset,
|
|
121
|
+
collisionBoundary,
|
|
122
|
+
collisionPadding,
|
|
123
|
+
sticky,
|
|
124
|
+
arrowPadding,
|
|
125
|
+
disableAnchorTracking,
|
|
126
|
+
collisionAvoidance,
|
|
127
|
+
children: /* @__PURE__ */ jsx(PopoverPopup, { ...props })
|
|
128
|
+
}) });
|
|
129
|
+
}
|
|
130
|
+
function PopoverHeader({ className = "", ref, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx("div", {
|
|
132
|
+
ref,
|
|
133
|
+
"data-slot": "popover-header",
|
|
134
|
+
className: ["popover__header", className].filter(Boolean).join(" "),
|
|
135
|
+
...props
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Directional arrow pointing to the trigger element.
|
|
140
|
+
*/
|
|
141
|
+
function PopoverArrow({ className = "", ref, ...props }) {
|
|
142
|
+
const classes = ["popover__arrow", className].filter(Boolean).join(" ");
|
|
143
|
+
return /* @__PURE__ */ jsx(Popover$1.Arrow, {
|
|
144
|
+
ref,
|
|
145
|
+
"data-slot": "popover-arrow",
|
|
146
|
+
className: classes,
|
|
147
|
+
...props
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Semantic title for the popover content.
|
|
152
|
+
* Renders an `<h2>` element.
|
|
153
|
+
*/
|
|
154
|
+
function PopoverTitle({ className = "", ref, ...props }) {
|
|
155
|
+
const classes = ["popover__title", className].filter(Boolean).join(" ");
|
|
156
|
+
return /* @__PURE__ */ jsx(Popover$1.Title, {
|
|
157
|
+
ref,
|
|
158
|
+
"data-slot": "popover-title",
|
|
159
|
+
className: classes,
|
|
160
|
+
...props
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Description text for the popover content.
|
|
165
|
+
* Renders a `<p>` element.
|
|
166
|
+
*/
|
|
167
|
+
function PopoverDescription({ className = "", ref, ...props }) {
|
|
168
|
+
const classes = ["popover__description", className].filter(Boolean).join(" ");
|
|
169
|
+
return /* @__PURE__ */ jsx(Popover$1.Description, {
|
|
170
|
+
ref,
|
|
171
|
+
"data-slot": "popover-description",
|
|
172
|
+
className: classes,
|
|
173
|
+
...props
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Button that closes the popover.
|
|
178
|
+
*/
|
|
179
|
+
function PopoverClose({ className = "", ref, ...props }) {
|
|
180
|
+
const classes = ["popover__close", className].filter(Boolean).join(" ");
|
|
181
|
+
return /* @__PURE__ */ jsx(Popover$1.Close, {
|
|
182
|
+
ref,
|
|
183
|
+
"data-slot": "popover-close",
|
|
184
|
+
className: classes,
|
|
185
|
+
...props
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* An accessible popup anchored to a trigger button.
|
|
190
|
+
* Supports flexible positioning, animations, and optional backdrop.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* // Basic popover
|
|
195
|
+
* <Popover.Root>
|
|
196
|
+
* <Popover.Trigger>Click me</Popover.Trigger>
|
|
197
|
+
* <Popover.Portal>
|
|
198
|
+
* <Popover.Positioner>
|
|
199
|
+
* <Popover.Popup>
|
|
200
|
+
* <Popover.Title>Settings</Popover.Title>
|
|
201
|
+
* <Popover.Description>
|
|
202
|
+
* Configure your preferences here.
|
|
203
|
+
* </Popover.Description>
|
|
204
|
+
* <Popover.Close>Close</Popover.Close>
|
|
205
|
+
* </Popover.Popup>
|
|
206
|
+
* </Popover.Positioner>
|
|
207
|
+
* </Popover.Portal>
|
|
208
|
+
* </Popover.Root>
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```tsx
|
|
213
|
+
* // With arrow and custom positioning
|
|
214
|
+
* <Popover.Root>
|
|
215
|
+
* <Popover.Trigger>Info</Popover.Trigger>
|
|
216
|
+
* <Popover.Portal>
|
|
217
|
+
* <Popover.Positioner side="right" sideOffset={8}>
|
|
218
|
+
* <Popover.Popup>
|
|
219
|
+
* <Popover.Arrow />
|
|
220
|
+
* <p>Additional information</p>
|
|
221
|
+
* </Popover.Popup>
|
|
222
|
+
* </Popover.Positioner>
|
|
223
|
+
* </Popover.Portal>
|
|
224
|
+
* </Popover.Root>
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @see {@link https://base-ui.com/react/components/popover | Base UI Popover}
|
|
228
|
+
*/
|
|
229
|
+
const Popover = Object.assign(PopoverRoot, {
|
|
230
|
+
Root: PopoverRoot,
|
|
231
|
+
Anchor: PopoverAnchor,
|
|
232
|
+
Trigger: PopoverTrigger,
|
|
233
|
+
Portal: PopoverPortal,
|
|
234
|
+
Backdrop: PopoverBackdrop,
|
|
235
|
+
Positioner: PopoverPositioner,
|
|
236
|
+
Popup: PopoverPopup,
|
|
237
|
+
Content: PopoverContent,
|
|
238
|
+
Header: PopoverHeader,
|
|
239
|
+
Arrow: PopoverArrow,
|
|
240
|
+
Title: PopoverTitle,
|
|
241
|
+
Description: PopoverDescription,
|
|
242
|
+
Close: PopoverClose
|
|
243
|
+
});
|
|
244
|
+
//#endregion
|
|
245
|
+
export { Popover, PopoverAnchor, PopoverArrow, PopoverBackdrop, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverRoot, PopoverTitle, PopoverTrigger };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PreviewCard as PreviewCard$1 } from "@base-ui/react/preview-card";
|
|
3
|
+
|
|
4
|
+
//#region src/components/PreviewCard.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props for the PreviewCard.Root component.
|
|
7
|
+
*/
|
|
8
|
+
interface PreviewCardProps extends React.ComponentPropsWithoutRef<typeof PreviewCard$1.Root> {}
|
|
9
|
+
/**
|
|
10
|
+
* Props for the PreviewCard.Trigger component.
|
|
11
|
+
*/
|
|
12
|
+
interface PreviewCardTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof PreviewCard$1.Trigger>, "className"> {
|
|
13
|
+
/** Additional CSS class names */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Props for the PreviewCard.Portal component.
|
|
18
|
+
*/
|
|
19
|
+
interface PreviewCardPortalProps extends React.ComponentPropsWithoutRef<typeof PreviewCard$1.Portal> {}
|
|
20
|
+
/**
|
|
21
|
+
* Props for the PreviewCard.Backdrop component.
|
|
22
|
+
*/
|
|
23
|
+
interface PreviewCardBackdropProps extends Omit<React.ComponentPropsWithoutRef<typeof PreviewCard$1.Backdrop>, "className"> {
|
|
24
|
+
/** Additional CSS class names */
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Props for the PreviewCard.Positioner component.
|
|
29
|
+
*/
|
|
30
|
+
interface PreviewCardPositionerProps extends Omit<React.ComponentPropsWithoutRef<typeof PreviewCard$1.Positioner>, "className"> {
|
|
31
|
+
/** Additional CSS class names */
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Props for the PreviewCard.Popup component.
|
|
36
|
+
*/
|
|
37
|
+
interface PreviewCardPopupProps extends Omit<React.ComponentPropsWithoutRef<typeof PreviewCard$1.Popup>, "className"> {
|
|
38
|
+
/** Additional CSS class names */
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
type PreviewCardPlacementProps = Pick<PreviewCardPositionerProps, "anchor" | "positionMethod" | "side" | "sideOffset" | "align" | "alignOffset" | "collisionBoundary" | "collisionPadding" | "sticky" | "arrowPadding" | "disableAnchorTracking" | "collisionAvoidance">;
|
|
42
|
+
type PreviewCardContentProps = PreviewCardPopupProps & PreviewCardPlacementProps;
|
|
43
|
+
/**
|
|
44
|
+
* Props for the PreviewCard.Arrow component.
|
|
45
|
+
*/
|
|
46
|
+
interface PreviewCardArrowProps extends Omit<React.ComponentPropsWithoutRef<typeof PreviewCard$1.Arrow>, "className"> {
|
|
47
|
+
/** Additional CSS class names */
|
|
48
|
+
className?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Link element that triggers the preview card on hover.
|
|
52
|
+
*/
|
|
53
|
+
declare function PreviewCardTrigger({
|
|
54
|
+
className,
|
|
55
|
+
ref,
|
|
56
|
+
...props
|
|
57
|
+
}: PreviewCardTriggerProps & {
|
|
58
|
+
ref?: React.Ref<HTMLAnchorElement>;
|
|
59
|
+
}): React.JSX.Element;
|
|
60
|
+
/**
|
|
61
|
+
* Optional backdrop behind the preview card.
|
|
62
|
+
*/
|
|
63
|
+
declare function PreviewCardBackdrop({
|
|
64
|
+
className,
|
|
65
|
+
ref,
|
|
66
|
+
...props
|
|
67
|
+
}: PreviewCardBackdropProps & {
|
|
68
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
69
|
+
}): React.JSX.Element;
|
|
70
|
+
/**
|
|
71
|
+
* Positions the preview card relative to the trigger.
|
|
72
|
+
*/
|
|
73
|
+
declare function PreviewCardPositioner({
|
|
74
|
+
className,
|
|
75
|
+
ref,
|
|
76
|
+
...props
|
|
77
|
+
}: PreviewCardPositionerProps & {
|
|
78
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
79
|
+
}): React.JSX.Element;
|
|
80
|
+
/**
|
|
81
|
+
* Container for preview card content.
|
|
82
|
+
*/
|
|
83
|
+
declare function PreviewCardPopup({
|
|
84
|
+
className,
|
|
85
|
+
ref,
|
|
86
|
+
...props
|
|
87
|
+
}: PreviewCardPopupProps & {
|
|
88
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
89
|
+
}): React.JSX.Element;
|
|
90
|
+
declare function PreviewCardContent({
|
|
91
|
+
anchor,
|
|
92
|
+
positionMethod,
|
|
93
|
+
side,
|
|
94
|
+
sideOffset,
|
|
95
|
+
align,
|
|
96
|
+
alignOffset,
|
|
97
|
+
collisionBoundary,
|
|
98
|
+
collisionPadding,
|
|
99
|
+
sticky,
|
|
100
|
+
arrowPadding,
|
|
101
|
+
disableAnchorTracking,
|
|
102
|
+
collisionAvoidance,
|
|
103
|
+
...props
|
|
104
|
+
}: PreviewCardContentProps & {
|
|
105
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
106
|
+
}): React.JSX.Element;
|
|
107
|
+
/**
|
|
108
|
+
* Decorative arrow pointing to the trigger.
|
|
109
|
+
*/
|
|
110
|
+
declare function PreviewCardArrow({
|
|
111
|
+
className,
|
|
112
|
+
ref,
|
|
113
|
+
...props
|
|
114
|
+
}: PreviewCardArrowProps & {
|
|
115
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
116
|
+
}): React.JSX.Element;
|
|
117
|
+
/**
|
|
118
|
+
* A popup that appears when a link is hovered, showing a preview for sighted users.
|
|
119
|
+
* Useful for showing user profiles, link previews, or additional context.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx
|
|
123
|
+
* // Basic preview card
|
|
124
|
+
* <PreviewCard.Root>
|
|
125
|
+
* <PreviewCard.Trigger href="/users/john">
|
|
126
|
+
* @johndoe
|
|
127
|
+
* </PreviewCard.Trigger>
|
|
128
|
+
* <PreviewCard.Portal>
|
|
129
|
+
* <PreviewCard.Positioner sideOffset={8}>
|
|
130
|
+
* <PreviewCard.Popup>
|
|
131
|
+
* <PreviewCard.Arrow />
|
|
132
|
+
* <div className="preview-content">
|
|
133
|
+
* <img src="/john-avatar.jpg" alt="" />
|
|
134
|
+
* <h4>John Doe</h4>
|
|
135
|
+
* <p>Software Engineer at Acme Corp</p>
|
|
136
|
+
* </div>
|
|
137
|
+
* </PreviewCard.Popup>
|
|
138
|
+
* </PreviewCard.Positioner>
|
|
139
|
+
* </PreviewCard.Portal>
|
|
140
|
+
* </PreviewCard.Root>
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @see {@link https://base-ui.com/react/components/preview-card | Base UI PreviewCard}
|
|
144
|
+
*/
|
|
145
|
+
declare const PreviewCard: {
|
|
146
|
+
Root: (props: PreviewCardProps) => React.JSX.Element;
|
|
147
|
+
Trigger: typeof PreviewCardTrigger;
|
|
148
|
+
Content: typeof PreviewCardContent;
|
|
149
|
+
Portal: (props: PreviewCardPortalProps) => React.JSX.Element;
|
|
150
|
+
Backdrop: typeof PreviewCardBackdrop;
|
|
151
|
+
Positioner: typeof PreviewCardPositioner;
|
|
152
|
+
Popup: typeof PreviewCardPopup;
|
|
153
|
+
Arrow: typeof PreviewCardArrow;
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
export { PreviewCard, PreviewCardArrowProps, PreviewCardBackdropProps, PreviewCardContentProps, PreviewCardPopupProps, PreviewCardPortalProps, PreviewCardPositionerProps, PreviewCardProps, PreviewCardTriggerProps };
|