Skip to content

Commit 5ded564

Browse files
committed
chore: merge master
2 parents a3279ff + 401b183 commit 5ded564

7 files changed

Lines changed: 69 additions & 37 deletions

File tree

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
# rc-dialog
1+
# @rc-component/dialog
22

3-
react dialog component
3+
react dialog component.
44

5-
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url]
5+
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]
66

7-
[npm-image]: http://img.shields.io/npm/v/rc-dialog.svg?style=flat-square
8-
[npm-url]: http://npmjs.org/package/rc-dialog
9-
[github-actions-image]: https://github.com/react-component/dialog/workflows/CI/badge.svg
10-
[github-actions-url]: https://github.com/react-component/dialog/actions
11-
[circleci-image]: https://img.shields.io/circleci/react-component/dialog/master?style=flat-square
12-
[circleci-url]: https://circleci.com/gh/react-component/dialog
7+
[npm-image]: https://img.shields.io/npm/v/@rc-component/dialog.svg?style=flat-square
8+
[npm-url]: https://npmjs.org/package/@rc-component/dialog
9+
[travis-image]: https://img.shields.io/travis/react-component/dialog/master?style=flat-square
10+
[travis-url]: https://travis-ci.com/react-component/dialog
11+
[github-actions-image]: https://github.com/react-component/dialog/actions/workflows/react-component-ci.yml/badge.svg
12+
[github-actions-url]: https://github.com/react-component/dialog/actions/workflows/react-component-ci.yml
1313
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dialog/master.svg?style=flat-square
1414
[codecov-url]: https://app.codecov.io/gh/react-component/dialog
15-
[download-image]: https://img.shields.io/npm/dm/rc-dialog.svg?style=flat-square
16-
[download-url]: https://npmjs.org/package/rc-dialog
17-
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-dialog
18-
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-dialog
15+
[david-url]: https://david-dm.org/react-component/dialog
16+
[david-image]: https://david-dm.org/react-component/dialog/status.svg?style=flat-square
17+
[david-dev-url]: https://david-dm.org/react-component/dialog?type=dev
18+
[david-dev-image]: https://david-dm.org/react-component/dialog/dev-status.svg?style=flat-square
19+
[download-image]: https://img.shields.io/npm/dm/@rc-component/dialog.svg?style=flat-square
20+
[download-url]: https://npmjs.org/package/@rc-component/dialog
21+
[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dialog
22+
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/dialog
23+
[dumi-url]: https://github.com/umijs/dumi
24+
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
25+
1926

2027
## Screenshot
2128

@@ -29,12 +36,12 @@ online example: https://dialog.react-component.vercel.app/
2936

3037
## Install
3138

32-
[![rc-dialog](https://nodei.co/npm/rc-dialog.png)](https://npmjs.org/package/rc-dialog)
39+
[![@rc-component/dialog](https://nodei.co/npm/@rc-component/dialog.png)](https://npmjs.org/package/@rc-component/dialog)
3340

3441
## Usage
3542

3643
```js
37-
var Dialog = require('rc-dialog');
44+
var Dialog = require('@rc-component/dialog');
3845

3946
ReactDOM.render(
4047
<Dialog title={title} onClose={callback1} visible>
@@ -47,7 +54,7 @@ ReactDOM.render(
4754

4855
## API
4956

50-
### rc-dialog
57+
### @rc-component/dialog
5158

5259
| Name | Type | Default | Description | Version |
5360
| --- | --- | --- | --- | --- |
@@ -102,7 +109,7 @@ open coverage/ dir
102109

103110
## License
104111

105-
rc-dialog is released under the MIT license.
112+
@rc-component/dialog is released under the MIT license.
106113

107114

108115
## 🤝 Contributing

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rc-component/dialog",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "dialog ui component for react",
55
"keywords": [
66
"react",
@@ -53,7 +53,7 @@
5353
"@rc-component/motion": "^1.1.3",
5454
"@rc-component/portal": "^2.0.0",
5555
"@rc-component/util": "^1.5.0",
56-
"classnames": "^2.2.6"
56+
"clsx": "^2.1.1"
5757
},
5858
"devDependencies": {
5959
"@rc-component/drawer": "^1.0.0",
@@ -62,18 +62,15 @@
6262
"@rc-component/select": "^1.0.0",
6363
"@testing-library/jest-dom": "^6.1.6",
6464
"@testing-library/react": "^16.3.0",
65-
"@types/jest": "^29.4.0",
65+
"@types/jest": "^30.0.0",
6666
"@types/keyv": "3.1.4",
6767
"@types/node": "^24.0.8",
6868
"@types/react": "^19.1.4",
6969
"@types/react-dom": "^19.1.5",
7070
"@umijs/fabric": "^3.0.0",
7171
"bootstrap": "^5.3.7",
72-
"cross-env": "^7.0.0",
7372
"dumi": "^2.1.3",
7473
"eslint": "^7.1.0",
75-
"eslint-config-airbnb": "^19.0.4",
76-
"eslint-plugin-react": "^7.20.6",
7774
"father": "^4.1.5",
7875
"gh-pages": "^6.1.1",
7976
"glob": "^11.0.0",

src/Dialog/Content/Panel.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import classNames from 'classnames';
1+
import { clsx } from 'clsx';
22
import { useComposeRef } from '@rc-component/util/lib/ref';
33
import { useLockFocus } from '@rc-component/util/lib/Dom/focus';
44
import React, { useMemo, useRef } from 'react';
@@ -70,7 +70,7 @@ const Panel = React.forwardRef<PanelRef, PanelProps>((props, ref) => {
7070
// ================================ Render ================================
7171
const footerNode = footer ? (
7272
<div
73-
className={classNames(`${prefixCls}-footer`, modalClassNames?.footer)}
73+
className={clsx(`${prefixCls}-footer`, modalClassNames?.footer)}
7474
style={{ ...modalStyles?.footer }}
7575
>
7676
{footer}
@@ -79,11 +79,11 @@ const Panel = React.forwardRef<PanelRef, PanelProps>((props, ref) => {
7979

8080
const headerNode = title ? (
8181
<div
82-
className={classNames(`${prefixCls}-header`, modalClassNames?.header)}
82+
className={clsx(`${prefixCls}-header`, modalClassNames?.header)}
8383
style={{ ...modalStyles?.header }}
8484
>
8585
<div
86-
className={classNames(`${prefixCls}-title`, modalClassNames?.title)}
86+
className={clsx(`${prefixCls}-title`, modalClassNames?.title)}
8787
id={ariaId}
8888
style={{ ...modalStyles?.title }}
8989
>
@@ -120,13 +120,13 @@ const Panel = React.forwardRef<PanelRef, PanelProps>((props, ref) => {
120120

121121
const content = (
122122
<div
123-
className={classNames(`${prefixCls}-container`, modalClassNames?.container)}
123+
className={clsx(`${prefixCls}-container`, modalClassNames?.container)}
124124
style={modalStyles?.container}
125125
>
126126
{closerNode}
127127
{headerNode}
128128
<div
129-
className={classNames(`${prefixCls}-body`, modalClassNames?.body)}
129+
className={clsx(`${prefixCls}-body`, modalClassNames?.body)}
130130
style={{ ...bodyStyle, ...modalStyles?.body }}
131131
{...bodyProps}
132132
>
@@ -144,7 +144,7 @@ const Panel = React.forwardRef<PanelRef, PanelProps>((props, ref) => {
144144
aria-modal="true"
145145
ref={mergedRef}
146146
style={{ ...style, ...contentStyle }}
147-
className={classNames(prefixCls, className)}
147+
className={clsx(prefixCls, className)}
148148
onMouseDown={onMouseDown}
149149
onMouseUp={onMouseUp}
150150
tabIndex={-1}

src/Dialog/Content/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { useRef } from 'react';
3-
import classNames from 'classnames';
3+
import { clsx } from 'clsx';
44
import CSSMotion from '@rc-component/motion';
55
import { offset } from '../../util';
66
import type { PanelProps, PanelRef } from './Panel';
@@ -82,7 +82,7 @@ const Content = React.forwardRef<ContentRef, ContentProps>((props, ref) => {
8282
prefixCls={prefixCls}
8383
holderRef={motionRef}
8484
style={{ ...motionStyle, ...style, ...contentStyle }}
85-
className={classNames(className, motionClassName)}
85+
className={clsx(className, motionClassName)}
8686
/>
8787
)}
8888
</CSSMotion>

src/Dialog/Mask.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 CSSMotion from '@rc-component/motion';
44

55
export type MaskProps = {
@@ -24,7 +24,7 @@ const Mask: React.FC<MaskProps> = (props) => {
2424
<div
2525
ref={ref}
2626
style={{ ...motionStyle, ...style }}
27-
className={classNames(`${prefixCls}-mask`, motionClassName, className)}
27+
className={clsx(`${prefixCls}-mask`, motionClassName, className)}
2828
{...maskProps}
2929
/>
3030
)}

src/Dialog/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import classNames from 'classnames';
1+
import { clsx } from 'clsx';
22
import contains from '@rc-component/util/lib/Dom/contains';
33
import useId from '@rc-component/util/lib/hooks/useId';
44
import KeyCode from '@rc-component/util/lib/KeyCode';
@@ -181,7 +181,7 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
181181
// ========================= Render =========================
182182
return (
183183
<div
184-
className={classNames(`${prefixCls}-root`, rootClassName)}
184+
className={clsx(`${prefixCls}-root`, rootClassName)}
185185
style={rootStyle}
186186
{...pickAttrs(props, { data: true })}
187187
>
@@ -195,7 +195,7 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
195195
/>
196196
<div
197197
onKeyDown={onWrapperKeyDown}
198-
className={classNames(`${prefixCls}-wrap`, wrapClassName, modalClassNames?.wrapper)}
198+
className={clsx(`${prefixCls}-wrap`, wrapClassName, modalClassNames?.wrapper)}
199199
ref={wrapperRef}
200200
onClick={onWrapperClick}
201201
style={mergedStyle}

tests/setup.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,31 @@ console.error = (...args) => {
2424

2525
originError(...args);
2626
};
27+
28+
window.MessageChannel = class {
29+
port1;
30+
port2;
31+
constructor() {
32+
const createPort = () => {
33+
const port = {
34+
onmessage: null,
35+
postMessage: (message) => {
36+
setTimeout(() => {
37+
if (port._target && typeof port._target.onmessage === 'function') {
38+
port._target.onmessage({ data: message });
39+
}
40+
}, 0);
41+
},
42+
_target: null,
43+
};
44+
return port;
45+
};
46+
47+
const port1 = createPort();
48+
const port2 = createPort();
49+
port1._target = port2;
50+
port2._target = port1;
51+
this.port1 = port1;
52+
this.port2 = port2;
53+
}
54+
}

0 commit comments

Comments
 (0)