@rovula/ui 0.1.24 → 0.1.25
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/cjs/bundle.js +1 -1
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/patterns/menu/Menu.js +6 -1
- package/package.json +1 -1
- package/src/patterns/menu/Menu.tsx +24 -18
|
@@ -86,7 +86,12 @@ function renderMenuItems(items, selectedValues, onSelect) {
|
|
|
86
86
|
// - Full a11y / WAI-ARIA
|
|
87
87
|
// - Sub-menu support via DropdownMenuSub
|
|
88
88
|
// ---------------------------------------------------------------------------
|
|
89
|
-
export const Menu = ({ trigger, items, selectedValues = [], onSelect, header, open, onOpenChange, align = "start", side = "bottom", sideOffset = 4, contentClassName, testId, }) => (
|
|
89
|
+
export const Menu = ({ trigger, items, selectedValues = [], onSelect, header, open, onOpenChange, align = "start", side = "bottom", sideOffset = 4, contentClassName, testId, }) => (
|
|
90
|
+
// Stop click events from bubbling through React's portal event system.
|
|
91
|
+
// DropdownMenuContent renders in a DOM portal (document.body) but React
|
|
92
|
+
// synthetic events still bubble through the component tree, so clicks on
|
|
93
|
+
// menu items reach ancestor onClick handlers (e.g. a clickable card).
|
|
94
|
+
_jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsxs(DropdownMenuRoot, { open: open, onOpenChange: onOpenChange, children: [trigger && (_jsx(DropdownMenuTrigger, { asChild: true, children: trigger })), _jsxs(DropdownMenuContent, { align: align, side: side, sideOffset: sideOffset, className: contentClassName, "data-testid": testId, children: [header && (_jsx("div", { className: "sticky top-0 z-10 bg-modal-surface border-b border-[var(--dropdown-menu-seperator-bg)]", children: header })), renderMenuItems(items, selectedValues, onSelect)] })] }) }));
|
|
90
95
|
Menu.displayName = "Menu";
|
|
91
96
|
// ---------------------------------------------------------------------------
|
|
92
97
|
// Re-exports — backward compat for consumers using Menu's sub-components
|
package/package.json
CHANGED
|
@@ -255,25 +255,31 @@ export const Menu = ({
|
|
|
255
255
|
contentClassName,
|
|
256
256
|
testId,
|
|
257
257
|
}: MenuProps) => (
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
className={contentClassName}
|
|
267
|
-
data-testid={testId}
|
|
268
|
-
>
|
|
269
|
-
{header && (
|
|
270
|
-
<div className="sticky top-0 z-10 bg-modal-surface border-b border-[var(--dropdown-menu-seperator-bg)]">
|
|
271
|
-
{header}
|
|
272
|
-
</div>
|
|
258
|
+
// Stop click events from bubbling through React's portal event system.
|
|
259
|
+
// DropdownMenuContent renders in a DOM portal (document.body) but React
|
|
260
|
+
// synthetic events still bubble through the component tree, so clicks on
|
|
261
|
+
// menu items reach ancestor onClick handlers (e.g. a clickable card).
|
|
262
|
+
<div onClick={(e) => e.stopPropagation()}>
|
|
263
|
+
<DropdownMenuRoot open={open} onOpenChange={onOpenChange}>
|
|
264
|
+
{trigger && (
|
|
265
|
+
<DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>
|
|
273
266
|
)}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
267
|
+
<DropdownMenuContent
|
|
268
|
+
align={align}
|
|
269
|
+
side={side}
|
|
270
|
+
sideOffset={sideOffset}
|
|
271
|
+
className={contentClassName}
|
|
272
|
+
data-testid={testId}
|
|
273
|
+
>
|
|
274
|
+
{header && (
|
|
275
|
+
<div className="sticky top-0 z-10 bg-modal-surface border-b border-[var(--dropdown-menu-seperator-bg)]">
|
|
276
|
+
{header}
|
|
277
|
+
</div>
|
|
278
|
+
)}
|
|
279
|
+
{renderMenuItems(items, selectedValues, onSelect)}
|
|
280
|
+
</DropdownMenuContent>
|
|
281
|
+
</DropdownMenuRoot>
|
|
282
|
+
</div>
|
|
277
283
|
);
|
|
278
284
|
|
|
279
285
|
Menu.displayName = "Menu";
|