@arco-design/mobile-react 2.27.5 → 2.28.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 (107) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/hooks.d.ts +1 -0
  5. package/cjs/_helpers/hooks.js +43 -27
  6. package/cjs/badge/style/css/index.css +12 -0
  7. package/cjs/badge/style/index.less +3 -3
  8. package/cjs/button/style/css/index.css +4 -0
  9. package/cjs/button/style/index.less +1 -1
  10. package/cjs/cell/style/css/index.css +7 -0
  11. package/cjs/cell/style/index.less +4 -1
  12. package/cjs/checkbox/style/css/index.css +13 -0
  13. package/cjs/checkbox/style/index.less +3 -3
  14. package/cjs/collapse/collapse.js +12 -6
  15. package/cjs/form/style/css/index.css +16 -0
  16. package/cjs/form/style/index.less +4 -4
  17. package/cjs/image-preview/index.js +2 -1
  18. package/cjs/radio/style/css/index.css +8 -0
  19. package/cjs/radio/style/index.less +2 -2
  20. package/cjs/rate/index.js +5 -3
  21. package/cjs/rate/style/css/index.css +4 -0
  22. package/cjs/rate/style/index.less +4 -0
  23. package/cjs/sticky/index.d.ts +5 -0
  24. package/cjs/sticky/index.js +20 -7
  25. package/cjs/switch/index.js +7 -2
  26. package/cjs/switch/style/css/index.css +44 -0
  27. package/cjs/switch/style/index.less +19 -7
  28. package/cjs/tabs/demo/style/css/mobile.css +11 -0
  29. package/cjs/tabs/demo/style/mobile.less +5 -1
  30. package/cjs/tabs/index.js +14 -5
  31. package/cjs/tabs/style/css/index.css +32 -7
  32. package/cjs/tabs/style/index.less +9 -14
  33. package/cjs/tabs/tab-cell-underline.js +14 -5
  34. package/cjs/tabs/tab-cell.js +15 -7
  35. package/cjs/tabs/tab-pane.js +4 -3
  36. package/cjs/tabs/type.d.ts +1 -0
  37. package/dist/index.js +92 -40
  38. package/dist/index.min.js +3 -3
  39. package/dist/style.css +134 -7
  40. package/dist/style.min.css +1 -1
  41. package/esm/_helpers/hooks.d.ts +1 -0
  42. package/esm/_helpers/hooks.js +41 -27
  43. package/esm/badge/style/css/index.css +12 -0
  44. package/esm/badge/style/index.less +3 -3
  45. package/esm/button/style/css/index.css +4 -0
  46. package/esm/button/style/index.less +1 -1
  47. package/esm/cell/style/css/index.css +7 -0
  48. package/esm/cell/style/index.less +4 -1
  49. package/esm/checkbox/style/css/index.css +13 -0
  50. package/esm/checkbox/style/index.less +3 -3
  51. package/esm/collapse/collapse.js +14 -8
  52. package/esm/form/style/css/index.css +16 -0
  53. package/esm/form/style/index.less +4 -4
  54. package/esm/image-preview/index.js +2 -1
  55. package/esm/radio/style/css/index.css +8 -0
  56. package/esm/radio/style/index.less +2 -2
  57. package/esm/rate/index.js +5 -3
  58. package/esm/rate/style/css/index.css +4 -0
  59. package/esm/rate/style/index.less +4 -0
  60. package/esm/sticky/index.d.ts +5 -0
  61. package/esm/sticky/index.js +20 -7
  62. package/esm/switch/index.js +9 -4
  63. package/esm/switch/style/css/index.css +44 -0
  64. package/esm/switch/style/index.less +19 -7
  65. package/esm/tabs/demo/style/css/mobile.css +11 -0
  66. package/esm/tabs/demo/style/mobile.less +5 -1
  67. package/esm/tabs/index.js +16 -7
  68. package/esm/tabs/style/css/index.css +32 -7
  69. package/esm/tabs/style/index.less +9 -14
  70. package/esm/tabs/tab-cell-underline.js +14 -6
  71. package/esm/tabs/tab-cell.js +15 -8
  72. package/esm/tabs/tab-pane.js +4 -3
  73. package/esm/tabs/type.d.ts +1 -0
  74. package/package.json +3 -3
  75. package/umd/_helpers/hooks.d.ts +1 -0
  76. package/umd/_helpers/hooks.js +43 -27
  77. package/umd/badge/style/css/index.css +12 -0
  78. package/umd/badge/style/index.less +3 -3
  79. package/umd/button/style/css/index.css +4 -0
  80. package/umd/button/style/index.less +1 -1
  81. package/umd/cell/style/css/index.css +7 -0
  82. package/umd/cell/style/index.less +4 -1
  83. package/umd/checkbox/style/css/index.css +13 -0
  84. package/umd/checkbox/style/index.less +3 -3
  85. package/umd/collapse/collapse.js +12 -6
  86. package/umd/form/style/css/index.css +16 -0
  87. package/umd/form/style/index.less +4 -4
  88. package/umd/image-preview/index.js +2 -1
  89. package/umd/radio/style/css/index.css +8 -0
  90. package/umd/radio/style/index.less +2 -2
  91. package/umd/rate/index.js +5 -3
  92. package/umd/rate/style/css/index.css +4 -0
  93. package/umd/rate/style/index.less +4 -0
  94. package/umd/sticky/index.d.ts +5 -0
  95. package/umd/sticky/index.js +20 -7
  96. package/umd/switch/index.js +7 -2
  97. package/umd/switch/style/css/index.css +44 -0
  98. package/umd/switch/style/index.less +19 -7
  99. package/umd/tabs/demo/style/css/mobile.css +11 -0
  100. package/umd/tabs/demo/style/mobile.less +5 -1
  101. package/umd/tabs/index.js +14 -5
  102. package/umd/tabs/style/css/index.css +32 -7
  103. package/umd/tabs/style/index.less +9 -14
  104. package/umd/tabs/tab-cell-underline.js +16 -9
  105. package/umd/tabs/tab-cell.js +17 -11
  106. package/umd/tabs/tab-pane.js +4 -3
  107. package/umd/tabs/type.d.ts +1 -0
@@ -44,15 +44,31 @@
44
44
  right: auto;
45
45
  left: 5PX ;
46
46
  }
47
+ [dir="rtl"] .arco-switch.type-android.checked .arco-switch-text {
48
+ right: initial;
49
+ left: auto;
50
+ }
51
+ [dir="rtl"] .arco-switch.type-android.checked .arco-switch-text {
52
+ left: initial;
53
+ right: 5PX ;
54
+ }
47
55
  .arco-switch.type-android.checked .arco-switch-inner {
48
56
  -webkit-transform: translateX(16PX) ;
49
57
  transform: translateX(16PX) ;
50
58
  }
59
+ [dir="rtl"] .arco-switch.type-android.checked .arco-switch-inner {
60
+ -webkit-transform: rotate(180deg) translateX(16PX) ;
61
+ transform: rotate(180deg) translateX(16PX) ;
62
+ }
51
63
  .arco-switch.type-android .arco-switch-inner {
52
64
  width: 20PX ;
53
65
  height: 20PX ;
54
66
  box-shadow: 0 2PX 4PX 0 rgba(0, 0, 0, 0.08) ;
55
67
  }
68
+ [dir="rtl"] .arco-switch.type-android .arco-switch-inner {
69
+ -webkit-transform: rotate(180deg);
70
+ transform: rotate(180deg);
71
+ }
56
72
  .arco-switch.type-android.disabled.checked {
57
73
  background-color: #94bfff ;
58
74
  }
@@ -63,6 +79,10 @@
63
79
  font-size: 12PX ;
64
80
  right: 5PX ;
65
81
  }
82
+ [dir="rtl"] .arco-switch.type-android .arco-switch-text {
83
+ right: initial;
84
+ left: 5PX ;
85
+ }
66
86
  .arco-switch.type-ios {
67
87
  width: 1.02rem ;
68
88
  height: 0.62rem ;
@@ -83,11 +103,23 @@
83
103
  right: auto;
84
104
  left: 0.12rem ;
85
105
  }
106
+ [dir="rtl"] .arco-switch.type-ios.checked .arco-switch-text {
107
+ right: initial;
108
+ left: auto;
109
+ }
110
+ [dir="rtl"] .arco-switch.type-ios.checked .arco-switch-text {
111
+ left: initial;
112
+ right: 0.12rem ;
113
+ }
86
114
  .arco-switch.type-ios.checked .arco-switch-inner {
87
115
  -webkit-transform: translateX(0.4rem) ;
88
116
  transform: translateX(0.4rem) ;
89
117
  box-shadow: 0 3PX 2PX 0 rgba(0, 0, 0, 0.12) ;
90
118
  }
119
+ [dir="rtl"] .arco-switch.type-ios.checked .arco-switch-inner {
120
+ -webkit-transform: rotate(180deg) translateX(0.4rem) ;
121
+ transform: rotate(180deg) translateX(0.4rem) ;
122
+ }
91
123
  .arco-switch.type-ios.disabled.checked {
92
124
  opacity: 0.3 ;
93
125
  }
@@ -95,6 +127,10 @@
95
127
  font-size: 0.28rem ;
96
128
  right: 0.12rem ;
97
129
  }
130
+ [dir="rtl"] .arco-switch.type-ios .arco-switch-text {
131
+ right: initial;
132
+ left: 0.12rem ;
133
+ }
98
134
  .arco-switch.type-ios .arco-switch-inner {
99
135
  width: 0.54rem ;
100
136
  height: 0.54rem ;
@@ -136,6 +172,10 @@
136
172
  border-radius: 150%;
137
173
  }
138
174
  }
175
+ [dir="rtl"] .arco-switch.type-ios .arco-switch-inner {
176
+ -webkit-transform: rotate(180deg);
177
+ transform: rotate(180deg);
178
+ }
139
179
  .arco-switch.type-ios.disabled.checked {
140
180
  background-color: #4DD865 ;
141
181
  }
@@ -169,6 +209,10 @@
169
209
  -webkit-transition: all 0.2s ;
170
210
  transition: all 0.2s ;
171
211
  }
212
+ [dir="rtl"] .arco-switch-inner {
213
+ left: initial;
214
+ right: 0;
215
+ }
172
216
  .fully .arco-switch-inner {
173
217
  border-radius: 50% ;
174
218
  }
@@ -33,17 +33,23 @@
33
33
  &.checked {
34
34
  .use-var(background-color, switch-android-checked-background);
35
35
  .@{prefix}-switch-text {
36
- right: auto;
37
- .use-var(left, switch-android-text-gap-size);
36
+ .set-prop-with-rtl(right, auto);
37
+ .use-var-with-rtl(left, switch-android-text-gap-size);
38
38
  }
39
39
  .@{prefix}-switch-inner {
40
40
  .use-var(transform, switch-android-checked-inner-transform);
41
+ [dir="rtl"] & {
42
+ .use-var(transform, switch-android-checked-inner-transform, "rotate(180deg)");
43
+ }
41
44
  }
42
45
  }
43
46
  .@{prefix}-switch-inner {
44
47
  .use-var(width, switch-android-inner-diameter-size);
45
48
  .use-var(height, switch-android-inner-diameter-size);
46
49
  .use-var(box-shadow, switch-android-inner-box-shadow);
50
+ [dir="rtl"] & {
51
+ transform: rotate(180deg);
52
+ }
47
53
  }
48
54
 
49
55
  &.disabled {
@@ -58,7 +64,7 @@
58
64
  }
59
65
  .@{prefix}-switch-text {
60
66
  .use-var(font-size, switch-android-text-font-size);
61
- .use-var(right, switch-android-text-gap-size);
67
+ .use-var-with-rtl(right, switch-android-text-gap-size);
62
68
  }
63
69
  }
64
70
 
@@ -80,12 +86,15 @@
80
86
  &.checked {
81
87
  .use-var(background-color, switch-ios-checked-background);
82
88
  .@{prefix}-switch-text {
83
- right: auto;
84
- .use-var(left, switch-ios-text-gap-size);
89
+ .set-prop-with-rtl(right, auto);
90
+ .use-var-with-rtl(left, switch-ios-text-gap-size);
85
91
  }
86
92
  .@{prefix}-switch-inner {
87
93
  .use-var(transform, switch-ios-checked-inner-transform);
88
94
  .use-var(box-shadow, switch-ios-inner-box-shadow);
95
+ [dir="rtl"] & {
96
+ .use-var(transform, switch-ios-checked-inner-transform, "rotate(180deg)");
97
+ }
89
98
  }
90
99
  }
91
100
 
@@ -94,12 +103,15 @@
94
103
  }
95
104
  .@{prefix}-switch-text {
96
105
  .use-var(font-size, switch-ios-text-font-size);
97
- .use-var(right, switch-ios-text-gap-size);
106
+ .use-var-with-rtl(right, switch-ios-text-gap-size);
98
107
  }
99
108
  .@{prefix}-switch-inner {
100
109
  .use-var(width, switch-ios-inner-diameter-size);
101
110
  .use-var(height, switch-ios-inner-diameter-size);
102
111
  .onepx-border-var(all, switch-ios-inner-border-color, 50%);
112
+ [dir="rtl"] & {
113
+ transform: rotate(180deg);
114
+ }
103
115
  }
104
116
 
105
117
  &.disabled {
@@ -127,7 +139,7 @@
127
139
 
128
140
  &-inner {
129
141
  position: relative;
130
- left: 0;
142
+ .set-prop-with-rtl(left, 0);
131
143
  top: 0;
132
144
  display: flex;
133
145
  align-items: center;
@@ -43,6 +43,17 @@
43
43
  justify-content: flex-end;
44
44
  font-weight: bold;
45
45
  }
46
+ [dir="rtl"] #demo-tabs .demo-tabs-add-extra {
47
+ right: initial;
48
+ left: 0;
49
+ }
50
+ [dir="rtl"] #demo-tabs .demo-tabs-add-extra {
51
+ -webkit-box-pack: start;
52
+ -webkit-justify-content: flex-start;
53
+ justify-content: flex-start;
54
+ -webkit-transform: rotate(180deg);
55
+ transform: rotate(180deg);
56
+ }
46
57
  #demo-tabs .demo-tab-custom-bar .arco-tab-cell-container-wrap {
47
58
  height: 1.52rem;
48
59
  }
@@ -24,7 +24,7 @@
24
24
 
25
25
  .demo-tabs-add-extra {
26
26
  position: absolute;
27
- right: 0;
27
+ .set-prop-with-rtl(right, 0);
28
28
  top: 0;
29
29
  background: linear-gradient(270deg, #fff 66.04%, rgba(255, 255, 255, 0) 105%);
30
30
  .rem(width, 64);
@@ -36,6 +36,10 @@
36
36
  align-items: center;
37
37
  justify-content: flex-end;
38
38
  font-weight: bold;
39
+ [dir="rtl"] & {
40
+ justify-content: flex-start;
41
+ transform: rotate(180deg);
42
+ }
39
43
  }
40
44
 
41
45
  .demo-tab-custom-bar {
package/cjs/tabs/index.js CHANGED
@@ -150,6 +150,10 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
150
150
  tabBarStopPropagation = _props$tabBarStopProp === void 0 ? true : _props$tabBarStopProp,
151
151
  _props$swipeEnergySav = props.swipeEnergySaving,
152
152
  swipeEnergySaving = _props$swipeEnergySav === void 0 ? false : _props$swipeEnergySav;
153
+
154
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
155
+ useRtl = _useContext.useRtl;
156
+
153
157
  var domRef = (0, _react.useRef)(null);
154
158
  var cellRef = (0, _react.useRef)(null);
155
159
  var paneRef = (0, _react.useRef)(null);
@@ -201,6 +205,8 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
201
205
  var allPanes = getAllPanes();
202
206
  var tabDirection = ['top', 'bottom'].indexOf(tabBarPosition) !== -1 ? 'vertical' : 'horizontal';
203
207
  var canSwipe = mode === 'swipe' && !disabled && swipeable && tabDirection === 'vertical' && tabs.length > 1;
208
+ var horizontalUseRtl = tabDirection === 'vertical' && useRtl;
209
+ var rtlRatio = horizontalUseRtl ? -1 : 1;
204
210
  (0, _react.useImperativeHandle)(ref, function () {
205
211
  return {
206
212
  dom: domRef.current,
@@ -320,6 +326,7 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
320
326
  var posDisY = touchMoveY - touchStartYRef.current;
321
327
  var absDisX = Math.abs(posDisX);
322
328
  var absDisY = Math.abs(posDisY);
329
+ var comparedDis = posDisX * rtlRatio;
323
330
 
324
331
  if (scrollingRef.current === null) {
325
332
  scrollingRef.current = absDisX < absDisY;
@@ -337,10 +344,10 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
337
344
  return;
338
345
  }
339
346
 
340
- if (activeIndexRef.current === 0 && posDisX > 0 || activeIndexRef.current === tabs.length - 1 && posDisX < 0) {
347
+ if (activeIndexRef.current === 0 && comparedDis > 0 || activeIndexRef.current === tabs.length - 1 && comparedDis < 0) {
341
348
  if (!touchStoppedRef.current && absDisX > stopTouchThreshold) {
342
349
  touchStoppedRef.current = true;
343
- onTouchStopped && onTouchStopped(posDisX >= 0 ? -1 : 1);
350
+ onTouchStopped && onTouchStopped(comparedDis >= 0 ? -1 : 1);
344
351
  }
345
352
 
346
353
  setDistance(0);
@@ -390,10 +397,11 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
390
397
  var index = activeIndexRef.current;
391
398
  var needJump = Math.abs(dis) > maxSlice && Math.abs(dis) > distanceToChangeTab || Math.abs(speed) > speedToChangeTab;
392
399
  var newIndex = index;
400
+ var comparedDis = dis * rtlRatio;
393
401
 
394
- if (dis > 0 && needJump) {
402
+ if (comparedDis > 0 && needJump) {
395
403
  newIndex = index - 1;
396
- } else if (dis < 0 && needJump) {
404
+ } else if (comparedDis < 0 && needJump) {
397
405
  newIndex = index + 1;
398
406
  }
399
407
 
@@ -537,7 +545,8 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
537
545
  tabPaneExtra: tabPaneExtra,
538
546
  autoHeight: autoHeight,
539
547
  onScroll: onScroll,
540
- swipeEnergySaving: swipeEnergySaving
548
+ swipeEnergySaving: swipeEnergySaving,
549
+ rtlRatio: rtlRatio
541
550
  }, commonProps)));
542
551
  });
543
552
  });
@@ -368,11 +368,12 @@
368
368
  -webkit-flex: 1;
369
369
  flex: 1;
370
370
  }
371
- .arco-tab-cell.vertical:not(.custom).line {
371
+ .arco-tab-cell.vertical:not(.custom).line:not(.last) {
372
372
  margin-right: 0.8rem ;
373
373
  }
374
- .arco-tab-cell.vertical:not(.custom).line.last {
375
- margin-right: 0;
374
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).line:not(.last) {
375
+ margin-right: initial;
376
+ margin-left: 0.8rem ;
376
377
  }
377
378
  .arco-tab-cell.vertical:not(.custom).line.active,
378
379
  .arco-tab-cell.vertical:not(.custom).line-divide.active {
@@ -407,29 +408,53 @@
407
408
  .arco-tab-cell.vertical:not(.custom).card:not(:last-child) {
408
409
  border-right: 1PX solid #165dff ;
409
410
  }
411
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:not(:last-child) {
412
+ border-right: initial;
413
+ border-left: 1PX solid #165dff ;
414
+ }
410
415
  .arco-tab-cell.vertical:not(.custom).card:first-of-type {
411
416
  border-top-left-radius: 2PX ;
412
417
  border-bottom-left-radius: 2PX ;
413
418
  }
419
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:first-of-type {
420
+ border-top-left-radius: initial;
421
+ border-top-right-radius: 2PX ;
422
+ }
423
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:first-of-type {
424
+ border-bottom-left-radius: initial;
425
+ border-bottom-right-radius: 2PX ;
426
+ }
414
427
  .arco-tab-cell.vertical:not(.custom).card:last-of-type {
415
428
  border-top-right-radius: 2PX ;
416
429
  border-bottom-right-radius: 2PX ;
417
430
  }
431
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:last-of-type {
432
+ border-top-right-radius: initial;
433
+ border-top-left-radius: 2PX ;
434
+ }
435
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:last-of-type {
436
+ border-bottom-right-radius: initial;
437
+ border-bottom-left-radius: 2PX ;
438
+ }
418
439
  .arco-tab-cell.vertical:not(.custom).card.android,
419
440
  .arco-tab-cell.vertical:not(.custom).tag-divide.android {
420
441
  padding-top: 0.04rem;
421
442
  }
422
443
  .arco-tab-cell.vertical:not(.custom).tag,
423
444
  .arco-tab-cell.vertical:not(.custom).tag-divide {
424
- margin-right: 0.32rem ;
425
445
  padding: 0 0.32rem ;
426
446
  border-radius: 2rem;
427
447
  background: #f7f8fA ;
428
448
  color: #1d2129 ;
429
449
  }
430
- .arco-tab-cell.vertical:not(.custom).tag.last,
431
- .arco-tab-cell.vertical:not(.custom).tag-divide.last {
432
- margin-right: 0;
450
+ .arco-tab-cell.vertical:not(.custom).tag:not(.last),
451
+ .arco-tab-cell.vertical:not(.custom).tag-divide:not(.last) {
452
+ margin-right: 0.32rem ;
453
+ }
454
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).tag:not(.last),
455
+ [dir="rtl"] .arco-tab-cell.vertical:not(.custom).tag-divide:not(.last) {
456
+ margin-right: initial;
457
+ margin-left: 0.32rem ;
433
458
  }
434
459
  .arco-tab-cell.vertical:not(.custom).tag.active,
435
460
  .arco-tab-cell.vertical:not(.custom).tag-divide.active {
@@ -310,12 +310,8 @@
310
310
 
311
311
  &:not(.custom) {
312
312
 
313
- &.line {
314
- .use-var(margin-right, tabs-tab-bar-line-gutter);
315
-
316
- &.last {
317
- margin-right: 0;
318
- }
313
+ &.line:not(.last) {
314
+ .use-var-with-rtl(margin-right, tabs-tab-bar-line-gutter);
319
315
  }
320
316
 
321
317
  &.line,
@@ -337,17 +333,17 @@
337
333
  }
338
334
 
339
335
  &:not(:last-child) {
340
- .use-var(border-right, tabs-tab-bar-card-color, 1PX solid);
336
+ .use-var-with-rtl(border-right, tabs-tab-bar-card-color, 1PX solid);
341
337
  }
342
338
 
343
339
  &:first-of-type {
344
- .use-var(border-top-left-radius, tabs-tab-bar-card-border-radius);
345
- .use-var(border-bottom-left-radius, tabs-tab-bar-card-border-radius);
340
+ .use-var-with-rtl(border-top-left-radius, tabs-tab-bar-card-border-radius);
341
+ .use-var-with-rtl(border-bottom-left-radius, tabs-tab-bar-card-border-radius);
346
342
  }
347
343
 
348
344
  &:last-of-type {
349
- .use-var(border-top-right-radius, tabs-tab-bar-card-border-radius);
350
- .use-var(border-bottom-right-radius, tabs-tab-bar-card-border-radius);
345
+ .use-var-with-rtl(border-top-right-radius, tabs-tab-bar-card-border-radius);
346
+ .use-var-with-rtl(border-bottom-right-radius, tabs-tab-bar-card-border-radius);
351
347
  }
352
348
  }
353
349
 
@@ -361,14 +357,13 @@
361
357
 
362
358
  &.tag,
363
359
  &.tag-divide {
364
- .use-var(margin-right, tabs-tab-bar-tag-gutter);
365
360
  .use-var(padding, tabs-tab-bar-tag-padding);
366
361
  .rem(border-radius, 100);
367
362
  .use-var(background, tabs-tab-bar-tag-background);
368
363
  .use-var(color, tabs-tab-bar-tag-text-color);
369
364
 
370
- &.last {
371
- margin-right: 0;
365
+ &:not(.last) {
366
+ .use-var-with-rtl(margin-right, tabs-tab-bar-tag-gutter);
372
367
  }
373
368
 
374
369
  &.active {
@@ -13,6 +13,8 @@ var _mobileUtils = require("@arco-design/mobile-utils");
13
13
 
14
14
  var _helpers = require("../_helpers");
15
15
 
16
+ var _contextProvider = require("../context-provider");
17
+
16
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
19
 
18
20
  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; }
@@ -40,6 +42,9 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
40
42
  getTabRect = props.getTabRect,
41
43
  getTabCenterLeft = props.getTabCenterLeft;
42
44
 
45
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
46
+ useRtl = _useContext.useRtl;
47
+
43
48
  var _useState = (0, _react.useState)({}),
44
49
  underlineStyle = _useState[0],
45
50
  setUnderlineStyle = _useState[1];
@@ -59,6 +64,7 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
59
64
  var isVertical = tabDirection === 'vertical';
60
65
  var maxScaleWithDefault = caterpillarMaxScale || 2;
61
66
  var translateZStr = translateZ ? ' translateZ(0)' : '';
67
+ var rtlRatio = isVertical && useRtl ? -1 : 1;
62
68
  (0, _react.useImperativeHandle)(ref, function () {
63
69
  return {
64
70
  setCaterpillarAnimate: setCaterpillarAnimate,
@@ -130,11 +136,13 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
130
136
  }
131
137
 
132
138
  function getDescIndex() {
133
- if (distance > 0) {
139
+ var comparedDis = distance * rtlRatio;
140
+
141
+ if (comparedDis > 0) {
134
142
  return activeIndex - 1;
135
143
  }
136
144
 
137
- if (distance < 0) {
145
+ if (comparedDis < 0) {
138
146
  return activeIndex + 1;
139
147
  }
140
148
 
@@ -156,7 +164,8 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
156
164
  var currentLeft = getLineLeft(activeIndex);
157
165
  var descIndex = getDescIndex();
158
166
  var descLeft = getLineLeft(descIndex);
159
- var moveRatio = wrapWidth ? distance / wrapWidth : 0;
167
+ var comparedDis = distance * rtlRatio;
168
+ var moveRatio = wrapWidth ? comparedDis / wrapWidth : 0;
160
169
  var leftOffset = moveRatio * (currentLeft - descLeft);
161
170
  var direc = isVertical ? 'X' : 'Y';
162
171
  var transStyle = useCaterpillar && !jumpingDis && !underlineAdaptive ? caterpillarProperty === 'size' ? (_ref = {}, _ref[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _ref.willChange = 'width', _ref) : {
@@ -171,7 +180,7 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
171
180
  var currentWidth = getLineWidth(activeIndex);
172
181
  var descWidth = getLineWidth(descIndex);
173
182
  var widthOffset = moveRatio * (currentWidth - descWidth);
174
- adaptiveStyle = (_adaptiveStyle = {}, _adaptiveStyle[isVertical ? 'width' : 'height'] = distance > 0 ? currentWidth - widthOffset : currentWidth + widthOffset, _adaptiveStyle.willChange = 'width', _adaptiveStyle);
183
+ adaptiveStyle = (_adaptiveStyle = {}, _adaptiveStyle[isVertical ? 'width' : 'height'] = comparedDis > 0 ? currentWidth - widthOffset : currentWidth + widthOffset, _adaptiveStyle.willChange = 'width', _adaptiveStyle);
175
184
  adaptiveOuterStyle = isVertical ? {
176
185
  width: 'auto'
177
186
  } : {
@@ -188,7 +197,7 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
188
197
  };
189
198
  return {
190
199
  outer: (0, _extends2.default)({
191
- transform: "translate" + direc + "(" + (distance > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
200
+ transform: "translate" + direc + "(" + (comparedDis > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
192
201
  }, outerSize, adaptiveOuterStyle),
193
202
  inner: (0, _extends2.default)({}, transStyle, adaptiveStyle)
194
203
  };
@@ -15,6 +15,8 @@ var _helpers = require("../_helpers");
15
15
 
16
16
  var _tabCellUnderline = _interopRequireDefault(require("./tab-cell-underline"));
17
17
 
18
+ var _contextProvider = require("../context-provider");
19
+
18
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
21
 
20
22
  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; }
@@ -68,6 +70,10 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
68
70
  translateZ = props.translateZ,
69
71
  tabBarStopPropagation = props.tabBarStopPropagation;
70
72
  var prefix = prefixCls + "-tab-cell";
73
+
74
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
75
+ useRtl = _useContext.useRtl;
76
+
71
77
  var domRef = (0, _react.useRef)(null);
72
78
  var underlineRef = (0, _react.useRef)(null);
73
79
  var allCellRectRef = (0, _react.useRef)([]);
@@ -262,20 +268,22 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
262
268
  }
263
269
 
264
270
  function getCellStyle(index) {
271
+ var _ref2;
272
+
265
273
  if (!isVertical) {
266
274
  return {};
267
275
  }
268
276
 
277
+ var marginStart = useRtl ? 'marginRight' : 'marginLeft';
278
+ var marginEnd = useRtl ? 'marginLeft' : 'marginRight';
279
+
269
280
  if (index === 0) {
270
- return {
271
- marginRight: cellGutter,
272
- marginLeft: getCellPadding('left')
273
- };
281
+ var _ref;
282
+
283
+ return _ref = {}, _ref[marginEnd] = cellGutter, _ref[marginStart] = getCellPadding('left'), _ref;
274
284
  }
275
285
 
276
- return {
277
- marginRight: index === tabs.length - 1 ? void 0 : cellGutter
278
- };
286
+ return _ref2 = {}, _ref2[marginEnd] = index === tabs.length - 1 ? void 0 : cellGutter, _ref2;
279
287
  }
280
288
 
281
289
  function renderBarItem(tab, index) {
@@ -52,7 +52,8 @@ var TabPane = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
52
52
  autoHeight = props.autoHeight,
53
53
  swipeEnergySaving = props.swipeEnergySaving,
54
54
  changeIndex = props.changeIndex,
55
- onScroll = props.onScroll;
55
+ onScroll = props.onScroll,
56
+ rtlRatio = props.rtlRatio;
56
57
  var domRef = (0, _react.useRef)(null);
57
58
  var panesRef = (0, _react.useRef)([]);
58
59
  var autoScrollingRef = (0, _react.useRef)(false);
@@ -251,7 +252,7 @@ var TabPane = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
251
252
  var translateStr = translateZ ? ' translateZ(0)' : '';
252
253
  var sizeStyle = tabDirection === 'vertical' ? {
253
254
  width: 100 * panes.length + "%",
254
- transform: "translateX(" + (distance - wrapWidth * activeIndex) + "px)" + translateStr
255
+ transform: "translateX(" + (distance - wrapWidth * activeIndex * rtlRatio) + "px)" + translateStr
255
256
  } : {
256
257
  height: 100 * panes.length + "%",
257
258
  transform: "translateY(" + (distance - wrapHeight * activeIndex) + "px)" + translateStr
@@ -279,7 +280,7 @@ var TabPane = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
279
280
 
280
281
  var translateStr = translateZ ? ' translateZ(0)' : '';
281
282
  var sizeStyle = tabDirection === 'vertical' ? {
282
- transform: "translateX(" + (distance - wrapWidth * (activeIndex - index)) + "px)" + translateStr
283
+ transform: "translateX(" + (distance - wrapWidth * (activeIndex - index) * rtlRatio) + "px)" + translateStr
283
284
  } : {
284
285
  transform: "translateY(" + (distance - wrapHeight * (activeIndex - index)) + "px)" + translateStr
285
286
  };
@@ -579,6 +579,7 @@ export interface TabPaneProps extends Pick<TabsProps, 'duration' | 'transitionDu
579
579
  paneTrans: boolean;
580
580
  swipeable: boolean;
581
581
  changeIndex: (newIndex: number, from?: string) => void;
582
+ rtlRatio: number;
582
583
  }
583
584
  export interface TabPaneRef {
584
585
  /**