Skip to content

Commit a2fc794

Browse files
committed
chore: migrate to @rc-component and clsx
1 parent 539aad1 commit a2fc794

File tree

8 files changed

+18
-19
lines changed

8 files changed

+18
-19
lines changed

examples/fill-width.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import useLayoutEffect from "rc-util/lib/hooks/useLayoutEffect";
2+
import useLayoutEffect from "@rc-component/util/lib/hooks/useLayoutEffect";
33
import Overflow from '../src';
44
import '../assets/index.less';
55
import './common.less';

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@
4545
},
4646
"dependencies": {
4747
"@babel/runtime": "^7.11.1",
48-
"classnames": "^2.2.1",
49-
"rc-resize-observer": "^1.0.0",
50-
"rc-util": "^5.37.0"
48+
"@rc-component/resize-observer": "^1.0.1",
49+
"@rc-component/util": "^1.4.0",
50+
"clsx": "^2.1.1"
5151
},
5252
"devDependencies": {
5353
"@rc-component/father-plugin": "^1.0.0",
5454
"@testing-library/jest-dom": "^5.16.4",
5555
"@testing-library/react": "^12.0.0",
56-
"@types/classnames": "^2.2.9",
5756
"@types/enzyme": "^3.10.8",
5857
"@types/jest": "^26.0.23",
5958
"@types/node": "^24.8.1",
@@ -94,4 +93,4 @@
9493
"tnpm": {
9594
"mode": "npm"
9695
}
97-
}
96+
}

src/Item.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
2-
import classNames from 'classnames';
3-
import ResizeObserver from 'rc-resize-observer';
2+
import { clsx } from 'clsx';
3+
import ResizeObserver from '@rc-component/resize-observer';
44
import type { ComponentType } from './RawItem';
55

66
// Use shared variable to save bundle size
@@ -89,7 +89,7 @@ function InternalItem<ItemType>(
8989

9090
let itemNode = (
9191
<Component
92-
className={classNames(!invalidate && prefixCls, className)}
92+
className={clsx(!invalidate && prefixCls, className)}
9393
style={{
9494
...overflowStyle,
9595
...style,

src/Overflow.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from 'react';
22
import { useState, useMemo, useCallback } from 'react';
3-
import classNames from 'classnames';
4-
import ResizeObserver from 'rc-resize-observer';
5-
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
3+
import { clsx } from 'clsx';
4+
import ResizeObserver from '@rc-component/resize-observer';
5+
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
66
import Item from './Item';
77
import useEffectState, { useBatcher } from './hooks/useEffectState';
88
import type { ComponentType } from './RawItem';
@@ -394,7 +394,7 @@ function Overflow<ItemType = any>(
394394

395395
const overflowNode = (
396396
<Component
397-
className={classNames(!invalidate && prefixCls, className)}
397+
className={clsx(!invalidate && prefixCls, className)}
398398
style={style}
399399
ref={ref}
400400
{...restProps}

src/RawItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import classNames from 'classnames';
2+
import { clsx } from 'clsx';
33
import Item from './Item';
44
import { OverflowContext } from './context';
55

@@ -31,7 +31,7 @@ const InternalRawItem = (props: RawItemProps, ref: React.Ref<any>) => {
3131
<OverflowContext.Provider value={null}>
3232
<Item
3333
ref={ref}
34-
className={classNames(contextClassName, className)}
34+
className={clsx(contextClassName, className)}
3535
{...restContext}
3636
{...restProps}
3737
/>

src/hooks/channelUpdate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import raf from 'rc-util/lib/raf';
1+
import raf from '@rc-component/util/lib/raf';
22

33
export default function channelUpdate(callback: VoidFunction) {
44
if (typeof MessageChannel === 'undefined') {

src/hooks/useEffectState.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import useEvent from 'rc-util/lib/hooks/useEvent';
1+
import useEvent from '@rc-component/util/lib/hooks/useEvent';
22
import * as React from 'react';
33
import { unstable_batchedUpdates } from 'react-dom';
44
import channelUpdate from './channelUpdate';

tests/github.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import { render, act } from '@testing-library/react';
3-
import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
3+
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
44
import Overflow from '../src';
55

6-
import { _rs as onResize } from 'rc-resize-observer/lib/utils/observerUtil';
6+
import { _rs as onResize } from '@rc-component/resize-observer/lib/utils/observerUtil';
77

88
interface ItemType {
99
label: React.ReactNode;

0 commit comments

Comments
 (0)