@nutui/nutui-react-taro 2.6.21 → 2.6.22

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 (62) hide show
  1. package/CHANGELOG.md +22 -5
  2. package/dist/esm/Address.js +1 -1
  3. package/dist/esm/AnimatingNumbers.js +7 -7
  4. package/dist/esm/Audio/style/style.css +1 -1
  5. package/dist/esm/Audio.js +1 -1
  6. package/dist/esm/Avatar.js +1 -1
  7. package/dist/esm/AvatarCropper.js +1 -1
  8. package/dist/esm/BackTop.js +1 -1
  9. package/dist/esm/Button.js +1 -1
  10. package/dist/esm/Calendar.js +1 -1
  11. package/dist/esm/CalendarItem.js +1 -1
  12. package/dist/esm/Cascader.js +1 -1
  13. package/dist/esm/Dialog.js +1 -1
  14. package/dist/esm/Empty.js +1 -1
  15. package/dist/esm/Menu.js +1 -1
  16. package/dist/esm/MenuItem.js +1 -1
  17. package/dist/esm/NavBar/style/style.css +1 -1
  18. package/dist/esm/NavBar.js +1 -1
  19. package/dist/esm/Radio.js +1 -1
  20. package/dist/esm/RadioGroup.js +1 -1
  21. package/dist/esm/Range/style/style.css +1 -1
  22. package/dist/esm/Range.js +1 -1
  23. package/dist/esm/Skeleton.js +1 -1
  24. package/dist/esm/Tabs.js +1 -1
  25. package/dist/esm/Uploader.js +1 -1
  26. package/dist/esm/{address.taro-CWr6jIYg.js → address.taro-Ai6DQF3D.js} +1 -1
  27. package/dist/esm/{audio.taro--yoX2oyx.js → audio.taro-qK1wq4IH.js} +4 -5
  28. package/dist/esm/avatar.taro-9dU2KeWv.js +82 -0
  29. package/dist/esm/{avatarcropper.taro-B0I9uLNp.js → avatarcropper.taro-meD2sizv.js} +1 -1
  30. package/dist/esm/{backtop.taro-CpzSXDW3.js → backtop.taro-D3Lo3jFO.js} +8 -10
  31. package/dist/esm/{button.taro-1kEru6r9.js → button.taro-CixO32Hw.js} +2 -2
  32. package/dist/esm/{calendar.taro-Csq-7imv.js → calendar.taro-C52T1TFf.js} +1 -1
  33. package/dist/esm/{calendaritem.taro-BOMJjsx9.js → calendaritem.taro-CHdJXKkc.js} +1 -1
  34. package/dist/esm/{cascader.taro-DZ_oBTm0.js → cascader.taro-CMOCzo0m.js} +1 -1
  35. package/dist/esm/{dialog.taro-Bg730q8d.js → dialog.taro-yjDaaRHA.js} +1 -1
  36. package/dist/esm/{empty.taro-Dr4eSaDg.js → empty.taro-Dt07kty5.js} +1 -1
  37. package/dist/esm/{menu.taro-BFc4uUxG.js → menu.taro-BmjnA_YM.js} +13 -13
  38. package/dist/esm/{menuitem.taro-D6KQvdRw.js → menuitem.taro-DCqPC4Nu.js} +13 -13
  39. package/dist/esm/{navbar.taro-Dea0-s9Q.js → navbar.taro-HRFRDGii.js} +7 -2
  40. package/dist/esm/nutui-react.es.js +19 -19
  41. package/dist/esm/{radio.taro-CzOHqD3O.js → radio.taro-M2in687s.js} +24 -20
  42. package/dist/esm/{raf-zwv-SBjP.js → raf-Di10dXPS.js} +2 -1
  43. package/dist/esm/{range.taro-BilM3sMH.js → range.taro-D4U2Q7Wx.js} +49 -44
  44. package/dist/esm/{skeleton.taro-bD6fHZop.js → skeleton.taro-D9Vkgsyx.js} +1 -1
  45. package/dist/esm/{tabs.taro-CJiI4q_-.js → tabs.taro-D8bDfm4x.js} +1 -1
  46. package/dist/esm/{uploader.taro-DZyZiEi2.js → uploader.taro-CceZ5Y4t.js} +1 -1
  47. package/dist/locales/base.js +1 -1
  48. package/dist/locales/en-US.js +1 -1
  49. package/dist/locales/id-ID.js +1 -1
  50. package/dist/locales/tr-TR.js +1 -1
  51. package/dist/locales/zh-CN.js +1 -1
  52. package/dist/locales/zh-TW.js +1 -1
  53. package/dist/locales/zh-UG.js +1 -1
  54. package/dist/nutui.react.es.js +211 -251
  55. package/dist/nutui.react.umd.js +211 -251
  56. package/dist/packages/navbar/navbar.scss +0 -5
  57. package/dist/packages/range/range.scss +2 -0
  58. package/dist/style.css +1 -1
  59. package/dist/types/packages/avatar/avatar.d.ts +1 -1
  60. package/dist/types/packages/overlay/overlay.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/dist/esm/avatar.taro-DSL3ErmC.js +0 -85
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
3
3
  })(this, function(exports2, React, Taro, components, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:02:22 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react-taro v2.6.22 Sat Oct 12 2024 15:01:29 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -320,7 +320,7 @@
320
320
  };
321
321
  const getStyle = React.useCallback(() => {
322
322
  const style2 = {};
323
- if (props.color) {
323
+ if (color) {
324
324
  if (props.fill === "outline" || props.fill === "dashed") {
325
325
  style2.color = color;
326
326
  if (!(color == null ? void 0 : color.includes("gradient"))) {
@@ -333,7 +333,7 @@
333
333
  }
334
334
  }
335
335
  return style2;
336
- }, [color]);
336
+ }, [color, props.fill]);
337
337
  const handleClick = (e2) => {
338
338
  if (!loading && !disabled && onClick) {
339
339
  onClick(e2);
@@ -3961,7 +3961,7 @@
3961
3961
  stop.current = true;
3962
3962
  };
3963
3963
  }
3964
- const inBrowser = typeof document !== "undefined" && !!document.scripts;
3964
+ const inBrowser$1 = typeof document !== "undefined" && !!document.scripts;
3965
3965
  function isWindow(val) {
3966
3966
  return val === window;
3967
3967
  }
@@ -4003,7 +4003,7 @@
4003
4003
  }
4004
4004
  const getRectByTaro = async (element) => {
4005
4005
  if (element) {
4006
- if (inBrowser) {
4006
+ if (inBrowser$1) {
4007
4007
  return Promise.resolve(getRect(element));
4008
4008
  }
4009
4009
  return new Promise((resolve, reject) => {
@@ -4168,11 +4168,16 @@
4168
4168
  ...props
4169
4169
  };
4170
4170
  const classPrefix2 = "nut-backtop";
4171
- const [backTop, SetBackTop] = React.useState(false);
4172
- Taro.usePageScroll((res) => {
4173
- const { scrollTop } = res;
4174
- scrollTop >= threshold ? SetBackTop(true) : SetBackTop(false);
4175
- });
4171
+ const [backTop, setBackTop] = React.useState(false);
4172
+ const cls = classNames(classPrefix2, { show: backTop }, className);
4173
+ const handleScroll = React.useCallback(
4174
+ (res) => {
4175
+ const { scrollTop } = res;
4176
+ setBackTop(scrollTop >= threshold);
4177
+ },
4178
+ [threshold]
4179
+ );
4180
+ Taro.usePageScroll(handleScroll);
4176
4181
  const goTop = (e2) => {
4177
4182
  onClick && onClick(e2);
4178
4183
  Taro.pageScrollTo({
@@ -4188,23 +4193,7 @@
4188
4193
  bottom: "20px",
4189
4194
  zIndex
4190
4195
  };
4191
- return /* @__PURE__ */ React.createElement(
4192
- "div",
4193
- {
4194
- className: classNames(
4195
- classPrefix2,
4196
- {
4197
- show: backTop
4198
- },
4199
- className
4200
- ),
4201
- style: styles,
4202
- onClick: (e2) => {
4203
- goTop(e2);
4204
- }
4205
- },
4206
- children || /* @__PURE__ */ React.createElement(N, { size: 19, className: "nut-backtop-main" })
4207
- );
4196
+ return /* @__PURE__ */ React.createElement("div", { className: cls, style: styles, onClick: (e2) => goTop(e2) }, children || /* @__PURE__ */ React.createElement(N, { size: 19, className: "nut-backtop-main" }));
4208
4197
  };
4209
4198
  BackTop.displayName = "NutBackTop";
4210
4199
  const elevatorContext = React.createContext({});
@@ -4628,11 +4617,10 @@
4628
4617
  };
4629
4618
  const classes = classNames({
4630
4619
  [`${classPrefix2}-fixed`]: fixed,
4631
- [`${classPrefix2}-safe-area-inset-top`]: safeAreaInsetTop,
4632
4620
  [`${classPrefix2}-title-align-${titleAlign}`]: true
4633
4621
  });
4634
4622
  const cls = classNames(classPrefix2, classes, className);
4635
- return /* @__PURE__ */ React.createElement(React.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
4623
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
4636
4624
  };
4637
4625
  NavBar.displayName = "NutNavBar";
4638
4626
  const defaultProps$1f = {
@@ -5220,8 +5208,9 @@
5220
5208
  );
5221
5209
  return children ? /* @__PURE__ */ React.createElement("div", { className: classes }, !disabled && children) : null;
5222
5210
  };
5211
+ const inBrowser = typeof window !== "undefined";
5223
5212
  function requestAniFrame() {
5224
- if (typeof window !== "undefined") {
5213
+ if (inBrowser) {
5225
5214
  const _window = window;
5226
5215
  return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
5227
5216
  _window.setTimeout(callback, 1e3 / 60);
@@ -10775,9 +10764,19 @@
10775
10764
  React.useEffect(() => {
10776
10765
  setShowPopup(show2);
10777
10766
  }, [show2]);
10767
+ const getParentOffset = React.useCallback(() => {
10768
+ setTimeout(async () => {
10769
+ const p = parent.menuRef.current;
10770
+ const rect = await getRectByTaro(p);
10771
+ setPosition({
10772
+ height: rect.height,
10773
+ top: rect.top
10774
+ });
10775
+ }, 100);
10776
+ }, [parent.menuRef]);
10778
10777
  React.useEffect(() => {
10779
10778
  getParentOffset();
10780
- }, [showPopup]);
10779
+ }, [showPopup, getParentOffset]);
10781
10780
  const windowHeight = React.useMemo(() => Taro.getSystemInfoSync().windowHeight, []);
10782
10781
  const updateItemOffset = React.useCallback(() => {
10783
10782
  if (!parent.lockScroll) return;
@@ -10790,7 +10789,7 @@
10790
10789
  });
10791
10790
  }
10792
10791
  });
10793
- }, [direction, windowHeight]);
10792
+ }, [direction, windowHeight, parent.lockScroll, parent.menuRef]);
10794
10793
  Taro.usePageScroll(updateItemOffset);
10795
10794
  React.useImperativeHandle(ref, () => ({
10796
10795
  toggle: (s) => {
@@ -10818,16 +10817,6 @@
10818
10817
  top: 0,
10819
10818
  height: 0
10820
10819
  });
10821
- const getParentOffset = () => {
10822
- setTimeout(async () => {
10823
- const p = parent.menuRef.current;
10824
- const rect = await getRectByTaro(p);
10825
- setPosition({
10826
- height: rect.height,
10827
- top: rect.top
10828
- });
10829
- }, 100);
10830
- };
10831
10820
  const isShow = () => {
10832
10821
  if (showPopup) return {};
10833
10822
  return { display: "none" };
@@ -10972,24 +10961,29 @@
10972
10961
  ...props
10973
10962
  };
10974
10963
  const menuRef = React.useRef(null);
10964
+ const [showMenuItem, setShowMenuItem] = React.useState([]);
10965
+ const [menuItemTitle, setMenuItemTitle] = React.useState([]);
10975
10966
  const [isScrollFixed, setIsScrollFixed] = React.useState(false);
10967
+ const cls = classNames(`nut-menu`, className, {
10968
+ "scroll-fixed": isScrollFixed
10969
+ });
10976
10970
  const getScrollTop = (el) => {
10977
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
10971
+ return Math.max(
10972
+ 0,
10973
+ el === window ? window.scrollY : el.scrollTop
10974
+ );
10978
10975
  };
10979
- const onScroll = () => {
10980
- const { scrollFixed: scrollFixed2 } = props;
10976
+ const onScroll = React.useCallback(() => {
10981
10977
  const scrollTop = getScrollTop(window);
10982
- const isFixed = scrollTop > (typeof scrollFixed2 === "boolean" ? 30 : Number(scrollFixed2));
10978
+ const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
10983
10979
  setIsScrollFixed(isFixed);
10984
- };
10980
+ }, [scrollFixed]);
10985
10981
  React.useEffect(() => {
10986
10982
  if (scrollFixed) {
10987
10983
  window.addEventListener("scroll", onScroll);
10988
10984
  }
10989
10985
  return () => window.removeEventListener("scroll", onScroll);
10990
- }, []);
10991
- const [showMenuItem, setShowMenuItem] = React.useState([]);
10992
- const [menuItemTitle, setMenuItemTitle] = React.useState([]);
10986
+ }, [scrollFixed, onScroll]);
10993
10987
  const toggleMenuItem = (index, from = "NORMAL") => {
10994
10988
  showMenuItem[index] = !showMenuItem[index];
10995
10989
  if (showMenuItem[index]) {
@@ -11092,26 +11086,15 @@
11092
11086
  return null;
11093
11087
  });
11094
11088
  };
11095
- return /* @__PURE__ */ React.createElement(
11089
+ return /* @__PURE__ */ React.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React.createElement(
11096
11090
  "div",
11097
11091
  {
11098
- ...rest,
11099
- className: classNames(`nut-menu`, className, {
11100
- "scroll-fixed": isScrollFixed
11101
- }),
11102
- ref: menuRef
11092
+ className: classNames("nut-menu-bar", {
11093
+ opened: showMenuItem.includes(true)
11094
+ })
11103
11095
  },
11104
- /* @__PURE__ */ React.createElement(
11105
- "div",
11106
- {
11107
- className: classNames("nut-menu-bar", {
11108
- opened: showMenuItem.includes(true)
11109
- })
11110
- },
11111
- menuTitle()
11112
- ),
11113
- cloneChildren()
11114
- );
11096
+ menuTitle()
11097
+ ), cloneChildren());
11115
11098
  };
11116
11099
  Menu.displayName = "NutMenu";
11117
11100
  Menu.Item = MenuItem;
@@ -11302,6 +11285,13 @@
11302
11285
  disabled,
11303
11286
  ...rest
11304
11287
  } = { ...defaultProps$R, ...props };
11288
+ const cls = classNames(
11289
+ classPrefix$g,
11290
+ {
11291
+ [`${classPrefix$g}-${props.direction}`]: props.direction
11292
+ },
11293
+ className
11294
+ );
11305
11295
  const [val2State, setVal2State] = usePropsValue({
11306
11296
  defaultValue: props.defaultValue,
11307
11297
  value: props.value,
@@ -11324,7 +11314,7 @@
11324
11314
  }
11325
11315
  );
11326
11316
  });
11327
- }, [options]);
11317
+ }, [options, labelPosition, val2State]);
11328
11318
  return /* @__PURE__ */ React.createElement(
11329
11319
  RadioContext.Provider,
11330
11320
  {
@@ -11341,20 +11331,7 @@
11341
11331
  }
11342
11332
  }
11343
11333
  },
11344
- /* @__PURE__ */ React.createElement(
11345
- "div",
11346
- {
11347
- className: classNames(
11348
- classPrefix$g,
11349
- {
11350
- [`${classPrefix$g}-${props.direction}`]: props.direction
11351
- },
11352
- className
11353
- ),
11354
- ...rest
11355
- },
11356
- (options == null ? void 0 : options.length) ? renderOptionsChildren() : children
11357
- )
11334
+ /* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, (options == null ? void 0 : options.length) ? renderOptionsChildren() : children)
11358
11335
  );
11359
11336
  }
11360
11337
  );
@@ -11412,29 +11389,6 @@
11412
11389
  }
11413
11390
  };
11414
11391
  }
11415
- const renderLabel = () => {
11416
- return /* @__PURE__ */ React.createElement(
11417
- "div",
11418
- {
11419
- className: classNames(`${classPrefix2}-label`, {
11420
- [`${classPrefix2}-label-disabled`]: disabled
11421
- })
11422
- },
11423
- children
11424
- );
11425
- };
11426
- const renderButton = () => {
11427
- return /* @__PURE__ */ React.createElement(
11428
- "div",
11429
- {
11430
- className: classNames(`${classPrefix2}-button`, {
11431
- [`${classPrefix2}-button-active`]: checkedStatement,
11432
- [`${classPrefix2}-button-disabled`]: disabled
11433
- })
11434
- },
11435
- children
11436
- );
11437
- };
11438
11392
  const color = () => {
11439
11393
  return {
11440
11394
  [`${classPrefix2}-icon-disabled`]: disabled,
@@ -11458,8 +11412,21 @@
11458
11412
  className: classNames(color())
11459
11413
  }) : /* @__PURE__ */ React.createElement(A, { className: classNames(color()) });
11460
11414
  };
11415
+ const renderLabel = () => {
11416
+ const labelcls = classNames(`${classPrefix2}-label`, {
11417
+ [`${classPrefix2}-label-disabled`]: disabled
11418
+ });
11419
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), /* @__PURE__ */ React.createElement("div", { className: labelcls }, children));
11420
+ };
11421
+ const renderButton = () => {
11422
+ const buttoncls = classNames(`${classPrefix2}-button`, {
11423
+ [`${classPrefix2}-button-active`]: checkedStatement,
11424
+ [`${classPrefix2}-button-disabled`]: disabled
11425
+ });
11426
+ return /* @__PURE__ */ React.createElement("div", { className: buttoncls }, children);
11427
+ };
11461
11428
  const renderByShape = (shape2) => {
11462
- return shape2 === "button" ? renderButton() : /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), renderLabel());
11429
+ return shape2 === "button" ? renderButton() : renderLabel();
11463
11430
  };
11464
11431
  const renderRadioItem = () => {
11465
11432
  return renderByShape(context && context.shape ? context.shape : shape);
@@ -11468,22 +11435,14 @@
11468
11435
  if (disabled || checkedStatement) return;
11469
11436
  setCheckedStatement(!checkedStatement);
11470
11437
  };
11471
- return /* @__PURE__ */ React.createElement(
11472
- "div",
11438
+ const cls = classNames(
11439
+ classPrefix2,
11473
11440
  {
11474
- className: classNames(
11475
- classPrefix2,
11476
- {
11477
- [`${classPrefix2}-reverse`]: labelPosition === "left"
11478
- },
11479
- className
11480
- ),
11481
- style,
11482
- onClick: handleClick,
11483
- ...rest
11441
+ [`${classPrefix2}-reverse`]: labelPosition === "left"
11484
11442
  },
11485
- renderRadioItem()
11443
+ className
11486
11444
  );
11445
+ return /* @__PURE__ */ React.createElement("div", { className: cls, style, onClick: handleClick, ...rest }, renderRadioItem());
11487
11446
  };
11488
11447
  Radio.displayName = "NutRadio";
11489
11448
  Radio.Group = RadioGroup;
@@ -11505,9 +11464,6 @@
11505
11464
  button,
11506
11465
  vertical,
11507
11466
  marks,
11508
- onChange,
11509
- onStart,
11510
- onEnd,
11511
11467
  minDescription,
11512
11468
  maxDescription,
11513
11469
  currentDescription,
@@ -11515,7 +11471,10 @@
11515
11471
  max,
11516
11472
  step,
11517
11473
  value,
11518
- defaultValue
11474
+ defaultValue,
11475
+ onChange,
11476
+ onStart,
11477
+ onEnd
11519
11478
  } = { ...defaultProps$P, ...props };
11520
11479
  const classPrefix2 = "nut-range";
11521
11480
  const [buttonIndex, setButtonIndex] = React.useState(0);
@@ -11533,7 +11492,7 @@
11533
11492
  finalValue: 0,
11534
11493
  onChange: handleChange
11535
11494
  });
11536
- const [exactValue, setEaxctValue] = React.useState(
11495
+ const [exactValue, setExactValue] = React.useState(
11537
11496
  () => value || defaultValue || 0
11538
11497
  );
11539
11498
  const marksRef = React.useRef({});
@@ -11551,10 +11510,7 @@
11551
11510
  setMarksList(list);
11552
11511
  }
11553
11512
  }
11554
- }, [marks]);
11555
- const scope = () => {
11556
- return max - min;
11557
- };
11513
+ }, [marks, max, min]);
11558
11514
  const classes = classNames(classPrefix2, {
11559
11515
  [`${classPrefix2}-disabled`]: disabled,
11560
11516
  [`${classPrefix2}-vertical`]: vertical
@@ -11566,41 +11522,38 @@
11566
11522
  },
11567
11523
  className
11568
11524
  );
11569
- const markClassName = React.useCallback(
11570
- (mark) => {
11571
- const classPrefix22 = "nut-range-mark";
11572
- let lowerBound = min;
11573
- let upperBound = max;
11574
- if (range2 && Array.isArray(current)) {
11575
- lowerBound = current[0];
11576
- upperBound = current[1];
11577
- } else {
11578
- upperBound = current;
11579
- }
11580
- const isActive = mark <= upperBound && mark >= lowerBound;
11581
- return [
11582
- `${classPrefix22}-text`,
11583
- `${isActive ? `${classPrefix22}-text-active` : ""}`
11584
- ].join(" ");
11585
- },
11586
- [range2, current, min, max]
11587
- );
11525
+ const markClassName = (mark) => {
11526
+ const classPrefix22 = "nut-range-mark";
11527
+ let lowerBound = min;
11528
+ let upperBound = max;
11529
+ if (range2 && Array.isArray(current)) {
11530
+ lowerBound = current[0];
11531
+ upperBound = current[1];
11532
+ } else {
11533
+ upperBound = current;
11534
+ }
11535
+ const isActive = mark <= upperBound && mark >= lowerBound;
11536
+ return [
11537
+ `${classPrefix22}-text`,
11538
+ `${isActive ? `${classPrefix22}-text-active` : ""}`
11539
+ ].join(" ");
11540
+ };
11588
11541
  const isRange = (val) => {
11589
11542
  return !!range2 && Array.isArray(val);
11590
11543
  };
11544
+ const scope = React.useMemo(() => {
11545
+ if (max < min || max === min) {
11546
+ console.log("max 的值需要大于 min的值");
11547
+ }
11548
+ return max - min;
11549
+ }, [max, min]);
11591
11550
  const calcMainAxis = () => {
11592
11551
  const modelVal = current;
11593
- if (isRange(modelVal)) {
11594
- return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
11595
- }
11596
- return `${(modelVal - min) * 100 / scope()}%`;
11552
+ return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
11597
11553
  };
11598
11554
  const calcOffset = () => {
11599
11555
  const modelVal = current;
11600
- if (isRange(modelVal)) {
11601
- return `${(modelVal[0] - min) * 100 / scope()}%`;
11602
- }
11603
- return `0%`;
11556
+ return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
11604
11557
  };
11605
11558
  const barStyle = () => {
11606
11559
  if (vertical) {
@@ -11620,11 +11573,11 @@
11620
11573
  const marksStyle = (mark) => {
11621
11574
  const dir = rtl ? "right" : "left";
11622
11575
  let style = {
11623
- [dir]: `${(mark - min) / scope() * 100}%`
11576
+ [dir]: `${(mark - min) / scope * 100}%`
11624
11577
  };
11625
11578
  if (vertical) {
11626
11579
  style = {
11627
- top: `${(mark - min) / scope() * 100}%`
11580
+ top: `${(mark - min) / scope * 100}%`
11628
11581
  };
11629
11582
  }
11630
11583
  return style;
@@ -11671,8 +11624,8 @@
11671
11624
  delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
11672
11625
  total = rect.height;
11673
11626
  }
11674
- const value2 = min + delta / total * scope();
11675
- setEaxctValue(current);
11627
+ const value2 = min + delta / total * scope;
11628
+ setExactValue(current);
11676
11629
  if (isRange(current)) {
11677
11630
  const [left2, right2] = current;
11678
11631
  const middle = (left2 + right2) / 2;
@@ -11690,7 +11643,7 @@
11690
11643
  return;
11691
11644
  }
11692
11645
  touch.start(event);
11693
- setEaxctValue(current);
11646
+ setExactValue(current);
11694
11647
  if (isRange(current)) {
11695
11648
  setStartValue(current.map(format2));
11696
11649
  } else {
@@ -11711,12 +11664,12 @@
11711
11664
  if (!rect) return;
11712
11665
  let delta = touch.deltaX.current;
11713
11666
  let total = rect.width;
11714
- let diff = delta / total * scope();
11667
+ let diff = delta / total * scope;
11715
11668
  diff = rtl ? -diff : diff;
11716
11669
  if (vertical) {
11717
11670
  delta = touch.deltaY.current;
11718
11671
  total = rect.height;
11719
- diff = delta / total * scope();
11672
+ diff = delta / total * scope;
11720
11673
  }
11721
11674
  let newValue;
11722
11675
  if (isRange(startValue)) {
@@ -11725,7 +11678,7 @@
11725
11678
  } else {
11726
11679
  newValue = startValue + diff;
11727
11680
  }
11728
- setEaxctValue(newValue);
11681
+ setExactValue(newValue);
11729
11682
  updateValue(newValue);
11730
11683
  };
11731
11684
  const onTouchEnd = () => {
@@ -11745,57 +11698,65 @@
11745
11698
  const renderButton = (index) => {
11746
11699
  return /* @__PURE__ */ React.createElement(React.Fragment, null, button || /* @__PURE__ */ React.createElement("div", { className: "nut-range-button" }, currentDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "number" }, currentDescription ? currentDescription(curValue(index)) : curValue(index))));
11747
11700
  };
11748
- return /* @__PURE__ */ React.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React.createElement("div", { ref: root2, className: classes, onClick: (e2) => click(e2) }, marksList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
11749
- return /* @__PURE__ */ React.createElement(
11750
- "span",
11751
- {
11752
- key: mark,
11753
- className: markClassName(mark),
11754
- style: marksStyle(mark)
11755
- },
11756
- Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
11757
- /* @__PURE__ */ React.createElement(
11758
- "span",
11701
+ const renderRangeButton = () => {
11702
+ return [0, 1].map((item, index) => {
11703
+ const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
11704
+ ${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
11705
+ return /* @__PURE__ */ React.createElement(
11706
+ "div",
11759
11707
  {
11760
- className: classNames("nut-range-tick", {
11761
- active: tickClass(mark)
11762
- })
11763
- }
11764
- )
11765
- );
11766
- })), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range2 ? [0, 1].map((item, index) => {
11767
- return /* @__PURE__ */ React.createElement(
11768
- "div",
11769
- {
11770
- key: index,
11771
- className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
11772
- ${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
11773
- onTouchStart: (e2) => {
11774
- if (typeof index === "number") {
11708
+ key: index,
11709
+ className: cls,
11710
+ onTouchStart: (e2) => {
11775
11711
  setButtonIndex(index);
11776
- }
11777
- onTouchStart(e2);
11712
+ onTouchStart(e2);
11713
+ },
11714
+ onTouchMove,
11715
+ onTouchEnd,
11716
+ onTouchCancel: onTouchEnd,
11717
+ onClick: (e2) => e2.stopPropagation()
11778
11718
  },
11779
- onTouchMove: (e2) => onTouchMove(e2),
11719
+ renderButton(index)
11720
+ );
11721
+ });
11722
+ };
11723
+ const renderSingleButton = () => {
11724
+ return /* @__PURE__ */ React.createElement(
11725
+ components.View,
11726
+ {
11727
+ catchMove: true,
11728
+ className: "nut-range-button-wrapper",
11729
+ onTouchStart,
11730
+ onTouchMove,
11780
11731
  onTouchEnd,
11781
11732
  onTouchCancel: onTouchEnd,
11782
11733
  onClick: (e2) => e2.stopPropagation()
11783
11734
  },
11784
- renderButton(index)
11735
+ renderButton()
11785
11736
  );
11786
- }) : /* @__PURE__ */ React.createElement(
11787
- components.View,
11788
- {
11789
- catchMove: true,
11790
- className: "nut-range-button-wrapper",
11791
- onTouchStart: (e2) => onTouchStart(e2),
11792
- onTouchMove: (e2) => onTouchMove(e2),
11793
- onTouchEnd,
11794
- onTouchCancel: onTouchEnd,
11795
- onClick: (e2) => e2.stopPropagation()
11796
- },
11797
- renderButton()
11798
- ))), maxDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "max" }, maxDescription || max));
11737
+ };
11738
+ const renderMark = () => {
11739
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
11740
+ return /* @__PURE__ */ React.createElement(
11741
+ "span",
11742
+ {
11743
+ key: mark,
11744
+ className: markClassName(mark),
11745
+ style: marksStyle(mark)
11746
+ },
11747
+ Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
11748
+ /* @__PURE__ */ React.createElement(
11749
+ "span",
11750
+ {
11751
+ className: classNames("nut-range-tick", {
11752
+ active: tickClass(mark)
11753
+ })
11754
+ }
11755
+ )
11756
+ );
11757
+ })));
11758
+ };
11759
+ return /* @__PURE__ */ React.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React.createElement("div", { ref: root2, className: classes, onClick: (e2) => click(e2) }, renderMark(), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range2 ? renderRangeButton() : renderSingleButton())), maxDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "max" }, maxDescription || max));
11799
11760
  };
11800
11761
  Range.displayName = "NutRange";
11801
11762
  const defaultProps$O = {
@@ -15065,15 +15026,14 @@
15065
15026
  size: "",
15066
15027
  shape: "round",
15067
15028
  icon: "",
15068
- fit: "cover",
15069
15029
  background: "#eee",
15070
15030
  color: "#666",
15031
+ fit: "cover",
15071
15032
  src: "",
15072
15033
  alt: ""
15073
15034
  };
15074
15035
  const classPrefix$a = `nut-avatar`;
15075
15036
  const Avatar = (props) => {
15076
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
15077
15037
  const {
15078
15038
  children,
15079
15039
  size,
@@ -15081,9 +15041,9 @@
15081
15041
  background,
15082
15042
  color,
15083
15043
  src,
15044
+ alt,
15084
15045
  icon,
15085
15046
  fit,
15086
- alt,
15087
15047
  className,
15088
15048
  style,
15089
15049
  onClick,
@@ -15099,9 +15059,10 @@
15099
15059
  const avatarRef = React.useRef(null);
15100
15060
  const parent = React.useContext(AvatarContext);
15101
15061
  const sizeValue = ["large", "normal", "small"];
15062
+ const { propAvatarGroup, avatarGroupRef } = parent;
15102
15063
  const classes = classNames({
15103
- [`nut-avatar-${((_a = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _a.size) || size || "normal"}`]: true,
15104
- [`nut-avatar-${((_b = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _b.shape) || shape}`]: true
15064
+ [`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
15065
+ [`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
15105
15066
  });
15106
15067
  const cls = classNames(classPrefix$a, classes, className);
15107
15068
  const styles = {
@@ -15109,52 +15070,52 @@
15109
15070
  height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
15110
15071
  backgroundColor: `${background}`,
15111
15072
  color,
15112
- marginLeft: avatarIndex !== 1 && ((_c = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c.gap) ? `${(_d = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _d.gap}px` : "",
15113
- zIndex: ((_e = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _e.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
15073
+ marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
15074
+ zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
15114
15075
  ...style
15115
15076
  };
15116
15077
  const maxStyles = {
15117
- backgroundColor: `${(_f = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _f.maxBackground}`,
15118
- color: `${(_g = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _g.maxColor}`
15078
+ backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
15079
+ color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
15119
15080
  };
15081
+ const avatarLength = React.useCallback(
15082
+ (children2) => {
15083
+ var _a, _b;
15084
+ for (let i2 = 0; i2 < children2.length; i2++) {
15085
+ if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
15086
+ children2[i2].setAttribute("data-index", i2 + 1);
15087
+ }
15088
+ }
15089
+ const index = Number((_b = (_a = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
15090
+ const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
15091
+ setMaxSum(children2.length);
15092
+ setAvatarIndex(index);
15093
+ if (index === children2.length && index !== maxCount && children2.length > maxCount) {
15094
+ setShowMax(true);
15095
+ }
15096
+ },
15097
+ [propAvatarGroup == null ? void 0 : propAvatarGroup.max]
15098
+ );
15120
15099
  React.useEffect(() => {
15121
- var _a2;
15122
- const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
15100
+ const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
15123
15101
  if (avatarChildren) {
15124
15102
  avatarLength(avatarChildren);
15125
15103
  }
15126
- }, []);
15104
+ }, [avatarLength, avatarGroupRef]);
15127
15105
  const isAvatarInClassList = (element) => {
15128
- var _a2, _b2;
15106
+ var _a, _b;
15129
15107
  if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
15130
15108
  return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
15131
15109
  }
15132
- return ((_a2 = element.classList) == null ? void 0 : _a2.tokenList[0]) === "nut-avatar" || ((_b2 = element.classList) == null ? void 0 : _b2.tokenList.values().next().value) === "nut-avatar";
15133
- };
15134
- const avatarLength = (children2) => {
15135
- var _a2, _b2, _c2;
15136
- for (let i2 = 0; i2 < children2.length; i2++) {
15137
- if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
15138
- children2[i2].setAttribute("data-index", i2 + 1);
15139
- }
15140
- }
15141
- const index = (_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index;
15142
- const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
15143
- setMaxSum(children2.length);
15144
- setAvatarIndex(index);
15145
- if (index === children2.length && index !== maxCount && children2.length > maxCount) {
15146
- setShowMax(true);
15147
- }
15110
+ return ((_a = element.classList) == null ? void 0 : _a.tokenList[0]) === "nut-avatar" || ((_b = element.classList) == null ? void 0 : _b.tokenList.values().next().value) === "nut-avatar";
15148
15111
  };
15149
15112
  const errorEvent = () => {
15150
- if (onError) {
15151
- onError();
15152
- }
15113
+ onError && onError();
15153
15114
  };
15154
15115
  const clickAvatar = (e2) => {
15155
15116
  onClick && onClick(e2);
15156
15117
  };
15157
- return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !((_h = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _h.max) || avatarIndex <= ((_i = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _i.max)) && /* @__PURE__ */ React.createElement(
15118
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(
15158
15119
  "div",
15159
15120
  {
15160
15121
  className: cls,
@@ -15163,7 +15124,7 @@
15163
15124
  onClick: clickAvatar,
15164
15125
  ref: avatarRef
15165
15126
  },
15166
- (!((_j = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _j.max) || avatarIndex <= ((_k = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _k.max)) && /* @__PURE__ */ React.createElement(React.Fragment, null, src && /* @__PURE__ */ React.createElement(
15127
+ (!(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(React.Fragment, null, src && /* @__PURE__ */ React.createElement(
15167
15128
  Image$1,
15168
15129
  {
15169
15130
  className: "avatar-img",
@@ -15175,7 +15136,7 @@
15175
15136
  ...icon.props,
15176
15137
  className: `${icon.props.className || ""} icon`
15177
15138
  }) : null, children && /* @__PURE__ */ React.createElement("span", { className: "text" }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(D, { className: "icon" })),
15178
- showMax && /* @__PURE__ */ React.createElement("div", { className: "text" }, ((_l = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _l.maxContent) ? (_m = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _m.maxContent : `+ ${avatarIndex - Number(((_n = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _n.max) || 0)}`)
15139
+ showMax && /* @__PURE__ */ React.createElement("div", { className: "text" }, (propAvatarGroup == null ? void 0 : propAvatarGroup.maxContent) ? propAvatarGroup == null ? void 0 : propAvatarGroup.maxContent : `+ ${avatarIndex - Number((propAvatarGroup == null ? void 0 : propAvatarGroup.max) || 0)}`)
15179
15140
  ));
15180
15141
  };
15181
15142
  Avatar.displayName = "NutAvatar";
@@ -15640,22 +15601,22 @@
15640
15601
  className,
15641
15602
  thousands,
15642
15603
  style,
15643
- ...reset
15604
+ ...rest
15644
15605
  } = mergeProps(defaultProps$q, props);
15645
15606
  const classPrefix2 = "nut-countup";
15646
15607
  const countupRef = React.useRef(null);
15647
15608
  const timerRef = React.useRef(0);
15648
15609
  const numbers = Array.from({ length: 10 }, (v, i2) => i2);
15649
- const getShowNumber = () => {
15610
+ const getShowNumber = React.useCallback(() => {
15650
15611
  const splitArr = value.split(".");
15651
15612
  const intNumber = length && splitArr[0].length < length ? (Array(length).join("0") + splitArr[0]).slice(-length) : splitArr[0];
15652
15613
  const currNumber = `${thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : intNumber}${splitArr[1] ? "." : ""}${splitArr[1] || ""}`;
15653
15614
  return currNumber.split("");
15654
- };
15615
+ }, [length, thousands, value]);
15655
15616
  const [numerArr, setNumerArr] = React.useState([]);
15656
15617
  const [transformArr, setTransformArr] = React.useState([]);
15657
15618
  const isLoaded = React.useRef(false);
15658
- const setNumberTransform = () => {
15619
+ const setNumberTransform = React.useCallback(() => {
15659
15620
  if (countupRef.current && numerArr.length) {
15660
15621
  Taro.createSelectorQuery().selectAll(".nut-countup-listitem").node((numberItems) => {
15661
15622
  const transformArrCache = [];
@@ -15670,7 +15631,7 @@
15670
15631
  setTransformArr([...transformArrCache]);
15671
15632
  }).exec();
15672
15633
  }
15673
- };
15634
+ }, [numerArr]);
15674
15635
  const numberEaseStyle = (idx) => {
15675
15636
  return {
15676
15637
  transition: `transform ${duration}s ease-in-out`,
@@ -15679,7 +15640,7 @@
15679
15640
  };
15680
15641
  React.useEffect(() => {
15681
15642
  setNumberTransform();
15682
- }, [numerArr]);
15643
+ }, [numerArr, setNumberTransform]);
15683
15644
  React.useEffect(() => {
15684
15645
  if (!isLoaded.current) {
15685
15646
  isLoaded.current = true;
@@ -15692,7 +15653,7 @@
15692
15653
  return () => {
15693
15654
  window.clearTimeout(timerRef.current);
15694
15655
  };
15695
- }, [value]);
15656
+ }, [value, delay, getShowNumber]);
15696
15657
  return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
15697
15658
  return /* @__PURE__ */ React.createElement(
15698
15659
  "li",
@@ -15807,7 +15768,7 @@
15807
15768
  onPlay == null ? void 0 : onPlay(audioCtx);
15808
15769
  });
15809
15770
  audioCtx.onCanplay(() => {
15810
- const intervalID = setInterval(function() {
15771
+ const intervalID = setInterval(() => {
15811
15772
  if (audioCtx.duration !== 0) {
15812
15773
  setTotalSeconds(audioCtx.duration);
15813
15774
  clearInterval(intervalID);
@@ -15824,8 +15785,7 @@
15824
15785
  setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
15825
15786
  });
15826
15787
  audioCtx.onError((res) => {
15827
- console.warn("code", res.errCode);
15828
- console.warn("message", res.errMsg);
15788
+ console.warn("onError", res.errCode, res.errMsg);
15829
15789
  });
15830
15790
  function formatSeconds(value) {
15831
15791
  if (!value) {