diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 084cf0d964..8abf9213d4 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -16,6 +16,27 @@ tag: vVERSION --- +## 5.17.1 + +`2024-05-14` + +- 🐞 Optimize the internal logic of the Form, fix the problem that antd takes too long time to build in Next.js. [react-component/async-validator#9](https://github.com/react-component/async-validator/pull/9) +- 🐞 Fix visually not centered when Tooltip content is only one character. [#48890](https://github.com/ant-design/ant-design/pull/48890) [@kiner-tang](https://github.com/kiner-tang) +- Button + - 🐞 Fix hover and active styles not differentiating when Button `type="text"`and `type="danger"` are used together. [#48876](https://github.com/ant-design/ant-design/pull/48876) [@LonelySnowman](https://github.com/LonelySnowman) +- Fix issue where some components throw findDOMNode warnings + - 🐞 Fix Button throwing `findDOMNode` warning. [#48830](https://github.com/ant-design/ant-design/pull/48830) [@wanpan11](https://github.com/wanpan11) + - 🐞 Fix Badge throwing `findDOMNode` warnings. [#48878](https://github.com/ant-design/ant-design/pull/48878) [@wanpan11](https://github.com/wanpan11) + - 🐞 Fix Alert throwing `findDOMNode` warnings. [#48868](https://github.com/ant-design/ant-design/pull/48868) [@wanpan11](https://github.com/wanpan11) + - 🐞 Fix FloatButton.BackTop throwing `findDOMNode` warnings. [#48865](https://github.com/ant-design/ant-design/pull/48865) [@wanpan11](https://github.com/wanpan11) +- 💄 Add className to internal component Spin given by Drawer to prevent internal Spin styles from overriding user-passed Spin styles. [#48857](https://github.com/ant-design/ant-design/pull/48857) [@li-jia-nan](https://github.com/li-jia-nan) +- 💄 Fix missing bottom border when Card `size="small"`. [#48787](https://github.com/ant-design/ant-design/pull/48787) [@wanpan11](https://github.com/wanpan11) +- 🐞 Fix AutoComplete `tagRender` not working for maxTag and clicking on an edge triggering unexpected closure of the layer. [#48798](https://github.com/ant-design/ant-design/pull/48798) +- RTL + - 💄 Fix Button's missing icon order and margins under RTL. [#48821](https://github.com/ant-design/ant-design/pull/48821) +- TypeScript + - 🤖 Fix Cascader redundant generalization issue. [#48879](https://github.com/ant-design/ant-design/pull/48879) [@crazyair](https://github.com/crazyair) + ## 5.17.0 `2024-05-03` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index ba30fde093..46dbf9c0c0 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,27 @@ tag: vVERSION --- +## 5.17.1 + +`2024-05-14` + +- 🐞 优化 Form 组件底层逻辑,修复了 antd 在 Next.js 中构建时间太长的问题。[react-component/async-validator#9](https://github.com/react-component/async-validator/pull/9) +- 🐞 修复 Tooltip 内容只有一个字符时视觉不居中的问题。[#48890](https://github.com/ant-design/ant-design/pull/48890) [@kiner-tang](https://github.com/kiner-tang) +- Button + - 🐞 修复 Button `type="text"` 和`type="danger"` 同时使用时 hover 和 active 样式没有区分的问题。[#48876](https://github.com/ant-design/ant-design/pull/48876) [@LonelySnowman](https://github.com/LonelySnowman) +- 修复部分组件抛出 findDOMNode 警告的问题 + - 🐞 修复 Button 抛出 `findDOMNode` 警告的问题。[#48830](https://github.com/ant-design/ant-design/pull/48830) [@wanpan11](https://github.com/wanpan11) + - 🐞 修复 Badge 抛出 `findDOMNode` 警告的问题。[#48878](https://github.com/ant-design/ant-design/pull/48878) [@wanpan11](https://github.com/wanpan11) + - 🐞 修复 Alert 抛出 `findDOMNode` 警告的问题。[#48868](https://github.com/ant-design/ant-design/pull/48868) [@wanpan11](https://github.com/wanpan11) + - 🐞 修复 FloatButton.BackTop 抛出 `findDOMNode` 警告的问题。[#48865](https://github.com/ant-design/ant-design/pull/48865) [@wanpan11](https://github.com/wanpan11) +- 💄 给 Drawer 的内部组件 Spin 添加 className,防止内部 Spin 样式覆盖用户传入的 Spin 样式。[#48857](https://github.com/ant-design/ant-design/pull/48857) [@li-jia-nan](https://github.com/li-jia-nan) +- 💄 修复 Card `size="small"` 时下边框丢失的问题。[#48787](https://github.com/ant-design/ant-design/pull/48787) [@wanpan11](https://github.com/wanpan11) +- 🐞 AutoComplete 修复 `tagRender` 对 maxTag 无效的问题和点击边缘会触发弹层意外关闭的问题。[#48798](https://github.com/ant-design/ant-design/pull/48798) +- RTL + - 💄 修复 Button 在 RTL 下的图标顺序和边距缺失问题。[#48821](https://github.com/ant-design/ant-design/pull/48821) +- TypeScript + - 🤖 修复 Cascader 多余泛型问题。[#48879](https://github.com/ant-design/ant-design/pull/48879) [@crazyair](https://github.com/crazyair) + ## 5.17.0 `2024-05-03` diff --git a/components/button/style/index.ts b/components/button/style/index.ts index cebb13772e..0565b57853 100644 --- a/components/button/style/index.ts +++ b/components/button/style/index.ts @@ -359,7 +359,7 @@ const genTextButtonStyle: GenerateStyle = (token) => ({ }, { color: token.colorErrorHover, - background: token.colorErrorBg, + background: token.colorErrorBgActive, }, ), }, diff --git a/components/cascader/Panel.tsx b/components/cascader/Panel.tsx index 71cfe1742b..68db70def4 100644 --- a/components/cascader/Panel.tsx +++ b/components/cascader/Panel.tsx @@ -21,11 +21,17 @@ export type CascaderPanelProps< Multiple extends boolean = false, > = Pick, PanelPickType>; +export type CascaderPanelAutoProps< + OptionType extends DefaultOptionType = DefaultOptionType, + ValueField extends keyof OptionType = keyof OptionType, +> = + | CascaderPanelProps + | (CascaderPanelProps & { multiple: true }); + function CascaderPanel< OptionType extends DefaultOptionType = DefaultOptionType, ValueField extends keyof OptionType = keyof OptionType, - Multiple extends boolean = false, ->(props: CascaderPanelProps) { +>(props: CascaderPanelAutoProps) { const { prefixCls: customizePrefixCls, className, diff --git a/components/cascader/__tests__/type.test.tsx b/components/cascader/__tests__/type.test.tsx index e7e812420d..e876dcb5ae 100644 --- a/components/cascader/__tests__/type.test.tsx +++ b/components/cascader/__tests__/type.test.tsx @@ -1,8 +1,9 @@ import * as React from 'react'; -import type { BaseOptionType } from '..'; +import type { BaseOptionType, CascaderAutoProps } from '..'; import Cascader from '..'; import { render } from '../../../tests/utils'; +import type { CascaderPanelAutoProps } from '../Panel'; describe('Cascader.typescript', () => { it('options value', () => { @@ -88,4 +89,17 @@ describe('Cascader.typescript', () => { const { container } = render( values} />); expect(container).toBeTruthy(); }); + it('props', () => { + const list: { props?: CascaderAutoProps }[] = [ + { props: { multiple: true, onChange: (value) => value } }, + { props: { multiple: false, onChange: (value) => value } }, + ]; + expect(list).toBeTruthy(); + + const list2: { props?: CascaderPanelAutoProps }[] = [ + { props: { multiple: true, onChange: (value) => value } }, + { props: { multiple: false, onChange: (value) => value } }, + ]; + expect(list2).toBeTruthy(); + }); }); diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 3a0ebf5500..c3537359d6 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -135,6 +135,12 @@ export interface CascaderProps< */ variant?: Variant; } +export type CascaderAutoProps< + OptionType extends DefaultOptionType = DefaultOptionType, + ValueField extends keyof OptionType = keyof OptionType, +> = + | CascaderProps + | (CascaderProps & { multiple: true }); export interface CascaderRef { focus: () => void; @@ -348,9 +354,8 @@ const Cascader = React.forwardRef>((props, ref) }) as unknown as (< OptionType extends DefaultOptionType = DefaultOptionType, ValueField extends keyof OptionType = keyof OptionType, - Multiple extends boolean = false, >( - props: React.PropsWithChildren> & + props: React.PropsWithChildren> & React.RefAttributes, ) => React.ReactElement) & { displayName: string; diff --git a/components/index.ts b/components/index.ts index c1f5f82764..11188036cc 100644 --- a/components/index.ts +++ b/components/index.ts @@ -27,7 +27,8 @@ export type { CardProps } from './card'; export { default as Carousel } from './carousel'; export type { CarouselProps } from './carousel'; export { default as Cascader } from './cascader'; -export type { CascaderProps } from './cascader'; +export type { CascaderProps, CascaderAutoProps } from './cascader'; +export type { CascaderPanelProps, CascaderPanelAutoProps } from './cascader/Panel'; export { default as Checkbox } from './checkbox'; export type { CheckboxOptionType, CheckboxProps, CheckboxRef } from './checkbox'; export { default as Col } from './col'; diff --git a/components/theme/__tests__/token.test.tsx b/components/theme/__tests__/token.test.tsx index affa211abe..e74b76c46c 100644 --- a/components/theme/__tests__/token.test.tsx +++ b/components/theme/__tests__/token.test.tsx @@ -5,8 +5,8 @@ import theme from '..'; import { render, renderHook } from '../../../tests/utils'; import ConfigProvider from '../../config-provider'; import type { ThemeConfig } from '../../config-provider/context'; +import Input from '../../input'; import Row from '../../row'; -import Slider from '../../slider'; import genRadius from '../themes/shared/genRadius'; const { useToken } = theme; @@ -314,30 +314,24 @@ describe('Theme', () => { - + ); const { container, rerender } = render(); - expect(container.querySelector('.ant-slider-track')).toHaveStyle({ - 'background-color': '#91caff', - }); + expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#4096ff' }); rerender(); - expect(container.querySelector('.ant-slider-track')).toHaveStyle({ - 'background-color': '#6ce0a4', - }); + expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#20c77c' }); rerender(); - expect(container.querySelector('.ant-slider-track')).toHaveStyle({ - 'background-color': '#0e462e', - }); + expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#1fb572' }); }); }); diff --git a/components/theme/interface/maps/colors.ts b/components/theme/interface/maps/colors.ts index 659209d8df..06e4019030 100644 --- a/components/theme/interface/maps/colors.ts +++ b/components/theme/interface/maps/colors.ts @@ -476,6 +476,14 @@ interface ColorErrorMapToken { */ colorErrorBgHover: string; // 2 + /** + * @nameZH 错误色的浅色背景色激活态 + * @nameEN Error background color active state + * @desc 错误色的浅色背景色激活态 + * @descEN The active state background color of the error state. + */ + colorErrorBgActive: string; // 3 + /** * @nameZH 错误色的描边色 * @nameEN Error border color diff --git a/components/theme/themes/shared/genColorMapToken.ts b/components/theme/themes/shared/genColorMapToken.ts index df18501f8d..9c1a6813d1 100644 --- a/components/theme/themes/shared/genColorMapToken.ts +++ b/components/theme/themes/shared/genColorMapToken.ts @@ -60,6 +60,7 @@ export default function genColorMapToken( colorErrorBg: errorColors[1], colorErrorBgHover: errorColors[2], + colorErrorBgActive: errorColors[3], colorErrorBorder: errorColors[3], colorErrorBorderHover: errorColors[4], colorErrorHover: errorColors[5], diff --git a/components/tooltip/style/index.ts b/components/tooltip/style/index.ts index 7063b2d253..3019f4ec35 100644 --- a/components/tooltip/style/index.ts +++ b/components/tooltip/style/index.ts @@ -61,7 +61,7 @@ const genTooltipStyle: GenerateStyle = (token) => { // Wrapper for the tooltip content [`${componentCls}-inner`]: { - minWidth: controlHeight, + minWidth: '1em', minHeight: controlHeight, padding: `${unit(token.calc(paddingSM).div(2).equal())} ${unit(paddingXS)}`, color: tooltipColor, diff --git a/package.json b/package.json index 4efd0a7e69..fd8e7d2f58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "5.17.0", + "version": "5.17.1", "description": "An enterprise-class UI design language and React components implementation", "keywords": [ "ant",