Skip to content

Commit 195463e

Browse files
authored
perf: uninstall classnames, install clsx (#720)
1 parent 72c6e46 commit 195463e

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@
4646
]
4747
},
4848
"dependencies": {
49-
"@rc-component/mini-decimal": "^1.0.1",
50-
"classnames": "^2.2.5",
5149
"@rc-component/input": "~1.0.0",
52-
"@rc-component/util": "^1.2.0"
50+
"@rc-component/mini-decimal": "^1.0.1",
51+
"@rc-component/util": "^1.2.0",
52+
"clsx": "^2.1.1"
5353
},
5454
"devDependencies": {
5555
"@rc-component/father-plugin": "^2.0.2",
5656
"@rc-component/np": "^1.0.3",
5757
"@swc-node/jest": "^1.5.5",
5858
"@testing-library/jest-dom": "^6.1.5",
5959
"@testing-library/react": "^16.0.0",
60-
"@types/classnames": "^2.2.9",
6160
"@types/jest": "^29.2.4",
61+
"@types/node": "^24.5.2",
6262
"@types/react": "^18.0.26",
6363
"@types/react-dom": "^18.0.9",
6464
"@types/responselike": "^1.0.0",

src/InputNumber.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import getMiniDecimal, {
66
validateNumber,
77
ValueType,
88
} from '@rc-component/mini-decimal';
9-
import clsx from 'classnames';
9+
import { clsx } from 'clsx';
1010
import { BaseInput } from '@rc-component/input';
1111
import { useLayoutUpdateEffect } from '@rc-component/util/lib/hooks/useLayoutEffect';
1212
import proxyObject from '@rc-component/util/lib/proxyObject';

src/StepHandler.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable react/no-unknown-property */
22
import * as React from 'react';
3-
import cls from 'classnames';
3+
import { clsx } from 'clsx';
44
import raf from '@rc-component/util/lib/raf';
55
import SemanticContext from './SemanticContext';
66

@@ -22,6 +22,7 @@ export interface StepHandlerProps {
2222
downDisabled?: boolean;
2323
onStep: (up: boolean, emitter: 'handler' | 'keyboard' | 'wheel') => void;
2424
}
25+
2526
export default function StepHandler({
2627
prefixCls,
2728
upNode,
@@ -64,18 +65,20 @@ export default function StepHandler({
6465
React.useEffect(
6566
() => () => {
6667
onStopStep();
67-
frameIds.current.forEach((id) => raf.cancel(id));
68+
frameIds.current.forEach((id) => {
69+
raf.cancel(id);
70+
});
6871
},
6972
[],
7073
);
7174

7275
// ======================= Render =======================
7376
const handlerClassName = `${prefixCls}-handler`;
7477

75-
const upClassName = cls(handlerClassName, `${handlerClassName}-up`, {
78+
const upClassName = clsx(handlerClassName, `${handlerClassName}-up`, {
7679
[`${handlerClassName}-up-disabled`]: upDisabled,
7780
});
78-
const downClassName = cls(handlerClassName, `${handlerClassName}-down`, {
81+
const downClassName = clsx(handlerClassName, `${handlerClassName}-down`, {
7982
[`${handlerClassName}-down-disabled`]: downDisabled,
8083
});
8184

@@ -94,7 +97,7 @@ export default function StepHandler({
9497
};
9598

9699
return (
97-
<div className={cls(`${handlerClassName}-wrap`, classNames?.actions)} style={styles?.actions}>
100+
<div className={clsx(`${handlerClassName}-wrap`, classNames?.actions)} style={styles?.actions}>
98101
<span
99102
{...sharedHandlerProps}
100103
onMouseDown={(e) => {

0 commit comments

Comments
 (0)