Skip to content

feat(Switch): support classNames and styles for component and ConfigProvider#52849

Merged
thinkasany merged 3 commits intonextfrom
cp-switch
Feb 17, 2025
Merged

feat(Switch): support classNames and styles for component and ConfigProvider#52849
thinkasany merged 3 commits intonextfrom
cp-switch

Conversation

@thinkasany
Copy link
Member

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature

📝 Change Log

Language Changelog
🇺🇸 English feat: ConfigProvider support classnames and styles for switch
🇨🇳 Chinese feat: ConfigProvider support classnames and styles for switch

@bolt-new-by-stackblitz
Copy link

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2025

Preview is ready

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2025

👁 Visual Regression Report for PR #52849 Failed ❌

🎯 Target branch: next (676ccd5)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 96 changed

Expected (Branch next) Actual (Current PR) Diff
card-component-token.compact.png card-component-token.compact.png card-component-token.compact.png card-component-token.compact.png
card-component-token.compact.png card-component-token.compact.png card-component-token.compact.css-var.png card-component-token.compact.css-var.png
card-component-token.dark.png card-component-token.dark.png card-component-token.dark.png card-component-token.dark.png
card-component-token.dark.png card-component-token.dark.png card-component-token.dark.css-var.png card-component-token.dark.css-var.png
card-component-token.default.png card-component-token.default.png card-component-token.default.png card-component-token.default.png
card-component-token.default.png card-component-token.default.png card-component-token.default.css-var.png card-component-token.default.css-var.png
card-tabs.compact.png card-tabs.compact.png card-tabs.compact.png card-tabs.compact.png
card-tabs.compact.png card-tabs.compact.png card-tabs.compact.css-var.png card-tabs.compact.css-var.png

Warning

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


Important

There are 96 diffs found in this PR: 🔄 96 changed.
Please check all items:

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

@petercat-assistant
Copy link

Walkthrough

This pull request introduces a new feature to the ConfigProvider component, allowing it to support custom class names and styles for the Switch component. This enhancement provides developers with more flexibility in styling the Switch component according to their needs.

Changes

Files Summary
components/config-provider/context.ts Added SwitchStyleConfig type to support classNames and styles for Switch. Updated switch property to use SwitchStyleConfig.
components/config-provider/index.en-US.md, components/config-provider/index.zh-CN.md Updated documentation to reflect new support for classNames and styles in Switch.
components/switch/tests/index.test.tsx Added tests to verify support for custom styles and classNames in Switch.
components/switch/demo/_semantic.tsx Added a semantic demo for the Switch component.
components/switch/index.en-US.md, components/switch/index.zh-CN.md Added Semantic DOM section to documentation.
components/switch/index.tsx Updated Switch component to utilize useComponentConfig for classNames and styles.
package.json Updated dependencies to include @rc-component/switch.

@thinkasany thinkasany mentioned this pull request Feb 17, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2025

size-limit report 📦

Path Size
dist/antd.min.js 510.06 KB (+970 B 🔺)
dist/antd-with-locales.min.js 596.59 KB (+46 B 🔺)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 17, 2025

@codecov
Copy link

codecov bot commented Feb 17, 2025

Bundle Report

Changes will decrease total bundle size by 7.9MB (-67.8%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.75MB -7.9MB (-67.8%) ⬇️

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.min.js (New) 2.03MB 2.03MB 100.0% 🚀
antd.min.js (New) 1.72MB 1.72MB 100.0% 🚀
antd-with-locales.js (Deleted) -6.08MB 0 bytes -100.0% 🗑️
antd.js (Deleted) -5.57MB 0 bytes -100.0% 🗑️

Files in antd-with-locales.min.js:

  • ./components/config-provider/context.ts → Total Size: 1.51kB

Files in antd.min.js:

  • ./components/config-provider/context.ts → Total Size: 1.51kB

@socket-security
Copy link

socket-security bot commented Feb 17, 2025

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@rc-component/switch@1.0.0 None 0 20 kB zombiej
npm/puppeteer@24.2.1 None 0 358 kB google-wombot
npm/qs@6.14.0 None 0 268 kB ljharb

🚮 Removed packages: npm/rc-switch@4.1.0

View full report↗︎

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 17, 2025

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 86c7686
Status: ✅  Deploy successful!
Preview URL: https://a90252a5.ant-design.pages.dev
Branch Preview URL: https://cp-switch.ant-design.pages.dev

View logs

@codecov
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (185258f) to head (86c7686).
Report is 3 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##              next    #52849   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          765       765           
  Lines        13799     13799           
  Branches      3617      3617           
=========================================
  Hits         13799     13799           

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

{ name: 'content', desc: locale.content, version: '6.0.0' },
]}
>
<Switch checkedChildren="on" unCheckedChildren="off" defaultChecked />
Copy link
Member

Choose a reason for hiding this comment

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

要微调一下,现在这个在 unchecked 下会很奇怪。我本来是想看看 unchecked 时对应的位置看到的是这个:
截屏2025-02-17 17 53 01

@thinkasany thinkasany merged commit 2dbeb54 into next Feb 17, 2025
42 checks passed
@thinkasany thinkasany deleted the cp-switch branch February 17, 2025 11:54
@Wxh16144 Wxh16144 changed the title feat: ConfigProvider support classnames and styles for switch feat(Switch): support classNames and styles for component and ConfigProvider Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants