@arco-design/mobile-react 2.27.5 → 2.28.1

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 (110) hide show
  1. package/CHANGELOG.md +30 -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/avatar/type.d.ts +1 -1
  7. package/cjs/badge/style/css/index.css +12 -0
  8. package/cjs/badge/style/index.less +3 -3
  9. package/cjs/button/style/css/index.css +4 -0
  10. package/cjs/button/style/index.less +1 -1
  11. package/cjs/cell/style/css/index.css +7 -0
  12. package/cjs/cell/style/index.less +4 -1
  13. package/cjs/checkbox/style/css/index.css +13 -0
  14. package/cjs/checkbox/style/index.less +3 -3
  15. package/cjs/collapse/collapse.js +12 -6
  16. package/cjs/form/style/css/index.css +16 -0
  17. package/cjs/form/style/index.less +4 -4
  18. package/cjs/image-preview/index.js +2 -1
  19. package/cjs/radio/style/css/index.css +8 -0
  20. package/cjs/radio/style/index.less +2 -2
  21. package/cjs/rate/index.js +5 -3
  22. package/cjs/rate/style/css/index.css +4 -0
  23. package/cjs/rate/style/index.less +4 -0
  24. package/cjs/sticky/index.d.ts +5 -0
  25. package/cjs/sticky/index.js +20 -7
  26. package/cjs/switch/index.js +7 -2
  27. package/cjs/switch/style/css/index.css +44 -0
  28. package/cjs/switch/style/index.less +19 -7
  29. package/cjs/tabs/demo/style/css/mobile.css +11 -0
  30. package/cjs/tabs/demo/style/mobile.less +5 -1
  31. package/cjs/tabs/index.js +14 -5
  32. package/cjs/tabs/style/css/index.css +32 -7
  33. package/cjs/tabs/style/index.less +9 -14
  34. package/cjs/tabs/tab-cell-underline.js +14 -5
  35. package/cjs/tabs/tab-cell.js +15 -7
  36. package/cjs/tabs/tab-pane.js +4 -3
  37. package/cjs/tabs/type.d.ts +1 -0
  38. package/dist/index.js +92 -40
  39. package/dist/index.min.js +3 -3
  40. package/dist/style.css +134 -7
  41. package/dist/style.min.css +1 -1
  42. package/esm/_helpers/hooks.d.ts +1 -0
  43. package/esm/_helpers/hooks.js +41 -27
  44. package/esm/avatar/type.d.ts +1 -1
  45. package/esm/badge/style/css/index.css +12 -0
  46. package/esm/badge/style/index.less +3 -3
  47. package/esm/button/style/css/index.css +4 -0
  48. package/esm/button/style/index.less +1 -1
  49. package/esm/cell/style/css/index.css +7 -0
  50. package/esm/cell/style/index.less +4 -1
  51. package/esm/checkbox/style/css/index.css +13 -0
  52. package/esm/checkbox/style/index.less +3 -3
  53. package/esm/collapse/collapse.js +14 -8
  54. package/esm/form/style/css/index.css +16 -0
  55. package/esm/form/style/index.less +4 -4
  56. package/esm/image-preview/index.js +2 -1
  57. package/esm/radio/style/css/index.css +8 -0
  58. package/esm/radio/style/index.less +2 -2
  59. package/esm/rate/index.js +5 -3
  60. package/esm/rate/style/css/index.css +4 -0
  61. package/esm/rate/style/index.less +4 -0
  62. package/esm/sticky/index.d.ts +5 -0
  63. package/esm/sticky/index.js +20 -7
  64. package/esm/switch/index.js +9 -4
  65. package/esm/switch/style/css/index.css +44 -0
  66. package/esm/switch/style/index.less +19 -7
  67. package/esm/tabs/demo/style/css/mobile.css +11 -0
  68. package/esm/tabs/demo/style/mobile.less +5 -1
  69. package/esm/tabs/index.js +16 -7
  70. package/esm/tabs/style/css/index.css +32 -7
  71. package/esm/tabs/style/index.less +9 -14
  72. package/esm/tabs/tab-cell-underline.js +14 -6
  73. package/esm/tabs/tab-cell.js +15 -8
  74. package/esm/tabs/tab-pane.js +4 -3
  75. package/esm/tabs/type.d.ts +1 -0
  76. package/package.json +17 -3
  77. package/umd/_helpers/hooks.d.ts +1 -0
  78. package/umd/_helpers/hooks.js +43 -27
  79. package/umd/avatar/type.d.ts +1 -1
  80. package/umd/badge/style/css/index.css +12 -0
  81. package/umd/badge/style/index.less +3 -3
  82. package/umd/button/style/css/index.css +4 -0
  83. package/umd/button/style/index.less +1 -1
  84. package/umd/cell/style/css/index.css +7 -0
  85. package/umd/cell/style/index.less +4 -1
  86. package/umd/checkbox/style/css/index.css +13 -0
  87. package/umd/checkbox/style/index.less +3 -3
  88. package/umd/collapse/collapse.js +12 -6
  89. package/umd/form/style/css/index.css +16 -0
  90. package/umd/form/style/index.less +4 -4
  91. package/umd/image-preview/index.js +2 -1
  92. package/umd/radio/style/css/index.css +8 -0
  93. package/umd/radio/style/index.less +2 -2
  94. package/umd/rate/index.js +5 -3
  95. package/umd/rate/style/css/index.css +4 -0
  96. package/umd/rate/style/index.less +4 -0
  97. package/umd/sticky/index.d.ts +5 -0
  98. package/umd/sticky/index.js +20 -7
  99. package/umd/switch/index.js +7 -2
  100. package/umd/switch/style/css/index.css +44 -0
  101. package/umd/switch/style/index.less +19 -7
  102. package/umd/tabs/demo/style/css/mobile.css +11 -0
  103. package/umd/tabs/demo/style/mobile.less +5 -1
  104. package/umd/tabs/index.js +14 -5
  105. package/umd/tabs/style/css/index.css +32 -7
  106. package/umd/tabs/style/index.less +9 -14
  107. package/umd/tabs/tab-cell-underline.js +16 -9
  108. package/umd/tabs/tab-cell.js +17 -11
  109. package/umd/tabs/tab-pane.js +4 -3
  110. package/umd/tabs/type.d.ts +1 -0
@@ -25,6 +25,7 @@
25
25
  _exports.useProgress = void 0;
26
26
  _exports.useRefMountedState = useRefMountedState;
27
27
  _exports.useRefState = useRefState;
28
+ _exports.useSameRefState = useSameRefState;
28
29
  _exports.useSingleAndDoubleClick = useSingleAndDoubleClick;
29
30
  _exports.useSwiperInnerScroll = useSwiperInnerScroll;
30
31
  _exports.useSystem = useSystem;
@@ -90,11 +91,26 @@
90
91
  return result;
91
92
  }
92
93
 
93
- function useRefState(initialValue) {
94
+ function useSameRefState(initialValue) {
94
95
  var _useState2 = (0, _react.useState)(initialValue),
95
96
  state = _useState2[0],
96
97
  setState = _useState2[1];
97
98
 
99
+ var stateRef = (0, _react.useRef)(state);
100
+
101
+ var setStateProxy = function setStateProxy(data) {
102
+ stateRef.current = data;
103
+ setState(data);
104
+ };
105
+
106
+ return [state, stateRef, setStateProxy];
107
+ }
108
+
109
+ function useRefState(initialValue) {
110
+ var _useState3 = (0, _react.useState)(initialValue),
111
+ state = _useState3[0],
112
+ setState = _useState3[1];
113
+
98
114
  var stateRef = (0, _react.useRef)(state);
99
115
  (0, _react.useEffect)(function () {
100
116
  stateRef.current = state;
@@ -130,8 +146,8 @@
130
146
  }
131
147
 
132
148
  function useForceUpdate() {
133
- var _useState3 = (0, _react.useState)(0),
134
- setTick = _useState3[1];
149
+ var _useState4 = (0, _react.useState)(0),
150
+ setTick = _useState4[1];
135
151
 
136
152
  var update = (0, _react.useCallback)(function () {
137
153
  setTick(function (tick) {
@@ -153,11 +169,11 @@
153
169
  var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
154
170
  currentSystem = _useContext.system;
155
171
 
156
- var _useState4 = (0, _react.useState)(function () {
172
+ var _useState5 = (0, _react.useState)(function () {
157
173
  return currentSystem || (0, _mobileUtils.getSystem)();
158
174
  }),
159
- system = _useState4[0],
160
- setSystem = _useState4[1];
175
+ system = _useState5[0],
176
+ setSystem = _useState5[1];
161
177
 
162
178
  (0, _react.useEffect)(function () {
163
179
  setSystem(currentSystem || (0, _mobileUtils.getSystem)());
@@ -166,13 +182,13 @@
166
182
  }
167
183
 
168
184
  function useWindowSize(listenResize) {
169
- var _useState5 = (0, _react.useState)(0),
170
- windowWidth = _useState5[0],
171
- setWindowWidth = _useState5[1];
172
-
173
185
  var _useState6 = (0, _react.useState)(0),
174
- windowHeight = _useState6[0],
175
- setWindowHeight = _useState6[1];
186
+ windowWidth = _useState6[0],
187
+ setWindowWidth = _useState6[1];
188
+
189
+ var _useState7 = (0, _react.useState)(0),
190
+ windowHeight = _useState7[0],
191
+ setWindowHeight = _useState7[1];
176
192
 
177
193
  function setSize() {
178
194
  setWindowWidth(window.innerWidth);
@@ -479,17 +495,17 @@
479
495
  }
480
496
 
481
497
  var useProgress = function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
482
- var _useState7 = (0, _react.useState)(0),
483
- currentPercentage = _useState7[0],
484
- setCurrentPercentage = _useState7[1];
498
+ var _useState8 = (0, _react.useState)(0),
499
+ currentPercentage = _useState8[0],
500
+ setCurrentPercentage = _useState8[1];
485
501
 
486
- var _useState8 = (0, _react.useState)(false),
487
- transitionControl = _useState8[0],
488
- setTransitionControl = _useState8[1];
502
+ var _useState9 = (0, _react.useState)(false),
503
+ transitionControl = _useState9[0],
504
+ setTransitionControl = _useState9[1];
489
505
 
490
- var _useState9 = (0, _react.useState)(0),
491
- count = _useState9[0],
492
- setCount = _useState9[1];
506
+ var _useState10 = (0, _react.useState)(0),
507
+ count = _useState10[0],
508
+ setCount = _useState10[1];
493
509
 
494
510
  var latestPercentage = (0, _react.useRef)(percentage);
495
511
  (0, _react.useEffect)(function () {
@@ -521,9 +537,9 @@
521
537
  delay = 200;
522
538
  }
523
539
 
524
- var _useState10 = (0, _react.useState)(0),
525
- clickTimes = _useState10[0],
526
- setClickTimes = _useState10[1];
540
+ var _useState11 = (0, _react.useState)(0),
541
+ clickTimes = _useState11[0],
542
+ setClickTimes = _useState11[1];
527
543
 
528
544
  var eventRef = (0, _react.useRef)();
529
545
  (0, _react.useEffect)(function () {
@@ -547,9 +563,9 @@
547
563
  var arcoSvgKeyCount = 0;
548
564
 
549
565
  function useGenSvgKey(userSetSvgKey) {
550
- var _useState11 = (0, _react.useState)(''),
551
- innerSvgKey = _useState11[0],
552
- setInnerSvgKey = _useState11[1];
566
+ var _useState12 = (0, _react.useState)(''),
567
+ innerSvgKey = _useState12[0],
568
+ setInnerSvgKey = _useState12[1];
553
569
 
554
570
  var svgKey = userSetSvgKey || innerSvgKey;
555
571
  (0, _react.useEffect)(function () {
@@ -18,7 +18,7 @@ export interface AvatarProps<T extends ImageProps = ImageProps> extends BaseProp
18
18
  * 图片头像的资源地址
19
19
  * @en resource of avatar picture
20
20
  */
21
- src: string;
21
+ src?: string;
22
22
  /**
23
23
  * 图片头像组件参数,透传给Image组件
24
24
  * @en Image avatar component props, transparently passed to the Image component
@@ -89,7 +89,19 @@
89
89
  margin-left: -8PX ;
90
90
  margin-top: -8PX ;
91
91
  }
92
+ [dir="rtl"] .arco-badge-absolute {
93
+ left: initial;
94
+ right: 100%;
95
+ }
96
+ [dir="rtl"] .arco-badge-absolute {
97
+ margin-left: initial;
98
+ margin-right: -8PX ;
99
+ }
92
100
  .arco-badge-absolute.arco-badge-dot {
93
101
  margin-left: -4PX ;
94
102
  margin-top: -4PX ;
95
103
  }
104
+ [dir="rtl"] .arco-badge-absolute.arco-badge-dot {
105
+ margin-left: initial;
106
+ margin-right: -4PX ;
107
+ }
@@ -60,13 +60,13 @@
60
60
  &-absolute {
61
61
  position: absolute;
62
62
  top: 0;
63
- left: 100%;
64
- .use-var(margin-left, badge-text-deviation);
63
+ .set-prop-with-rtl(left, 100%);
64
+ .use-var-with-rtl(margin-left, badge-text-deviation);
65
65
  .use-var(margin-top, badge-text-deviation);
66
66
  }
67
67
 
68
68
  &-absolute&-dot {
69
- .use-var(margin-left, badge-dot-deviation);
69
+ .use-var-with-rtl(margin-left, badge-dot-deviation);
70
70
  .use-var(margin-top, badge-dot-deviation);
71
71
  }
72
72
  }
@@ -210,6 +210,10 @@
210
210
  .arco-button-text-has-icon {
211
211
  margin-left: 0.08rem ;
212
212
  }
213
+ [dir="rtl"] .arco-button-text-has-icon {
214
+ margin-left: initial;
215
+ margin-right: 0.08rem ;
216
+ }
213
217
  .arco-button-loading-icon {
214
218
  display: inline-block;
215
219
  vertical-align: middle;
@@ -84,7 +84,7 @@
84
84
  vertical-align: middle;
85
85
  }
86
86
  &-text-has-icon {
87
- .use-var(margin-left, button-icon-text-gutter);
87
+ .use-var-with-rtl(margin-left, button-icon-text-gutter);
88
88
  }
89
89
 
90
90
  &-loading-icon {
@@ -164,6 +164,9 @@
164
164
  -webkit-box-orient: vertical;
165
165
  white-space: normal;
166
166
  }
167
+ [dir="rtl"] .arco-cell .cell-content .cell-text {
168
+ text-align: left;
169
+ }
167
170
  .arco-cell .cell-label-icon {
168
171
  margin-right: 0.24rem ;
169
172
  font-size: 0;
@@ -181,6 +184,10 @@
181
184
  margin-left: 0.16rem ;
182
185
  font-size: 0;
183
186
  }
187
+ [dir="rtl"] .arco-cell .cell-arrow-icon {
188
+ -webkit-transform: scale(-1);
189
+ transform: scale(-1);
190
+ }
184
191
  [dir="rtl"] .arco-cell .cell-arrow-icon {
185
192
  margin-left: initial;
186
193
  margin-right: 0.16rem ;
@@ -54,7 +54,7 @@
54
54
 
55
55
  .cell-text {
56
56
  width: 100%;
57
- text-align: right;
57
+ .set-value-with-rtl(text-align, right);
58
58
  .use-var(font-size, cell-content-font-size);
59
59
  .text-overflow(2);
60
60
  }
@@ -71,6 +71,9 @@
71
71
  }
72
72
 
73
73
  .cell-arrow-icon {
74
+ [dir="rtl"] & {
75
+ transform: scale(-1);
76
+ }
74
77
  .use-var-with-rtl(margin-left, cell-arrow-gutter);
75
78
  font-size: 0;
76
79
  .@{prefix}-icon {
@@ -32,6 +32,10 @@
32
32
  .arco-checkbox .checkbox-icon + .checkbox-text {
33
33
  margin-left: 0.16rem ;
34
34
  }
35
+ [dir="rtl"] .arco-checkbox .checkbox-icon + .checkbox-text {
36
+ margin-left: initial;
37
+ margin-right: 0.16rem ;
38
+ }
35
39
  .arco-checkbox.disabled .checkbox-text {
36
40
  opacity: 0.5 ;
37
41
  }
@@ -47,7 +51,16 @@
47
51
  .arco-checkbox-group .arco-checkbox:not(:last-child) {
48
52
  margin-right: 0.48rem ;
49
53
  }
54
+ [dir="rtl"] .arco-checkbox-group .arco-checkbox:not(:last-child) {
55
+ margin-right: initial;
56
+ margin-left: 0.48rem ;
57
+ }
50
58
  .arco-checkbox-group .arco-checkbox:not(:last-child).block,
51
59
  .arco-checkbox-group .arco-checkbox:not(:last-child).justify {
52
60
  margin-right: 0;
53
61
  }
62
+ [dir="rtl"] .arco-checkbox-group .arco-checkbox:not(:last-child).block,
63
+ [dir="rtl"] .arco-checkbox-group .arco-checkbox:not(:last-child).justify {
64
+ margin-right: initial;
65
+ margin-left: 0;
66
+ }
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  .checkbox-icon + .checkbox-text {
32
- .use-var(margin-left, checkbox-icon-margin-right);
32
+ .use-var-with-rtl(margin-left, checkbox-icon-margin-right);
33
33
  }
34
34
 
35
35
  &.disabled .checkbox-text {
@@ -48,11 +48,11 @@
48
48
 
49
49
  .@{prefix}-checkbox-group {
50
50
  .@{prefix}-checkbox:not(:last-child) {
51
- .use-var(margin-right, checkbox-group-gutter);
51
+ .use-var-with-rtl(margin-right, checkbox-group-gutter);
52
52
 
53
53
  &.block,
54
54
  &.justify {
55
- margin-right: 0;
55
+ .set-prop-with-rtl(margin-right, 0);
56
56
  }
57
57
  }
58
58
  }
@@ -66,7 +66,13 @@
66
66
 
67
67
  var CollapseContext = _utils.allContexts[groupKey] || {};
68
68
  var groupContext = (0, _react.useContext)(CollapseContext) || {};
69
- var opened = (0, _react.useMemo)(function () {
69
+
70
+ var _useSameRefState = (0, _helpers.useSameRefState)(false),
71
+ opened = _useSameRefState[0],
72
+ openedRef = _useSameRefState[1],
73
+ setOpened = _useSameRefState[2];
74
+
75
+ (0, _react.useEffect)(function () {
70
76
  var show = false; // 优先级: group > children
71
77
  // @en Priority: group > children
72
78
 
@@ -80,7 +86,7 @@
80
86
  show = itemActive;
81
87
  }
82
88
 
83
- return show;
89
+ setOpened(show);
84
90
  }, [value, active, itemActive, groupContext.isGroup, groupContext.value]);
85
91
 
86
92
  var getContentHeight = function getContentHeight() {
@@ -98,8 +104,8 @@
98
104
  contentWrapRef.current.style.height = newHeight;
99
105
  var transTimeout = (0, _mobileUtils.convertCssDuration)(contentWrapRef.current, 'transitionDuration');
100
106
  setTimeout(function () {
101
- return contentWrapRef.current && (contentWrapRef.current.style.height = opened ? 'auto' : '0px');
102
- }, opened ? transTimeout : 20);
107
+ return contentWrapRef.current && (contentWrapRef.current.style.height = openedRef.current ? 'auto' : '0px');
108
+ }, openedRef.current ? transTimeout : 20);
103
109
  };
104
110
 
105
111
  var toggleOpened = function toggleOpened() {
@@ -122,10 +128,10 @@
122
128
  }
123
129
 
124
130
  var height = getContentHeight();
125
- contentWrapRef.current.style.height = opened ? contentHeightRef.current + "px" : '0px';
131
+ contentWrapRef.current.style.height = openedRef.current ? contentHeightRef.current + "px" : '0px';
126
132
  (0, _mobileUtils.nextTick)(function () {
127
133
  contentHeightRef.current = height;
128
- resetHeight(opened ? height + "px" : '0px');
134
+ resetHeight(openedRef.current ? height + "px" : '0px');
129
135
  });
130
136
  };
131
137
 
@@ -27,6 +27,10 @@
27
27
  padding-right: 0.32rem ;
28
28
  width: 1.92rem ;
29
29
  }
30
+ [dir="rtl"] .arco-form-label-item {
31
+ padding-right: initial;
32
+ padding-left: 0.32rem ;
33
+ }
30
34
  .arco-form-label-item-required-asterisk {
31
35
  position: absolute;
32
36
  left: -0.6em;
@@ -35,6 +39,10 @@
35
39
  line-height: 1.08rem ;
36
40
  color: #f53f3f ;
37
41
  }
42
+ [dir="rtl"] .arco-form-label-item-required-asterisk {
43
+ left: initial;
44
+ right: -0.6em;
45
+ }
38
46
  .disabled .arco-form-label-item {
39
47
  color: #c9cdd4 ;
40
48
  }
@@ -68,6 +76,10 @@
68
76
  .arco-form-item-message svg {
69
77
  margin-right: 0.08rem;
70
78
  }
79
+ [dir="rtl"] .arco-form-item-message svg {
80
+ margin-right: initial;
81
+ margin-left: 0.08rem;
82
+ }
71
83
  .arco-form-item-error-message {
72
84
  color: #f53f3f ;
73
85
  }
@@ -80,6 +92,10 @@
80
92
  .arco-form-item.arco-form-item-vertical .arco-input-wrap {
81
93
  padding-left: 0;
82
94
  }
95
+ [dir="rtl"] .arco-form-item.arco-form-item-vertical .arco-input-wrap {
96
+ padding-left: initial;
97
+ padding-right: 0;
98
+ }
83
99
  .arco-form-item.arco-form-item-vertical .arco-form-label-item {
84
100
  width: auto;
85
101
  margin-top: 16px;
@@ -20,12 +20,12 @@
20
20
  .use-var(font-size, form-item-label-item-font-size);
21
21
  .use-var(line-height, form-item-label-item-line-height);
22
22
  .use-var(color, form-item-label-item-color);
23
- .use-var(padding-right, form-item-label-item-gutter);
23
+ .use-var-with-rtl(padding-right, form-item-label-item-gutter);
24
24
  .use-var(width, form-item-label-item-width);
25
25
 
26
26
  &-required-asterisk {
27
27
  position: absolute;
28
- left: -0.6em;
28
+ .set-prop-with-rtl(left, -0.6em);
29
29
  top: 0;
30
30
 
31
31
  .use-var(font-size, form-item-label-item-font-size);
@@ -60,7 +60,7 @@
60
60
  }
61
61
 
62
62
  svg {
63
- .rem(margin-right, 4);
63
+ .rem-with-rtl(margin-right, 4);
64
64
  }
65
65
  margin-bottom: 16px;
66
66
  }
@@ -75,7 +75,7 @@
75
75
  &-item.@{prefix}-form-item-vertical {
76
76
  display: block;
77
77
  .arco-input-wrap {
78
- padding-left: 0;
78
+ .set-prop-with-rtl(padding-left, 0);
79
79
  }
80
80
  .@{prefix}-form-label-item {
81
81
  width: auto;
@@ -794,7 +794,8 @@
794
794
  return /*#__PURE__*/_react.default.createElement(_carousel.default, (0, _extends5.default)({
795
795
  autoPlay: false,
796
796
  loop: loop,
797
- lazyloadCount: lazyloadCount
797
+ lazyloadCount: lazyloadCount,
798
+ stopPropagation: false
798
799
  }, carouselProps), (allImages || []).map(function (image, index) {
799
800
  var innerNode = /*#__PURE__*/_react.default.createElement("div", {
800
801
  key: index,
@@ -32,6 +32,10 @@
32
32
  .arco-radio .radio-icon + .radio-text {
33
33
  margin-left: 0.16rem ;
34
34
  }
35
+ [dir="rtl"] .arco-radio .radio-icon + .radio-text {
36
+ margin-left: initial;
37
+ margin-right: 0.16rem ;
38
+ }
35
39
  .arco-radio.disabled .radio-text {
36
40
  opacity: 0.5 ;
37
41
  }
@@ -47,3 +51,7 @@
47
51
  .arco-radio-group .arco-radio:not(:last-child, .block) {
48
52
  margin-right: 0.48rem ;
49
53
  }
54
+ [dir="rtl"] .arco-radio-group .arco-radio:not(:last-child, .block) {
55
+ margin-right: initial;
56
+ margin-left: 0.48rem ;
57
+ }
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  .radio-icon + .radio-text {
32
- .use-var(margin-left, checkbox-icon-margin-right);
32
+ .use-var-with-rtl(margin-left, checkbox-icon-margin-right);
33
33
  }
34
34
 
35
35
  &.disabled .radio-text {
@@ -48,6 +48,6 @@
48
48
 
49
49
  .@{prefix}-radio-group {
50
50
  .@{prefix}-radio:not(:last-child, .block) {
51
- .use-var(margin-right, checkbox-group-gutter);
51
+ .use-var-with-rtl(margin-right, checkbox-group-gutter);
52
52
  }
53
53
  }
package/umd/rate/index.js CHANGED
@@ -154,7 +154,8 @@
154
154
  }
155
155
 
156
156
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref2) {
157
- var prefixCls = _ref2.prefixCls;
157
+ var prefixCls = _ref2.prefixCls,
158
+ useRtl = _ref2.useRtl;
158
159
  return /*#__PURE__*/_react.default.createElement("div", {
159
160
  role: "slider",
160
161
  "aria-valuemin": 0,
@@ -170,6 +171,7 @@
170
171
  // 对内的index从1开始,方便计算
171
172
  // @en The index of the pair starts from 1, which is convenient for calculation
172
173
  var index = i + 1;
174
+ var halfIndex = allowHalf ? index - 0.5 : index;
173
175
  var status = getIconStatus(index);
174
176
  return /*#__PURE__*/_react.default.createElement("div", {
175
177
  key: index,
@@ -180,12 +182,12 @@
180
182
  }, renderRateIcon(prefixCls + "-rate", status, index), /*#__PURE__*/_react.default.createElement("div", {
181
183
  className: prefixCls + "-rate-icon-click-half left",
182
184
  onClick: function onClick() {
183
- return handleStarIndexChange(allowHalf ? index - 0.5 : index);
185
+ return handleStarIndexChange(useRtl ? index : halfIndex);
184
186
  }
185
187
  }), /*#__PURE__*/_react.default.createElement("div", {
186
188
  className: prefixCls + "-rate-icon-click-half right",
187
189
  onClick: function onClick() {
188
- return handleStarIndexChange(index);
190
+ return handleStarIndexChange(useRtl ? halfIndex : index);
189
191
  }
190
192
  }));
191
193
  }));
@@ -40,6 +40,10 @@
40
40
  position: absolute;
41
41
  z-index: 1;
42
42
  }
43
+ [dir="rtl"] .arco-rate-icon.half-active {
44
+ -webkit-transform: scaleX(-1);
45
+ transform: scaleX(-1);
46
+ }
43
47
  .arco-rate-icon-click-half {
44
48
  width: 50%;
45
49
  height: 100%;
@@ -38,6 +38,10 @@
38
38
  &.half-active {
39
39
  position: absolute;
40
40
  z-index: 1;
41
+
42
+ [dir="rtl"] & {
43
+ transform: scaleX(-1);
44
+ }
41
45
  }
42
46
  }
43
47
 
@@ -10,6 +10,11 @@ export interface StickyRef {
10
10
  * @en In the local scrolling mode, if there is nested scrolling outside the container, this method can be actively called to make the sticky element actively update the fixed position
11
11
  */
12
12
  recalculatePosition: () => void;
13
+ /**
14
+ * 手动更新占位模块的高度
15
+ * @en Manually update the height of the placeholder
16
+ */
17
+ updatePlaceholderLayout: () => void;
13
18
  }
14
19
  export interface StickyEventPayload {
15
20
  /**
@@ -161,6 +161,22 @@
161
161
  });
162
162
  framePendingRef.current = true;
163
163
  }, [containerEventHandler]);
164
+ var updatePlaceholderLayoutInner = (0, _react.useCallback)(function () {
165
+ if (placeholderRef.current) {
166
+ var contentHeight = contentCalculateHeightRef.current; // 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
167
+ // @en When an element is sticky to the top, a placeholder element occupies the element's position by default to avoid jitter in the layout
168
+
169
+ placeholderRef.current.style.height = (isStickyRef.current ? contentHeight : 0) + "px";
170
+ }
171
+ }, []);
172
+ var updatePlaceholderLayout = (0, _react.useCallback)(function () {
173
+ if (contentRef.current) {
174
+ var contentClientRect = contentRef.current.getBoundingClientRect();
175
+ contentCalculateHeightRef.current = contentClientRect.height;
176
+ }
177
+
178
+ updatePlaceholderLayoutInner();
179
+ }, []);
164
180
  (0, _react.useEffect)(function () {
165
181
  var containerEle = (0, _mobileUtils.getActualContainer)(getContainer);
166
182
  containerRef.current = containerEle || document.body;
@@ -183,18 +199,15 @@
183
199
  };
184
200
  }, [getContainer, getScrollContainer, recalculatePosition]);
185
201
  (0, _react.useEffect)(function () {
186
- if (placeholderRef.current) {
187
- // 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
188
- // @en When an element is sticky to the top, a placeholder element occupies the element's position by default to avoid jitter in the layout
189
- placeholderRef.current.style.height = (isStickyRef.current ? contentCalculateHeightRef.current : 0) + "px";
190
- }
202
+ updatePlaceholderLayoutInner();
191
203
  }, [isSticky, wasSticky]);
192
204
  (0, _react.useImperativeHandle)(ref, function () {
193
205
  return {
194
206
  dom: contentRef.current,
195
- recalculatePosition: recalculatePosition
207
+ recalculatePosition: recalculatePosition,
208
+ updatePlaceholderLayout: updatePlaceholderLayout
196
209
  };
197
- }, [recalculatePosition]);
210
+ }, [recalculatePosition, updatePlaceholderLayout]);
198
211
  var computedStyle = (0, _react.useMemo)(function () {
199
212
  return (0, _extends2.default)({}, style || {}, stickyStateStyle);
200
213
  }, [stickyStateStyle, style]);
@@ -22,6 +22,9 @@
22
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; }
23
23
 
24
24
  var Switch = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
25
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
26
+ useRtl = _useContext.useRtl;
27
+
25
28
  var system = (0, _helpers.useSystem)();
26
29
  var className = props.className,
27
30
  style = props.style,
@@ -89,13 +92,15 @@
89
92
 
90
93
  var touchEndX = e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].clientX : 0;
91
94
  var distance = touchEndX - touchStartX;
95
+ var swipeRight = useRtl ? distance < 0 : distance > 0;
96
+ var swipeLeft = useRtl ? distance > 0 : distance < 0;
92
97
  var newChecked = false; // 右滑打开
93
98
  // @en Swipe right to open
94
99
 
95
- if (distance > 0) {
100
+ if (swipeRight) {
96
101
  newChecked = true; // 左滑关闭
97
102
  // @en Swipe left to close
98
- } else if (distance < 0) {
103
+ } else if (swipeLeft) {
99
104
  newChecked = false; // 点击时取反
100
105
  // @en Invert on clicking
101
106
  } else {