@rc-component/dialog 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,7 +64,7 @@ ReactDOM.render(
64
64
  | maskTransitionName | String | | mask animation css class name | |
65
65
  | title | String\|React.Element | | Title of the dialog | |
66
66
  | footer | React.Element | | footer of the dialog | |
67
- | closable | Boolean \| ({ closeIcon?: React.ReactNode; disabled?: boolean } & React.AriaAttributes | true | whether show close button | |
67
+ | closable | Boolean \| ({ closeIcon?: React.ReactNode; disabled?: boolean, afterClose:function } & React.AriaAttributes) | true | whether show close button | |
68
68
  | mask | Boolean | true | whether show mask | |
69
69
  | maskClosable | Boolean | true | whether click mask to close | |
70
70
  | keyboard | Boolean | true | whether support press esc to close | |
@@ -103,3 +103,10 @@ open coverage/ dir
103
103
  ## License
104
104
 
105
105
  rc-dialog is released under the MIT license.
106
+
107
+
108
+ ## 🤝 Contributing
109
+
110
+ <a href="https://openomy.app/github/react-component/dialog" target="_blank" style="display: block; width: 100%;" align="center">
111
+ <img src="https://www.openomy.app/svg?repo=react-component/dialog&chart=bubble&latestMonth=24" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
112
+ </a>
@@ -14,7 +14,7 @@
14
14
  -webkit-overflow-scrolling: touch;
15
15
  outline: 0;
16
16
  }
17
- .rc-dialog-section {
17
+ .rc-dialog-container {
18
18
  position: relative;
19
19
  background-color: #fff;
20
20
  border: 1px solid #999;
@@ -80,7 +80,7 @@
80
80
  width: 600px;
81
81
  margin: 30px auto;
82
82
  }
83
- .rc-dialog-section {
83
+ .rc-dialog-container {
84
84
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
85
85
  }
86
86
  }
package/assets/index.css CHANGED
@@ -20,7 +20,7 @@
20
20
  line-height: 21px;
21
21
  font-weight: bold;
22
22
  }
23
- .rc-dialog-section {
23
+ .rc-dialog-container {
24
24
  position: relative;
25
25
  background-color: #ffffff;
26
26
  border: none;
@@ -120,8 +120,8 @@ const Panel = /*#__PURE__*/React.forwardRef((props, ref) => {
120
120
  disabled: closeBtnIsDisabled
121
121
  }), closableObj.closeIcon) : null;
122
122
  const content = /*#__PURE__*/React.createElement("div", {
123
- className: classNames(`${prefixCls}-section`, modalClassNames?.section),
124
- style: modalStyles?.section
123
+ className: classNames(`${prefixCls}-container`, modalClassNames?.container),
124
+ style: modalStyles?.container
125
125
  }, closerNode, headerNode, /*#__PURE__*/React.createElement("div", _extends({
126
126
  className: classNames(`${prefixCls}-body`, modalClassNames?.body),
127
127
  style: {
package/es/DialogWrap.js CHANGED
@@ -19,6 +19,7 @@ const DialogWrap = props => {
19
19
  forceRender,
20
20
  destroyOnHidden = false,
21
21
  afterClose,
22
+ closable,
22
23
  panelRef
23
24
  } = props;
24
25
  const [animatedVisible, setAnimatedVisible] = React.useState(visible);
@@ -45,6 +46,11 @@ const DialogWrap = props => {
45
46
  }, /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {
46
47
  destroyOnHidden: destroyOnHidden,
47
48
  afterClose: () => {
49
+ const closableObj = closable && typeof closable === 'object' ? closable : {};
50
+ const {
51
+ afterClose: closableAfterClose
52
+ } = closableObj || {};
53
+ closableAfterClose?.();
48
54
  afterClose?.();
49
55
  setAnimatedVisible(false);
50
56
  }
@@ -1,8 +1,13 @@
1
1
  import type { GetContainer } from '@rc-component/util/lib/PortalWrapper';
2
2
  import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
3
- export type SemanticName = 'header' | 'body' | 'footer' | 'section' | 'title' | 'wrapper' | 'mask';
3
+ export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask';
4
4
  export type ModalClassNames = Partial<Record<SemanticName, string>>;
5
5
  export type ModalStyles = Partial<Record<SemanticName, CSSProperties>>;
6
+ export type ClosableType = {
7
+ closeIcon?: React.ReactNode;
8
+ disabled?: boolean;
9
+ afterClose?: () => any;
10
+ };
6
11
  export type IDialogPropTypes = {
7
12
  className?: string;
8
13
  keyboard?: boolean;
@@ -13,10 +18,7 @@ export type IDialogPropTypes = {
13
18
  afterClose?: () => any;
14
19
  afterOpenChange?: (open: boolean) => void;
15
20
  onClose?: (e: SyntheticEvent) => any;
16
- closable?: boolean | ({
17
- closeIcon?: React.ReactNode;
18
- disabled?: boolean;
19
- } & React.AriaAttributes);
21
+ closable?: boolean | (ClosableType & React.AriaAttributes);
20
22
  maskClosable?: boolean;
21
23
  visible?: boolean;
22
24
  destroyOnHidden?: boolean;
@@ -129,8 +129,8 @@ const Panel = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
129
129
  disabled: closeBtnIsDisabled
130
130
  }), closableObj.closeIcon) : null;
131
131
  const content = /*#__PURE__*/_react.default.createElement("div", {
132
- className: (0, _classnames.default)(`${prefixCls}-section`, modalClassNames?.section),
133
- style: modalStyles?.section
132
+ className: (0, _classnames.default)(`${prefixCls}-container`, modalClassNames?.container),
133
+ style: modalStyles?.container
134
134
  }, closerNode, headerNode, /*#__PURE__*/_react.default.createElement("div", _extends({
135
135
  className: (0, _classnames.default)(`${prefixCls}-body`, modalClassNames?.body),
136
136
  style: {
package/lib/DialogWrap.js CHANGED
@@ -28,6 +28,7 @@ const DialogWrap = props => {
28
28
  forceRender,
29
29
  destroyOnHidden = false,
30
30
  afterClose,
31
+ closable,
31
32
  panelRef
32
33
  } = props;
33
34
  const [animatedVisible, setAnimatedVisible] = React.useState(visible);
@@ -54,6 +55,11 @@ const DialogWrap = props => {
54
55
  }, /*#__PURE__*/React.createElement(_Dialog.default, _extends({}, props, {
55
56
  destroyOnHidden: destroyOnHidden,
56
57
  afterClose: () => {
58
+ const closableObj = closable && typeof closable === 'object' ? closable : {};
59
+ const {
60
+ afterClose: closableAfterClose
61
+ } = closableObj || {};
62
+ closableAfterClose?.();
57
63
  afterClose?.();
58
64
  setAnimatedVisible(false);
59
65
  }
@@ -1,8 +1,13 @@
1
1
  import type { GetContainer } from '@rc-component/util/lib/PortalWrapper';
2
2
  import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
3
- export type SemanticName = 'header' | 'body' | 'footer' | 'section' | 'title' | 'wrapper' | 'mask';
3
+ export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask';
4
4
  export type ModalClassNames = Partial<Record<SemanticName, string>>;
5
5
  export type ModalStyles = Partial<Record<SemanticName, CSSProperties>>;
6
+ export type ClosableType = {
7
+ closeIcon?: React.ReactNode;
8
+ disabled?: boolean;
9
+ afterClose?: () => any;
10
+ };
6
11
  export type IDialogPropTypes = {
7
12
  className?: string;
8
13
  keyboard?: boolean;
@@ -13,10 +18,7 @@ export type IDialogPropTypes = {
13
18
  afterClose?: () => any;
14
19
  afterOpenChange?: (open: boolean) => void;
15
20
  onClose?: (e: SyntheticEvent) => any;
16
- closable?: boolean | ({
17
- closeIcon?: React.ReactNode;
18
- disabled?: boolean;
19
- } & React.AriaAttributes);
21
+ closable?: boolean | (ClosableType & React.AriaAttributes);
20
22
  maskClosable?: boolean;
21
23
  visible?: boolean;
22
24
  destroyOnHidden?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/dialog",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "dialog ui component for react",
5
5
  "keywords": [
6
6
  "react",
@@ -61,15 +61,14 @@
61
61
  "@rc-component/np": "^1.0.3",
62
62
  "@rc-component/select": "^1.0.0",
63
63
  "@testing-library/jest-dom": "^6.1.6",
64
- "@testing-library/react": "^13.0.0",
64
+ "@testing-library/react": "^16.3.0",
65
65
  "@types/jest": "^29.4.0",
66
66
  "@types/keyv": "3.1.4",
67
- "@types/node": "^22.15.18",
67
+ "@types/node": "^24.0.8",
68
68
  "@types/react": "^19.1.4",
69
69
  "@types/react-dom": "^19.1.5",
70
70
  "@umijs/fabric": "^3.0.0",
71
- "bootstrap": "^4.3.1",
72
- "cheerio": "1.0.0-rc.12",
71
+ "bootstrap": "^5.3.7",
73
72
  "cross-env": "^7.0.0",
74
73
  "dumi": "^2.1.3",
75
74
  "eslint": "^7.1.0",
@@ -80,7 +79,7 @@
80
79
  "glob": "^11.0.0",
81
80
  "husky": "^9.1.6",
82
81
  "less": "^4.1.3",
83
- "lint-staged": "^15.2.0",
82
+ "lint-staged": "^16.1.2",
84
83
  "prettier": "^3.2.1",
85
84
  "rc-test": "^7.0.14",
86
85
  "react": "^18.0.0",