Skip to content

Commit a8a761e

Browse files
committed
fix(Menu): item styles
1 parent 7d7aa37 commit a8a761e

File tree

4 files changed

+53
-11
lines changed

4 files changed

+53
-11
lines changed

.changeset/big-suns-complain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fixes Menu Item disabled styles.

src/components/pickers/Menu/Menu.stories.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,42 @@ export const Default = ({ ...props }) => {
8383
);
8484
};
8585

86+
export const DisabledKeys = ({ ...props }) => {
87+
const menu = (
88+
<Menu id="menu" disabledKeys={['red', 'yellow']} {...props} width="220px">
89+
<Menu.Item key="red" postfix="Ctr+C">
90+
Copy
91+
</Menu.Item>
92+
<Menu.Item key="orange" postfix="Ctr+V">
93+
Paste
94+
</Menu.Item>
95+
<Menu.Item key="yellow" postfix="Ctr+X">
96+
Cut
97+
</Menu.Item>
98+
</Menu>
99+
);
100+
101+
return (
102+
<Space
103+
gap="10x"
104+
placeContent="start start"
105+
placeItems="start"
106+
height="400px"
107+
>
108+
{menu}
109+
110+
<MenuTrigger>
111+
<Button
112+
size="small"
113+
icon={<MoreIcon />}
114+
aria-label="Open Context Menu"
115+
/>
116+
{menu}
117+
</MenuTrigger>
118+
</Space>
119+
);
120+
};
121+
86122
export const InsideModal = () => {
87123
return (
88124
<DialogContainer>

src/components/pickers/Menu/Menu.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ import { MenuSection } from './MenuSection';
2626
import { StyledMenu, StyledMenuHeader } from './styled';
2727

2828
export interface CubeMenuProps<T>
29-
extends ContainerStyleProps,
29+
extends BaseProps,
30+
ContainerStyleProps,
3031
AriaMenuProps<T> {
3132
selectionIcon?: MenuSelectionType;
3233
// @deprecated
@@ -51,10 +52,11 @@ function Menu<T extends object>(
5152
sectionHeadingStyles,
5253
selectionIcon,
5354
qa,
55+
...rest
5456
} = props;
5557
const domRef = useDOMRef(ref);
5658
const contextProps = useMenuContext();
57-
const completeProps = mergeProps(contextProps, props);
59+
const completeProps = mergeProps(contextProps, rest);
5860

5961
const state = useTreeState(completeProps);
6062
const items = [...state.collection];

src/components/pickers/Menu/MenuButton.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ const StyledButton = tasty(Block, {
2323
'': '#clear',
2424
hovered: '#dark.03',
2525
'pressed | selected': '#dark.06',
26-
'[disabled] & ![data-type="link"]': '#dark.04',
26+
disabled: '#dark.04',
27+
},
28+
color: {
29+
'': '#dark-02',
30+
hovered: '#dark-02',
31+
pressed: '#dark',
32+
disabled: '#dark-04',
2733
},
2834
cursor: {
2935
'': 'pointer',
@@ -54,14 +60,7 @@ const StyledButton = tasty(Block, {
5460
placeItems: 'center',
5561
},
5662

57-
Postfix: {
58-
color: {
59-
'': '#dark-03',
60-
'hovered | focused': '#dark-03',
61-
'pressed | selected': '#purple-text',
62-
disabled: '#dark-04',
63-
},
64-
},
63+
Postfix: {},
6564
},
6665
});
6766

0 commit comments

Comments
 (0)