antd-mobile 5.0.0-rc.22 → 5.0.0-rc.26

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 (291) hide show
  1. package/2x/README.md +7 -6
  2. package/2x/cjs/components/badge/badge.css +18 -10
  3. package/2x/cjs/components/badge/badge.d.ts +1 -0
  4. package/2x/cjs/components/badge/badge.js +4 -5
  5. package/2x/cjs/components/button/button.css +3 -3
  6. package/2x/cjs/components/calendar/calendar.js +3 -1
  7. package/2x/cjs/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
  8. package/2x/cjs/components/checkbox/check-icon.js +4 -13
  9. package/2x/cjs/components/checkbox/checkbox.css +5 -14
  10. package/2x/cjs/components/checkbox/checkbox.js +3 -5
  11. package/2x/cjs/components/checkbox/indeterminate-icon.d.ts +3 -0
  12. package/2x/cjs/components/checkbox/indeterminate-icon.js +24 -0
  13. package/2x/cjs/components/date-picker/date-picker.d.ts +1 -1
  14. package/2x/cjs/components/date-picker-view/date-picker-view.d.ts +3 -2
  15. package/2x/cjs/components/ellipsis/ellipsis.js +3 -1
  16. package/2x/cjs/components/floating-bubble/floating-bubble.css +1 -0
  17. package/2x/cjs/components/floating-panel/floating-panel.d.ts +7 -5
  18. package/2x/cjs/components/floating-panel/floating-panel.js +11 -1
  19. package/2x/cjs/components/form/form-item.css +3 -2
  20. package/2x/cjs/components/form/form-item.d.ts +2 -2
  21. package/2x/cjs/components/form/form-item.js +9 -5
  22. package/2x/cjs/components/form/form.css +3 -3
  23. package/2x/cjs/components/form/form.d.ts +5 -4
  24. package/2x/cjs/components/form/index.css +6 -5
  25. package/2x/cjs/components/form/index.d.ts +5 -4
  26. package/2x/cjs/components/image-uploader/image-uploader.js +1 -1
  27. package/2x/cjs/components/image-viewer/image-viewer.d.ts +8 -2
  28. package/2x/cjs/components/image-viewer/image-viewer.js +19 -6
  29. package/2x/cjs/components/image-viewer/index.d.ts +6 -2
  30. package/2x/cjs/components/image-viewer/slide.js +2 -1
  31. package/2x/cjs/components/image-viewer/slides.d.ts +7 -3
  32. package/2x/cjs/components/image-viewer/slides.js +18 -11
  33. package/2x/cjs/components/input/input.d.ts +2 -2
  34. package/2x/cjs/components/input/input.js +7 -3
  35. package/2x/cjs/components/list/list.css +2 -6
  36. package/2x/cjs/components/modal/modal.css +25 -20
  37. package/2x/cjs/components/modal/modal.js +8 -12
  38. package/2x/cjs/components/passcode-input/passcode-input.d.ts +2 -2
  39. package/2x/cjs/components/picker/picker.css +10 -2
  40. package/2x/cjs/components/picker/picker.d.ts +1 -1
  41. package/2x/cjs/components/picker-view/picker-view.css +4 -2
  42. package/2x/cjs/components/picker-view/picker-view.d.ts +1 -1
  43. package/2x/cjs/components/picker-view/wheel.js +5 -3
  44. package/2x/cjs/components/popover/arrow.d.ts +3 -0
  45. package/2x/cjs/components/popover/arrow.js +26 -0
  46. package/2x/cjs/components/popover/index.d.ts +7 -15
  47. package/2x/cjs/components/popover/index.js +4 -2
  48. package/2x/cjs/components/popover/popover-menu.css +63 -0
  49. package/2x/cjs/components/popover/popover-menu.d.ts +20 -0
  50. package/{cjs/components/popover/pop-menu.js → 2x/cjs/components/popover/popover-menu.js} +23 -26
  51. package/2x/cjs/components/popover/popover.css +90 -318
  52. package/2x/cjs/components/popover/popover.d.ts +9 -8
  53. package/2x/cjs/components/popover/popover.js +11 -17
  54. package/2x/cjs/components/radio/radio.css +4 -7
  55. package/2x/cjs/components/radio/radio.js +1 -3
  56. package/2x/cjs/components/search-bar/search-bar.css +1 -1
  57. package/2x/cjs/components/selector/selector.css +14 -6
  58. package/2x/cjs/components/selector/selector.d.ts +2 -1
  59. package/2x/cjs/components/selector/selector.js +3 -2
  60. package/2x/cjs/components/swiper/swiper.js +1 -1
  61. package/2x/cjs/components/switch/switch.css +8 -3
  62. package/2x/cjs/components/tabs/tabs.js +2 -2
  63. package/2x/cjs/components/text-area/text-area.css +9 -9
  64. package/2x/cjs/components/text-area/text-area.d.ts +2 -2
  65. package/2x/cjs/components/text-area/text-area.js +41 -32
  66. package/2x/cjs/components/virtual-input/virtual-input.js +3 -1
  67. package/2x/cjs/utils/get-scroll-parent.js +1 -1
  68. package/2x/cjs/utils/use-ref-state.js +1 -1
  69. package/2x/cjs/utils/use-resize-effect.js +1 -3
  70. package/2x/cjs/utils/use-tab-list-scroll.js +1 -3
  71. package/2x/es/components/badge/badge.css +18 -10
  72. package/2x/es/components/badge/badge.d.ts +1 -0
  73. package/2x/es/components/badge/badge.js +4 -5
  74. package/2x/es/components/button/button.css +3 -3
  75. package/2x/es/components/calendar/calendar.js +3 -2
  76. package/2x/es/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
  77. package/2x/es/components/checkbox/check-icon.js +4 -13
  78. package/2x/es/components/checkbox/checkbox.css +5 -14
  79. package/2x/es/components/checkbox/checkbox.js +2 -5
  80. package/2x/es/components/checkbox/indeterminate-icon.d.ts +3 -0
  81. package/2x/es/components/checkbox/indeterminate-icon.js +10 -0
  82. package/2x/es/components/date-picker/date-picker.d.ts +1 -1
  83. package/2x/es/components/date-picker-view/date-picker-view.d.ts +3 -2
  84. package/2x/es/components/ellipsis/ellipsis.js +3 -2
  85. package/2x/es/components/floating-bubble/floating-bubble.css +1 -0
  86. package/2x/es/components/floating-panel/floating-panel.d.ts +7 -5
  87. package/2x/es/components/floating-panel/floating-panel.js +9 -1
  88. package/2x/es/components/form/form-item.css +3 -2
  89. package/2x/es/components/form/form-item.d.ts +2 -2
  90. package/2x/es/components/form/form-item.js +9 -5
  91. package/2x/es/components/form/form.css +3 -3
  92. package/2x/es/components/form/form.d.ts +5 -4
  93. package/2x/es/components/form/index.css +6 -5
  94. package/2x/es/components/form/index.d.ts +5 -4
  95. package/2x/es/components/image-uploader/image-uploader.js +3 -3
  96. package/2x/es/components/image-viewer/image-viewer.d.ts +8 -2
  97. package/2x/es/components/image-viewer/image-viewer.js +15 -4
  98. package/2x/es/components/image-viewer/index.d.ts +6 -2
  99. package/2x/es/components/image-viewer/slide.js +2 -1
  100. package/2x/es/components/image-viewer/slides.d.ts +7 -3
  101. package/2x/es/components/image-viewer/slides.js +19 -10
  102. package/2x/es/components/input/input.d.ts +2 -2
  103. package/2x/es/components/input/input.js +7 -4
  104. package/2x/es/components/list/list.css +2 -6
  105. package/2x/es/components/modal/modal.css +25 -20
  106. package/2x/es/components/modal/modal.js +8 -12
  107. package/2x/es/components/passcode-input/passcode-input.d.ts +2 -2
  108. package/2x/es/components/picker/picker.css +10 -2
  109. package/2x/es/components/picker/picker.d.ts +1 -1
  110. package/2x/es/components/picker-view/picker-view.css +4 -2
  111. package/2x/es/components/picker-view/picker-view.d.ts +1 -1
  112. package/2x/es/components/picker-view/wheel.js +5 -4
  113. package/2x/es/components/popover/arrow.d.ts +3 -0
  114. package/2x/es/components/popover/arrow.js +12 -0
  115. package/2x/es/components/popover/index.d.ts +7 -15
  116. package/2x/es/components/popover/index.js +3 -2
  117. package/2x/es/components/popover/popover-menu.css +63 -0
  118. package/2x/es/components/popover/popover-menu.d.ts +20 -0
  119. package/2x/es/components/popover/popover-menu.js +52 -0
  120. package/2x/es/components/popover/popover.css +90 -318
  121. package/2x/es/components/popover/popover.d.ts +9 -8
  122. package/2x/es/components/popover/popover.js +10 -17
  123. package/2x/es/components/radio/radio.css +4 -7
  124. package/2x/es/components/radio/radio.js +1 -3
  125. package/2x/es/components/search-bar/search-bar.css +1 -1
  126. package/2x/es/components/selector/selector.css +14 -6
  127. package/2x/es/components/selector/selector.d.ts +2 -1
  128. package/2x/es/components/selector/selector.js +3 -2
  129. package/2x/es/components/swiper/swiper.js +3 -3
  130. package/2x/es/components/switch/switch.css +8 -3
  131. package/2x/es/components/tabs/tabs.js +4 -4
  132. package/2x/es/components/text-area/text-area.css +9 -9
  133. package/2x/es/components/text-area/text-area.d.ts +2 -2
  134. package/2x/es/components/text-area/text-area.js +41 -31
  135. package/2x/es/components/virtual-input/virtual-input.js +3 -2
  136. package/2x/es/utils/get-scroll-parent.js +1 -1
  137. package/2x/es/utils/use-ref-state.js +2 -2
  138. package/2x/es/utils/use-resize-effect.js +2 -3
  139. package/2x/es/utils/use-tab-list-scroll.js +2 -3
  140. package/2x/package.json +4 -4
  141. package/README.md +7 -6
  142. package/cjs/components/badge/badge.css +16 -10
  143. package/cjs/components/badge/badge.d.ts +1 -0
  144. package/cjs/components/badge/badge.js +4 -5
  145. package/cjs/components/button/button.css +3 -3
  146. package/cjs/components/calendar/calendar.js +3 -1
  147. package/cjs/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
  148. package/cjs/components/checkbox/check-icon.js +4 -13
  149. package/cjs/components/checkbox/checkbox.css +5 -13
  150. package/cjs/components/checkbox/checkbox.js +3 -5
  151. package/cjs/components/checkbox/indeterminate-icon.d.ts +3 -0
  152. package/cjs/components/checkbox/indeterminate-icon.js +24 -0
  153. package/cjs/components/date-picker/date-picker.d.ts +1 -1
  154. package/cjs/components/date-picker-view/date-picker-view.d.ts +3 -2
  155. package/cjs/components/ellipsis/ellipsis.js +3 -1
  156. package/cjs/components/floating-bubble/floating-bubble.css +1 -0
  157. package/cjs/components/floating-panel/floating-panel.d.ts +7 -5
  158. package/cjs/components/floating-panel/floating-panel.js +11 -1
  159. package/cjs/components/form/form-item.css +3 -2
  160. package/cjs/components/form/form-item.d.ts +2 -2
  161. package/cjs/components/form/form-item.js +9 -5
  162. package/cjs/components/form/form.css +3 -3
  163. package/cjs/components/form/form.d.ts +5 -4
  164. package/cjs/components/form/index.css +6 -5
  165. package/cjs/components/form/index.d.ts +5 -4
  166. package/cjs/components/image-uploader/image-uploader.js +1 -1
  167. package/cjs/components/image-viewer/image-viewer.d.ts +8 -2
  168. package/cjs/components/image-viewer/image-viewer.js +19 -6
  169. package/cjs/components/image-viewer/index.d.ts +6 -2
  170. package/cjs/components/image-viewer/slide.js +2 -1
  171. package/cjs/components/image-viewer/slides.d.ts +7 -3
  172. package/cjs/components/image-viewer/slides.js +18 -11
  173. package/cjs/components/input/input.d.ts +2 -2
  174. package/cjs/components/input/input.js +7 -3
  175. package/cjs/components/list/list.css +2 -5
  176. package/cjs/components/modal/modal.css +23 -19
  177. package/cjs/components/modal/modal.js +8 -12
  178. package/cjs/components/passcode-input/passcode-input.d.ts +2 -2
  179. package/cjs/components/picker/picker.css +9 -2
  180. package/cjs/components/picker/picker.d.ts +1 -1
  181. package/cjs/components/picker-view/picker-view.css +4 -2
  182. package/cjs/components/picker-view/picker-view.d.ts +1 -1
  183. package/cjs/components/picker-view/wheel.js +5 -3
  184. package/cjs/components/popover/arrow.d.ts +3 -0
  185. package/cjs/components/popover/arrow.js +26 -0
  186. package/cjs/components/popover/index.d.ts +7 -15
  187. package/cjs/components/popover/index.js +4 -2
  188. package/cjs/components/popover/popover-menu.css +52 -0
  189. package/cjs/components/popover/popover-menu.d.ts +20 -0
  190. package/{2x/cjs/components/popover/pop-menu.js → cjs/components/popover/popover-menu.js} +23 -26
  191. package/cjs/components/popover/popover.css +83 -276
  192. package/cjs/components/popover/popover.d.ts +9 -8
  193. package/cjs/components/popover/popover.js +11 -17
  194. package/cjs/components/radio/radio.css +4 -7
  195. package/cjs/components/radio/radio.js +1 -3
  196. package/cjs/components/search-bar/search-bar.css +1 -1
  197. package/cjs/components/selector/selector.css +14 -6
  198. package/cjs/components/selector/selector.d.ts +2 -1
  199. package/cjs/components/selector/selector.js +3 -2
  200. package/cjs/components/swiper/swiper.js +1 -1
  201. package/cjs/components/switch/switch.css +8 -3
  202. package/cjs/components/tabs/tabs.js +2 -2
  203. package/cjs/components/text-area/text-area.css +9 -9
  204. package/cjs/components/text-area/text-area.d.ts +2 -2
  205. package/cjs/components/text-area/text-area.js +41 -32
  206. package/cjs/components/virtual-input/virtual-input.js +3 -1
  207. package/cjs/utils/get-scroll-parent.js +1 -1
  208. package/cjs/utils/use-ref-state.js +1 -1
  209. package/cjs/utils/use-resize-effect.js +1 -3
  210. package/cjs/utils/use-tab-list-scroll.js +1 -3
  211. package/es/components/badge/badge.css +16 -10
  212. package/es/components/badge/badge.d.ts +1 -0
  213. package/es/components/badge/badge.js +4 -5
  214. package/es/components/button/button.css +3 -3
  215. package/es/components/calendar/calendar.js +3 -2
  216. package/es/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
  217. package/es/components/checkbox/check-icon.js +4 -13
  218. package/es/components/checkbox/checkbox.css +5 -13
  219. package/es/components/checkbox/checkbox.js +2 -5
  220. package/es/components/checkbox/indeterminate-icon.d.ts +3 -0
  221. package/es/components/checkbox/indeterminate-icon.js +10 -0
  222. package/es/components/date-picker/date-picker.d.ts +1 -1
  223. package/es/components/date-picker-view/date-picker-view.d.ts +3 -2
  224. package/es/components/ellipsis/ellipsis.js +3 -2
  225. package/es/components/floating-bubble/floating-bubble.css +1 -0
  226. package/es/components/floating-panel/floating-panel.d.ts +7 -5
  227. package/es/components/floating-panel/floating-panel.js +9 -1
  228. package/es/components/form/form-item.css +3 -2
  229. package/es/components/form/form-item.d.ts +2 -2
  230. package/es/components/form/form-item.js +9 -5
  231. package/es/components/form/form.css +3 -3
  232. package/es/components/form/form.d.ts +5 -4
  233. package/es/components/form/index.css +6 -5
  234. package/es/components/form/index.d.ts +5 -4
  235. package/es/components/image-uploader/image-uploader.js +3 -3
  236. package/es/components/image-viewer/image-viewer.d.ts +8 -2
  237. package/es/components/image-viewer/image-viewer.js +15 -4
  238. package/es/components/image-viewer/index.d.ts +6 -2
  239. package/es/components/image-viewer/slide.js +2 -1
  240. package/es/components/image-viewer/slides.d.ts +7 -3
  241. package/es/components/image-viewer/slides.js +19 -10
  242. package/es/components/input/input.d.ts +2 -2
  243. package/es/components/input/input.js +7 -4
  244. package/es/components/list/list.css +2 -5
  245. package/es/components/modal/modal.css +23 -19
  246. package/es/components/modal/modal.js +8 -12
  247. package/es/components/passcode-input/passcode-input.d.ts +2 -2
  248. package/es/components/picker/picker.css +9 -2
  249. package/es/components/picker/picker.d.ts +1 -1
  250. package/es/components/picker-view/picker-view.css +4 -2
  251. package/es/components/picker-view/picker-view.d.ts +1 -1
  252. package/es/components/picker-view/wheel.js +5 -4
  253. package/es/components/popover/arrow.d.ts +3 -0
  254. package/es/components/popover/arrow.js +12 -0
  255. package/es/components/popover/index.d.ts +7 -15
  256. package/es/components/popover/index.js +3 -2
  257. package/es/components/popover/popover-menu.css +52 -0
  258. package/es/components/popover/popover-menu.d.ts +20 -0
  259. package/es/components/popover/popover-menu.js +52 -0
  260. package/es/components/popover/popover.css +83 -276
  261. package/es/components/popover/popover.d.ts +9 -8
  262. package/es/components/popover/popover.js +10 -17
  263. package/es/components/radio/radio.css +4 -7
  264. package/es/components/radio/radio.js +1 -3
  265. package/es/components/search-bar/search-bar.css +1 -1
  266. package/es/components/selector/selector.css +14 -6
  267. package/es/components/selector/selector.d.ts +2 -1
  268. package/es/components/selector/selector.js +3 -2
  269. package/es/components/swiper/swiper.js +3 -3
  270. package/es/components/switch/switch.css +8 -3
  271. package/es/components/tabs/tabs.js +4 -4
  272. package/es/components/text-area/text-area.css +9 -9
  273. package/es/components/text-area/text-area.d.ts +2 -2
  274. package/es/components/text-area/text-area.js +41 -31
  275. package/es/components/virtual-input/virtual-input.js +3 -2
  276. package/es/utils/get-scroll-parent.js +1 -1
  277. package/es/utils/use-ref-state.js +2 -2
  278. package/es/utils/use-resize-effect.js +2 -3
  279. package/es/utils/use-tab-list-scroll.js +2 -3
  280. package/package.json +4 -4
  281. package/umd/antd-mobile.js +1 -1
  282. package/2x/cjs/components/popover/animation.css +0 -111
  283. package/2x/cjs/components/popover/pop-menu.d.ts +0 -28
  284. package/2x/es/components/popover/animation.css +0 -111
  285. package/2x/es/components/popover/pop-menu.d.ts +0 -28
  286. package/2x/es/components/popover/pop-menu.js +0 -54
  287. package/cjs/components/popover/animation.css +0 -96
  288. package/cjs/components/popover/pop-menu.d.ts +0 -28
  289. package/es/components/popover/animation.css +0 -96
  290. package/es/components/popover/pop-menu.d.ts +0 -28
  291. package/es/components/popover/pop-menu.js +0 -54
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
4
- export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'max' | 'min' | 'autoComplete' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp'> & {
4
+ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'max' | 'min' | 'autoComplete' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
5
5
  value?: string;
6
6
  defaultValue?: string;
7
7
  onChange?: (val: string) => void;
@@ -19,7 +19,7 @@ export declare type InputRef = {
19
19
  focus: () => void;
20
20
  blur: () => void;
21
21
  };
22
- export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "max" | "min" | "type" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength"> & {
22
+ export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "max" | "min" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength"> & {
23
23
  value?: string | undefined;
24
24
  defaultValue?: string | undefined;
25
25
  onChange?: ((val: string) => void) | undefined;
@@ -1,9 +1,10 @@
1
- import React, { useState, forwardRef, useImperativeHandle, useRef, useLayoutEffect } from 'react';
1
+ import React, { useState, forwardRef, useImperativeHandle, useRef } from 'react';
2
2
  import { usePropsValue } from '../../utils/use-props-value';
3
3
  import { CloseCircleFill } from 'antd-mobile-icons';
4
4
  import { withNativeProps } from '../../utils/native-props';
5
5
  import { mergeProps } from '../../utils/with-default-props';
6
6
  import classNames from 'classnames';
7
+ import { useIsomorphicLayoutEffect } from 'ahooks';
7
8
  const classPrefix = `adm-input`;
8
9
  const defaultProps = {
9
10
  defaultValue: ''
@@ -39,7 +40,7 @@ export const Input = forwardRef((p, ref) => {
39
40
  (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
40
41
  };
41
42
 
42
- useLayoutEffect(() => {
43
+ useIsomorphicLayoutEffect(() => {
43
44
  var _a;
44
45
 
45
46
  if (!props.enterKeyHint) return;
@@ -86,8 +87,10 @@ export const Input = forwardRef((p, ref) => {
86
87
  autoCapitalize: props.autoCapitalize,
87
88
  autoCorrect: props.autoCorrect,
88
89
  onKeyDown: handleKeydown,
89
- onKeyUp: props.onKeyUp
90
- }), props.clearable && !!value && React.createElement("div", {
90
+ onKeyUp: props.onKeyUp,
91
+ onCompositionStart: props.onCompositionStart,
92
+ onCompositionEnd: props.onCompositionEnd
93
+ }), props.clearable && !!value && !props.readOnly && React.createElement("div", {
91
94
  className: `${classPrefix}-clear`,
92
95
  onMouseDown: e => {
93
96
  e.preventDefault();
@@ -99,11 +99,11 @@
99
99
  pointer-events: none;
100
100
  }
101
101
 
102
- a.adm-list-item:active {
102
+ a.adm-list-item:active:not(.adm-list-item-disabled) {
103
103
  background-color: var(--active-background-color);
104
104
  }
105
105
 
106
- a.adm-list-item:active::after {
106
+ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
107
107
  content: ' ';
108
108
  display: block;
109
109
  position: absolute;
@@ -111,8 +111,4 @@ a.adm-list-item:active::after {
111
111
  bottom: -2px;
112
112
  left: 0;
113
113
  border-bottom: var(--border-inner);
114
- }
115
-
116
- a.adm-list-item.adm-list-item-disabled:active {
117
- background-color: unset;
118
114
  }
@@ -22,10 +22,12 @@
22
22
  .adm-modal-main {
23
23
  width: 100%;
24
24
  max-height: 70vh;
25
+ box-sizing: border-box;
25
26
  font-size: 28px;
26
27
  background-color: white;
27
28
  border-radius: 16px;
28
- overflow: hidden;
29
+ overflow-x: hidden;
30
+ overflow-y: auto;
29
31
  display: flex;
30
32
  flex-direction: column;
31
33
  }
@@ -40,14 +42,12 @@
40
42
 
41
43
  .adm-modal-main .adm-modal-body {
42
44
  padding: 40px 24px 24px;
45
+ display: flex;
46
+ flex-direction: column;
43
47
  }
44
48
 
45
- .adm-modal-main .adm-modal-body .adm-modal-close {
46
- position: absolute;
47
- right: 24px;
48
- top: 24px;
49
- color: var(--adm-color-weak);
50
- padding: 4px;
49
+ .adm-modal-main .adm-modal-body > * + * {
50
+ margin-top: 16px;
51
51
  }
52
52
 
53
53
  .adm-modal-main .adm-modal-body-header-wrapper {
@@ -63,39 +63,44 @@
63
63
  }
64
64
 
65
65
  .adm-modal-main .adm-modal-body-content {
66
- max-height: 70vh;
67
- overflow-x: hidden;
68
- overflow-y: auto;
69
66
  font-size: 30px;
70
67
  line-height: 1.4;
71
68
  color: #333;
72
69
  }
73
70
 
74
- .adm-modal-main .adm-modal-footer {
71
+ .adm-modal-main .adm-modal-close {
72
+ position: absolute;
73
+ right: 16px;
74
+ top: 16px;
75
+ color: var(--adm-color-weak);
76
+ padding: 8px;
77
+ font-size: 36px;
78
+ }
79
+
80
+ .adm-modal-footer {
75
81
  user-select: none;
76
82
  padding: 16px 24px 24px;
77
83
  }
78
84
 
79
- .adm-modal-main .adm-modal-footer .adm-modal-button {
80
- font-size: 36px;
81
- line-height: 50px;
82
- border-right: solid 1px var(--adm-border-color);
85
+ .adm-modal-footer.adm-space {
86
+ --gap-vertical: 40px;
83
87
  }
84
88
 
85
- .adm-modal-main .adm-modal-footer .adm-modal-button:last-child {
86
- border-right: none;
89
+ .adm-modal-footer .adm-modal-button {
90
+ font-size: 36px;
91
+ line-height: 50px;
87
92
  }
88
93
 
89
- .adm-modal-main .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary) {
94
+ .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary) {
90
95
  padding-top: 0;
91
96
  padding-bottom: 0;
92
97
  }
93
98
 
94
- .adm-modal-main .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary)::before {
99
+ .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary)::before {
95
100
  display: none;
96
101
  }
97
102
 
98
- .adm-modal-main .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary):active {
103
+ .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary):active {
99
104
  opacity: 0.7;
100
105
  }
101
106
 
@@ -71,7 +71,10 @@ export const Modal = p => {
71
71
  style: Object.assign({}, style),
72
72
  onClick: e => e.stopPropagation(),
73
73
  className: `${classPrefix}-main`
74
- }, !!props.image && React.createElement("div", {
74
+ }, props.showCloseButton && React.createElement("a", {
75
+ className: classNames(`${classPrefix}-close`, 'adm-plain-anchor'),
76
+ onClick: props.onClose
77
+ }, React.createElement(CloseOutline, null)), !!props.image && React.createElement("div", {
75
78
  className: `${classPrefix}-image-container`
76
79
  }, React.createElement(Image, {
77
80
  src: props.image,
@@ -80,12 +83,6 @@ export const Modal = p => {
80
83
  })), React.createElement("div", {
81
84
  style: props.bodyStyle,
82
85
  className: classNames(`${classPrefix}-body`, props.bodyClassName)
83
- }, props.showCloseButton && React.createElement("a", {
84
- className: classNames(`${classPrefix}-close`, 'adm-plain-anchor'),
85
- onClick: props.onClose
86
- }, React.createElement(CloseOutline, null)), React.createElement(Space, {
87
- direction: 'vertical',
88
- block: true
89
86
  }, !!props.header && React.createElement("div", {
90
87
  className: `${classPrefix}-body-header-wrapper`
91
88
  }, React.createElement("div", {
@@ -94,11 +91,10 @@ export const Modal = p => {
94
91
  className: `${classPrefix}-body-title`
95
92
  }, props.title), !!props.content && React.createElement("div", {
96
93
  className: `${classPrefix}-body-content`
97
- }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content))), React.createElement("div", {
98
- className: `${classPrefix}-footer`
99
- }, React.createElement(Space, {
94
+ }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content)), React.createElement(Space, {
100
95
  direction: 'vertical',
101
- block: true
96
+ block: true,
97
+ className: `${classPrefix}-footer`
102
98
  }, props.actions.map((action, index) => {
103
99
  return React.createElement(ModalActionButton, {
104
100
  key: action.key,
@@ -113,6 +109,6 @@ export const Modal = p => {
113
109
  }
114
110
  })
115
111
  });
116
- }))))))));
112
+ })))))));
117
113
  return renderToContainer(props.getContainer, node);
118
114
  };
@@ -14,7 +14,7 @@ export declare type PasscodeInputProps = {
14
14
  onFocus?: () => void;
15
15
  keyboard?: ReactElement<NumberKeyboardProps>;
16
16
  onFill?: (val: string) => void;
17
- } & NativeProps<'--cell-gap' | '--cell-size'>;
17
+ } & NativeProps<'--cell-gap' | '--cell-size' | '--dot-size' | '--border-color' | '--border-radius'>;
18
18
  export declare type PasscodeInputRef = {
19
19
  focus: () => void;
20
20
  blur: () => void;
@@ -32,4 +32,4 @@ export declare const PasscodeInput: React.ForwardRefExoticComponent<{
32
32
  onFocus?: (() => void) | undefined;
33
33
  keyboard?: React.ReactElement<NumberKeyboardProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
34
34
  onFill?: ((val: string) => void) | undefined;
35
- } & NativeProps<"--cell-size" | "--cell-gap"> & React.RefAttributes<PasscodeInputRef>>;
35
+ } & NativeProps<"--border-radius" | "--border-color" | "--cell-size" | "--dot-size" | "--cell-gap"> & React.RefAttributes<PasscodeInputRef>>;
@@ -1,10 +1,18 @@
1
1
  .adm-picker {
2
+ --header-button-font-size: 30px;
3
+ --title-font-size: 30px;
4
+ --item-font-size: 32px;
2
5
  width: 100%;
3
6
  height: 600px;
4
7
  overflow: hidden;
5
8
  position: relative;
6
9
  display: flex;
7
10
  flex-direction: column;
11
+ ---item-font-size: var(--item-font-size);
12
+ }
13
+
14
+ .adm-picker .adm-picker-view.adm-picker-view {
15
+ --item-font-size: var(---item-font-size);
8
16
  }
9
17
 
10
18
  .adm-picker-header {
@@ -17,14 +25,14 @@
17
25
  }
18
26
 
19
27
  .adm-picker-header-button {
20
- font-size: 30px;
28
+ font-size: var(--header-button-font-size);
21
29
  display: inline-block;
22
30
  padding: 16px 16px;
23
31
  }
24
32
 
25
33
  .adm-picker-header-title {
26
34
  padding: 8px 8px;
27
- font-size: 30px;
35
+ font-size: var(--title-font-size);
28
36
  color: var(--adm-color-text);
29
37
  text-align: center;
30
38
  flex: 1;
@@ -15,5 +15,5 @@ export declare type PickerProps = {
15
15
  confirmText?: ReactNode;
16
16
  cancelText?: ReactNode;
17
17
  children?: (items: (PickerColumnItem | null)[]) => ReactNode;
18
- } & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps;
18
+ } & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps<'--header-button-font-size' | '--title-font-size' | '--item-font-size'>;
19
19
  export declare const Picker: React.NamedExoticComponent<PickerProps>;
@@ -1,5 +1,6 @@
1
1
  .adm-picker-view {
2
2
  --height: 480px;
3
+ --item-font-size: 32px;
3
4
  height: var(--height);
4
5
  width: 100%;
5
6
  display: flex;
@@ -44,7 +45,7 @@
44
45
  }
45
46
 
46
47
  .adm-picker-view-column-item {
47
- font-size: 32px;
48
+ font-size: var(--item-font-size);
48
49
  padding: 0 12px;
49
50
  height: 68px;
50
51
  display: flex;
@@ -66,6 +67,7 @@
66
67
  display: flex;
67
68
  flex-direction: column;
68
69
  position: relative;
70
+ z-index: 0;
69
71
  }
70
72
 
71
73
  .adm-picker-view-column-accessible > * {
@@ -86,7 +88,7 @@
86
88
 
87
89
  .adm-picker-view-mask {
88
90
  position: absolute;
89
- z-index: 100;
91
+ z-index: 10000;
90
92
  left: 0;
91
93
  top: 0;
92
94
  width: 100%;
@@ -14,5 +14,5 @@ export declare type PickerViewProps = {
14
14
  value?: PickerValue[];
15
15
  defaultValue?: PickerValue[];
16
16
  onChange?: (value: PickerValue[], extend: PickerValueExtend) => void;
17
- } & NativeProps<'--height'>;
17
+ } & NativeProps<'--height' | '--item-font-size'>;
18
18
  export declare const PickerView: React.NamedExoticComponent<PickerViewProps>;
@@ -1,10 +1,11 @@
1
- import React, { memo, useLayoutEffect, useRef } from 'react';
1
+ import React, { memo, useRef } from 'react';
2
2
  import { useSpring, animated } from '@react-spring/web';
3
3
  import { useDrag } from '@use-gesture/react';
4
4
  import { convertPx } from '../../utils/convert-px';
5
5
  import { rubberbandIfOutOfBounds } from '../../utils/rubberband';
6
6
  import { bound } from '../../utils/bound';
7
7
  import isEqual from 'lodash/isEqual';
8
+ import { useIsomorphicLayoutEffect } from 'ahooks';
8
9
  const classPrefix = `adm-picker-view`;
9
10
  export const Wheel = memo(props => {
10
11
  const itemHeight = convertPx(34);
@@ -29,7 +30,7 @@ export const Wheel = memo(props => {
29
30
  }
30
31
  }));
31
32
  const draggingRef = useRef(false);
32
- useLayoutEffect(() => {
33
+ useIsomorphicLayoutEffect(() => {
33
34
  if (draggingRef.current) return;
34
35
  if (!value) return;
35
36
  const targetIndex = column.findIndex(item => item.value === value);
@@ -40,7 +41,7 @@ export const Wheel = memo(props => {
40
41
  immediate: y.goal !== finalPosition
41
42
  });
42
43
  }, [value, column]);
43
- useLayoutEffect(() => {
44
+ useIsomorphicLayoutEffect(() => {
44
45
  if (column.length === 0) {
45
46
  if (value !== null) {
46
47
  onSelect(null);
@@ -126,7 +127,7 @@ export const Wheel = memo(props => {
126
127
  className: `${classPrefix}-column`
127
128
  }, bind()), React.createElement(animated.div, {
128
129
  style: {
129
- y
130
+ translateY: y
130
131
  },
131
132
  className: `${classPrefix}-column-wheel`,
132
133
  "aria-hidden": true
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ export declare const Arrow: React.NamedExoticComponent<NativeProps<never>>;
@@ -0,0 +1,12 @@
1
+ import React, { memo } from 'react';
2
+ import { withNativeProps } from '../../utils/native-props';
3
+ export const Arrow = memo(props => {
4
+ return withNativeProps(props, React.createElement("svg", {
5
+ viewBox: '0 0 30 16'
6
+ }, React.createElement("g", {
7
+ transform: 'translate(-1300.000000, -841.000000)',
8
+ fill: 'currentColor'
9
+ }, React.createElement("path", {
10
+ d: 'M1300,841 L1330,841 L1318.07289,855.312538 C1316.65863,857.009645 1314.13637,857.238942 1312.43926,855.824685 C1312.25341,855.669808 1312.08199,855.49839 1311.92711,855.312538 L1300,841 L1300,841 Z'
11
+ }))));
12
+ });
@@ -1,27 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import './popover.less';
3
- export type { BasePopoverProps, PopoverRef } from './popover';
4
- export type { PopMenuProps, Action } from './pop-menu';
3
+ import './popover-menu.less';
4
+ export type { PopoverProps, PopoverRef } from './popover';
5
+ export type { PopoverMenuProps, Action } from './popover-menu';
5
6
  declare const _default: import("react").ForwardRefExoticComponent<{
6
- getContainer?: (() => HTMLElement) | undefined;
7
+ getContainer?: HTMLElement | (() => HTMLElement) | null | undefined;
7
8
  destroyOnHide?: boolean | undefined;
8
9
  children: import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
9
10
  mode?: "dark" | "light" | undefined;
10
11
  trigger?: "click" | undefined;
11
- placement: "left" | "right" | "bottom" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom";
12
+ placement?: "left" | "right" | "bottom" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | undefined;
12
13
  stopPropagation?: "click"[] | undefined;
13
- } & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "zIndex" | "align" | "defaultVisible" | "onVisibleChange" | "overlayStyle" | "overlayClassName"> & import("../../utils/native-props").NativeProps<"--z-index"> & {
14
14
  content: import("react").ReactNode;
15
- } & import("react").RefAttributes<import("./popover").PopoverRef>> & {
16
- Menu: <T extends import("./pop-menu").Action = import("./pop-menu").Action>(props: {
17
- getContainer?: (() => HTMLElement) | undefined;
18
- destroyOnHide?: boolean | undefined;
19
- children: import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
20
- mode?: "dark" | "light" | undefined;
21
- trigger?: "click" | undefined;
22
- placement: "left" | "right" | "bottom" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom";
23
- stopPropagation?: "click"[] | undefined;
24
- } & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "zIndex" | "align" | "defaultVisible" | "onVisibleChange" | "overlayStyle" | "overlayClassName"> & import("../../utils/native-props").NativeProps<"--z-index"> & {
15
+ } & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "align" | "defaultVisible" | "onVisibleChange"> & import("../../utils/native-props").NativeProps<"--z-index"> & import("react").RefAttributes<import("./popover").PopoverRef>> & {
16
+ Menu: <T extends import("./popover-menu").Action = import("./popover-menu").Action>(props: Pick<import("./popover").PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
25
17
  actions: T[];
26
18
  onAction?: ((text: T) => void) | undefined;
27
19
  } & {
@@ -1,7 +1,8 @@
1
1
  import "./popover.css";
2
+ import "./popover-menu.css";
2
3
  import { attachPropertiesToComponent } from '../../utils/attach-properties-to-component';
3
- import { PopMenu } from './pop-menu';
4
+ import { PopoverMenu } from './popover-menu';
4
5
  import { Popover } from './popover';
5
6
  export default attachPropertiesToComponent(Popover, {
6
- Menu: PopMenu
7
+ Menu: PopoverMenu
7
8
  });
@@ -0,0 +1,63 @@
1
+ .adm-popover-menu {
2
+ --border-color: var(--adm-border-color);
3
+ }
4
+
5
+ .adm-popover-menu.adm-popover {
6
+ --content-padding: 0;
7
+ }
8
+
9
+ .adm-popover-menu-list {
10
+ overflow: hidden;
11
+ min-width: 240px;
12
+ }
13
+
14
+ .adm-popover-menu-list-inner {
15
+ margin-top: -2px;
16
+ }
17
+
18
+ .adm-popover-menu-item {
19
+ display: flex;
20
+ padding-left: 40px;
21
+ justify-content: flex-start;
22
+ align-items: center;
23
+ position: relative;
24
+ }
25
+
26
+ .adm-popover-menu-item-icon {
27
+ flex: none;
28
+ padding-right: 16px;
29
+ font-size: 40px;
30
+ }
31
+
32
+ .adm-popover-menu-item-text {
33
+ flex: auto;
34
+ padding: 28px 40px 28px 0;
35
+ border-top: solid 2px var(--border-color);
36
+ }
37
+
38
+ .adm-popover-menu-item-disabled {
39
+ cursor: not-allowed;
40
+ }
41
+
42
+ .adm-popover-menu-item-disabled > * {
43
+ opacity: 0.4;
44
+ }
45
+
46
+ .adm-popover-menu-item:active:not(.adm-popover-menu-item-disabled) {
47
+ background-color: var(--border-color);
48
+ }
49
+
50
+ .adm-popover-menu-item:active:not(.adm-popover-menu-item-disabled)::after {
51
+ content: ' ';
52
+ display: block;
53
+ position: absolute;
54
+ width: 100%;
55
+ bottom: -2px;
56
+ left: 0;
57
+ border-bottom: solid 2px var(--border-color);
58
+ }
59
+
60
+ .adm-popover.adm-popover-dark.adm-popover-menu {
61
+ --border-color: #333333;
62
+ --background: rgba(0, 0, 0, 0.9);
63
+ }
@@ -0,0 +1,20 @@
1
+ import React, { ReactElement, Ref } from 'react';
2
+ import { PopoverProps, PopoverRef } from './popover';
3
+ export declare type Action = {
4
+ text: React.ReactNode;
5
+ icon?: React.ReactNode;
6
+ disabled?: boolean;
7
+ key?: string;
8
+ onClick?: () => void;
9
+ [key: string]: any;
10
+ };
11
+ export declare type PopoverMenuProps<T> = Omit<PopoverProps, 'content'> & {
12
+ actions: T[];
13
+ onAction?: (text: T) => void;
14
+ };
15
+ export declare const PopoverMenu: <T extends Action = Action>(props: Pick<PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
16
+ actions: T[];
17
+ onAction?: ((text: T) => void) | undefined;
18
+ } & {
19
+ ref?: ((instance: PopoverRef | null) => void) | React.RefObject<PopoverRef> | null | undefined;
20
+ }) => ReactElement;
@@ -0,0 +1,52 @@
1
+ import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
2
+ import classNames from 'classnames';
3
+ import { Popover } from './popover';
4
+ const classPrefix = `adm-popover-menu`;
5
+ export const PopoverMenu = forwardRef((props, ref) => {
6
+ const innerRef = useRef(null);
7
+ useImperativeHandle(ref, () => innerRef.current, []);
8
+ const onClick = useCallback(e => {
9
+ var _a;
10
+
11
+ const {
12
+ onAction
13
+ } = props;
14
+
15
+ if (onAction) {
16
+ onAction(e);
17
+ }
18
+
19
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.hide();
20
+ }, [props.onAction]);
21
+ const overlay = useMemo(() => {
22
+ return React.createElement("div", {
23
+ className: `${classPrefix}-list`
24
+ }, React.createElement("div", {
25
+ className: `${classPrefix}-list-inner`
26
+ }, props.actions.map((action, index) => {
27
+ var _a;
28
+
29
+ return React.createElement("a", {
30
+ key: (_a = action.key) !== null && _a !== void 0 ? _a : index,
31
+ className: classNames(`${classPrefix}-item`, 'adm-plain-anchor', action.disabled && `${classPrefix}-item-disabled`),
32
+ onClick: () => {
33
+ var _a;
34
+
35
+ if (action.disabled) return;
36
+ onClick(action);
37
+ (_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
38
+ }
39
+ }, action.icon && React.createElement("div", {
40
+ className: `${classPrefix}-item-icon`
41
+ }, action.icon), React.createElement("div", {
42
+ className: `${classPrefix}-item-text`
43
+ }, action.text));
44
+ })));
45
+ }, [props.actions, onClick]);
46
+ return React.createElement(Popover, Object.assign({
47
+ ref: innerRef
48
+ }, props, {
49
+ className: classNames(classPrefix, props.className),
50
+ content: overlay
51
+ }), props.children);
52
+ });