@nutui/nutui-react-taro 4.0.0-beta.6 → 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.
Files changed (140) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/packages/actionsheet/style/style.harmony.css +12 -6
  3. package/dist/cjs/packages/address/style/style.harmony.css +12 -6
  4. package/dist/cjs/packages/animate/style/style.css +27 -9
  5. package/dist/cjs/packages/animate/style/style.harmony.css +27 -9
  6. package/dist/cjs/packages/animate/style-jmapp/style.css +27 -9
  7. package/dist/cjs/packages/animate/style-jrkf/style.css +27 -9
  8. package/dist/cjs/packages/audio/audio.js +14 -14
  9. package/dist/cjs/packages/audio/style/style.harmony.css +20 -8
  10. package/dist/cjs/packages/badge/badge.js +17 -17
  11. package/dist/cjs/packages/button/button.js +1 -2
  12. package/dist/cjs/packages/button/style/style.css +20 -8
  13. package/dist/cjs/packages/button/style/style.harmony.css +20 -8
  14. package/dist/cjs/packages/button/style-jmapp/style.css +20 -8
  15. package/dist/cjs/packages/button/style-jrkf/style.css +20 -8
  16. package/dist/cjs/packages/calendar/style/style.harmony.css +12 -6
  17. package/dist/cjs/packages/cascader/style/style.harmony.css +12 -6
  18. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  19. package/dist/cjs/packages/datepicker/style/style.harmony.css +12 -6
  20. package/dist/cjs/packages/dialog/style/style.harmony.css +20 -8
  21. package/dist/cjs/packages/empty/style/style.harmony.css +20 -8
  22. package/dist/cjs/packages/imagepreview/style/style.harmony.css +12 -6
  23. package/dist/cjs/packages/indicator/indicator.js +6 -6
  24. package/dist/cjs/packages/infiniteloading/infiniteloading.js +9 -9
  25. package/dist/cjs/packages/navbar/style/style.css +3 -1
  26. package/dist/cjs/packages/navbar/style/style.harmony.css +3 -1
  27. package/dist/cjs/packages/navbar/style-jmapp/style.css +3 -1
  28. package/dist/cjs/packages/navbar/style-jrkf/style.css +3 -1
  29. package/dist/cjs/packages/noticebar/noticebar.js +120 -60
  30. package/dist/cjs/packages/noticebar/style/noticebar.scss +130 -10
  31. package/dist/cjs/packages/noticebar/style/style.css +138 -35
  32. package/dist/cjs/packages/noticebar/style/style.harmony.css +138 -35
  33. package/dist/cjs/packages/noticebar/style-jmapp/noticebar.scss +130 -10
  34. package/dist/cjs/packages/noticebar/style-jmapp/style.css +113 -10
  35. package/dist/cjs/packages/noticebar/style-jrkf/noticebar.scss +130 -10
  36. package/dist/cjs/packages/noticebar/style-jrkf/style.css +113 -10
  37. package/dist/cjs/packages/numberkeyboard/style/style.css +6 -6
  38. package/dist/cjs/packages/numberkeyboard/style/style.harmony.css +18 -12
  39. package/dist/cjs/packages/numberkeyboard/style-jmapp/style.css +6 -6
  40. package/dist/cjs/packages/numberkeyboard/style-jrkf/style.css +6 -6
  41. package/dist/cjs/packages/picker/style/style.harmony.css +12 -6
  42. package/dist/cjs/packages/popover/popover.js +46 -37
  43. package/dist/cjs/packages/popover/style/popover.scss +79 -54
  44. package/dist/cjs/packages/popover/style/style.css +73 -61
  45. package/dist/cjs/packages/popover/style/style.harmony.css +85 -67
  46. package/dist/cjs/packages/popover/style-jmapp/popover.scss +79 -54
  47. package/dist/cjs/packages/popover/style-jmapp/style.css +73 -61
  48. package/dist/cjs/packages/popover/style-jrkf/popover.scss +79 -54
  49. package/dist/cjs/packages/popover/style-jrkf/style.css +73 -61
  50. package/dist/cjs/packages/popup/style/style.css +12 -6
  51. package/dist/cjs/packages/popup/style/style.harmony.css +12 -6
  52. package/dist/cjs/packages/popup/style-jmapp/style.css +12 -6
  53. package/dist/cjs/packages/popup/style-jrkf/style.css +12 -6
  54. package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +54 -54
  55. package/dist/cjs/packages/quickenter/style/style.harmony.css +12 -6
  56. package/dist/cjs/packages/resultpage/style/style.harmony.css +20 -8
  57. package/dist/cjs/packages/shortpassword/style/style.harmony.css +12 -6
  58. package/dist/cjs/packages/skeleton/skeleton.js +15 -15
  59. package/dist/cjs/packages/timeselect/style/style.harmony.css +12 -6
  60. package/dist/cjs/packages/tour/style/style.harmony.css +86 -68
  61. package/dist/cjs/packages/tour/tour.js +1 -1
  62. package/dist/cjs/types/spec/noticebar/base.d.ts +5 -1
  63. package/dist/cjs/types/spec/popover/base.d.ts +4 -0
  64. package/dist/cjs/utils/is-forward-ref-component.js +2 -2
  65. package/dist/cjs/utils/render.js +1 -1
  66. package/dist/es/packages/actionsheet/style/style.harmony.css +12 -6
  67. package/dist/es/packages/address/style/style.harmony.css +12 -6
  68. package/dist/es/packages/animate/style/style.css +27 -9
  69. package/dist/es/packages/animate/style/style.harmony.css +27 -9
  70. package/dist/es/packages/animate/style-jmapp/style.css +27 -9
  71. package/dist/es/packages/animate/style-jrkf/style.css +27 -9
  72. package/dist/es/packages/audio/audio.js +14 -14
  73. package/dist/es/packages/audio/style/style.harmony.css +20 -8
  74. package/dist/es/packages/badge/badge.js +17 -17
  75. package/dist/es/packages/button/button.js +1 -2
  76. package/dist/es/packages/button/style/style.css +20 -8
  77. package/dist/es/packages/button/style/style.harmony.css +20 -8
  78. package/dist/es/packages/button/style-jmapp/style.css +20 -8
  79. package/dist/es/packages/button/style-jrkf/style.css +20 -8
  80. package/dist/es/packages/calendar/style/style.harmony.css +12 -6
  81. package/dist/es/packages/cascader/style/style.harmony.css +12 -6
  82. package/dist/es/packages/configprovider/types.d.ts +1 -1
  83. package/dist/es/packages/datepicker/style/style.harmony.css +12 -6
  84. package/dist/es/packages/dialog/style/style.harmony.css +20 -8
  85. package/dist/es/packages/empty/style/style.harmony.css +20 -8
  86. package/dist/es/packages/imagepreview/style/style.harmony.css +12 -6
  87. package/dist/es/packages/indicator/indicator.js +6 -6
  88. package/dist/es/packages/infiniteloading/infiniteloading.js +9 -9
  89. package/dist/es/packages/navbar/style/style.css +3 -1
  90. package/dist/es/packages/navbar/style/style.harmony.css +3 -1
  91. package/dist/es/packages/navbar/style-jmapp/style.css +3 -1
  92. package/dist/es/packages/navbar/style-jrkf/style.css +3 -1
  93. package/dist/es/packages/noticebar/noticebar.js +120 -60
  94. package/dist/es/packages/noticebar/style/noticebar.scss +130 -10
  95. package/dist/es/packages/noticebar/style/style.css +138 -35
  96. package/dist/es/packages/noticebar/style/style.harmony.css +138 -35
  97. package/dist/es/packages/noticebar/style-jmapp/noticebar.scss +130 -10
  98. package/dist/es/packages/noticebar/style-jmapp/style.css +113 -10
  99. package/dist/es/packages/noticebar/style-jrkf/noticebar.scss +130 -10
  100. package/dist/es/packages/noticebar/style-jrkf/style.css +113 -10
  101. package/dist/es/packages/numberkeyboard/style/style.css +6 -6
  102. package/dist/es/packages/numberkeyboard/style/style.harmony.css +18 -12
  103. package/dist/es/packages/numberkeyboard/style-jmapp/style.css +6 -6
  104. package/dist/es/packages/numberkeyboard/style-jrkf/style.css +6 -6
  105. package/dist/es/packages/picker/style/style.harmony.css +12 -6
  106. package/dist/es/packages/popover/popover.js +46 -37
  107. package/dist/es/packages/popover/style/popover.scss +79 -54
  108. package/dist/es/packages/popover/style/style.css +73 -61
  109. package/dist/es/packages/popover/style/style.harmony.css +85 -67
  110. package/dist/es/packages/popover/style-jmapp/popover.scss +79 -54
  111. package/dist/es/packages/popover/style-jmapp/style.css +73 -61
  112. package/dist/es/packages/popover/style-jrkf/popover.scss +79 -54
  113. package/dist/es/packages/popover/style-jrkf/style.css +73 -61
  114. package/dist/es/packages/popup/style/style.css +12 -6
  115. package/dist/es/packages/popup/style/style.harmony.css +12 -6
  116. package/dist/es/packages/popup/style-jmapp/style.css +12 -6
  117. package/dist/es/packages/popup/style-jrkf/style.css +12 -6
  118. package/dist/es/packages/pulltorefresh/pulltorefresh.js +54 -54
  119. package/dist/es/packages/quickenter/style/style.harmony.css +12 -6
  120. package/dist/es/packages/resultpage/style/style.harmony.css +20 -8
  121. package/dist/es/packages/shortpassword/style/style.harmony.css +12 -6
  122. package/dist/es/packages/skeleton/skeleton.js +15 -15
  123. package/dist/es/packages/timeselect/style/style.harmony.css +12 -6
  124. package/dist/es/packages/tour/style/style.harmony.css +86 -68
  125. package/dist/es/packages/tour/tour.js +1 -1
  126. package/dist/es/types/spec/noticebar/base.d.ts +19 -3
  127. package/dist/es/types/spec/popover/base.d.ts +21 -2
  128. package/dist/es/utils/render.js +1 -1
  129. package/dist/nutui.react.umd.js +327 -1211
  130. package/dist/style-jmapp.css +1 -1
  131. package/dist/style-jmapp.scss +31 -31
  132. package/dist/style-jrkf.css +1 -1
  133. package/dist/style-jrkf.scss +25 -25
  134. package/dist/style.css +1 -1
  135. package/dist/style.scss +29 -29
  136. package/dist/styles/variables-daojia.scss +55 -9
  137. package/dist/styles/variables-jmapp.scss +52 -6
  138. package/dist/styles/variables-jrkf.scss +52 -6
  139. package/dist/styles/variables.scss +123 -15
  140. package/package.json +1 -1
@@ -31,20 +31,24 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
31
31
  direction: 'horizontal',
32
32
  list: [],
33
33
  duration: 1000,
34
- height: 40,
34
+ height: 36,
35
35
  content: '',
36
36
  closeable: false,
37
37
  wrap: false,
38
38
  leftIcon: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Notice, null),
39
39
  rightIcon: null,
40
40
  right: null,
41
+ description: null,
42
+ tag: null,
43
+ action: null,
44
+ autoClose: 0,
41
45
  delay: 1,
42
46
  scrollable: null,
43
47
  speed: 50
44
48
  });
45
49
  var NoticeBar = function NoticeBar(props) {
46
50
  var rtl = (0, _index.useRtl)();
47
- var _$_object_spread = (0, _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;
51
+ var _$_object_spread = (0, _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;
48
52
  var classPrefix = 'nut-noticebar';
49
53
  var wrapRef = (0, _react.useRef)(null);
50
54
  var contentRef = (0, _react.useRef)(null);
@@ -52,21 +56,22 @@ var NoticeBar = function NoticeBar(props) {
52
56
  var wrapRefId = "wrap-ref-".concat(uid);
53
57
  var contentRefId = "content-ref-".concat(uid);
54
58
  var _useState = (0, _sliced_to_array._)((0, _react.useState)(true), 2), showNoticeBar = _useState[0], setShowNoticeBar = _useState[1];
59
+ var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(100), 2), autoCloseProgress = _useState1[0], setAutoCloseProgress = _useState1[1];
55
60
  var scrollList = (0, _react.useRef)([]);
56
- var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), wrapWidth = _useState1[0], SetWrapWidth = _useState1[1];
57
- var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(true), 2), firstRound = _useState2[0], SetFirstRound = _useState2[1];
58
- var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), animationDuration = _useState3[0], SetAnimationDuration = _useState3[1];
59
- var _useState4 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), offsetWidth = _useState4[0], SetOffsetW = _useState4[1];
60
- var _useState5 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), animationClass = _useState5[0], SetAnimationClass = _useState5[1];
61
- var _useState6 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), animate = _useState6[0], SetAnimate = _useState6[1];
62
- var _useState7 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), timer = _useState7[0], SetTimer = _useState7[1];
63
- var _useState8 = (0, _sliced_to_array._)((0, _react.useState)(null), 2), isCanScroll = _useState8[0], SetIsCanScroll = _useState8[1];
61
+ var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), wrapWidth = _useState2[0], SetWrapWidth = _useState2[1];
62
+ var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(true), 2), firstRound = _useState3[0], SetFirstRound = _useState3[1];
63
+ var _useState4 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), animationDuration = _useState4[0], SetAnimationDuration = _useState4[1];
64
+ var _useState5 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), offsetWidth = _useState5[0], SetOffsetW = _useState5[1];
65
+ var _useState6 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), animationClass = _useState6[0], SetAnimationClass = _useState6[1];
66
+ var _useState7 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), animate = _useState7[0], SetAnimate = _useState7[1];
67
+ var _useState8 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), timer = _useState8[0], SetTimer = _useState8[1];
68
+ var _useState9 = (0, _sliced_to_array._)((0, _react.useState)(null), 2), isCanScroll = _useState9[0], SetIsCanScroll = _useState9[1];
64
69
  var isVertical = direction === 'vertical';
65
- var _useState9 = (0, _sliced_to_array._)((0, _react.useState)(null), 2), rect = _useState9[0], setRect = _useState9[1];
70
+ var _useState10 = (0, _sliced_to_array._)((0, _react.useState)(null), 2), rect = _useState10[0], setRect = _useState10[1];
66
71
  var activeRef = (0, _react.useRef)(0);
67
- var _useState10 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), ready = _useState10[0], setReady = _useState10[1];
72
+ var _useState11 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), ready = _useState11[0], setReady = _useState11[1];
68
73
  var container = (0, _react.useRef)(null);
69
- var _useState11 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), isContainerReady = _useState11[0], setIsContainerReady = _useState11[1];
74
+ var _useState12 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), isContainerReady = _useState12[0], setIsContainerReady = _useState12[1];
70
75
  var innerRef = (0, _react.useRef)(null);
71
76
  var swiperRef = (0, _react.useRef)({
72
77
  moving: false,
@@ -76,8 +81,8 @@ var NoticeBar = function NoticeBar(props) {
76
81
  offset: 0,
77
82
  size: 0
78
83
  });
79
- var _useState12 = (0, _sliced_to_array._)((0, _react.useState)([]), 2), childOffset = _useState12[0], setChildOffset = _useState12[1];
80
- var _useState13 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), offset = _useState13[0], setOffset = _useState13[1];
84
+ var _useState13 = (0, _sliced_to_array._)((0, _react.useState)([]), 2), childOffset = _useState13[0], setChildOffset = _useState13[1];
85
+ var _useState14 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), offset = _useState14[0], setOffset = _useState14[1];
81
86
  var _useMemo = (0, _react.useMemo)(function() {
82
87
  var childCount = 0;
83
88
  var childs = _react.default.Children.map(children, function(child) {
@@ -102,6 +107,35 @@ var NoticeBar = function NoticeBar(props) {
102
107
  }
103
108
  return 0;
104
109
  }();
110
+ var onCloseRef = (0, _react.useRef)(onClose);
111
+ onCloseRef.current = onClose;
112
+ var autoCloseTimerRef = (0, _react.useRef)(0);
113
+ var autoCloseIntervalRef = (0, _react.useRef)(0);
114
+ // 自动关闭
115
+ (0, _react.useEffect)(function() {
116
+ if (autoClose && autoClose > 0 && showNoticeBar) {
117
+ var startTime = Date.now();
118
+ autoCloseIntervalRef.current = setInterval(function() {
119
+ var elapsed = Date.now() - startTime;
120
+ var remaining = Math.max(0, 100 - elapsed / autoClose * 100);
121
+ setAutoCloseProgress(remaining);
122
+ if (remaining <= 0) clearInterval(autoCloseIntervalRef.current);
123
+ }, 50);
124
+ autoCloseTimerRef.current = setTimeout(function() {
125
+ var _onCloseRef_current;
126
+ setShowNoticeBar(false);
127
+ (_onCloseRef_current = onCloseRef.current) === null || _onCloseRef_current === void 0 ? void 0 : _onCloseRef_current.call(onCloseRef);
128
+ }, autoClose);
129
+ return function() {
130
+ clearInterval(autoCloseIntervalRef.current);
131
+ clearTimeout(autoCloseTimerRef.current);
132
+ };
133
+ }
134
+ setAutoCloseProgress(100);
135
+ }, [
136
+ autoClose,
137
+ showNoticeBar
138
+ ]);
105
139
  (0, _react.useEffect)(function() {
106
140
  if (isVertical) {
107
141
  if (children) {
@@ -186,6 +220,17 @@ var NoticeBar = function NoticeBar(props) {
186
220
  click && click(event);
187
221
  onClick && onClick(event);
188
222
  };
223
+ var onClickIcon = (0, _react.useCallback)(function(event) {
224
+ event.stopPropagation();
225
+ setShowNoticeBar(false);
226
+ clearInterval(autoCloseIntervalRef.current);
227
+ clearTimeout(autoCloseTimerRef.current);
228
+ close && close(event);
229
+ onClose && onClose(event);
230
+ }, [
231
+ close,
232
+ onClose
233
+ ]);
189
234
  var onAnimationEnd = function onAnimationEnd() {
190
235
  SetFirstRound(false);
191
236
  setTimeout(function() {
@@ -208,16 +253,6 @@ var NoticeBar = function NoticeBar(props) {
208
253
  SetAnimate(false);
209
254
  }, time);
210
255
  };
211
- var handleClickIcon = (0, _react.useCallback)(function(event) {
212
- event.stopPropagation();
213
- setShowNoticeBar(!closeable);
214
- close && close(event);
215
- onClose && onClose(event);
216
- }, [
217
- close,
218
- onClose,
219
- closeable
220
- ]);
221
256
  var isEllipsis = function isEllipsis() {
222
257
  if (isCanScroll == null && align === 'left') {
223
258
  return wrap;
@@ -370,7 +405,6 @@ var NoticeBar = function NoticeBar(props) {
370
405
  };
371
406
  if (height) {
372
407
  style.height = "".concat(height, "px");
373
- // style.lineHeight = `${height}px`
374
408
  }
375
409
  var offset = childOffset[index];
376
410
  if (offset) {
@@ -439,32 +473,52 @@ var NoticeBar = function NoticeBar(props) {
439
473
  container.current = ref;
440
474
  setIsContainerReady(true);
441
475
  }, []);
442
- var renderLeftIcon = (0, _react.useCallback)(function() {
443
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, leftIcon ? /*#__PURE__*/ _react.default.createElement(_components.View, {
444
- className: "nut-noticebar-box-left-icon"
445
- }, leftIcon) : null);
446
- }, [
447
- leftIcon
448
- ]);
449
- var renderRight = (0, _react.useCallback)(function() {
450
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, right ? /*#__PURE__*/ _react.default.createElement(_components.View, {
451
- className: "nut-noticebar-box-right"
452
- }, right) : null);
453
- }, [
454
- right
455
- ]);
456
- var renderRightIcon = (0, _react.useCallback)(function() {
457
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, rightIcon || closeable ? /*#__PURE__*/ _react.default.createElement(_components.View, {
458
- className: "nut-noticebar-box-right-icon",
459
- onClick: handleClickIcon
460
- }, rightIcon || /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, {
461
- className: "nut-noticebar-box-right-icon-default"
462
- })) : null);
463
- }, [
464
- rightIcon,
465
- closeable,
466
- handleClickIcon
467
- ]);
476
+ var renderLeftIcon = function renderLeftIcon() {
477
+ if (!leftIcon) return null;
478
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
479
+ className: "".concat(classPrefix, "-box-left-icon")
480
+ }, leftIcon);
481
+ };
482
+ var renderTag = function renderTag() {
483
+ if (!tag) return null;
484
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
485
+ className: "".concat(classPrefix, "-box-tag")
486
+ }, tag);
487
+ };
488
+ var renderAction = function renderAction() {
489
+ if (!action) return null;
490
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
491
+ className: "".concat(classPrefix, "-box-action")
492
+ }, action);
493
+ };
494
+ var renderAutoCloseIcon = function renderAutoCloseIcon() {
495
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
496
+ className: "".concat(classPrefix, "-box-close-countdown"),
497
+ style: {
498
+ '--progress': "".concat(autoCloseProgress, "%")
499
+ }
500
+ }, /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, {
501
+ className: "".concat(classPrefix, "-box-close-icon")
502
+ }));
503
+ };
504
+ var renderCloseIcon = function renderCloseIcon() {
505
+ if (!closeable && !rightIcon && !(autoClose && autoClose > 0)) return null;
506
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
507
+ className: "".concat(classPrefix, "-box-right-icon"),
508
+ onClick: onClickIcon
509
+ }, rightIcon || (autoClose && autoClose > 0 ? renderAutoCloseIcon() : /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, {
510
+ className: "".concat(classPrefix, "-box-right-icon-default")
511
+ })));
512
+ };
513
+ var renderRight = function renderRight() {
514
+ if (!right) return null;
515
+ if (process.env.NODE_ENV !== 'production') {
516
+ console.warn('[NutUI] NoticeBar: `right` prop is deprecated, use `action` instead.');
517
+ }
518
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
519
+ className: "".concat(classPrefix, "-box-right")
520
+ }, right);
521
+ };
468
522
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
469
523
  className: cls,
470
524
  style: style
@@ -473,22 +527,28 @@ var NoticeBar = function NoticeBar(props) {
473
527
  style: barStyle,
474
528
  onClick: handleClick
475
529
  }, renderLeftIcon(), /*#__PURE__*/ _react.default.createElement(_components.View, {
530
+ className: "".concat(classPrefix, "-box-content-wrapper")
531
+ }, /*#__PURE__*/ _react.default.createElement(_components.View, {
532
+ className: "".concat(classPrefix, "-box-content-main")
533
+ }, /*#__PURE__*/ _react.default.createElement(_components.View, {
476
534
  ref: wrapRef,
477
- className: "nut-noticebar-box-wrap",
535
+ className: "".concat(classPrefix, "-box-wrap"),
478
536
  id: wrapRefId
479
537
  }, /*#__PURE__*/ _react.default.createElement(_components.View, {
480
538
  ref: contentRef,
481
539
  id: contentRefId,
482
- className: "nut-noticebar-box-wrap-content ".concat(animationClass, " ").concat(isEllipsis() ? 'nut-ellipsis' : ''),
540
+ className: "".concat(classPrefix, "-box-wrap-content ").concat(animationClass, " ").concat(isEllipsis() ? 'nut-ellipsis' : ''),
483
541
  style: contentStyle,
484
542
  onAnimationEnd: onAnimationEnd
485
- }, children, content)), renderRight(), renderRightIcon()) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ _react.default.createElement(_components.View, {
486
- className: "nut-noticebar-vertical",
543
+ }, children, content)), renderTag()), description ? /*#__PURE__*/ _react.default.createElement(_components.View, {
544
+ className: "".concat(classPrefix, "-box-description")
545
+ }, description) : null), renderAction(), renderRight(), renderCloseIcon()) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ _react.default.createElement(_components.View, {
546
+ className: "".concat(classPrefix, "-vertical"),
487
547
  style: barStyle,
488
548
  ref: containerRefCallback,
489
549
  onClick: handleClick
490
550
  }, renderLeftIcon(), children ? /*#__PURE__*/ _react.default.createElement(_components.View, {
491
- className: "nut-noticebar-box-wrap",
551
+ className: "".concat(classPrefix, "-box-wrap"),
492
552
  ref: innerRef
493
553
  }, scrollList.current.map(function(item, index) {
494
554
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
@@ -499,11 +559,11 @@ var NoticeBar = function NoticeBar(props) {
499
559
  }
500
560
  }, item);
501
561
  })) : /*#__PURE__*/ _react.default.createElement(_components.View, {
502
- className: "nut-noticebar-box-horseLamp-list",
562
+ className: "".concat(classPrefix, "-box-horseLamp-list"),
503
563
  style: horseLampStyle
504
564
  }, scrollList.current.map(function(item, index) {
505
565
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
506
- className: "nut-noticebar-box-horseLamp-list-item",
566
+ className: "".concat(classPrefix, "-box-horseLamp-list-item"),
507
567
  style: {
508
568
  height: height
509
569
  },
@@ -512,6 +572,6 @@ var NoticeBar = function NoticeBar(props) {
512
572
  handleItemClick(e, item);
513
573
  }
514
574
  }, item);
515
- })), renderRight(), renderRightIcon()) : null);
575
+ })), renderTag(), renderAction(), renderRight(), renderCloseIcon()) : null);
516
576
  };
517
577
  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-right-icon-width;
68
- margin-left: $noticebar-icon-gap;
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
- width: scale-px(12px);
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-icon-gap;
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
  }