From ab0e07e25db7554d749e1f2d25e171753b504d57 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 10 Jan 2025 14:14:31 +0800 Subject: [PATCH] refactor: [v6] use rc-component (#52337) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: use @rc-component * chore: adjust compile * test: fix logic * chore: back of reset --------- Co-authored-by: 二货机器人 --- .dumi/hooks/useThemeAnimation.ts | 2 +- .dumi/theme/builtins/ImagePreview/index.tsx | 2 +- .dumi/theme/builtins/Previewer/CodePreviewer.tsx | 4 ++-- .dumi/theme/common/styles/Common.tsx | 2 +- .dumi/theme/slots/Footer/AdditionalInfo.tsx | 2 +- .jest.js | 1 + components/_util/ActionButton.tsx | 2 +- components/_util/PurePanel.tsx | 2 +- components/_util/__tests__/wave.test.tsx | 2 +- components/_util/hooks/useClosable.tsx | 2 +- components/_util/scrollTo.ts | 2 +- components/_util/styleChecker.ts | 4 ++-- components/_util/throttleByAnimationFrame.ts | 2 +- components/_util/warning.ts | 4 +++- components/_util/wave/WaveEffect.tsx | 4 ++-- components/_util/wave/index.ts | 4 ++-- components/_util/wave/useWave.ts | 4 ++-- components/affix/__tests__/demo.test.tsx | 2 +- components/affix/index.tsx | 2 +- components/alert/Alert.tsx | 4 ++-- components/alert/__tests__/index.test.tsx | 2 +- components/anchor/Anchor.tsx | 2 +- components/anchor/__tests__/Anchor.test.tsx | 2 +- components/auto-complete/index.tsx | 4 ++-- components/avatar/avatar.tsx | 2 +- components/avatar/group.tsx | 2 +- components/breadcrumb/Breadcrumb.tsx | 4 ++-- components/breadcrumb/useItemRender.tsx | 2 +- components/button/__tests__/index.test.tsx | 2 +- components/button/__tests__/wave.test.tsx | 2 +- components/button/button.tsx | 6 +++--- components/calendar/__tests__/index.test.tsx | 4 ++-- components/calendar/__tests__/select.test.tsx | 2 +- components/calendar/generateCalendar.tsx | 2 +- components/card/Card.tsx | 2 +- components/cascader/index.tsx | 2 +- components/checkbox/Checkbox.tsx | 2 +- components/checkbox/Group.tsx | 2 +- components/checkbox/useBubbleLock.ts | 2 +- components/collapse/Collapse.tsx | 4 ++-- components/color-picker/ColorPicker.tsx | 2 +- components/color-picker/__tests__/gradient.test.tsx | 2 +- components/color-picker/__tests__/index.test.tsx | 2 +- components/color-picker/components/ColorInput.tsx | 2 +- components/color-picker/components/ColorPresets.tsx | 2 +- components/color-picker/components/ColorSlider.tsx | 2 +- components/color-picker/components/ColorTrigger.tsx | 2 +- .../color-picker/components/PanelPicker/index.tsx | 2 +- components/color-picker/hooks/useModeColor.ts | 4 ++-- components/config-provider/UnstableContext.tsx | 2 +- .../config-provider/__tests__/components.test.tsx | 3 ++- components/config-provider/__tests__/popup.test.tsx | 3 ++- components/config-provider/__tests__/theme.test.tsx | 4 ++-- components/config-provider/__tests__/unstable.test.tsx | 2 +- components/config-provider/__tests__/wave.test.tsx | 2 +- components/config-provider/cssVariables.ts | 4 ++-- components/config-provider/hooks/useTheme.ts | 4 ++-- components/config-provider/index.tsx | 10 +++++----- components/descriptions/hooks/useItems.ts | 2 +- components/dropdown/dropdown.tsx | 6 +++--- components/flex/index.tsx | 2 +- components/float-button/BackTop.tsx | 2 +- components/float-button/FloatButton.tsx | 2 +- components/float-button/FloatButtonGroup.tsx | 4 ++-- components/form/FormItem/ItemHolder.tsx | 6 +++--- components/form/FormItem/index.tsx | 4 ++-- components/form/FormItemInput.tsx | 4 ++-- components/form/context.tsx | 4 ++-- components/form/hooks/useChildren.ts | 2 +- components/form/hooks/useForm.ts | 2 +- components/form/hooks/useFrameState.ts | 2 +- components/form/hooks/useItemRef.ts | 2 +- components/grid/__tests__/server.test.tsx | 2 +- components/grid/hooks/useBreakpoint.tsx | 2 +- components/input/Input.tsx | 2 +- components/input/OTP/OTPInput.tsx | 2 +- components/input/OTP/index.tsx | 4 ++-- components/input/Password.tsx | 4 ++-- components/input/Search.tsx | 2 +- components/input/__tests__/focus.test.tsx | 2 +- components/input/__tests__/textarea.test.tsx | 2 +- components/layout/Sider.tsx | 2 +- components/layout/hooks/useHasSider.ts | 2 +- components/layout/layout.tsx | 2 +- components/mentions/index.tsx | 2 +- components/menu/MenuItem.tsx | 4 ++-- components/menu/OverrideContext.tsx | 2 +- components/menu/SubMenu.tsx | 2 +- components/menu/menu.tsx | 4 ++-- components/modal/__tests__/Modal.test.tsx | 2 +- components/modal/__tests__/confirm.test.tsx | 6 +++--- components/modal/__tests__/hook.test.tsx | 4 ++-- components/popconfirm/__tests__/index.test.tsx | 2 +- components/popconfirm/index.tsx | 4 ++-- components/popover/index.tsx | 4 ++-- components/progress/progress.tsx | 4 ++-- components/qr-code/index.tsx | 4 ++-- components/radio/group.tsx | 6 +++--- components/radio/radio.tsx | 2 +- components/segmented/index.tsx | 2 +- components/select/index.tsx | 4 ++-- components/skeleton/Avatar.tsx | 2 +- components/skeleton/Button.tsx | 2 +- components/skeleton/Input.tsx | 2 +- components/slider/SliderTooltip.tsx | 4 ++-- components/slider/index.tsx | 2 +- components/slider/useRafLock.ts | 2 +- components/space/Compact.tsx | 2 +- components/space/index.tsx | 2 +- components/spin/Indicator/Progress.tsx | 2 +- components/splitter/SplitBar.tsx | 2 +- components/splitter/Splitter.tsx | 2 +- components/splitter/__tests__/index.test.tsx | 2 +- components/splitter/__tests__/lazy.test.tsx | 4 ++-- components/splitter/hooks/useItems.ts | 2 +- components/statistic/Statistic.tsx | 2 +- components/steps/useLegacyItems.ts | 2 +- components/switch/__tests__/index.test.tsx | 2 +- components/switch/index.tsx | 2 +- components/table/InternalTable.tsx | 2 +- components/table/__tests__/empty.test.tsx | 2 +- components/table/hooks/useFilter/FilterDropdown.tsx | 2 +- components/table/hooks/useFilter/FilterWrapper.tsx | 2 +- components/table/hooks/useSelection.tsx | 2 +- components/table/hooks/useSorter.tsx | 2 +- components/tabs/hooks/useLegacyItems.ts | 2 +- components/tag/__tests__/index.test.tsx | 2 +- components/tag/index.tsx | 2 +- components/timeline/useItems.ts | 2 +- components/tooltip/__tests__/tooltip.test.tsx | 2 +- components/tooltip/index.tsx | 2 +- components/tour/__tests__/index.test.tsx | 2 +- components/transfer/ListBody.tsx | 2 +- components/transfer/hooks/useSelection.ts | 2 +- components/transfer/list.tsx | 2 +- components/tree-select/index.tsx | 2 +- components/typography/Base/Ellipsis.tsx | 5 +++-- components/typography/Base/index.tsx | 10 +++++----- components/typography/Editable.tsx | 2 +- components/typography/Text.tsx | 2 +- components/typography/Typography.tsx | 2 +- components/typography/__tests__/editable.test.tsx | 2 +- components/typography/__tests__/ellipsis.test.tsx | 7 ++++--- components/typography/__tests__/index.test.tsx | 6 +++--- components/typography/hooks/useCopyClick.ts | 2 +- components/upload/Upload.tsx | 2 +- components/upload/UploadList/index.tsx | 2 +- components/upload/__tests__/upload.test.tsx | 2 +- components/upload/__tests__/uploadlist.test.tsx | 2 +- components/watermark/context.ts | 2 +- components/watermark/index.tsx | 4 ++-- components/watermark/useRafDebounce.ts | 4 ++-- package.json | 2 +- tests/__mocks__/rc-util/lib/Portal.tsx | 4 ++-- tests/shared/imageTest.tsx | 2 +- typings/custom-typings.d.ts | 2 -- 156 files changed, 217 insertions(+), 212 deletions(-) diff --git a/.dumi/hooks/useThemeAnimation.ts b/.dumi/hooks/useThemeAnimation.ts index 53a3502514..de95e3789c 100644 --- a/.dumi/hooks/useThemeAnimation.ts +++ b/.dumi/hooks/useThemeAnimation.ts @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import { removeCSS, updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; +import { removeCSS, updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS'; import theme from '../../components/theme'; diff --git a/.dumi/theme/builtins/ImagePreview/index.tsx b/.dumi/theme/builtins/ImagePreview/index.tsx index 7fe41f0af4..834805f7b4 100644 --- a/.dumi/theme/builtins/ImagePreview/index.tsx +++ b/.dumi/theme/builtins/ImagePreview/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; import { Image } from 'antd'; import classNames from 'classnames'; -import toArray from 'rc-util/lib/Children/toArray'; interface ImagePreviewProps { className?: string; diff --git a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx index f453f44b13..9d7222be24 100644 --- a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx @@ -95,7 +95,7 @@ const CodePreviewer: React.FC = (props) => { const entryName = 'index.tsx'; const entryCode = asset.dependencies[entryName].value; - + const previewDemo = useRef(null); const demoContainer = useRef(null); const { @@ -288,7 +288,7 @@ createRoot(document.getElementById('container')).render(); main: 'index.js', dependencies: { ...dependencies, - 'rc-util': pkgDependencyList['rc-util'], + '@rc-component/util': pkgDependencyList['@rc-component/util'], react: '^18.0.0', 'react-dom': '^18.0.0', 'react-scripts': '^5.0.0', diff --git a/.dumi/theme/common/styles/Common.tsx b/.dumi/theme/common/styles/Common.tsx index 2744394b20..23f900c108 100644 --- a/.dumi/theme/common/styles/Common.tsx +++ b/.dumi/theme/common/styles/Common.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { css, Global } from '@emotion/react'; +import { updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS'; import { useTheme } from 'antd-style'; -import { updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; export default () => { const { anchorTop } = useTheme(); diff --git a/.dumi/theme/slots/Footer/AdditionalInfo.tsx b/.dumi/theme/slots/Footer/AdditionalInfo.tsx index fc97731ec0..af3ad76be5 100644 --- a/.dumi/theme/slots/Footer/AdditionalInfo.tsx +++ b/.dumi/theme/slots/Footer/AdditionalInfo.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import { removeCSS, updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS'; import { createStyles } from 'antd-style'; -import { removeCSS, updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; import useLocale from '../../../hooks/useLocale'; diff --git a/.jest.js b/.jest.js index 631743f5d0..ab60544fd3 100644 --- a/.jest.js +++ b/.jest.js @@ -6,6 +6,7 @@ const compileModules = [ 'countup.js', '.pnpm', '@asamuzakjp/css-color', + '@rc-component', ]; const ignoreList = []; diff --git a/components/_util/ActionButton.tsx b/components/_util/ActionButton.tsx index 6f28403763..f1c4f0b112 100644 --- a/components/_util/ActionButton.tsx +++ b/components/_util/ActionButton.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import useState from 'rc-util/lib/hooks/useState'; +import useState from '@rc-component/util/lib/hooks/useState'; import Button from '../button'; import type { ButtonProps, LegacyButtonType } from '../button/button'; diff --git a/components/_util/PurePanel.tsx b/components/_util/PurePanel.tsx index e2463352fa..badc7551e9 100644 --- a/components/_util/PurePanel.tsx +++ b/components/_util/PurePanel.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import ConfigProvider, { ConfigContext } from '../config-provider'; import type { AnyObject } from './type'; diff --git a/components/_util/__tests__/wave.test.tsx b/components/_util/__tests__/wave.test.tsx index 32a65b35f8..a6d3eab326 100644 --- a/components/_util/__tests__/wave.test.tsx +++ b/components/_util/__tests__/wave.test.tsx @@ -21,7 +21,7 @@ jest.mock('react-dom', () => { return realReactDOM; }); -jest.mock('rc-util/lib/Dom/isVisible', () => { +jest.mock('@rc-component/util/lib/Dom/isVisible', () => { const mockFn = () => (global as any).isVisible; return mockFn; }); diff --git a/components/_util/hooks/useClosable.tsx b/components/_util/hooks/useClosable.tsx index 044a74f8ac..a2e07b63cc 100644 --- a/components/_util/hooks/useClosable.tsx +++ b/components/_util/hooks/useClosable.tsx @@ -1,8 +1,8 @@ import type { ReactNode } from 'react'; import React from 'react'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import type { DialogProps } from 'rc-dialog'; -import pickAttrs from 'rc-util/lib/pickAttrs'; export type ClosableType = DialogProps['closable']; diff --git a/components/_util/scrollTo.ts b/components/_util/scrollTo.ts index 9a3f79c73f..7da9e59203 100644 --- a/components/_util/scrollTo.ts +++ b/components/_util/scrollTo.ts @@ -1,4 +1,4 @@ -import raf from 'rc-util/lib/raf'; +import raf from '@rc-component/util/lib/raf'; import { easeInOutCubic } from './easings'; import getScroll, { isWindow } from './getScroll'; diff --git a/components/_util/styleChecker.ts b/components/_util/styleChecker.ts index dfc960fa8f..45f3a23f08 100644 --- a/components/_util/styleChecker.ts +++ b/components/_util/styleChecker.ts @@ -1,5 +1,5 @@ -import canUseDom from 'rc-util/lib/Dom/canUseDom'; -import { isStyleSupport } from 'rc-util/lib/Dom/styleChecker'; +import canUseDom from '@rc-component/util/lib/Dom/canUseDom'; +import { isStyleSupport } from '@rc-component/util/lib/Dom/styleChecker'; export const canUseDocElement = () => canUseDom() && window.document.documentElement; diff --git a/components/_util/throttleByAnimationFrame.ts b/components/_util/throttleByAnimationFrame.ts index 8b0f1c7a47..a4c277d464 100644 --- a/components/_util/throttleByAnimationFrame.ts +++ b/components/_util/throttleByAnimationFrame.ts @@ -1,4 +1,4 @@ -import raf from 'rc-util/lib/raf'; +import raf from '@rc-component/util/lib/raf'; function throttleByAnimationFrame(fn: (...args: T) => void) { let requestId: number | null; diff --git a/components/_util/warning.ts b/components/_util/warning.ts index 66a2cef0f7..6bf093f5f5 100644 --- a/components/_util/warning.ts +++ b/components/_util/warning.ts @@ -1,5 +1,6 @@ import * as React from 'react'; -import rcWarning, { resetWarned as rcResetWarned } from 'rc-util/lib/warning'; +import rcWarning, { resetWarned as rcResetWarned } from '@rc-component/util/lib/warning'; +import { resetWarned as deprecatedRcResetWarned } from 'rc-util/lib/warning'; export function noop() {} @@ -8,6 +9,7 @@ let deprecatedWarnList: Record | null = null; export function resetWarned() { deprecatedWarnList = null; rcResetWarned(); + deprecatedRcResetWarned(); } type Warning = (valid: boolean, component: string, message?: string) => void; diff --git a/components/_util/wave/WaveEffect.tsx b/components/_util/wave/WaveEffect.tsx index 542bea3f2b..136b656536 100644 --- a/components/_util/wave/WaveEffect.tsx +++ b/components/_util/wave/WaveEffect.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; +import raf from '@rc-component/util/lib/raf'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; -import raf from 'rc-util/lib/raf'; -import { composeRef } from 'rc-util/lib/ref'; import { getReactRender, type UnmountType } from '../../config-provider/UnstableContext'; import { TARGET_CLS } from './interface'; diff --git a/components/_util/wave/index.ts b/components/_util/wave/index.ts index 3332a034e2..a3509a9994 100644 --- a/components/_util/wave/index.ts +++ b/components/_util/wave/index.ts @@ -1,7 +1,7 @@ import React, { useContext, useRef } from 'react'; +import isVisible from '@rc-component/util/lib/Dom/isVisible'; +import { composeRef, getNodeRef, supportRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; -import isVisible from 'rc-util/lib/Dom/isVisible'; -import { composeRef, getNodeRef, supportRef } from 'rc-util/lib/ref'; import type { ConfigConsumerProps } from '../../config-provider'; import { ConfigContext } from '../../config-provider'; diff --git a/components/_util/wave/useWave.ts b/components/_util/wave/useWave.ts index 2064f9601d..df7834531c 100644 --- a/components/_util/wave/useWave.ts +++ b/components/_util/wave/useWave.ts @@ -1,6 +1,6 @@ import * as React from 'react'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import raf from 'rc-util/lib/raf'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import raf from '@rc-component/util/lib/raf'; import { ConfigContext } from '../../config-provider'; import useToken from '../../theme/useToken'; diff --git a/components/affix/__tests__/demo.test.tsx b/components/affix/__tests__/demo.test.tsx index 3cb3f0bfcf..4b46dd722f 100644 --- a/components/affix/__tests__/demo.test.tsx +++ b/components/affix/__tests__/demo.test.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { spyElementPrototype } from 'rc-util/lib/test/domHook'; +import { spyElementPrototype } from '@rc-component/util/lib/test/domHook'; import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest'; diff --git a/components/affix/index.tsx b/components/affix/index.tsx index 42562a3cf1..993fa38a90 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; -import omit from 'rc-util/lib/omit'; import throttleByAnimationFrame from '../_util/throttleByAnimationFrame'; import type { ConfigConsumerProps } from '../config-provider'; diff --git a/components/alert/Alert.tsx b/components/alert/Alert.tsx index f53c5cd4dd..f1ce4effc6 100644 --- a/components/alert/Alert.tsx +++ b/components/alert/Alert.tsx @@ -5,10 +5,10 @@ import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; -import pickAttrs from 'rc-util/lib/pickAttrs'; -import { composeRef } from 'rc-util/lib/ref'; import type { ClosableType } from '../_util/hooks/useClosable'; import { replaceElement } from '../_util/reactNode'; diff --git a/components/alert/__tests__/index.test.tsx b/components/alert/__tests__/index.test.tsx index 111e27fea8..46ef61986e 100644 --- a/components/alert/__tests__/index.test.tsx +++ b/components/alert/__tests__/index.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; +import { resetWarned } from '@rc-component/util/lib/warning'; import userEvent from '@testing-library/user-event'; -import { resetWarned } from 'rc-util/lib/warning'; import Alert from '..'; import { accessibilityTest } from '../../../tests/shared/accessibilityTest'; diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index 452836fa36..7dd51640d5 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; import classNames from 'classnames'; -import useEvent from 'rc-util/lib/hooks/useEvent'; import scrollIntoView from 'scroll-into-view-if-needed'; import getScroll from '../_util/getScroll'; diff --git a/components/anchor/__tests__/Anchor.test.tsx b/components/anchor/__tests__/Anchor.test.tsx index 02e3b0ed45..3b12953755 100644 --- a/components/anchor/__tests__/Anchor.test.tsx +++ b/components/anchor/__tests__/Anchor.test.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import scrollIntoView from 'scroll-into-view-if-needed'; import Anchor from '..'; diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index 360e4b136e..6865012fcc 100755 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; +import omit from '@rc-component/util/lib/omit'; 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 { useZIndex } from '../_util/hooks/useZIndex'; import genPurePanel from '../_util/PurePanel'; diff --git a/components/avatar/avatar.tsx b/components/avatar/avatar.tsx index d14f57f8dc..887bc629e8 100644 --- a/components/avatar/avatar.tsx +++ b/components/avatar/avatar.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; -import { composeRef } from 'rc-util/lib/ref'; import type { Breakpoint } from '../_util/responsiveObserver'; import { responsiveArray } from '../_util/responsiveObserver'; diff --git a/components/avatar/group.tsx b/components/avatar/group.tsx index 71d6180669..e0b38bbdd2 100644 --- a/components/avatar/group.tsx +++ b/components/avatar/group.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; import classNames from 'classnames'; -import toArray from 'rc-util/lib/Children/toArray'; import { cloneElement } from '../_util/reactNode'; import { devUseWarning } from '../_util/warning'; diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 5e138151a8..7054c5088d 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import classNames from 'classnames'; -import toArray from 'rc-util/lib/Children/toArray'; -import pickAttrs from 'rc-util/lib/pickAttrs'; import { cloneElement } from '../_util/reactNode'; import type { AnyObject } from '../_util/type'; diff --git a/components/breadcrumb/useItemRender.tsx b/components/breadcrumb/useItemRender.tsx index e3b0a9f810..2f3d0555c7 100644 --- a/components/breadcrumb/useItemRender.tsx +++ b/components/breadcrumb/useItemRender.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import classNames from 'classnames'; -import pickAttrs from 'rc-util/lib/pickAttrs'; import type { BreadcrumbProps, InternalRouteType, ItemType } from './Breadcrumb'; diff --git a/components/button/__tests__/index.test.tsx b/components/button/__tests__/index.test.tsx index 3b2f9fae4d..519071e855 100644 --- a/components/button/__tests__/index.test.tsx +++ b/components/button/__tests__/index.test.tsx @@ -1,6 +1,6 @@ import React, { Suspense, useRef, useState } from 'react'; import { SearchOutlined } from '@ant-design/icons'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import Button, { _ButtonVariantTypes } from '..'; import type { GetRef } from '../../_util/type'; diff --git a/components/button/__tests__/wave.test.tsx b/components/button/__tests__/wave.test.tsx index 7abe0bcd4b..b45f5839f7 100644 --- a/components/button/__tests__/wave.test.tsx +++ b/components/button/__tests__/wave.test.tsx @@ -16,7 +16,7 @@ jest.mock('react-dom', () => { return realReactDOM; }); -jest.mock('rc-util/lib/Dom/isVisible', () => { +jest.mock('@rc-component/util/lib/Dom/isVisible', () => { const mockFn = () => true; return mockFn; }); diff --git a/components/button/button.tsx b/components/button/button.tsx index 4970f63f7d..d50fc040a0 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -1,7 +1,7 @@ import React, { Children, useContext, useEffect, useMemo, useRef, useState } from 'react'; +import omit from '@rc-component/util/lib/omit'; +import { useComposeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; -import { useComposeRef } from 'rc-util/lib/ref'; import { devUseWarning } from '../_util/warning'; import Wave from '../_util/wave'; @@ -19,8 +19,8 @@ import type { ButtonVariantType, } from './buttonHelpers'; import { isTwoCNChar, isUnBorderedButtonVariant, spaceChildren } from './buttonHelpers'; -import IconWrapper from './IconWrapper'; import DefaultLoadingIcon from './DefaultLoadingIcon'; +import IconWrapper from './IconWrapper'; import useStyle from './style'; import Compact from './style/compact'; diff --git a/components/calendar/__tests__/index.test.tsx b/components/calendar/__tests__/index.test.tsx index 054fe8ecb1..ea319ca287 100644 --- a/components/calendar/__tests__/index.test.tsx +++ b/components/calendar/__tests__/index.test.tsx @@ -3,22 +3,22 @@ import Dayjs from 'dayjs'; import 'dayjs/locale/zh-cn'; import React from 'react'; +import { resetWarned } from '@rc-component/util/lib/warning'; import MockDate from 'mockdate'; import type { PickerPanelProps } from 'rc-picker'; import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs'; import type { Locale } from 'rc-picker/lib/interface'; -import { resetWarned } from 'rc-util/lib/warning'; import Calendar from '..'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; import { fireEvent, render } from '../../../tests/utils'; +import ConfigProvider from '../../config-provider'; import Group from '../../radio/group'; import Button from '../../radio/radioButton'; import Select from '../../select'; import Header from '../Header'; import type { CalendarHeaderProps } from '../Header'; -import ConfigProvider from '../../config-provider'; const ref: { calendarProps?: PickerPanelProps; diff --git a/components/calendar/__tests__/select.test.tsx b/components/calendar/__tests__/select.test.tsx index 2d538a256e..5c1d75dc72 100644 --- a/components/calendar/__tests__/select.test.tsx +++ b/components/calendar/__tests__/select.test.tsx @@ -3,7 +3,7 @@ import Dayjs from 'dayjs'; import 'dayjs/locale/zh-cn'; import React from 'react'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import Calendar from '..'; import { fireEvent, render, waitFakeTimer } from '../../../tests/utils'; diff --git a/components/calendar/generateCalendar.tsx b/components/calendar/generateCalendar.tsx index 96ed4afa33..a65957c29b 100644 --- a/components/calendar/generateCalendar.tsx +++ b/components/calendar/generateCalendar.tsx @@ -1,10 +1,10 @@ import * as React from 'react'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; import type { BasePickerPanelProps as RcBasePickerPanelProps } from 'rc-picker'; import { PickerPanel as RCPickerPanel } from 'rc-picker'; import type { GenerateConfig } from 'rc-picker/lib/generate'; import type { CellRenderInfo } from 'rc-picker/lib/interface'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; import type { AnyObject } from '../_util/type'; import { devUseWarning } from '../_util/warning'; diff --git a/components/card/Card.tsx b/components/card/Card.tsx index 1cc222767a..b71c077c1f 100644 --- a/components/card/Card.tsx +++ b/components/card/Card.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { Tab } from 'rc-tabs/lib/interface'; -import omit from 'rc-util/lib/omit'; import { devUseWarning } from '../_util/warning'; import { ConfigContext } from '../config-provider'; diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index dc11e41dcd..5d82d9cfa2 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { BaseOptionType, @@ -9,7 +10,6 @@ import type { } from 'rc-cascader'; import RcCascader from 'rc-cascader'; import type { Placement } from 'rc-select/lib/BaseSelect'; -import omit from 'rc-util/lib/omit'; import { useZIndex } from '../_util/hooks/useZIndex'; import type { SelectCommonPlacement } from '../_util/motion'; diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index dce5be3564..3bf2a4831a 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import type { CheckboxRef } from 'rc-checkbox'; import RcCheckbox from 'rc-checkbox'; -import { composeRef } from 'rc-util/lib/ref'; import { devUseWarning } from '../_util/warning'; import Wave from '../_util/wave'; diff --git a/components/checkbox/Group.tsx b/components/checkbox/Group.tsx index a4c8260ce1..4126b0f22c 100644 --- a/components/checkbox/Group.tsx +++ b/components/checkbox/Group.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { ConfigContext } from '../config-provider'; import useCSSVarCls from '../config-provider/hooks/useCSSVarCls'; diff --git a/components/checkbox/useBubbleLock.ts b/components/checkbox/useBubbleLock.ts index a460b5590b..15d4a75e1d 100644 --- a/components/checkbox/useBubbleLock.ts +++ b/components/checkbox/useBubbleLock.ts @@ -1,5 +1,5 @@ import React from 'react'; -import raf from 'rc-util/lib/raf'; +import raf from '@rc-component/util/lib/raf'; /** * When click on the label, diff --git a/components/collapse/Collapse.tsx b/components/collapse/Collapse.tsx index 840b95dae3..e865c4f40a 100644 --- a/components/collapse/Collapse.tsx +++ b/components/collapse/Collapse.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; import RightOutlined from '@ant-design/icons/RightOutlined'; +import toArray from '@rc-component/util/lib/Children/toArray'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { CollapseProps as RcCollapseProps } from 'rc-collapse'; import RcCollapse from 'rc-collapse'; import type { CSSMotionProps } from 'rc-motion'; -import toArray from 'rc-util/lib/Children/toArray'; -import omit from 'rc-util/lib/omit'; import initCollapseMotion from '../_util/motion'; import { cloneElement } from '../_util/reactNode'; diff --git a/components/color-picker/ColorPicker.tsx b/components/color-picker/ColorPicker.tsx index 2cc7ed50b4..3976613480 100644 --- a/components/color-picker/ColorPicker.tsx +++ b/components/color-picker/ColorPicker.tsx @@ -1,6 +1,6 @@ import React, { useContext, useMemo } from 'react'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; import ContextIsolator from '../_util/ContextIsolator'; import genPurePanel from '../_util/PurePanel'; diff --git a/components/color-picker/__tests__/gradient.test.tsx b/components/color-picker/__tests__/gradient.test.tsx index 7e490468c5..6e429cff45 100644 --- a/components/color-picker/__tests__/gradient.test.tsx +++ b/components/color-picker/__tests__/gradient.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import { resetWarned } from '../../_util/warning'; import { createEvent, fireEvent } from '../../../tests/utils'; diff --git a/components/color-picker/__tests__/index.test.tsx b/components/color-picker/__tests__/index.test.tsx index 45ee9dbe29..103e83f23c 100644 --- a/components/color-picker/__tests__/index.test.tsx +++ b/components/color-picker/__tests__/index.test.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useMemo, useState } from 'react'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { createEvent, fireEvent, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import { resetWarned } from '../../_util/warning'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/color-picker/components/ColorInput.tsx b/components/color-picker/components/ColorInput.tsx index 6f4670b8a2..7d72401079 100644 --- a/components/color-picker/components/ColorInput.tsx +++ b/components/color-picker/components/ColorInput.tsx @@ -1,6 +1,6 @@ import type { FC } from 'react'; import React, { useMemo } from 'react'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import Select from '../../select'; import type { AggregationColor } from '../color'; diff --git a/components/color-picker/components/ColorPresets.tsx b/components/color-picker/components/ColorPresets.tsx index 6131bf36a2..9d2bbd54fe 100644 --- a/components/color-picker/components/ColorPresets.tsx +++ b/components/color-picker/components/ColorPresets.tsx @@ -1,8 +1,8 @@ import type { FC } from 'react'; import React, { useMemo } from 'react'; import { ColorBlock, Color as RcColor } from '@rc-component/color-picker'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; import type { CollapseProps } from '../../collapse'; import Collapse from '../../collapse'; diff --git a/components/color-picker/components/ColorSlider.tsx b/components/color-picker/components/ColorSlider.tsx index f6ee8da055..d35fc4b48c 100644 --- a/components/color-picker/components/ColorSlider.tsx +++ b/components/color-picker/components/ColorSlider.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import type { BaseSliderProps } from '@rc-component/color-picker'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; import classNames from 'classnames'; import { UnstableContext } from 'rc-slider'; -import useEvent from 'rc-util/lib/hooks/useEvent'; import type { GetContextProp, GetProp } from '../../_util/type'; import Slider from '../../slider'; diff --git a/components/color-picker/components/ColorTrigger.tsx b/components/color-picker/components/ColorTrigger.tsx index 60e210951d..1aece7925b 100644 --- a/components/color-picker/components/ColorTrigger.tsx +++ b/components/color-picker/components/ColorTrigger.tsx @@ -2,8 +2,8 @@ import type { CSSProperties, MouseEventHandler } from 'react'; import React, { forwardRef, useMemo } from 'react'; import { ColorBlock } from '@rc-component/color-picker'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import classNames from 'classnames'; -import pickAttrs from 'rc-util/lib/pickAttrs'; import { useLocale } from '../../locale'; import type { AggregationColor } from '../color'; diff --git a/components/color-picker/components/PanelPicker/index.tsx b/components/color-picker/components/PanelPicker/index.tsx index 504395f64e..2a22e64f41 100644 --- a/components/color-picker/components/PanelPicker/index.tsx +++ b/components/color-picker/components/PanelPicker/index.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react'; import React, { useContext } from 'react'; import RcColorPicker from '@rc-component/color-picker'; import type { Color } from '@rc-component/color-picker'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import Segmented from '../../../segmented'; import { AggregationColor } from '../../color'; diff --git a/components/color-picker/hooks/useModeColor.ts b/components/color-picker/hooks/useModeColor.ts index ffef564b5e..6050aa41ae 100644 --- a/components/color-picker/hooks/useModeColor.ts +++ b/components/color-picker/hooks/useModeColor.ts @@ -1,6 +1,6 @@ import * as React from 'react'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import { useLocale } from '../../locale'; import type { AggregationColor } from '../color'; diff --git a/components/config-provider/UnstableContext.tsx b/components/config-provider/UnstableContext.tsx index 0f44fc1584..6c59a60b37 100644 --- a/components/config-provider/UnstableContext.tsx +++ b/components/config-provider/UnstableContext.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { render, unmount } from 'rc-util/lib/React/render'; +import { render, unmount } from '@rc-component/util/lib/React/render'; import warning from '../_util/warning'; diff --git a/components/config-provider/__tests__/components.test.tsx b/components/config-provider/__tests__/components.test.tsx index 544126d4a3..671767c32d 100644 --- a/components/config-provider/__tests__/components.test.tsx +++ b/components/config-provider/__tests__/components.test.tsx @@ -58,7 +58,8 @@ import TreeSelect from '../../tree-select'; import Upload from '../../upload'; dayjs.extend(customParseFormat); -jest.mock('rc-util/lib/Portal'); + +jest.mock('@rc-component/util/lib/Portal'); describe('ConfigProvider', () => { describe('components', () => { diff --git a/components/config-provider/__tests__/popup.test.tsx b/components/config-provider/__tests__/popup.test.tsx index b6a78af067..b879b8a53f 100644 --- a/components/config-provider/__tests__/popup.test.tsx +++ b/components/config-provider/__tests__/popup.test.tsx @@ -10,7 +10,8 @@ import Select from '../../select'; import TreeSelect from '../../tree-select'; dayjs.extend(customParseFormat); -jest.mock('rc-util/lib/Portal'); + +jest.mock('@rc-component/util/lib/Portal'); function triggerProps(): TriggerProps { return (global as any).triggerProps; diff --git a/components/config-provider/__tests__/theme.test.tsx b/components/config-provider/__tests__/theme.test.tsx index 6b71c4f6c8..e665221d4b 100644 --- a/components/config-provider/__tests__/theme.test.tsx +++ b/components/config-provider/__tests__/theme.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; +import canUseDom from '@rc-component/util/lib/Dom/canUseDom'; import kebabCase from 'lodash/kebabCase'; -import canUseDom from 'rc-util/lib/Dom/canUseDom'; import ConfigProvider from '..'; import { Button, InputNumber, Select } from '../..'; @@ -15,7 +15,7 @@ const { defaultAlgorithm, darkAlgorithm, compactAlgorithm } = theme; /* biome-ignore lint/style/noVar: has to be a global variable */ /* eslint-disable-next-line no-var */ var mockCanUseDom = true; -jest.mock('rc-util/lib/Dom/canUseDom', () => () => mockCanUseDom); +jest.mock('@rc-component/util/lib/Dom/canUseDom', () => () => mockCanUseDom); describe('ConfigProvider.Theme', () => { beforeEach(() => { diff --git a/components/config-provider/__tests__/unstable.test.tsx b/components/config-provider/__tests__/unstable.test.tsx index 1b86119628..1ba3f56c64 100644 --- a/components/config-provider/__tests__/unstable.test.tsx +++ b/components/config-provider/__tests__/unstable.test.tsx @@ -3,7 +3,7 @@ import { version } from 'react'; import { waitFakeTimer19 } from '../../../tests/utils'; import Modal from '../../modal'; -jest.mock('rc-util/lib/Dom/isVisible', () => () => true); +jest.mock('@rc-component/util/lib/Dom/isVisible', () => () => true); describe('UnstableContext', () => { beforeEach(() => { diff --git a/components/config-provider/__tests__/wave.test.tsx b/components/config-provider/__tests__/wave.test.tsx index 59cf899d10..632513bc73 100644 --- a/components/config-provider/__tests__/wave.test.tsx +++ b/components/config-provider/__tests__/wave.test.tsx @@ -4,7 +4,7 @@ import ConfigProvider from '..'; import { fireEvent, render, waitFakeTimer } from '../../../tests/utils'; import Button from '../../button'; -jest.mock('rc-util/lib/Dom/isVisible', () => () => true); +jest.mock('@rc-component/util/lib/Dom/isVisible', () => () => true); describe('ConfigProvider.Wave', () => { beforeEach(() => { diff --git a/components/config-provider/cssVariables.ts b/components/config-provider/cssVariables.ts index 90d89177c5..1d98dc97f9 100644 --- a/components/config-provider/cssVariables.ts +++ b/components/config-provider/cssVariables.ts @@ -1,7 +1,7 @@ import { generate } from '@ant-design/colors'; import { FastColor } from '@ant-design/fast-color'; -import canUseDom from 'rc-util/lib/Dom/canUseDom'; -import { updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; +import canUseDom from '@rc-component/util/lib/Dom/canUseDom'; +import { updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS'; import warning from '../_util/warning'; import type { Theme } from './context'; diff --git a/components/config-provider/hooks/useTheme.ts b/components/config-provider/hooks/useTheme.ts index 2e1c0f6de7..7963ec4719 100644 --- a/components/config-provider/hooks/useTheme.ts +++ b/components/config-provider/hooks/useTheme.ts @@ -1,5 +1,5 @@ -import useMemo from 'rc-util/lib/hooks/useMemo'; -import isEqual from 'rc-util/lib/isEqual'; +import useMemo from '@rc-component/util/lib/hooks/useMemo'; +import isEqual from '@rc-component/util/lib/isEqual'; import { devUseWarning } from '../../_util/warning'; import type { OverrideToken } from '../../theme/interface'; diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index b5d1d87b17..2a01d70073 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import { createTheme } from '@ant-design/cssinjs'; import IconContext from '@ant-design/icons/lib/components/Context'; -import useMemo from 'rc-util/lib/hooks/useMemo'; -import { merge } from 'rc-util/lib/utils/set'; +import useMemo from '@rc-component/util/lib/hooks/useMemo'; +import { merge } from '@rc-component/util/lib/utils/set'; import warning, { devUseWarning, WarningContext } from '../_util/warning'; import type { WarningContextProps } from '../_util/warning'; @@ -27,6 +27,7 @@ import type { DatePickerConfig, DirectionType, DrawerConfig, + EmptyConfig, FlexConfig, FloatButtonGroupConfig, FormConfig, @@ -39,6 +40,8 @@ import type { ModalConfig, NotificationConfig, PaginationConfig, + PopconfirmConfig, + PopoverConfig, PopupOverflow, RangePickerConfig, SelectConfig, @@ -52,14 +55,11 @@ import type { ThemeConfig, TimePickerConfig, TooltipConfig, - PopoverConfig, - PopconfirmConfig, TourConfig, TransferConfig, TreeSelectConfig, Variant, WaveConfig, - EmptyConfig, } from './context'; import { ConfigConsumer, diff --git a/components/descriptions/hooks/useItems.ts b/components/descriptions/hooks/useItems.ts index db20867ba9..a3da7eb62c 100644 --- a/components/descriptions/hooks/useItems.ts +++ b/components/descriptions/hooks/useItems.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import toArray from 'rc-util/lib/Children/toArray'; +import toArray from '@rc-component/util/lib/Children/toArray'; import type { DescriptionsItemType, InternalDescriptionsItemType } from '..'; import { matchScreen } from '../../_util/responsiveObserver'; diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index a52251c45d..88d96ecb7c 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; import RightOutlined from '@ant-design/icons/RightOutlined'; import type { AlignType } from '@rc-component/trigger'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; 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 { useZIndex } from '../_util/hooks/useZIndex'; import isPrimitive from '../_util/isPrimitive'; diff --git a/components/flex/index.tsx b/components/flex/index.tsx index 1b0b5b83b4..774a01e444 100644 --- a/components/flex/index.tsx +++ b/components/flex/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { isPresetSize } from '../_util/gapSize'; import { ConfigContext } from '../config-provider'; diff --git a/components/float-button/BackTop.tsx b/components/float-button/BackTop.tsx index b30f8935d6..f9216b3916 100644 --- a/components/float-button/BackTop.tsx +++ b/components/float-button/BackTop.tsx @@ -1,8 +1,8 @@ import React, { useContext, useEffect, useState } from 'react'; import VerticalAlignTopOutlined from '@ant-design/icons/VerticalAlignTopOutlined'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; -import { composeRef } from 'rc-util/lib/ref'; import getScroll from '../_util/getScroll'; import scrollTo from '../_util/scrollTo'; diff --git a/components/float-button/FloatButton.tsx b/components/float-button/FloatButton.tsx index 8b5ee0bc6c..14c8a4c4ae 100644 --- a/components/float-button/FloatButton.tsx +++ b/components/float-button/FloatButton.tsx @@ -1,6 +1,6 @@ import React, { useContext, useMemo } from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { useZIndex } from '../_util/hooks/useZIndex'; import { devUseWarning } from '../_util/warning'; diff --git a/components/float-button/FloatButtonGroup.tsx b/components/float-button/FloatButtonGroup.tsx index dab79aa497..5166657cf0 100644 --- a/components/float-button/FloatButtonGroup.tsx +++ b/components/float-button/FloatButtonGroup.tsx @@ -1,10 +1,10 @@ import React from 'react'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; import FileTextOutlined from '@ant-design/icons/FileTextOutlined'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; import { useZIndex } from '../_util/hooks/useZIndex'; import { devUseWarning } from '../_util/warning'; diff --git a/components/form/FormItem/ItemHolder.tsx b/components/form/FormItem/ItemHolder.tsx index 9ad956664d..e2c1f11c55 100644 --- a/components/form/FormItem/ItemHolder.tsx +++ b/components/form/FormItem/ItemHolder.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; +import isVisible from '@rc-component/util/lib/Dom/isVisible'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { Meta } from 'rc-field-form/lib/interface'; -import isVisible from 'rc-util/lib/Dom/isVisible'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import omit from 'rc-util/lib/omit'; import type { FormItemProps } from '.'; import { Row } from '../../grid'; diff --git a/components/form/FormItem/index.tsx b/components/form/FormItem/index.tsx index efc8903beb..d8a3699931 100644 --- a/components/form/FormItem/index.tsx +++ b/components/form/FormItem/index.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; import type { JSX } from 'react'; +import useState from '@rc-component/util/lib/hooks/useState'; +import { supportRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import { Field, FieldContext, ListContext } from 'rc-field-form'; import type { FieldProps } from 'rc-field-form/lib/Field'; import type { InternalNamePath, Meta } from 'rc-field-form/lib/interface'; -import useState from 'rc-util/lib/hooks/useState'; -import { supportRef } from 'rc-util/lib/ref'; import { cloneElement } from '../../_util/reactNode'; import { devUseWarning } from '../../_util/warning'; diff --git a/components/form/FormItemInput.tsx b/components/form/FormItemInput.tsx index 42c436a354..7e57c65e5e 100644 --- a/components/form/FormItemInput.tsx +++ b/components/form/FormItemInput.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import type { JSX } from 'react'; +import { get, set } from '@rc-component/util'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import classNames from 'classnames'; -import { get, set } from 'rc-util'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; import type { ColProps } from '../grid/col'; import Col from '../grid/col'; diff --git a/components/form/context.tsx b/components/form/context.tsx index 94895f55e1..fe0afa3cca 100644 --- a/components/form/context.tsx +++ b/components/form/context.tsx @@ -1,14 +1,14 @@ import type { PropsWithChildren, ReactNode } from 'react'; import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import { FormProvider as RcFormProvider } from 'rc-field-form'; import type { FormProviderProps as RcFormProviderProps } from 'rc-field-form/lib/FormContext'; import type { Meta } from 'rc-field-form/lib/interface'; -import omit from 'rc-util/lib/omit'; +import type { Variant } from '../config-provider'; import type { ColProps } from '../grid/col'; import type { FormInstance, RequiredMark } from './Form'; import type { FeedbackIcons, ValidateStatus } from './FormItem'; -import type { Variant } from '../config-provider'; import type { FormLabelAlign } from './interface'; /** Form Context. Set top form style and pass to Form Item usage. */ diff --git a/components/form/hooks/useChildren.ts b/components/form/hooks/useChildren.ts index dac4b48b57..69c5d6a05a 100644 --- a/components/form/hooks/useChildren.ts +++ b/components/form/hooks/useChildren.ts @@ -1,4 +1,4 @@ -import toArray from 'rc-util/lib/Children/toArray'; +import toArray from '@rc-component/util/lib/Children/toArray'; import type { FormItemProps } from '../FormItem'; diff --git a/components/form/hooks/useForm.ts b/components/form/hooks/useForm.ts index 254dd3f267..bf1d41a143 100644 --- a/components/form/hooks/useForm.ts +++ b/components/form/hooks/useForm.ts @@ -1,7 +1,7 @@ import * as React from 'react'; +import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode'; import type { FormInstance as RcFormInstance } from 'rc-field-form'; import { useForm as useRcForm } from 'rc-field-form'; -import { getDOM } from 'rc-util/lib/Dom/findDOMNode'; import scrollIntoView from 'scroll-into-view-if-needed'; import type { InternalNamePath, NamePath, ScrollOptions } from '../interface'; diff --git a/components/form/hooks/useFrameState.ts b/components/form/hooks/useFrameState.ts index 53209b7147..5396943af9 100644 --- a/components/form/hooks/useFrameState.ts +++ b/components/form/hooks/useFrameState.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import raf from 'rc-util/lib/raf'; +import raf from '@rc-component/util/lib/raf'; type Updater = (prev?: ValueType) => ValueType; diff --git a/components/form/hooks/useItemRef.ts b/components/form/hooks/useItemRef.ts index b25f888a5c..d96f0d4b33 100644 --- a/components/form/hooks/useItemRef.ts +++ b/components/form/hooks/useItemRef.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import { composeRef, getNodeRef } from 'rc-util/lib/ref'; +import { composeRef, getNodeRef } from '@rc-component/util/lib/ref'; import { FormContext } from '../context'; import type { InternalNamePath } from '../interface'; diff --git a/components/grid/__tests__/server.test.tsx b/components/grid/__tests__/server.test.tsx index a223446e9f..18ef6c18f3 100644 --- a/components/grid/__tests__/server.test.tsx +++ b/components/grid/__tests__/server.test.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { Col, Row } from '..'; import { render } from '../../../tests/utils'; -jest.mock('rc-util/lib/Dom/canUseDom', () => () => false); +jest.mock('@rc-component/util/lib/Dom/canUseDom', () => () => false); describe('Grid.Server', () => { it('use compatible gap logic', () => { diff --git a/components/grid/hooks/useBreakpoint.tsx b/components/grid/hooks/useBreakpoint.tsx index 71f13ced39..d008e0d56d 100644 --- a/components/grid/hooks/useBreakpoint.tsx +++ b/components/grid/hooks/useBreakpoint.tsx @@ -1,5 +1,5 @@ import { useRef } from 'react'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import useForceUpdate from '../../_util/hooks/useForceUpdate'; import type { ScreenMap } from '../../_util/responsiveObserver'; diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 7c19c33a6a..2ed032d423 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -1,9 +1,9 @@ import React, { forwardRef, useContext, useEffect, useRef } from 'react'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import type { InputRef, InputProps as RcInputProps } from 'rc-input'; import RcInput from 'rc-input'; import { InputFocusOptions, triggerFocus } from 'rc-input/lib/utils/commonUtils'; -import { composeRef } from 'rc-util/lib/ref'; import ContextIsolator from '../_util/ContextIsolator'; import getAllowClear from '../_util/getAllowClear'; diff --git a/components/input/OTP/OTPInput.tsx b/components/input/OTP/OTPInput.tsx index e7a5a4e249..01993384af 100644 --- a/components/input/OTP/OTPInput.tsx +++ b/components/input/OTP/OTPInput.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import raf from 'rc-util/lib/raf'; +import raf from '@rc-component/util/lib/raf'; import Input from '../Input'; import type { InputProps, InputRef } from '../Input'; diff --git a/components/input/OTP/index.tsx b/components/input/OTP/index.tsx index dcbc54c7d5..c78b28dcf5 100644 --- a/components/input/OTP/index.tsx +++ b/components/input/OTP/index.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import classNames from 'classnames'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import pickAttrs from 'rc-util/lib/pickAttrs'; import { getMergedStatus } from '../../_util/statusUtils'; import type { InputStatus } from '../../_util/statusUtils'; diff --git a/components/input/Password.tsx b/components/input/Password.tsx index abba20f10d..6f69a87a2c 100644 --- a/components/input/Password.tsx +++ b/components/input/Password.tsx @@ -2,9 +2,9 @@ import * as React from 'react'; import { useRef, useState } from 'react'; import EyeInvisibleOutlined from '@ant-design/icons/EyeInvisibleOutlined'; import EyeOutlined from '@ant-design/icons/EyeOutlined'; +import omit from '@rc-component/util/lib/omit'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; -import { composeRef } from 'rc-util/lib/ref'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; diff --git a/components/input/Search.tsx b/components/input/Search.tsx index 51167c74a2..742771cd06 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import SearchOutlined from '@ant-design/icons/SearchOutlined'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; -import { composeRef } from 'rc-util/lib/ref'; import { cloneElement } from '../_util/reactNode'; import Button from '../button'; diff --git a/components/input/__tests__/focus.test.tsx b/components/input/__tests__/focus.test.tsx index e488641595..1114505835 100644 --- a/components/input/__tests__/focus.test.tsx +++ b/components/input/__tests__/focus.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import Input from '..'; import { fireEvent, render } from '../../../tests/utils'; diff --git a/components/input/__tests__/textarea.test.tsx b/components/input/__tests__/textarea.test.tsx index 5af847da40..b026a2b652 100644 --- a/components/input/__tests__/textarea.test.tsx +++ b/components/input/__tests__/textarea.test.tsx @@ -1,6 +1,6 @@ import type { ChangeEventHandler, TextareaHTMLAttributes } from 'react'; import React, { useState } from 'react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import Input from '..'; import focusTest from '../../../tests/shared/focusTest'; diff --git a/components/layout/Sider.tsx b/components/layout/Sider.tsx index f5edd636bf..78598a2b84 100644 --- a/components/layout/Sider.tsx +++ b/components/layout/Sider.tsx @@ -3,8 +3,8 @@ import { useContext, useEffect, useRef, useState } from 'react'; import BarsOutlined from '@ant-design/icons/BarsOutlined'; import LeftOutlined from '@ant-design/icons/LeftOutlined'; import RightOutlined from '@ant-design/icons/RightOutlined'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import isNumeric from '../_util/isNumeric'; import { ConfigContext } from '../config-provider'; diff --git a/components/layout/hooks/useHasSider.ts b/components/layout/hooks/useHasSider.ts index d85c2967c4..87aed6f84e 100644 --- a/components/layout/hooks/useHasSider.ts +++ b/components/layout/hooks/useHasSider.ts @@ -1,5 +1,5 @@ import type * as React from 'react'; -import toArray from 'rc-util/lib/Children/toArray'; +import toArray from '@rc-component/util/lib/Children/toArray'; import Sider from '../Sider'; diff --git a/components/layout/layout.tsx b/components/layout/layout.tsx index 5723064a94..76a2879695 100644 --- a/components/layout/layout.tsx +++ b/components/layout/layout.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { ConfigContext } from '../config-provider'; import { LayoutContext } from './context'; diff --git a/components/mentions/index.tsx b/components/mentions/index.tsx index 7df1a3f961..c8003d3d30 100644 --- a/components/mentions/index.tsx +++ b/components/mentions/index.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import RcMentions from 'rc-mentions'; import type { @@ -6,7 +7,6 @@ import type { MentionsProps as RcMentionsProps, MentionsRef as RcMentionsRef, } from 'rc-mentions/lib/Mentions'; -import { composeRef } from 'rc-util/lib/ref'; import getAllowClear from '../_util/getAllowClear'; import genPurePanel from '../_util/PurePanel'; diff --git a/components/menu/MenuItem.tsx b/components/menu/MenuItem.tsx index 51b0c6af09..9fe71b3091 100644 --- a/components/menu/MenuItem.tsx +++ b/components/menu/MenuItem.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; 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 { cloneElement } from '../_util/reactNode'; import type { SiderContextProps } from '../layout/Sider'; diff --git a/components/menu/OverrideContext.tsx b/components/menu/OverrideContext.tsx index afa88fa2fd..f07d055a93 100644 --- a/components/menu/OverrideContext.tsx +++ b/components/menu/OverrideContext.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { getNodeRef, supportNodeRef, useComposeRef } from 'rc-util/lib/ref'; +import { getNodeRef, supportNodeRef, useComposeRef } from '@rc-component/util/lib/ref'; import ContextIsolator from '../_util/ContextIsolator'; import type { MenuProps } from './menu'; diff --git a/components/menu/SubMenu.tsx b/components/menu/SubMenu.tsx index 52a6e2d38d..6b42219e9e 100644 --- a/components/menu/SubMenu.tsx +++ b/components/menu/SubMenu.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import { SubMenu as RcSubMenu, useFullPath } from 'rc-menu'; -import omit from 'rc-util/lib/omit'; import { useZIndex } from '../_util/hooks/useZIndex'; import { cloneElement } from '../_util/reactNode'; diff --git a/components/menu/menu.tsx b/components/menu/menu.tsx index 3db30f7c31..bf86bc0616 100644 --- a/components/menu/menu.tsx +++ b/components/menu/menu.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; import { forwardRef } from 'react'; import EllipsisOutlined from '@ant-design/icons/EllipsisOutlined'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { MenuProps as RcMenuProps, MenuRef as RcMenuRef } from 'rc-menu'; import RcMenu from 'rc-menu'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import omit from 'rc-util/lib/omit'; import initCollapseMotion from '../_util/motion'; import { cloneElement } from '../_util/reactNode'; diff --git a/components/modal/__tests__/Modal.test.tsx b/components/modal/__tests__/Modal.test.tsx index 4a31aef198..3487833976 100644 --- a/components/modal/__tests__/Modal.test.tsx +++ b/components/modal/__tests__/Modal.test.tsx @@ -6,7 +6,7 @@ import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; import { createEvent, fireEvent, render } from '../../../tests/utils'; -jest.mock('rc-util/lib/Portal'); +jest.mock('@rc-component/util/lib/Portal'); const ModalTester: React.FC = (props) => { const [open, setOpen] = React.useState(false); diff --git a/components/modal/__tests__/confirm.test.tsx b/components/modal/__tests__/confirm.test.tsx index a7fee1a948..090269f38f 100644 --- a/components/modal/__tests__/confirm.test.tsx +++ b/components/modal/__tests__/confirm.test.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import { SmileOutlined } from '@ant-design/icons'; +import KeyCode from '@rc-component/util/lib/KeyCode'; +import { resetWarned } from '@rc-component/util/lib/warning'; 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 type { ModalFuncProps } from '..'; import Modal from '..'; @@ -76,7 +76,7 @@ describe('Modal.confirm triggers callbacks correctly', () => { (CSSMotion as any)[key] = (MockCSSMotion as any)[key]; }); - // // Mock for rc-util raf + // // Mock for @rc-component/util raf // window.requestAnimationFrame = callback => { // const ret = window.setTimeout(callback, 16); // return ret; diff --git a/components/modal/__tests__/hook.test.tsx b/components/modal/__tests__/hook.test.tsx index a7150535fd..720e62b409 100644 --- a/components/modal/__tests__/hook.test.tsx +++ b/components/modal/__tests__/hook.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; +import KeyCode from '@rc-component/util/lib/KeyCode'; import CSSMotion from 'rc-motion'; import { genCSSMotion } from 'rc-motion/lib/CSSMotion'; -import KeyCode from 'rc-util/lib/KeyCode'; import Modal from '..'; import { act, fireEvent, render, waitFakeTimer } from '../../../tests/utils'; @@ -11,7 +11,7 @@ import Input from '../../input'; import zhCN from '../../locale/zh_CN'; import type { ModalFunc } from '../confirm'; -jest.mock('rc-util/lib/Portal'); +jest.mock('@rc-component/util/lib/Portal'); jest.mock('rc-motion'); // TODO: Remove this. Mock for React 19 diff --git a/components/popconfirm/__tests__/index.test.tsx b/components/popconfirm/__tests__/index.test.tsx index 0b5107a1ce..9105027139 100644 --- a/components/popconfirm/__tests__/index.test.tsx +++ b/components/popconfirm/__tests__/index.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { spyElementPrototype } from 'rc-util/lib/test/domHook'; +import { spyElementPrototype } from '@rc-component/util/lib/test/domHook'; import Popconfirm from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index 0f0bc32569..4c3fd8a1b1 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import omit from 'rc-util/lib/omit'; import type { RenderFunction } from '../_util/getRenderPropValue'; import type { ButtonProps, LegacyButtonType } from '../button/button'; diff --git a/components/popover/index.tsx b/components/popover/index.tsx index d3d279f1f1..7b46d04192 100644 --- a/components/popover/index.tsx +++ b/components/popover/index.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; +import KeyCode from '@rc-component/util/lib/KeyCode'; import classNames from 'classnames'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import KeyCode from 'rc-util/lib/KeyCode'; import type { RenderFunction } from '../_util/getRenderPropValue'; import { getRenderPropValue } from '../_util/getRenderPropValue'; diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index 268aaf1e00..c47969c517 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; +import { FastColor } from '@ant-design/fast-color'; import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled'; import CheckOutlined from '@ant-design/icons/CheckOutlined'; import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; -import { FastColor } from '@ant-design/fast-color'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { devUseWarning } from '../_util/warning'; import type { ConfigConsumerProps } from '../config-provider'; diff --git a/components/qr-code/index.tsx b/components/qr-code/index.tsx index bcc9e2d160..bf5bd7b6df 100644 --- a/components/qr-code/index.tsx +++ b/components/qr-code/index.tsx @@ -1,8 +1,8 @@ import React, { useContext, type AriaAttributes } from 'react'; import { QRCodeCanvas, QRCodeSVG } from '@rc-component/qrcode'; +import omit from '@rc-component/util/lib/omit'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; -import pickAttrs from 'rc-util/lib/pickAttrs'; import { devUseWarning } from '../_util/warning'; import type { ConfigConsumerProps } from '../config-provider'; diff --git a/components/radio/group.tsx b/components/radio/group.tsx index f66ab52f22..b9f6298ace 100644 --- a/components/radio/group.tsx +++ b/components/radio/group.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; +import useId from '@rc-component/util/lib/hooks/useId'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import classNames from 'classnames'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import pickAttrs from 'rc-util/lib/pickAttrs'; import { ConfigContext } from '../config-provider'; import useCSSVarCls from '../config-provider/hooks/useCSSVarCls'; @@ -15,7 +16,6 @@ import type { } from './interface'; import Radio from './radio'; import useStyle from './style'; -import useId from 'rc-util/lib/hooks/useId'; const RadioGroup = React.forwardRef((props, ref) => { const { getPrefixCls, direction } = React.useContext(ConfigContext); diff --git a/components/radio/radio.tsx b/components/radio/radio.tsx index 91292e52c3..9e12d5c3ec 100644 --- a/components/radio/radio.tsx +++ b/components/radio/radio.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import RcCheckbox from 'rc-checkbox'; -import { composeRef } from 'rc-util/lib/ref'; import { devUseWarning } from '../_util/warning'; import Wave from '../_util/wave'; diff --git a/components/segmented/index.tsx b/components/segmented/index.tsx index 184498081d..6065b34bff 100644 --- a/components/segmented/index.tsx +++ b/components/segmented/index.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import useId from '@rc-component/util/lib/hooks/useId'; import classNames from 'classnames'; import type { SegmentedLabeledOption as RcSegmentedLabeledOption, @@ -12,7 +13,6 @@ import { ConfigContext } from '../config-provider'; import useSize from '../config-provider/hooks/useSize'; import type { SizeType } from '../config-provider/SizeContext'; import useStyle from './style'; -import useId from 'rc-util/lib/hooks/useId'; export type { SegmentedValue } from 'rc-segmented'; diff --git a/components/select/index.tsx b/components/select/index.tsx index 0e0301af32..a6d0ec0966 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -1,11 +1,11 @@ // TODO: 4.0 - codemod should help to change `filterOption` to support node props. import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { BaseSelectRef, SelectProps as RcSelectProps } from 'rc-select'; 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 { useZIndex } from '../_util/hooks/useZIndex'; import type { SelectCommonPlacement } from '../_util/motion'; @@ -15,13 +15,13 @@ import type { InputStatus } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; import { devUseWarning } from '../_util/warning'; import { ConfigContext } from '../config-provider'; +import type { Variant } from '../config-provider'; import DefaultRenderEmpty from '../config-provider/defaultRenderEmpty'; import DisabledContext from '../config-provider/DisabledContext'; import useCSSVarCls from '../config-provider/hooks/useCSSVarCls'; import useSize from '../config-provider/hooks/useSize'; import type { SizeType } from '../config-provider/SizeContext'; import { FormItemInputContext } from '../form/context'; -import type { Variant } from '../config-provider'; import useVariants from '../form/hooks/useVariants'; import { useCompactItemContext } from '../space/Compact'; import { useToken } from '../theme/internal'; diff --git a/components/skeleton/Avatar.tsx b/components/skeleton/Avatar.tsx index 6953eeaa20..8eab818baa 100644 --- a/components/skeleton/Avatar.tsx +++ b/components/skeleton/Avatar.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; diff --git a/components/skeleton/Button.tsx b/components/skeleton/Button.tsx index be414299c2..22707f6287 100644 --- a/components/skeleton/Button.tsx +++ b/components/skeleton/Button.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; diff --git a/components/skeleton/Input.tsx b/components/skeleton/Input.tsx index 0ed80966fc..c6fe6be5d9 100644 --- a/components/skeleton/Input.tsx +++ b/components/skeleton/Input.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { ConfigContext } from '../config-provider'; import type { SkeletonElementProps } from './Element'; diff --git a/components/slider/SliderTooltip.tsx b/components/slider/SliderTooltip.tsx index 0a51dfbea8..e75db71a7f 100644 --- a/components/slider/SliderTooltip.tsx +++ b/components/slider/SliderTooltip.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import { useRef } from 'react'; +import raf from '@rc-component/util/lib/raf'; +import { composeRef } from '@rc-component/util/lib/ref'; import type { SliderRef } from 'rc-slider/lib/Slider'; -import raf from 'rc-util/lib/raf'; -import { composeRef } from 'rc-util/lib/ref'; import type { TooltipProps } from '../tooltip'; import Tooltip from '../tooltip'; diff --git a/components/slider/index.tsx b/components/slider/index.tsx index 072e5231fb..da1048524a 100644 --- a/components/slider/index.tsx +++ b/components/slider/index.tsx @@ -1,9 +1,9 @@ import React from 'react'; +import raf from '@rc-component/util/lib/raf'; import classNames from 'classnames'; import type { SliderProps as RcSliderProps } from 'rc-slider'; import RcSlider from 'rc-slider'; import type { SliderRef } from 'rc-slider/lib/Slider'; -import raf from 'rc-util/lib/raf'; import type { GetProp } from '../_util/type'; import { devUseWarning } from '../_util/warning'; diff --git a/components/slider/useRafLock.ts b/components/slider/useRafLock.ts index 652785ad44..d54def3043 100644 --- a/components/slider/useRafLock.ts +++ b/components/slider/useRafLock.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import raf from 'rc-util/lib/raf'; +import raf from '@rc-component/util/lib/raf'; export default function useRafLock(): [state: boolean, setState: (nextState: boolean) => void] { const [state, setState] = React.useState(false); diff --git a/components/space/Compact.tsx b/components/space/Compact.tsx index 7295c757bd..f614b78502 100644 --- a/components/space/Compact.tsx +++ b/components/space/Compact.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; import classNames from 'classnames'; -import toArray from 'rc-util/lib/Children/toArray'; import type { DirectionType } from '../config-provider'; import { ConfigContext } from '../config-provider'; diff --git a/components/space/index.tsx b/components/space/index.tsx index 69bfb39c47..c7a605221f 100644 --- a/components/space/index.tsx +++ b/components/space/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; import classNames from 'classnames'; -import toArray from 'rc-util/lib/Children/toArray'; import { isPresetSize, isValidGapNumber } from '../_util/gapSize'; import { ConfigContext } from '../config-provider'; diff --git a/components/spin/Indicator/Progress.tsx b/components/spin/Indicator/Progress.tsx index a784d21978..fcfa5321e5 100644 --- a/components/spin/Indicator/Progress.tsx +++ b/components/spin/Indicator/Progress.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import classNames from 'classnames'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; export interface ProgressProps { prefixCls: string; diff --git a/components/splitter/SplitBar.tsx b/components/splitter/SplitBar.tsx index 2319a948f7..27549e4c7c 100644 --- a/components/splitter/SplitBar.tsx +++ b/components/splitter/SplitBar.tsx @@ -3,8 +3,8 @@ import DownOutlined from '@ant-design/icons/DownOutlined'; import LeftOutlined from '@ant-design/icons/LeftOutlined'; import RightOutlined from '@ant-design/icons/RightOutlined'; import UpOutlined from '@ant-design/icons/UpOutlined'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; import classNames from 'classnames'; -import useEvent from 'rc-util/lib/hooks/useEvent'; export interface SplitBarProps { index: number; diff --git a/components/splitter/Splitter.tsx b/components/splitter/Splitter.tsx index 036c6a46b0..8653de1406 100644 --- a/components/splitter/Splitter.tsx +++ b/components/splitter/Splitter.tsx @@ -1,8 +1,8 @@ /* eslint-disable react/no-array-index-key */ import React, { useState } from 'react'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; -import useEvent from 'rc-util/lib/hooks/useEvent'; import type { GetProp } from '../_util/type'; import { devUseWarning } from '../_util/warning'; diff --git a/components/splitter/__tests__/index.test.tsx b/components/splitter/__tests__/index.test.tsx index 96ea3f8d42..2d5542b7be 100644 --- a/components/splitter/__tests__/index.test.tsx +++ b/components/splitter/__tests__/index.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import type { GetProps, SplitterProps } from 'antd'; import { ConfigProvider, Splitter } from 'antd'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import { resetWarned } from '../../_util/warning'; import { diff --git a/components/splitter/__tests__/lazy.test.tsx b/components/splitter/__tests__/lazy.test.tsx index 7ab4201ee1..d82fce6825 100644 --- a/components/splitter/__tests__/lazy.test.tsx +++ b/components/splitter/__tests__/lazy.test.tsx @@ -1,8 +1,8 @@ import React from 'react'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; +import { resetWarned } from '@rc-component/util/lib/warning'; import { createEvent, fireEvent, render } from '@testing-library/react'; import { Splitter } from 'antd'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; -import { resetWarned } from 'rc-util/lib/warning'; import { triggerResize, waitFakeTimer } from '../../../tests/utils'; import { PanelProps, SplitterProps } from '../interface'; diff --git a/components/splitter/hooks/useItems.ts b/components/splitter/hooks/useItems.ts index 853d798fc4..3666d757fe 100644 --- a/components/splitter/hooks/useItems.ts +++ b/components/splitter/hooks/useItems.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import toArray from 'rc-util/lib/Children/toArray'; +import toArray from '@rc-component/util/lib/Children/toArray'; import type { PanelProps } from '../interface'; diff --git a/components/statistic/Statistic.tsx b/components/statistic/Statistic.tsx index 1a52c407ca..a1c50a805e 100644 --- a/components/statistic/Statistic.tsx +++ b/components/statistic/Statistic.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; import classNames from 'classnames'; -import pickAttrs from 'rc-util/lib/pickAttrs'; import type { HTMLAriaDataAttributes } from '../_util/aria-data-attrs'; import { devUseWarning } from '../_util/warning'; diff --git a/components/steps/useLegacyItems.ts b/components/steps/useLegacyItems.ts index cd3c4aa380..d08e9fed1f 100644 --- a/components/steps/useLegacyItems.ts +++ b/components/steps/useLegacyItems.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import toArray from 'rc-util/lib/Children/toArray'; +import toArray from '@rc-component/util/lib/Children/toArray'; import type { StepProps } from '.'; import { devUseWarning } from '../_util/warning'; diff --git a/components/switch/__tests__/index.test.tsx b/components/switch/__tests__/index.test.tsx index 87dd3a64c1..2e458e722f 100644 --- a/components/switch/__tests__/index.test.tsx +++ b/components/switch/__tests__/index.test.tsx @@ -6,7 +6,7 @@ import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; import { act, fireEvent, render } from '../../../tests/utils'; -jest.mock('rc-util/lib/Dom/isVisible', () => { +jest.mock('@rc-component/util/lib/Dom/isVisible', () => { const mockFn = () => true; return mockFn; }); diff --git a/components/switch/index.tsx b/components/switch/index.tsx index abae39b801..88f18b21bf 100755 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; import RcSwitch from 'rc-switch'; import type { SwitchChangeEventHandler, SwitchClickEventHandler } from 'rc-switch'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; import Wave from '../_util/wave'; import { ConfigContext } from '../config-provider'; diff --git a/components/table/InternalTable.tsx b/components/table/InternalTable.tsx index fcc81d308f..f33d738ce0 100644 --- a/components/table/InternalTable.tsx +++ b/components/table/InternalTable.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import { INTERNAL_HOOKS } from 'rc-table'; import type { Reference as RcReference, TableProps as RcTableProps } from 'rc-table'; import { convertChildrenToColumns } from 'rc-table/lib/hooks/useColumns'; -import omit from 'rc-util/lib/omit'; import useProxyImperativeHandle from '../_util/hooks/useProxyImperativeHandle'; import type { Breakpoint } from '../_util/responsiveObserver'; diff --git a/components/table/__tests__/empty.test.tsx b/components/table/__tests__/empty.test.tsx index 3849d914c0..8a3de61e90 100644 --- a/components/table/__tests__/empty.test.tsx +++ b/components/table/__tests__/empty.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import type { ColumnsType } from '..'; import Table from '..'; diff --git a/components/table/hooks/useFilter/FilterDropdown.tsx b/components/table/hooks/useFilter/FilterDropdown.tsx index 3627a79039..53a6545890 100644 --- a/components/table/hooks/useFilter/FilterDropdown.tsx +++ b/components/table/hooks/useFilter/FilterDropdown.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import FilterFilled from '@ant-design/icons/FilterFilled'; +import isEqual from '@rc-component/util/lib/isEqual'; import type { AnyObject } from 'antd/es/_util/type'; import classNames from 'classnames'; import type { FieldDataNode } from 'rc-tree'; -import isEqual from 'rc-util/lib/isEqual'; import type { FilterState } from '.'; import extendsObject from '../../../_util/extendsObject'; diff --git a/components/table/hooks/useFilter/FilterWrapper.tsx b/components/table/hooks/useFilter/FilterWrapper.tsx index 4f8cf55376..94602ca3e3 100644 --- a/components/table/hooks/useFilter/FilterWrapper.tsx +++ b/components/table/hooks/useFilter/FilterWrapper.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import KeyCode from 'rc-util/lib/KeyCode'; +import KeyCode from '@rc-component/util/lib/KeyCode'; export interface FilterDropdownMenuWrapperProps { className?: string; diff --git a/components/table/hooks/useSelection.tsx b/components/table/hooks/useSelection.tsx index 0d7f77285c..78cbdbc12f 100644 --- a/components/table/hooks/useSelection.tsx +++ b/components/table/hooks/useSelection.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { useCallback, useMemo } from 'react'; import DownOutlined from '@ant-design/icons/DownOutlined'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; import { INTERNAL_COL_DEFINE } from 'rc-table'; import type { FixedType } from 'rc-table/lib/interface'; @@ -8,7 +9,6 @@ import type { DataNode, GetCheckDisabled } from 'rc-tree/lib/interface'; 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 useMultipleSelect from '../../_util/hooks/useMultipleSelect'; import type { AnyObject } from '../../_util/type'; diff --git a/components/table/hooks/useSorter.tsx b/components/table/hooks/useSorter.tsx index 36ba3b5b01..c043656c4d 100644 --- a/components/table/hooks/useSorter.tsx +++ b/components/table/hooks/useSorter.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import CaretDownOutlined from '@ant-design/icons/CaretDownOutlined'; import CaretUpOutlined from '@ant-design/icons/CaretUpOutlined'; +import KeyCode from '@rc-component/util/lib/KeyCode'; import classNames from 'classnames'; -import KeyCode from 'rc-util/lib/KeyCode'; import type { AnyObject } from '../../_util/type'; import type { TooltipProps } from '../../tooltip'; diff --git a/components/tabs/hooks/useLegacyItems.ts b/components/tabs/hooks/useLegacyItems.ts index 05ea28eaef..e339e389ce 100644 --- a/components/tabs/hooks/useLegacyItems.ts +++ b/components/tabs/hooks/useLegacyItems.ts @@ -1,6 +1,6 @@ import * as React from 'react'; +import toArray from '@rc-component/util/lib/Children/toArray'; import type { Tab } from 'rc-tabs/lib/interface'; -import toArray from 'rc-util/lib/Children/toArray'; import type { TabPaneProps, TabsProps } from '..'; import { devUseWarning } from '../../_util/warning'; diff --git a/components/tag/__tests__/index.test.tsx b/components/tag/__tests__/index.test.tsx index 9f67679dea..9889b589e7 100644 --- a/components/tag/__tests__/index.test.tsx +++ b/components/tag/__tests__/index.test.tsx @@ -9,7 +9,7 @@ import { act, fireEvent, render } from '../../../tests/utils'; (global as any).isVisible = true; -jest.mock('rc-util/lib/Dom/isVisible', () => { +jest.mock('@rc-component/util/lib/Dom/isVisible', () => { const mockFn = () => (global as any).isVisible; return mockFn; }); diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 30849c63f8..fb6d36baa4 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import type { PresetColorType, PresetStatusColorType } from '../_util/colors'; import { isPresetColor, isPresetStatusColor } from '../_util/colors'; diff --git a/components/timeline/useItems.ts b/components/timeline/useItems.ts index a450da344c..ba7077ffc3 100644 --- a/components/timeline/useItems.ts +++ b/components/timeline/useItems.ts @@ -1,5 +1,5 @@ import type * as React from 'react'; -import toArray from 'rc-util/lib/Children/toArray'; +import toArray from '@rc-component/util/lib/Children/toArray'; import type { TimelineItemProps } from './TimelineItem'; diff --git a/components/tooltip/__tests__/tooltip.test.tsx b/components/tooltip/__tests__/tooltip.test.tsx index 2143203902..36b8e3e04c 100644 --- a/components/tooltip/__tests__/tooltip.test.tsx +++ b/components/tooltip/__tests__/tooltip.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { spyElementPrototype } from 'rc-util/lib/test/domHook'; +import { spyElementPrototype } from '@rc-component/util/lib/test/domHook'; import type { TooltipPlacement } from '..'; import Tooltip from '..'; diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 39f6d00381..63f187b111 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import type { BuildInPlacements } from '@rc-component/trigger'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; import RcTooltip from 'rc-tooltip'; import type { placements as Placements } from 'rc-tooltip/lib/placements'; @@ -7,7 +8,6 @@ import type { TooltipProps as RcTooltipProps, TooltipRef as RcTooltipRef, } from 'rc-tooltip/lib/Tooltip'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; import type { PresetColorType } from '../_util/colors'; import ContextIsolator from '../_util/ContextIsolator'; diff --git a/components/tour/__tests__/index.test.tsx b/components/tour/__tests__/index.test.tsx index aad11b6550..db5e275901 100644 --- a/components/tour/__tests__/index.test.tsx +++ b/components/tour/__tests__/index.test.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useRef } from 'react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import Tour from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/transfer/ListBody.tsx b/components/transfer/ListBody.tsx index 79dfa89eb0..4818b2c049 100644 --- a/components/transfer/ListBody.tsx +++ b/components/transfer/ListBody.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; import classNames from 'classnames'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; import type { KeyWiseTransferItem } from '.'; import Pagination from '../pagination'; diff --git a/components/transfer/hooks/useSelection.ts b/components/transfer/hooks/useSelection.ts index 2c5f1191e0..088b371d30 100644 --- a/components/transfer/hooks/useSelection.ts +++ b/components/transfer/hooks/useSelection.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useEvent, useMergedState } from 'rc-util'; +import { useEvent, useMergedState } from '@rc-component/util'; import type { TransferKey } from '../interface'; diff --git a/components/transfer/list.tsx b/components/transfer/list.tsx index 3fe0b74720..19e1637b1a 100644 --- a/components/transfer/list.tsx +++ b/components/transfer/list.tsx @@ -1,7 +1,7 @@ import React, { useMemo, useRef, useState } from 'react'; import DownOutlined from '@ant-design/icons/DownOutlined'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; -import omit from 'rc-util/lib/omit'; import { groupKeysMap } from '../_util/transKeys'; import Checkbox from '../checkbox'; diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index 93d36b707d..10f22371cc 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { BaseSelectRef } from 'rc-select'; import type { Placement } from 'rc-select/lib/BaseSelect'; import type { TreeSelectProps as RcTreeSelectProps } from 'rc-tree-select'; import RcTreeSelect, { SHOW_ALL, SHOW_CHILD, SHOW_PARENT, TreeNode } from 'rc-tree-select'; import type { DataNode } from 'rc-tree-select/lib/interface'; -import omit from 'rc-util/lib/omit'; import { useZIndex } from '../_util/hooks/useZIndex'; import type { SelectCommonPlacement } from '../_util/motion'; diff --git a/components/typography/Base/Ellipsis.tsx b/components/typography/Base/Ellipsis.tsx index 9a49fe0a17..84c3fabd8c 100644 --- a/components/typography/Base/Ellipsis.tsx +++ b/components/typography/Base/Ellipsis.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; -import toArray from 'rc-util/lib/Children/toArray'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; +import toArray from '@rc-component/util/lib/Children/toArray'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; + import { isValidText } from './util'; interface MeasureTextProps { diff --git a/components/typography/Base/index.tsx b/components/typography/Base/index.tsx index b35e45876a..2864b9bbc7 100644 --- a/components/typography/Base/index.tsx +++ b/components/typography/Base/index.tsx @@ -1,14 +1,14 @@ import * as React from 'react'; import type { JSX } from 'react'; import EditOutlined from '@ant-design/icons/EditOutlined'; +import toArray from '@rc-component/util/lib/Children/toArray'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; +import omit from '@rc-component/util/lib/omit'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; import type { AutoSizeType } from 'rc-textarea'; -import toArray from 'rc-util/lib/Children/toArray'; -import useLayoutEffect 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 { isStyleSupport } from '../../_util/styleChecker'; import { ConfigContext } from '../../config-provider'; diff --git a/components/typography/Editable.tsx b/components/typography/Editable.tsx index 68e2568f80..8365c50aca 100644 --- a/components/typography/Editable.tsx +++ b/components/typography/Editable.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import EnterOutlined from '@ant-design/icons/EnterOutlined'; +import KeyCode from '@rc-component/util/lib/KeyCode'; import classNames from 'classnames'; import type { TextAreaProps } from 'rc-textarea'; -import KeyCode from 'rc-util/lib/KeyCode'; import { cloneElement } from '../_util/reactNode'; import type { DirectionType } from '../config-provider'; diff --git a/components/typography/Text.tsx b/components/typography/Text.tsx index a20aa9ab0f..1d751663c4 100644 --- a/components/typography/Text.tsx +++ b/components/typography/Text.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import omit from 'rc-util/lib/omit'; +import omit from '@rc-component/util/lib/omit'; import { devUseWarning } from '../_util/warning'; import type { BlockProps, EllipsisConfig } from './Base'; diff --git a/components/typography/Typography.tsx b/components/typography/Typography.tsx index b5afdf75d1..266c66f185 100644 --- a/components/typography/Typography.tsx +++ b/components/typography/Typography.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import type { JSX } from 'react'; +import { composeRef } from '@rc-component/util/lib/ref'; import classNames from 'classnames'; -import { composeRef } from 'rc-util/lib/ref'; import { devUseWarning } from '../_util/warning'; import type { ConfigConsumerProps, DirectionType } from '../config-provider'; diff --git a/components/typography/__tests__/editable.test.tsx b/components/typography/__tests__/editable.test.tsx index dc34d0ecf5..9ee159f944 100644 --- a/components/typography/__tests__/editable.test.tsx +++ b/components/typography/__tests__/editable.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { fireEvent, render } from '../../../tests/utils'; import Base from '../Base'; diff --git a/components/typography/__tests__/ellipsis.test.tsx b/components/typography/__tests__/ellipsis.test.tsx index 812ef49940..cd47d8301b 100644 --- a/components/typography/__tests__/ellipsis.test.tsx +++ b/components/typography/__tests__/ellipsis.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { act, @@ -9,11 +9,12 @@ import { waitFakeTimer, waitFor, } from '../../../tests/utils'; -import type { EllipsisConfig } from '../Base'; -import Base from '../Base'; import ConfigProvider from '../../config-provider'; import type { ConfigProviderProps } from '../../config-provider'; import zhCN from '../../locale/zh_CN'; +import type { EllipsisConfig } from '../Base'; +import Base from '../Base'; + type Locale = ConfigProviderProps['locale']; jest.mock('copy-to-clipboard'); diff --git a/components/typography/__tests__/index.test.tsx b/components/typography/__tests__/index.test.tsx index 28d74d2359..fc39e5734e 100644 --- a/components/typography/__tests__/index.test.tsx +++ b/components/typography/__tests__/index.test.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { CheckOutlined, HighlightOutlined, LikeOutlined, SmileOutlined } from '@ant-design/icons'; -import copy from 'copy-to-clipboard'; -import KeyCode from 'rc-util/lib/KeyCode'; -import { resetWarned } from 'rc-util/lib/warning'; +import KeyCode from '@rc-component/util/lib/KeyCode'; +import { resetWarned } from '@rc-component/util/lib/warning'; import userEvent from '@testing-library/user-event'; +import copy from 'copy-to-clipboard'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; diff --git a/components/typography/hooks/useCopyClick.ts b/components/typography/hooks/useCopyClick.ts index b97f3b98f5..76ac6bbc2c 100644 --- a/components/typography/hooks/useCopyClick.ts +++ b/components/typography/hooks/useCopyClick.ts @@ -1,6 +1,6 @@ import * as React from 'react'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; import copy from 'copy-to-clipboard'; -import useEvent from 'rc-util/lib/hooks/useEvent'; import toList from '../../_util/toList'; import type { CopyConfig } from '../Base'; diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index 9bd91b2172..1b51b3f965 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import { flushSync } from 'react-dom'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; 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 { devUseWarning } from '../_util/warning'; import { ConfigContext } from '../config-provider'; diff --git a/components/upload/UploadList/index.tsx b/components/upload/UploadList/index.tsx index db1ad1ffe4..36f1fda109 100644 --- a/components/upload/UploadList/index.tsx +++ b/components/upload/UploadList/index.tsx @@ -3,10 +3,10 @@ import FileTwoTone from '@ant-design/icons/FileTwoTone'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import PaperClipOutlined from '@ant-design/icons/PaperClipOutlined'; import PictureTwoTone from '@ant-design/icons/PictureTwoTone'; +import omit from '@rc-component/util/lib/omit'; import classNames from 'classnames'; import type { CSSMotionListProps } from 'rc-motion'; import CSSMotion, { CSSMotionList } from 'rc-motion'; -import omit from 'rc-util/lib/omit'; import useForceUpdate from '../../_util/hooks/useForceUpdate'; import initCollapseMotion from '../../_util/motion'; diff --git a/components/upload/__tests__/upload.test.tsx b/components/upload/__tests__/upload.test.tsx index b51012c0e3..02775fc186 100644 --- a/components/upload/__tests__/upload.test.tsx +++ b/components/upload/__tests__/upload.test.tsx @@ -31,7 +31,7 @@ describe('Upload', () => { return teardown(); }); - // Mock for rc-util raf + // Mock for rc-component/util raf window.requestAnimationFrame = (callback) => window.setTimeout(callback, 16); window.cancelAnimationFrame = (id) => window.clearTimeout(id); diff --git a/components/upload/__tests__/uploadlist.test.tsx b/components/upload/__tests__/uploadlist.test.tsx index 516e8d00b8..426e0a370b 100644 --- a/components/upload/__tests__/uploadlist.test.tsx +++ b/components/upload/__tests__/uploadlist.test.tsx @@ -29,7 +29,7 @@ const fileList: UploadProps['fileList'] = [ ]; describe('Upload List', () => { - // Mock for rc-util raf + // Mock for rc-component/util raf window.requestAnimationFrame = (callback) => window.setTimeout(callback, 16); window.cancelAnimationFrame = (id) => window.clearTimeout(id); diff --git a/components/watermark/context.ts b/components/watermark/context.ts index 3060ad991e..b82346ba94 100644 --- a/components/watermark/context.ts +++ b/components/watermark/context.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import useEvent from 'rc-util/lib/hooks/useEvent'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; export interface WatermarkContextProps { add: (ele: HTMLElement) => void; diff --git a/components/watermark/index.tsx b/components/watermark/index.tsx index d12b66070c..cd3c636c8a 100644 --- a/components/watermark/index.tsx +++ b/components/watermark/index.tsx @@ -1,8 +1,9 @@ import React, { useEffect } from 'react'; import { useMutateObserver } from '@rc-component/mutate-observer'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; import classNames from 'classnames'; -import useEvent from 'rc-util/lib/hooks/useEvent'; +import toList from '../_util/toList'; import { useToken } from '../theme/internal'; import WatermarkContext from './context'; import type { WatermarkContextProps } from './context'; @@ -10,7 +11,6 @@ import useClips, { FontGap } from './useClips'; import useRafDebounce from './useRafDebounce'; import useWatermark from './useWatermark'; import { getPixelRatio, reRendering } from './utils'; -import toList from '../_util/toList'; export interface WatermarkProps { zIndex?: number; diff --git a/components/watermark/useRafDebounce.ts b/components/watermark/useRafDebounce.ts index 370299bbae..9d8cca5ae4 100644 --- a/components/watermark/useRafDebounce.ts +++ b/components/watermark/useRafDebounce.ts @@ -1,6 +1,6 @@ import React from 'react'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import raf from 'rc-util/lib/raf'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import raf from '@rc-component/util/lib/raf'; /** * Callback will only execute last one for each raf diff --git a/package.json b/package.json index 76d0c5d467..ea8dc1b1d1 100644 --- a/package.json +++ b/package.json @@ -116,6 +116,7 @@ "@rc-component/qrcode": "~1.0.0", "@rc-component/tour": "~1.15.1", "@rc-component/trigger": "^2.2.6", + "@rc-component/util": "^1.0.1", "classnames": "^2.5.1", "copy-to-clipboard": "^3.3.3", "dayjs": "^1.11.11", @@ -150,7 +151,6 @@ "rc-tree": "~5.13.0", "rc-tree-select": "~5.27.0", "rc-upload": "~4.8.1", - "rc-util": "^5.44.3", "scroll-into-view-if-needed": "^3.1.0", "throttle-debounce": "^5.0.2" }, diff --git a/tests/__mocks__/rc-util/lib/Portal.tsx b/tests/__mocks__/rc-util/lib/Portal.tsx index b00287b9c5..0533f51a63 100644 --- a/tests/__mocks__/rc-util/lib/Portal.tsx +++ b/tests/__mocks__/rc-util/lib/Portal.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import type { PortalProps, PortalRef } from 'rc-util/lib/Portal'; +import type { PortalProps, PortalRef } from '@rc-component/util/lib/Portal'; import { TriggerMockContext } from '../../../shared/demoTestContext'; -let OriginPortal = jest.requireActual('rc-util/lib/Portal'); +let OriginPortal = jest.requireActual('@rc-component/util/lib/Portal'); OriginPortal = OriginPortal.default ?? OriginPortal; class MockPortal extends React.Component { diff --git a/tests/shared/imageTest.tsx b/tests/shared/imageTest.tsx index dc3199724a..d287158cac 100644 --- a/tests/shared/imageTest.tsx +++ b/tests/shared/imageTest.tsx @@ -2,13 +2,13 @@ import path from 'path'; import React from 'react'; // Reference: https://github.com/ant-design/ant-design/pull/24003#discussion_r427267386 import { createCache, extractStyle, StyleProvider } from '@ant-design/cssinjs'; +import rcWarning from '@rc-component/util/lib/warning'; import { extractStaticStyle } from 'antd-style'; import dayjs from 'dayjs'; import fse from 'fs-extra'; import { globSync } from 'glob'; import { JSDOM } from 'jsdom'; import MockDate from 'mockdate'; -import rcWarning from 'rc-util/lib/warning'; import type { HTTPRequest } from 'puppeteer'; import ReactDOMServer from 'react-dom/server'; diff --git a/typings/custom-typings.d.ts b/typings/custom-typings.d.ts index 758a40db17..96e52e851b 100644 --- a/typings/custom-typings.d.ts +++ b/typings/custom-typings.d.ts @@ -8,8 +8,6 @@ declare module '*.svg' { export default src; } -declare module 'rc-util*'; - declare module 'jsonml-to-react-element'; declare module 'jsonml.js/*';