diff --git a/.dumi/theme/builtins/ComponentOverview/index.tsx b/.dumi/theme/builtins/ComponentOverview/index.tsx index 6b12828c7e..ad02ce28e5 100644 --- a/.dumi/theme/builtins/ComponentOverview/index.tsx +++ b/.dumi/theme/builtins/ComponentOverview/index.tsx @@ -243,7 +243,7 @@ const Overview: React.FC = () => { {cardContent} ) : ( - + {cardContent} ); diff --git a/.dumi/theme/builtins/DemoWrapper/index.tsx b/.dumi/theme/builtins/DemoWrapper/index.tsx index dd6f1919a1..5f408be6cc 100644 --- a/.dumi/theme/builtins/DemoWrapper/index.tsx +++ b/.dumi/theme/builtins/DemoWrapper/index.tsx @@ -1,4 +1,4 @@ -import React, { useContext } from 'react'; +import React, { Suspense, useContext } from 'react'; import { BugOutlined, CodeOutlined, ExperimentOutlined } from '@ant-design/icons'; import { ConfigProvider, Tooltip, Button } from 'antd'; import classNames from 'classnames'; @@ -113,7 +113,9 @@ const DemoWrapper: typeof DumiDemoGrid = ({ items }) => { - + + + ); diff --git a/.dumi/theme/common/Link.tsx b/.dumi/theme/common/Link.tsx index 9cfea27292..bccbbc1547 100644 --- a/.dumi/theme/common/Link.tsx +++ b/.dumi/theme/common/Link.tsx @@ -1,7 +1,6 @@ -import type { MouseEvent, MouseEventHandler } from 'react'; -import React, { forwardRef, useLayoutEffect, useTransition } from 'react'; -import { Link as DumiLink, useLocation, useNavigate } from 'dumi'; -import nprogress from 'nprogress'; +import type { MouseEventHandler } from 'react'; +import React from 'react'; +import { Link as DumiLink } from 'dumi'; export interface LinkProps { to: string | { pathname?: string; search?: string; hash?: string }; @@ -9,64 +8,9 @@ export interface LinkProps { className?: string; onClick?: MouseEventHandler; component?: React.ComponentType; + children?: React.ReactNode; } -nprogress.configure({ showSpinner: false }); - -const Link = forwardRef>((props, ref) => { - const { to, children, component, ...rest } = props; - const [isPending, startTransition] = useTransition(); - const navigate = useNavigate(); - const { pathname } = useLocation(); - - const href = React.useMemo(() => { - if (typeof to === 'object') { - return `${to.pathname || pathname}${to.search || ''}${to.hash || ''}`; - } - return to; - }, [to]); - - const handleClick = (e: MouseEvent) => { - 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 ( - - {children} - - ); -}); +const Link: React.FC = (props) => ; export default Link; diff --git a/.dumi/theme/common/styles/Demo.tsx b/.dumi/theme/common/styles/Demo.tsx index 912bd88afb..d738b76aab 100644 --- a/.dumi/theme/common/styles/Demo.tsx +++ b/.dumi/theme/common/styles/Demo.tsx @@ -350,9 +350,8 @@ const GlobalDemoStyles: React.FC = () => { } ${antCls}-btn { - opacity: 0.6; &.icon-enabled { - background: ${token.colorFillSecondary}; + background-color: ${token.colorFillSecondary}; opacity: 1; ${iconCls} { color: ${token.colorTextBase}; diff --git a/.dumirc.ts b/.dumirc.ts index a440e99ef3..57672e5d8e 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -9,7 +9,11 @@ import { version } from './package.json'; export default defineConfig({ plugins: ['dumi-plugin-color-chunk'], + + // For + routePrefetch: {}, manifest: {}, + conventionRoutes: { // to avoid generate routes for .dumi/pages/index/components/xx exclude: [/index\/components\//], diff --git a/components/avatar/group.tsx b/components/avatar/group.tsx index cccae8c40d..34fc2ee5ed 100644 --- a/components/avatar/group.tsx +++ b/components/avatar/group.tsx @@ -102,7 +102,10 @@ const Group: React.FC = (props) => { ); 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; diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 049892e2a9..f23106db56 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -199,6 +199,7 @@ const Breadcrumb = (props: BreadcrumbProps) const isLastItem = index === childrenLength - 1; return cloneElement(element, { separator: isLastItem ? '' : separator, + // eslint-disable-next-line react/no-array-index-key key: index, }); }); diff --git a/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap index ed0420ec52..33cde627cb 100644 --- a/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -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" href="https://www.google.com" tabindex="0" + target="_blank" > { - - diff --git a/components/button/demo/icon.tsx b/components/button/demo/icon.tsx index d6b0695024..10ca156140 100644 --- a/components/button/demo/icon.tsx +++ b/components/button/demo/icon.tsx @@ -30,7 +30,7 @@ const App: React.FC = () => ( -