antd-mobile 5.5.1 → 5.6.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 (123) 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/cascader-view/cascader-view.js +7 -0
  6. package/2x/cjs/components/checkbox/checkbox.js +4 -20
  7. package/2x/cjs/components/checkbox/native-input.d.ts +10 -0
  8. package/2x/cjs/components/checkbox/native-input.js +42 -0
  9. package/2x/cjs/components/dialog/index.d.ts +1 -1
  10. package/2x/cjs/components/dialog/show.d.ts +2 -4
  11. package/2x/cjs/components/dialog/show.js +9 -47
  12. package/2x/cjs/components/dot-loading/dot-loading.js +1 -2
  13. package/2x/cjs/components/error-block/error-block.js +4 -2
  14. package/2x/cjs/components/floating-bubble/floating-bubble.css +2 -1
  15. package/2x/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
  16. package/2x/cjs/components/image-viewer/index.d.ts +1 -1
  17. package/2x/cjs/components/image-viewer/methods.d.ts +3 -4
  18. package/2x/cjs/components/image-viewer/methods.js +41 -56
  19. package/2x/cjs/components/modal/index.d.ts +1 -1
  20. package/2x/cjs/components/modal/show.d.ts +2 -4
  21. package/2x/cjs/components/modal/show.js +9 -47
  22. package/2x/cjs/components/popover/popover.js +1 -0
  23. package/2x/cjs/components/popover/temp-floating-ui.min.js +1 -430
  24. package/2x/cjs/components/radio/radio.js +4 -20
  25. package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
  26. package/2x/cjs/components/tab-bar/tab-bar.d.ts +1 -1
  27. package/2x/cjs/components/tab-bar/tab-bar.js +1 -1
  28. package/2x/cjs/components/tree-select/tree-select.js +2 -2
  29. package/2x/cjs/utils/render-imperatively.d.ts +10 -0
  30. package/2x/cjs/utils/render-imperatively.js +58 -0
  31. package/2x/es/components/action-sheet/action-sheet.d.ts +5 -5
  32. package/2x/es/components/action-sheet/action-sheet.js +5 -41
  33. package/2x/es/components/action-sheet/index.d.ts +1 -1
  34. package/2x/es/components/badge/badge.js +1 -1
  35. package/2x/es/components/cascader-view/cascader-view.js +7 -0
  36. package/2x/es/components/checkbox/checkbox.js +4 -21
  37. package/2x/es/components/checkbox/native-input.d.ts +10 -0
  38. package/2x/es/components/checkbox/native-input.js +28 -0
  39. package/2x/es/components/dialog/index.d.ts +1 -1
  40. package/2x/es/components/dialog/show.d.ts +2 -4
  41. package/2x/es/components/dialog/show.js +8 -44
  42. package/2x/es/components/dot-loading/dot-loading.js +1 -2
  43. package/2x/es/components/error-block/error-block.js +4 -2
  44. package/2x/es/components/floating-bubble/floating-bubble.css +2 -1
  45. package/2x/es/components/floating-bubble/floating-bubble.d.ts +1 -1
  46. package/2x/es/components/image-viewer/index.d.ts +1 -1
  47. package/2x/es/components/image-viewer/methods.d.ts +3 -4
  48. package/2x/es/components/image-viewer/methods.js +38 -57
  49. package/2x/es/components/modal/index.d.ts +1 -1
  50. package/2x/es/components/modal/show.d.ts +2 -4
  51. package/2x/es/components/modal/show.js +8 -44
  52. package/2x/es/components/popover/popover.js +1 -0
  53. package/2x/es/components/popover/temp-floating-ui.min.js +1 -430
  54. package/2x/es/components/radio/radio.js +4 -21
  55. package/2x/es/components/search-bar/search-bar.d.ts +1 -1
  56. package/2x/es/components/tab-bar/tab-bar.d.ts +1 -1
  57. package/2x/es/components/tab-bar/tab-bar.js +1 -1
  58. package/2x/es/components/tree-select/tree-select.js +2 -2
  59. package/2x/es/utils/render-imperatively.d.ts +10 -0
  60. package/2x/es/utils/render-imperatively.js +45 -0
  61. package/2x/package.json +2 -3
  62. package/cjs/components/action-sheet/action-sheet.d.ts +5 -5
  63. package/cjs/components/action-sheet/action-sheet.js +6 -46
  64. package/cjs/components/action-sheet/index.d.ts +1 -1
  65. package/cjs/components/badge/badge.js +1 -1
  66. package/cjs/components/cascader-view/cascader-view.js +7 -0
  67. package/cjs/components/checkbox/checkbox.js +4 -20
  68. package/cjs/components/checkbox/native-input.d.ts +10 -0
  69. package/cjs/components/checkbox/native-input.js +42 -0
  70. package/cjs/components/dialog/index.d.ts +1 -1
  71. package/cjs/components/dialog/show.d.ts +2 -4
  72. package/cjs/components/dialog/show.js +9 -47
  73. package/cjs/components/dot-loading/dot-loading.js +1 -2
  74. package/cjs/components/error-block/error-block.js +4 -2
  75. package/cjs/components/floating-bubble/floating-bubble.css +2 -1
  76. package/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
  77. package/cjs/components/image-viewer/index.d.ts +1 -1
  78. package/cjs/components/image-viewer/methods.d.ts +3 -4
  79. package/cjs/components/image-viewer/methods.js +41 -56
  80. package/cjs/components/modal/index.d.ts +1 -1
  81. package/cjs/components/modal/show.d.ts +2 -4
  82. package/cjs/components/modal/show.js +9 -47
  83. package/cjs/components/popover/popover.js +1 -0
  84. package/cjs/components/popover/temp-floating-ui.min.js +1 -430
  85. package/cjs/components/radio/radio.js +4 -20
  86. package/cjs/components/search-bar/search-bar.d.ts +1 -1
  87. package/cjs/components/tab-bar/tab-bar.d.ts +1 -1
  88. package/cjs/components/tab-bar/tab-bar.js +1 -1
  89. package/cjs/components/tree-select/tree-select.js +2 -2
  90. package/cjs/utils/render-imperatively.d.ts +10 -0
  91. package/cjs/utils/render-imperatively.js +58 -0
  92. package/es/components/action-sheet/action-sheet.d.ts +5 -5
  93. package/es/components/action-sheet/action-sheet.js +5 -41
  94. package/es/components/action-sheet/index.d.ts +1 -1
  95. package/es/components/badge/badge.js +1 -1
  96. package/es/components/cascader-view/cascader-view.js +7 -0
  97. package/es/components/checkbox/checkbox.js +4 -21
  98. package/es/components/checkbox/native-input.d.ts +10 -0
  99. package/es/components/checkbox/native-input.js +28 -0
  100. package/es/components/dialog/index.d.ts +1 -1
  101. package/es/components/dialog/show.d.ts +2 -4
  102. package/es/components/dialog/show.js +8 -44
  103. package/es/components/dot-loading/dot-loading.js +1 -2
  104. package/es/components/error-block/error-block.js +4 -2
  105. package/es/components/floating-bubble/floating-bubble.css +2 -1
  106. package/es/components/floating-bubble/floating-bubble.d.ts +1 -1
  107. package/es/components/image-viewer/index.d.ts +1 -1
  108. package/es/components/image-viewer/methods.d.ts +3 -4
  109. package/es/components/image-viewer/methods.js +38 -57
  110. package/es/components/modal/index.d.ts +1 -1
  111. package/es/components/modal/show.d.ts +2 -4
  112. package/es/components/modal/show.js +8 -44
  113. package/es/components/popover/popover.js +1 -0
  114. package/es/components/popover/temp-floating-ui.min.js +1 -430
  115. package/es/components/radio/radio.js +4 -21
  116. package/es/components/search-bar/search-bar.d.ts +1 -1
  117. package/es/components/tab-bar/tab-bar.d.ts +1 -1
  118. package/es/components/tab-bar/tab-bar.js +1 -1
  119. package/es/components/tree-select/tree-select.js +2 -2
  120. package/es/utils/render-imperatively.d.ts +10 -0
  121. package/es/utils/render-imperatively.js +45 -0
  122. package/package.json +2 -3
  123. package/umd/antd-mobile.js +1 -1
@@ -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})}));
@@ -1,4 +1,4 @@
1
- import React, { useContext, useEffect, useRef } from 'react';
1
+ import React, { useContext } from 'react';
2
2
  import { withNativeProps } from '../../utils/native-props';
3
3
  import classNames from 'classnames';
4
4
  import { RadioGroupContext } from './group-context';
@@ -7,6 +7,7 @@ import { mergeProps } from '../../utils/with-default-props';
7
7
  import { CheckIcon } from '../checkbox/check-icon';
8
8
  import { devWarning } from '../../utils/dev-log';
9
9
  import { isDev } from '../../utils/is-dev';
10
+ import { NativeInput } from '../checkbox/native-input';
10
11
  const classPrefix = `adm-radio`;
11
12
  const defaultProps = {
12
13
  defaultChecked: false
@@ -64,34 +65,16 @@ export const Radio = p => {
64
65
  }, checked && React.createElement(CheckIcon, null));
65
66
  };
66
67
 
67
- const inputRef = useRef(null);
68
- const labelRef = useRef(null);
69
- useEffect(() => {
70
- var _a;
71
-
72
- (_a = labelRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', e => {
73
- if (e.target !== inputRef.current) {
74
- e.stopPropagation();
75
- e.stopImmediatePropagation();
76
- }
77
- }, {
78
- capture: false
79
- });
80
- }, []);
81
68
  return withNativeProps(props, React.createElement("label", {
82
- ref: labelRef,
83
69
  className: classNames(classPrefix, {
84
70
  [`${classPrefix}-checked`]: checked,
85
71
  [`${classPrefix}-disabled`]: disabled,
86
72
  [`${classPrefix}-block`]: props.block
87
73
  })
88
- }, React.createElement("input", {
89
- ref: inputRef,
74
+ }, React.createElement(NativeInput, {
90
75
  type: 'radio',
91
76
  checked: checked,
92
- onChange: e => {
93
- setChecked(e.target.checked);
94
- },
77
+ onChange: setChecked,
95
78
  disabled: disabled,
96
79
  id: props.id
97
80
  }), renderIcon(), props.children && React.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>;
@@ -52,7 +52,7 @@ export const TabBar = p => {
52
52
  }, typeof item.props.icon === 'function' ? item.props.icon(active) : item.props.icon);
53
53
  const titleElement = item.props.title && React.createElement("div", {
54
54
  className: `${classPrefix}-item-title`
55
- }, item.props.title);
55
+ }, typeof item.props.title === 'function' ? item.props.title(active) : item.props.title);
56
56
 
57
57
  if (iconElement) {
58
58
  return React.createElement(React.Fragment, null, React.createElement(Badge, {
@@ -47,12 +47,12 @@ export const TreeSelect = p => {
47
47
  let current = node;
48
48
 
49
49
  while (current) {
50
- parentNodes.unshift(current);
50
+ parentNodes.push(current);
51
51
  const next = optionsParentMap.get(current[valueName]);
52
52
  current = next;
53
53
  }
54
54
 
55
- const values = parentNodes.map(i => i[valueName]);
55
+ const values = parentNodes.reverse().map(i => i[valueName]);
56
56
  setValue(values);
57
57
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values, {
58
58
  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,45 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import { renderToBody } from './render-to-body';
3
+ export function renderImperatively(element) {
4
+ let close = () => {};
5
+
6
+ const Wrapper = () => {
7
+ const [visible, setVisible] = useState(false);
8
+ const closedRef = useRef(false);
9
+ useEffect(() => {
10
+ if (!closedRef.current) {
11
+ setVisible(true);
12
+ } else {
13
+ afterClose();
14
+ }
15
+ }, []);
16
+
17
+ function onClose() {
18
+ var _a, _b;
19
+
20
+ closedRef.current = true;
21
+ setVisible(false);
22
+ (_b = (_a = element.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
23
+ }
24
+
25
+ close = onClose;
26
+
27
+ function afterClose() {
28
+ var _a, _b;
29
+
30
+ unmount();
31
+ (_b = (_a = element.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
32
+ }
33
+
34
+ return React.cloneElement(element, Object.assign(Object.assign({}, element.props), {
35
+ visible,
36
+ onClose,
37
+ afterClose
38
+ }));
39
+ };
40
+
41
+ const unmount = renderToBody(React.createElement(Wrapper, null));
42
+ return {
43
+ close
44
+ };
45
+ }
package/2x/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "dependencies": {
5
5
  "@floating-ui/dom": "^0.3.1",
6
6
  "@react-spring/web": "^9.4.3",
@@ -14,8 +14,7 @@
14
14
  "lodash": "^4.17.21",
15
15
  "rc-field-form": "^1.23.1",
16
16
  "staged-components": "^1.1.2",
17
- "tslib": "^2.3.1",
18
- "use-async-memo": "^1.2.3"
17
+ "tslib": "^2.3.1"
19
18
  },
20
19
  "peerDependencies": {
21
20
  "react": "^16.8.0 || ^17.0.0"
@@ -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;