Compare commits

..

203 Commits

Author SHA1 Message Date
afc163
14f397749d chore: bump version to 5.29.3 and update changelogs (#56267) 2025-12-18 11:32:55 +08:00
Guo Yunhe
d36e6628ef fix(Breadcrumb): custom itemRender style for 5.x (#56251) 2025-12-17 17:00:00 +08:00
afc163
6dd5a234de chore: add 5.x-stable branch to github workflows (#56222) 2025-12-15 17:36:20 +08:00
afc163
2a6d0b837e chore: update branch references from master to 5.x-stable in scripts (#56218) 2025-12-15 16:02:26 +08:00
Wanpan
081e9a6311 fix(V5): Splitter ptg not fully cover (#56217)
Co-authored-by: 二货爱吃白萝卜 <smith3816@gmail.com>
fix: Splitter ptg not fully cover (#56025)
2025-12-15 12:08:23 +08:00
afc163
a811b7a702 docs: bump version to 5.29.2 and update changelogs (#56190)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-12-15 11:45:47 +08:00
afc163
34b32bb389 fix: notification wrong background color when cssVar is false (#56133) 2025-12-10 13:25:19 +08:00
Guo Yunhe
2a823ea79c fix(Breadcrumb): lift link style priority for v5 (#56139) 2025-12-10 13:21:16 +08:00
Copilot
6339b669e7 chore: cherry-pick changelog route fix from PR #56038 to 5.x-stable docs (#56138)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: 𝑾𝒖𝒙𝒉 <wxh1220@gmail.com>
2025-12-10 13:20:49 +08:00
𝑾𝒖𝒙𝒉
2e771318d0 docs: Add the link corresponding to the next major version of the cur… (#55946)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-27 15:50:04 +08:00
𝑾𝒖𝒙𝒉
bd10127ad0 docs(theme-editor): revert useLocalStorage to fix state update issue in Theme Editor (#55848) 2025-11-25 10:37:48 +08:00
二货爱吃白萝卜
5ebd3cb42f fix: Input.Search should not warning for addonAfter (#55806)
* docs: demo of Injector

* fix: Search should not warning
2025-11-22 12:56:13 +08:00
二货爱吃白萝卜
bbd260a757 docs: rm banner (#55790) 2025-11-21 12:04:52 +08:00
lijianan
27b5fc0552 fix: update innerLoading to loading (#55789) 2025-11-21 11:33:13 +08:00
Yueming Gao
b4168a0f29 fix(notification): prevent colorful background when CSS variables are disabled (#55785)
* fix(notification): prevent colorful background when CSS variables are disabled

This fix conditionally applies type-specific background colors (success, error, info, warning) only when the color values exist. This prevents the notification component from showing unexpected colorful backgrounds when CSS variables are disabled (cssVar: false).

Fixes #55765

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(notification): use reduce pattern for type-specific backgrounds

Refactor the conditional background color application to use Object.entries
and reduce pattern, making the code more maintainable and DRY. This approach
makes it easier to add new notification types in the future.

Co-authored-by: gemini-code-assist[bot] <gemini-code-assist[bot]@users.noreply.github.com>

* Refactor notification styles for background colors

Signed-off-by: lijianan <574980606@qq.com>

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: gemini-code-assist[bot] <gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: lijianan <574980606@qq.com>
2025-11-21 02:09:49 +08:00
Copilot
b40fb8a832 chore(deps-dev): upgrade @inquirer/prompts to 8.0.1 (#55775)
* chore(deps-dev): bump the dev-dependencies group with 4 updates

Bumps the dev-dependencies group with 4 updates: [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js), [antd-token-previewer](https://github.com/ant-design/antd-token-previewer), [glob](https://github.com/isaacs/node-glob) and [webpack-bundle-analyzer](https://github.com/webpack/webpack-bundle-analyzer).


Updates `@inquirer/prompts` from 7.10.1 to 8.0.1
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/@inquirer/prompts@7.10.1...@inquirer/prompts@8.0.1)

Updates `antd-token-previewer` from 2.0.8 to 3.0.0
- [Release notes](https://github.com/ant-design/antd-token-previewer/releases)
- [Commits](https://github.com/ant-design/antd-token-previewer/compare/v2.0.8...v3.0.0)

Updates `glob` from 12.0.0 to 13.0.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v12.0.0...v13.0.0)

Updates `webpack-bundle-analyzer` from 4.10.2 to 5.0.1
- [Changelog](https://github.com/webpack/webpack-bundle-analyzer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-bundle-analyzer/compare/v4.10.2...v5.0.1)

---
updated-dependencies:
- dependency-name: "@inquirer/prompts"
  dependency-version: 8.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: antd-token-previewer
  dependency-version: 3.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: glob
  dependency-version: 13.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: webpack-bundle-analyzer
  dependency-version: 5.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update package.json

Signed-off-by: thinkasany <480968828@qq.com>

* Update package.json

Signed-off-by: thinkasany <480968828@qq.com>

* Initial plan

* chore(deps-dev): upgrade @inquirer/prompts to 8.0.1

Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>

* fix: remove deprecated helpMode option from checkbox theme

Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>
2025-11-20 23:04:17 +08:00
J-Da-Shi
1f672480f6 refactor(Button): Change the iconNode ternary nesting to a map query. (#55742)
Co-authored-by: shida <v-shida1@xiaomi.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-11-20 10:15:21 +08:00
dependabot[bot]
9fa23a19e1 chore(deps-dev): bump webpack-bundle-analyzer to 5.0.1 and glob to 13 (#55774)
* chore(deps-dev): bump the dev-dependencies group with 4 updates

Bumps the dev-dependencies group with 4 updates: [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js), [antd-token-previewer](https://github.com/ant-design/antd-token-previewer), [glob](https://github.com/isaacs/node-glob) and [webpack-bundle-analyzer](https://github.com/webpack/webpack-bundle-analyzer).


Updates `@inquirer/prompts` from 7.10.1 to 8.0.1
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/@inquirer/prompts@7.10.1...@inquirer/prompts@8.0.1)

Updates `antd-token-previewer` from 2.0.8 to 3.0.0
- [Release notes](https://github.com/ant-design/antd-token-previewer/releases)
- [Commits](https://github.com/ant-design/antd-token-previewer/compare/v2.0.8...v3.0.0)

Updates `glob` from 12.0.0 to 13.0.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v12.0.0...v13.0.0)

Updates `webpack-bundle-analyzer` from 4.10.2 to 5.0.1
- [Changelog](https://github.com/webpack/webpack-bundle-analyzer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-bundle-analyzer/compare/v4.10.2...v5.0.1)

---
updated-dependencies:
- dependency-name: "@inquirer/prompts"
  dependency-version: 8.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: antd-token-previewer
  dependency-version: 3.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: glob
  dependency-version: 13.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: webpack-bundle-analyzer
  dependency-version: 5.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update package.json

Signed-off-by: thinkasany <480968828@qq.com>

* Update package.json

Signed-off-by: thinkasany <480968828@qq.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-11-20 08:59:56 +08:00
lijianan
685010e4f8 docs: update popupRender docs (#55773) 2025-11-20 08:40:01 +08:00
二货爱吃白萝卜
f64a5c4a2d docs: update docs (#55767) 2025-11-19 11:33:16 +08:00
LiShuai (阿木)
02ce3d9efb docs: Update Claude Code documentation links to the correct URL (#55764) 2025-11-19 10:30:53 +08:00
二货爱吃白萝卜
79bdbe424f docs: 5.29.1 changelog (#55759)
* docs: 5.29.1 changelog

* chore: trigger CI
2025-11-18 23:22:03 +08:00
Wanpan
4be4ba64a5 fix: Fixed the issue of carousel dot being unclickable (#55757) 2025-11-18 20:57:17 +08:00
SocietyNiu
7aabe2a4fa docs: Fix custom storage sync event (#55753)
* docs: fix unexpected storage logic

* Update .dumi/hooks/useLocalStorage.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: 遇见同学 <1875694521@qq.com>

---------

Signed-off-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-18 10:12:05 +08:00
afc163
ebcfbb1145 docs: Update badge URLs in README.md (#55746)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-18 10:00:42 +08:00
dependabot[bot]
de075f4d03 chore(deps-dev): bump glob from 11 to 12 (#55752)
* chore(deps-dev): bump the dev-dependencies group with 3 updates

Bumps the dev-dependencies group with 3 updates: [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js), [antd-token-previewer](https://github.com/ant-design/antd-token-previewer) and [glob](https://github.com/isaacs/node-glob).


Updates `@inquirer/prompts` from 7.10.1 to 8.0.1
- [Release notes](https://github.com/SBoudrias/Inquirer.js/releases)
- [Commits](https://github.com/SBoudrias/Inquirer.js/compare/@inquirer/prompts@7.10.1...@inquirer/prompts@8.0.1)

Updates `antd-token-previewer` from 2.0.8 to 3.0.0
- [Release notes](https://github.com/ant-design/antd-token-previewer/releases)
- [Commits](https://github.com/ant-design/antd-token-previewer/compare/v2.0.8...v3.0.0)

Updates `glob` from 11.1.0 to 12.0.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v11.1.0...v12.0.0)

---
updated-dependencies:
- dependency-name: "@inquirer/prompts"
  dependency-version: 8.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: antd-token-previewer
  dependency-version: 3.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
- dependency-name: glob
  dependency-version: 12.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update package.json

Signed-off-by: thinkasany <480968828@qq.com>

* Update package.json

Signed-off-by: thinkasany <480968828@qq.com>

* Update package.json

Signed-off-by: thinkasany <480968828@qq.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-11-18 09:03:23 +08:00
thinkasany
888700677e fix(ci): correct to in site-deploy workflow (#55751) 2025-11-17 22:54:24 +08:00
zhounz
36e7b11371 docs: fix incorrect AntV link (#55744)
* docs: fix link

* docs: fix link in recommendation.md

* Unify the Chinese and English documents

---------

Co-authored-by: zhounz <zhounz@chinaunicom.cn>
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-11-17 16:17:02 +08:00
zoomdong
b4e13830e9 docs: release 5.29.0 (#55733)
* docs: release 5.29.0

* Update CHANGELOG.zh-CN.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: 遇见同学 <1875694521@qq.com>

* Update CHANGELOG.en-US.md

Co-authored-by: 遇见同学 <1875694521@qq.com>
Signed-off-by: zoomdong <1344492820@qq.com>

* chore: add feature changelog

* Update CHANGELOG.zh-CN.md

Co-authored-by: 遇见同学 <1875694521@qq.com>
Signed-off-by: zoomdong <1344492820@qq.com>

---------

Signed-off-by: 遇见同学 <1875694521@qq.com>
Signed-off-by: zoomdong <1344492820@qq.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-17 15:20:02 +08:00
遇见同学
70d00c65c1 fix(site): ensure z-index is set for container in semantic-preview for drawer overflow (#55743) 2025-11-17 14:47:36 +08:00
github-actions[bot]
21e4518386 chore: auto merge branches (#55737)
chore: merge feature into master
2025-11-17 05:21:48 +00:00
lijianan
eca869ac3e Merge pull request #55734 from ant-design/master
chore: merge master into feature
2025-11-17 10:46:49 +08:00
Copilot
713b889ceb chore: revert useless ignore config (#55729)
* chore(deps): update actions/upload-artifact action to v5

* Initial plan

* Revert actions/upload-artifact to v4 and disable renovate updates

Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>

* Remove ineffective dependabot.yml ignore rule for actions/upload-artifact

Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>

* Update renovate.json

Signed-off-by: thinkasany <480968828@qq.com>

---------

Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-11-16 19:46:53 +08:00
Copilot
26c451c07d chore: Pin actions/upload-artifact@v4 and disable renovate updates (#55730)
* chore(deps): update actions/upload-artifact action to v5

* Initial plan

* Revert to actions/upload-artifact@v4 and disable renovate updates

Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-11-16 19:42:11 +08:00
renovate[bot]
71de2f0e23 chore(deps): update dependency open to v11 (#55728)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-16 13:07:06 +08:00
thinkasany
662fe02252 chore: improve code style (#55720)
* chore: improve code style

* Apply suggestion from @gemini-code-assist[bot]

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: 遇见同学 <1875694521@qq.com>

---------

Signed-off-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-14 22:21:35 +08:00
github-actions[bot]
2d440e138d chore: auto merge branches (#55718)
chore: sync master into feature
2025-11-14 11:51:12 +00:00
x1ngYu
19a37a3780 fix(drawer): improve accessibility (aria-labelledby) (#55697)
Co-authored-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-11-14 11:40:29 +08:00
Copilot
4e19a1f3d2 chore(deps): disable Dependabot auto-upgrade for actions/upload-artifact@v4 (#55711)
* chore(deps): Revert "chore(deps): bump actions/upload-artifact from 4 to 5 (#55708)"

* Initial plan

* chore: disable Dependabot auto-upgrade for actions/upload-artifact@v4

Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>

---------

Co-authored-by: thinkasany <480968828@qq.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thinkasany <117748716+thinkasany@users.noreply.github.com>
2025-11-14 11:31:57 +08:00
GeekerGx
3f644af0fb docs: improve upload api doc (#55714)
* Upload API添加类型说明

补充修改英文文档
参考:中文文档修改记录
https://github.com/ant-design/ant-design/pull/55671

Signed-off-by: GeekerGx <386348903@qq.com>

* chore: update doc

* Apply suggestion from @meet-student

Signed-off-by: 遇见同学 <1875694521@qq.com>

* Apply suggestion from @meet-student

Signed-off-by: 遇见同学 <1875694521@qq.com>

* chore: update

* chore: update snap

---------

Signed-off-by: GeekerGx <386348903@qq.com>
Signed-off-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-11-14 11:20:43 +08:00
GeekerGx
d903180635 docs: update API type (#55671)
* Upload API添加类型说明

beforeUpload 中的参数file, fileList没有指明类型,会和UploadFile混淆,导致开发中出现意料外的情况

Signed-off-by: GeekerGx <386348903@qq.com>

* Update components/upload/index.zh-CN.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: GeekerGx <386348903@qq.com>

---------

Signed-off-by: GeekerGx <386348903@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-14 07:09:09 +08:00
thinkasany
d731b4db94 chore(deps): Revert "chore(deps): bump actions/upload-artifact from 4 to 5 (#55708)" (#55710) 2025-11-13 22:18:49 +08:00
dependabot[bot]
1a27f476b7 chore(deps): bump actions/upload-artifact from 4 to 5 (#55708)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-13 21:51:52 +08:00
github-actions[bot]
5079bf4b0b chore: auto merge branches (#55699)
chore: feature merge master
2025-11-13 04:05:34 +00:00
二货爱吃白萝卜
6bc31dcef3 Revert "chore(deps): update actions/upload-artifact action to v5 (#55470)" (#55698)
This reverts commit d3ac9eddd0.
2025-11-13 11:40:49 +08:00
J-Da-Shi
9be6685a45 refactor(modal): remove duplicate locale type definition (#55683)
Co-authored-by: shida <v-shida1@xiaomi.com>
2025-11-13 10:38:28 +08:00
EmilyyyLiu
5632e40fce feat[InputNumber]: deprecated addon* attribute (#55505)
* feat[InputNumber]: deprecated addon* attribute

* test: update snap

* Update components/form/demo/register.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* test: update form snap

* update

* update

* feat: change Search addon*

* test: demo add annotation

* update Search

* feat: add Space.Addon

* test: use addon in demos

* feat: Space.Addon -> Space.CompactCell

* test: update compactCell snap

* feat: fix style lint

* test: update compact-middle class snap

* chore: update logic

* test: delete if (!button) return input

* chore: fix logic

* update test snap

* update test snap

* update test snap

* update test snap

* test: update test

* test: update snap

* chore: fix search

* revert test

* test: update

* test: update

* feat: add description for CompactCell

* feat: change description

* docs: add api Version

* test: change search style

* test: update snap

* test: update snap

* feat: searchButton text color

* fix: border is null whenhover search Button

* Update components/space/index.zh-CN.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* Update components/space/index.zh-CN.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* Update components/space/index.en-US.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* Update components/space/index.en-US.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* docs: change Compact description

* Update components/space/index.zh-CN.md

Signed-off-by: lijianan <574980606@qq.com>

* feat: compactCell -> compactAddon

* feat: compactAddon -> Addon

* docs: Remove component name quotation marks from the document

* refactor: Refactoring Space.Addon style and class name

* chore: add css var

* feat[InputNumber]: deprecated addon* attribute

* test: update snap

* Update components/form/demo/register.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* test: update form snap

* update

* update

* feat: change Search addon*

* test: demo add annotation

* update Search

* feat: add Space.Addon

* test: use addon in demos

* feat: Space.Addon -> Space.CompactCell

* test: update compactCell snap

* feat: fix style lint

* test: update compact-middle class snap

* chore: update logic

* test: delete if (!button) return input

* chore: fix logic

* update test snap

* update test snap

* update test snap

* update test snap

* test: update test

* test: update snap

* chore: fix search

* revert test

* test: update

* test: update

* feat: add description for CompactCell

* feat: change description

* docs: add api Version

* test: change search style

* test: update snap

* test: update snap

* feat: searchButton text color

* fix: border is null whenhover search Button

* Update components/space/index.zh-CN.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* Update components/space/index.zh-CN.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* Update components/space/index.en-US.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* Update components/space/index.en-US.md

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* docs: change Compact description

* Update components/space/index.zh-CN.md

Signed-off-by: lijianan <574980606@qq.com>

* feat: compactCell -> compactAddon

* feat: compactAddon -> Addon

* docs: Remove component name quotation marks from the document

* refactor: Refactoring Space.Addon style and class name

* chore: add css var

* chore: adjust style

* docs: back

* docs: update demo

* test: update snapshot

* refactor: Restore Search using Compact

* refactor: Remove unused wrapCSSVar

* test: update snap

* test:update snap

* refactor: Remove non addon modifications

---------

Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: 刘欢 <lh01217311@antgroup.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: lijianan <574980606@qq.com>
Co-authored-by: 二货机器人 <smith3816@gmail.com>
2025-11-12 17:42:49 +08:00
github-actions[bot]
ba24332fe7 chore: auto merge branches (#55673)
chore: merge master into feature
2025-11-11 03:48:42 +00:00
lijianan
2f0474bfd9 docs: update log (#55669)
* docs: update log

* Update CHANGELOG.zh-CN.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: lijianan <574980606@qq.com>

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-11 11:13:39 +08:00
Jeongseok Kang
8a914f36a3 fix(local): Correct spacing in copy message from '복사 됨' to '복사됨' (#55672) 2025-11-11 11:13:22 +08:00
MadCcc
3a4a4abe1a docs: changelog 5.28.1 (#55658)
* docs: changelog 5.28.1

* chore: udpate

* chore: update

* Update CHANGELOG.zh-CN.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: MadCcc <1075746765@qq.com>

* Update CHANGELOG.zh-CN.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: MadCcc <1075746765@qq.com>

---------

Signed-off-by: MadCcc <1075746765@qq.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-11-10 17:42:21 +08:00
lijianan
2037fa7834 fix(locale): add missing locale (#55656) 2025-11-09 16:09:41 +08:00
renovate[bot]
f3d75842fa chore(deps): update softprops/action-gh-release action to v2.4.2 (#55654)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-09 10:21:06 +08:00
github-actions[bot]
574c2f6cf0 chore: auto merge branches (#55652)
chore: sync master into feature
2025-11-09 02:11:40 +00:00
afc163
a4b8185a74 Revert "fix: clicking does nothing after occur error in actionFn (#55519)" (#55651)
This reverts commit 2b12ef528d.
2025-11-09 01:21:02 +08:00
Tony
ce9a5dc2fd docs: add classNames and styles to Tooltip shared API documentation (#55645) 2025-11-08 08:41:55 +08:00
TianHua Liu
2b12ef528d fix: clicking does nothing after occur error in actionFn (#55519) 2025-11-08 00:07:19 +08:00
Wanpan
44526a56a7 fix: use dotActiveWidth token (#55615) 2025-11-07 19:05:35 +08:00
ustcfury
2f6846d2a5 fix: Select underlined height (#55607)
Co-authored-by: furyzhao <furyzhao@tencent.com>
2025-11-06 10:21:35 +08:00
github-actions[bot]
6d5e7e4ace chore: auto merge branches (#55625)
chore: merge master into feature
2025-11-05 17:09:42 +00:00
afc163
8471922710 demo: fix extra padding in Carousel demos (#55613) 2025-11-05 13:12:06 +08:00
Wanpan
3966a9fcc8 fix(carousel): The transform animation is invalid when the drawing is first performed. (#55589)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-11-05 10:01:20 +08:00
ustcfury
dee2365bed fix: input underlined hover color (#55609)
to #55608

Co-authored-by: furyzhao <furyzhao@tencent.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-11-04 23:02:05 +08:00
afc163
39843ae9b2 docs: update icon component import code and documentation warnings (#55594) 2025-11-04 23:00:52 +08:00
ayangweb
51949965ce type: optimize LiteralUnion type and add Primitive type (#55599) 2025-11-04 23:00:08 +08:00
ayangweb
be0d352579 docs(icon): automatically scroll to the top after icon search (#55596) 2025-11-04 15:23:07 +08:00
ayangweb
bf1a3393fc type(flex): fix missing preset size support for gap (#55591) 2025-11-04 14:00:31 +08:00
github-actions[bot]
5d5f45a44f chore: auto merge branches (#55574)
chore: merge master into feature
2025-11-02 16:49:05 +00:00
thinkasany
d11b6c7807 chore(decription): improve classNames (#55573)
* chore(decription): improve classNames

* Refactor classNames import and usage in Cell component

Signed-off-by: lijianan <574980606@qq.com>

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: lijianan <574980606@qq.com>
2025-11-03 00:26:56 +08:00
lijianan
d928c9b2fb chore: rename isValidNode (#55570)
* chore: rename isValidNode

* update

* update demo code
2025-11-02 21:59:48 +08:00
lijianan
15a17dee7c fix: uses correct style for content rendering (#55572)
* fix: uses correct style for content rendering

* update
2025-11-02 21:16:34 +08:00
lijianan
fbfc09901e chore: use classNames (#55571)
* chore: use classNames

* Update components/table/hooks/useSorter.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: lijianan <574980606@qq.com>

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-02 20:41:41 +08:00
lijianan
83f7e0f6b9 Merge pull request #55565 from ant-design/master
chore: merge master into feature
2025-11-02 00:27:15 +08:00
afc163
0db00b0886 docs: release 5.28.0 (#55564)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-01 23:31:41 +08:00
lijianan
041f6d6692 autospace-fix (#55562) 2025-11-01 22:45:15 +08:00
Peace
45b929dfd7 docs(drawer): add closable api (#55548)
* docs: add closable api

* docs: improve documentation description

* Update components/drawer/index.zh-CN.md

Signed-off-by: thinkasany <480968828@qq.com>

* Update components/drawer/index.en-US.md

Signed-off-by: thinkasany <480968828@qq.com>

---------

Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: 叶文俊 <yewenjun@mistong.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-11-01 10:44:54 +08:00
github-actions[bot]
29e4119c2b chore: auto merge branches (#55542)
chore: merge master into feature
2025-10-31 07:46:19 +00:00
lijianan
d33d8cf959 test: simplify style test case again (#55539)
* test: simplify test case

* update

* update

* update

* test: simplify style test case

* update

* update

* update

* update

* test: simplify style test case again

* update

* update

* update color to rgb
2025-10-31 15:19:47 +08:00
lijianan
0bd374b94e test: fix CI fail (#55541) 2025-10-31 15:07:13 +08:00
lijianan
352f6c6c78 test: simplify style test case (#55538)
* test: simplify test case

* update

* update

* update

* test: simplify style test case

* update

* update

* update

* update
2025-10-31 12:46:16 +08:00
lijianan
ec658c9842 test: simplify test case (#55537)
* test: simplify test case

* update

* update

* update
2025-10-31 11:42:54 +08:00
github-actions[bot]
c809781c29 chore: auto merge branches (#55534)
chore: merge master into feature
2025-10-31 02:44:34 +00:00
github-actions[bot]
134a474ed4 chore: upgrade deps (#55528)
Co-authored-by: afc163 <507615+afc163@users.noreply.github.com>
2025-10-30 08:15:42 +08:00
iola1999
9e792c72c2 site: remove infinite loop in theme transition (#55527) 2025-10-29 20:30:10 +08:00
lijianan
1ff663afa8 chore: code optimization, rm unnecessary nested function (#55517) 2025-10-29 13:25:56 +08:00
lijianan
1c0f1cdc06 docs: rm children api (#55515)
* docs: rm children api

* update

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-29 10:55:38 +08:00
github-actions[bot]
4414b81772 chore: auto merge branches (#55509)
chore: merge master into feature
2025-10-28 09:50:06 +00:00
lijianan
259e533757 demo: update Select to data drive (#55507)
* demo: update Select to data drive

* Update components/form/demo/advanced-search.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: lijianan <574980606@qq.com>

* update more

* update more

* update more

* update snap

* update snap

* update snap

* update snap

* update

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-28 17:15:24 +08:00
lijianan
7f921b0ad4 fix: add process.env.NODE_ENV for useLocalStorage (#55506) 2025-10-28 15:04:07 +08:00
𝑾𝒖𝒙𝒉
cf34c4a1eb chore(demo): remove usage of internal utility methods and types from … (#55421) 2025-10-28 11:56:34 +08:00
ug
2ee85ee240 docs: Add llms documentation (#54940)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: liuqiang <qiang.liu@xinjifamily.com>
Co-authored-by: ug <62086147+765477020@users.noreply.github.com>
2025-10-28 11:55:58 +08:00
二货爱吃白萝卜
d29f4721b6 docs: See Conf no jumping (#55390)
* chore: update logic

* chore: clean up

* update useLocalStorage hook

* chore: test logic

* chore: banner hardcode

* chore: fix build

---------

Co-authored-by: lijianan <574980606@qq.com>
2025-10-28 10:55:49 +08:00
github-actions[bot]
2c1b697158 chore: auto merge branches (#55501)
chore: merge master into feature
2025-10-27 14:42:25 +00:00
lijianan
e1ff71744e docs: add api anchor (#55495)
* docs: add docs anchor for RequestOptions

* update
2025-10-27 14:20:26 +08:00
github-actions[bot]
26c3b09eeb chore: auto merge branches (#55492)
chore: sync feature to master
2025-10-27 05:43:32 +00:00
lijianan
682c460673 docs: fix docs typo (#55493)
* docs: fix docs typo

* update

* update

* update
2025-10-27 13:13:06 +08:00
afc163
6e958871c4 fix: Segmented style conflict with React DevTools 7.0 (#55438)
Co-authored-by: lijianan <574980606@qq.com>
Co-authored-by: thinkasany <480968828@qq.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-27 10:54:16 +08:00
ug
27a9c8a57c fix(Modal):Watermark crashes when wrapping Modal with modalRender (#55435)
Co-authored-by: liuqiang <qiang.liu@xinjifamily.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-27 10:03:53 +08:00
github-actions[bot]
8a81accfaf chore: auto merge branches (#55479)
chore: merge master into feature
2025-10-26 09:47:24 +00:00
lijianan
41b5dce953 perf: try to reduce bundle size (#55478)
* refactor: reuse useForceUpdate hook

* update

* perf: try to reduce bundle size

* update
2025-10-26 17:18:36 +08:00
thinkasany
80a1f69588 fix: add image missing memo deps (#55477)
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-26 17:00:39 +08:00
lijianan
40531626c1 refactor: remove useState, reuse useForceUpdate hook (#55476)
* refactor: reuse useForceUpdate hook

* update
2025-10-26 16:38:18 +08:00
thinkasany
d7ee8cc377 fix: add ColorPicker missing memo deps (#55475)
* fix: add ColorPicker missing memo deps

* fix

* fix
2025-10-26 16:21:25 +08:00
lijianan
246c14b442 fix: add missing dependency (#55467)
Co-authored-by: thinkasany <480968828@qq.com>
2025-10-26 15:22:07 +08:00
lijianan
bf7cd94b89 chore: rm unnecessary useMemo (#55468)
* chore: rm unnecessary useMemo

* rename
2025-10-26 10:07:41 +08:00
renovate[bot]
d3ac9eddd0 chore(deps): update actions/upload-artifact action to v5 (#55470)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 09:04:35 +08:00
renovate[bot]
5a69863ac1 chore(deps): update actions/download-artifact action to v6 (#55469)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 09:03:23 +08:00
Yasin B. Kalkan
00e392e66d Fix color node reference and class name indexing (#55461)
Signed-off-by: Yasin B. Kalkan <yasinburakkalkan@gmail.com>
2025-10-25 21:09:18 +08:00
thinkasany
1d0b0a440c fix: add alert missing memo deps (#55457)
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-25 13:25:30 +08:00
thinkasany
8ab7fa52d4 chore: bump eslint-plugin-react-hooks@7.0.1 (#55456)
* chore: rm useless eslint comment

* eslint-plugin-react-hooks@7.0.1
2025-10-25 13:24:40 +08:00
github-actions[bot]
c6bff1aca6 chore: auto merge branches (#55454)
chore: sync master into feature
2025-10-25 02:47:55 +00:00
lijianan
c13ac86af2 fix: item styles should be merge (#55453) 2025-10-25 10:26:19 +08:00
lijianan
db2b6c93f6 chore: code style optimization (#55450)
* chore: code style optimization

* update
2025-10-25 10:24:24 +08:00
thinkasany
da7c8192a3 chore: rm useless NonNullAssertedOptionalChain (#55448)
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-25 10:17:25 +08:00
lijianan
94a2574e4a chore: fix lint error (#55451)
* test

* fix lint error

* fix lint error

* fix lint error

* fix lint error

* fix lint error

* fix lint error

* fix lint error

* update

* update

* update

* update

* update

* update
2025-10-25 10:06:51 +08:00
thinkasany
384646768d chore: add colorPicker missing memo deps (#55446) 2025-10-24 23:22:52 +08:00
jiAng
addf5ba2f7 feat: add itemActiveColor/itemActiveColorHover token on Pagination (#55195)
Co-authored-by: 遇见同学 <1875694521@qq.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-10-24 22:21:03 +08:00
github-actions[bot]
1592b9c4df chore: auto merge branches (#55441)
chore: sync master into feature
2025-10-24 13:31:24 +00:00
afc163
2933bd66ce chore: update biome config and report template (#55440)
* chore: update biome config and report template

* Apply suggestion from @afc163

Signed-off-by: afc163 <afc163@gmail.com>

---------

Signed-off-by: afc163 <afc163@gmail.com>
2025-10-24 20:27:58 +08:00
𝑾𝒖𝒙𝒉
60000bc14e fix(DirectoryTree): fieldNames cause defaultExpandAll to not work error (#55420) 2025-10-24 17:50:25 +08:00
lijianan
1c30401023 type: update any type to function (#55434) 2025-10-24 16:32:46 +08:00
lijianan
553ac801d3 type: update undefined type to optional (#55436) 2025-10-24 16:31:14 +08:00
divyeshagrawal
34297362a3 chore: remove unused devDependencies (#55433)
* Chore: Remove unused dependencies

* Chore: Add EOL

* Chore: Add remark-cli

* Chore: Add EOL
2025-10-24 15:46:43 +08:00
lijianan
44223967ae chore: rm useUniqueMemo hook (#55412) 2025-10-23 10:48:30 +08:00
lijianan
f187eeafb3 test: update any type with React.ReactElement (#55410) 2025-10-23 08:09:15 +08:00
lijianan
5fe4cff30d chore: unified code style (#55411) 2025-10-23 08:08:09 +08:00
thinkasany
8095b8c467 chore: improve avatar code style (#55408) 2025-10-23 04:14:01 +08:00
github-actions[bot]
4aeb941bec chore: auto merge branches (#55405)
chore: merge master into feature
2025-10-22 11:52:41 +00:00
lijianan
ec44482a1b chore: unified code style (#55406) 2025-10-22 19:31:22 +08:00
SocietyNiu
2131d9f7e2 docs: fix auto theme mode (#55397)
* fix: fix the auto theme mode

* fix: fix the index page background color display issue under auto theme mode

* docs: fix index css

---------

Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-22 18:51:50 +08:00
zancheng
2bceb47f3a style(Segmented): Support gradient background (#55391) 2025-10-22 10:00:33 +08:00
lijianan
70cba6b961 site: add useLocalStorage hook (#55401)
* site: add useLocalStorage hook

* update

* update

* update
2025-10-22 09:57:34 +08:00
thinkasany
4c6f5d965b fix(space): add missing deps (#55399)
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-21 21:34:02 +08:00
afc163
5c122a805d style: Statistic skeleton showing active animation defaultly (#55398) 2025-10-21 20:28:09 +08:00
ug
d792286afe docs: Update React documentation links from reactjs.org to react.dev (#55392)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: liuqiang <qiang.liu@xinjifamily.com>
2025-10-21 17:14:21 +08:00
二货爱吃白萝卜
6d879793fd docs: add see conf config (#55389) 2025-10-21 16:08:15 +08:00
github-actions[bot]
e06b9533c0 chore: auto merge branches (#55384)
chore: merge master into feature
2025-10-21 02:44:15 +00:00
lijianan
4195a736e2 fix: update missing prefixCls dependency (#55378)
* docs: add mousePosition prop

* fix: update missing prefixCls dependency

* clear

---------

Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-21 09:50:34 +08:00
lijianan
563e855dec fix: update missing responsiveMap dependency (#55385)
* fix: update missing responsiveMap dependency

* update
2025-10-21 09:28:45 +08:00
xrkffgg
a31d11d8a7 docs: add changelog 5.27.6 (#55380) 2025-10-20 16:44:32 +08:00
lijianan
2367a516c4 site: update missing isLight dependency (#55377)
* site: update missing themeData dependency

* update

---------

Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-20 09:16:47 +08:00
lijianan
af1a78a83f refactor: avoid unnecessary re-renders by explicitly listing deps (#55376) 2025-10-20 08:37:24 +08:00
github-actions[bot]
9e2ca60497 chore: auto merge branches (#55372)
chore: merge master into feature
2025-10-19 15:47:58 +00:00
lijianan
072c9fa707 type: update any type to ConfirmDialogProps (#55371) 2025-10-19 23:21:17 +08:00
lijianan
a0a32ff450 fix: add missing getConfirmFunc dependency (#55370)
* fix: add missing getConfirmFunc dependency

* fix: add missing getConfirmFunc dependency
2025-10-19 22:53:07 +08:00
thinkasany
25001647a7 Revert "refactor(modal): use modalRef replace createRef (#55368)" (#55369)
This reverts commit 3b47ac3630.
2025-10-19 20:07:41 +08:00
thinkasany
3b47ac3630 refactor(modal): use modalRef replace createRef (#55368) 2025-10-19 16:28:58 +08:00
thinkasany
7a70bafe42 chore: rm useless eslint comments (#55367)
* chore: rm useless eslint comments

* rerun ci
2025-10-19 15:57:16 +08:00
lijianan
c0408b70aa fix: add missing checkedActiveItems dep (#55366) 2025-10-19 13:59:15 +08:00
lijianan
90696b1632 fix: add missing schema dep for useMergeSemantic (#55364)
* fix: add missing schema dep for useMergeSemantic

* update

* update
2025-10-19 13:19:08 +08:00
github-actions[bot]
1252e72856 chore: auto merge branches (#55362)
chore: merge master into feature
2025-10-19 02:36:25 +00:00
lijianan
f442fa2518 Merge branch master into feature-merge-master 2025-10-19 09:50:23 +08:00
lijianan
b447d9c22a Merge branch master into feature-merge-master 2025-10-19 09:44:18 +08:00
github-actions[bot]
f981a12895 chore: auto merge branches (#55348)
chore: sync master into feature
2025-10-18 07:43:33 +00:00
github-actions[bot]
474245dd7b chore: auto merge branches (#55341)
chore: sync master into feature
2025-10-17 16:12:08 +00:00
EmilyyyLiu
62bd8e367d feat[Input]: deprecated addon* attribute (#55315)
* feat[Input]: deprecated addon* attribute

* Update components/input/Input.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: thinkasany <480968828@qq.com>

* test: update snap

* test: Restore addon demo

* test: update snap

* tsat: update snap

---------

Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: 刘欢 <lh01217311@antgroup.com>
Co-authored-by: thinkasany <480968828@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-16 15:14:53 +08:00
github-actions[bot]
cea58dc907 chore: auto merge branches (#55323)
chore: sync master into feature
2025-10-15 14:27:29 +00:00
github-actions[bot]
479963ccbc chore: auto merge branches (#55306)
chore: sync master into feature
2025-10-14 12:20:22 +00:00
github-actions[bot]
a534480899 chore: auto merge branches (#55287)
chore: merge master into feature
2025-10-13 01:49:54 +00:00
github-actions[bot]
785f7fd8a3 chore: auto merge branches (#55260)
chore: merge master into feature
2025-10-10 11:23:19 +00:00
github-actions[bot]
d82c775248 chore: auto merge branches (#55248)
chore: sync master into feature
2025-10-09 12:28:50 +00:00
ug
76fe1be8a6 feat(splitter): Support onCollapse event (#54673)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: afc163 <afc163@gmail.com>
Co-authored-by: liuqiang <qiang.liu@xinjifamily.com>
Co-authored-by: Wanpan <wanpan96@163.com>
Co-authored-by: 遇见同学 <1875694521@qq.com>
2025-10-09 17:11:38 +08:00
github-actions[bot]
de674acfc9 chore: auto merge branches (#55235)
chore: merge master into feature
2025-10-06 18:32:55 +00:00
github-actions[bot]
5bbb3726b8 chore: auto merge branches (#55227)
chore: merge master into feature
2025-10-03 16:21:50 +00:00
github-actions[bot]
eef4faa527 chore: auto merge branches (#55211)
chore: merge master into feature
2025-10-01 06:26:44 +00:00
github-actions[bot]
4760c2af89 chore: auto merge branches (#55202)
chore: sync master into feature
2025-09-30 15:44:04 +00:00
github-actions[bot]
c61c5abd69 chore: auto merge branches (#55175)
chore: sync master into feature
2025-09-28 05:06:15 +00:00
thinkasany
dd3de44261 chore: lint fix 2025-09-28 12:44:31 +08:00
thinkasany
b16183b209 Merge remote-tracking branch 'origin/master' into feature-merge-master 2025-09-28 12:15:04 +08:00
lijianan
8a77e20d93 docs: update cn => en (#55159) 2025-09-26 23:58:57 +08:00
EmilyyyLiu
6647881b09 feat: Add defaultRequest to customRequest (#55146)
* chore: Upgrade rc-upload

* docs: add documents

* docs: change document

* docs: add link to RequestOptions

* test: update site snap

---------

Co-authored-by: 刘欢 <lh01217311@antgroup.com>
2025-09-26 16:17:33 +08:00
github-actions[bot]
631610433d chore: auto merge branches (#55148)
chore: sync master into feature
2025-09-25 12:01:00 +00:00
github-actions[bot]
247b95a89e chore: auto merge branches (#55111)
chore: sync master into feature
2025-09-21 05:48:27 +00:00
github-actions[bot]
b7dc1324b1 chore: auto merge branches (#55095)
chore: merge master into feature
2025-09-19 15:14:15 +00:00
lijianan
4b2364bde0 feat: add boostLevel prop and support value segmentation (#55063)
* feat: add boostLevel prop and support value segmentation

* test: update snap
2025-09-19 10:22:06 +08:00
github-actions[bot]
fc649c4a44 chore: auto merge branches (#55051)
chore: sync master into feature
2025-09-18 00:16:07 +00:00
github-actions[bot]
f73f6063d7 chore: auto merge branches (#55018)
chore: merge master into feature
2025-09-14 11:17:45 +00:00
github-actions[bot]
7dccd7a449 chore: auto merge branches (#55008)
chore: merge master into feature
2025-09-13 17:49:19 +00:00
github-actions[bot]
568f8074a4 chore: auto merge branches (#54989)
chore: sync master into feature
2025-09-12 15:38:01 +00:00
github-actions[bot]
f81e47a0b4 chore: auto merge branches (#54926)
chore: merge master into feature
2025-09-08 12:08:07 +00:00
github-actions[bot]
a983e79481 chore: auto merge branches (#54903)
chore: sync master into feature
2025-09-06 06:37:46 +00:00
github-actions[bot]
ba93683692 chore: auto merge branches (#54863)
chore: sync master into feature
2025-09-03 13:26:16 +00:00
LeiZhang
7d4bd5bd8c feat: The transfer & tree component inherits the form disable (#54831)
* feat: The transfer&tree component inherits the form disable

* test: add snap

* test: add form diabled demo

* test: add snap

---------

Co-authored-by: 路振凯 <l>
2025-09-02 16:29:23 +08:00
Trần Quang Khánh
e0683bbd41 feat(TreeSelect): support global config for switcher icon (#54821)
* feat(TreeSelect): support global config for switcher icon

* chore: update config provider document

---------

Co-authored-by: Khanh Tran <quangkhanhdeveloper@gmail.com>
2025-09-02 09:54:59 +08:00
thinkasany
fbc8cc03a7 chore: improve code style (#54834)
* chore: improve code style

* Apply suggestion from @afc163

Signed-off-by: afc163 <afc163@gmail.com>

---------

Signed-off-by: afc163 <afc163@gmail.com>
Co-authored-by: afc163 <afc163@gmail.com>
2025-09-01 21:46:03 +08:00
github-actions[bot]
7d2860e4f4 chore: auto merge branches (#54832)
chore: sync master into feature
2025-09-01 11:29:30 +00:00
EmilyyyLiu
827b22bf55 feat: The mentions component inherits the form's disable (#54829)
* feat: The mentions component inherits the form's disable

* Update components/mentions/index.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* test: add test

* test: add demo

* test: update snap

---------

Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
Co-authored-by: 刘欢 <lh01217311@antgroup.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-09-01 17:56:19 +08:00
Trần Quang Khánh
5facf03416 docs(ConfigProvider): update correct cn version for Image (#54823)
Co-authored-by: Khanh Tran <quangkhanhdeveloper@gmail.com>
2025-08-31 23:45:36 +08:00
thinkasany
48c5ed40f2 feat: add component token support for notification background colors (#54802)
Co-authored-by: afc163 <afc163@gmail.com>
fix: notification wrong bg (#54800)
2025-08-29 14:14:16 +08:00
EmilyyyLiu
864b177fdd fix: make suffixIcon=undefined behave same as when unset (#54790)
* fix: make suffixIcon=undefined behave same as when unset

* Update components/date-picker/generatePicker/generateSinglePicker.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* Update components/date-picker/generatePicker/generateRangePicker.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* feat: useSuffixIcon

* feat: suffixIcon component

* Update components/date-picker/generatePicker/SuffixIcon.tsx

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>

* feat: add debug demo

* test: update snap

---------

Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
Co-authored-by: 刘欢 <lh01217311@antgroup.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: afc163 <afc163@gmail.com>
2025-08-29 12:06:11 +08:00
thinkasany
8838b8f178 chore: improve code style (#54799)
* chore: improve code style

* clean memo
2025-08-29 11:20:30 +08:00
ug
9244e8039e Docs(Grid): Improve the Grid document. (#54793)
* update

* update

* update

---------

Co-authored-by: liuqiang <qiang.liu@xinjifamily.com>
2025-08-28 19:53:31 +08:00
github-actions[bot]
c579e2fd8e chore: auto merge branches (#54786)
chore: sync master into feature
2025-08-28 08:26:25 +00:00
Trần Quang Khánh
a1c2f3b4d2 feat(Image): support fallback global config (#54702)
* feat(Image): support fallback global config

* feat(Image): update config provider document

---------

Co-authored-by: Khanh Tran <quangkhanhdeveloper@gmail.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-08-28 10:25:10 +08:00
lijianan
f98c8f9617 fix: add miss dep for useMemo (#54772)
* fix: add miss dep for useMemo

* Update components/drawer/DrawerPanel.tsx

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: thinkasany <480968828@qq.com>

---------

Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: thinkasany <480968828@qq.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-08-27 17:15:09 +08:00
github-actions[bot]
9bf6ba06c8 chore: auto merge branches (#54765)
chore: merge master into feature
2025-08-27 08:28:08 +00:00
Wanpan
da30965089 feat: Upload add pictureCardSize token (#54756) 2025-08-27 10:22:34 +08:00
David Hsing
e01b76c4a4 feat: Add Drawer closable placement prop for close icon position (#54067)
Co-authored-by: afc163 <afc163@gmail.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-08-26 15:42:14 +08:00
ug
6a302f1133 feat(Row): The "gutter" parameter supports the string type. (#54628)
Co-authored-by: liuqiang <qiang.liu@xinjifamily.com>
2025-08-25 14:04:34 +08:00
github-actions[bot]
f40cedc3bb chore: auto merge branches (#54744)
chore: merge master into feature
2025-08-23 08:34:07 +00:00
github-actions[bot]
410d38921d chore: auto merge branches (#54710)
chore: sync master into feature
2025-08-19 02:41:47 +00:00
github-actions[bot]
a06e74ebb3 chore: auto merge branches (#54684)
chore: sync master into feature
2025-08-14 15:13:49 +00:00
github-actions[bot]
b1702668bf chore: auto merge branches (#54653)
chore: sync master into feature
2025-08-11 13:10:19 +00:00
396 changed files with 11920 additions and 3932 deletions

View File

@@ -20,6 +20,9 @@
html {
scrollbar-width: thin;
scrollbar-color: #eaeaea transparent;
@supports (text-autospace: normal) {
text-autospace: normal;
}
}
.rc-footer {

View File

@@ -0,0 +1,113 @@
import React, { useCallback, useEffect } from 'react';
const ANT_SYNC_STORAGE_EVENT_KEY = 'ANT_SYNC_STORAGE_EVENT_KEY';
const isFunction = (val: any): val is (...args: any[]) => any => {
return typeof val === 'function';
};
interface Options<T> {
defaultValue?: T;
serializer?: (value: T) => string;
deserializer?: (value: string) => T;
onError?: (error: unknown) => void;
}
const useLocalStorage = <T>(key: string, options: Options<T> = {}) => {
const storage = typeof window !== 'undefined' ? localStorage : null;
const { serializer, deserializer, onError, defaultValue } = options;
const mergedSerializer = typeof serializer === 'function' ? serializer : JSON.stringify;
const mergedDeserializer = typeof deserializer === 'function' ? deserializer : JSON.parse;
const handleError = typeof onError === 'function' ? onError : console.error;
const getStoredValue = () => {
try {
const rawData = storage?.getItem(key);
if (rawData) {
return mergedDeserializer(rawData);
}
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
handleError(e);
}
return defaultValue;
}
return defaultValue;
};
const [state, setState] = React.useState<T>(getStoredValue);
useEffect(() => {
setState(getStoredValue());
}, [key]);
const updateState: React.Dispatch<React.SetStateAction<T>> = (value) => {
const currentState = isFunction(value) ? value(state) : value;
setState(currentState);
try {
let newValue: string | null;
const oldValue = storage?.getItem(key);
if (typeof currentState === 'undefined') {
newValue = null;
storage?.removeItem(key);
} else {
newValue = mergedSerializer(currentState);
storage?.setItem(key, newValue);
}
dispatchEvent(
new CustomEvent(ANT_SYNC_STORAGE_EVENT_KEY, {
detail: { key, newValue, oldValue, storageArea: storage },
}),
);
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
handleError(e);
}
}
};
const shouldSync = (ev: StorageEvent) => {
return ev && ev.key === key && ev.storageArea === storage;
};
const onNativeStorage = useCallback(
(event: StorageEvent) => {
if (shouldSync(event)) {
setState(getStoredValue());
}
},
[key],
);
const shouldSyncCustomEvent = (ev: CustomEvent<{ key: string; storageArea: Storage }>) => {
return ev?.detail?.key === key && ev?.detail?.storageArea === storage;
};
const onCustomStorage = useCallback(
(event: Event) => {
const customEvent = event as CustomEvent;
if (shouldSyncCustomEvent(customEvent)) {
setState(getStoredValue());
}
},
[key],
);
useEffect(() => {
window?.addEventListener('storage', onNativeStorage);
window?.addEventListener(ANT_SYNC_STORAGE_EVENT_KEY, onCustomStorage);
return () => {
window?.removeEventListener('storage', onNativeStorage);
window?.removeEventListener(ANT_SYNC_STORAGE_EVENT_KEY, onCustomStorage);
};
}, [key, onNativeStorage, onCustomStorage]);
return [state, updateState] as const;
};
export default useLocalStorage;

View File

@@ -85,10 +85,6 @@ const useThemeAnimation = () => {
);
document
.startViewTransition(async () => {
// wait for theme change end
while (colorBgElevated === animateRef.current.colorBgElevated) {
await new Promise<void>((resolve) => setTimeout(resolve, 1000 / 60));
}
const root = document.documentElement;
root.classList.remove(isDark ? 'dark' : 'light');
root.classList.add(isDark ? 'light' : 'dark');

View File

@@ -31,15 +31,17 @@ const locales = {
const useStyle = createStyles(({ token, css, cx }, siteConfig: SiteContextProps) => {
const textShadow = `0 0 4px ${token.colorBgContainer}`;
const isDark = siteConfig.theme.includes('dark');
const mask = cx(css`
position: absolute;
inset: 0;
backdrop-filter: blur(2px);
opacity: 1;
background-color: ${isDark ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)'};
background-color: rgba(255, 255, 255, 0.2);
transition: all 1s ease;
pointer-events: none;
[data-prefers-color='dark'] & {
background-color: rgba(0, 0, 0, 0.2);
}
`);
const block = cx(css`

View File

@@ -389,10 +389,9 @@ const Theme: React.FC = () => {
themeType,
...ThemesInfo[themeType],
};
setThemeData(mergedData);
form.setFieldsValue(mergedData);
}, [themeType]);
}, [form, themeType]);
const isDark = React.use(DarkContext);
@@ -433,23 +432,14 @@ const Theme: React.FC = () => {
token: { ...themeToken, colorPrimary: colorPrimaryValue },
algorithm: algorithmFn,
components: {
Layout: isLight
? {
headerBg: 'transparent',
bodyBg: 'transparent',
}
: {},
Layout: isLight ? { headerBg: 'transparent', bodyBg: 'transparent' } : {},
Menu: isLight
? {
itemBg: 'transparent',
subMenuItemBg: 'transparent',
activeBarBorderWidth: 0,
}
? { itemBg: 'transparent', subMenuItemBg: 'transparent', activeBarBorderWidth: 0 }
: {},
...(themeType === 'v4' ? defaultTheme.components : {}),
},
}),
[themeToken, colorPrimaryValue, algorithmFn, themeType],
[themeToken, colorPrimaryValue, algorithmFn, isLight, themeType],
);
// ================================ Render ================================

View File

@@ -60,7 +60,15 @@ export type Extras = {
export type Icons = Icon[];
export type HeadingBanner = {
[key in 'cn' | 'en']: {
title?: string;
href?: string;
};
};
export type SiteData = {
headingBanner: HeadingBanner;
articles: Articles;
authors: Authors;
recommendations: Recommendations;
@@ -82,10 +90,31 @@ export function preLoad(list: string[]) {
}
}
/**
* Banner 硬编码,以防止页面闪烁问题
* 返回 null 表示不显示
*/
export const getBannerData = (): null | {
title: string;
href: string;
} => {
// return {
// title: 'See Conf 2025 震撼来袭 - 探索 AI 时代的用户体验与工程实践',
// href: 'https://seeconf.antfin.com/',
// };
return null;
};
export const useAntdSiteConfig = () => {
const { data, error, isLoading } = useSWR<Partial<SiteData>, Error>(
`https://render.alipay.com/p/h5data/antd4-config_website-h5data.json`,
(url: string) => fetch(url).then((res) => res.json()),
{
suspense: false,
// revalidateOnMount: false,
revalidateIfStale: false,
revalidateOnFocus: false,
},
);
return { data, error, isLoading };
};

View File

@@ -1,5 +1,5 @@
import React, { Suspense, useEffect } from 'react';
import { App, Button, ConfigProvider, Skeleton } from 'antd';
import React, { Suspense } from 'react';
import { App, Button, ConfigProvider, Skeleton, version } from 'antd';
import { enUS, zhCN } from 'antd-token-previewer';
import type { ThemeConfig } from 'antd/es/config-provider/context';
import { Helmet } from 'dumi';
@@ -33,21 +33,21 @@ const locales = {
},
};
const ANT_DESIGN_V5_THEME_EDITOR_THEME = 'ant-design-v5-theme-editor-theme';
const [antdMajor] = version.split('.');
const ANT_DESIGN_V5_THEME_EDITOR_THEME = `ant-design-v${antdMajor}-theme-editor-theme`;
const CustomTheme: React.FC = () => {
const { message } = App.useApp();
const [locale, lang] = useLocale(locales);
const [theme, setTheme] = React.useState<ThemeConfig>({});
useEffect(() => {
const storedConfig = localStorage.getItem(ANT_DESIGN_V5_THEME_EDITOR_THEME);
if (storedConfig) {
const themeConfig = JSON.parse(storedConfig);
setTheme(themeConfig);
const [theme, setTheme] = React.useState<ThemeConfig>(() => {
try {
const storedConfig = localStorage.getItem(ANT_DESIGN_V5_THEME_EDITOR_THEME);
return storedConfig ? JSON.parse(storedConfig) : {};
} catch {
return {};
}
}, []);
});
const handleSave = () => {
localStorage.setItem(ANT_DESIGN_V5_THEME_EDITOR_THEME, JSON.stringify(theme));

View File

@@ -20,7 +20,9 @@
const isEnabled = always || enabledCondition.every(Boolean);
if (!isEnabled) return;
if (!isEnabled) {
return;
}
const prefixCls = 'antd-mirror-notify';
const primaryColor = '#1677ff';

View File

@@ -48,7 +48,7 @@ const locales = {
},
};
const branchUrl = (repo: string) => `https://github.com/${repo}/edit/master/`;
const branchUrl = (repo: string) => `https://github.com/${repo}/edit/5.x-stable/`;
function isVersionNumber(value?: string) {
return value && /^\d+\.\d+\.\d+$/.test(value);
@@ -126,7 +126,7 @@ const ComponentMeta: React.FC<ComponentMetaProps> = (props) => {
if (String(source) === 'true') {
const kebabComponent = kebabCase(component);
return [
`https://github.com/${repo}/blob/master/components/${kebabComponent}`,
`https://github.com/${repo}/blob/5.x-stable/components/${kebabComponent}`,
`components/${kebabComponent}`,
];
}
@@ -139,7 +139,10 @@ const ComponentMeta: React.FC<ComponentMetaProps> = (props) => {
}, [component, repo, source]);
// ======================== Render ========================
const importList = `import { ${transformComponentName(component)} } from "antd";`;
const importCode =
component === 'Icon'
? `import { AntDesignOutlined } from '@ant-design/icons';`
: `import { ${transformComponentName(component)} } from 'antd';`;
return (
<Descriptions
@@ -153,14 +156,14 @@ const ComponentMeta: React.FC<ComponentMetaProps> = (props) => {
{
label: locale.import,
children: (
<CopyToClipboard text={`import { ${component} } from "antd";`} onCopy={onCopy}>
<CopyToClipboard text={importCode} onCopy={onCopy}>
<Tooltip
placement="right"
title={copied ? locale.copied : locale.copy}
onOpenChange={onOpenChange}
>
<Typography.Text className={styles.code} onClick={onCopy}>
{importList}
{importCode}
</Typography.Text>
</Tooltip>
</CopyToClipboard>

View File

@@ -7,8 +7,8 @@ import classNames from 'classnames';
import ImagePreview from '../ImagePreview';
import type { ImagePreviewProps } from '../ImagePreview';
const isNotEmpty = (val: any) => {
return typeof val !== 'undefined' && val !== null && val !== '';
const isNonNullable = <T,>(val: T): val is NonNullable<T> => {
return val !== undefined && val !== null;
};
const useStyle = createStyles(({ css, token }) => {
@@ -51,8 +51,8 @@ const FlexWithImagePreview: React.FC<
return (
<Flex className={classNames(styles.wrapper, className)} style={style} {...rest}>
<Flex align="flex-start" justify="flex-start" vertical>
{isNotEmpty(title) && <div className={styles.title}>{title}</div>}
{isNotEmpty(description) && <div className={styles.description}>{description}</div>}
{isNonNullable(title) && <div className={styles.title}>{title}</div>}
{isNonNullable(description) && <div className={styles.description}>{description}</div>}
</Flex>
<ImagePreview {...imagePreviewProps}>{children}</ImagePreview>
</Flex>

View File

@@ -48,6 +48,8 @@ const IconSearch: React.FC = () => {
const handleSearchIcon = debounce((e: React.ChangeEvent<HTMLInputElement>) => {
setDisplayState((prevState) => ({ ...prevState, searchKey: e.target.value }));
document.getElementById('list-of-icons')?.scrollIntoView({ behavior: 'smooth' });
}, 300);
const handleChangeTheme = useCallback((value: ThemeType) => {

View File

@@ -164,7 +164,6 @@ const CodePreview: React.FC<CodePreviewProps> = ({
</div>
),
})),
// eslint-disable-next-line react-hooks/exhaustive-deps
[
entryName,
error,

View File

@@ -72,10 +72,10 @@ const Palette: React.FC<PaletteProps> = (props) => {
key={i}
ref={(node) => {
if (node) {
colorNodesRef.current[`${name}-${i}`] = node;
colorNodesRef.current[`${name}-${i + 1}`] = node;
}
}}
className={`main-color-item palette-${name}-${i}`}
className={`main-color-item palette-${name}-${i + 1}`}
style={{
color: (name === 'yellow' ? i > 6 : i > 5) ? firstColor : lastColor,
fontWeight: i === 6 ? 'bold' : 'normal',

View File

@@ -3,7 +3,7 @@ import { EditOutlined } from '@ant-design/icons';
import { Tooltip } from 'antd';
import { createStyles } from 'antd-style';
const branchUrl = 'https://github.com/ant-design/ant-design/edit/master/';
const branchUrl = 'https://github.com/ant-design/ant-design/edit/5.x-stable/';
export interface EditButtonProps {
title: React.ReactNode;

View File

@@ -16,6 +16,7 @@ export interface SemanticPreviewInjectionProps {
const useStyle = createStyles(({ token }) => ({
container: css`
position: relative;
z-index: 0;
`,
colWrap: css`
border-inline-end: 1px solid ${token.colorBorderSecondary};

View File

@@ -11,17 +11,17 @@ import type { MenuProps } from 'antd';
import { CompactTheme, DarkTheme } from 'antd-token-previewer/es/icons';
import { FormattedMessage, useLocation } from 'dumi';
import useLocalStorage from '../../../hooks/useLocalStorage';
import useThemeAnimation from '../../../hooks/useThemeAnimation';
import type { SiteContextProps } from '../../slots/SiteContext';
import SiteContext from '../../slots/SiteContext';
import { getLocalizedPathname, isZhCN, isLocalStorageNameSupported } from '../../utils';
import { getLocalizedPathname, isZhCN } from '../../utils';
import Link from '../Link';
import ThemeIcon from './ThemeIcon';
export type ThemeName = 'light' | 'dark' | 'auto' | 'compact' | 'motion-off' | 'happy-work';
// 主题持久化存储键名
const ANT_DESIGN_SITE_THEME = 'ant-design-site-theme';
export const ANT_DESIGN_SITE_THEME = 'ant-design-site-theme';
export interface ThemeSwitchProps {
value?: ThemeName[];
@@ -33,6 +33,10 @@ const ThemeSwitch: React.FC<ThemeSwitchProps> = () => {
const toggleAnimationTheme = useThemeAnimation();
const lastThemeKey = useRef<string>(theme.includes('dark') ? 'dark' : 'light');
const [, setTheme] = useLocalStorage<ThemeName>(ANT_DESIGN_SITE_THEME, {
defaultValue: undefined,
});
const badge = <Badge color="blue" style={{ marginTop: -1 }} />;
// 主题选项配置
@@ -133,14 +137,9 @@ const ThemeSwitch: React.FC<ThemeSwitchProps> = () => {
const filteredTheme = theme.filter((t) => !['light', 'dark', 'auto'].includes(t));
const newTheme = [...filteredTheme, themeKey];
updateSiteConfig({
theme: newTheme,
});
setTheme(themeKey);
// 持久化到 localStorage
if (isLocalStorageNameSupported()) {
localStorage.setItem(ANT_DESIGN_SITE_THEME, themeKey);
}
updateSiteConfig({ theme: newTheme });
} else {
// 其他主题选项是开关式的
const hasTheme = theme.includes(themeKey);

View File

@@ -12,15 +12,18 @@ import { getSandpackCssText } from '@codesandbox/sandpack-react';
import { theme as antdTheme, App } from 'antd';
import type { MappingAlgorithm } from 'antd';
import type { DirectionType, ThemeConfig } from 'antd/es/config-provider';
import dayjs from 'dayjs';
import { createSearchParams, useOutlet, useSearchParams, useServerInsertedHTML } from 'dumi';
import { DarkContext } from '../../hooks/useDark';
import useLayoutState from '../../hooks/useLayoutState';
import useLocalStorage from '../../hooks/useLocalStorage';
import { getBannerData } from '../../pages/index/components/util';
import { ANT_DESIGN_SITE_THEME } from '../common/ThemeSwitch';
import type { ThemeName } from '../common/ThemeSwitch';
import SiteThemeProvider from '../SiteThemeProvider';
import type { SiteContextProps } from '../slots/SiteContext';
import SiteContext from '../slots/SiteContext';
import { isLocalStorageNameSupported } from '../utils';
import '@ant-design/v5-patch-for-react-19';
@@ -28,10 +31,8 @@ type Entries<T> = { [K in keyof T]: [K, T[K]] }[keyof T][];
type SiteState = Partial<Omit<SiteContextProps, 'updateSiteConfig'>>;
const RESPONSIVE_MOBILE = 768;
export const ANT_DESIGN_NOT_SHOW_BANNER = 'ANT_DESIGN_NOT_SHOW_BANNER';
// 主题持久化存储键名
const ANT_DESIGN_SITE_THEME = 'ant-design-site-theme';
export const ANT_DESIGN_NOT_SHOW_BANNER = 'ANT_DESIGN_NOT_SHOW_BANNER';
// Compatible with old anchors
if (typeof window !== 'undefined') {
@@ -43,9 +44,13 @@ if (typeof window !== 'undefined') {
}
}
const getAlgorithm = (themes: ThemeName[] = []) =>
const getAlgorithm = (themes: ThemeName[] = [], systemTheme: 'dark' | 'light') =>
themes
.map((theme) => {
// auto 模式下根据系统主题切换
if (theme === 'auto' && systemTheme === 'dark') {
return antdTheme.darkAlgorithm;
}
if (theme === 'dark') {
return antdTheme.darkAlgorithm;
}
@@ -56,21 +61,11 @@ const getAlgorithm = (themes: ThemeName[] = []) =>
})
.filter(Boolean);
// 获取最终主题优先级URL Query > Local Storage > Site (Memory)
const getFinalTheme = (urlTheme: ThemeName[]): ThemeName[] => {
// 只认 light/dark
const baseTheme = urlTheme.filter((t) => !['light', 'dark', 'auto'].includes(t));
const urlColor = urlTheme.find((t) => t === 'light' || t === 'dark');
if (urlColor) return [...baseTheme, urlColor];
if (isLocalStorageNameSupported()) {
const stored = localStorage.getItem(ANT_DESIGN_SITE_THEME) as ThemeName;
if (stored && ['light', 'dark', 'auto'].includes(stored)) {
return [...baseTheme, stored];
}
const getSystemTheme = (): 'light' | 'dark' => {
if (typeof window === 'undefined') {
return 'light';
}
// 默认 auto
return [...baseTheme, 'auto'];
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
};
const GlobalLayout: React.FC = () => {
@@ -84,6 +79,32 @@ const GlobalLayout: React.FC = () => {
bannerVisible: false,
});
const [storedTheme] = useLocalStorage<ThemeName>(ANT_DESIGN_SITE_THEME, {
defaultValue: undefined,
});
const [bannerLastTime] = useLocalStorage<string>(ANT_DESIGN_NOT_SHOW_BANNER, {
defaultValue: undefined,
});
// 获取最终主题优先级URL Query > Local Storage > Site (Memory)
const getFinalTheme = (urlTheme: ThemeName[]): ThemeName[] => {
// 只认 light/dark
const baseTheme = urlTheme.filter((t) => !['light', 'dark', 'auto'].includes(t));
const urlColor = urlTheme.find((t) => t === 'light' || t === 'dark');
if (urlColor) {
return [...baseTheme, urlColor];
}
if (['light', 'dark', 'auto'].includes(storedTheme)) {
return [...baseTheme, storedTheme];
}
return [...baseTheme, 'auto'];
};
const [systemTheme, setSystemTheme] = React.useState<'light' | 'dark'>(() => getSystemTheme());
const bannerData = getBannerData();
// TODO: This can be remove in v6
const useCssVar = searchParams.get('cssVar') !== 'false';
@@ -111,10 +132,6 @@ const GlobalLayout: React.FC = () => {
} else {
nextSearchParams.delete('theme');
}
// 设置 data-prefers-color
if (color) {
document.querySelector('html')?.setAttribute('data-prefers-color', color);
}
}
});
@@ -122,7 +139,6 @@ const GlobalLayout: React.FC = () => {
setSearchParams(nextSearchParams);
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[searchParams, setSearchParams],
);
@@ -130,6 +146,17 @@ const GlobalLayout: React.FC = () => {
updateSiteConfig({ isMobile: window.innerWidth < RESPONSIVE_MOBILE });
}, [updateSiteConfig]);
// 设置 data-prefers-color 属性
useEffect(() => {
const color = theme.find((t) => t === 'light' || t === 'dark');
const html = document.querySelector<HTMLHtmlElement>('html');
if (theme.includes('auto') && systemTheme) {
html?.setAttribute('data-prefers-color', systemTheme);
} else if (color) {
html?.setAttribute('data-prefers-color', color);
}
}, [systemTheme, theme]);
// 监听系统主题变化
useEffect(() => {
if (typeof window === 'undefined') {
@@ -138,7 +165,10 @@ const GlobalLayout: React.FC = () => {
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
const handleSystemThemeChange = () => {};
const handleSystemThemeChange = (e: MediaQueryListEvent) => {
const newSystemTheme = e.matches ? 'dark' : 'light';
setSystemTheme(newSystemTheme);
};
mediaQuery.addEventListener('change', handleSystemThemeChange);
@@ -153,17 +183,18 @@ const GlobalLayout: React.FC = () => {
const finalTheme = getFinalTheme(urlTheme);
const _direction = searchParams.get('direction') as DirectionType;
const storedBannerVisible = bannerLastTime && dayjs().diff(dayjs(bannerLastTime), 'day') >= 1;
const isZhCN = typeof window !== 'undefined' && window.location.pathname.includes('-cn');
const hasBannerContent = isZhCN && !!bannerData;
setSiteState({
theme: finalTheme,
direction: _direction === 'rtl' ? 'rtl' : 'ltr',
bannerVisible: hasBannerContent && (bannerLastTime ? !!storedBannerVisible : true),
});
// 设置 data-prefers-color 属性
const colorTheme = finalTheme.find((t) => ['light', 'dark'].includes(t));
if (colorTheme) {
document.documentElement.setAttribute('data-prefers-color', colorTheme);
}
// Handle isMobile
updateMobileMode();
@@ -177,7 +208,6 @@ const GlobalLayout: React.FC = () => {
return () => {
window.removeEventListener('resize', updateMobileMode);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchParams, updateMobileMode]);
const siteContextValue = React.useMemo<SiteContextProps>(
@@ -195,12 +225,12 @@ const GlobalLayout: React.FC = () => {
// 算法优先级auto 时用系统主题算法
const themeForAlgorithm = theme;
return {
algorithm: getAlgorithm(themeForAlgorithm),
algorithm: getAlgorithm(themeForAlgorithm, systemTheme),
token: { motion: !theme.includes('motion-off') },
cssVar: useCssVar,
hashed: !useCssVar,
};
}, [theme, useCssVar]);
}, [theme, useCssVar, systemTheme]);
const styleCache = React.useMemo(() => createCache(), []);
@@ -239,7 +269,9 @@ const GlobalLayout: React.FC = () => {
));
return (
<DarkContext value={theme.includes('dark')}>
<DarkContext
value={theme.includes('dark') || (theme.includes('auto') && systemTheme === 'dark')}
>
<StyleProvider
cache={styleCache}
linters={[legacyNotSelectorLinter, parentSelectorLinter, NaNLinter]}

View File

@@ -157,21 +157,11 @@ const RoutesPlugin = async (api: IApi) => {
api.modifyRoutes((routes) => {
// TODO: append extra routes, such as home, changelog, form-v3
/**
* **important!** Make sure that the `id` and `path` are consistent.
* see: https://github.com/ant-design/ant-design/issues/55960
*/
const extraRoutesList: IRoute[] = [
{
id: 'changelog-cn',
path: 'changelog-cn',
absPath: '/changelog-cn',
parentId: 'DocLayout',
file: resolve('../../CHANGELOG.zh-CN.md'),
},
{
id: 'components-changelog-cn',
path: 'components/changelog-cn',
absPath: '/changelog-cn',
parentId: 'DocLayout',
file: resolve('../../CHANGELOG.zh-CN.md'),
},
{
id: 'changelog',
path: 'changelog',
@@ -180,12 +170,26 @@ const RoutesPlugin = async (api: IApi) => {
file: resolve('../../CHANGELOG.en-US.md'),
},
{
id: 'components-changelog',
id: 'changelog-cn',
path: 'changelog-cn',
absPath: '/changelog-cn',
parentId: 'DocLayout',
file: resolve('../../CHANGELOG.zh-CN.md'),
},
{
id: 'components/changelog',
path: 'components/changelog',
absPath: '/changelog',
absPath: '/components/changelog',
parentId: 'DocLayout',
file: resolve('../../CHANGELOG.en-US.md'),
},
{
id: 'components/changelog-cn',
path: 'components/changelog-cn',
absPath: '/components/changelog-cn',
parentId: 'DocLayout',
file: resolve('../../CHANGELOG.zh-CN.md'),
},
];
extraRoutesList.forEach((itemRoute) => {

View File

@@ -40,12 +40,10 @@ const Content: React.FC<React.PropsWithChildren> = ({ children }) => {
useLayoutEffect(() => {
setShowDebug(process.env.NODE_ENV === 'development' || isDebugDemo);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isDebugDemo]);
const contextValue = useMemo<DemoContextProps>(
() => ({ showDebug, setShowDebug, codeType, setCodeType }),
// eslint-disable-next-line react-hooks/exhaustive-deps
[showDebug, codeType],
);

View File

@@ -8,6 +8,8 @@ import { useLocation, useSiteData } from 'dumi';
import DumiSearchBar from 'dumi/theme-default/slots/SearchBar';
import useLocale from '../../../hooks/useLocale';
import useLocalStorage from '../../../hooks/useLocalStorage';
import { getBannerData } from '../../../pages/index/components/util';
import ThemeSwitch from '../../common/ThemeSwitch';
import DirectionIcon from '../../icons/DirectionIcon';
import { ANT_DESIGN_NOT_SHOW_BANNER } from '../../layouts/GlobalLayout';
@@ -22,20 +24,7 @@ import SwitchBtn from './SwitchBtn';
const RESPONSIVE_XS = 1120;
const RESPONSIVE_SM = 1200;
const locales = {
cn: {
message: '语雀征文 · 说说你和开源的故事,赢取 Ant Design 精美周边 🎁',
shortMessage: '语雀征文 · 说说你和开源的故事,赢取 Ant Design 精美周边 🎁',
more: '前往了解',
link: 'https://www.yuque.com/opensource2023',
},
en: {
message: '',
shortMessage: '',
more: '',
link: '',
},
};
export const ANT_LOCAL_TYPE_KEY = 'ANT_LOCAL_TYPE_KEY';
const useStyle = createStyles(({ token, css }) => {
const searchIconColor = '#ced4d9';
@@ -162,11 +151,12 @@ interface HeaderState {
// ================================= Header =================================
const Header: React.FC = () => {
const [locale, lang] = useLocale(locales);
const [, lang] = useLocale();
const { pkg } = useSiteData();
const themeConfig = getThemeConfig();
const [headerState, setHeaderState] = useState<HeaderState>({
menuVisible: false,
windowWidth: 1400,
@@ -179,24 +169,33 @@ const Header: React.FC = () => {
const { styles } = useStyle();
const [, setTopBannerDay] = useLocalStorage<string>(ANT_DESIGN_NOT_SHOW_BANNER, {
defaultValue: undefined,
});
const [, setLocalType] = useLocalStorage<string>(ANT_LOCAL_TYPE_KEY, {
defaultValue: undefined,
});
const handleHideMenu = useCallback(() => {
setHeaderState((prev) => ({ ...prev, menuVisible: false }));
}, []);
const onWindowResize = useCallback(() => {
setHeaderState((prev) => ({ ...prev, windowWidth: window.innerWidth }));
}, []);
const onMenuVisibleChange = useCallback((visible: boolean) => {
setHeaderState((prev) => ({ ...prev, menuVisible: visible }));
}, []);
const onDirectionChange = () => {
updateSiteConfig({ direction: direction !== 'rtl' ? 'rtl' : 'ltr' });
};
const onBannerClose = () => {
updateSiteConfig({ bannerVisible: false });
if (utils.isLocalStorageNameSupported()) {
localStorage.setItem(ANT_DESIGN_NOT_SHOW_BANNER, dayjs().toISOString());
}
setTopBannerDay(dayjs().toISOString());
};
useEffect(() => {
@@ -238,9 +237,8 @@ const Header: React.FC = () => {
const currentProtocol = `${window.location.protocol}//`;
const currentHref = window.location.href.slice(currentProtocol.length);
if (utils.isLocalStorageNameSupported()) {
localStorage.setItem('locale', utils.isZhCN(pathname) ? 'en-US' : 'zh-CN');
}
setLocalType(utils.isZhCN(pathname) ? 'en-US' : 'zh-CN');
window.location.href =
currentProtocol +
currentHref.replace(
@@ -261,6 +259,7 @@ const Header: React.FC = () => {
const { menuVisible, windowWidth, searching } = headerState;
const docVersions: Record<string, string> = {
...themeConfig?.docNewVersions,
[pkg.version]: pkg.version,
...themeConfig?.docVersions,
};
@@ -272,6 +271,12 @@ const Header: React.FC = () => {
const isHome = ['', 'index', 'index-cn'].includes(pathname);
const isZhCN = lang === 'cn';
const isRTL = direction === 'rtl';
// Get banner data from site config
const bannerData = getBannerData();
const bannerTitle = bannerData?.title || '';
const bannerHref = bannerData?.href || '';
let responsive: null | 'narrow' | 'crowded' = null;
if (windowWidth < RESPONSIVE_XS) {
responsive = 'crowded';
@@ -375,7 +380,7 @@ const Header: React.FC = () => {
<MenuOutlined className="nav-phone-icon" />
</Popover>
)}
{isZhCN && bannerVisible && (
{isZhCN && bannerVisible && bannerTitle && bannerHref && (
<ConfigProvider
theme={{
token: {
@@ -387,23 +392,25 @@ const Header: React.FC = () => {
<Alert
className={styles.banner}
message={
<>
<span>{isMobile ? locale.shortMessage : locale.message}</span>
<a
className={styles.link}
href={locale.link}
target="_blank"
rel="noreferrer"
onClick={() => {
window.gtag?.('event', '点击', {
event_category: 'top_banner',
event_label: locale.link,
});
}}
>
{locale.more}
</a>
</>
bannerTitle && bannerHref ? (
<>
<span>{bannerTitle}</span>
<a
className={styles.link}
href={bannerHref}
target="_blank"
rel="noreferrer"
onClick={() => {
window.gtag?.('event', '点击', {
event_category: 'top_banner',
event_label: bannerHref,
});
}}
>
</a>
</>
) : null
}
type="info"
banner

View File

@@ -2,6 +2,7 @@ import * as React from 'react';
import type { DirectionType } from 'antd/es/config-provider';
import type { ThemeName } from '../common/ThemeSwitch';
import { getBannerData } from '../../pages/index/components/util';
export interface SiteContextProps {
isMobile: boolean;
@@ -13,7 +14,7 @@ export interface SiteContextProps {
const SiteContext = React.createContext<SiteContextProps>({
isMobile: false,
bannerVisible: false,
bannerVisible: !!getBannerData(),
direction: 'ltr',
theme: ['light'],
updateSiteConfig: () => {},

View File

@@ -55,4 +55,7 @@ export default {
'0.10.x': 'https://010x.ant.design',
'0.9.x': 'https://09x.ant.design',
},
docNewVersions: {
'6.x': chineseMirror ? 'https://ant-design.antgroup.com' : 'https://ant.design',
},
};

View File

@@ -1,6 +1,7 @@
import semver from 'semver';
import flatten from 'lodash/flatten';
import flattenDeep from 'lodash/flattenDeep';
import semver from 'semver';
import deprecatedVersions from '../../../BUG_VERSIONS.json';
import themeConfig from '../themeConfig';
@@ -157,19 +158,6 @@ export function getLocalizedPathname(
return { pathname: fullPath, search };
}
export function isLocalStorageNameSupported() {
const testKey = 'test';
const storage = window.localStorage;
try {
storage.setItem(testKey, '1');
storage.removeItem(testKey);
return true;
} catch (error) {
console.error('Your web browser does not support storing settings locally.', error);
return false;
}
}
export function loadScript(src: string) {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
@@ -177,7 +165,7 @@ export function loadScript(src: string) {
script.src = src;
script.onload = resolve;
script.onerror = reject;
document.head!.appendChild(script);
document.head.appendChild(script);
});
}

View File

@@ -131,17 +131,6 @@ export default defineConfig({
headScripts: [
`
(function () {
function isLocalStorageNameSupported() {
const testKey = 'test';
const storage = window.localStorage;
try {
storage.setItem(testKey, '1');
storage.removeItem(testKey);
return true;
} catch (error) {
return false;
}
}
// 优先级提高到所有静态资源的前面,语言不对,加载其他静态资源没意义
const pathname = location.pathname;
@@ -171,7 +160,7 @@ export default defineConfig({
}
// 首页无视链接里面的语言设置 https://github.com/ant-design/ant-design/issues/4552
if (isLocalStorageNameSupported() && (pathname === '/' || pathname === '/index-cn')) {
if (pathname === '/' || pathname === '/index-cn') {
const lang =
(window.localStorage && localStorage.getItem('locale')) ||
((navigator.language || navigator.browserLanguage).toLowerCase() === 'zh-cn'

View File

@@ -39,7 +39,9 @@ jobs:
const now = new Date();
for (const issue of issues) {
if (issue.pull_request) continue;
if (issue.pull_request) {
continue;
}
const updatedAt = new Date(issue.updated_at);
const daysInactive = (now - updatedAt) / (1000 * 60 * 60 * 24);

View File

@@ -41,7 +41,9 @@ jobs:
}, {});
const total = Object.keys(jobs).length;
if(total === 0) core.setFailed('no jobs found');
if (total === 0) {
core.setFailed('no jobs found');
}
// the name here must be the same as `jobs.xxx.{name}` in preview-build.yml
// set output

View File

@@ -25,7 +25,7 @@ jobs:
with:
trigger: tag
changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md'
branch: 'master, 4.x-stable'
branch: 'master, 5.x-stable, 4.x-stable'
tag: '5*, 4*'
latest: '5*'
dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} ${{ secrets.DINGDING_BOT_COLLABORATOR_TOKEN }} ${{ secrets.DINGDING_BOT_MAINTAINER_TOKEN }}
@@ -41,7 +41,7 @@ jobs:
with:
trigger: tag
changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md'
branch: 'master, 4.x-stable'
branch: 'master, 5.x-stable, 4.x-stable'
tag: '5*, 4*'
latest: '5*'
dingding-token: ${{ secrets.DINGDING_BOT_BIGFISH_TOKEN }} ${{ secrets.DINGDING_BOT_BIGFISH_2_TOKEN }} ${{ secrets.DINGDING_BOT_YUNFENGDIE_TOKEN }}

View File

@@ -63,7 +63,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
- name: download site artifact
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: real-site
path: _site
@@ -73,7 +73,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
exclude_files: ./_site/report.html # 👈 这个功能是 beta, 但即便不排除,也不 care
exclude_assets: ./_site/report.html
force_orphan: true
# Since force_orphan will not trigger Sync to Gitee, we need to force run it here
@@ -105,7 +105,7 @@ jobs:
needs: build-site
steps:
- name: download site artifact
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: real-site
path: _site
@@ -117,7 +117,7 @@ jobs:
cd ..
- name: Upload to Release
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
with:
fail_on_unmatched_files: true
files: website.tar.gz

View File

@@ -9,6 +9,7 @@ on:
- 2.x-stable
- 3.x-stable
- 4.x-stable
- 5.x-stable
create:
workflow_dispatch:

View File

@@ -123,7 +123,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
- run: bun install
- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v6
with:
pattern: coverage-artifacts-*
merge-multiple: true

View File

@@ -4,9 +4,9 @@ name: ✅ test
on:
push:
branches: [master, feature]
branches: [master, feature, 5.x-stable]
pull_request:
branches: [master, feature]
branches: [master, feature, 5.x-stable]
# Cancel prev CI if new commit come
concurrency:
@@ -126,7 +126,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
- run: bun install
- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v6
with:
pattern: coverage-artifacts-*
merge-multiple: true
@@ -183,7 +183,7 @@ jobs:
# Artifact build files
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'push' && github.ref == 'refs/heads/5.x-stable'
with:
name: build artifacts
path: |
@@ -193,7 +193,7 @@ jobs:
lib
- name: zip builds
if: github.repository == 'ant-design/ant-design' && github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.repository == 'ant-design/ant-design' && github.event_name == 'push' && github.ref == 'refs/heads/5.x-stable'
env:
ALI_OSS_AK_ID: ${{ secrets.ALI_OSS_AK_ID }}
ALI_OSS_AK_SECRET: ${{ secrets.ALI_OSS_AK_SECRET }}

View File

@@ -4,7 +4,7 @@ name: 👀 Visual Regression Diff Build
on:
pull_request:
branches: [master, feature, next]
branches: [master, feature, next, 5.x-stable]
types: [opened, synchronize, reopened]
# Cancel prev CI if new commit come
@@ -54,7 +54,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
- run: bun install
- uses: actions/download-artifact@v5
- uses: actions/download-artifact@v6
with:
pattern: snapshot-artifacts-*
merge-multiple: true

View File

@@ -43,7 +43,9 @@ jobs:
}, {});
const total = Object.keys(jobs).length;
if(total === 0) core.setFailed('no jobs found');
if (total === 0) {
core.setFailed('no jobs found');
}
// the name here must be the same as `jobs.xxx.{name}`
console.log('visual-diff report job status: %s', jobs['visual-diff report'].status);

View File

@@ -8,7 +8,7 @@ name: 👀 Visual Regression Diff Start
on:
pull_request_target:
branches: [master, feature, next]
branches: [master, feature, next, 5.x-stable]
types: [opened, synchronize, reopened]
permissions:

View File

@@ -40,7 +40,9 @@ jobs:
}, {});
const total = Object.keys(jobs).length;
if(total === 0) core.setFailed('no jobs found');
if (total === 0) {
core.setFailed('no jobs found');
}
// the name here must be the same as `jobs.xxx.{name}`
console.log('visual-diff report job status: %s', jobs['test image']);
@@ -87,7 +89,7 @@ jobs:
path: ./tmp
- name: Persist Image Snapshot to OSS
if: github.repository == 'ant-design/ant-design' && github.event.workflow_run.event == 'push' && (github.event.workflow_run.head_branch == 'master' || github.event.workflow_run.head_branch == 'feature' || github.event.workflow_run.head_branch == 'next')
if: github.repository == 'ant-design/ant-design' && github.event.workflow_run.event == 'push' && (github.event.workflow_run.head_branch == 'master' || github.event.workflow_run.head_branch == 'feature' || github.event.workflow_run.head_branch == 'next' || github.event.workflow_run.head_branch == '5.x-stable')
env:
ALI_OSS_AK_ID: ${{ secrets.ALI_OSS_AK_ID }}
ALI_OSS_AK_SECRET: ${{ secrets.ALI_OSS_AK_SECRET }}

View File

@@ -8,6 +8,7 @@ on:
- master
- feature
- next
- 5.x-stable
permissions:
contents: read

View File

@@ -77,5 +77,6 @@
],
"5.22.6": ["https://github.com/ant-design/ant-design/issues/52124"],
"5.24.8": ["https://github.com/ant-design/ant-design/issues/53652"],
"5.25.0": ["https://github.com/ant-design/ant-design/issues/53764"]
"5.25.0": ["https://github.com/ant-design/ant-design/issues/53764"],
">= 5.28.1 <= 5.29.0": ["https://github.com/ant-design/ant-design/issues/55755"]
}

View File

@@ -15,6 +15,87 @@ tag: vVERSION
---
## 5.29.3
`2025-12-18`
- 🐞 Fix Breadcrumb link color being overridden when using custom `itemRender`. [#56251](https://github.com/ant-design/ant-design/pull/56251) [@guoyunhe](https://github.com/guoyunhe)
## 5.29.2
`2025-12-15`
- 🐞 Fix notification background colors incorrect when `cssVar` is disabled. [#56133](https://github.com/ant-design/ant-design/pull/56133) [@afc163](https://github.com/afc163)
- 🐞 Raise Breadcrumb link style priority to avoid being overridden by global styles (v5). [#56139](https://github.com/ant-design/ant-design/pull/56139) [@guoyunhe](https://github.com/guoyunhe)
- 🐞 Fix Input.Search should not warn about deprecated `addonAfter`. [#55806](https://github.com/ant-design/ant-design/pull/55806) [@zombieJ](https://github.com/zombieJ)
- 🐞 Fix Splitter failing to fill its container when the sum of panel proportions is not 1. [#56217](https://github.com/ant-design/ant-design/pull/56217) [@zombieJ](https://github.com/zombieJ)
## 5.29.1
`2025-11-18`
- 🐞 Fix Carousel dot can not click when in vertical mode.[#55757](https://github.com/ant-design/ant-design/pull/55757) [@wanpan11](https://github.com/wanpan11)
## 5.29.0
`2025-11-17`
- 🆕 InputNumber component deprecates `addonAfter` and `addonBefore` props, use Space.Compact instead. [#55505](https://github.com/ant-design/ant-design/pull/55505) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- ⌨️ Improve Drawer accessibility by adding `aria-labelledby` when a title is present. [#55697](https://github.com/ant-design/ant-design/pull/55697) [@rxy001](https://github.com/rxy001)
- 🌐 Fixed spacing in Korean localization for “복사됨” message. [#55672](https://github.com/ant-design/ant-design/pull/55672) [@rapsealk](https://github.com/rapsealk)
## 5.28.1
`2025-11-11`
- Carousel
- 🐞 Fix Carousel style issue in vertical mode. [#55615](https://github.com/ant-design/ant-design/pull/55615) [@wanpan11](https://github.com/wanpan11)
- 🐞 Fix Carousel dots animation missing when first render. [#55589](https://github.com/ant-design/ant-design/pull/55589) [@wanpan11](https://github.com/wanpan11)
- 🐞 Fix Descriptions where content style wrongly used `labelStyle`. [#55572](https://github.com/ant-design/ant-design/pull/55572) [@li-jia-nan](https://github.com/li-jia-nan)
- 💄 Adjust the height of the Select component to 32px when `variant="underlined"`. [#55607](https://github.com/ant-design/ant-design/pull/55607) [@ustcfury](https://github.com/ustcfury)
- 💄 When the `underlined` property is enabled for the Input component, the border color changes on mouse hover. [#55609](https://github.com/ant-design/ant-design/pull/55609) [@ustcfury](https://github.com/ustcfury)
- 🌐 Add missing TimePicker translations for locales: ar_EG, en_GB, gl_ES, bg_BG, ca_ES, cs_CZ, el_GR, es_ES, eu_ES, fi_FI, he_IL, hu_HU, is_IS, kn_IN, kmr_IQ, lv_LV, mk_MK, mn_MN, ms_MY, pl_PL, pt_BR, pt_PT, ro_RO, sk_SK, sl_SI, sv_SE, ta_IN, th_TH, zh_TW, et_EE. [#55656](https://github.com/ant-design/ant-design/pull/55656) [@li-jia-nan](https://github.com/li-jia-nan)
- TypeScript
- 🤖 Improve Flex component `gap` prop typing, for better IDE autocomplete and type inference. [#55591](https://github.com/ant-design/ant-design/pull/55591) [@ayangweb](https://github.com/ayangweb)
## 5.28.0
`2025-11-01`
- 🆕 Drawer supports `closable.placement` prop to specify the position of the close button. [#54067](https://github.com/ant-design/ant-design/pull/54067) [@davidhsing](https://github.com/davidhsing)
- 🆕 Image component supports `fallback` global configuration. [#54702](https://github.com/ant-design/ant-design/pull/54702) [@Jiyur](https://github.com/Jiyur)
- 🆕 QRCode component supports `boostLevel` prop. [#55063](https://github.com/ant-design/ant-design/pull/55063) [@li-jia-nan](https://github.com/li-jia-nan)
- 🆕 Splitter supports `onCollapse` prop. [#54673](https://github.com/ant-design/ant-design/pull/54673) [@ug-hero](https://github.com/ug-hero)
- 🆕 Statistic displays animation effect by default when set to `loading`. [#55398](https://github.com/ant-design/ant-design/pull/55398) [@afc163](https://github.com/afc163)
- 🆕 TreeSelect supports global configuration for switcher icon. [#54821](https://github.com/ant-design/ant-design/pull/54821) [@Jiyur](https://github.com/Jiyur)
- Segmented
- 💄 Segmented theme variable `itemSelectedBg` supports background gradient. [#55391](https://github.com/ant-design/ant-design/pull/55391) [@zancheng](https://github.com/zancheng)
- 🐞 Fix Segmented abnormal animation after React DevTools upgrade. [#55438](https://github.com/ant-design/ant-design/pull/55438) [@afc163](https://github.com/afc163)
- 🐞 Fix Tree and Transfer components `disabled` inheritance issue. [#54831](https://github.com/ant-design/ant-design/pull/54831) [@cactuser-Lu](https://github.com/cactuser-Lu)
- 🐞 Fix Tree.DirectoryTree `defaultExpandAll` not working when `fieldNames` is defined. [#55420](https://github.com/ant-design/ant-design/pull/55420) [@Wxh16144](https://github.com/Wxh16144)
- Upload
- 🆕 Upload component adds `info.defaultRequest` in `customRequest` parameters. [#55146](https://github.com/ant-design/ant-design/pull/55146) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 💄 Upload component supports `pictureCardSize` token. [#54756](https://github.com/ant-design/ant-design/pull/54756) [@wanpan11](https://github.com/wanpan11)
- 💄 Notification supports configuring background color token. [#54802](https://github.com/ant-design/ant-design/pull/54802) [@thinkasany](https://github.com/thinkasany)
- 💄 Pagination supports modifying the text color of active items through `itemActiveColor` and `itemActiveColorHover` tokens. [#55195](https://github.com/ant-design/ant-design/pull/55195) [@Renderz](https://github.com/Renderz)
- 🐞 Fix Select, DatePicker, TreeSelect, Cascader and other components not showing default suffix icon when `suffixIcon` is configured as undefined. [#54790](https://github.com/ant-design/ant-design/pull/54790) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 🐞 Fix Mentions component not inheriting `disabled` from external Form. [#54829](https://github.com/ant-design/ant-design/pull/54829) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 🐞 Fix Watermark component crashing when wrapping Modal with `modalRender`. [#55435](https://github.com/ant-design/ant-design/pull/55435) [@ug-hero](https://github.com/ug-hero)
- 🗑 Input component deprecates `addonAfter` and `addonBefore` props, use Space.Compact instead. [#55315](https://github.com/ant-design/ant-design/pull/55315) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 🤖 Row component `gutter` prop supports string type definition. [#54628](https://github.com/ant-design/ant-design/pull/54628) [@ug-hero](https://github.com/ug-hero)
## 5.27.6
`2025-10-20`
- 🐞 Fix Table `pagination.align` is not working. [#55316](https://github.com/ant-design/ant-design/pull/55316)
- 🛠 Refactor Modal useMemo of ConfirmDialog to resolve useMemo invalid where Object.values generates a new array. [#55376](https://github.com/ant-design/ant-design/pull/55376)
- TypeScript
- 🤖 Add ConfigProvider the `Window` type definition in `getTargetContainer` of . [#55313](https://github.com/ant-design/ant-design/pull/55313)
- 🤖 Add ConfigProvider the `ShadowRoot` type definition in `getTargetContainer` and `getPopupContainer`. [#55278](https://github.com/ant-design/ant-design/pull/55278) [@leshalv](https://github.com/leshalv)
- 🤖 Improve Modal type definition. [#55371](https://github.com/ant-design/ant-design/pull/55371)
## 5.27.5
`2025-10-14`

View File

@@ -15,6 +15,86 @@ tag: vVERSION
---
## 5.29.3
`2025-12-18`
- 🐞 修复 Breadcrumb 自定义 `itemRender` 时链接颜色被覆盖的问题。[#56251](https://github.com/ant-design/ant-design/pull/56251) [@guoyunhe](https://github.com/guoyunhe)
## 5.29.2
`2025-12-15`
- 🐞 修复关闭 `cssVar` 时 notification 背景色异常的问题。[#56133](https://github.com/ant-design/ant-design/pull/56133) [@afc163](https://github.com/afc163)
- 🐞 提升 Breadcrumb 链接样式的优先级以避免被全局样式覆盖。[#56139](https://github.com/ant-design/ant-design/pull/56139) [@guoyunhe](https://github.com/guoyunhe)
- 🐞 修复 Input.Search 会报 `addonAfter` 已经废弃的警告信息的问题。[#55806](https://github.com/ant-design/ant-design/pull/55806) [@zombieJ](https://github.com/zombieJ)
- 🐞 修复 Splitter 在 Panel 总占比不为 1 时出现占不满的情况。 [#56217](https://github.com/ant-design/ant-design/pull/56217) [@zombieJ](https://github.com/zombieJ)
## 5.29.1
`2025-11-18`
- 🐞 修复 Carousel 选择器在垂直位置无法点击的问题。 [#55757](https://github.com/ant-design/ant-design/pull/55757) [@wanpan11](https://github.com/wanpan11)
## 5.29.0
`2025-11-17`
- 🆕 InputNumber 组件废弃 `addonAfter``addonBefore` 属性,使用 Space.Compact 替换。 [#55505](https://github.com/ant-design/ant-design/pull/55505) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- ⌨️ 优化 Drawer 组件的可访问性,存在标题时的属性 `aria-labelledby`。[#55697](https://github.com/ant-design/ant-design/pull/55697) [@rxy001](https://github.com/rxy001)
- 🌐 修复韩语本地化中“복사됨”文本的空格规则问题。[#55672](https://github.com/ant-design/ant-design/pull/55672) [@rapsealk](https://github.com/rapsealk)
## 5.28.1
`2025-11-11`
- Carousel
- 🐞 修复 Carousel 组件纵向样式问题。[#55615](https://github.com/ant-design/ant-design/pull/55615) [@wanpan11](https://github.com/wanpan11)
- 🐞 修复 Carousel 首次渲染时指示点动画丢失。[#55589](https://github.com/ant-design/ant-design/pull/55589) [@wanpan11](https://github.com/wanpan11)
- 🐞 修复 Descriptions 组件内容样式错误使用 `labelStyle` 的问题。[#55572](https://github.com/ant-design/ant-design/pull/55572) [@li-jia-nan](https://github.com/li-jia-nan)
- 💄 修正 `underlined` 变体的 Select 组件高度为 32px。[#55607](https://github.com/ant-design/ant-design/pull/55607) [@ustcfury](https://github.com/ustcfury)
- 💄 为 `underlined` 变体的 Input 组件补全 hover 边框颜色样式。[#55609](https://github.com/ant-design/ant-design/pull/55609) [@ustcfury](https://github.com/ustcfury)
- 🌐 补充 TimePicker 多语言翻译覆盖以下语言ar_EG、en_GB、gl_ES、bg_BG、ca_ES、cs_CZ、el_GR、es_ES、eu_ES、fi_FI、he_IL、hu_HU、is_IS、kn_IN、kmr_IQ、lv_LV、mk_MK、mn_MN、ms_MY、pl_PL、pt_BR、pt_PT、ro_RO、sk_SK、sl_SI、sv_SE、ta_IN、th_TH、zh_TW、et_EE。[#55656](https://github.com/ant-design/ant-design/pull/55656) [@li-jia-nan](https://github.com/li-jia-nan)
- TypeScript
- 🤖 优化 Flex 组件 `gap` 属性类型定义,支持更友好的 IDE 类型提示 [#55591](https://github.com/ant-design/ant-design/pull/55591) [@ayangweb](https://github.com/ayangweb)
## 5.28.0
`2025-11-01`
- 🆕 Drawer 支持 `closable.placement` 属性,用于指定关闭按钮的位置。[#54067](https://github.com/ant-design/ant-design/pull/54067) [@davidhsing](https://github.com/davidhsing)
- 🆕 Image 组件支持 `fallback` 全局配置。[#54702](https://github.com/ant-design/ant-design/pull/54702) [@Jiyur](https://github.com/Jiyur)
- 🆕 QRCode 组件支持 `boostLevel` 属性。[#55063](https://github.com/ant-design/ant-design/pull/55063) [@li-jia-nan](https://github.com/li-jia-nan)
- 🆕 Splitter 支持 `onCollapse` 属性。[#54673](https://github.com/ant-design/ant-design/pull/54673) [@ug-hero](https://github.com/ug-hero)
- 🆕 Statistic 设置为 `loading` 时默认展现动画效果。[#55398](https://github.com/ant-design/ant-design/pull/55398) [@afc163](https://github.com/afc163)
- 🆕 TreeSelect 支持切换器图标的全局配置。[#54821](https://github.com/ant-design/ant-design/pull/54821) [@Jiyur](https://github.com/Jiyur)
- Segmented
- 💄 Segmented 的主题变量 `itemSelectedBg` 支持背景渐变。[#55391](https://github.com/ant-design/ant-design/pull/55391) [@zancheng](https://github.com/zancheng)
- 🐞 修复 Segmented 切换动画总是从第一项移动闪烁的问题。[#55438](https://github.com/ant-design/ant-design/pull/55438) [@afc163](https://github.com/afc163)
- 🐞 修复 Tree 和 Transfer 组件的 `disabled` 继承问题。[#54831](https://github.com/ant-design/ant-design/pull/54831) [@cactuser-Lu](https://github.com/cactuser-Lu)
- 🐞 修复 Tree.DirectoryTree 定义 `fieldNames``defaultExpandAll` 不生效的问题。[#55420](https://github.com/ant-design/ant-design/pull/55420) [@Wxh16144](https://github.com/Wxh16144)
- Upload
- 🆕 Upload 组件 `customRequest` 参数中增加 `info.defaultRequest`。[#55146](https://github.com/ant-design/ant-design/pull/55146) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 💄 Upload 组件支持 `pictureCardSize` token。[#54756](https://github.com/ant-design/ant-design/pull/54756) [@wanpan11](https://github.com/wanpan11)
- 💄 Notification 支持配置背景颜色的 token。[#54802](https://github.com/ant-design/ant-design/pull/54802) [@thinkasany](https://github.com/thinkasany)
- 💄 Pagination 支持通过 `itemActiveColor``itemActiveColorHover` token 修改高亮项的文字颜色。[#55195](https://github.com/ant-design/ant-design/pull/55195) [@Renderz](https://github.com/Renderz)
- 🐞 修复 Select、DatePicker、TreeSelect、Cascader 等组件 `suffixIcon` 配置值为 undefined 时没有默认后缀图标的问题。[#54790](https://github.com/ant-design/ant-design/pull/54790) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 🐞 修复 Mentions 组件没有继承外部 Form 的 `disabled` 的问题。[#54829](https://github.com/ant-design/ant-design/pull/54829) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 🐞 修复 Watermark 组件内包裹 Modal 使用 `modalRender` 会导致崩溃的问题。[#55435](https://github.com/ant-design/ant-design/pull/55435) [@ug-hero](https://github.com/ug-hero)
- 🗑 Input 组件废弃 `addonAfter``addonBefore` 属性,使用 Space.Compact 替换。[#55315](https://github.com/ant-design/ant-design/pull/55315) [@EmilyyyLiu](https://github.com/EmilyyyLiu)
- 🤖 Row 组件 `gutter` 属性支持 string 类型定义。[#54628](https://github.com/ant-design/ant-design/pull/54628) [@ug-hero](https://github.com/ug-hero)
## 5.27.6
`2025-10-20`
- 🐞 修复 Table `pagination.align` 属性失效的问题。[#55316](https://github.com/ant-design/ant-design/pull/55316)
- 🛠 重构 Modal 中 ConfirmDialog 的 useMemo以解决 Object.values 生成新数组导致 useMemo 失效的问题。[#55376](https://github.com/ant-design/ant-design/pull/55376)
- TypeScript
- 🤖 补充 ConfigProvider `getTargetContainer``Window` 类型定义。[#55313](https://github.com/ant-design/ant-design/pull/55313)
- 🤖 补充 ConfigProvider 的 `getTargetContainer``getPopupContainer``ShadowRoot` 类型定义。[#55278](https://github.com/ant-design/ant-design/pull/55278) [@leshalv](https://github.com/leshalv)
- 🤖 优化 Modal 中类型定义。[#55371](https://github.com/ant-design/ant-design/pull/55371)
## 5.27.5
`2025-10-14`
@@ -36,7 +116,7 @@ tag: vVERSION
- 🐞 修复 Table 在使 `sticky` 表头或设置 `scroll.y` 时,筛选下拉与 Tooltip 重复显示的问题。[#54910](https://github.com/ant-design/ant-design/pull/54910) [@afc163](https://github.com/afc163)
- 🐞 修复 Table 表头在首次加载时未正确渲染的问题。[#54910](https://github.com/ant-design/ant-design/pull/54910) [@afc163](https://github.com/afc163)
- 🐞 修复 Table 在启用 `scroll.x` 时,固定列的对齐问题。[#54899](https://github.com/ant-design/ant-design/pull/54899) [@afc163](https://github.com/afc163)
- 🐞 修复 Button 仅图标icon-only按钮的内边距受主题影响的问题。 [#54970](https://github.com/ant-design/ant-design/pull/54970) [@guoyunhe](https://github.com/guoyunhe)
- 🐞 修复 Button 仅图标icon-only按钮的内边距受主题影响的问题。[#54970](https://github.com/ant-design/ant-design/pull/54970) [@guoyunhe](https://github.com/guoyunhe)
- 🐞 修复 Splitter 在非受控模式下初次挂载时,`minSize``maxSize` 未生效的问题。[#54939](https://github.com/ant-design/ant-design/pull/54939) [@zombieJ](https://github.com/zombieJ)
- 🐞 修复 Switch 波纹效果与 Tailwind CSS disabled 变体的兼容性问题。[#54933](https://github.com/ant-design/ant-design/pull/54933) [@Jiyur](https://github.com/Jiyur)
- 🐞 修复 Input.Search 在搜索按钮为 `disabled` 时,悬停仍会导致边框和图标变色的问题。[#54892](https://github.com/ant-design/ant-design/pull/54892) [@Jiyur](https://github.com/Jiyur)

View File

@@ -26,13 +26,13 @@
[download-url]: https://npmjs.org/package/antd
[fossa-image]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fant-design%2Fant-design.svg?type=shield
[fossa-url]: https://app.fossa.io/projects/git%2Bgithub.com%2Fant-design%2Fant-design?ref=badge_shield
[help-wanted-image]: https://flat.badgen.net/github/label-issues/ant-design/ant-design/help%20wanted/open
[help-wanted-image]: https://img.shields.io/github/issues/ant-design/ant-design/help%20wanted?color=green&style=flat-square
[help-wanted-url]: https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22
[twitter-image]: https://img.shields.io/twitter/follow/AntDesignUI.svg?label=Ant%20Design
[twitter-url]: https://twitter.com/AntDesignUI
[jsdelivr-image]: https://data.jsdelivr.com/v1/package/npm/antd/badge
[jsdelivr-url]: https://www.jsdelivr.com/package/npm/antd
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/antd?style=flat-square
[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/antd
[bundlephobia-url]: https://bundlephobia.com/package/antd
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
[dumi-url]: https://github.com/umijs/dumi

View File

@@ -26,13 +26,13 @@ An enterprise-class UI design language and React UI library.
[download-url]: https://npmjs.org/package/antd
[fossa-image]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fant-design%2Fant-design.svg?type=shield
[fossa-url]: https://app.fossa.io/projects/git%2Bgithub.com%2Fant-design%2Fant-design?ref=badge_shield
[help-wanted-image]: https://flat.badgen.net/github/label-issues/ant-design/ant-design/help%20wanted/open
[help-wanted-image]: https://img.shields.io/github/issues/ant-design/ant-design/help%20wanted?color=green&style=flat-square
[help-wanted-url]: https://github.com/ant-design/ant-design/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22
[twitter-image]: https://img.shields.io/twitter/follow/AntDesignUI.svg?label=Ant%20Design
[twitter-url]: https://twitter.com/AntDesignUI
[jsdelivr-image]: https://data.jsdelivr.com/v1/package/npm/antd/badge
[jsdelivr-url]: https://www.jsdelivr.com/package/npm/antd
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/antd?style=flat-square
[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/antd?style=flat-square
[bundlephobia-url]: https://bundlephobia.com/package/antd
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
[dumi-url]: https://github.com/umijs/dumi

View File

@@ -15,7 +15,8 @@
"!scripts/previewEditor/**/*",
"!**/*.tmp",
"!package.json",
"!components/style/antd.css"
"!components/style/antd.css",
"!scripts/visual-regression/report-template.html"
]
},
"formatter": {
@@ -57,6 +58,7 @@
"noExplicitAny": "off",
"noArrayIndexKey": "off",
"noConfusingVoidType": "off",
"noNonNullAssertedOptionalChain": "off",
"noThenProperty": "off",
"noTemplateCurlyInString": "off",
"useIterableCallbackReturn": "off",

View File

@@ -67,7 +67,7 @@ const genPurePanel = <ComponentProps extends BaseProps = BaseProps>(
resizeObserver.disconnect();
};
}
}, []);
}, [prefixCls]);
let mergedProps: WrapProps = {
...props,

View File

@@ -2,8 +2,8 @@ import React, { useEffect } from 'react';
import { CloseOutlined } from '@ant-design/icons';
import { render } from '@testing-library/react';
import { useClosable } from '../hooks';
import type { UseClosableParams } from '../hooks/useClosable';
import useClosable from '../hooks/useClosable';
type ParamsOfUseClosable = [
closable: UseClosableParams['closable'],

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { fireEvent, render } from '../../../tests/utils';
import useSyncState from '../hooks/useSyncState';
import { useSyncState } from '../hooks';
describe('Table', () => {
it('useSyncState', () => {

View File

@@ -1,56 +0,0 @@
import React from 'react';
import { act, render } from '../../../tests/utils';
import useUniqueMemo from '../hooks/useUniqueMemo';
describe('Table', () => {
beforeEach(() => {
jest.useFakeTimers();
});
afterEach(() => {
jest.clearAllTimers();
jest.useRealTimers();
});
it('useSyncState', () => {
const sharedObjDeps1 = {};
const sharedObjDeps2 = {};
let calledTimes = 0;
const Test: React.FC<{ depName?: string }> = ({ depName }) => {
useUniqueMemo(() => {
calledTimes += 1;
return depName;
}, [depName, sharedObjDeps1, 'bamboo', sharedObjDeps2]);
return null;
};
// Reuse the same memo
const { rerender } = render(
<>
<Test depName="light" />
<Test depName="light" />
<Test depName="light" />
</>,
);
expect(calledTimes).toBe(1);
// Different deps should clean up the cache
act(() => {
jest.advanceTimersByTime(1000 * 60 * 20);
});
for (let i = 0; i < 20000; i += 1) {
rerender(<Test depName="diff" key={i} />);
}
rerender(<Test depName="clear" />);
calledTimes = 0;
// Back should recompute
rerender(<Test depName="light" />);
expect(calledTimes).toBe(1);
});
});

View File

@@ -300,7 +300,7 @@ describe('Test useZIndex hooks', () => {
if (['SelectLike', 'DatePicker', 'ImagePreview'].includes(key)) {
let comps = document.querySelectorAll<HTMLElement>(selector1);
comps.forEach((comp) => {
expect(comp?.style.zIndex).toBeFalsy();
expect(comp).toHaveStyle({ zIndex: '' });
});
comps = document.querySelectorAll<HTMLElement>(selector2);
comps.forEach((comp) => {
@@ -311,9 +311,9 @@ describe('Test useZIndex hooks', () => {
const operOffset = comp.classList.contains('ant-image-preview-operations-wrapper')
? 1
: 0;
expect(comp?.style.zIndex).toBe(
String(1000 + containerZIndexValue + consumerOffset + operOffset),
);
expect(comp).toHaveStyle({
zIndex: 1000 + containerZIndexValue + consumerOffset + operOffset,
});
});
comps = document.querySelectorAll<HTMLElement>(selector3);
@@ -325,21 +325,21 @@ describe('Test useZIndex hooks', () => {
const operOffset = comp.classList.contains('ant-image-preview-operations-wrapper')
? 1
: 0;
expect(comp?.style.zIndex).toBe(
String(1000 + containerZIndexValue * 2 + consumerOffset + operOffset),
);
expect(comp).toHaveStyle({
zIndex: 1000 + containerZIndexValue * 2 + consumerOffset + operOffset,
});
});
} else {
const element1 = document.querySelector<HTMLElement>(selector1);
const element2 = document.querySelector<HTMLElement>(selector2);
const element3 = document.querySelector<HTMLElement>(selector3);
expect(element1?.style.zIndex).toBe(key === 'Tour' ? '1001' : '');
expect(element2?.style.zIndex).toBe(
String(1000 + containerZIndexValue + consumerZIndexValue),
);
expect(element3?.style.zIndex).toBe(
String(1000 + containerZIndexValue * 2 + consumerZIndexValue),
);
expect(element1).toHaveStyle({ zIndex: key === 'Tour' ? 1001 : '' });
expect(element2).toHaveStyle({
zIndex: 1000 + containerZIndexValue + consumerZIndexValue,
});
expect(element3).toHaveStyle({
zIndex: 1000 + containerZIndexValue * 2 + consumerZIndexValue,
});
}
unmount();
}, 20000);
@@ -399,16 +399,14 @@ describe('Test useZIndex hooks', () => {
<FloatButton />
</WrapWithProvider>,
);
expect(container.querySelector<HTMLElement>('.ant-float-btn')?.style.zIndex).toBe(
// parentZIndex + containerBaseZIndexOffset["FloatButton"]
String(1100 + containerBaseZIndexOffset.FloatButton),
);
const ele = container.querySelector<HTMLElement>('.ant-float-btn');
expect(ele).toHaveStyle({ zIndex: 1100 + containerBaseZIndexOffset.FloatButton });
rerender(
<WrapWithProvider container="FloatButton">
<FloatButton style={{ zIndex: 666 }} />
</WrapWithProvider>,
);
expect(container.querySelector<HTMLElement>('.ant-float-btn')?.style.zIndex).toBe(String(666));
expect(ele).toHaveStyle({ zIndex: 666 });
});
it('not warning for static func', () => {

View File

@@ -0,0 +1,8 @@
export * from './useClosable';
export * from './useForceUpdate';
export * from './useMergeSemantic';
export * from './useMultipleSelect';
export * from './usePatchElement';
export * from './useProxyImperativeHandle';
export * from './useSyncState';
export * from './useZIndex';

View File

@@ -56,10 +56,7 @@ function useClosableConfig(closableCollection?: ClosableCollection | null) {
closeIcon: typeof closeIcon !== 'boolean' && closeIcon !== null ? closeIcon : undefined,
};
if (closable && typeof closable === 'object') {
closableConfig = {
...closableConfig,
...closable,
};
closableConfig = { ...closableConfig, ...closable };
}
return closableConfig;
}, [closable, closeIcon]);
@@ -82,7 +79,7 @@ interface FallbackCloseCollection extends ClosableCollection {
/** Use same object to support `useMemo` optimization */
const EmptyFallbackCloseCollection: FallbackCloseCollection = {};
export default function useClosable(
export const useClosable = (
propCloseCollection?: ClosableCollection,
contextCloseCollection?: ClosableCollection | null,
fallbackCloseCollection: FallbackCloseCollection = EmptyFallbackCloseCollection,
@@ -91,7 +88,7 @@ export default function useClosable(
closeIcon: React.ReactNode,
closeBtnIsDisabled: boolean,
ariaOrDataProps?: HTMLAriaDataAttributes,
] {
] => {
// Align the `props`, `context` `fallback` to config object first
const propCloseConfig = useClosableConfig(propCloseCollection);
const contextCloseConfig = useClosableConfig(contextCloseCollection);
@@ -172,4 +169,4 @@ export default function useClosable(
mergedClosableConfig,
mergedFallbackCloseCollection,
]);
}
};

View File

@@ -1,6 +1,5 @@
import * as React from 'react';
import React from 'react';
export default function useForceUpdate() {
const [, forceUpdate] = React.useReducer((x) => x + 1, 0);
return forceUpdate;
}
export const useForceUpdate = () => {
return React.useReducer((ori) => ori + 1, 0);
};

View File

@@ -1,13 +1,11 @@
import * as React from 'react';
import classnames from 'classnames';
import type { ValidChar } from './interface';
import type { ValidChar } from '../type';
type TemplateSemanticClassNames<T extends string> = Partial<Record<T, string>>;
export type SemanticSchema = {
_default?: string;
} & {
export type SemanticSchema = { _default?: string } & {
[key: `${ValidChar}${string}`]: SemanticSchema;
};
@@ -15,7 +13,7 @@ export type SemanticSchema = {
export function mergeClassNames<
T extends string,
SemanticClassNames extends Partial<Record<T, any>> = TemplateSemanticClassNames<T>,
>(schema: SemanticSchema | undefined, ...classNames: (SemanticClassNames | undefined)[]) {
>(schema?: SemanticSchema, ...classNames: (SemanticClassNames | undefined)[]) {
const mergedSchema = schema || {};
return classNames.reduce((acc: any, cur) => {
@@ -31,8 +29,10 @@ export function mergeClassNames<
} else {
// Covert string to object structure
const { _default: defaultField } = keySchema;
acc[key] = acc[key] || {};
acc[key][defaultField!] = classnames(acc[key][defaultField!], curVal);
if (defaultField) {
acc[key] = acc[key] || {};
acc[key][defaultField] = classnames(acc[key][defaultField], curVal);
}
}
} else {
// Flatten fill
@@ -40,16 +40,16 @@ export function mergeClassNames<
}
});
return acc;
}, {} as SemanticClassNames) as SemanticClassNames;
}, {} as SemanticClassNames);
}
function useSemanticClassNames<ClassNamesType extends object>(
schema: SemanticSchema | undefined,
schema?: SemanticSchema,
...classNames: (Partial<ClassNamesType> | undefined)[]
): Partial<ClassNamesType> {
return React.useMemo(
() => mergeClassNames(schema, ...classNames),
[classNames],
[classNames, schema],
) as ClassNamesType;
}
@@ -58,31 +58,25 @@ function useSemanticStyles<StylesType extends object>(
...styles: (Partial<StylesType> | undefined)[]
) {
return React.useMemo(() => {
return styles.reduce(
(acc, cur = {}) => {
Object.keys(cur).forEach((key) => {
acc[key] = { ...acc[key], ...(cur as Record<string, React.CSSProperties>)[key] };
});
return acc;
},
{} as Record<string, React.CSSProperties>,
);
return styles.reduce<Record<string, React.CSSProperties>>((acc, cur = {}) => {
Object.keys(cur).forEach((key) => {
acc[key] = { ...acc[key], ...(cur as Record<string, React.CSSProperties>)[key] };
});
return acc;
}, {});
}, [styles]) as StylesType;
}
// =========================== Export ===========================
function fillObjectBySchema<T extends object>(obj: T, schema: SemanticSchema): T {
const newObj: any = { ...obj };
Object.keys(schema).forEach((key) => {
if (key !== '_default') {
const nestSchema = (schema as any)[key] as SemanticSchema;
const nextValue = newObj[key] || {};
newObj[key] = nestSchema ? fillObjectBySchema(nextValue, nestSchema) : nextValue;
}
});
return newObj;
}
@@ -90,18 +84,17 @@ function fillObjectBySchema<T extends object>(obj: T, schema: SemanticSchema): T
* Merge classNames and styles from multiple sources.
* When `schema` is provided, it will **must** provide the nest object structure.
*/
export default function useMergeSemantic<ClassNamesType extends object, StylesType extends object>(
export const useMergeSemantic = <ClassNamesType extends object, StylesType extends object>(
classNamesList: (ClassNamesType | undefined)[],
stylesList: (StylesType | undefined)[],
schema?: SemanticSchema,
) {
) => {
const mergedClassNames = useSemanticClassNames(schema, ...classNamesList) as ClassNamesType;
const mergedStyles = useSemanticStyles(...stylesList) as StylesType;
return React.useMemo(() => {
return [
fillObjectBySchema(mergedClassNames, schema!) as ClassNamesType,
fillObjectBySchema(mergedStyles, schema!) as StylesType,
] as const;
}, [mergedClassNames, mergedStyles]);
}
}, [mergedClassNames, mergedStyles, schema]);
};

View File

@@ -1,27 +0,0 @@
export type ValidChar =
| 'a'
| 'b'
| 'c'
| 'd'
| 'e'
| 'f'
| 'g'
| 'h'
| 'i'
| 'j'
| 'k'
| 'l'
| 'm'
| 'n'
| 'o'
| 'p'
| 'q'
| 'r'
| 's'
| 't'
| 'u'
| 'v'
| 'w'
| 'x'
| 'y'
| 'z';

View File

@@ -6,7 +6,7 @@ export type PrevSelectedIndex = null | number;
* @title multipleSelect hooks
* @description multipleSelect by hold down shift key
*/
export default function useMultipleSelect<T, K>(getKey: (item: T) => K) {
export const useMultipleSelect = <T, K>(getKey: (item: T, index: number, array: T[]) => K) => {
const [prevSelectedIndex, setPrevSelectedIndex] = useState<PrevSelectedIndex>(null);
const multipleSelect = useCallback(
@@ -16,7 +16,7 @@ export default function useMultipleSelect<T, K>(getKey: (item: T) => K) {
// add/delete the selected range
const startIndex = Math.min(configPrevSelectedIndex || 0, currentSelectedIndex);
const endIndex = Math.max(configPrevSelectedIndex || 0, currentSelectedIndex);
const rangeKeys = data.slice(startIndex, endIndex + 1).map((item) => getKey(item));
const rangeKeys = data.slice(startIndex, endIndex + 1).map<K>(getKey);
const shouldSelected = rangeKeys.some((rangeKey) => !selectedKeys.has(rangeKey));
const changedKeys: K[] = [];
@@ -39,9 +39,5 @@ export default function useMultipleSelect<T, K>(getKey: (item: T) => K) {
[prevSelectedIndex],
);
const updatePrevSelectedIndex = (val: PrevSelectedIndex) => {
setPrevSelectedIndex(val);
};
return [multipleSelect, updatePrevSelectedIndex] as const;
}
return [multipleSelect, setPrevSelectedIndex] as const;
};

View File

@@ -1,9 +1,9 @@
import * as React from 'react';
export default function usePatchElement(): [
export const usePatchElement = (): [
React.ReactElement[],
(element: React.ReactElement) => () => void,
] {
] => {
const [elements, setElements] = React.useState<React.ReactElement[]>([]);
const patchElement = React.useCallback((element: React.ReactElement) => {
@@ -18,4 +18,4 @@ export default function usePatchElement(): [
}, []);
return [elements, patchElement];
}
};

View File

@@ -22,10 +22,13 @@ function fillProxy(
return element;
}
export default function useProxyImperativeHandle<
export const useProxyImperativeHandle = <
NativeELementType extends HTMLElement,
ReturnRefType extends { nativeElement: NativeELementType },
>(ref: Ref<any> | undefined, init: () => ReturnRefType) {
>(
ref: Ref<any> | undefined,
init: () => ReturnRefType,
) => {
return useImperativeHandle(ref, () => {
const refObj = init();
const { nativeElement } = refObj;
@@ -45,4 +48,4 @@ export default function useProxyImperativeHandle<
// Fallback of IE
return fillProxy(nativeElement, refObj);
});
}
};

View File

@@ -1,13 +1,12 @@
import * as React from 'react';
import useForceUpdate from './useForceUpdate';
import { useForceUpdate } from './useForceUpdate';
type UseSyncStateProps<T> = readonly [() => T, (newValue: T) => void];
export default function useSyncState<T>(initialValue: T): UseSyncStateProps<T> {
export const useSyncState = <T>(initialValue: T): UseSyncStateProps<T> => {
const ref = React.useRef<T>(initialValue);
const forceUpdate = useForceUpdate();
const [, forceUpdate] = useForceUpdate();
return [
() => ref.current,
(newValue: T) => {
@@ -16,4 +15,4 @@ export default function useSyncState<T>(initialValue: T): UseSyncStateProps<T> {
forceUpdate();
},
] as const;
}
};

View File

@@ -1,97 +0,0 @@
import React from 'react';
const BEAT_LIMIT = 1000 * 60 * 10;
/**
* A helper class to map keys to values.
* It supports both primitive keys and object keys.
*/
class ArrayKeyMap<T> {
map = new Map<string, T>();
// Use WeakMap to avoid memory leak
objectIDMap = new WeakMap<object, number>();
nextID = 0;
lastAccessBeat = new Map<string, number>();
// We will clean up the cache when reach the limit
accessBeat = 0;
set(keys: React.DependencyList, value: any) {
// New set will trigger clear
this.clear();
// Set logic
const compositeKey = this.getCompositeKey(keys);
this.map.set(compositeKey, value);
this.lastAccessBeat.set(compositeKey, Date.now());
}
get(keys: React.DependencyList) {
const compositeKey = this.getCompositeKey(keys);
const cache = this.map.get(compositeKey);
this.lastAccessBeat.set(compositeKey, Date.now());
this.accessBeat += 1;
return cache;
}
getCompositeKey(keys: React.DependencyList) {
const ids = keys.map<string>((key) => {
if (key && typeof key === 'object') {
return `obj_${this.getObjectID(key)}`;
}
return `${typeof key}_${key}`;
});
return ids.join('|');
}
getObjectID(obj: object) {
if (this.objectIDMap.has(obj)) {
return this.objectIDMap.get(obj);
}
const id = this.nextID;
this.objectIDMap.set(obj, id);
this.nextID += 1;
return id;
}
clear() {
if (this.accessBeat > 10000) {
const now = Date.now();
this.lastAccessBeat.forEach((beat, key) => {
if (now - beat > BEAT_LIMIT) {
this.map.delete(key);
this.lastAccessBeat.delete(key);
}
});
this.accessBeat = 0;
}
}
}
const uniqueMap = new ArrayKeyMap();
/**
* Like `useMemo`, but this hook result will be shared across all instances.
*/
function useUniqueMemo<T>(memoFn: () => T, deps: React.DependencyList) {
return React.useMemo<T>(() => {
const cachedValue = uniqueMap.get(deps);
if (cachedValue) {
return cachedValue as T;
}
const newValue = memoFn();
uniqueMap.set(deps, newValue);
return newValue;
}, deps);
}
export default useUniqueMemo;

View File

@@ -140,7 +140,7 @@ const useResponsiveObserver = () => {
subscribers.clear();
},
};
}, [token]);
}, [responsiveMap]);
};
export default useResponsiveObserver;

View File

@@ -1,10 +1,14 @@
import type React from 'react';
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
/** https://github.com/Microsoft/TypeScript/issues/29729 */
export type LiteralUnion<T extends string> = T | (string & {});
export type LiteralUnion<T, U extends Primitive = string> = T | (U & Record<never, never>);
export type AnyObject = Record<PropertyKey, any>;
export type EmptyObject = Record<never, never>;
export type CustomComponent<P = AnyObject> = React.ComponentType<P> | string;
/**
@@ -78,3 +82,31 @@ export type GetContextProp<
T extends React.Context<any>,
PropName extends keyof GetContextProps<T>,
> = NonNullable<GetContextProps<T>[PropName]>;
export type ValidChar =
| 'a'
| 'b'
| 'c'
| 'd'
| 'e'
| 'f'
| 'g'
| 'h'
| 'i'
| 'j'
| 'k'
| 'l'
| 'm'
| 'n'
| 'o'
| 'p'
| 'q'
| 'r'
| 's'
| 't'
| 'u'
| 'v'
| 'w'
| 'x'
| 'y'
| 'z';

View File

@@ -55,7 +55,10 @@ export interface AffixRef {
updatePosition: ReturnType<typeof throttleByAnimationFrame>;
}
type InternalAffixProps = AffixProps & { onTestUpdatePosition?: any };
interface InternalAffixProps extends AffixProps {
onTestUpdatePosition?: () => void;
}
const Affix = React.forwardRef<AffixRef, InternalAffixProps>((props, ref) => {
const {
style,

View File

@@ -10,7 +10,7 @@ import CSSMotion from 'rc-motion';
import pickAttrs from 'rc-util/lib/pickAttrs';
import { composeRef } from 'rc-util/lib/ref';
import type { ClosableType } from '../_util/hooks/useClosable';
import type { ClosableType } from '../_util/hooks';
import { replaceElement } from '../_util/reactNode';
import { devUseWarning } from '../_util/warning';
import { useComponentConfig } from '../config-provider/context';
@@ -176,7 +176,9 @@ const Alert = React.forwardRef<AlertRef, AlertProps>((props, ref) => {
// closeable when closeText or closeIcon is assigned
const isClosable = React.useMemo<boolean>(() => {
if (typeof closable === 'object' && closable.closeIcon) return true;
if (typeof closable === 'object' && closable.closeIcon) {
return true;
}
if (closeText) {
return true;
}
@@ -226,7 +228,7 @@ const Alert = React.forwardRef<AlertRef, AlertProps>((props, ref) => {
return contextClosable.closeIcon;
}
return contextCloseIcon;
}, [closeIcon, closable, closeText, contextCloseIcon]);
}, [closeIcon, closable, contextClosable, closeText, contextCloseIcon]);
const mergedAriaProps = React.useMemo<React.AriaAttributes>(() => {
const merged = closable ?? contextClosable;

View File

@@ -1,7 +1,7 @@
## zh-CN
友好的 [React 错误处理](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) 包裹组件。
友好的 [React 错误处理](https://zh-hans.react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary) 包裹组件。
## en-US
ErrorBoundary Component for making error handling easier in [React](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html).
ErrorBoundary Component for making error handling easier in [React](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary).

View File

@@ -246,7 +246,7 @@ const Anchor: React.FC<AnchorProps> = (props) => {
);
setCurrentActiveLink(currentActiveLink);
}, [dependencyListItem, targetOffset, offsetTop]);
}, [links, targetOffset, offsetTop, bounds]);
const handleScrollTo = React.useCallback<(link: string) => void>(
(link) => {

View File

@@ -185,7 +185,7 @@ describe('Anchor Render', () => {
const link = container.querySelector(`a[href="http://www.example.com/#${hash}"]`)!;
fireEvent.click(link);
await waitFakeTimer();
expect(link.classList).toContain('ant-anchor-link-title-active');
expect(link).toHaveClass('ant-anchor-link-title-active');
});
it('scrolls the page when clicking a link', async () => {
@@ -737,11 +737,9 @@ describe('Anchor Render', () => {
/>,
);
expect(container.querySelectorAll('.ant-anchor-ink').length).toBe(1);
expect(
container
.querySelector('.ant-anchor-wrapper')
?.classList.contains('ant-anchor-wrapper-horizontal'),
).toBeTruthy();
expect(container.querySelector('.ant-anchor-wrapper')).toHaveClass(
'ant-anchor-wrapper-horizontal',
);
});
it('nested children via items should be filtered out when direction is horizontal', () => {
@@ -818,7 +816,7 @@ describe('Anchor Render', () => {
const link = container.querySelector(`a[href="http://www.example.com/#${hash}"]`)!;
fireEvent.click(link);
await waitFakeTimer();
expect(link.classList).toContain('ant-anchor-link-title-active');
expect(link).toHaveClass('ant-anchor-link-title-active');
});
it('scrolls the page when clicking a link', async () => {
@@ -1026,25 +1024,29 @@ describe('Anchor Render', () => {
</div>
);
};
const wrapper = await render(<Foo />);
(await wrapper.findByText('part-1')).click();
const { container, findByText } = await render(<Foo />);
(await findByText('part-1')).click();
await waitFakeTimer();
const ink = wrapper.container.querySelector<HTMLSpanElement>('.ant-anchor-ink')!;
const toggleButton = wrapper.container.querySelector('button')!;
const inkElement = container.querySelector<HTMLSpanElement>('.ant-anchor-ink');
const toggleButton = container.querySelector<HTMLElement>('button');
fireEvent.click(toggleButton);
act(() => jest.runAllTimers());
expect(!!ink.style.left).toBe(true);
expect(!!ink.style.width).toBe(true);
expect(ink.style.top).toBe('');
expect(ink.style.height).toBe('');
expect(toggleButton).toBeInTheDocument();
fireEvent.click(toggleButton);
fireEvent.click(toggleButton!);
act(() => jest.runAllTimers());
expect(!!ink.style.top).toBe(true);
expect(!!ink.style.height).toBe(true);
expect(ink.style.left).toBe('');
expect(ink.style.width).toBe('');
expect(inkElement).toHaveStyle({
left: '0px',
width: '0px',
});
fireEvent.click(toggleButton!);
act(() => jest.runAllTimers());
expect(inkElement).toHaveStyle({
top: '0px',
height: '0px',
});
});
});
});

View File

@@ -4,7 +4,7 @@ import type { BaseSelectRef } from 'rc-select';
import toArray from 'rc-util/lib/Children/toArray';
import omit from 'rc-util/lib/omit';
import { useZIndex } from '../_util/hooks/useZIndex';
import { useZIndex } from '../_util/hooks';
import type { InputStatus } from '../_util/statusUtils';
import { devUseWarning } from '../_util/warning';
import type { ConfigConsumerProps } from '../config-provider';
@@ -24,6 +24,7 @@ export interface DataSourceItemObject {
value: string;
text: string;
}
export type DataSourceItemType = DataSourceItemObject | React.ReactNode;
export interface AutoCompleteProps<

View File

@@ -46,8 +46,7 @@ Common props ref[Common props](/docs/react/common-props)
| allowClear | Show clear button | boolean \| { clearIcon?: ReactNode } | false | 5.8.0: Support Object type |
| autoFocus | If get focus when component mounted | boolean | false | |
| backfill | If backfill selected item the input when using keyboard | boolean | false | |
| children (for customize input element) | Customize input element | HTMLInputElement \| HTMLTextAreaElement \| React.ReactElement&lt;InputProps> | &lt;Input /> | |
| children (for dataSource) | Data source to auto complete | React.ReactElement&lt;OptionProps> \| Array&lt;React.ReactElement&lt;OptionProps>> | - | |
| children | Customize input element | HTMLInputElement \| HTMLTextAreaElement \| React.ReactElement&lt;InputProps> | &lt;Input /> | |
| classNames | Semantic DOM class | [Record<SemanticDOM, string>](#semantic-dom) | - | 5.25.0 |
| defaultActiveFirstOption | Whether active first option by default | boolean | true | |
| defaultOpen | Initial open state of dropdown | boolean | - | |

View File

@@ -47,8 +47,7 @@ demo:
| allowClear | 支持清除 | boolean \| { clearIcon?: ReactNode } | false | 5.8.0: 支持对象形式 |
| autoFocus | 自动获取焦点 | boolean | false | |
| backfill | 使用键盘选择选项的时候把选中项回填到输入框中 | boolean | false | |
| children (自动完成的数据源) | 自动完成的数据源,不能和自定义输入框同时配置 | React.ReactElement&lt;OptionProps> \| Array&lt;React.ReactElement&lt;OptionProps>> | - | |
| children (自定义输入框) | 自定义输入框,不能和自动完成的数据源同时配置 | HTMLInputElement \| HTMLTextAreaElement \| React.ReactElement&lt;InputProps> | &lt;Input /> | |
| children | 自定义输入框 | HTMLInputElement \| HTMLTextAreaElement \| React.ReactElement&lt;InputProps> | &lt;Input /> | |
| classNames | 语义化结构 class | [Record<SemanticDOM, string>](#semantic-dom) | - | 5.25.0 |
| defaultActiveFirstOption | 是否默认高亮第一个选项 | boolean | true | |
| defaultOpen | 是否默认展开下拉菜单 | boolean | - | |

View File

@@ -129,7 +129,7 @@ const Avatar = React.forwardRef<HTMLSpanElement, AvatarProps>((props, ref) => {
fontSize: currentSize && (icon || children) ? currentSize / 2 : 18,
}
: {};
}, [screens, size]);
}, [screens, size, icon, children]);
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Avatar');
@@ -205,11 +205,7 @@ const Avatar = React.forwardRef<HTMLSpanElement, AvatarProps>((props, ref) => {
childrenToRender = (
<ResizeObserver onResize={setScaleParam}>
<span
className={`${prefixCls}-string`}
ref={avatarChildrenRef}
style={{ ...childrenStyle }}
>
<span className={`${prefixCls}-string`} ref={avatarChildrenRef} style={childrenStyle}>
{children}
</span>
</ResizeObserver>

View File

@@ -146,11 +146,11 @@ describe('Badge', () => {
// https://github.com/ant-design/ant-design/issues/15349
it('should color style works on Badge', () => {
const { container } = render(
<Badge style={{ color: 'red' }} status="success" text="Success" />,
);
expect((container.querySelector('.ant-badge-status-text')! as HTMLElement).style.color).toEqual(
'red',
<Badge style={{ color: 'rgb(255, 0, 0)' }} status="success" text="Success" />,
);
expect(container.querySelector<HTMLElement>('.ant-badge-status-text')).toHaveStyle({
color: 'rgb(255, 0, 0)',
});
});
// https://github.com/ant-design/ant-design/issues/15799
@@ -247,14 +247,8 @@ describe('Badge', () => {
const { container } = render(
<Badge
count={10}
classNames={{
root: 'test-root',
indicator: 'test-indicator',
}}
styles={{
root: { backgroundColor: 'yellow' },
indicator: { backgroundColor: 'blue' },
}}
classNames={{ root: 'test-root', indicator: 'test-indicator' }}
styles={{ root: { padding: 10 }, indicator: { padding: 20 } }}
>
test
</Badge>,
@@ -267,9 +261,7 @@ describe('Badge', () => {
expect(element?.querySelector<HTMLElement>('sup')).toHaveClass('test-indicator');
// styles
expect(element).toHaveStyle({ backgroundColor: 'rgb(255, 255, 0)' });
expect(element?.querySelector<HTMLElement>('sup')).toHaveStyle({
backgroundColor: 'rgb(0, 0, 255)',
});
expect(element).toHaveStyle({ padding: '10px' });
expect(element?.querySelector<HTMLElement>('sup')).toHaveStyle({ padding: '20px' });
});
});

View File

@@ -37,28 +37,28 @@ describe('Ribbon', () => {
expect(container.querySelectorAll('.ant-ribbon-color-green').length).toEqual(1);
});
it('works with custom color', () => {
const { container: wrapperLeft } = render(
<Badge.Ribbon color="#888" placement="start">
const { container, rerender } = render(
<Badge.Ribbon color="rgb(136, 136, 136)" placement="start">
<div />
</Badge.Ribbon>,
);
expect((wrapperLeft.querySelector('.ant-ribbon')! as HTMLElement).style.background).toEqual(
'rgb(136, 136, 136)',
);
expect((wrapperLeft.querySelector('.ant-ribbon-corner')! as HTMLElement).style.color).toEqual(
'rgb(136, 136, 136)',
);
const { container: wrapperRight } = render(
<Badge.Ribbon color="#888" placement="end">
expect(container.querySelector<HTMLElement>('.ant-ribbon')).toHaveStyle({
backgroundColor: 'rgb(136, 136, 136)',
});
expect(container.querySelector<HTMLElement>('.ant-ribbon-corner')).toHaveStyle({
color: 'rgb(136, 136, 136)',
});
rerender(
<Badge.Ribbon color="rgb(136, 136, 136)" placement="end">
<div />
</Badge.Ribbon>,
);
expect((wrapperRight.querySelector('.ant-ribbon')! as HTMLElement).style.background).toEqual(
'rgb(136, 136, 136)',
);
expect(
(wrapperRight.querySelector('.ant-ribbon-corner')! as HTMLElement).style.color,
).toEqual('rgb(136, 136, 136)');
expect(container.querySelector<HTMLElement>('.ant-ribbon')).toHaveStyle({
backgroundColor: 'rgb(136, 136, 136)',
});
expect(container.querySelector<HTMLElement>('.ant-ribbon-corner')).toHaveStyle({
color: 'rgb(136, 136, 136)',
});
});
});

View File

@@ -94,7 +94,7 @@ export const InternalBreadcrumbItem: React.FC<BreadcrumbItemProps> = (props) =>
if (link !== undefined && link !== null) {
return (
<>
<li>{link}</li>
<li className={`${prefixCls}-item`}>{link}</li>
{separator && <BreadcrumbSeparator>{separator}</BreadcrumbSeparator>}
</>
);

View File

@@ -5,7 +5,9 @@ exports[`Breadcrumb filter React.Fragment 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -18,7 +20,9 @@ exports[`Breadcrumb filter React.Fragment 1`] = `
>
:
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -57,7 +61,9 @@ exports[`Breadcrumb should allow Breadcrumb.Item is null or undefined 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -73,7 +79,9 @@ exports[`Breadcrumb should not display Breadcrumb Item when its children is fals
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -86,7 +94,9 @@ exports[`Breadcrumb should not display Breadcrumb Item when its children is fals
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -102,7 +112,9 @@ exports[`Breadcrumb should render a menu 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#/index"
@@ -116,7 +128,9 @@ exports[`Breadcrumb should render a menu 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-dropdown-trigger ant-breadcrumb-overlay-link"
>
@@ -153,7 +167,9 @@ exports[`Breadcrumb should render a menu 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#/index/first/second"
@@ -167,7 +183,9 @@ exports[`Breadcrumb should render a menu 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#/index/first/second/third"
@@ -182,7 +200,9 @@ exports[`Breadcrumb should render correct 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#/"
@@ -198,7 +218,9 @@ exports[`Breadcrumb should render correct 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -214,7 +236,9 @@ exports[`Breadcrumb should support Breadcrumb.Item default separator 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -228,7 +252,9 @@ exports[`Breadcrumb should support Breadcrumb.Item default separator 1`] = `
/
</li>
<span>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -242,7 +268,9 @@ exports[`Breadcrumb should support Breadcrumb.Item default separator 1`] = `
/
</li>
</span>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -258,7 +286,9 @@ exports[`Breadcrumb should support React.Fragment and falsy children 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -271,7 +301,9 @@ exports[`Breadcrumb should support React.Fragment and falsy children 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -284,7 +316,9 @@ exports[`Breadcrumb should support React.Fragment and falsy children 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -308,7 +342,9 @@ exports[`Breadcrumb should support custom attribute 1`] = `
data-custom="custom"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
data-custom="custom-item"
@@ -322,7 +358,9 @@ exports[`Breadcrumb should support custom attribute 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -338,7 +376,9 @@ exports[`Breadcrumb should support string \`0\` and number \`0\` 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -351,7 +391,9 @@ exports[`Breadcrumb should support string \`0\` and number \`0\` 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>

View File

@@ -5,7 +5,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx extend context correctly 1
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -18,7 +20,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx extend context correctly 1
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -35,7 +39,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx extend context correctly 1
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -52,7 +58,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx extend context correctly 1
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -70,7 +78,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx extend context c
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -83,7 +93,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx extend context c
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -100,7 +112,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx extend context c
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-dropdown-trigger ant-breadcrumb-overlay-link"
>
@@ -267,7 +281,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx extend context c
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -281,7 +297,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx extend context c
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -313,7 +331,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx extend context c
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -353,7 +373,9 @@ exports[`renders components/breadcrumb/demo/debug-routes.tsx extend context corr
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#/home"
@@ -367,7 +389,9 @@ exports[`renders components/breadcrumb/demo/debug-routes.tsx extend context corr
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-dropdown-trigger ant-breadcrumb-overlay-link"
>
@@ -499,7 +523,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx extend context correctly
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -512,7 +538,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx extend context correctly
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -529,7 +557,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx extend context correctly
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-dropdown-trigger ant-breadcrumb-overlay-link"
>
@@ -696,7 +726,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx extend context correctly
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -714,7 +746,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx extend context correct
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -727,7 +761,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx extend context correct
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -741,7 +777,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx extend context correct
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -755,7 +793,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx extend context correct
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -773,7 +813,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx extend conte
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -786,7 +828,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx extend conte
>
:
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -800,7 +844,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx extend conte
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -814,7 +860,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx extend conte
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -832,7 +880,9 @@ exports[`renders components/breadcrumb/demo/withIcon.tsx extend context correctl
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -864,7 +914,9 @@ exports[`renders components/breadcrumb/demo/withIcon.tsx extend context correctl
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -899,7 +951,9 @@ exports[`renders components/breadcrumb/demo/withIcon.tsx extend context correctl
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -917,7 +971,9 @@ exports[`renders components/breadcrumb/demo/withParams.tsx extend context correc
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -930,7 +986,9 @@ exports[`renders components/breadcrumb/demo/withParams.tsx extend context correc
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""

View File

@@ -5,7 +5,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx correctly 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -18,7 +20,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -35,7 +39,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -52,7 +58,9 @@ exports[`renders components/breadcrumb/demo/basic.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -68,7 +76,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx correctly 1`] =
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -81,7 +91,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx correctly 1`] =
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -98,7 +110,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx correctly 1`] =
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-dropdown-trigger ant-breadcrumb-overlay-link"
>
@@ -138,7 +152,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx correctly 1`] =
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -152,7 +168,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx correctly 1`] =
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -184,7 +202,9 @@ exports[`renders components/breadcrumb/demo/component-token.tsx correctly 1`] =
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -222,7 +242,9 @@ exports[`renders components/breadcrumb/demo/debug-routes.tsx correctly 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#/home"
@@ -236,7 +258,9 @@ exports[`renders components/breadcrumb/demo/debug-routes.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-dropdown-trigger ant-breadcrumb-overlay-link"
>
@@ -276,7 +300,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx correctly 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -289,7 +315,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -306,7 +334,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-dropdown-trigger ant-breadcrumb-overlay-link"
>
@@ -346,7 +376,9 @@ exports[`renders components/breadcrumb/demo/overlay.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -362,7 +394,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx correctly 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -375,7 +409,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx correctly 1`] = `
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -389,7 +425,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx correctly 1`] = `
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -403,7 +441,9 @@ exports[`renders components/breadcrumb/demo/separator.tsx correctly 1`] = `
>
&gt;
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -419,7 +459,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx correctly 1`
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -432,7 +474,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx correctly 1`
>
:
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -446,7 +490,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx correctly 1`
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -460,7 +506,9 @@ exports[`renders components/breadcrumb/demo/separator-component.tsx correctly 1`
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -476,7 +524,9 @@ exports[`renders components/breadcrumb/demo/withIcon.tsx correctly 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -508,7 +558,9 @@ exports[`renders components/breadcrumb/demo/withIcon.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""
@@ -543,7 +595,9 @@ exports[`renders components/breadcrumb/demo/withIcon.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -559,7 +613,9 @@ exports[`renders components/breadcrumb/demo/withParams.tsx correctly 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -572,7 +628,9 @@ exports[`renders components/breadcrumb/demo/withParams.tsx correctly 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href=""

View File

@@ -6,7 +6,9 @@ exports[`Breadcrumb.ItemRender render as expect 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="my-link"
data-path="/"
@@ -20,7 +22,9 @@ exports[`Breadcrumb.ItemRender render as expect 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="my-link"
data-path="/bamboo"

View File

@@ -5,7 +5,9 @@ exports[`react router react router legacy 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#/"
@@ -19,7 +21,9 @@ exports[`react router react router legacy 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#//apps"
@@ -33,7 +37,9 @@ exports[`react router react router legacy 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#//apps/1"
@@ -47,7 +53,9 @@ exports[`react router react router legacy 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<a
class="ant-breadcrumb-link"
href="#//apps/1/detail"

View File

@@ -66,7 +66,7 @@ const genBreadcrumbStyle: GenerateStyle<BreadcrumbToken, CSSObject> = (token) =>
listStyle: 'none',
},
a: {
[`${componentCls}-item a`]: {
color: token.linkColor,
transition: `color ${token.motionDurationMid}`,
padding: `0 ${unit(token.paddingXXS)}`,
@@ -83,7 +83,7 @@ const genBreadcrumbStyle: GenerateStyle<BreadcrumbToken, CSSObject> = (token) =>
...genFocusStyle(token),
},
'li:last-child': {
[`${componentCls}-item:last-child`]: {
color: token.lastItemColor,
},

View File

@@ -1,8 +1,8 @@
import React, { Children, useContext, useEffect, useMemo, useRef, useState } from 'react';
import classNames from 'classnames';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import omit from 'rc-util/lib/omit';
import { useComposeRef } from 'rc-util/lib/ref';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import { devUseWarning } from '../_util/warning';
import Wave from '../_util/wave';
@@ -154,7 +154,7 @@ const InternalCompoundedButton = React.forwardRef<
}
return ['default', 'outlined'];
}, [type, color, variant, danger, button?.variant, button?.color]);
}, [color, variant, type, danger, button?.color, button?.variant, mergedType]);
const isDanger = mergedColor === 'danger';
const mergedColorText = isDanger ? 'dangerous' : mergedColor;
@@ -335,23 +335,35 @@ const InternalCompoundedButton = React.forwardRef<
...(contextStyles.icon || {}),
};
const iconNode =
icon && !innerLoading ? (
<IconWrapper prefixCls={prefixCls} className={iconClasses} style={iconStyle}>
{icon}
</IconWrapper>
) : loading && typeof loading === 'object' && loading.icon ? (
<IconWrapper prefixCls={prefixCls} className={iconClasses} style={iconStyle}>
{loading.icon}
</IconWrapper>
) : (
<DefaultLoadingIcon
existIcon={!!icon}
prefixCls={prefixCls}
loading={innerLoading}
mount={isMountRef.current}
/>
);
/**
* Extract icon node
* If there is a custom icon and not in loading state: show custom icon
*/
const iconWrapperElement = (child: React.ReactNode) => (
<IconWrapper prefixCls={prefixCls} className={iconClasses} style={iconStyle}>
{child}
</IconWrapper>
);
const defaultLoadingIconElement = () => (
<DefaultLoadingIcon
existIcon={!!icon}
prefixCls={prefixCls}
loading={innerLoading}
mount={isMountRef.current}
/>
);
/**
* Using if-else statements can improve code readability without affecting future expansion.
*/
let iconNode: React.ReactNode;
if (icon && !innerLoading) {
iconNode = iconWrapperElement(icon);
} else if (loading && typeof loading === 'object' && loading.icon) {
iconNode = iconWrapperElement(loading.icon);
} else {
iconNode = defaultLoadingIconElement();
}
const kids =
children || children === 0 ? spaceChildren(children, needInserted && mergedInsertSpace) : null;

View File

@@ -1,8 +1,5 @@
import Dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import React from 'react';
import Dayjs from 'dayjs';
import MockDate from 'mockdate';
import type { PickerPanelProps } from 'rc-picker';
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
@@ -17,9 +14,12 @@ import ConfigProvider from '../../config-provider';
import Group from '../../radio/group';
import Button from '../../radio/radioButton';
import Select from '../../select';
import type { DefaultOptionType } from '../../select';
import Header from '../Header';
import type { CalendarHeaderProps } from '../Header';
import 'dayjs/locale/zh-cn';
const ref: {
calendarProps?: PickerPanelProps;
calendarHeaderProps?: CalendarHeaderProps<unknown>;
@@ -375,15 +375,10 @@ describe('Calendar', () => {
// Year
const headerRender = jest.fn(({ value }) => {
const year = value.year();
const options = [];
const options: DefaultOptionType[] = [];
for (let i = year - 100; i < year + 100; i += 1) {
options.push(
<Select.Option className="year-item" key={i} value={i}>
{i}
</Select.Option>,
);
options.push({ label: i, value: i });
}
return (
<Select
size="small"
@@ -391,9 +386,8 @@ describe('Calendar', () => {
className="my-year-select"
onChange={onYearChange}
value={String(year)}
>
{options}
</Select>
options={options}
/>
);
});
const uiWithYear = <Calendar fullscreen={false} headerRender={headerRender} />;
@@ -412,23 +406,17 @@ describe('Calendar', () => {
const headerRenderWithMonth = jest.fn(({ value }) => {
const start = 0;
const end = 12;
const monthOptions = [];
const months: string[] = [];
const monthOptions: DefaultOptionType[] = [];
const current = value.clone();
const localeData = value.localeData();
const months = [];
for (let i = 0; i < 12; i += 1) {
current.month(i);
months.push(localeData.monthsShort(current));
}
for (let index = start; index < end; index += 1) {
monthOptions.push(
<Select.Option className="month-item" key={index} value={index}>
{months[index]}
</Select.Option>,
);
monthOptions.push({ label: months[index], value: index });
}
const month = value.month();
return (
<Select
@@ -437,9 +425,8 @@ describe('Calendar', () => {
className="my-month-select"
onChange={onMonthChange}
value={String(month)}
>
{monthOptions}
</Select>
options={monthOptions}
/>
);
});
const uiWithMonth = <Calendar fullscreen={false} headerRender={headerRenderWithMonth} />;

View File

@@ -65,8 +65,12 @@ const App: React.FC = () => {
};
const cellRender: CalendarProps<Dayjs>['cellRender'] = (current, info) => {
if (info.type === 'date') return dateCellRender(current);
if (info.type === 'month') return monthCellRender(current);
if (info.type === 'date') {
return dateCellRender(current);
}
if (info.type === 'month') {
return monthCellRender(current);
}
return info.originNode;
};

View File

@@ -327,7 +327,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -347,7 +347,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
1
</h3>
@@ -367,7 +367,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
2
</h3>
@@ -387,7 +387,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
3
</h3>
@@ -407,7 +407,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -427,7 +427,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
1
</h3>
@@ -447,7 +447,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
2
</h3>
@@ -467,7 +467,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
3
</h3>
@@ -487,7 +487,7 @@ exports[`renders components/carousel/demo/autoplay.tsx extend context correctly
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -1036,7 +1036,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -1056,7 +1056,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
1
</h3>
@@ -1076,7 +1076,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
2
</h3>
@@ -1096,7 +1096,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
3
</h3>
@@ -1116,7 +1116,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -1136,7 +1136,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
1
</h3>
@@ -1156,7 +1156,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
2
</h3>
@@ -1176,7 +1176,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
3
</h3>
@@ -1196,7 +1196,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx extend context correc
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -1272,7 +1272,7 @@ exports[`renders components/carousel/demo/fade.tsx extend context correctly 1`]
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
1
</h3>
@@ -1292,7 +1292,7 @@ exports[`renders components/carousel/demo/fade.tsx extend context correctly 1`]
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
2
</h3>
@@ -1312,7 +1312,7 @@ exports[`renders components/carousel/demo/fade.tsx extend context correctly 1`]
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
3
</h3>
@@ -1332,7 +1332,7 @@ exports[`renders components/carousel/demo/fade.tsx extend context correctly 1`]
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -1503,7 +1503,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -1523,7 +1523,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
1
</h3>
@@ -1543,7 +1543,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
2
</h3>
@@ -1563,7 +1563,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
3
</h3>
@@ -1583,7 +1583,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>
@@ -1603,7 +1603,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
1
</h3>
@@ -1623,7 +1623,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
2
</h3>
@@ -1643,7 +1643,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
3
</h3>
@@ -1663,7 +1663,7 @@ Array [
tabindex="-1"
>
<h3
style="height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
style="margin: 0px; height: 160px; color: rgb(255, 255, 255); line-height: 160px; text-align: center; background: rgb(54, 77, 121);"
>
4
</h3>

View File

@@ -324,7 +324,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -344,7 +344,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
1
</h3>
@@ -364,7 +364,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
2
</h3>
@@ -384,7 +384,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
3
</h3>
@@ -404,7 +404,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -424,7 +424,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
1
</h3>
@@ -444,7 +444,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
2
</h3>
@@ -464,7 +464,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
3
</h3>
@@ -484,7 +484,7 @@ exports[`renders components/carousel/demo/autoplay.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -1027,7 +1027,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -1047,7 +1047,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
1
</h3>
@@ -1067,7 +1067,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
2
</h3>
@@ -1087,7 +1087,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
3
</h3>
@@ -1107,7 +1107,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -1127,7 +1127,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
1
</h3>
@@ -1147,7 +1147,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
2
</h3>
@@ -1167,7 +1167,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
3
</h3>
@@ -1187,7 +1187,7 @@ exports[`renders components/carousel/demo/dot-duration.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -1261,7 +1261,7 @@ exports[`renders components/carousel/demo/fade.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
1
</h3>
@@ -1281,7 +1281,7 @@ exports[`renders components/carousel/demo/fade.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
2
</h3>
@@ -1301,7 +1301,7 @@ exports[`renders components/carousel/demo/fade.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
3
</h3>
@@ -1321,7 +1321,7 @@ exports[`renders components/carousel/demo/fade.tsx correctly 1`] = `
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -1490,7 +1490,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -1510,7 +1510,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
1
</h3>
@@ -1530,7 +1530,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
2
</h3>
@@ -1550,7 +1550,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
3
</h3>
@@ -1570,7 +1570,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>
@@ -1590,7 +1590,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
1
</h3>
@@ -1610,7 +1610,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
2
</h3>
@@ -1630,7 +1630,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
3
</h3>
@@ -1650,7 +1650,7 @@ Array [
tabindex="-1"
>
<h3
style="height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
style="margin:0;height:160px;color:#fff;line-height:160px;text-align:center;background:#364d79"
>
4
</h3>

View File

@@ -2,6 +2,7 @@ import React from 'react';
import { Carousel } from 'antd';
const contentStyle: React.CSSProperties = {
margin: 0,
height: '160px',
color: '#fff',
lineHeight: '160px',

View File

@@ -2,6 +2,7 @@ import React from 'react';
import { Carousel } from 'antd';
const contentStyle: React.CSSProperties = {
margin: 0,
height: '160px',
color: '#fff',
lineHeight: '160px',

View File

@@ -2,6 +2,7 @@ import React from 'react';
import { Carousel } from 'antd';
const contentStyle: React.CSSProperties = {
margin: 0,
height: '160px',
color: '#fff',
lineHeight: '160px',

View File

@@ -5,6 +5,7 @@ import { Carousel, Radio } from 'antd';
type DotPosition = CarouselProps['dotPosition'];
const contentStyle: React.CSSProperties = {
margin: 0,
height: '160px',
color: '#fff',
lineHeight: '160px',

View File

@@ -1,4 +1,4 @@
import { unit } from '@ant-design/cssinjs';
import { Keyframes, unit } from '@ant-design/cssinjs';
import { resetComponent } from '../../style';
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
@@ -230,6 +230,16 @@ const genDotsStyle: GenerateStyle<CarouselToken> = (token) => {
colorBgContainer,
motionDurationSlow,
} = token;
const animation = new Keyframes(`${token.prefixCls}-dot-animation`, {
from: {
width: 0,
},
to: {
width: token.dotActiveWidth,
},
});
return {
[componentCls]: {
'.slick-dots': {
@@ -274,7 +284,7 @@ const genDotsStyle: GenerateStyle<CarouselToken> = (token) => {
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: '100%',
width: 0,
height: dotHeight,
content: '""',
background: 'transparent',
@@ -283,7 +293,6 @@ const genDotsStyle: GenerateStyle<CarouselToken> = (token) => {
outline: 'none',
cursor: 'pointer',
overflow: 'hidden',
transform: 'translate3d(-100%, 0, 0)',
},
button: {
@@ -322,8 +331,10 @@ const genDotsStyle: GenerateStyle<CarouselToken> = (token) => {
},
'&::after': {
background: colorBgContainer,
transform: 'translate3d(0, 0, 0)',
transition: `transform var(${DotDuration}) ease-out`,
animationName: animation,
animationDuration: `var(${DotDuration})`,
animationTimingFunction: 'ease-out',
animationFillMode: 'forwards',
},
},
},
@@ -335,6 +346,15 @@ const genDotsStyle: GenerateStyle<CarouselToken> = (token) => {
const genCarouselVerticalStyle: GenerateStyle<CarouselToken> = (token) => {
const { componentCls, dotOffset, arrowOffset, marginXXS } = token;
const animation = new Keyframes(`${token.prefixCls}-dot-vertical-animation`, {
from: {
height: 0,
},
to: {
height: token.dotActiveWidth,
},
});
const reverseSizeOfDot = {
width: token.dotHeight,
height: token.dotWidth,
@@ -396,12 +416,19 @@ const genCarouselVerticalStyle: GenerateStyle<CarouselToken> = (token) => {
'&.slick-active': {
...reverseSizeOfDot,
height: token.dotActiveWidth,
button: reverseSizeOfDot,
button: {
...reverseSizeOfDot,
height: token.dotActiveWidth,
},
'&::after': {
...reverseSizeOfDot,
transition: `height var(${DotDuration}) ease-out`,
animationName: animation,
animationDuration: `var(${DotDuration})`,
animationTimingFunction: 'ease-out',
animationFillMode: 'forwards',
},
},
},

View File

@@ -558,14 +558,14 @@ describe('Cascader', () => {
resetWarned();
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const customStyle = { background: 'red' };
const { container } = render(<Cascader dropdownStyle={customStyle} open />);
const { container } = render(<Cascader dropdownStyle={{ padding: 10 }} open />);
expect(errSpy).toHaveBeenCalledWith(
'Warning: [antd: Cascader] `dropdownStyle` is deprecated. Please use `styles.popup.root` instead.',
);
expect(container.querySelector('.ant-select-dropdown')?.getAttribute('style')).toContain(
'background: red',
);
expect(container.querySelector<HTMLElement>('.ant-select-dropdown')).toHaveStyle({
padding: '10px',
});
errSpy.mockRestore();
});
@@ -595,11 +595,11 @@ describe('Cascader', () => {
resetWarned();
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const columnStyle = { background: 'red' };
const { getByRole } = render(
<Cascader
options={[{ label: 'test', value: 1 }]}
dropdownMenuColumnStyle={columnStyle}
dropdownMenuColumnStyle={{ padding: 10 }}
open
/>,
);
@@ -607,7 +607,7 @@ describe('Cascader', () => {
'Warning: [antd: Cascader] `dropdownMenuColumnStyle` is deprecated. Please use `popupMenuColumnStyle` instead.',
);
const menuColumn = getByRole('menuitemcheckbox');
expect(menuColumn.style.background).toBe('red');
expect(menuColumn).toHaveStyle({ padding: '10px' });
errSpy.mockRestore();
});

View File

@@ -11,7 +11,7 @@ import RcCascader from 'rc-cascader';
import type { Placement } from 'rc-select/lib/BaseSelect';
import omit from 'rc-util/lib/omit';
import { useZIndex } from '../_util/hooks/useZIndex';
import { useZIndex } from '../_util/hooks';
import type { SelectCommonPlacement } from '../_util/motion';
import { getTransitionName } from '../_util/motion';
import genPurePanel from '../_util/PurePanel';

View File

@@ -82,14 +82,12 @@ describe('Collapse', () => {
</Collapse.Panel>
</Collapse>,
);
expect(
container.querySelector('.ant-collapse-item')?.classList.contains('ant-collapse-item-active'),
).toBe(false);
expect(container.querySelector('.ant-collapse-item')).not.toHaveClass(
'ant-collapse-item-active',
);
fireEvent.click(container.querySelector('.ant-collapse-header')!);
await waitFakeTimer();
expect(
container.querySelector('.ant-collapse-item')?.classList.contains('ant-collapse-item-active'),
).toBe(true);
expect(container.querySelector('.ant-collapse-item')).toHaveClass('ant-collapse-item-active');
jest.useRealTimers();
});

View File

@@ -3,8 +3,6 @@ import { SettingOutlined } from '@ant-design/icons';
import type { CollapseProps } from 'antd';
import { Collapse, Select } from 'antd';
const { Option } = Select;
const text = `
A dog is a type of domesticated animal.
Known for its loyalty and faithfulness,
@@ -64,10 +62,15 @@ const App: React.FC = () => {
/>
<br />
<span>Expand Icon Position: </span>
<Select value={expandIconPosition} style={{ margin: '0 8px' }} onChange={onPositionChange}>
<Option value="start">start</Option>
<Option value="end">end</Option>
</Select>
<Select
value={expandIconPosition}
style={{ margin: '0 8px' }}
onChange={onPositionChange}
options={[
{ label: 'start', value: 'start' },
{ label: 'end', value: 'end' },
]}
/>
</>
);
};

View File

@@ -205,7 +205,7 @@ describe('ColorPicker', () => {
fireEvent.click(container.querySelector('.ant-color-picker-trigger')!);
await waitFakeTimer();
const presetsColors = container
.querySelector('.ant-collapse-content')
?.querySelector('.ant-collapse-content')
?.querySelectorAll('.ant-color-picker-presets-color')!;
expect(container.querySelector('.ant-color-picker-presets')).toBeTruthy();
@@ -217,9 +217,7 @@ describe('ColorPicker', () => {
).toBeTruthy();
fireEvent.click(presetsColors[0]);
expect(
presetsColors[0].classList.contains('ant-color-picker-presets-color-bright'),
).toBeFalsy();
expect(presetsColors[0]).not.toHaveClass('ant-color-picker-presets-color-bright');
expect(
container.querySelector('.ant-color-picker-hex-input input')?.getAttribute('value'),
).toEqual('000000');
@@ -228,9 +226,7 @@ describe('ColorPicker', () => {
);
fireEvent.click(presetsColors[9]);
expect(
presetsColors[9].classList.contains('ant-color-picker-presets-color-bright'),
).toBeTruthy();
expect(presetsColors[9]).toHaveClass('ant-color-picker-presets-color-bright');
expect(
container.querySelector('.ant-color-picker-hex-input input')?.getAttribute('value'),
).toEqual('000000');

View File

@@ -79,7 +79,7 @@ const ColorTrigger = forwardRef<HTMLDivElement, ColorTriggerProps>((props, ref)
default:
return alpha < 100 ? `${hexString.slice(0, 7)},${alpha}%` : hexString;
}
}, [color, format, showText, activeIndex]);
}, [color, format, showText, activeIndex, locale.transparent, colorTextCellPrefixCls]);
// ============================= Render =============================
const containerNode = useMemo<React.ReactNode>(

View File

@@ -4,6 +4,7 @@ import RcColorPicker from '@rc-component/color-picker';
import type { Color } from '@rc-component/color-picker';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import { useForceUpdate } from '../../../_util/hooks';
import Segmented from '../../../segmented';
import { AggregationColor } from '../../color';
import { PanelPickerContext } from '../../context';
@@ -70,7 +71,7 @@ const PanelPicker: FC = () => {
if (!isSingle) {
setLockedColor(colors[activeIndex]?.color);
}
}, [gradientDragging, activeIndex]);
}, [isSingle, colors, gradientDragging, activeIndex]);
const activeColor = React.useMemo(() => {
if (isSingle) {
@@ -83,11 +84,12 @@ const PanelPicker: FC = () => {
}
return colors[activeIndex]?.color;
}, [value, activeIndex, isSingle, lockedColor, gradientDragging]);
}, [colors, value, activeIndex, isSingle, lockedColor, gradientDragging]);
// ========================= Picker Color =========================
const [pickerColor, setPickerColor] = React.useState<AggregationColor | null>(activeColor);
const [forceSync, setForceSync] = React.useState(0);
const [forceSync, setForceSync] = useForceUpdate();
const mergedPickerColor = pickerColor?.equals(activeColor) ? activeColor : pickerColor;
@@ -148,7 +150,7 @@ const PanelPicker: FC = () => {
// Back of origin color in case in controlled
// This will set after `onChangeComplete` to avoid `setState` trigger rerender
// which will make `fillColor` get wrong `color.cleared` state
setForceSync((ori) => ori + 1);
setForceSync();
};
const onInputChange = (colorValue: AggregationColor) => {

View File

@@ -57,7 +57,7 @@ export default function useModeColor(
pushOption('gradient', locale.gradientColor);
return [optionList, modes];
}, [mode]);
}, [mode, locale.singleColor, locale.gradientColor]);
// ======================== Post ========================
// We need align `mode` with `color` state

View File

@@ -1175,7 +1175,9 @@ exports[`ConfigProvider components Breadcrumb configProvider 1`] = `
class="config-breadcrumb"
>
<ol>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1188,7 +1190,9 @@ exports[`ConfigProvider components Breadcrumb configProvider 1`] = `
>
/
</li>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1204,7 +1208,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentDisabled 1
class="config-breadcrumb"
>
<ol>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1217,7 +1223,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentDisabled 1
>
/
</li>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1233,7 +1241,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentSize large
class="config-breadcrumb"
>
<ol>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1246,7 +1256,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentSize large
>
/
</li>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1262,7 +1274,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentSize middl
class="config-breadcrumb"
>
<ol>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1275,7 +1289,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentSize middl
>
/
</li>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1291,7 +1307,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentSize small
class="config-breadcrumb"
>
<ol>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1304,7 +1322,9 @@ exports[`ConfigProvider components Breadcrumb configProvider componentSize small
>
/
</li>
<li>
<li
class="config-breadcrumb-item"
>
<span
class="config-breadcrumb-link"
>
@@ -1320,7 +1340,9 @@ exports[`ConfigProvider components Breadcrumb normal 1`] = `
class="ant-breadcrumb"
>
<ol>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -1333,7 +1355,9 @@ exports[`ConfigProvider components Breadcrumb normal 1`] = `
>
/
</li>
<li>
<li
class="ant-breadcrumb-item"
>
<span
class="ant-breadcrumb-link"
>
@@ -1349,7 +1373,9 @@ exports[`ConfigProvider components Breadcrumb prefixCls 1`] = `
class="prefix-Breadcrumb"
>
<ol>
<li>
<li
class="prefix-Breadcrumb-item"
>
<span
class="prefix-Breadcrumb-link"
>
@@ -1362,7 +1388,9 @@ exports[`ConfigProvider components Breadcrumb prefixCls 1`] = `
>
/
</li>
<li>
<li
class="prefix-Breadcrumb-item"
>
<span
class="prefix-Breadcrumb-link"
>
@@ -24801,7 +24829,7 @@ exports[`ConfigProvider components Select configProvider 1`] = `
class="config-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_1"
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="true"
@@ -24819,8 +24847,11 @@ exports[`ConfigProvider components Select configProvider 1`] = `
/>
</span>
<span
class="config-select-selection-placeholder"
/>
class="config-select-selection-item"
title="Light"
>
Light
</span>
</span>
</div>
<div
@@ -24833,18 +24864,13 @@ exports[`ConfigProvider components Select configProvider 1`] = `
role="listbox"
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_0"
role="presentation"
/>
<div
aria-label="Light"
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_1"
aria-selected="true"
id="rc_select_TEST_OR_SSR_list_0"
role="option"
>
Bamboo
light
</div>
</div>
<div
@@ -24861,14 +24887,8 @@ exports[`ConfigProvider components Select configProvider 1`] = `
style="display: flex; flex-direction: column;"
>
<div
class="config-select-item config-select-item-group"
title="grp"
>
grp
</div>
<div
aria-selected="false"
class="config-select-item config-select-item-option config-select-item-option-grouped config-select-item-option-active"
aria-selected="true"
class="config-select-item config-select-item-option config-select-item-option-active config-select-item-option-selected"
title="Light"
>
<div
@@ -24950,8 +24970,11 @@ exports[`ConfigProvider components Select configProvider componentDisabled 1`] =
/>
</span>
<span
class="config-select-selection-placeholder"
/>
class="config-select-selection-item"
title="Light"
>
Light
</span>
</span>
</div>
<span
@@ -24997,7 +25020,7 @@ exports[`ConfigProvider components Select configProvider componentSize large 1`]
class="config-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_1"
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="true"
@@ -25015,8 +25038,11 @@ exports[`ConfigProvider components Select configProvider componentSize large 1`]
/>
</span>
<span
class="config-select-selection-placeholder"
/>
class="config-select-selection-item"
title="Light"
>
Light
</span>
</span>
</div>
<div
@@ -25029,18 +25055,13 @@ exports[`ConfigProvider components Select configProvider componentSize large 1`]
role="listbox"
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_0"
role="presentation"
/>
<div
aria-label="Light"
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_1"
aria-selected="true"
id="rc_select_TEST_OR_SSR_list_0"
role="option"
>
Bamboo
light
</div>
</div>
<div
@@ -25057,14 +25078,8 @@ exports[`ConfigProvider components Select configProvider componentSize large 1`]
style="display: flex; flex-direction: column;"
>
<div
class="config-select-item config-select-item-group"
title="grp"
>
grp
</div>
<div
aria-selected="false"
class="config-select-item config-select-item-option config-select-item-option-grouped config-select-item-option-active"
aria-selected="true"
class="config-select-item config-select-item-option config-select-item-option-active config-select-item-option-selected"
title="Light"
>
<div
@@ -25128,7 +25143,7 @@ exports[`ConfigProvider components Select configProvider componentSize middle 1`
class="config-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_1"
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="true"
@@ -25146,8 +25161,11 @@ exports[`ConfigProvider components Select configProvider componentSize middle 1`
/>
</span>
<span
class="config-select-selection-placeholder"
/>
class="config-select-selection-item"
title="Light"
>
Light
</span>
</span>
</div>
<div
@@ -25160,18 +25178,13 @@ exports[`ConfigProvider components Select configProvider componentSize middle 1`
role="listbox"
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_0"
role="presentation"
/>
<div
aria-label="Light"
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_1"
aria-selected="true"
id="rc_select_TEST_OR_SSR_list_0"
role="option"
>
Bamboo
light
</div>
</div>
<div
@@ -25188,14 +25201,8 @@ exports[`ConfigProvider components Select configProvider componentSize middle 1`
style="display: flex; flex-direction: column;"
>
<div
class="config-select-item config-select-item-group"
title="grp"
>
grp
</div>
<div
aria-selected="false"
class="config-select-item config-select-item-option config-select-item-option-grouped config-select-item-option-active"
aria-selected="true"
class="config-select-item config-select-item-option config-select-item-option-active config-select-item-option-selected"
title="Light"
>
<div
@@ -25259,7 +25266,7 @@ exports[`ConfigProvider components Select configProvider componentSize small 1`]
class="config-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_1"
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="true"
@@ -25277,8 +25284,11 @@ exports[`ConfigProvider components Select configProvider componentSize small 1`]
/>
</span>
<span
class="config-select-selection-placeholder"
/>
class="config-select-selection-item"
title="Light"
>
Light
</span>
</span>
</div>
<div
@@ -25291,18 +25301,13 @@ exports[`ConfigProvider components Select configProvider componentSize small 1`]
role="listbox"
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_0"
role="presentation"
/>
<div
aria-label="Light"
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_1"
aria-selected="true"
id="rc_select_TEST_OR_SSR_list_0"
role="option"
>
Bamboo
light
</div>
</div>
<div
@@ -25319,14 +25324,8 @@ exports[`ConfigProvider components Select configProvider componentSize small 1`]
style="display: flex; flex-direction: column;"
>
<div
class="config-select-item config-select-item-group"
title="grp"
>
grp
</div>
<div
aria-selected="false"
class="config-select-item config-select-item-option config-select-item-option-grouped config-select-item-option-active"
aria-selected="true"
class="config-select-item config-select-item-option config-select-item-option-active config-select-item-option-selected"
title="Light"
>
<div
@@ -25390,7 +25389,7 @@ exports[`ConfigProvider components Select normal 1`] = `
class="ant-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_1"
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="true"
@@ -25408,8 +25407,11 @@ exports[`ConfigProvider components Select normal 1`] = `
/>
</span>
<span
class="ant-select-selection-placeholder"
/>
class="ant-select-selection-item"
title="Light"
>
Light
</span>
</span>
</div>
<div
@@ -25422,18 +25424,13 @@ exports[`ConfigProvider components Select normal 1`] = `
role="listbox"
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_0"
role="presentation"
/>
<div
aria-label="Light"
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_1"
aria-selected="true"
id="rc_select_TEST_OR_SSR_list_0"
role="option"
>
Bamboo
light
</div>
</div>
<div
@@ -25450,14 +25447,8 @@ exports[`ConfigProvider components Select normal 1`] = `
style="display: flex; flex-direction: column;"
>
<div
class="ant-select-item ant-select-item-group"
title="grp"
>
grp
</div>
<div
aria-selected="false"
class="ant-select-item ant-select-item-option ant-select-item-option-grouped ant-select-item-option-active"
aria-selected="true"
class="ant-select-item ant-select-item-option ant-select-item-option-active ant-select-item-option-selected"
title="Light"
>
<div
@@ -25521,7 +25512,7 @@ exports[`ConfigProvider components Select prefixCls 1`] = `
class="prefix-Select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_1"
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="true"
@@ -25539,8 +25530,11 @@ exports[`ConfigProvider components Select prefixCls 1`] = `
/>
</span>
<span
class="prefix-Select-selection-placeholder"
/>
class="prefix-Select-selection-item"
title="Light"
>
Light
</span>
</span>
</div>
<div
@@ -25553,18 +25547,13 @@ exports[`ConfigProvider components Select prefixCls 1`] = `
role="listbox"
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_0"
role="presentation"
/>
<div
aria-label="Light"
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_1"
aria-selected="true"
id="rc_select_TEST_OR_SSR_list_0"
role="option"
>
Bamboo
light
</div>
</div>
<div
@@ -25581,14 +25570,8 @@ exports[`ConfigProvider components Select prefixCls 1`] = `
style="display: flex; flex-direction: column;"
>
<div
class="prefix-Select-item prefix-Select-item-group"
title="grp"
>
grp
</div>
<div
aria-selected="false"
class="prefix-Select-item prefix-Select-item-option prefix-Select-item-option-grouped prefix-Select-item-option-active"
aria-selected="true"
class="prefix-Select-item prefix-Select-item-option prefix-Select-item-option-active prefix-Select-item-option-selected"
title="Light"
>
<div
@@ -39939,7 +39922,7 @@ exports[`ConfigProvider components Transfer configProvider 1`] = `
exports[`ConfigProvider components Transfer configProvider componentDisabled 1`] = `
<div
class="config-transfer"
class="config-transfer config-transfer-disabled"
>
<div
class="config-transfer-list"
@@ -39966,6 +39949,7 @@ exports[`ConfigProvider components Transfer configProvider componentDisabled 1`]
<span
aria-label="down"
class="anticon anticon-down config-dropdown-trigger config-transfer-list-header-dropdown"
disabled=""
role="img"
>
<svg
@@ -40136,6 +40120,7 @@ exports[`ConfigProvider components Transfer configProvider componentDisabled 1`]
<span
aria-label="down"
class="anticon anticon-down config-dropdown-trigger config-transfer-list-header-dropdown"
disabled=""
role="img"
>
<svg
@@ -41810,11 +41795,12 @@ exports[`ConfigProvider components Tree configProvider 1`] = `
exports[`ConfigProvider components Tree configProvider componentDisabled 1`] = `
<div>
<div
class="config-tree config-tree-icon-hide"
class="config-tree config-tree-icon-hide config-tree-disabled"
>
<div>
<input
aria-label="for screen reader"
disabled=""
style="width: 0px; height: 0px; display: flex; overflow: hidden; opacity: 0; border: 0px; padding: 0px; margin: 0px;"
tabindex="0"
value=""
@@ -41848,7 +41834,7 @@ exports[`ConfigProvider components Tree configProvider componentDisabled 1`] = `
>
<div
aria-expanded="false"
class="config-tree-treenode config-tree-treenode-switcher-close config-tree-treenode-leaf-last config-tree-treenode-leaf"
class="config-tree-treenode config-tree-treenode-disabled config-tree-treenode-switcher-close config-tree-treenode-leaf-last config-tree-treenode-leaf"
draggable="false"
role="treeitem"
>
@@ -41876,11 +41862,12 @@ exports[`ConfigProvider components Tree configProvider componentDisabled 1`] = `
</div>
</div>
<div
class="config-tree config-tree-block-node config-tree-directory"
class="config-tree config-tree-block-node config-tree-disabled config-tree-directory"
>
<div>
<input
aria-label="for screen reader"
disabled=""
style="width: 0px; height: 0px; display: flex; overflow: hidden; opacity: 0; border: 0px; padding: 0px; margin: 0px;"
tabindex="0"
value=""
@@ -41914,7 +41901,7 @@ exports[`ConfigProvider components Tree configProvider componentDisabled 1`] = `
>
<div
aria-expanded="false"
class="config-tree-treenode config-tree-treenode-switcher-close config-tree-treenode-leaf-last config-tree-treenode-leaf"
class="config-tree-treenode config-tree-treenode-disabled config-tree-treenode-switcher-close config-tree-treenode-leaf-last config-tree-treenode-leaf"
draggable="false"
role="treeitem"
>

View File

@@ -59,11 +59,12 @@ import TreeSelect from '../../tree-select';
import Upload from '../../upload';
dayjs.extend(customParseFormat);
jest.mock('rc-util/lib/Portal');
describe('ConfigProvider', () => {
describe('components', () => {
function testPair(name: string, renderComponent: (props?: any) => React.ReactElement): void {
const testPair = (name: string, renderComponent: (props?: any) => React.ReactElement<any>) => {
const isArray = ['Menu', 'TimePicker', 'Tooltip'].includes(name);
describe(`${name}`, () => {
// normal
@@ -122,7 +123,7 @@ describe('ConfigProvider', () => {
expect(isArray ? container.children : container.firstChild).toMatchSnapshot();
});
});
}
};
// Alert
testPair('Alert', (props) => (
@@ -430,11 +431,12 @@ describe('ConfigProvider', () => {
// Select
testPair('Select', (props) => (
<Select {...props} open>
<Select.OptGroup key="grp">
<Select.Option key="Bamboo">Light</Select.Option>
</Select.OptGroup>
</Select>
<Select
open
defaultValue={'light'}
options={[{ label: 'Light', value: 'light' }]}
{...props}
/>
));
// Skeleton

View File

@@ -82,7 +82,8 @@ describe('ConfigProvider.Locale', () => {
const datepicke = wrapper.container.querySelector<HTMLInputElement>('.ant-picker-input input');
expect(datepicke?.value).toBe('');
expect(datepicke?.placeholder).toBe('请选择日期');
expect(wrapper.container.querySelector('.ant-pagination-item-1')?.className).toContain(
expect(wrapper.container.querySelector<HTMLElement>('.ant-pagination-item-1')).toHaveClass(
'ant-pagination-item-active',
);
@@ -93,6 +94,7 @@ describe('ConfigProvider.Locale', () => {
expect(
wrapper.container.querySelector<HTMLInputElement>('.ant-picker-input input')?.value,
).not.toBe('');
wrapper.rerender(
<ConfigProvider locale={{} as Locale}>
<DatePicker />
@@ -108,7 +110,7 @@ describe('ConfigProvider.Locale', () => {
expect(datepicker?.value).not.toBe('');
expect(datepicker?.value).toContain('-10');
expect(wrapper.container.querySelector('.ant-pagination-item-3')?.className).toContain(
expect(wrapper.container.querySelector('.ant-pagination-item-3')).toHaveClass(
'ant-pagination-item-active',
);
});

View File

@@ -132,6 +132,7 @@ export interface TableConfig extends ComponentStyleConfig {
export interface ImageConfig extends ComponentStyleConfig {
preview?: Partial<Record<'closeIcon', React.ReactNode>>;
fallback?: string;
}
export type CollapseConfig = ComponentStyleConfig & Pick<CollapseProps, 'expandIcon'>;
@@ -214,7 +215,7 @@ export type CascaderConfig = ComponentStyleConfig &
Pick<CascaderProps, 'variant' | 'styles' | 'classNames'>;
export type TreeSelectConfig = ComponentStyleConfig &
Pick<TreeSelectProps, 'variant' | 'styles' | 'classNames'>;
Pick<TreeSelectProps, 'variant' | 'styles' | 'classNames' | 'switcherIcon'>;
export type DatePickerConfig = ComponentStyleConfig &
Pick<DatePickerProps, 'variant' | 'styles' | 'classNames'>;

View File

@@ -36,7 +36,6 @@ type DirectionType = ConfigProviderProps['direction'];
const InputGroup = Input.Group;
const ButtonGroup = Button.Group;
const { Option } = Select;
const { TreeNode } = Tree;
const { Search } = Input;
@@ -100,19 +99,27 @@ const Page: React.FC<{ placement: Placement }> = ({ placement }) => {
const [showBadge, setShowBadge] = useState(true);
const selectBefore = (
<Select defaultValue="Http://" style={{ width: 90 }}>
<Option value="Http://">Http://</Option>
<Option value="Https://">Https://</Option>
</Select>
<Select
defaultValue="Http://"
style={{ width: 90 }}
options={[
{ label: 'Http://', value: 'Http://' },
{ label: 'Https://', value: 'Https://' },
]}
/>
);
const selectAfter = (
<Select defaultValue=".com" style={{ width: 80 }}>
<Option value=".com">.com</Option>
<Option value=".jp">.jp</Option>
<Option value=".cn">.cn</Option>
<Option value=".org">.org</Option>
</Select>
<Select
defaultValue=".com"
style={{ width: 80 }}
options={[
{ label: '.com', value: '.com' },
{ label: '.jp', value: '.jp' },
{ label: '.cn', value: '.cn' },
{ label: '.org', value: '.org' },
]}
/>
);
// ==== Cascader ====
@@ -280,10 +287,13 @@ const Page: React.FC<{ placement: Placement }> = ({ placement }) => {
</InputGroup>
<br />
<InputGroup compact>
<Select defaultValue="Option1">
<Option value="Option1">Option1</Option>
<Option value="Option2">Option2</Option>
</Select>
<Select
defaultValue="Option1"
options={[
{ label: 'Option1', value: 'Option1' },
{ label: 'Option2', value: 'Option2' },
]}
/>
<Input style={{ width: '50%' }} defaultValue="input content" />
<InputNumber />
</InputGroup>
@@ -292,32 +302,50 @@ const Page: React.FC<{ placement: Placement }> = ({ placement }) => {
<br />
<br />
<div style={{ marginBottom: 16 }}>
<Input addonBefore={selectBefore} addonAfter={selectAfter} defaultValue="mysite" />
<Space.Compact>
{selectBefore}
<Input defaultValue="mysite" />
{selectAfter}
</Space.Compact>
</div>
<br />
<Row>
<Col span={12}>
<Divider orientation="left">Select example</Divider>
<Divider orientation="start">Select example</Divider>
<Space wrap>
<Select mode="multiple" defaultValue="مورچه" style={{ width: 120 }}>
<Option value="jack">Jack</Option>
<Option value="مورچه">مورچه</Option>
<Option value="disabled" disabled>
Disabled
</Option>
<Option value="Yiminghe">yiminghe</Option>
</Select>
<Select defaultValue="مورچه" style={{ width: 120 }} disabled>
<Option value="مورچه">مورچه</Option>
</Select>
<Select defaultValue="مورچه" style={{ width: 120 }} loading>
<Option value="مورچه">مورچه</Option>
</Select>
<Select showSearch style={{ width: 200 }} placeholder="Select a person">
<Option value="jack">Jack</Option>
<Option value="سعید">سعید</Option>
<Option value="tom">Tom</Option>
</Select>
<Select
mode="multiple"
defaultValue="مورچه"
style={{ width: 120 }}
options={[
{ label: 'jack', value: 'jack' },
{ label: 'مورچه', value: 'مورچه' },
{ label: 'disabled', value: 'disabled', disabled: true },
{ label: 'yiminghe', value: 'Yiminghe' },
]}
/>
<Select
disabled
defaultValue="مورچه"
style={{ width: 120 }}
options={[{ label: 'مورچه', value: 'مورچه' }]}
/>
<Select
loading
defaultValue="مورچه"
style={{ width: 120 }}
options={[{ label: 'مورچه', value: 'مورچه' }]}
/>
<Select
showSearch
style={{ width: 200 }}
placeholder="Select a person"
options={[
{ label: 'jack', value: 'jack' },
{ label: 'سعید', value: 'سعید' },
{ label: 'Tom', value: 'tom' },
]}
/>
</Space>
</Col>
<Col span={12}>

Some files were not shown because too many files have changed in this diff Show More