antd-mobile 5.2.1 → 5.2.2

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 (53) hide show
  1. package/2x/cjs/components/date-picker/date-picker.js +1 -1
  2. package/2x/cjs/components/dialog/dialog.css +27 -18
  3. package/2x/cjs/components/dialog/dialog.js +39 -42
  4. package/2x/cjs/components/dropdown/dropdown.css +2 -1
  5. package/2x/cjs/components/modal/modal.css +27 -21
  6. package/2x/cjs/components/modal/modal.js +39 -36
  7. package/2x/cjs/components/popover/arrow.js +1 -2
  8. package/2x/cjs/components/switch/spin-icon.d.ts +3 -0
  9. package/2x/cjs/components/switch/spin-icon.js +37 -0
  10. package/2x/cjs/components/switch/switch.css +1 -1
  11. package/2x/cjs/components/switch/switch.js +4 -6
  12. package/2x/es/components/date-picker/date-picker.js +1 -1
  13. package/2x/es/components/dialog/dialog.css +27 -18
  14. package/2x/es/components/dialog/dialog.js +37 -41
  15. package/2x/es/components/dropdown/dropdown.css +2 -1
  16. package/2x/es/components/modal/modal.css +27 -21
  17. package/2x/es/components/modal/modal.js +37 -36
  18. package/2x/es/components/popover/arrow.js +1 -2
  19. package/2x/es/components/switch/spin-icon.d.ts +3 -0
  20. package/2x/es/components/switch/spin-icon.js +23 -0
  21. package/2x/es/components/switch/switch.css +1 -1
  22. package/2x/es/components/switch/switch.js +3 -5
  23. package/2x/package.json +1 -1
  24. package/cjs/components/date-picker/date-picker.js +1 -1
  25. package/cjs/components/dialog/dialog.css +26 -18
  26. package/cjs/components/dialog/dialog.js +39 -42
  27. package/cjs/components/dropdown/dropdown.css +2 -1
  28. package/cjs/components/modal/modal.css +26 -20
  29. package/cjs/components/modal/modal.js +39 -36
  30. package/cjs/components/popover/arrow.js +1 -2
  31. package/cjs/components/switch/spin-icon.d.ts +3 -0
  32. package/cjs/components/switch/spin-icon.js +37 -0
  33. package/cjs/components/switch/switch.css +1 -1
  34. package/cjs/components/switch/switch.js +4 -6
  35. package/es/components/date-picker/date-picker.js +1 -1
  36. package/es/components/dialog/dialog.css +26 -18
  37. package/es/components/dialog/dialog.js +37 -41
  38. package/es/components/dropdown/dropdown.css +2 -1
  39. package/es/components/modal/modal.css +26 -20
  40. package/es/components/modal/modal.js +37 -36
  41. package/es/components/popover/arrow.js +1 -2
  42. package/es/components/switch/spin-icon.d.ts +3 -0
  43. package/es/components/switch/spin-icon.js +23 -0
  44. package/es/components/switch/switch.css +1 -1
  45. package/es/components/switch/switch.js +3 -5
  46. package/package.json +1 -1
  47. package/umd/antd-mobile.js +1 -1
  48. package/2x/assets/spin.svg +0 -12
  49. package/2x/cjs/assets/spin.svg +0 -12
  50. package/2x/es/assets/spin.svg +0 -12
  51. package/assets/spin.svg +0 -12
  52. package/cjs/assets/spin.svg +0 -12
  53. package/es/assets/spin.svg +0 -12
@@ -16,48 +16,53 @@
16
16
  max-width: 75vw;
17
17
  transform: translate(-50%, -50%);
18
18
  }
19
- .adm-modal-main {
19
+ .adm-modal-body {
20
20
  width: 100%;
21
21
  max-height: 70vh;
22
22
  box-sizing: border-box;
23
23
  font-size: 14px;
24
24
  background-color: white;
25
25
  border-radius: 8px;
26
- overflow-x: hidden;
27
- overflow-y: auto;
26
+ overflow: hidden;
28
27
  display: flex;
29
28
  flex-direction: column;
30
29
  }
31
- .adm-modal-main > * {
30
+ .adm-modal-body > * {
32
31
  flex: none;
33
32
  }
34
- .adm-modal-main > .adm-modal-image-container {
33
+ .adm-modal-body > .adm-modal-content {
35
34
  flex: auto;
36
35
  }
37
- .adm-modal-main .adm-modal-body {
38
- padding: 20px 12px 12px;
39
- display: flex;
40
- flex-direction: column;
36
+ .adm-modal-body:not(.adm-modal-with-image) {
37
+ padding-top: 20px;
41
38
  }
42
- .adm-modal-main .adm-modal-body > * + * {
43
- margin-top: 8px;
39
+ .adm-modal-body .adm-modal-image-container {
40
+ margin-bottom: 12px;
41
+ max-height: 40vh;
42
+ overflow-y: scroll;
44
43
  }
45
- .adm-modal-main .adm-modal-body-header-wrapper {
46
- display: flex;
47
- justify-content: center;
44
+ .adm-modal-body .adm-modal-header {
45
+ margin-bottom: 8px;
46
+ padding: 0 12px;
48
47
  }
49
- .adm-modal-main .adm-modal-body-title {
48
+ .adm-modal-body .adm-modal-title {
49
+ margin-bottom: 8px;
50
+ padding: 0 12px;
50
51
  font-weight: bold;
51
52
  font-size: 18px;
52
53
  line-height: 25px;
53
54
  text-align: center;
54
55
  }
55
- .adm-modal-main .adm-modal-body-content {
56
+ .adm-modal-body .adm-modal-content {
57
+ padding: 0 12px 12px;
58
+ max-height: 70vh;
59
+ overflow-x: hidden;
60
+ overflow-y: auto;
56
61
  font-size: 15px;
57
62
  line-height: 1.4;
58
63
  color: #333;
59
64
  }
60
- .adm-modal-main .adm-modal-close {
65
+ .adm-modal-body .adm-modal-close {
61
66
  position: absolute;
62
67
  right: 8px;
63
68
  top: 8px;
@@ -69,6 +74,10 @@
69
74
  user-select: none;
70
75
  padding: 8px 12px 12px;
71
76
  }
77
+ .adm-modal-footer-empty {
78
+ padding: 0;
79
+ height: 8px;
80
+ }
72
81
  .adm-modal-footer.adm-space {
73
82
  --gap-vertical: 20px;
74
83
  }
@@ -86,6 +95,3 @@
86
95
  .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary):active {
87
96
  opacity: 0.7;
88
97
  }
89
- .adm-modal-image-container {
90
- overflow-y: auto;
91
- }
@@ -81,49 +81,29 @@ const Modal = p => {
81
81
  }
82
82
  });
83
83
  const [active, setActive] = (0, _react.useState)(props.visible);
84
- const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
85
- className: classPrefix,
86
- style: {
87
- display: active ? 'unset' : 'none'
88
- }
89
- }, _react.default.createElement(_mask.default, {
90
- visible: props.visible,
91
- onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
92
- style: props.maskStyle,
93
- className: (0, _classnames.default)(`${classPrefix}-mask`, props.maskClassName)
94
- }), _react.default.createElement("div", {
95
- className: `${classPrefix}-wrap`,
96
- style: {
97
- pointerEvents: props.visible ? 'unset' : 'none'
98
- }
99
- }, _react.default.createElement(_web.animated.div, {
100
- style: Object.assign({}, style),
101
- onClick: e => e.stopPropagation(),
102
- className: `${classPrefix}-main`
84
+
85
+ const body = _react.default.createElement("div", {
86
+ className: (0, _classnames.default)(cls('body'), props.image && cls('with-image'), props.bodyClassName),
87
+ style: props.bodyStyle
103
88
  }, props.showCloseButton && _react.default.createElement("a", {
104
- className: (0, _classnames.default)(`${classPrefix}-close`, 'adm-plain-anchor'),
89
+ className: (0, _classnames.default)(cls('close'), 'adm-plain-anchor'),
105
90
  onClick: props.onClose
106
91
  }, _react.default.createElement(_antdMobileIcons.CloseOutline, null)), !!props.image && _react.default.createElement("div", {
107
- className: `${classPrefix}-image-container`
92
+ className: cls('image-container')
108
93
  }, _react.default.createElement(_image.default, {
109
94
  src: props.image,
110
95
  alt: 'modal header image',
111
96
  width: '100%'
112
- })), _react.default.createElement("div", {
113
- style: props.bodyStyle,
114
- className: (0, _classnames.default)(`${classPrefix}-body`, props.bodyClassName)
115
- }, !!props.header && _react.default.createElement("div", {
116
- className: `${classPrefix}-body-header-wrapper`
117
- }, _react.default.createElement("div", {
118
- className: `${classPrefix}-body-header`
119
- }, props.header)), !!props.title && _react.default.createElement("div", {
120
- className: `${classPrefix}-body-title`
121
- }, props.title), !!props.content && _react.default.createElement("div", {
122
- className: `${classPrefix}-body-content`
123
- }, typeof props.content === 'string' ? _react.default.createElement(_autoCenter.default, null, props.content) : props.content)), _react.default.createElement(_space.default, {
97
+ })), !!props.header && _react.default.createElement("div", {
98
+ className: cls('header')
99
+ }, _react.default.createElement(_autoCenter.default, null, props.header)), !!props.title && _react.default.createElement("div", {
100
+ className: cls('title')
101
+ }, props.title), _react.default.createElement("div", {
102
+ className: cls('content')
103
+ }, typeof props.content === 'string' ? _react.default.createElement(_autoCenter.default, null, props.content) : props.content), _react.default.createElement(_space.default, {
124
104
  direction: 'vertical',
125
105
  block: true,
126
- className: `${classPrefix}-footer`
106
+ className: (0, _classnames.default)(cls('footer'), props.actions.length === 0 && cls('footer-empty'))
127
107
  }, props.actions.map((action, index) => {
128
108
  return _react.default.createElement(_modalActionButton.ModalActionButton, {
129
109
  key: action.key,
@@ -138,8 +118,31 @@ const Modal = p => {
138
118
  }
139
119
  })
140
120
  });
141
- })))))));
121
+ })));
122
+
123
+ const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
124
+ className: cls(),
125
+ style: {
126
+ display: active ? 'unset' : 'none'
127
+ }
128
+ }, _react.default.createElement(_mask.default, {
129
+ visible: props.visible,
130
+ onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
131
+ style: props.maskStyle,
132
+ className: (0, _classnames.default)(cls('mask'), props.maskClassName)
133
+ }), _react.default.createElement("div", {
134
+ className: cls('wrap'),
135
+ style: {
136
+ pointerEvents: props.visible ? 'unset' : 'none'
137
+ }
138
+ }, _react.default.createElement(_web.animated.div, {
139
+ style: style
140
+ }, body)))));
142
141
  return (0, _renderToContainer.renderToContainer)(props.getContainer, node);
143
142
  };
144
143
 
145
- exports.Modal = Modal;
144
+ exports.Modal = Modal;
145
+
146
+ function cls(name = '') {
147
+ return 'adm-modal' + (name && '-') + name;
148
+ }
@@ -17,10 +17,9 @@ const Arrow = (0, _react.memo)(props => {
17
17
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("svg", {
18
18
  viewBox: '0 0 30 16'
19
19
  }, _react.default.createElement("g", {
20
- transform: 'translate(-1300.000000, -841.000000)',
21
20
  fill: 'currentColor'
22
21
  }, _react.default.createElement("path", {
23
- d: 'M1300,841 L1330,841 L1318.07289,855.312538 C1316.65863,857.009645 1314.13637,857.238942 1312.43926,855.824685 C1312.25341,855.669808 1312.08199,855.49839 1311.92711,855.312538 L1300,841 L1300,841 Z'
22
+ d: 'M0,0 L30,0 L18.07289,14.312538 C16.65863,16.009645 14.13637,16.238942 12.43926,14.824685 C12.25341,14.669808 12.08199,14.49839 11.92711,14.312538 L0,0 L0,0 Z'
24
23
  }))));
25
24
  });
26
25
  exports.Arrow = Arrow;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ export declare const SpinIcon: React.NamedExoticComponent<NativeProps<never>>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SpinIcon = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _nativeProps = require("../../utils/native-props");
11
+
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ const SpinIcon = (0, _react.memo)(props => {
17
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("svg", {
18
+ width: '28px',
19
+ height: '28px',
20
+ viewBox: '0 0 28 28'
21
+ }, _react.default.createElement("g", {
22
+ stroke: 'none',
23
+ strokeWidth: '1',
24
+ fill: 'none',
25
+ fillRule: 'evenodd'
26
+ }, _react.default.createElement("g", {
27
+ transform: 'translate(-137.000000, -840.000000)',
28
+ fill: '#1576FE'
29
+ }, _react.default.createElement("g", {
30
+ transform: 'translate(80.000000, 823.000000)'
31
+ }, _react.default.createElement("g", {
32
+ transform: 'translate(53.000000, 13.000000)'
33
+ }, _react.default.createElement("path", {
34
+ d: 'M17.9996753,31.5 C10.5556724,31.5 4.5,25.4443275 4.5,18.0003247 C4.5,10.5563219 10.5556724,4.5 17.9996753,4.5 C18.5355492,4.5 18.9702974,4.93474816 18.9702974,5.47062208 C18.9702974,6.006496 18.5355492,6.44124416 17.9996753,6.44124416 C11.6261524,6.44124416 6.44124416,11.6267709 6.44124416,18.0002938 C6.44124416,24.3738167 11.6261524,29.5587249 17.9996753,29.5587249 C24.3731982,29.5587249 29.5587249,24.3738167 29.5587249,18.0002938 C29.5587249,14.7964616 28.2778291,11.8169616 25.9523687,9.61220279 C25.5637302,9.24317094 25.5473089,8.62893223 25.9157222,8.23967523 C26.2841356,7.84976878 26.8989928,7.83461537 27.2882498,8.20302872 C30.0042351,10.7787368 31.5,14.2580826 31.5,18.0002938 C31.5,25.4443275 25.4436781,31.5 17.9996753,31.5 Z'
35
+ })))))));
36
+ });
37
+ exports.SpinIcon = SpinIcon;
@@ -89,7 +89,7 @@
89
89
  cursor: not-allowed;
90
90
  opacity: 0.4;
91
91
  }
92
- .adm-switch-icon {
92
+ .adm-switch-spin-icon {
93
93
  width: 14px;
94
94
  height: 14px;
95
95
  animation: loading-rotate 1s linear infinite;
@@ -11,14 +11,14 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
 
14
- var _spin = _interopRequireDefault(require("../../assets/spin.svg"));
15
-
16
14
  var _nativeProps = require("../../utils/native-props");
17
15
 
18
16
  var _usePropsValue = require("../../utils/use-props-value");
19
17
 
20
18
  var _withDefaultProps = require("../../utils/with-default-props");
21
19
 
20
+ var _spinIcon = require("./spin-icon");
21
+
22
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
23
 
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -75,10 +75,8 @@ const Switch = p => {
75
75
  className: `${classPrefix}-checkbox`
76
76
  }, _react.default.createElement("div", {
77
77
  className: `${classPrefix}-handle`
78
- }, (props.loading || changing) && _react.default.createElement("img", {
79
- src: _spin.default,
80
- className: `${classPrefix}-icon`,
81
- alt: 'switch-handle'
78
+ }, (props.loading || changing) && _react.default.createElement(_spinIcon.SpinIcon, {
79
+ className: `${classPrefix}-spin-icon`
82
80
  })), _react.default.createElement("div", {
83
81
  className: `${classPrefix}-inner`
84
82
  }, checked ? props.checkedText : props.uncheckedText))));
@@ -31,7 +31,7 @@ export const DatePicker = p => {
31
31
  let date = value;
32
32
 
33
33
  if (date === null) {
34
- date = new Date(bound(now.getDate(), props.min.getDate(), props.max.getDate()));
34
+ date = new Date(bound(now.getTime(), props.min.getTime(), props.max.getTime()));
35
35
  }
36
36
 
37
37
  return convertDateToStringArray(date, props.precision);
@@ -15,7 +15,7 @@
15
15
  max-width: 500px;
16
16
  transform: translate(-50%, -50%);
17
17
  }
18
- .adm-dialog-main {
18
+ .adm-dialog-body {
19
19
  width: 100%;
20
20
  max-height: 70vh;
21
21
  font-size: 14px;
@@ -25,29 +25,33 @@
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  }
28
- .adm-dialog-main > * {
28
+ .adm-dialog-body > * {
29
29
  flex: none;
30
30
  }
31
- .adm-dialog-main > .adm-dialog-image-container {
31
+ .adm-dialog-body > .adm-dialog-content {
32
32
  flex: auto;
33
33
  }
34
- .adm-dialog-main > .adm-dialog-image-container + .adm-dialog-body {
35
- padding-top: 12px;
34
+ .adm-dialog-body:not(.adm-dialog-with-image) {
35
+ padding-top: 20px;
36
36
  }
37
- .adm-dialog-main .adm-dialog-body {
38
- padding: 20px 12px;
37
+ .adm-dialog-body .adm-dialog-image-container {
38
+ margin-bottom: 12px;
39
+ max-height: 40vh;
39
40
  }
40
- .adm-dialog-main .adm-dialog-body-header-wrapper {
41
- display: flex;
42
- justify-content: center;
41
+ .adm-dialog-body .adm-dialog-header {
42
+ margin-bottom: 8px;
43
+ padding: 0 12px;
43
44
  }
44
- .adm-dialog-main .adm-dialog-body-title {
45
+ .adm-dialog-body .adm-dialog-title {
46
+ margin-bottom: 8px;
47
+ padding: 0 12px;
45
48
  font-weight: bold;
46
49
  font-size: 18px;
47
50
  line-height: 25px;
48
51
  text-align: center;
49
52
  }
50
- .adm-dialog-main .adm-dialog-body-content {
53
+ .adm-dialog-body .adm-dialog-content {
54
+ padding: 0 12px 20px;
51
55
  max-height: 70vh;
52
56
  overflow-x: hidden;
53
57
  overflow-y: auto;
@@ -55,28 +59,32 @@
55
59
  line-height: 1.4;
56
60
  color: #333;
57
61
  }
58
- .adm-dialog-main .adm-dialog-footer {
62
+ .adm-dialog-body .adm-dialog-content-empty {
63
+ padding: 0;
64
+ height: 12px;
65
+ }
66
+ .adm-dialog-body .adm-dialog-footer {
59
67
  user-select: none;
60
68
  }
61
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row {
69
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row {
62
70
  display: flex;
63
71
  align-items: stretch;
64
72
  border-top: 0.5px solid var(--adm-border-color);
65
73
  }
66
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > * {
74
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > * {
67
75
  flex: 1;
68
76
  }
69
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button {
77
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button {
70
78
  padding: 10px;
71
79
  font-size: 18px;
72
80
  line-height: 25px;
73
81
  border-radius: 0;
74
82
  border-right: solid 0.5px var(--adm-border-color);
75
83
  }
76
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button-bold {
84
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button-bold {
77
85
  font-weight: bold;
78
86
  }
79
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button:last-child {
87
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button:last-child {
80
88
  border-right: none;
81
89
  }
82
90
  .adm-dialog-image-container {
@@ -6,13 +6,11 @@ import { useUnmountedRef } from 'ahooks';
6
6
  import Mask from '../mask';
7
7
  import { DialogActionButton } from './dialog-action-button';
8
8
  import Image from '../image';
9
- import Space from '../space';
10
9
  import { renderToContainer } from '../../utils/render-to-container';
11
10
  import { withStopPropagation } from '../../utils/with-stop-propagation';
12
11
  import AutoCenter from '../auto-center';
13
12
  import { useSpring, animated } from '@react-spring/web';
14
13
  import { withNativeProps } from '../../utils/native-props';
15
- const classPrefix = `adm-dialog`;
16
14
  const defaultProps = {
17
15
  visible: false,
18
16
  actions: [],
@@ -50,51 +48,27 @@ export const Dialog = p => {
50
48
  }
51
49
  });
52
50
  const [active, setActive] = useState(props.visible);
53
- const node = withNativeProps(props, React.createElement("div", {
54
- className: classPrefix,
55
- style: {
56
- display: active ? 'unset' : 'none'
57
- }
58
- }, React.createElement(Mask, {
59
- visible: props.visible,
60
- onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
61
- style: props.maskStyle,
62
- className: classNames(`${classPrefix}-mask`, props.maskClassName)
63
- }), React.createElement("div", {
64
- className: `${classPrefix}-wrap`,
65
- style: {
66
- pointerEvents: props.visible ? 'unset' : 'none'
67
- }
68
- }, React.createElement(animated.div, {
69
- style: Object.assign({}, style),
70
- onClick: e => e.stopPropagation(),
71
- className: `${classPrefix}-main`
51
+ const body = React.createElement("div", {
52
+ className: classNames(cls('body'), props.image && cls('with-image'), props.bodyClassName),
53
+ style: props.bodyStyle
72
54
  }, !!props.image && React.createElement("div", {
73
- className: `${classPrefix}-image-container`
55
+ className: cls('image-container')
74
56
  }, React.createElement(Image, {
75
57
  src: props.image,
76
58
  alt: 'dialog header image',
77
59
  width: '100%'
78
- })), React.createElement("div", {
79
- style: props.bodyStyle,
80
- className: classNames(`${classPrefix}-body`, props.bodyClassName)
81
- }, React.createElement(Space, {
82
- direction: 'vertical',
83
- block: true
84
- }, !!props.header && React.createElement("div", {
85
- className: `${classPrefix}-body-header-wrapper`
86
- }, React.createElement("div", {
87
- className: `${classPrefix}-body-header`
88
- }, props.header)), !!props.title && React.createElement("div", {
89
- className: `${classPrefix}-body-title`
90
- }, props.title), !!props.content && React.createElement("div", {
91
- className: `${classPrefix}-body-content`
92
- }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content))), React.createElement("div", {
93
- className: `${classPrefix}-footer`
60
+ })), !!props.header && React.createElement("div", {
61
+ className: cls('header')
62
+ }, React.createElement(AutoCenter, null, props.header)), !!props.title && React.createElement("div", {
63
+ className: cls('title')
64
+ }, props.title), React.createElement("div", {
65
+ className: classNames(cls('content'), !props.content && cls('content-empty'))
66
+ }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content), React.createElement("div", {
67
+ className: cls('footer')
94
68
  }, props.actions.map((row, index) => {
95
69
  const actions = Array.isArray(row) ? row : [row];
96
70
  return React.createElement("div", {
97
- className: `${classPrefix}-action-row`,
71
+ className: cls('action-row'),
98
72
  key: index
99
73
  }, actions.map((action, index) => React.createElement(DialogActionButton, {
100
74
  key: action.key,
@@ -109,6 +83,28 @@ export const Dialog = p => {
109
83
  }
110
84
  })
111
85
  })));
112
- }))))));
86
+ })));
87
+ const node = withNativeProps(props, React.createElement("div", {
88
+ className: cls(),
89
+ style: {
90
+ display: active ? 'unset' : 'none'
91
+ }
92
+ }, React.createElement(Mask, {
93
+ visible: props.visible,
94
+ onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
95
+ style: props.maskStyle,
96
+ className: classNames(cls('mask'), props.maskClassName)
97
+ }), React.createElement("div", {
98
+ className: cls('wrap'),
99
+ style: {
100
+ pointerEvents: props.visible ? 'unset' : 'none'
101
+ }
102
+ }, React.createElement(animated.div, {
103
+ style: style
104
+ }, body))));
113
105
  return renderToContainer(props.getContainer, withStopPropagation(props.stopPropagation, node));
114
- };
106
+ };
107
+
108
+ function cls(name = '') {
109
+ return 'adm-dialog' + (name && '-') + name;
110
+ }
@@ -3,9 +3,10 @@
3
3
  }
4
4
  .adm-dropdown .adm-dropdown-nav {
5
5
  display: flex;
6
+ border-bottom: 1px solid transparent;
6
7
  }
7
8
  .adm-dropdown-open .adm-dropdown-nav {
8
- border-bottom: 1px solid var(--adm-border-color);
9
+ border-bottom-color: var(--adm-border-color);
9
10
  }
10
11
  .adm-dropdown-item {
11
12
  display: flex;
@@ -16,48 +16,53 @@
16
16
  max-width: 75vw;
17
17
  transform: translate(-50%, -50%);
18
18
  }
19
- .adm-modal-main {
19
+ .adm-modal-body {
20
20
  width: 100%;
21
21
  max-height: 70vh;
22
22
  box-sizing: border-box;
23
23
  font-size: 14px;
24
24
  background-color: white;
25
25
  border-radius: 8px;
26
- overflow-x: hidden;
27
- overflow-y: auto;
26
+ overflow: hidden;
28
27
  display: flex;
29
28
  flex-direction: column;
30
29
  }
31
- .adm-modal-main > * {
30
+ .adm-modal-body > * {
32
31
  flex: none;
33
32
  }
34
- .adm-modal-main > .adm-modal-image-container {
33
+ .adm-modal-body > .adm-modal-content {
35
34
  flex: auto;
36
35
  }
37
- .adm-modal-main .adm-modal-body {
38
- padding: 20px 12px 12px;
39
- display: flex;
40
- flex-direction: column;
36
+ .adm-modal-body:not(.adm-modal-with-image) {
37
+ padding-top: 20px;
41
38
  }
42
- .adm-modal-main .adm-modal-body > * + * {
43
- margin-top: 8px;
39
+ .adm-modal-body .adm-modal-image-container {
40
+ margin-bottom: 12px;
41
+ max-height: 40vh;
42
+ overflow-y: scroll;
44
43
  }
45
- .adm-modal-main .adm-modal-body-header-wrapper {
46
- display: flex;
47
- justify-content: center;
44
+ .adm-modal-body .adm-modal-header {
45
+ margin-bottom: 8px;
46
+ padding: 0 12px;
48
47
  }
49
- .adm-modal-main .adm-modal-body-title {
48
+ .adm-modal-body .adm-modal-title {
49
+ margin-bottom: 8px;
50
+ padding: 0 12px;
50
51
  font-weight: bold;
51
52
  font-size: 18px;
52
53
  line-height: 25px;
53
54
  text-align: center;
54
55
  }
55
- .adm-modal-main .adm-modal-body-content {
56
+ .adm-modal-body .adm-modal-content {
57
+ padding: 0 12px 12px;
58
+ max-height: 70vh;
59
+ overflow-x: hidden;
60
+ overflow-y: auto;
56
61
  font-size: 15px;
57
62
  line-height: 1.4;
58
63
  color: #333;
59
64
  }
60
- .adm-modal-main .adm-modal-close {
65
+ .adm-modal-body .adm-modal-close {
61
66
  position: absolute;
62
67
  right: 8px;
63
68
  top: 8px;
@@ -69,6 +74,10 @@
69
74
  user-select: none;
70
75
  padding: 8px 12px 12px;
71
76
  }
77
+ .adm-modal-footer-empty {
78
+ padding: 0;
79
+ height: 8px;
80
+ }
72
81
  .adm-modal-footer.adm-space {
73
82
  --gap-vertical: 20px;
74
83
  }
@@ -86,6 +95,3 @@
86
95
  .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary):active {
87
96
  opacity: 0.7;
88
97
  }
89
- .adm-modal-image-container {
90
- overflow-y: auto;
91
- }