diff --git a/package.json b/package.json index 0bdb8c5..111df83 100644 --- a/package.json +++ b/package.json @@ -40,10 +40,10 @@ "tsc": "bunx tsc --noEmit" }, "dependencies": { - "@rc-component/portal": "^2.0.0", "@rc-component/motion": "^1.0.0", + "@rc-component/portal": "^2.0.0", "@rc-component/util": "^1.3.0", - "classnames": "^2.2.6" + "clsx": "^2.1.1" }, "devDependencies": { "@ant-design/icons": "^5.0.1", @@ -51,8 +51,8 @@ "@rc-component/np": "^1.0.0", "@testing-library/jest-dom": "^6.4.0", "@testing-library/react": "^15.0.6", - "@types/classnames": "^2.2.10", "@types/jest": "^29.5.11", + "@types/node": "^24.5.2", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@umijs/fabric": "^4.0.1", diff --git a/src/Image.tsx b/src/Image.tsx index 9a0fd55..4e37d86 100644 --- a/src/Image.tsx +++ b/src/Image.tsx @@ -1,5 +1,5 @@ import useControlledState from '@rc-component/util/lib/hooks/useControlledState'; -import classnames from 'classnames'; +import { clsx } from 'clsx'; import * as React from 'react'; import { useContext, useMemo, useState } from 'react'; import type { InternalPreviewConfig, PreviewSemanticName, ToolbarRenderInfoType } from './Preview'; @@ -208,7 +208,7 @@ const ImageInternal: CompoundedComponent = props => { <>
= props => { > = props => { {/* Preview Click Mask */} {cover !== false && canPreview && (
= props => { {...restProps} classNames={classNames?.popup} styles={styles?.popup} - rootClassName={classnames(previewRootClassName, rootClassName)} + rootClassName={clsx(previewRootClassName, rootClassName)} /> )} diff --git a/src/Preview/Footer.tsx b/src/Preview/Footer.tsx index de08f3e..d03cfe3 100644 --- a/src/Preview/Footer.tsx +++ b/src/Preview/Footer.tsx @@ -1,4 +1,4 @@ -import classnames from 'classnames'; +import { clsx } from 'clsx'; import * as React from 'react'; import type { Actions, PreviewProps } from '.'; import type { ImgInfo } from '../Image'; @@ -97,7 +97,7 @@ export default function Footer(props: FooterProps) { return (
+
{flipYNode} {flipXNode} {rotateLeftNode} @@ -176,7 +176,7 @@ export default function Footer(props: FooterProps) { // >>>>> Render return ( -
+
{progressNode} {actionsRender ? actionsRender(actionsNode, { diff --git a/src/Preview/PrevNext.tsx b/src/Preview/PrevNext.tsx index adaad51..049e721 100644 --- a/src/Preview/PrevNext.tsx +++ b/src/Preview/PrevNext.tsx @@ -1,4 +1,4 @@ -import classNames from 'classnames'; +import { clsx } from 'clsx'; import * as React from 'react'; import type { OperationIcons } from '.'; @@ -24,7 +24,7 @@ export default function PrevNext(props: PrevNextProps) { return ( <>
onActive(-1)} @@ -32,7 +32,7 @@ export default function PrevNext(props: PrevNextProps) { {prev ?? left}
onActive(1)} diff --git a/src/Preview/index.tsx b/src/Preview/index.tsx index 02d2252..2aab1c8 100644 --- a/src/Preview/index.tsx +++ b/src/Preview/index.tsx @@ -3,7 +3,7 @@ import Portal, { type PortalProps } from '@rc-component/portal'; import { useEvent } from '@rc-component/util'; import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import KeyCode from '@rc-component/util/lib/KeyCode'; -import classnames from 'classnames'; +import { clsx } from 'clsx'; import React, { useContext, useEffect, useRef, useState } from 'react'; import { PreviewGroupContext } from '../context'; import type { TransformAction, TransformType } from '../hooks/useImageTransform'; @@ -410,27 +410,23 @@ const Preview: React.FC = props => { return (
{/* Mask */}
{/* Body */} -
+
{/* Preview Image */} {imageRender - ? imageRender(imgNode, { - transform, - image, - ...(groupContext ? { current } : {}), - }) + ? imageRender(imgNode, { transform, image, ...(groupContext ? { current } : {}) }) : imgNode}