@rc-component/dialog 1.0.0 → 1.1.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.
Files changed (128) hide show
  1. package/dist/10509781610555453368.hot-update-url-map.json +1 -0
  2. package/dist/10509781610555453368.hot-update.json +1 -0
  3. package/dist/11977476592833392720.hot-update-url-map.json +1 -0
  4. package/dist/11977476592833392720.hot-update.json +1 -0
  5. package/dist/14397576132152343869.hot-update-url-map.json +1 -0
  6. package/dist/14397576132152343869.hot-update.json +1 -0
  7. package/dist/14597408625395534096.hot-update-url-map.json +1 -0
  8. package/dist/14597408625395534096.hot-update.json +1 -0
  9. package/dist/15104553912779929595.hot-update-url-map.json +1 -0
  10. package/dist/15104553912779929595.hot-update.json +1 -0
  11. package/dist/4361192314875393955.hot-update-url-map.json +1 -0
  12. package/dist/4361192314875393955.hot-update.json +1 -0
  13. package/dist/4704580574928883170.hot-update-url-map.json +1 -0
  14. package/dist/4704580574928883170.hot-update.json +1 -0
  15. package/dist/5496443382647786649.hot-update-url-map.json +1 -0
  16. package/dist/5496443382647786649.hot-update.json +1 -0
  17. package/dist/7338948553039754745.hot-update-url-map.json +1 -0
  18. package/dist/7338948553039754745.hot-update.json +1 -0
  19. package/dist/7441995189917427860.hot-update-url-map.json +1 -0
  20. package/dist/7441995189917427860.hot-update.json +1 -0
  21. package/dist/8425845753817463333.hot-update-url-map.json +1 -0
  22. package/dist/8425845753817463333.hot-update.json +1 -0
  23. package/dist/8742625841545363477.hot-update-url-map.json +1 -0
  24. package/dist/8742625841545363477.hot-update.json +1 -0
  25. package/dist/960384830459946830.hot-update-url-map.json +1 -0
  26. package/dist/960384830459946830.hot-update.json +1 -0
  27. package/dist/9707589364653732454.hot-update-url-map.json +1 -0
  28. package/dist/9707589364653732454.hot-update.json +1 -0
  29. package/dist/common-async.10509781610555453368.hot-update.js +268 -0
  30. package/dist/common-async.10509781610555453368.hot-update.js.map +1 -0
  31. package/dist/common-async.11977476592833392720.hot-update.js +395 -0
  32. package/dist/common-async.11977476592833392720.hot-update.js.map +1 -0
  33. package/dist/common-async.14397576132152343869.hot-update.js +395 -0
  34. package/dist/common-async.14397576132152343869.hot-update.js.map +1 -0
  35. package/dist/common-async.14597408625395534096.hot-update.js +268 -0
  36. package/dist/common-async.14597408625395534096.hot-update.js.map +1 -0
  37. package/dist/common-async.15104553912779929595.hot-update.js +268 -0
  38. package/dist/common-async.15104553912779929595.hot-update.js.map +1 -0
  39. package/dist/common-async.4361192314875393955.hot-update.js +268 -0
  40. package/dist/common-async.4361192314875393955.hot-update.js.map +1 -0
  41. package/dist/common-async.4704580574928883170.hot-update.js +268 -0
  42. package/dist/common-async.4704580574928883170.hot-update.js.map +1 -0
  43. package/dist/common-async.5496443382647786649.hot-update.js +391 -0
  44. package/dist/common-async.5496443382647786649.hot-update.js.map +1 -0
  45. package/dist/common-async.7338948553039754745.hot-update.js +395 -0
  46. package/dist/common-async.7338948553039754745.hot-update.js.map +1 -0
  47. package/dist/common-async.7441995189917427860.hot-update.js +394 -0
  48. package/dist/common-async.7441995189917427860.hot-update.js.map +1 -0
  49. package/dist/common-async.8425845753817463333.hot-update.js +268 -0
  50. package/dist/common-async.8425845753817463333.hot-update.js.map +1 -0
  51. package/dist/common-async.8742625841545363477.hot-update.js +268 -0
  52. package/dist/common-async.8742625841545363477.hot-update.js.map +1 -0
  53. package/dist/common-async.960384830459946830.hot-update.js +268 -0
  54. package/dist/common-async.960384830459946830.hot-update.js.map +1 -0
  55. package/dist/common-async.9707589364653732454.hot-update.js +268 -0
  56. package/dist/common-async.9707589364653732454.hot-update.js.map +1 -0
  57. package/dist/common-async.js +1180 -0
  58. package/dist/common-async.js.map +1 -0
  59. package/dist/demos-async.7338948553039754745.hot-update.js +395 -0
  60. package/dist/demos-async.7338948553039754745.hot-update.js.map +1 -0
  61. package/dist/demos-async.css +396 -0
  62. package/dist/demos-async.css.map +1 -0
  63. package/dist/demos-async.js +1242 -0
  64. package/dist/demos-async.js.map +1 -0
  65. package/dist/docs_changelog_md-async.js +2159 -0
  66. package/dist/docs_changelog_md-async.js.map +1 -0
  67. package/dist/docs_demo_ant-design_md-async.js +119 -0
  68. package/dist/docs_demo_ant-design_md-async.js.map +1 -0
  69. package/dist/docs_demo_bootstrap_md-async.js +119 -0
  70. package/dist/docs_demo_bootstrap_md-async.js.map +1 -0
  71. package/dist/docs_demo_draggable_md-async.js +119 -0
  72. package/dist/docs_demo_draggable_md-async.js.map +1 -0
  73. package/dist/docs_demo_multiple-Portal_md-async.js +119 -0
  74. package/dist/docs_demo_multiple-Portal_md-async.js.map +1 -0
  75. package/dist/docs_demo_pure_md-async.js +119 -0
  76. package/dist/docs_demo_pure_md-async.js.map +1 -0
  77. package/dist/docs_index_md-async.js +1717 -0
  78. package/dist/docs_index_md-async.js.map +1 -0
  79. package/dist/dumi__tmp__dumi__theme__ContextWrapper-async.js +201 -0
  80. package/dist/dumi__tmp__dumi__theme__ContextWrapper-async.js.map +1 -0
  81. package/dist/meta__docs-async.7338948553039754745.hot-update.js +395 -0
  82. package/dist/meta__docs-async.7338948553039754745.hot-update.js.map +1 -0
  83. package/dist/meta__docs-async.css +396 -0
  84. package/dist/meta__docs-async.css.map +1 -0
  85. package/dist/meta__docs-async.js +2391 -0
  86. package/dist/meta__docs-async.js.map +1 -0
  87. package/dist/nm__dumi__dist__client__pages__404-async.js +69 -0
  88. package/dist/nm__dumi__dist__client__pages__404-async.js.map +1 -0
  89. package/dist/nm__dumi__dist__client__pages__Demo__index-async.js +63 -0
  90. package/dist/nm__dumi__dist__client__pages__Demo__index-async.js.map +1 -0
  91. package/dist/node_modules__dumi_2_4_17_dumi_dist_client_misc_reactDemoCompiler_js-async.js +368 -0
  92. package/dist/node_modules__dumi_2_4_17_dumi_dist_client_misc_reactDemoCompiler_js-async.js.map +1 -0
  93. package/dist/node_modules__dumi_2_4_17_dumi_theme-default_layouts_DocLayout_index_js-async.js +1077 -0
  94. package/dist/node_modules__dumi_2_4_17_dumi_theme-default_layouts_DocLayout_index_js-async.js.map +1 -0
  95. package/dist/node_modules__react-dom_18_3_1_react-dom_server_browser_js-async.js +18 -0
  96. package/dist/node_modules__react-dom_18_3_1_react-dom_server_browser_js-async.js.map +1 -0
  97. package/dist/umi.css +1302 -0
  98. package/dist/umi.css.map +1 -0
  99. package/dist/umi.js +80442 -0
  100. package/dist/umi.js.map +1 -0
  101. package/dist/vendors-async.css +22545 -0
  102. package/dist/vendors-async.css.map +1 -0
  103. package/dist/vendors-async.js +53289 -0
  104. package/dist/vendors-async.js.map +1 -0
  105. package/es/Dialog/Content/MemoChildren.js +5 -7
  106. package/es/Dialog/Content/Panel.d.ts +2 -2
  107. package/es/Dialog/Content/Panel.js +89 -78
  108. package/es/Dialog/Content/index.d.ts +4 -1
  109. package/es/Dialog/Content/index.js +45 -37
  110. package/es/Dialog/Mask.js +23 -20
  111. package/es/Dialog/index.js +97 -93
  112. package/es/DialogWrap.js +17 -22
  113. package/es/IDialogPropTypes.d.ts +2 -1
  114. package/es/context.js +1 -1
  115. package/es/util.js +9 -9
  116. package/lib/Dialog/Content/MemoChildren.js +7 -10
  117. package/lib/Dialog/Content/Panel.d.ts +2 -2
  118. package/lib/Dialog/Content/Panel.js +93 -83
  119. package/lib/Dialog/Content/index.d.ts +4 -1
  120. package/lib/Dialog/Content/index.js +49 -42
  121. package/lib/Dialog/Mask.js +27 -25
  122. package/lib/Dialog/index.js +103 -100
  123. package/lib/DialogWrap.js +21 -27
  124. package/lib/IDialogPropTypes.d.ts +2 -1
  125. package/lib/context.js +3 -4
  126. package/lib/index.js +2 -2
  127. package/lib/util.js +9 -9
  128. package/package.json +11 -16
@@ -1,67 +1,62 @@
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";
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
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,61 +64,66 @@ 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
 
77
71
  // ========================= Events =========================
72
+ // Close action will trigger by:
73
+ // 1. When hide motion end
74
+ // 2. Controlled `open` to `false` immediately after set to `true` which will not trigger motion
75
+ function doClose() {
76
+ // Clean up scroll bar & focus back
77
+ setAnimatedVisible(false);
78
+ if (mask && lastOutSideActiveElementRef.current && focusTriggerAfterClose) {
79
+ try {
80
+ lastOutSideActiveElementRef.current.focus({
81
+ preventScroll: true
82
+ });
83
+ } catch (e) {
84
+ // Do nothing
85
+ }
86
+ lastOutSideActiveElementRef.current = null;
87
+ }
88
+
89
+ // Trigger afterClose only when change visible from true to false
90
+ if (animatedVisible) {
91
+ afterClose?.();
92
+ }
93
+ }
78
94
  function onDialogVisibleChanged(newVisible) {
79
95
  // Try to focus
80
96
  if (newVisible) {
81
97
  focusDialogContent();
82
98
  } else {
83
- // Clean up scroll bar & focus back
84
- setAnimatedVisible(false);
85
- if (mask && lastOutSideActiveElementRef.current && focusTriggerAfterClose) {
86
- try {
87
- lastOutSideActiveElementRef.current.focus({
88
- preventScroll: true
89
- });
90
- } catch (e) {
91
- // Do nothing
92
- }
93
- lastOutSideActiveElementRef.current = null;
94
- }
95
-
96
- // Trigger afterClose only when change visible from true to false
97
- if (animatedVisible) {
98
- afterClose === null || afterClose === void 0 || afterClose();
99
- }
99
+ doClose();
100
100
  }
101
- afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(newVisible);
101
+ afterOpenChange?.(newVisible);
102
102
  }
103
103
  function onInternalClose(e) {
104
- onClose === null || onClose === void 0 || onClose(e);
104
+ onClose?.(e);
105
105
  }
106
106
 
107
107
  // >>> Content
108
- var contentClickRef = useRef(false);
109
- var contentTimeoutRef = useRef();
108
+ const contentClickRef = useRef(false);
109
+ const contentTimeoutRef = useRef();
110
110
 
111
111
  // We need record content click incase content popup out of dialog
112
- var onContentMouseDown = function onContentMouseDown() {
112
+ const onContentMouseDown = () => {
113
113
  clearTimeout(contentTimeoutRef.current);
114
114
  contentClickRef.current = true;
115
115
  };
116
- var onContentMouseUp = function onContentMouseUp() {
117
- contentTimeoutRef.current = setTimeout(function () {
116
+ const onContentMouseUp = () => {
117
+ contentTimeoutRef.current = setTimeout(() => {
118
118
  contentClickRef.current = false;
119
119
  });
120
120
  };
121
121
 
122
122
  // >>> Wrapper
123
123
  // Close only when element not on dialog
124
- var onWrapperClick = null;
124
+ let onWrapperClick = null;
125
125
  if (maskClosable) {
126
- onWrapperClick = function onWrapperClick(e) {
126
+ onWrapperClick = e => {
127
127
  if (contentClickRef.current) {
128
128
  contentClickRef.current = false;
129
129
  } else if (wrapperRef.current === e.target) {
@@ -145,43 +145,47 @@ var Dialog = function Dialog(props) {
145
145
  }
146
146
 
147
147
  // ========================= Effect =========================
148
- useEffect(function () {
148
+ useEffect(() => {
149
149
  if (visible) {
150
150
  setAnimatedVisible(true);
151
151
  saveLastOutSideActiveElementRef();
152
+ } else if (animatedVisible && contentRef.current.enableMotion() && !contentRef.current.inMotion()) {
153
+ doClose();
152
154
  }
153
155
  }, [visible]);
154
156
 
155
157
  // Remove direct should also check the scroll bar update
156
- useEffect(function () {
157
- return function () {
158
- clearTimeout(contentTimeoutRef.current);
159
- };
158
+ useEffect(() => () => {
159
+ clearTimeout(contentTimeoutRef.current);
160
160
  }, []);
161
- var mergedStyle = _objectSpread(_objectSpread(_objectSpread({
162
- zIndex: zIndex
163
- }, wrapStyle), modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.wrapper), {}, {
161
+ const mergedStyle = {
162
+ zIndex,
163
+ ...wrapStyle,
164
+ ...modalStyles?.wrapper,
164
165
  display: !animatedVisible ? 'none' : null
165
- });
166
+ };
166
167
 
167
168
  // ========================= Render =========================
168
169
  return /*#__PURE__*/React.createElement("div", _extends({
169
- className: classNames("".concat(prefixCls, "-root"), rootClassName)
170
+ className: classNames(`${prefixCls}-root`, rootClassName),
171
+ style: rootStyle
170
172
  }, pickAttrs(props, {
171
173
  data: true
172
174
  })), /*#__PURE__*/React.createElement(Mask, {
173
175
  prefixCls: prefixCls,
174
176
  visible: mask && visible,
175
177
  motionName: getMotionName(prefixCls, maskTransitionName, maskAnimation),
176
- style: _objectSpread(_objectSpread({
177
- zIndex: zIndex
178
- }, maskStyle), modalStyles === null || modalStyles === void 0 ? void 0 : modalStyles.mask),
178
+ style: {
179
+ zIndex,
180
+ ...maskStyle,
181
+ ...modalStyles?.mask
182
+ },
179
183
  maskProps: maskProps,
180
- className: modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.mask
184
+ className: modalClassNames?.mask
181
185
  }), /*#__PURE__*/React.createElement("div", _extends({
182
186
  tabIndex: -1,
183
187
  onKeyDown: onWrapperKeyDown,
184
- className: classNames("".concat(prefixCls, "-wrap"), wrapClassName, modalClassNames === null || modalClassNames === void 0 ? void 0 : modalClassNames.wrapper),
188
+ className: classNames(`${prefixCls}-wrap`, wrapClassName, modalClassNames?.wrapper),
185
189
  ref: wrapperRef,
186
190
  onClick: onWrapperClick,
187
191
  style: mergedStyle
package/es/DialogWrap.js CHANGED
@@ -1,5 +1,4 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
2
  import Portal from '@rc-component/portal';
4
3
  import * as React from 'react';
5
4
  import { RefContext } from "./context";
@@ -13,24 +12,20 @@ import Dialog from "./Dialog";
13
12
  * So here should add a child (div element) to custom container.
14
13
  * */
15
14
 
16
- var DialogWrap = function DialogWrap(props) {
17
- var visible = props.visible,
18
- getContainer = props.getContainer,
19
- forceRender = props.forceRender,
20
- _props$destroyOnClose = props.destroyOnClose,
21
- destroyOnClose = _props$destroyOnClose === void 0 ? false : _props$destroyOnClose,
22
- _afterClose = props.afterClose,
23
- panelRef = props.panelRef;
24
- var _React$useState = React.useState(visible),
25
- _React$useState2 = _slicedToArray(_React$useState, 2),
26
- animatedVisible = _React$useState2[0],
27
- setAnimatedVisible = _React$useState2[1];
28
- var refContext = React.useMemo(function () {
29
- return {
30
- panel: panelRef
31
- };
32
- }, [panelRef]);
33
- React.useEffect(function () {
15
+ const DialogWrap = props => {
16
+ const {
17
+ visible,
18
+ getContainer,
19
+ forceRender,
20
+ destroyOnClose = false,
21
+ afterClose,
22
+ panelRef
23
+ } = props;
24
+ const [animatedVisible, setAnimatedVisible] = React.useState(visible);
25
+ const refContext = React.useMemo(() => ({
26
+ panel: panelRef
27
+ }), [panelRef]);
28
+ React.useEffect(() => {
34
29
  if (visible) {
35
30
  setAnimatedVisible(true);
36
31
  }
@@ -49,8 +44,8 @@ var DialogWrap = function DialogWrap(props) {
49
44
  autoLock: visible || animatedVisible
50
45
  }, /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {
51
46
  destroyOnClose: destroyOnClose,
52
- afterClose: function afterClose() {
53
- _afterClose === null || _afterClose === void 0 || _afterClose();
47
+ afterClose: () => {
48
+ afterClose?.();
54
49
  setAnimatedVisible(false);
55
50
  }
56
51
  }))));
@@ -1,4 +1,4 @@
1
- import type { GetContainer } from 'rc-util/lib/PortalWrapper';
1
+ import type { GetContainer } from '@rc-component/util/lib/PortalWrapper';
2
2
  import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
3
3
  export type SemanticName = 'header' | 'body' | 'footer' | 'section' | 'title' | 'wrapper' | 'mask';
4
4
  export type ModalClassNames = Partial<Record<SemanticName, string>>;
@@ -7,6 +7,7 @@ export type IDialogPropTypes = {
7
7
  className?: string;
8
8
  keyboard?: boolean;
9
9
  style?: CSSProperties;
10
+ rootStyle?: CSSProperties;
10
11
  mask?: boolean;
11
12
  children?: React.ReactNode;
12
13
  afterClose?: () => any;
package/es/context.js CHANGED
@@ -1,2 +1,2 @@
1
1
  import * as React from 'react';
2
- export var RefContext = /*#__PURE__*/React.createContext({});
2
+ export const RefContext = /*#__PURE__*/React.createContext({});
package/es/util.js CHANGED
@@ -1,18 +1,18 @@
1
1
  // =============================== Motion ===============================
2
2
  export function getMotionName(prefixCls, transitionName, animationName) {
3
- var motionName = transitionName;
3
+ let motionName = transitionName;
4
4
  if (!motionName && animationName) {
5
- motionName = "".concat(prefixCls, "-").concat(animationName);
5
+ motionName = `${prefixCls}-${animationName}`;
6
6
  }
7
7
  return motionName;
8
8
  }
9
9
 
10
10
  // =============================== Offset ===============================
11
11
  function getScroll(w, top) {
12
- var ret = w["page".concat(top ? 'Y' : 'X', "Offset")];
13
- var method = "scroll".concat(top ? 'Top' : 'Left');
12
+ let ret = w[`page${top ? 'Y' : 'X'}Offset`];
13
+ const method = `scroll${top ? 'Top' : 'Left'}`;
14
14
  if (typeof ret !== 'number') {
15
- var d = w.document;
15
+ const d = w.document;
16
16
  ret = d.documentElement[method];
17
17
  if (typeof ret !== 'number') {
18
18
  ret = d.body[method];
@@ -21,13 +21,13 @@ function getScroll(w, top) {
21
21
  return ret;
22
22
  }
23
23
  export function offset(el) {
24
- var rect = el.getBoundingClientRect();
25
- var pos = {
24
+ const rect = el.getBoundingClientRect();
25
+ const pos = {
26
26
  left: rect.left,
27
27
  top: rect.top
28
28
  };
29
- var doc = el.ownerDocument;
30
- var w = doc.defaultView || doc.parentWindow;
29
+ const doc = el.ownerDocument;
30
+ const w = doc.defaultView || doc.parentWindow;
31
31
  pos.left += getScroll(w);
32
32
  pos.top += getScroll(w, true);
33
33
  return pos;
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
7
  var React = _interopRequireWildcard(require("react"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- var _default = exports.default = /*#__PURE__*/React.memo(function (_ref) {
12
- var children = _ref.children;
13
- return children;
14
- }, function (_, _ref2) {
15
- var shouldUpdate = _ref2.shouldUpdate;
16
- return !shouldUpdate;
17
- });
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ var _default = exports.default = /*#__PURE__*/React.memo(({
11
+ children
12
+ }) => children, (_, {
13
+ shouldUpdate
14
+ }) => !shouldUpdate);
@@ -7,9 +7,9 @@ export interface PanelProps extends Omit<IDialogPropTypes, 'getOpenCount'> {
7
7
  onMouseUp?: React.MouseEventHandler;
8
8
  holderRef?: React.Ref<HTMLDivElement>;
9
9
  }
10
- export type ContentRef = {
10
+ export type PanelRef = {
11
11
  focus: () => void;
12
12
  changeActive: (next: boolean) => void;
13
13
  };
14
- declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<ContentRef>>;
14
+ declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<PanelRef>>;
15
15
  export default Panel;