@aurora-ds/components 0.23.0 → 0.23.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/cjs/components/overlay/menu/MenuItem/MenuItem.props.d.ts +5 -0
- package/dist/cjs/components/overlay/menu/MenuItem/MenuItem.styles.d.ts +2 -1
- package/dist/cjs/index.js +8 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/overlay/menu/MenuItem/MenuItem.props.d.ts +5 -0
- package/dist/esm/components/overlay/menu/MenuItem/MenuItem.styles.d.ts +2 -1
- package/dist/esm/index.js +8 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +2 -2
|
@@ -6,4 +6,9 @@ export type MenuItemProps = {
|
|
|
6
6
|
onClick: () => void;
|
|
7
7
|
textColor?: keyof ThemeContract['colors'];
|
|
8
8
|
iconColor?: keyof ThemeContract['colors'];
|
|
9
|
+
/** If true, the menu item is highlighted as active */
|
|
10
|
+
active?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type MenuItemStyleParams = {
|
|
13
|
+
active: boolean;
|
|
9
14
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -1609,28 +1609,30 @@ const MenuGroup = ({ children }) => {
|
|
|
1609
1609
|
MenuGroup.displayName = 'MenuGroup';
|
|
1610
1610
|
|
|
1611
1611
|
const MENU_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
1612
|
-
root: {
|
|
1612
|
+
root: ({ active }) => ({
|
|
1613
1613
|
display: 'flex',
|
|
1614
1614
|
alignItems: 'center',
|
|
1615
1615
|
gap: theme.spacing.sm,
|
|
1616
1616
|
padding: theme.spacing.sm,
|
|
1617
1617
|
borderRadius: theme.radius.sm,
|
|
1618
|
-
backgroundColor: theme.colors.surface,
|
|
1618
|
+
backgroundColor: active ? theme.colors.primary : theme.colors.surface,
|
|
1619
1619
|
outline: 'none',
|
|
1620
1620
|
border: 'none',
|
|
1621
1621
|
cursor: 'pointer',
|
|
1622
1622
|
minHeight: MENU_ITEM_SIZE,
|
|
1623
1623
|
maxHeight: MENU_ITEM_SIZE,
|
|
1624
1624
|
flexShrink: 0,
|
|
1625
|
+
width: '100%',
|
|
1625
1626
|
transition: 'background-color 150ms ease-in-out',
|
|
1627
|
+
color: active ? theme.colors.surface : theme.colors.text,
|
|
1626
1628
|
':hover': {
|
|
1627
|
-
backgroundColor: theme.colors.surfaceHover,
|
|
1629
|
+
backgroundColor: active ? theme.colors.primary : theme.colors.surfaceHover,
|
|
1628
1630
|
},
|
|
1629
|
-
},
|
|
1631
|
+
}),
|
|
1630
1632
|
}));
|
|
1631
1633
|
|
|
1632
|
-
const MenuItem = ({ label, icon, onClick, textColor, iconColor }) => {
|
|
1633
|
-
return (jsxRuntime.jsxs("button", { className: MENU_ITEM_STYLES.root, onClick: onClick, children: [icon && (jsxRuntime.jsx(Icon, { color: iconColor ?? 'text', size: 'sm', children: icon })), jsxRuntime.jsx(Text, { variant: 'label', color: textColor ?? 'text', maxLines: 1, fontSize: 'sm', children: label })] }));
|
|
1634
|
+
const MenuItem = ({ label, icon, onClick, textColor, iconColor, active = false }) => {
|
|
1635
|
+
return (jsxRuntime.jsxs("button", { className: MENU_ITEM_STYLES.root({ active }), onClick: onClick, children: [icon && (jsxRuntime.jsx(Icon, { color: active ? 'surface' : (iconColor ?? 'text'), size: 'sm', children: icon })), jsxRuntime.jsx(Text, { variant: 'label', color: active ? 'surface' : (textColor ?? 'text'), maxLines: 1, fontSize: 'sm', children: label })] }));
|
|
1634
1636
|
};
|
|
1635
1637
|
MenuItem.displayName = 'MenuItem';
|
|
1636
1638
|
|