@rc-component/dialog 1.0.0 → 1.0.1

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.
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
- export default /*#__PURE__*/React.memo(function (_ref) {
3
- var children = _ref.children;
4
- return children;
5
- }, function (_, _ref2) {
6
- var shouldUpdate = _ref2.shouldUpdate;
7
- return !shouldUpdate;
8
- });
2
+ export default /*#__PURE__*/React.memo(({
3
+ children
4
+ }) => children, (_, {
5
+ shouldUpdate
6
+ }) => !shouldUpdate);
@@ -1,77 +1,76 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _typeof from "@babel/runtime/helpers/esm/typeof";
3
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
2
  import classNames from 'classnames';
5
- import { useComposeRef } from "rc-util/es/ref";
3
+ import { useComposeRef } from "@rc-component/util/es/ref";
6
4
  import React, { useMemo, useRef } from 'react';
7
5
  import { RefContext } from "../../context";
8
6
  import MemoChildren from "./MemoChildren";
9
- import pickAttrs from "rc-util/es/pickAttrs";
10
- var sentinelStyle = {
7
+ import pickAttrs from "@rc-component/util/es/pickAttrs";
8
+ const sentinelStyle = {
11
9
  width: 0,
12
10
  height: 0,
13
11
  overflow: 'hidden',
14
12
  outline: 'none'
15
13
  };
16
- var entityStyle = {
14
+ const entityStyle = {
17
15
  outline: 'none'
18
16
  };
19
- var Panel = /*#__PURE__*/React.forwardRef(function (props, ref) {
20
- var prefixCls = props.prefixCls,
21
- className = props.className,
22
- style = props.style,
23
- title = props.title,
24
- ariaId = props.ariaId,
25
- footer = props.footer,
26
- closable = props.closable,
27
- closeIcon = props.closeIcon,
28
- onClose = props.onClose,
29
- children = props.children,
30
- bodyStyle = props.bodyStyle,
31
- bodyProps = props.bodyProps,
32
- modalRender = props.modalRender,
33
- onMouseDown = props.onMouseDown,
34
- onMouseUp = props.onMouseUp,
35
- holderRef = props.holderRef,
36
- visible = props.visible,
37
- forceRender = props.forceRender,
38
- width = props.width,
39
- height = props.height,
40
- modalClassNames = props.classNames,
41
- modalStyles = props.styles;
17
+ const Panel = /*#__PURE__*/React.forwardRef((props, ref) => {
18
+ const {
19
+ prefixCls,
20
+ className,
21
+ style,
22
+ title,
23
+ ariaId,
24
+ footer,
25
+ closable,
26
+ closeIcon,
27
+ onClose,
28
+ children,
29
+ bodyStyle,
30
+ bodyProps,
31
+ modalRender,
32
+ onMouseDown,
33
+ onMouseUp,
34
+ holderRef,
35
+ visible,
36
+ forceRender,
37
+ width,
38
+ height,
39
+ classNames: modalClassNames,
40
+ styles: modalStyles
41
+ } = props;
42
42
 
43
43
  // ================================= Refs =================================
44
- var _React$useContext = React.useContext(RefContext),
45
- panelRef = _React$useContext.panel;
46
- var mergedRef = useComposeRef(holderRef, panelRef);
47
- var sentinelStartRef = useRef();
48
- var sentinelEndRef = useRef();
49
- React.useImperativeHandle(ref, function () {
50
- return {
51
- focus: function focus() {
52
- var _sentinelStartRef$cur;
53
- (_sentinelStartRef$cur = sentinelStartRef.current) === null || _sentinelStartRef$cur === void 0 || _sentinelStartRef$cur.focus({
44
+ const {
45
+ panel: panelRef
46
+ } = React.useContext(RefContext);
47
+ const mergedRef = useComposeRef(holderRef, panelRef);
48
+ const sentinelStartRef = useRef();
49
+ const sentinelEndRef = useRef();
50
+ React.useImperativeHandle(ref, () => ({
51
+ focus: () => {
52
+ sentinelStartRef.current?.focus({
53
+ preventScroll: true
54
+ });
55
+ },
56
+ changeActive: next => {
57
+ const {
58
+ activeElement
59
+ } = document;
60
+ if (next && activeElement === sentinelEndRef.current) {
61
+ sentinelStartRef.current.focus({
62
+ preventScroll: true
63
+ });
64
+ } else if (!next && activeElement === sentinelStartRef.current) {
65
+ sentinelEndRef.current.focus({
54
66
  preventScroll: true
55
67
  });
56
- },
57
- changeActive: function changeActive(next) {
58
- var _document = document,
59
- activeElement = _document.activeElement;
60
- if (next && activeElement === sentinelEndRef.current) {
61
- sentinelStartRef.current.focus({
62
- preventScroll: true
63
- });
64
- } else if (!next && activeElement === sentinelStartRef.current) {
65
- sentinelEndRef.current.focus({
66
- preventScroll: true
67
- });
68
- }
69
68
  }
70
- };
71
- });
69
+ }
70
+ }));
72
71
 
73
72
  // ================================ Style =================================
74
- var contentStyle = {};
73
+ const contentStyle = {};
75
74
  if (width !== undefined) {
76
75
  contentStyle.width = width;
77
76
  }
@@ -79,47 +78,56 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, ref) {
79
78
  contentStyle.height = height;
80
79
  }
81
80
  // ================================ Render ================================
82
- var footerNode = footer ? /*#__PURE__*/React.createElement("div", {
83
- className: classNames("".concat(prefixCls, "-footer"), modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.footer),
84
- style: _objectSpread({}, modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.footer)
81
+ const footerNode = footer ? /*#__PURE__*/React.createElement("div", {
82
+ className: classNames(`${prefixCls}-footer`, modalClassNames?.footer),
83
+ style: {
84
+ ...modalStyles?.footer
85
+ }
85
86
  }, footer) : null;
86
- var headerNode = title ? /*#__PURE__*/React.createElement("div", {
87
- className: classNames("".concat(prefixCls, "-header"), modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.header),
88
- style: _objectSpread({}, modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.header)
87
+ const headerNode = title ? /*#__PURE__*/React.createElement("div", {
88
+ className: classNames(`${prefixCls}-header`, modalClassNames?.header),
89
+ style: {
90
+ ...modalStyles?.header
91
+ }
89
92
  }, /*#__PURE__*/React.createElement("div", {
90
- className: classNames("".concat(prefixCls, "-title"), modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.title),
93
+ className: classNames(`${prefixCls}-title`, modalClassNames?.title),
91
94
  id: ariaId,
92
- style: _objectSpread({}, modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.title)
95
+ style: {
96
+ ...modalStyles?.title
97
+ }
93
98
  }, title)) : null;
94
- var closableObj = useMemo(function () {
95
- if (_typeof(closable) === 'object' && closable !== null) {
99
+ const closableObj = useMemo(() => {
100
+ if (typeof closable === 'object' && closable !== null) {
96
101
  return closable;
97
102
  }
98
103
  if (closable) {
99
104
  return {
100
- closeIcon: closeIcon !== null && closeIcon !== void 0 ? closeIcon : /*#__PURE__*/React.createElement("span", {
101
- className: "".concat(prefixCls, "-close-x")
105
+ closeIcon: closeIcon ?? /*#__PURE__*/React.createElement("span", {
106
+ className: `${prefixCls}-close-x`
102
107
  })
103
108
  };
104
109
  }
105
110
  return {};
106
111
  }, [closable, closeIcon, prefixCls]);
107
- var ariaProps = pickAttrs(closableObj, true);
108
- var closeBtnIsDisabled = _typeof(closable) === 'object' && closable.disabled;
109
- var closerNode = closable ? /*#__PURE__*/React.createElement("button", _extends({
112
+ const ariaProps = pickAttrs(closableObj, true);
113
+ const closeBtnIsDisabled = typeof closable === 'object' && closable.disabled;
114
+ const closerNode = closable ? /*#__PURE__*/React.createElement("button", _extends({
110
115
  type: "button",
111
116
  onClick: onClose,
112
117
  "aria-label": "Close"
113
118
  }, ariaProps, {
114
- className: "".concat(prefixCls, "-close"),
119
+ className: `${prefixCls}-close`,
115
120
  disabled: closeBtnIsDisabled
116
121
  }), closableObj.closeIcon) : null;
117
- var content = /*#__PURE__*/React.createElement("div", {
118
- className: classNames("".concat(prefixCls, "-section"), modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.section),
119
- style: modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.section
122
+ const content = /*#__PURE__*/React.createElement("div", {
123
+ className: classNames(`${prefixCls}-section`, modalClassNames?.section),
124
+ style: modalStyles?.section
120
125
  }, closerNode, headerNode, /*#__PURE__*/React.createElement("div", _extends({
121
- className: classNames("".concat(prefixCls, "-body"), modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.body),
122
- style: _objectSpread(_objectSpread({}, bodyStyle), modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.body)
126
+ className: classNames(`${prefixCls}-body`, modalClassNames?.body),
127
+ style: {
128
+ ...bodyStyle,
129
+ ...modalStyles?.body
130
+ }
123
131
  }, bodyProps), children), footerNode);
124
132
  return /*#__PURE__*/React.createElement("div", {
125
133
  key: "dialog-element",
@@ -127,7 +135,10 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, ref) {
127
135
  "aria-labelledby": title ? ariaId : null,
128
136
  "aria-modal": "true",
129
137
  ref: mergedRef,
130
- style: _objectSpread(_objectSpread({}, style), contentStyle),
138
+ style: {
139
+ ...style,
140
+ ...contentStyle
141
+ },
131
142
  className: classNames(prefixCls, className),
132
143
  onMouseDown: onMouseDown,
133
144
  onMouseUp: onMouseUp
@@ -1,38 +1,35 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
2
  import * as React from 'react';
5
3
  import { useRef } from 'react';
6
4
  import classNames from 'classnames';
7
5
  import CSSMotion from 'rc-motion';
8
6
  import { offset } from "../../util";
9
7
  import Panel from "./Panel";
10
- var Content = /*#__PURE__*/React.forwardRef(function (props, ref) {
11
- var prefixCls = props.prefixCls,
12
- title = props.title,
13
- style = props.style,
14
- className = props.className,
15
- visible = props.visible,
16
- forceRender = props.forceRender,
17
- destroyOnClose = props.destroyOnClose,
18
- motionName = props.motionName,
19
- ariaId = props.ariaId,
20
- onVisibleChanged = props.onVisibleChanged,
21
- mousePosition = props.mousePosition;
22
- var dialogRef = useRef();
8
+ const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
9
+ const {
10
+ prefixCls,
11
+ title,
12
+ style,
13
+ className,
14
+ visible,
15
+ forceRender,
16
+ destroyOnClose,
17
+ motionName,
18
+ ariaId,
19
+ onVisibleChanged,
20
+ mousePosition
21
+ } = props;
22
+ const dialogRef = useRef();
23
23
 
24
24
  // ============================= Style ==============================
25
- var _React$useState = React.useState(),
26
- _React$useState2 = _slicedToArray(_React$useState, 2),
27
- transformOrigin = _React$useState2[0],
28
- setTransformOrigin = _React$useState2[1];
29
- var contentStyle = {};
25
+ const [transformOrigin, setTransformOrigin] = React.useState();
26
+ const contentStyle = {};
30
27
  if (transformOrigin) {
31
28
  contentStyle.transformOrigin = transformOrigin;
32
29
  }
33
30
  function onPrepare() {
34
- var elementOffset = offset(dialogRef.current);
35
- setTransformOrigin(mousePosition && (mousePosition.x || mousePosition.y) ? "".concat(mousePosition.x - elementOffset.left, "px ").concat(mousePosition.y - elementOffset.top, "px") : '');
31
+ const elementOffset = offset(dialogRef.current);
32
+ setTransformOrigin(mousePosition && (mousePosition.x || mousePosition.y) ? `${mousePosition.x - elementOffset.left}px ${mousePosition.y - elementOffset.top}px` : '');
36
33
  }
37
34
 
38
35
  // ============================= Render =============================
@@ -45,19 +42,22 @@ var Content = /*#__PURE__*/React.forwardRef(function (props, ref) {
45
42
  motionName: motionName,
46
43
  removeOnLeave: destroyOnClose,
47
44
  ref: dialogRef
48
- }, function (_ref, motionRef) {
49
- var motionClassName = _ref.className,
50
- motionStyle = _ref.style;
51
- return /*#__PURE__*/React.createElement(Panel, _extends({}, props, {
52
- ref: ref,
53
- title: title,
54
- ariaId: ariaId,
55
- prefixCls: prefixCls,
56
- holderRef: motionRef,
57
- style: _objectSpread(_objectSpread(_objectSpread({}, motionStyle), style), contentStyle),
58
- className: classNames(className, motionClassName)
59
- }));
60
- });
45
+ }, ({
46
+ className: motionClassName,
47
+ style: motionStyle
48
+ }, motionRef) => /*#__PURE__*/React.createElement(Panel, _extends({}, props, {
49
+ ref: ref,
50
+ title: title,
51
+ ariaId: ariaId,
52
+ prefixCls: prefixCls,
53
+ holderRef: motionRef,
54
+ style: {
55
+ ...motionStyle,
56
+ ...style,
57
+ ...contentStyle
58
+ },
59
+ className: classNames(className, motionClassName)
60
+ })));
61
61
  });
62
62
  Content.displayName = 'Content';
63
63
  export default Content;
package/es/Dialog/Mask.js CHANGED
@@ -1,28 +1,31 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
2
  import * as React from 'react';
4
3
  import classNames from 'classnames';
5
4
  import CSSMotion from 'rc-motion';
6
- var Mask = function Mask(props) {
7
- var prefixCls = props.prefixCls,
8
- style = props.style,
9
- visible = props.visible,
10
- maskProps = props.maskProps,
11
- motionName = props.motionName,
12
- className = props.className;
5
+ const Mask = props => {
6
+ const {
7
+ prefixCls,
8
+ style,
9
+ visible,
10
+ maskProps,
11
+ motionName,
12
+ className
13
+ } = props;
13
14
  return /*#__PURE__*/React.createElement(CSSMotion, {
14
15
  key: "mask",
15
16
  visible: visible,
16
17
  motionName: motionName,
17
- leavedClassName: "".concat(prefixCls, "-mask-hidden")
18
- }, function (_ref, ref) {
19
- var motionClassName = _ref.className,
20
- motionStyle = _ref.style;
21
- return /*#__PURE__*/React.createElement("div", _extends({
22
- ref: ref,
23
- style: _objectSpread(_objectSpread({}, motionStyle), style),
24
- className: classNames("".concat(prefixCls, "-mask"), motionClassName, className)
25
- }, maskProps));
26
- });
18
+ leavedClassName: `${prefixCls}-mask-hidden`
19
+ }, ({
20
+ className: motionClassName,
21
+ style: motionStyle
22
+ }, ref) => /*#__PURE__*/React.createElement("div", _extends({
23
+ ref: ref,
24
+ style: {
25
+ ...motionStyle,
26
+ ...style
27
+ },
28
+ className: classNames(`${prefixCls}-mask`, motionClassName, className)
29
+ }, maskProps)));
27
30
  };
28
31
  export default Mask;
@@ -1,67 +1,62 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
2
  import classNames from 'classnames';
5
- import contains from "rc-util/es/Dom/contains";
6
- import useId from "rc-util/es/hooks/useId";
7
- import KeyCode from "rc-util/es/KeyCode";
8
- import pickAttrs from "rc-util/es/pickAttrs";
3
+ import contains from "@rc-component/util/es/Dom/contains";
4
+ import useId from "@rc-component/util/es/hooks/useId";
5
+ import KeyCode from "@rc-component/util/es/KeyCode";
6
+ import pickAttrs from "@rc-component/util/es/pickAttrs";
9
7
  import * as React from 'react';
10
8
  import { useEffect, useRef } from 'react';
11
9
  import { getMotionName } from "../util";
12
10
  import Content from "./Content";
13
11
  import Mask from "./Mask";
14
- import { warning } from "rc-util/es/warning";
15
- var Dialog = function Dialog(props) {
16
- var _props$prefixCls = props.prefixCls,
17
- prefixCls = _props$prefixCls === void 0 ? 'rc-dialog' : _props$prefixCls,
18
- zIndex = props.zIndex,
19
- _props$visible = props.visible,
20
- visible = _props$visible === void 0 ? false : _props$visible,
21
- _props$keyboard = props.keyboard,
22
- keyboard = _props$keyboard === void 0 ? true : _props$keyboard,
23
- _props$focusTriggerAf = props.focusTriggerAfterClose,
24
- focusTriggerAfterClose = _props$focusTriggerAf === void 0 ? true : _props$focusTriggerAf,
25
- wrapStyle = props.wrapStyle,
26
- wrapClassName = props.wrapClassName,
27
- wrapProps = props.wrapProps,
28
- onClose = props.onClose,
29
- afterOpenChange = props.afterOpenChange,
30
- afterClose = props.afterClose,
31
- transitionName = props.transitionName,
32
- animation = props.animation,
33
- _props$closable = props.closable,
34
- closable = _props$closable === void 0 ? true : _props$closable,
35
- _props$mask = props.mask,
36
- mask = _props$mask === void 0 ? true : _props$mask,
37
- maskTransitionName = props.maskTransitionName,
38
- maskAnimation = props.maskAnimation,
39
- _props$maskClosable = props.maskClosable,
40
- maskClosable = _props$maskClosable === void 0 ? true : _props$maskClosable,
41
- maskStyle = props.maskStyle,
42
- maskProps = props.maskProps,
43
- rootClassName = props.rootClassName,
44
- modalClassNames = props.classNames,
45
- modalStyles = props.styles;
12
+ import { warning } from "@rc-component/util/es/warning";
13
+ const Dialog = props => {
14
+ const {
15
+ prefixCls = 'rc-dialog',
16
+ zIndex,
17
+ visible = false,
18
+ keyboard = true,
19
+ focusTriggerAfterClose = true,
20
+ // scrollLocker,
21
+ // Wrapper
22
+ wrapStyle,
23
+ wrapClassName,
24
+ wrapProps,
25
+ onClose,
26
+ afterOpenChange,
27
+ afterClose,
28
+ // Dialog
29
+ transitionName,
30
+ animation,
31
+ closable = true,
32
+ // Mask
33
+ mask = true,
34
+ maskTransitionName,
35
+ maskAnimation,
36
+ maskClosable = true,
37
+ maskStyle,
38
+ maskProps,
39
+ rootClassName,
40
+ rootStyle,
41
+ classNames: modalClassNames,
42
+ styles: modalStyles
43
+ } = props;
46
44
  if (process.env.NODE_ENV !== 'production') {
47
- ['wrapStyle', 'bodyStyle', 'maskStyle'].forEach(function (prop) {
45
+ ['wrapStyle', 'bodyStyle', 'maskStyle'].forEach(prop => {
48
46
  // (prop in props) && console.error(`Warning: ${prop} is deprecated, please use styles instead.`)
49
- warning(!(prop in props), "".concat(prop, " is deprecated, please use styles instead."));
47
+ warning(!(prop in props), `${prop} is deprecated, please use styles instead.`);
50
48
  });
51
49
  if ('wrapClassName' in props) {
52
- warning(false, "wrapClassName is deprecated, please use classNames instead.");
50
+ warning(false, `wrapClassName is deprecated, please use classNames instead.`);
53
51
  }
54
52
  }
55
- var lastOutSideActiveElementRef = useRef();
56
- var wrapperRef = useRef();
57
- var contentRef = useRef();
58
- var _React$useState = React.useState(visible),
59
- _React$useState2 = _slicedToArray(_React$useState, 2),
60
- animatedVisible = _React$useState2[0],
61
- setAnimatedVisible = _React$useState2[1];
53
+ const lastOutSideActiveElementRef = useRef();
54
+ const wrapperRef = useRef();
55
+ const contentRef = useRef();
56
+ const [animatedVisible, setAnimatedVisible] = React.useState(visible);
62
57
 
63
58
  // ========================== Init ==========================
64
- var ariaId = useId();
59
+ const ariaId = useId();
65
60
  function saveLastOutSideActiveElementRef() {
66
61
  if (!contains(wrapperRef.current, document.activeElement)) {
67
62
  lastOutSideActiveElementRef.current = document.activeElement;
@@ -69,8 +64,7 @@ var Dialog = function Dialog(props) {
69
64
  }
70
65
  function focusDialogContent() {
71
66
  if (!contains(wrapperRef.current, document.activeElement)) {
72
- var _contentRef$current;
73
- (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 || _contentRef$current.focus();
67
+ contentRef.current?.focus();
74
68
  }
75
69
  }
76
70
 
@@ -95,35 +89,35 @@ var Dialog = function Dialog(props) {
95
89
 
96
90
  // Trigger afterClose only when change visible from true to false
97
91
  if (animatedVisible) {
98
- afterClose === null || afterClose === void 0 || afterClose();
92
+ afterClose?.();
99
93
  }
100
94
  }
101
- afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(newVisible);
95
+ afterOpenChange?.(newVisible);
102
96
  }
103
97
  function onInternalClose(e) {
104
- onClose === null || onClose === void 0 || onClose(e);
98
+ onClose?.(e);
105
99
  }
106
100
 
107
101
  // >>> Content
108
- var contentClickRef = useRef(false);
109
- var contentTimeoutRef = useRef();
102
+ const contentClickRef = useRef(false);
103
+ const contentTimeoutRef = useRef();
110
104
 
111
105
  // We need record content click incase content popup out of dialog
112
- var onContentMouseDown = function onContentMouseDown() {
106
+ const onContentMouseDown = () => {
113
107
  clearTimeout(contentTimeoutRef.current);
114
108
  contentClickRef.current = true;
115
109
  };
116
- var onContentMouseUp = function onContentMouseUp() {
117
- contentTimeoutRef.current = setTimeout(function () {
110
+ const onContentMouseUp = () => {
111
+ contentTimeoutRef.current = setTimeout(() => {
118
112
  contentClickRef.current = false;
119
113
  });
120
114
  };
121
115
 
122
116
  // >>> Wrapper
123
117
  // Close only when element not on dialog
124
- var onWrapperClick = null;
118
+ let onWrapperClick = null;
125
119
  if (maskClosable) {
126
- onWrapperClick = function onWrapperClick(e) {
120
+ onWrapperClick = e => {
127
121
  if (contentClickRef.current) {
128
122
  contentClickRef.current = false;
129
123
  } else if (wrapperRef.current === e.target) {
@@ -145,7 +139,7 @@ var Dialog = function Dialog(props) {
145
139
  }
146
140
 
147
141
  // ========================= Effect =========================
148
- useEffect(function () {
142
+ useEffect(() => {
149
143
  if (visible) {
150
144
  setAnimatedVisible(true);
151
145
  saveLastOutSideActiveElementRef();
@@ -153,35 +147,37 @@ var Dialog = function Dialog(props) {
153
147
  }, [visible]);
154
148
 
155
149
  // Remove direct should also check the scroll bar update
156
- useEffect(function () {
157
- return function () {
158
- clearTimeout(contentTimeoutRef.current);
159
- };
150
+ useEffect(() => () => {
151
+ clearTimeout(contentTimeoutRef.current);
160
152
  }, []);
161
- var mergedStyle = _objectSpread(_objectSpread(_objectSpread({
162
- zIndex: zIndex
163
- }, wrapStyle), modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.wrapper), {}, {
153
+ const mergedStyle = {
154
+ zIndex,
155
+ ...wrapStyle,
156
+ ...modalStyles?.wrapper,
164
157
  display: !animatedVisible ? 'none' : null
165
- });
158
+ };
166
159
 
167
160
  // ========================= Render =========================
168
161
  return /*#__PURE__*/React.createElement("div", _extends({
169
- className: classNames("".concat(prefixCls, "-root"), rootClassName)
162
+ className: classNames(`${prefixCls}-root`, rootClassName),
163
+ style: rootStyle
170
164
  }, pickAttrs(props, {
171
165
  data: true
172
166
  })), /*#__PURE__*/React.createElement(Mask, {
173
167
  prefixCls: prefixCls,
174
168
  visible: mask && visible,
175
169
  motionName: getMotionName(prefixCls, maskTransitionName, maskAnimation),
176
- style: _objectSpread(_objectSpread({
177
- zIndex: zIndex
178
- }, maskStyle), modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.mask),
170
+ style: {
171
+ zIndex,
172
+ ...maskStyle,
173
+ ...modalStyles?.mask
174
+ },
179
175
  maskProps: maskProps,
180
- className: modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.mask
176
+ className: modalClassNames?.mask
181
177
  }), /*#__PURE__*/React.createElement("div", _extends({
182
178
  tabIndex: -1,
183
179
  onKeyDown: onWrapperKeyDown,
184
- className: classNames("".concat(prefixCls, "-wrap"), wrapClassName, modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.wrapper),
180
+ className: classNames(`${prefixCls}-wrap`, wrapClassName, modalClassNames?.wrapper),
185
181
  ref: wrapperRef,
186
182
  onClick: onWrapperClick,
187
183
  style: mergedStyle