@nutui/nutui-react 4.0.0-beta.5 → 4.0.0-beta.7
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 +15 -0
- package/dist/cjs/packages/animate/style/style.css +27 -9
- package/dist/cjs/packages/animate/style-jmapp/style.css +27 -9
- package/dist/cjs/packages/animate/style-jrkf/style.css +27 -9
- package/dist/cjs/packages/audio/audio.js +8 -8
- package/dist/cjs/packages/badge/badge.js +9 -9
- package/dist/cjs/packages/button/style/style.css +20 -8
- package/dist/cjs/packages/button/style-jmapp/style.css +20 -8
- package/dist/cjs/packages/button/style-jrkf/style.css +20 -8
- package/dist/cjs/packages/cascader/utils.js +3 -2
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/indicator/indicator.js +6 -6
- package/dist/cjs/packages/infiniteloading/infiniteloading.js +9 -9
- package/dist/cjs/packages/navbar/style/style.css +3 -1
- package/dist/cjs/packages/navbar/style-jmapp/style.css +3 -1
- package/dist/cjs/packages/navbar/style-jrkf/style.css +3 -1
- package/dist/cjs/packages/noticebar/noticebar.js +115 -52
- package/dist/cjs/packages/noticebar/style/noticebar.scss +130 -10
- package/dist/cjs/packages/noticebar/style/style.css +138 -35
- package/dist/cjs/packages/noticebar/style-jmapp/noticebar.scss +130 -10
- package/dist/cjs/packages/noticebar/style-jmapp/style.css +113 -10
- package/dist/cjs/packages/noticebar/style-jrkf/noticebar.scss +130 -10
- package/dist/cjs/packages/noticebar/style-jrkf/style.css +113 -10
- package/dist/cjs/packages/notify/Notification.js +8 -8
- package/dist/cjs/packages/numberkeyboard/style/style.css +6 -6
- package/dist/cjs/packages/numberkeyboard/style-jmapp/style.css +6 -6
- package/dist/cjs/packages/numberkeyboard/style-jrkf/style.css +6 -6
- package/dist/cjs/packages/popover/popover.js +46 -37
- package/dist/cjs/packages/popover/style/popover.scss +79 -54
- package/dist/cjs/packages/popover/style/style.css +73 -61
- package/dist/cjs/packages/popover/style-jmapp/popover.scss +79 -54
- package/dist/cjs/packages/popover/style-jmapp/style.css +73 -61
- package/dist/cjs/packages/popover/style-jrkf/popover.scss +79 -54
- package/dist/cjs/packages/popover/style-jrkf/style.css +73 -61
- package/dist/cjs/packages/popup/style/style.css +12 -6
- package/dist/cjs/packages/popup/style-jmapp/style.css +12 -6
- package/dist/cjs/packages/popup/style-jrkf/style.css +12 -6
- package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +35 -35
- package/dist/cjs/packages/skeleton/skeleton.js +15 -15
- package/dist/cjs/packages/swiper/swiper.js +11 -11
- package/dist/cjs/packages/toast/Notification.js +8 -8
- package/dist/cjs/packages/tour/tour.js +1 -1
- package/dist/cjs/types/spec/noticebar/base.d.ts +5 -1
- package/dist/cjs/types/spec/popover/base.d.ts +4 -0
- package/dist/cjs/utils/is-forward-ref-component.js +2 -2
- package/dist/cjs/utils/render.js +1 -1
- package/dist/es/packages/animate/style/style.css +27 -9
- package/dist/es/packages/animate/style-jmapp/style.css +27 -9
- package/dist/es/packages/animate/style-jrkf/style.css +27 -9
- package/dist/es/packages/audio/audio.js +8 -8
- package/dist/es/packages/badge/badge.js +9 -9
- package/dist/es/packages/button/style/style.css +20 -8
- package/dist/es/packages/button/style-jmapp/style.css +20 -8
- package/dist/es/packages/button/style-jrkf/style.css +20 -8
- package/dist/es/packages/cascader/utils.js +3 -2
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/indicator/indicator.js +6 -6
- package/dist/es/packages/infiniteloading/infiniteloading.js +9 -9
- package/dist/es/packages/navbar/style/style.css +3 -1
- package/dist/es/packages/navbar/style-jmapp/style.css +3 -1
- package/dist/es/packages/navbar/style-jrkf/style.css +3 -1
- package/dist/es/packages/noticebar/noticebar.js +117 -55
- package/dist/es/packages/noticebar/style/noticebar.scss +130 -10
- package/dist/es/packages/noticebar/style/style.css +138 -35
- package/dist/es/packages/noticebar/style-jmapp/noticebar.scss +130 -10
- package/dist/es/packages/noticebar/style-jmapp/style.css +113 -10
- package/dist/es/packages/noticebar/style-jrkf/noticebar.scss +130 -10
- package/dist/es/packages/noticebar/style-jrkf/style.css +113 -10
- package/dist/es/packages/notify/Notification.js +8 -8
- package/dist/es/packages/numberkeyboard/style/style.css +6 -6
- package/dist/es/packages/numberkeyboard/style-jmapp/style.css +6 -6
- package/dist/es/packages/numberkeyboard/style-jrkf/style.css +6 -6
- package/dist/es/packages/popover/popover.js +46 -37
- package/dist/es/packages/popover/style/popover.scss +79 -54
- package/dist/es/packages/popover/style/style.css +73 -61
- package/dist/es/packages/popover/style-jmapp/popover.scss +79 -54
- package/dist/es/packages/popover/style-jmapp/style.css +73 -61
- package/dist/es/packages/popover/style-jrkf/popover.scss +79 -54
- package/dist/es/packages/popover/style-jrkf/style.css +73 -61
- package/dist/es/packages/popup/style/style.css +12 -6
- package/dist/es/packages/popup/style-jmapp/style.css +12 -6
- package/dist/es/packages/popup/style-jrkf/style.css +12 -6
- package/dist/es/packages/pulltorefresh/pulltorefresh.js +35 -35
- package/dist/es/packages/skeleton/skeleton.js +15 -15
- package/dist/es/packages/swiper/swiper.js +11 -11
- package/dist/es/packages/toast/Notification.js +8 -8
- package/dist/es/packages/tour/tour.js +1 -1
- package/dist/es/types/spec/noticebar/base.d.ts +19 -3
- package/dist/es/types/spec/popover/base.d.ts +17 -1
- package/dist/es/utils/render.js +1 -1
- package/dist/nutui.react.umd.js +1616 -1256
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +33 -33
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +42 -42
- package/dist/style.css +1 -1
- package/dist/style.scss +39 -39
- package/dist/styles/variables-daojia.scss +55 -9
- package/dist/styles/variables-jmapp.scss +52 -6
- package/dist/styles/variables-jrkf.scss +52 -6
- package/dist/styles/variables.scss +123 -15
- package/package.json +1 -1
|
@@ -14,39 +14,44 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
14
14
|
direction: 'horizontal',
|
|
15
15
|
list: [],
|
|
16
16
|
duration: 1000,
|
|
17
|
-
height:
|
|
17
|
+
height: 36,
|
|
18
18
|
content: '',
|
|
19
19
|
closeable: false,
|
|
20
20
|
wrap: false,
|
|
21
21
|
leftIcon: /*#__PURE__*/ React.createElement(Notice, null),
|
|
22
22
|
rightIcon: null,
|
|
23
23
|
right: null,
|
|
24
|
+
description: null,
|
|
25
|
+
tag: null,
|
|
26
|
+
action: null,
|
|
27
|
+
autoClose: 0,
|
|
24
28
|
delay: 1,
|
|
25
29
|
scrollable: null,
|
|
26
30
|
speed: 50
|
|
27
31
|
});
|
|
28
32
|
export var NoticeBar = function NoticeBar(props) {
|
|
29
33
|
var rtl = useRtl();
|
|
30
|
-
var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style, align = _$_object_spread.align, direction = _$_object_spread.direction, list = _$_object_spread.list, duration = _$_object_spread.duration, height = _$_object_spread.height, content = _$_object_spread.content, closeable = _$_object_spread.closeable, wrap = _$_object_spread.wrap, leftIcon = _$_object_spread.leftIcon, rightIcon = _$_object_spread.rightIcon, right = _$_object_spread.right, delay = _$_object_spread.delay, scrollable = _$_object_spread.scrollable, speed = _$_object_spread.speed, close = _$_object_spread.close, click = _$_object_spread.click, onClose = _$_object_spread.onClose, onClick = _$_object_spread.onClick, onItemClick = _$_object_spread.onItemClick;
|
|
34
|
+
var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style, align = _$_object_spread.align, direction = _$_object_spread.direction, list = _$_object_spread.list, duration = _$_object_spread.duration, height = _$_object_spread.height, content = _$_object_spread.content, closeable = _$_object_spread.closeable, wrap = _$_object_spread.wrap, leftIcon = _$_object_spread.leftIcon, rightIcon = _$_object_spread.rightIcon, right = _$_object_spread.right, description = _$_object_spread.description, tag = _$_object_spread.tag, action = _$_object_spread.action, autoClose = _$_object_spread.autoClose, delay = _$_object_spread.delay, scrollable = _$_object_spread.scrollable, speed = _$_object_spread.speed, close = _$_object_spread.close, click = _$_object_spread.click, onClose = _$_object_spread.onClose, onClick = _$_object_spread.onClick, onItemClick = _$_object_spread.onItemClick;
|
|
31
35
|
var classPrefix = 'nut-noticebar';
|
|
32
36
|
var wrapRef = useRef(null);
|
|
33
37
|
var contentRef = useRef(null);
|
|
34
|
-
var _useState = _sliced_to_array(useState(true), 2), showNoticeBar = _useState[0],
|
|
38
|
+
var _useState = _sliced_to_array(useState(true), 2), showNoticeBar = _useState[0], setShowNoticeBar = _useState[1];
|
|
39
|
+
var _useState1 = _sliced_to_array(useState(100), 2), autoCloseProgress = _useState1[0], setAutoCloseProgress = _useState1[1];
|
|
35
40
|
var scrollList = useRef([]);
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
41
|
+
var _useState2 = _sliced_to_array(useState(0), 2), wrapWidth = _useState2[0], SetWrapWidth = _useState2[1];
|
|
42
|
+
var _useState3 = _sliced_to_array(useState(true), 2), firstRound = _useState3[0], SetFirstRound = _useState3[1];
|
|
43
|
+
var _useState4 = _sliced_to_array(useState(0), 2), animationDuration = _useState4[0], SetAnimationDuration = _useState4[1];
|
|
44
|
+
var _useState5 = _sliced_to_array(useState(0), 2), offsetWidth = _useState5[0], SetOffsetW = _useState5[1];
|
|
45
|
+
var _useState6 = _sliced_to_array(useState(''), 2), animationClass = _useState6[0], SetAnimationClass = _useState6[1];
|
|
46
|
+
var _useState7 = _sliced_to_array(useState(false), 2), animate = _useState7[0], SetAnimate = _useState7[1];
|
|
47
|
+
var _useState8 = _sliced_to_array(useState(0), 2), timer = _useState8[0], SetTimer = _useState8[1];
|
|
48
|
+
var _useState9 = _sliced_to_array(useState(null), 2), isCanScroll = _useState9[0], SetIsCanScroll = _useState9[1];
|
|
44
49
|
var isVertical = direction === 'vertical';
|
|
45
|
-
var
|
|
50
|
+
var _useState10 = _sliced_to_array(useState(null), 2), rect = _useState10[0], setRect = _useState10[1];
|
|
46
51
|
var activeRef = useRef(0);
|
|
47
|
-
var
|
|
52
|
+
var _useState11 = _sliced_to_array(useState(false), 2), ready = _useState11[0], setReady = _useState11[1];
|
|
48
53
|
var container = useRef(null);
|
|
49
|
-
var
|
|
54
|
+
var _useState12 = _sliced_to_array(useState(false), 2), isContainerReady = _useState12[0], setIsContainerReady = _useState12[1];
|
|
50
55
|
var innerRef = useRef(null);
|
|
51
56
|
var swiperRef = useRef({
|
|
52
57
|
moving: false,
|
|
@@ -56,8 +61,8 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
56
61
|
offset: 0,
|
|
57
62
|
size: 0
|
|
58
63
|
});
|
|
59
|
-
var
|
|
60
|
-
var
|
|
64
|
+
var _useState13 = _sliced_to_array(useState([]), 2), childOffset = _useState13[0], setChildOffset = _useState13[1];
|
|
65
|
+
var _useState14 = _sliced_to_array(useState(0), 2), offset = _useState14[0], setOffset = _useState14[1];
|
|
61
66
|
var _useMemo = useMemo(function() {
|
|
62
67
|
var childCount = 0;
|
|
63
68
|
var childs = React.Children.map(children, function(child) {
|
|
@@ -82,6 +87,35 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
82
87
|
}
|
|
83
88
|
return 0;
|
|
84
89
|
}();
|
|
90
|
+
var onCloseRef = useRef(onClose);
|
|
91
|
+
onCloseRef.current = onClose;
|
|
92
|
+
var autoCloseTimerRef = useRef(0);
|
|
93
|
+
var autoCloseIntervalRef = useRef(0);
|
|
94
|
+
// 自动关闭
|
|
95
|
+
useEffect(function() {
|
|
96
|
+
if (autoClose && autoClose > 0 && showNoticeBar) {
|
|
97
|
+
var startTime = Date.now();
|
|
98
|
+
autoCloseIntervalRef.current = window.setInterval(function() {
|
|
99
|
+
var elapsed = Date.now() - startTime;
|
|
100
|
+
var remaining = Math.max(0, 100 - elapsed / autoClose * 100);
|
|
101
|
+
setAutoCloseProgress(remaining);
|
|
102
|
+
if (remaining <= 0) clearInterval(autoCloseIntervalRef.current);
|
|
103
|
+
}, 50);
|
|
104
|
+
autoCloseTimerRef.current = window.setTimeout(function() {
|
|
105
|
+
var _onCloseRef_current;
|
|
106
|
+
setShowNoticeBar(false);
|
|
107
|
+
(_onCloseRef_current = onCloseRef.current) === null || _onCloseRef_current === void 0 ? void 0 : _onCloseRef_current.call(onCloseRef);
|
|
108
|
+
}, autoClose);
|
|
109
|
+
return function() {
|
|
110
|
+
clearInterval(autoCloseIntervalRef.current);
|
|
111
|
+
clearTimeout(autoCloseTimerRef.current);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
setAutoCloseProgress(100);
|
|
115
|
+
}, [
|
|
116
|
+
autoClose,
|
|
117
|
+
showNoticeBar
|
|
118
|
+
]);
|
|
85
119
|
useEffect(function() {
|
|
86
120
|
if (isVertical) {
|
|
87
121
|
if (children) {
|
|
@@ -140,7 +174,9 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
140
174
|
};
|
|
141
175
|
var onClickIcon = function onClickIcon(event) {
|
|
142
176
|
event.stopPropagation();
|
|
143
|
-
|
|
177
|
+
setShowNoticeBar(false);
|
|
178
|
+
clearInterval(autoCloseIntervalRef.current);
|
|
179
|
+
clearTimeout(autoCloseTimerRef.current);
|
|
144
180
|
close && close(event);
|
|
145
181
|
onClose && onClose(event);
|
|
146
182
|
};
|
|
@@ -168,13 +204,6 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
168
204
|
SetAnimate(false);
|
|
169
205
|
}, time);
|
|
170
206
|
};
|
|
171
|
-
// 点击滚动单元
|
|
172
|
-
var handleClickIcon = function handleClickIcon(event) {
|
|
173
|
-
event.stopPropagation();
|
|
174
|
-
SetShowNoticeBar(!closeable);
|
|
175
|
-
close && close(event);
|
|
176
|
-
onClose && onClose(event);
|
|
177
|
-
};
|
|
178
207
|
var isEllipsis = function isEllipsis() {
|
|
179
208
|
if (isCanScroll == null && align === 'left') {
|
|
180
209
|
return wrap;
|
|
@@ -376,6 +405,52 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
376
405
|
container.current = ref;
|
|
377
406
|
setIsContainerReady(true);
|
|
378
407
|
}, []);
|
|
408
|
+
var renderLeftIcon = function renderLeftIcon() {
|
|
409
|
+
if (!leftIcon) return null;
|
|
410
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
411
|
+
className: "".concat(classPrefix, "-box-left-icon")
|
|
412
|
+
}, leftIcon);
|
|
413
|
+
};
|
|
414
|
+
var renderTag = function renderTag() {
|
|
415
|
+
if (!tag) return null;
|
|
416
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
417
|
+
className: "".concat(classPrefix, "-box-tag")
|
|
418
|
+
}, tag);
|
|
419
|
+
};
|
|
420
|
+
var renderAction = function renderAction() {
|
|
421
|
+
if (!action) return null;
|
|
422
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
423
|
+
className: "".concat(classPrefix, "-box-action")
|
|
424
|
+
}, action);
|
|
425
|
+
};
|
|
426
|
+
var renderAutoCloseIcon = function renderAutoCloseIcon() {
|
|
427
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
428
|
+
className: "".concat(classPrefix, "-box-close-countdown"),
|
|
429
|
+
style: {
|
|
430
|
+
'--progress': "".concat(autoCloseProgress, "%")
|
|
431
|
+
}
|
|
432
|
+
}, /*#__PURE__*/ React.createElement(Close, {
|
|
433
|
+
className: "".concat(classPrefix, "-box-close-icon")
|
|
434
|
+
}));
|
|
435
|
+
};
|
|
436
|
+
var renderCloseIcon = function renderCloseIcon() {
|
|
437
|
+
if (!closeable && !rightIcon && !(autoClose && autoClose > 0)) return null;
|
|
438
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
439
|
+
className: "".concat(classPrefix, "-box-right-icon"),
|
|
440
|
+
onClick: onClickIcon
|
|
441
|
+
}, rightIcon || (autoClose && autoClose > 0 ? renderAutoCloseIcon() : /*#__PURE__*/ React.createElement(Close, {
|
|
442
|
+
className: "".concat(classPrefix, "-box-right-icon-default")
|
|
443
|
+
})));
|
|
444
|
+
};
|
|
445
|
+
var renderRight = function renderRight() {
|
|
446
|
+
if (!right) return null;
|
|
447
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
448
|
+
console.warn('[NutUI] NoticeBar: `right` prop is deprecated, use `action` instead.');
|
|
449
|
+
}
|
|
450
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
451
|
+
className: "".concat(classPrefix, "-box-right")
|
|
452
|
+
}, right);
|
|
453
|
+
};
|
|
379
454
|
return /*#__PURE__*/ React.createElement("div", {
|
|
380
455
|
className: cls,
|
|
381
456
|
style: style
|
|
@@ -383,32 +458,27 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
383
458
|
className: noticebarClass,
|
|
384
459
|
style: barStyle,
|
|
385
460
|
onClick: handleClick
|
|
386
|
-
},
|
|
387
|
-
className: "
|
|
388
|
-
},
|
|
461
|
+
}, renderLeftIcon(), /*#__PURE__*/ React.createElement("div", {
|
|
462
|
+
className: "".concat(classPrefix, "-box-content-wrapper")
|
|
463
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
464
|
+
className: "".concat(classPrefix, "-box-content-main")
|
|
465
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
389
466
|
ref: wrapRef,
|
|
390
|
-
className: "
|
|
467
|
+
className: "".concat(classPrefix, "-box-wrap")
|
|
391
468
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
392
469
|
ref: contentRef,
|
|
393
|
-
className: "
|
|
470
|
+
className: "".concat(classPrefix, "-box-wrap-content ").concat(animationClass, " ").concat(isEllipsis() ? 'nut-ellipsis' : ''),
|
|
394
471
|
style: contentStyle,
|
|
395
472
|
onAnimationEnd: onAnimationEnd
|
|
396
|
-
}, children, content)),
|
|
397
|
-
className: "
|
|
398
|
-
},
|
|
399
|
-
className: "
|
|
400
|
-
onClick: onClickIcon
|
|
401
|
-
}, rightIcon || /*#__PURE__*/ React.createElement(Close, {
|
|
402
|
-
className: "nut-noticebar-box-right-icon-default"
|
|
403
|
-
})) : null) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ React.createElement("div", {
|
|
404
|
-
className: "nut-noticebar-vertical",
|
|
473
|
+
}, children, content)), renderTag()), description ? /*#__PURE__*/ React.createElement("div", {
|
|
474
|
+
className: "".concat(classPrefix, "-box-description")
|
|
475
|
+
}, description) : null), renderAction(), renderRight(), renderCloseIcon()) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ React.createElement("div", {
|
|
476
|
+
className: "".concat(classPrefix, "-vertical"),
|
|
405
477
|
style: barStyle,
|
|
406
478
|
ref: containerRefCallback,
|
|
407
479
|
onClick: handleClick
|
|
408
|
-
},
|
|
409
|
-
className: "
|
|
410
|
-
}, leftIcon) : null, children ? /*#__PURE__*/ React.createElement("div", {
|
|
411
|
-
className: "nut-noticebar-box-wrap",
|
|
480
|
+
}, renderLeftIcon(), children ? /*#__PURE__*/ React.createElement("div", {
|
|
481
|
+
className: "".concat(classPrefix, "-box-wrap"),
|
|
412
482
|
ref: innerRef
|
|
413
483
|
}, scrollList.current.map(function(item, index) {
|
|
414
484
|
return /*#__PURE__*/ React.createElement("div", {
|
|
@@ -419,12 +489,11 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
419
489
|
}
|
|
420
490
|
}, item);
|
|
421
491
|
})) : /*#__PURE__*/ React.createElement("div", {
|
|
422
|
-
className: "
|
|
492
|
+
className: "".concat(classPrefix, "-box-horseLamp-list"),
|
|
423
493
|
style: horseLampStyle
|
|
424
494
|
}, scrollList.current.map(function(item, index) {
|
|
425
|
-
return(
|
|
426
|
-
|
|
427
|
-
className: "nut-noticebar-box-horseLamp-list-item",
|
|
495
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
496
|
+
className: "".concat(classPrefix, "-box-horseLamp-list-item"),
|
|
428
497
|
style: {
|
|
429
498
|
height: height
|
|
430
499
|
},
|
|
@@ -432,14 +501,7 @@ export var NoticeBar = function NoticeBar(props) {
|
|
|
432
501
|
onClick: function onClick(e) {
|
|
433
502
|
handleItemClick(e, item);
|
|
434
503
|
}
|
|
435
|
-
}, item)
|
|
436
|
-
})),
|
|
437
|
-
className: "nut-noticebar-box-right-icon",
|
|
438
|
-
onClick: function onClick(e) {
|
|
439
|
-
handleClickIcon(e);
|
|
440
|
-
}
|
|
441
|
-
}, rightIcon || (closeable ? /*#__PURE__*/ React.createElement(Close, {
|
|
442
|
-
className: "nut-noticebar-box-right-icon-default"
|
|
443
|
-
}) : null))) : null);
|
|
504
|
+
}, item);
|
|
505
|
+
})), renderTag(), renderAction(), renderRight(), renderCloseIcon()) : null);
|
|
444
506
|
};
|
|
445
507
|
NoticeBar.displayName = 'NutNoticeBar';
|
|
@@ -20,10 +20,17 @@
|
|
|
20
20
|
.nut-noticebar-box-wrap {
|
|
21
21
|
height: auto;
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
.nut-noticebar-box-left-icon {
|
|
25
|
+
height: $noticebar-left-icon-wrap-width;
|
|
26
|
+
min-width: $noticebar-left-icon-wrap-width;
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
&-wrapable {
|
|
26
31
|
.nut-noticebar-box-wrap {
|
|
32
|
+
flex: initial;
|
|
33
|
+
|
|
27
34
|
.nut-noticebar-box-wrap-content {
|
|
28
35
|
position: relative;
|
|
29
36
|
white-space: normal;
|
|
@@ -51,26 +58,75 @@
|
|
|
51
58
|
|
|
52
59
|
&-left-icon {
|
|
53
60
|
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
54
63
|
height: $noticebar-left-icon-width;
|
|
55
64
|
min-width: $noticebar-left-icon-width;
|
|
56
65
|
margin-right: $noticebar-icon-gap;
|
|
57
66
|
background-size: 100% 100%;
|
|
67
|
+
|
|
58
68
|
.nut-icon {
|
|
59
|
-
color: $noticebar-color;
|
|
69
|
+
color: $noticebar-icon-color;
|
|
60
70
|
}
|
|
71
|
+
|
|
72
|
+
img {
|
|
73
|
+
border-radius: $noticebar-left-icon-border-radius;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&-content-wrapper {
|
|
78
|
+
flex: 1;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
min-width: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&-content-main {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&-description {
|
|
89
|
+
font-size: $noticebar-description-font-size;
|
|
90
|
+
color: $noticebar-description-color;
|
|
91
|
+
line-height: $noticebar-description-line-height;
|
|
92
|
+
white-space: nowrap;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
text-overflow: ellipsis;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&-tag {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
width: $noticebar-tag-size;
|
|
101
|
+
height: $noticebar-tag-size;
|
|
102
|
+
margin-left: $noticebar-tag-gap;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&-action {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
max-width: $noticebar-action-max-width;
|
|
111
|
+
margin-left: $noticebar-action-gap;
|
|
112
|
+
font-size: $noticebar-action-font-size;
|
|
113
|
+
color: $color-primary;
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
white-space: nowrap;
|
|
61
116
|
}
|
|
62
117
|
|
|
63
118
|
&-right-icon {
|
|
64
119
|
display: flex;
|
|
65
120
|
align-items: center;
|
|
66
121
|
justify-content: center;
|
|
67
|
-
width: $noticebar-
|
|
68
|
-
|
|
122
|
+
width: $noticebar-close-size;
|
|
123
|
+
height: $noticebar-close-size;
|
|
124
|
+
margin-left: $noticebar-action-gap;
|
|
125
|
+
flex-shrink: 0;
|
|
126
|
+
cursor: pointer;
|
|
69
127
|
|
|
70
128
|
.nut-icon {
|
|
71
|
-
|
|
72
|
-
height: scale-px(12px);
|
|
73
|
-
color: $noticebar-color;
|
|
129
|
+
color: $noticebar-close-color;
|
|
74
130
|
}
|
|
75
131
|
}
|
|
76
132
|
|
|
@@ -79,6 +135,49 @@
|
|
|
79
135
|
height: $icon-size-12;
|
|
80
136
|
}
|
|
81
137
|
|
|
138
|
+
&-close-countdown {
|
|
139
|
+
position: relative;
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
width: $noticebar-close-size;
|
|
144
|
+
height: $noticebar-close-size;
|
|
145
|
+
background: conic-gradient(
|
|
146
|
+
$noticebar-close-ring-color 0% var(--progress),
|
|
147
|
+
$noticebar-close-ring-shadow-color var(--progress) 100%
|
|
148
|
+
);
|
|
149
|
+
border-radius: 50%;
|
|
150
|
+
|
|
151
|
+
&::before {
|
|
152
|
+
content: '';
|
|
153
|
+
position: absolute;
|
|
154
|
+
inset: scale-px(1px);
|
|
155
|
+
background: $noticebar-background;
|
|
156
|
+
border-radius: 50%;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&-close-icon {
|
|
161
|
+
position: relative;
|
|
162
|
+
width: $noticebar-close-icon-size;
|
|
163
|
+
height: $noticebar-close-icon-size;
|
|
164
|
+
color: $noticebar-close-color;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&-left-icon--product {
|
|
168
|
+
height: scale-px(32px);
|
|
169
|
+
min-width: scale-px(32px);
|
|
170
|
+
|
|
171
|
+
img {
|
|
172
|
+
background: $white;
|
|
173
|
+
border-radius: $noticebar-left-icon-border-radius;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&-right {
|
|
178
|
+
flex-shrink: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
82
181
|
&-wrap {
|
|
83
182
|
display: flex;
|
|
84
183
|
flex: 1;
|
|
@@ -158,11 +257,12 @@
|
|
|
158
257
|
flex-direction: column;
|
|
159
258
|
}
|
|
160
259
|
|
|
260
|
+
.nut-noticebar-box-description {
|
|
261
|
+
white-space: normal;
|
|
262
|
+
}
|
|
263
|
+
|
|
161
264
|
.nut-noticebar-box-right-icon {
|
|
162
265
|
align-self: center;
|
|
163
|
-
display: flex;
|
|
164
|
-
justify-content: center;
|
|
165
|
-
width: $noticebar-right-icon-width;
|
|
166
266
|
margin-left: $noticebar-icon-gap;
|
|
167
267
|
}
|
|
168
268
|
}
|
|
@@ -196,7 +296,17 @@
|
|
|
196
296
|
|
|
197
297
|
&-right-icon {
|
|
198
298
|
margin-left: 0;
|
|
199
|
-
margin-right: $noticebar-
|
|
299
|
+
margin-right: $noticebar-action-gap;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
&-tag {
|
|
303
|
+
margin-left: 0;
|
|
304
|
+
margin-right: $noticebar-tag-gap;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
&-action {
|
|
308
|
+
margin-left: 0;
|
|
309
|
+
margin-right: $noticebar-action-gap;
|
|
200
310
|
}
|
|
201
311
|
|
|
202
312
|
.play {
|
|
@@ -225,5 +335,15 @@
|
|
|
225
335
|
margin-left: 0;
|
|
226
336
|
margin-right: $noticebar-icon-gap;
|
|
227
337
|
}
|
|
338
|
+
|
|
339
|
+
.nut-noticebar-box-tag {
|
|
340
|
+
margin-left: 0;
|
|
341
|
+
margin-right: $noticebar-tag-gap;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.nut-noticebar-box-action {
|
|
345
|
+
margin-left: 0;
|
|
346
|
+
margin-right: $noticebar-action-gap;
|
|
347
|
+
}
|
|
228
348
|
}
|
|
229
349
|
}
|