antd-mobile 5.28.0 → 5.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/2x/bundle/antd-mobile.cjs.development.js +341 -284
  2. package/2x/bundle/antd-mobile.cjs.js +10 -9
  3. package/2x/bundle/antd-mobile.es.development.js +341 -284
  4. package/2x/bundle/antd-mobile.es.js +4969 -4923
  5. package/2x/bundle/antd-mobile.umd.development.js +341 -284
  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 +9 -2
  9. package/2x/cjs/components/ellipsis/ellipsis.d.ts +1 -0
  10. package/2x/cjs/components/ellipsis/ellipsis.js +3 -2
  11. package/2x/cjs/components/nav-bar/nav-bar.d.ts +2 -2
  12. package/2x/cjs/components/popover/popover.css +1 -1
  13. package/2x/cjs/components/popover/popover.patch.css +1 -0
  14. package/2x/cjs/components/popup/popup.js +7 -1
  15. package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +15 -16
  16. package/2x/cjs/components/stepper/index.d.ts +1 -1
  17. package/2x/cjs/components/stepper/stepper.d.ts +4 -2
  18. package/2x/cjs/components/stepper/stepper.js +21 -3
  19. package/2x/cjs/components/steps/steps.css +0 -1
  20. package/2x/cjs/components/swiper/swiper.js +6 -3
  21. package/2x/cjs/components/text-area/text-area.css +8 -0
  22. package/2x/cjs/components/text-area/text-area.js +16 -3
  23. package/2x/cjs/global/css-vars-patch.css +1 -0
  24. package/2x/cjs/index.d.ts +1 -1
  25. package/2x/cjs/locales/base.d.ts +1 -0
  26. package/2x/cjs/locales/base.js +2 -1
  27. package/2x/cjs/locales/en-US.d.ts +1 -0
  28. package/2x/cjs/locales/es-ES.d.ts +1 -0
  29. package/2x/cjs/locales/fa-IR.d.ts +1 -0
  30. package/2x/cjs/locales/fr-FR.d.ts +1 -0
  31. package/2x/cjs/locales/id-ID.d.ts +1 -0
  32. package/2x/cjs/locales/ja-JP.d.ts +1 -0
  33. package/2x/cjs/locales/kk-KZ.d.ts +1 -0
  34. package/2x/cjs/locales/ko-KR.d.ts +1 -0
  35. package/2x/cjs/locales/ko-KR.js +31 -2
  36. package/2x/cjs/locales/zh-CN.d.ts +1 -0
  37. package/2x/cjs/locales/zh-CN.js +2 -1
  38. package/2x/cjs/locales/zh-HK.d.ts +1 -0
  39. package/2x/cjs/locales/zh-HK.js +2 -1
  40. package/2x/cjs/locales/zh-TW.d.ts +1 -0
  41. package/2x/cjs/locales/zh-TW.js +2 -1
  42. package/2x/cjs/utils/reduce-and-restore-motion.js +7 -6
  43. package/2x/cjs/utils/render-imperatively.js +9 -3
  44. package/2x/es/components/ellipsis/ellipsis.d.ts +1 -0
  45. package/2x/es/components/ellipsis/ellipsis.js +3 -2
  46. package/2x/es/components/nav-bar/nav-bar.d.ts +2 -2
  47. package/2x/es/components/popover/popover.css +1 -1
  48. package/2x/es/components/popover/popover.patch.css +1 -0
  49. package/2x/es/components/popup/popup.js +7 -1
  50. package/2x/es/components/pull-to-refresh/pull-to-refresh.js +15 -16
  51. package/2x/es/components/stepper/index.d.ts +1 -1
  52. package/2x/es/components/stepper/stepper.d.ts +4 -2
  53. package/2x/es/components/stepper/stepper.js +19 -3
  54. package/2x/es/components/steps/steps.css +0 -1
  55. package/2x/es/components/swiper/swiper.js +6 -3
  56. package/2x/es/components/text-area/text-area.css +8 -0
  57. package/2x/es/components/text-area/text-area.js +16 -3
  58. package/2x/es/global/css-vars-patch.css +1 -0
  59. package/2x/es/index.d.ts +1 -1
  60. package/2x/es/locales/base.d.ts +1 -0
  61. package/2x/es/locales/base.js +2 -1
  62. package/2x/es/locales/en-US.d.ts +1 -0
  63. package/2x/es/locales/es-ES.d.ts +1 -0
  64. package/2x/es/locales/fa-IR.d.ts +1 -0
  65. package/2x/es/locales/fr-FR.d.ts +1 -0
  66. package/2x/es/locales/id-ID.d.ts +1 -0
  67. package/2x/es/locales/ja-JP.d.ts +1 -0
  68. package/2x/es/locales/kk-KZ.d.ts +1 -0
  69. package/2x/es/locales/ko-KR.d.ts +1 -0
  70. package/2x/es/locales/ko-KR.js +31 -2
  71. package/2x/es/locales/zh-CN.d.ts +1 -0
  72. package/2x/es/locales/zh-CN.js +2 -1
  73. package/2x/es/locales/zh-HK.d.ts +1 -0
  74. package/2x/es/locales/zh-HK.js +2 -1
  75. package/2x/es/locales/zh-TW.d.ts +1 -0
  76. package/2x/es/locales/zh-TW.js +2 -1
  77. package/2x/es/utils/reduce-and-restore-motion.js +7 -6
  78. package/2x/es/utils/render-imperatively.js +9 -3
  79. package/2x/package.json +3 -3
  80. package/bundle/antd-mobile.cjs.development.js +341 -284
  81. package/bundle/antd-mobile.cjs.js +10 -9
  82. package/bundle/antd-mobile.compatible.umd.js +1 -1
  83. package/bundle/antd-mobile.es.development.js +341 -284
  84. package/bundle/antd-mobile.es.js +4969 -4923
  85. package/bundle/antd-mobile.umd.development.js +341 -284
  86. package/bundle/antd-mobile.umd.js +10 -9
  87. package/bundle/css-vars-patch.css +1 -0
  88. package/bundle/style.css +1 -1
  89. package/cjs/components/ellipsis/ellipsis.d.ts +1 -0
  90. package/cjs/components/ellipsis/ellipsis.js +3 -2
  91. package/cjs/components/nav-bar/nav-bar.d.ts +2 -2
  92. package/cjs/components/popover/popover.css +1 -1
  93. package/cjs/components/popover/popover.patch.css +1 -0
  94. package/cjs/components/popup/popup.js +7 -1
  95. package/cjs/components/pull-to-refresh/pull-to-refresh.js +15 -16
  96. package/cjs/components/stepper/index.d.ts +1 -1
  97. package/cjs/components/stepper/stepper.d.ts +4 -2
  98. package/cjs/components/stepper/stepper.js +21 -3
  99. package/cjs/components/steps/steps.css +0 -1
  100. package/cjs/components/swiper/swiper.js +6 -3
  101. package/cjs/components/text-area/text-area.css +7 -0
  102. package/cjs/components/text-area/text-area.js +16 -3
  103. package/cjs/global/css-vars-patch.css +1 -0
  104. package/cjs/index.d.ts +1 -1
  105. package/cjs/locales/base.d.ts +1 -0
  106. package/cjs/locales/base.js +2 -1
  107. package/cjs/locales/en-US.d.ts +1 -0
  108. package/cjs/locales/es-ES.d.ts +1 -0
  109. package/cjs/locales/fa-IR.d.ts +1 -0
  110. package/cjs/locales/fr-FR.d.ts +1 -0
  111. package/cjs/locales/id-ID.d.ts +1 -0
  112. package/cjs/locales/ja-JP.d.ts +1 -0
  113. package/cjs/locales/kk-KZ.d.ts +1 -0
  114. package/cjs/locales/ko-KR.d.ts +1 -0
  115. package/cjs/locales/ko-KR.js +31 -2
  116. package/cjs/locales/zh-CN.d.ts +1 -0
  117. package/cjs/locales/zh-CN.js +2 -1
  118. package/cjs/locales/zh-HK.d.ts +1 -0
  119. package/cjs/locales/zh-HK.js +2 -1
  120. package/cjs/locales/zh-TW.d.ts +1 -0
  121. package/cjs/locales/zh-TW.js +2 -1
  122. package/cjs/utils/reduce-and-restore-motion.js +7 -6
  123. package/cjs/utils/render-imperatively.js +9 -3
  124. package/es/components/ellipsis/ellipsis.d.ts +1 -0
  125. package/es/components/ellipsis/ellipsis.js +3 -2
  126. package/es/components/nav-bar/nav-bar.d.ts +2 -2
  127. package/es/components/popover/popover.css +1 -1
  128. package/es/components/popover/popover.patch.css +1 -0
  129. package/es/components/popup/popup.js +7 -1
  130. package/es/components/pull-to-refresh/pull-to-refresh.js +15 -16
  131. package/es/components/stepper/index.d.ts +1 -1
  132. package/es/components/stepper/stepper.d.ts +4 -2
  133. package/es/components/stepper/stepper.js +19 -3
  134. package/es/components/steps/steps.css +0 -1
  135. package/es/components/swiper/swiper.js +6 -3
  136. package/es/components/text-area/text-area.css +7 -0
  137. package/es/components/text-area/text-area.js +16 -3
  138. package/es/global/css-vars-patch.css +1 -0
  139. package/es/index.d.ts +1 -1
  140. package/es/locales/base.d.ts +1 -0
  141. package/es/locales/base.js +2 -1
  142. package/es/locales/en-US.d.ts +1 -0
  143. package/es/locales/es-ES.d.ts +1 -0
  144. package/es/locales/fa-IR.d.ts +1 -0
  145. package/es/locales/fr-FR.d.ts +1 -0
  146. package/es/locales/id-ID.d.ts +1 -0
  147. package/es/locales/ja-JP.d.ts +1 -0
  148. package/es/locales/kk-KZ.d.ts +1 -0
  149. package/es/locales/ko-KR.d.ts +1 -0
  150. package/es/locales/ko-KR.js +31 -2
  151. package/es/locales/zh-CN.d.ts +1 -0
  152. package/es/locales/zh-CN.js +2 -1
  153. package/es/locales/zh-HK.d.ts +1 -0
  154. package/es/locales/zh-HK.js +2 -1
  155. package/es/locales/zh-TW.d.ts +1 -0
  156. package/es/locales/zh-TW.js +2 -1
  157. package/es/utils/reduce-and-restore-motion.js +7 -6
  158. package/es/utils/render-imperatively.js +9 -3
  159. package/package.json +3 -3
  160. package/umd/antd-mobile.js +1 -1
  161. package/umd/antd-mobile.js.LICENSE.txt +5 -4
@@ -60,6 +60,13 @@
60
60
  .adm-text-area-element[readonly] {
61
61
  pointer-events: none;
62
62
  }
63
+ .adm-text-area-element-hidden {
64
+ visibility: hidden;
65
+ position: absolute;
66
+ top: 0;
67
+ left: 0;
68
+ z-index: -1000;
69
+ }
63
70
  .adm-text-area-count {
64
71
  text-align: var(--count-text-align);
65
72
  color: var(--adm-color-weak);
@@ -25,6 +25,10 @@ export const TextArea = forwardRef((p, ref) => {
25
25
  devError('TextArea', '`value` prop on `TextArea` should not be `null`. Consider using an empty string to clear the component.');
26
26
  }
27
27
  const nativeTextAreaRef = useRef(null);
28
+ // https://github.com/ant-design/ant-design-mobile/issues/5961
29
+ const heightRef = useRef('auto');
30
+ // https://github.com/ant-design/ant-design-mobile/issues/6051
31
+ const hiddenTextAreaRef = useRef(null);
28
32
  useImperativeHandle(ref, () => ({
29
33
  clear: () => {
30
34
  setValue('');
@@ -44,9 +48,11 @@ export const TextArea = forwardRef((p, ref) => {
44
48
  useIsomorphicLayoutEffect(() => {
45
49
  if (!autoSize) return;
46
50
  const textArea = nativeTextAreaRef.current;
51
+ const hiddenTextArea = hiddenTextAreaRef.current;
47
52
  if (!textArea) return;
48
- textArea.style.height = 'auto';
49
- let height = textArea.scrollHeight;
53
+ textArea.style.height = heightRef.current;
54
+ if (!hiddenTextArea) return;
55
+ let height = hiddenTextArea.scrollHeight;
50
56
  if (typeof autoSize === 'object') {
51
57
  const computedStyle = window.getComputedStyle(textArea);
52
58
  const lineHeight = parseFloat(computedStyle.lineHeight);
@@ -57,6 +63,7 @@ export const TextArea = forwardRef((p, ref) => {
57
63
  height = Math.min(height, autoSize.maxRows * lineHeight);
58
64
  }
59
65
  }
66
+ heightRef.current = `${height}px`;
60
67
  textArea.style.height = `${height}px`;
61
68
  }, [value, autoSize]);
62
69
  const compositingRef = useRef(false);
@@ -107,6 +114,12 @@ export const TextArea = forwardRef((p, ref) => {
107
114
  onFocus: props.onFocus,
108
115
  onBlur: props.onBlur,
109
116
  onClick: props.onClick
110
- }), 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
+ })));
111
124
  });
112
125
  TextArea.defaultProps = defaultProps;
@@ -209,6 +209,7 @@
209
209
  }
210
210
  .adm-popover {
211
211
  z-index: 1030;
212
+ color: #333333;
212
213
  }
213
214
  .adm-popover.adm-popover-dark {
214
215
  color: #ffffff;
package/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';
@@ -4,6 +4,7 @@ export declare const base: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,7 +4,8 @@ export const base = {
4
4
  common: {
5
5
  confirm: 'Confirm',
6
6
  cancel: 'Cancel',
7
- loading: 'Loading'
7
+ loading: 'Loading',
8
+ close: 'Close'
8
9
  },
9
10
  Calendar: {
10
11
  markItems: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
@@ -4,6 +4,7 @@ declare const enUS: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,6 +4,7 @@ declare const esES: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,6 +4,7 @@ declare const faIR: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,6 +4,7 @@ declare const frFR: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,6 +4,7 @@ declare const idID: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,6 +4,7 @@ declare const jaJP: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,6 +4,7 @@ declare const kkKZ: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -4,6 +4,7 @@ declare const koKR: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -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;
@@ -4,6 +4,7 @@ declare const zhCN: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -6,7 +6,8 @@ const zhCN = 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: ['一', '二', '三', '四', '五', '六', '日'],
@@ -4,6 +4,7 @@ declare const zhHK: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -6,7 +6,8 @@ const zhHK = 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: ['一', '二', '三', '四', '五', '六', '日'],
@@ -4,6 +4,7 @@ declare const zhTW: {
4
4
  confirm: string;
5
5
  cancel: string;
6
6
  loading: string;
7
+ close: string;
7
8
  };
8
9
  Calendar: {
9
10
  markItems: string[];
@@ -6,7 +6,8 @@ const zhTW = 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: ['一', '二', '三', '四', '五', '六', '日'],
@@ -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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.28.0",
3
+ "version": "5.28.2",
4
4
  "dependencies": {
5
5
  "@floating-ui/dom": "^1.0.6",
6
6
  "@rc-component/mini-decimal": "^1.0.1",
7
- "@react-spring/web": "^9.5.5",
7
+ "@react-spring/web": "~9.6.0",
8
8
  "@use-gesture/react": "10.2.20",
9
9
  "ahooks": "^3.7.2",
10
10
  "antd-mobile-icons": "^0.3.0",
@@ -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",