antd-mobile 5.5.1 → 5.7.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 (289) hide show
  1. package/2x/cjs/components/action-sheet/action-sheet.d.ts +5 -5
  2. package/2x/cjs/components/action-sheet/action-sheet.js +6 -46
  3. package/2x/cjs/components/action-sheet/index.d.ts +1 -1
  4. package/2x/cjs/components/badge/badge.js +1 -1
  5. package/2x/cjs/components/calendar/calendar.d.ts +4 -3
  6. package/2x/cjs/components/calendar/calendar.js +67 -56
  7. package/2x/cjs/components/calendar/convert.d.ts +2 -0
  8. package/2x/cjs/components/calendar/convert.js +22 -0
  9. package/2x/cjs/components/cascader-view/cascader-view.js +7 -0
  10. package/2x/cjs/components/checkbox/checkbox.js +4 -20
  11. package/2x/cjs/components/checkbox/native-input.d.ts +10 -0
  12. package/2x/cjs/components/checkbox/native-input.js +42 -0
  13. package/2x/cjs/components/dialog/index.d.ts +1 -1
  14. package/2x/cjs/components/dialog/show.d.ts +2 -4
  15. package/2x/cjs/components/dialog/show.js +9 -47
  16. package/2x/cjs/components/dot-loading/dot-loading.js +1 -2
  17. package/2x/cjs/components/empty/empty-icon.d.ts +3 -0
  18. package/2x/cjs/components/empty/empty-icon.js +37 -0
  19. package/2x/cjs/components/empty/empty.js +27 -15
  20. package/2x/cjs/components/error-block/error-block.css +1 -0
  21. package/2x/cjs/components/error-block/error-block.js +5 -8
  22. package/2x/cjs/components/error-block/images/busy.d.ts +1 -0
  23. package/2x/cjs/components/error-block/images/busy.js +102 -0
  24. package/2x/cjs/components/error-block/images/default.d.ts +1 -0
  25. package/2x/cjs/components/error-block/images/default.js +178 -0
  26. package/2x/cjs/components/error-block/images/disconnected.d.ts +1 -0
  27. package/2x/cjs/components/error-block/images/disconnected.js +135 -0
  28. package/2x/cjs/components/error-block/images/empty.d.ts +1 -0
  29. package/2x/cjs/components/error-block/images/empty.js +131 -0
  30. package/2x/cjs/components/error-block/images/index.d.ts +2 -0
  31. package/2x/cjs/components/error-block/images/index.js +22 -0
  32. package/2x/cjs/components/floating-bubble/floating-bubble.css +2 -1
  33. package/2x/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
  34. package/2x/cjs/components/form/form-item.d.ts +1 -1
  35. package/2x/cjs/components/form/form-item.js +4 -1
  36. package/2x/cjs/components/image-viewer/index.d.ts +1 -1
  37. package/2x/cjs/components/image-viewer/methods.d.ts +3 -7
  38. package/2x/cjs/components/image-viewer/methods.js +13 -79
  39. package/2x/cjs/components/modal/index.d.ts +1 -1
  40. package/2x/cjs/components/modal/show.d.ts +2 -4
  41. package/2x/cjs/components/modal/show.js +9 -47
  42. package/2x/cjs/components/picker/picker.js +6 -9
  43. package/2x/cjs/components/picker-view/columns-extend.d.ts +3 -0
  44. package/2x/cjs/components/picker-view/columns-extend.js +45 -0
  45. package/2x/cjs/components/picker-view/picker-view.d.ts +1 -0
  46. package/2x/cjs/components/picker-view/picker-view.js +14 -16
  47. package/2x/cjs/components/popover/popover.css +1 -0
  48. package/2x/cjs/components/popover/popover.js +1 -0
  49. package/2x/cjs/components/popover/temp-floating-ui.min.js +1 -430
  50. package/2x/cjs/components/radio/radio.js +4 -20
  51. package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
  52. package/2x/cjs/components/tab-bar/tab-bar.d.ts +1 -1
  53. package/2x/cjs/components/tab-bar/tab-bar.js +1 -1
  54. package/2x/cjs/components/tree-select/tree-select.js +2 -2
  55. package/2x/cjs/utils/render-imperatively.d.ts +10 -0
  56. package/2x/cjs/utils/render-imperatively.js +68 -0
  57. package/2x/cjs/utils/with-cache.d.ts +1 -0
  58. package/2x/cjs/utils/with-cache.js +17 -0
  59. package/2x/es/components/action-sheet/action-sheet.d.ts +5 -5
  60. package/2x/es/components/action-sheet/action-sheet.js +5 -41
  61. package/2x/es/components/action-sheet/index.d.ts +1 -1
  62. package/2x/es/components/badge/badge.js +1 -1
  63. package/2x/es/components/calendar/calendar.d.ts +4 -3
  64. package/2x/es/components/calendar/calendar.js +67 -58
  65. package/2x/es/components/calendar/convert.d.ts +2 -0
  66. package/2x/es/components/calendar/convert.js +15 -0
  67. package/2x/es/components/cascader-view/cascader-view.js +7 -0
  68. package/2x/es/components/checkbox/checkbox.js +4 -21
  69. package/2x/es/components/checkbox/native-input.d.ts +10 -0
  70. package/2x/es/components/checkbox/native-input.js +28 -0
  71. package/2x/es/components/dialog/index.d.ts +1 -1
  72. package/2x/es/components/dialog/show.d.ts +2 -4
  73. package/2x/es/components/dialog/show.js +8 -44
  74. package/2x/es/components/dot-loading/dot-loading.js +1 -2
  75. package/2x/es/components/empty/empty-icon.d.ts +3 -0
  76. package/2x/es/components/empty/empty-icon.js +24 -0
  77. package/2x/es/components/empty/empty.js +27 -14
  78. package/2x/es/components/error-block/error-block.css +1 -0
  79. package/2x/es/components/error-block/error-block.js +4 -6
  80. package/2x/es/components/error-block/images/busy.d.ts +1 -0
  81. package/2x/es/components/error-block/images/busy.js +90 -0
  82. package/2x/es/components/error-block/images/default.d.ts +1 -0
  83. package/2x/es/components/error-block/images/default.js +166 -0
  84. package/2x/es/components/error-block/images/disconnected.d.ts +1 -0
  85. package/2x/es/components/error-block/images/disconnected.js +123 -0
  86. package/2x/es/components/error-block/images/empty.d.ts +1 -0
  87. package/2x/es/components/error-block/images/empty.js +119 -0
  88. package/2x/es/components/error-block/images/index.d.ts +2 -0
  89. package/2x/es/components/error-block/images/index.js +10 -0
  90. package/2x/es/components/floating-bubble/floating-bubble.css +2 -1
  91. package/2x/es/components/floating-bubble/floating-bubble.d.ts +1 -1
  92. package/2x/es/components/form/form-item.d.ts +1 -1
  93. package/2x/es/components/form/form-item.js +4 -1
  94. package/2x/es/components/image-viewer/index.d.ts +1 -1
  95. package/2x/es/components/image-viewer/methods.d.ts +3 -7
  96. package/2x/es/components/image-viewer/methods.js +12 -75
  97. package/2x/es/components/modal/index.d.ts +1 -1
  98. package/2x/es/components/modal/show.d.ts +2 -4
  99. package/2x/es/components/modal/show.js +8 -44
  100. package/2x/es/components/picker/picker.js +6 -8
  101. package/2x/es/components/picker-view/columns-extend.d.ts +3 -0
  102. package/2x/es/components/picker-view/columns-extend.js +34 -0
  103. package/2x/es/components/picker-view/picker-view.d.ts +1 -0
  104. package/2x/es/components/picker-view/picker-view.js +14 -15
  105. package/2x/es/components/popover/popover.css +1 -0
  106. package/2x/es/components/popover/popover.js +1 -0
  107. package/2x/es/components/popover/temp-floating-ui.min.js +1 -430
  108. package/2x/es/components/radio/radio.js +4 -21
  109. package/2x/es/components/search-bar/search-bar.d.ts +1 -1
  110. package/2x/es/components/tab-bar/tab-bar.d.ts +1 -1
  111. package/2x/es/components/tab-bar/tab-bar.js +1 -1
  112. package/2x/es/components/tree-select/tree-select.js +2 -2
  113. package/2x/es/utils/render-imperatively.d.ts +10 -0
  114. package/2x/es/utils/render-imperatively.js +53 -0
  115. package/2x/es/utils/with-cache.d.ts +1 -0
  116. package/2x/es/utils/with-cache.js +10 -0
  117. package/2x/package.json +2 -3
  118. package/cjs/components/action-sheet/action-sheet.d.ts +5 -5
  119. package/cjs/components/action-sheet/action-sheet.js +6 -46
  120. package/cjs/components/action-sheet/index.d.ts +1 -1
  121. package/cjs/components/badge/badge.js +1 -1
  122. package/cjs/components/calendar/calendar.d.ts +4 -3
  123. package/cjs/components/calendar/calendar.js +67 -56
  124. package/cjs/components/calendar/convert.d.ts +2 -0
  125. package/cjs/components/calendar/convert.js +22 -0
  126. package/cjs/components/cascader-view/cascader-view.js +7 -0
  127. package/cjs/components/checkbox/checkbox.js +4 -20
  128. package/cjs/components/checkbox/native-input.d.ts +10 -0
  129. package/cjs/components/checkbox/native-input.js +42 -0
  130. package/cjs/components/dialog/index.d.ts +1 -1
  131. package/cjs/components/dialog/show.d.ts +2 -4
  132. package/cjs/components/dialog/show.js +9 -47
  133. package/cjs/components/dot-loading/dot-loading.js +1 -2
  134. package/cjs/components/empty/empty-icon.d.ts +3 -0
  135. package/cjs/components/empty/empty-icon.js +37 -0
  136. package/cjs/components/empty/empty.js +27 -15
  137. package/cjs/components/error-block/error-block.css +1 -0
  138. package/cjs/components/error-block/error-block.js +5 -8
  139. package/cjs/components/error-block/images/busy.d.ts +1 -0
  140. package/cjs/components/error-block/images/busy.js +102 -0
  141. package/cjs/components/error-block/images/default.d.ts +1 -0
  142. package/cjs/components/error-block/images/default.js +178 -0
  143. package/cjs/components/error-block/images/disconnected.d.ts +1 -0
  144. package/cjs/components/error-block/images/disconnected.js +135 -0
  145. package/cjs/components/error-block/images/empty.d.ts +1 -0
  146. package/cjs/components/error-block/images/empty.js +131 -0
  147. package/cjs/components/error-block/images/index.d.ts +2 -0
  148. package/cjs/components/error-block/images/index.js +22 -0
  149. package/cjs/components/floating-bubble/floating-bubble.css +2 -1
  150. package/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
  151. package/cjs/components/form/form-item.d.ts +1 -1
  152. package/cjs/components/form/form-item.js +4 -1
  153. package/cjs/components/image-viewer/index.d.ts +1 -1
  154. package/cjs/components/image-viewer/methods.d.ts +3 -7
  155. package/cjs/components/image-viewer/methods.js +13 -79
  156. package/cjs/components/modal/index.d.ts +1 -1
  157. package/cjs/components/modal/show.d.ts +2 -4
  158. package/cjs/components/modal/show.js +9 -47
  159. package/cjs/components/picker/picker.js +6 -9
  160. package/cjs/components/picker-view/columns-extend.d.ts +3 -0
  161. package/cjs/components/picker-view/columns-extend.js +45 -0
  162. package/cjs/components/picker-view/picker-view.d.ts +1 -0
  163. package/cjs/components/picker-view/picker-view.js +14 -16
  164. package/cjs/components/popover/popover.css +1 -0
  165. package/cjs/components/popover/popover.js +1 -0
  166. package/cjs/components/popover/temp-floating-ui.min.js +1 -430
  167. package/cjs/components/radio/radio.js +4 -20
  168. package/cjs/components/search-bar/search-bar.d.ts +1 -1
  169. package/cjs/components/tab-bar/tab-bar.d.ts +1 -1
  170. package/cjs/components/tab-bar/tab-bar.js +1 -1
  171. package/cjs/components/tree-select/tree-select.js +2 -2
  172. package/cjs/utils/render-imperatively.d.ts +10 -0
  173. package/cjs/utils/render-imperatively.js +68 -0
  174. package/cjs/utils/with-cache.d.ts +1 -0
  175. package/cjs/utils/with-cache.js +17 -0
  176. package/es/components/action-sheet/action-sheet.d.ts +5 -5
  177. package/es/components/action-sheet/action-sheet.js +5 -41
  178. package/es/components/action-sheet/index.d.ts +1 -1
  179. package/es/components/badge/badge.js +1 -1
  180. package/es/components/calendar/calendar.d.ts +4 -3
  181. package/es/components/calendar/calendar.js +67 -58
  182. package/es/components/calendar/convert.d.ts +2 -0
  183. package/es/components/calendar/convert.js +15 -0
  184. package/es/components/cascader-view/cascader-view.js +7 -0
  185. package/es/components/checkbox/checkbox.js +4 -21
  186. package/es/components/checkbox/native-input.d.ts +10 -0
  187. package/es/components/checkbox/native-input.js +28 -0
  188. package/es/components/dialog/index.d.ts +1 -1
  189. package/es/components/dialog/show.d.ts +2 -4
  190. package/es/components/dialog/show.js +8 -44
  191. package/es/components/dot-loading/dot-loading.js +1 -2
  192. package/es/components/empty/empty-icon.d.ts +3 -0
  193. package/es/components/empty/empty-icon.js +24 -0
  194. package/es/components/empty/empty.js +27 -14
  195. package/es/components/error-block/error-block.css +1 -0
  196. package/es/components/error-block/error-block.js +4 -6
  197. package/es/components/error-block/images/busy.d.ts +1 -0
  198. package/es/components/error-block/images/busy.js +90 -0
  199. package/es/components/error-block/images/default.d.ts +1 -0
  200. package/es/components/error-block/images/default.js +166 -0
  201. package/es/components/error-block/images/disconnected.d.ts +1 -0
  202. package/es/components/error-block/images/disconnected.js +123 -0
  203. package/es/components/error-block/images/empty.d.ts +1 -0
  204. package/es/components/error-block/images/empty.js +119 -0
  205. package/es/components/error-block/images/index.d.ts +2 -0
  206. package/es/components/error-block/images/index.js +10 -0
  207. package/es/components/floating-bubble/floating-bubble.css +2 -1
  208. package/es/components/floating-bubble/floating-bubble.d.ts +1 -1
  209. package/es/components/form/form-item.d.ts +1 -1
  210. package/es/components/form/form-item.js +4 -1
  211. package/es/components/image-viewer/index.d.ts +1 -1
  212. package/es/components/image-viewer/methods.d.ts +3 -7
  213. package/es/components/image-viewer/methods.js +12 -75
  214. package/es/components/modal/index.d.ts +1 -1
  215. package/es/components/modal/show.d.ts +2 -4
  216. package/es/components/modal/show.js +8 -44
  217. package/es/components/picker/picker.js +6 -8
  218. package/es/components/picker-view/columns-extend.d.ts +3 -0
  219. package/es/components/picker-view/columns-extend.js +34 -0
  220. package/es/components/picker-view/picker-view.d.ts +1 -0
  221. package/es/components/picker-view/picker-view.js +14 -15
  222. package/es/components/popover/popover.css +1 -0
  223. package/es/components/popover/popover.js +1 -0
  224. package/es/components/popover/temp-floating-ui.min.js +1 -430
  225. package/es/components/radio/radio.js +4 -21
  226. package/es/components/search-bar/search-bar.d.ts +1 -1
  227. package/es/components/tab-bar/tab-bar.d.ts +1 -1
  228. package/es/components/tab-bar/tab-bar.js +1 -1
  229. package/es/components/tree-select/tree-select.js +2 -2
  230. package/es/utils/render-imperatively.d.ts +10 -0
  231. package/es/utils/render-imperatively.js +53 -0
  232. package/es/utils/with-cache.d.ts +1 -0
  233. package/es/utils/with-cache.js +10 -0
  234. package/package.json +2 -3
  235. package/umd/antd-mobile.js +1 -1
  236. package/2x/assets/busy.svg +0 -42
  237. package/2x/assets/default.svg +0 -53
  238. package/2x/assets/disconnected.svg +0 -60
  239. package/2x/assets/empty-icon.svg +0 -18
  240. package/2x/assets/empty.svg +0 -52
  241. package/2x/cjs/assets/busy.svg +0 -42
  242. package/2x/cjs/assets/default.svg +0 -53
  243. package/2x/cjs/assets/disconnected.svg +0 -60
  244. package/2x/cjs/assets/empty-icon.svg +0 -18
  245. package/2x/cjs/assets/empty.svg +0 -52
  246. package/2x/cjs/components/error-block/error.d.ts +0 -1
  247. package/2x/cjs/components/error-block/error.js +0 -24
  248. package/2x/cjs/components/picker-view/use-columns.d.ts +0 -2
  249. package/2x/cjs/components/picker-view/use-columns.js +0 -18
  250. package/2x/cjs/components/picker-view/use-picker-value-extend.d.ts +0 -2
  251. package/2x/cjs/components/picker-view/use-picker-value-extend.js +0 -37
  252. package/2x/es/assets/busy.svg +0 -42
  253. package/2x/es/assets/default.svg +0 -53
  254. package/2x/es/assets/disconnected.svg +0 -60
  255. package/2x/es/assets/empty-icon.svg +0 -18
  256. package/2x/es/assets/empty.svg +0 -52
  257. package/2x/es/components/error-block/error.d.ts +0 -1
  258. package/2x/es/components/error-block/error.js +0 -10
  259. package/2x/es/components/picker-view/use-columns.d.ts +0 -2
  260. package/2x/es/components/picker-view/use-columns.js +0 -10
  261. package/2x/es/components/picker-view/use-picker-value-extend.d.ts +0 -2
  262. package/2x/es/components/picker-view/use-picker-value-extend.js +0 -26
  263. package/assets/busy.svg +0 -42
  264. package/assets/default.svg +0 -53
  265. package/assets/disconnected.svg +0 -60
  266. package/assets/empty-icon.svg +0 -18
  267. package/assets/empty.svg +0 -52
  268. package/cjs/assets/busy.svg +0 -42
  269. package/cjs/assets/default.svg +0 -53
  270. package/cjs/assets/disconnected.svg +0 -60
  271. package/cjs/assets/empty-icon.svg +0 -18
  272. package/cjs/assets/empty.svg +0 -52
  273. package/cjs/components/error-block/error.d.ts +0 -1
  274. package/cjs/components/error-block/error.js +0 -24
  275. package/cjs/components/picker-view/use-columns.d.ts +0 -2
  276. package/cjs/components/picker-view/use-columns.js +0 -18
  277. package/cjs/components/picker-view/use-picker-value-extend.d.ts +0 -2
  278. package/cjs/components/picker-view/use-picker-value-extend.js +0 -37
  279. package/es/assets/busy.svg +0 -42
  280. package/es/assets/default.svg +0 -53
  281. package/es/assets/disconnected.svg +0 -60
  282. package/es/assets/empty-icon.svg +0 -18
  283. package/es/assets/empty.svg +0 -52
  284. package/es/components/error-block/error.d.ts +0 -1
  285. package/es/components/error-block/error.js +0 -10
  286. package/es/components/picker-view/use-columns.d.ts +0 -2
  287. package/es/components/picker-view/use-columns.js +0 -10
  288. package/es/components/picker-view/use-picker-value-extend.d.ts +0 -2
  289. package/es/components/picker-view/use-picker-value-extend.js +0 -26
@@ -1,430 +1 @@
1
- !(function (t, e) {
2
- 'object' == typeof exports && 'undefined' != typeof module
3
- ? e(exports, require('@floating-ui/core'))
4
- : 'function' == typeof define && define.amd
5
- ? define(['exports', '@floating-ui/core'], e)
6
- : e(
7
- ((t =
8
- 'undefined' != typeof globalThis
9
- ? globalThis
10
- : t || self).FloatingUIDOM = {}),
11
- t.FloatingUICore
12
- )
13
- })(this, function (t, e) {
14
- 'use strict'
15
- function n(t) {
16
- return '[object Window]' === (null == t ? void 0 : t.toString())
17
- }
18
- function o(t) {
19
- if (null == t) return window
20
- if (!n(t)) {
21
- const e = t.ownerDocument
22
- return (e && e.defaultView) || window
23
- }
24
- return t
25
- }
26
- function i(t) {
27
- return o(t).getComputedStyle(t)
28
- }
29
- function r(t) {
30
- return n(t) ? '' : t ? (t.nodeName || '').toLowerCase() : ''
31
- }
32
- function l(t) {
33
- return t instanceof o(t).HTMLElement
34
- }
35
- function c(t) {
36
- return t instanceof o(t).Element
37
- }
38
- function f(t) {
39
- return t instanceof o(t).ShadowRoot || t instanceof ShadowRoot
40
- }
41
- function u(t) {
42
- const { overflow: e, overflowX: n, overflowY: o } = i(t)
43
- return /auto|scroll|overlay|hidden/.test(e + o + n)
44
- }
45
- function s(t) {
46
- return ['table', 'td', 'th'].includes(r(t))
47
- }
48
- function d(t) {
49
- const e = navigator.userAgent.toLowerCase().includes('firefox'),
50
- n = i(t)
51
- return (
52
- 'none' !== n.transform ||
53
- 'none' !== n.perspective ||
54
- 'paint' === n.contain ||
55
- ['transform', 'perspective'].includes(n.willChange) ||
56
- (e && 'filter' === n.willChange) ||
57
- (e && !!n.filter && 'none' !== n.filter)
58
- )
59
- }
60
- const h = Math.min,
61
- a = Math.max,
62
- g = Math.round
63
- function p(t, e) {
64
- void 0 === e && (e = !1)
65
- const n = t.getBoundingClientRect()
66
- let o = 1,
67
- i = 1
68
- return (
69
- e &&
70
- l(t) &&
71
- ((o = (t.offsetWidth > 0 && g(n.width) / t.offsetWidth) || 1),
72
- (i = (t.offsetHeight > 0 && g(n.height) / t.offsetHeight) || 1)),
73
- {
74
- width: n.width / o,
75
- height: n.height / i,
76
- top: n.top / i,
77
- right: n.right / o,
78
- bottom: n.bottom / i,
79
- left: n.left / o,
80
- x: n.left / o,
81
- y: n.top / i,
82
- }
83
- )
84
- }
85
- function m(t) {
86
- return ((e = t),
87
- (e instanceof o(e).Node ? t.ownerDocument : t.document) ||
88
- window.document).documentElement
89
- var e
90
- }
91
- function y(t) {
92
- return n(t)
93
- ? { scrollLeft: t.pageXOffset, scrollTop: t.pageYOffset }
94
- : { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop }
95
- }
96
- function w(t) {
97
- return p(m(t)).left + y(t).scrollLeft
98
- }
99
- function b(t, e, n) {
100
- const o = l(e),
101
- i = m(e),
102
- c = p(
103
- t,
104
- o &&
105
- (function (t) {
106
- const e = p(t)
107
- return (
108
- g(e.width) !== t.offsetWidth || g(e.height) !== t.offsetHeight
109
- )
110
- })(e)
111
- )
112
- let f = { scrollLeft: 0, scrollTop: 0 }
113
- const s = { x: 0, y: 0 }
114
- if (o || (!o && 'fixed' !== n))
115
- if ((('body' !== r(e) || u(i)) && (f = y(e)), l(e))) {
116
- const t = p(e, !0)
117
- ;(s.x = t.x + e.clientLeft), (s.y = t.y + e.clientTop)
118
- } else i && (s.x = w(i))
119
- return {
120
- x: c.left + f.scrollLeft - s.x,
121
- y: c.top + f.scrollTop - s.y,
122
- width: c.width,
123
- height: c.height,
124
- }
125
- }
126
- function v(t) {
127
- return 'html' === r(t)
128
- ? t
129
- : t.assignedSlot || t.parentNode || (f(t) ? t.host : null) || m(t)
130
- }
131
- function x(t) {
132
- return l(t) && 'fixed' !== getComputedStyle(t).position
133
- ? t.offsetParent
134
- : null
135
- }
136
- function L(t) {
137
- const e = o(t)
138
- let n = x(t)
139
- for (; n && s(n) && 'static' === getComputedStyle(n).position; ) n = x(n)
140
- return n &&
141
- ('html' === r(n) ||
142
- ('body' === r(n) && 'static' === getComputedStyle(n).position && !d(n)))
143
- ? e
144
- : n ||
145
- (function (t) {
146
- let e = v(t)
147
- for (
148
- f(e) && (e = e.host);
149
- l(e) && !['html', 'body'].includes(r(e));
150
-
151
- ) {
152
- if (d(e)) return e
153
- e = e.parentNode
154
- }
155
- return null
156
- })(t) ||
157
- e
158
- }
159
- function O(t) {
160
- if (l(t)) return { width: t.offsetWidth, height: t.offsetHeight }
161
- const e = p(t)
162
- return { width: e.width, height: e.height }
163
- }
164
- function P(t) {
165
- const e = v(t)
166
- return ['html', 'body', '#document'].includes(r(e))
167
- ? t.ownerDocument.body
168
- : l(e) && u(e)
169
- ? e
170
- : P(e)
171
- }
172
- function R(t, e) {
173
- var n
174
- void 0 === e && (e = [])
175
- const i = P(t),
176
- r = i === (null == (n = t.ownerDocument) ? void 0 : n.body),
177
- l = o(i),
178
- c = r ? [l].concat(l.visualViewport || [], u(i) ? i : []) : i,
179
- f = e.concat(c)
180
- return r ? f : f.concat(R(v(c)))
181
- }
182
- function T(t, n) {
183
- return 'viewport' === n
184
- ? e.rectToClientRect(
185
- (function (t) {
186
- const e = o(t),
187
- n = m(t),
188
- i = e.visualViewport
189
- let r = n.clientWidth,
190
- l = n.clientHeight,
191
- c = 0,
192
- f = 0
193
- return (
194
- i &&
195
- ((r = i.width),
196
- (l = i.height),
197
- Math.abs(e.innerWidth / i.scale - i.width) < 0.01 &&
198
- ((c = i.offsetLeft), (f = i.offsetTop))),
199
- { width: r, height: l, x: c, y: f }
200
- )
201
- })(t)
202
- )
203
- : c(n)
204
- ? (function (t) {
205
- const e = p(t),
206
- n = e.top + t.clientTop,
207
- o = e.left + t.clientLeft
208
- return {
209
- top: n,
210
- left: o,
211
- x: o,
212
- y: n,
213
- right: o + t.clientWidth,
214
- bottom: n + t.clientHeight,
215
- width: t.clientWidth,
216
- height: t.clientHeight,
217
- }
218
- })(n)
219
- : e.rectToClientRect(
220
- (function (t) {
221
- var e
222
- const n = m(t),
223
- o = y(t),
224
- r = null == (e = t.ownerDocument) ? void 0 : e.body,
225
- l = a(
226
- n.scrollWidth,
227
- n.clientWidth,
228
- r ? r.scrollWidth : 0,
229
- r ? r.clientWidth : 0
230
- ),
231
- c = a(
232
- n.scrollHeight,
233
- n.clientHeight,
234
- r ? r.scrollHeight : 0,
235
- r ? r.clientHeight : 0
236
- )
237
- let f = -o.scrollLeft + w(t)
238
- const u = -o.scrollTop
239
- return (
240
- 'rtl' === i(r || n).direction &&
241
- (f += a(n.clientWidth, r ? r.clientWidth : 0) - l),
242
- { width: l, height: c, x: f, y: u }
243
- )
244
- })(m(t))
245
- )
246
- }
247
- function C(t) {
248
- const e = R(t),
249
- n = ['absolute', 'fixed'].includes(i(t).position) && l(t) ? L(t) : t
250
- return c(n)
251
- ? e.filter(
252
- t =>
253
- c(t) &&
254
- (function (t, e) {
255
- const n = null == e.getRootNode ? void 0 : e.getRootNode()
256
- if (t.contains(e)) return !0
257
- if (n && f(n)) {
258
- let n = e
259
- do {
260
- if (n && t === n) return !0
261
- n = n.parentNode || n.host
262
- } while (n)
263
- }
264
- return !1
265
- })(t, n) &&
266
- 'body' !== r(t)
267
- )
268
- : []
269
- }
270
- const W = {
271
- getClippingRect: function (t) {
272
- let { element: e, boundary: n, rootBoundary: o } = t
273
- const i = [...('clippingAncestors' === n ? C(e) : [].concat(n)), o],
274
- r = i[0],
275
- l = i.reduce((t, n) => {
276
- const o = T(e, n)
277
- return (
278
- (t.top = a(o.top, t.top)),
279
- (t.right = h(o.right, t.right)),
280
- (t.bottom = h(o.bottom, t.bottom)),
281
- (t.left = a(o.left, t.left)),
282
- t
283
- )
284
- }, T(e, r))
285
- return {
286
- width: l.right - l.left,
287
- height: l.bottom - l.top,
288
- x: l.left,
289
- y: l.top,
290
- }
291
- },
292
- convertOffsetParentRelativeRectToViewportRelativeRect: function (t) {
293
- let { rect: e, offsetParent: n, strategy: o } = t
294
- const i = l(n),
295
- c = m(n)
296
- if (n === c) return e
297
- let f = { scrollLeft: 0, scrollTop: 0 }
298
- const s = { x: 0, y: 0 }
299
- if (
300
- (i || (!i && 'fixed' !== o)) &&
301
- (('body' !== r(n) || u(c)) && (f = y(n)), l(n))
302
- ) {
303
- const t = p(n, !0)
304
- ;(s.x = t.x + n.clientLeft), (s.y = t.y + n.clientTop)
305
- }
306
- return { ...e, x: e.x - f.scrollLeft + s.x, y: e.y - f.scrollTop + s.y }
307
- },
308
- isElement: c,
309
- getDimensions: O,
310
- getOffsetParent: L,
311
- getDocumentElement: m,
312
- getElementRects: t => {
313
- let { reference: e, floating: n, strategy: o } = t
314
- return { reference: b(e, L(n), o), floating: { ...O(n), x: 0, y: 0 } }
315
- },
316
- getClientRects: t => Array.from(t.getClientRects()),
317
- isRTL: t => 'rtl' === i(t).direction,
318
- }
319
- Object.defineProperty(t, 'arrow', {
320
- enumerable: !0,
321
- get: function () {
322
- return e.arrow
323
- },
324
- }),
325
- Object.defineProperty(t, 'autoPlacement', {
326
- enumerable: !0,
327
- get: function () {
328
- return e.autoPlacement
329
- },
330
- }),
331
- Object.defineProperty(t, 'detectOverflow', {
332
- enumerable: !0,
333
- get: function () {
334
- return e.detectOverflow
335
- },
336
- }),
337
- Object.defineProperty(t, 'flip', {
338
- enumerable: !0,
339
- get: function () {
340
- return e.flip
341
- },
342
- }),
343
- Object.defineProperty(t, 'hide', {
344
- enumerable: !0,
345
- get: function () {
346
- return e.hide
347
- },
348
- }),
349
- Object.defineProperty(t, 'inline', {
350
- enumerable: !0,
351
- get: function () {
352
- return e.inline
353
- },
354
- }),
355
- Object.defineProperty(t, 'limitShift', {
356
- enumerable: !0,
357
- get: function () {
358
- return e.limitShift
359
- },
360
- }),
361
- Object.defineProperty(t, 'offset', {
362
- enumerable: !0,
363
- get: function () {
364
- return e.offset
365
- },
366
- }),
367
- Object.defineProperty(t, 'shift', {
368
- enumerable: !0,
369
- get: function () {
370
- return e.shift
371
- },
372
- }),
373
- Object.defineProperty(t, 'size', {
374
- enumerable: !0,
375
- get: function () {
376
- return e.size
377
- },
378
- }),
379
- (t.autoUpdate = function (t, e, n, o) {
380
- void 0 === o && (o = {})
381
- const {
382
- ancestorScroll: i = !0,
383
- ancestorResize: r = !0,
384
- elementResize: l = !0,
385
- animationFrame: f = !1,
386
- } = o
387
- let u = !1
388
- const s = i && !f,
389
- d = r && !f,
390
- h = l && !f,
391
- a = s || d ? [...(c(t) ? R(t) : []), ...R(e)] : []
392
- a.forEach(t => {
393
- s && t.addEventListener('scroll', n, { passive: !0 }),
394
- d && t.addEventListener('resize', n)
395
- })
396
- let g,
397
- m = null
398
- h && ((m = new ResizeObserver(n)), c(t) && m.observe(t), m.observe(e))
399
- let y = f ? p(t) : null
400
- return (
401
- f &&
402
- (function e() {
403
- if (u) return
404
- const o = p(t)
405
- !y ||
406
- (o.x === y.x &&
407
- o.y === y.y &&
408
- o.width === y.width &&
409
- o.height === y.height) ||
410
- n()
411
- ;(y = o), (g = requestAnimationFrame(e))
412
- })(),
413
- () => {
414
- var t
415
- ;(u = !0),
416
- a.forEach(t => {
417
- s && t.removeEventListener('scroll', n),
418
- d && t.removeEventListener('resize', n)
419
- }),
420
- null == (t = m) || t.disconnect(),
421
- (m = null),
422
- f && cancelAnimationFrame(g)
423
- }
424
- )
425
- }),
426
- (t.computePosition = (t, n, o) =>
427
- e.computePosition(t, n, { platform: W, ...o })),
428
- (t.getOverflowAncestors = R),
429
- Object.defineProperty(t, '__esModule', { value: !0 })
430
- })
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@floating-ui/core")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIDOM={},t.FloatingUICore)}(this,(function(t,e){"use strict";function n(t){return"[object Window]"===(null==t?void 0:t.toString())}function o(t){if(null==t)return window;if(!n(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return o(t).getComputedStyle(t)}function r(t){return n(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(t){return t instanceof o(t).HTMLElement}function c(t){return t instanceof o(t).Element}function f(t){return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:n,overflowY:o}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function s(t){return["table","td","th"].includes(r(t))}function d(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=i(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}const h=Math.min,a=Math.max,g=Math.round;function p(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&l(t)&&(o=t.offsetWidth>0&&g(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&g(n.height)/t.offsetHeight||1),{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function m(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function y(t){return n(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function w(t){return p(m(t)).left+y(t).scrollLeft}function b(t,e,n){const o=l(e),i=m(e),c=p(t,o&&function(t){const e=p(t);return g(e.width)!==t.offsetWidth||g(e.height)!==t.offsetHeight}(e));let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(f=y(e)),l(e)){const t=p(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=w(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function v(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||m(t)}function x(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function L(t){const e=o(t);let n=x(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=x(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=v(t);for(f(e)&&(e=e.host);l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function O(t){if(l(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=p(t);return{width:e.width,height:e.height}}function P(t){const e=v(t);return["html","body","#document"].includes(r(e))?t.ownerDocument.body:l(e)&&u(e)?e:P(e)}function R(t,e){var n;void 0===e&&(e=[]);const i=P(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(R(v(c)))}function T(t,n){return"viewport"===n?e.rectToClientRect(function(t){const e=o(t),n=m(t),i=e.visualViewport;let r=n.clientWidth,l=n.clientHeight,c=0,f=0;return i&&(r=i.width,l=i.height,Math.abs(e.innerWidth/i.scale-i.width)<.01&&(c=i.offsetLeft,f=i.offsetTop)),{width:r,height:l,x:c,y:f}}(t)):c(n)?function(t){const e=p(t),n=e.top+t.clientTop,o=e.left+t.clientLeft;return{top:n,left:o,x:o,y:n,right:o+t.clientWidth,bottom:n+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n):e.rectToClientRect(function(t){var e;const n=m(t),o=y(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=a(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=a(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+w(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=a(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(m(t)))}function C(t){const e=R(t),n=["absolute","fixed"].includes(i(t).position)&&l(t)?L(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&f(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==r(t))):[]}const W={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingAncestors"===n?C(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=T(e,n);return t.top=a(o.top,t.top),t.right=h(o.right,t.right),t.bottom=h(o.bottom,t.bottom),t.left=a(o.left,t.left),t}),T(e,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=l(n),c=m(n);if(n===c)return e;let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||u(c))&&(f=y(n)),l(n))){const t=p(n,!0);s.x=t.x+n.clientLeft,s.y=t.y+n.clientTop}return{...e,x:e.x-f.scrollLeft+s.x,y:e.y-f.scrollTop+s.y}},isElement:c,getDimensions:O,getOffsetParent:L,getDocumentElement:m,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:b(e,L(n),o),floating:{...O(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};Object.defineProperty(t,"arrow",{enumerable:!0,get:function(){return e.arrow}}),Object.defineProperty(t,"autoPlacement",{enumerable:!0,get:function(){return e.autoPlacement}}),Object.defineProperty(t,"detectOverflow",{enumerable:!0,get:function(){return e.detectOverflow}}),Object.defineProperty(t,"flip",{enumerable:!0,get:function(){return e.flip}}),Object.defineProperty(t,"hide",{enumerable:!0,get:function(){return e.hide}}),Object.defineProperty(t,"inline",{enumerable:!0,get:function(){return e.inline}}),Object.defineProperty(t,"limitShift",{enumerable:!0,get:function(){return e.limitShift}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}}),Object.defineProperty(t,"shift",{enumerable:!0,get:function(){return e.shift}}),Object.defineProperty(t,"size",{enumerable:!0,get:function(){return e.size}}),t.autoUpdate=function(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:f=!1}=o;let u=!1;const s=i&&!f,d=r&&!f,h=l&&!f,a=s||d?[...c(t)?R(t):[],...R(e)]:[];a.forEach((t=>{s&&t.addEventListener("scroll",n,{passive:!0}),d&&t.addEventListener("resize",n)}));let g,m=null;h&&(m=new ResizeObserver(n),c(t)&&m.observe(t),m.observe(e));let y=f?p(t):null;return f&&function e(){if(u)return;const o=p(t);!y||o.x===y.x&&o.y===y.y&&o.width===y.width&&o.height===y.height||n();y=o,g=requestAnimationFrame(e)}(),()=>{var t;u=!0,a.forEach((t=>{s&&t.removeEventListener("scroll",n),d&&t.removeEventListener("resize",n)})),null==(t=m)||t.disconnect(),m=null,f&&cancelAnimationFrame(g)}},t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:W,...o}),t.getOverflowAncestors=R,Object.defineProperty(t,"__esModule",{value:!0})}));
@@ -23,6 +23,8 @@ var _devLog = require("../../utils/dev-log");
23
23
 
24
24
  var _isDev = require("../../utils/is-dev");
25
25
 
26
+ var _nativeInput = require("../checkbox/native-input");
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  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); }
@@ -87,34 +89,16 @@ const Radio = p => {
87
89
  }, checked && _react.default.createElement(_checkIcon.CheckIcon, null));
88
90
  };
89
91
 
90
- const inputRef = (0, _react.useRef)(null);
91
- const labelRef = (0, _react.useRef)(null);
92
- (0, _react.useEffect)(() => {
93
- var _a;
94
-
95
- (_a = labelRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', e => {
96
- if (e.target !== inputRef.current) {
97
- e.stopPropagation();
98
- e.stopImmediatePropagation();
99
- }
100
- }, {
101
- capture: false
102
- });
103
- }, []);
104
92
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("label", {
105
- ref: labelRef,
106
93
  className: (0, _classnames.default)(classPrefix, {
107
94
  [`${classPrefix}-checked`]: checked,
108
95
  [`${classPrefix}-disabled`]: disabled,
109
96
  [`${classPrefix}-block`]: props.block
110
97
  })
111
- }, _react.default.createElement("input", {
112
- ref: inputRef,
98
+ }, _react.default.createElement(_nativeInput.NativeInput, {
113
99
  type: 'radio',
114
100
  checked: checked,
115
- onChange: e => {
116
- setChecked(e.target.checked);
117
- },
101
+ onChange: setChecked,
118
102
  disabled: disabled,
119
103
  id: props.id
120
104
  }), renderIcon(), props.children && _react.default.createElement("div", {
@@ -29,4 +29,4 @@ export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps,
29
29
  onSearch?: ((val: string) => void) | undefined;
30
30
  onChange?: ((val: string) => void) | undefined;
31
31
  onCancel?: (() => void) | undefined;
32
- } & NativeProps<"--border-radius" | "--height" | "--padding-left" | "--placeholder-color" | "--background"> & React.RefAttributes<InputRef>>;
32
+ } & NativeProps<"--border-radius" | "--height" | "--padding-left" | "--background" | "--placeholder-color"> & React.RefAttributes<InputRef>>;
@@ -3,7 +3,7 @@ import { NativeProps } from '../../utils/native-props';
3
3
  import { BadgeProps } from '../badge';
4
4
  export declare type TabBarItemProps = {
5
5
  icon?: ReactNode | ((active: boolean) => ReactNode);
6
- title?: ReactNode;
6
+ title?: ReactNode | ((active: boolean) => ReactNode);
7
7
  badge?: BadgeProps['content'];
8
8
  } & NativeProps;
9
9
  export declare const TabBarItem: FC<TabBarItemProps>;
@@ -74,7 +74,7 @@ const TabBar = p => {
74
74
 
75
75
  const titleElement = item.props.title && _react.default.createElement("div", {
76
76
  className: `${classPrefix}-item-title`
77
- }, item.props.title);
77
+ }, typeof item.props.title === 'function' ? item.props.title(active) : item.props.title);
78
78
 
79
79
  if (iconElement) {
80
80
  return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_badge.default, {
@@ -67,12 +67,12 @@ const TreeSelect = p => {
67
67
  let current = node;
68
68
 
69
69
  while (current) {
70
- parentNodes.unshift(current);
70
+ parentNodes.push(current);
71
71
  const next = optionsParentMap.get(current[valueName]);
72
72
  current = next;
73
73
  }
74
74
 
75
- const values = parentNodes.map(i => i[valueName]);
75
+ const values = parentNodes.reverse().map(i => i[valueName]);
76
76
  setValue(values);
77
77
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values, {
78
78
  options: parentNodes
@@ -0,0 +1,10 @@
1
+ import { ReactElement } from 'react';
2
+ declare type ImperativeProps = {
3
+ visible?: boolean;
4
+ onClose?: () => void;
5
+ afterClose?: () => void;
6
+ };
7
+ export declare function renderImperatively(element: ReactElement<ImperativeProps>): {
8
+ close: () => void;
9
+ };
10
+ export {};
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderImperatively = renderImperatively;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _renderToBody = require("./render-to-body");
11
+
12
+ 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); }
13
+
14
+ 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; }
15
+
16
+ function renderImperatively(element) {
17
+ const Wrapper = _react.default.forwardRef((_, ref) => {
18
+ const [visible, setVisible] = (0, _react.useState)(false);
19
+ const closedRef = (0, _react.useRef)(false);
20
+ (0, _react.useEffect)(() => {
21
+ if (!closedRef.current) {
22
+ setVisible(true);
23
+ } else {
24
+ afterClose();
25
+ }
26
+ }, []);
27
+
28
+ function onClose() {
29
+ var _a, _b;
30
+
31
+ closedRef.current = true;
32
+ setVisible(false);
33
+ (_b = (_a = element.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
34
+ }
35
+
36
+ function afterClose() {
37
+ var _a, _b;
38
+
39
+ unmount();
40
+ (_b = (_a = element.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
41
+ }
42
+
43
+ (0, _react.useImperativeHandle)(ref, () => ({
44
+ close: onClose
45
+ }));
46
+ return _react.default.cloneElement(element, Object.assign(Object.assign({}, element.props), {
47
+ visible,
48
+ onClose,
49
+ afterClose
50
+ }));
51
+ });
52
+
53
+ const wrapperRef = _react.default.createRef();
54
+
55
+ const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
56
+ ref: wrapperRef
57
+ }));
58
+
59
+ function close() {
60
+ var _a;
61
+
62
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.close();
63
+ }
64
+
65
+ return {
66
+ close
67
+ };
68
+ }
@@ -0,0 +1 @@
1
+ export declare function withCache<T>(generate: () => T): () => T;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withCache = withCache;
7
+
8
+ function withCache(generate) {
9
+ let cache = null;
10
+ return () => {
11
+ if (cache === null) {
12
+ cache = generate();
13
+ }
14
+
15
+ return cache;
16
+ };
17
+ }
@@ -10,7 +10,7 @@ export declare type Action = {
10
10
  onClick?: () => void;
11
11
  };
12
12
  export declare type ActionSheetProps = {
13
- visible: boolean;
13
+ visible?: boolean;
14
14
  actions: Action[];
15
15
  extra?: React.ReactNode;
16
16
  cancelText?: React.ReactNode;
@@ -22,11 +22,11 @@ export declare type ActionSheetProps = {
22
22
  closeOnMaskClick?: boolean;
23
23
  getContainer?: GetContainer;
24
24
  safeArea?: boolean;
25
+ popupClassName?: string;
26
+ popupStyle?: React.CSSProperties;
25
27
  } & NativeProps;
26
28
  export declare const ActionSheet: FC<ActionSheetProps>;
27
- export declare type ActionSheetRef = {
28
- close: () => void;
29
- };
30
- export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible'>): {
29
+ export declare type ActionSheetShowHandler = {
31
30
  close: () => void;
32
31
  };
32
+ export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible'>): ActionSheetShowHandler;