Skip to content

feat: Mentions reduce dom strcuture and support size - #55638

Merged
meet-student merged 7 commits into
nextfrom
mentions-refactor
Nov 8, 2025
Merged

meet-student merged 7 commits into
nextfrom
mentions-refactor

Conversation

@zombieJ

@zombieJ zombieJ commented Nov 7, 2025

Copy link
Copy Markdown
Member

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

resolve #55618

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English Refactor Mentions DOM structure to support suffix semantic and size props.
🇨🇳 Chinese 重构 Mentions DOM 结构并支持 suffix 语义化结构以及 size 属性。

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions

github-actions Bot commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor

👁 Visual Regression Report for PR #55638 Failed ❌

🎯 Target branch: next (4998944)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 136 changed, 🆕 3 added

Expected (Branch next) Actual (Current PR) Diff
breadcrumb-style-class.compact.png breadcrumb-style-class.compact.png breadcrumb-style-class.compact.png breadcrumb-style-class.compact.png
breadcrumb-style-class.dark.png breadcrumb-style-class.dark.png breadcrumb-style-class.dark.png breadcrumb-style-class.dark.png
breadcrumb-style-class.default.png breadcrumb-style-class.default.png breadcrumb-style-class.default.png breadcrumb-style-class.default.png
calendar-card.compact.png calendar-card.compact.png calendar-card.compact.png calendar-card.compact.png
calendar-card.dark.png calendar-card.dark.png calendar-card.dark.png calendar-card.dark.png
calendar-card.default.png calendar-card.default.png calendar-card.default.png calendar-card.default.png
calendar-customize-header.compact.png calendar-customize-header.compact.png calendar-customize-header.compact.png calendar-customize-header.compact.png
calendar-customize-header.dark.png calendar-customize-header.dark.png calendar-customize-header.dark.png calendar-customize-header.dark.png

Warning

There are more diffs not shown in the table. Please check the Full Report for details.


Important

There are 139 diffs found in this PR: 🔄 136 changed, 🆕 3 added.
Please check all items:

  • Checked all diffs in the full report
  • Visual diff is acceptable

@github-actions

github-actions Bot commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor

Preview is ready

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @zombieJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a substantial refactoring of the Mentions component, focusing on a cleaner DOM structure and enhanced styling capabilities. The primary goal is to provide better support for component sizing and semantic styling of its suffix elements, ultimately offering more flexibility and consistency for developers using the component.

Highlights

  • Mentions Component Refactoring: The Mentions component's DOM structure has been significantly refactored to reduce complexity and improve maintainability. This includes changes to how its internal elements, such as the textarea and suffix, are rendered and styled.
  • Size Prop Support: The Mentions component now officially supports a size prop, allowing developers to easily control its visual size (large, default, small). This is implemented using CSS variables for dynamic padding and height adjustments.
  • Suffix Semantic Styling: The suffix element within the Mentions component now has dedicated semantic styling support, enabling more granular control over its appearance through classNames and styles props. This also includes proper handling of clear icons and feedback icons within the suffix.
  • Updated Demos and Documentation: New demos and documentation have been added to showcase the size prop and demonstrate advanced styling capabilities, such as making the textarea resizable, using the styles prop.
  • Dependency Update: The @rc-component/mentions dependency has been updated to version ~1.5.5, reflecting underlying changes and improvements in the core mentions library.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mentions-refactor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

The pull request effectively refactors the Mentions component's DOM structure and introduces support for the size prop and suffix semantic structure. The changes are well-implemented, improving both the component's flexibility and maintainability. The styling logic has been significantly refactored, utilizing CSS variables for better control over sizing, and the new size prop is correctly integrated. Documentation and demo updates are consistent with the new features. No issues of medium, high, or critical severity were found.

@github-actions

github-actions Bot commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
dist/antd.min.js 495.56 KB (+200 B 🔺)
dist/antd-with-locales.min.js 587.72 KB (+199 B 🔺)

@pkg-pr-new

pkg-pr-new Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 8.04MB (214.08%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
antd.min-array-push 11.8MB 8.04MB (214.08%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.js (New) 6.21MB 6.21MB 100.0% 🚀
antd.js (New) 5.59MB 5.59MB 100.0% 🚀
antd-with-locales.min.js (Deleted) -2.07MB 0 bytes -100.0% 🗑️
antd.min.js (Deleted) -1.69MB 0 bytes -100.0% 🗑️

Files in antd-with-locales.js:

  • ./components/input/style/index.ts → Total Size: 21.3kB

  • ./components/mentions/style/index.ts → Total Size: 8.15kB

Files in antd.js:

  • ./components/input/style/index.ts → Total Size: 21.3kB

  • ./components/mentions/style/index.ts → Total Size: 8.15kB

@socket-security

socket-security Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedminimist@​1.2.810010010081100
Addedlodash@​4.17.211001008781100
Addedjquery@​3.7.11001009184100

View full report

meet-student
meet-student previously approved these changes Nov 7, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Nov 7, 2025
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

Deploying ant-design-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7cea1ed
Status: ✅  Deploy successful!
Preview URL: https://63f05204.ant-design-next.pages.dev
Branch Preview URL: https://mentions-refactor.ant-design-next.pages.dev

View logs

@meet-student

meet-student commented Nov 7, 2025 •

Copy link
Copy Markdown
Member

酱, 还有 CI 没过

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7cea1ed
Status: ✅  Deploy successful!
Preview URL: https://1ee96943.ant-design.pages.dev
Branch Preview URL: https://mentions-refactor.ant-design.pages.dev

View logs

@codecov

codecov Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6664c57) to head (7cea1ed).
⚠️ Report is 2 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##              next    #55638   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          796       796           
  Lines        14697     14703    +6     
  Branches      3899      3901    +2     
=========================================
+ Hits         14697     14703    +6     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@afc163

afc163 commented Nov 7, 2025

Copy link
Copy Markdown
Member

visual diff 看下

@thinkasany
thinkasany requested a review from Copilot November 7, 2025 11:28
@thinkasany

Copy link
Copy Markdown
Member

@meet-student 你的 demo
image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds size support to the Mentions component, aligning it with other Ant Design form components. It also refactors the component's styling to use CSS variables for better maintainability and updates the underlying @rc-component/mentions dependency.

Key changes:

  • Added size prop support with small, default, and large variants
  • Refactored styling to use CSS custom properties for padding and control height
  • Updated @rc-component/mentions from ~1.4.0 to ~1.5.5
  • Separated dropdown styles from main component styles for better code organization

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
package.json Updated @rc-component/mentions dependency to ~1.5.5 to support new features
mako.config.json Added @rc-component/.* to watch regex for development workflow
components/mentions/style/index.ts Major refactoring: split styles into genMentionsStyle and genDropdownStyle, implemented CSS variables for size support
components/mentions/index.tsx Added size prop, useSize hook, and size-specific class names (ant-mentions-sm/lg)
components/mentions/index.en-US.md Added size demo reference with version="6.0.0", removed version tag from variant demo
components/mentions/index.zh-CN.md Added size demo reference with version="6.0.0", removed version tag from variant demo
components/mentions/demo/size.tsx New demo showcasing small, default, and large size options
components/mentions/demo/size.md Documentation for size demo in both English and Chinese
components/mentions/demo/style-class.tsx Enhanced demo with resize styling example
components/mentions/demo/style-class.md Updated description to mention textarea resizability example
components/mentions/demo/_semantic.tsx Added suffix semantic element documentation and enhanced demo display
components/mentions/tests/snapshots/*.snap Updated snapshots reflecting new class names and structure changes
components/input/style/index.ts Enhanced genBasicInputStyle to accept optional largeStyle and smallStyle overrides
components/input/demo/size.tsx Refactored to use Flex layout instead of manual
elements
components/input/tests/snapshots/*.snap Updated snapshots for Input size demo refactoring
components/form/tests/snapshots/*.snap Updated snapshots reflecting Mentions component structure changes

@meet-student

Copy link
Copy Markdown
Member

@meet-student 你的 demo image

对的对的

之前有问题

@meet-student
meet-student merged commit b9f1d12 into next Nov 8, 2025
2 of 3 checks passed
@meet-student
meet-student deleted the mentions-refactor branch November 8, 2025 06:43
@meet-student meet-student mentioned this pull request Nov 8, 2025
3 tasks done
@zombieJ zombieJ mentioned this pull request Nov 19, 2025
1 of 17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants