@arco-design/mobile-react 2.32.0 → 2.34.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 (60) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/hooks.js +2 -0
  5. package/cjs/avatar/index.js +3 -1
  6. package/cjs/avatar/type.d.ts +6 -0
  7. package/cjs/carousel/index.js +18 -1
  8. package/cjs/divider/style/css/index.css +6 -4
  9. package/cjs/divider/style/index.less +3 -1
  10. package/cjs/notice-bar/index.js +11 -8
  11. package/cjs/popover/popover-inner.js +9 -2
  12. package/cjs/steps/index.d.ts +1 -1
  13. package/cjs/steps/index.js +6 -1
  14. package/cjs/steps/style/css/index.css +42 -4
  15. package/cjs/steps/style/index.less +58 -6
  16. package/cjs/steps/type.d.ts +5 -0
  17. package/dist/index.js +77 -41
  18. package/dist/index.min.js +2 -2
  19. package/dist/style.css +32 -7
  20. package/dist/style.min.css +1 -1
  21. package/esm/_helpers/hooks.js +2 -0
  22. package/esm/avatar/index.js +3 -1
  23. package/esm/avatar/type.d.ts +6 -0
  24. package/esm/carousel/index.js +18 -1
  25. package/esm/divider/style/css/index.css +6 -4
  26. package/esm/divider/style/index.less +3 -1
  27. package/esm/notice-bar/index.js +12 -9
  28. package/esm/popover/popover-inner.js +9 -2
  29. package/esm/steps/index.d.ts +1 -1
  30. package/esm/steps/index.js +7 -2
  31. package/esm/steps/style/css/index.css +42 -4
  32. package/esm/steps/style/index.less +58 -6
  33. package/esm/steps/type.d.ts +5 -0
  34. package/esnext/_helpers/hooks.js +6 -2
  35. package/esnext/avatar/index.js +2 -2
  36. package/esnext/avatar/type.d.ts +6 -0
  37. package/esnext/carousel/index.js +13 -4
  38. package/esnext/divider/style/css/index.css +6 -4
  39. package/esnext/divider/style/index.less +3 -1
  40. package/esnext/notice-bar/index.js +6 -6
  41. package/esnext/popover/popover-inner.js +7 -2
  42. package/esnext/steps/index.d.ts +1 -1
  43. package/esnext/steps/index.js +6 -3
  44. package/esnext/steps/style/css/index.css +42 -4
  45. package/esnext/steps/style/index.less +58 -6
  46. package/esnext/steps/type.d.ts +5 -0
  47. package/package.json +3 -3
  48. package/umd/_helpers/hooks.js +2 -0
  49. package/umd/avatar/index.js +3 -1
  50. package/umd/avatar/type.d.ts +6 -0
  51. package/umd/carousel/index.js +18 -1
  52. package/umd/divider/style/css/index.css +6 -4
  53. package/umd/divider/style/index.less +3 -1
  54. package/umd/notice-bar/index.js +11 -8
  55. package/umd/popover/popover-inner.js +9 -2
  56. package/umd/steps/index.d.ts +1 -1
  57. package/umd/steps/index.js +6 -1
  58. package/umd/steps/style/css/index.css +42 -4
  59. package/umd/steps/style/index.less +58 -6
  60. package/umd/steps/type.d.ts +5 -0
package/dist/index.js CHANGED
@@ -3981,6 +3981,8 @@
3981
3981
  setState(value);
3982
3982
  }, []);
3983
3983
  React.useEffect(function () {
3984
+ // see: https://github.com/arco-design/arco-design-mobile/pull/292
3985
+ leavingRef.current = false;
3984
3986
  return function () {
3985
3987
  leavingRef.current = true;
3986
3988
  };
@@ -7813,19 +7815,21 @@
7813
7815
  _e = props.status,
7814
7816
  status = _e === void 0 ? 'process' : _e,
7815
7817
  items = props.items,
7818
+ _f = props.reverseOrder,
7819
+ reverseOrder = _f === void 0 ? false : _f,
7816
7820
  onClick = props.onClick,
7817
7821
  onChange = props.onChange;
7818
7822
  var defaultAlign = direction === 'vertical' ? 'start' : 'center';
7819
7823
  var align = userSetAlign !== void 0 ? userSetAlign : defaultAlign;
7820
7824
 
7821
- var _f = React.useState(Number(defaultIndex)),
7822
- innerIndex = _f[0],
7823
- setInnerIndex = _f[1];
7825
+ var _g = React.useState(Number(defaultIndex)),
7826
+ innerIndex = _g[0],
7827
+ setInnerIndex = _g[1];
7824
7828
 
7825
- var _g = useRefState(current === void 0 ? innerIndex : current),
7826
- activeIndex = _g[0],
7827
- activeRefIndex = _g[1],
7828
- setActiveIndex = _g[2];
7829
+ var _h = useRefState(current === void 0 ? innerIndex : current),
7830
+ activeIndex = _h[0],
7831
+ activeRefIndex = _h[1],
7832
+ setActiveIndex = _h[2];
7829
7833
 
7830
7834
  var domRef = React.useRef(null);
7831
7835
  var system = useSystem();
@@ -7853,6 +7857,7 @@
7853
7857
  index: index,
7854
7858
  status: activeIndex === index ? status : void 0,
7855
7859
  align: align,
7860
+ reverseOrder: reverseOrder,
7856
7861
  changeIndex: changeIndex
7857
7862
  },
7858
7863
  key: index
@@ -7861,7 +7866,9 @@
7861
7866
  return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
7862
7867
  var prefixCls = _a.prefixCls;
7863
7868
  return /*#__PURE__*/React__default["default"].createElement("div", {
7864
- className: prefixCls + "-steps all-border-box " + className + " " + direction + " " + system,
7869
+ className: cls(prefixCls + "-steps all-border-box " + className + " " + direction + " " + system, {
7870
+ 'reverse-order': reverseOrder
7871
+ }),
7865
7872
  style: style,
7866
7873
  ref: domRef
7867
7874
  }, items ? items.map(function (item, index) {
@@ -9826,24 +9833,26 @@
9826
9833
  textAvatar = _g === void 0 ? '' : _g,
9827
9834
  _h = props.avatarStyle,
9828
9835
  avatarStyle = _h === void 0 ? {} : _h,
9829
- _j = props.autoFixFontSize,
9830
- autoFixFontSize = _j === void 0 ? true : _j,
9831
- _k = props.autoFixFontOffset,
9832
- autoFixFontOffset = _k === void 0 ? 2 : _k,
9833
- _l = props.avatarName,
9834
- avatarName = _l === void 0 ? '' : _l,
9835
- _m = props.avatarDesc,
9836
- avatarDesc = _m === void 0 ? '' : _m,
9837
- _o = props.children,
9838
- children = _o === void 0 ? null : _o,
9839
- _p = props.renderInfo,
9840
- renderInfo = _p === void 0 ? null : _p,
9841
- _q = props.className,
9842
- className = _q === void 0 ? '' : _q,
9843
- _r = props.style,
9844
- style = _r === void 0 ? {} : _r,
9845
- _s = props.imageProps,
9846
- imageProps = _s === void 0 ? {} : _s,
9836
+ _j = props.avatarClass,
9837
+ avatarClass = _j === void 0 ? '' : _j,
9838
+ _k = props.autoFixFontSize,
9839
+ autoFixFontSize = _k === void 0 ? true : _k,
9840
+ _l = props.autoFixFontOffset,
9841
+ autoFixFontOffset = _l === void 0 ? 2 : _l,
9842
+ _m = props.avatarName,
9843
+ avatarName = _m === void 0 ? '' : _m,
9844
+ _o = props.avatarDesc,
9845
+ avatarDesc = _o === void 0 ? '' : _o,
9846
+ _p = props.children,
9847
+ children = _p === void 0 ? null : _p,
9848
+ _q = props.renderInfo,
9849
+ renderInfo = _q === void 0 ? null : _q,
9850
+ _r = props.className,
9851
+ className = _r === void 0 ? '' : _r,
9852
+ _s = props.style,
9853
+ style = _s === void 0 ? {} : _s,
9854
+ _t = props.imageProps,
9855
+ imageProps = _t === void 0 ? {} : _t,
9847
9856
  defaultOverLap = props.defaultOverLap,
9848
9857
  onClickDecoration = props.onClickDecoration,
9849
9858
  onClick = props.onClick;
@@ -9851,9 +9860,9 @@
9851
9860
  var avatarRef = React.useRef(null);
9852
9861
  var avatarTextRef = React.useRef(null);
9853
9862
 
9854
- var _t = React.useState(1),
9855
- textScale = _t[0],
9856
- setTextScale = _t[1];
9863
+ var _u = React.useState(1),
9864
+ textScale = _u[0],
9865
+ setTextScale = _u[1];
9857
9866
 
9858
9867
  React.useImperativeHandle(ref, function () {
9859
9868
  return {
@@ -9902,7 +9911,7 @@
9902
9911
  className: cls(prefixCls + "-avatar-wrapper", className, size, shape, prefixCls + "-avatar-wrapper-shape-" + shape, (_a = {}, _a[prefixCls + "-avatar-wrapper-with-info " + prefixCls + "-avatar-wrapper-with-info-size-" + size + " with-info"] = Boolean(avatarName), _a)),
9903
9912
  onClick: onClick
9904
9913
  }, /*#__PURE__*/React__default["default"].createElement("div", {
9905
- className: cls(prefixCls + "-avatar", prefixCls + "-avatar-size-" + size, size, prefixCls + "-avatar-shape-" + shape, shape, (_b = {}, _b[prefixCls + "-text-avatar " + prefixCls + "-avatar-mode-text"] = isTextAvatar, _b[prefixCls + "-image-avatar " + prefixCls + "-avatar-mode-image"] = isImageAvatar, _b[prefixCls + "-avatar-default-overlap default-overlap"] = useDefaultAvatar, _b)),
9914
+ className: cls(prefixCls + "-avatar", avatarClass, prefixCls + "-avatar-size-" + size, size, prefixCls + "-avatar-shape-" + shape, shape, (_b = {}, _b[prefixCls + "-text-avatar " + prefixCls + "-avatar-mode-text"] = isTextAvatar, _b[prefixCls + "-image-avatar " + prefixCls + "-avatar-mode-image"] = isImageAvatar, _b[prefixCls + "-avatar-default-overlap default-overlap"] = useDefaultAvatar, _b)),
9906
9915
  style: avatarStyle,
9907
9916
  ref: avatarRef
9908
9917
  }, children, useDefaultAvatar && (defaultOverLap === void 0 ? /*#__PURE__*/React__default["default"].createElement(IconUserFill, {
@@ -10402,6 +10411,12 @@
10402
10411
 
10403
10412
  if (posAdjustingRef.current) {
10404
10413
  return;
10414
+ } // touchMove触发时,阻止handleTouchStart多次执行(如点击事件)
10415
+ // @en When touchMove is triggered, prevent handleTouchStart from executing multiple times (such as click events)
10416
+
10417
+
10418
+ if (touchStartedRef.current && touchMovedRef.current) {
10419
+ return;
10405
10420
  }
10406
10421
 
10407
10422
  touchStartedRef.current = true;
@@ -10858,12 +10873,23 @@
10858
10873
  return;
10859
10874
  }
10860
10875
 
10861
- if (!touchStartedRef.current || !touchMovedRef.current || posAdjustingRef.current || touchStoppedRef.current) {
10876
+ if (!touchStartedRef.current) {
10862
10877
  return;
10863
10878
  }
10864
10879
 
10865
10880
  touchStartedRef.current = false;
10881
+
10882
+ if (!touchMovedRef.current) {
10883
+ setPlayIntervalRef.current();
10884
+ return;
10885
+ }
10886
+
10866
10887
  touchMovedRef.current = false;
10888
+
10889
+ if (posAdjustingRef.current || touchStoppedRef.current) {
10890
+ return;
10891
+ }
10892
+
10867
10893
  var touchEndTime = new Date().getTime();
10868
10894
  var dis = Math.abs(distance);
10869
10895
  var speed = dis / (touchEndTime - touchStartTimeRef.current) * 1000;
@@ -23492,9 +23518,13 @@
23492
23518
  var contentRef = React.useRef(null);
23493
23519
  var timerRef = React.useRef(null);
23494
23520
 
23495
- var _j = React.useState(false),
23496
- needMarquee = _j[0],
23497
- setNeedMarquee = _j[1];
23521
+ var _j = React.useState(true),
23522
+ visible = _j[0],
23523
+ setVisible = _j[1];
23524
+
23525
+ var _k = React.useState(false),
23526
+ needMarquee = _k[0],
23527
+ setNeedMarquee = _k[1];
23498
23528
 
23499
23529
  var extraClass = React.useMemo(function () {
23500
23530
  var classList = []; // 字幕可滚动时,或不可滚动且不可以换行时,添加不换行效果
@@ -23535,9 +23565,8 @@
23535
23565
  }, [useRtl]);
23536
23566
 
23537
23567
  function close() {
23538
- if (domRef.current) {
23539
- removeElement(domRef.current);
23540
- }
23568
+ setVisible(false);
23569
+ clear();
23541
23570
  }
23542
23571
 
23543
23572
  function handleClose(e) {
@@ -23602,7 +23631,7 @@
23602
23631
  }
23603
23632
 
23604
23633
  function renderNoticeBar(prefix) {
23605
- return /*#__PURE__*/React__default["default"].createElement("div", {
23634
+ return visible ? /*#__PURE__*/React__default["default"].createElement("div", {
23606
23635
  className: cls(prefix, className, extraClass),
23607
23636
  style: style,
23608
23637
  ref: domRef,
@@ -23628,7 +23657,7 @@
23628
23657
  }, rightContent) : null, closeable ? /*#__PURE__*/React__default["default"].createElement("div", {
23629
23658
  className: prefix + "-close",
23630
23659
  onClick: handleClose
23631
- }, closeIcon) : null);
23660
+ }, closeIcon) : null) : null;
23632
23661
  }
23633
23662
 
23634
23663
  return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
@@ -24229,7 +24258,15 @@
24229
24258
  if (left || width || top || height || bottom) {
24230
24259
  if (!show) {
24231
24260
  setTimeout(function () {
24232
- setShow(true);
24261
+ setShow(function () {
24262
+ var _a; // bugfix:
24263
+ // 外层CSSTransition使用dom API而非通过react className属性修改class
24264
+ // 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
24265
+
24266
+
24267
+ (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.classList.add('show');
24268
+ return true;
24269
+ });
24233
24270
  }, 0);
24234
24271
  }
24235
24272
  }
@@ -24281,7 +24318,6 @@
24281
24318
  return /*#__PURE__*/React__default["default"].createElement("div", {
24282
24319
  ref: domRef,
24283
24320
  className: cls(prefixCls + "-popover-inner", 'popover-inner', 'all-border-box', mode + "-mode", className, {
24284
- show: show,
24285
24321
  'with-shadow': needShadow,
24286
24322
  'with-suffix': showCloseIcon || textSuffix,
24287
24323
  'custom-content': typeof content !== 'string'