Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@
"@rc-component/motion": "^1.1.4",
"@rc-component/portal": "^2.0.0",
"@rc-component/util": "^1.2.1",
"classnames": "^2.2.6"
"clsx": "^2.1.1"
},
"devDependencies": {
"@ant-design/icons": "^5.3.0",
"@rc-component/father-plugin": "^2.0.2",
"@rc-component/np": "^1.0.0",
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^16.3.0",
"@types/classnames": "^2.2.9",
"@types/jest": "^29.5.11",
"@types/node": "^24.3.0",
"@types/raf": "^3.4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/DrawerPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import classNames from 'classnames';
import { clsx } from 'clsx';
import * as React from 'react';
import { RefContext } from './context';
import pickAttrs from '@rc-component/util/lib/pickAttrs';
Expand Down Expand Up @@ -43,7 +43,7 @@ const DrawerPanel: React.FC<Readonly<DrawerPanelProps>> = props => {

return (
<div
className={classNames(`${prefixCls}-section`, className)}
className={clsx(`${prefixCls}-section`, className)}
role="dialog"
ref={mergedRef}
{...pickAttrs(props, { aria: true })}
Expand Down
38 changes: 11 additions & 27 deletions src/DrawerPopup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import classNames from 'classnames';
import { clsx } from 'clsx';
import type { CSSMotionProps } from '@rc-component/motion';
import CSSMotion from '@rc-component/motion';
import KeyCode from '@rc-component/util/lib/KeyCode';
Expand Down Expand Up @@ -248,17 +248,13 @@ const DrawerPopup: React.ForwardRefRenderFunction<
maskRef,
) => (
<div
className={classNames(
className={clsx(
`${prefixCls}-mask`,
motionMaskClassName,
drawerClassNames?.mask,
maskClassName,
)}
style={{
...motionMaskStyle,
...maskStyle,
...styles?.mask,
}}
style={{ ...motionMaskStyle, ...maskStyle, ...styles?.mask }}
onClick={maskClosable && open ? onClose : undefined}
ref={maskRef}
/>
Expand Down Expand Up @@ -372,11 +368,8 @@ const DrawerPopup: React.ForwardRefRenderFunction<
id={id}
containerRef={motionRef}
prefixCls={prefixCls}
className={classNames(className, drawerClassNames?.section)}
style={{
...style,
...styles?.section,
}}
className={clsx(className, drawerClassNames?.section)}
style={{ ...style, ...styles?.section }}
{...pickAttrs(props, { aria: true })}
{...eventHandlers}
>
Expand All @@ -386,17 +379,13 @@ const DrawerPopup: React.ForwardRefRenderFunction<
return (
<div
ref={wrapperRef}
className={classNames(
className={clsx(
`${prefixCls}-content-wrapper`,
isDragging && `${prefixCls}-content-wrapper-dragging`,
drawerClassNames?.wrapper,
!isDragging && motionClassName,
)}
style={{
...motionStyle,
...wrapperStyle,
...styles?.wrapper,
}}
style={{ ...motionStyle, ...wrapperStyle, ...styles?.wrapper }}
{...pickAttrs(props, { data: true })}
>
{isResizable && <div {...dragElementProps} />}
Expand All @@ -419,15 +408,10 @@ const DrawerPopup: React.ForwardRefRenderFunction<
return (
<DrawerContext.Provider value={mergedContext}>
<div
className={classNames(
prefixCls,
`${prefixCls}-${placement}`,
rootClassName,
{
[`${prefixCls}-open`]: open,
[`${prefixCls}-inline`]: inline,
},
)}
className={clsx(prefixCls, `${prefixCls}-${placement}`, rootClassName, {
[`${prefixCls}-open`]: open,
[`${prefixCls}-inline`]: inline,
})}
style={containerStyle}
tabIndex={-1}
ref={panelRef}
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useDrag.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import classNames from 'classnames';
import { clsx } from 'clsx';
import type { Placement } from '../Drawer';
import { useEvent } from '@rc-component/util';

Expand Down Expand Up @@ -120,7 +120,7 @@ export default function useDrag(options: UseDragOptions): UseDragReturn {
}
}, [isDragging, handleMouseMove, handleMouseUp]);

const dragElementClassName = classNames(
const dragElementClassName = clsx(
`${prefixCls}-dragger`,
`${prefixCls}-dragger-${direction}`,
{
Expand Down