antd-mobile 5.28.1 → 5.29.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 (273) hide show
  1. package/2x/bundle/antd-mobile.cjs.development.js +549 -317
  2. package/2x/bundle/antd-mobile.cjs.js +10 -9
  3. package/2x/bundle/antd-mobile.es.development.js +549 -317
  4. package/2x/bundle/antd-mobile.es.js +7650 -7398
  5. package/2x/bundle/antd-mobile.umd.development.js +549 -317
  6. package/2x/bundle/antd-mobile.umd.js +10 -9
  7. package/2x/bundle/css-vars-patch.css +1 -0
  8. package/2x/bundle/style.css +45 -34
  9. package/2x/cjs/components/action-sheet/action-sheet.css +1 -1
  10. package/2x/cjs/components/action-sheet/action-sheet.js +6 -2
  11. package/2x/cjs/components/avatar/avatar.d.ts +1 -1
  12. package/2x/cjs/components/avatar/avatar.js +2 -1
  13. package/2x/cjs/components/badge/badge.css +2 -2
  14. package/2x/cjs/components/button/button.css +2 -2
  15. package/2x/cjs/components/capsule-tabs/capsule-tabs.css +2 -2
  16. package/2x/cjs/components/check-list/check-list-item.js +3 -1
  17. package/2x/cjs/components/check-list/check-list.d.ts +1 -0
  18. package/2x/cjs/components/check-list/check-list.js +2 -0
  19. package/2x/cjs/components/check-list/context.d.ts +1 -0
  20. package/2x/cjs/components/checkbox/checkbox.css +2 -2
  21. package/2x/cjs/components/ellipsis/ellipsis.js +1 -1
  22. package/2x/cjs/components/image/image.css +1 -1
  23. package/2x/cjs/components/index-bar/index-bar.css +4 -4
  24. package/2x/cjs/components/input/input.d.ts +1 -1
  25. package/2x/cjs/components/jumbo-tabs/jumbo-tabs.css +2 -2
  26. package/2x/cjs/components/notice-bar/notice-bar.css +1 -1
  27. package/2x/cjs/components/number-keyboard/number-keyboard.js +10 -6
  28. package/2x/cjs/components/popover/index.d.ts +1 -1
  29. package/2x/cjs/components/popover/popover.css +2 -2
  30. package/2x/cjs/components/popover/popover.d.ts +2 -2
  31. package/2x/cjs/components/popover/popover.js +1 -1
  32. package/2x/cjs/components/popover/popover.patch.css +1 -0
  33. package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +15 -16
  34. package/2x/cjs/components/radio/radio.css +2 -2
  35. package/2x/cjs/components/search-bar/search-bar.css +1 -1
  36. package/2x/cjs/components/selector/selector.css +1 -1
  37. package/2x/cjs/components/selector/selector.js +10 -2
  38. package/2x/cjs/components/side-bar/side-bar.css +1 -1
  39. package/2x/cjs/components/slider/slider.css +3 -3
  40. package/2x/cjs/components/stepper/index.d.ts +1 -1
  41. package/2x/cjs/components/stepper/stepper.css +2 -2
  42. package/2x/cjs/components/stepper/stepper.d.ts +4 -2
  43. package/2x/cjs/components/stepper/stepper.js +21 -3
  44. package/2x/cjs/components/swipe-action/swipe-action.css +1 -1
  45. package/2x/cjs/components/switch/switch.css +2 -2
  46. package/2x/cjs/components/tabs/tabs.js +5 -2
  47. package/2x/cjs/components/text-area/text-area.css +8 -0
  48. package/2x/cjs/components/text-area/text-area.d.ts +1 -1
  49. package/2x/cjs/components/text-area/text-area.js +12 -2
  50. package/2x/cjs/components/virtual-input/virtual-input.js +12 -2
  51. package/2x/cjs/global/css-vars-patch.css +1 -0
  52. package/2x/cjs/global/global.css +5 -2
  53. package/2x/cjs/global/theme-default.css +5 -2
  54. package/2x/cjs/index.d.ts +1 -1
  55. package/2x/cjs/locales/base.d.ts +3 -0
  56. package/2x/cjs/locales/base.js +3 -0
  57. package/2x/cjs/locales/en-US.d.ts +3 -0
  58. package/2x/cjs/locales/es-ES.d.ts +3 -0
  59. package/2x/cjs/locales/fa-IR.d.ts +3 -0
  60. package/2x/cjs/locales/fr-FR.d.ts +3 -0
  61. package/2x/cjs/locales/id-ID.d.ts +3 -0
  62. package/2x/cjs/locales/ja-JP.d.ts +3 -0
  63. package/2x/cjs/locales/kk-KZ.d.ts +3 -0
  64. package/2x/cjs/locales/ko-KR.d.ts +3 -0
  65. package/2x/cjs/locales/ko-KR.js +31 -2
  66. package/2x/cjs/locales/zh-CN.d.ts +3 -0
  67. package/2x/cjs/locales/zh-CN.js +3 -0
  68. package/2x/cjs/locales/zh-HK.d.ts +3 -0
  69. package/2x/cjs/locales/zh-TW.d.ts +3 -0
  70. package/2x/cjs/utils/reduce-and-restore-motion.js +7 -6
  71. package/2x/cjs/utils/render-imperatively.js +9 -3
  72. package/2x/es/components/action-sheet/action-sheet.css +1 -1
  73. package/2x/es/components/action-sheet/action-sheet.js +6 -2
  74. package/2x/es/components/avatar/avatar.d.ts +1 -1
  75. package/2x/es/components/avatar/avatar.js +2 -1
  76. package/2x/es/components/badge/badge.css +2 -2
  77. package/2x/es/components/button/button.css +2 -2
  78. package/2x/es/components/capsule-tabs/capsule-tabs.css +2 -2
  79. package/2x/es/components/check-list/check-list-item.js +3 -1
  80. package/2x/es/components/check-list/check-list.d.ts +1 -0
  81. package/2x/es/components/check-list/check-list.js +2 -0
  82. package/2x/es/components/check-list/context.d.ts +1 -0
  83. package/2x/es/components/checkbox/checkbox.css +2 -2
  84. package/2x/es/components/ellipsis/ellipsis.js +1 -1
  85. package/2x/es/components/image/image.css +1 -1
  86. package/2x/es/components/index-bar/index-bar.css +4 -4
  87. package/2x/es/components/input/input.d.ts +1 -1
  88. package/2x/es/components/jumbo-tabs/jumbo-tabs.css +2 -2
  89. package/2x/es/components/notice-bar/notice-bar.css +1 -1
  90. package/2x/es/components/number-keyboard/number-keyboard.js +10 -6
  91. package/2x/es/components/popover/index.d.ts +1 -1
  92. package/2x/es/components/popover/popover.css +2 -2
  93. package/2x/es/components/popover/popover.d.ts +2 -2
  94. package/2x/es/components/popover/popover.js +1 -1
  95. package/2x/es/components/popover/popover.patch.css +1 -0
  96. package/2x/es/components/pull-to-refresh/pull-to-refresh.js +15 -16
  97. package/2x/es/components/radio/radio.css +2 -2
  98. package/2x/es/components/search-bar/search-bar.css +1 -1
  99. package/2x/es/components/selector/selector.css +1 -1
  100. package/2x/es/components/selector/selector.js +10 -2
  101. package/2x/es/components/side-bar/side-bar.css +1 -1
  102. package/2x/es/components/slider/slider.css +3 -3
  103. package/2x/es/components/stepper/index.d.ts +1 -1
  104. package/2x/es/components/stepper/stepper.css +2 -2
  105. package/2x/es/components/stepper/stepper.d.ts +4 -2
  106. package/2x/es/components/stepper/stepper.js +19 -3
  107. package/2x/es/components/swipe-action/swipe-action.css +1 -1
  108. package/2x/es/components/switch/switch.css +2 -2
  109. package/2x/es/components/tabs/tabs.js +5 -2
  110. package/2x/es/components/text-area/text-area.css +8 -0
  111. package/2x/es/components/text-area/text-area.d.ts +1 -1
  112. package/2x/es/components/text-area/text-area.js +12 -2
  113. package/2x/es/components/virtual-input/virtual-input.js +12 -2
  114. package/2x/es/global/css-vars-patch.css +1 -0
  115. package/2x/es/global/global.css +5 -2
  116. package/2x/es/global/theme-default.css +5 -2
  117. package/2x/es/index.d.ts +1 -1
  118. package/2x/es/locales/base.d.ts +3 -0
  119. package/2x/es/locales/base.js +3 -0
  120. package/2x/es/locales/en-US.d.ts +3 -0
  121. package/2x/es/locales/es-ES.d.ts +3 -0
  122. package/2x/es/locales/fa-IR.d.ts +3 -0
  123. package/2x/es/locales/fr-FR.d.ts +3 -0
  124. package/2x/es/locales/id-ID.d.ts +3 -0
  125. package/2x/es/locales/ja-JP.d.ts +3 -0
  126. package/2x/es/locales/kk-KZ.d.ts +3 -0
  127. package/2x/es/locales/ko-KR.d.ts +3 -0
  128. package/2x/es/locales/ko-KR.js +31 -2
  129. package/2x/es/locales/zh-CN.d.ts +3 -0
  130. package/2x/es/locales/zh-CN.js +3 -0
  131. package/2x/es/locales/zh-HK.d.ts +3 -0
  132. package/2x/es/locales/zh-TW.d.ts +3 -0
  133. package/2x/es/utils/reduce-and-restore-motion.js +7 -6
  134. package/2x/es/utils/render-imperatively.js +9 -3
  135. package/2x/package.json +2 -2
  136. package/bundle/antd-mobile.cjs.development.js +549 -317
  137. package/bundle/antd-mobile.cjs.js +10 -9
  138. package/bundle/antd-mobile.compatible.umd.js +1 -1
  139. package/bundle/antd-mobile.es.development.js +549 -317
  140. package/bundle/antd-mobile.es.js +7650 -7398
  141. package/bundle/antd-mobile.umd.development.js +549 -317
  142. package/bundle/antd-mobile.umd.js +10 -9
  143. package/bundle/css-vars-patch.css +1 -0
  144. package/bundle/style.css +1 -1
  145. package/cjs/components/action-sheet/action-sheet.css +1 -1
  146. package/cjs/components/action-sheet/action-sheet.js +6 -2
  147. package/cjs/components/avatar/avatar.d.ts +1 -1
  148. package/cjs/components/avatar/avatar.js +2 -1
  149. package/cjs/components/badge/badge.css +2 -2
  150. package/cjs/components/button/button.css +2 -2
  151. package/cjs/components/capsule-tabs/capsule-tabs.css +2 -2
  152. package/cjs/components/check-list/check-list-item.js +3 -1
  153. package/cjs/components/check-list/check-list.d.ts +1 -0
  154. package/cjs/components/check-list/check-list.js +2 -0
  155. package/cjs/components/check-list/context.d.ts +1 -0
  156. package/cjs/components/checkbox/checkbox.css +2 -2
  157. package/cjs/components/ellipsis/ellipsis.js +1 -1
  158. package/cjs/components/image/image.css +1 -1
  159. package/cjs/components/index-bar/index-bar.css +4 -4
  160. package/cjs/components/input/input.d.ts +1 -1
  161. package/cjs/components/jumbo-tabs/jumbo-tabs.css +2 -2
  162. package/cjs/components/notice-bar/notice-bar.css +1 -1
  163. package/cjs/components/number-keyboard/number-keyboard.js +10 -6
  164. package/cjs/components/popover/index.d.ts +1 -1
  165. package/cjs/components/popover/popover.css +2 -2
  166. package/cjs/components/popover/popover.d.ts +2 -2
  167. package/cjs/components/popover/popover.js +1 -1
  168. package/cjs/components/popover/popover.patch.css +1 -0
  169. package/cjs/components/pull-to-refresh/pull-to-refresh.js +15 -16
  170. package/cjs/components/radio/radio.css +2 -2
  171. package/cjs/components/search-bar/search-bar.css +1 -1
  172. package/cjs/components/selector/selector.css +1 -1
  173. package/cjs/components/selector/selector.js +10 -2
  174. package/cjs/components/side-bar/side-bar.css +1 -1
  175. package/cjs/components/slider/slider.css +3 -3
  176. package/cjs/components/stepper/index.d.ts +1 -1
  177. package/cjs/components/stepper/stepper.css +2 -2
  178. package/cjs/components/stepper/stepper.d.ts +4 -2
  179. package/cjs/components/stepper/stepper.js +21 -3
  180. package/cjs/components/swipe-action/swipe-action.css +1 -1
  181. package/cjs/components/switch/switch.css +2 -2
  182. package/cjs/components/tabs/tabs.js +5 -2
  183. package/cjs/components/text-area/text-area.css +7 -0
  184. package/cjs/components/text-area/text-area.d.ts +1 -1
  185. package/cjs/components/text-area/text-area.js +12 -2
  186. package/cjs/components/virtual-input/virtual-input.js +12 -2
  187. package/cjs/global/css-vars-patch.css +1 -0
  188. package/cjs/global/global.css +5 -2
  189. package/cjs/global/theme-default.css +5 -2
  190. package/cjs/index.d.ts +1 -1
  191. package/cjs/locales/base.d.ts +3 -0
  192. package/cjs/locales/base.js +3 -0
  193. package/cjs/locales/en-US.d.ts +3 -0
  194. package/cjs/locales/es-ES.d.ts +3 -0
  195. package/cjs/locales/fa-IR.d.ts +3 -0
  196. package/cjs/locales/fr-FR.d.ts +3 -0
  197. package/cjs/locales/id-ID.d.ts +3 -0
  198. package/cjs/locales/ja-JP.d.ts +3 -0
  199. package/cjs/locales/kk-KZ.d.ts +3 -0
  200. package/cjs/locales/ko-KR.d.ts +3 -0
  201. package/cjs/locales/ko-KR.js +31 -2
  202. package/cjs/locales/zh-CN.d.ts +3 -0
  203. package/cjs/locales/zh-CN.js +3 -0
  204. package/cjs/locales/zh-HK.d.ts +3 -0
  205. package/cjs/locales/zh-TW.d.ts +3 -0
  206. package/cjs/utils/reduce-and-restore-motion.js +7 -6
  207. package/cjs/utils/render-imperatively.js +9 -3
  208. package/es/components/action-sheet/action-sheet.css +1 -1
  209. package/es/components/action-sheet/action-sheet.js +6 -2
  210. package/es/components/avatar/avatar.d.ts +1 -1
  211. package/es/components/avatar/avatar.js +2 -1
  212. package/es/components/badge/badge.css +2 -2
  213. package/es/components/button/button.css +2 -2
  214. package/es/components/capsule-tabs/capsule-tabs.css +2 -2
  215. package/es/components/check-list/check-list-item.js +3 -1
  216. package/es/components/check-list/check-list.d.ts +1 -0
  217. package/es/components/check-list/check-list.js +2 -0
  218. package/es/components/check-list/context.d.ts +1 -0
  219. package/es/components/checkbox/checkbox.css +2 -2
  220. package/es/components/ellipsis/ellipsis.js +1 -1
  221. package/es/components/image/image.css +1 -1
  222. package/es/components/index-bar/index-bar.css +4 -4
  223. package/es/components/input/input.d.ts +1 -1
  224. package/es/components/jumbo-tabs/jumbo-tabs.css +2 -2
  225. package/es/components/notice-bar/notice-bar.css +1 -1
  226. package/es/components/number-keyboard/number-keyboard.js +10 -6
  227. package/es/components/popover/index.d.ts +1 -1
  228. package/es/components/popover/popover.css +2 -2
  229. package/es/components/popover/popover.d.ts +2 -2
  230. package/es/components/popover/popover.js +1 -1
  231. package/es/components/popover/popover.patch.css +1 -0
  232. package/es/components/pull-to-refresh/pull-to-refresh.js +15 -16
  233. package/es/components/radio/radio.css +2 -2
  234. package/es/components/search-bar/search-bar.css +1 -1
  235. package/es/components/selector/selector.css +1 -1
  236. package/es/components/selector/selector.js +10 -2
  237. package/es/components/side-bar/side-bar.css +1 -1
  238. package/es/components/slider/slider.css +3 -3
  239. package/es/components/stepper/index.d.ts +1 -1
  240. package/es/components/stepper/stepper.css +2 -2
  241. package/es/components/stepper/stepper.d.ts +4 -2
  242. package/es/components/stepper/stepper.js +19 -3
  243. package/es/components/swipe-action/swipe-action.css +1 -1
  244. package/es/components/switch/switch.css +2 -2
  245. package/es/components/tabs/tabs.js +5 -2
  246. package/es/components/text-area/text-area.css +7 -0
  247. package/es/components/text-area/text-area.d.ts +1 -1
  248. package/es/components/text-area/text-area.js +12 -2
  249. package/es/components/virtual-input/virtual-input.js +12 -2
  250. package/es/global/css-vars-patch.css +1 -0
  251. package/es/global/global.css +5 -2
  252. package/es/global/theme-default.css +5 -2
  253. package/es/index.d.ts +1 -1
  254. package/es/locales/base.d.ts +3 -0
  255. package/es/locales/base.js +3 -0
  256. package/es/locales/en-US.d.ts +3 -0
  257. package/es/locales/es-ES.d.ts +3 -0
  258. package/es/locales/fa-IR.d.ts +3 -0
  259. package/es/locales/fr-FR.d.ts +3 -0
  260. package/es/locales/id-ID.d.ts +3 -0
  261. package/es/locales/ja-JP.d.ts +3 -0
  262. package/es/locales/kk-KZ.d.ts +3 -0
  263. package/es/locales/ko-KR.d.ts +3 -0
  264. package/es/locales/ko-KR.js +31 -2
  265. package/es/locales/zh-CN.d.ts +3 -0
  266. package/es/locales/zh-CN.js +3 -0
  267. package/es/locales/zh-HK.d.ts +3 -0
  268. package/es/locales/zh-TW.d.ts +3 -0
  269. package/es/utils/reduce-and-restore-motion.js +7 -6
  270. package/es/utils/render-imperatively.js +9 -3
  271. package/package.json +2 -2
  272. package/umd/antd-mobile.js +1 -1
  273. package/umd/antd-mobile.js.LICENSE.txt +5 -4
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
- import { InputProps } from '../input';
3
+ import { InputProps, InputRef } from '../input';
4
4
  declare type ValueProps<ValueType> = {
5
5
  allowEmpty: true;
6
6
  value?: ValueType | null;
@@ -30,5 +30,7 @@ export declare type StringStepperProps = BaseStepperProps<string> & {
30
30
  stringMode: true;
31
31
  };
32
32
  export declare type StepperProps = NumberStepperProps | StringStepperProps;
33
- export declare function Stepper<ValueType extends number | string>(p: StepperProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
33
+ export declare type StepperRef = Pick<InputRef, 'blur' | 'focus' | 'nativeElement'>;
34
+ export declare function InnerStepper<ValueType extends number | string>(p: StepperProps, ref: React.ForwardedRef<StepperRef>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
35
+ export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<StepperRef>>;
34
36
  export {};
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { useEffect, useState } from 'react';
2
+ import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react';
3
3
  import { MinusOutline, AddOutline } from 'antd-mobile-icons';
4
4
  import useMergedState from 'rc-util/lib/hooks/useMergedState';
5
5
  import getMiniDecimal, { toFixed } from '@rc-component/mini-decimal';
@@ -14,7 +14,7 @@ const defaultProps = {
14
14
  disabled: false,
15
15
  allowEmpty: false
16
16
  };
17
- export function Stepper(p) {
17
+ export function InnerStepper(p, ref) {
18
18
  const props = mergeProps(defaultProps, p);
19
19
  const {
20
20
  defaultValue = 0,
@@ -33,6 +33,21 @@ export function Stepper(p) {
33
33
  const {
34
34
  locale
35
35
  } = useConfig();
36
+ // ========================== Ref ==========================
37
+ useImperativeHandle(ref, () => ({
38
+ focus: () => {
39
+ var _a;
40
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
41
+ },
42
+ blur: () => {
43
+ var _a;
44
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
45
+ },
46
+ get nativeElement() {
47
+ var _a, _b;
48
+ return (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.nativeElement) !== null && _b !== void 0 ? _b : null;
49
+ }
50
+ }));
36
51
  // ========================== Parse / Format ==========================
37
52
  const fixedValue = value => {
38
53
  const fixedValue = digits !== undefined ? toFixed(value.toString(), '.', digits) : value;
@@ -200,4 +215,5 @@ export function Stepper(p) {
200
215
  color: 'primary',
201
216
  "aria-label": locale.Stepper.increase
202
217
  }, React.createElement(AddOutline, null))));
203
- }
218
+ }
219
+ export const Stepper = forwardRef(InnerStepper);
@@ -36,7 +36,7 @@
36
36
  .adm-swipe-action-action-button.adm-button {
37
37
  --border-radius: 0;
38
38
  --border-width: 0;
39
- --text-color: var(--adm-color-white);
39
+ --text-color: var(--adm-color-text-light-solid);
40
40
  padding-left: 40px;
41
41
  padding-right: 40px;
42
42
  }
@@ -57,7 +57,7 @@
57
57
  width: calc(var(--height) - 2 * var(--border-width));
58
58
  height: calc(var(--height) - 2 * var(--border-width));
59
59
  border-radius: calc(var(--height) - 2 * var(--border-width));
60
- background: var(--adm-color-white);
60
+ background: var(--adm-color-text-light-solid);
61
61
  position: absolute;
62
62
  z-index: 2;
63
63
  top: var(--border-width);
@@ -93,7 +93,7 @@
93
93
 
94
94
  .adm-switch.adm-switch-checked .adm-switch-inner {
95
95
  margin: 0 calc(var(--height) - var(--border-width) + 10px) 0 20px;
96
- color: var(--adm-color-white);
96
+ color: var(--adm-color-text-light-solid);
97
97
  }
98
98
 
99
99
  .adm-switch.adm-switch-disabled {
@@ -182,7 +182,8 @@ export const Tabs = p => {
182
182
  className: `${classPrefix}-tab-list`,
183
183
  ref: tabListContainerRef,
184
184
  scrollLeft: scrollLeft,
185
- onScroll: updateMask
185
+ onScroll: updateMask,
186
+ role: 'tablist'
186
187
  }, React.createElement(animated.div, {
187
188
  ref: activeLineRef,
188
189
  className: `${classPrefix}-tab-line`,
@@ -209,7 +210,9 @@ export const Tabs = p => {
209
210
  className: classNames(`${classPrefix}-tab`, {
210
211
  [`${classPrefix}-tab-active`]: pane.key === activeKey,
211
212
  [`${classPrefix}-tab-disabled`]: pane.props.disabled
212
- })
213
+ }),
214
+ role: 'tab',
215
+ "aria-selected": pane.key === activeKey
213
216
  }, pane.props.title)))))), panes.map(pane => {
214
217
  if (pane.props.children === undefined) {
215
218
  return null;
@@ -70,6 +70,14 @@
70
70
  pointer-events: none;
71
71
  }
72
72
 
73
+ .adm-text-area-element-hidden {
74
+ visibility: hidden;
75
+ position: absolute;
76
+ top: 0;
77
+ left: 0;
78
+ z-index: -1000;
79
+ }
80
+
73
81
  .adm-text-area-count {
74
82
  text-align: var(--count-text-align);
75
83
  color: var(--adm-color-weak);
@@ -21,7 +21,7 @@ export declare type TextAreaRef = {
21
21
  blur: () => void;
22
22
  nativeElement: HTMLTextAreaElement | null;
23
23
  };
24
- export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "onClick" | "disabled" | "name" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "autoComplete" | "autoFocus" | "readOnly"> & {
24
+ export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "onClick" | "disabled" | "name" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "autoFocus" | "autoComplete" | "readOnly"> & {
25
25
  onChange?: ((val: string) => void) | undefined;
26
26
  value?: string | undefined;
27
27
  defaultValue?: string | undefined;
@@ -27,6 +27,8 @@ export const TextArea = forwardRef((p, ref) => {
27
27
  const nativeTextAreaRef = useRef(null);
28
28
  // https://github.com/ant-design/ant-design-mobile/issues/5961
29
29
  const heightRef = useRef('auto');
30
+ // https://github.com/ant-design/ant-design-mobile/issues/6051
31
+ const hiddenTextAreaRef = useRef(null);
30
32
  useImperativeHandle(ref, () => ({
31
33
  clear: () => {
32
34
  setValue('');
@@ -46,9 +48,11 @@ export const TextArea = forwardRef((p, ref) => {
46
48
  useIsomorphicLayoutEffect(() => {
47
49
  if (!autoSize) return;
48
50
  const textArea = nativeTextAreaRef.current;
51
+ const hiddenTextArea = hiddenTextAreaRef.current;
49
52
  if (!textArea) return;
50
53
  textArea.style.height = heightRef.current;
51
- let height = textArea.scrollHeight;
54
+ if (!hiddenTextArea) return;
55
+ let height = hiddenTextArea.scrollHeight;
52
56
  if (typeof autoSize === 'object') {
53
57
  const computedStyle = window.getComputedStyle(textArea);
54
58
  const lineHeight = parseFloat(computedStyle.lineHeight);
@@ -110,6 +114,12 @@ export const TextArea = forwardRef((p, ref) => {
110
114
  onFocus: props.onFocus,
111
115
  onBlur: props.onBlur,
112
116
  onClick: props.onClick
113
- }), count));
117
+ }), count, autoSize && React.createElement("textarea", {
118
+ ref: hiddenTextAreaRef,
119
+ className: `${classPrefix}-element ${classPrefix}-element-hidden`,
120
+ value: value,
121
+ "aria-hidden": true,
122
+ readOnly: true
123
+ })));
114
124
  });
115
125
  TextArea.defaultProps = defaultProps;
@@ -5,6 +5,7 @@ import { usePropsValue } from '../../utils/use-props-value';
5
5
  import classNames from 'classnames';
6
6
  import { CloseCircleFill } from 'antd-mobile-icons';
7
7
  import { useIsomorphicLayoutEffect } from 'ahooks';
8
+ import { useConfig } from '../config-provider';
8
9
  const classPrefix = 'adm-virtual-input';
9
10
  const defaultProps = {
10
11
  defaultValue: ''
@@ -15,6 +16,9 @@ export const VirtualInput = forwardRef((p, ref) => {
15
16
  const rootRef = useRef(null);
16
17
  const contentRef = useRef(null);
17
18
  const [hasFocus, setHasFocus] = useState(false);
19
+ const {
20
+ locale
21
+ } = useConfig();
18
22
  function scrollToEnd() {
19
23
  const root = rootRef.current;
20
24
  if (!root) return;
@@ -84,7 +88,11 @@ export const VirtualInput = forwardRef((p, ref) => {
84
88
  onClick: props.onClick
85
89
  }, React.createElement("div", {
86
90
  className: `${classPrefix}-content`,
87
- ref: contentRef
91
+ ref: contentRef,
92
+ role: 'option',
93
+ tabIndex: props.disabled ? undefined : 0,
94
+ "aria-disabled": props.disabled,
95
+ "aria-label": props.placeholder
88
96
  }, value, React.createElement("div", {
89
97
  className: `${classPrefix}-caret-container`
90
98
  }, hasFocus && React.createElement("div", {
@@ -96,7 +104,9 @@ export const VirtualInput = forwardRef((p, ref) => {
96
104
  e.stopPropagation();
97
105
  setValue('');
98
106
  (_a = props.onClear) === null || _a === void 0 ? void 0 : _a.call(props);
99
- }
107
+ },
108
+ role: 'button',
109
+ "aria-label": locale.Input.clear
100
110
  }, React.createElement(CloseCircleFill, null)), !value && React.createElement("div", {
101
111
  className: `${classPrefix}-placeholder`
102
112
  }, props.placeholder), keyboardElement));
@@ -267,6 +267,7 @@
267
267
 
268
268
  .adm-popover {
269
269
  z-index: 1030;
270
+ color: #333333;
270
271
  }
271
272
 
272
273
  .adm-popover.adm-popover-dark {
@@ -16,14 +16,17 @@
16
16
  --adm-color-success: #00b578;
17
17
  --adm-color-warning: #ff8f1f;
18
18
  --adm-color-danger: #ff3141;
19
- --adm-color-white: #ffffff;
20
19
  --adm-color-text: #333333;
21
20
  --adm-color-text-secondary: #666666;
22
21
  --adm-color-weak: #999999;
23
22
  --adm-color-light: #cccccc;
24
23
  --adm-color-border: #eeeeee;
25
- --adm-color-box: #f5f5f5;
26
24
  --adm-color-background: #ffffff;
25
+ --adm-color-white: #ffffff;
26
+ --adm-color-box: #f5f5f5;
27
+ --adm-color-text-light-solid: var(--adm-color-white);
28
+ --adm-color-text-dark-solid: #000000;
29
+ --adm-color-fill-content: var(--adm-color-box);
27
30
  --adm-font-size-main: var(--adm-font-size-5);
28
31
  --adm-font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',
29
32
  helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',
@@ -16,14 +16,17 @@
16
16
  --adm-color-success: #00b578;
17
17
  --adm-color-warning: #ff8f1f;
18
18
  --adm-color-danger: #ff3141;
19
- --adm-color-white: #ffffff;
20
19
  --adm-color-text: #333333;
21
20
  --adm-color-text-secondary: #666666;
22
21
  --adm-color-weak: #999999;
23
22
  --adm-color-light: #cccccc;
24
23
  --adm-color-border: #eeeeee;
25
- --adm-color-box: #f5f5f5;
26
24
  --adm-color-background: #ffffff;
25
+ --adm-color-white: #ffffff;
26
+ --adm-color-box: #f5f5f5;
27
+ --adm-color-text-light-solid: var(--adm-color-white);
28
+ --adm-color-text-dark-solid: #000000;
29
+ --adm-color-fill-content: var(--adm-color-box);
27
30
  --adm-font-size-main: var(--adm-font-size-5);
28
31
  --adm-font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',
29
32
  helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',
package/2x/es/index.d.ts CHANGED
@@ -133,7 +133,7 @@ export type { SpaceProps } from './components/space';
133
133
  export { default as SpinLoading } from './components/spin-loading';
134
134
  export type { SpinLoadingProps } from './components/spin-loading';
135
135
  export { default as Stepper } from './components/stepper';
136
- export type { StepperProps } from './components/stepper';
136
+ export type { StepperProps, StepperRef } from './components/stepper';
137
137
  export { default as Steps } from './components/steps';
138
138
  export type { StepsProps, StepProps } from './components/steps';
139
139
  export { default as SwipeAction } from './components/swipe-action';
@@ -127,5 +127,8 @@ export declare const base: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export declare type Locale = typeof base;
@@ -127,5 +127,8 @@ export const base = {
127
127
  },
128
128
  Switch: {
129
129
  name: 'Switch'
130
+ },
131
+ Selector: {
132
+ name: 'Selector'
130
133
  }
131
134
  };
@@ -127,5 +127,8 @@ declare const enUS: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default enUS;
@@ -127,5 +127,8 @@ declare const esES: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default esES;
@@ -127,5 +127,8 @@ declare const faIR: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default faIR;
@@ -127,5 +127,8 @@ declare const frFR: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default frFR;
@@ -127,5 +127,8 @@ declare const idID: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default idID;
@@ -127,5 +127,8 @@ declare const jaJP: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default jaJP;
@@ -127,5 +127,8 @@ declare const kkKZ: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default kkKZ;
@@ -127,5 +127,8 @@ declare const koKR: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default koKR;
@@ -6,7 +6,8 @@ const koKR = mergeLocale(base, {
6
6
  common: {
7
7
  confirm: '확인',
8
8
  cancel: '취소',
9
- loading: '로딩중'
9
+ loading: '로딩중',
10
+ close: '닫기'
10
11
  },
11
12
  Calendar: {
12
13
  markItems: ['월', '화', '수', '목', '금', '토', '일'],
@@ -18,6 +19,9 @@ const koKR = mergeLocale(base, {
18
19
  Dialog: {
19
20
  ok: '확인'
20
21
  },
22
+ DatePicker: {
23
+ tillNow: '지금까지'
24
+ },
21
25
  ErrorBlock: {
22
26
  default: {
23
27
  title: '문제가 발생했습니다',
@@ -88,7 +92,16 @@ const koKR = mergeLocale(base, {
88
92
  }
89
93
  },
90
94
  ImageUploader: {
91
- uploading: '업로드 중...'
95
+ uploading: '업로드 중...',
96
+ upload: '업로드'
97
+ },
98
+ InfiniteScroll: {
99
+ noMore: '불러올 데이터 없음',
100
+ failedToLoad: '불러오기 실패',
101
+ retry: '재시도'
102
+ },
103
+ Input: {
104
+ clear: '지우기'
92
105
  },
93
106
  Mask: {
94
107
  name: '마스크'
@@ -96,10 +109,26 @@ const koKR = mergeLocale(base, {
96
109
  Modal: {
97
110
  ok: '확인'
98
111
  },
112
+ PasscodeInput: {
113
+ name: '비밀번호 입력'
114
+ },
99
115
  PullToRefresh: {
100
116
  pulling: '스크롤을 당겨서 새로고침하십시오',
101
117
  canRelease: '새로고침 하려면 놓으십시오',
102
118
  complete: '새로고침 완료'
119
+ },
120
+ SearchBar: {
121
+ name: '검색바'
122
+ },
123
+ Slider: {
124
+ name: '슬라이더'
125
+ },
126
+ Stepper: {
127
+ decrease: '감소',
128
+ increase: '증가'
129
+ },
130
+ Switch: {
131
+ name: '스위치'
103
132
  }
104
133
  });
105
134
  export default koKR;
@@ -127,5 +127,8 @@ declare const zhCN: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default zhCN;
@@ -129,6 +129,9 @@ const zhCN = mergeLocale(base, {
129
129
  },
130
130
  Switch: {
131
131
  name: '开关'
132
+ },
133
+ Selector: {
134
+ name: '选择组'
132
135
  }
133
136
  });
134
137
  export default zhCN;
@@ -127,5 +127,8 @@ declare const zhHK: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default zhHK;
@@ -127,5 +127,8 @@ declare const zhTW: {
127
127
  Switch: {
128
128
  name: string;
129
129
  };
130
+ Selector: {
131
+ name: string;
132
+ };
130
133
  };
131
134
  export default zhTW;
@@ -24,11 +24,12 @@ export function restoreMotion() {
24
24
  export function isMotionReduced() {
25
25
  return reduced;
26
26
  }
27
+ function subscribe(onStoreChange) {
28
+ subscribers.add(onStoreChange);
29
+ return () => {
30
+ subscribers.delete(onStoreChange);
31
+ };
32
+ }
27
33
  export function useMotionReduced() {
28
- return useSyncExternalStore(onStoreChange => {
29
- subscribers.add(onStoreChange);
30
- return () => {
31
- subscribers.delete(onStoreChange);
32
- };
33
- }, isMotionReduced);
34
+ return useSyncExternalStore(subscribe, isMotionReduced);
34
35
  }
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
2
3
  import { renderToBody } from './render-to-body';
3
4
  export function renderImperatively(element) {
@@ -45,10 +46,15 @@ export function renderImperatively(element) {
45
46
  ref: wrapperRef
46
47
  }));
47
48
  return {
48
- close: () => {
49
+ close: () => __awaiter(this, void 0, void 0, function* () {
49
50
  var _a;
50
- (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.close();
51
- },
51
+ if (!wrapperRef.current) {
52
+ // it means the wrapper is not mounted yet, call `unmount` directly
53
+ unmount();
54
+ } else {
55
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.close();
56
+ }
57
+ }),
52
58
  replace: element => {
53
59
  var _a;
54
60
  (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.replace(element);
package/2x/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.28.1",
3
+ "version": "5.29.0",
4
4
  "dependencies": {
5
5
  "@floating-ui/dom": "^1.0.6",
6
6
  "@rc-component/mini-decimal": "^1.0.1",
@@ -14,7 +14,7 @@
14
14
  "lodash": "^4.17.21",
15
15
  "rc-field-form": "~1.27.3",
16
16
  "rc-util": "^5.24.8",
17
- "react-is": "^17.0.2",
17
+ "react-is": "^18.2.0",
18
18
  "runes": "^0.4.3",
19
19
  "staged-components": "^1.1.3",
20
20
  "tslib": "^2.4.1",