@nutui/nutui-react 2.6.21 → 2.6.23

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 (65) hide show
  1. package/CHANGELOG.md +32 -5
  2. package/dist/esm/ActionSheet/style/style.css +1 -1
  3. package/dist/esm/Address/style/style.css +1 -1
  4. package/dist/esm/AnimatingNumbers.js +4 -4
  5. package/dist/esm/Audio/style/style.css +1 -1
  6. package/dist/esm/Avatar.js +23 -26
  7. package/dist/esm/AvatarCropper.js +1 -1
  8. package/dist/esm/BackTop.js +30 -43
  9. package/dist/esm/Calendar/style/style.css +1 -1
  10. package/dist/esm/Calendar.js +3 -3
  11. package/dist/esm/CalendarCard.js +1 -1
  12. package/dist/esm/CalendarItem.js +3 -3
  13. package/dist/esm/Cascader/style/style.css +1 -1
  14. package/dist/esm/DatePicker/style/style.css +1 -1
  15. package/dist/esm/Dialog/style/style.css +1 -1
  16. package/dist/esm/Dialog.js +3 -3
  17. package/dist/esm/FixedNav/style/style.css +1 -1
  18. package/dist/esm/ImagePreview/style/style.css +1 -1
  19. package/dist/esm/Menu/style/style.css +1 -1
  20. package/dist/esm/Menu.js +12 -12
  21. package/dist/esm/MenuItem/style/style.css +1 -1
  22. package/dist/esm/NavBar/style/style.css +1 -1
  23. package/dist/esm/NavBar.js +7 -2
  24. package/dist/esm/NumberKeyboard/style/style.css +1 -1
  25. package/dist/esm/Overlay/style/style.css +1 -1
  26. package/dist/esm/Picker/style/style.css +1 -1
  27. package/dist/esm/Popover/style/style.css +1 -1
  28. package/dist/esm/Popup/style/style.css +1 -1
  29. package/dist/esm/RadioGroup.js +5 -4
  30. package/dist/esm/Range/style/style.css +1 -1
  31. package/dist/esm/Range.js +49 -44
  32. package/dist/esm/ShortPassword/style/style.css +1 -1
  33. package/dist/esm/SideNavBar/style/style.css +1 -1
  34. package/dist/esm/TimeSelect/style/style.css +1 -1
  35. package/dist/esm/Tour/style/style.css +1 -1
  36. package/dist/esm/button2.js +2 -2
  37. package/dist/esm/cascader2.js +1 -1
  38. package/dist/esm/configprovider2.js +138 -1
  39. package/dist/esm/menuitem2.js +15 -15
  40. package/dist/esm/overlay2.js +2 -1
  41. package/dist/esm/popup2.js +2 -1
  42. package/dist/esm/radio2.js +19 -16
  43. package/dist/esm/raf.js +10 -1
  44. package/dist/locales/base.js +1 -1
  45. package/dist/locales/en-US.js +1 -1
  46. package/dist/locales/id-ID.js +1 -1
  47. package/dist/locales/tr-TR.js +1 -1
  48. package/dist/locales/zh-CN.js +1 -1
  49. package/dist/locales/zh-TW.js +1 -1
  50. package/dist/locales/zh-UG.js +1 -1
  51. package/dist/nutui.react.es.js +284 -324
  52. package/dist/nutui.react.umd.js +284 -324
  53. package/dist/packages/navbar/navbar.scss +0 -5
  54. package/dist/packages/overlay/overlay.scss +0 -4
  55. package/dist/packages/range/range.scss +2 -0
  56. package/dist/style.css +1 -1
  57. package/dist/types/packages/avatar/avatar.d.ts +5 -5
  58. package/dist/types/packages/calendar/calendar.d.ts +10 -0
  59. package/dist/types/packages/calendar/calendar.taro.d.ts +2 -0
  60. package/dist/types/packages/calendaritem/calendaritem.d.ts +1 -0
  61. package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +1 -0
  62. package/dist/types/packages/overlay/overlay.d.ts +2 -2
  63. package/package.json +1 -1
  64. package/dist/esm/configprovider.taro.js +0 -23
  65. package/dist/esm/zh-CN.js +0 -141
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.6.21 Fri Sep 27 2024 14:09:32 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.23 Fri Oct 18 2024 14:16:05 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -635,7 +635,7 @@ const Button = React__default.forwardRef(
635
635
  };
636
636
  const getStyle = useCallback(() => {
637
637
  const style2 = {};
638
- if (props.color) {
638
+ if (color) {
639
639
  if (props.fill === "outline" || props.fill === "dashed") {
640
640
  style2.color = color;
641
641
  if (!(color == null ? void 0 : color.includes("gradient"))) {
@@ -648,7 +648,7 @@ const Button = React__default.forwardRef(
648
648
  }
649
649
  }
650
650
  return style2;
651
- }, [color]);
651
+ }, [color, props.fill]);
652
652
  const handleClick2 = (e) => {
653
653
  if (!loading && !disabled && onClick) {
654
654
  onClick(e);
@@ -1854,7 +1854,7 @@ const zhCN = {
1854
1854
  };
1855
1855
  const inBrowser = typeof window !== "undefined";
1856
1856
  function requestAniFrame() {
1857
- if (typeof window !== "undefined") {
1857
+ if (inBrowser) {
1858
1858
  const _window = window;
1859
1859
  return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
1860
1860
  _window.setTimeout(callback, 1e3 / 60);
@@ -1864,22 +1864,30 @@ function requestAniFrame() {
1864
1864
  setTimeout(callback, 1e3 / 60);
1865
1865
  };
1866
1866
  }
1867
+ function cancelRaf(id) {
1868
+ if (inBrowser) {
1869
+ const _window = window;
1870
+ (_window.cancelAnimationFrame || _window.webkitCancelAnimationFrame)(id);
1871
+ } else {
1872
+ clearTimeout(id);
1873
+ }
1874
+ }
1867
1875
  const requestAniFrame$1 = requestAniFrame();
1868
1876
  const classPrefix$p = "nut-configprovider";
1869
- const defaultConfigRef$1 = {
1877
+ const defaultConfigRef = {
1870
1878
  current: {
1871
1879
  locale: zhCN
1872
1880
  }
1873
1881
  };
1874
1882
  const setDefaultConfig = (config2) => {
1875
- defaultConfigRef$1.current = config2;
1883
+ defaultConfigRef.current = config2;
1876
1884
  };
1877
- const getDefaultConfig$1 = () => {
1878
- return defaultConfigRef$1.current;
1885
+ const getDefaultConfig = () => {
1886
+ return defaultConfigRef.current;
1879
1887
  };
1880
- const ConfigContext$1 = createContext(null);
1881
- const useConfig$1 = () => {
1882
- return useContext(ConfigContext$1) ?? getDefaultConfig$1();
1888
+ const ConfigContext = createContext(null);
1889
+ const useConfig = () => {
1890
+ return useContext(ConfigContext) ?? getDefaultConfig();
1883
1891
  };
1884
1892
  function convertThemeVarsToCSSVars(themeVars) {
1885
1893
  const cssVars = {};
@@ -1889,7 +1897,7 @@ function convertThemeVarsToCSSVars(themeVars) {
1889
1897
  return cssVars;
1890
1898
  }
1891
1899
  const useRtl = () => {
1892
- const { direction } = useConfig$1();
1900
+ const { direction } = useConfig();
1893
1901
  if (direction) {
1894
1902
  return direction === "rtl";
1895
1903
  }
@@ -1900,7 +1908,7 @@ const ConfigProvider = (props) => {
1900
1908
  const mergedConfig = useMemo(
1901
1909
  () => {
1902
1910
  return {
1903
- ...getDefaultConfig$1(),
1911
+ ...getDefaultConfig(),
1904
1912
  ...config2,
1905
1913
  direction
1906
1914
  };
@@ -1914,7 +1922,7 @@ const ConfigProvider = (props) => {
1914
1922
  const cssVarStyle = React__default.useMemo(() => {
1915
1923
  return convertThemeVarsToCSSVars(mergedConfig.theme || {});
1916
1924
  }, [mergedConfig.theme]);
1917
- return /* @__PURE__ */ React__default.createElement(ConfigContext$1.Provider, { value: mergedConfig }, /* @__PURE__ */ React__default.createElement(
1925
+ return /* @__PURE__ */ React__default.createElement(ConfigContext.Provider, { value: mergedConfig }, /* @__PURE__ */ React__default.createElement(
1918
1926
  "div",
1919
1927
  {
1920
1928
  className: classNames(classPrefix$p, className),
@@ -2782,7 +2790,8 @@ const Overlay = (props) => {
2782
2790
  setInnerVisible(false);
2783
2791
  }
2784
2792
  }, [visible]);
2785
- useLockScroll(nodeRef, !!lockScroll && innerVisible);
2793
+ const shouldLockScroll = !innerVisible ? false : lockScroll;
2794
+ useLockScroll(nodeRef, shouldLockScroll);
2786
2795
  const classes = classNames(classPrefix2, className);
2787
2796
  const styles = {
2788
2797
  ...style
@@ -3336,31 +3345,36 @@ const BackTop = (props) => {
3336
3345
  const [scrollTop, SetScrollTop] = useState(0);
3337
3346
  let startTime = 0;
3338
3347
  const scrollEl = useRef(null);
3339
- useEffect(() => {
3340
- init();
3341
- return () => removeEventListener();
3342
- }, []);
3343
- const init = () => {
3348
+ const cls = classNames(classPrefix2, { show: backTop }, className);
3349
+ const scrollListener = useCallback(() => {
3350
+ var _a;
3351
+ let top = null;
3352
+ if (scrollEl.current instanceof Window) {
3353
+ top = scrollEl.current.scrollY;
3354
+ } else {
3355
+ top = (_a = scrollEl.current) == null ? void 0 : _a.scrollTop;
3356
+ }
3357
+ SetScrollTop(top);
3358
+ SetBackTop(top >= threshold);
3359
+ }, [threshold]);
3360
+ const init = useCallback(() => {
3361
+ var _a, _b;
3344
3362
  if (target && document.getElementById(target)) {
3345
3363
  scrollEl.current = document.getElementById(target);
3346
3364
  } else {
3347
3365
  scrollEl.current = window;
3348
3366
  }
3349
- addEventListener();
3350
- initCancelAniFrame();
3351
- };
3352
- const scrollListener = () => {
3353
- let top = null;
3354
- if (scrollEl.current instanceof Window) {
3355
- top = scrollEl.current.pageYOffset;
3356
- SetScrollTop(top);
3357
- } else {
3358
- top = scrollEl.current.scrollTop;
3359
- SetScrollTop(top);
3360
- }
3361
- const showBtn = top >= threshold;
3362
- SetBackTop(showBtn);
3363
- };
3367
+ (_a = scrollEl.current) == null ? void 0 : _a.addEventListener("scroll", scrollListener, false);
3368
+ (_b = scrollEl.current) == null ? void 0 : _b.addEventListener("resize", scrollListener, false);
3369
+ }, [target, scrollListener]);
3370
+ useEffect(() => {
3371
+ init();
3372
+ return () => {
3373
+ var _a, _b;
3374
+ (_a = scrollEl.current) == null ? void 0 : _a.removeEventListener("scroll", scrollListener, false);
3375
+ (_b = scrollEl.current) == null ? void 0 : _b.removeEventListener("resize", scrollListener, false);
3376
+ };
3377
+ }, [init, scrollListener]);
3364
3378
  const scroll = (y = 0) => {
3365
3379
  if (scrollEl.current instanceof Window) {
3366
3380
  window.scrollTo(0, y);
@@ -3376,27 +3390,13 @@ const BackTop = (props) => {
3376
3390
  scroll(y);
3377
3391
  cid = requestAniFrame$1(fn);
3378
3392
  if (t === duration || y === 0) {
3379
- window.cancelAnimationFrame(cid);
3393
+ cancelRaf(cid);
3380
3394
  }
3381
3395
  });
3382
3396
  };
3383
- const initCancelAniFrame = () => {
3384
- window.cancelAnimationFrame = window.webkitCancelAnimationFrame;
3385
- };
3386
- function addEventListener() {
3387
- var _a, _b;
3388
- (_a = scrollEl.current) == null ? void 0 : _a.addEventListener("scroll", scrollListener, false);
3389
- (_b = scrollEl.current) == null ? void 0 : _b.addEventListener("resize", scrollListener, false);
3390
- }
3391
- function removeEventListener() {
3392
- var _a, _b;
3393
- (_a = scrollEl.current) == null ? void 0 : _a.removeEventListener("scroll", scrollListener, false);
3394
- (_b = scrollEl.current) == null ? void 0 : _b.removeEventListener("resize", scrollListener, false);
3395
- }
3396
3397
  const goTop = (e) => {
3397
3398
  onClick && onClick(e);
3398
- const otime = +/* @__PURE__ */ new Date();
3399
- startTime = otime;
3399
+ startTime = +/* @__PURE__ */ new Date();
3400
3400
  duration > 0 ? scrollAnimation() : scroll();
3401
3401
  };
3402
3402
  const styles = Object.keys(style || {}).length !== 0 ? {
@@ -3407,23 +3407,7 @@ const BackTop = (props) => {
3407
3407
  bottom: "20px",
3408
3408
  zIndex
3409
3409
  };
3410
- return /* @__PURE__ */ React__default.createElement(
3411
- "div",
3412
- {
3413
- className: classNames(
3414
- classPrefix2,
3415
- {
3416
- show: backTop
3417
- },
3418
- className
3419
- ),
3420
- style: styles,
3421
- onClick: (e) => {
3422
- goTop(e);
3423
- }
3424
- },
3425
- children || /* @__PURE__ */ React__default.createElement(s$1, { width: 19, height: 19, className: "nut-backtop-main" })
3426
- );
3410
+ return /* @__PURE__ */ React__default.createElement("div", { className: cls, style: styles, onClick: (e) => goTop(e) }, children || /* @__PURE__ */ React__default.createElement(s$1, { width: 19, height: 19, className: "nut-backtop-main" }));
3427
3411
  };
3428
3412
  BackTop.displayName = "NutBackTop";
3429
3413
  function clamp$2(v, min, max) {
@@ -8461,7 +8445,7 @@ const defaultProps$1g = {
8461
8445
  }
8462
8446
  };
8463
8447
  const FixedNav = (props) => {
8464
- const { locale } = useConfig$1();
8448
+ const { locale } = useConfig();
8465
8449
  const {
8466
8450
  className,
8467
8451
  overlay,
@@ -8626,11 +8610,10 @@ const NavBar = (props) => {
8626
8610
  };
8627
8611
  const classes = classNames({
8628
8612
  [`${classPrefix2}-fixed`]: fixed,
8629
- [`${classPrefix2}-safe-area-inset-top`]: safeAreaInsetTop,
8630
8613
  [`${classPrefix2}-title-align-${titleAlign}`]: true
8631
8614
  });
8632
8615
  const cls = classNames(classPrefix2, classes, className);
8633
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
8616
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React__default.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
8634
8617
  };
8635
8618
  NavBar.displayName = "NutNavBar";
8636
8619
  const defaultProps$1e = {
@@ -8693,7 +8676,8 @@ const Popup = (props) => {
8693
8676
  const [innerVisible, setInnerVisible] = useState(visible);
8694
8677
  const [showChildren, setShowChildren] = useState(true);
8695
8678
  const [transitionName, setTransitionName] = useState("");
8696
- useLockScroll(nodeRef, innerVisible && lockScroll);
8679
+ const shouldLockScroll = !innerVisible ? false : lockScroll;
8680
+ useLockScroll(nodeRef, shouldLockScroll);
8697
8681
  const classPrefix2 = "nut-popup";
8698
8682
  const baseStyle = {
8699
8683
  zIndex: index
@@ -9559,19 +9543,6 @@ class Tree {
9559
9543
  return pathNodes;
9560
9544
  }
9561
9545
  }
9562
- const defaultConfigRef = {
9563
- current: {
9564
- locale: zhCN,
9565
- direction: "ltr"
9566
- }
9567
- };
9568
- const getDefaultConfig = () => {
9569
- return defaultConfigRef.current;
9570
- };
9571
- const ConfigContext = createContext(null);
9572
- const useConfig = () => {
9573
- return useContext(ConfigContext) ?? getDefaultConfig();
9574
- };
9575
9546
  const defaultProps$16 = {
9576
9547
  ...ComponentDefaults,
9577
9548
  activeColor: "",
@@ -9988,7 +9959,7 @@ const defaultProps$14 = {
9988
9959
  custom: false
9989
9960
  };
9990
9961
  const ExistRender = (props) => {
9991
- const { locale } = useConfig$1();
9962
+ const { locale } = useConfig();
9992
9963
  const {
9993
9964
  children,
9994
9965
  type: type4,
@@ -10044,7 +10015,7 @@ const defaultProps$13 = {
10044
10015
  backIcon: null
10045
10016
  };
10046
10017
  const InternalAddress = (props, ref) => {
10047
- const { locale } = useConfig$1();
10018
+ const { locale } = useConfig();
10048
10019
  const {
10049
10020
  style,
10050
10021
  className,
@@ -10439,7 +10410,7 @@ const defaultProps$12 = {
10439
10410
  }
10440
10411
  };
10441
10412
  const CalendarItem = React__default.forwardRef((props, ref) => {
10442
- const { locale } = useConfig$1();
10413
+ const { locale } = useConfig();
10443
10414
  const {
10444
10415
  style,
10445
10416
  className,
@@ -10461,6 +10432,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10461
10432
  firstDayOfWeek,
10462
10433
  disableDate,
10463
10434
  renderHeaderButtons,
10435
+ renderBottomButton,
10464
10436
  renderDay,
10465
10437
  renderDayTop,
10466
10438
  renderDayBottom,
@@ -11003,7 +10975,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
11003
10975
  );
11004
10976
  };
11005
10977
  const renderFooter = () => {
11006
- return /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React__default.createElement("div", { className: "calendar-confirm-btn", onClick: confirm2 }, confirmText || locale.confirm));
10978
+ return /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React__default.createElement("div", { onClick: confirm2 }, renderBottomButton ? renderBottomButton() : /* @__PURE__ */ React__default.createElement("div", { className: "calendar-confirm-btn" }, confirmText || locale.confirm)));
11007
10979
  };
11008
10980
  return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
11009
10981
  });
@@ -11041,7 +11013,7 @@ const defaultProps$11 = {
11041
11013
  }
11042
11014
  };
11043
11015
  const Calendar = React__default.forwardRef((props, ref) => {
11044
- const { locale } = useConfig$1();
11016
+ const { locale } = useConfig();
11045
11017
  const {
11046
11018
  style,
11047
11019
  className,
@@ -11062,8 +11034,10 @@ const Calendar = React__default.forwardRef((props, ref) => {
11062
11034
  showSubTitle,
11063
11035
  scrollAnimation,
11064
11036
  firstDayOfWeek,
11037
+ closeIcon,
11065
11038
  disableDate,
11066
11039
  renderHeaderButtons,
11040
+ renderBottomButton,
11067
11041
  renderDay,
11068
11042
  renderDayTop,
11069
11043
  renderDayBottom,
@@ -11106,6 +11080,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
11106
11080
  children,
11107
11081
  type: type4,
11108
11082
  autoBackfill,
11083
+ renderBottomButton,
11109
11084
  popup,
11110
11085
  title: title || locale.calendaritem.title,
11111
11086
  defaultValue,
@@ -11138,6 +11113,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
11138
11113
  position: "bottom",
11139
11114
  round: true,
11140
11115
  closeable: true,
11116
+ closeIcon,
11141
11117
  destroyOnClose: true,
11142
11118
  onOverlayClick: closePopup,
11143
11119
  onCloseIconClick: closePopup,
@@ -11258,7 +11234,7 @@ const defaultProps$10 = {
11258
11234
  };
11259
11235
  const prefixCls = "nut-calendarcard";
11260
11236
  const CalendarCard = React__default.forwardRef((props, ref) => {
11261
- const { locale } = useConfig$1();
11237
+ const { locale } = useConfig();
11262
11238
  const {
11263
11239
  style,
11264
11240
  className,
@@ -12104,7 +12080,7 @@ const defaultProps$Z = {
12104
12080
  duration: 1e3
12105
12081
  };
12106
12082
  const InternalPicker = (props, ref) => {
12107
- const { locale } = useConfig$1();
12083
+ const { locale } = useConfig();
12108
12084
  const {
12109
12085
  children,
12110
12086
  visible,
@@ -12400,7 +12376,7 @@ const DatePicker = (props) => {
12400
12376
  ...defaultProps$Y,
12401
12377
  ...props
12402
12378
  };
12403
- const { locale } = useConfig$1();
12379
+ const { locale } = useConfig();
12404
12380
  const lang = locale.datepicker;
12405
12381
  const zhCNType = {
12406
12382
  day: lang.day,
@@ -14207,7 +14183,7 @@ const defaultProps$V = {
14207
14183
  const Input = forwardRef(
14208
14184
  (props, ref) => {
14209
14185
  const rtl = useRtl();
14210
- const { locale } = useConfig$1();
14186
+ const { locale } = useConfig();
14211
14187
  const {
14212
14188
  type: type4,
14213
14189
  name,
@@ -14679,9 +14655,21 @@ const MenuItem = forwardRef((props, ref) => {
14679
14655
  useEffect(() => {
14680
14656
  setShowPopup(show2);
14681
14657
  }, [show2]);
14658
+ const getParentOffset = useCallback(() => {
14659
+ setTimeout(() => {
14660
+ const p2 = parent.menuRef.current;
14661
+ if (p2) {
14662
+ const rect = p2.getBoundingClientRect();
14663
+ setPosition({
14664
+ height: rect.height,
14665
+ top: rect.top
14666
+ });
14667
+ }
14668
+ });
14669
+ }, [parent.menuRef]);
14682
14670
  useEffect(() => {
14683
14671
  getParentOffset();
14684
- }, [showPopup]);
14672
+ }, [showPopup, getParentOffset]);
14685
14673
  useImperativeHandle(ref, () => ({
14686
14674
  toggle: (s2) => {
14687
14675
  const from = "REF";
@@ -14715,18 +14703,6 @@ const MenuItem = forwardRef((props, ref) => {
14715
14703
  const scrollParent = useMemo$1(() => {
14716
14704
  return getScrollParent(parent.menuRef, window);
14717
14705
  }, [parent.menuRef]);
14718
- const getParentOffset = () => {
14719
- setTimeout(() => {
14720
- const p2 = parent.menuRef.current;
14721
- if (p2) {
14722
- const rect = p2.getBoundingClientRect();
14723
- setPosition({
14724
- height: rect.height,
14725
- top: rect.top
14726
- });
14727
- }
14728
- });
14729
- };
14730
14706
  useEffect(() => {
14731
14707
  if (!parent.lockScroll) {
14732
14708
  scrollParent == null ? void 0 : scrollParent.addEventListener("scroll", getParentOffset, false);
@@ -14734,7 +14710,7 @@ const MenuItem = forwardRef((props, ref) => {
14734
14710
  scrollParent == null ? void 0 : scrollParent.removeEventListener("scroll", getParentOffset, false);
14735
14711
  };
14736
14712
  }
14737
- }, []);
14713
+ }, [parent.lockScroll, scrollParent, getParentOffset]);
14738
14714
  const getPosition = () => {
14739
14715
  return direction === "down" ? {
14740
14716
  top: `${position.top + position.height}px`,
@@ -14865,24 +14841,29 @@ const Menu = (props) => {
14865
14841
  ...props
14866
14842
  };
14867
14843
  const menuRef = useRef(null);
14844
+ const [showMenuItem, setShowMenuItem] = useState([]);
14845
+ const [menuItemTitle, setMenuItemTitle] = useState([]);
14868
14846
  const [isScrollFixed, setIsScrollFixed] = useState(false);
14847
+ const cls = classNames(`nut-menu`, className, {
14848
+ "scroll-fixed": isScrollFixed
14849
+ });
14869
14850
  const getScrollTop = (el) => {
14870
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
14851
+ return Math.max(
14852
+ 0,
14853
+ el === window ? window.scrollY : el.scrollTop
14854
+ );
14871
14855
  };
14872
- const onScroll = () => {
14873
- const { scrollFixed: scrollFixed2 } = props;
14856
+ const onScroll = useCallback(() => {
14874
14857
  const scrollTop = getScrollTop(window);
14875
- const isFixed = scrollTop > (typeof scrollFixed2 === "boolean" ? 30 : Number(scrollFixed2));
14858
+ const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
14876
14859
  setIsScrollFixed(isFixed);
14877
- };
14860
+ }, [scrollFixed]);
14878
14861
  useEffect(() => {
14879
14862
  if (scrollFixed) {
14880
14863
  window.addEventListener("scroll", onScroll);
14881
14864
  }
14882
14865
  return () => window.removeEventListener("scroll", onScroll);
14883
- }, []);
14884
- const [showMenuItem, setShowMenuItem] = useState([]);
14885
- const [menuItemTitle, setMenuItemTitle] = useState([]);
14866
+ }, [scrollFixed, onScroll]);
14886
14867
  const toggleMenuItem = (index, from = "NORMAL") => {
14887
14868
  showMenuItem[index] = !showMenuItem[index];
14888
14869
  if (showMenuItem[index]) {
@@ -14986,26 +14967,15 @@ const Menu = (props) => {
14986
14967
  return null;
14987
14968
  });
14988
14969
  };
14989
- return /* @__PURE__ */ React__default.createElement(
14970
+ return /* @__PURE__ */ React__default.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React__default.createElement(
14990
14971
  "div",
14991
14972
  {
14992
- ...rest,
14993
- className: classNames(`nut-menu`, className, {
14994
- "scroll-fixed": isScrollFixed
14995
- }),
14996
- ref: menuRef
14973
+ className: classNames("nut-menu-bar", {
14974
+ opened: showMenuItem.includes(true)
14975
+ })
14997
14976
  },
14998
- /* @__PURE__ */ React__default.createElement(
14999
- "div",
15000
- {
15001
- className: classNames("nut-menu-bar", {
15002
- opened: showMenuItem.includes(true)
15003
- })
15004
- },
15005
- menuTitle()
15006
- ),
15007
- cloneChildren()
15008
- );
14977
+ menuTitle()
14978
+ ), cloneChildren());
15009
14979
  };
15010
14980
  Menu.displayName = "NutMenu";
15011
14981
  Menu.Item = MenuItem;
@@ -15020,7 +14990,7 @@ const defaultProps$R = {
15020
14990
  }
15021
14991
  };
15022
14992
  const NumberKeyboard = (props) => {
15023
- const { locale } = useConfig$1();
14993
+ const { locale } = useConfig();
15024
14994
  const {
15025
14995
  title,
15026
14996
  rightActions,
@@ -15202,6 +15172,13 @@ const RadioGroup = React__default.forwardRef(
15202
15172
  disabled,
15203
15173
  ...rest
15204
15174
  } = { ...defaultProps$Q, ...props };
15175
+ const cls = classNames(
15176
+ classPrefix$f,
15177
+ {
15178
+ [`${classPrefix$f}-${props.direction}`]: props.direction
15179
+ },
15180
+ className
15181
+ );
15205
15182
  const [val2State, setVal2State] = usePropsValue({
15206
15183
  defaultValue: props.defaultValue,
15207
15184
  value: props.value,
@@ -15224,7 +15201,7 @@ const RadioGroup = React__default.forwardRef(
15224
15201
  }
15225
15202
  );
15226
15203
  });
15227
- }, [options2]);
15204
+ }, [options2, labelPosition, val2State]);
15228
15205
  return /* @__PURE__ */ React__default.createElement(
15229
15206
  RadioContext.Provider,
15230
15207
  {
@@ -15241,20 +15218,7 @@ const RadioGroup = React__default.forwardRef(
15241
15218
  }
15242
15219
  }
15243
15220
  },
15244
- /* @__PURE__ */ React__default.createElement(
15245
- "div",
15246
- {
15247
- className: classNames(
15248
- classPrefix$f,
15249
- {
15250
- [`${classPrefix$f}-${props.direction}`]: props.direction
15251
- },
15252
- className
15253
- ),
15254
- ...rest
15255
- },
15256
- (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : children
15257
- )
15221
+ /* @__PURE__ */ React__default.createElement("div", { className: cls, ...rest }, (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : children)
15258
15222
  );
15259
15223
  }
15260
15224
  );
@@ -15312,29 +15276,6 @@ const Radio = (props) => {
15312
15276
  }
15313
15277
  };
15314
15278
  }
15315
- const renderLabel = () => {
15316
- return /* @__PURE__ */ React__default.createElement(
15317
- "div",
15318
- {
15319
- className: classNames(`${classPrefix2}-label`, {
15320
- [`${classPrefix2}-label-disabled`]: disabled
15321
- })
15322
- },
15323
- children
15324
- );
15325
- };
15326
- const renderButton = () => {
15327
- return /* @__PURE__ */ React__default.createElement(
15328
- "div",
15329
- {
15330
- className: classNames(`${classPrefix2}-button`, {
15331
- [`${classPrefix2}-button-active`]: checkedStatement,
15332
- [`${classPrefix2}-button-disabled`]: disabled
15333
- })
15334
- },
15335
- children
15336
- );
15337
- };
15338
15279
  const color = () => {
15339
15280
  return {
15340
15281
  [`${classPrefix2}-icon-disabled`]: disabled,
@@ -15358,8 +15299,21 @@ const Radio = (props) => {
15358
15299
  className: classNames(color())
15359
15300
  }) : /* @__PURE__ */ React__default.createElement(i$6, { className: classNames(color()) });
15360
15301
  };
15302
+ const renderLabel = () => {
15303
+ const labelcls = classNames(`${classPrefix2}-label`, {
15304
+ [`${classPrefix2}-label-disabled`]: disabled
15305
+ });
15306
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), /* @__PURE__ */ React__default.createElement("div", { className: labelcls }, children));
15307
+ };
15308
+ const renderButton = () => {
15309
+ const buttoncls = classNames(`${classPrefix2}-button`, {
15310
+ [`${classPrefix2}-button-active`]: checkedStatement,
15311
+ [`${classPrefix2}-button-disabled`]: disabled
15312
+ });
15313
+ return /* @__PURE__ */ React__default.createElement("div", { className: buttoncls }, children);
15314
+ };
15361
15315
  const renderByShape = (shape2) => {
15362
- return shape2 === "button" ? renderButton() : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
15316
+ return shape2 === "button" ? renderButton() : renderLabel();
15363
15317
  };
15364
15318
  const renderRadioItem = () => {
15365
15319
  return renderByShape(context && context.shape ? context.shape : shape);
@@ -15368,22 +15322,14 @@ const Radio = (props) => {
15368
15322
  if (disabled || checkedStatement) return;
15369
15323
  setCheckedStatement(!checkedStatement);
15370
15324
  };
15371
- return /* @__PURE__ */ React__default.createElement(
15372
- "div",
15325
+ const cls = classNames(
15326
+ classPrefix2,
15373
15327
  {
15374
- className: classNames(
15375
- classPrefix2,
15376
- {
15377
- [`${classPrefix2}-reverse`]: labelPosition === "left"
15378
- },
15379
- className
15380
- ),
15381
- style,
15382
- onClick: handleClick2,
15383
- ...rest
15328
+ [`${classPrefix2}-reverse`]: labelPosition === "left"
15384
15329
  },
15385
- renderRadioItem()
15330
+ className
15386
15331
  );
15332
+ return /* @__PURE__ */ React__default.createElement("div", { className: cls, style, onClick: handleClick2, ...rest }, renderRadioItem());
15387
15333
  };
15388
15334
  Radio.displayName = "NutRadio";
15389
15335
  Radio.Group = RadioGroup;
@@ -15405,9 +15351,6 @@ const Range = (props) => {
15405
15351
  button,
15406
15352
  vertical,
15407
15353
  marks,
15408
- onChange,
15409
- onStart,
15410
- onEnd,
15411
15354
  minDescription,
15412
15355
  maxDescription,
15413
15356
  currentDescription,
@@ -15415,7 +15358,10 @@ const Range = (props) => {
15415
15358
  max,
15416
15359
  step,
15417
15360
  value,
15418
- defaultValue
15361
+ defaultValue,
15362
+ onChange,
15363
+ onStart,
15364
+ onEnd
15419
15365
  } = { ...defaultProps$O, ...props };
15420
15366
  const classPrefix2 = "nut-range";
15421
15367
  const [buttonIndex, setButtonIndex] = useState(0);
@@ -15433,7 +15379,7 @@ const Range = (props) => {
15433
15379
  finalValue: 0,
15434
15380
  onChange: handleChange
15435
15381
  });
15436
- const [exactValue, setEaxctValue] = useState(
15382
+ const [exactValue, setExactValue] = useState(
15437
15383
  () => value || defaultValue || 0
15438
15384
  );
15439
15385
  const marksRef = useRef({});
@@ -15451,10 +15397,7 @@ const Range = (props) => {
15451
15397
  setMarksList(list);
15452
15398
  }
15453
15399
  }
15454
- }, [marks]);
15455
- const scope = () => {
15456
- return max - min;
15457
- };
15400
+ }, [marks, max, min]);
15458
15401
  const classes = classNames(classPrefix2, {
15459
15402
  [`${classPrefix2}-disabled`]: disabled,
15460
15403
  [`${classPrefix2}-vertical`]: vertical
@@ -15466,41 +15409,38 @@ const Range = (props) => {
15466
15409
  },
15467
15410
  className
15468
15411
  );
15469
- const markClassName = useCallback(
15470
- (mark) => {
15471
- const classPrefix22 = "nut-range-mark";
15472
- let lowerBound = min;
15473
- let upperBound = max;
15474
- if (range3 && Array.isArray(current)) {
15475
- lowerBound = current[0];
15476
- upperBound = current[1];
15477
- } else {
15478
- upperBound = current;
15479
- }
15480
- const isActive = mark <= upperBound && mark >= lowerBound;
15481
- return [
15482
- `${classPrefix22}-text`,
15483
- `${isActive ? `${classPrefix22}-text-active` : ""}`
15484
- ].join(" ");
15485
- },
15486
- [range3, current, min, max]
15487
- );
15412
+ const markClassName = (mark) => {
15413
+ const classPrefix22 = "nut-range-mark";
15414
+ let lowerBound = min;
15415
+ let upperBound = max;
15416
+ if (range3 && Array.isArray(current)) {
15417
+ lowerBound = current[0];
15418
+ upperBound = current[1];
15419
+ } else {
15420
+ upperBound = current;
15421
+ }
15422
+ const isActive = mark <= upperBound && mark >= lowerBound;
15423
+ return [
15424
+ `${classPrefix22}-text`,
15425
+ `${isActive ? `${classPrefix22}-text-active` : ""}`
15426
+ ].join(" ");
15427
+ };
15488
15428
  const isRange = (val) => {
15489
15429
  return !!range3 && Array.isArray(val);
15490
15430
  };
15431
+ const scope = useMemo$1(() => {
15432
+ if (max < min || max === min) {
15433
+ console.log("max 的值需要大于 min的值");
15434
+ }
15435
+ return max - min;
15436
+ }, [max, min]);
15491
15437
  const calcMainAxis = () => {
15492
15438
  const modelVal = current;
15493
- if (isRange(modelVal)) {
15494
- return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
15495
- }
15496
- return `${(modelVal - min) * 100 / scope()}%`;
15439
+ return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
15497
15440
  };
15498
15441
  const calcOffset = () => {
15499
15442
  const modelVal = current;
15500
- if (isRange(modelVal)) {
15501
- return `${(modelVal[0] - min) * 100 / scope()}%`;
15502
- }
15503
- return `0%`;
15443
+ return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
15504
15444
  };
15505
15445
  const barStyle = () => {
15506
15446
  if (vertical) {
@@ -15520,11 +15460,11 @@ const Range = (props) => {
15520
15460
  const marksStyle = (mark) => {
15521
15461
  const dir = rtl ? "right" : "left";
15522
15462
  let style = {
15523
- [dir]: `${(mark - min) / scope() * 100}%`
15463
+ [dir]: `${(mark - min) / scope * 100}%`
15524
15464
  };
15525
15465
  if (vertical) {
15526
15466
  style = {
15527
- top: `${(mark - min) / scope() * 100}%`
15467
+ top: `${(mark - min) / scope * 100}%`
15528
15468
  };
15529
15469
  }
15530
15470
  return style;
@@ -15571,8 +15511,8 @@ const Range = (props) => {
15571
15511
  delta = event.clientY - rect.top;
15572
15512
  total = rect.height;
15573
15513
  }
15574
- const value2 = min + delta / total * scope();
15575
- setEaxctValue(current);
15514
+ const value2 = min + delta / total * scope;
15515
+ setExactValue(current);
15576
15516
  if (isRange(current)) {
15577
15517
  const [left, right] = current;
15578
15518
  const middle = (left + right) / 2;
@@ -15590,7 +15530,7 @@ const Range = (props) => {
15590
15530
  return;
15591
15531
  }
15592
15532
  touch.start(event);
15593
- setEaxctValue(current);
15533
+ setExactValue(current);
15594
15534
  if (isRange(current)) {
15595
15535
  setStartValue(current.map(format2));
15596
15536
  } else {
@@ -15611,12 +15551,12 @@ const Range = (props) => {
15611
15551
  const rect = getRect(root2.current);
15612
15552
  let delta = touch.deltaX.current;
15613
15553
  let total = rect.width;
15614
- let diff = delta / total * scope();
15554
+ let diff = delta / total * scope;
15615
15555
  diff = rtl ? -diff : diff;
15616
15556
  if (vertical) {
15617
15557
  delta = touch.deltaY.current;
15618
15558
  total = rect.height;
15619
- diff = delta / total * scope();
15559
+ diff = delta / total * scope;
15620
15560
  }
15621
15561
  let newValue;
15622
15562
  if (isRange(startValue)) {
@@ -15625,7 +15565,7 @@ const Range = (props) => {
15625
15565
  } else {
15626
15566
  newValue = startValue + diff;
15627
15567
  }
15628
- setEaxctValue(newValue);
15568
+ setExactValue(newValue);
15629
15569
  updateValue(newValue);
15630
15570
  };
15631
15571
  const onTouchEnd = () => {
@@ -15645,56 +15585,64 @@ const Range = (props) => {
15645
15585
  const renderButton = (index) => {
15646
15586
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, button || /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-button" }, currentDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "number" }, currentDescription ? currentDescription(curValue(index)) : curValue(index))));
15647
15587
  };
15648
- return /* @__PURE__ */ React__default.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React__default.createElement("div", { ref: root2, className: classes, onClick: (e) => click(e) }, marksList.length > 0 && /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
15649
- return /* @__PURE__ */ React__default.createElement(
15650
- "span",
15651
- {
15652
- key: mark,
15653
- className: markClassName(mark),
15654
- style: marksStyle(mark)
15655
- },
15656
- Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
15657
- /* @__PURE__ */ React__default.createElement(
15658
- "span",
15588
+ const renderRangeButton = () => {
15589
+ return [0, 1].map((item, index) => {
15590
+ const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
15591
+ ${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
15592
+ return /* @__PURE__ */ React__default.createElement(
15593
+ "div",
15659
15594
  {
15660
- className: classNames("nut-range-tick", {
15661
- active: tickClass(mark)
15662
- })
15663
- }
15664
- )
15665
- );
15666
- })), /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range3 ? [0, 1].map((item, index) => {
15595
+ key: index,
15596
+ className: cls,
15597
+ onTouchStart: (e) => {
15598
+ setButtonIndex(index);
15599
+ onTouchStart(e);
15600
+ },
15601
+ onTouchMove,
15602
+ onTouchEnd,
15603
+ onTouchCancel: onTouchEnd,
15604
+ onClick: (e) => e.stopPropagation()
15605
+ },
15606
+ renderButton(index)
15607
+ );
15608
+ });
15609
+ };
15610
+ const renderSingleButton = () => {
15667
15611
  return /* @__PURE__ */ React__default.createElement(
15668
15612
  "div",
15669
15613
  {
15670
- key: index,
15671
- className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
15672
- ${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
15673
- onTouchStart: (e) => {
15674
- if (typeof index === "number") {
15675
- setButtonIndex(index);
15676
- }
15677
- onTouchStart(e);
15678
- },
15679
- onTouchMove: (e) => onTouchMove(e),
15614
+ className: "nut-range-button-wrapper",
15615
+ onTouchStart,
15616
+ onTouchMove,
15680
15617
  onTouchEnd,
15681
15618
  onTouchCancel: onTouchEnd,
15682
15619
  onClick: (e) => e.stopPropagation()
15683
15620
  },
15684
- renderButton(index)
15621
+ renderButton()
15685
15622
  );
15686
- }) : /* @__PURE__ */ React__default.createElement(
15687
- "div",
15688
- {
15689
- className: "nut-range-button-wrapper",
15690
- onTouchStart: (e) => onTouchStart(e),
15691
- onTouchMove: (e) => onTouchMove(e),
15692
- onTouchEnd,
15693
- onTouchCancel: onTouchEnd,
15694
- onClick: (e) => e.stopPropagation()
15695
- },
15696
- renderButton()
15697
- ))), maxDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "max" }, maxDescription || max));
15623
+ };
15624
+ const renderMark = () => {
15625
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
15626
+ return /* @__PURE__ */ React__default.createElement(
15627
+ "span",
15628
+ {
15629
+ key: mark,
15630
+ className: markClassName(mark),
15631
+ style: marksStyle(mark)
15632
+ },
15633
+ Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
15634
+ /* @__PURE__ */ React__default.createElement(
15635
+ "span",
15636
+ {
15637
+ className: classNames("nut-range-tick", {
15638
+ active: tickClass(mark)
15639
+ })
15640
+ }
15641
+ )
15642
+ );
15643
+ })));
15644
+ };
15645
+ return /* @__PURE__ */ React__default.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React__default.createElement("div", { ref: root2, className: classes, onClick: (e) => click(e) }, renderMark(), /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range3 ? renderRangeButton() : renderSingleButton())), maxDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "max" }, maxDescription || max));
15698
15646
  };
15699
15647
  Range.displayName = "NutRange";
15700
15648
  const defaultProps$N = {
@@ -15908,7 +15856,7 @@ const defaultProps$M = {
15908
15856
  };
15909
15857
  const SearchBar = (props) => {
15910
15858
  const classPrefix2 = "nut-searchbar";
15911
- const { locale } = useConfig$1();
15859
+ const { locale } = useConfig();
15912
15860
  const searchRef = useRef(null);
15913
15861
  const {
15914
15862
  value: outerValue,
@@ -16061,7 +16009,7 @@ const defaultProps$L = {
16061
16009
  autoFocus: false
16062
16010
  };
16063
16011
  const InternalShortPassword = (props, ref) => {
16064
- const { locale } = useConfig$1();
16012
+ const { locale } = useConfig();
16065
16013
  const {
16066
16014
  title,
16067
16015
  description,
@@ -16159,7 +16107,7 @@ const defaultProps$K = {
16159
16107
  unsupported: ""
16160
16108
  };
16161
16109
  const InternalSignature = (props, ref) => {
16162
- const { locale } = useConfig$1();
16110
+ const { locale } = useConfig();
16163
16111
  const {
16164
16112
  type: type4,
16165
16113
  lineWidth,
@@ -16340,7 +16288,7 @@ const defaultProps$I = {
16340
16288
  autoSize: false
16341
16289
  };
16342
16290
  const TextArea = (props) => {
16343
- const { locale } = useConfig$1();
16291
+ const { locale } = useConfig();
16344
16292
  const {
16345
16293
  className,
16346
16294
  value,
@@ -16764,7 +16712,7 @@ const defaultProps$G = {
16764
16712
  }
16765
16713
  };
16766
16714
  const InternalUploader = (props, ref) => {
16767
- const { locale } = useConfig$1();
16715
+ const { locale } = useConfig();
16768
16716
  const fileListRef = useRef([]);
16769
16717
  const {
16770
16718
  children,
@@ -17345,6 +17293,18 @@ const Content = (props) => {
17345
17293
  );
17346
17294
  };
17347
17295
  Content.displayName = "NutContent";
17296
+ const defaultDialogProps = {
17297
+ ...ComponentDefaults,
17298
+ overlay: true,
17299
+ overlayStyle: {},
17300
+ overlayClassName: "",
17301
+ onCancel: () => {
17302
+ },
17303
+ onClose: () => {
17304
+ },
17305
+ onOverlayClick: (e) => true,
17306
+ ...defaultOverlayProps
17307
+ };
17348
17308
  const DialogWrap = (props) => {
17349
17309
  const {
17350
17310
  visible,
@@ -17356,7 +17316,7 @@ const DialogWrap = (props) => {
17356
17316
  onClose,
17357
17317
  onCancel,
17358
17318
  onOverlayClick
17359
- } = props;
17319
+ } = mergeProps(defaultDialogProps, props);
17360
17320
  const onHandleClickOverlay = (e) => {
17361
17321
  if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
17362
17322
  const closed = onOverlayClick && onOverlayClick(e);
@@ -17404,7 +17364,7 @@ const defaultProps$E = {
17404
17364
  beforeClose: () => true
17405
17365
  };
17406
17366
  const BaseDialog = (props, ref) => {
17407
- const { locale } = useConfig$1();
17367
+ const { locale } = useConfig();
17408
17368
  const {
17409
17369
  visible,
17410
17370
  footer,
@@ -17701,7 +17661,7 @@ const defaultProps$B = {
17701
17661
  };
17702
17662
  const classPrefix$d = `nut-infiniteloading`;
17703
17663
  const InfiniteLoading = (props) => {
17704
- const { locale } = useConfig$1();
17664
+ const { locale } = useConfig();
17705
17665
  const {
17706
17666
  children,
17707
17667
  type: type4,
@@ -18771,7 +18731,7 @@ const defaultProps$x = {
18771
18731
  };
18772
18732
  const PullToRefresh = (p2) => {
18773
18733
  const classPrefix2 = "nut-pulltorefresh";
18774
- const { locale } = useConfig$1();
18734
+ const { locale } = useConfig();
18775
18735
  const props = {
18776
18736
  ...defaultProps$x,
18777
18737
  ...p2,
@@ -18952,7 +18912,6 @@ const defaultProps$v = {
18952
18912
  };
18953
18913
  const classPrefix$9 = `nut-avatar`;
18954
18914
  const Avatar = (props) => {
18955
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
18956
18915
  const {
18957
18916
  children,
18958
18917
  size,
@@ -18978,9 +18937,10 @@ const Avatar = (props) => {
18978
18937
  const avatarRef = useRef(null);
18979
18938
  const parent = useContext(AvatarContext);
18980
18939
  const sizeValue = ["large", "normal", "small"];
18940
+ const { propAvatarGroup, avatarGroupRef } = parent;
18981
18941
  const classes = classNames({
18982
- [`nut-avatar-${((_a = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _a.size) || size || "normal"}`]: true,
18983
- [`nut-avatar-${((_b = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _b.shape) || shape}`]: true
18942
+ [`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
18943
+ [`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
18984
18944
  });
18985
18945
  const cls = classNames(classPrefix$9, classes, className);
18986
18946
  const styles = {
@@ -18988,45 +18948,45 @@ const Avatar = (props) => {
18988
18948
  height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
18989
18949
  backgroundColor: `${background}`,
18990
18950
  color,
18991
- 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` : "",
18992
- zIndex: ((_e = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _e.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
18951
+ marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
18952
+ zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
18993
18953
  ...style
18994
18954
  };
18995
18955
  const maxStyles = {
18996
- backgroundColor: `${(_f = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _f.maxBackground}`,
18997
- color: `${(_g = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _g.maxColor}`
18998
- };
18956
+ backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
18957
+ color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
18958
+ };
18959
+ const avatarLength = useCallback(
18960
+ (children2) => {
18961
+ var _a, _b;
18962
+ for (let i2 = 0; i2 < children2.length; i2++) {
18963
+ if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
18964
+ children2[i2].setAttribute("data-index", i2 + 1);
18965
+ }
18966
+ }
18967
+ const index = Number((_b = (_a = avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
18968
+ const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
18969
+ setMaxSum(children2.length);
18970
+ setAvatarIndex(index);
18971
+ if (index === children2.length && index !== maxCount && children2.length > maxCount) {
18972
+ setShowMax(true);
18973
+ }
18974
+ },
18975
+ [propAvatarGroup == null ? void 0 : propAvatarGroup.max]
18976
+ );
18999
18977
  useEffect(() => {
19000
- var _a2;
19001
- const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
18978
+ const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
19002
18979
  if (avatarChildren) {
19003
18980
  avatarLength(avatarChildren);
19004
18981
  }
19005
- }, []);
19006
- const avatarLength = (children2) => {
19007
- var _a2, _b2, _c2;
19008
- for (let i2 = 0; i2 < children2.length; i2++) {
19009
- if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
19010
- children2[i2].setAttribute("data-index", i2 + 1);
19011
- }
19012
- }
19013
- const index = Number((_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index);
19014
- const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
19015
- setMaxSum(children2.length);
19016
- setAvatarIndex(index);
19017
- if (index === children2.length && index !== maxCount && children2.length > maxCount) {
19018
- setShowMax(true);
19019
- }
19020
- };
18982
+ }, [avatarLength, avatarGroupRef]);
19021
18983
  const errorEvent = () => {
19022
- if (onError) {
19023
- onError();
19024
- }
18984
+ onError && onError();
19025
18985
  };
19026
18986
  const clickAvatar = (e) => {
19027
18987
  onClick && onClick(e);
19028
18988
  };
19029
- return /* @__PURE__ */ React__default.createElement(React__default.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__default.createElement(
18989
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (showMax || !(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React__default.createElement(
19030
18990
  "div",
19031
18991
  {
19032
18992
  className: cls,
@@ -19035,7 +18995,7 @@ const Avatar = (props) => {
19035
18995
  onClick: clickAvatar,
19036
18996
  ref: avatarRef
19037
18997
  },
19038
- (!((_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__default.createElement(React__default.Fragment, null, src && /* @__PURE__ */ React__default.createElement(
18998
+ (!(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, src && /* @__PURE__ */ React__default.createElement(
19039
18999
  Image$1,
19040
19000
  {
19041
19001
  className: "avatar-img",
@@ -19048,7 +19008,7 @@ const Avatar = (props) => {
19048
19008
  ...icon.props,
19049
19009
  className: `${icon.props.className || ""} icon`
19050
19010
  }) : null, children && /* @__PURE__ */ React__default.createElement("span", { className: "text" }, children), !src && !icon && !children && /* @__PURE__ */ React__default.createElement(i, { className: "icon" })),
19051
- showMax && /* @__PURE__ */ React__default.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)}`)
19011
+ showMax && /* @__PURE__ */ React__default.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)}`)
19052
19012
  ));
19053
19013
  };
19054
19014
  Avatar.displayName = "NutAvatar";
@@ -19557,7 +19517,7 @@ const CountUp = (props) => {
19557
19517
  className,
19558
19518
  thousands,
19559
19519
  style,
19560
- ...reset
19520
+ ...rest
19561
19521
  } = mergeProps(defaultProps$r, props);
19562
19522
  const classPrefix2 = "nut-countup";
19563
19523
  const countupRef = useRef(null);
@@ -19570,7 +19530,7 @@ const CountUp = (props) => {
19570
19530
  return currNumber.split("");
19571
19531
  };
19572
19532
  const numerArr = useMemo$1(getShowNumber, [value, length, thousands]);
19573
- const setNumberTransform = () => {
19533
+ const setNumberTransform = useCallback(() => {
19574
19534
  if (countupRef.current) {
19575
19535
  const numberItems = countupRef.current.querySelectorAll(
19576
19536
  ".nut-countup-number"
@@ -19588,7 +19548,7 @@ const CountUp = (props) => {
19588
19548
  }
19589
19549
  });
19590
19550
  }
19591
- };
19551
+ }, [numerArr]);
19592
19552
  const numberEaseStyle = {
19593
19553
  transition: `transform ${duration}s ease-in-out`
19594
19554
  };
@@ -19599,7 +19559,7 @@ const CountUp = (props) => {
19599
19559
  return () => {
19600
19560
  window.clearTimeout(timerRef.current);
19601
19561
  };
19602
- }, [numerArr]);
19562
+ }, [numerArr, delay, setNumberTransform]);
19603
19563
  return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React__default.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
19604
19564
  return /* @__PURE__ */ React__default.createElement(
19605
19565
  "li",
@@ -19660,7 +19620,7 @@ const defaultProps$p = {
19660
19620
  }
19661
19621
  };
19662
19622
  const Audio = (props) => {
19663
- const { locale } = useConfig$1();
19623
+ const { locale } = useConfig();
19664
19624
  const {
19665
19625
  className,
19666
19626
  src,
@@ -21349,7 +21309,7 @@ const defaultProps$e = {
21349
21309
  ellipse: false
21350
21310
  };
21351
21311
  const Pagination = (props) => {
21352
- const { locale } = useConfig$1();
21312
+ const { locale } = useConfig();
21353
21313
  const {
21354
21314
  value,
21355
21315
  mode,
@@ -21696,7 +21656,7 @@ const defaultProps$a = {
21696
21656
  showHeader: true
21697
21657
  };
21698
21658
  const Table = (props) => {
21699
- const { locale } = useConfig$1();
21659
+ const { locale } = useConfig();
21700
21660
  const rtl = useRtl();
21701
21661
  defaultProps$a.noData = locale.noData;
21702
21662
  const {
@@ -21966,7 +21926,7 @@ const defaultProps$8 = {
21966
21926
  };
21967
21927
  const classPrefix$2 = "nut-tour";
21968
21928
  const Tour = (props) => {
21969
- const { locale } = useConfig$1();
21929
+ const { locale } = useConfig();
21970
21930
  const {
21971
21931
  children,
21972
21932
  className,
@@ -22621,7 +22581,7 @@ const defaultProps$3 = {
22621
22581
  }
22622
22582
  };
22623
22583
  const TimeSelect = (props) => {
22624
- const { locale } = useConfig$1();
22584
+ const { locale } = useConfig();
22625
22585
  const {
22626
22586
  visible,
22627
22587
  className,
@@ -22846,7 +22806,7 @@ const defaultProps$1 = {
22846
22806
  fontSize: 14
22847
22807
  };
22848
22808
  const WaterMark = (props) => {
22849
- const { locale } = useConfig$1();
22809
+ const { locale } = useConfig();
22850
22810
  const {
22851
22811
  content,
22852
22812
  fullPage,
@@ -23405,8 +23365,8 @@ export {
23405
23365
  Video,
23406
23366
  VirtualList,
23407
23367
  WaterMark,
23408
- getDefaultConfig$1 as getDefaultConfig,
23368
+ getDefaultConfig,
23409
23369
  setDefaultConfig,
23410
- useConfig$1 as useConfig,
23370
+ useConfig,
23411
23371
  useRtl
23412
23372
  };