@nutui/nutui-react 3.0.5 → 3.0.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 (182) hide show
  1. package/CHANGELOG.md +59 -1
  2. package/dist/cjs/packages/actionsheet/style/style.css +4 -4
  3. package/dist/cjs/packages/address/style/style.css +4 -4
  4. package/dist/cjs/packages/audio/style/style.css +4 -16
  5. package/dist/cjs/packages/badge/badge.js +4 -3
  6. package/dist/cjs/packages/badge/style/badge.scss +4 -0
  7. package/dist/cjs/packages/badge/style/style.css +9 -6
  8. package/dist/cjs/packages/button/style/button.scss +4 -20
  9. package/dist/cjs/packages/button/style/style.css +4 -16
  10. package/dist/cjs/packages/calendar/style/style.css +4 -4
  11. package/dist/cjs/packages/cascader/style/style.css +4 -4
  12. package/dist/cjs/packages/collapse/style/style.css +22 -7
  13. package/dist/cjs/packages/collapseitem/collapseitem.js +46 -44
  14. package/dist/cjs/packages/collapseitem/style/collapseitem.scss +22 -5
  15. package/dist/cjs/packages/collapseitem/style/style.css +22 -7
  16. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  17. package/dist/cjs/packages/datepicker/style/style.css +7 -4
  18. package/dist/cjs/packages/datepickerview/style/style.css +3 -0
  19. package/dist/cjs/packages/dialog/confirm.d.ts +2 -3
  20. package/dist/cjs/packages/dialog/confirm.js +4 -18
  21. package/dist/cjs/packages/dialog/content.d.ts +11 -3
  22. package/dist/cjs/packages/dialog/dialog.d.ts +1 -1
  23. package/dist/cjs/packages/dialog/dialog.js +98 -69
  24. package/dist/cjs/packages/dialog/index.d.ts +1 -1
  25. package/dist/cjs/packages/dialog/style/style.css +4 -16
  26. package/dist/cjs/packages/empty/style/style.css +4 -16
  27. package/dist/cjs/packages/fixednav/style/style.css +9 -6
  28. package/dist/cjs/packages/imagepreview/style/style.css +4 -4
  29. package/dist/cjs/packages/indicator/indicator.js +1 -1
  30. package/dist/cjs/packages/lottie/index.d.ts +1 -1
  31. package/dist/cjs/packages/lottie/index.js +2 -2
  32. package/dist/cjs/packages/notify/Notification.d.ts +3 -9
  33. package/dist/cjs/packages/notify/Notification.js +27 -7
  34. package/dist/cjs/packages/notify/notify.d.ts +0 -4
  35. package/dist/cjs/packages/notify/notify.js +6 -34
  36. package/dist/cjs/packages/notify/style/notify.scss +39 -36
  37. package/dist/cjs/packages/notify/style/style.css +36 -31
  38. package/dist/cjs/packages/numberkeyboard/style/style.css +4 -4
  39. package/dist/cjs/packages/picker/style/style.css +7 -4
  40. package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -0
  41. package/dist/cjs/packages/pickerview/style/style.css +3 -0
  42. package/dist/cjs/packages/popover/popover.js +72 -65
  43. package/dist/cjs/packages/popover/style/popover.scss +48 -51
  44. package/dist/cjs/packages/popover/style/style.css +64 -70
  45. package/dist/cjs/packages/popup/style/popup.scss +4 -4
  46. package/dist/cjs/packages/popup/style/style.css +4 -4
  47. package/dist/cjs/packages/resultpage/style/style.css +4 -16
  48. package/dist/cjs/packages/shortpassword/style/style.css +4 -4
  49. package/dist/cjs/packages/skeleton/skeleton.js +64 -49
  50. package/dist/cjs/packages/skeleton/style/index.js +0 -1
  51. package/dist/cjs/packages/skeleton/style/skeleton.scss +40 -46
  52. package/dist/cjs/packages/skeleton/style/style.css +32 -175
  53. package/dist/cjs/packages/switch/style/style.css +5 -0
  54. package/dist/cjs/packages/switch/style/switch.scss +5 -0
  55. package/dist/cjs/packages/switch/switch.js +22 -11
  56. package/dist/cjs/packages/tabbar/style/style.css +54 -45
  57. package/dist/cjs/packages/tabbar/style/tabbar.scss +28 -19
  58. package/dist/cjs/packages/tabbar/tabbar.js +28 -10
  59. package/dist/cjs/packages/tabbaritem/style/style.css +30 -27
  60. package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
  61. package/dist/cjs/packages/tabbaritem/tabbaritem.js +34 -13
  62. package/dist/cjs/packages/tabpane/tabpane.js +2 -2
  63. package/dist/cjs/packages/timeselect/style/style.css +4 -4
  64. package/dist/cjs/packages/tour/style/style.css +64 -70
  65. package/dist/cjs/types/spec/badge/base.d.ts +1 -0
  66. package/dist/cjs/types/spec/dialog/base.d.ts +50 -1
  67. package/dist/cjs/types/spec/dialog/base.js +7 -0
  68. package/dist/cjs/types/spec/dialog/h5.d.ts +4 -1
  69. package/dist/cjs/types/spec/dialog/taro.d.ts +8 -2
  70. package/dist/cjs/types/spec/indicator/base.d.ts +1 -1
  71. package/dist/cjs/types/spec/notify/base.d.ts +7 -2
  72. package/dist/cjs/types/spec/popover/base.d.ts +7 -0
  73. package/dist/cjs/types/spec/searchbar/taro.d.ts +10 -7
  74. package/dist/cjs/types/spec/skeleton/base.d.ts +7 -5
  75. package/dist/cjs/types/spec/switch/base.d.ts +3 -2
  76. package/dist/cjs/types/spec/switch/h5.d.ts +1 -1
  77. package/dist/cjs/types/spec/switch/taro.d.ts +1 -4
  78. package/dist/cjs/types/spec/tabbar/base.d.ts +7 -4
  79. package/dist/cjs/utils/get-rect-by-taro.js +10 -0
  80. package/dist/cjs/utils/lru.d.ts +8 -0
  81. package/dist/cjs/utils/lru.js +58 -0
  82. package/dist/es/packages/actionsheet/style/style.css +4 -4
  83. package/dist/es/packages/address/style/style.css +4 -4
  84. package/dist/es/packages/audio/style/style.css +4 -16
  85. package/dist/es/packages/badge/badge.js +4 -3
  86. package/dist/es/packages/badge/style/badge.scss +4 -0
  87. package/dist/es/packages/badge/style/style.css +9 -6
  88. package/dist/es/packages/button/style/button.scss +4 -20
  89. package/dist/es/packages/button/style/style.css +4 -16
  90. package/dist/es/packages/calendar/style/style.css +4 -4
  91. package/dist/es/packages/cascader/style/style.css +4 -4
  92. package/dist/es/packages/collapse/style/style.css +22 -7
  93. package/dist/es/packages/collapseitem/collapseitem.js +47 -45
  94. package/dist/es/packages/collapseitem/style/collapseitem.scss +22 -5
  95. package/dist/es/packages/collapseitem/style/style.css +22 -7
  96. package/dist/es/packages/configprovider/types.d.ts +1 -1
  97. package/dist/es/packages/datepicker/style/style.css +7 -4
  98. package/dist/es/packages/datepickerview/style/style.css +3 -0
  99. package/dist/es/packages/dialog/confirm.d.ts +2 -3
  100. package/dist/es/packages/dialog/confirm.js +1 -8
  101. package/dist/es/packages/dialog/content.d.ts +11 -3
  102. package/dist/es/packages/dialog/dialog.d.ts +1 -1
  103. package/dist/es/packages/dialog/dialog.js +98 -69
  104. package/dist/es/packages/dialog/index.d.ts +1 -1
  105. package/dist/es/packages/dialog/style/style.css +4 -16
  106. package/dist/es/packages/empty/style/style.css +4 -16
  107. package/dist/es/packages/fixednav/style/style.css +9 -6
  108. package/dist/es/packages/imagepreview/style/style.css +4 -4
  109. package/dist/es/packages/indicator/indicator.js +1 -1
  110. package/dist/es/packages/lottie/index.d.ts +1 -1
  111. package/dist/es/packages/lottie/index.js +1 -1
  112. package/dist/es/packages/notify/Notification.d.ts +3 -9
  113. package/dist/es/packages/notify/Notification.js +27 -7
  114. package/dist/es/packages/notify/notify.d.ts +0 -4
  115. package/dist/es/packages/notify/notify.js +6 -34
  116. package/dist/es/packages/notify/style/notify.scss +39 -36
  117. package/dist/es/packages/notify/style/style.css +36 -31
  118. package/dist/es/packages/numberkeyboard/style/style.css +4 -4
  119. package/dist/es/packages/picker/style/style.css +7 -4
  120. package/dist/es/packages/pickerview/style/pickerview.scss +3 -0
  121. package/dist/es/packages/pickerview/style/style.css +3 -0
  122. package/dist/es/packages/popover/popover.js +72 -65
  123. package/dist/es/packages/popover/style/popover.scss +48 -51
  124. package/dist/es/packages/popover/style/style.css +64 -70
  125. package/dist/es/packages/popup/style/popup.scss +4 -4
  126. package/dist/es/packages/popup/style/style.css +4 -4
  127. package/dist/es/packages/resultpage/style/style.css +4 -16
  128. package/dist/es/packages/shortpassword/style/style.css +4 -4
  129. package/dist/es/packages/skeleton/skeleton.js +63 -49
  130. package/dist/es/packages/skeleton/style/index.js +0 -1
  131. package/dist/es/packages/skeleton/style/skeleton.scss +40 -46
  132. package/dist/es/packages/skeleton/style/style.css +32 -175
  133. package/dist/es/packages/switch/style/style.css +5 -0
  134. package/dist/es/packages/switch/style/switch.scss +5 -0
  135. package/dist/es/packages/switch/switch.js +21 -11
  136. package/dist/es/packages/tabbar/style/style.css +54 -45
  137. package/dist/es/packages/tabbar/style/tabbar.scss +28 -19
  138. package/dist/es/packages/tabbar/tabbar.js +27 -10
  139. package/dist/es/packages/tabbaritem/style/style.css +30 -27
  140. package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
  141. package/dist/es/packages/tabbaritem/tabbaritem.js +34 -13
  142. package/dist/es/packages/tabpane/tabpane.js +2 -2
  143. package/dist/es/packages/timeselect/style/style.css +4 -4
  144. package/dist/es/packages/tour/style/style.css +64 -70
  145. package/dist/es/types/spec/badge/base.d.ts +4 -0
  146. package/dist/es/types/spec/dialog/base.d.ts +83 -1
  147. package/dist/es/types/spec/dialog/base.js +1 -1
  148. package/dist/es/types/spec/dialog/h5.d.ts +4 -1
  149. package/dist/es/types/spec/dialog/taro.d.ts +8 -2
  150. package/dist/es/types/spec/indicator/base.d.ts +1 -1
  151. package/dist/es/types/spec/notify/base.d.ts +22 -5
  152. package/dist/es/types/spec/popover/base.d.ts +7 -0
  153. package/dist/es/types/spec/searchbar/taro.d.ts +10 -7
  154. package/dist/es/types/spec/skeleton/base.d.ts +19 -14
  155. package/dist/es/types/spec/switch/base.d.ts +6 -2
  156. package/dist/es/types/spec/switch/h5.d.ts +1 -1
  157. package/dist/es/types/spec/switch/taro.d.ts +1 -4
  158. package/dist/es/types/spec/tabbar/base.d.ts +7 -4
  159. package/dist/es/utils/get-rect-by-taro.js +9 -0
  160. package/dist/es/utils/lru.d.ts +8 -0
  161. package/dist/es/utils/lru.js +49 -0
  162. package/dist/nutui.react.umd.js +557 -529
  163. package/dist/style.css +1 -1
  164. package/dist/style.scss +38 -38
  165. package/dist/styles/theme-jmapp.scss +1 -0
  166. package/dist/styles/themes/jmapp.css +1 -1
  167. package/dist/styles/variables-jmapp.scss +237 -50
  168. package/dist/styles/variables-jrkf.scss +25 -14
  169. package/dist/styles/variables.scss +38 -51
  170. package/package.json +1 -1
  171. package/dist/cjs/packages/dialog/dialogwrap.d.ts +0 -4
  172. package/dist/cjs/packages/dialog/dialogwrap.js +0 -79
  173. package/dist/cjs/packages/dialog/types.d.ts +0 -57
  174. package/dist/cjs/packages/dialog/types.js +0 -11
  175. package/dist/es/packages/dialog/dialogwrap.d.ts +0 -4
  176. package/dist/es/packages/dialog/dialogwrap.js +0 -60
  177. package/dist/es/packages/dialog/types.d.ts +0 -57
  178. package/dist/es/packages/dialog/types.js +0 -1
  179. /package/dist/cjs/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  180. /package/dist/cjs/packages/lottie/{web.js → lottie.js} +0 -0
  181. /package/dist/es/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  182. /package/dist/es/packages/lottie/{web.js → lottie.js} +0 -0
@@ -9967,7 +9967,8 @@ Please add \`${key2}Action\` when creating your handler.`);
9967
9967
  top: 0,
9968
9968
  right: 0,
9969
9969
  fill: "solid",
9970
- size: "large"
9970
+ size: "large",
9971
+ disabled: false
9971
9972
  });
9972
9973
  var Badge = function(props) {
9973
9974
  var isIcon = function isIcon2() {
@@ -9981,7 +9982,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9981
9982
  };
9982
9983
  var _this;
9983
9984
  var rtl = useRtl();
9984
- var _$_object_spread = _object_spread({}, defaultProps$1l, props), className = _$_object_spread.className, style = _$_object_spread.style, value2 = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size;
9985
+ var _$_object_spread = _object_spread({}, defaultProps$1l, props), className = _$_object_spread.className, style = _$_object_spread.style, value2 = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size, disabled = _$_object_spread.disabled;
9985
9986
  var classPrefix2 = "nut-badge";
9986
9987
  var classes = classNames(classPrefix2, className);
9987
9988
  var getContent = function() {
@@ -9992,7 +9993,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9992
9993
  return value2;
9993
9994
  };
9994
9995
  var _obj;
9995
- var contentClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-sup"), isNumber() || isString() || dot), _define_property(_obj, "".concat(classPrefix2, "-number"), isNumber()), _define_property(_obj, "".concat(classPrefix2, "-one"), typeof getContent() === "string" && ((_this = "".concat(getContent())) === null || _this === void 0 ? void 0 : _this.length) === 1), _define_property(_obj, "".concat(classPrefix2, "-dot"), dot), _define_property(_obj, "".concat(classPrefix2, "-dot-").concat(size), dot), _define_property(_obj, "".concat(classPrefix2, "-").concat(fill), fill === "outline"), _define_property(_obj, "".concat(classPrefix2, "-content"), children), _obj));
9996
+ var contentClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-sup"), isNumber() || isString() || dot), _define_property(_obj, "".concat(classPrefix2, "-number"), isNumber()), _define_property(_obj, "".concat(classPrefix2, "-one"), typeof getContent() === "string" && ((_this = "".concat(getContent())) === null || _this === void 0 ? void 0 : _this.length) === 1), _define_property(_obj, "".concat(classPrefix2, "-dot"), dot), _define_property(_obj, "".concat(classPrefix2, "-dot-").concat(size), dot), _define_property(_obj, "".concat(classPrefix2, "-").concat(fill), fill === "outline"), _define_property(_obj, "".concat(classPrefix2, "-content"), children), _define_property(_obj, "".concat(classPrefix2, "-disabled"), disabled), _obj));
9996
9997
  var getPositionStyle = function() {
9997
9998
  return _define_property({
9998
9999
  top: "".concat(Number(top) || 0, "px")
@@ -10371,11 +10372,12 @@ Please add \`${key2}Action\` when creating your handler.`);
10371
10372
  dot: false,
10372
10373
  max: 99,
10373
10374
  top: "0",
10374
- right: "0"
10375
+ right: "0",
10376
+ direction: "vertical"
10375
10377
  });
10376
10378
  var TabbarItem = function(props) {
10377
10379
  var ctx2 = React.useContext(TabbarContext);
10378
- var _ref = _object_spread({}, defaultProps$1g, props), className = _ref.className, style = _ref.style, title = _ref.title, icon = _ref.icon, value2 = _ref.value, dot = _ref.dot, max = _ref.max, top = _ref.top, right = _ref.right, index2 = _ref.index, rest = _object_without_properties(_ref, [
10380
+ var _ref = _object_spread({}, defaultProps$1g, props), className = _ref.className, style = _ref.style, title = _ref.title, icon = _ref.icon, value2 = _ref.value, dot = _ref.dot, max = _ref.max, top = _ref.top, right = _ref.right, index2 = _ref.index, direction = _ref.direction, onActiveClick = _ref.onActiveClick, rest = _object_without_properties(_ref, [
10379
10381
  "className",
10380
10382
  "style",
10381
10383
  "title",
@@ -10385,15 +10387,19 @@ Please add \`${key2}Action\` when creating your handler.`);
10385
10387
  "max",
10386
10388
  "top",
10387
10389
  "right",
10388
- "index"
10390
+ "index",
10391
+ "direction",
10392
+ "onActiveClick"
10389
10393
  ]);
10390
10394
  var active2 = index2 === (ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.selectIndex);
10391
10395
  var classPrefix2 = "nut-tabbar-item";
10392
- var tabbarItemClass = classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-active"), active2), className);
10393
- var boxPrefix = "".concat(classPrefix2, "-icon-box");
10394
- var titleClass = classNames(boxPrefix, "".concat(boxPrefix, "-nav"), _define_property({}, "".concat(boxPrefix, "-large"), !icon));
10396
+ var _obj;
10397
+ var tabbarItemClass = classNames(classPrefix2, (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-active"), active2), _define_property(_obj, "".concat(classPrefix2, "-large"), !icon || !title), _obj), className);
10398
+ var renderNodeWithActive = function(node) {
10399
+ return node && typeof node === "function" ? node(active2) : node;
10400
+ };
10395
10401
  var badgeProps = {
10396
- value: value2,
10402
+ value: renderNodeWithActive(value2),
10397
10403
  dot,
10398
10404
  max,
10399
10405
  top,
@@ -10402,8 +10408,26 @@ Please add \`${key2}Action\` when creating your handler.`);
10402
10408
  };
10403
10409
  var renderTitleText = function() {
10404
10410
  return title && /* @__PURE__ */ React.createElement("div", {
10405
- className: titleClass
10406
- }, title);
10411
+ className: "".concat(classPrefix2, "-text")
10412
+ }, renderNodeWithActive(title));
10413
+ };
10414
+ var renderTitle = function() {
10415
+ return /* @__PURE__ */ React.createElement(Badge, _object_spread({
10416
+ size: "normal"
10417
+ }, badgeProps), renderTitleText());
10418
+ };
10419
+ var renderIcon = function() {
10420
+ return renderNodeWithActive(icon);
10421
+ };
10422
+ var renderIconAndTitle = function() {
10423
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, _object_spread_props(_object_spread({
10424
+ size: "normal"
10425
+ }, badgeProps), {
10426
+ top: 3
10427
+ }), renderIcon()), renderTitleText());
10428
+ };
10429
+ var renderDualItem = function() {
10430
+ return dot ? null : /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), renderTitleText(), /* @__PURE__ */ React.createElement(Badge, badgeProps));
10407
10431
  };
10408
10432
  return /* @__PURE__ */ React.createElement("div", _object_spread({
10409
10433
  className: tabbarItemClass,
@@ -10411,23 +10435,22 @@ Please add \`${key2}Action\` when creating your handler.`);
10411
10435
  color: active2 ? ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.activeColor : ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.inactiveColor
10412
10436
  }, style),
10413
10437
  onClick: function() {
10414
- return ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.handleClick(index2);
10438
+ return active2 ? onActiveClick === null || onActiveClick === void 0 ? void 0 : onActiveClick() : ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.handleClick(index2);
10415
10439
  }
10416
- }, rest), icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, badgeProps, /* @__PURE__ */ React.createElement("div", {
10417
- className: boxPrefix
10418
- }, icon)), renderTitleText()) : /* @__PURE__ */ React.createElement(Badge, badgeProps, renderTitleText()));
10440
+ }, rest), direction === "horizontal" && !dot ? renderDualItem() : /* @__PURE__ */ React.createElement(React.Fragment, null, icon && renderIconAndTitle(), !icon && renderTitle()));
10419
10441
  };
10420
10442
  var defaultProps$1f = _object_spread_props(_object_spread({}, ComponentDefaults), {
10421
10443
  defaultValue: 0,
10422
10444
  fixed: false,
10423
10445
  inactiveColor: "",
10424
10446
  activeColor: "",
10447
+ direction: "vertical",
10425
10448
  safeArea: false,
10426
- onSwitch: function(value2) {
10449
+ onSwitch: function() {
10427
10450
  }
10428
10451
  });
10429
10452
  var Tabbar = function(props) {
10430
- var _$_object_spread = _object_spread({}, defaultProps$1f, props), children = _$_object_spread.children, defaultValue = _$_object_spread.defaultValue, value2 = _$_object_spread.value, fixed = _$_object_spread.fixed, activeColor = _$_object_spread.activeColor, inactiveColor = _$_object_spread.inactiveColor, safeArea = _$_object_spread.safeArea, className = _$_object_spread.className, style = _$_object_spread.style, onSwitch = _$_object_spread.onSwitch;
10453
+ var _$_object_spread = _object_spread({}, defaultProps$1f, props), children = _$_object_spread.children, defaultValue = _$_object_spread.defaultValue, value2 = _$_object_spread.value, fixed = _$_object_spread.fixed, activeColor = _$_object_spread.activeColor, inactiveColor = _$_object_spread.inactiveColor, direction = _$_object_spread.direction, safeArea = _$_object_spread.safeArea, className = _$_object_spread.className, style = _$_object_spread.style, onSwitch = _$_object_spread.onSwitch;
10431
10454
  var classPrefix2 = "nut-tabbar";
10432
10455
  var _usePropsValue = _sliced_to_array(usePropsValue({
10433
10456
  value: value2,
@@ -10435,11 +10458,26 @@ Please add \`${key2}Action\` when creating your handler.`);
10435
10458
  finalValue: 0,
10436
10459
  onChange: onSwitch
10437
10460
  }), 2), selectIndex = _usePropsValue[0], setSelectIndex = _usePropsValue[1];
10461
+ var sizeCls = React.useMemo(function() {
10462
+ var size = React.Children.count(children);
10463
+ var _obj;
10464
+ return size > 3 ? "" : classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-wrap-3"), size === 3), _define_property(_obj, "".concat(classPrefix2, "-wrap-2"), size === 2), _define_property(_obj, "".concat(classPrefix2, "-wrap-").concat(direction), size === 2 && direction !== "vertical"), _obj));
10465
+ }, [
10466
+ children,
10467
+ direction
10468
+ ]);
10469
+ var itemDirection = React.useMemo(function() {
10470
+ var size = React.Children.count(children);
10471
+ return size === 2 && direction !== "vertical" && direction;
10472
+ }, [
10473
+ direction,
10474
+ children
10475
+ ]);
10438
10476
  return /* @__PURE__ */ React.createElement("div", {
10439
10477
  className: classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-fixed"), fixed), className),
10440
10478
  style
10441
10479
  }, /* @__PURE__ */ React.createElement("div", {
10442
- className: "".concat(classPrefix2, "-wrap")
10480
+ className: "".concat(classPrefix2, "-wrap ").concat(sizeCls)
10443
10481
  }, /* @__PURE__ */ React.createElement(TabbarContext.Provider, {
10444
10482
  value: {
10445
10483
  selectIndex,
@@ -10448,12 +10486,12 @@ Please add \`${key2}Action\` when creating your handler.`);
10448
10486
  handleClick: setSelectIndex
10449
10487
  }
10450
10488
  }, React.Children.map(children, function(child, index2) {
10451
- if (!/* @__PURE__ */ React.isValidElement(child)) return null;
10452
- return /* @__PURE__ */ React.cloneElement(child, _object_spread_props(_object_spread({}, child.props), {
10453
- index: index2
10454
- }));
10455
- }))), (fixed || safeArea) && /* @__PURE__ */ React.createElement("div", {
10456
- className: "".concat(classPrefix2, "-safe-area")
10489
+ return /* @__PURE__ */ React.isValidElement(child) ? /* @__PURE__ */ React.cloneElement(child, _object_spread_props(_object_spread({}, child.props), {
10490
+ index: index2,
10491
+ direction: itemDirection
10492
+ })) : null;
10493
+ }))), (fixed || safeArea) && /* @__PURE__ */ React.createElement(SafeArea, {
10494
+ position: "bottom"
10457
10495
  }));
10458
10496
  };
10459
10497
  Tabbar.displayName = "NutTabbar";
@@ -10469,9 +10507,9 @@ Please add \`${key2}Action\` when creating your handler.`);
10469
10507
  var classes = classNames(classPrefix2, {
10470
10508
  active: !disabled && props.active
10471
10509
  }, autoHeightClassName, className);
10472
- return children && /* @__PURE__ */ React.createElement("div", {
10510
+ return children ? /* @__PURE__ */ React.createElement("div", {
10473
10511
  className: classes
10474
- }, !disabled && children);
10512
+ }, !disabled && children) : null;
10475
10513
  };
10476
10514
  var defaultProps$1d = _object_spread_props(_object_spread({}, ComponentDefaults), {
10477
10515
  tabStyle: {},
@@ -18434,15 +18472,17 @@ Please add \`${key2}Action\` when creating your handler.`);
18434
18472
  var defaultProps$M = _object_spread_props(_object_spread({}, ComponentDefaults), {
18435
18473
  disabled: false,
18436
18474
  activeText: "",
18437
- inactiveText: ""
18475
+ inactiveText: "",
18476
+ loadingIcon: /* @__PURE__ */ React.createElement(d$3, null)
18438
18477
  });
18439
18478
  var Switch = function(props) {
18440
- var _ref = _object_spread({}, defaultProps$M, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, className = _ref.className, style = _ref.style, onChange = _ref.onChange, rest = _object_without_properties(_ref, [
18479
+ var _ref = _object_spread({}, defaultProps$M, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, loadingIcon = _ref.loadingIcon, className = _ref.className, style = _ref.style, onChange = _ref.onChange, rest = _object_without_properties(_ref, [
18441
18480
  "checked",
18442
18481
  "defaultChecked",
18443
18482
  "disabled",
18444
18483
  "activeText",
18445
18484
  "inactiveText",
18485
+ "loadingIcon",
18446
18486
  "className",
18447
18487
  "style",
18448
18488
  "onChange"
@@ -18453,6 +18493,12 @@ Please add \`${key2}Action\` when creating your handler.`);
18453
18493
  value: checked,
18454
18494
  defaultValue: defaultChecked
18455
18495
  }), 2), value2 = _usePropsValue[0], setValue = _usePropsValue[1];
18496
+ React.useEffect(function() {
18497
+ changing && setChanging(false);
18498
+ }, [
18499
+ value2
18500
+ ]);
18501
+ var _useState = _sliced_to_array(React.useState(false), 2), changing = _useState[0], setChanging = _useState[1];
18456
18502
  var classes = function() {
18457
18503
  var _obj2;
18458
18504
  return classNames([
@@ -18461,17 +18507,18 @@ Please add \`${key2}Action\` when creating your handler.`);
18461
18507
  (_obj2 = {}, _define_property(_obj2, "".concat(classPrefix2, "-close"), !value2), _define_property(_obj2, "".concat(classPrefix2, "-disabled"), disabled), _define_property(_obj2, "".concat(classPrefix2, "-disabled-close"), disabled && !value2), _obj2)
18462
18508
  ]);
18463
18509
  };
18464
- var onClick = function(event) {
18465
- if (disabled) return;
18466
- onChange && onChange(!value2, event);
18510
+ var onClick = function() {
18511
+ if (disabled || changing) return;
18512
+ if (onChange) {
18513
+ setChanging(true);
18514
+ onChange(!value2);
18515
+ }
18467
18516
  setValue(!value2);
18468
18517
  };
18469
18518
  var _obj, _obj1;
18470
18519
  return /* @__PURE__ */ React.createElement("div", _object_spread({
18471
18520
  className: classes(),
18472
- onClick: function(e2) {
18473
- return onClick(e2);
18474
- },
18521
+ onClick,
18475
18522
  style
18476
18523
  }, rest), /* @__PURE__ */ React.createElement("div", {
18477
18524
  className: classNames([
@@ -18483,9 +18530,9 @@ Please add \`${key2}Action\` when creating your handler.`);
18483
18530
  ],
18484
18531
  (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-button-open-rtl"), rtl && value2), _define_property(_obj, "".concat(classPrefix2, "-button-close-rtl"), rtl && !value2), _obj)
18485
18532
  ])
18486
- }, !value2 && !activeText && /* @__PURE__ */ React.createElement("div", {
18533
+ }, changing && loadingIcon ? /* @__PURE__ */ React.createElement(React.Fragment, null, loadingIcon) : /* @__PURE__ */ React.createElement(React.Fragment, null, !value2 && !activeText && /* @__PURE__ */ React.createElement("div", {
18487
18534
  className: "".concat(classPrefix2, "-close-line")
18488
- })), activeText && /* @__PURE__ */ React.createElement("div", {
18535
+ }))), activeText && /* @__PURE__ */ React.createElement("div", {
18489
18536
  className: classNames("".concat(classPrefix2, "-label"), (_obj1 = {}, _define_property(_obj1, "".concat(classPrefix2, "-label-open"), value2), _define_property(_obj1, "".concat(classPrefix2, "-label-close"), !value2), _define_property(_obj1, "".concat(classPrefix2, "-label-open-rtl"), rtl && value2), _define_property(_obj1, "".concat(classPrefix2, "-label-close-rtl"), rtl && !value2), _define_property(_obj1, "".concat(classPrefix2, "-label-close-disabled"), disabled && !value2), _obj1))
18490
18537
  }, value2 ? activeText : inactiveText));
18491
18538
  };
@@ -19270,6 +19317,7 @@ Please add \`${key2}Action\` when creating your handler.`);
19270
19317
  }));
19271
19318
  };
19272
19319
  ActionSheet.displayName = "NutActionSheet";
19320
+ var destroyList = [];
19273
19321
  var fullClone = _object_spread({}, ReactDOM__namespace);
19274
19322
  var version = fullClone.version, reactRender = fullClone.render, unmountComponentAtNode = fullClone.unmountComponentAtNode;
19275
19323
  var createRoot;
@@ -19334,10 +19382,6 @@ Please add \`${key2}Action\` when creating your handler.`);
19334
19382
  function ConfirmDialog(props) {
19335
19383
  return /* @__PURE__ */ React.createElement(Dialog, props, props.content);
19336
19384
  }
19337
- var normalizeConfig = function(config2) {
19338
- config2.hideCancelButton = config2.isNotice;
19339
- return config2;
19340
- };
19341
19385
  var confirm = function(config2, renderFunc) {
19342
19386
  var div2 = document.createElement("div");
19343
19387
  document.body.appendChild(div2);
@@ -19370,7 +19414,6 @@ Please add \`${key2}Action\` when creating your handler.`);
19370
19414
  }
19371
19415
  };
19372
19416
  dialogConfig.onConfirm = onConfirm;
19373
- dialogConfig = normalizeConfig(dialogConfig);
19374
19417
  dialogConfig.visible = true;
19375
19418
  renderFunction(dialogConfig);
19376
19419
  var destroy = function() {
@@ -19378,6 +19421,13 @@ Please add \`${key2}Action\` when creating your handler.`);
19378
19421
  if (div2 === null || div2 === void 0 ? void 0 : div2.parentNode) {
19379
19422
  div2.parentNode.removeChild(div2);
19380
19423
  }
19424
+ for (var i2 = 0; i2 < destroyList.length; i2++) {
19425
+ var fn = destroyList[i2];
19426
+ if (fn === close) {
19427
+ destroyList.splice(i2, 1);
19428
+ break;
19429
+ }
19430
+ }
19381
19431
  };
19382
19432
  var onCancel = function(confirm2) {
19383
19433
  !confirm2 && config2.onCancel && config2.onCancel();
@@ -19391,7 +19441,6 @@ Please add \`${key2}Action\` when creating your handler.`);
19391
19441
  };
19392
19442
  var update2 = function(newConfig) {
19393
19443
  dialogConfig = _object_spread({}, dialogConfig, newConfig);
19394
- dialogConfig = normalizeConfig(dialogConfig);
19395
19444
  renderFunction(dialogConfig);
19396
19445
  };
19397
19446
  var close = function() {
@@ -19402,6 +19451,7 @@ Please add \`${key2}Action\` when creating your handler.`);
19402
19451
  };
19403
19452
  renderFunction(dialogConfig);
19404
19453
  };
19454
+ destroyList.push(close);
19405
19455
  return {
19406
19456
  close,
19407
19457
  update: update2
@@ -19447,64 +19497,13 @@ Please add \`${key2}Action\` when creating your handler.`);
19447
19497
  }, children), renderFooter()));
19448
19498
  };
19449
19499
  Content.displayName = "NutContent";
19450
- var defaultDialogWrapProps = _object_spread_props(_object_spread({}, defaultOverlayProps, defaultContentProps), {
19451
- overlay: true,
19452
- overlayStyle: {},
19453
- overlayClassName: "nut-dialog-overlay",
19454
- onCancel: function() {
19455
- },
19456
- onClose: function() {
19457
- },
19458
- onOverlayClick: function() {
19459
- return true;
19460
- }
19461
- });
19462
- var DialogWrap = function(props) {
19463
- var _ref = _object_spread({}, defaultDialogWrapProps, props), visible = _ref.visible, overlay = _ref.overlay, overlayStyle = _ref.overlayStyle, overlayClassName = _ref.overlayClassName, closeOnOverlayClick = _ref.closeOnOverlayClick, lockScroll = _ref.lockScroll, zIndex = _ref.zIndex, onClose = _ref.onClose, onCancel = _ref.onCancel, onOverlayClick = _ref.onOverlayClick, restProps = _object_without_properties(_ref, [
19464
- "visible",
19465
- "overlay",
19466
- "overlayStyle",
19467
- "overlayClassName",
19468
- "closeOnOverlayClick",
19469
- "lockScroll",
19470
- "zIndex",
19471
- "onClose",
19472
- "onCancel",
19473
- "onOverlayClick"
19474
- ]);
19475
- var onHandleClickOverlay = function(e2) {
19476
- if (closeOnOverlayClick && visible && e2.target === e2.currentTarget) {
19477
- var closed = onOverlayClick && onOverlayClick(e2);
19478
- closed && (onClose === null || onClose === void 0 ? void 0 : onClose());
19479
- closed && (onCancel === null || onCancel === void 0 ? void 0 : onCancel());
19480
- }
19481
- };
19482
- return /* @__PURE__ */ React.createElement(React.Fragment, null, overlay && /* @__PURE__ */ React.createElement(Overlay, {
19483
- zIndex,
19484
- style: overlayStyle,
19485
- className: overlayClassName,
19486
- visible,
19487
- closeOnOverlayClick,
19488
- lockScroll,
19489
- onClick: onHandleClickOverlay
19490
- }), /* @__PURE__ */ React.createElement(CSSTransition, {
19491
- in: visible,
19492
- timeout: 300,
19493
- classNames: "fadeDialog",
19494
- unmountOnExit: true,
19495
- appear: true
19496
- }, /* @__PURE__ */ React.createElement(Content, _object_spread_props(_object_spread({}, restProps), {
19497
- style: {
19498
- zIndex
19499
- },
19500
- visible
19501
- }))));
19502
- };
19503
- DialogWrap.displayName = "NutDialogWrap";
19504
- var defaultProps$H = _object_spread_props(_object_spread({}, defaultDialogWrapProps), {
19500
+ var defaultProps$H = _object_spread_props(_object_spread({}, defaultOverlayProps, defaultContentProps), {
19501
+ title: "",
19502
+ content: "",
19503
+ header: "",
19504
+ footer: "",
19505
19505
  confirmText: "",
19506
19506
  cancelText: "",
19507
- overlay: true,
19508
19507
  closeOnOverlayClick: true,
19509
19508
  hideConfirmButton: false,
19510
19509
  hideCancelButton: false,
@@ -19513,38 +19512,28 @@ Please add \`${key2}Action\` when creating your handler.`);
19513
19512
  lockScroll: true,
19514
19513
  closeIconPosition: "bottom",
19515
19514
  closeIcon: false,
19515
+ overlay: true,
19516
+ overlayStyle: {},
19517
+ overlayClassName: "nut-dialog-overlay",
19516
19518
  zIndex: 1200,
19517
19519
  beforeCancel: function() {
19518
19520
  return true;
19519
19521
  },
19520
19522
  beforeClose: function() {
19521
19523
  return true;
19524
+ },
19525
+ onCancel: function() {
19526
+ },
19527
+ onClose: function() {
19528
+ },
19529
+ onOverlayClick: function() {
19530
+ return true;
19522
19531
  }
19523
19532
  });
19524
19533
  var BaseDialog = function(props, ref) {
19525
- var locale = useConfig().locale;
19526
- var _ref = _object_spread({}, defaultProps$H, props), visible = _ref.visible, footer = _ref.footer, hideConfirmButton = _ref.hideConfirmButton, hideCancelButton = _ref.hideCancelButton, lockScroll = _ref.lockScroll, disableConfirmButton = _ref.disableConfirmButton;
19527
- _ref.closeOnOverlayClick;
19528
- var confirmText = _ref.confirmText, cancelText = _ref.cancelText, closeIconPosition = _ref.closeIconPosition, closeIcon = _ref.closeIcon, footerDirection = _ref.footerDirection, onClose = _ref.onClose, onCancel = _ref.onCancel, onConfirm = _ref.onConfirm, beforeCancel = _ref.beforeCancel, beforeClose = _ref.beforeClose, restProps = _object_without_properties(_ref, [
19529
- "visible",
19530
- "footer",
19531
- "hideConfirmButton",
19532
- "hideCancelButton",
19533
- "lockScroll",
19534
- "disableConfirmButton",
19535
- "closeOnOverlayClick",
19536
- "confirmText",
19537
- "cancelText",
19538
- "closeIconPosition",
19539
- "closeIcon",
19540
- "footerDirection",
19541
- "onClose",
19542
- "onCancel",
19543
- "onConfirm",
19544
- "beforeCancel",
19545
- "beforeClose"
19546
- ]);
19534
+ var _mergeProps = mergeProps(defaultProps$H, props), closeOnOverlayClick = _mergeProps.closeOnOverlayClick, confirmText = _mergeProps.confirmText, cancelText = _mergeProps.cancelText, children = _mergeProps.children, className = _mergeProps.className, closeIconPosition = _mergeProps.closeIconPosition, closeIcon = _mergeProps.closeIcon, content2 = _mergeProps.content, disableConfirmButton = _mergeProps.disableConfirmButton, footer = _mergeProps.footer, footerDirection = _mergeProps.footerDirection, header = _mergeProps.header, hideConfirmButton = _mergeProps.hideConfirmButton, hideCancelButton = _mergeProps.hideCancelButton, lockScroll = _mergeProps.lockScroll, overlay = _mergeProps.overlay, overlayStyle = _mergeProps.overlayStyle, overlayClassName = _mergeProps.overlayClassName, style = _mergeProps.style, title = _mergeProps.title, visible = _mergeProps.visible, zIndex = _mergeProps.zIndex, beforeCancel = _mergeProps.beforeCancel, beforeClose = _mergeProps.beforeClose, onClose = _mergeProps.onClose, onCancel = _mergeProps.onCancel, onConfirm = _mergeProps.onConfirm, onOverlayClick = _mergeProps.onOverlayClick;
19547
19535
  var classPrefix2 = "nut-dialog";
19536
+ var locale = useConfig().locale;
19548
19537
  var _useState = _sliced_to_array(React.useState(false), 2), loading = _useState[0], setLoading = _useState[1];
19549
19538
  var renderFooter = function() {
19550
19539
  if (footer === null) return "";
@@ -19552,11 +19541,11 @@ Please add \`${key2}Action\` when creating your handler.`);
19552
19541
  e2.stopPropagation();
19553
19542
  if (!(beforeCancel === null || beforeCancel === void 0 ? void 0 : beforeCancel())) return;
19554
19543
  if (!(beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose())) return;
19555
- onClose === null || onClose === void 0 ? void 0 : onClose();
19556
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
19544
+ onClose();
19545
+ onCancel();
19557
19546
  };
19558
19547
  var handleOk = /* @__PURE__ */ function() {
19559
- var _ref2 = _async_to_generator(function(e2) {
19548
+ var _ref = _async_to_generator(function(e2) {
19560
19549
  return __generator(this, function(_state) {
19561
19550
  switch (_state.label) {
19562
19551
  case 0:
@@ -19577,7 +19566,7 @@ Please add \`${key2}Action\` when creating your handler.`);
19577
19566
  case 2:
19578
19567
  _state.sent();
19579
19568
  setLoading(false);
19580
- onClose === null || onClose === void 0 ? void 0 : onClose();
19569
+ onClose();
19581
19570
  return [
19582
19571
  3,
19583
19572
  4
@@ -19597,45 +19586,54 @@ Please add \`${key2}Action\` when creating your handler.`);
19597
19586
  });
19598
19587
  });
19599
19588
  return function handleOk2(e2) {
19600
- return _ref2.apply(this, arguments);
19589
+ return _ref.apply(this, arguments);
19601
19590
  };
19602
19591
  }();
19603
19592
  var btnClass = hideCancelButton || hideConfirmButton ? "".concat(classPrefix2, "-footer-block") : "";
19604
- return footer || /* @__PURE__ */ React.createElement(React.Fragment, null, !hideCancelButton && (footerDirection === "vertical" ? /* @__PURE__ */ React.createElement("div", {
19605
- style: {
19606
- order: 2
19607
- },
19608
- className: "".concat(classPrefix2, "-footer-cancel ").concat(btnClass),
19609
- onClick: function(e2) {
19610
- return handleCancel(e2);
19611
- }
19612
- }, cancelText || locale.cancel) : /* @__PURE__ */ React.createElement(Button, {
19613
- type: "default",
19614
- size: "large",
19615
- className: "".concat(classPrefix2, "-footer-cancel ").concat(btnClass),
19616
- onClick: function(e2) {
19617
- return handleCancel(e2);
19618
- }
19619
- }, cancelText || locale.cancel)), !hideConfirmButton && /* @__PURE__ */ React.createElement(Button, {
19620
- type: "primary",
19621
- size: "large",
19622
- className: classNames("".concat(classPrefix2, "-footer-ok ").concat(btnClass), {
19623
- disabled: disableConfirmButton
19624
- }),
19625
- disabled: disableConfirmButton,
19626
- onClick: function(e2) {
19627
- return handleOk(e2);
19628
- },
19629
- loading
19630
- }, confirmText || locale.confirm));
19593
+ var renderCancelOfVertical = function() {
19594
+ return !hideCancelButton && /* @__PURE__ */ React.createElement("div", {
19595
+ style: {
19596
+ order: 2
19597
+ },
19598
+ className: "".concat(classPrefix2, "-footer-cancel ").concat(btnClass),
19599
+ onClick: function(e2) {
19600
+ return handleCancel(e2);
19601
+ }
19602
+ }, cancelText || locale.cancel);
19603
+ };
19604
+ var renderCancel = function() {
19605
+ return !hideCancelButton && /* @__PURE__ */ React.createElement(Button, {
19606
+ type: "default",
19607
+ size: "large",
19608
+ className: "".concat(classPrefix2, "-footer-cancel ").concat(btnClass),
19609
+ onClick: function(e2) {
19610
+ return handleCancel(e2);
19611
+ }
19612
+ }, cancelText || locale.cancel);
19613
+ };
19614
+ var renderConfirm = function() {
19615
+ return !hideConfirmButton && /* @__PURE__ */ React.createElement(Button, {
19616
+ type: "primary",
19617
+ size: "large",
19618
+ className: classNames("".concat(classPrefix2, "-footer-ok ").concat(btnClass), {
19619
+ disabled: disableConfirmButton
19620
+ }),
19621
+ disabled: disableConfirmButton,
19622
+ onClick: function(e2) {
19623
+ return handleOk(e2);
19624
+ },
19625
+ loading
19626
+ }, confirmText || locale.confirm);
19627
+ };
19628
+ return footer || /* @__PURE__ */ React.createElement(React.Fragment, null, footerDirection === "vertical" ? /* @__PURE__ */ React.createElement(React.Fragment, null, renderConfirm(), renderCancelOfVertical()) : /* @__PURE__ */ React.createElement(React.Fragment, null, renderCancel(), renderConfirm()));
19631
19629
  };
19632
19630
  var renderCloseIcon = function() {
19633
19631
  if (!closeIcon) return null;
19634
19632
  var handleCancel = function() {
19635
19633
  if (!(beforeCancel === null || beforeCancel === void 0 ? void 0 : beforeCancel())) return;
19636
19634
  if (!(beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose())) return;
19637
- onClose === null || onClose === void 0 ? void 0 : onClose();
19638
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
19635
+ onClose();
19636
+ onCancel();
19639
19637
  };
19640
19638
  var _obj;
19641
19639
  var closeClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-close"), true), _define_property(_obj, "".concat(classPrefix2, "-close-").concat(closeIconPosition), true), _obj));
@@ -19645,19 +19643,46 @@ Please add \`${key2}Action\` when creating your handler.`);
19645
19643
  onClick: handleCancel
19646
19644
  }, /* @__PURE__ */ React.isValidElement(closeIcon) ? closeIcon : systomIcon);
19647
19645
  };
19646
+ var onHandleClickOverlay = function(e2) {
19647
+ if (closeOnOverlayClick && visible && e2.target === e2.currentTarget) {
19648
+ var closed = onOverlayClick && onOverlayClick(e2);
19649
+ closed && onClose();
19650
+ closed && onCancel();
19651
+ }
19652
+ };
19653
+ var renderContent = function() {
19654
+ return /* @__PURE__ */ React.createElement(CSSTransition, {
19655
+ in: visible,
19656
+ timeout: 300,
19657
+ classNames: "fadeDialog",
19658
+ unmountOnExit: true,
19659
+ appear: true
19660
+ }, /* @__PURE__ */ React.createElement(Content, {
19661
+ className,
19662
+ style: _object_spread({
19663
+ zIndex
19664
+ }, style),
19665
+ title,
19666
+ header,
19667
+ close: renderCloseIcon(),
19668
+ footer: renderFooter(),
19669
+ footerDirection,
19670
+ visible
19671
+ }, content2 || children));
19672
+ };
19648
19673
  return /* @__PURE__ */ React.createElement("div", {
19649
19674
  style: {
19650
19675
  display: visible ? "block" : "none"
19651
19676
  }
19652
- }, /* @__PURE__ */ React.createElement(DialogWrap, _object_spread_props(_object_spread({}, restProps), {
19677
+ }, overlay && /* @__PURE__ */ React.createElement(Overlay, {
19678
+ zIndex,
19653
19679
  visible,
19680
+ style: overlayStyle,
19681
+ className: overlayClassName,
19682
+ closeOnOverlayClick,
19654
19683
  lockScroll,
19655
- footer: renderFooter(),
19656
- footerDirection,
19657
- close: renderCloseIcon(),
19658
- onClose,
19659
- onCancel
19660
- })));
19684
+ onClick: onHandleClickOverlay
19685
+ }), renderContent());
19661
19686
  };
19662
19687
  var Dialog = /* @__PURE__ */ React.forwardRef(BaseDialog);
19663
19688
  Dialog.confirm = function(props) {
@@ -19665,12 +19690,9 @@ Please add \`${key2}Action\` when creating your handler.`);
19665
19690
  };
19666
19691
  [
19667
19692
  "alert"
19668
- ].forEach(function(type2) {
19669
- Dialog[type2] = function(props) {
19670
- return confirm(_object_spread_props(_object_spread({}, props), {
19671
- isNotice: false,
19672
- noticeType: type2
19673
- }));
19693
+ ].forEach(function() {
19694
+ Dialog.alert = function(props) {
19695
+ return confirm(_object_spread({}, props));
19674
19696
  };
19675
19697
  });
19676
19698
  Dialog.displayName = "NutDialog";
@@ -37366,6 +37388,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37366
37388
  {
37367
37389
  key: "close",
37368
37390
  value: function close() {
37391
+ var _this_props;
37369
37392
  this.setState({
37370
37393
  show: false
37371
37394
  });
@@ -37374,7 +37397,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37374
37397
  var element = document.getElementById(this.props.id);
37375
37398
  element && element.parentNode && element.parentNode.removeChild(element);
37376
37399
  }
37377
- this.props.onClose();
37400
+ (_this_props = this.props) === null || _this_props === void 0 ? void 0 : _this_props.onClose();
37378
37401
  }
37379
37402
  },
37380
37403
  {
@@ -37419,22 +37442,40 @@ Please add \`${key2}Action\` when creating your handler.`);
37419
37442
  {
37420
37443
  key: "render",
37421
37444
  value: function render2() {
37422
- var _this_props = this.props, style = _this_props.style, message = _this_props.message, type2 = _this_props.type, className = _this_props.className, position2 = _this_props.position;
37445
+ var _this_props = this.props, id = _this_props.id, style = _this_props.style, message = _this_props.message, leftIcon = _this_props.leftIcon, rightIcon = _this_props.rightIcon, closeable = _this_props.closeable, className = _this_props.className, position2 = _this_props.position, distance = _this_props.distance, navHeight = _this_props.navHeight;
37423
37446
  var show2 = this.state.show;
37447
+ var classes = classNames(classPrefix$c, className);
37448
+ var getDistance = function() {
37449
+ if (position2 === "top") {
37450
+ return {
37451
+ top: "".concat(distance + navHeight, "px")
37452
+ };
37453
+ }
37454
+ return {
37455
+ bottom: "".concat(distance, "px")
37456
+ };
37457
+ };
37424
37458
  var _obj;
37425
- var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix$c, "-popup-top"), position2 === "top"), _define_property(_obj, "".concat(classPrefix$c, "-popup-bottom"), position2 === "bottom"), _define_property(_obj, "".concat(classPrefix$c), true), _define_property(_obj, "".concat(classPrefix$c, "-").concat(type2), true), _obj));
37426
37459
  return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(CSSTransition, {
37427
37460
  in: show2,
37428
37461
  timeout: 300,
37429
37462
  classNames: "fade",
37430
37463
  unmountOnExit: true,
37431
37464
  appear: true,
37432
- position: position2
37465
+ position: position2,
37466
+ id
37433
37467
  }, /* @__PURE__ */ React__namespace.createElement("div", {
37434
- className: "".concat(classes, " ").concat(className),
37435
- style,
37468
+ className: classes,
37469
+ style: _object_spread({}, style, getDistance()),
37436
37470
  onClick: this.clickCover
37437
- }, message)));
37471
+ }, leftIcon ? /* @__PURE__ */ React__namespace.createElement("div", {
37472
+ className: "".concat(classPrefix$c, "-left-icon")
37473
+ }, leftIcon) : null, /* @__PURE__ */ React__namespace.createElement("div", {
37474
+ className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix$c, "-content"), true), _define_property(_obj, "".concat(classPrefix$c, "-ellipsis"), closeable || rightIcon), _define_property(_obj, "".concat(classPrefix$c, "-layout-left"), leftIcon || rightIcon), _obj))
37475
+ }, message), rightIcon || closeable ? /* @__PURE__ */ React__namespace.createElement("div", {
37476
+ className: "".concat(classPrefix$c, "-right-icon"),
37477
+ onClick: this.close
37478
+ }, rightIcon || (closeable ? /* @__PURE__ */ React__namespace.createElement(n$6, null) : null)) : null)));
37438
37479
  }
37439
37480
  }
37440
37481
  ]);
@@ -37470,9 +37511,13 @@ Please add \`${key2}Action\` when creating your handler.`);
37470
37511
  var messageInstance$1 = null;
37471
37512
  var options = _object_spread_props(_object_spread({}, ComponentDefaults), {
37472
37513
  id: "",
37473
- duration: 3e3,
37474
- type: "danger",
37475
37514
  position: "top",
37515
+ distance: 8,
37516
+ navHeight: 57,
37517
+ closeable: false,
37518
+ leftIcon: null,
37519
+ rightIcon: null,
37520
+ duration: 3e3,
37476
37521
  onClose: function() {
37477
37522
  },
37478
37523
  onClick: function() {
@@ -37507,38 +37552,6 @@ Please add \`${key2}Action\` when creating your handler.`);
37507
37552
  type: "base"
37508
37553
  }, option));
37509
37554
  },
37510
- success: function success(message) {
37511
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37512
- errorMsg$1(message);
37513
- return notice$1(_object_spread({
37514
- message,
37515
- type: "success"
37516
- }, option));
37517
- },
37518
- primary: function primary(message) {
37519
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37520
- errorMsg$1(message);
37521
- return notice$1(_object_spread({
37522
- message,
37523
- type: "primary"
37524
- }, option));
37525
- },
37526
- danger: function danger(message) {
37527
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37528
- errorMsg$1(message);
37529
- return notice$1(_object_spread({
37530
- message,
37531
- type: "danger"
37532
- }, option));
37533
- },
37534
- warn: function warn(message) {
37535
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37536
- errorMsg$1(message);
37537
- return notice$1(_object_spread({
37538
- message,
37539
- type: "warning"
37540
- }, option));
37541
- },
37542
37555
  hide: function hide() {
37543
37556
  if (messageInstance$1) {
37544
37557
  messageInstance$1.destroy();
@@ -37594,12 +37607,12 @@ Please add \`${key2}Action\` when creating your handler.`);
37594
37607
  var popoverRef = React.useRef(null);
37595
37608
  var popoverContentRef = React.useRef(null);
37596
37609
  var _useState = _sliced_to_array(React.useState(false), 2), showPopup = _useState[0], setShowPopup = _useState[1];
37597
- var _useState1 = _sliced_to_array(React.useState(), 2), rootPosition = _useState1[0], setRootPosition = _useState1[1];
37610
+ var _useState1 = _sliced_to_array(React.useState(), 2), wrapperPosition = _useState1[0], setWrapperPosition = _useState1[1];
37598
37611
  React.useEffect(function() {
37599
37612
  setShowPopup(visible);
37600
37613
  if (visible) {
37601
37614
  setTimeout(function() {
37602
- getContentWidth();
37615
+ getWrapperPosition();
37603
37616
  }, 0);
37604
37617
  }
37605
37618
  }, [
@@ -37607,25 +37620,10 @@ Please add \`${key2}Action\` when creating your handler.`);
37607
37620
  location
37608
37621
  ]);
37609
37622
  var update2 = React.useRef(function(e2) {
37610
- getContentWidth();
37623
+ getWrapperPosition();
37611
37624
  });
37612
- React.useEffect(function() {
37613
- if (visible) {
37614
- scrollableParents.forEach(function(parent2) {
37615
- parent2.addEventListener("scroll", update2.current, {
37616
- passive: true
37617
- });
37618
- });
37619
- } else {
37620
- scrollableParents.forEach(function(parent2) {
37621
- return parent2.removeEventListener("scroll", update2.current);
37622
- });
37623
- }
37624
- }, [
37625
- visible
37626
- ]);
37627
- var element = null;
37628
37625
  var targetSet = [];
37626
+ var element = null;
37629
37627
  if (canUseDom && targetId) {
37630
37628
  element = document.querySelector("#".concat(targetId));
37631
37629
  targetSet = [
@@ -37638,39 +37636,59 @@ Please add \`${key2}Action\` when creating your handler.`);
37638
37636
  popoverContentRef.current
37639
37637
  ];
37640
37638
  }
37641
- useClickAway(function() {
37642
- onClick === null || onClick === void 0 ? void 0 : onClick();
37643
- onClose === null || onClose === void 0 ? void 0 : onClose();
37644
- }, targetSet, "touchstart", true, visible, closeOnOutsideClick);
37645
37639
  var scrollableParents = React.useMemo(function() {
37646
37640
  return getAllScrollableParents(element || popoverRef.current);
37647
37641
  }, [
37648
37642
  element,
37649
37643
  popoverRef.current
37650
37644
  ]);
37651
- var getContentWidth = function() {
37645
+ React.useEffect(function() {
37646
+ if (visible) {
37647
+ scrollableParents.forEach(function(parent2) {
37648
+ parent2.addEventListener("scroll", update2.current, {
37649
+ passive: true
37650
+ });
37651
+ });
37652
+ } else {
37653
+ scrollableParents.forEach(function(parent2) {
37654
+ return parent2.removeEventListener("scroll", update2.current);
37655
+ });
37656
+ }
37657
+ }, [
37658
+ visible
37659
+ ]);
37660
+ useClickAway(function() {
37661
+ onClick === null || onClick === void 0 ? void 0 : onClick();
37662
+ onClose === null || onClose === void 0 ? void 0 : onClose();
37663
+ }, targetSet, "touchstart", true, visible, closeOnOutsideClick);
37664
+ var getWrapperPosition = function() {
37652
37665
  var rect = getRect(targetId ? document.querySelector("#".concat(targetId)) : popoverRef.current);
37653
- setRootPosition({
37654
- width: rect.width,
37655
- height: rect.height,
37656
- left: rtl ? rect.right : rect.left,
37657
- top: rect.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop),
37658
- right: rtl ? rect.left : rect.right
37666
+ var distance = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
37667
+ var width2 = rect.width, height2 = rect.height, right = rect.right, left = rect.left, top = rect.top;
37668
+ setWrapperPosition({
37669
+ width: width2,
37670
+ height: height2,
37671
+ left: rtl ? right : left,
37672
+ top: top + distance,
37673
+ right: rtl ? left : right
37659
37674
  });
37660
37675
  };
37661
- var _obj;
37662
- var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix$b), true), _define_property(_obj, "".concat(classPrefix$b, "-").concat(theme), theme === "dark"), _obj), className);
37676
+ var classes = classNames(classPrefix$b, _define_property({}, "".concat(classPrefix$b, "-").concat(theme), theme === "dark"), className);
37663
37677
  var popoverArrow = function() {
37664
37678
  var prefixCls2 = "nut-popover-arrow";
37665
- return "".concat(prefixCls2, " ").concat(prefixCls2, "-").concat(location.split("-")[0], " ").concat(prefixCls2, "-").concat(location);
37679
+ var direction = location.split("-")[0];
37680
+ return "".concat(prefixCls2, " ").concat(prefixCls2, "-").concat(direction, " ").concat(prefixCls2, "-").concat(location);
37666
37681
  };
37667
- var getRootPosition = function() {
37682
+ var getPopoverPosition = function() {
37668
37683
  var _popoverContentRef_current, _popoverContentRef_current1;
37669
37684
  var styles = {};
37670
- if (!rootPosition) return {};
37671
- var contentWidth = (_popoverContentRef_current = popoverContentRef.current) === null || _popoverContentRef_current === void 0 ? void 0 : _popoverContentRef_current.clientWidth;
37672
- var contentHeight = (_popoverContentRef_current1 = popoverContentRef.current) === null || _popoverContentRef_current1 === void 0 ? void 0 : _popoverContentRef_current1.clientHeight;
37673
- var width2 = rootPosition.width, height2 = rootPosition.height, left = rootPosition.left, top = rootPosition.top, right = rootPosition.right;
37685
+ if (!wrapperPosition) {
37686
+ styles.visibility = "hidden";
37687
+ return styles;
37688
+ }
37689
+ var popWidth = (_popoverContentRef_current = popoverContentRef.current) === null || _popoverContentRef_current === void 0 ? void 0 : _popoverContentRef_current.clientWidth;
37690
+ var popHeight = (_popoverContentRef_current1 = popoverContentRef.current) === null || _popoverContentRef_current1 === void 0 ? void 0 : _popoverContentRef_current1.clientHeight;
37691
+ var width2 = wrapperPosition.width, height2 = wrapperPosition.height, left = wrapperPosition.left, top = wrapperPosition.top, right = wrapperPosition.right;
37674
37692
  var direction = location.split("-")[0];
37675
37693
  var skew = location.split("-")[1];
37676
37694
  var cross = 0;
@@ -37686,15 +37704,15 @@ Please add \`${key2}Action\` when creating your handler.`);
37686
37704
  "bottom",
37687
37705
  "top"
37688
37706
  ].includes(direction)) {
37689
- var h = direction === "bottom" ? height2 + cross : -(contentHeight + cross);
37707
+ var h = direction === "bottom" ? height2 + cross : -(popHeight + cross);
37690
37708
  styles.top = "".concat(top + h, "px");
37691
37709
  if (!skew) {
37692
- styles[dir] = "".concat(-(contentWidth - width2) / 2 + rootPosition[dir] + parallel, "px");
37710
+ styles[dir] = "".concat(-(popWidth - width2) / 2 + wrapperPosition[dir] + parallel, "px");
37693
37711
  }
37694
- if (skew === "start") {
37712
+ if (skew === "left") {
37695
37713
  styles.left = "".concat(left + parallel, "px");
37696
37714
  }
37697
- if (skew === "end") {
37715
+ if (skew === "right") {
37698
37716
  styles.left = "".concat(right + parallel, "px");
37699
37717
  }
37700
37718
  }
@@ -37702,22 +37720,23 @@ Please add \`${key2}Action\` when creating your handler.`);
37702
37720
  "left",
37703
37721
  "right"
37704
37722
  ].includes(direction)) {
37705
- var contentW = direction === "left" ? -(contentWidth + cross) : width2 + cross;
37723
+ var contentW = direction === "left" ? -(popWidth + cross) : width2 + cross;
37706
37724
  styles.left = "".concat(left + contentW, "px");
37707
37725
  if (!skew) {
37708
- styles.top = "".concat(top - contentHeight / 2 + height2 / 2 - 4 + parallel, "px");
37726
+ styles.top = "".concat(top - popHeight / 2 + height2 / 2 - 4 + parallel, "px");
37709
37727
  }
37710
- if (skew === "start") {
37728
+ if (skew === "top") {
37711
37729
  styles.top = "".concat(top + parallel, "px");
37712
37730
  }
37713
- if (skew === "end") {
37731
+ if (skew === "bottom") {
37714
37732
  styles.top = "".concat(top + height2 + parallel, "px");
37715
37733
  }
37716
37734
  }
37717
37735
  }
37736
+ styles.visibility = popWidth === 0 ? "hidden" : "initial";
37718
37737
  return styles;
37719
37738
  };
37720
- var arrowStyle = function() {
37739
+ var popoverArrowStyle = function() {
37721
37740
  var styles = {};
37722
37741
  var direction = location.split("-")[0];
37723
37742
  var skew = location.split("-")[1];
@@ -37732,10 +37751,10 @@ Please add \`${key2}Action\` when creating your handler.`);
37732
37751
  if (!skew) {
37733
37752
  styles[dir] = "calc(50% + ".concat(arrowOffset, "px)");
37734
37753
  }
37735
- if (skew === "start") {
37754
+ if (skew === "left") {
37736
37755
  styles[dir] = "".concat(base + arrowOffset, "px");
37737
37756
  }
37738
- if (skew === "end") {
37757
+ if (skew === "right") {
37739
37758
  styles[dir2] = "".concat(base - arrowOffset, "px");
37740
37759
  }
37741
37760
  }
@@ -37746,10 +37765,10 @@ Please add \`${key2}Action\` when creating your handler.`);
37746
37765
  if (!skew) {
37747
37766
  styles.top = "calc(50% - ".concat(arrowOffset, "px)");
37748
37767
  }
37749
- if (skew === "start") {
37768
+ if (skew === "top") {
37750
37769
  styles.top = "".concat(base - arrowOffset, "px");
37751
37770
  }
37752
- if (skew === "end") {
37771
+ if (skew === "bottom") {
37753
37772
  styles.bottom = "".concat(base + arrowOffset, "px");
37754
37773
  }
37755
37774
  }
@@ -37758,28 +37777,28 @@ Please add \`${key2}Action\` when creating your handler.`);
37758
37777
  };
37759
37778
  var handleSelect = function(item, index2) {
37760
37779
  if (!item.disabled) {
37761
- onSelect && onSelect(item, index2);
37780
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(item, index2);
37762
37781
  }
37763
37782
  if (closeOnActionClick) {
37764
- onClick && onClick();
37765
- onClose && onClose();
37783
+ onClick === null || onClick === void 0 ? void 0 : onClick();
37784
+ onClose === null || onClose === void 0 ? void 0 : onClose();
37766
37785
  }
37767
37786
  };
37768
37787
  return /* @__PURE__ */ React.createElement(React.Fragment, null, !targetId && /* @__PURE__ */ React.createElement("div", {
37769
37788
  className: "nut-popover-wrapper",
37770
37789
  ref: popoverRef,
37771
37790
  onClick: function() {
37772
- onClick && onClick();
37791
+ onClick === null || onClick === void 0 ? void 0 : onClick();
37773
37792
  if (!visible) {
37774
- onOpen && onOpen();
37793
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
37775
37794
  } else {
37776
- onClose && onClose();
37795
+ onClose === null || onClose === void 0 ? void 0 : onClose();
37777
37796
  }
37778
37797
  },
37779
37798
  style
37780
37799
  }, Array.isArray(children) ? children[0] : children), /* @__PURE__ */ ReactDOM.createPortal(/* @__PURE__ */ React.createElement("div", {
37781
37800
  className: classes,
37782
- style: getRootPosition()
37801
+ style: _object_spread({}, getPopoverPosition(), style)
37783
37802
  }, /* @__PURE__ */ React.createElement(Popup, _object_spread({
37784
37803
  className: "nut-popover-content nut-popover-content-".concat(location),
37785
37804
  visible: showPopup,
@@ -37791,29 +37810,30 @@ Please add \`${key2}Action\` when creating your handler.`);
37791
37810
  ref: popoverContentRef
37792
37811
  }, showArrow && /* @__PURE__ */ React.createElement("div", {
37793
37812
  className: popoverArrow(),
37794
- style: arrowStyle()
37813
+ style: popoverArrowStyle()
37795
37814
  }, /* @__PURE__ */ React.createElement(i$1, {
37796
37815
  width: 8,
37797
37816
  height: 4
37798
37817
  })), Array.isArray(children) ? children[1] : null, list.map(function(item, index2) {
37818
+ var _item_action;
37799
37819
  return /* @__PURE__ */ React.createElement("div", {
37800
37820
  className: classNames({
37801
- "nut-popover-menu-item": true,
37802
- "nut-popover-menu-disabled": item.disabled
37821
+ "nut-popover-item": true,
37822
+ "nut-popover-item-disabled": item.disabled
37803
37823
  }, item.className),
37804
37824
  key: item.key || index2,
37805
37825
  onClick: function() {
37806
37826
  return handleSelect(item, index2);
37807
37827
  }
37808
37828
  }, item.icon && /* @__PURE__ */ React.createElement("div", {
37809
- className: "nut-popover-menu-item-icon"
37829
+ className: "nut-popover-item-icon"
37810
37830
  }, item.icon), /* @__PURE__ */ React.createElement("div", {
37811
- className: "nut-popover-menu-item-name"
37812
- }, item.name), item.action && item.action.icon && /* @__PURE__ */ React.createElement("div", {
37813
- className: "nut-popover-menu-item-action-icon",
37831
+ className: "nut-popover-item-name"
37832
+ }, item.name), ((_item_action = item.action) === null || _item_action === void 0 ? void 0 : _item_action.icon) && /* @__PURE__ */ React.createElement("div", {
37833
+ className: "nut-popover-item-action-icon",
37814
37834
  onClick: function(e2) {
37815
- var _item_action_onClick, _item_action;
37816
- return (_item_action = item.action) === null || _item_action === void 0 ? void 0 : (_item_action_onClick = _item_action.onClick) === null || _item_action_onClick === void 0 ? void 0 : _item_action_onClick.call(_item_action, e2);
37835
+ var _item_action_onClick, _item_action2;
37836
+ return (_item_action2 = item.action) === null || _item_action2 === void 0 ? void 0 : (_item_action_onClick = _item_action2.onClick) === null || _item_action_onClick === void 0 ? void 0 : _item_action_onClick.call(_item_action2, e2);
37817
37837
  }
37818
37838
  }, item.action.icon));
37819
37839
  })))), document.body));
@@ -38141,212 +38161,83 @@ Please add \`${key2}Action\` when creating your handler.`);
38141
38161
  })) : null, children);
38142
38162
  };
38143
38163
  ResultPage.displayName = "NutResultPage";
38144
- var AvatarContext = React.createContext({});
38145
38164
  var defaultProps$y = _object_spread_props(_object_spread({}, ComponentDefaults), {
38146
- maxContent: "",
38147
- max: "",
38148
- maxBackground: "#eee",
38149
- maxColor: "#666",
38150
- gap: "-8",
38151
- level: "left"
38165
+ rows: 1,
38166
+ animated: true,
38167
+ visible: false,
38168
+ size: "normal",
38169
+ shape: "round",
38170
+ duration: 0.6,
38171
+ inline: false
38152
38172
  });
38153
- var classPrefix$a = "nut-avatar-group";
38154
- var AvatarGroup = function(props) {
38155
- var propAvatarGroup = _object_spread({}, defaultProps$y, props);
38156
- var className = propAvatarGroup.className, style = propAvatarGroup.style, children = propAvatarGroup.children;
38157
- var avatarGroupRef = React.useRef(null);
38158
- var cls = classNames(classPrefix$a, className);
38159
- var parentAvatar = {
38160
- propAvatarGroup,
38161
- avatarGroupRef
38162
- };
38163
- return /* @__PURE__ */ React.createElement(AvatarContext.Provider, {
38164
- value: parentAvatar
38165
- }, /* @__PURE__ */ React.createElement("div", {
38166
- className: cls,
38167
- style,
38168
- ref: avatarGroupRef
38169
- }, children));
38170
- };
38171
- AvatarGroup.displayName = "NutAvatarGroup";
38172
- var defaultProps$x = _object_spread_props(_object_spread({}, ComponentDefaults), {
38173
- size: "",
38174
- shape: "round",
38175
- icon: "",
38176
- background: "#eee",
38177
- color: "#666",
38178
- fit: "cover",
38179
- src: "",
38180
- alt: ""
38181
- });
38182
- var classPrefix$9 = "nut-avatar";
38183
- var Avatar = function(props) {
38184
- var _ref = _object_spread({}, defaultProps$x, props), children = _ref.children, size = _ref.size, shape = _ref.shape, background = _ref.background, color = _ref.color, src = _ref.src, alt = _ref.alt, icon = _ref.icon, fit = _ref.fit, className = _ref.className, style = _ref.style, onClick = _ref.onClick, onError = _ref.onError, rest = _object_without_properties(_ref, [
38185
- "children",
38186
- "size",
38187
- "shape",
38188
- "background",
38189
- "color",
38190
- "src",
38191
- "alt",
38192
- "icon",
38193
- "fit",
38194
- "className",
38195
- "style",
38196
- "onClick",
38197
- "onError"
38198
- ]);
38199
- var _useState = _sliced_to_array(React.useState(0), 2), maxSum = _useState[0], setMaxSum = _useState[1];
38200
- var _useState1 = _sliced_to_array(React.useState(false), 2), showMax = _useState1[0], setShowMax = _useState1[1];
38201
- var _useState2 = _sliced_to_array(React.useState(1), 2), avatarIndex = _useState2[0], setAvatarIndex = _useState2[1];
38202
- var avatarRef = React.useRef(null);
38203
- var parent2 = React.useContext(AvatarContext);
38204
- var sizeValue = [
38205
- "large",
38206
- "normal",
38207
- "small"
38208
- ];
38209
- var propAvatarGroup = parent2.propAvatarGroup, avatarGroupRef = parent2.avatarGroupRef;
38210
- var _obj;
38211
- var classes = classNames((_obj = {}, _define_property(_obj, "nut-avatar-".concat((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.size) || size || "normal"), true), _define_property(_obj, "nut-avatar-".concat((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.shape) || shape), true), _define_property(_obj, "nut-avatar-".concat((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.size) || size || "normal", "-round"), shape === "round" && true), _obj));
38212
- var cls = classNames(classPrefix$9, classes, className);
38213
- var styles = _object_spread({
38214
- width: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
38215
- height: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
38216
- backgroundColor: "".concat(background),
38217
- color,
38218
- marginLeft: avatarIndex !== 1 && (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap) ? "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap, "px") : "",
38219
- zIndex: (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.level) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
38220
- }, style);
38221
- var maxStyles = {
38222
- backgroundColor: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxBackground),
38223
- color: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxColor)
38224
- };
38225
- var avatarLength = React.useCallback(function(children2) {
38226
- var _avatarRef_current_dataset, _avatarRef_current;
38227
- for (var i2 = 0; i2 < children2.length; i2++) {
38228
- if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
38229
- children2[i2].setAttribute("data-index", i2 + 1);
38230
- }
38231
- }
38232
- var index2 = Number(avatarRef === null || avatarRef === void 0 ? void 0 : (_avatarRef_current = avatarRef.current) === null || _avatarRef_current === void 0 ? void 0 : (_avatarRef_current_dataset = _avatarRef_current.dataset) === null || _avatarRef_current_dataset === void 0 ? void 0 : _avatarRef_current_dataset.index);
38233
- var maxCount = (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || children2.length;
38234
- setMaxSum(children2.length);
38235
- setAvatarIndex(index2);
38236
- if (index2 === children2.length && index2 !== maxCount && children2.length > maxCount) {
38237
- setShowMax(true);
38238
- }
38239
- }, [
38240
- propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max
38241
- ]);
38242
- React.useEffect(function() {
38243
- var avatarChildren = avatarGroupRef === null || avatarGroupRef === void 0 ? void 0 : avatarGroupRef.current.children;
38244
- if (avatarChildren) {
38245
- avatarLength(avatarChildren);
38246
- }
38247
- }, [
38248
- avatarLength,
38249
- avatarGroupRef
38250
- ]);
38251
- var errorEvent = function() {
38252
- onError && onError();
38173
+ var Skeleton = function(props) {
38174
+ var shapeStyle = function shapeStyle2() {
38175
+ if (shape === "circle") return {
38176
+ borderRadius: "50%"
38177
+ };
38178
+ if (shape === "square") return {
38179
+ borderRadius: "0"
38180
+ };
38181
+ return {};
38253
38182
  };
38254
- var clickAvatar = function(e2) {
38255
- onClick && onClick(e2);
38183
+ var durationStyle = function durationStyle2() {
38184
+ if (typeof duration !== "undefined") return {
38185
+ animationDuration: "".concat(duration, "s")
38186
+ };
38187
+ return {};
38256
38188
  };
38257
- return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement("div", _object_spread_props(_object_spread({
38258
- className: cls
38259
- }, rest), {
38260
- style: !showMax ? styles : maxStyles,
38261
- onClick: clickAvatar,
38262
- ref: avatarRef
38263
- }), (!(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(React.Fragment, null, src && /* @__PURE__ */ React.createElement(Image$1, {
38264
- className: "nut-avatar-img",
38265
- src,
38266
- alt,
38267
- style: {
38268
- objectFit: fit
38269
- },
38270
- onError: errorEvent
38271
- }), /* @__PURE__ */ React.isValidElement(icon) ? /* @__PURE__ */ React.cloneElement(icon, _object_spread_props(_object_spread({}, icon.props), {
38272
- className: "".concat(icon.props.className || "", " nut-avatar-icon")
38273
- })) : null, children && /* @__PURE__ */ React.createElement("span", {
38274
- className: "nut-avatar-text"
38275
- }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(m, {
38276
- className: "nut-avatar-icon"
38277
- })), showMax && /* @__PURE__ */ React.createElement("div", {
38278
- className: "nut-avatar-text"
38279
- }, (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxContent) ? propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxContent : "+ ".concat(avatarIndex - Number((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || 0)))));
38280
- };
38281
- Avatar.displayName = "NutAvatar";
38282
- Avatar.Group = AvatarGroup;
38283
- var defaultProps$w = _object_spread_props(_object_spread({}, ComponentDefaults), {
38284
- rows: 1,
38285
- animated: false,
38286
- title: false,
38287
- avatar: false,
38288
- avatarSize: "50px",
38289
- visible: false,
38290
- avatarShape: "round"
38291
- });
38292
- var Skeleton = function(props) {
38293
- var _ref = _object_spread({}, defaultProps$w, props), className = _ref.className, animated2 = _ref.animated, rows = _ref.rows, title = _ref.title, avatar = _ref.avatar, avatarSize = _ref.avatarSize, visible = _ref.visible, children = _ref.children, avatarShape = _ref.avatarShape, rest = _object_without_properties(_ref, [
38189
+ var _ref = _object_spread({}, defaultProps$y, props), className = _ref.className, width2 = _ref.width, height2 = _ref.height, shape = _ref.shape, animated2 = _ref.animated, rows = _ref.rows, visible = _ref.visible, size = _ref.size, duration = _ref.duration, children = _ref.children, rest = _object_without_properties(_ref, [
38294
38190
  "className",
38191
+ "width",
38192
+ "height",
38193
+ "shape",
38295
38194
  "animated",
38296
38195
  "rows",
38297
- "title",
38298
- "avatar",
38299
- "avatarSize",
38300
38196
  "visible",
38301
- "children",
38302
- "avatarShape"
38197
+ "size",
38198
+ "duration",
38199
+ "children"
38303
38200
  ]);
38304
38201
  var classPrefix2 = "nut-skeleton";
38305
38202
  var classes = classNames(classPrefix2, className);
38306
- var _obj;
38307
- var avatarClass = classNames((_obj = {}, _define_property(_obj, "nut-avatar", true), _define_property(_obj, "nut-skeleton-content-avatar", true), _define_property(_obj, "avatar-".concat(avatarShape), avatarShape), _obj));
38308
- var repeatLines = function(num) {
38203
+ var repeatCount = function(num) {
38309
38204
  return Array.from({
38310
38205
  length: num
38311
38206
  }, function(v, i2) {
38312
38207
  return i2;
38313
38208
  });
38314
38209
  };
38315
- var getStyle = function() {
38316
- if (avatarSize) {
38317
- return {
38318
- width: avatarSize,
38319
- height: avatarSize
38320
- };
38321
- }
38322
- return {
38323
- width: "50px",
38324
- height: "50px"
38325
- };
38210
+ var _useState = _sliced_to_array(React.useState(false), 2), animate = _useState[0], setAnimate = _useState[1];
38211
+ var playAnimation = function() {
38212
+ setAnimate(false);
38213
+ setTimeout(function() {
38214
+ setAnimate(true);
38215
+ }, 10);
38326
38216
  };
38327
- return /* @__PURE__ */ React.createElement(React.Fragment, null, visible ? /* @__PURE__ */ React.createElement(React.Fragment, null, children) : /* @__PURE__ */ React.createElement("div", _object_spread({
38217
+ React.useEffect(function() {
38218
+ if (!animated2) return;
38219
+ playAnimation();
38220
+ var intervalId = setInterval(playAnimation, 1e3 + duration * 1e3);
38221
+ return function() {
38222
+ return clearInterval(intervalId);
38223
+ };
38224
+ }, []);
38225
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, visible ? children : /* @__PURE__ */ React.createElement("div", _object_spread({
38328
38226
  className: classes
38329
- }, rest), animated2 && /* @__PURE__ */ React.createElement("div", {
38330
- className: "".concat(classPrefix2, "-animation")
38331
- }), /* @__PURE__ */ React.createElement("div", {
38332
- className: "".concat(classPrefix2, "-content")
38333
- }, avatar && /* @__PURE__ */ React.createElement(Avatar, {
38334
- className: avatarClass,
38335
- shape: avatarShape,
38336
- style: getStyle(),
38337
- icon: "null"
38338
- }), rows === 1 ? /* @__PURE__ */ React.createElement("div", {
38339
- className: "".concat(classPrefix2, "-content-block")
38340
- }) : /* @__PURE__ */ React.createElement("div", {
38341
- className: "".concat(classPrefix2, "-content-line")
38342
- }, title && /* @__PURE__ */ React.createElement("div", {
38343
- className: "".concat(classPrefix2, "-content-title")
38344
- }), repeatLines(rows).map(function(item, index2) {
38227
+ }, rest), repeatCount(rows).map(function(item, index2) {
38228
+ var contentClass = "".concat(classPrefix2, "-content ").concat(classPrefix2, "-content-").concat(size, " ").concat(classPrefix2, "-content-").concat(size, "-").concat(index2);
38345
38229
  return /* @__PURE__ */ React.createElement("div", {
38346
- className: "".concat(classPrefix2, "-content-block"),
38347
- key: index2
38348
- });
38349
- })))));
38230
+ className: "".concat(contentClass),
38231
+ key: index2,
38232
+ style: _object_spread({
38233
+ width: width2,
38234
+ height: height2
38235
+ }, shapeStyle())
38236
+ }, animated2 && /* @__PURE__ */ React.createElement("div", {
38237
+ className: "".concat(classPrefix2, "-animated ").concat(animate ? "".concat(classPrefix2, "-animation") : ""),
38238
+ style: durationStyle()
38239
+ }));
38240
+ })));
38350
38241
  };
38351
38242
  Skeleton.displayName = "NutSkeleton";
38352
38243
  function preventDefault(event, isStopPropagation) {
@@ -38357,13 +38248,13 @@ Please add \`${key2}Action\` when creating your handler.`);
38357
38248
  event.stopPropagation();
38358
38249
  }
38359
38250
  }
38360
- var defaultProps$v = {
38251
+ var defaultProps$x = {
38361
38252
  name: ""
38362
38253
  };
38363
38254
  var Swipe = /* @__PURE__ */ React.forwardRef(function(props, instanceRef) {
38364
38255
  var classPrefix2 = "nut-swipe";
38365
38256
  var touch = useTouch();
38366
- var _$_object_spread = _object_spread({}, defaultProps$v, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style;
38257
+ var _$_object_spread = _object_spread({}, defaultProps$x, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style;
38367
38258
  var root2 = React.useRef();
38368
38259
  var opened = React.useRef(false);
38369
38260
  var lockClick = React.useRef(false);
@@ -38563,7 +38454,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38563
38454
  }, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef)));
38564
38455
  });
38565
38456
  Swipe.displayName = "NutSwipe";
38566
- var classPrefix$8 = "nut-toast";
38457
+ var classPrefix$a = "nut-toast";
38567
38458
  var Notification = /* @__PURE__ */ function(_superClass) {
38568
38459
  _inherits(Notification2, _superClass);
38569
38460
  function Notification2(props) {
@@ -38640,7 +38531,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38640
38531
  })
38641
38532
  }[icon];
38642
38533
  return /* @__PURE__ */ React__namespace.createElement("p", {
38643
- className: "".concat(classPrefix$8, "-icon-wrapper")
38534
+ className: "".concat(classPrefix$a, "-icon-wrapper")
38644
38535
  }, iconNode);
38645
38536
  }
38646
38537
  return icon;
@@ -38671,22 +38562,22 @@ Please add \`${key2}Action\` when creating your handler.`);
38671
38562
  visible: show2,
38672
38563
  style,
38673
38564
  zIndex,
38674
- className: "".concat(classPrefix$8, "-overlay-default ").concat(className),
38565
+ className: "".concat(classPrefix$a, "-overlay-default ").concat(className),
38675
38566
  onClick: function() {
38676
38567
  return _this.clickCover();
38677
38568
  },
38678
38569
  closeOnOverlayClick,
38679
38570
  lockScroll
38680
38571
  }, /* @__PURE__ */ React__namespace.createElement("div", {
38681
- className: "".concat(classPrefix$8, " ").concat(classes),
38572
+ className: "".concat(classPrefix$a, " ").concat(classes),
38682
38573
  id: "toast-".concat(id)
38683
38574
  }, /* @__PURE__ */ React__namespace.createElement("div", {
38684
- className: classNames("".concat(classPrefix$8, "-inner"), "".concat(classPrefix$8, "-").concat(position2), contentClassName, "".concat(classPrefix$8, "-inner-").concat(size), "".concat(classPrefix$8, "-inner-").concat(wordBreak), _define_property({}, "".concat(classPrefix$8, "-inner-descrption"), content2)),
38575
+ className: classNames("".concat(classPrefix$a, "-inner"), "".concat(classPrefix$a, "-").concat(position2), contentClassName, "".concat(classPrefix$a, "-inner-").concat(size), "".concat(classPrefix$a, "-inner-").concat(wordBreak), _define_property({}, "".concat(classPrefix$a, "-inner-descrption"), content2)),
38685
38576
  style: _object_spread({}, contentStyle)
38686
38577
  }, this.renderIcon(), title && /* @__PURE__ */ React__namespace.createElement("div", {
38687
- className: "".concat(classPrefix$8, "-title")
38578
+ className: "".concat(classPrefix$a, "-title")
38688
38579
  }, title), content2 && /* @__PURE__ */ React__namespace.createElement("span", {
38689
- className: "".concat(classPrefix$8, "-text")
38580
+ className: "".concat(classPrefix$a, "-text")
38690
38581
  }, content2))));
38691
38582
  }
38692
38583
  }
@@ -38719,7 +38610,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38719
38610
  })), element);
38720
38611
  };
38721
38612
  var messageInstance = null;
38722
- var defaultProps$u = _object_spread_props(_object_spread({}, defaultOverlayProps), {
38613
+ var defaultProps$w = _object_spread_props(_object_spread({}, defaultOverlayProps), {
38723
38614
  id: "",
38724
38615
  position: "middle",
38725
38616
  title: "",
@@ -38753,7 +38644,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38753
38644
  opts2.onClose && opts2.onClose();
38754
38645
  }
38755
38646
  }
38756
- var opts22 = _object_spread_props(_object_spread({}, defaultProps$u, opts2), {
38647
+ var opts22 = _object_spread_props(_object_spread({}, defaultProps$w, opts2), {
38757
38648
  onClose: close
38758
38649
  });
38759
38650
  getInstance(opts22, function(notification) {
@@ -38776,7 +38667,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38776
38667
  return notice(_object_spread({}, option));
38777
38668
  }
38778
38669
  function config(config2) {
38779
- defaultProps$u = _object_spread({}, defaultProps$u, config2);
38670
+ defaultProps$w = _object_spread({}, defaultProps$w, config2);
38780
38671
  }
38781
38672
  const Toast = {
38782
38673
  show,
@@ -38788,16 +38679,16 @@ Please add \`${key2}Action\` when creating your handler.`);
38788
38679
  }
38789
38680
  }
38790
38681
  };
38791
- var defaultProps$t = _object_spread_props(_object_spread({}, ComponentDefaults), {
38682
+ var defaultProps$v = _object_spread_props(_object_spread({}, ComponentDefaults), {
38792
38683
  type: "shake",
38793
38684
  action: "initial",
38794
38685
  loop: false,
38795
38686
  onClick: function(event) {
38796
38687
  }
38797
38688
  });
38798
- var classPrefix$7 = "nut-animate";
38689
+ var classPrefix$9 = "nut-animate";
38799
38690
  var Animate = function(props) {
38800
- var _ref = _object_spread({}, defaultProps$t, props), className = _ref.className, type2 = _ref.type, action = _ref.action, loop2 = _ref.loop, onClick = _ref.onClick, children = _ref.children, rest = _object_without_properties(_ref, [
38691
+ var _ref = _object_spread({}, defaultProps$v, props), className = _ref.className, type2 = _ref.type, action = _ref.action, loop2 = _ref.loop, onClick = _ref.onClick, children = _ref.children, rest = _object_without_properties(_ref, [
38801
38692
  "className",
38802
38693
  "type",
38803
38694
  "action",
@@ -38809,7 +38700,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38809
38700
  var _obj;
38810
38701
  var classes = classNames((_obj = {
38811
38702
  "nut-ani-container": true
38812
- }, _define_property(_obj, "".concat(classPrefix$7, "-").concat(type2), action === "initial" || clicked), _define_property(_obj, "loop", loop2), _obj), className);
38703
+ }, _define_property(_obj, "".concat(classPrefix$9, "-").concat(type2), action === "initial" || clicked), _define_property(_obj, "loop", loop2), _obj), className);
38813
38704
  var handleClick = function(event) {
38814
38705
  setClicked(true);
38815
38706
  if (!loop2) {
@@ -38827,7 +38718,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38827
38718
  }, rest), children));
38828
38719
  };
38829
38720
  Animate.displayName = "NutAnimate";
38830
- var defaultProps$s = _object_spread_props(_object_spread({}, ComponentDefaults), {
38721
+ var defaultProps$u = _object_spread_props(_object_spread({}, ComponentDefaults), {
38831
38722
  length: 0,
38832
38723
  value: "",
38833
38724
  delay: 300,
@@ -38835,7 +38726,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38835
38726
  thousands: false
38836
38727
  });
38837
38728
  var CountUp = function(props) {
38838
- var _mergeProps = mergeProps(defaultProps$s, props), length2 = _mergeProps.length, value2 = _mergeProps.value, delay = _mergeProps.delay, duration = _mergeProps.duration, className = _mergeProps.className, thousands = _mergeProps.thousands;
38729
+ var _mergeProps = mergeProps(defaultProps$u, props), length2 = _mergeProps.length, value2 = _mergeProps.value, delay = _mergeProps.delay, duration = _mergeProps.duration, className = _mergeProps.className, thousands = _mergeProps.thousands;
38839
38730
  _mergeProps.style;
38840
38731
  _object_without_properties(_mergeProps, [
38841
38732
  "length",
@@ -38922,7 +38813,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38922
38813
  })));
38923
38814
  };
38924
38815
  CountUp.displayName = "NutCountUp";
38925
- var defaultProps$r = {};
38816
+ var defaultProps$t = {};
38926
38817
  var AnimatingNumbers = /* @__PURE__ */ function(Component) {
38927
38818
  _inherits(AnimatingNumbers2, Component);
38928
38819
  function AnimatingNumbers2(props) {
@@ -38946,11 +38837,11 @@ Please add \`${key2}Action\` when creating your handler.`);
38946
38837
  ]);
38947
38838
  return AnimatingNumbers2;
38948
38839
  }(React.Component);
38949
- _define_property(AnimatingNumbers, "defaultProps", defaultProps$r);
38840
+ _define_property(AnimatingNumbers, "defaultProps", defaultProps$t);
38950
38841
  _define_property(AnimatingNumbers, "displayName", "NutAnimatingNumbers");
38951
38842
  _define_property(AnimatingNumbers, "CountUp", CountUp);
38952
38843
  AnimatingNumbers.CountUp = CountUp;
38953
- var defaultProps$q = _object_spread_props(_object_spread({}, ComponentDefaults), {
38844
+ var defaultProps$s = _object_spread_props(_object_spread({}, ComponentDefaults), {
38954
38845
  src: "",
38955
38846
  muted: false,
38956
38847
  autoPlay: false,
@@ -38980,7 +38871,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38980
38871
  }
38981
38872
  };
38982
38873
  var locale = useConfig().locale;
38983
- var _ref = _object_spread({}, defaultProps$q, props), className = _ref.className, src = _ref.src, style = _ref.style, muted = _ref.muted, autoPlay = _ref.autoPlay, loop2 = _ref.loop, preload = _ref.preload, type2 = _ref.type, onBack = _ref.onBack, onForward = _ref.onForward, onPause = _ref.onPause, onEnd = _ref.onEnd, onMute = _ref.onMute, onCanPlay = _ref.onCanPlay, children = _ref.children, rest = _object_without_properties(_ref, [
38874
+ var _ref = _object_spread({}, defaultProps$s, props), className = _ref.className, src = _ref.src, style = _ref.style, muted = _ref.muted, autoPlay = _ref.autoPlay, loop2 = _ref.loop, preload = _ref.preload, type2 = _ref.type, onBack = _ref.onBack, onForward = _ref.onForward, onPause = _ref.onPause, onEnd = _ref.onEnd, onMute = _ref.onMute, onCanPlay = _ref.onCanPlay, children = _ref.children, rest = _object_without_properties(_ref, [
38984
38875
  "className",
38985
38876
  "src",
38986
38877
  "style",
@@ -39188,6 +39079,145 @@ Please add \`${key2}Action\` when creating your handler.`);
39188
39079
  })));
39189
39080
  };
39190
39081
  Audio.displayName = "NutAudio";
39082
+ var AvatarContext = React.createContext({});
39083
+ var defaultProps$r = _object_spread_props(_object_spread({}, ComponentDefaults), {
39084
+ maxContent: "",
39085
+ max: "",
39086
+ maxBackground: "#eee",
39087
+ maxColor: "#666",
39088
+ gap: "-8",
39089
+ level: "left"
39090
+ });
39091
+ var classPrefix$8 = "nut-avatar-group";
39092
+ var AvatarGroup = function(props) {
39093
+ var propAvatarGroup = _object_spread({}, defaultProps$r, props);
39094
+ var className = propAvatarGroup.className, style = propAvatarGroup.style, children = propAvatarGroup.children;
39095
+ var avatarGroupRef = React.useRef(null);
39096
+ var cls = classNames(classPrefix$8, className);
39097
+ var parentAvatar = {
39098
+ propAvatarGroup,
39099
+ avatarGroupRef
39100
+ };
39101
+ return /* @__PURE__ */ React.createElement(AvatarContext.Provider, {
39102
+ value: parentAvatar
39103
+ }, /* @__PURE__ */ React.createElement("div", {
39104
+ className: cls,
39105
+ style,
39106
+ ref: avatarGroupRef
39107
+ }, children));
39108
+ };
39109
+ AvatarGroup.displayName = "NutAvatarGroup";
39110
+ var defaultProps$q = _object_spread_props(_object_spread({}, ComponentDefaults), {
39111
+ size: "",
39112
+ shape: "round",
39113
+ icon: "",
39114
+ background: "#eee",
39115
+ color: "#666",
39116
+ fit: "cover",
39117
+ src: "",
39118
+ alt: ""
39119
+ });
39120
+ var classPrefix$7 = "nut-avatar";
39121
+ var Avatar = function(props) {
39122
+ var _ref = _object_spread({}, defaultProps$q, props), children = _ref.children, size = _ref.size, shape = _ref.shape, background = _ref.background, color = _ref.color, src = _ref.src, alt = _ref.alt, icon = _ref.icon, fit = _ref.fit, className = _ref.className, style = _ref.style, onClick = _ref.onClick, onError = _ref.onError, rest = _object_without_properties(_ref, [
39123
+ "children",
39124
+ "size",
39125
+ "shape",
39126
+ "background",
39127
+ "color",
39128
+ "src",
39129
+ "alt",
39130
+ "icon",
39131
+ "fit",
39132
+ "className",
39133
+ "style",
39134
+ "onClick",
39135
+ "onError"
39136
+ ]);
39137
+ var _useState = _sliced_to_array(React.useState(0), 2), maxSum = _useState[0], setMaxSum = _useState[1];
39138
+ var _useState1 = _sliced_to_array(React.useState(false), 2), showMax = _useState1[0], setShowMax = _useState1[1];
39139
+ var _useState2 = _sliced_to_array(React.useState(1), 2), avatarIndex = _useState2[0], setAvatarIndex = _useState2[1];
39140
+ var avatarRef = React.useRef(null);
39141
+ var parent2 = React.useContext(AvatarContext);
39142
+ var sizeValue = [
39143
+ "large",
39144
+ "normal",
39145
+ "small"
39146
+ ];
39147
+ var propAvatarGroup = parent2.propAvatarGroup, avatarGroupRef = parent2.avatarGroupRef;
39148
+ var _obj;
39149
+ var classes = classNames((_obj = {}, _define_property(_obj, "nut-avatar-".concat((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.size) || size || "normal"), true), _define_property(_obj, "nut-avatar-".concat((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.shape) || shape), true), _define_property(_obj, "nut-avatar-".concat((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.size) || size || "normal", "-round"), shape === "round" && true), _obj));
39150
+ var cls = classNames(classPrefix$7, classes, className);
39151
+ var styles = _object_spread({
39152
+ width: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
39153
+ height: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
39154
+ backgroundColor: "".concat(background),
39155
+ color,
39156
+ marginLeft: avatarIndex !== 1 && (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap) ? "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap, "px") : "",
39157
+ zIndex: (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.level) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
39158
+ }, style);
39159
+ var maxStyles = {
39160
+ backgroundColor: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxBackground),
39161
+ color: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxColor)
39162
+ };
39163
+ var avatarLength = React.useCallback(function(children2) {
39164
+ var _avatarRef_current_dataset, _avatarRef_current;
39165
+ for (var i2 = 0; i2 < children2.length; i2++) {
39166
+ if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
39167
+ children2[i2].setAttribute("data-index", i2 + 1);
39168
+ }
39169
+ }
39170
+ var index2 = Number(avatarRef === null || avatarRef === void 0 ? void 0 : (_avatarRef_current = avatarRef.current) === null || _avatarRef_current === void 0 ? void 0 : (_avatarRef_current_dataset = _avatarRef_current.dataset) === null || _avatarRef_current_dataset === void 0 ? void 0 : _avatarRef_current_dataset.index);
39171
+ var maxCount = (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || children2.length;
39172
+ setMaxSum(children2.length);
39173
+ setAvatarIndex(index2);
39174
+ if (index2 === children2.length && index2 !== maxCount && children2.length > maxCount) {
39175
+ setShowMax(true);
39176
+ }
39177
+ }, [
39178
+ propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max
39179
+ ]);
39180
+ React.useEffect(function() {
39181
+ var avatarChildren = avatarGroupRef === null || avatarGroupRef === void 0 ? void 0 : avatarGroupRef.current.children;
39182
+ if (avatarChildren) {
39183
+ avatarLength(avatarChildren);
39184
+ }
39185
+ }, [
39186
+ avatarLength,
39187
+ avatarGroupRef
39188
+ ]);
39189
+ var errorEvent = function() {
39190
+ onError && onError();
39191
+ };
39192
+ var clickAvatar = function(e2) {
39193
+ onClick && onClick(e2);
39194
+ };
39195
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement("div", _object_spread_props(_object_spread({
39196
+ className: cls
39197
+ }, rest), {
39198
+ style: !showMax ? styles : maxStyles,
39199
+ onClick: clickAvatar,
39200
+ ref: avatarRef
39201
+ }), (!(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(React.Fragment, null, src && /* @__PURE__ */ React.createElement(Image$1, {
39202
+ className: "nut-avatar-img",
39203
+ src,
39204
+ alt,
39205
+ style: {
39206
+ objectFit: fit
39207
+ },
39208
+ onError: errorEvent
39209
+ }), /* @__PURE__ */ React.isValidElement(icon) ? /* @__PURE__ */ React.cloneElement(icon, _object_spread_props(_object_spread({}, icon.props), {
39210
+ className: "".concat(icon.props.className || "", " nut-avatar-icon")
39211
+ })) : null, children && /* @__PURE__ */ React.createElement("span", {
39212
+ className: "nut-avatar-text"
39213
+ }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(m, {
39214
+ className: "nut-avatar-icon"
39215
+ })), showMax && /* @__PURE__ */ React.createElement("div", {
39216
+ className: "nut-avatar-text"
39217
+ }, (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxContent) ? propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxContent : "+ ".concat(avatarIndex - Number((propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || 0)))));
39218
+ };
39219
+ Avatar.displayName = "NutAvatar";
39220
+ Avatar.Group = AvatarGroup;
39191
39221
  var defaultProps$p = _object_spread_props(_object_spread({}, ComponentDefaults), {
39192
39222
  strokeWidth: 5,
39193
39223
  radius: 50,
@@ -39339,57 +39369,50 @@ Please add \`${key2}Action\` when creating your handler.`);
39339
39369
  expanded,
39340
39370
  rotate
39341
39371
  ]);
39342
- var handleClick = function() {
39343
- if (!disabled) {
39344
- context2.updateValue(name2);
39345
- }
39346
- };
39347
- var onTransitionEnd = function() {
39348
- if (expanded) {
39349
- if (wrapperRef.current) {
39350
- wrapperRef.current.style.height = "";
39351
- }
39352
- }
39353
- };
39354
- var getOffsetHeight = function() {
39355
- var _contentRef_current;
39356
- var height2 = (_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.offsetHeight;
39357
- return height2 ? "".concat(height2, "px") : "";
39358
- };
39359
- var toggle = function() {
39360
- var start2 = expanded ? "0px" : getOffsetHeight();
39361
- if (wrapperRef.current) {
39362
- wrapperRef.current.style.height = start2;
39363
- }
39364
- requestAnimationFrame(function() {
39365
- requestAnimationFrame(function() {
39366
- var end = expanded ? getOffsetHeight() : "0px";
39367
- if (wrapperRef.current) {
39368
- wrapperRef.current.style.height = end;
39369
- }
39372
+ var _useState = _sliced_to_array(React.useState(0), 2), tran = _useState[0], setTran = _useState[1];
39373
+ var _useRefState = _sliced_to_array(useRefState(0), 2), currentHeight = _useRefState[0], setCurrentHeight = _useRefState[1];
39374
+ var _useState1 = _sliced_to_array(React.useState(0), 2), wrapperHeight = _useState1[0], setWrapperHeight = _useState1[1];
39375
+ var updateRectHeight = /* @__PURE__ */ function() {
39376
+ var _ref2 = _async_to_generator(function() {
39377
+ var height2;
39378
+ return __generator(this, function(_state) {
39379
+ height2 = contentRef.current.offsetHeight;
39380
+ setCurrentHeight(height2);
39381
+ setWrapperHeight(expanded ? height2 : 0);
39382
+ setTimeout(function() {
39383
+ setTran(1);
39384
+ });
39385
+ return [
39386
+ 2
39387
+ ];
39370
39388
  });
39371
39389
  });
39372
- };
39373
- var init = React.useRef(true);
39390
+ return function updateRectHeight2() {
39391
+ return _ref2.apply(this, arguments);
39392
+ };
39393
+ }();
39374
39394
  React.useEffect(function() {
39375
- if (init.current) {
39376
- init.current = false;
39377
- if (!expanded) {
39378
- wrapperRef.current.style.height = "0px";
39379
- }
39380
- } else {
39381
- toggle();
39382
- }
39395
+ updateRectHeight();
39383
39396
  }, [
39397
+ children,
39384
39398
  expanded
39385
39399
  ]);
39400
+ var toggle = function() {
39401
+ var end = !expanded ? currentHeight.current : 0;
39402
+ setWrapperHeight(end);
39403
+ };
39404
+ var handleClick = function() {
39405
+ if (!disabled) {
39406
+ context2.updateValue(name2);
39407
+ toggle();
39408
+ }
39409
+ };
39410
+ var _obj;
39386
39411
  return /* @__PURE__ */ React.createElement("div", _object_spread({
39387
39412
  className: classNames(classPrefix2, className),
39388
39413
  style
39389
39414
  }, rest), /* @__PURE__ */ React.createElement("div", {
39390
- className: classNames("".concat(classPrefix2, "-header"), {
39391
- disabled
39392
- }),
39415
+ className: classNames("".concat(classPrefix2, "-header"), _define_property({}, "".concat(classPrefix2, "-header-disabled"), disabled)),
39393
39416
  onClick: handleClick
39394
39417
  }, /* @__PURE__ */ React.createElement("div", {
39395
39418
  className: "".concat(classPrefix2, "-title")
@@ -39401,13 +39424,17 @@ Please add \`${key2}Action\` when creating your handler.`);
39401
39424
  className: "".concat(classPrefix2, "-icon"),
39402
39425
  style: iconStyle
39403
39426
  }, expandIcon || context2.expandIcon))), /* @__PURE__ */ React.createElement("div", {
39404
- className: "".concat(classPrefix2, "-content"),
39405
- onTransitionEnd,
39427
+ className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-content-wrapper"), true), _define_property(_obj, "".concat(classPrefix2, "-content-wrapper-tran"), true), _obj)),
39428
+ style: tran ? {
39429
+ height: wrapperHeight
39430
+ } : {},
39406
39431
  ref: wrapperRef
39432
+ }, /* @__PURE__ */ React.createElement("div", {
39433
+ className: "".concat(classPrefix2, "-content")
39407
39434
  }, /* @__PURE__ */ React.createElement("div", {
39408
39435
  ref: contentRef,
39409
39436
  className: "".concat(classPrefix2, "-content-text")
39410
- }, children)));
39437
+ }, children))));
39411
39438
  };
39412
39439
  CollapseItem.displayName = "NutCollapseItem";
39413
39440
  var defaultProps$n = _object_spread_props(_object_spread({}, ComponentDefaults), {
@@ -39992,7 +40019,7 @@ Please add \`${key2}Action\` when creating your handler.`);
39992
40019
  var classPrefix$3 = "nut-indicator";
39993
40020
  var Indicator = function(props) {
39994
40021
  var maybeFixedWidth = function maybeFixedWidth2() {
39995
- if (total === 2 || type2 === "slide") {
40022
+ if (type2 === "dualScreen" || type2 === "slide") {
39996
40023
  return "".concat(classPrefix$3, "-fixed-width");
39997
40024
  }
39998
40025
  return "";
@@ -42813,6 +42840,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42813
42840
  exports.Video = Video;
42814
42841
  exports.VirtualList = VirtualList;
42815
42842
  exports.WaterMark = WaterMark;
42843
+ exports.destroyList = destroyList;
42816
42844
  exports.getDefaultConfig = getDefaultConfig;
42817
42845
  exports.setDefaultConfig = setDefaultConfig;
42818
42846
  exports.useConfig = useConfig;