@arco-design/mobile-react 2.33.0 → 2.35.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 (41) hide show
  1. package/CHANGELOG.md +38 -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/date-picker/index.js +1 -1
  6. package/cjs/date-picker/type.d.ts +1 -1
  7. package/cjs/divider/style/css/index.css +6 -4
  8. package/cjs/divider/style/index.less +3 -1
  9. package/cjs/notice-bar/index.js +11 -8
  10. package/cjs/popover/popover-inner.js +9 -2
  11. package/dist/index.js +23 -11
  12. package/dist/index.min.js +2 -2
  13. package/dist/style.css +5 -3
  14. package/dist/style.min.css +1 -1
  15. package/esm/_helpers/hooks.js +2 -0
  16. package/esm/date-picker/index.js +2 -2
  17. package/esm/date-picker/type.d.ts +1 -1
  18. package/esm/divider/style/css/index.css +6 -4
  19. package/esm/divider/style/index.less +3 -1
  20. package/esm/notice-bar/index.js +12 -9
  21. package/esm/popover/popover-inner.js +9 -2
  22. package/esnext/_helpers/hooks.js +6 -2
  23. package/esnext/date-picker/index.js +2 -2
  24. package/esnext/date-picker/type.d.ts +1 -1
  25. package/esnext/divider/style/css/index.css +6 -4
  26. package/esnext/divider/style/index.less +3 -1
  27. package/esnext/notice-bar/index.js +6 -6
  28. package/esnext/popover/popover-inner.js +7 -2
  29. package/package.json +3 -3
  30. package/tokens/app/arcodesign/default/css-variables.less +2 -1
  31. package/tokens/app/arcodesign/default/index.d.ts +1 -0
  32. package/tokens/app/arcodesign/default/index.js +2 -1
  33. package/tokens/app/arcodesign/default/index.json +15 -2
  34. package/tokens/app/arcodesign/default/index.less +2 -1
  35. package/umd/_helpers/hooks.js +2 -0
  36. package/umd/date-picker/index.js +1 -1
  37. package/umd/date-picker/type.d.ts +1 -1
  38. package/umd/divider/style/css/index.css +6 -4
  39. package/umd/divider/style/index.less +3 -1
  40. package/umd/notice-bar/index.js +11 -8
  41. package/umd/popover/popover-inner.js +9 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.35.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.34.0...@arco-design/mobile-react@2.35.0) (2025-01-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * add new less variable `[@prefix-mobile](https://github.com/prefix-mobile)` ([#310](https://github.com/arco-design/arco-design-mobile/issues/310)) ([c8b539c](https://github.com/arco-design/arco-design-mobile/commit/c8b539cf7c5a064f1334de6d87a7c00d22c8f453))
12
+ * change protocol from http to https ([#304](https://github.com/arco-design/arco-design-mobile/issues/304)) ([0c42f9b](https://github.com/arco-design/arco-design-mobile/commit/0c42f9becf74e2dcbd02d774b426e113ea2b260c))
13
+ * fix `Context-Provider` demo url ([#306](https://github.com/arco-design/arco-design-mobile/issues/306)) ([4a5c0f8](https://github.com/arco-design/arco-design-mobile/commit/4a5c0f86de85f5eddb2b0b6816db2a9ea38cde40))
14
+ * keep empty value in renderLinkedContainer of `DatePicker` ([#309](https://github.com/arco-design/arco-design-mobile/issues/309)) ([0f07a93](https://github.com/arco-design/arco-design-mobile/commit/0f07a931de93b22dfe17aa5eda878b51cc943913))
15
+
16
+
17
+ ### Features
18
+
19
+ * add dynamic theme demo ([#305](https://github.com/arco-design/arco-design-mobile/issues/305)) ([f27ccc6](https://github.com/arco-design/arco-design-mobile/commit/f27ccc6910a700a064be22926c2321b3afac4694))
20
+
21
+
22
+
23
+
24
+
25
+ # [2.34.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.33.0...@arco-design/mobile-react@2.34.0) (2024-11-21)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * `Popover` custom show transition animation ([#297](https://github.com/arco-design/arco-design-mobile/issues/297)) ([c3ceaf2](https://github.com/arco-design/arco-design-mobile/commit/c3ceaf2a7571626c298132b2c486d7128a748007))
31
+ * fix `useMountedState` in `hooks.ts` not correct init leavingRef in StrictMode. ([#292](https://github.com/arco-design/arco-design-mobile/issues/292)) ([af2bf5d](https://github.com/arco-design/arco-design-mobile/commit/af2bf5d5428eec252cac565ef708b2af6e0106a2))
32
+
33
+
34
+ ### Features
35
+
36
+ * add a FAQ in the `Dialog`. ([#302](https://github.com/arco-design/arco-design-mobile/issues/302)) ([55f6940](https://github.com/arco-design/arco-design-mobile/commit/55f69406a3411faf5e67b2ef05a552121a9d3c04))
37
+ * optimize `Divider` hairline style ([99b1604](https://github.com/arco-design/arco-design-mobile/commit/99b16041aa8e4b71a82ffb5744f180ee9273ef3b))
38
+ * optimize `NoticeBar` close ([#294](https://github.com/arco-design/arco-design-mobile/issues/294)) ([a717540](https://github.com/arco-design/arco-design-mobile/commit/a7175403158c43c209b58c27cd994643f822aeeb))
39
+
40
+
41
+
42
+
43
+
6
44
  # [2.33.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.32.0...@arco-design/mobile-react@2.33.0) (2024-10-24)
7
45
 
8
46
 
package/README.en-US.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.32.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.32.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.34.0/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.34.0/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## Full import
package/README.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.32.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.32.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.34.0/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.34.0/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## 引入全部
@@ -101,6 +101,8 @@ function useMountedState(initialState) {
101
101
  setState(value);
102
102
  }, []);
103
103
  (0, _react.useEffect)(function () {
104
+ // see: https://github.com/arco-design/arco-design-mobile/pull/292
105
+ leavingRef.current = false;
104
106
  return function () {
105
107
  leavingRef.current = true;
106
108
  };
@@ -345,7 +345,7 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
345
345
  onOk: _handlePickerConfirm,
346
346
  touchToStop: touchToStop,
347
347
  renderLinkedContainer: renderLinkedContainer ? function () {
348
- return renderLinkedContainer(currentTs, keyOptions);
348
+ return renderLinkedContainer((0, _mobileUtils.isEmptyValue)(props.currentTs) ? undefined : currentTs, keyOptions);
349
349
  } : undefined
350
350
  }));
351
351
  });
@@ -110,5 +110,5 @@ export interface DatePickerProps extends Omit<PickerProps, 'data' | 'cascade' |
110
110
  * 将选择器的展现隐藏状态及选中值的展示与某个容器关联,传入后将同时渲染该容器和选择器组件,此时选择器组件的 visible 和 onHide 属性可不传,点击该容器会唤起选择器
111
111
  * @en Associate the hidden state of the picker and the display of the selected value with a container. After passing it in, the container and the picker component will be rendered at the same time. At this time, the visible and onHide attributes of the picker component are optional values. Clicking the container will evoke the picker
112
112
  */
113
- renderLinkedContainer?: (currentTs: number, itemTypes: ItemType[]) => ReactNode;
113
+ renderLinkedContainer?: (currentTs: number | undefined, itemTypes: ItemType[]) => ReactNode;
114
114
  }
@@ -542,10 +542,12 @@
542
542
  .arco-divider::before {
543
543
  content: '';
544
544
  }
545
- .arco-divider--hairline::before,
546
- .arco-divider--hairline::after {
547
- -webkit-transform: scaleY(0.5);
548
- transform: scaleY(0.5);
545
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
546
+ .arco-divider--hairline::before,
547
+ .arco-divider--hairline::after {
548
+ -webkit-transform: scaleY(0.5);
549
+ transform: scaleY(0.5);
550
+ }
549
551
  }
550
552
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
551
553
  .arco-divider--hairline::before,
@@ -27,7 +27,9 @@
27
27
  &--hairline {
28
28
  &::before,
29
29
  &::after {
30
- transform: scaleY(0.5);
30
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
31
+ transform: scaleY(0.5);
32
+ }
31
33
 
32
34
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
33
35
  transform: scaleY(0.33333333);
@@ -57,9 +57,13 @@ var NoticeBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
57
57
  var contentRef = (0, _react.useRef)(null);
58
58
  var timerRef = (0, _react.useRef)(null);
59
59
 
60
- var _useState = (0, _react.useState)(false),
61
- needMarquee = _useState[0],
62
- setNeedMarquee = _useState[1];
60
+ var _useState = (0, _react.useState)(true),
61
+ visible = _useState[0],
62
+ setVisible = _useState[1];
63
+
64
+ var _useState2 = (0, _react.useState)(false),
65
+ needMarquee = _useState2[0],
66
+ setNeedMarquee = _useState2[1];
63
67
 
64
68
  var extraClass = (0, _react.useMemo)(function () {
65
69
  var classList = []; // 字幕可滚动时,或不可滚动且不可以换行时,添加不换行效果
@@ -100,9 +104,8 @@ var NoticeBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
100
104
  }, [useRtl]);
101
105
 
102
106
  function close() {
103
- if (domRef.current) {
104
- (0, _mobileUtils.removeElement)(domRef.current);
105
- }
107
+ setVisible(false);
108
+ clear();
106
109
  }
107
110
 
108
111
  function handleClose(e) {
@@ -167,7 +170,7 @@ var NoticeBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
167
170
  }
168
171
 
169
172
  function renderNoticeBar(prefix) {
170
- return /*#__PURE__*/_react.default.createElement("div", {
173
+ return visible ? /*#__PURE__*/_react.default.createElement("div", {
171
174
  className: (0, _mobileUtils.cls)(prefix, className, extraClass),
172
175
  style: style,
173
176
  ref: domRef,
@@ -193,7 +196,7 @@ var NoticeBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
193
196
  }, rightContent) : null, closeable ? /*#__PURE__*/_react.default.createElement("div", {
194
197
  className: prefix + "-close",
195
198
  onClick: handleClose
196
- }, closeIcon) : null);
199
+ }, closeIcon) : null) : null;
197
200
  }
198
201
 
199
202
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
@@ -63,7 +63,15 @@ var PopoverInner = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
63
63
  if (left || width || top || height || bottom) {
64
64
  if (!show) {
65
65
  setTimeout(function () {
66
- setShow(true);
66
+ setShow(function () {
67
+ var _domRef$current;
68
+
69
+ // bugfix:
70
+ // 外层CSSTransition使用dom API而非通过react className属性修改class
71
+ // 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
72
+ (_domRef$current = domRef.current) == null ? void 0 : _domRef$current.classList.add('show');
73
+ return true;
74
+ });
67
75
  }, 0);
68
76
  }
69
77
  }
@@ -115,7 +123,6 @@ var PopoverInner = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
115
123
  return /*#__PURE__*/_react.default.createElement("div", {
116
124
  ref: domRef,
117
125
  className: (0, _mobileUtils.cls)(prefixCls + "-popover-inner", 'popover-inner', 'all-border-box', mode + "-mode", className, {
118
- show: show,
119
126
  'with-shadow': needShadow,
120
127
  'with-suffix': showCloseIcon || textSuffix,
121
128
  'custom-content': typeof content !== 'string'
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
  };
@@ -13962,7 +13964,7 @@
13962
13964
  onOk: _handlePickerConfirm,
13963
13965
  touchToStop: touchToStop,
13964
13966
  renderLinkedContainer: renderLinkedContainer ? function () {
13965
- return renderLinkedContainer(currentTs, keyOptions);
13967
+ return renderLinkedContainer(isEmptyValue(props.currentTs) ? undefined : currentTs, keyOptions);
13966
13968
  } : undefined
13967
13969
  }));
13968
13970
  });
@@ -23516,9 +23518,13 @@
23516
23518
  var contentRef = React.useRef(null);
23517
23519
  var timerRef = React.useRef(null);
23518
23520
 
23519
- var _j = React.useState(false),
23520
- needMarquee = _j[0],
23521
- 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];
23522
23528
 
23523
23529
  var extraClass = React.useMemo(function () {
23524
23530
  var classList = []; // 字幕可滚动时,或不可滚动且不可以换行时,添加不换行效果
@@ -23559,9 +23565,8 @@
23559
23565
  }, [useRtl]);
23560
23566
 
23561
23567
  function close() {
23562
- if (domRef.current) {
23563
- removeElement(domRef.current);
23564
- }
23568
+ setVisible(false);
23569
+ clear();
23565
23570
  }
23566
23571
 
23567
23572
  function handleClose(e) {
@@ -23626,7 +23631,7 @@
23626
23631
  }
23627
23632
 
23628
23633
  function renderNoticeBar(prefix) {
23629
- return /*#__PURE__*/React__default["default"].createElement("div", {
23634
+ return visible ? /*#__PURE__*/React__default["default"].createElement("div", {
23630
23635
  className: cls(prefix, className, extraClass),
23631
23636
  style: style,
23632
23637
  ref: domRef,
@@ -23652,7 +23657,7 @@
23652
23657
  }, rightContent) : null, closeable ? /*#__PURE__*/React__default["default"].createElement("div", {
23653
23658
  className: prefix + "-close",
23654
23659
  onClick: handleClose
23655
- }, closeIcon) : null);
23660
+ }, closeIcon) : null) : null;
23656
23661
  }
23657
23662
 
23658
23663
  return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
@@ -24253,7 +24258,15 @@
24253
24258
  if (left || width || top || height || bottom) {
24254
24259
  if (!show) {
24255
24260
  setTimeout(function () {
24256
- 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
+ });
24257
24270
  }, 0);
24258
24271
  }
24259
24272
  }
@@ -24305,7 +24318,6 @@
24305
24318
  return /*#__PURE__*/React__default["default"].createElement("div", {
24306
24319
  ref: domRef,
24307
24320
  className: cls(prefixCls + "-popover-inner", 'popover-inner', 'all-border-box', mode + "-mode", className, {
24308
- show: show,
24309
24321
  'with-shadow': needShadow,
24310
24322
  'with-suffix': showCloseIcon || textSuffix,
24311
24323
  'custom-content': typeof content !== 'string'