From 28f97f56e05e17baf8f362d15ee89a44f312a5a7 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Sun, 28 Sep 2025 12:59:44 +0800 Subject: [PATCH] perf: uninstall classnames, install clsx --- .gitignore | 1 + package.json | 12 ++++++------ src/Circle/PtgCircle.tsx | 7 +++---- src/Circle/index.tsx | 13 +++++-------- src/Line.tsx | 4 ++-- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index ee90fed..005f482 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ es coverage/ yarn.lock package-lock.json +pnpm-lock.yaml .storybook .doc diff --git a/package.json b/package.json index b9bccb5..7be4aad 100644 --- a/package.json +++ b/package.json @@ -39,21 +39,17 @@ "coverage": "father test --coverage", "now-build": "npm run docs:build" }, - "peerDependencies": { - "react": ">=16.9.0", - "react-dom": ">=16.9.0" - }, "dependencies": { "@rc-component/util": "^1.2.1", - "classnames": "^2.2.6" + "clsx": "^2.1.1" }, "devDependencies": { "@rc-component/father-plugin": "^2.0.4", "@rc-component/np": "^1.0.4", "@testing-library/react": "^13.0.0", - "@types/classnames": "^2.2.9", "@types/jest": "^29.4.0", "@types/keyv": "3.1.4", + "@types/node": "^24.5.2", "@types/react": "^18.0.9", "@types/react-dom": "^18.0.3", "@umijs/fabric": "^3.0.0", @@ -69,5 +65,9 @@ "react": "^18.0.0", "react-dom": "^18.0.0", "typescript": "^5.0.0" + }, + "peerDependencies": { + "react": ">=16.9.0", + "react-dom": ">=16.9.0" } } diff --git a/src/Circle/PtgCircle.tsx b/src/Circle/PtgCircle.tsx index 9b755b2..5e738b8 100644 --- a/src/Circle/PtgCircle.tsx +++ b/src/Circle/PtgCircle.tsx @@ -1,14 +1,13 @@ import * as React from 'react'; import type { ProgressProps } from '..'; import type { StrokeColorObject } from '../interface'; -import classNames from 'classnames'; +import { clsx } from 'clsx'; interface BlockProps { bg: string; - children?: React.ReactNode; } -const Block: React.FC = ({ bg, children }) => ( +const Block: React.FC> = ({ bg, children }) => (
{children}
); @@ -59,7 +58,7 @@ const PtgCircle = React.forwardRef((props, const circleNode = ( = (props) => { return ( = (props) => { return ( = (props) => { > {!stepCount && ( )} {stepCount ? getStepStokeList() : getStokeList()} diff --git a/src/Line.tsx b/src/Line.tsx index 5041da8..1ee3f39 100644 --- a/src/Line.tsx +++ b/src/Line.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import classNames from 'classnames'; +import { clsx } from 'clsx'; import { useTransitionDuration, defaultProps } from './common'; import type { ProgressProps } from './interface'; import getIndeterminateLine from './utils/getIndeterminateLine'; @@ -50,7 +50,7 @@ const Line: React.FC = (props) => { return (