@arco-design/mobile-react 2.30.0 → 2.30.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 (67) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/carousel/index.js +3 -1
  5. package/cjs/context-provider/index.d.ts +5 -1
  6. package/cjs/context-provider/index.js +10 -3
  7. package/cjs/dialog/demo/style/css/mobile.css +2 -1
  8. package/cjs/dialog/demo/style/mobile.less +2 -1
  9. package/cjs/form/form-item.js +15 -7
  10. package/cjs/form/type.d.ts +3 -2
  11. package/cjs/form/utils.d.ts +1 -0
  12. package/cjs/form/utils.js +6 -2
  13. package/cjs/input/demo/style/css/mobile.css +25 -7
  14. package/cjs/input/demo/style/mobile.less +32 -7
  15. package/cjs/nav-bar/style/css/index.css +1 -1
  16. package/cjs/notify/demo/style/css/mobile.css +5 -1
  17. package/cjs/notify/demo/style/mobile.less +9 -1
  18. package/cjs/popover/demo/style/css/mobile.css +6 -2
  19. package/cjs/popover/demo/style/mobile.less +12 -2
  20. package/cjs/tabs/demo/style/css/mobile.css +6 -2
  21. package/cjs/tabs/demo/style/mobile.less +7 -1
  22. package/cjs/tabs/style/css/index.css +1 -1
  23. package/dist/index.js +36 -15
  24. package/dist/index.min.js +1 -1
  25. package/esm/carousel/index.js +3 -1
  26. package/esm/context-provider/index.d.ts +5 -1
  27. package/esm/context-provider/index.js +11 -4
  28. package/esm/dialog/demo/style/css/mobile.css +2 -1
  29. package/esm/dialog/demo/style/mobile.less +2 -1
  30. package/esm/form/form-item.js +15 -7
  31. package/esm/form/type.d.ts +3 -2
  32. package/esm/form/utils.d.ts +1 -0
  33. package/esm/form/utils.js +6 -2
  34. package/esm/input/demo/style/css/mobile.css +25 -7
  35. package/esm/input/demo/style/mobile.less +32 -7
  36. package/esm/nav-bar/style/css/index.css +1 -1
  37. package/esm/notify/demo/style/css/mobile.css +5 -1
  38. package/esm/notify/demo/style/mobile.less +9 -1
  39. package/esm/popover/demo/style/css/mobile.css +6 -2
  40. package/esm/popover/demo/style/mobile.less +12 -2
  41. package/esm/tabs/demo/style/css/mobile.css +6 -2
  42. package/esm/tabs/demo/style/mobile.less +7 -1
  43. package/esm/tabs/style/css/index.css +1 -1
  44. package/package.json +3 -3
  45. package/tokens/app/arcodesign/default/css-variables.less +4 -4
  46. package/tokens/app/arcodesign/default/index.js +4 -4
  47. package/tokens/app/arcodesign/default/index.json +10 -10
  48. package/tokens/app/arcodesign/default/index.less +4 -4
  49. package/umd/carousel/index.js +3 -1
  50. package/umd/context-provider/index.d.ts +5 -1
  51. package/umd/context-provider/index.js +10 -3
  52. package/umd/dialog/demo/style/css/mobile.css +2 -1
  53. package/umd/dialog/demo/style/mobile.less +2 -1
  54. package/umd/form/form-item.js +15 -7
  55. package/umd/form/type.d.ts +3 -2
  56. package/umd/form/utils.d.ts +1 -0
  57. package/umd/form/utils.js +6 -2
  58. package/umd/input/demo/style/css/mobile.css +25 -7
  59. package/umd/input/demo/style/mobile.less +32 -7
  60. package/umd/nav-bar/style/css/index.css +1 -1
  61. package/umd/notify/demo/style/css/mobile.css +5 -1
  62. package/umd/notify/demo/style/mobile.less +9 -1
  63. package/umd/popover/demo/style/css/mobile.css +6 -2
  64. package/umd/popover/demo/style/mobile.less +12 -2
  65. package/umd/tabs/demo/style/css/mobile.css +6 -2
  66. package/umd/tabs/demo/style/mobile.less +7 -1
  67. package/umd/tabs/style/css/index.css +1 -1
package/dist/index.js CHANGED
@@ -1106,7 +1106,7 @@
1106
1106
  * @desc {en} Get properties of the scrolling container. Perform additional attribute compatibility processing for window and document.
1107
1107
  * @param property 所需属性
1108
1108
  * @param property {en} Required attributes
1109
- * @param getContainer 待计算滚动容器
1109
+ * @param {() => HTMLElement | Window | Document | null} getContainer 待计算滚动容器
1110
1110
  * @param getContainer {en} Scrolling container to be calculated.
1111
1111
  * @example
1112
1112
  * ```
@@ -1147,7 +1147,7 @@
1147
1147
  /**
1148
1148
  * 提供了元素的大小及其相对于视口的位置。
1149
1149
  * @desc {en} Provide information about the size of an element and its position relative to the viewport.
1150
- * @param container 滚动容器
1150
+ * @param {HTMLElement | Window | null} container 滚动容器
1151
1151
  * @param container {en} Scroll Container
1152
1152
  * @example
1153
1153
  * ```
@@ -3771,9 +3771,15 @@
3771
3771
  isDarkModeState = _c[0],
3772
3772
  setIsDarkModeState = _c[1];
3773
3773
 
3774
- var setDarkModeState = function setDarkModeState(isDark) {
3774
+ var mountedRef = React.useRef(false);
3775
+
3776
+ var setDarkModeState = function setDarkModeState(isDark, needChange) {
3777
+ if (needChange === void 0) {
3778
+ needChange = true;
3779
+ }
3780
+
3775
3781
  setIsDarkModeState(isDark);
3776
- onDarkModeChange && onDarkModeChange(isDark);
3782
+ needChange && onDarkModeChange && onDarkModeChange(isDark);
3777
3783
  };
3778
3784
 
3779
3785
  var isDarkMode = React.useMemo(function () {
@@ -3802,7 +3808,7 @@
3802
3808
 
3803
3809
  if (useDarkMode) {
3804
3810
  var dark = matchMedia.matches;
3805
- setDarkModeState(dark);
3811
+ setDarkModeState(dark, mountedRef.current);
3806
3812
 
3807
3813
  if (typeof matchMedia.addEventListener === 'function') {
3808
3814
  matchMedia.addEventListener('change', changeDarkMode);
@@ -3811,6 +3817,7 @@
3811
3817
  }
3812
3818
  }
3813
3819
 
3820
+ mountedRef.current = true;
3814
3821
  return function () {
3815
3822
  if (useDarkMode) {
3816
3823
  if (typeof matchMedia.removeEventListener === 'function') {
@@ -10283,7 +10290,9 @@
10283
10290
  // @en When noLoop is used, the blank space of spaceBetween needs to be exposed at the end, so when sliding to the last one, the transform value moves to the left by the corresponding width
10284
10291
 
10285
10292
  var translateDis = noLoop ? noLoopDis - (total > 1 && index === total - 1 ? spaceBetween : 0) * rtlRatio : dis;
10286
- var transStr = childSize > 0 ? translateDis + "px" : "-" + index * 100 + "%";
10293
+ var initTranslateDis = -1 * index * 100; // bugfix: prop `style` did not match in ssr
10294
+
10295
+ var transStr = childSize > 0 ? "" + translateDis + (translateDis ? 'px' : '') : "" + initTranslateDis + (initTranslateDis ? '%' : '');
10287
10296
 
10288
10297
  if (vertical) {
10289
10298
  var translateStyle_1 = getStyleWithVendor({
@@ -16145,11 +16154,13 @@
16145
16154
  var getErrorAndWarnings = function getErrorAndWarnings(result) {
16146
16155
  var errors = [];
16147
16156
  var warnings = [];
16157
+ var errorTypes = [];
16148
16158
  result.map(function (_a) {
16149
16159
  var _b = _a.message,
16150
16160
  message = _b === void 0 ? [] : _b,
16151
16161
  _c = _a.validateLevel,
16152
- validateLevel = _c === void 0 ? 'error' : _c;
16162
+ validateLevel = _c === void 0 ? 'error' : _c,
16163
+ resultErrorTypes = _a.errorTypes;
16153
16164
 
16154
16165
  if (!(message === null || message === void 0 ? void 0 : message.length)) {
16155
16166
  return;
@@ -16159,11 +16170,13 @@
16159
16170
  warnings = __spreadArrays$1(warnings, message);
16160
16171
  } else {
16161
16172
  errors = __spreadArrays$1(errors, message);
16173
+ errorTypes = __spreadArrays$1(errorTypes, resultErrorTypes);
16162
16174
  }
16163
16175
  });
16164
16176
  return {
16165
16177
  warnings: warnings,
16166
- errors: errors
16178
+ errors: errors,
16179
+ errorTypes: errorTypes
16167
16180
  };
16168
16181
  };
16169
16182
 
@@ -16226,12 +16239,14 @@
16226
16239
  fieldValidator_1.validate((_a = {}, _a[field] = value, _a), function (errorsMap) {
16227
16240
  var _a = getErrorAndWarnings((errorsMap === null || errorsMap === void 0 ? void 0 : errorsMap[field]) || []),
16228
16241
  errors = _a.errors,
16229
- warnings = _a.warnings;
16242
+ warnings = _a.warnings,
16243
+ errorTypes = _a.errorTypes;
16230
16244
 
16231
16245
  _this._errors = errors;
16232
16246
  onValidateStatusChange({
16233
16247
  errors: _this._errors,
16234
- warnings: warnings
16248
+ warnings: warnings,
16249
+ errorTypes: errorTypes
16235
16250
  });
16236
16251
  return resolve({
16237
16252
  errors: _this._errors,
@@ -16470,16 +16485,22 @@
16470
16485
  errors = _e[0],
16471
16486
  setErrors = _e[1];
16472
16487
 
16473
- var _f = React.useState([]),
16474
- warnings = _f[0],
16475
- setWarnings = _f[1];
16488
+ var _f = React.useState(null),
16489
+ errorTypes = _f[0],
16490
+ setErrorTypes = _f[1];
16491
+
16492
+ var _g = React.useState([]),
16493
+ warnings = _g[0],
16494
+ setWarnings = _g[1];
16476
16495
 
16477
16496
  var formItemRef = React.useRef(null);
16478
16497
 
16479
16498
  var onValidateStatusChange = function onValidateStatusChange(validateResult) {
16480
16499
  var _errors = validateResult.errors,
16481
- _warnings = validateResult.warnings;
16500
+ _warnings = validateResult.warnings,
16501
+ _errorTypes = validateResult.errorTypes;
16482
16502
  setErrors(_errors.length ? _errors[0] : null);
16503
+ setErrorTypes(_errorTypes.length ? _errorTypes[0] : null);
16483
16504
  setWarnings(_warnings);
16484
16505
  };
16485
16506
 
@@ -16501,7 +16522,7 @@
16501
16522
  return /*#__PURE__*/React__default["default"].createElement("div", {
16502
16523
  className: cls(prefixCls + "-form-item", prefixCls + "-form-item-" + (itemLayout || layout), className, (_a = {
16503
16524
  disabled: fieldDisabled
16504
- }, _a[prefixCls + "-form-item-error"] = !!errors, _a[prefixCls + "-form-item-warning"] = Boolean(!errors && warnings), _a)),
16525
+ }, _a[prefixCls + "-form-item-error"] = !!errors, _a[prefixCls + "-form-item-warning"] = Boolean(!errors && warnings), _a[prefixCls + "-form-item-error-" + errorTypes] = errorTypes, _a)),
16505
16526
  style: style,
16506
16527
  ref: formItemRef
16507
16528
  }, /*#__PURE__*/React__default["default"].createElement("div", {