Merge branch 'master' into fix/duplicate-style-tags

This commit is contained in:
🏎️ Imer 2024-12-06 13:56:00 +08:00 committed by GitHub
commit 74729a6998
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 105 additions and 86 deletions

View File

@ -243,7 +243,7 @@ const Overview: React.FC = () => {
{cardContent} {cardContent}
</a> </a>
) : ( ) : (
<Link to={url} prefetch key={component.title}> <Link to={url} key={component.title}>
{cardContent} {cardContent}
</Link> </Link>
); );

View File

@ -1,4 +1,4 @@
import React, { useContext } from 'react'; import React, { Suspense, useContext } from 'react';
import { BugOutlined, CodeOutlined, ExperimentOutlined } from '@ant-design/icons'; import { BugOutlined, CodeOutlined, ExperimentOutlined } from '@ant-design/icons';
import { ConfigProvider, Tooltip, Button } from 'antd'; import { ConfigProvider, Tooltip, Button } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
@ -113,7 +113,9 @@ const DemoWrapper: typeof DumiDemoGrid = ({ items }) => {
</Tooltip> </Tooltip>
</span> </span>
<ConfigProvider theme={{ cssVar: enableCssVar, hashed: !enableCssVar }}> <ConfigProvider theme={{ cssVar: enableCssVar, hashed: !enableCssVar }}>
<DumiDemoGrid items={demos} /> <Suspense>
<DumiDemoGrid items={demos} />
</Suspense>
</ConfigProvider> </ConfigProvider>
</div> </div>
); );

View File

@ -1,7 +1,6 @@
import type { MouseEvent, MouseEventHandler } from 'react'; import type { MouseEventHandler } from 'react';
import React, { forwardRef, useLayoutEffect, useTransition } from 'react'; import React from 'react';
import { Link as DumiLink, useLocation, useNavigate } from 'dumi'; import { Link as DumiLink } from 'dumi';
import nprogress from 'nprogress';
export interface LinkProps { export interface LinkProps {
to: string | { pathname?: string; search?: string; hash?: string }; to: string | { pathname?: string; search?: string; hash?: string };
@ -9,64 +8,9 @@ export interface LinkProps {
className?: string; className?: string;
onClick?: MouseEventHandler; onClick?: MouseEventHandler;
component?: React.ComponentType<any>; component?: React.ComponentType<any>;
children?: React.ReactNode;
} }
nprogress.configure({ showSpinner: false }); const Link: React.FC<LinkProps> = (props) => <DumiLink {...props} prefetch />;
const Link = forwardRef<HTMLAnchorElement, React.PropsWithChildren<LinkProps>>((props, ref) => {
const { to, children, component, ...rest } = props;
const [isPending, startTransition] = useTransition();
const navigate = useNavigate();
const { pathname } = useLocation();
const href = React.useMemo<string>(() => {
if (typeof to === 'object') {
return `${to.pathname || pathname}${to.search || ''}${to.hash || ''}`;
}
return to;
}, [to]);
const handleClick = (e: MouseEvent<HTMLAnchorElement>) => {
props.onClick?.(e);
if (!href?.startsWith('http')) {
// Should support open in new tab
if (!e.metaKey && !e.ctrlKey && !e.shiftKey) {
e.preventDefault();
startTransition(() => {
if (href) {
navigate(href);
}
});
}
}
};
useLayoutEffect(() => {
if (isPending) {
nprogress.start();
} else {
nprogress.done();
}
}, [isPending]);
if (component) {
return React.createElement(
component,
{
...rest,
ref,
onClick: handleClick,
href,
},
children,
);
}
return (
<DumiLink ref={ref} onClick={handleClick} {...rest} to={href} prefetch>
{children}
</DumiLink>
);
});
export default Link; export default Link;

View File

@ -350,9 +350,8 @@ const GlobalDemoStyles: React.FC = () => {
} }
${antCls}-btn { ${antCls}-btn {
opacity: 0.6;
&.icon-enabled { &.icon-enabled {
background: ${token.colorFillSecondary}; background-color: ${token.colorFillSecondary};
opacity: 1; opacity: 1;
${iconCls} { ${iconCls} {
color: ${token.colorTextBase}; color: ${token.colorTextBase};

View File

@ -9,7 +9,11 @@ import { version } from './package.json';
export default defineConfig({ export default defineConfig({
plugins: ['dumi-plugin-color-chunk'], plugins: ['dumi-plugin-color-chunk'],
// For <Link prefetch />
routePrefetch: {},
manifest: {}, manifest: {},
conventionRoutes: { conventionRoutes: {
// to avoid generate routes for .dumi/pages/index/components/xx // to avoid generate routes for .dumi/pages/index/components/xx
exclude: [/index\/components\//], exclude: [/index\/components\//],

View File

@ -102,7 +102,10 @@ const Group: React.FC<GroupProps> = (props) => {
); );
const childrenWithProps = toArray(children).map((child, index) => const childrenWithProps = toArray(children).map((child, index) =>
cloneElement(child, { key: `avatar-key-${index}` }), cloneElement(child, {
// eslint-disable-next-line react/no-array-index-key
key: `avatar-key-${index}`,
}),
); );
const mergeCount = max?.count || maxCount; const mergeCount = max?.count || maxCount;

View File

@ -199,6 +199,7 @@ const Breadcrumb = <T extends AnyObject = AnyObject>(props: BreadcrumbProps<T>)
const isLastItem = index === childrenLength - 1; const isLastItem = index === childrenLength - 1;
return cloneElement(element, { return cloneElement(element, {
separator: isLastItem ? '' : separator, separator: isLastItem ? '' : separator,
// eslint-disable-next-line react/no-array-index-key
key: index, key: index,
}); });
}); });

View File

@ -1117,6 +1117,7 @@ Array [
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-lg ant-btn-icon-only" class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-lg ant-btn-icon-only"
href="https://www.google.com" href="https://www.google.com"
tabindex="0" tabindex="0"
target="_blank"
> >
<span <span
class="ant-btn-icon" class="ant-btn-icon"
@ -1843,6 +1844,7 @@ exports[`renders components/button/demo/icon.tsx extend context correctly 1`] =
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only" class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only"
href="https://www.google.com" href="https://www.google.com"
tabindex="0" tabindex="0"
target="_blank"
> >
<span <span
class="ant-btn-icon" class="ant-btn-icon"
@ -2271,6 +2273,7 @@ Array [
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only ant-btn-icon-end" class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only ant-btn-icon-end"
href="https://www.google.com" href="https://www.google.com"
tabindex="0" tabindex="0"
target="_blank"
> >
<span <span
class="ant-btn-icon" class="ant-btn-icon"

View File

@ -1022,6 +1022,7 @@ Array [
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-lg ant-btn-icon-only" class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-lg ant-btn-icon-only"
href="https://www.google.com" href="https://www.google.com"
tabindex="0" tabindex="0"
target="_blank"
> >
<span <span
class="ant-btn-icon" class="ant-btn-icon"
@ -1666,6 +1667,7 @@ exports[`renders components/button/demo/icon.tsx correctly 1`] = `
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only" class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only"
href="https://www.google.com" href="https://www.google.com"
tabindex="0" tabindex="0"
target="_blank"
> >
<span <span
class="ant-btn-icon" class="ant-btn-icon"
@ -2016,6 +2018,7 @@ Array [
class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only ant-btn-icon-end" class="ant-btn ant-btn-default ant-btn-color-default ant-btn-variant-outlined ant-btn-icon-only ant-btn-icon-end"
href="https://www.google.com" href="https://www.google.com"
tabindex="0" tabindex="0"
target="_blank"
> >
<span <span
class="ant-btn-icon" class="ant-btn-icon"

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { SearchOutlined, MinusSquareOutlined } from '@ant-design/icons'; import { MinusSquareOutlined, SearchOutlined } from '@ant-design/icons';
import { Button, ConfigProvider, Divider, Flex, Radio, Tooltip } from 'antd'; import { Button, ConfigProvider, Divider, Flex, Radio, Tooltip } from 'antd';
import type { ConfigProviderProps } from 'antd'; import type { ConfigProviderProps } from 'antd';
@ -52,7 +52,7 @@ const App: React.FC = () => {
<Button type="dashed" icon={<SearchOutlined />}> <Button type="dashed" icon={<SearchOutlined />}>
Search Search
</Button> </Button>
<Button icon={<SearchOutlined />} href="https://www.google.com" /> <Button icon={<SearchOutlined />} href="https://www.google.com" target="_blank" />
<Button> <Button>
<SearchOutlined /> <SearchOutlined />
Search Search

View File

@ -47,7 +47,12 @@ const App: React.FC = () => {
<Button type="dashed" icon={<SearchOutlined />} iconPosition={position}> <Button type="dashed" icon={<SearchOutlined />} iconPosition={position}>
Search Search
</Button> </Button>
<Button icon={<SearchOutlined />} href="https://www.google.com" iconPosition={position} /> <Button
icon={<SearchOutlined />}
href="https://www.google.com"
target="_blank"
iconPosition={position}
/>
<Button type="primary" loading iconPosition={position}> <Button type="primary" loading iconPosition={position}>
Loading Loading
</Button> </Button>

View File

@ -30,7 +30,7 @@ const App: React.FC = () => (
<Button type="dashed" icon={<SearchOutlined />}> <Button type="dashed" icon={<SearchOutlined />}>
Search Search
</Button> </Button>
<Button icon={<SearchOutlined />} href="https://www.google.com" /> <Button icon={<SearchOutlined />} href="https://www.google.com" target="_blank" />
</Flex> </Flex>
</Flex> </Flex>
); );

View File

@ -406,7 +406,10 @@ const Page: React.FC<{ placement: Placement }> = ({ placement }) => {
<Rate defaultValue={2.5} /> <Rate defaultValue={2.5} />
<br /> <br />
<strong>* Note:</strong> Half star not implemented in RTL direction, it will be <strong>* Note:</strong> Half star not implemented in RTL direction, it will be
supported after <a href="https://github.com/react-component/rate">rc-rate</a>{' '} supported after{' '}
<a href="https://github.com/react-component/rate" target="_blank" rel="noreferrer">
rc-rate
</a>{' '}
implement rtl support. implement rtl support.
</Col> </Col>
<Col span={12}> <Col span={12}>

View File

@ -4343,6 +4343,8 @@ Array [
</p> </p>
<a <a
href="http://github.com/ant-design/ant-design/" href="http://github.com/ant-design/ant-design/"
rel="noreferrer"
target="_blank"
> >
github.com/ant-design/ant-design/ github.com/ant-design/ant-design/
</a> </a>

View File

@ -135,7 +135,7 @@ const App: React.FC = () => {
<DescriptionItem <DescriptionItem
title="Github" title="Github"
content={ content={
<a href="http://github.com/ant-design/ant-design/"> <a href="http://github.com/ant-design/ant-design/" target="_blank" rel="noreferrer">
github.com/ant-design/ant-design/ github.com/ant-design/ant-design/
</a> </a>
} }

View File

@ -7263,6 +7263,8 @@ Array [
> >
<a <a
href="https://www.antgroup.com" href="https://www.antgroup.com"
rel="noopener noreferrer"
target="_blank"
> >
1st menu item 1st menu item
</a> </a>
@ -7296,6 +7298,8 @@ Array [
> >
<a <a
href="https://www.aliyun.com" href="https://www.aliyun.com"
rel="noopener noreferrer"
target="_blank"
> >
2nd menu item 2nd menu item
</a> </a>

View File

@ -5,11 +5,19 @@ import { Dropdown, Space } from 'antd';
const items: MenuProps['items'] = [ const items: MenuProps['items'] = [
{ {
label: <a href="https://www.antgroup.com">1st menu item</a>, label: (
<a href="https://www.antgroup.com" target="_blank" rel="noopener noreferrer">
1st menu item
</a>
),
key: '0', key: '0',
}, },
{ {
label: <a href="https://www.aliyun.com">2nd menu item</a>, label: (
<a href="https://www.aliyun.com" target="_blank" rel="noopener noreferrer">
2nd menu item
</a>
),
key: '1', key: '1',
}, },
{ {

View File

@ -942,6 +942,8 @@ Array [
> >
<a <a
href="https://github.com/ant-design/ant-design/issues/36459" href="https://github.com/ant-design/ant-design/issues/36459"
rel="noreferrer"
target="_blank"
> >
#36459 #36459
</a> </a>
@ -1376,6 +1378,8 @@ Array [
> >
<a <a
href="https://github.com/ant-design/ant-design/issues/36459" href="https://github.com/ant-design/ant-design/issues/36459"
rel="noreferrer"
target="_blank"
> >
#36459 #36459
</a> </a>

View File

@ -778,6 +778,8 @@ Array [
> >
<a <a
href="https://github.com/ant-design/ant-design/issues/36459" href="https://github.com/ant-design/ant-design/issues/36459"
rel="noreferrer"
target="_blank"
> >
#36459 #36459
</a> </a>
@ -1107,6 +1109,8 @@ Array [
> >
<a <a
href="https://github.com/ant-design/ant-design/issues/36459" href="https://github.com/ant-design/ant-design/issues/36459"
rel="noreferrer"
target="_blank"
> >
#36459 #36459
</a> </a>

View File

@ -3,7 +3,15 @@ import { Button, Divider, Form, Input, Select } from 'antd';
const sharedItem = ( const sharedItem = (
<Form.Item <Form.Item
label={<a href="https://github.com/ant-design/ant-design/issues/36459">#36459</a>} label={
<a
href="https://github.com/ant-design/ant-design/issues/36459"
target="_blank"
rel="noreferrer"
>
#36459
</a>
}
initialValue={['bamboo']} initialValue={['bamboo']}
name="select" name="select"
style={{ boxShadow: '0 0 3px red' }} style={{ boxShadow: '0 0 3px red' }}

View File

@ -41,6 +41,7 @@ const App: React.FC = () => {
<Button <Button
key="link" key="link"
href="https://google.com" href="https://google.com"
target="_blank"
type="primary" type="primary"
loading={loading} loading={loading}
onClick={handleOk} onClick={handleOk}

View File

@ -143,6 +143,8 @@ Array [
> >
<a <a
href="https://github.com/ant-design/ant-design/issues/1862" href="https://github.com/ant-design/ant-design/issues/1862"
rel="noopener noreferrer"
target="_blank"
> >
Link Link
</a> </a>

View File

@ -141,6 +141,8 @@ Array [
> >
<a <a
href="https://github.com/ant-design/ant-design/issues/1862" href="https://github.com/ant-design/ant-design/issues/1862"
rel="noopener noreferrer"
target="_blank"
> >
Link Link
</a> </a>

View File

@ -11,7 +11,13 @@ const App: React.FC = () => (
<> <>
<Tag>Tag 1</Tag> <Tag>Tag 1</Tag>
<Tag> <Tag>
<a href="https://github.com/ant-design/ant-design/issues/1862">Link</a> <a
href="https://github.com/ant-design/ant-design/issues/1862"
target="_blank"
rel="noopener noreferrer"
>
Link
</a>
</Tag> </Tag>
<Tag closeIcon onClose={preventDefault}> <Tag closeIcon onClose={preventDefault}>
Prevent Default Prevent Default

View File

@ -8,10 +8,22 @@ const App: React.FC = () => (
> >
<Flex gap="4px 0" wrap> <Flex gap="4px 0" wrap>
<Tag> <Tag>
<a href="https://github.com/ant-design/ant-design/issues/1862">Link</a> <a
href="https://github.com/ant-design/ant-design/issues/1862"
target="_blank"
rel="noreferrer"
>
Link
</a>
</Tag> </Tag>
<Tag bordered={false}> <Tag bordered={false}>
<a href="https://github.com/ant-design/ant-design/issues/1862">Link</a> <a
href="https://github.com/ant-design/ant-design/issues/1862"
target="_blank"
rel="noreferrer"
>
Link
</a>
</Tag> </Tag>
<Tag closable color="magenta"> <Tag closable color="magenta">
Tag 2 Tag 2

View File

@ -135,12 +135,12 @@
"rc-motion": "^2.9.3", "rc-motion": "^2.9.3",
"rc-notification": "~5.6.2", "rc-notification": "~5.6.2",
"rc-pagination": "~4.3.0", "rc-pagination": "~4.3.0",
"rc-picker": "~4.8.2", "rc-picker": "~4.8.3",
"rc-progress": "~4.0.0", "rc-progress": "~4.0.0",
"rc-rate": "~2.13.0", "rc-rate": "~2.13.0",
"rc-resize-observer": "^1.4.0", "rc-resize-observer": "^1.4.0",
"rc-segmented": "~2.5.0", "rc-segmented": "~2.5.0",
"rc-select": "~14.16.3", "rc-select": "~14.16.4",
"rc-slider": "~11.1.7", "rc-slider": "~11.1.7",
"rc-steps": "~6.0.1", "rc-steps": "~6.0.1",
"rc-switch": "~4.1.0", "rc-switch": "~4.1.0",
@ -165,8 +165,8 @@
"@codecov/webpack-plugin": "^1.2.1", "@codecov/webpack-plugin": "^1.2.1",
"@codesandbox/sandpack-react": "^2.19.9", "@codesandbox/sandpack-react": "^2.19.9",
"@dnd-kit/core": "^6.2.0", "@dnd-kit/core": "^6.2.0",
"@dnd-kit/modifiers": "^8.0.0", "@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^9.0.0", "@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2", "@dnd-kit/utilities": "^3.2.2",
"@emotion/css": "^11.13.4", "@emotion/css": "^11.13.4",
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
@ -201,7 +201,6 @@
"@types/lodash": "^4.17.12", "@types/lodash": "^4.17.12",
"@types/minimist": "^1.2.5", "@types/minimist": "^1.2.5",
"@types/node": "^22.7.7", "@types/node": "^22.7.7",
"@types/nprogress": "^0.2.3",
"@types/pixelmatch": "^5.2.6", "@types/pixelmatch": "^5.2.6",
"@types/pngjs": "^6.0.5", "@types/pngjs": "^6.0.5",
"@types/prismjs": "^1.26.4", "@types/prismjs": "^1.26.4",
@ -237,7 +236,7 @@
"eslint-plugin-compat": "^6.0.1", "eslint-plugin-compat": "^6.0.1",
"eslint-plugin-jest": "^28.8.3", "eslint-plugin-jest": "^28.8.3",
"eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-hooks": "5.0.0",
"eslint-plugin-react-refresh": "^0.4.13", "eslint-plugin-react-refresh": "^0.4.13",
"fast-glob": "^3.3.2", "fast-glob": "^3.3.2",
"fetch-jsonp": "^1.3.0", "fetch-jsonp": "^1.3.0",
@ -270,7 +269,6 @@
"mockdate": "^3.0.5", "mockdate": "^3.0.5",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
"node-notifier": "^10.0.1", "node-notifier": "^10.0.1",
"nprogress": "^0.2.0",
"open": "^10.1.0", "open": "^10.1.0",
"ora": "^8.1.0", "ora": "^8.1.0",
"p-all": "^5.0.0", "p-all": "^5.0.0",

View File

@ -120,6 +120,7 @@ type Options = {
export default function accessibilityDemoTest(component: string, options: Options = {}) { export default function accessibilityDemoTest(component: string, options: Options = {}) {
// If skip is true, return immediately without executing any tests // If skip is true, return immediately without executing any tests
if (options.skip === true) { if (options.skip === true) {
// eslint-disable-next-line jest/no-disabled-tests
describe.skip(`${component} demo a11y`, () => { describe.skip(`${component} demo a11y`, () => {
it('skipped', () => {}); it('skipped', () => {});
}); });