@arco-design/mobile-react 2.33.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.
- package/CHANGELOG.md +19 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.js +2 -0
- package/cjs/divider/style/css/index.css +6 -4
- package/cjs/divider/style/index.less +3 -1
- package/cjs/notice-bar/index.js +11 -8
- package/cjs/popover/popover-inner.js +9 -2
- package/dist/index.js +22 -10
- package/dist/index.min.js +2 -2
- package/dist/style.css +5 -3
- package/dist/style.min.css +1 -1
- package/esm/_helpers/hooks.js +2 -0
- package/esm/divider/style/css/index.css +6 -4
- package/esm/divider/style/index.less +3 -1
- package/esm/notice-bar/index.js +12 -9
- package/esm/popover/popover-inner.js +9 -2
- package/esnext/_helpers/hooks.js +6 -2
- package/esnext/divider/style/css/index.css +6 -4
- package/esnext/divider/style/index.less +3 -1
- package/esnext/notice-bar/index.js +6 -6
- package/esnext/popover/popover-inner.js +7 -2
- package/package.json +3 -3
- package/umd/_helpers/hooks.js +2 -0
- package/umd/divider/style/css/index.css +6 -4
- package/umd/divider/style/index.less +3 -1
- package/umd/notice-bar/index.js +11 -8
- package/umd/popover/popover-inner.js +9 -2
@@ -542,10 +542,12 @@
|
|
542
542
|
.arco-divider::before {
|
543
543
|
content: '';
|
544
544
|
}
|
545
|
-
|
546
|
-
.arco-divider--hairline::
|
547
|
-
-
|
548
|
-
|
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
|
-
|
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);
|
package/esm/notice-bar/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { cls,
|
1
|
+
import { cls, fadeColor, nextTick } from '@arco-design/mobile-utils';
|
2
2
|
import React, { useRef, forwardRef, useImperativeHandle, useState, useEffect, useMemo, useContext } from 'react';
|
3
3
|
import { ContextLayout, GlobalContext } from '../context-provider';
|
4
4
|
import IconClose from '../icon/IconClose';
|
@@ -43,9 +43,13 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
43
43
|
var contentRef = useRef(null);
|
44
44
|
var timerRef = useRef(null);
|
45
45
|
|
46
|
-
var _useState = useState(
|
47
|
-
|
48
|
-
|
46
|
+
var _useState = useState(true),
|
47
|
+
visible = _useState[0],
|
48
|
+
setVisible = _useState[1];
|
49
|
+
|
50
|
+
var _useState2 = useState(false),
|
51
|
+
needMarquee = _useState2[0],
|
52
|
+
setNeedMarquee = _useState2[1];
|
49
53
|
|
50
54
|
var extraClass = useMemo(function () {
|
51
55
|
var classList = []; // 字幕可滚动时,或不可滚动且不可以换行时,添加不换行效果
|
@@ -86,9 +90,8 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
86
90
|
}, [useRtl]);
|
87
91
|
|
88
92
|
function close() {
|
89
|
-
|
90
|
-
|
91
|
-
}
|
93
|
+
setVisible(false);
|
94
|
+
clear();
|
92
95
|
}
|
93
96
|
|
94
97
|
function handleClose(e) {
|
@@ -153,7 +156,7 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
153
156
|
}
|
154
157
|
|
155
158
|
function renderNoticeBar(prefix) {
|
156
|
-
return /*#__PURE__*/React.createElement("div", {
|
159
|
+
return visible ? /*#__PURE__*/React.createElement("div", {
|
157
160
|
className: cls(prefix, className, extraClass),
|
158
161
|
style: style,
|
159
162
|
ref: domRef,
|
@@ -179,7 +182,7 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
179
182
|
}, rightContent) : null, closeable ? /*#__PURE__*/React.createElement("div", {
|
180
183
|
className: prefix + "-close",
|
181
184
|
onClick: handleClose
|
182
|
-
}, closeIcon) : null);
|
185
|
+
}, closeIcon) : null) : null;
|
183
186
|
}
|
184
187
|
|
185
188
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
@@ -47,7 +47,15 @@ export var PopoverInner = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
47
47
|
if (left || width || top || height || bottom) {
|
48
48
|
if (!show) {
|
49
49
|
setTimeout(function () {
|
50
|
-
setShow(
|
50
|
+
setShow(function () {
|
51
|
+
var _domRef$current;
|
52
|
+
|
53
|
+
// bugfix:
|
54
|
+
// 外层CSSTransition使用dom API而非通过react className属性修改class
|
55
|
+
// 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
|
56
|
+
(_domRef$current = domRef.current) == null ? void 0 : _domRef$current.classList.add('show');
|
57
|
+
return true;
|
58
|
+
});
|
51
59
|
}, 0);
|
52
60
|
}
|
53
61
|
}
|
@@ -99,7 +107,6 @@ export var PopoverInner = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
99
107
|
return /*#__PURE__*/React.createElement("div", {
|
100
108
|
ref: domRef,
|
101
109
|
className: cls(prefixCls + "-popover-inner", 'popover-inner', 'all-border-box', mode + "-mode", className, {
|
102
|
-
show: show,
|
103
110
|
'with-shadow': needShadow,
|
104
111
|
'with-suffix': showCloseIcon || textSuffix,
|
105
112
|
'custom-content': typeof content !== 'string'
|
package/esnext/_helpers/hooks.js
CHANGED
@@ -60,8 +60,12 @@ export function useMountedState(initialState) {
|
|
60
60
|
}
|
61
61
|
setState(value);
|
62
62
|
}, []);
|
63
|
-
useEffect(() =>
|
64
|
-
|
63
|
+
useEffect(() => {
|
64
|
+
// see: https://github.com/arco-design/arco-design-mobile/pull/292
|
65
|
+
leavingRef.current = false;
|
66
|
+
return () => {
|
67
|
+
leavingRef.current = true;
|
68
|
+
};
|
65
69
|
}, []);
|
66
70
|
const result = [state, setValidState];
|
67
71
|
return result;
|
@@ -542,10 +542,12 @@
|
|
542
542
|
.arco-divider::before {
|
543
543
|
content: '';
|
544
544
|
}
|
545
|
-
|
546
|
-
.arco-divider--hairline::
|
547
|
-
-
|
548
|
-
|
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
|
-
|
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);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { cls,
|
1
|
+
import { cls, fadeColor, nextTick } from '@arco-design/mobile-utils';
|
2
2
|
import React, { useRef, forwardRef, useImperativeHandle, useState, useEffect, useMemo, useContext, } from 'react';
|
3
3
|
import { ContextLayout, GlobalContext } from '../context-provider';
|
4
4
|
import IconClose from '../icon/IconClose';
|
@@ -17,6 +17,7 @@ const NoticeBar = forwardRef((props, ref) => {
|
|
17
17
|
const wrapRef = useRef(null);
|
18
18
|
const contentRef = useRef(null);
|
19
19
|
const timerRef = useRef(null);
|
20
|
+
const [visible, setVisible] = useState(true);
|
20
21
|
const [needMarquee, setNeedMarquee] = useState(false);
|
21
22
|
const extraClass = useMemo(() => {
|
22
23
|
const classList = [];
|
@@ -53,9 +54,8 @@ const NoticeBar = forwardRef((props, ref) => {
|
|
53
54
|
updateData();
|
54
55
|
}, [useRtl]);
|
55
56
|
function close() {
|
56
|
-
|
57
|
-
|
58
|
-
}
|
57
|
+
setVisible(false);
|
58
|
+
clear();
|
59
59
|
}
|
60
60
|
function handleClose(e) {
|
61
61
|
e.stopPropagation();
|
@@ -112,14 +112,14 @@ const NoticeBar = forwardRef((props, ref) => {
|
|
112
112
|
}
|
113
113
|
}
|
114
114
|
function renderNoticeBar(prefix) {
|
115
|
-
return (React.createElement("div", { className: cls(prefix, className, extraClass), style: style, ref: domRef, onClick: onClick },
|
115
|
+
return visible ? (React.createElement("div", { className: cls(prefix, className, extraClass), style: style, ref: domRef, onClick: onClick },
|
116
116
|
leftContent ? React.createElement("div", { className: `${prefix}-left-part` }, leftContent) : null,
|
117
117
|
React.createElement("div", { className: `${prefix}-content`, ref: wrapRef },
|
118
118
|
needMarquee ? (React.createElement("i", { className: `${prefix}-gradient left`, style: gradientStyle })) : null,
|
119
119
|
React.createElement("div", { className: cls(`${prefix}-content-inner`, { animate: needMarquee }), ref: contentRef }, children),
|
120
120
|
needMarquee ? (React.createElement("i", { className: `${prefix}-gradient right`, style: gradientStyle })) : null),
|
121
121
|
rightContent ? React.createElement("div", { className: `${prefix}-right-part` }, rightContent) : null,
|
122
|
-
closeable ? (React.createElement("div", { className: `${prefix}-close`, onClick: handleClose }, closeIcon)) : null));
|
122
|
+
closeable ? (React.createElement("div", { className: `${prefix}-close`, onClick: handleClose }, closeIcon)) : null)) : null;
|
123
123
|
}
|
124
124
|
return (React.createElement(ContextLayout, null, ({ prefixCls }) => renderNoticeBar(`${prefixCls}-notice-bar`)));
|
125
125
|
});
|
@@ -18,7 +18,13 @@ export const PopoverInner = forwardRef((props, ref) => {
|
|
18
18
|
if (left || width || top || height || bottom) {
|
19
19
|
if (!show) {
|
20
20
|
setTimeout(() => {
|
21
|
-
setShow(
|
21
|
+
setShow(() => {
|
22
|
+
// bugfix:
|
23
|
+
// 外层CSSTransition使用dom API而非通过react className属性修改class
|
24
|
+
// 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
|
25
|
+
domRef.current?.classList.add('show');
|
26
|
+
return true;
|
27
|
+
});
|
22
28
|
}, 0);
|
23
29
|
}
|
24
30
|
}
|
@@ -60,7 +66,6 @@ export const PopoverInner = forwardRef((props, ref) => {
|
|
60
66
|
};
|
61
67
|
};
|
62
68
|
return (React.createElement("div", { ref: domRef, className: cls(`${prefixCls}-popover-inner`, 'popover-inner', 'all-border-box', `${mode}-mode`, className, {
|
63
|
-
show,
|
64
69
|
'with-shadow': needShadow,
|
65
70
|
'with-suffix': showCloseIcon || textSuffix,
|
66
71
|
'custom-content': typeof content !== 'string',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arco-design/mobile-react",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.34.0",
|
4
4
|
"description": "",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "esm/index.js",
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"author": "taoyiyue@bytedance.com",
|
16
16
|
"license": "ISC",
|
17
17
|
"dependencies": {
|
18
|
-
"@arco-design/mobile-utils": "2.20.
|
18
|
+
"@arco-design/mobile-utils": "2.20.1",
|
19
19
|
"@arco-design/transformable": "^1.0.0",
|
20
20
|
"@babel/runtime": "^7",
|
21
21
|
"lodash.throttle": "^4.1.1",
|
@@ -47,5 +47,5 @@
|
|
47
47
|
"publishConfig": {
|
48
48
|
"access": "public"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "42445e5c9d62da918bdbcf48afc01c77916f8519"
|
51
51
|
}
|
package/umd/_helpers/hooks.js
CHANGED
@@ -542,10 +542,12 @@
|
|
542
542
|
.arco-divider::before {
|
543
543
|
content: '';
|
544
544
|
}
|
545
|
-
|
546
|
-
.arco-divider--hairline::
|
547
|
-
-
|
548
|
-
|
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
|
-
|
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);
|
package/umd/notice-bar/index.js
CHANGED
@@ -64,9 +64,13 @@
|
|
64
64
|
var contentRef = (0, _react.useRef)(null);
|
65
65
|
var timerRef = (0, _react.useRef)(null);
|
66
66
|
|
67
|
-
var _useState = (0, _react.useState)(
|
68
|
-
|
69
|
-
|
67
|
+
var _useState = (0, _react.useState)(true),
|
68
|
+
visible = _useState[0],
|
69
|
+
setVisible = _useState[1];
|
70
|
+
|
71
|
+
var _useState2 = (0, _react.useState)(false),
|
72
|
+
needMarquee = _useState2[0],
|
73
|
+
setNeedMarquee = _useState2[1];
|
70
74
|
|
71
75
|
var extraClass = (0, _react.useMemo)(function () {
|
72
76
|
var classList = []; // 字幕可滚动时,或不可滚动且不可以换行时,添加不换行效果
|
@@ -107,9 +111,8 @@
|
|
107
111
|
}, [useRtl]);
|
108
112
|
|
109
113
|
function close() {
|
110
|
-
|
111
|
-
|
112
|
-
}
|
114
|
+
setVisible(false);
|
115
|
+
clear();
|
113
116
|
}
|
114
117
|
|
115
118
|
function handleClose(e) {
|
@@ -174,7 +177,7 @@
|
|
174
177
|
}
|
175
178
|
|
176
179
|
function renderNoticeBar(prefix) {
|
177
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
180
|
+
return visible ? /*#__PURE__*/_react.default.createElement("div", {
|
178
181
|
className: (0, _mobileUtils.cls)(prefix, className, extraClass),
|
179
182
|
style: style,
|
180
183
|
ref: domRef,
|
@@ -200,7 +203,7 @@
|
|
200
203
|
}, rightContent) : null, closeable ? /*#__PURE__*/_react.default.createElement("div", {
|
201
204
|
className: prefix + "-close",
|
202
205
|
onClick: handleClose
|
203
|
-
}, closeIcon) : null);
|
206
|
+
}, closeIcon) : null) : null;
|
204
207
|
}
|
205
208
|
|
206
209
|
return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
|
@@ -68,7 +68,15 @@
|
|
68
68
|
if (left || width || top || height || bottom) {
|
69
69
|
if (!show) {
|
70
70
|
setTimeout(function () {
|
71
|
-
setShow(
|
71
|
+
setShow(function () {
|
72
|
+
var _domRef$current;
|
73
|
+
|
74
|
+
// bugfix:
|
75
|
+
// 外层CSSTransition使用dom API而非通过react className属性修改class
|
76
|
+
// 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
|
77
|
+
(_domRef$current = domRef.current) == null ? void 0 : _domRef$current.classList.add('show');
|
78
|
+
return true;
|
79
|
+
});
|
72
80
|
}, 0);
|
73
81
|
}
|
74
82
|
}
|
@@ -120,7 +128,6 @@
|
|
120
128
|
return /*#__PURE__*/_react.default.createElement("div", {
|
121
129
|
ref: domRef,
|
122
130
|
className: (0, _mobileUtils.cls)(prefixCls + "-popover-inner", 'popover-inner', 'all-border-box', mode + "-mode", className, {
|
123
|
-
show: show,
|
124
131
|
'with-shadow': needShadow,
|
125
132
|
'with-suffix': showCloseIcon || textSuffix,
|
126
133
|
'custom-content': typeof content !== 'string'
|