Skip to content

fix(Menu): item styles #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/big-suns-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": patch
---

Fixes Menu Item disabled styles.
36 changes: 36 additions & 0 deletions src/components/pickers/Menu/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,42 @@ export const Default = ({ ...props }) => {
);
};

export const DisabledKeys = ({ ...props }) => {
const menu = (
<Menu id="menu" disabledKeys={['red', 'yellow']} {...props} width="220px">
<Menu.Item key="red" postfix="Ctr+C">
Copy
</Menu.Item>
<Menu.Item key="orange" postfix="Ctr+V">
Paste
</Menu.Item>
<Menu.Item key="yellow" postfix="Ctr+X">
Cut
</Menu.Item>
</Menu>
);

return (
<Space
gap="10x"
placeContent="start start"
placeItems="start"
height="400px"
>
{menu}

<MenuTrigger>
<Button
size="small"
icon={<MoreIcon />}
aria-label="Open Context Menu"
/>
{menu}
</MenuTrigger>
</Space>
);
};

export const InsideModal = () => {
return (
<DialogContainer>
Expand Down
6 changes: 4 additions & 2 deletions src/components/pickers/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import { MenuSection } from './MenuSection';
import { StyledMenu, StyledMenuHeader } from './styled';

export interface CubeMenuProps<T>
extends ContainerStyleProps,
extends BaseProps,
ContainerStyleProps,
AriaMenuProps<T> {
selectionIcon?: MenuSelectionType;
// @deprecated
Expand All @@ -51,10 +52,11 @@ function Menu<T extends object>(
sectionHeadingStyles,
selectionIcon,
qa,
...rest
} = props;
const domRef = useDOMRef(ref);
const contextProps = useMenuContext();
const completeProps = mergeProps(contextProps, props);
const completeProps = mergeProps(contextProps, rest);

const state = useTreeState(completeProps);
const items = [...state.collection];
Expand Down
11 changes: 8 additions & 3 deletions src/components/pickers/Menu/MenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ const StyledButton = tasty(Block, {
'': '#clear',
hovered: '#dark.03',
'pressed | selected': '#dark.06',
'[disabled] & ![data-type="link"]': '#dark.04',
disabled: '#dark.04',
},
color: {
'': '#dark-02',
hovered: '#dark-02',
pressed: '#dark',
disabled: '#dark-04',
},
cursor: {
'': 'pointer',
Expand Down Expand Up @@ -57,8 +63,7 @@ const StyledButton = tasty(Block, {
Postfix: {
color: {
'': '#dark-03',
'hovered | focused': '#dark-03',
'pressed | selected': '#purple-text',
pressed: '#dark-02',
disabled: '#dark-04',
},
},
Expand Down
Loading