antd-mobile 5.17.2 → 5.20.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 (239) hide show
  1. package/2x/bundle/antd-mobile.cjs.js +47 -19174
  2. package/2x/bundle/antd-mobile.compatible.umd.js +25815 -0
  3. package/2x/bundle/antd-mobile.es.js +16532 -17127
  4. package/2x/bundle/antd-mobile.umd.js +64 -0
  5. package/2x/bundle/style.css +237 -273
  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/form/context.d.ts +1 -1
  16. package/2x/cjs/components/form/form-item.js +9 -4
  17. package/2x/cjs/components/image/test/image.test.js +57 -8
  18. package/2x/cjs/components/image-viewer/slide.js +75 -56
  19. package/2x/cjs/components/input/input.js +9 -2
  20. package/2x/cjs/components/modal/show.d.ts +1 -1
  21. package/2x/cjs/components/notice-bar/notice-bar.css +9 -0
  22. package/2x/cjs/components/notice-bar/notice-bar.js +5 -3
  23. package/2x/cjs/components/number-keyboard/number-keyboard.css +11 -15
  24. package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  25. package/2x/cjs/components/number-keyboard/number-keyboard.js +19 -17
  26. package/2x/cjs/components/passcode-input/index.d.ts +1 -1
  27. package/2x/cjs/components/passcode-input/passcode-input.css +12 -12
  28. package/2x/cjs/components/passcode-input/passcode-input.js +16 -8
  29. package/2x/cjs/components/rate/rate.css +1 -0
  30. package/2x/cjs/components/rate/rate.js +38 -5
  31. package/2x/cjs/components/rate/star.js +0 -10
  32. package/2x/cjs/components/result/result.d.ts +1 -1
  33. package/2x/cjs/components/result/result.js +7 -1
  34. package/2x/cjs/components/search-bar/search-bar.js +12 -2
  35. package/2x/cjs/components/swipe-action/swipe-action.d.ts +2 -0
  36. package/2x/cjs/components/swipe-action/swipe-action.js +34 -6
  37. package/2x/cjs/components/swiper/swiper.js +14 -0
  38. package/2x/cjs/components/switch/switch.d.ts +2 -1
  39. package/2x/cjs/components/switch/switch.js +16 -3
  40. package/2x/cjs/locales/base.d.ts +9 -0
  41. package/2x/cjs/locales/base.js +9 -0
  42. package/2x/cjs/locales/en-US.d.ts +9 -0
  43. package/2x/cjs/locales/es-ES.d.ts +9 -0
  44. package/2x/cjs/locales/fa-IR.d.ts +9 -0
  45. package/2x/cjs/locales/fr-FR.d.ts +9 -0
  46. package/2x/cjs/locales/id-ID.d.ts +9 -0
  47. package/2x/cjs/locales/id-ID.js +13 -0
  48. package/2x/cjs/locales/kk-KZ.d.ts +9 -0
  49. package/2x/cjs/locales/ko-KR.d.ts +9 -0
  50. package/2x/cjs/locales/zh-CN.d.ts +9 -0
  51. package/2x/cjs/locales/zh-CN.js +9 -0
  52. package/2x/cjs/locales/zh-HK.d.ts +9 -0
  53. package/2x/cjs/locales/zh-TW.d.ts +9 -0
  54. package/2x/cjs/utils/matrix.d.ts +10 -0
  55. package/2x/cjs/utils/matrix.js +60 -0
  56. package/2x/cjs/utils/merge-locale.d.ts +1 -1
  57. package/2x/cjs/utils/merge-locale.js +15 -5
  58. package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -1
  59. package/2x/cjs/utils/use-props-value.js +1 -1
  60. package/2x/cjs/utils/use-resize-effect.js +3 -1
  61. package/2x/cjs/utils/with-default-props.js +2 -6
  62. package/2x/es/components/action-sheet/action-sheet.d.ts +1 -1
  63. package/2x/es/components/button/button.js +1 -1
  64. package/2x/es/components/calendar/calendar.d.ts +3 -3
  65. package/2x/es/components/calendar/index.d.ts +1 -1
  66. package/2x/es/components/cascader/cascader.d.ts +2 -0
  67. package/2x/es/components/cascader/index.d.ts +1 -0
  68. package/2x/es/components/cascader-view/cascader-view.d.ts +2 -1
  69. package/2x/es/components/cascader-view/cascader-view.js +2 -1
  70. package/2x/es/components/dialog/show.d.ts +1 -1
  71. package/2x/es/components/form/context.d.ts +1 -1
  72. package/2x/es/components/form/form-item.js +8 -4
  73. package/2x/es/components/image/test/image.test.js +54 -8
  74. package/2x/es/components/image-viewer/slide.js +73 -56
  75. package/2x/es/components/input/input.js +8 -2
  76. package/2x/es/components/modal/show.d.ts +1 -1
  77. package/2x/es/components/notice-bar/notice-bar.css +9 -0
  78. package/2x/es/components/notice-bar/notice-bar.js +5 -3
  79. package/2x/es/components/number-keyboard/number-keyboard.css +11 -15
  80. package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  81. package/2x/es/components/number-keyboard/number-keyboard.js +19 -17
  82. package/2x/es/components/passcode-input/index.d.ts +1 -1
  83. package/2x/es/components/passcode-input/passcode-input.css +12 -12
  84. package/2x/es/components/passcode-input/passcode-input.js +15 -8
  85. package/2x/es/components/rate/rate.css +1 -0
  86. package/2x/es/components/rate/rate.js +32 -5
  87. package/2x/es/components/rate/star.js +0 -10
  88. package/2x/es/components/result/result.d.ts +1 -1
  89. package/2x/es/components/result/result.js +6 -1
  90. package/2x/es/components/search-bar/search-bar.js +12 -2
  91. package/2x/es/components/swipe-action/swipe-action.d.ts +2 -0
  92. package/2x/es/components/swipe-action/swipe-action.js +34 -6
  93. package/2x/es/components/swiper/swiper.js +14 -0
  94. package/2x/es/components/switch/switch.d.ts +2 -1
  95. package/2x/es/components/switch/switch.js +15 -3
  96. package/2x/es/locales/base.d.ts +9 -0
  97. package/2x/es/locales/base.js +9 -0
  98. package/2x/es/locales/en-US.d.ts +9 -0
  99. package/2x/es/locales/es-ES.d.ts +9 -0
  100. package/2x/es/locales/fa-IR.d.ts +9 -0
  101. package/2x/es/locales/fr-FR.d.ts +9 -0
  102. package/2x/es/locales/id-ID.d.ts +9 -0
  103. package/2x/es/locales/id-ID.js +13 -0
  104. package/2x/es/locales/kk-KZ.d.ts +9 -0
  105. package/2x/es/locales/ko-KR.d.ts +9 -0
  106. package/2x/es/locales/zh-CN.d.ts +9 -0
  107. package/2x/es/locales/zh-CN.js +9 -0
  108. package/2x/es/locales/zh-HK.d.ts +9 -0
  109. package/2x/es/locales/zh-TW.d.ts +9 -0
  110. package/2x/es/utils/matrix.d.ts +10 -0
  111. package/2x/es/utils/matrix.js +27 -0
  112. package/2x/es/utils/merge-locale.d.ts +1 -1
  113. package/2x/es/utils/merge-locale.js +17 -3
  114. package/2x/es/utils/use-drag-and-pinch.d.ts +1 -1
  115. package/2x/es/utils/use-props-value.js +1 -1
  116. package/2x/es/utils/use-resize-effect.js +3 -1
  117. package/2x/es/utils/with-default-props.js +2 -4
  118. package/2x/package.json +6 -6
  119. package/2x/umd/antd-mobile.js +25815 -2
  120. package/bundle/antd-mobile.cjs.js +47 -19174
  121. package/bundle/antd-mobile.compatible.umd.js +25815 -0
  122. package/bundle/antd-mobile.es.js +16532 -17127
  123. package/bundle/antd-mobile.umd.js +64 -0
  124. package/bundle/style.css +1 -4080
  125. package/cjs/components/action-sheet/action-sheet.d.ts +1 -1
  126. package/cjs/components/button/button.js +1 -1
  127. package/cjs/components/calendar/calendar.d.ts +3 -3
  128. package/cjs/components/calendar/index.d.ts +1 -1
  129. package/cjs/components/cascader/cascader.d.ts +2 -0
  130. package/cjs/components/cascader/index.d.ts +1 -0
  131. package/cjs/components/cascader-view/cascader-view.d.ts +2 -1
  132. package/cjs/components/cascader-view/cascader-view.js +2 -1
  133. package/cjs/components/dialog/show.d.ts +1 -1
  134. package/cjs/components/form/context.d.ts +1 -1
  135. package/cjs/components/form/form-item.js +9 -4
  136. package/cjs/components/image/test/image.test.js +57 -8
  137. package/cjs/components/image-viewer/slide.js +75 -56
  138. package/cjs/components/input/input.js +9 -2
  139. package/cjs/components/modal/show.d.ts +1 -1
  140. package/cjs/components/notice-bar/notice-bar.css +8 -0
  141. package/cjs/components/notice-bar/notice-bar.js +5 -3
  142. package/cjs/components/number-keyboard/number-keyboard.css +11 -14
  143. package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  144. package/cjs/components/number-keyboard/number-keyboard.js +19 -17
  145. package/cjs/components/passcode-input/index.d.ts +1 -1
  146. package/cjs/components/passcode-input/passcode-input.css +12 -12
  147. package/cjs/components/passcode-input/passcode-input.js +16 -8
  148. package/cjs/components/rate/rate.css +1 -0
  149. package/cjs/components/rate/rate.js +38 -5
  150. package/cjs/components/rate/star.js +0 -10
  151. package/cjs/components/result/result.d.ts +1 -1
  152. package/cjs/components/result/result.js +7 -1
  153. package/cjs/components/search-bar/search-bar.js +12 -2
  154. package/cjs/components/swipe-action/swipe-action.d.ts +2 -0
  155. package/cjs/components/swipe-action/swipe-action.js +34 -6
  156. package/cjs/components/swiper/swiper.js +14 -0
  157. package/cjs/components/switch/switch.d.ts +2 -1
  158. package/cjs/components/switch/switch.js +16 -3
  159. package/cjs/locales/base.d.ts +9 -0
  160. package/cjs/locales/base.js +9 -0
  161. package/cjs/locales/en-US.d.ts +9 -0
  162. package/cjs/locales/es-ES.d.ts +9 -0
  163. package/cjs/locales/fa-IR.d.ts +9 -0
  164. package/cjs/locales/fr-FR.d.ts +9 -0
  165. package/cjs/locales/id-ID.d.ts +9 -0
  166. package/cjs/locales/id-ID.js +13 -0
  167. package/cjs/locales/kk-KZ.d.ts +9 -0
  168. package/cjs/locales/ko-KR.d.ts +9 -0
  169. package/cjs/locales/zh-CN.d.ts +9 -0
  170. package/cjs/locales/zh-CN.js +9 -0
  171. package/cjs/locales/zh-HK.d.ts +9 -0
  172. package/cjs/locales/zh-TW.d.ts +9 -0
  173. package/cjs/utils/matrix.d.ts +10 -0
  174. package/cjs/utils/matrix.js +60 -0
  175. package/cjs/utils/merge-locale.d.ts +1 -1
  176. package/cjs/utils/merge-locale.js +15 -5
  177. package/cjs/utils/use-drag-and-pinch.d.ts +1 -1
  178. package/cjs/utils/use-props-value.js +1 -1
  179. package/cjs/utils/use-resize-effect.js +3 -1
  180. package/cjs/utils/with-default-props.js +2 -6
  181. package/es/components/action-sheet/action-sheet.d.ts +1 -1
  182. package/es/components/button/button.js +1 -1
  183. package/es/components/calendar/calendar.d.ts +3 -3
  184. package/es/components/calendar/index.d.ts +1 -1
  185. package/es/components/cascader/cascader.d.ts +2 -0
  186. package/es/components/cascader/index.d.ts +1 -0
  187. package/es/components/cascader-view/cascader-view.d.ts +2 -1
  188. package/es/components/cascader-view/cascader-view.js +2 -1
  189. package/es/components/dialog/show.d.ts +1 -1
  190. package/es/components/form/context.d.ts +1 -1
  191. package/es/components/form/form-item.js +8 -4
  192. package/es/components/image/test/image.test.js +54 -8
  193. package/es/components/image-viewer/slide.js +73 -56
  194. package/es/components/input/input.js +8 -2
  195. package/es/components/modal/show.d.ts +1 -1
  196. package/es/components/notice-bar/notice-bar.css +8 -0
  197. package/es/components/notice-bar/notice-bar.js +5 -3
  198. package/es/components/number-keyboard/number-keyboard.css +11 -14
  199. package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  200. package/es/components/number-keyboard/number-keyboard.js +19 -17
  201. package/es/components/passcode-input/index.d.ts +1 -1
  202. package/es/components/passcode-input/passcode-input.css +12 -12
  203. package/es/components/passcode-input/passcode-input.js +15 -8
  204. package/es/components/rate/rate.css +1 -0
  205. package/es/components/rate/rate.js +32 -5
  206. package/es/components/rate/star.js +0 -10
  207. package/es/components/result/result.d.ts +1 -1
  208. package/es/components/result/result.js +6 -1
  209. package/es/components/search-bar/search-bar.js +12 -2
  210. package/es/components/swipe-action/swipe-action.d.ts +2 -0
  211. package/es/components/swipe-action/swipe-action.js +34 -6
  212. package/es/components/swiper/swiper.js +14 -0
  213. package/es/components/switch/switch.d.ts +2 -1
  214. package/es/components/switch/switch.js +15 -3
  215. package/es/locales/base.d.ts +9 -0
  216. package/es/locales/base.js +9 -0
  217. package/es/locales/en-US.d.ts +9 -0
  218. package/es/locales/es-ES.d.ts +9 -0
  219. package/es/locales/fa-IR.d.ts +9 -0
  220. package/es/locales/fr-FR.d.ts +9 -0
  221. package/es/locales/id-ID.d.ts +9 -0
  222. package/es/locales/id-ID.js +13 -0
  223. package/es/locales/kk-KZ.d.ts +9 -0
  224. package/es/locales/ko-KR.d.ts +9 -0
  225. package/es/locales/zh-CN.d.ts +9 -0
  226. package/es/locales/zh-CN.js +9 -0
  227. package/es/locales/zh-HK.d.ts +9 -0
  228. package/es/locales/zh-TW.d.ts +9 -0
  229. package/es/utils/matrix.d.ts +10 -0
  230. package/es/utils/matrix.js +27 -0
  231. package/es/utils/merge-locale.d.ts +1 -1
  232. package/es/utils/merge-locale.js +17 -3
  233. package/es/utils/use-drag-and-pinch.d.ts +1 -1
  234. package/es/utils/use-props-value.js +1 -1
  235. package/es/utils/use-resize-effect.js +3 -1
  236. package/es/utils/with-default-props.js +2 -4
  237. package/package.json +6 -6
  238. package/umd/antd-mobile.js +1 -1
  239. package/2x/umd/antd-mobile.js.LICENSE.txt +0 -35
@@ -57,13 +57,18 @@ const NumberKeyboard = p => {
57
57
  const keys = (0, _react.useMemo)(() => {
58
58
  const defaultKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];
59
59
  const keyList = randomOrder ? (0, _shuffle.shuffle)(defaultKeys) : defaultKeys;
60
+ const customKeys = Array.isArray(customKey) ? customKey : [customKey];
60
61
  keyList.push('0');
61
62
 
62
63
  if (confirmText) {
63
- keyList.push(customKey || '');
64
+ if (customKeys.length === 2) {
65
+ keyList.splice(9, 0, customKeys.pop());
66
+ }
67
+
68
+ keyList.push(customKeys[0] || '');
64
69
  } else {
65
- keyList.splice(9, 0, customKey || '');
66
- keyList.push('BACKSPACE');
70
+ keyList.splice(9, 0, customKeys[0] || '');
71
+ keyList.push(customKeys[1] || 'BACKSPACE');
67
72
  }
68
73
 
69
74
  return keyList;
@@ -86,8 +91,7 @@ const NumberKeyboard = p => {
86
91
  const onBackspacePressEnd = () => {
87
92
  clearTimeout(timeoutRef.current);
88
93
  clearInterval(intervalRef.current);
89
- }; // 点击键盘按键
90
-
94
+ };
91
95
 
92
96
  const onKeyPress = (e, key) => {
93
97
  var _a, _b;
@@ -109,18 +113,17 @@ const NumberKeyboard = p => {
109
113
  break;
110
114
 
111
115
  default:
112
- // customKey 不存在时,点击该键不应该触发 onInput
116
+ // onInput should't be called when customKey doesn't exist
113
117
  if (key !== '') onInput === null || onInput === void 0 ? void 0 : onInput(key);
114
118
  break;
115
119
  }
116
- }; // 渲染 title 和 close button
117
-
120
+ };
118
121
 
119
122
  const renderHeader = () => {
120
123
  if (!showCloseButton && !title) return null;
121
124
  return _react.default.createElement("div", {
122
125
  className: (0, _classnames.default)(`${classPrefix}-header`, {
123
- 'with-title': !!title
126
+ [`${classPrefix}-header-with-title`]: !!title
124
127
  })
125
128
  }, title && _react.default.createElement("div", {
126
129
  className: `${classPrefix}-title`
@@ -134,15 +137,14 @@ const NumberKeyboard = p => {
134
137
  role: 'button',
135
138
  title: 'CLOSE'
136
139
  }, _react.default.createElement(_antdMobileIcons.DownOutline, null)));
137
- }; // 渲染基础键盘按键
138
-
140
+ };
139
141
 
140
142
  const renderKey = (key, index) => {
141
143
  const isNumberKey = /^\d$/.test(key);
142
144
  const className = (0, _classnames.default)(`${classPrefix}-key`, {
143
- 'number-key': isNumberKey,
144
- 'sign-key': !isNumberKey && key,
145
- 'mid-key': index === 9 && !!confirmText
145
+ [`${classPrefix}-key-number`]: isNumberKey,
146
+ [`${classPrefix}-key-sign`]: !isNumberKey && key,
147
+ [`${classPrefix}-key-mid`]: index === 9 && !!confirmText && keys.length < 12
146
148
  });
147
149
  const ariaProps = key ? {
148
150
  role: 'button',
@@ -186,12 +188,12 @@ const NumberKeyboard = p => {
186
188
  className: `${classPrefix}-wrapper`
187
189
  }, _react.default.createElement("div", {
188
190
  className: (0, _classnames.default)(`${classPrefix}-main`, {
189
- 'confirmed-style': !!confirmText
191
+ [`${classPrefix}-main-confirmed-style`]: !!confirmText
190
192
  })
191
193
  }, keys.map(renderKey)), !!confirmText && _react.default.createElement("div", {
192
194
  className: `${classPrefix}-confirm`
193
195
  }, _react.default.createElement("div", {
194
- className: `${classPrefix}-key extra-key bs-key`,
196
+ className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-bs`,
195
197
  onTouchStart: () => {
196
198
  onBackspacePressStart();
197
199
  },
@@ -202,7 +204,7 @@ const NumberKeyboard = p => {
202
204
  title: 'BACKSPACE',
203
205
  role: 'button'
204
206
  }, _react.default.createElement(_antdMobileIcons.TextDeletionOutline, null)), _react.default.createElement("div", {
205
- className: `${classPrefix}-key extra-key ok-key`,
207
+ className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-ok`,
206
208
  onTouchEnd: e => onKeyPress(e, 'OK'),
207
209
  role: 'button'
208
210
  }, confirmText))), props.safeArea && _react.default.createElement("div", {
@@ -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 => {
@@ -3,6 +3,7 @@
3
3
  --active-color: #ffd21e;
4
4
  --inactive-color: var(--adm-color-border);
5
5
  display: inline-flex;
6
+ touch-action: pan-y;
6
7
  }
7
8
  .adm-rate-box {
8
9
  position: relative;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Rate = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
@@ -17,8 +17,16 @@ var _usePropsValue = require("../../utils/use-props-value");
17
17
 
18
18
  var _star = require("./star");
19
19
 
20
+ var _react2 = require("@use-gesture/react");
21
+
22
+ var _bound = require("../../utils/bound");
23
+
20
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
25
 
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); }
27
+
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; }
29
+
22
30
  const classPrefix = `adm-rate`;
23
31
  const defaultProps = {
24
32
  count: 5,
@@ -32,6 +40,7 @@ const defaultProps = {
32
40
  const Rate = p => {
33
41
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
34
42
  const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
43
+ const containerRef = (0, _react.useRef)(null);
35
44
  const starList = Array(props.count).fill(null);
36
45
 
37
46
  function renderStar(v, half) {
@@ -49,13 +58,37 @@ const Rate = p => {
49
58
  } else {
50
59
  setValue(v);
51
60
  }
52
- }
61
+ },
62
+ role: 'radio',
63
+ "aria-checked": value >= v,
64
+ "aria-label": '' + v
53
65
  }, props.character);
54
66
  }
55
67
 
56
- return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
57
- className: classPrefix
58
- }, starList.map((_, i) => _react.default.createElement("div", {
68
+ const bind = (0, _react2.useDrag)(state => {
69
+ if (props.readOnly) return;
70
+ const {
71
+ xy: [clientX]
72
+ } = state;
73
+ const container = containerRef.current;
74
+ if (!container) return;
75
+ const rect = container.getBoundingClientRect();
76
+ const rawValue = (clientX - rect.left) / rect.width * props.count;
77
+ const roundedValue = props.allowHalf ? Math.round(rawValue * 2) / 2 : Math.round(rawValue);
78
+ setValue((0, _bound.bound)(roundedValue, 0, props.count));
79
+ }, {
80
+ axis: 'x',
81
+ preventScroll: true,
82
+ pointer: {
83
+ touch: true
84
+ }
85
+ });
86
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", Object.assign({
87
+ className: classPrefix,
88
+ role: 'radiogroup',
89
+ "aria-readonly": props.readOnly,
90
+ ref: containerRef
91
+ }, bind()), starList.map((_, i) => _react.default.createElement("div", {
59
92
  key: i,
60
93
  className: (0, _classnames.default)(`${classPrefix}-box`)
61
94
  }, props.allowHalf && renderStar(i + 0.5, true), renderStar(i + 1, false)))));
@@ -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
  });
@@ -20,6 +20,7 @@ export declare type SwipeActionProps = {
20
20
  closeOnAction?: boolean;
21
21
  children: ReactNode;
22
22
  stopPropagation?: PropagationEvent[];
23
+ onActionsReveal?: (side: 'left' | 'right') => void;
23
24
  } & NativeProps<'--background'>;
24
25
  export declare const SwipeAction: React.ForwardRefExoticComponent<{
25
26
  rightActions?: Action[] | undefined;
@@ -29,6 +30,7 @@ export declare const SwipeAction: React.ForwardRefExoticComponent<{
29
30
  closeOnAction?: boolean | undefined;
30
31
  children: ReactNode;
31
32
  stopPropagation?: "click"[] | undefined;
33
+ onActionsReveal?: ((side: 'left' | 'right') => void) | undefined;
32
34
  } & {
33
35
  className?: string | undefined;
34
36
  style?: (React.CSSProperties & Partial<Record<"--background", string>>) | undefined;
@@ -65,8 +65,26 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
65
65
  }
66
66
  }), []);
67
67
  const draggingRef = (0, _react.useRef)(false);
68
+ const dragCancelRef = (0, _react.useRef)(null);
69
+
70
+ function forceCancelDrag() {
71
+ var _a;
72
+
73
+ (_a = dragCancelRef.current) === null || _a === void 0 ? void 0 : _a.call(dragCancelRef);
74
+ draggingRef.current = false;
75
+ }
76
+
68
77
  const bind = (0, _react2.useDrag)(state => {
69
- draggingRef.current = true;
78
+ var _a;
79
+
80
+ dragCancelRef.current = state.cancel;
81
+ if (!state.intentional) return;
82
+
83
+ if (state.down) {
84
+ draggingRef.current = true;
85
+ }
86
+
87
+ if (!draggingRef.current) return;
70
88
  const [offsetX] = state.offset;
71
89
 
72
90
  if (state.last) {
@@ -82,9 +100,15 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
82
100
  position = 0;
83
101
  }
84
102
 
103
+ const targetX = (0, _nearest.nearest)([-rightWidth, 0, leftWidth], position);
85
104
  api.start({
86
- x: (0, _nearest.nearest)([-rightWidth, 0, leftWidth], position)
105
+ x: targetX
87
106
  });
107
+
108
+ if (targetX !== 0) {
109
+ (_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, targetX > 0 ? 'left' : 'right');
110
+ }
111
+
88
112
  window.setTimeout(() => {
89
113
  draggingRef.current = false;
90
114
  });
@@ -109,17 +133,21 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
109
133
  preventScroll: true,
110
134
  pointer: {
111
135
  touch: true
112
- }
136
+ },
137
+ triggerAllEvents: true
113
138
  });
114
139
 
115
140
  function close() {
116
141
  api.start({
117
142
  x: 0
118
143
  });
144
+ forceCancelDrag();
119
145
  }
120
146
 
121
147
  (0, _react.useImperativeHandle)(ref, () => ({
122
148
  show: (side = 'right') => {
149
+ var _a;
150
+
123
151
  if (side === 'right') {
124
152
  api.start({
125
153
  x: -getRightWidth()
@@ -129,6 +157,8 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
129
157
  x: getLeftWidth()
130
158
  });
131
159
  }
160
+
161
+ (_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, side);
132
162
  },
133
163
  close
134
164
  }));
@@ -200,9 +230,7 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
200
230
  if (x.goal !== 0) {
201
231
  e.preventDefault();
202
232
  e.stopPropagation();
203
- api.start({
204
- x: 0
205
- });
233
+ close();
206
234
  }
207
235
  }
208
236
  }, _react.default.createElement(_web.animated.div, {
@@ -141,7 +141,18 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
141
141
  });
142
142
  }
143
143
  }), [count]);
144
+ const dragCancelRef = (0, _react.useRef)(null);
145
+
146
+ function forceCancelDrag() {
147
+ var _a;
148
+
149
+ (_a = dragCancelRef.current) === null || _a === void 0 ? void 0 : _a.call(dragCancelRef);
150
+ draggingRef.current = false;
151
+ }
152
+
144
153
  const bind = (0, _react2.useDrag)(state => {
154
+ dragCancelRef.current = state.cancel;
155
+ if (!state.intentional) return;
145
156
  const slidePixels = getSlidePixels();
146
157
  if (!slidePixels) return;
147
158
  const paramIndex = isVertical ? 1 : 0;
@@ -170,6 +181,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
170
181
  const slidePixels = getSlidePixels();
171
182
  return [position.get() / 100 * slidePixels, position.get() / 100 * slidePixels];
172
183
  },
184
+ triggerAllEvents: true,
173
185
  bounds: () => {
174
186
  if (loop) return {};
175
187
  const slidePixels = getSlidePixels();
@@ -284,6 +296,8 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
284
296
  if (draggingRef.current) {
285
297
  e.stopPropagation();
286
298
  }
299
+
300
+ forceCancelDrag();
287
301
  }
288
302
  }, props.allowTouchMove ? bind() : {}), renderTrackInner()), props.indicator === undefined ? _react.default.createElement("div", {
289
303
  className: `${classPrefix}-indicator`
@@ -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
  }
@@ -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
  },