@nutui/nutui-react 3.0.4 → 3.0.6

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 (126) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/cjs/packages/badge/badge.js +4 -3
  3. package/dist/cjs/packages/badge/style/badge.scss +7 -8
  4. package/dist/cjs/packages/badge/style/style.css +13 -15
  5. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  6. package/dist/cjs/packages/datepicker/style/style.css +3 -1
  7. package/dist/cjs/packages/datepickerview/style/style.css +3 -1
  8. package/dist/cjs/packages/empty/style/index.js +1 -0
  9. package/dist/cjs/packages/empty/style/style.css +389 -0
  10. package/dist/cjs/packages/fixednav/fixednav.js +3 -2
  11. package/dist/cjs/packages/fixednav/style/fixednav.scss +43 -39
  12. package/dist/cjs/packages/fixednav/style/style.css +56 -51
  13. package/dist/cjs/packages/imagepreview/imagepreview.js +49 -84
  14. package/dist/cjs/packages/imagepreview/style/imagepreview.scss +2 -1
  15. package/dist/cjs/packages/imagepreview/style/style.css +2 -1
  16. package/dist/cjs/packages/indicator/indicator.js +1 -1
  17. package/dist/cjs/packages/inputnumber/inputnumber.js +2 -2
  18. package/dist/cjs/packages/lottie/index.d.ts +1 -1
  19. package/dist/cjs/packages/lottie/index.js +2 -2
  20. package/dist/cjs/packages/notify/Notification.d.ts +3 -9
  21. package/dist/cjs/packages/notify/Notification.js +28 -8
  22. package/dist/cjs/packages/notify/notify.d.ts +0 -4
  23. package/dist/cjs/packages/notify/notify.js +6 -34
  24. package/dist/cjs/packages/notify/style/notify.scss +39 -36
  25. package/dist/cjs/packages/notify/style/style.css +36 -31
  26. package/dist/cjs/packages/nutui.react.d.ts +1 -0
  27. package/dist/cjs/packages/nutui.react.js +1 -0
  28. package/dist/cjs/packages/picker/style/style.css +3 -1
  29. package/dist/cjs/packages/pickerview/pickerroller.js +11 -6
  30. package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -1
  31. package/dist/cjs/packages/pickerview/style/style.css +3 -1
  32. package/dist/cjs/packages/resultpage/style/index.js +1 -0
  33. package/dist/cjs/packages/resultpage/style/style.css +389 -0
  34. package/dist/cjs/packages/skeleton/skeleton.js +64 -49
  35. package/dist/cjs/packages/skeleton/style/index.js +0 -1
  36. package/dist/cjs/packages/skeleton/style/skeleton.scss +40 -46
  37. package/dist/cjs/packages/skeleton/style/style.css +32 -175
  38. package/dist/cjs/packages/switch/style/style.css +5 -0
  39. package/dist/cjs/packages/switch/style/switch.scss +5 -0
  40. package/dist/cjs/packages/switch/switch.js +22 -11
  41. package/dist/cjs/packages/tabbar/style/style.css +58 -54
  42. package/dist/cjs/packages/tabbar/style/tabbar.scss +28 -19
  43. package/dist/cjs/packages/tabbar/tabbar.js +28 -10
  44. package/dist/cjs/packages/tabbaritem/style/style.css +34 -36
  45. package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
  46. package/dist/cjs/packages/tabbaritem/tabbaritem.js +34 -13
  47. package/dist/cjs/packages/toast/Notification.js +1 -1
  48. package/dist/cjs/types/spec/badge/base.d.ts +1 -0
  49. package/dist/cjs/types/spec/indicator/base.d.ts +1 -1
  50. package/dist/cjs/types/spec/notify/base.d.ts +7 -2
  51. package/dist/cjs/types/spec/searchbar/taro.d.ts +10 -7
  52. package/dist/cjs/types/spec/skeleton/base.d.ts +7 -5
  53. package/dist/cjs/types/spec/switch/base.d.ts +3 -2
  54. package/dist/cjs/types/spec/switch/h5.d.ts +1 -1
  55. package/dist/cjs/types/spec/switch/taro.d.ts +1 -4
  56. package/dist/cjs/types/spec/tabbar/base.d.ts +7 -4
  57. package/dist/es/packages/badge/badge.js +4 -3
  58. package/dist/es/packages/badge/style/badge.scss +7 -8
  59. package/dist/es/packages/badge/style/style.css +13 -15
  60. package/dist/es/packages/configprovider/types.d.ts +1 -1
  61. package/dist/es/packages/datepicker/style/style.css +3 -1
  62. package/dist/es/packages/datepickerview/style/style.css +3 -1
  63. package/dist/es/packages/empty/style/index.js +1 -0
  64. package/dist/es/packages/empty/style/style.css +389 -0
  65. package/dist/es/packages/fixednav/fixednav.js +3 -2
  66. package/dist/es/packages/fixednav/style/fixednav.scss +43 -39
  67. package/dist/es/packages/fixednav/style/style.css +56 -51
  68. package/dist/es/packages/imagepreview/imagepreview.js +49 -84
  69. package/dist/es/packages/imagepreview/style/imagepreview.scss +2 -1
  70. package/dist/es/packages/imagepreview/style/style.css +2 -1
  71. package/dist/es/packages/indicator/indicator.js +1 -1
  72. package/dist/es/packages/inputnumber/inputnumber.js +2 -2
  73. package/dist/es/packages/lottie/index.d.ts +1 -1
  74. package/dist/es/packages/lottie/index.js +1 -1
  75. package/dist/es/packages/notify/Notification.d.ts +3 -9
  76. package/dist/es/packages/notify/Notification.js +28 -8
  77. package/dist/es/packages/notify/notify.d.ts +0 -4
  78. package/dist/es/packages/notify/notify.js +6 -34
  79. package/dist/es/packages/notify/style/notify.scss +39 -36
  80. package/dist/es/packages/notify/style/style.css +36 -31
  81. package/dist/es/packages/picker/style/style.css +3 -1
  82. package/dist/es/packages/pickerview/pickerroller.js +10 -6
  83. package/dist/es/packages/pickerview/style/pickerview.scss +3 -1
  84. package/dist/es/packages/pickerview/style/style.css +3 -1
  85. package/dist/es/packages/resultpage/style/index.js +1 -0
  86. package/dist/es/packages/resultpage/style/style.css +389 -0
  87. package/dist/es/packages/skeleton/skeleton.js +63 -49
  88. package/dist/es/packages/skeleton/style/index.js +0 -1
  89. package/dist/es/packages/skeleton/style/skeleton.scss +40 -46
  90. package/dist/es/packages/skeleton/style/style.css +32 -175
  91. package/dist/es/packages/switch/style/style.css +5 -0
  92. package/dist/es/packages/switch/style/switch.scss +5 -0
  93. package/dist/es/packages/switch/switch.js +21 -11
  94. package/dist/es/packages/tabbar/style/style.css +58 -54
  95. package/dist/es/packages/tabbar/style/tabbar.scss +28 -19
  96. package/dist/es/packages/tabbar/tabbar.js +27 -10
  97. package/dist/es/packages/tabbaritem/style/style.css +34 -36
  98. package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
  99. package/dist/es/packages/tabbaritem/tabbaritem.js +34 -13
  100. package/dist/es/packages/toast/Notification.js +1 -1
  101. package/dist/es/types/spec/badge/base.d.ts +4 -0
  102. package/dist/es/types/spec/indicator/base.d.ts +1 -1
  103. package/dist/es/types/spec/notify/base.d.ts +22 -5
  104. package/dist/es/types/spec/searchbar/taro.d.ts +10 -7
  105. package/dist/es/types/spec/skeleton/base.d.ts +19 -14
  106. package/dist/es/types/spec/switch/base.d.ts +6 -2
  107. package/dist/es/types/spec/switch/h5.d.ts +1 -1
  108. package/dist/es/types/spec/switch/taro.d.ts +1 -4
  109. package/dist/es/types/spec/tabbar/base.d.ts +7 -4
  110. package/dist/nutui.react.umd.js +394 -373
  111. package/dist/style.css +1 -1
  112. package/dist/style.scss +49 -49
  113. package/dist/styles/theme-dark.scss +2 -0
  114. package/dist/styles/theme-default.scss +2 -0
  115. package/dist/styles/themes/dark.css +1 -1
  116. package/dist/styles/themes/default.css +1 -1
  117. package/dist/styles/themes/jmapp.css +1 -1
  118. package/dist/styles/themes/jrkf.css +1 -1
  119. package/dist/styles/variables-jmapp.scss +24 -1
  120. package/dist/styles/variables-jrkf.scss +24 -1
  121. package/dist/styles/variables.scss +37 -38
  122. package/package.json +1 -1
  123. /package/dist/cjs/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  124. /package/dist/cjs/packages/lottie/{web.js → lottie.js} +0 -0
  125. /package/dist/es/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  126. /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")
@@ -10048,7 +10049,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10048
10049
  var classPrefix2 = "nut-fixednav";
10049
10050
  var classes = classNames(classPrefix2, {
10050
10051
  active: visible
10051
- }, type2, className);
10052
+ }, "".concat(classPrefix2, "-").concat(type2), className);
10052
10053
  var renderListItem = function(item, index2) {
10053
10054
  return /* @__PURE__ */ React.createElement("div", {
10054
10055
  className: "".concat(classPrefix2, "-list-item"),
@@ -10058,7 +10059,8 @@ Please add \`${key2}Action\` when creating your handler.`);
10058
10059
  key: item.id || index2
10059
10060
  }, /* @__PURE__ */ React.isValidElement(item.icon) ? item.icon : /* @__PURE__ */ React.createElement("img", {
10060
10061
  src: item.icon,
10061
- alt: ""
10062
+ alt: "",
10063
+ className: "".concat(classPrefix2, "-list-image")
10062
10064
  }), /* @__PURE__ */ React.createElement("div", {
10063
10065
  className: "".concat(classPrefix2, "-list-text")
10064
10066
  }, item.text));
@@ -10370,11 +10372,12 @@ Please add \`${key2}Action\` when creating your handler.`);
10370
10372
  dot: false,
10371
10373
  max: 99,
10372
10374
  top: "0",
10373
- right: "0"
10375
+ right: "0",
10376
+ direction: "vertical"
10374
10377
  });
10375
10378
  var TabbarItem = function(props) {
10376
10379
  var ctx2 = React.useContext(TabbarContext);
10377
- 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, [
10378
10381
  "className",
10379
10382
  "style",
10380
10383
  "title",
@@ -10384,15 +10387,19 @@ Please add \`${key2}Action\` when creating your handler.`);
10384
10387
  "max",
10385
10388
  "top",
10386
10389
  "right",
10387
- "index"
10390
+ "index",
10391
+ "direction",
10392
+ "onActiveClick"
10388
10393
  ]);
10389
10394
  var active2 = index2 === (ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.selectIndex);
10390
10395
  var classPrefix2 = "nut-tabbar-item";
10391
- var tabbarItemClass = classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-active"), active2), className);
10392
- var boxPrefix = "".concat(classPrefix2, "-icon-box");
10393
- 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
+ };
10394
10401
  var badgeProps = {
10395
- value: value2,
10402
+ value: renderNodeWithActive(value2),
10396
10403
  dot,
10397
10404
  max,
10398
10405
  top,
@@ -10401,8 +10408,26 @@ Please add \`${key2}Action\` when creating your handler.`);
10401
10408
  };
10402
10409
  var renderTitleText = function() {
10403
10410
  return title && /* @__PURE__ */ React.createElement("div", {
10404
- className: titleClass
10405
- }, 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));
10406
10431
  };
10407
10432
  return /* @__PURE__ */ React.createElement("div", _object_spread({
10408
10433
  className: tabbarItemClass,
@@ -10410,23 +10435,22 @@ Please add \`${key2}Action\` when creating your handler.`);
10410
10435
  color: active2 ? ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.activeColor : ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.inactiveColor
10411
10436
  }, style),
10412
10437
  onClick: function() {
10413
- 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);
10414
10439
  }
10415
- }, rest), icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, badgeProps, /* @__PURE__ */ React.createElement("div", {
10416
- className: boxPrefix
10417
- }, icon)), renderTitleText()) : /* @__PURE__ */ React.createElement(Badge, badgeProps, renderTitleText()));
10440
+ }, rest), direction === "horizontal" && !dot ? renderDualItem() : /* @__PURE__ */ React.createElement(React.Fragment, null, icon && renderIconAndTitle(), !icon && renderTitle()));
10418
10441
  };
10419
10442
  var defaultProps$1f = _object_spread_props(_object_spread({}, ComponentDefaults), {
10420
10443
  defaultValue: 0,
10421
10444
  fixed: false,
10422
10445
  inactiveColor: "",
10423
10446
  activeColor: "",
10447
+ direction: "vertical",
10424
10448
  safeArea: false,
10425
- onSwitch: function(value2) {
10449
+ onSwitch: function() {
10426
10450
  }
10427
10451
  });
10428
10452
  var Tabbar = function(props) {
10429
- 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;
10430
10454
  var classPrefix2 = "nut-tabbar";
10431
10455
  var _usePropsValue = _sliced_to_array(usePropsValue({
10432
10456
  value: value2,
@@ -10434,11 +10458,26 @@ Please add \`${key2}Action\` when creating your handler.`);
10434
10458
  finalValue: 0,
10435
10459
  onChange: onSwitch
10436
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
+ ]);
10437
10476
  return /* @__PURE__ */ React.createElement("div", {
10438
10477
  className: classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-fixed"), fixed), className),
10439
10478
  style
10440
10479
  }, /* @__PURE__ */ React.createElement("div", {
10441
- className: "".concat(classPrefix2, "-wrap")
10480
+ className: "".concat(classPrefix2, "-wrap ").concat(sizeCls)
10442
10481
  }, /* @__PURE__ */ React.createElement(TabbarContext.Provider, {
10443
10482
  value: {
10444
10483
  selectIndex,
@@ -10447,12 +10486,12 @@ Please add \`${key2}Action\` when creating your handler.`);
10447
10486
  handleClick: setSelectIndex
10448
10487
  }
10449
10488
  }, React.Children.map(children, function(child, index2) {
10450
- if (!/* @__PURE__ */ React.isValidElement(child)) return null;
10451
- return /* @__PURE__ */ React.cloneElement(child, _object_spread_props(_object_spread({}, child.props), {
10452
- index: index2
10453
- }));
10454
- }))), (fixed || safeArea) && /* @__PURE__ */ React.createElement("div", {
10455
- 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"
10456
10495
  }));
10457
10496
  };
10458
10497
  Tabbar.displayName = "NutTabbar";
@@ -13381,12 +13420,13 @@ Please add \`${key2}Action\` when creating your handler.`);
13381
13420
  var _props_keyIndex = props.keyIndex, keyIndex = _props_keyIndex === void 0 ? 0 : _props_keyIndex, _props_options = props.options, options2 = _props_options === void 0 ? [] : _props_options, _props_threeDimensional = props.threeDimensional, threeDimensional = _props_threeDimensional === void 0 ? true : _props_threeDimensional, _props_duration = props.duration, duration = _props_duration === void 0 ? 1e3 : _props_duration, onSelect = props.onSelect, _props_renderLabel = props.renderLabel, renderLabel = _props_renderLabel === void 0 ? function(item) {
13382
13421
  return item.label;
13383
13422
  } : _props_renderLabel;
13423
+ var classPrefix2 = "nut-pickerview-roller";
13384
13424
  var DEFAULT_DURATION = 200;
13385
13425
  var INERTIA_TIME = 300;
13386
13426
  var INERTIA_DISTANCE = 15;
13387
13427
  var ROTATION = 20;
13388
13428
  var touch = useTouch();
13389
- var _useState = _sliced_to_array(React.useState(1), 2), currentIndex = _useState[0], setCurrentIndex = _useState[1];
13429
+ var _useState = _sliced_to_array(React.useState(0), 2), currentIndex = _useState[0], setCurrentIndex = _useState[1];
13390
13430
  var lineSpacing = React.useRef(36);
13391
13431
  var _useState1 = _sliced_to_array(React.useState(0), 2), touchTime = _useState1[0], setTouchTime = _useState1[1];
13392
13432
  var _useState2 = _sliced_to_array(React.useState("0deg"), 2), touchDeg = _useState2[0], setTouchDeg = _useState2[1];
@@ -13420,7 +13460,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13420
13460
  var deg1 = Math.min(Math.max(currentDeg, 0), (options2.length + 1) * ROTATION);
13421
13461
  if (deg1 >= 0 && deg1 < (options2.length + 1) * ROTATION) {
13422
13462
  applyTransform("", "".concat(deg1, "deg"), void 0, updatedMove);
13423
- setCurrentIndex(Math.abs(Math.round(updatedMove / lineSpacing.current)) + 1);
13463
+ deg1 > 0 && setCurrentIndex(Math.abs(Math.round(updatedMove / lineSpacing.current)) + 1);
13424
13464
  }
13425
13465
  }
13426
13466
  };
@@ -13461,7 +13501,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13461
13501
  var index2 = options2.findIndex(function(item) {
13462
13502
  return item.value === selectedValue;
13463
13503
  });
13464
- setCurrentIndex(index2 === -1 ? 1 : index2 + 1);
13504
+ setCurrentIndex(index2 === -1 ? 0 : index2 + 1);
13465
13505
  var move = index2 * lineSpacing.current;
13466
13506
  handleMove(-move);
13467
13507
  };
@@ -13519,21 +13559,22 @@ Please add \`${key2}Action\` when creating your handler.`);
13519
13559
  className: "nut-pickerview-list",
13520
13560
  ref: pickerRollerRef
13521
13561
  }, /* @__PURE__ */ React.createElement("div", {
13522
- className: "nut-pickerview-roller",
13562
+ className: classPrefix2,
13523
13563
  ref: rollerRef,
13524
13564
  style: threeDimensional ? touchRollerStyle() : touchTiledStyle(),
13525
13565
  onTransitionEnd: stopMomentumScroll
13526
13566
  }, threeDimensional && options2.map(function(item, index2) {
13527
13567
  var _item_value;
13568
+ var _obj;
13528
13569
  return /* @__PURE__ */ React.createElement("div", {
13529
- className: "nut-pickerview-roller-item ".concat(isItemHidden(index2 + 1) && "nut-pickerview-roller-item-hidden"),
13570
+ className: classNames("".concat(classPrefix2, "-item"), (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-item-hidden"), isItemHidden(index2 + 1)), _define_property(_obj, "".concat(classPrefix2, "-item-active"), index2 + 1 === currentIndex), _obj)),
13530
13571
  style: rollerStyle(index2),
13531
13572
  key: (_item_value = item.value) !== null && _item_value !== void 0 ? _item_value : index2
13532
13573
  }, renderLabel(item));
13533
13574
  }), !threeDimensional && options2.map(function(item, index2) {
13534
13575
  var _item_value;
13535
13576
  return /* @__PURE__ */ React.createElement("div", {
13536
- className: "nut-pickerview-roller-item-tiled",
13577
+ className: classNames("".concat(classPrefix2, "-item-tiled"), _define_property({}, "".concat(classPrefix2, "-item-active"), index2 + 1 === currentIndex)),
13537
13578
  key: (_item_value = item.value) !== null && _item_value !== void 0 ? _item_value : index2
13538
13579
  }, renderLabel(item));
13539
13580
  })));
@@ -16577,7 +16618,7 @@ Please add \`${key2}Action\` when creating your handler.`);
16577
16618
  className: "".concat(classPrefix$h, "-minus"),
16578
16619
  onClick: handleReduce
16579
16620
  }, /* @__PURE__ */ React.createElement(i, {
16580
- className: classNames("".concat(classPrefix$h, "-icon ").concat(classPrefix$h, "-icon-minus"), _define_property({}, "".concat(classPrefix$h, "-icon-disabled"), shadowValue === min || disabled))
16621
+ className: classNames("".concat(classPrefix$h, "-icon ").concat(classPrefix$h, "-icon-minus"), _define_property({}, "".concat(classPrefix$h, "-icon-disabled"), Number(shadowValue) <= Number(min) || disabled))
16581
16622
  })), /* @__PURE__ */ React.createElement("input", {
16582
16623
  className: classNames("".concat(classPrefix$h, "-input"), _define_property({}, "".concat(classPrefix$h, "-input-disabled"), disabled)),
16583
16624
  ref: inputRef,
@@ -16592,7 +16633,7 @@ Please add \`${key2}Action\` when creating your handler.`);
16592
16633
  className: "".concat(classPrefix$h, "-add"),
16593
16634
  onClick: handlePlus
16594
16635
  }, /* @__PURE__ */ React.createElement(d$2, {
16595
- className: classNames("".concat(classPrefix$h, "-icon ").concat(classPrefix$h, "-icon-plus"), _define_property({}, "".concat(classPrefix$h, "-icon-disabled"), shadowValue === max || disabled))
16636
+ className: classNames("".concat(classPrefix$h, "-icon ").concat(classPrefix$h, "-icon-plus"), _define_property({}, "".concat(classPrefix$h, "-icon-disabled"), Number(shadowValue) >= Number(max) || disabled))
16596
16637
  })));
16597
16638
  };
16598
16639
  InputNumber.displayName = "NutInputNumber";
@@ -18431,15 +18472,19 @@ Please add \`${key2}Action\` when creating your handler.`);
18431
18472
  var defaultProps$M = _object_spread_props(_object_spread({}, ComponentDefaults), {
18432
18473
  disabled: false,
18433
18474
  activeText: "",
18434
- inactiveText: ""
18475
+ inactiveText: "",
18476
+ loadingIcon: /* @__PURE__ */ React.createElement(d$3, null)
18435
18477
  });
18436
18478
  var Switch = function(props) {
18437
- 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;
18480
+ _ref.onChange;
18481
+ var rest = _object_without_properties(_ref, [
18438
18482
  "checked",
18439
18483
  "defaultChecked",
18440
18484
  "disabled",
18441
18485
  "activeText",
18442
18486
  "inactiveText",
18487
+ "loadingIcon",
18443
18488
  "className",
18444
18489
  "style",
18445
18490
  "onChange"
@@ -18450,6 +18495,12 @@ Please add \`${key2}Action\` when creating your handler.`);
18450
18495
  value: checked,
18451
18496
  defaultValue: defaultChecked
18452
18497
  }), 2), value2 = _usePropsValue[0], setValue = _usePropsValue[1];
18498
+ React.useEffect(function() {
18499
+ changing && setChanging(false);
18500
+ }, [
18501
+ value2
18502
+ ]);
18503
+ var _useState = _sliced_to_array(React.useState(false), 2), changing = _useState[0], setChanging = _useState[1];
18453
18504
  var classes = function() {
18454
18505
  var _obj2;
18455
18506
  return classNames([
@@ -18458,17 +18509,18 @@ Please add \`${key2}Action\` when creating your handler.`);
18458
18509
  (_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)
18459
18510
  ]);
18460
18511
  };
18461
- var onClick = function(event) {
18462
- if (disabled) return;
18463
- onChange && onChange(!value2, event);
18512
+ var onClick = function() {
18513
+ if (disabled || changing) return;
18514
+ if (props.onChange) {
18515
+ setChanging(true);
18516
+ props.onChange(!value2);
18517
+ }
18464
18518
  setValue(!value2);
18465
18519
  };
18466
18520
  var _obj, _obj1;
18467
18521
  return /* @__PURE__ */ React.createElement("div", _object_spread({
18468
18522
  className: classes(),
18469
- onClick: function(e2) {
18470
- return onClick(e2);
18471
- },
18523
+ onClick,
18472
18524
  style
18473
18525
  }, rest), /* @__PURE__ */ React.createElement("div", {
18474
18526
  className: classNames([
@@ -18480,9 +18532,9 @@ Please add \`${key2}Action\` when creating your handler.`);
18480
18532
  ],
18481
18533
  (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-button-open-rtl"), rtl && value2), _define_property(_obj, "".concat(classPrefix2, "-button-close-rtl"), rtl && !value2), _obj)
18482
18534
  ])
18483
- }, !value2 && !activeText && /* @__PURE__ */ React.createElement("div", {
18535
+ }, changing && loadingIcon ? /* @__PURE__ */ React.createElement(React.Fragment, null, loadingIcon) : /* @__PURE__ */ React.createElement(React.Fragment, null, !value2 && !activeText && /* @__PURE__ */ React.createElement("div", {
18484
18536
  className: "".concat(classPrefix2, "-close-line")
18485
- })), activeText && /* @__PURE__ */ React.createElement("div", {
18537
+ }))), activeText && /* @__PURE__ */ React.createElement("div", {
18486
18538
  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))
18487
18539
  }, value2 ? activeText : inactiveText));
18488
18540
  };
@@ -37363,6 +37415,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37363
37415
  {
37364
37416
  key: "close",
37365
37417
  value: function close() {
37418
+ var _this_props;
37366
37419
  this.setState({
37367
37420
  show: false
37368
37421
  });
@@ -37371,7 +37424,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37371
37424
  var element = document.getElementById(this.props.id);
37372
37425
  element && element.parentNode && element.parentNode.removeChild(element);
37373
37426
  }
37374
- this.props.onClose();
37427
+ (_this_props = this.props) === null || _this_props === void 0 ? void 0 : _this_props.onClose();
37375
37428
  }
37376
37429
  },
37377
37430
  {
@@ -37416,22 +37469,40 @@ Please add \`${key2}Action\` when creating your handler.`);
37416
37469
  {
37417
37470
  key: "render",
37418
37471
  value: function render2() {
37419
- 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;
37472
+ 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;
37420
37473
  var show2 = this.state.show;
37474
+ var classes = classNames(classPrefix$c, className);
37475
+ var getDistance = function() {
37476
+ if (position2 === "top") {
37477
+ return {
37478
+ top: "".concat(distance + navHeight, "px")
37479
+ };
37480
+ }
37481
+ return {
37482
+ bottom: "".concat(distance, "px")
37483
+ };
37484
+ };
37421
37485
  var _obj;
37422
- 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));
37423
37486
  return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(CSSTransition, {
37424
37487
  in: show2,
37425
37488
  timeout: 300,
37426
37489
  classNames: "fade",
37427
37490
  unmountOnExit: true,
37428
37491
  appear: true,
37429
- position: position2
37492
+ position: position2,
37493
+ id
37430
37494
  }, /* @__PURE__ */ React__namespace.createElement("div", {
37431
- className: "".concat(classes, " ").concat(className),
37432
- style,
37495
+ className: classes,
37496
+ style: _object_spread({}, style, getDistance()),
37433
37497
  onClick: this.clickCover
37434
- }, message)));
37498
+ }, leftIcon ? /* @__PURE__ */ React__namespace.createElement("div", {
37499
+ className: "".concat(classPrefix$c, "-left-icon")
37500
+ }, leftIcon) : null, /* @__PURE__ */ React__namespace.createElement("div", {
37501
+ 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))
37502
+ }, message), rightIcon || closeable ? /* @__PURE__ */ React__namespace.createElement("div", {
37503
+ className: "".concat(classPrefix$c, "-right-icon"),
37504
+ onClick: this.close
37505
+ }, rightIcon || (closeable ? /* @__PURE__ */ React__namespace.createElement(n$6, null) : null)) : null)));
37435
37506
  }
37436
37507
  }
37437
37508
  ]);
@@ -37455,7 +37526,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37455
37526
  });
37456
37527
  };
37457
37528
  var element = document.createElement("div");
37458
- var id = properties.id ? properties.id : "".concat((/* @__PURE__ */ new Date()).getTime());
37529
+ var id = properties.id ? properties.id : "".concat(Date.now());
37459
37530
  element.id = id;
37460
37531
  properties.id = id;
37461
37532
  document.body.appendChild(element);
@@ -37467,9 +37538,13 @@ Please add \`${key2}Action\` when creating your handler.`);
37467
37538
  var messageInstance$1 = null;
37468
37539
  var options = _object_spread_props(_object_spread({}, ComponentDefaults), {
37469
37540
  id: "",
37470
- duration: 3e3,
37471
- type: "danger",
37472
37541
  position: "top",
37542
+ distance: 8,
37543
+ navHeight: 57,
37544
+ closeable: false,
37545
+ leftIcon: null,
37546
+ rightIcon: null,
37547
+ duration: 3e3,
37473
37548
  onClose: function() {
37474
37549
  },
37475
37550
  onClick: function() {
@@ -37504,38 +37579,6 @@ Please add \`${key2}Action\` when creating your handler.`);
37504
37579
  type: "base"
37505
37580
  }, option));
37506
37581
  },
37507
- success: function success(message) {
37508
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37509
- errorMsg$1(message);
37510
- return notice$1(_object_spread({
37511
- message,
37512
- type: "success"
37513
- }, option));
37514
- },
37515
- primary: function primary(message) {
37516
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37517
- errorMsg$1(message);
37518
- return notice$1(_object_spread({
37519
- message,
37520
- type: "primary"
37521
- }, option));
37522
- },
37523
- danger: function danger(message) {
37524
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37525
- errorMsg$1(message);
37526
- return notice$1(_object_spread({
37527
- message,
37528
- type: "danger"
37529
- }, option));
37530
- },
37531
- warn: function warn(message) {
37532
- var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37533
- errorMsg$1(message);
37534
- return notice$1(_object_spread({
37535
- message,
37536
- type: "warning"
37537
- }, option));
37538
- },
37539
37582
  hide: function hide() {
37540
37583
  if (messageInstance$1) {
37541
37584
  messageInstance$1.destroy();
@@ -38138,212 +38181,83 @@ Please add \`${key2}Action\` when creating your handler.`);
38138
38181
  })) : null, children);
38139
38182
  };
38140
38183
  ResultPage.displayName = "NutResultPage";
38141
- var AvatarContext = React.createContext({});
38142
38184
  var defaultProps$y = _object_spread_props(_object_spread({}, ComponentDefaults), {
38143
- maxContent: "",
38144
- max: "",
38145
- maxBackground: "#eee",
38146
- maxColor: "#666",
38147
- gap: "-8",
38148
- level: "left"
38149
- });
38150
- var classPrefix$a = "nut-avatar-group";
38151
- var AvatarGroup = function(props) {
38152
- var propAvatarGroup = _object_spread({}, defaultProps$y, props);
38153
- var className = propAvatarGroup.className, style = propAvatarGroup.style, children = propAvatarGroup.children;
38154
- var avatarGroupRef = React.useRef(null);
38155
- var cls = classNames(classPrefix$a, className);
38156
- var parentAvatar = {
38157
- propAvatarGroup,
38158
- avatarGroupRef
38159
- };
38160
- return /* @__PURE__ */ React.createElement(AvatarContext.Provider, {
38161
- value: parentAvatar
38162
- }, /* @__PURE__ */ React.createElement("div", {
38163
- className: cls,
38164
- style,
38165
- ref: avatarGroupRef
38166
- }, children));
38167
- };
38168
- AvatarGroup.displayName = "NutAvatarGroup";
38169
- var defaultProps$x = _object_spread_props(_object_spread({}, ComponentDefaults), {
38170
- size: "",
38171
- shape: "round",
38172
- icon: "",
38173
- background: "#eee",
38174
- color: "#666",
38175
- fit: "cover",
38176
- src: "",
38177
- alt: ""
38178
- });
38179
- var classPrefix$9 = "nut-avatar";
38180
- var Avatar = function(props) {
38181
- 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, [
38182
- "children",
38183
- "size",
38184
- "shape",
38185
- "background",
38186
- "color",
38187
- "src",
38188
- "alt",
38189
- "icon",
38190
- "fit",
38191
- "className",
38192
- "style",
38193
- "onClick",
38194
- "onError"
38195
- ]);
38196
- var _useState = _sliced_to_array(React.useState(0), 2), maxSum = _useState[0], setMaxSum = _useState[1];
38197
- var _useState1 = _sliced_to_array(React.useState(false), 2), showMax = _useState1[0], setShowMax = _useState1[1];
38198
- var _useState2 = _sliced_to_array(React.useState(1), 2), avatarIndex = _useState2[0], setAvatarIndex = _useState2[1];
38199
- var avatarRef = React.useRef(null);
38200
- var parent2 = React.useContext(AvatarContext);
38201
- var sizeValue = [
38202
- "large",
38203
- "normal",
38204
- "small"
38205
- ];
38206
- var propAvatarGroup = parent2.propAvatarGroup, avatarGroupRef = parent2.avatarGroupRef;
38207
- var _obj;
38208
- 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));
38209
- var cls = classNames(classPrefix$9, classes, className);
38210
- var styles = _object_spread({
38211
- width: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
38212
- height: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
38213
- backgroundColor: "".concat(background),
38214
- color,
38215
- marginLeft: avatarIndex !== 1 && (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap) ? "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap, "px") : "",
38216
- zIndex: (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.level) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
38217
- }, style);
38218
- var maxStyles = {
38219
- backgroundColor: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxBackground),
38220
- color: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxColor)
38221
- };
38222
- var avatarLength = React.useCallback(function(children2) {
38223
- var _avatarRef_current_dataset, _avatarRef_current;
38224
- for (var i2 = 0; i2 < children2.length; i2++) {
38225
- if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
38226
- children2[i2].setAttribute("data-index", i2 + 1);
38227
- }
38228
- }
38229
- 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);
38230
- var maxCount = (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || children2.length;
38231
- setMaxSum(children2.length);
38232
- setAvatarIndex(index2);
38233
- if (index2 === children2.length && index2 !== maxCount && children2.length > maxCount) {
38234
- setShowMax(true);
38235
- }
38236
- }, [
38237
- propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max
38238
- ]);
38239
- React.useEffect(function() {
38240
- var avatarChildren = avatarGroupRef === null || avatarGroupRef === void 0 ? void 0 : avatarGroupRef.current.children;
38241
- if (avatarChildren) {
38242
- avatarLength(avatarChildren);
38243
- }
38244
- }, [
38245
- avatarLength,
38246
- avatarGroupRef
38247
- ]);
38248
- var errorEvent = function() {
38249
- onError && onError();
38250
- };
38251
- var clickAvatar = function(e2) {
38252
- onClick && onClick(e2);
38253
- };
38254
- 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({
38255
- className: cls
38256
- }, rest), {
38257
- style: !showMax ? styles : maxStyles,
38258
- onClick: clickAvatar,
38259
- ref: avatarRef
38260
- }), (!(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, {
38261
- className: "nut-avatar-img",
38262
- src,
38263
- alt,
38264
- style: {
38265
- objectFit: fit
38266
- },
38267
- onError: errorEvent
38268
- }), /* @__PURE__ */ React.isValidElement(icon) ? /* @__PURE__ */ React.cloneElement(icon, _object_spread_props(_object_spread({}, icon.props), {
38269
- className: "".concat(icon.props.className || "", " nut-avatar-icon")
38270
- })) : null, children && /* @__PURE__ */ React.createElement("span", {
38271
- className: "nut-avatar-text"
38272
- }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(m, {
38273
- className: "nut-avatar-icon"
38274
- })), showMax && /* @__PURE__ */ React.createElement("div", {
38275
- className: "nut-avatar-text"
38276
- }, (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)))));
38277
- };
38278
- Avatar.displayName = "NutAvatar";
38279
- Avatar.Group = AvatarGroup;
38280
- var defaultProps$w = _object_spread_props(_object_spread({}, ComponentDefaults), {
38281
38185
  rows: 1,
38282
- animated: false,
38283
- title: false,
38284
- avatar: false,
38285
- avatarSize: "50px",
38186
+ animated: true,
38286
38187
  visible: false,
38287
- avatarShape: "round"
38188
+ size: "normal",
38189
+ shape: "round",
38190
+ duration: 0.6,
38191
+ inline: false
38288
38192
  });
38289
38193
  var Skeleton = function(props) {
38290
- 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, [
38194
+ var shapeStyle = function shapeStyle2() {
38195
+ if (shape === "circle") return {
38196
+ borderRadius: "50%"
38197
+ };
38198
+ if (shape === "square") return {
38199
+ borderRadius: "0"
38200
+ };
38201
+ return {};
38202
+ };
38203
+ var durationStyle = function durationStyle2() {
38204
+ if (typeof duration !== "undefined") return {
38205
+ animationDuration: "".concat(duration, "s")
38206
+ };
38207
+ return {};
38208
+ };
38209
+ 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, [
38291
38210
  "className",
38211
+ "width",
38212
+ "height",
38213
+ "shape",
38292
38214
  "animated",
38293
38215
  "rows",
38294
- "title",
38295
- "avatar",
38296
- "avatarSize",
38297
38216
  "visible",
38298
- "children",
38299
- "avatarShape"
38217
+ "size",
38218
+ "duration",
38219
+ "children"
38300
38220
  ]);
38301
38221
  var classPrefix2 = "nut-skeleton";
38302
38222
  var classes = classNames(classPrefix2, className);
38303
- var _obj;
38304
- 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));
38305
- var repeatLines = function(num) {
38223
+ var repeatCount = function(num) {
38306
38224
  return Array.from({
38307
38225
  length: num
38308
38226
  }, function(v, i2) {
38309
38227
  return i2;
38310
38228
  });
38311
38229
  };
38312
- var getStyle = function() {
38313
- if (avatarSize) {
38314
- return {
38315
- width: avatarSize,
38316
- height: avatarSize
38317
- };
38318
- }
38319
- return {
38320
- width: "50px",
38321
- height: "50px"
38322
- };
38230
+ var _useState = _sliced_to_array(React.useState(false), 2), animate = _useState[0], setAnimate = _useState[1];
38231
+ var playAnimation = function() {
38232
+ setAnimate(false);
38233
+ setTimeout(function() {
38234
+ setAnimate(true);
38235
+ }, 10);
38323
38236
  };
38324
- return /* @__PURE__ */ React.createElement(React.Fragment, null, visible ? /* @__PURE__ */ React.createElement(React.Fragment, null, children) : /* @__PURE__ */ React.createElement("div", _object_spread({
38237
+ React.useEffect(function() {
38238
+ if (!animated2) return;
38239
+ playAnimation();
38240
+ var intervalId = setInterval(playAnimation, 1e3 + duration * 1e3);
38241
+ return function() {
38242
+ return clearInterval(intervalId);
38243
+ };
38244
+ }, []);
38245
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, visible ? children : /* @__PURE__ */ React.createElement("div", _object_spread({
38325
38246
  className: classes
38326
- }, rest), animated2 && /* @__PURE__ */ React.createElement("div", {
38327
- className: "".concat(classPrefix2, "-animation")
38328
- }), /* @__PURE__ */ React.createElement("div", {
38329
- className: "".concat(classPrefix2, "-content")
38330
- }, avatar && /* @__PURE__ */ React.createElement(Avatar, {
38331
- className: avatarClass,
38332
- shape: avatarShape,
38333
- style: getStyle(),
38334
- icon: "null"
38335
- }), rows === 1 ? /* @__PURE__ */ React.createElement("div", {
38336
- className: "".concat(classPrefix2, "-content-block")
38337
- }) : /* @__PURE__ */ React.createElement("div", {
38338
- className: "".concat(classPrefix2, "-content-line")
38339
- }, title && /* @__PURE__ */ React.createElement("div", {
38340
- className: "".concat(classPrefix2, "-content-title")
38341
- }), repeatLines(rows).map(function(item, index2) {
38247
+ }, rest), repeatCount(rows).map(function(item, index2) {
38248
+ var contentClass = "".concat(classPrefix2, "-content ").concat(classPrefix2, "-content-").concat(size, " ").concat(classPrefix2, "-content-").concat(size, "-").concat(index2);
38342
38249
  return /* @__PURE__ */ React.createElement("div", {
38343
- className: "".concat(classPrefix2, "-content-block"),
38344
- key: index2
38345
- });
38346
- })))));
38250
+ className: "".concat(contentClass),
38251
+ key: index2,
38252
+ style: _object_spread({
38253
+ width: width2,
38254
+ height: height2
38255
+ }, shapeStyle())
38256
+ }, animated2 && /* @__PURE__ */ React.createElement("div", {
38257
+ className: "".concat(classPrefix2, "-animated ").concat(animate ? "".concat(classPrefix2, "-animation") : ""),
38258
+ style: durationStyle()
38259
+ }));
38260
+ })));
38347
38261
  };
38348
38262
  Skeleton.displayName = "NutSkeleton";
38349
38263
  function preventDefault(event, isStopPropagation) {
@@ -38354,13 +38268,13 @@ Please add \`${key2}Action\` when creating your handler.`);
38354
38268
  event.stopPropagation();
38355
38269
  }
38356
38270
  }
38357
- var defaultProps$v = {
38271
+ var defaultProps$x = {
38358
38272
  name: ""
38359
38273
  };
38360
38274
  var Swipe = /* @__PURE__ */ React.forwardRef(function(props, instanceRef) {
38361
38275
  var classPrefix2 = "nut-swipe";
38362
38276
  var touch = useTouch();
38363
- var _$_object_spread = _object_spread({}, defaultProps$v, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style;
38277
+ var _$_object_spread = _object_spread({}, defaultProps$x, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style;
38364
38278
  var root2 = React.useRef();
38365
38279
  var opened = React.useRef(false);
38366
38280
  var lockClick = React.useRef(false);
@@ -38560,7 +38474,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38560
38474
  }, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef)));
38561
38475
  });
38562
38476
  Swipe.displayName = "NutSwipe";
38563
- var classPrefix$8 = "nut-toast";
38477
+ var classPrefix$a = "nut-toast";
38564
38478
  var Notification = /* @__PURE__ */ function(_superClass) {
38565
38479
  _inherits(Notification2, _superClass);
38566
38480
  function Notification2(props) {
@@ -38637,7 +38551,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38637
38551
  })
38638
38552
  }[icon];
38639
38553
  return /* @__PURE__ */ React__namespace.createElement("p", {
38640
- className: "".concat(classPrefix$8, "-icon-wrapper")
38554
+ className: "".concat(classPrefix$a, "-icon-wrapper")
38641
38555
  }, iconNode);
38642
38556
  }
38643
38557
  return icon;
@@ -38668,22 +38582,22 @@ Please add \`${key2}Action\` when creating your handler.`);
38668
38582
  visible: show2,
38669
38583
  style,
38670
38584
  zIndex,
38671
- className: "".concat(classPrefix$8, "-overlay-default ").concat(className),
38585
+ className: "".concat(classPrefix$a, "-overlay-default ").concat(className),
38672
38586
  onClick: function() {
38673
38587
  return _this.clickCover();
38674
38588
  },
38675
38589
  closeOnOverlayClick,
38676
38590
  lockScroll
38677
38591
  }, /* @__PURE__ */ React__namespace.createElement("div", {
38678
- className: "".concat(classPrefix$8, " ").concat(classes),
38592
+ className: "".concat(classPrefix$a, " ").concat(classes),
38679
38593
  id: "toast-".concat(id)
38680
38594
  }, /* @__PURE__ */ React__namespace.createElement("div", {
38681
- 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)),
38595
+ 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)),
38682
38596
  style: _object_spread({}, contentStyle)
38683
38597
  }, this.renderIcon(), title && /* @__PURE__ */ React__namespace.createElement("div", {
38684
- className: "".concat(classPrefix$8, "-title")
38598
+ className: "".concat(classPrefix$a, "-title")
38685
38599
  }, title), content2 && /* @__PURE__ */ React__namespace.createElement("span", {
38686
- className: "".concat(classPrefix$8, "-text")
38600
+ className: "".concat(classPrefix$a, "-text")
38687
38601
  }, content2))));
38688
38602
  }
38689
38603
  }
@@ -38706,7 +38620,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38706
38620
  });
38707
38621
  };
38708
38622
  var element = document.createElement("div");
38709
- var id = properties.id ? properties.id : "".concat((/* @__PURE__ */ new Date()).getTime());
38623
+ var id = properties.id ? properties.id : "".concat(Date.now());
38710
38624
  element.id = id;
38711
38625
  properties.id = id;
38712
38626
  document.body.appendChild(element);
@@ -38716,7 +38630,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38716
38630
  })), element);
38717
38631
  };
38718
38632
  var messageInstance = null;
38719
- var defaultProps$u = _object_spread_props(_object_spread({}, defaultOverlayProps), {
38633
+ var defaultProps$w = _object_spread_props(_object_spread({}, defaultOverlayProps), {
38720
38634
  id: "",
38721
38635
  position: "middle",
38722
38636
  title: "",
@@ -38750,7 +38664,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38750
38664
  opts2.onClose && opts2.onClose();
38751
38665
  }
38752
38666
  }
38753
- var opts22 = _object_spread_props(_object_spread({}, defaultProps$u, opts2), {
38667
+ var opts22 = _object_spread_props(_object_spread({}, defaultProps$w, opts2), {
38754
38668
  onClose: close
38755
38669
  });
38756
38670
  getInstance(opts22, function(notification) {
@@ -38773,7 +38687,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38773
38687
  return notice(_object_spread({}, option));
38774
38688
  }
38775
38689
  function config(config2) {
38776
- defaultProps$u = _object_spread({}, defaultProps$u, config2);
38690
+ defaultProps$w = _object_spread({}, defaultProps$w, config2);
38777
38691
  }
38778
38692
  const Toast = {
38779
38693
  show,
@@ -38785,16 +38699,16 @@ Please add \`${key2}Action\` when creating your handler.`);
38785
38699
  }
38786
38700
  }
38787
38701
  };
38788
- var defaultProps$t = _object_spread_props(_object_spread({}, ComponentDefaults), {
38702
+ var defaultProps$v = _object_spread_props(_object_spread({}, ComponentDefaults), {
38789
38703
  type: "shake",
38790
38704
  action: "initial",
38791
38705
  loop: false,
38792
38706
  onClick: function(event) {
38793
38707
  }
38794
38708
  });
38795
- var classPrefix$7 = "nut-animate";
38709
+ var classPrefix$9 = "nut-animate";
38796
38710
  var Animate = function(props) {
38797
- 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, [
38711
+ 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, [
38798
38712
  "className",
38799
38713
  "type",
38800
38714
  "action",
@@ -38806,7 +38720,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38806
38720
  var _obj;
38807
38721
  var classes = classNames((_obj = {
38808
38722
  "nut-ani-container": true
38809
- }, _define_property(_obj, "".concat(classPrefix$7, "-").concat(type2), action === "initial" || clicked), _define_property(_obj, "loop", loop2), _obj), className);
38723
+ }, _define_property(_obj, "".concat(classPrefix$9, "-").concat(type2), action === "initial" || clicked), _define_property(_obj, "loop", loop2), _obj), className);
38810
38724
  var handleClick = function(event) {
38811
38725
  setClicked(true);
38812
38726
  if (!loop2) {
@@ -38824,7 +38738,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38824
38738
  }, rest), children));
38825
38739
  };
38826
38740
  Animate.displayName = "NutAnimate";
38827
- var defaultProps$s = _object_spread_props(_object_spread({}, ComponentDefaults), {
38741
+ var defaultProps$u = _object_spread_props(_object_spread({}, ComponentDefaults), {
38828
38742
  length: 0,
38829
38743
  value: "",
38830
38744
  delay: 300,
@@ -38832,7 +38746,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38832
38746
  thousands: false
38833
38747
  });
38834
38748
  var CountUp = function(props) {
38835
- var _mergeProps = mergeProps(defaultProps$s, props), length2 = _mergeProps.length, value2 = _mergeProps.value, delay = _mergeProps.delay, duration = _mergeProps.duration, className = _mergeProps.className, thousands = _mergeProps.thousands;
38749
+ var _mergeProps = mergeProps(defaultProps$u, props), length2 = _mergeProps.length, value2 = _mergeProps.value, delay = _mergeProps.delay, duration = _mergeProps.duration, className = _mergeProps.className, thousands = _mergeProps.thousands;
38836
38750
  _mergeProps.style;
38837
38751
  _object_without_properties(_mergeProps, [
38838
38752
  "length",
@@ -38919,7 +38833,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38919
38833
  })));
38920
38834
  };
38921
38835
  CountUp.displayName = "NutCountUp";
38922
- var defaultProps$r = {};
38836
+ var defaultProps$t = {};
38923
38837
  var AnimatingNumbers = /* @__PURE__ */ function(Component) {
38924
38838
  _inherits(AnimatingNumbers2, Component);
38925
38839
  function AnimatingNumbers2(props) {
@@ -38943,11 +38857,11 @@ Please add \`${key2}Action\` when creating your handler.`);
38943
38857
  ]);
38944
38858
  return AnimatingNumbers2;
38945
38859
  }(React.Component);
38946
- _define_property(AnimatingNumbers, "defaultProps", defaultProps$r);
38860
+ _define_property(AnimatingNumbers, "defaultProps", defaultProps$t);
38947
38861
  _define_property(AnimatingNumbers, "displayName", "NutAnimatingNumbers");
38948
38862
  _define_property(AnimatingNumbers, "CountUp", CountUp);
38949
38863
  AnimatingNumbers.CountUp = CountUp;
38950
- var defaultProps$q = _object_spread_props(_object_spread({}, ComponentDefaults), {
38864
+ var defaultProps$s = _object_spread_props(_object_spread({}, ComponentDefaults), {
38951
38865
  src: "",
38952
38866
  muted: false,
38953
38867
  autoPlay: false,
@@ -38977,7 +38891,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38977
38891
  }
38978
38892
  };
38979
38893
  var locale = useConfig().locale;
38980
- 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, [
38894
+ 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, [
38981
38895
  "className",
38982
38896
  "src",
38983
38897
  "style",
@@ -39185,6 +39099,145 @@ Please add \`${key2}Action\` when creating your handler.`);
39185
39099
  })));
39186
39100
  };
39187
39101
  Audio.displayName = "NutAudio";
39102
+ var AvatarContext = React.createContext({});
39103
+ var defaultProps$r = _object_spread_props(_object_spread({}, ComponentDefaults), {
39104
+ maxContent: "",
39105
+ max: "",
39106
+ maxBackground: "#eee",
39107
+ maxColor: "#666",
39108
+ gap: "-8",
39109
+ level: "left"
39110
+ });
39111
+ var classPrefix$8 = "nut-avatar-group";
39112
+ var AvatarGroup = function(props) {
39113
+ var propAvatarGroup = _object_spread({}, defaultProps$r, props);
39114
+ var className = propAvatarGroup.className, style = propAvatarGroup.style, children = propAvatarGroup.children;
39115
+ var avatarGroupRef = React.useRef(null);
39116
+ var cls = classNames(classPrefix$8, className);
39117
+ var parentAvatar = {
39118
+ propAvatarGroup,
39119
+ avatarGroupRef
39120
+ };
39121
+ return /* @__PURE__ */ React.createElement(AvatarContext.Provider, {
39122
+ value: parentAvatar
39123
+ }, /* @__PURE__ */ React.createElement("div", {
39124
+ className: cls,
39125
+ style,
39126
+ ref: avatarGroupRef
39127
+ }, children));
39128
+ };
39129
+ AvatarGroup.displayName = "NutAvatarGroup";
39130
+ var defaultProps$q = _object_spread_props(_object_spread({}, ComponentDefaults), {
39131
+ size: "",
39132
+ shape: "round",
39133
+ icon: "",
39134
+ background: "#eee",
39135
+ color: "#666",
39136
+ fit: "cover",
39137
+ src: "",
39138
+ alt: ""
39139
+ });
39140
+ var classPrefix$7 = "nut-avatar";
39141
+ var Avatar = function(props) {
39142
+ 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, [
39143
+ "children",
39144
+ "size",
39145
+ "shape",
39146
+ "background",
39147
+ "color",
39148
+ "src",
39149
+ "alt",
39150
+ "icon",
39151
+ "fit",
39152
+ "className",
39153
+ "style",
39154
+ "onClick",
39155
+ "onError"
39156
+ ]);
39157
+ var _useState = _sliced_to_array(React.useState(0), 2), maxSum = _useState[0], setMaxSum = _useState[1];
39158
+ var _useState1 = _sliced_to_array(React.useState(false), 2), showMax = _useState1[0], setShowMax = _useState1[1];
39159
+ var _useState2 = _sliced_to_array(React.useState(1), 2), avatarIndex = _useState2[0], setAvatarIndex = _useState2[1];
39160
+ var avatarRef = React.useRef(null);
39161
+ var parent2 = React.useContext(AvatarContext);
39162
+ var sizeValue = [
39163
+ "large",
39164
+ "normal",
39165
+ "small"
39166
+ ];
39167
+ var propAvatarGroup = parent2.propAvatarGroup, avatarGroupRef = parent2.avatarGroupRef;
39168
+ var _obj;
39169
+ 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));
39170
+ var cls = classNames(classPrefix$7, classes, className);
39171
+ var styles = _object_spread({
39172
+ width: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
39173
+ height: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
39174
+ backgroundColor: "".concat(background),
39175
+ color,
39176
+ marginLeft: avatarIndex !== 1 && (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap) ? "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.gap, "px") : "",
39177
+ zIndex: (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.level) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
39178
+ }, style);
39179
+ var maxStyles = {
39180
+ backgroundColor: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxBackground),
39181
+ color: "".concat(propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.maxColor)
39182
+ };
39183
+ var avatarLength = React.useCallback(function(children2) {
39184
+ var _avatarRef_current_dataset, _avatarRef_current;
39185
+ for (var i2 = 0; i2 < children2.length; i2++) {
39186
+ if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
39187
+ children2[i2].setAttribute("data-index", i2 + 1);
39188
+ }
39189
+ }
39190
+ 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);
39191
+ var maxCount = (propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max) || children2.length;
39192
+ setMaxSum(children2.length);
39193
+ setAvatarIndex(index2);
39194
+ if (index2 === children2.length && index2 !== maxCount && children2.length > maxCount) {
39195
+ setShowMax(true);
39196
+ }
39197
+ }, [
39198
+ propAvatarGroup === null || propAvatarGroup === void 0 ? void 0 : propAvatarGroup.max
39199
+ ]);
39200
+ React.useEffect(function() {
39201
+ var avatarChildren = avatarGroupRef === null || avatarGroupRef === void 0 ? void 0 : avatarGroupRef.current.children;
39202
+ if (avatarChildren) {
39203
+ avatarLength(avatarChildren);
39204
+ }
39205
+ }, [
39206
+ avatarLength,
39207
+ avatarGroupRef
39208
+ ]);
39209
+ var errorEvent = function() {
39210
+ onError && onError();
39211
+ };
39212
+ var clickAvatar = function(e2) {
39213
+ onClick && onClick(e2);
39214
+ };
39215
+ 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({
39216
+ className: cls
39217
+ }, rest), {
39218
+ style: !showMax ? styles : maxStyles,
39219
+ onClick: clickAvatar,
39220
+ ref: avatarRef
39221
+ }), (!(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, {
39222
+ className: "nut-avatar-img",
39223
+ src,
39224
+ alt,
39225
+ style: {
39226
+ objectFit: fit
39227
+ },
39228
+ onError: errorEvent
39229
+ }), /* @__PURE__ */ React.isValidElement(icon) ? /* @__PURE__ */ React.cloneElement(icon, _object_spread_props(_object_spread({}, icon.props), {
39230
+ className: "".concat(icon.props.className || "", " nut-avatar-icon")
39231
+ })) : null, children && /* @__PURE__ */ React.createElement("span", {
39232
+ className: "nut-avatar-text"
39233
+ }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(m, {
39234
+ className: "nut-avatar-icon"
39235
+ })), showMax && /* @__PURE__ */ React.createElement("div", {
39236
+ className: "nut-avatar-text"
39237
+ }, (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)))));
39238
+ };
39239
+ Avatar.displayName = "NutAvatar";
39240
+ Avatar.Group = AvatarGroup;
39188
39241
  var defaultProps$p = _object_spread_props(_object_spread({}, ComponentDefaults), {
39189
39242
  strokeWidth: 5,
39190
39243
  radius: 50,
@@ -39989,7 +40042,7 @@ Please add \`${key2}Action\` when creating your handler.`);
39989
40042
  var classPrefix$3 = "nut-indicator";
39990
40043
  var Indicator = function(props) {
39991
40044
  var maybeFixedWidth = function maybeFixedWidth2() {
39992
- if (total === 2 || type2 === "slide") {
40045
+ if (type2 === "dualScreen" || type2 === "slide") {
39993
40046
  return "".concat(classPrefix$3, "-fixed-width");
39994
40047
  }
39995
40048
  return "";
@@ -40405,7 +40458,7 @@ Please add \`${key2}Action\` when creating your handler.`);
40405
40458
  indicatorColor: "#fff",
40406
40459
  closeIcon: false,
40407
40460
  closeIconPosition: "top-right",
40408
- onChange: function(value2) {
40461
+ onChange: function() {
40409
40462
  },
40410
40463
  onClose: function() {
40411
40464
  }
@@ -40418,71 +40471,50 @@ Please add \`${key2}Action\` when creating your handler.`);
40418
40471
  value: value2,
40419
40472
  defaultValue,
40420
40473
  finalValue: defaultValue,
40421
- onChange: function(val2) {
40422
- onChange === null || onChange === void 0 ? void 0 : onChange(val2);
40423
- }
40474
+ onChange
40424
40475
  }), 2), innerNo = _usePropsValue[0], setInnerNo = _usePropsValue[1];
40425
40476
  var _useState = _sliced_to_array(React.useState(visible), 2), showPop = _useState[0], setShowPop = _useState[1];
40426
40477
  var _useState1 = _sliced_to_array(React.useState(0), 2), active2 = _useState1[0], setActive = _useState1[1];
40427
- var _useState2 = _sliced_to_array(React.useState((images === null || images === void 0 ? void 0 : images.length) || 0 + ((videos === null || videos === void 0 ? void 0 : videos.length) || 0)), 2), maxNo = _useState2[0], setMaxNo = _useState2[1];
40478
+ var _useState2 = _sliced_to_array(React.useState(images.length + videos.length), 2), maxNo = _useState2[0], setMaxNo = _useState2[1];
40428
40479
  var _useState3 = _sliced_to_array(React.useState({
40429
40480
  scale: 1,
40430
- moveable: false
40481
+ moveable: false,
40482
+ oriDistance: 0,
40483
+ originScale: 1
40431
40484
  }), 2), store = _useState3[0], setStore = _useState3[1];
40432
- var _useState4 = _sliced_to_array(React.useState(0), 2), lastTouchEndTime = _useState4[0], setLastTouchEndTime = _useState4[1];
40485
+ var lastTouchEndTime = React.useRef(0);
40433
40486
  var onTouchStart = function(event) {
40434
40487
  var touches = event.touches;
40435
40488
  var events = touches[0];
40436
40489
  var events2 = touches[1];
40437
- var curTouchTime = (/* @__PURE__ */ new Date()).getTime();
40438
- if (curTouchTime - lastTouchEndTime < 300) {
40490
+ var curTouchTime = Date.now();
40491
+ if (curTouchTime - lastTouchEndTime.current < 100) {
40439
40492
  var store1 = store;
40440
- if (store1.scale > 1) {
40441
- store1.scale = 1;
40442
- } else if (store1.scale === 1) {
40443
- store1.scale = 2;
40444
- }
40493
+ store1.scale = store1.scale === 1 ? 2 : 1;
40445
40494
  scaleNow();
40446
40495
  }
40447
40496
  var store11 = store;
40448
40497
  store11.moveable = true;
40449
40498
  if (events2) {
40450
- store11.oriDistance = getDistance({
40451
- x: events.pageX,
40452
- y: events.pageY
40453
- }, {
40454
- x: events2.pageX,
40455
- y: events2.pageY
40456
- });
40499
+ store11.oriDistance = getDistance(events, events2);
40457
40500
  }
40458
- store11.originScale = store11.scale || 1;
40501
+ store11.originScale = store11.scale;
40459
40502
  };
40460
40503
  var onTouchMove = function(event) {
40504
+ if (!store.moveable) return;
40461
40505
  var touches = event.touches;
40462
40506
  var events = touches[0];
40463
40507
  var events2 = touches[1];
40464
- if (!store.moveable) {
40465
- return;
40466
- }
40467
40508
  var store1 = store;
40468
40509
  if (events2) {
40469
- var curDistance = getDistance({
40470
- x: events.pageX,
40471
- y: events.pageY
40472
- }, {
40473
- x: events2.pageX,
40474
- y: events2.pageY
40475
- });
40510
+ var curDistance = getDistance(events, events2);
40476
40511
  var curScale = curDistance / store1.oriDistance;
40477
- store1.scale = store1.originScale * curScale;
40478
- if (store1.scale > 3) {
40479
- store1.scale = 3;
40480
- }
40512
+ store1.scale = Math.min(store1.originScale * curScale, 3);
40481
40513
  scaleNow();
40482
40514
  }
40483
40515
  };
40484
40516
  var onTouchEnd = function() {
40485
- setLastTouchEndTime((/* @__PURE__ */ new Date()).getTime());
40517
+ lastTouchEndTime.current = Date.now();
40486
40518
  var store1 = store;
40487
40519
  store1.moveable = false;
40488
40520
  if (store1.scale < 1.1 && store1.scale > 1 || store1.scale < 1) {
@@ -40497,6 +40529,11 @@ Please add \`${key2}Action\` when creating your handler.`);
40497
40529
  document.addEventListener("touchmove", onTouchMove);
40498
40530
  document.addEventListener("touchend", onTouchEnd);
40499
40531
  document.addEventListener("touchcancel", onTouchEnd);
40532
+ return function() {
40533
+ document.removeEventListener("touchcancel", onTouchEnd);
40534
+ document.removeEventListener("touchmove", onTouchMove);
40535
+ document.removeEventListener("touchend", onTouchEnd);
40536
+ };
40500
40537
  };
40501
40538
  React.useEffect(function() {
40502
40539
  setShowPop(visible);
@@ -40514,7 +40551,7 @@ Please add \`${key2}Action\` when creating your handler.`);
40514
40551
  innerNo
40515
40552
  ]);
40516
40553
  React.useEffect(function() {
40517
- setMaxNo((images === null || images === void 0 ? void 0 : images.length) || 0 + ((videos === null || videos === void 0 ? void 0 : videos.length) || 0));
40554
+ setMaxNo(images.length + videos.length);
40518
40555
  }, [
40519
40556
  images,
40520
40557
  videos
@@ -40525,7 +40562,7 @@ Please add \`${key2}Action\` when creating your handler.`);
40525
40562
  }
40526
40563
  };
40527
40564
  var getDistance = function(first, second) {
40528
- return Math.hypot(Math.abs(second.x - first.x), Math.abs(second.y - first.y));
40565
+ return Math.hypot(Math.abs(second.pageX - first.pageX), Math.abs(second.pageY - first.pageY));
40529
40566
  };
40530
40567
  var slideChangeEnd = function(page) {
40531
40568
  setActive(page + 1);
@@ -40536,31 +40573,26 @@ Please add \`${key2}Action\` when creating your handler.`);
40536
40573
  setShowPop(false);
40537
40574
  setActive(innerNo);
40538
40575
  scaleNow();
40539
- onClose && onClose();
40576
+ onClose === null || onClose === void 0 ? void 0 : onClose();
40540
40577
  setStore(_object_spread_props(_object_spread({}, store), {
40541
40578
  scale: 1
40542
40579
  }));
40543
40580
  };
40544
40581
  var closeOnImg = function(e2) {
40545
40582
  e2.stopPropagation();
40546
- if (closeOnContentClick) {
40547
- onCloseInner(e2);
40548
- }
40583
+ if (closeOnContentClick) onCloseInner(e2);
40549
40584
  };
40550
40585
  var duration = typeof autoPlay === "string" ? parseInt(autoPlay) : autoPlay;
40551
40586
  return /* @__PURE__ */ React.createElement(Popup, {
40552
40587
  visible: showPop,
40553
40588
  className: "".concat(classPrefix2, "-pop"),
40554
- style: {
40555
- width: "100%"
40556
- },
40557
40589
  onClick: onCloseInner
40558
40590
  }, /* @__PURE__ */ React.createElement("div", {
40559
40591
  className: classNames(classPrefix2, className),
40560
40592
  style,
40561
40593
  ref,
40562
40594
  onTouchStart
40563
- }, showPop ? /* @__PURE__ */ React.createElement(InnerSwiper, {
40595
+ }, showPop && /* @__PURE__ */ React.createElement(InnerSwiper, {
40564
40596
  autoPlay: !!duration,
40565
40597
  duration,
40566
40598
  className: "".concat(classPrefix2, "-swiper"),
@@ -40572,50 +40604,39 @@ Please add \`${key2}Action\` when creating your handler.`);
40572
40604
  onChange: function(page) {
40573
40605
  return slideChangeEnd(page);
40574
40606
  },
40575
- defaultValue: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
40607
+ defaultValue: innerNo > maxNo ? maxNo - 1 : innerNo - 1,
40576
40608
  indicator
40577
- }, (videos !== null && videos !== void 0 ? videos : []).map(function(item) {
40609
+ }, _to_consumable_array(videos.map(function(item) {
40578
40610
  return {
40579
40611
  type: "video",
40580
40612
  data: item
40581
40613
  };
40582
- }).concat((images !== null && images !== void 0 ? images : []).map(function(item) {
40614
+ })).concat(_to_consumable_array(images.map(function(item) {
40583
40615
  return {
40584
40616
  type: "image",
40585
40617
  data: item
40586
40618
  };
40587
- })).sort(function(a, b) {
40588
- var _a_data, _b_data;
40619
+ }))).sort(function(a, b) {
40589
40620
  var _a_data_index, _b_data_index;
40590
- return ((_a_data_index = (_a_data = a.data) === null || _a_data === void 0 ? void 0 : _a_data.index) !== null && _a_data_index !== void 0 ? _a_data_index : 0) - ((_b_data_index = (_b_data = b.data) === null || _b_data === void 0 ? void 0 : _b_data.index) !== null && _b_data_index !== void 0 ? _b_data_index : 0);
40621
+ return ((_a_data_index = a.data.index) !== null && _a_data_index !== void 0 ? _a_data_index : 0) - ((_b_data_index = b.data.index) !== null && _b_data_index !== void 0 ? _b_data_index : 0);
40591
40622
  }).map(function(item, index2) {
40592
- if (item.type === "video") {
40593
- var _item_data = item.data, source = _item_data.source, options2 = _item_data.options;
40594
- return /* @__PURE__ */ React.createElement(SwiperItem, {
40595
- key: index2
40596
- }, /* @__PURE__ */ React.createElement(Video, {
40597
- source,
40598
- options: options2,
40599
- onClick: closeOnImg
40600
- }));
40601
- }
40602
- if (item.type === "image") {
40603
- var src = item.data.src;
40604
- return /* @__PURE__ */ React.createElement(SwiperItem, {
40605
- key: index2
40606
- }, /* @__PURE__ */ React.createElement(Image$1, {
40607
- src,
40608
- draggable: false,
40609
- onClick: closeOnImg
40610
- }));
40611
- }
40612
- return null;
40613
- })) : null), pagination ? /* @__PURE__ */ React.createElement("div", {
40623
+ return /* @__PURE__ */ React.createElement(SwiperItem, {
40624
+ key: index2
40625
+ }, item.type === "video" ? /* @__PURE__ */ React.createElement(Video, {
40626
+ source: item.data.source,
40627
+ options: item.data.options,
40628
+ onClick: closeOnImg
40629
+ }) : /* @__PURE__ */ React.createElement(Image$1, {
40630
+ src: item.data.src,
40631
+ draggable: false,
40632
+ onClick: closeOnImg
40633
+ }));
40634
+ }))), pagination && /* @__PURE__ */ React.createElement("div", {
40614
40635
  className: "".concat(classPrefix2, "-index")
40615
- }, active2, "/", (images ? images.length : 0) + (videos ? videos.length : 0)) : null, closeIcon !== false ? /* @__PURE__ */ React.createElement("div", {
40636
+ }, active2, "/", maxNo), closeIcon !== false && /* @__PURE__ */ React.createElement("div", {
40616
40637
  className: "".concat(classPrefix2, "-close ").concat(closeIconPosition),
40617
40638
  onClick: onCloseInner
40618
- }, closeIcon === true ? /* @__PURE__ */ React.createElement(n$6, null) : closeIcon) : null);
40639
+ }, closeIcon === true ? /* @__PURE__ */ React.createElement(n$6, null) : closeIcon));
40619
40640
  };
40620
40641
  ImagePreview.displayName = "NutImagePreview";
40621
40642
  var defaultPaginationOptions = {