antd-mobile 5.17.1 → 5.19.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 (219) hide show
  1. package/2x/bundle/antd-mobile.cjs.js +47 -19173
  2. package/2x/bundle/antd-mobile.compatible.umd.js +25752 -0
  3. package/2x/bundle/antd-mobile.es.js +16416 -17055
  4. package/2x/bundle/antd-mobile.umd.js +64 -0
  5. package/2x/bundle/style.css +240 -277
  6. package/2x/cjs/components/action-sheet/action-sheet.d.ts +1 -1
  7. package/2x/cjs/components/button/button.js +1 -1
  8. package/2x/cjs/components/calendar/calendar.d.ts +3 -3
  9. package/2x/cjs/components/calendar/index.d.ts +1 -1
  10. package/2x/cjs/components/cascader/cascader.d.ts +2 -0
  11. package/2x/cjs/components/cascader/index.d.ts +1 -0
  12. package/2x/cjs/components/cascader-view/cascader-view.d.ts +2 -1
  13. package/2x/cjs/components/cascader-view/cascader-view.js +2 -1
  14. package/2x/cjs/components/dialog/show.d.ts +1 -1
  15. package/2x/cjs/components/floating-panel/floating-panel.css +4 -4
  16. package/2x/cjs/components/form/form-item.js +6 -4
  17. package/2x/cjs/components/image-viewer/slide.js +75 -56
  18. package/2x/cjs/components/input/input.js +9 -2
  19. package/2x/cjs/components/modal/show.d.ts +1 -1
  20. package/2x/cjs/components/notice-bar/notice-bar.css +9 -0
  21. package/2x/cjs/components/notice-bar/notice-bar.js +5 -3
  22. package/2x/cjs/components/number-keyboard/number-keyboard.css +11 -15
  23. package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  24. package/2x/cjs/components/number-keyboard/number-keyboard.js +19 -17
  25. package/2x/cjs/components/passcode-input/index.d.ts +1 -1
  26. package/2x/cjs/components/passcode-input/passcode-input.css +12 -12
  27. package/2x/cjs/components/passcode-input/passcode-input.js +16 -8
  28. package/2x/cjs/components/picker-view/wheel.js +1 -1
  29. package/2x/cjs/components/rate/rate.js +7 -2
  30. package/2x/cjs/components/rate/star.js +0 -10
  31. package/2x/cjs/components/result/result.d.ts +1 -1
  32. package/2x/cjs/components/result/result.js +7 -1
  33. package/2x/cjs/components/search-bar/search-bar.js +12 -2
  34. package/2x/cjs/components/switch/switch.d.ts +2 -1
  35. package/2x/cjs/components/switch/switch.js +16 -3
  36. package/2x/cjs/components/text-area/text-area.js +1 -0
  37. package/2x/cjs/locales/base.d.ts +9 -0
  38. package/2x/cjs/locales/base.js +9 -0
  39. package/2x/cjs/locales/en-US.d.ts +9 -0
  40. package/2x/cjs/locales/es-ES.d.ts +9 -0
  41. package/2x/cjs/locales/fa-IR.d.ts +9 -0
  42. package/2x/cjs/locales/fr-FR.d.ts +9 -0
  43. package/2x/cjs/locales/id-ID.d.ts +9 -0
  44. package/2x/cjs/locales/kk-KZ.d.ts +9 -0
  45. package/2x/cjs/locales/ko-KR.d.ts +9 -0
  46. package/2x/cjs/locales/zh-CN.d.ts +9 -0
  47. package/2x/cjs/locales/zh-CN.js +9 -0
  48. package/2x/cjs/locales/zh-HK.d.ts +9 -0
  49. package/2x/cjs/locales/zh-TW.d.ts +9 -0
  50. package/2x/cjs/utils/matrix.d.ts +10 -0
  51. package/2x/cjs/utils/matrix.js +60 -0
  52. package/2x/cjs/utils/merge-locale.d.ts +1 -1
  53. package/2x/cjs/utils/merge-locale.js +15 -5
  54. package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -1
  55. package/2x/cjs/utils/use-props-value.js +1 -1
  56. package/2x/cjs/utils/with-default-props.js +2 -6
  57. package/2x/es/components/action-sheet/action-sheet.d.ts +1 -1
  58. package/2x/es/components/button/button.js +1 -1
  59. package/2x/es/components/calendar/calendar.d.ts +3 -3
  60. package/2x/es/components/calendar/index.d.ts +1 -1
  61. package/2x/es/components/cascader/cascader.d.ts +2 -0
  62. package/2x/es/components/cascader/index.d.ts +1 -0
  63. package/2x/es/components/cascader-view/cascader-view.d.ts +2 -1
  64. package/2x/es/components/cascader-view/cascader-view.js +2 -1
  65. package/2x/es/components/dialog/show.d.ts +1 -1
  66. package/2x/es/components/floating-panel/floating-panel.css +4 -4
  67. package/2x/es/components/form/form-item.js +5 -4
  68. package/2x/es/components/image-viewer/slide.js +73 -56
  69. package/2x/es/components/input/input.js +8 -2
  70. package/2x/es/components/modal/show.d.ts +1 -1
  71. package/2x/es/components/notice-bar/notice-bar.css +9 -0
  72. package/2x/es/components/notice-bar/notice-bar.js +5 -3
  73. package/2x/es/components/number-keyboard/number-keyboard.css +11 -15
  74. package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  75. package/2x/es/components/number-keyboard/number-keyboard.js +19 -17
  76. package/2x/es/components/passcode-input/index.d.ts +1 -1
  77. package/2x/es/components/passcode-input/passcode-input.css +12 -12
  78. package/2x/es/components/passcode-input/passcode-input.js +15 -8
  79. package/2x/es/components/picker-view/wheel.js +1 -1
  80. package/2x/es/components/rate/rate.js +7 -2
  81. package/2x/es/components/rate/star.js +0 -10
  82. package/2x/es/components/result/result.d.ts +1 -1
  83. package/2x/es/components/result/result.js +6 -1
  84. package/2x/es/components/search-bar/search-bar.js +12 -2
  85. package/2x/es/components/switch/switch.d.ts +2 -1
  86. package/2x/es/components/switch/switch.js +15 -3
  87. package/2x/es/components/text-area/text-area.js +1 -0
  88. package/2x/es/locales/base.d.ts +9 -0
  89. package/2x/es/locales/base.js +9 -0
  90. package/2x/es/locales/en-US.d.ts +9 -0
  91. package/2x/es/locales/es-ES.d.ts +9 -0
  92. package/2x/es/locales/fa-IR.d.ts +9 -0
  93. package/2x/es/locales/fr-FR.d.ts +9 -0
  94. package/2x/es/locales/id-ID.d.ts +9 -0
  95. package/2x/es/locales/kk-KZ.d.ts +9 -0
  96. package/2x/es/locales/ko-KR.d.ts +9 -0
  97. package/2x/es/locales/zh-CN.d.ts +9 -0
  98. package/2x/es/locales/zh-CN.js +9 -0
  99. package/2x/es/locales/zh-HK.d.ts +9 -0
  100. package/2x/es/locales/zh-TW.d.ts +9 -0
  101. package/2x/es/utils/matrix.d.ts +10 -0
  102. package/2x/es/utils/matrix.js +27 -0
  103. package/2x/es/utils/merge-locale.d.ts +1 -1
  104. package/2x/es/utils/merge-locale.js +17 -3
  105. package/2x/es/utils/use-drag-and-pinch.d.ts +1 -1
  106. package/2x/es/utils/use-props-value.js +1 -1
  107. package/2x/es/utils/with-default-props.js +2 -4
  108. package/2x/package.json +4 -4
  109. package/2x/umd/antd-mobile.js +25752 -2
  110. package/bundle/antd-mobile.cjs.js +47 -19173
  111. package/bundle/antd-mobile.compatible.umd.js +25752 -0
  112. package/bundle/antd-mobile.es.js +16416 -17055
  113. package/bundle/antd-mobile.umd.js +64 -0
  114. package/bundle/style.css +1 -4080
  115. package/cjs/components/action-sheet/action-sheet.d.ts +1 -1
  116. package/cjs/components/button/button.js +1 -1
  117. package/cjs/components/calendar/calendar.d.ts +3 -3
  118. package/cjs/components/calendar/index.d.ts +1 -1
  119. package/cjs/components/cascader/cascader.d.ts +2 -0
  120. package/cjs/components/cascader/index.d.ts +1 -0
  121. package/cjs/components/cascader-view/cascader-view.d.ts +2 -1
  122. package/cjs/components/cascader-view/cascader-view.js +2 -1
  123. package/cjs/components/dialog/show.d.ts +1 -1
  124. package/cjs/components/floating-panel/floating-panel.css +4 -4
  125. package/cjs/components/form/form-item.js +6 -4
  126. package/cjs/components/image-viewer/slide.js +75 -56
  127. package/cjs/components/input/input.js +9 -2
  128. package/cjs/components/modal/show.d.ts +1 -1
  129. package/cjs/components/notice-bar/notice-bar.css +8 -0
  130. package/cjs/components/notice-bar/notice-bar.js +5 -3
  131. package/cjs/components/number-keyboard/number-keyboard.css +11 -14
  132. package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  133. package/cjs/components/number-keyboard/number-keyboard.js +19 -17
  134. package/cjs/components/passcode-input/index.d.ts +1 -1
  135. package/cjs/components/passcode-input/passcode-input.css +12 -12
  136. package/cjs/components/passcode-input/passcode-input.js +16 -8
  137. package/cjs/components/picker-view/wheel.js +1 -1
  138. package/cjs/components/rate/rate.js +7 -2
  139. package/cjs/components/rate/star.js +0 -10
  140. package/cjs/components/result/result.d.ts +1 -1
  141. package/cjs/components/result/result.js +7 -1
  142. package/cjs/components/search-bar/search-bar.js +12 -2
  143. package/cjs/components/switch/switch.d.ts +2 -1
  144. package/cjs/components/switch/switch.js +16 -3
  145. package/cjs/components/text-area/text-area.js +1 -0
  146. package/cjs/locales/base.d.ts +9 -0
  147. package/cjs/locales/base.js +9 -0
  148. package/cjs/locales/en-US.d.ts +9 -0
  149. package/cjs/locales/es-ES.d.ts +9 -0
  150. package/cjs/locales/fa-IR.d.ts +9 -0
  151. package/cjs/locales/fr-FR.d.ts +9 -0
  152. package/cjs/locales/id-ID.d.ts +9 -0
  153. package/cjs/locales/kk-KZ.d.ts +9 -0
  154. package/cjs/locales/ko-KR.d.ts +9 -0
  155. package/cjs/locales/zh-CN.d.ts +9 -0
  156. package/cjs/locales/zh-CN.js +9 -0
  157. package/cjs/locales/zh-HK.d.ts +9 -0
  158. package/cjs/locales/zh-TW.d.ts +9 -0
  159. package/cjs/utils/matrix.d.ts +10 -0
  160. package/cjs/utils/matrix.js +60 -0
  161. package/cjs/utils/merge-locale.d.ts +1 -1
  162. package/cjs/utils/merge-locale.js +15 -5
  163. package/cjs/utils/use-drag-and-pinch.d.ts +1 -1
  164. package/cjs/utils/use-props-value.js +1 -1
  165. package/cjs/utils/with-default-props.js +2 -6
  166. package/es/components/action-sheet/action-sheet.d.ts +1 -1
  167. package/es/components/button/button.js +1 -1
  168. package/es/components/calendar/calendar.d.ts +3 -3
  169. package/es/components/calendar/index.d.ts +1 -1
  170. package/es/components/cascader/cascader.d.ts +2 -0
  171. package/es/components/cascader/index.d.ts +1 -0
  172. package/es/components/cascader-view/cascader-view.d.ts +2 -1
  173. package/es/components/cascader-view/cascader-view.js +2 -1
  174. package/es/components/dialog/show.d.ts +1 -1
  175. package/es/components/floating-panel/floating-panel.css +4 -4
  176. package/es/components/form/form-item.js +5 -4
  177. package/es/components/image-viewer/slide.js +73 -56
  178. package/es/components/input/input.js +8 -2
  179. package/es/components/modal/show.d.ts +1 -1
  180. package/es/components/notice-bar/notice-bar.css +8 -0
  181. package/es/components/notice-bar/notice-bar.js +5 -3
  182. package/es/components/number-keyboard/number-keyboard.css +11 -14
  183. package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  184. package/es/components/number-keyboard/number-keyboard.js +19 -17
  185. package/es/components/passcode-input/index.d.ts +1 -1
  186. package/es/components/passcode-input/passcode-input.css +12 -12
  187. package/es/components/passcode-input/passcode-input.js +15 -8
  188. package/es/components/picker-view/wheel.js +1 -1
  189. package/es/components/rate/rate.js +7 -2
  190. package/es/components/rate/star.js +0 -10
  191. package/es/components/result/result.d.ts +1 -1
  192. package/es/components/result/result.js +6 -1
  193. package/es/components/search-bar/search-bar.js +12 -2
  194. package/es/components/switch/switch.d.ts +2 -1
  195. package/es/components/switch/switch.js +15 -3
  196. package/es/components/text-area/text-area.js +1 -0
  197. package/es/locales/base.d.ts +9 -0
  198. package/es/locales/base.js +9 -0
  199. package/es/locales/en-US.d.ts +9 -0
  200. package/es/locales/es-ES.d.ts +9 -0
  201. package/es/locales/fa-IR.d.ts +9 -0
  202. package/es/locales/fr-FR.d.ts +9 -0
  203. package/es/locales/id-ID.d.ts +9 -0
  204. package/es/locales/kk-KZ.d.ts +9 -0
  205. package/es/locales/ko-KR.d.ts +9 -0
  206. package/es/locales/zh-CN.d.ts +9 -0
  207. package/es/locales/zh-CN.js +9 -0
  208. package/es/locales/zh-HK.d.ts +9 -0
  209. package/es/locales/zh-TW.d.ts +9 -0
  210. package/es/utils/matrix.d.ts +10 -0
  211. package/es/utils/matrix.js +27 -0
  212. package/es/utils/merge-locale.d.ts +1 -1
  213. package/es/utils/merge-locale.js +17 -3
  214. package/es/utils/use-drag-and-pinch.d.ts +1 -1
  215. package/es/utils/use-props-value.js +1 -1
  216. package/es/utils/with-default-props.js +2 -4
  217. package/package.json +4 -4
  218. package/umd/antd-mobile.js +1 -1
  219. package/2x/umd/antd-mobile.js.LICENSE.txt +0 -35
@@ -1,4 +1,4 @@
1
1
  import './passcode-input.less';
2
2
  import { PasscodeInput } from './passcode-input';
3
- export type { PasscodeInputProps } from './passcode-input';
3
+ export type { PasscodeInputProps, PasscodeInputRef } from './passcode-input';
4
4
  export default PasscodeInput;
@@ -22,53 +22,53 @@
22
22
  height: var(--cell-size);
23
23
  background: var(--adm-color-background);
24
24
  }
25
- .adm-passcode-input:not(.seperated) {
25
+ .adm-passcode-input:not(.adm-passcode-input-seperated) {
26
26
  border-radius: var(--border-radius);
27
27
  overflow: hidden;
28
28
  border: 1px solid var(--border-color);
29
29
  }
30
- .adm-passcode-input:not(.seperated) .adm-passcode-input-cell:not(:last-child) {
30
+ .adm-passcode-input:not(.adm-passcode-input-seperated) .adm-passcode-input-cell:not(:last-child) {
31
31
  border-right: 1px solid var(--border-color);
32
32
  }
33
- .adm-passcode-input:not(.seperated).focused {
33
+ .adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-focused {
34
34
  border-color: var(--adm-color-primary);
35
35
  box-shadow: 0 0 2px 0 var(--adm-color-primary);
36
36
  outline: none;
37
37
  }
38
- .adm-passcode-input:not(.seperated).error {
38
+ .adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-error {
39
39
  border-color: var(--adm-color-danger);
40
40
  box-shadow: 0 0 2px 0 var(--adm-color-danger);
41
41
  animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
42
42
  }
43
- .adm-passcode-input.seperated .adm-passcode-input-cell {
43
+ .adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell {
44
44
  border-radius: var(--border-radius);
45
45
  border: 1px solid var(--border-color);
46
46
  }
47
- .adm-passcode-input.seperated .adm-passcode-input-cell:not(:last-child) {
47
+ .adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell:not(:last-child) {
48
48
  margin-right: var(--cell-gap);
49
49
  }
50
- .adm-passcode-input.seperated .adm-passcode-input-cell.focused {
50
+ .adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell-focused {
51
51
  border-color: var(--adm-color-primary);
52
52
  box-shadow: 0 0 2px 0 var(--adm-color-primary);
53
53
  }
54
- .adm-passcode-input.seperated.focused {
54
+ .adm-passcode-input-seperated.adm-passcode-input-focused {
55
55
  outline: none;
56
56
  }
57
- .adm-passcode-input.seperated.error {
57
+ .adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error {
58
58
  animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
59
59
  }
60
- .adm-passcode-input.seperated.error .adm-passcode-input-cell {
60
+ .adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error .adm-passcode-input-cell {
61
61
  border-color: var(--adm-color-danger);
62
62
  box-shadow: 0 0 2px 0 var(--adm-color-danger);
63
63
  }
64
- .adm-passcode-input-cell.dot::before {
64
+ .adm-passcode-input-cell-dot::before {
65
65
  content: '';
66
66
  width: var(--dot-size);
67
67
  height: var(--dot-size);
68
68
  border-radius: 50%;
69
69
  background: var(--adm-color-text);
70
70
  }
71
- .adm-passcode-input-cell.caret::after {
71
+ .adm-passcode-input-cell-caret::after {
72
72
  content: '';
73
73
  width: 2px;
74
74
  height: 1.1em;
@@ -17,6 +17,8 @@ var _bound = require("../../utils/bound");
17
17
 
18
18
  var _usePropsValue = require("../../utils/use-props-value");
19
19
 
20
+ var _configProvider = require("../config-provider");
21
+
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
22
24
  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); }
@@ -36,6 +38,9 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
36
38
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p); // 防止 length 值不合法
37
39
 
38
40
  const cellLength = props.length > 0 && props.length < Infinity ? Math.floor(props.length) : defaultProps.length;
41
+ const {
42
+ locale
43
+ } = (0, _configProvider.useConfig)();
39
44
  const [focused, setFocused] = (0, _react.useState)(false);
40
45
  const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
41
46
  const rootRef = (0, _react.useRef)(null);
@@ -106,9 +111,9 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
106
111
  for (let i = 0; i < cellLength; i++) {
107
112
  cells.push(_react.default.createElement("div", {
108
113
  className: (0, _classnames.default)(`${classPrefix}-cell`, {
109
- caret: props.caret && caretIndex === i && focused,
110
- focused: focusedIndex === i && focused,
111
- dot: !props.plain && chars[i]
114
+ [`${classPrefix}-cell-caret`]: props.caret && caretIndex === i && focused,
115
+ [`${classPrefix}-cell-focused`]: focusedIndex === i && focused,
116
+ [`${classPrefix}-cell-dot`]: !props.plain && chars[i]
112
117
  }),
113
118
  key: i
114
119
  }, chars[i] && props.plain ? chars[i] : ''));
@@ -118,16 +123,18 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
118
123
  };
119
124
 
120
125
  const cls = (0, _classnames.default)(classPrefix, {
121
- focused: focused,
122
- error: props.error,
123
- seperated: props.seperated
126
+ [`${classPrefix}-focused`]: focused,
127
+ [`${classPrefix}-error`]: props.error,
128
+ [`${classPrefix}-seperated`]: props.seperated
124
129
  });
125
130
  return _react.default.createElement(_react.default.Fragment, null, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
126
131
  ref: rootRef,
127
132
  tabIndex: 0,
128
133
  className: cls,
129
134
  onFocus: onFocus,
130
- onBlur: onBlur
135
+ onBlur: onBlur,
136
+ role: 'button',
137
+ "aria-label": locale.PasscodeInput.name
131
138
  }, _react.default.createElement("div", {
132
139
  className: `${classPrefix}-cell-container`
133
140
  }, renderCells()), _react.default.createElement("input", {
@@ -139,7 +146,8 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
139
146
  inputMode: 'numeric',
140
147
  onChange: e => {
141
148
  setValue(e.target.value.slice(0, props.length));
142
- }
149
+ },
150
+ "aria-hidden": true
143
151
  }))), props.keyboard && _react.default.cloneElement(props.keyboard, {
144
152
  visible: focused,
145
153
  onInput: v => {
@@ -62,7 +62,7 @@ const Wheel = (0, _react.memo)(props => {
62
62
  });
63
63
  (0, _ahooks.useIsomorphicLayoutEffect)(() => {
64
64
  if (draggingRef.current) return;
65
- if (!value) return;
65
+ if (value === null) return;
66
66
  const targetIndex = column.findIndex(item => item.value === value);
67
67
  if (targetIndex < 0) return;
68
68
  const finalPosition = targetIndex * -itemHeight.current;
@@ -49,12 +49,17 @@ const Rate = p => {
49
49
  } else {
50
50
  setValue(v);
51
51
  }
52
- }
52
+ },
53
+ role: 'radio',
54
+ "aria-checked": value >= v,
55
+ "aria-label": '' + v
53
56
  }, props.character);
54
57
  }
55
58
 
56
59
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
57
- className: classPrefix
60
+ className: classPrefix,
61
+ role: 'radiogroup',
62
+ "aria-readonly": props.readOnly
58
63
  }, starList.map((_, i) => _react.default.createElement("div", {
59
64
  key: i,
60
65
  className: (0, _classnames.default)(`${classPrefix}-box`)
@@ -10,16 +10,6 @@ var _react = _interopRequireDefault(require("react"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
12
  const Star = () => {
13
- // return (
14
- // <svg height='1em' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'>
15
- // <title>{'star-fill\u5907\u4EFD 71'}</title>
16
- // <path
17
- // d='m24 36-10.52 5.53a2 2 0 0 1-2.902-2.108l2.01-11.714-8.511-8.296a2 2 0 0 1 1.108-3.411l11.762-1.71 5.26-10.657a2 2 0 0 1 3.586 0l5.26 10.658L42.815 16a2 2 0 0 1 1.108 3.411l-8.51 8.296 2.009 11.714a2 2 0 0 1-2.902 2.109L24 36Z'
18
- // fill='#E5E5E5'
19
- // fillRule='evenodd'
20
- // />
21
- // </svg>
22
- // )
23
13
  return _react.default.createElement("svg", {
24
14
  viewBox: '0 0 42 40',
25
15
  height: '1em',
@@ -1,7 +1,7 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  export declare type ResultProps = {
4
- status: 'success' | 'error' | 'info' | 'waiting' | 'warning';
4
+ status?: 'success' | 'error' | 'info' | 'waiting' | 'warning';
5
5
  title: ReactNode;
6
6
  description?: ReactNode;
7
7
  icon?: ReactNode;
@@ -13,6 +13,8 @@ var _antdMobileIcons = require("antd-mobile-icons");
13
13
 
14
14
  var _nativeProps = require("../../utils/native-props");
15
15
 
16
+ var _withDefaultProps = require("../../utils/with-default-props");
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  const classPrefix = `adm-result`;
@@ -23,8 +25,12 @@ const iconRecord = {
23
25
  waiting: _antdMobileIcons.ClockCircleFill,
24
26
  warning: _antdMobileIcons.ExclamationCircleFill
25
27
  };
28
+ const defaultProps = {
29
+ status: 'info'
30
+ };
26
31
 
27
- const Result = props => {
32
+ const Result = p => {
33
+ const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
28
34
  const {
29
35
  status,
30
36
  title,
@@ -48,6 +48,7 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
48
48
  const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
49
49
  const [hasFocus, setHasFocus] = (0, _react.useState)(false);
50
50
  const inputRef = (0, _react.useRef)(null);
51
+ const composingRef = (0, _react.useRef)(false);
51
52
  (0, _react.useImperativeHandle)(ref, () => ({
52
53
  clear: () => {
53
54
  var _a;
@@ -140,8 +141,17 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
140
141
  onEnterPress: () => {
141
142
  var _a, _b;
142
143
 
143
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
144
- (_b = props.onSearch) === null || _b === void 0 ? void 0 : _b.call(props, value);
144
+ if (!composingRef.current) {
145
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
146
+ (_b = props.onSearch) === null || _b === void 0 ? void 0 : _b.call(props, value);
147
+ }
148
+ },
149
+ "aria-label": locale.SearchBar.name,
150
+ onCompositionStart: () => {
151
+ composingRef.current = true;
152
+ },
153
+ onCompositionEnd: () => {
154
+ composingRef.current = false;
145
155
  }
146
156
  })), renderCancelButton()));
147
157
  });
@@ -5,8 +5,9 @@ export declare type SwitchProps = {
5
5
  disabled?: boolean;
6
6
  checked?: boolean;
7
7
  defaultChecked?: boolean;
8
+ /** @deprecated use `onChange` instead */
8
9
  beforeChange?: (val: boolean) => Promise<void>;
9
- onChange?: (checked: boolean) => void;
10
+ onChange?: (checked: boolean) => void | Promise<void>;
10
11
  checkedText?: ReactNode;
11
12
  uncheckedText?: ReactNode;
12
13
  } & NativeProps<'--checked-color' | '--width' | '--height' | '--border-width'>;
@@ -21,6 +21,8 @@ var _spinIcon = require("./spin-icon");
21
21
 
22
22
  var _configProvider = require("../config-provider");
23
23
 
24
+ var _validate = require("../../utils/validate");
25
+
24
26
  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); }
25
27
 
26
28
  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; }
@@ -58,14 +60,25 @@ const Switch = p => {
58
60
 
59
61
  try {
60
62
  yield props.beforeChange(nextChecked);
61
- setChecked(nextChecked);
62
63
  setChanging(false);
63
64
  } catch (e) {
64
65
  setChanging(false);
65
66
  throw e;
66
67
  }
67
- } else {
68
- setChecked(nextChecked);
68
+ }
69
+
70
+ const result = setChecked(nextChecked);
71
+
72
+ if ((0, _validate.isPromise)(result)) {
73
+ setChanging(true);
74
+
75
+ try {
76
+ yield result;
77
+ setChanging(false);
78
+ } catch (e) {
79
+ setChanging(false);
80
+ throw e;
81
+ }
69
82
  }
70
83
  });
71
84
  }
@@ -68,6 +68,7 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
68
68
  if (!autoSize) return;
69
69
  const textArea = nativeTextAreaRef.current;
70
70
  if (!textArea) return;
71
+ textArea.style.height = 'auto';
71
72
  let height = textArea.scrollHeight;
72
73
 
73
74
  if (typeof autoSize === 'object') {
@@ -93,17 +93,26 @@ export declare const base: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -100,17 +100,26 @@ const base = {
100
100
  failedToLoad: 'Failed to load',
101
101
  retry: 'Retry'
102
102
  },
103
+ Input: {
104
+ clear: 'clear'
105
+ },
103
106
  Mask: {
104
107
  name: 'Mask'
105
108
  },
106
109
  Modal: {
107
110
  ok: 'OK'
108
111
  },
112
+ PasscodeInput: {
113
+ name: 'Passcode Input'
114
+ },
109
115
  PullToRefresh: {
110
116
  pulling: 'Scroll down to refresh',
111
117
  canRelease: 'Release to refresh immediately',
112
118
  complete: 'Refresh successful'
113
119
  },
120
+ SearchBar: {
121
+ name: 'Search Bar'
122
+ },
114
123
  Slider: {
115
124
  name: 'Slider'
116
125
  },
@@ -93,17 +93,26 @@ declare const enUS: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const esES: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const faIR: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const frFR: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const idID: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const kkKZ: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const koKR: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const zhCN: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -105,17 +105,26 @@ const zhCN = (0, _mergeLocale.mergeLocale)(_base.base, {
105
105
  failedToLoad: '加载失败',
106
106
  retry: '重新加载'
107
107
  },
108
+ Input: {
109
+ clear: '清除'
110
+ },
108
111
  Mask: {
109
112
  name: '遮罩层'
110
113
  },
111
114
  Modal: {
112
115
  ok: '我知道了'
113
116
  },
117
+ PasscodeInput: {
118
+ name: '密码输入框'
119
+ },
114
120
  PullToRefresh: {
115
121
  pulling: '下拉刷新',
116
122
  canRelease: '释放立即刷新',
117
123
  complete: '刷新成功'
118
124
  },
125
+ SearchBar: {
126
+ name: '搜索框'
127
+ },
119
128
  Slider: {
120
129
  name: '滑动输入条'
121
130
  },
@@ -93,17 +93,26 @@ declare const zhHK: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };
@@ -93,17 +93,26 @@ declare const zhTW: {
93
93
  failedToLoad: string;
94
94
  retry: string;
95
95
  };
96
+ Input: {
97
+ clear: string;
98
+ };
96
99
  Mask: {
97
100
  name: string;
98
101
  };
99
102
  Modal: {
100
103
  ok: string;
101
104
  };
105
+ PasscodeInput: {
106
+ name: string;
107
+ };
102
108
  PullToRefresh: {
103
109
  pulling: string;
104
110
  canRelease: string;
105
111
  complete: string;
106
112
  };
113
+ SearchBar: {
114
+ name: string;
115
+ };
107
116
  Slider: {
108
117
  name: string;
109
118
  };