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
@@ -52,49 +52,28 @@ export const Modal = p => {
52
52
  }
53
53
  });
54
54
  const [active, setActive] = useState(props.visible);
55
- const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
56
- className: classPrefix,
57
- style: {
58
- display: active ? 'unset' : 'none'
59
- }
60
- }, React.createElement(Mask, {
61
- visible: props.visible,
62
- onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
63
- style: props.maskStyle,
64
- className: classNames(`${classPrefix}-mask`, props.maskClassName)
65
- }), React.createElement("div", {
66
- className: `${classPrefix}-wrap`,
67
- style: {
68
- pointerEvents: props.visible ? 'unset' : 'none'
69
- }
70
- }, React.createElement(animated.div, {
71
- style: Object.assign({}, style),
72
- onClick: e => e.stopPropagation(),
73
- className: `${classPrefix}-main`
55
+ const body = React.createElement("div", {
56
+ className: classNames(cls('body'), props.image && cls('with-image'), props.bodyClassName),
57
+ style: props.bodyStyle
74
58
  }, props.showCloseButton && React.createElement("a", {
75
- className: classNames(`${classPrefix}-close`, 'adm-plain-anchor'),
59
+ className: classNames(cls('close'), 'adm-plain-anchor'),
76
60
  onClick: props.onClose
77
61
  }, React.createElement(CloseOutline, null)), !!props.image && React.createElement("div", {
78
- className: `${classPrefix}-image-container`
62
+ className: cls('image-container')
79
63
  }, React.createElement(Image, {
80
64
  src: props.image,
81
65
  alt: 'modal header image',
82
66
  width: '100%'
83
- })), React.createElement("div", {
84
- style: props.bodyStyle,
85
- className: classNames(`${classPrefix}-body`, props.bodyClassName)
86
- }, !!props.header && React.createElement("div", {
87
- className: `${classPrefix}-body-header-wrapper`
88
- }, React.createElement("div", {
89
- className: `${classPrefix}-body-header`
90
- }, props.header)), !!props.title && React.createElement("div", {
91
- className: `${classPrefix}-body-title`
92
- }, props.title), !!props.content && React.createElement("div", {
93
- className: `${classPrefix}-body-content`
94
- }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content)), React.createElement(Space, {
67
+ })), !!props.header && React.createElement("div", {
68
+ className: cls('header')
69
+ }, React.createElement(AutoCenter, null, props.header)), !!props.title && React.createElement("div", {
70
+ className: cls('title')
71
+ }, props.title), React.createElement("div", {
72
+ className: cls('content')
73
+ }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content), React.createElement(Space, {
95
74
  direction: 'vertical',
96
75
  block: true,
97
- className: `${classPrefix}-footer`
76
+ className: classNames(cls('footer'), props.actions.length === 0 && cls('footer-empty'))
98
77
  }, props.actions.map((action, index) => {
99
78
  return React.createElement(ModalActionButton, {
100
79
  key: action.key,
@@ -109,6 +88,28 @@ export const Modal = p => {
109
88
  }
110
89
  })
111
90
  });
112
- })))))));
91
+ })));
92
+ const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
93
+ className: cls(),
94
+ style: {
95
+ display: active ? 'unset' : 'none'
96
+ }
97
+ }, React.createElement(Mask, {
98
+ visible: props.visible,
99
+ onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
100
+ style: props.maskStyle,
101
+ className: classNames(cls('mask'), props.maskClassName)
102
+ }), React.createElement("div", {
103
+ className: cls('wrap'),
104
+ style: {
105
+ pointerEvents: props.visible ? 'unset' : 'none'
106
+ }
107
+ }, React.createElement(animated.div, {
108
+ style: style
109
+ }, body)))));
113
110
  return renderToContainer(props.getContainer, node);
114
- };
111
+ };
112
+
113
+ function cls(name = '') {
114
+ return 'adm-modal' + (name && '-') + name;
115
+ }
@@ -4,9 +4,8 @@ export const Arrow = memo(props => {
4
4
  return withNativeProps(props, React.createElement("svg", {
5
5
  viewBox: '0 0 30 16'
6
6
  }, React.createElement("g", {
7
- transform: 'translate(-1300.000000, -841.000000)',
8
7
  fill: 'currentColor'
9
8
  }, React.createElement("path", {
10
- 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'
9
+ 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'
11
10
  }))));
12
11
  });
@@ -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,23 @@
1
+ import React, { memo } from 'react';
2
+ import { withNativeProps } from '../../utils/native-props';
3
+ export const SpinIcon = memo(props => {
4
+ return withNativeProps(props, React.createElement("svg", {
5
+ width: '28px',
6
+ height: '28px',
7
+ viewBox: '0 0 28 28'
8
+ }, React.createElement("g", {
9
+ stroke: 'none',
10
+ strokeWidth: '1',
11
+ fill: 'none',
12
+ fillRule: 'evenodd'
13
+ }, React.createElement("g", {
14
+ transform: 'translate(-137.000000, -840.000000)',
15
+ fill: '#1576FE'
16
+ }, React.createElement("g", {
17
+ transform: 'translate(80.000000, 823.000000)'
18
+ }, React.createElement("g", {
19
+ transform: 'translate(53.000000, 13.000000)'
20
+ }, React.createElement("path", {
21
+ 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'
22
+ })))))));
23
+ });
@@ -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;
@@ -1,10 +1,10 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import classNames from 'classnames';
3
3
  import React, { useState } from 'react';
4
- import SpinIcon from '../../assets/spin.svg';
5
4
  import { withNativeProps } from '../../utils/native-props';
6
5
  import { usePropsValue } from '../../utils/use-props-value';
7
6
  import { mergeProps } from '../../utils/with-default-props';
7
+ import { SpinIcon } from './spin-icon';
8
8
  const classPrefix = `adm-switch`;
9
9
  const defaultProps = {
10
10
  defaultChecked: false
@@ -54,10 +54,8 @@ export const Switch = p => {
54
54
  className: `${classPrefix}-checkbox`
55
55
  }, React.createElement("div", {
56
56
  className: `${classPrefix}-handle`
57
- }, (props.loading || changing) && React.createElement("img", {
58
- src: SpinIcon,
59
- className: `${classPrefix}-icon`,
60
- alt: 'switch-handle'
57
+ }, (props.loading || changing) && React.createElement(SpinIcon, {
58
+ className: `${classPrefix}-spin-icon`
61
59
  })), React.createElement("div", {
62
60
  className: `${classPrefix}-inner`
63
61
  }, checked ? props.checkedText : props.uncheckedText))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "dependencies": {
5
5
  "@react-spring/web": "^9.4.3",
6
6
  "@types/resize-observer-browser": "^0.1.7",