Skip to content
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

Menu : deprecate props.mode / always support full capabilities + icons #18703

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

amal-k-joy
Copy link
Contributor

Contributes #18338

Adopt changes from jans PR for deprecating mode

Changelog

New

  • {{new thing}}

Changed

  • {{change thing}}

Removed

  • {{removed thing}}

Testing / Reviewing

{{ Add descriptions, steps or a checklist for how reviewers can verify this PR works or not }}

@amal-k-joy amal-k-joy marked this pull request as draft February 26, 2025 11:50
@amal-k-joy amal-k-joy changed the title Menu wc parity Menu : deprecate props.mode / always support full capabilities + icons Feb 26, 2025
Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit a5ba6ac
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67bf000b8c3b0c000834d162
😎 Deploy Preview https://deploy-preview-18703--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit a5ba6ac
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/67bf000b28c1900008ab0825
😎 Deploy Preview https://deploy-preview-18703--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a5ba6ac
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/67bf000b7eebc90008963bdd
😎 Deploy Preview https://deploy-preview-18703--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.34%. Comparing base (b67877b) to head (a5ba6ac).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18703      +/-   ##
==========================================
- Coverage   84.97%   84.34%   -0.64%     
==========================================
  Files         408      408              
  Lines       14542    14645     +103     
  Branches     4764     4771       +7     
==========================================
- Hits        12357    12352       -5     
- Misses       2024     2132     +108     
  Partials      161      161              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +31 to +33
// @provide({ context: MenuContext })
// @consume({ context: MenuContext, subscribe: true })
// contextChild;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we clean up the commented out code if it's not needed?

Comment on lines +137 to +138
//this.context.updateFromChild?.({ hasIcons: true },this);
// if(!this.context.hasIcons)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//this.context.updateFromChild?.({ hasIcons: true },this);
// if(!this.context.hasIcons)

Comment on lines +142 to +144
} else {
// this.hasIcon=false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
// this.hasIcon=false;
}
}

[`${prefix}--menu-item`]: true,
[`${prefix}--menu-item--disabled`]: isDisabled,
[`${prefix}--menu-item--danger`]: isDanger,
// [`${prefix}--menu-item--with-icon`]:!this.hasIcon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// [`${prefix}--menu-item--with-icon`]:!this.hasIcon

${isRtl ? CaretLeft16() : CaretRight16()}
</div>
<cds-menu
.isChild="${hasChildren}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If hasChildren is a boolean we should be able to apply the attribute or not based on its value

Suggested change
.isChild="${hasChildren}"
?isChild="${hasChildren}"

Comment on lines +166 to +171
<cds-menu-item-radio-group
label="Font weight"
items={items}
selectedItem={items[3]}
itemToString={(item) => item.label}
/>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<cds-menu-item-radio-group
label="Font weight"
items={items}
selectedItem={items[3]}
itemToString={(item) => item.label}
/>;
<cds-menu-item-radio-group
label="Font weight"
items={items}
selectedItem={items[3]}
itemToString={(item) => item.label}></cds-menu-item-radio-group>;

import FolderShared16 from '@carbon/icons/lib/folder--shared/16.js';
import Cut16 from '@carbon/icons/lib/cut/16.js';
import Copy16 from '@carbon/icons/lib/copy/16.js';
//import TrashCan16 from '@carbon/icons/lib/trash-can/16.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//import TrashCan16 from '@carbon/icons/lib/trash-can/16.js';

const subitemlist = ['None', 'Product team', 'Organization', 'Company'];
return html`
<cds-menu ?open=${open} size=${size}>
<cds-menu-item label="Share with" .renderIcon=${FolderShared16}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing in the icon through the renderIcon property, can the icon be slotted in instead? Having to pass in the icon this way might be difficult for folks using CDN or are not using Lit in their own application.

We can detect if icon has been passed in the slot using the _handleSlotChange() event (ex: https://github.com/carbon-design-system/carbon/blob/main/packages/web-components/src/components/text-input/text-input.ts#L52-L75)

@annawen1
Copy link
Member

annawen1 commented Mar 3, 2025

@amal-k-joy with the 2 other Menu PRs (#18718 and #18612), can you clarify which one we should be focusing on first?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants