Skip to content

Commit

Permalink
Merge branch 'master' into a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
aojunhao123 authored Jan 27, 2025
2 parents f60a448 + 8d21f1c commit a4eccc1
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 32 deletions.
3 changes: 2 additions & 1 deletion components/_util/wave/WaveEffect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import CSSMotion from 'rc-motion';
import raf from 'rc-util/lib/raf';
import { composeRef } from 'rc-util/lib/ref';

import { getReactRender, type UnmountType } from '../../config-provider/UnstableContext';
import { getReactRender } from '../../config-provider/UnstableContext';
import type { UnmountType } from '../../config-provider/UnstableContext';
import { TARGET_CLS } from './interface';
import type { ShowWaveEffect } from './interface';
import { getTargetWaveColor } from './util';
Expand Down
4 changes: 4 additions & 0 deletions components/auto-complete/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,19 @@ Common props ref:[Common props](/docs/react/common-props)
| options | Select options. Will get better perf than jsx definition | { label, value }\[] | - | |
| placeholder | The placeholder of input | string | - | |
| status | Set validation status | 'error' \| 'warning' | - | 4.19.0 |
| size | The size of the input box | `large` \| `middle` \| `small` | - | |
| value | Selected option | string | - | |
| variant | Variants of input | `outlined` \| `borderless` \| `filled` | `outlined` | 5.13.0 |
| virtual | Disable virtual scroll when set to false | boolean | true | 4.1.0 |
| onBlur | Called when leaving the component | function() | - | |
| onChange | Called when selecting an option or changing an input value | function(value) | - | |
| onDropdownVisibleChange | Call when dropdown open | function(open) | - | |
| onFocus | Called when entering the component | function() | - | |
| onSearch | Called when searching items | function(value) | - | |
| onSelect | Called when a option is selected. param is option's value and option instance | function(value, option) | - | |
| onClear | Called when clear | function | - | 4.6.0 |
| onInputKeyDown | Called when key pressed | (event: KeyboardEvent) => void | - | |
| onPopupScroll | Called when dropdown scrolls | (event: UIEvent) => void | - | |

## Methods

Expand Down
4 changes: 4 additions & 0 deletions components/auto-complete/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,19 @@ demo:
| options | 数据化配置选项内容,相比 jsx 定义会获得更好的渲染性能 | { label, value }\[] | - | |
| placeholder | 输入框提示 | string | - | |
| status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 |
| size | 控件大小 | `large` \| `middle` \| `small` | - | |
| value | 指定当前选中的条目 | string | - | |
| variant | 形态变体 | `outlined` \| `borderless` \| `filled` | `outlined` | 5.13.0 |
| virtual | 设置 false 时关闭虚拟滚动 | boolean | true | 4.1.0 |
| onBlur | 失去焦点时的回调 | function() | - | |
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | - | |
| onDropdownVisibleChange | 展开下拉菜单的回调 | function(open) | - | |
| onFocus | 获得焦点时的回调 | function() | - | |
| onSearch | 搜索补全项的时候调用 | function(value) | - | |
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | - | |
| onClear | 清除内容时的回调 | function | - | 4.6.0 |
| onInputKeyDown | 按键按下时回调 | (event: KeyboardEvent) => void | - | |
| onPopupScroll | 下拉列表滚动时的回调 | (event: UIEvent) => void | - | |

## 方法

Expand Down
22 changes: 10 additions & 12 deletions components/button/button-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ const ButtonGroup: React.FC<ButtonGroupProps> = (props) => {

const [, , hashId] = useToken();

let sizeCls = '';

switch (size) {
case 'large':
sizeCls = 'lg';
break;
case 'small':
sizeCls = 'sm';
break;
default:
// Do nothing
}
const sizeCls = React.useMemo<string>(() => {
switch (size) {
case 'large':
return 'lg';
case 'small':
return 'sm';
default:
return '';
}
}, [size]);

if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Button.Group');
Expand Down
7 changes: 4 additions & 3 deletions components/qr-code/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, type AriaAttributes } from 'react';
import React, { useContext } from 'react';
import { QRCodeCanvas, QRCodeSVG } from '@rc-component/qrcode';
import classNames from 'classnames';
import omit from 'rc-util/lib/omit';
Expand Down Expand Up @@ -50,9 +50,10 @@ const QRCode: React.FC<QRCodeProps> = (props) => {
};

const a11yProps = pickAttrs(rest, true);
const restProps = omit<React.HTMLAttributes<HTMLDivElement>, keyof AriaAttributes>(

const restProps = omit<React.HTMLAttributes<HTMLDivElement>, keyof React.AriaAttributes>(
rest,
Object.keys(a11yProps) as Array<keyof AriaAttributes>,
Object.keys(a11yProps) as (keyof React.AriaAttributes)[],
);

const qrCodeProps = {
Expand Down
26 changes: 17 additions & 9 deletions components/space/Compact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ export const useCompactItemContext = (prefixCls: string, direction: DirectionTyp
};
};

export const NoCompactStyle: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
<SpaceCompactItemContext.Provider value={null}>{children}</SpaceCompactItemContext.Provider>
);
export const NoCompactStyle: React.FC<Readonly<React.PropsWithChildren>> = (props) => {
const { children } = props;
return (
<SpaceCompactItemContext.Provider value={null}>{children}</SpaceCompactItemContext.Provider>
);
};

export interface SpaceCompactProps extends React.HTMLAttributes<HTMLDivElement> {
prefixCls?: string;
Expand All @@ -55,12 +58,16 @@ export interface SpaceCompactProps extends React.HTMLAttributes<HTMLDivElement>
rootClassName?: string;
}

const CompactItem: React.FC<React.PropsWithChildren<SpaceCompactItemContextType>> = ({
children,
...otherProps
}) => (
<SpaceCompactItemContext.Provider value={otherProps}>{children}</SpaceCompactItemContext.Provider>
);
const CompactItem: React.FC<React.PropsWithChildren<SpaceCompactItemContextType>> = (props) => {
const { children, ...others } = props;
return (
<SpaceCompactItemContext.Provider
value={React.useMemo<SpaceCompactItemContextType>(() => others, [others])}
>
{children}
</SpaceCompactItemContext.Provider>
);
};

const Compact: React.FC<SpaceCompactProps> = (props) => {
const { getPrefixCls, direction: directionConfig } = React.useContext(ConfigContext);
Expand Down Expand Up @@ -95,6 +102,7 @@ const Compact: React.FC<SpaceCompactProps> = (props) => {
const compactItemContext = React.useContext(SpaceCompactItemContext);

const childNodes = toArray(children);

const nodes = React.useMemo(
() =>
childNodes.map((child, i) => {
Expand Down
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"@ant-design/happy-work-theme": "^1.0.0",
"@ant-design/tools": "^18.0.3",
"@ant-design/v5-patch-for-react-19": "^1.0.2",
"@antfu/eslint-config": "^3.11.2",
"@antfu/eslint-config": "^4.0.0",
"@antv/g6": "^4.8.24",
"@biomejs/biome": "^1.9.4",
"@codecov/webpack-plugin": "^1.4.0",
Expand Down Expand Up @@ -348,11 +348,5 @@
"title": "Ant Design",
"tnpm": {
"mode": "npm"
},
"overrides": {
"react-intl": "7.0.4"
},
"resolutions": {
"react-intl": "7.0.4"
}
}
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function addPluginsForProduction(config) {
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: 'antd.min',
uploadToken: process.env.CODECOV_TOKEN,
gitService: "github",
}),
new CircularDependencyPlugin({
failOnError: true,
Expand Down

0 comments on commit a4eccc1

Please sign in to comment.