diff --git a/.dumi/hooks/useLocation.ts b/.dumi/hooks/useLocation.ts index 3499a3bbe2..d978cc4a08 100644 --- a/.dumi/hooks/useLocation.ts +++ b/.dumi/hooks/useLocation.ts @@ -1,5 +1,5 @@ import { useLocation as useDumiLocation } from 'dumi'; -import * as React from 'react'; +import React from 'react'; import useLocale from './useLocale'; function clearPath(path: string) { diff --git a/.dumi/pages/index/components/Banner.tsx b/.dumi/pages/index/components/Banner.tsx index 781a09da45..d7b0b87fce 100644 --- a/.dumi/pages/index/components/Banner.tsx +++ b/.dumi/pages/index/components/Banner.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/react'; import { Button, Space, Typography } from 'antd'; import { Link, useLocation } from 'dumi'; -import * as React from 'react'; +import React from 'react'; import useLocale from '../../../hooks/useLocale'; import useSiteToken from '../../../hooks/useSiteToken'; import SiteContext from '../../../theme/slots/SiteContext'; diff --git a/.dumi/pages/index/components/BannerRecommends.tsx b/.dumi/pages/index/components/BannerRecommends.tsx index 6b50968b83..b33a1810a9 100644 --- a/.dumi/pages/index/components/BannerRecommends.tsx +++ b/.dumi/pages/index/components/BannerRecommends.tsx @@ -1,10 +1,10 @@ -import * as React from 'react'; -import { Typography, Skeleton, Carousel } from 'antd'; import type { SerializedStyles } from '@emotion/react'; import { css } from '@emotion/react'; -import type { Extra, Icon } from './util'; +import { Carousel, Skeleton, Typography } from 'antd'; +import React from 'react'; import useSiteToken from '../../../hooks/useSiteToken'; import SiteContext from '../../../theme/slots/SiteContext'; +import type { Extra, Icon } from './util'; import { useCarouselStyle } from './util'; const useStyle = () => { diff --git a/.dumi/pages/index/components/Group.tsx b/.dumi/pages/index/components/Group.tsx index 8fa8ce059c..4e188657a4 100644 --- a/.dumi/pages/index/components/Group.tsx +++ b/.dumi/pages/index/components/Group.tsx @@ -1,6 +1,5 @@ -import * as React from 'react'; -import { useContext } from 'react'; import { Typography } from 'antd'; +import React, { useContext } from 'react'; import useSiteToken from '../../../hooks/useSiteToken'; import SiteContext from '../../../theme/slots/SiteContext'; diff --git a/.dumi/pages/index/components/RecommendsOld.tsx b/.dumi/pages/index/components/RecommendsOld.tsx index 0a04a5559a..22f2f775e1 100644 --- a/.dumi/pages/index/components/RecommendsOld.tsx +++ b/.dumi/pages/index/components/RecommendsOld.tsx @@ -1,8 +1,8 @@ -import * as React from 'react'; -import { Row, Col, Typography } from 'antd'; import { css } from '@emotion/react'; -import type { Recommendation } from './util'; +import { Col, Row, Typography } from 'antd'; +import React from 'react'; import useSiteToken from '../../../hooks/useSiteToken'; +import type { Recommendation } from './util'; const useStyle = () => { const { token } = useSiteToken(); @@ -77,7 +77,7 @@ export interface RecommendsProps { recommendations?: Recommendation[]; } -export default function Recommends({ recommendations = [] }: RecommendsProps) { +const Recommends: React.FC = ({ recommendations = [] }) => { const { token } = useSiteToken(); const style = useStyle(); @@ -101,4 +101,6 @@ export default function Recommends({ recommendations = [] }: RecommendsProps) { })} ); -} +}; + +export default Recommends; diff --git a/.dumi/pages/index/components/SiteContext.ts b/.dumi/pages/index/components/SiteContext.ts index 9767a89b50..d41e57d9c4 100644 --- a/.dumi/pages/index/components/SiteContext.ts +++ b/.dumi/pages/index/components/SiteContext.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface SiteContextProps { isMobile: boolean; diff --git a/.dumi/pages/index/components/Theme/MobileCarousel.tsx b/.dumi/pages/index/components/Theme/MobileCarousel.tsx index 12fdeae6d4..1155171535 100644 --- a/.dumi/pages/index/components/Theme/MobileCarousel.tsx +++ b/.dumi/pages/index/components/Theme/MobileCarousel.tsx @@ -1,9 +1,8 @@ -import * as React from 'react'; -import { useState } from 'react'; import { css } from '@emotion/react'; -import { Typography, Carousel } from 'antd'; -import { useCarouselStyle } from '../util'; +import { Carousel, Typography } from 'antd'; +import React, { useState } from 'react'; import useSiteToken from '../../../../hooks/useSiteToken'; +import { useCarouselStyle } from '../util'; const useStyle = () => { const { carousel } = useCarouselStyle(); diff --git a/.dumi/pages/index/components/Theme/ThemePicker.tsx b/.dumi/pages/index/components/Theme/ThemePicker.tsx index b9fa6e7443..7699b59594 100644 --- a/.dumi/pages/index/components/Theme/ThemePicker.tsx +++ b/.dumi/pages/index/components/Theme/ThemePicker.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/react'; import { Space } from 'antd'; -import * as React from 'react'; +import React from 'react'; import useSiteToken from '../../../../hooks/useSiteToken'; import useLocale from '../../../../hooks/useLocale'; diff --git a/.dumi/pages/index/components/Theme/index.tsx b/.dumi/pages/index/components/Theme/index.tsx index 119b7f11a3..7ee4646ee7 100644 --- a/.dumi/pages/index/components/Theme/index.tsx +++ b/.dumi/pages/index/components/Theme/index.tsx @@ -1,12 +1,11 @@ -import * as React from 'react'; -import { css } from '@emotion/react'; -import { TinyColor } from '@ctrl/tinycolor'; import { BellOutlined, FolderOutlined, HomeOutlined, QuestionCircleOutlined, } from '@ant-design/icons'; +import { TinyColor } from '@ctrl/tinycolor'; +import { css } from '@emotion/react'; import type { MenuProps } from 'antd'; import { Breadcrumb, @@ -18,21 +17,22 @@ import { Menu, Radio, Space, - theme, Typography, + theme, } from 'antd'; +import React from 'react'; import useLocale from '../../../../hooks/useLocale'; import useSiteToken from '../../../../hooks/useSiteToken'; +import SiteContext from '../../../../theme/slots/SiteContext'; +import Group from '../Group'; +import { useCarouselStyle } from '../util'; +import BackgroundImage from './BackgroundImage'; +import ColorPicker from './ColorPicker'; +import MobileCarousel from './MobileCarousel'; +import RadiusPicker from './RadiusPicker'; import type { THEME } from './ThemePicker'; import ThemePicker from './ThemePicker'; -import ColorPicker from './ColorPicker'; -import RadiusPicker from './RadiusPicker'; -import Group from '../Group'; -import BackgroundImage from './BackgroundImage'; -import { DEFAULT_COLOR, getAvatarURL, getClosetColor, PINK_COLOR } from './colorUtil'; -import SiteContext from '../../../../theme/slots/SiteContext'; -import { useCarouselStyle } from '../util'; -import MobileCarousel from './MobileCarousel'; +import { DEFAULT_COLOR, PINK_COLOR, getAvatarURL, getClosetColor } from './colorUtil'; const { Header, Content, Sider } = Layout; diff --git a/.dumi/pages/index/components/util.ts b/.dumi/pages/index/components/util.ts index 67921644f1..727322640e 100644 --- a/.dumi/pages/index/components/util.ts +++ b/.dumi/pages/index/components/util.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { css } from '@emotion/react'; export interface Author { diff --git a/.dumi/theme/builtins/ColorChunk/index.tsx b/.dumi/theme/builtins/ColorChunk/index.tsx index 5ec1bdd2e3..720c4f5e78 100644 --- a/.dumi/theme/builtins/ColorChunk/index.tsx +++ b/.dumi/theme/builtins/ColorChunk/index.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { TinyColor, type ColorInput } from '@ctrl/tinycolor'; import { css } from '@emotion/react'; import useSiteToken from '../../../hooks/useSiteToken'; diff --git a/.dumi/theme/builtins/IconSearch/Category.tsx b/.dumi/theme/builtins/IconSearch/Category.tsx index f697fa01a6..d675a1dac1 100644 --- a/.dumi/theme/builtins/IconSearch/Category.tsx +++ b/.dumi/theme/builtins/IconSearch/Category.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { message } from 'antd'; import { useIntl } from 'dumi'; import CopyableIcon from './CopyableIcon'; diff --git a/.dumi/theme/builtins/IconSearch/CopyableIcon.tsx b/.dumi/theme/builtins/IconSearch/CopyableIcon.tsx index 4563192391..76dcdf67cb 100644 --- a/.dumi/theme/builtins/IconSearch/CopyableIcon.tsx +++ b/.dumi/theme/builtins/IconSearch/CopyableIcon.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import CopyToClipboard from 'react-copy-to-clipboard'; import { Badge, message } from 'antd'; import classNames from 'classnames'; diff --git a/.dumi/theme/builtins/IconSearch/themeIcons.tsx b/.dumi/theme/builtins/IconSearch/themeIcons.tsx index 892a95dd29..879a26742d 100644 --- a/.dumi/theme/builtins/IconSearch/themeIcons.tsx +++ b/.dumi/theme/builtins/IconSearch/themeIcons.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { CustomIconComponentProps } from '@ant-design/icons/es/components/Icon'; type CustomIconComponent = React.ComponentType< diff --git a/.dumi/theme/builtins/ResourceArticles/index.tsx b/.dumi/theme/builtins/ResourceArticles/index.tsx index 4fafbcf46a..7e74bc08f4 100644 --- a/.dumi/theme/builtins/ResourceArticles/index.tsx +++ b/.dumi/theme/builtins/ResourceArticles/index.tsx @@ -1,5 +1,5 @@ /* eslint-disable react/no-array-index-key */ -import * as React from 'react'; +import React from 'react'; import dayjs from 'dayjs'; import { FormattedMessage, useIntl } from 'dumi'; import { Tabs, Skeleton, Avatar, Divider, Empty } from 'antd'; diff --git a/.dumi/theme/builtins/TokenTable/index.tsx b/.dumi/theme/builtins/TokenTable/index.tsx index 3c2b17d685..d3c0b90c96 100644 --- a/.dumi/theme/builtins/TokenTable/index.tsx +++ b/.dumi/theme/builtins/TokenTable/index.tsx @@ -1,5 +1,5 @@ import type { FC } from 'react'; -import * as React from 'react'; +import React from 'react'; /* eslint import/no-unresolved: 0 */ import { css } from '@emotion/react'; import type { TableProps } from 'antd'; diff --git a/.dumi/theme/common/Helmet.tsx b/.dumi/theme/common/Helmet.tsx index 4bc99ec82c..a675569113 100644 --- a/.dumi/theme/common/Helmet.tsx +++ b/.dumi/theme/common/Helmet.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import { Helmet } from 'dumi'; +import React from 'react'; type HelmetProps = Helmet['props']; export interface WrapHelmetProps extends HelmetProps { diff --git a/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx b/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx index 5fc69f312b..d19972204e 100644 --- a/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx +++ b/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/react'; import { Tabs } from 'antd'; import throttle from 'lodash/throttle'; -import * as React from 'react'; +import React from 'react'; import scrollTo from '../../../../components/_util/scrollTo'; import useSiteToken from '../../../hooks/useSiteToken'; diff --git a/.dumi/theme/slots/Footer/AdditionalInfo.tsx b/.dumi/theme/slots/Footer/AdditionalInfo.tsx index 447b4be308..48c9b4a171 100644 --- a/.dumi/theme/slots/Footer/AdditionalInfo.tsx +++ b/.dumi/theme/slots/Footer/AdditionalInfo.tsx @@ -1,5 +1,5 @@ import { removeCSS, updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; -import * as React from 'react'; +import React from 'react'; import useLocale from '../../../hooks/useLocale'; const whereCls = 'ant-where-checker'; diff --git a/.dumi/theme/slots/Header/Logo.tsx b/.dumi/theme/slots/Header/Logo.tsx index ac5cfa2dcf..ae43b2a211 100644 --- a/.dumi/theme/slots/Header/Logo.tsx +++ b/.dumi/theme/slots/Header/Logo.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/react'; import { Link, useLocation } from 'dumi'; -import * as React from 'react'; +import React from 'react'; import useSiteToken from '../../../hooks/useSiteToken'; import * as utils from '../../utils'; diff --git a/.dumi/theme/slots/Header/Navigation.tsx b/.dumi/theme/slots/Header/Navigation.tsx index 7bdc0e8859..3bb4b30441 100644 --- a/.dumi/theme/slots/Header/Navigation.tsx +++ b/.dumi/theme/slots/Header/Navigation.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { FormattedMessage, Link, useFullSidebarData, useLocation } from 'dumi'; import type { MenuProps } from 'antd'; import { Menu } from 'antd'; diff --git a/.dumi/theme/slots/SiteContext.ts b/.dumi/theme/slots/SiteContext.ts index 179aa6dc33..3636640164 100644 --- a/.dumi/theme/slots/SiteContext.ts +++ b/.dumi/theme/slots/SiteContext.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { DirectionType } from 'antd/es/config-provider'; import type { ThemeName } from '../common/ThemeSwitch'; diff --git a/components/__tests__/node.test.tsx b/components/__tests__/node.test.tsx index cc63dd37e4..22ffb0a0fc 100644 --- a/components/__tests__/node.test.tsx +++ b/components/__tests__/node.test.tsx @@ -1,5 +1,5 @@ import { globSync } from 'glob'; -import * as React from 'react'; +import React from 'react'; import { renderToString } from 'react-dom/server'; import type { Options } from '../../tests/shared/demoTest'; diff --git a/components/__tests__/setup.test.tsx b/components/__tests__/setup.test.tsx index f555f13ee6..f5ede05a2b 100644 --- a/components/__tests__/setup.test.tsx +++ b/components/__tests__/setup.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { render } from '../../tests/utils'; describe('SetUp.Test', () => { diff --git a/components/_util/ActionButton.tsx b/components/_util/ActionButton.tsx index 410e9aad24..3ed54f794e 100644 --- a/components/_util/ActionButton.tsx +++ b/components/_util/ActionButton.tsx @@ -1,5 +1,5 @@ import useState from 'rc-util/lib/hooks/useState'; -import * as React from 'react'; +import React from 'react'; import Button from '../button'; import type { ButtonProps, LegacyButtonType } from '../button/button'; import { convertLegacyProps } from '../button/button'; diff --git a/components/_util/PurePanel.tsx b/components/_util/PurePanel.tsx index 49e8b2c16e..3a04a9355a 100644 --- a/components/_util/PurePanel.tsx +++ b/components/_util/PurePanel.tsx @@ -1,5 +1,5 @@ import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import * as React from 'react'; +import React from 'react'; import ConfigProvider, { ConfigContext } from '../config-provider'; export interface BaseProps { diff --git a/components/_util/hooks/useFlexGapSupport.ts b/components/_util/hooks/useFlexGapSupport.ts index b0640f0f07..be249b4c6c 100644 --- a/components/_util/hooks/useFlexGapSupport.ts +++ b/components/_util/hooks/useFlexGapSupport.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { detectFlexGapSupported } from '../styleChecker'; export default () => { diff --git a/components/_util/hooks/useForceUpdate.ts b/components/_util/hooks/useForceUpdate.ts index d053a1986a..21fa97810b 100644 --- a/components/_util/hooks/useForceUpdate.ts +++ b/components/_util/hooks/useForceUpdate.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export default function useForceUpdate() { const [, forceUpdate] = React.useReducer((x) => x + 1, 0); diff --git a/components/_util/hooks/usePatchElement.tsx b/components/_util/hooks/usePatchElement.tsx index d2e9f92a89..239f2b2ba1 100644 --- a/components/_util/hooks/usePatchElement.tsx +++ b/components/_util/hooks/usePatchElement.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export default function usePatchElement(): [ React.ReactElement[], diff --git a/components/_util/hooks/useSyncState.ts b/components/_util/hooks/useSyncState.ts index 03fcb47097..a9f7714c04 100644 --- a/components/_util/hooks/useSyncState.ts +++ b/components/_util/hooks/useSyncState.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import useForceUpdate from './useForceUpdate'; type UseSyncStateProps = readonly [() => T, (newValue: T) => void]; diff --git a/components/_util/reactNode.ts b/components/_util/reactNode.ts index 8e5b73c016..4af272d099 100644 --- a/components/_util/reactNode.ts +++ b/components/_util/reactNode.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export const { isValidElement } = React; diff --git a/components/_util/transButton.tsx b/components/_util/transButton.tsx index 73a9f9906a..77f4e88e82 100644 --- a/components/_util/transButton.tsx +++ b/components/_util/transButton.tsx @@ -4,7 +4,7 @@ * This helps accessibility reader to tread as a interactive button to operation. */ import KeyCode from 'rc-util/lib/KeyCode'; -import * as React from 'react'; +import React from 'react'; interface TransButtonProps extends React.HTMLAttributes { onClick?: (e?: React.MouseEvent) => void; diff --git a/components/_util/wave/WaveEffect.tsx b/components/_util/wave/WaveEffect.tsx index 2a87aacb5f..7f5f370559 100644 --- a/components/_util/wave/WaveEffect.tsx +++ b/components/_util/wave/WaveEffect.tsx @@ -2,7 +2,7 @@ import classNames from 'classnames'; import CSSMotion from 'rc-motion'; import { render, unmount } from 'rc-util/lib/React/render'; import raf from 'rc-util/lib/raf'; -import * as React from 'react'; +import React from 'react'; import { getTargetWaveColor } from './util'; function validateNum(value: number) { diff --git a/components/affix/__tests__/demo.test.tsx b/components/affix/__tests__/demo.test.tsx index 85dc90a0e6..ab5c28df84 100644 --- a/components/affix/__tests__/demo.test.tsx +++ b/components/affix/__tests__/demo.test.tsx @@ -1,5 +1,5 @@ import { spyElementPrototype } from 'rc-util/lib/test/domHook'; -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('affix', { diff --git a/components/alert/ErrorBoundary.tsx b/components/alert/ErrorBoundary.tsx index 86861d011e..bb0ced36f6 100644 --- a/components/alert/ErrorBoundary.tsx +++ b/components/alert/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Alert from '.'; interface ErrorBoundaryProps { diff --git a/components/alert/index.tsx b/components/alert/index.tsx index e5cbedd01b..f74ad548db 100644 --- a/components/alert/index.tsx +++ b/components/alert/index.tsx @@ -6,7 +6,7 @@ import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; import type { ReactElement } from 'react'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import getDataOrAriaProps from '../_util/getDataOrAriaProps'; import { replaceElement } from '../_util/reactNode'; diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index 7888a4e5f7..e3bc91baff 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import useEvent from 'rc-util/lib/hooks/useEvent'; -import * as React from 'react'; +import React from 'react'; import scrollIntoView from 'scroll-into-view-if-needed'; import Affix from '../affix'; diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index 3743e85971..08606fed7d 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import warning from '../_util/warning'; import type { AntAnchor } from './Anchor'; diff --git a/components/anchor/__tests__/demo.test.tsx b/components/anchor/__tests__/demo.test.tsx index 3d68d0fd2c..37f5fcdf7a 100644 --- a/components/anchor/__tests__/demo.test.tsx +++ b/components/anchor/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('anchor', { diff --git a/components/anchor/context.ts b/components/anchor/context.ts index ab5c0474e2..7324398eec 100644 --- a/components/anchor/context.ts +++ b/components/anchor/context.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { AntAnchor } from './Anchor'; const AnchorContext = React.createContext(undefined); diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index 613d41b416..f95f5606fd 100755 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -10,7 +10,7 @@ import classNames from 'classnames'; import type { BaseSelectRef } from 'rc-select'; import toArray from 'rc-util/lib/Children/toArray'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import genPurePanel from '../_util/PurePanel'; import { isValidElement } from '../_util/reactNode'; import type { InputStatus } from '../_util/statusUtils'; diff --git a/components/avatar/SizeContext.tsx b/components/avatar/SizeContext.tsx index b66c624b11..beffc3a69d 100644 --- a/components/avatar/SizeContext.tsx +++ b/components/avatar/SizeContext.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { ScreenSizeMap } from '../_util/responsiveObserver'; export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap; diff --git a/components/avatar/__tests__/demo.test.tsx b/components/avatar/__tests__/demo.test.tsx index 71d78cbd05..031a91d8b1 100644 --- a/components/avatar/__tests__/demo.test.tsx +++ b/components/avatar/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('avatar'); diff --git a/components/avatar/avatar.tsx b/components/avatar/avatar.tsx index bcecaf9acb..ce67344aeb 100644 --- a/components/avatar/avatar.tsx +++ b/components/avatar/avatar.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import useBreakpoint from '../grid/hooks/useBreakpoint'; import type { Breakpoint } from '../_util/responsiveObserver'; diff --git a/components/avatar/group.tsx b/components/avatar/group.tsx index 4e0f29c8d0..9305d62e06 100644 --- a/components/avatar/group.tsx +++ b/components/avatar/group.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import toArray from 'rc-util/lib/Children/toArray'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import Popover from '../popover'; import { cloneElement } from '../_util/reactNode'; diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index eeee024195..ad0d999fc3 100644 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -2,14 +2,14 @@ import VerticalAlignTopOutlined from '@ant-design/icons/VerticalAlignTopOutlined import classNames from 'classnames'; import CSSMotion from 'rc-motion'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; -import type { ConfigConsumerProps } from '../config-provider'; -import { ConfigContext } from '../config-provider'; +import React from 'react'; import getScroll from '../_util/getScroll'; import { cloneElement } from '../_util/reactNode'; import scrollTo from '../_util/scrollTo'; import throttleByAnimationFrame from '../_util/throttleByAnimationFrame'; import warning from '../_util/warning'; +import type { ConfigConsumerProps } from '../config-provider'; +import { ConfigContext } from '../config-provider'; import useStyle from './style'; export interface BackTopProps { diff --git a/components/badge/Ribbon.tsx b/components/badge/Ribbon.tsx index 05760f6e93..2ffaea5cbb 100644 --- a/components/badge/Ribbon.tsx +++ b/components/badge/Ribbon.tsx @@ -1,10 +1,10 @@ import classNames from 'classnames'; -import * as React from 'react'; -import { ConfigContext } from '../config-provider'; +import React from 'react'; import type { PresetColorType } from '../_util/colors'; -import type { LiteralUnion } from '../_util/type'; -import useStyle from './style'; import { isPresetColor } from '../_util/colors'; +import type { LiteralUnion } from '../_util/type'; +import { ConfigContext } from '../config-provider'; +import useStyle from './style'; type RibbonPlacement = 'start' | 'end'; diff --git a/components/badge/ScrollNumber.tsx b/components/badge/ScrollNumber.tsx index 83eaafbde5..8ccbedc803 100644 --- a/components/badge/ScrollNumber.tsx +++ b/components/badge/ScrollNumber.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; -import * as React from 'react'; -import { ConfigContext } from '../config-provider'; +import React from 'react'; import { cloneElement } from '../_util/reactNode'; +import { ConfigContext } from '../config-provider'; import SingleNumber from './SingleNumber'; export interface ScrollNumberProps { diff --git a/components/badge/SingleNumber.tsx b/components/badge/SingleNumber.tsx index 992ecf3775..01e04505c7 100644 --- a/components/badge/SingleNumber.tsx +++ b/components/badge/SingleNumber.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; export interface UnitNumberProps { prefixCls: string; diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 4967cd0a37..c9b7e43400 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -1,13 +1,12 @@ import classNames from 'classnames'; import CSSMotion from 'rc-motion'; -import * as React from 'react'; -import { useMemo, useRef } from 'react'; -import { ConfigContext } from '../config-provider'; -import type { PresetColorKey } from '../theme/internal'; +import React, { useMemo, useRef } from 'react'; import type { PresetStatusColorType } from '../_util/colors'; import { isPresetColor } from '../_util/colors'; import { cloneElement } from '../_util/reactNode'; import type { LiteralUnion } from '../_util/type'; +import { ConfigContext } from '../config-provider'; +import type { PresetColorKey } from '../theme/internal'; import Ribbon from './Ribbon'; import ScrollNumber from './ScrollNumber'; import useStyle from './style'; diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index bffc0eddbd..f6db921045 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import toArray from 'rc-util/lib/Children/toArray'; import pickAttrs from 'rc-util/lib/pickAttrs'; -import * as React from 'react'; +import React from 'react'; import { cloneElement } from '../_util/reactNode'; import warning from '../_util/warning'; import { ConfigContext } from '../config-provider'; diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index 0cb432e1b8..5f64701514 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -1,5 +1,5 @@ import DownOutlined from '@ant-design/icons/DownOutlined'; -import * as React from 'react'; +import React from 'react'; import warning from '../_util/warning'; import { ConfigContext } from '../config-provider'; import type { DropdownProps } from '../dropdown/dropdown'; diff --git a/components/breadcrumb/BreadcrumbSeparator.tsx b/components/breadcrumb/BreadcrumbSeparator.tsx index 380eb5cbba..914a8f6ba7 100644 --- a/components/breadcrumb/BreadcrumbSeparator.tsx +++ b/components/breadcrumb/BreadcrumbSeparator.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; type CompoundedComponent = React.FC<{ children?: React.ReactNode }> & { diff --git a/components/breadcrumb/useItemRender.tsx b/components/breadcrumb/useItemRender.tsx index 11d10f3b29..d16136d18d 100644 --- a/components/breadcrumb/useItemRender.tsx +++ b/components/breadcrumb/useItemRender.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import pickAttrs from 'rc-util/lib/pickAttrs'; -import * as React from 'react'; +import React from 'react'; import type { BreadcrumbProps, InternalRouteType, ItemType } from './Breadcrumb'; type AddParameters any, TParameters extends [...args: any]> = ( diff --git a/components/button/button-group.tsx b/components/button/button-group.tsx index d38df65ab8..337c76d075 100644 --- a/components/button/button-group.tsx +++ b/components/button/button-group.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SizeType } from '../config-provider/SizeContext'; import { useToken } from '../theme/internal'; diff --git a/components/calendar/Header.tsx b/components/calendar/Header.tsx index 15efba8029..3a7d045c05 100644 --- a/components/calendar/Header.tsx +++ b/components/calendar/Header.tsx @@ -1,7 +1,6 @@ import type { GenerateConfig } from 'rc-picker/lib/generate'; import type { Locale } from 'rc-picker/lib/interface'; -import * as React from 'react'; -import { useContext, useMemo } from 'react'; +import React, { useContext, useMemo } from 'react'; import { FormItemInputContext } from '../form/context'; import { Button, Group } from '../radio'; import Select from '../select'; diff --git a/components/calendar/generateCalendar.tsx b/components/calendar/generateCalendar.tsx index 278a91253f..3d9cb27d9c 100644 --- a/components/calendar/generateCalendar.tsx +++ b/components/calendar/generateCalendar.tsx @@ -8,7 +8,7 @@ import type { PickerPanelTimeProps as RCPickerPanelTimeProps, } from 'rc-picker/lib/PickerPanel'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import { useLocale } from '../locale'; import CalendarHeader from './Header'; diff --git a/components/card/Card.tsx b/components/card/Card.tsx index dfd3c9f034..1702eb9d2c 100644 --- a/components/card/Card.tsx +++ b/components/card/Card.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import SizeContext from '../config-provider/SizeContext'; import Skeleton from '../skeleton'; diff --git a/components/card/Grid.tsx b/components/card/Grid.tsx index 5b4f87ee8e..4bcd9ec1df 100644 --- a/components/card/Grid.tsx +++ b/components/card/Grid.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { ConfigConsumerProps } from '../config-provider'; diff --git a/components/card/Meta.tsx b/components/card/Meta.tsx index 55107619ca..e9b8327427 100644 --- a/components/card/Meta.tsx +++ b/components/card/Meta.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; diff --git a/components/card/__tests__/type.test.tsx b/components/card/__tests__/type.test.tsx index 19eae9739f..66cc2cc3b4 100644 --- a/components/card/__tests__/type.test.tsx +++ b/components/card/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Card from '../index'; describe('Card.typescript', () => { diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index dd7360d702..a3725ea26c 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -1,7 +1,7 @@ import type { Settings } from '@ant-design/react-slick'; import SlickCarousel from '@ant-design/react-slick'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import useStyle from './style'; diff --git a/components/cascader/__tests__/demo.test.tsx b/components/cascader/__tests__/demo.test.tsx index 53c929e436..4295349709 100644 --- a/components/cascader/__tests__/demo.test.tsx +++ b/components/cascader/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('cascader', { diff --git a/components/cascader/__tests__/type.test.tsx b/components/cascader/__tests__/type.test.tsx index e0c9010e65..3e50cd7e16 100644 --- a/components/cascader/__tests__/type.test.tsx +++ b/components/cascader/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { BaseOptionType } from '..'; import Cascader from '..'; import { render } from '../../../tests/utils'; diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index f11cdb002e..bc466cb6d0 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -13,7 +13,7 @@ import type { import RcCascader from 'rc-cascader'; import type { Placement } from 'rc-select/lib/BaseSelect'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import DisabledContext from '../config-provider/DisabledContext'; import type { SizeType } from '../config-provider/SizeContext'; diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index 459f38b75d..3544ddfea8 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import type { CheckboxRef } from 'rc-checkbox'; import RcCheckbox from 'rc-checkbox'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import { FormItemInputContext } from '../form/context'; import warning from '../_util/warning'; diff --git a/components/checkbox/Group.tsx b/components/checkbox/Group.tsx index ce583f6bd3..9db92501d6 100644 --- a/components/checkbox/Group.tsx +++ b/components/checkbox/Group.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { CheckboxChangeEvent } from './Checkbox'; import Checkbox from './Checkbox'; diff --git a/components/checkbox/__tests__/demo.test.tsx b/components/checkbox/__tests__/demo.test.tsx index c506cb1542..7cdebc3229 100644 --- a/components/checkbox/__tests__/demo.test.tsx +++ b/components/checkbox/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('checkbox'); diff --git a/components/checkbox/__tests__/type.test.tsx b/components/checkbox/__tests__/type.test.tsx index 3852519274..6492e5c6da 100644 --- a/components/checkbox/__tests__/type.test.tsx +++ b/components/checkbox/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Checkbox from '..'; import Input from '../../input'; diff --git a/components/collapse/Collapse.tsx b/components/collapse/Collapse.tsx index 0742b2908f..80b62ea032 100644 --- a/components/collapse/Collapse.tsx +++ b/components/collapse/Collapse.tsx @@ -2,7 +2,7 @@ import RightOutlined from '@ant-design/icons/RightOutlined'; import classNames from 'classnames'; import RcCollapse from 'rc-collapse'; import type { CSSMotionProps } from 'rc-motion'; -import * as React from 'react'; +import React from 'react'; import toArray from 'rc-util/lib/Children/toArray'; import omit from 'rc-util/lib/omit'; diff --git a/components/collapse/CollapsePanel.tsx b/components/collapse/CollapsePanel.tsx index c05d902e54..9fc43d5f66 100644 --- a/components/collapse/CollapsePanel.tsx +++ b/components/collapse/CollapsePanel.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import RcCollapse from 'rc-collapse'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import warning from '../_util/warning'; diff --git a/components/config-provider/DisabledContext.tsx b/components/config-provider/DisabledContext.tsx index d67773838b..c24399e3c6 100644 --- a/components/config-provider/DisabledContext.tsx +++ b/components/config-provider/DisabledContext.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export type DisabledType = boolean | undefined; diff --git a/components/config-provider/SizeContext.tsx b/components/config-provider/SizeContext.tsx index 5bc5924017..b1c523530e 100644 --- a/components/config-provider/SizeContext.tsx +++ b/components/config-provider/SizeContext.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export type SizeType = 'small' | 'middle' | 'large' | undefined; diff --git a/components/config-provider/__tests__/cssinjs.test.tsx b/components/config-provider/__tests__/cssinjs.test.tsx index 38c272f51f..33a5236cdb 100644 --- a/components/config-provider/__tests__/cssinjs.test.tsx +++ b/components/config-provider/__tests__/cssinjs.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { SmileOutlined } from '@ant-design/icons'; import ConfigProvider from '..'; import Button from '../../button'; diff --git a/components/config-provider/context.ts b/components/config-provider/context.ts index ea805d2481..c4481fd7f0 100644 --- a/components/config-provider/context.ts +++ b/components/config-provider/context.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { DerivativeFunc } from '@ant-design/cssinjs'; import type { Options } from 'scroll-into-view-if-needed'; import type { RequiredMark } from '../form/Form'; diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index 32cdd11f59..93b5849955 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -5,7 +5,7 @@ import type { ValidateMessages } from 'rc-field-form/lib/interface'; import { setValues } from 'rc-field-form/lib/utils/valueUtil'; import useMemo from 'rc-util/lib/hooks/useMemo'; import type { ReactElement } from 'react'; -import * as React from 'react'; +import React from 'react'; import type { Options } from 'scroll-into-view-if-needed'; import warning from '../_util/warning'; import type { RequiredMark } from '../form/Form'; diff --git a/components/date-picker/PickerButton.tsx b/components/date-picker/PickerButton.tsx index bf8b0f462b..471d7d5c06 100644 --- a/components/date-picker/PickerButton.tsx +++ b/components/date-picker/PickerButton.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { ButtonProps } from '../button'; import Button from '../button'; diff --git a/components/date-picker/__tests__/demo.test.tsx b/components/date-picker/__tests__/demo.test.tsx index e249126e32..bfe3f11a22 100644 --- a/components/date-picker/__tests__/demo.test.tsx +++ b/components/date-picker/__tests__/demo.test.tsx @@ -1,5 +1,5 @@ import dayjs from 'dayjs'; -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('date-picker', { skip: ['locale.tsx'], testRootProps: false }); diff --git a/components/date-picker/__tests__/type.test.tsx b/components/date-picker/__tests__/type.test.tsx index 06f0851937..96fec7c2b2 100644 --- a/components/date-picker/__tests__/type.test.tsx +++ b/components/date-picker/__tests__/type.test.tsx @@ -1,5 +1,5 @@ import type { Dayjs } from 'dayjs'; -import * as React from 'react'; +import React from 'react'; import DatePicker from '..'; import type { DatePickRef, RangePickerRef } from '../generatePicker/interface'; diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx index a6bd7e6fc5..380c744d61 100644 --- a/components/date-picker/generatePicker/generateRangePicker.tsx +++ b/components/date-picker/generatePicker/generateRangePicker.tsx @@ -5,18 +5,17 @@ import SwapRightOutlined from '@ant-design/icons/SwapRightOutlined'; import classNames from 'classnames'; import { RangePicker as RCRangePicker } from 'rc-picker'; import type { GenerateConfig } from 'rc-picker/lib/generate/index'; -import * as React from 'react'; -import { forwardRef, useContext, useImperativeHandle } from 'react'; +import React, { forwardRef, useContext, useImperativeHandle } from 'react'; import type { RangePickerProps } from '.'; import { Components, getTimeProps } from '.'; +import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; +import warning from '../../_util/warning'; import { ConfigContext } from '../../config-provider'; import DisabledContext from '../../config-provider/DisabledContext'; import SizeContext from '../../config-provider/SizeContext'; import { FormItemInputContext } from '../../form/context'; import { useLocale } from '../../locale'; import { useCompactItemContext } from '../../space/Compact'; -import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; -import warning from '../../_util/warning'; import enUS from '../locale/en_US'; import { getRangePlaceholder, transPlacement2DropdownAlign } from '../util'; import type { CommonPickerMethods, PickerComponentClass } from './interface'; diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx index ae755cfa3c..4d6386e4e9 100644 --- a/components/date-picker/generatePicker/generateSinglePicker.tsx +++ b/components/date-picker/generatePicker/generateSinglePicker.tsx @@ -5,19 +5,18 @@ import classNames from 'classnames'; import RCPicker from 'rc-picker'; import type { GenerateConfig } from 'rc-picker/lib/generate/index'; import type { PickerMode } from 'rc-picker/lib/interface'; -import * as React from 'react'; -import { forwardRef, useContext, useImperativeHandle } from 'react'; +import React, { forwardRef, useContext, useImperativeHandle } from 'react'; import type { PickerProps, PickerTimeProps } from '.'; import { Components, getTimeProps } from '.'; +import type { InputStatus } from '../../_util/statusUtils'; +import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; +import warning from '../../_util/warning'; import { ConfigContext } from '../../config-provider'; import DisabledContext from '../../config-provider/DisabledContext'; import SizeContext from '../../config-provider/SizeContext'; import { FormItemInputContext } from '../../form/context'; import { useLocale } from '../../locale'; import { useCompactItemContext } from '../../space/Compact'; -import type { InputStatus } from '../../_util/statusUtils'; -import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; -import warning from '../../_util/warning'; import enUS from '../locale/en_US'; import { getPlaceholder, transPlacement2DropdownAlign } from '../util'; import type { CommonPickerMethods, DatePickRef, PickerComponentClass } from './interface'; diff --git a/components/descriptions/Cell.tsx b/components/descriptions/Cell.tsx index fe7bd3ca2a..e9f55641d8 100644 --- a/components/descriptions/Cell.tsx +++ b/components/descriptions/Cell.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; function notEmpty(val: any) { return val !== undefined && val !== null; diff --git a/components/descriptions/Row.tsx b/components/descriptions/Row.tsx index 28ac218ece..73a9c35b05 100644 --- a/components/descriptions/Row.tsx +++ b/components/descriptions/Row.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { DescriptionsContextProps } from '.'; import { DescriptionsContext } from '.'; import Cell from './Cell'; diff --git a/components/descriptions/index.tsx b/components/descriptions/index.tsx index bdd90448ff..7f164f7221 100644 --- a/components/descriptions/index.tsx +++ b/components/descriptions/index.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/no-array-index-key */ import classNames from 'classnames'; import toArray from 'rc-util/lib/Children/toArray'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import { cloneElement } from '../_util/reactNode'; import type { Breakpoint, ScreenMap } from '../_util/responsiveObserver'; diff --git a/components/divider/__tests__/index.test.tsx b/components/divider/__tests__/index.test.tsx index 0e581f43b2..e3e3e133d1 100644 --- a/components/divider/__tests__/index.test.tsx +++ b/components/divider/__tests__/index.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { render } from '../../../tests/utils'; import Divider from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/divider/index.tsx b/components/divider/index.tsx index cab33801a0..87c0e99015 100644 --- a/components/divider/index.tsx +++ b/components/divider/index.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import warning from '../_util/warning'; diff --git a/components/drawer/DrawerPanel.tsx b/components/drawer/DrawerPanel.tsx index 6448cd7d78..f07f72ff16 100644 --- a/components/drawer/DrawerPanel.tsx +++ b/components/drawer/DrawerPanel.tsx @@ -1,7 +1,7 @@ import CloseOutlined from '@ant-design/icons/CloseOutlined'; import classNames from 'classnames'; import type { DrawerProps as RCDrawerProps } from 'rc-drawer'; -import * as React from 'react'; +import React from 'react'; export interface DrawerPanelProps { prefixCls: string; diff --git a/components/drawer/__tests__/demo-extend.test.tsx b/components/drawer/__tests__/demo-extend.test.tsx index 5dd0a52c33..6e3eb5d683 100644 --- a/components/drawer/__tests__/demo-extend.test.tsx +++ b/components/drawer/__tests__/demo-extend.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { extendTest } from '../../../tests/shared/demoTest'; jest.mock('rc-drawer', () => { diff --git a/components/drawer/__tests__/type.test.tsx b/components/drawer/__tests__/type.test.tsx index b47fee0968..6ed6cf79d8 100644 --- a/components/drawer/__tests__/type.test.tsx +++ b/components/drawer/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Drawer from '..'; describe('Drawer.typescript', () => { diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index 8c19d95cfa..84c6ca49dd 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -2,7 +2,7 @@ import classNames from 'classnames'; import RcDrawer from 'rc-drawer'; import type { DrawerProps as RcDrawerProps } from 'rc-drawer'; import type { CSSMotionProps } from 'rc-motion'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import { NoFormStyle } from '../form/context'; import { getTransitionName } from '../_util/motion'; diff --git a/components/dropdown/__tests__/demo.test.tsx b/components/dropdown/__tests__/demo.test.tsx index e9679ee00c..0673e06c4f 100644 --- a/components/dropdown/__tests__/demo.test.tsx +++ b/components/dropdown/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('dropdown', { diff --git a/components/dropdown/dropdown-button.tsx b/components/dropdown/dropdown-button.tsx index bf10b08b7d..3b1f81dafe 100644 --- a/components/dropdown/dropdown-button.tsx +++ b/components/dropdown/dropdown-button.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import EllipsisOutlined from '@ant-design/icons/EllipsisOutlined'; import Button from '../button'; import { ConfigContext } from '../config-provider'; diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 7a1a08f157..c5d14014cd 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -4,7 +4,7 @@ import RcDropdown from 'rc-dropdown'; import useEvent from 'rc-util/lib/hooks/useEvent'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import genPurePanel from '../_util/PurePanel'; import type { AdjustOverflow } from '../_util/placements'; import getPlacements from '../_util/placements'; diff --git a/components/empty/empty.tsx b/components/empty/empty.tsx index c382a34ab3..f3000fe128 100644 --- a/components/empty/empty.tsx +++ b/components/empty/empty.tsx @@ -1,5 +1,5 @@ import { TinyColor } from '@ctrl/tinycolor'; -import * as React from 'react'; +import React from 'react'; import { useToken } from '../theme/internal'; const Empty: React.FC = () => { diff --git a/components/empty/index.tsx b/components/empty/index.tsx index 56e7628e76..39c9643e97 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import { useLocale } from '../locale'; import DefaultEmptyImg from './empty'; diff --git a/components/empty/simple.tsx b/components/empty/simple.tsx index f0b0dda188..96403381df 100644 --- a/components/empty/simple.tsx +++ b/components/empty/simple.tsx @@ -1,6 +1,5 @@ import { TinyColor } from '@ctrl/tinycolor'; -import * as React from 'react'; -import { useMemo } from 'react'; +import React, { useMemo } from 'react'; import { useToken } from '../theme/internal'; const Simple: React.FC = () => { diff --git a/components/float-button/PurePanel.tsx b/components/float-button/PurePanel.tsx index 2732a06331..6cf10b0aa3 100644 --- a/components/float-button/PurePanel.tsx +++ b/components/float-button/PurePanel.tsx @@ -1,5 +1,5 @@ /* eslint-disable react/no-array-index-key */ -import * as React from 'react'; +import React from 'react'; import classNames from 'classnames'; import FloatButton, { floatButtonPrefixCls } from './FloatButton'; import FloatButtonGroup from './FloatButtonGroup'; diff --git a/components/form/ErrorList.tsx b/components/form/ErrorList.tsx index 8893e9375b..ed733cac58 100644 --- a/components/form/ErrorList.tsx +++ b/components/form/ErrorList.tsx @@ -1,10 +1,9 @@ import classNames from 'classnames'; import CSSMotion, { CSSMotionList } from 'rc-motion'; -import * as React from 'react'; -import { useMemo } from 'react'; +import React, { useMemo } from 'react'; import initCollapseMotion from '../_util/motion'; -import { FormItemPrefixContext } from './context'; import type { ValidateStatus } from './FormItem'; +import { FormItemPrefixContext } from './context'; import useDebounce from './hooks/useDebounce'; import useStyle from './style'; diff --git a/components/form/Form.tsx b/components/form/Form.tsx index d18a7ac943..303befb099 100644 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -2,8 +2,7 @@ import classNames from 'classnames'; import FieldForm, { List, useWatch } from 'rc-field-form'; import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form'; import type { InternalNamePath, ValidateErrorEntity } from 'rc-field-form/lib/interface'; -import * as React from 'react'; -import { useMemo } from 'react'; +import React, { useMemo } from 'react'; import type { Options } from 'scroll-into-view-if-needed'; import { ConfigContext } from '../config-provider'; import DisabledContext, { DisabledContextProvider } from '../config-provider/DisabledContext'; diff --git a/components/form/FormItem/ItemHolder.tsx b/components/form/FormItem/ItemHolder.tsx index d338594325..584541432f 100644 --- a/components/form/FormItem/ItemHolder.tsx +++ b/components/form/FormItem/ItemHolder.tsx @@ -7,7 +7,7 @@ import type { Meta } from 'rc-field-form/lib/interface'; import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; import isVisible from 'rc-util/lib/Dom/isVisible'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import type { FormItemProps, ValidateStatus } from '.'; import { Row } from '../../grid'; import FormItemInput from '../FormItemInput'; diff --git a/components/form/FormItem/index.tsx b/components/form/FormItem/index.tsx index 68127ed505..f2d326ed0e 100644 --- a/components/form/FormItem/index.tsx +++ b/components/form/FormItem/index.tsx @@ -5,7 +5,7 @@ import type { FieldProps } from 'rc-field-form/lib/Field'; import type { Meta, NamePath } from 'rc-field-form/lib/interface'; import useState from 'rc-util/lib/hooks/useState'; import { supportRef } from 'rc-util/lib/ref'; -import * as React from 'react'; +import React from 'react'; import { cloneElement, isValidElement } from '../../_util/reactNode'; import warning from '../../_util/warning'; import { ConfigContext } from '../../config-provider'; diff --git a/components/form/FormItemInput.tsx b/components/form/FormItemInput.tsx index c81a5ce4da..2f0a35f5a1 100644 --- a/components/form/FormItemInput.tsx +++ b/components/form/FormItemInput.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { ColProps } from '../grid/col'; import Col from '../grid/col'; import { FormContext, FormItemPrefixContext } from './context'; diff --git a/components/form/FormItemLabel.tsx b/components/form/FormItemLabel.tsx index a8f4dace0e..d8fac1b25e 100644 --- a/components/form/FormItemLabel.tsx +++ b/components/form/FormItemLabel.tsx @@ -1,6 +1,6 @@ import QuestionCircleOutlined from '@ant-design/icons/QuestionCircleOutlined'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { ColProps } from '../grid/col'; import Col from '../grid/col'; import defaultLocale from '../locale/en_US'; diff --git a/components/form/FormList.tsx b/components/form/FormList.tsx index eaff6f5520..89d3616082 100644 --- a/components/form/FormList.tsx +++ b/components/form/FormList.tsx @@ -1,6 +1,6 @@ import { List } from 'rc-field-form'; import type { StoreValue, ValidatorRule } from 'rc-field-form/lib/interface'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import warning from '../_util/warning'; import { FormItemPrefixContext } from './context'; diff --git a/components/form/__tests__/demo.test.tsx b/components/form/__tests__/demo.test.tsx index d7ab665e7b..53a4e5df03 100644 --- a/components/form/__tests__/demo.test.tsx +++ b/components/form/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('form', { skip: ['complex-form-control.tsx', 'dep-debug.tsx'] }); diff --git a/components/form/context.tsx b/components/form/context.tsx index ed6bb91f66..fc4f1d4b7f 100644 --- a/components/form/context.tsx +++ b/components/form/context.tsx @@ -3,8 +3,7 @@ import type { FormProviderProps as RcFormProviderProps } from 'rc-field-form/lib import type { Meta } from 'rc-field-form/lib/interface'; import omit from 'rc-util/lib/omit'; import type { FC, PropsWithChildren, ReactNode } from 'react'; -import * as React from 'react'; -import { useContext, useMemo } from 'react'; +import React, { useContext, useMemo } from 'react'; import type { ColProps } from '../grid/col'; import type { FormInstance, RequiredMark } from './Form'; import type { ValidateStatus } from './FormItem'; diff --git a/components/form/hooks/useDebounce.ts b/components/form/hooks/useDebounce.ts index ded2dcb1b3..65940778b5 100644 --- a/components/form/hooks/useDebounce.ts +++ b/components/form/hooks/useDebounce.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export default function useDebounce(value: T[]): T[] { const [cacheValue, setCacheValue] = React.useState(value); diff --git a/components/form/hooks/useForm.ts b/components/form/hooks/useForm.ts index a553a58902..f2031edd94 100644 --- a/components/form/hooks/useForm.ts +++ b/components/form/hooks/useForm.ts @@ -1,6 +1,6 @@ import type { FormInstance as RcFormInstance } from 'rc-field-form'; import { useForm as useRcForm } from 'rc-field-form'; -import * as React from 'react'; +import React from 'react'; import scrollIntoView from 'scroll-into-view-if-needed'; import type { InternalNamePath, NamePath, ScrollOptions } from '../interface'; import { getFieldId, toArray } from '../util'; diff --git a/components/form/hooks/useFrameState.ts b/components/form/hooks/useFrameState.ts index 12fbc587c1..41a8e112d8 100644 --- a/components/form/hooks/useFrameState.ts +++ b/components/form/hooks/useFrameState.ts @@ -1,6 +1,5 @@ import raf from 'rc-util/lib/raf'; -import * as React from 'react'; -import { useRef } from 'react'; +import React, { useRef } from 'react'; type Updater = (prev?: ValueType) => ValueType; diff --git a/components/form/hooks/useItemRef.ts b/components/form/hooks/useItemRef.ts index e42890677d..d3ddb858f2 100644 --- a/components/form/hooks/useItemRef.ts +++ b/components/form/hooks/useItemRef.ts @@ -1,5 +1,5 @@ import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; +import React from 'react'; import { FormContext } from '../context'; import type { InternalNamePath } from '../interface'; diff --git a/components/grid/col.tsx b/components/grid/col.tsx index ead96e4913..83b725d492 100644 --- a/components/grid/col.tsx +++ b/components/grid/col.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import RowContext from './RowContext'; import { useColStyle } from './style'; diff --git a/components/grid/row.tsx b/components/grid/row.tsx index c4fea7486c..5770528e6a 100644 --- a/components/grid/row.tsx +++ b/components/grid/row.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import useFlexGapSupport from '../_util/hooks/useFlexGapSupport'; import type { Breakpoint, ScreenMap } from '../_util/responsiveObserver'; diff --git a/components/image/PreviewGroup.tsx b/components/image/PreviewGroup.tsx index 136843e2c5..7a95b2aff6 100644 --- a/components/image/PreviewGroup.tsx +++ b/components/image/PreviewGroup.tsx @@ -8,7 +8,7 @@ import ZoomInOutlined from '@ant-design/icons/ZoomInOutlined'; import ZoomOutOutlined from '@ant-design/icons/ZoomOutOutlined'; import RcImage from 'rc-image'; import type { GroupConsumerProps } from 'rc-image/lib/PreviewGroup'; -import * as React from 'react'; +import React from 'react'; import classNames from 'classnames'; import { ConfigContext } from '../config-provider'; import { getTransitionName } from '../_util/motion'; diff --git a/components/image/index.tsx b/components/image/index.tsx index 09a58b7b1a..941c93d6a9 100644 --- a/components/image/index.tsx +++ b/components/image/index.tsx @@ -1,7 +1,7 @@ import EyeOutlined from '@ant-design/icons/EyeOutlined'; import classNames from 'classnames'; import RcImage, { type ImageProps } from 'rc-image'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import defaultLocale from '../locale/en_US'; import { getTransitionName } from '../_util/motion'; diff --git a/components/input-number/__tests__/demo.test.tsx b/components/input-number/__tests__/demo.test.tsx index 4b6a47dad4..b8977fda38 100644 --- a/components/input-number/__tests__/demo.test.tsx +++ b/components/input-number/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('input-number'); diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index 0afd07132f..2e5c21bb1e 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -4,7 +4,7 @@ import type { ValueType } from '@rc-component/mini-decimal'; import classNames from 'classnames'; import type { InputNumberProps as RcInputNumberProps } from 'rc-input-number'; import RcInputNumber from 'rc-input-number'; -import * as React from 'react'; +import React from 'react'; import ConfigProvider, { ConfigContext } from '../config-provider'; import DisabledContext from '../config-provider/DisabledContext'; import type { SizeType } from '../config-provider/SizeContext'; diff --git a/components/input-number/index.zh-CN.md b/components/input-number/index.zh-CN.md index ce37f7348d..4b950b5933 100644 --- a/components/input-number/index.zh-CN.md +++ b/components/input-number/index.zh-CN.md @@ -35,8 +35,6 @@ demo: ## API -属性如下 - | 成员 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | | addonAfter | 带标签的 input,设置后置标签 | ReactNode | - | 4.17.0 | diff --git a/components/input/Group.tsx b/components/input/Group.tsx index fbb3063923..7f8d8d78a1 100644 --- a/components/input/Group.tsx +++ b/components/input/Group.tsx @@ -1,10 +1,9 @@ import classNames from 'classnames'; -import * as React from 'react'; -import { useContext, useMemo } from 'react'; +import React, { useContext, useMemo } from 'react'; +import warning from '../_util/warning'; import { ConfigContext } from '../config-provider'; import type { FormItemStatusContextProps } from '../form/context'; import { FormItemInputContext } from '../form/context'; -import warning from '../_util/warning'; import useStyle from './style'; export interface GroupProps { diff --git a/components/input/Password.tsx b/components/input/Password.tsx index d2de855f80..fc00b230d2 100644 --- a/components/input/Password.tsx +++ b/components/input/Password.tsx @@ -3,13 +3,12 @@ import EyeOutlined from '@ant-design/icons/EyeOutlined'; import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; -import { useRef, useState } from 'react'; +import React, { useRef, useState } from 'react'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; -import useRemovePasswordTimeout from './hooks/useRemovePasswordTimeout'; import type { InputProps, InputRef } from './Input'; import Input from './Input'; +import useRemovePasswordTimeout from './hooks/useRemovePasswordTimeout'; const defaultIconRender = (visible: boolean): React.ReactNode => visible ? : ; diff --git a/components/input/Search.tsx b/components/input/Search.tsx index 770e310bfe..bba8455dde 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -1,7 +1,7 @@ import SearchOutlined from '@ant-design/icons/SearchOutlined'; import classNames from 'classnames'; import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; +import React from 'react'; import Button from '../button'; import { ConfigContext } from '../config-provider'; import SizeContext from '../config-provider/SizeContext'; diff --git a/components/input/TextArea.tsx b/components/input/TextArea.tsx index 44a2e818bc..5a42094a94 100644 --- a/components/input/TextArea.tsx +++ b/components/input/TextArea.tsx @@ -1,21 +1,20 @@ -import type { TextAreaProps as RcTextAreaProps } from 'rc-textarea/lib/interface'; -import type { TextAreaRef as RcTextAreaRef } from 'rc-textarea'; -import { forwardRef } from 'react'; -import * as React from 'react'; -import RcTextArea from 'rc-textarea'; -import classNames from 'classnames'; import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; +import classNames from 'classnames'; import type { BaseInputProps } from 'rc-input/lib/interface'; -import { FormItemInputContext } from '../form/context'; -import useStyle from './style'; -import type { SizeType } from '../config-provider/SizeContext'; -import SizeContext from '../config-provider/SizeContext'; +import type { TextAreaRef as RcTextAreaRef } from 'rc-textarea'; +import RcTextArea from 'rc-textarea'; +import type { TextAreaProps as RcTextAreaProps } from 'rc-textarea/lib/interface'; +import React, { forwardRef } from 'react'; import type { InputStatus } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; +import { ConfigContext } from '../config-provider'; +import DisabledContext from '../config-provider/DisabledContext'; +import type { SizeType } from '../config-provider/SizeContext'; +import SizeContext from '../config-provider/SizeContext'; +import { FormItemInputContext } from '../form/context'; import type { InputFocusOptions } from './Input'; import { triggerFocus } from './Input'; -import DisabledContext from '../config-provider/DisabledContext'; -import { ConfigContext } from '../config-provider'; +import useStyle from './style'; export interface TextAreaProps extends Omit { bordered?: boolean; diff --git a/components/input/__tests__/demo.test.tsx b/components/input/__tests__/demo.test.tsx index 4be9097dab..232a98204e 100644 --- a/components/input/__tests__/demo.test.tsx +++ b/components/input/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('input'); diff --git a/components/input/index.en-US.md b/components/input/index.en-US.md index da8beba360..6981d59d44 100644 --- a/components/input/index.en-US.md +++ b/components/input/index.en-US.md @@ -55,8 +55,8 @@ A basic widget for getting the user input is a text field. Keyboard and mouse ca | defaultValue | The initial input content | string | - | | | disabled | Whether the input is disabled | boolean | false | | | id | The ID for input | string | - | | -| maxLength | The max length | number | - | | -| showCount | Whether show text count | boolean \| { formatter: (info: { value: string, count: number, maxLength?: number }) => ReactNode } | false | 4.18.0 info.value: 4.23.0 | +| maxLength | The maximum number of characters in Input | number | - | | +| showCount | Whether to show character count | boolean \| { formatter: (info: { value: string, count: number, maxLength?: number }) => ReactNode } | false | 4.18.0 info.value: 4.23.0 | | status | Set validation status | 'error' \| 'warning' | - | 4.19.0 | | styles | Semantic DOM style | Record<[SemanticDOM](#input-1), CSSProperties> | - | 5.4.0 | | prefix | The prefix icon for the Input | ReactNode | - | | @@ -80,8 +80,8 @@ The rest of the props of Input are exactly the same as the original [input](http | bordered | Whether has border style | boolean | true | 4.5.0 | | classNames | Semantic DOM class | Record<[SemanticDOM](#inputtextarea-1), string> | - | 5.4.0 | | defaultValue | The initial input content | string | - | | -| maxLength | The max length | number | - | 4.7.0 | -| showCount | Whether show text count | boolean \| { formatter: (info: { value: string, count: number, maxLength?: number }) => string } | false | 4.7.0 formatter: 4.10.0 info.value: 4.23.0 | +| maxLength | The maximum number of characters in TextArea | number | - | 4.7.0 | +| showCount | Whether to show character count | boolean \| { formatter: (info: { value: string, count: number, maxLength?: number }) => string } | false | 4.7.0 formatter: 4.10.0 info.value: 4.23.0 | | styles | Semantic DOM style | Record<[SemanticDOM](#inputtextarea-1), CSSProperties> | - | 5.4.0 | | value | The input content value | string | - | | | onPressEnter | The callback function that is triggered when Enter key is pressed | function(e) | - | | diff --git a/components/layout/Sider.tsx b/components/layout/Sider.tsx index 4df4f05478..46e0841f15 100644 --- a/components/layout/Sider.tsx +++ b/components/layout/Sider.tsx @@ -3,11 +3,9 @@ import LeftOutlined from '@ant-design/icons/LeftOutlined'; import RightOutlined from '@ant-design/icons/RightOutlined'; import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; -import { useContext, useEffect, useRef, useState } from 'react'; - -import { ConfigContext } from '../config-provider'; +import React, { useContext, useEffect, useRef, useState } from 'react'; import isNumeric from '../_util/isNumeric'; +import { ConfigContext } from '../config-provider'; import { LayoutContext } from './layout'; const dimensionMaxMap = { diff --git a/components/layout/layout.tsx b/components/layout/layout.tsx index fa9b41487d..9de948a67c 100644 --- a/components/layout/layout.tsx +++ b/components/layout/layout.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import useStyle from './style'; diff --git a/components/list/index.tsx b/components/list/index.tsx index 73a7a2f467..8e7c843d69 100644 --- a/components/list/index.tsx +++ b/components/list/index.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; // eslint-disable-next-line import/no-named-as-default -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import DefaultRenderEmpty from '../config-provider/defaultRenderEmpty'; import { Row } from '../grid'; diff --git a/components/locale/index.tsx b/components/locale/index.tsx index 34f75c9a26..57c1235f2a 100644 --- a/components/locale/index.tsx +++ b/components/locale/index.tsx @@ -1,5 +1,5 @@ import type { ValidateMessages } from 'rc-field-form/lib/interface'; -import * as React from 'react'; +import React from 'react'; import warning from '../_util/warning'; import type { PickerLocale as DatePickerLocale } from '../date-picker/generatePicker'; import type { TransferLocale as TransferLocaleForEmpty } from '../empty'; diff --git a/components/locale/useLocale.ts b/components/locale/useLocale.ts index 69be9bc409..ad4704464e 100644 --- a/components/locale/useLocale.ts +++ b/components/locale/useLocale.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { Locale } from '.'; import type { LocaleContextProps } from './context'; import LocaleContext from './context'; diff --git a/components/mentions/__tests__/demo.test.tsx b/components/mentions/__tests__/demo.test.tsx index 1d7e528071..947a2c85e1 100644 --- a/components/mentions/__tests__/demo.test.tsx +++ b/components/mentions/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; import { fireEvent } from '../../../tests/utils'; diff --git a/components/mentions/index.tsx b/components/mentions/index.tsx index a40a8e23f4..354fd41a9a 100644 --- a/components/mentions/index.tsx +++ b/components/mentions/index.tsx @@ -7,7 +7,7 @@ import type { } from 'rc-mentions/lib/Mentions'; import { composeRef } from 'rc-util/lib/ref'; // eslint-disable-next-line import/no-named-as-default -import * as React from 'react'; +import React from 'react'; import genPurePanel from '../_util/PurePanel'; import type { InputStatus } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; diff --git a/components/menu/MenuDivider.tsx b/components/menu/MenuDivider.tsx index 1441481bec..75948880f3 100644 --- a/components/menu/MenuDivider.tsx +++ b/components/menu/MenuDivider.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import { Divider } from 'rc-menu'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; export interface MenuDividerProps extends React.HTMLAttributes { diff --git a/components/menu/MenuItem.tsx b/components/menu/MenuItem.tsx index aa1273e2fa..74ce65aa81 100644 --- a/components/menu/MenuItem.tsx +++ b/components/menu/MenuItem.tsx @@ -3,12 +3,12 @@ import type { MenuItemProps as RcMenuItemProps } from 'rc-menu'; import { Item } from 'rc-menu'; import toArray from 'rc-util/lib/Children/toArray'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; +import { cloneElement, isValidElement } from '../_util/reactNode'; import type { SiderContextProps } from '../layout/Sider'; import { SiderContext } from '../layout/Sider'; import type { TooltipProps } from '../tooltip'; import Tooltip from '../tooltip'; -import { cloneElement, isValidElement } from '../_util/reactNode'; import type { MenuContextProps } from './MenuContext'; import MenuContext from './MenuContext'; diff --git a/components/menu/OverrideContext.tsx b/components/menu/OverrideContext.tsx index ba663f69f5..18c906f39f 100644 --- a/components/menu/OverrideContext.tsx +++ b/components/menu/OverrideContext.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { MenuProps } from './menu'; // Used for Dropdown only diff --git a/components/menu/SubMenu.tsx b/components/menu/SubMenu.tsx index 1ae6b50840..bf293163f9 100644 --- a/components/menu/SubMenu.tsx +++ b/components/menu/SubMenu.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import { SubMenu as RcSubMenu, useFullPath } from 'rc-menu'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { cloneElement, isValidElement } from '../_util/reactNode'; import type { MenuContextProps, MenuTheme } from './MenuContext'; import MenuContext from './MenuContext'; diff --git a/components/menu/__tests__/demo.test.tsx b/components/menu/__tests__/demo.test.tsx index 8edf31440a..8fe70822e9 100644 --- a/components/menu/__tests__/demo.test.tsx +++ b/components/menu/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('menu', { testRootProps: false }); diff --git a/components/menu/hooks/useItems.tsx b/components/menu/hooks/useItems.tsx index dbffab2467..6a5e65311d 100644 --- a/components/menu/hooks/useItems.tsx +++ b/components/menu/hooks/useItems.tsx @@ -5,7 +5,7 @@ import type { MenuItemType as RcMenuItemType, SubMenuType as RcSubMenuType, } from 'rc-menu/lib/interface'; -import * as React from 'react'; +import React from 'react'; import MenuDivider from '../MenuDivider'; import MenuItem from '../MenuItem'; import SubMenu from '../SubMenu'; diff --git a/components/menu/index.tsx b/components/menu/index.tsx index 4c30d2edc6..bbafaa55fc 100644 --- a/components/menu/index.tsx +++ b/components/menu/index.tsx @@ -1,7 +1,6 @@ import type { MenuRef as RcMenuRef } from 'rc-menu'; import { ItemGroup } from 'rc-menu'; -import * as React from 'react'; -import { forwardRef, useImperativeHandle, useRef } from 'react'; +import React, { forwardRef, useImperativeHandle, useRef } from 'react'; import type { MenuProps } from './menu'; import InternalMenu from './menu'; import { SiderContext } from '../layout/Sider'; diff --git a/components/menu/menu.tsx b/components/menu/menu.tsx index 7f0e0e052d..a8254230e1 100644 --- a/components/menu/menu.tsx +++ b/components/menu/menu.tsx @@ -1,22 +1,21 @@ +import EllipsisOutlined from '@ant-design/icons/EllipsisOutlined'; +import classNames from 'classnames'; import type { MenuProps as RcMenuProps, MenuRef as RcMenuRef } from 'rc-menu'; import RcMenu from 'rc-menu'; -import * as React from 'react'; -import { forwardRef } from 'react'; -import omit from 'rc-util/lib/omit'; import useEvent from 'rc-util/lib/hooks/useEvent'; -import classNames from 'classnames'; -import EllipsisOutlined from '@ant-design/icons/EllipsisOutlined'; -import warning from '../_util/warning'; +import omit from 'rc-util/lib/omit'; +import React, { forwardRef } from 'react'; import initCollapseMotion from '../_util/motion'; import { cloneElement } from '../_util/reactNode'; -import type { SiderContextProps } from '../layout/Sider'; +import warning from '../_util/warning'; import { ConfigContext } from '../config-provider'; -import useStyle from './style'; -import OverrideContext from './OverrideContext'; -import useItems from './hooks/useItems'; -import type { ItemType } from './hooks/useItems'; +import type { SiderContextProps } from '../layout/Sider'; +import type { MenuContextProps, MenuTheme } from './MenuContext'; import MenuContext from './MenuContext'; -import type { MenuTheme, MenuContextProps } from './MenuContext'; +import OverrideContext from './OverrideContext'; +import type { ItemType } from './hooks/useItems'; +import useItems from './hooks/useItems'; +import useStyle from './style'; export interface MenuProps extends Omit { theme?: MenuTheme; diff --git a/components/menu/style/vertical.tsx b/components/menu/style/vertical.tsx index aa5dd0bb2f..57a0365a27 100644 --- a/components/menu/style/vertical.tsx +++ b/components/menu/style/vertical.tsx @@ -19,6 +19,11 @@ const getVerticalInlineStyle: GenerateStyle = (token) => { return { [`${componentCls}-item`]: { position: 'relative', + + // https://github.com/ant-design/ant-design/blob/5e52057671f9781ad2b957b0ff9adfcd1eb1eb88/components/menu/style/index.less#L487-L489 + [`&:not(:last-child)`]: { + marginBottom: marginXS, + }, }, [`${componentCls}-item, ${componentCls}-submenu-title`]: { diff --git a/components/message/PurePanel.tsx b/components/message/PurePanel.tsx index 7b9e467b7d..5dceb785b6 100644 --- a/components/message/PurePanel.tsx +++ b/components/message/PurePanel.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; diff --git a/components/message/index.tsx b/components/message/index.tsx index c005728462..1e07d34a93 100755 --- a/components/message/index.tsx +++ b/components/message/index.tsx @@ -1,5 +1,5 @@ import { render } from 'rc-util/lib/React/render'; -import * as React from 'react'; +import React from 'react'; import ConfigProvider, { globalConfig, warnContext } from '../config-provider'; import type { ArgsProps, diff --git a/components/message/useMessage.tsx b/components/message/useMessage.tsx index e5242166b2..bfa6db9d65 100644 --- a/components/message/useMessage.tsx +++ b/components/message/useMessage.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { useNotification as useRcNotification } from 'rc-notification'; import type { NotificationAPI } from 'rc-notification/lib'; import classNames from 'classnames'; diff --git a/components/modal/ConfirmDialog.tsx b/components/modal/ConfirmDialog.tsx index 84f36b22d2..7e1cb074e0 100644 --- a/components/modal/ConfirmDialog.tsx +++ b/components/modal/ConfirmDialog.tsx @@ -3,7 +3,7 @@ import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import ConfigProvider from '../config-provider'; import { useLocale } from '../locale'; import ActionButton from '../_util/ActionButton'; diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index 4bf98b2f8a..4a542de49e 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import Dialog from 'rc-dialog'; -import * as React from 'react'; +import React from 'react'; import type { ButtonProps, LegacyButtonType } from '../button/button'; import type { DirectionType } from '../config-provider'; import { ConfigContext } from '../config-provider'; diff --git a/components/modal/PurePanel.tsx b/components/modal/PurePanel.tsx index fe8c085e5d..e6377eff6c 100644 --- a/components/modal/PurePanel.tsx +++ b/components/modal/PurePanel.tsx @@ -3,7 +3,7 @@ import CloseOutlined from '@ant-design/icons/CloseOutlined'; import classNames from 'classnames'; import { Panel } from 'rc-dialog'; import type { PanelProps } from 'rc-dialog/lib/Dialog/Content/Panel'; -import * as React from 'react'; +import React from 'react'; import Button from '../button'; import { convertLegacyProps } from '../button/button'; import { ConfigContext } from '../config-provider'; diff --git a/components/modal/__tests__/confirm.test.tsx b/components/modal/__tests__/confirm.test.tsx index cc1578817b..50fba8335c 100644 --- a/components/modal/__tests__/confirm.test.tsx +++ b/components/modal/__tests__/confirm.test.tsx @@ -3,7 +3,7 @@ import CSSMotion from 'rc-motion'; import { genCSSMotion } from 'rc-motion/lib/CSSMotion'; import KeyCode from 'rc-util/lib/KeyCode'; import { resetWarned } from 'rc-util/lib/warning'; -import * as React from 'react'; +import React from 'react'; import TestUtils from 'react-dom/test-utils'; import type { ModalFuncProps } from '..'; import Modal from '..'; diff --git a/components/modal/__tests__/demo.test.tsx b/components/modal/__tests__/demo.test.tsx index e02e3b6d82..c38fad541e 100644 --- a/components/modal/__tests__/demo.test.tsx +++ b/components/modal/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('modal', { diff --git a/components/modal/__tests__/static-warning.test.tsx b/components/modal/__tests__/static-warning.test.tsx index af26595b61..b4157a47be 100644 --- a/components/modal/__tests__/static-warning.test.tsx +++ b/components/modal/__tests__/static-warning.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Modal from '..'; import { render, waitFakeTimer } from '../../../tests/utils'; import ConfigProvider from '../../config-provider'; diff --git a/components/modal/__tests__/type.test.tsx b/components/modal/__tests__/type.test.tsx index 8276ec7cef..fc525505eb 100644 --- a/components/modal/__tests__/type.test.tsx +++ b/components/modal/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Modal from '..'; describe('Modal.typescript', () => { diff --git a/components/modal/confirm.tsx b/components/modal/confirm.tsx index 287a3ae9d3..ff2e544528 100644 --- a/components/modal/confirm.tsx +++ b/components/modal/confirm.tsx @@ -1,5 +1,5 @@ import { render as reactRender, unmount as reactUnmount } from 'rc-util/lib/React/render'; -import * as React from 'react'; +import React from 'react'; import { globalConfig, warnContext } from '../config-provider'; import warning from '../_util/warning'; import ConfirmDialog from './ConfirmDialog'; diff --git a/components/modal/useModal/HookModal.tsx b/components/modal/useModal/HookModal.tsx index d1e699fdc5..2c315ee2ac 100644 --- a/components/modal/useModal/HookModal.tsx +++ b/components/modal/useModal/HookModal.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../../config-provider'; import defaultLocale from '../../locale/en_US'; import useLocale from '../../locale/useLocale'; diff --git a/components/modal/useModal/index.tsx b/components/modal/useModal/index.tsx index ce4b1e55a8..04e2842e70 100644 --- a/components/modal/useModal/index.tsx +++ b/components/modal/useModal/index.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import usePatchElement from '../../_util/hooks/usePatchElement'; import type { ModalStaticFunctions } from '../confirm'; import { withConfirm, withError, withInfo, withSuccess, withWarn } from '../confirm'; diff --git a/components/notification/PurePanel.tsx b/components/notification/PurePanel.tsx index 56ef07e342..ee28edbf74 100644 --- a/components/notification/PurePanel.tsx +++ b/components/notification/PurePanel.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 00f6985c03..03065638b6 100755 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -1,5 +1,5 @@ import { render } from 'rc-util/lib/React/render'; -import * as React from 'react'; +import React from 'react'; import ConfigProvider, { globalConfig, warnContext } from '../config-provider'; import type { ArgsProps, GlobalConfigProps, NotificationInstance } from './interface'; import PurePanel from './PurePanel'; diff --git a/components/notification/useNotification.tsx b/components/notification/useNotification.tsx index d19b3ff8d6..d50587b5bd 100644 --- a/components/notification/useNotification.tsx +++ b/components/notification/useNotification.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { useNotification as useRcNotification } from 'rc-notification'; import type { NotificationAPI } from 'rc-notification/lib'; import classNames from 'classnames'; diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 2b90f531fe..9cb662b1ad 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -6,7 +6,7 @@ import classNames from 'classnames'; import type { PaginationLocale, PaginationProps as RcPaginationProps } from 'rc-pagination'; import RcPagination from 'rc-pagination'; import enUS from 'rc-pagination/lib/locale/en_US'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import useBreakpoint from '../grid/hooks/useBreakpoint'; import { useLocale } from '../locale'; diff --git a/components/pagination/Select.tsx b/components/pagination/Select.tsx index b0cec749a2..a48c2c4afc 100644 --- a/components/pagination/Select.tsx +++ b/components/pagination/Select.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { SelectProps } from '../select'; import Select from '../select'; diff --git a/components/popconfirm/PurePanel.tsx b/components/popconfirm/PurePanel.tsx index 52b21eaaf6..474648b3ed 100644 --- a/components/popconfirm/PurePanel.tsx +++ b/components/popconfirm/PurePanel.tsx @@ -1,6 +1,6 @@ import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { PopconfirmProps } from '.'; import Button from '../button'; import { convertLegacyProps } from '../button/button'; diff --git a/components/popconfirm/__tests__/demo.test.tsx b/components/popconfirm/__tests__/demo.test.tsx index ae0f7f0816..f89cbd3f87 100644 --- a/components/popconfirm/__tests__/demo.test.tsx +++ b/components/popconfirm/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('popconfirm', { diff --git a/components/popconfirm/__tests__/type.test.tsx b/components/popconfirm/__tests__/type.test.tsx index 938e790f2c..d83cbdbd63 100644 --- a/components/popconfirm/__tests__/type.test.tsx +++ b/components/popconfirm/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Popconfirm from '..'; describe('Popconfirm.typescript', () => { diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index d8c4aa1ed3..b7e9535717 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -2,7 +2,7 @@ import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import classNames from 'classnames'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; import KeyCode from 'rc-util/lib/KeyCode'; -import * as React from 'react'; +import React from 'react'; import omit from 'rc-util/lib/omit'; import type { ButtonProps, LegacyButtonType } from '../button/button'; import { ConfigContext } from '../config-provider'; diff --git a/components/popover/PurePanel.tsx b/components/popover/PurePanel.tsx index 29259c7f15..d51ee0fdf3 100644 --- a/components/popover/PurePanel.tsx +++ b/components/popover/PurePanel.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import { Popup } from 'rc-tooltip'; -import * as React from 'react'; +import React from 'react'; import type { PopoverProps } from '.'; import { ConfigContext } from '../config-provider'; diff --git a/components/popover/__tests__/demo.test.tsx b/components/popover/__tests__/demo.test.tsx index b02c927e55..948926e348 100644 --- a/components/popover/__tests__/demo.test.tsx +++ b/components/popover/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('popover', { diff --git a/components/popover/index.tsx b/components/popover/index.tsx index 225c344d92..6980940a50 100644 --- a/components/popover/index.tsx +++ b/components/popover/index.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { AbstractTooltipProps } from '../tooltip'; import Tooltip from '../tooltip'; diff --git a/components/progress/Circle.tsx b/components/progress/Circle.tsx index 06cb3acb16..e05d710f0b 100644 --- a/components/progress/Circle.tsx +++ b/components/progress/Circle.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import type { ProgressProps as RcProgressProps } from 'rc-progress'; import { Circle as RCCircle } from 'rc-progress'; -import * as React from 'react'; +import React from 'react'; import Tooltip from '../tooltip'; import type { ProgressGradient, ProgressProps } from './progress'; import { getPercentage, getSize, getStrokeColor } from './utils'; diff --git a/components/progress/Line.tsx b/components/progress/Line.tsx index 1e1db33a7b..4552e10060 100644 --- a/components/progress/Line.tsx +++ b/components/progress/Line.tsx @@ -1,7 +1,7 @@ import { presetPrimaryColors } from '@ant-design/colors'; -import * as React from 'react'; -import type { DirectionType } from '../config-provider'; +import React from 'react'; import warning from '../_util/warning'; +import type { DirectionType } from '../config-provider'; import type { ProgressGradient, ProgressProps, StringGradients } from './progress'; import { getSize, getSuccessPercent, validProgress } from './utils'; diff --git a/components/progress/Steps.tsx b/components/progress/Steps.tsx index 85f7c27b59..4bdd98f535 100644 --- a/components/progress/Steps.tsx +++ b/components/progress/Steps.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { ProgressProps } from './progress'; import { getSize } from './utils'; diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index 5a28175659..7448f73423 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -4,10 +4,10 @@ import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; +import warning from '../_util/warning'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; -import warning from '../_util/warning'; import Circle from './Circle'; import Line from './Line'; import Steps from './Steps'; diff --git a/components/radio/__tests__/demo.test.tsx b/components/radio/__tests__/demo.test.tsx index 720cdbde0b..0003619ffb 100644 --- a/components/radio/__tests__/demo.test.tsx +++ b/components/radio/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('radio'); diff --git a/components/radio/context.tsx b/components/radio/context.tsx index 46cf29de64..4383af5dbe 100644 --- a/components/radio/context.tsx +++ b/components/radio/context.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { RadioGroupContextProps, RadioOptionTypeContextProps } from './interface'; const RadioGroupContext = React.createContext(null); diff --git a/components/radio/group.tsx b/components/radio/group.tsx index 7e8433d7e1..581c764469 100644 --- a/components/radio/group.tsx +++ b/components/radio/group.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import SizeContext from '../config-provider/SizeContext'; import getDataOrAriaProps from '../_util/getDataOrAriaProps'; diff --git a/components/radio/radio.tsx b/components/radio/radio.tsx index d2b786682c..8615a302a1 100644 --- a/components/radio/radio.tsx +++ b/components/radio/radio.tsx @@ -2,7 +2,7 @@ import classNames from 'classnames'; import type { CheckboxRef } from 'rc-checkbox'; import RcCheckbox from 'rc-checkbox'; import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import DisabledContext from '../config-provider/DisabledContext'; import { FormItemInputContext } from '../form/context'; diff --git a/components/radio/radioButton.tsx b/components/radio/radioButton.tsx index 1cdf3b6a94..21ad910aa9 100644 --- a/components/radio/radioButton.tsx +++ b/components/radio/radioButton.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { AbstractCheckboxProps } from '../checkbox/Checkbox'; import { ConfigContext } from '../config-provider'; import { RadioOptionTypeContextProvider } from './context'; diff --git a/components/rate/index.tsx b/components/rate/index.tsx index 2028b8b6fa..8c67a6ca44 100644 --- a/components/rate/index.tsx +++ b/components/rate/index.tsx @@ -2,7 +2,7 @@ import StarFilled from '@ant-design/icons/StarFilled'; import classNames from 'classnames'; import RcRate from 'rc-rate'; import type { RateProps as RcRateProps, RateRef } from 'rc-rate/lib/Rate'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import Tooltip from '../tooltip'; import useStyle from './style'; diff --git a/components/result/__tests__/type.test.tsx b/components/result/__tests__/type.test.tsx index 14d8f6d7fb..6e877c7f85 100644 --- a/components/result/__tests__/type.test.tsx +++ b/components/result/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Result from '..'; describe('Result.typescript', () => { diff --git a/components/result/index.tsx b/components/result/index.tsx index 08041a5ba4..687d0e9179 100644 --- a/components/result/index.tsx +++ b/components/result/index.tsx @@ -3,7 +3,7 @@ import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import WarningFilled from '@ant-design/icons/WarningFilled'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import warning from '../_util/warning'; diff --git a/components/result/noFound.tsx b/components/result/noFound.tsx index e18365821f..13872117f5 100644 --- a/components/result/noFound.tsx +++ b/components/result/noFound.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; const NoFound: React.FC = () => ( diff --git a/components/result/serverError.tsx b/components/result/serverError.tsx index a4ed73538e..f16f24e8b6 100644 --- a/components/result/serverError.tsx +++ b/components/result/serverError.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; const ServerError: React.FC = () => ( diff --git a/components/result/unauthorized.tsx b/components/result/unauthorized.tsx index 7fbc1f2e6e..8202f3a222 100644 --- a/components/result/unauthorized.tsx +++ b/components/result/unauthorized.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; const Unauthorized: React.FC = () => ( diff --git a/components/segmented/index.tsx b/components/segmented/index.tsx index 49190ae081..da84af0659 100644 --- a/components/segmented/index.tsx +++ b/components/segmented/index.tsx @@ -5,7 +5,7 @@ import type { SegmentedRawOption, } from 'rc-segmented'; import RcSegmented from 'rc-segmented'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SizeType } from '../config-provider/SizeContext'; diff --git a/components/select/__tests__/demo.test.tsx b/components/select/__tests__/demo.test.tsx index ce4fb72cc7..4810b6f6ba 100644 --- a/components/select/__tests__/demo.test.tsx +++ b/components/select/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('select', { diff --git a/components/select/index.tsx b/components/select/index.tsx index 4bc74e9540..78830a16ca 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -5,7 +5,7 @@ import RcSelect, { OptGroup, Option } from 'rc-select'; import type { OptionProps } from 'rc-select/lib/Option'; import type { BaseOptionType, DefaultOptionType } from 'rc-select/lib/Select'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import genPurePanel from '../_util/PurePanel'; import type { SelectCommonPlacement } from '../_util/motion'; import { getTransitionDirection, getTransitionName } from '../_util/motion'; diff --git a/components/select/utils/iconUtil.tsx b/components/select/utils/iconUtil.tsx index 45df8e1072..99d9990c7f 100644 --- a/components/select/utils/iconUtil.tsx +++ b/components/select/utils/iconUtil.tsx @@ -5,7 +5,7 @@ import DownOutlined from '@ant-design/icons/DownOutlined'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import SearchOutlined from '@ant-design/icons/SearchOutlined'; import type { ReactNode } from 'react'; -import * as React from 'react'; +import React from 'react'; type RenderNode = React.ReactNode | ((props: any) => React.ReactNode); diff --git a/components/skeleton/Avatar.tsx b/components/skeleton/Avatar.tsx index 0a7b86d6af..faa74ec4fc 100644 --- a/components/skeleton/Avatar.tsx +++ b/components/skeleton/Avatar.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; import Element from './Element'; diff --git a/components/skeleton/Button.tsx b/components/skeleton/Button.tsx index 10018723b3..23629f9920 100644 --- a/components/skeleton/Button.tsx +++ b/components/skeleton/Button.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; import Element from './Element'; diff --git a/components/skeleton/Element.tsx b/components/skeleton/Element.tsx index 160e07629c..bc951fd274 100644 --- a/components/skeleton/Element.tsx +++ b/components/skeleton/Element.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; export interface SkeletonElementProps { prefixCls?: string; diff --git a/components/skeleton/Image.tsx b/components/skeleton/Image.tsx index 886aad5c5c..068199df33 100644 --- a/components/skeleton/Image.tsx +++ b/components/skeleton/Image.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; import useStyle from './style'; diff --git a/components/skeleton/Input.tsx b/components/skeleton/Input.tsx index 29b2a84838..235924fc67 100644 --- a/components/skeleton/Input.tsx +++ b/components/skeleton/Input.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; import Element from './Element'; diff --git a/components/skeleton/Node.tsx b/components/skeleton/Node.tsx index 245bc34791..bfdf70162a 100644 --- a/components/skeleton/Node.tsx +++ b/components/skeleton/Node.tsx @@ -1,6 +1,6 @@ import DotChartOutlined from '@ant-design/icons/DotChartOutlined'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; import useStyle from './style'; diff --git a/components/skeleton/Paragraph.tsx b/components/skeleton/Paragraph.tsx index 19a6af4b87..cbccf0033a 100644 --- a/components/skeleton/Paragraph.tsx +++ b/components/skeleton/Paragraph.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; type widthUnit = number | string; diff --git a/components/skeleton/Skeleton.tsx b/components/skeleton/Skeleton.tsx index d799d39374..4f918b4adb 100644 --- a/components/skeleton/Skeleton.tsx +++ b/components/skeleton/Skeleton.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { AvatarProps } from './Avatar'; import SkeletonAvatar from './Avatar'; diff --git a/components/skeleton/Title.tsx b/components/skeleton/Title.tsx index d1aa854030..d23e44e3e7 100644 --- a/components/skeleton/Title.tsx +++ b/components/skeleton/Title.tsx @@ -1,6 +1,6 @@ /* eslint-disable jsx-a11y/heading-has-content */ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; export interface SkeletonTitleProps { prefixCls?: string; diff --git a/components/skeleton/__tests__/demo.test.tsx b/components/skeleton/__tests__/demo.test.tsx index e7c77fcc9e..41ae411473 100644 --- a/components/skeleton/__tests__/demo.test.tsx +++ b/components/skeleton/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('skeleton'); diff --git a/components/slider/SliderTooltip.tsx b/components/slider/SliderTooltip.tsx index 5cd2a104f3..ce337865f2 100644 --- a/components/slider/SliderTooltip.tsx +++ b/components/slider/SliderTooltip.tsx @@ -1,7 +1,6 @@ import raf from 'rc-util/lib/raf'; import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; -import { useRef } from 'react'; +import React, { useRef } from 'react'; import type { TooltipProps } from '../tooltip'; import Tooltip from '../tooltip'; diff --git a/components/slider/__tests__/type.test.tsx b/components/slider/__tests__/type.test.tsx index b1219a71eb..d30bbd6e2e 100644 --- a/components/slider/__tests__/type.test.tsx +++ b/components/slider/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Slider from '..'; describe('Slider.typescript', () => { diff --git a/components/slider/index.tsx b/components/slider/index.tsx index 545980d7b8..4c62f0cfbd 100644 --- a/components/slider/index.tsx +++ b/components/slider/index.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import type { SliderProps as RcSliderProps } from 'rc-slider'; import RcSlider from 'rc-slider'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { TooltipPlacement } from '../tooltip'; import warning from '../_util/warning'; diff --git a/components/space/Compact.tsx b/components/space/Compact.tsx index 4168cf1586..d08ae04cea 100644 --- a/components/space/Compact.tsx +++ b/components/space/Compact.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import toArray from 'rc-util/lib/Children/toArray'; -import * as React from 'react'; +import React from 'react'; import type { DirectionType } from '../config-provider'; import { ConfigContext } from '../config-provider'; diff --git a/components/space/Item.tsx b/components/space/Item.tsx index 68864b1246..ea6e5b2d8f 100644 --- a/components/space/Item.tsx +++ b/components/space/Item.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { SpaceContext } from '.'; export interface ItemProps { diff --git a/components/space/__tests__/demo.test.tsx b/components/space/__tests__/demo.test.tsx index 31b27af803..d5e8d39ecb 100644 --- a/components/space/__tests__/demo.test.tsx +++ b/components/space/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; diff --git a/components/space/index.tsx b/components/space/index.tsx index 49d34ed761..d0c97d2174 100644 --- a/components/space/index.tsx +++ b/components/space/index.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import toArray from 'rc-util/lib/Children/toArray'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SizeType } from '../config-provider/SizeContext'; import useFlexGapSupport from '../_util/hooks/useFlexGapSupport'; diff --git a/components/spin/index.tsx b/components/spin/index.tsx index 8527a9a9b9..ae17fff0fe 100644 --- a/components/spin/index.tsx +++ b/components/spin/index.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import { debounce } from 'throttle-debounce'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; import { cloneElement, isValidElement } from '../_util/reactNode'; diff --git a/components/spin/style/index.tsx b/components/spin/style/index.tsx index 14626ed2eb..20848a8703 100644 --- a/components/spin/style/index.tsx +++ b/components/spin/style/index.tsx @@ -29,6 +29,7 @@ const genSpinStyle: GenerateStyle = (token: SpinToken): CSSObject => position: 'absolute', display: 'none', color: token.colorPrimary, + fontSize: 0, textAlign: 'center', verticalAlign: 'middle', opacity: 0, @@ -65,6 +66,7 @@ const genSpinStyle: GenerateStyle = (token: SpinToken): CSSObject => width: '100%', paddingTop: (token.spinDotSize - token.fontSize) / 2 + 2, textShadow: `0 1px 2px ${token.colorBgContainer}`, // FIXME: shadow + fontSize: token.fontSize, }, [`&${token.componentCls}-show-text ${token.componentCls}-dot`]: { diff --git a/components/statistic/Countdown.tsx b/components/statistic/Countdown.tsx index 4fcd5c95ee..f68c84da08 100644 --- a/components/statistic/Countdown.tsx +++ b/components/statistic/Countdown.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import useForceUpdate from '../_util/hooks/useForceUpdate'; import { cloneElement } from '../_util/reactNode'; import type { StatisticProps } from './Statistic'; diff --git a/components/statistic/Number.tsx b/components/statistic/Number.tsx index bc5c3d6f5e..0ba4d09120 100644 --- a/components/statistic/Number.tsx +++ b/components/statistic/Number.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { FormatConfig, valueType } from './utils'; interface NumberProps extends FormatConfig { diff --git a/components/statistic/Statistic.tsx b/components/statistic/Statistic.tsx index 73e1c21716..10fbefc5e4 100644 --- a/components/statistic/Statistic.tsx +++ b/components/statistic/Statistic.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; import Skeleton from '../skeleton'; diff --git a/components/steps/index.tsx b/components/steps/index.tsx index 98b6e5184b..7d6379bcf6 100644 --- a/components/steps/index.tsx +++ b/components/steps/index.tsx @@ -7,7 +7,7 @@ import type { StepIconRender, StepsProps as RcStepsProps, } from 'rc-steps/lib/Steps'; -import * as React from 'react'; +import React from 'react'; import Tooltip from '../tooltip'; import { ConfigContext } from '../config-provider'; import useBreakpoint from '../grid/hooks/useBreakpoint'; diff --git a/components/steps/useLegacyItems.ts b/components/steps/useLegacyItems.ts index efa597e3a2..6d0ecdb494 100644 --- a/components/steps/useLegacyItems.ts +++ b/components/steps/useLegacyItems.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import toArray from 'rc-util/lib/Children/toArray'; import type { StepProps } from '.'; import warning from '../_util/warning'; diff --git a/components/switch/index.tsx b/components/switch/index.tsx index dd21ff3a12..2d2ba7079a 100755 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -1,7 +1,7 @@ import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import classNames from 'classnames'; import RcSwitch from 'rc-switch'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import DisabledContext from '../config-provider/DisabledContext'; diff --git a/components/table/ExpandIcon.tsx b/components/table/ExpandIcon.tsx index 64c3f79360..6cf808036c 100644 --- a/components/table/ExpandIcon.tsx +++ b/components/table/ExpandIcon.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { TableLocale } from './interface'; interface DefaultExpandIconProps { diff --git a/components/table/InternalTable.tsx b/components/table/InternalTable.tsx index 2fa2a9c478..bc890b8ee5 100644 --- a/components/table/InternalTable.tsx +++ b/components/table/InternalTable.tsx @@ -3,7 +3,7 @@ import type { TableProps as RcTableProps } from 'rc-table/lib/Table'; import { INTERNAL_HOOKS } from 'rc-table/lib/Table'; import { convertChildrenToColumns } from 'rc-table/lib/hooks/useColumns'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import type { Breakpoint } from '../_util/responsiveObserver'; import scrollTo from '../_util/scrollTo'; import warning from '../_util/warning'; diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 0820749e57..f5689b8d85 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -1,5 +1,5 @@ import { EXPAND_COLUMN, Summary } from 'rc-table'; -import * as React from 'react'; +import React from 'react'; import Column from './Column'; import ColumnGroup from './ColumnGroup'; import type { TableProps } from './InternalTable'; diff --git a/components/table/__tests__/type.test.tsx b/components/table/__tests__/type.test.tsx index c1af784d3d..8d8cbc682d 100644 --- a/components/table/__tests__/type.test.tsx +++ b/components/table/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { ColumnProps } from '..'; import type { TreeColumnFilterItem } from '../hooks/useFilter/FilterDropdown'; import Table from '..'; diff --git a/components/table/hooks/useFilter/FilterDropdown.tsx b/components/table/hooks/useFilter/FilterDropdown.tsx index 7c7358a3a0..f6d36bc427 100644 --- a/components/table/hooks/useFilter/FilterDropdown.tsx +++ b/components/table/hooks/useFilter/FilterDropdown.tsx @@ -2,7 +2,7 @@ import FilterFilled from '@ant-design/icons/FilterFilled'; import classNames from 'classnames'; import isEqual from 'rc-util/lib/isEqual'; import type { FieldDataNode } from 'rc-tree'; -import * as React from 'react'; +import React from 'react'; import type { MenuProps } from '../../../menu'; import type { FilterState } from '.'; import { flattenKeys } from '.'; diff --git a/components/table/hooks/useFilter/FilterSearch.tsx b/components/table/hooks/useFilter/FilterSearch.tsx index 5a837531f3..f0f96a2a61 100644 --- a/components/table/hooks/useFilter/FilterSearch.tsx +++ b/components/table/hooks/useFilter/FilterSearch.tsx @@ -1,5 +1,5 @@ import SearchOutlined from '@ant-design/icons/SearchOutlined'; -import * as React from 'react'; +import React from 'react'; import Input from '../../../input'; import type { FilterSearchType, TableLocale } from '../../interface'; diff --git a/components/table/hooks/useFilter/FilterWrapper.tsx b/components/table/hooks/useFilter/FilterWrapper.tsx index d92a1d9fdf..12f0a9bc3a 100644 --- a/components/table/hooks/useFilter/FilterWrapper.tsx +++ b/components/table/hooks/useFilter/FilterWrapper.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import KeyCode from 'rc-util/lib/KeyCode'; export interface FilterDropdownMenuWrapperProps { diff --git a/components/table/hooks/useFilter/index.tsx b/components/table/hooks/useFilter/index.tsx index ae58ffe464..1056eba9ff 100644 --- a/components/table/hooks/useFilter/index.tsx +++ b/components/table/hooks/useFilter/index.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import warning from '../../../_util/warning'; import type { ColumnFilterItem, diff --git a/components/table/hooks/useLazyKVMap.ts b/components/table/hooks/useLazyKVMap.ts index dd2c362635..ae440e2ae0 100644 --- a/components/table/hooks/useLazyKVMap.ts +++ b/components/table/hooks/useLazyKVMap.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { GetRowKey, Key } from '../interface'; interface MapCache { diff --git a/components/table/hooks/useSelection.tsx b/components/table/hooks/useSelection.tsx index 9eb92940b3..49103d5c85 100644 --- a/components/table/hooks/useSelection.tsx +++ b/components/table/hooks/useSelection.tsx @@ -7,8 +7,7 @@ import { arrAdd, arrDel } from 'rc-tree/lib/util'; import { conductCheck } from 'rc-tree/lib/utils/conductUtil'; import { convertDataToEntities } from 'rc-tree/lib/utils/treeUtil'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import * as React from 'react'; -import { useCallback, useMemo, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import warning from '../../_util/warning'; import type { CheckboxProps } from '../../checkbox'; import Checkbox from '../../checkbox'; diff --git a/components/table/hooks/useSorter.tsx b/components/table/hooks/useSorter.tsx index 18eda6cac7..59d4f222de 100644 --- a/components/table/hooks/useSorter.tsx +++ b/components/table/hooks/useSorter.tsx @@ -2,7 +2,7 @@ import CaretDownOutlined from '@ant-design/icons/CaretDownOutlined'; import CaretUpOutlined from '@ant-design/icons/CaretUpOutlined'; import classNames from 'classnames'; import KeyCode from 'rc-util/lib/KeyCode'; -import * as React from 'react'; +import React from 'react'; import type { TooltipProps } from '../../tooltip'; import Tooltip from '../../tooltip'; import type { diff --git a/components/table/hooks/useTitleColumns.ts b/components/table/hooks/useTitleColumns.ts index 4f449b23e4..e8c48317e7 100644 --- a/components/table/hooks/useTitleColumns.ts +++ b/components/table/hooks/useTitleColumns.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { ColumnsType, ColumnTitleProps, TransformColumns } from '../interface'; import { renderColumnTitle } from '../util'; diff --git a/components/tabs/hooks/useLegacyItems.ts b/components/tabs/hooks/useLegacyItems.ts index c3da377e1c..17b113a850 100644 --- a/components/tabs/hooks/useLegacyItems.ts +++ b/components/tabs/hooks/useLegacyItems.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import toArray from 'rc-util/lib/Children/toArray'; import type { Tab } from 'rc-tabs/lib/interface'; import type { TabsProps, TabPaneProps } from '..'; diff --git a/components/tabs/index.tsx b/components/tabs/index.tsx index 55f237c2ef..167ae4fca0 100755 --- a/components/tabs/index.tsx +++ b/components/tabs/index.tsx @@ -5,7 +5,7 @@ import classNames from 'classnames'; import type { TabsProps as RcTabsProps } from 'rc-tabs'; import RcTabs from 'rc-tabs'; import type { EditableConfig } from 'rc-tabs/lib/interface'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { SizeType } from '../config-provider/SizeContext'; import SizeContext from '../config-provider/SizeContext'; diff --git a/components/tag/CheckableTag.tsx b/components/tag/CheckableTag.tsx index b806786c65..48bcce51cc 100644 --- a/components/tag/CheckableTag.tsx +++ b/components/tag/CheckableTag.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import useStyle from './style'; diff --git a/components/tag/index.tsx b/components/tag/index.tsx index c3b4ac8fd6..2256eebafc 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -1,6 +1,6 @@ import CloseOutlined from '@ant-design/icons/CloseOutlined'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { PresetColorType, PresetStatusColorType } from '../_util/colors'; import { isPresetColor, isPresetStatusColor } from '../_util/colors'; import type { LiteralUnion } from '../_util/type'; diff --git a/components/theme/__tests__/token.test.tsx b/components/theme/__tests__/token.test.tsx index 72d59a1279..ef74c3faf7 100644 --- a/components/theme/__tests__/token.test.tsx +++ b/components/theme/__tests__/token.test.tsx @@ -1,5 +1,5 @@ import { Theme } from '@ant-design/cssinjs'; -import * as React from 'react'; +import React from 'react'; import theme from '..'; import { render, renderHook } from '../../../tests/utils'; import ConfigProvider from '../../config-provider'; diff --git a/components/time-picker/__tests__/demo.test.tsx b/components/time-picker/__tests__/demo.test.tsx index b56475e4c6..d17fdd8f46 100644 --- a/components/time-picker/__tests__/demo.test.tsx +++ b/components/time-picker/__tests__/demo.test.tsx @@ -1,5 +1,5 @@ import dayjs from 'dayjs'; -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('time-picker', { diff --git a/components/time-picker/__tests__/type.test.tsx b/components/time-picker/__tests__/type.test.tsx index 92cdb9ce38..5c589a1d0f 100644 --- a/components/time-picker/__tests__/type.test.tsx +++ b/components/time-picker/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import TimePicker from '..'; describe('TimePicker.typescript', () => { diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index 909e0c9b77..e814840260 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -1,5 +1,5 @@ import type { Dayjs } from 'dayjs'; -import * as React from 'react'; +import React from 'react'; import DatePicker from '../date-picker'; import type { PickerTimeProps, RangePickerTimeProps } from '../date-picker/generatePicker'; import genPurePanel from '../_util/PurePanel'; diff --git a/components/timeline/Timeline.tsx b/components/timeline/Timeline.tsx index 6ffead4a5c..7778d72d43 100644 --- a/components/timeline/Timeline.tsx +++ b/components/timeline/Timeline.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { TimelineItemProps } from './TimelineItem'; import TimelineItemList from './TimelineItemList'; diff --git a/components/timeline/TimelineItem.tsx b/components/timeline/TimelineItem.tsx index f9e0fcbeee..ce32db2426 100644 --- a/components/timeline/TimelineItem.tsx +++ b/components/timeline/TimelineItem.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { LiteralUnion } from '../_util/type'; diff --git a/components/timeline/TimelineItemList.tsx b/components/timeline/TimelineItemList.tsx index d31ad82243..abfdfb5cde 100644 --- a/components/timeline/TimelineItemList.tsx +++ b/components/timeline/TimelineItemList.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import TimelineItem from './TimelineItem'; import type { TimelineProps } from './Timeline'; diff --git a/components/tooltip/PurePanel.tsx b/components/tooltip/PurePanel.tsx index 521fd4a7b1..d9468e129a 100644 --- a/components/tooltip/PurePanel.tsx +++ b/components/tooltip/PurePanel.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import { Popup } from 'rc-tooltip'; -import * as React from 'react'; +import React from 'react'; import type { TooltipProps } from '.'; import { ConfigContext } from '../config-provider'; diff --git a/components/tooltip/__tests__/demo.test.tsx b/components/tooltip/__tests__/demo.test.tsx index 72468220d9..1cf4081c81 100644 --- a/components/tooltip/__tests__/demo.test.tsx +++ b/components/tooltip/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('tooltip', { diff --git a/components/tooltip/__tests__/type.test.tsx b/components/tooltip/__tests__/type.test.tsx index e1be478ff3..16e6af7989 100644 --- a/components/tooltip/__tests__/type.test.tsx +++ b/components/tooltip/__tests__/type.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Tooltip from '..'; describe('Tooltip.typescript', () => { diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 2778a32226..887b2f54c1 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -1,17 +1,14 @@ -import type { BuildInPlacements, AlignType } from '@rc-component/trigger'; +import type { AlignType, BuildInPlacements } from '@rc-component/trigger'; import classNames from 'classnames'; import RcTooltip from 'rc-tooltip'; -import type { placements as Placements } from 'rc-tooltip/lib/placements'; import type { TooltipProps as RcTooltipProps, TooltipRef as RcTooltipRef, } from 'rc-tooltip/lib/Tooltip'; +import type { placements as Placements } from 'rc-tooltip/lib/placements'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; import type { CSSProperties } from 'react'; -import * as React from 'react'; -import { ConfigContext } from '../config-provider'; -import { NoCompactStyle } from '../space/Compact'; -import theme from '../theme'; +import React from 'react'; import type { PresetColorType } from '../_util/colors'; import { getTransitionName } from '../_util/motion'; import type { AdjustOverflow, PlacementsConfig } from '../_util/placements'; @@ -19,6 +16,9 @@ import getPlacements from '../_util/placements'; import { cloneElement, isFragment, isValidElement } from '../_util/reactNode'; import type { LiteralUnion } from '../_util/type'; import warning from '../_util/warning'; +import { ConfigContext } from '../config-provider'; +import { NoCompactStyle } from '../space/Compact'; +import theme from '../theme'; import PurePanel from './PurePanel'; import useStyle from './style'; import { parseColor } from './util'; diff --git a/components/tour/PurePanel.tsx b/components/tour/PurePanel.tsx index a6bb5e0b95..1b7c8f01b2 100644 --- a/components/tour/PurePanel.tsx +++ b/components/tour/PurePanel.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import { RawPurePanel as PopoverRawPurePanel } from '../popover/PurePanel'; import type { TourStepProps } from './interface'; diff --git a/components/tour/__tests__/demo.test.tsx b/components/tour/__tests__/demo.test.tsx index 31d55a5d58..0dcdb886f6 100644 --- a/components/tour/__tests__/demo.test.tsx +++ b/components/tour/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('tour', { diff --git a/components/transfer/ListBody.tsx b/components/transfer/ListBody.tsx index e57c60c075..0a37574d7f 100644 --- a/components/transfer/ListBody.tsx +++ b/components/transfer/ListBody.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { KeyWiseTransferItem } from '.'; import type { PaginationType } from './interface'; import type { RenderedItem, TransferListProps } from './list'; diff --git a/components/transfer/ListItem.tsx b/components/transfer/ListItem.tsx index 0bca1a22ff..a5a173dc64 100644 --- a/components/transfer/ListItem.tsx +++ b/components/transfer/ListItem.tsx @@ -1,6 +1,6 @@ import DeleteOutlined from '@ant-design/icons/DeleteOutlined'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import type { KeyWiseTransferItem } from '.'; import Checkbox from '../checkbox'; import defaultLocale from '../locale/en_US'; diff --git a/components/transfer/operation.tsx b/components/transfer/operation.tsx index d8df7ee31e..9b1cf4c1b7 100644 --- a/components/transfer/operation.tsx +++ b/components/transfer/operation.tsx @@ -1,6 +1,6 @@ import LeftOutlined from '@ant-design/icons/LeftOutlined'; import RightOutlined from '@ant-design/icons/RightOutlined'; -import * as React from 'react'; +import React from 'react'; import Button from '../button'; import type { DirectionType } from '../config-provider'; diff --git a/components/transfer/search.tsx b/components/transfer/search.tsx index e5cec43be5..82e9b6a96f 100644 --- a/components/transfer/search.tsx +++ b/components/transfer/search.tsx @@ -1,5 +1,5 @@ import SearchOutlined from '@ant-design/icons/SearchOutlined'; -import * as React from 'react'; +import React from 'react'; import Input from '../input'; diff --git a/components/tree-select/__tests__/demo.test.tsx b/components/tree-select/__tests__/demo.test.tsx index 61d664cb8f..6b58e254fe 100644 --- a/components/tree-select/__tests__/demo.test.tsx +++ b/components/tree-select/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('tree-select', { diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index 2d95cd67e0..96720e2bb9 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -5,7 +5,7 @@ import type { TreeSelectProps as RcTreeSelectProps } from 'rc-tree-select'; import RcTreeSelect, { SHOW_ALL, SHOW_CHILD, SHOW_PARENT, TreeNode } from 'rc-tree-select'; import type { BaseOptionType, DefaultOptionType } from 'rc-tree-select/lib/TreeSelect'; import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import genPurePanel from '../_util/PurePanel'; import type { SelectCommonPlacement } from '../_util/motion'; import { getTransitionDirection, getTransitionName } from '../_util/motion'; diff --git a/components/tree/DirectoryTree.tsx b/components/tree/DirectoryTree.tsx index 914973981a..baed7dc7f3 100644 --- a/components/tree/DirectoryTree.tsx +++ b/components/tree/DirectoryTree.tsx @@ -7,7 +7,7 @@ import type { BasicDataNode } from 'rc-tree'; import type { DataNode, EventDataNode, Key } from 'rc-tree/lib/interface'; import { conductExpandParent } from 'rc-tree/lib/util'; import { convertDataToEntities, convertTreeToData } from 'rc-tree/lib/utils/treeUtil'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../config-provider'; import type { AntdTreeNodeAttribute, TreeProps } from './Tree'; diff --git a/components/tree/__tests__/type.test.tsx b/components/tree/__tests__/type.test.tsx index 3d277b7821..2ee1e99355 100644 --- a/components/tree/__tests__/type.test.tsx +++ b/components/tree/__tests__/type.test.tsx @@ -1,5 +1,5 @@ import type { BasicDataNode } from 'rc-tree'; -import * as React from 'react'; +import React from 'react'; import { render } from '../../../tests/utils'; import type { DataNode } from '../index'; import Tree from '../index'; diff --git a/components/tree/utils/iconUtil.tsx b/components/tree/utils/iconUtil.tsx index 83d78d5322..bf0e3cfb9b 100644 --- a/components/tree/utils/iconUtil.tsx +++ b/components/tree/utils/iconUtil.tsx @@ -4,7 +4,7 @@ import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import MinusSquareOutlined from '@ant-design/icons/MinusSquareOutlined'; import PlusSquareOutlined from '@ant-design/icons/PlusSquareOutlined'; import classNames from 'classnames'; -import * as React from 'react'; +import React from 'react'; import { cloneElement, isValidElement } from '../../_util/reactNode'; import type { AntTreeNodeProps, SwitcherIcon, TreeLeafIcon } from '../Tree'; diff --git a/components/typography/Base/Ellipsis.tsx b/components/typography/Base/Ellipsis.tsx index d29cd394cd..5a8e7c7ce4 100644 --- a/components/typography/Base/Ellipsis.tsx +++ b/components/typography/Base/Ellipsis.tsx @@ -1,6 +1,6 @@ import toArray from 'rc-util/lib/Children/toArray'; import useIsomorphicLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import * as React from 'react'; +import React from 'react'; export interface EllipsisProps { enabledMeasure?: boolean; diff --git a/components/typography/Base/EllipsisTooltip.tsx b/components/typography/Base/EllipsisTooltip.tsx index 35c096a424..f6a8826c2d 100644 --- a/components/typography/Base/EllipsisTooltip.tsx +++ b/components/typography/Base/EllipsisTooltip.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import Tooltip from '../../tooltip'; import type { TooltipProps } from '../../tooltip'; diff --git a/components/typography/Base/index.tsx b/components/typography/Base/index.tsx index 9c712fc529..8753171215 100644 --- a/components/typography/Base/index.tsx +++ b/components/typography/Base/index.tsx @@ -10,7 +10,7 @@ import useIsomorphicLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; import omit from 'rc-util/lib/omit'; import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../../config-provider'; import useLocale from '../../locale/useLocale'; import type { TooltipProps } from '../../tooltip'; diff --git a/components/typography/Editable.tsx b/components/typography/Editable.tsx index e80dd76d11..bbb8cb68b9 100644 --- a/components/typography/Editable.tsx +++ b/components/typography/Editable.tsx @@ -2,7 +2,7 @@ import EnterOutlined from '@ant-design/icons/EnterOutlined'; import classNames from 'classnames'; import type { AutoSizeType } from 'rc-textarea'; import KeyCode from 'rc-util/lib/KeyCode'; -import * as React from 'react'; +import React from 'react'; import type { DirectionType } from '../config-provider'; import TextArea from '../input/TextArea'; import type { TextAreaRef } from '../input/TextArea'; diff --git a/components/typography/Link.tsx b/components/typography/Link.tsx index 36745f0f31..4de9e490cf 100644 --- a/components/typography/Link.tsx +++ b/components/typography/Link.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import warning from '../_util/warning'; import type { BlockProps } from './Base'; import Base from './Base'; diff --git a/components/typography/Paragraph.tsx b/components/typography/Paragraph.tsx index 81ae66831a..0cb72dddc3 100644 --- a/components/typography/Paragraph.tsx +++ b/components/typography/Paragraph.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { BlockProps } from './Base'; import Base from './Base'; diff --git a/components/typography/Text.tsx b/components/typography/Text.tsx index 1b50b30c03..5984ca32ee 100644 --- a/components/typography/Text.tsx +++ b/components/typography/Text.tsx @@ -1,5 +1,5 @@ import omit from 'rc-util/lib/omit'; -import * as React from 'react'; +import React from 'react'; import warning from '../_util/warning'; import type { BlockProps, EllipsisConfig } from './Base'; import Base from './Base'; diff --git a/components/typography/Title.tsx b/components/typography/Title.tsx index 926d9f6500..90d7cbdd11 100644 --- a/components/typography/Title.tsx +++ b/components/typography/Title.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import warning from '../_util/warning'; import type { BlockProps } from './Base'; import Base from './Base'; diff --git a/components/typography/Typography.tsx b/components/typography/Typography.tsx index 9b78a906a1..18de95261d 100644 --- a/components/typography/Typography.tsx +++ b/components/typography/Typography.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; import { composeRef } from 'rc-util/lib/ref'; -import * as React from 'react'; +import React from 'react'; import type { DirectionType } from '../config-provider'; import { ConfigContext } from '../config-provider'; import warning from '../_util/warning'; diff --git a/components/typography/__tests__/demo.test.tsx b/components/typography/__tests__/demo.test.tsx index b4ed9129ce..7434342879 100644 --- a/components/typography/__tests__/demo.test.tsx +++ b/components/typography/__tests__/demo.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; demoTest('typography'); diff --git a/components/typography/hooks/useMergedConfig.ts b/components/typography/hooks/useMergedConfig.ts index bd16c97e62..4ee6a44f43 100644 --- a/components/typography/hooks/useMergedConfig.ts +++ b/components/typography/hooks/useMergedConfig.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export default function useMergedConfig( propConfig: any, diff --git a/components/typography/hooks/useUpdatedEffect.ts b/components/typography/hooks/useUpdatedEffect.ts index ec85286161..7f4181d350 100644 --- a/components/typography/hooks/useUpdatedEffect.ts +++ b/components/typography/hooks/useUpdatedEffect.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; /** Similar with `useEffect` but only trigger after mounted */ const useUpdatedEffect = (callback: () => void, conditions?: React.DependencyList) => { diff --git a/components/upload/Dragger.tsx b/components/upload/Dragger.tsx index 4e6efed30a..d86f682881 100644 --- a/components/upload/Dragger.tsx +++ b/components/upload/Dragger.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import type { UploadProps } from './interface'; import Upload from './Upload'; diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index 0e5e0b52ba..5890b4bf7b 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -2,15 +2,20 @@ import classNames from 'classnames'; import type { UploadProps as RcUploadProps } from 'rc-upload'; import RcUpload from 'rc-upload'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import * as React from 'react'; +import React from 'react'; import { flushSync } from 'react-dom'; import { ConfigContext } from '../config-provider'; import DisabledContext from '../config-provider/DisabledContext'; import defaultLocale from '../locale/en_US'; import { useLocale } from '../locale'; import warning from '../_util/warning'; -import type { RcFile, ShowUploadListInterface, UploadChangeParam, UploadFile } from './interface'; -import { UploadProps } from './interface'; +import type { + RcFile, + ShowUploadListInterface, + UploadChangeParam, + UploadFile, + UploadProps, +} from './interface'; import UploadList from './UploadList'; import { file2Obj, getFileItem, removeFileItem, updateFileList } from './utils'; @@ -18,7 +23,7 @@ import useStyle from './style'; export const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`; -export { UploadProps }; +export type { UploadProps }; const InternalUpload: React.ForwardRefRenderFunction = (props, ref) => { const { @@ -378,6 +383,7 @@ const InternalUpload: React.ForwardRefRenderFunction = (pr appendAction={button} appendActionVisible={buttonVisible} itemRender={itemRender} + disabled={mergedDisabled} /> ); }; diff --git a/components/upload/UploadList/ListItem.tsx b/components/upload/UploadList/ListItem.tsx index 3ab5bd121e..c4d92089a8 100644 --- a/components/upload/UploadList/ListItem.tsx +++ b/components/upload/UploadList/ListItem.tsx @@ -3,7 +3,7 @@ import DownloadOutlined from '@ant-design/icons/DownloadOutlined'; import EyeOutlined from '@ant-design/icons/EyeOutlined'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; -import * as React from 'react'; +import React from 'react'; import { ConfigContext } from '../../config-provider'; import Progress from '../../progress'; import Tooltip from '../../tooltip'; diff --git a/components/upload/UploadList/index.tsx b/components/upload/UploadList/index.tsx index 565194f720..8b17ef955c 100644 --- a/components/upload/UploadList/index.tsx +++ b/components/upload/UploadList/index.tsx @@ -5,8 +5,7 @@ import PictureTwoTone from '@ant-design/icons/PictureTwoTone'; import classNames from 'classnames'; import type { CSSMotionListProps } from 'rc-motion'; import CSSMotion, { CSSMotionList } from 'rc-motion'; -import * as React from 'react'; -import { useMemo } from 'react'; +import React from 'react'; import type { ButtonProps } from '../../button'; import Button from '../../button'; import { ConfigContext } from '../../config-provider'; @@ -42,6 +41,7 @@ const InternalUploadList: React.ForwardRefRenderFunction = useMemo(() => { + const listItemMotion: Partial = React.useMemo(() => { const motion = { ...initCollapseMotion(rootPrefixCls), }; diff --git a/components/upload/__tests__/uploadlist.test.tsx b/components/upload/__tests__/uploadlist.test.tsx index 6dd8fdfadc..2498e68896 100644 --- a/components/upload/__tests__/uploadlist.test.tsx +++ b/components/upload/__tests__/uploadlist.test.tsx @@ -1,14 +1,14 @@ import React from 'react'; +import type { UploadFile, UploadProps } from '..'; import Upload from '..'; import { act, fireEvent, render, waitFakeTimer, waitFor } from '../../../tests/utils'; +import type { FormInstance } from '../../form'; import Form from '../../form'; import UploadList from '../UploadList'; +import type { UploadListProps, UploadLocale } from '../interface'; import { previewImage } from '../utils'; import { setup, teardown } from './mock'; import { errorRequest, successRequest } from './requests'; -import type { FormInstance } from '../../form'; -import type { UploadFile, UploadProps } from '..'; -import type { UploadListProps, UploadLocale } from '../interface'; const fileList: UploadProps['fileList'] = [ { @@ -1541,4 +1541,31 @@ describe('Upload List', () => { expect(container.querySelector('.ant-upload-list-item-error')).toBeTruthy(); }); + + // https://github.com/ant-design/ant-design/issues/42056 + describe('when form is disabled but upload is not', () => { + it('should not disable remove button', () => { + const { container } = render( +
+ + + +
, + ); + + const removeButton = container.querySelector('.ant-upload-list-item-actions > button'); + expect(removeButton).toBeTruthy(); + expect(removeButton).not.toBeDisabled(); + }); + }); }); diff --git a/components/upload/interface.ts b/components/upload/interface.ts index 57105c3e7c..b0a9d4e1b7 100755 --- a/components/upload/interface.ts +++ b/components/upload/interface.ts @@ -160,4 +160,8 @@ export interface UploadListProps { appendAction?: React.ReactNode; appendActionVisible?: boolean; itemRender?: ItemRender; + /** + * @internal Only the internal remove button is provided for use + */ + disabled?: boolean; } diff --git a/docs/react/use-custom-date-library.en-US.md b/docs/react/use-custom-date-library.en-US.md index 54a7f88a36..bce3731f53 100644 --- a/docs/react/use-custom-date-library.en-US.md +++ b/docs/react/use-custom-date-library.en-US.md @@ -39,7 +39,7 @@ For example: import { DatePicker } from 'antd'; import type { PickerTimeProps } from 'antd/es/date-picker/generatePicker'; import type { Moment } from 'moment'; -import * as React from 'react'; +import React from 'react'; export interface TimePickerProps extends Omit, 'picker'> {} diff --git a/docs/react/use-custom-date-library.zh-CN.md b/docs/react/use-custom-date-library.zh-CN.md index 4583fe4b6d..70c98271e5 100644 --- a/docs/react/use-custom-date-library.zh-CN.md +++ b/docs/react/use-custom-date-library.zh-CN.md @@ -37,7 +37,7 @@ export default MyDatePicker; import { DatePicker } from 'antd'; import type { PickerTimeProps } from 'antd/es/date-picker/generatePicker'; import type { Moment } from 'moment'; -import * as React from 'react'; +import React from 'react'; export interface TimePickerProps extends Omit, 'picker'> {} diff --git a/package.json b/package.json index 3b03e27ae3..77475c136a 100644 --- a/package.json +++ b/package.json @@ -188,7 +188,7 @@ "@types/jquery": "^3.5.14", "@types/lodash": "^4.14.139", "@types/lz-string": "^1.3.34", - "@types/node": "^18.15.11", + "@types/node": "^20.0.0", "@types/prismjs": "^1.26.0", "@types/progress": "^2.0.5", "@types/puppeteer": "^7.0.4", @@ -215,7 +215,7 @@ "dumi": "^2.1.17", "duplicate-package-checker-webpack-plugin": "^3.0.0", "esbuild-loader": "^3.0.0", - "eslint": "^8.0.0", + "eslint": "~8.39.0", "eslint-config-airbnb": "^19.0.0", "eslint-config-prettier": "^8.0.0", "eslint-import-resolver-typescript": "^3.5.2", @@ -247,7 +247,7 @@ "jest-image-snapshot": "^6.0.0", "jest-puppeteer": "^8.0.4", "jquery": "^3.4.1", - "jsdom": "^21.0.0", + "jsdom": "^22.0.0", "jsonml-to-react-element": "^1.1.11", "jsonml.js": "^0.1.0", "lint-staged": "^13.0.3", diff --git a/tests/__mocks__/@rc-component/trigger.tsx b/tests/__mocks__/@rc-component/trigger.tsx index b9c9d5c88d..1b02a82db7 100644 --- a/tests/__mocks__/@rc-component/trigger.tsx +++ b/tests/__mocks__/@rc-component/trigger.tsx @@ -1,6 +1,6 @@ import type { TriggerProps } from '@rc-component/trigger'; import MockTrigger from '@rc-component/trigger/lib/mock'; -import * as React from 'react'; +import React from 'react'; import { TriggerMockContext } from '../../shared/demoTestContext'; let OriginTrigger = jest.requireActual('@rc-component/trigger'); diff --git a/tests/__mocks__/rc-trigger.tsx b/tests/__mocks__/rc-trigger.tsx index 44631901fe..de6e7d4583 100644 --- a/tests/__mocks__/rc-trigger.tsx +++ b/tests/__mocks__/rc-trigger.tsx @@ -1,6 +1,6 @@ import type { TriggerProps } from 'rc-trigger'; import MockTrigger from 'rc-trigger/lib/mock'; -import * as React from 'react'; +import React from 'react'; import { TriggerMockContext } from '../shared/demoTestContext'; let OriginTrigger = jest.requireActual('rc-trigger'); diff --git a/tests/shared/demoTest.tsx b/tests/shared/demoTest.tsx index ac120a780e..8b80871bf6 100644 --- a/tests/shared/demoTest.tsx +++ b/tests/shared/demoTest.tsx @@ -2,7 +2,7 @@ import { createCache, StyleProvider } from '@ant-design/cssinjs'; import { globSync } from 'glob'; import path from 'path'; -import * as React from 'react'; +import React from 'react'; import { renderToString } from 'react-dom/server'; import { render } from '../utils'; import { TriggerMockContext } from './demoTestContext'; diff --git a/tests/shared/demoTestContext.ts b/tests/shared/demoTestContext.ts index f338f36e14..95bfe2791e 100644 --- a/tests/shared/demoTestContext.ts +++ b/tests/shared/demoTestContext.ts @@ -1,6 +1,6 @@ /* eslint-disable import/prefer-default-export */ import type { TriggerProps } from 'rc-trigger'; -import * as React from 'react'; +import React from 'react'; // We export context here is to avoid testing-lib inject `afterEach` in `tests/index.test.js` // Which breaks the circle deps