diff --git a/package.json b/package.json index aefbcb646..4d94f9c6a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "publish-version": "tsx ./scripts/synchronize-version.ts", "prepublishOnly": "tsx ./scripts/pre-publish.ts", "precompile": "npm run precompile --workspaces", - "prepare": "husky install", + "prepare": "husky", "size-limit": "size-limit", "lint": "npm run lint --workspaces", "tsc": "npm run tsc --workspaces", diff --git a/packages/x-markdown/.jest.js b/packages/x-markdown/.jest.js index 368774c23..7d7f3cfd8 100644 --- a/packages/x-markdown/.jest.js +++ b/packages/x-markdown/.jest.js @@ -1,4 +1,5 @@ const compileModules = [ + '@rc-component', 'react-sticky-box', 'rc-tween-one', '@babel', diff --git a/packages/x-markdown/package.json b/packages/x-markdown/package.json index e2563c366..37e632c9b 100644 --- a/packages/x-markdown/package.json +++ b/packages/x-markdown/package.json @@ -49,7 +49,7 @@ "license": "MIT", "description": "placeholder for @ant-design/x-markdown", "dependencies": { - "classnames": "^2.5.1", + "clsx": "^2.1.1", "dompurify": "^3.2.6", "html-react-parser": "^5.2.5", "katex": "^0.16.22", diff --git a/packages/x-markdown/src/XMarkdown/index.tsx b/packages/x-markdown/src/XMarkdown/index.tsx index a9402fe2c..7eef17888 100644 --- a/packages/x-markdown/src/XMarkdown/index.tsx +++ b/packages/x-markdown/src/XMarkdown/index.tsx @@ -1,4 +1,4 @@ -import classnames from 'classnames'; +import { clsx } from 'clsx'; import React, { useMemo } from 'react'; import { Parser, Renderer } from './core'; import { useStreaming } from './hooks'; @@ -21,7 +21,7 @@ const XMarkdown: React.FC = React.memo((props) => { } = props; // ============================ style ============================ - const mergedCls = classnames('x-markdown', rootClassName, className); + const mergedCls = clsx('x-markdown', rootClassName, className); // ============================ Streaming ============================ const displayContent = useStreaming(content || children || '', { streaming, components }); diff --git a/packages/x-markdown/tests/setup.ts b/packages/x-markdown/tests/setup.ts index deeaa1ba2..66ba0f289 100644 --- a/packages/x-markdown/tests/setup.ts +++ b/packages/x-markdown/tests/setup.ts @@ -40,7 +40,7 @@ export function fillWindowEnv(window: Window | DOMWindow) { }); } - // Fix css-animation or rc-motion deps on these + // Fix css-animation or @rc-component/motion deps on these // https://github.com/react-component/motion/blob/9c04ef1a210a4f3246c9becba6e33ea945e00669/src/util/motion.ts#L27-L35 // https://github.com/yiminghe/css-animation/blob/a5986d73fd7dfce75665337f39b91483d63a4c8c/src/Event.js#L44 win.AnimationEvent = win.AnimationEvent || win.Event; diff --git a/packages/x-markdown/tests/setupAfterEnv.ts b/packages/x-markdown/tests/setupAfterEnv.ts index cb39bc909..d30ddfa22 100644 --- a/packages/x-markdown/tests/setupAfterEnv.ts +++ b/packages/x-markdown/tests/setupAfterEnv.ts @@ -1,9 +1,9 @@ import '@testing-library/jest-dom'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import { toHaveNoViolations } from 'jest-axe'; import jsdom from 'jsdom'; import format, { plugins } from 'pretty-format'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; // Mock `scrollTo` since jsdom do not support it spyElementPrototypes(HTMLElement, { diff --git a/packages/x-sdk/.jest.js b/packages/x-sdk/.jest.js index df1b1f6e7..12cb73d54 100644 --- a/packages/x-sdk/.jest.js +++ b/packages/x-sdk/.jest.js @@ -1,4 +1,5 @@ const compileModules = [ + '@rc-component', 'react-sticky-box', 'rc-tween-one', '@babel', diff --git a/packages/x-sdk/package.json b/packages/x-sdk/package.json index 37a95584e..8f947cff5 100644 --- a/packages/x-sdk/package.json +++ b/packages/x-sdk/package.json @@ -44,7 +44,7 @@ "license": "MIT", "description": "placeholder for @ant-design/x-sdk", "dependencies": { - "rc-util": "^5.43.0" + "@rc-component/util": "^1.4.0" }, "devDependencies": { "@types/react": "^19.0.2", diff --git a/packages/x-sdk/src/x-chat/index.ts b/packages/x-sdk/src/x-chat/index.ts index f3a75f580..f8d653cc0 100644 --- a/packages/x-sdk/src/x-chat/index.ts +++ b/packages/x-sdk/src/x-chat/index.ts @@ -1,4 +1,4 @@ -import { useEvent } from 'rc-util'; +import { useEvent } from '@rc-component/util'; import React, { useEffect, useState } from 'react'; import type { AnyObject } from '../_util/type'; import { AbstractChatProvider } from '../chat-providers'; diff --git a/packages/x-sdk/tests/setup.ts b/packages/x-sdk/tests/setup.ts index da38b4e63..27f570d32 100644 --- a/packages/x-sdk/tests/setup.ts +++ b/packages/x-sdk/tests/setup.ts @@ -41,7 +41,7 @@ export function fillWindowEnv(window: Window | DOMWindow) { }); } - // Fix css-animation or rc-motion deps on these + // Fix css-animation or @rc-component/motion deps on these // https://github.com/react-component/motion/blob/9c04ef1a210a4f3246c9becba6e33ea945e00669/src/util/motion.ts#L27-L35 // https://github.com/yiminghe/css-animation/blob/a5986d73fd7dfce75665337f39b91483d63a4c8c/src/Event.js#L44 win.AnimationEvent = win.AnimationEvent || win.Event; diff --git a/packages/x-sdk/tests/utils.tsx b/packages/x-sdk/tests/utils.tsx index e8c7166f9..0891eb503 100644 --- a/packages/x-sdk/tests/utils.tsx +++ b/packages/x-sdk/tests/utils.tsx @@ -1,8 +1,8 @@ +import { _rs as onEsResize } from '@rc-component/resize-observer/es/utils/observerUtil'; +import { _rs as onLibResize } from '@rc-component/resize-observer/lib/utils/observerUtil'; import type { RenderOptions, RenderResult } from '@testing-library/react'; import { act, render } from '@testing-library/react'; import MockDate from 'mockdate'; -import { _rs as onEsResize } from 'rc-resize-observer/es/utils/observerUtil'; -import { _rs as onLibResize } from 'rc-resize-observer/lib/utils/observerUtil'; import type { ReactElement } from 'react'; import React, { createRef, StrictMode } from 'react'; diff --git a/packages/x/.dumi/components/SemanticPreview.tsx b/packages/x/.dumi/components/SemanticPreview.tsx index 9c38dd4ba..d01f6332a 100644 --- a/packages/x/.dumi/components/SemanticPreview.tsx +++ b/packages/x/.dumi/components/SemanticPreview.tsx @@ -1,8 +1,8 @@ import { XProvider } from '@ant-design/x'; +import set from '@rc-component/util/lib/utils/set'; import { Col, Flex, Popover, Row, Tag, Typography, theme } from 'antd'; import { createStyles, css } from 'antd-style'; -import classnames from 'classnames'; -import set from 'rc-util/lib/utils/set'; +import { clsx } from 'clsx'; /* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect */ import React from 'react'; @@ -149,13 +149,13 @@ const SemanticPreview: React.FC = (props) => { // ======================== Render ======================== return ( -
+
- + {cloneNode} -
    +
      {semantics.map((semantic) => ( = (props) => { } >
    • setHoverSemantic(semantic.name)} onMouseLeave={() => setHoverSemantic(null)} > @@ -201,7 +201,7 @@ const SemanticPreview: React.FC = (props) => {
      = (props) => { if (!before && !after) { return ( - + {title} {subtitle && {subtitle}} {tag && ( - + {tag.replace(/VERSION/i, version)} )} diff --git a/packages/x/.dumi/hooks/useThemeAnimation.ts b/packages/x/.dumi/hooks/useThemeAnimation.ts index 391c54709..096077b91 100644 --- a/packages/x/.dumi/hooks/useThemeAnimation.ts +++ b/packages/x/.dumi/hooks/useThemeAnimation.ts @@ -1,5 +1,5 @@ +import { removeCSS, updateCSS } from '@rc-component/util/lib/Dom/dynamicCSS'; import { useTheme } from 'antd-style'; -import { removeCSS, updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; import { useEffect, useRef } from 'react'; const viewTransitionStyle = ` diff --git a/packages/x/.dumi/pages/index/common/Container.tsx b/packages/x/.dumi/pages/index/common/Container.tsx index 1bf1f52b4..eac12e10c 100644 --- a/packages/x/.dumi/pages/index/common/Container.tsx +++ b/packages/x/.dumi/pages/index/common/Container.tsx @@ -1,5 +1,5 @@ import { createStyles } from 'antd-style'; -import classnames from 'classnames'; +import { clsx } from 'clsx'; import React from 'react'; const useStyle = createStyles(({ token, css }) => { @@ -48,7 +48,7 @@ const Container: React.FC = (props) => { const { styles } = useStyle(); return (
      diff --git a/packages/x/.dumi/pages/index/components/DesignGuide.tsx b/packages/x/.dumi/pages/index/components/DesignGuide.tsx index 37dfeb780..48c2a7fde 100644 --- a/packages/x/.dumi/pages/index/components/DesignGuide.tsx +++ b/packages/x/.dumi/pages/index/components/DesignGuide.tsx @@ -1,6 +1,5 @@ import { Button } from 'antd'; import { createStyles } from 'antd-style'; -import classnames from 'classnames'; import { useLocation, useNavigate } from 'dumi'; import React from 'react'; import useLocale from '../../../hooks/useLocale'; @@ -224,7 +223,7 @@ const DesignGuide: React.FC = () => { return (
      -
      +
      icon icon {
      - - @@ -275,7 +275,7 @@ const MainBanner: React.FC = () => { diff --git a/packages/x/.dumi/pages/index/components/SceneIntroduction/index.tsx b/packages/x/.dumi/pages/index/components/SceneIntroduction/index.tsx index e1fa37145..a0f2941bd 100644 --- a/packages/x/.dumi/pages/index/components/SceneIntroduction/index.tsx +++ b/packages/x/.dumi/pages/index/components/SceneIntroduction/index.tsx @@ -1,6 +1,6 @@ import { Button, Carousel } from 'antd'; import { createStyles } from 'antd-style'; -import classnames from 'classnames'; +import { clsx } from 'clsx'; import React from 'react'; import useLocale from '../../../../hooks/useLocale'; @@ -228,7 +228,7 @@ const SceneBanner: React.FC = () => {