@wonderflow/react-components 3.0.0-beta.21 → 3.0.0-beta.22
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/menu/menu-item/menu-item.d.ts +1 -2
- package/menu/menu-item/menu-item.js +1 -1
- package/menu/menu.js +2 -2
- package/menu/menu.module.css +1 -1
- package/package.json +1 -1
- package/stack/stack.module.css +1 -1
- package/themes/dark.css +1 -1
- package/themes/light.css +1 -1
|
@@ -48,8 +48,7 @@ export declare type MenuItemProps = {
|
|
|
48
48
|
autoFocus?: boolean;
|
|
49
49
|
/**
|
|
50
50
|
* Add an element to decorate the menu item. This is useful for adding extra elements
|
|
51
|
-
* and informations to the menu item.
|
|
52
|
-
* opposite side of the icon, based on `iconPosition`.
|
|
51
|
+
* and informations to the menu item.
|
|
53
52
|
*
|
|
54
53
|
* @note Don't use interactive elements (link, buttons, etc..) as decoration
|
|
55
54
|
* if `Menu.Item` is rendered as ´<button>´ (default).
|
|
@@ -15,7 +15,7 @@ export const MenuItem = forwardRef(({ className, children, onClick, icon, dimens
|
|
|
15
15
|
onClick();
|
|
16
16
|
}
|
|
17
17
|
}, [handleClick, onClick]);
|
|
18
|
-
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", className: ItemContent, horizontalAlign: isIconRight ? 'space-between' : 'start', verticalAlign: "center", columnGap: 8, horizontalPadding: 16, verticalPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Icon, { className: IconClass, name: icon, dimension: dimension === 'small' ? 14 : 16 }, void 0)), _jsxs(Stack, { direction: "row", horizontalAlign: "space-between", children: [children, decoration] }, void 0)] }, void 0)), [children, dimension, icon, isIconRight, decoration, padding]);
|
|
18
|
+
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", className: ItemContent, horizontalAlign: isIconRight ? 'space-between' : 'start', verticalAlign: "center", columnGap: 8, horizontalPadding: 16, verticalPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Icon, { className: IconClass, name: icon, dimension: dimension === 'small' ? 14 : 16 }, void 0)), _jsxs(Stack, { columnGap: 16, direction: "row", horizontalAlign: "space-between", children: [children, decoration] }, void 0)] }, void 0)), [children, dimension, icon, isIconRight, decoration, padding]);
|
|
19
19
|
return (_jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(MenuItemClass, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, ...otherProps, children: description
|
|
20
20
|
? (_jsx(Tooltip, { fill: true, open: focused, placement: "right-start", interactive: true, trigger: InnerContent, children: description }, void 0))
|
|
21
21
|
: InnerContent }, void 0));
|
package/menu/menu.js
CHANGED
|
@@ -3,12 +3,12 @@ import { Children, forwardRef } from 'react';
|
|
|
3
3
|
import { RovingTabIndexProvider } from 'react-roving-tabindex';
|
|
4
4
|
import { MenuItem } from './menu-item/menu-item';
|
|
5
5
|
import { MenuItemCheckbox } from './menu-item/menu-item-checkbox';
|
|
6
|
-
import { Stack, Elevator } from '..';
|
|
6
|
+
import { Stack, Elevator, Card } from '..';
|
|
7
7
|
import { Menu as MenuClass } from './menu.module.css';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
export const Menu = forwardRef(({ className, children, ...otherProps }, forwardedRef) => {
|
|
10
10
|
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
11
|
-
return (_jsx(Elevator, { resting: 2, children: _jsx(
|
|
11
|
+
return (_jsx(Elevator, { resting: 2, children: _jsx(Card, { bordered: true, radius: 8, padding: false, as: "ul", ref: forwardedRef, className: clsx(MenuClass, className), role: "menu", ...otherProps, children: _jsx(RovingTabIndexProvider, { options: { direction: 'vertical', loopAround: true }, children: Children.map(renderedChildren, (child) => (_jsx(Stack, { as: "li", role: "none", verticalPadding: child.type?.displayName === 'Separator' ? 8 : undefined, children: child }, void 0))) }, void 0) }, void 0) }, void 0));
|
|
12
12
|
});
|
|
13
13
|
Menu.displayName = 'Menu';
|
|
14
14
|
Menu.Item = MenuItem;
|
package/menu/menu.module.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Menu{
|
|
1
|
+
.Menu{list-style-type:none;overflow:hidden;padding:.44rem 0;position:relative}.Menu hr{margin:0 .44rem}
|
package/package.json
CHANGED
package/stack/stack.module.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:where(.Stack){grid-gap:var(--rGap,0) var(--cGap,0);align-items:var(--hAlign);display:flex;flex-direction:column;justify-content:var(--vAlign);padding:var(--vPadding,0) var(--hPadding,0)}:where(.Stack):where([data-stack-fill=true]>*
|
|
1
|
+
:where(.Stack){grid-gap:var(--rGap,0) var(--cGap,0);align-items:var(--hAlign);display:flex;flex-direction:column;justify-content:var(--vAlign);padding:var(--vPadding,0) var(--hPadding,0)}:where(.Stack):where([data-stack-fill=true])>*{flex-grow:1}[data-stack-direction=column-reverse]:where(.Stack){flex-direction:column-reverse}[data-stack-direction^=row]:where(.Stack){align-items:var(--vAlign);justify-content:var(--hAlign)}[data-stack-direction=row]:where(.Stack){flex-direction:row}[data-stack-direction=row-reverse]:where(.Stack){flex-direction:row-reverse}[data-stack-inline=true]:where(.Stack){display:inline-flex;flex-grow:0}[data-stack-wrap=true]:where(.Stack){flex-wrap:wrap}
|
package/themes/dark.css
CHANGED