@nutui/nutui-react 2.0.21 → 2.0.23-beta.0

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 (107) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/ActionSheet/style/style.css +1 -1
  3. package/dist/esm/ActionSheet.js +4 -0
  4. package/dist/esm/Address/style/style.css +1 -1
  5. package/dist/esm/Address.js +4 -0
  6. package/dist/esm/Calendar/style/style.css +1 -1
  7. package/dist/esm/CalendarCard/style/css.js +1 -0
  8. package/dist/esm/CalendarCard/style/index.js +2 -0
  9. package/dist/esm/CalendarCard/style/style.css +1 -0
  10. package/dist/esm/CalendarCard.js +513 -0
  11. package/dist/esm/CalendarItem.js +2 -0
  12. package/dist/esm/Cascader/style/style.css +1 -1
  13. package/dist/esm/Cascader.js +4 -0
  14. package/dist/esm/DatePicker/style/style.css +1 -1
  15. package/dist/esm/DatePicker.js +4 -4
  16. package/dist/esm/Dialog/style/style.css +1 -1
  17. package/dist/esm/Dialog.js +4 -0
  18. package/dist/esm/FixedNav/style/style.css +1 -1
  19. package/dist/esm/Image.js +24 -10
  20. package/dist/esm/ImagePreview/style/style.css +1 -1
  21. package/dist/esm/Input.js +1 -1
  22. package/dist/esm/Menu/style/style.css +1 -1
  23. package/dist/esm/Menu.js +4 -2
  24. package/dist/esm/MenuItem/style/style.css +1 -1
  25. package/dist/esm/MenuItem.js +4 -2
  26. package/dist/esm/NoticeBar/style/style.css +1 -1
  27. package/dist/esm/NoticeBar.js +9 -6
  28. package/dist/esm/NumberKeyboard/style/style.css +1 -1
  29. package/dist/esm/Overlay/style/style.css +1 -1
  30. package/dist/esm/Overlay.js +4 -0
  31. package/dist/esm/Picker/style/style.css +1 -1
  32. package/dist/esm/Picker.js +32 -9
  33. package/dist/esm/Popover/style/style.css +1 -1
  34. package/dist/esm/Popup/style/style.css +1 -1
  35. package/dist/esm/Popup.js +4 -0
  36. package/dist/esm/PullToRefresh.js +2 -14
  37. package/dist/esm/Range.js +2 -2
  38. package/dist/esm/ShortPassword/style/style.css +1 -1
  39. package/dist/esm/SideNavBar/style/style.css +1 -1
  40. package/dist/esm/Swipe.js +8 -5
  41. package/dist/esm/TabPane/style/style.css +1 -1
  42. package/dist/esm/Tabs/style/style.css +1 -1
  43. package/dist/esm/TimeSelect/style/style.css +1 -1
  44. package/dist/esm/Toast.js +4 -0
  45. package/dist/esm/Tour/style/style.css +1 -1
  46. package/dist/esm/nutui-react.es.js +136 -134
  47. package/dist/esm/overlay2.js +76 -15
  48. package/dist/esm/popup2.js +5 -4
  49. package/dist/esm/supports-passive.js +17 -0
  50. package/dist/esm/types/src/packages/calendarcard/__tests__/calendarcard.spec.d.ts +1 -0
  51. package/dist/esm/types/src/packages/calendarcard/calendarcard.d.ts +24 -0
  52. package/dist/esm/types/src/packages/calendarcard/calendarcard.taro.d.ts +24 -0
  53. package/dist/esm/types/src/packages/calendarcard/demo.d.ts +3 -0
  54. package/dist/esm/types/src/packages/calendarcard/demo.taro.d.ts +3 -0
  55. package/dist/esm/types/src/packages/calendarcard/icon.d.ts +5 -0
  56. package/dist/esm/types/src/packages/calendarcard/icon.taro.d.ts +5 -0
  57. package/dist/esm/types/src/packages/calendarcard/index.d.ts +3 -0
  58. package/dist/esm/types/src/packages/calendarcard/index.taro.d.ts +3 -0
  59. package/dist/esm/types/src/packages/calendarcard/types.d.ts +11 -0
  60. package/dist/esm/types/src/packages/calendarcard/utils.d.ts +19 -0
  61. package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +2 -1
  62. package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +2 -1
  63. package/dist/esm/types/src/packages/image/demo.taro.d.ts +0 -1
  64. package/dist/esm/types/src/packages/nutui.react.build.d.ts +2 -1
  65. package/dist/esm/types/src/packages/nutui.react.d.ts +3 -1
  66. package/dist/esm/types/src/packages/nutui.react.scss.d.ts +1 -0
  67. package/dist/esm/types/src/packages/nutui.react.taro.d.ts +3 -1
  68. package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +1 -0
  69. package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -1
  70. package/dist/esm/types/src/packages/picker/picker.d.ts +2 -0
  71. package/dist/esm/types/src/packages/picker/picker.taro.d.ts +2 -0
  72. package/dist/esm/types/src/utils/use-lock-scoll-taro.d.ts +2 -0
  73. package/dist/esm/types/src/utils/use-lock-scroll.d.ts +2 -0
  74. package/dist/esm/types/src/utils/use-props-value.d.ts +1 -1
  75. package/dist/esm/types/src/utils/use-touch.d.ts +8 -9
  76. package/dist/esm/use-props-value.js +3 -2
  77. package/dist/esm/use-touch.js +23 -32
  78. package/dist/locales/base.js +1 -1
  79. package/dist/locales/en-US.js +1 -1
  80. package/dist/locales/id-ID.js +1 -1
  81. package/dist/locales/tr-TR.js +1 -1
  82. package/dist/locales/zh-CN.js +1 -1
  83. package/dist/locales/zh-TW.js +1 -1
  84. package/dist/locales/zh-UG.js +1 -1
  85. package/dist/nutui.react.es.js +733 -228
  86. package/dist/nutui.react.umd.js +733 -228
  87. package/dist/packages/calendarcard/calendarcard.scss +104 -0
  88. package/dist/packages/noticebar/noticebar.scss +1 -0
  89. package/dist/packages/overlay/overlay.scss +5 -0
  90. package/dist/packages/tabpane/tabpane.scss +0 -8
  91. package/dist/packages/tabs/tabs.scss +6 -8
  92. package/dist/style.css +1 -1
  93. package/dist/style.mjs +1 -1
  94. package/dist/styles/themes/default.scss +1 -0
  95. package/dist/types/index.d.ts +3 -1
  96. package/dist/types/packages/calendarcard/calendarcard.d.ts +76 -0
  97. package/dist/types/packages/calendarcard/icon.d.ts +5 -0
  98. package/dist/types/packages/calendarcard/index.d.ts +3 -0
  99. package/dist/types/packages/calendarcard/types.d.ts +11 -0
  100. package/dist/types/packages/calendarcard/utils.d.ts +19 -0
  101. package/dist/types/packages/datepicker/datepicker.d.ts +6 -1
  102. package/dist/types/packages/picker/picker.d.ts +6 -0
  103. package/dist/types/utils/use-lock-scroll.d.ts +2 -0
  104. package/dist/types/utils/use-props-value.d.ts +1 -1
  105. package/dist/types/utils/use-touch.d.ts +8 -9
  106. package/package.json +1 -1
  107. package/dist/esm/types/src/packages/dialog/dialogwrap.taro.d.ts +0 -14
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v2.0.21 Wed Oct 18 2023 17:52:14 GMT+0800 (China Standard Time)
12
+ * @nutui/nutui-react v2.0.23 Fri Nov 03 2023 19:51:24 GMT+0800 (中国标准时间)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -2456,7 +2456,7 @@ Check the top-level render call using <` + t + ">.");
2456
2456
  style: {}
2457
2457
  };
2458
2458
  const prefixCls$1 = "nut-button";
2459
- const defaultProps$1s = {
2459
+ const defaultProps$1t = {
2460
2460
  ...ComponentDefaults,
2461
2461
  color: "",
2462
2462
  type: "default",
@@ -2490,7 +2490,7 @@ Check the top-level render call using <` + t + ">.");
2490
2490
  nativeType,
2491
2491
  ...rest
2492
2492
  } = {
2493
- ...defaultProps$1s,
2493
+ ...defaultProps$1t,
2494
2494
  ...props
2495
2495
  };
2496
2496
  const getStyle = React.useCallback(() => {
@@ -2542,7 +2542,7 @@ Check the top-level render call using <` + t + ">.");
2542
2542
  );
2543
2543
  Button.displayName = "NutButton";
2544
2544
  const CellGroupContext = React.createContext(null);
2545
- const defaultProps$1r = {
2545
+ const defaultProps$1s = {
2546
2546
  ...ComponentDefaults,
2547
2547
  title: "",
2548
2548
  description: "",
@@ -2551,7 +2551,7 @@ Check the top-level render call using <` + t + ">.");
2551
2551
  const classPrefix$p = "nut-cell-group";
2552
2552
  const CellGroup = (props) => {
2553
2553
  const { children, className, style, title, description, divider, ...rest } = {
2554
- ...defaultProps$1r,
2554
+ ...defaultProps$1s,
2555
2555
  ...props
2556
2556
  };
2557
2557
  return /* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix$p, className), ...rest }, title ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$p}__title` }, title) : null, description ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$p}__description` }, description) : null, /* @__PURE__ */ React.createElement(
@@ -2562,9 +2562,9 @@ Check the top-level render call using <` + t + ">.");
2562
2562
  /* @__PURE__ */ React.createElement(CellGroupContext.Provider, { value: { divider } }, children)
2563
2563
  ));
2564
2564
  };
2565
- CellGroup.defaultProps = defaultProps$1r;
2565
+ CellGroup.defaultProps = defaultProps$1s;
2566
2566
  CellGroup.displayName = "NutCellGroup";
2567
- const defaultProps$1q = {
2567
+ const defaultProps$1r = {
2568
2568
  ...ComponentDefaults,
2569
2569
  title: null,
2570
2570
  description: null,
@@ -2589,7 +2589,7 @@ Check the top-level render call using <` + t + ">.");
2589
2589
  style,
2590
2590
  ...rest
2591
2591
  } = {
2592
- ...defaultProps$1q,
2592
+ ...defaultProps$1r,
2593
2593
  ...props
2594
2594
  };
2595
2595
  const handleClick2 = (event) => {
@@ -2622,7 +2622,7 @@ Check the top-level render call using <` + t + ">.");
2622
2622
  (ctx2 == null ? void 0 : ctx2.divider) ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$o}__divider` }) : null
2623
2623
  );
2624
2624
  };
2625
- Cell.defaultProps = defaultProps$1q;
2625
+ Cell.defaultProps = defaultProps$1r;
2626
2626
  Cell.displayName = "NutCell";
2627
2627
  Cell.Group = CellGroup;
2628
2628
  var INFINITY = 1 / 0;
@@ -3763,7 +3763,7 @@ Check the top-level render call using <` + t + ">.");
3763
3763
  const pxCheck = (value) => {
3764
3764
  return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
3765
3765
  };
3766
- const defaultProps$1p = {
3766
+ const defaultProps$1q = {
3767
3767
  ...ComponentDefaults,
3768
3768
  fit: "fill",
3769
3769
  position: "center",
@@ -3792,26 +3792,40 @@ Check the top-level render call using <` + t + ">.");
3792
3792
  onClick,
3793
3793
  onLoad,
3794
3794
  onError
3795
- } = { ...defaultProps$1p, ...props };
3796
- const [innerLoading, setInnerLoading] = React.useState(true);
3795
+ } = { ...defaultProps$1q, ...props };
3796
+ const [innerLoading, setInnerLoading] = React.useState(false);
3797
3797
  const [isError, setIsError] = React.useState(false);
3798
+ const [complete, setComplete] = React.useState(false);
3798
3799
  const imgRef = React.useRef(null);
3799
3800
  React.useEffect(() => {
3800
- if (imgRef.current && imgRef.current.complete && imgRef.current.naturalHeight !== 0) {
3801
- setInnerLoading(false);
3802
- } else if (src) {
3801
+ if (imgRef.current && imgRef.current.complete) {
3802
+ if (imgRef.current.naturalHeight === 0) {
3803
+ handleError();
3804
+ } else {
3805
+ handleLoad();
3806
+ }
3807
+ } else {
3803
3808
  setInnerLoading(true);
3804
3809
  }
3810
+ }, [imgRef]);
3811
+ React.useEffect(() => {
3812
+ setComplete(false);
3805
3813
  }, [src]);
3806
3814
  const handleLoad = () => {
3807
- setIsError(false);
3808
- setInnerLoading(false);
3809
- onLoad && onLoad();
3815
+ if (!complete) {
3816
+ setIsError(false);
3817
+ setInnerLoading(false);
3818
+ onLoad && onLoad();
3819
+ setComplete(true);
3820
+ }
3810
3821
  };
3811
3822
  const handleError = () => {
3812
- setIsError(true);
3813
- setInnerLoading(false);
3814
- onError && onError();
3823
+ if (!complete) {
3824
+ setIsError(true);
3825
+ setInnerLoading(false);
3826
+ onError && onError();
3827
+ setComplete(true);
3828
+ }
3815
3829
  };
3816
3830
  const containerStyle = {
3817
3831
  height: height ? pxCheck(height) : "",
@@ -3919,7 +3933,7 @@ Check the top-level render call using <` + t + ">.");
3919
3933
  renderErrorImg()
3920
3934
  );
3921
3935
  };
3922
- Image$1.defaultProps = defaultProps$1p;
3936
+ Image$1.defaultProps = defaultProps$1q;
3923
3937
  Image$1.displayName = "NutImage";
3924
3938
  function _extends$4() {
3925
3939
  _extends$4 = Object.assign ? Object.assign.bind() : function(target) {
@@ -5662,6 +5676,171 @@ Check the top-level render call using <` + t + ">.");
5662
5676
  onExited: propTypesExports.func
5663
5677
  }) : {};
5664
5678
  const CSSTransition$1 = CSSTransition;
5679
+ const MIN_DISTANCE = 10;
5680
+ function getDirection(x2, y2) {
5681
+ if (x2 > y2 && x2 > MIN_DISTANCE) {
5682
+ return "horizontal";
5683
+ }
5684
+ if (y2 > x2 && y2 > MIN_DISTANCE) {
5685
+ return "vertical";
5686
+ }
5687
+ return "";
5688
+ }
5689
+ function useTouch() {
5690
+ const startX = React.useRef(0);
5691
+ const startY = React.useRef(0);
5692
+ const deltaX = React.useRef(0);
5693
+ const deltaY = React.useRef(0);
5694
+ const offsetX = React.useRef(0);
5695
+ const offsetY = React.useRef(0);
5696
+ const direction = React.useRef("");
5697
+ const isVertical = () => direction.current === "vertical";
5698
+ const isHorizontal = () => direction.current === "horizontal";
5699
+ const reset = () => {
5700
+ deltaX.current = 0;
5701
+ deltaY.current = 0;
5702
+ offsetX.current = 0;
5703
+ offsetY.current = 0;
5704
+ direction.current = "";
5705
+ };
5706
+ const start2 = (event) => {
5707
+ reset();
5708
+ startX.current = event.touches[0].clientX;
5709
+ startY.current = event.touches[0].clientY;
5710
+ };
5711
+ const move = (event) => {
5712
+ const touch = event.touches[0];
5713
+ deltaX.current = touch.clientX < 0 ? 0 : touch.clientX - startX.current;
5714
+ deltaY.current = touch.clientY - startY.current;
5715
+ offsetX.current = Math.abs(deltaX.current);
5716
+ offsetY.current = Math.abs(deltaY.current);
5717
+ if (!direction.current) {
5718
+ direction.current = getDirection(offsetX.current, offsetY.current);
5719
+ }
5720
+ };
5721
+ return {
5722
+ move,
5723
+ start: start2,
5724
+ reset,
5725
+ startX,
5726
+ startY,
5727
+ deltaX,
5728
+ deltaY,
5729
+ offsetX,
5730
+ offsetY,
5731
+ direction,
5732
+ isVertical,
5733
+ isHorizontal
5734
+ };
5735
+ }
5736
+ const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
5737
+ const defaultRoot = canUseDom ? window : void 0;
5738
+ const overflowStylePatterns = ["scroll", "auto", "overlay"];
5739
+ function isElement(node) {
5740
+ const ELEMENT_NODE_TYPE = 1;
5741
+ return node.nodeType === ELEMENT_NODE_TYPE;
5742
+ }
5743
+ function getScrollParent(el, root2 = defaultRoot) {
5744
+ let node = el;
5745
+ while (node && node !== root2 && isElement(node)) {
5746
+ if (node === document.body) {
5747
+ return root2;
5748
+ }
5749
+ const { overflowY } = window.getComputedStyle(node);
5750
+ if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
5751
+ return node;
5752
+ }
5753
+ node = node.parentNode;
5754
+ }
5755
+ return root2;
5756
+ }
5757
+ let passiveSupported = false;
5758
+ if (canUseDom) {
5759
+ try {
5760
+ const opts = Object.defineProperty({}, "passive", {
5761
+ get() {
5762
+ passiveSupported = true;
5763
+ }
5764
+ });
5765
+ window.addEventListener("test-passive-supported", null, opts);
5766
+ } catch (e) {
5767
+ console.log(e);
5768
+ }
5769
+ }
5770
+ let totalLockCount = 0;
5771
+ const BODY_LOCK_CLASS = "nut-overflow-hidden";
5772
+ function getScrollableElement(el) {
5773
+ let current = el == null ? void 0 : el.parentElement;
5774
+ while (current) {
5775
+ if (current.clientHeight < current.scrollHeight) {
5776
+ return current;
5777
+ }
5778
+ current = current.parentElement;
5779
+ }
5780
+ return null;
5781
+ }
5782
+ function useLockScroll(rootRef, shouldLock) {
5783
+ const touch = useTouch();
5784
+ const onTouchMove = (event) => {
5785
+ touch.move(event);
5786
+ const direction = touch.deltaY.current > 0 ? "10" : "01";
5787
+ const el = getScrollParent(
5788
+ event.target,
5789
+ rootRef.current
5790
+ );
5791
+ if (!el)
5792
+ return;
5793
+ if (shouldLock === "strict") {
5794
+ const scrollableParent = getScrollableElement(event.target);
5795
+ if (scrollableParent === document.body || scrollableParent === document.documentElement) {
5796
+ event.preventDefault();
5797
+ return;
5798
+ }
5799
+ }
5800
+ const { scrollHeight, offsetHeight, scrollTop } = el;
5801
+ let status = "11";
5802
+ if (scrollTop === 0) {
5803
+ status = offsetHeight >= scrollHeight ? "00" : "01";
5804
+ } else if (scrollTop + offsetHeight >= scrollHeight) {
5805
+ status = "10";
5806
+ }
5807
+ if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
5808
+ if (event.cancelable) {
5809
+ event.preventDefault();
5810
+ }
5811
+ }
5812
+ };
5813
+ const lock = () => {
5814
+ document.addEventListener("touchstart", touch.start);
5815
+ document.addEventListener(
5816
+ "touchmove",
5817
+ onTouchMove,
5818
+ passiveSupported ? { passive: false } : false
5819
+ );
5820
+ if (!totalLockCount) {
5821
+ document.body.classList.add(BODY_LOCK_CLASS);
5822
+ }
5823
+ totalLockCount++;
5824
+ };
5825
+ const unlock = () => {
5826
+ if (totalLockCount) {
5827
+ document.removeEventListener("touchstart", touch.start);
5828
+ document.removeEventListener("touchmove", onTouchMove);
5829
+ totalLockCount--;
5830
+ if (!totalLockCount) {
5831
+ document.body.classList.remove(BODY_LOCK_CLASS);
5832
+ }
5833
+ }
5834
+ };
5835
+ React.useEffect(() => {
5836
+ if (shouldLock) {
5837
+ lock();
5838
+ return () => {
5839
+ unlock();
5840
+ };
5841
+ }
5842
+ }, [shouldLock]);
5843
+ }
5665
5844
  const defaultOverlayProps = {
5666
5845
  ...ComponentDefaults,
5667
5846
  zIndex: 1e3,
@@ -5699,24 +5878,12 @@ Check the top-level render call using <` + t + ">.");
5699
5878
  } else {
5700
5879
  setInnerVisible(false);
5701
5880
  }
5702
- lock();
5703
5881
  }, [visible]);
5704
- React.useEffect(() => {
5705
- return () => {
5706
- document.body.classList.remove("nut-overflow-hidden");
5707
- };
5708
- }, []);
5882
+ useLockScroll(nodeRef, !!props.lockScroll && innerVisible);
5709
5883
  const classes = classNames(className, classPrefix2);
5710
5884
  const styles = {
5711
5885
  ...style
5712
5886
  };
5713
- const lock = () => {
5714
- if (lockScroll && visible) {
5715
- document.body.classList.add("nut-overflow-hidden");
5716
- } else {
5717
- document.body.classList.remove("nut-overflow-hidden");
5718
- }
5719
- };
5720
5887
  const handleClick2 = (e) => {
5721
5888
  if (closeOnOverlayClick) {
5722
5889
  onClick && onClick(e);
@@ -5755,7 +5922,7 @@ Check the top-level render call using <` + t + ">.");
5755
5922
  Overlay.defaultProps = defaultOverlayProps;
5756
5923
  Overlay.displayName = "NutOverlay";
5757
5924
  const DataContext$2 = React.createContext({});
5758
- const defaultProps$1o = {
5925
+ const defaultProps$1p = {
5759
5926
  ...ComponentDefaults,
5760
5927
  span: "24",
5761
5928
  offset: "0",
@@ -5763,7 +5930,7 @@ Check the top-level render call using <` + t + ">.");
5763
5930
  };
5764
5931
  const Col = (props) => {
5765
5932
  const { className, style, span, offset, children, onClick } = {
5766
- ...defaultProps$1o,
5933
+ ...defaultProps$1p,
5767
5934
  ...props
5768
5935
  };
5769
5936
  const [colName, setColName] = React.useState("");
@@ -5795,9 +5962,9 @@ Check the top-level render call using <` + t + ">.");
5795
5962
  children
5796
5963
  );
5797
5964
  };
5798
- Col.defaultProps = defaultProps$1o;
5965
+ Col.defaultProps = defaultProps$1p;
5799
5966
  Col.displayName = "NutCol";
5800
- const defaultProps$1n = {
5967
+ const defaultProps$1o = {
5801
5968
  ...ComponentDefaults,
5802
5969
  contentPosition: "center",
5803
5970
  direction: "horizontal"
@@ -5805,7 +5972,7 @@ Check the top-level render call using <` + t + ">.");
5805
5972
  const classPrefix$l = `nut-divider`;
5806
5973
  const Divider = (props) => {
5807
5974
  const { children, contentPosition, style, className, direction, ...rest } = {
5808
- ...defaultProps$1n,
5975
+ ...defaultProps$1o,
5809
5976
  ...props
5810
5977
  };
5811
5978
  const classes = direction === "horizontal" ? classNames({
@@ -5820,14 +5987,14 @@ Check the top-level render call using <` + t + ">.");
5820
5987
  });
5821
5988
  return /* @__PURE__ */ React.createElement("div", { className: `${classes} ${className || ""}`, style, ...rest }, children);
5822
5989
  };
5823
- Divider.defaultProps = defaultProps$1n;
5990
+ Divider.defaultProps = defaultProps$1o;
5824
5991
  Divider.displayName = "NutDivider";
5825
5992
  const gridContext = {
5826
5993
  onClick: (item, index) => {
5827
5994
  }
5828
5995
  };
5829
5996
  const GridContext = React.createContext(gridContext);
5830
- const defaultProps$1m = {
5997
+ const defaultProps$1n = {
5831
5998
  text: "",
5832
5999
  columns: 4,
5833
6000
  gap: 0,
@@ -5853,7 +6020,7 @@ Check the top-level render call using <` + t + ">.");
5853
6020
  onClick,
5854
6021
  ...rest
5855
6022
  } = {
5856
- ...defaultProps$1m,
6023
+ ...defaultProps$1n,
5857
6024
  ...props
5858
6025
  };
5859
6026
  const classPrefix2 = "nut-grid-item";
@@ -5911,9 +6078,9 @@ Check the top-level render call using <` + t + ">.");
5911
6078
  /* @__PURE__ */ React.createElement("div", { className: contentClass() }, children && /* @__PURE__ */ React.createElement(React.Fragment, null, children), text && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__text` }, text))
5912
6079
  );
5913
6080
  };
5914
- GridItem.defaultProps = defaultProps$1m;
6081
+ GridItem.defaultProps = defaultProps$1n;
5915
6082
  GridItem.displayName = "NutGridItem";
5916
- const defaultProps$1l = {
6083
+ const defaultProps$1m = {
5917
6084
  columns: 4,
5918
6085
  gap: 0,
5919
6086
  center: true,
@@ -5934,7 +6101,7 @@ Check the top-level render call using <` + t + ">.");
5934
6101
  className,
5935
6102
  onClick,
5936
6103
  ...rest
5937
- } = { ...defaultProps$1l, ...props };
6104
+ } = { ...defaultProps$1m, ...props };
5938
6105
  const childrenDom = React.Children.toArray(children);
5939
6106
  const classPrefix2 = "nut-grid";
5940
6107
  const rootClass = () => {
@@ -5964,18 +6131,18 @@ Check the top-level render call using <` + t + ">.");
5964
6131
  });
5965
6132
  })));
5966
6133
  };
5967
- Grid.defaultProps = defaultProps$1l;
6134
+ Grid.defaultProps = defaultProps$1m;
5968
6135
  Grid.displayName = "NutGrid";
5969
6136
  Grid.Item = GridItem;
5970
- const defaultProps$1k = {};
6137
+ const defaultProps$1l = {};
5971
6138
  const Layout = (props) => {
5972
- ({ ...defaultProps$1k, ...props });
6139
+ ({ ...defaultProps$1l, ...props });
5973
6140
  return /* @__PURE__ */ React.createElement("div", { className: "nut-layout" }, "Layout");
5974
6141
  };
5975
- Layout.defaultProps = defaultProps$1k;
6142
+ Layout.defaultProps = defaultProps$1l;
5976
6143
  Layout.displayName = "NutLayout";
5977
6144
  const classPrefix$k = "nut-row";
5978
- const defaultProps$1j = {
6145
+ const defaultProps$1k = {
5979
6146
  ...ComponentDefaults,
5980
6147
  type: "",
5981
6148
  justify: "start",
@@ -5995,7 +6162,7 @@ Check the top-level render call using <` + t + ">.");
5995
6162
  gutter,
5996
6163
  onClick
5997
6164
  } = {
5998
- ...defaultProps$1j,
6165
+ ...defaultProps$1k,
5999
6166
  ...props
6000
6167
  };
6001
6168
  const getClass = (prefix2, type22) => {
@@ -6027,15 +6194,15 @@ Check the top-level render call using <` + t + ">.");
6027
6194
  children
6028
6195
  ));
6029
6196
  };
6030
- Row.defaultProps = defaultProps$1j;
6197
+ Row.defaultProps = defaultProps$1k;
6031
6198
  Row.displayName = "NutRow";
6032
6199
  const prefixCls = "nut-space";
6033
- const defaultProps$1i = {
6200
+ const defaultProps$1j = {
6034
6201
  direction: "horizontal"
6035
6202
  };
6036
6203
  const Space = (props) => {
6037
6204
  const { className, style, children, wrap, align, direction, justify } = {
6038
- ...defaultProps$1i,
6205
+ ...defaultProps$1j,
6039
6206
  ...props
6040
6207
  };
6041
6208
  const cls = classNames(
@@ -6050,29 +6217,8 @@ Check the top-level render call using <` + t + ">.");
6050
6217
  return child !== null && child !== void 0 && /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-item` }, child);
6051
6218
  }));
6052
6219
  };
6053
- Space.defaultProps = defaultProps$1i;
6220
+ Space.defaultProps = defaultProps$1j;
6054
6221
  Space.displayName = "NutSpace";
6055
- const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
6056
- const defaultRoot = canUseDom ? window : void 0;
6057
- const overflowStylePatterns = ["scroll", "auto", "overlay"];
6058
- function isElement(node) {
6059
- const ELEMENT_NODE_TYPE = 1;
6060
- return node.nodeType === ELEMENT_NODE_TYPE;
6061
- }
6062
- function getScrollParent(el, root2 = defaultRoot) {
6063
- let node = el;
6064
- while (node && node !== root2 && isElement(node)) {
6065
- if (node === document.body) {
6066
- return root2;
6067
- }
6068
- const { overflowY } = window.getComputedStyle(node);
6069
- if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
6070
- return node;
6071
- }
6072
- node = node.parentNode;
6073
- }
6074
- return root2;
6075
- }
6076
6222
  function isWindow(val) {
6077
6223
  return val === window;
6078
6224
  }
@@ -6125,7 +6271,7 @@ Check the top-level render call using <` + t + ">.");
6125
6271
  stop2.current = true;
6126
6272
  };
6127
6273
  }
6128
- const defaultProps$1h = {
6274
+ const defaultProps$1i = {
6129
6275
  ...ComponentDefaults,
6130
6276
  position: "top",
6131
6277
  threshold: 0,
@@ -6143,7 +6289,7 @@ Check the top-level render call using <` + t + ">.");
6143
6289
  threshold,
6144
6290
  onChange,
6145
6291
  ...rest
6146
- } = { ...defaultProps$1h, ...props };
6292
+ } = { ...defaultProps$1i, ...props };
6147
6293
  const stickyRef = React.useRef(null);
6148
6294
  const rootRef = React.useRef(null);
6149
6295
  const [isFixed, setIsFixed] = React.useState(false);
@@ -6259,9 +6405,9 @@ Check the top-level render call using <` + t + ">.");
6259
6405
  /* @__PURE__ */ React.createElement("div", { className: "nut-sticky--box", ref: stickyRef, style: stickyStyle }, children)
6260
6406
  );
6261
6407
  };
6262
- Sticky.defaultProps = defaultProps$1h;
6408
+ Sticky.defaultProps = defaultProps$1i;
6263
6409
  Sticky.displayName = "NutSticky";
6264
- const defaultProps$1g = {
6410
+ const defaultProps$1h = {
6265
6411
  ...ComponentDefaults,
6266
6412
  target: "",
6267
6413
  threshold: 200,
@@ -6279,7 +6425,7 @@ Check the top-level render call using <` + t + ">.");
6279
6425
  style,
6280
6426
  onClick
6281
6427
  } = {
6282
- ...defaultProps$1g,
6428
+ ...defaultProps$1h,
6283
6429
  ...props
6284
6430
  };
6285
6431
  const classPrefix2 = "nut-backtop";
@@ -6377,7 +6523,7 @@ Check the top-level render call using <` + t + ">.");
6377
6523
  children || /* @__PURE__ */ React.createElement(y$2, { width: 19, height: 19, className: "nut-backtop-main" })
6378
6524
  );
6379
6525
  };
6380
- BackTop.defaultProps = defaultProps$1g;
6526
+ BackTop.defaultProps = defaultProps$1h;
6381
6527
  BackTop.displayName = "NutBackTop";
6382
6528
  function clamp$1(v, min, max) {
6383
6529
  return Math.max(min, Math.min(v, max));
@@ -11495,7 +11641,7 @@ Please add \`${key}Action\` when creating your handler.`);
11495
11641
  });
11496
11642
  const animated = host.animated;
11497
11643
  const elevatorContext = React.createContext({});
11498
- const defaultProps$1f = {
11644
+ const defaultProps$1g = {
11499
11645
  ...ComponentDefaults,
11500
11646
  height: "200px",
11501
11647
  floorKey: "title",
@@ -11521,7 +11667,7 @@ Please add \`${key}Action\` when creating your handler.`);
11521
11667
  children,
11522
11668
  ...rest
11523
11669
  } = {
11524
- ...defaultProps$1f,
11670
+ ...defaultProps$1g,
11525
11671
  ...props
11526
11672
  };
11527
11673
  const classPrefix2 = "nut-elevator";
@@ -11696,10 +11842,10 @@ Please add \`${key}Action\` when creating your handler.`);
11696
11842
  })
11697
11843
  ))) : null);
11698
11844
  };
11699
- Elevator.defaultProps = defaultProps$1f;
11845
+ Elevator.defaultProps = defaultProps$1g;
11700
11846
  Elevator.displayName = "NutElevator";
11701
11847
  Elevator.Context = elevatorContext;
11702
- const defaultProps$1e = {
11848
+ const defaultProps$1f = {
11703
11849
  ...ComponentDefaults,
11704
11850
  activeText: "",
11705
11851
  inactiveText: "",
@@ -11727,7 +11873,7 @@ Please add \`${key}Action\` when creating your handler.`);
11727
11873
  content,
11728
11874
  ...rest
11729
11875
  } = {
11730
- ...defaultProps$1e,
11876
+ ...defaultProps$1f,
11731
11877
  ...props
11732
11878
  };
11733
11879
  const classPrefix2 = "nut-fixednav";
@@ -11779,9 +11925,9 @@ Please add \`${key}Action\` when creating your handler.`);
11779
11925
  /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__btn`, onClick: () => onUpdateValue() }, content || /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(y$7, { color: "#fff" }), /* @__PURE__ */ React.createElement("div", { className: "text" }, visible ? activeText || locale.fixednav.activeText : inactiveText || locale.fixednav.inactiveText)))
11780
11926
  );
11781
11927
  };
11782
- FixedNav.defaultProps = defaultProps$1e;
11928
+ FixedNav.defaultProps = defaultProps$1f;
11783
11929
  FixedNav.displayName = "NutFixedNav";
11784
- const defaultProps$1d = {
11930
+ const defaultProps$1e = {
11785
11931
  ...ComponentDefaults,
11786
11932
  left: "",
11787
11933
  right: "",
@@ -11804,7 +11950,7 @@ Please add \`${key}Action\` when creating your handler.`);
11804
11950
  zIndex,
11805
11951
  onBackClick
11806
11952
  } = {
11807
- ...defaultProps$1d,
11953
+ ...defaultProps$1e,
11808
11954
  ...props
11809
11955
  };
11810
11956
  const classPrefix2 = "nut-navbar";
@@ -11841,9 +11987,9 @@ Please add \`${key}Action\` when creating your handler.`);
11841
11987
  const cls = classNames(classPrefix2, classes, className);
11842
11988
  return /* @__PURE__ */ React.createElement(React.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}--placeholder` }, renderWrapper()) : renderWrapper());
11843
11989
  };
11844
- NavBar.defaultProps = defaultProps$1d;
11990
+ NavBar.defaultProps = defaultProps$1e;
11845
11991
  NavBar.displayName = "NutNavBar";
11846
- const defaultProps$1c = {
11992
+ const defaultProps$1d = {
11847
11993
  ...ComponentDefaults,
11848
11994
  position: "center",
11849
11995
  transition: "",
@@ -11864,7 +12010,7 @@ Please add \`${key}Action\` when creating your handler.`);
11864
12010
  onCloseIconClick: (e) => true,
11865
12011
  ...defaultOverlayProps
11866
12012
  };
11867
- let _zIndex = 1100;
12013
+ const _zIndex = 1100;
11868
12014
  const Popup = (props) => {
11869
12015
  const {
11870
12016
  children,
@@ -11895,12 +12041,14 @@ Please add \`${key}Action\` when creating your handler.`);
11895
12041
  afterShow,
11896
12042
  afterClose,
11897
12043
  onClick
11898
- } = { ...defaultProps$1c, ...props };
12044
+ } = { ...defaultProps$1d, ...props };
11899
12045
  const nodeRef = React.useRef(null);
11900
- const [index, setIndex] = React.useState(zIndex || _zIndex);
12046
+ let innerIndex = zIndex || _zIndex;
12047
+ const [index, setIndex] = React.useState(innerIndex);
11901
12048
  const [innerVisible, setInnerVisible] = React.useState(visible);
11902
12049
  const [showChildren, setShowChildren] = React.useState(true);
11903
12050
  const [transitionName, setTransitionName] = React.useState("");
12051
+ useLockScroll(nodeRef, innerVisible && lockScroll);
11904
12052
  const classPrefix2 = "nut-popup";
11905
12053
  const baseStyle = {
11906
12054
  zIndex: index
@@ -11926,7 +12074,7 @@ Please add \`${key}Action\` when creating your handler.`);
11926
12074
  const open = () => {
11927
12075
  if (!innerVisible) {
11928
12076
  setInnerVisible(true);
11929
- setIndex(++_zIndex);
12077
+ setIndex(++innerIndex);
11930
12078
  }
11931
12079
  if (destroyOnClose) {
11932
12080
  setShowChildren(true);
@@ -12018,7 +12166,6 @@ Please add \`${key}Action\` when creating your handler.`);
12018
12166
  className: overlayClassName,
12019
12167
  visible: innerVisible,
12020
12168
  closeOnOverlayClick,
12021
- zIndex,
12022
12169
  lockScroll,
12023
12170
  duration,
12024
12171
  onClick: onHandleClickOverlay
@@ -12034,7 +12181,7 @@ Please add \`${key}Action\` when creating your handler.`);
12034
12181
  }, [position, transition]);
12035
12182
  return /* @__PURE__ */ React.createElement(React.Fragment, null, renderToContainer(portal, renderNode()));
12036
12183
  };
12037
- Popup.defaultProps = defaultProps$1c;
12184
+ Popup.defaultProps = defaultProps$1d;
12038
12185
  Popup.displayName = "NutPopup";
12039
12186
  const handleClick = (e) => {
12040
12187
  e.stopPropagation();
@@ -12050,7 +12197,7 @@ Please add \`${key}Action\` when creating your handler.`);
12050
12197
  }
12051
12198
  };
12052
12199
  const OffsetContext = React.createContext(20);
12053
- const defaultProps$1b = {
12200
+ const defaultProps$1c = {
12054
12201
  ...ComponentDefaults,
12055
12202
  position: "left",
12056
12203
  width: "80%"
@@ -12067,7 +12214,7 @@ Please add \`${key}Action\` when creating your handler.`);
12067
12214
  onClose,
12068
12215
  ...rest
12069
12216
  } = {
12070
- ...defaultProps$1b,
12217
+ ...defaultProps$1c,
12071
12218
  ...props
12072
12219
  };
12073
12220
  const indent = props.indent ? Number(props.indent) : 20;
@@ -12099,7 +12246,7 @@ Please add \`${key}Action\` when creating your handler.`);
12099
12246
  )))
12100
12247
  );
12101
12248
  };
12102
- SideNavBar.defaultProps = defaultProps$1b;
12249
+ SideNavBar.defaultProps = defaultProps$1c;
12103
12250
  SideNavBar.displayName = "NutSideNavBar";
12104
12251
  const SideNavBarItem = (props) => {
12105
12252
  const classPrefix2 = "nut-subsidenavbar";
@@ -12118,13 +12265,13 @@ Please add \`${key}Action\` when creating your handler.`);
12118
12265
  title
12119
12266
  );
12120
12267
  };
12121
- const defaultProps$1a = {
12268
+ const defaultProps$1b = {
12122
12269
  open: true
12123
12270
  };
12124
12271
  const SubSideNavBar = (props) => {
12125
12272
  const classPrefix2 = "nut-subsidenavbar";
12126
12273
  const { title, value, children, onClick, open, ...rest } = {
12127
- ...defaultProps$1a,
12274
+ ...defaultProps$1b,
12128
12275
  ...props
12129
12276
  };
12130
12277
  const offset = React.useContext(OffsetContext);
@@ -12189,19 +12336,19 @@ Please add \`${key}Action\` when creating your handler.`);
12189
12336
  stateRef.current = value;
12190
12337
  }
12191
12338
  const setState = React.useCallback(
12192
- (v) => {
12339
+ (v, forceTrigger = false) => {
12193
12340
  const prevState = stateRef.current;
12194
12341
  stateRef.current = v;
12195
- if (prevState !== stateRef.current) {
12342
+ if (prevState !== stateRef.current || forceTrigger) {
12196
12343
  forceUpdate();
12344
+ onChange == null ? void 0 : onChange(v);
12197
12345
  }
12198
- onChange == null ? void 0 : onChange(v);
12199
12346
  },
12200
12347
  [value, onChange]
12201
12348
  );
12202
12349
  return [stateRef.current, setState];
12203
12350
  }
12204
- const defaultProps$19 = {
12351
+ const defaultProps$1a = {
12205
12352
  ...ComponentDefaults,
12206
12353
  value: "",
12207
12354
  dot: false,
@@ -12212,7 +12359,7 @@ Please add \`${key}Action\` when creating your handler.`);
12212
12359
  };
12213
12360
  const Badge = (props) => {
12214
12361
  const { className, style, value, max, children, dot, top, right, color } = {
12215
- ...defaultProps$19,
12362
+ ...defaultProps$1a,
12216
12363
  ...props
12217
12364
  };
12218
12365
  const classPrefix2 = "nut-badge";
@@ -12239,9 +12386,9 @@ Please add \`${key}Action\` when creating your handler.`);
12239
12386
  };
12240
12387
  return /* @__PURE__ */ React.createElement("div", { className: classes, style }, typeof value === "object" && value && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__icon` }, value), /* @__PURE__ */ React.createElement("div", null, children), /* @__PURE__ */ React.createElement("div", { className: contentClasses, style: getStyle() }, content()));
12241
12388
  };
12242
- Badge.defaultProps = defaultProps$19;
12389
+ Badge.defaultProps = defaultProps$1a;
12243
12390
  Badge.displayName = "NutBadge";
12244
- const defaultProps$18 = {
12391
+ const defaultProps$19 = {
12245
12392
  ...ComponentDefaults,
12246
12393
  title: "",
12247
12394
  icon: null,
@@ -12271,7 +12418,7 @@ Please add \`${key}Action\` when creating your handler.`);
12271
12418
  handleClick: handleClick2,
12272
12419
  ...rest
12273
12420
  } = {
12274
- ...defaultProps$18,
12421
+ ...defaultProps$19,
12275
12422
  ...props
12276
12423
  };
12277
12424
  const classPrefix2 = "nut-tabbar-item";
@@ -12304,7 +12451,7 @@ Please add \`${key}Action\` when creating your handler.`);
12304
12451
  icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: boxPrefix }, icon)), /* @__PURE__ */ React.createElement("div", { className: titleClass }, title)) : /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: titleClass }, title))
12305
12452
  );
12306
12453
  };
12307
- const defaultProps$17 = {
12454
+ const defaultProps$18 = {
12308
12455
  ...ComponentDefaults,
12309
12456
  defaultValue: 0,
12310
12457
  fixed: false,
@@ -12327,7 +12474,7 @@ Please add \`${key}Action\` when creating your handler.`);
12327
12474
  style,
12328
12475
  onSwitch
12329
12476
  } = {
12330
- ...defaultProps$17,
12477
+ ...defaultProps$18,
12331
12478
  ...props
12332
12479
  };
12333
12480
  const classPrefix2 = "nut-tabbar";
@@ -12362,17 +12509,17 @@ Please add \`${key}Action\` when creating your handler.`);
12362
12509
  (fixed || safeArea) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__safe-area` })
12363
12510
  );
12364
12511
  };
12365
- Tabbar.defaultProps = defaultProps$17;
12512
+ Tabbar.defaultProps = defaultProps$18;
12366
12513
  Tabbar.displayName = "NutTabbar";
12367
12514
  Tabbar.Item = TabbarItem;
12368
- const defaultProps$16 = {
12515
+ const defaultProps$17 = {
12369
12516
  title: "",
12370
12517
  value: "",
12371
12518
  disabled: false
12372
12519
  };
12373
12520
  const TabPane = (props) => {
12374
12521
  const { children, autoHeightClassName, className, disabled } = {
12375
- ...defaultProps$16,
12522
+ ...defaultProps$17,
12376
12523
  ...props
12377
12524
  };
12378
12525
  const classPrefix2 = "nut-tabpane";
@@ -12398,7 +12545,7 @@ Please add \`${key}Action\` when creating your handler.`);
12398
12545
  };
12399
12546
  }
12400
12547
  const requestAniFrame$1 = requestAniFrame();
12401
- const defaultProps$15 = {
12548
+ const defaultProps$16 = {
12402
12549
  ...ComponentDefaults,
12403
12550
  tabStyle: {},
12404
12551
  activeColor: "",
@@ -12424,7 +12571,7 @@ Please add \`${key}Action\` when creating your handler.`);
12424
12571
  autoHeight,
12425
12572
  ...rest
12426
12573
  } = {
12427
- ...defaultProps$15,
12574
+ ...defaultProps$16,
12428
12575
  ...props
12429
12576
  };
12430
12577
  const [value, setValue] = usePropsValue({
@@ -12591,7 +12738,7 @@ Please add \`${key}Action\` when creating your handler.`);
12591
12738
  return React.cloneElement(child, childProps);
12592
12739
  }))));
12593
12740
  };
12594
- Tabs.defaultProps = defaultProps$15;
12741
+ Tabs.defaultProps = defaultProps$16;
12595
12742
  Tabs.displayName = "NutTabs";
12596
12743
  Tabs.TabPane = TabPane;
12597
12744
  const formatTree = (tree, parent, config2) => tree.map((node) => {
@@ -12731,7 +12878,7 @@ Please add \`${key}Action\` when creating your handler.`);
12731
12878
  }
12732
12879
  }
12733
12880
  const Tree$1 = Tree;
12734
- const defaultProps$14 = {
12881
+ const defaultProps$15 = {
12735
12882
  ...ComponentDefaults,
12736
12883
  activeColor: "",
12737
12884
  activeIcon: "checklist",
@@ -12775,7 +12922,7 @@ Please add \`${key}Action\` when creating your handler.`);
12775
12922
  onClose,
12776
12923
  onChange,
12777
12924
  onPathChange
12778
- } = { ...defaultProps$14, ...props };
12925
+ } = { ...defaultProps$15, ...props };
12779
12926
  const [tabvalue, setTabvalue] = React.useState("c1");
12780
12927
  const [optionsData, setOptionsData] = React.useState([]);
12781
12928
  const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
@@ -13072,9 +13219,9 @@ Please add \`${key}Action\` when creating your handler.`);
13072
13219
  ) : renderTabs());
13073
13220
  };
13074
13221
  const Cascader = React.forwardRef(InternalCascader);
13075
- Cascader.defaultProps = defaultProps$14;
13222
+ Cascader.defaultProps = defaultProps$15;
13076
13223
  Cascader.displayName = "NutCascader";
13077
- const defaultProps$13 = {
13224
+ const defaultProps$14 = {
13078
13225
  ...ComponentDefaults,
13079
13226
  visible: false,
13080
13227
  type: "custom",
@@ -13101,7 +13248,7 @@ Please add \`${key}Action\` when creating your handler.`);
13101
13248
  onPathChange,
13102
13249
  ...rest
13103
13250
  } = {
13104
- ...defaultProps$13,
13251
+ ...defaultProps$14,
13105
13252
  ...props
13106
13253
  };
13107
13254
  return /* @__PURE__ */ React.createElement(React.Fragment, null, type2 === "custom" && /* @__PURE__ */ React.createElement(
@@ -13126,7 +13273,7 @@ Please add \`${key}Action\` when creating your handler.`);
13126
13273
  }
13127
13274
  ));
13128
13275
  };
13129
- const defaultProps$12 = {
13276
+ const defaultProps$13 = {
13130
13277
  type: "custom",
13131
13278
  existList: [],
13132
13279
  defaultIcon: null,
@@ -13145,7 +13292,7 @@ Please add \`${key}Action\` when creating your handler.`);
13145
13292
  onSelect,
13146
13293
  onSwitch,
13147
13294
  ...rest
13148
- } = { ...defaultProps$12, ...props };
13295
+ } = { ...defaultProps$13, ...props };
13149
13296
  const classPrefix2 = "nut-address";
13150
13297
  const selectedExist = (item) => {
13151
13298
  existList.forEach((list, index) => {
@@ -13170,7 +13317,7 @@ Please add \`${key}Action\` when creating your handler.`);
13170
13317
  );
13171
13318
  })), (custom || custom && locale.address.chooseAnotherAddress) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-footer`, onClick }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-footer-btn` }, custom)));
13172
13319
  };
13173
- const defaultProps$11 = {
13320
+ const defaultProps$12 = {
13174
13321
  ...ComponentDefaults,
13175
13322
  defaultValue: [],
13176
13323
  type: "custom",
@@ -13212,7 +13359,7 @@ Please add \`${key}Action\` when creating your handler.`);
13212
13359
  className,
13213
13360
  ...rest
13214
13361
  } = {
13215
- ...defaultProps$11,
13362
+ ...defaultProps$12,
13216
13363
  ...props
13217
13364
  };
13218
13365
  const classPrefix2 = "nut-address";
@@ -13303,7 +13450,7 @@ Please add \`${key}Action\` when creating your handler.`);
13303
13450
  ));
13304
13451
  };
13305
13452
  const Address = React.forwardRef(InternalAddress);
13306
- Address.defaultProps = defaultProps$11;
13453
+ Address.defaultProps = defaultProps$12;
13307
13454
  Address.displayName = "NutAddress";
13308
13455
  const Utils = {
13309
13456
  /**
@@ -13553,7 +13700,7 @@ Please add \`${key}Action\` when creating your handler.`);
13553
13700
  const isStartAndEnd = (days) => {
13554
13701
  return days.length >= 2 && Utils.isEqual(days[0], days[1]);
13555
13702
  };
13556
- const defaultProps$10 = {
13703
+ const defaultProps$11 = {
13557
13704
  ...ComponentDefaults,
13558
13705
  type: "single",
13559
13706
  autoBackfill: false,
@@ -13613,7 +13760,7 @@ Please add \`${key}Action\` when creating your handler.`);
13613
13760
  onUpdate,
13614
13761
  onDayClick,
13615
13762
  onPageChange
13616
- } = { ...defaultProps$10, ...props };
13763
+ } = { ...defaultProps$11, ...props };
13617
13764
  const weekdays = locale.calendaritem.weekdays;
13618
13765
  const weeks = [
13619
13766
  ...weekdays.slice(firstDayOfWeek, 7),
@@ -13947,6 +14094,8 @@ Please add \`${key}Action\` when creating your handler.`);
13947
14094
  }
13948
14095
  const scrollTop = e.target.scrollTop;
13949
14096
  let current = Math.floor(scrollTop / avgHeight);
14097
+ if (!monthsData[current + 1])
14098
+ return;
13950
14099
  const nextTop = monthsData[current + 1].scrollTop;
13951
14100
  const nextHeight = monthsData[current + 1].cssHeight;
13952
14101
  if (current === 0) {
@@ -14147,9 +14296,9 @@ Please add \`${key}Action\` when creating your handler.`);
14147
14296
  };
14148
14297
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : ""));
14149
14298
  });
14150
- CalendarItem.defaultProps = defaultProps$10;
14299
+ CalendarItem.defaultProps = defaultProps$11;
14151
14300
  CalendarItem.displayName = "NutCalendarItem";
14152
- const defaultProps$$ = {
14301
+ const defaultProps$10 = {
14153
14302
  ...ComponentDefaults,
14154
14303
  type: "single",
14155
14304
  autoBackfill: false,
@@ -14212,7 +14361,7 @@ Please add \`${key}Action\` when creating your handler.`);
14212
14361
  onConfirm,
14213
14362
  onDayClick,
14214
14363
  onPageChange
14215
- } = { ...defaultProps$$, ...props };
14364
+ } = { ...defaultProps$10, ...props };
14216
14365
  const calendarRef = React.useRef(null);
14217
14366
  const close = () => {
14218
14367
  onClose && onClose();
@@ -14286,8 +14435,418 @@ Please add \`${key}Action\` when creating your handler.`);
14286
14435
  renderItem()
14287
14436
  ) : renderItem());
14288
14437
  });
14289
- Calendar.defaultProps = defaultProps$$;
14438
+ Calendar.defaultProps = defaultProps$10;
14290
14439
  Calendar.displayName = "NutCalendar";
14440
+ const Left = () => {
14441
+ return /* @__PURE__ */ React.createElement(
14442
+ "svg",
14443
+ {
14444
+ xmlns: "http://www.w3.org/2000/svg",
14445
+ width: "18",
14446
+ height: "18",
14447
+ viewBox: "0 0 18 18"
14448
+ },
14449
+ /* @__PURE__ */ React.createElement("path", { d: "M6.605 9.49a.771.771 0 0 1 0-.98l3.6-4.372a.771.771 0 0 1 1.19.981L8.2 9l3.197 3.881a.771.771 0 1 1-1.191.98l-3.6-4.37Z" })
14450
+ );
14451
+ };
14452
+ const Right = () => {
14453
+ return /* @__PURE__ */ React.createElement(
14454
+ "svg",
14455
+ {
14456
+ xmlns: "http://www.w3.org/2000/svg",
14457
+ width: "18",
14458
+ height: "18",
14459
+ viewBox: "0 0 18 18"
14460
+ },
14461
+ /* @__PURE__ */ React.createElement("path", { d: "M11.396 9.49a.771.771 0 0 0 0-.98l-3.6-4.372a.771.771 0 0 0-1.191.981L9.8 9l-3.196 3.881a.771.771 0 0 0 1.19.98l3.6-4.37Z" })
14462
+ );
14463
+ };
14464
+ const DoubleLeft = () => {
14465
+ return /* @__PURE__ */ React.createElement(
14466
+ "svg",
14467
+ {
14468
+ xmlns: "http://www.w3.org/2000/svg",
14469
+ width: "18",
14470
+ height: "18",
14471
+ viewBox: "0 0 18 18"
14472
+ },
14473
+ /* @__PURE__ */ React.createElement("path", { d: "M13.853 4.026a.771.771 0 0 1 .12 1.085L10.864 9l3.11 3.889a.771.771 0 1 1-1.204.963L9.272 9.482a.771.771 0 0 1 0-.964l3.497-4.371a.771.771 0 0 1 1.084-.12Zm-5.245 0a.771.771 0 0 1 .12 1.085L5.617 9l3.111 3.889a.771.771 0 0 1-1.205.963L4.026 9.482a.771.771 0 0 1 0-.964l3.497-4.371a.771.771 0 0 1 1.085-.12Z" })
14474
+ );
14475
+ };
14476
+ const DoubleRight = () => {
14477
+ return /* @__PURE__ */ React.createElement(
14478
+ "svg",
14479
+ {
14480
+ xmlns: "http://www.w3.org/2000/svg",
14481
+ width: "18",
14482
+ height: "18",
14483
+ viewBox: "0 0 18 18"
14484
+ },
14485
+ /* @__PURE__ */ React.createElement("path", { d: "M4.147 13.974a.771.771 0 0 1-.12-1.085L7.136 9 4.028 5.11a.771.771 0 1 1 1.204-.963l3.497 4.371a.771.771 0 0 1 0 .964l-3.497 4.371a.771.771 0 0 1-1.084.12Zm5.245 0a.771.771 0 0 1-.12-1.085L12.383 9 9.272 5.11a.771.771 0 1 1 1.205-.963l3.497 4.371a.771.771 0 0 1 0 .964l-3.497 4.371a.771.771 0 0 1-1.085.12Z" })
14486
+ );
14487
+ };
14488
+ const convertDateToDay = (date2) => {
14489
+ return date2 ? {
14490
+ year: date2.getFullYear(),
14491
+ month: date2.getMonth() + 1,
14492
+ date: date2.getDate()
14493
+ } : null;
14494
+ };
14495
+ const convertDayToDate = (day) => {
14496
+ return day ? new Date(day.year, day.month - 1, day.date) : null;
14497
+ };
14498
+ const getPrevMonthDays = (year, month, firstDayOfWeek) => {
14499
+ let prevMonth = month - 1;
14500
+ let prevYear = year;
14501
+ if (prevMonth <= 0) {
14502
+ prevMonth = 12;
14503
+ prevYear -= 1;
14504
+ }
14505
+ let days = Utils.getMonthPreDay(year, month);
14506
+ days -= firstDayOfWeek;
14507
+ if (days >= 7) {
14508
+ days -= 7;
14509
+ }
14510
+ const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
14511
+ const months = Array.from(Array(preDates), (_, k2) => {
14512
+ return {
14513
+ type: "prev",
14514
+ year: prevYear,
14515
+ month: prevMonth,
14516
+ date: k2 + 1
14517
+ };
14518
+ });
14519
+ return months.slice(preDates - days);
14520
+ };
14521
+ const getCurrentMonthDays = (year, month) => {
14522
+ const days = Utils.getMonthDays(`${year}`, `${month}`);
14523
+ return Array.from(Array(days), (_, k2) => {
14524
+ return {
14525
+ type: "current",
14526
+ year,
14527
+ month,
14528
+ date: k2 + 1
14529
+ };
14530
+ });
14531
+ };
14532
+ const getCurrentWeekDays = (day, firstDayOfWeek) => {
14533
+ const current = new Date(day.year, day.month - 1, day.date);
14534
+ const count = (current.getDay() + 7 - firstDayOfWeek) % 7;
14535
+ return [
14536
+ convertDateToDay(
14537
+ new Date(current.getTime() - 24 * 60 * 60 * 1e3 * count)
14538
+ ),
14539
+ convertDateToDay(
14540
+ new Date(current.getTime() + 24 * 60 * 60 * 1e3 * (6 - count))
14541
+ )
14542
+ ];
14543
+ };
14544
+ const defaultProps$$ = {
14545
+ ...ComponentDefaults,
14546
+ type: "single",
14547
+ firstDayOfWeek: 0
14548
+ };
14549
+ const CalendarCard = React.forwardRef((props, ref) => {
14550
+ const { locale } = useConfig();
14551
+ const {
14552
+ style,
14553
+ type: type2,
14554
+ value,
14555
+ defaultValue,
14556
+ firstDayOfWeek,
14557
+ startDate,
14558
+ endDate,
14559
+ disableDay,
14560
+ renderDay,
14561
+ renderDayTop,
14562
+ renderDayBottom,
14563
+ onDayClick,
14564
+ onPageChange,
14565
+ onChange
14566
+ } = { ...defaultProps$$, ...props };
14567
+ const [month, setMonth] = React.useState(() => {
14568
+ let date2 = new Date(Date.now());
14569
+ const val = value || defaultValue;
14570
+ if (Array.isArray(val)) {
14571
+ if (val.length) {
14572
+ date2 = val[0];
14573
+ }
14574
+ } else if (val) {
14575
+ date2 = val;
14576
+ }
14577
+ return {
14578
+ year: date2.getFullYear(),
14579
+ month: date2.getMonth() + 1
14580
+ };
14581
+ });
14582
+ const [days, setDays] = React.useState([]);
14583
+ const valueToRange = (val) => {
14584
+ if (Array.isArray(val)) {
14585
+ return val.map((date2) => {
14586
+ return convertDateToDay(date2);
14587
+ });
14588
+ }
14589
+ return val ? [convertDateToDay(val)] : [];
14590
+ };
14591
+ const rangeTovalue = (range2) => {
14592
+ if (Array.isArray(range2)) {
14593
+ return range2.map((day) => {
14594
+ return convertDayToDate(day);
14595
+ });
14596
+ }
14597
+ return range2 ? [convertDayToDate(range2)] : [];
14598
+ };
14599
+ const [innerValue, setInnerValue] = React.useState(() => {
14600
+ const val = value || defaultValue ? valueToRange(value || defaultValue) : [];
14601
+ return val;
14602
+ });
14603
+ React.useEffect(() => {
14604
+ const val = value || defaultValue ? valueToRange(value || defaultValue) : [];
14605
+ setInnerValue(val);
14606
+ }, [value]);
14607
+ const change = (v) => {
14608
+ setInnerValue(v);
14609
+ if (type2 === "single") {
14610
+ const date2 = convertDayToDate(v[0]);
14611
+ onChange == null ? void 0 : onChange(date2);
14612
+ } else if (type2 === "multiple" || type2 === "range" || type2 === "week") {
14613
+ const val = rangeTovalue(v);
14614
+ onChange == null ? void 0 : onChange(val);
14615
+ }
14616
+ };
14617
+ const getDays = (month2) => {
14618
+ const y2 = month2.year;
14619
+ const m = month2.month;
14620
+ const days2 = [
14621
+ ...getPrevMonthDays(y2, m, firstDayOfWeek),
14622
+ ...getCurrentMonthDays(y2, m)
14623
+ ];
14624
+ const size = days2.length;
14625
+ const yearOfNextMonth = month2.month === 12 ? month2.year + 1 : month2.year;
14626
+ const monthOfNextMonth = month2.month === 12 ? 1 : month2.month + 1;
14627
+ for (let i = 1; i <= 42 - size; i++) {
14628
+ days2.push({
14629
+ type: "next",
14630
+ year: yearOfNextMonth,
14631
+ month: monthOfNextMonth,
14632
+ date: i
14633
+ });
14634
+ }
14635
+ return days2;
14636
+ };
14637
+ React.useEffect(() => {
14638
+ const newDays = getDays(month);
14639
+ setDays(newDays);
14640
+ onPageChange == null ? void 0 : onPageChange(month);
14641
+ }, [month]);
14642
+ const isSameDay = (day1, day2) => {
14643
+ return (day1 == null ? void 0 : day1.year) === (day2 == null ? void 0 : day2.year) && (day1 == null ? void 0 : day1.month) === (day2 == null ? void 0 : day2.month) && (day1 == null ? void 0 : day1.date) === (day2 == null ? void 0 : day2.date);
14644
+ };
14645
+ const compareDay = (day1, day2) => {
14646
+ if (day1 && day2) {
14647
+ if (day1.year === day2.year) {
14648
+ if (day1.month === day2.month) {
14649
+ return day1.date - day2.date;
14650
+ }
14651
+ return day1.month - day2.month;
14652
+ }
14653
+ return day1.year - day2.year;
14654
+ }
14655
+ };
14656
+ const isDisable = (day) => {
14657
+ if (disableDay && disableDay(day)) {
14658
+ return true;
14659
+ }
14660
+ if (startDate && Number(compareDay(day, convertDateToDay(startDate))) < 0) {
14661
+ return true;
14662
+ }
14663
+ if (endDate && Number(compareDay(day, convertDateToDay(endDate))) > 0) {
14664
+ return true;
14665
+ }
14666
+ return false;
14667
+ };
14668
+ const isActive = (day) => {
14669
+ if (type2 === "single" || type2 === "multiple") {
14670
+ for (const val of innerValue) {
14671
+ if (isSameDay(day, val)) {
14672
+ return true;
14673
+ }
14674
+ }
14675
+ } else if (type2 === "range" && innerValue.length === 1 && isSameDay(innerValue[0], day)) {
14676
+ return true;
14677
+ }
14678
+ return false;
14679
+ };
14680
+ const isStart2 = (day) => {
14681
+ return (type2 === "range" || type2 === "week") && innerValue.length === 2 && isSameDay(day, innerValue[0]);
14682
+ };
14683
+ const isEnd2 = (day) => {
14684
+ return (type2 === "range" || type2 === "week") && innerValue.length === 2 && isSameDay(day, innerValue[1]);
14685
+ };
14686
+ const isMid = (day) => {
14687
+ if (type2 === "range" || type2 === "week") {
14688
+ if (innerValue.length === 2) {
14689
+ const c12 = compareDay(innerValue[0], day);
14690
+ const c22 = compareDay(day, innerValue[1]);
14691
+ if (c12 && c12 < 0 && c22 && c22 < 0) {
14692
+ return true;
14693
+ }
14694
+ }
14695
+ }
14696
+ return false;
14697
+ };
14698
+ const isWeekend = (day) => {
14699
+ const d = new Date(day.year, day.month - 1, day.date).getDay();
14700
+ return d === 0 || d === 6;
14701
+ };
14702
+ const getClasses = (day) => {
14703
+ if (isDisable(day)) {
14704
+ return ["disabled"];
14705
+ }
14706
+ const res = [];
14707
+ if (day.type === "current") {
14708
+ if (isActive(day)) {
14709
+ res.push("active");
14710
+ }
14711
+ if (isStart2(day)) {
14712
+ res.push("start");
14713
+ }
14714
+ if (isEnd2(day)) {
14715
+ res.push("end");
14716
+ }
14717
+ if (isMid(day)) {
14718
+ res.push("mid");
14719
+ }
14720
+ if (isWeekend(day)) {
14721
+ res.push("weekend");
14722
+ }
14723
+ }
14724
+ return res;
14725
+ };
14726
+ const jumpTo = (year, month2) => {
14727
+ setMonth({ year, month: month2 });
14728
+ };
14729
+ const jump = (step = 1) => {
14730
+ const current = month.year * 12 + month.month;
14731
+ let newMonth = (current + step) % 12;
14732
+ if (newMonth === 0) {
14733
+ newMonth = 12;
14734
+ }
14735
+ const newYear = Math.floor((current + step - newMonth) / 12);
14736
+ setMonth({
14737
+ year: newYear,
14738
+ month: newMonth
14739
+ });
14740
+ };
14741
+ React.useImperativeHandle(ref, () => {
14742
+ return {
14743
+ jump,
14744
+ jumpTo
14745
+ };
14746
+ });
14747
+ const handleDayClick = (day) => {
14748
+ if (day.type === "prev" || day.type === "next" || isDisable(day)) {
14749
+ return;
14750
+ }
14751
+ onDayClick == null ? void 0 : onDayClick(day);
14752
+ switch (type2) {
14753
+ case "single": {
14754
+ if (innerValue[0] && isSameDay(innerValue[0], day)) {
14755
+ change([]);
14756
+ } else {
14757
+ change([day]);
14758
+ }
14759
+ break;
14760
+ }
14761
+ case "multiple": {
14762
+ const t = innerValue.find((i) => isSameDay(i, day));
14763
+ if (t) {
14764
+ change(innerValue.filter((i) => i !== t));
14765
+ } else {
14766
+ change([...innerValue, day]);
14767
+ }
14768
+ break;
14769
+ }
14770
+ case "range": {
14771
+ const len = innerValue.length;
14772
+ if (len === 0 || len === 2) {
14773
+ change([day]);
14774
+ } else if (len === 1) {
14775
+ const t = compareDay(innerValue[0], day);
14776
+ if (t === 0 || t === null || t === void 0) {
14777
+ change([]);
14778
+ } else if (t < 0) {
14779
+ change([innerValue[0], day]);
14780
+ } else {
14781
+ change([day, innerValue[0]]);
14782
+ }
14783
+ } else {
14784
+ console.warn("[NutUI] Calendar range error");
14785
+ }
14786
+ break;
14787
+ }
14788
+ case "week": {
14789
+ if (innerValue.length === 2 || innerValue.length === 0) {
14790
+ const [left, right] = getCurrentWeekDays(day, firstDayOfWeek);
14791
+ change([left, right]);
14792
+ } else {
14793
+ console.warn("[NutUI] Calendar week error");
14794
+ }
14795
+ break;
14796
+ }
14797
+ default: {
14798
+ console.warn("[NutUI] Calendar type error");
14799
+ }
14800
+ }
14801
+ };
14802
+ const monthTitle = locale.calendaritem.monthTitle;
14803
+ const renderHeader = () => {
14804
+ return /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-header" }, /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-header-left" }, /* @__PURE__ */ React.createElement("div", { className: "double-left", onClick: () => jump(-12) }, /* @__PURE__ */ React.createElement(DoubleLeft, null)), /* @__PURE__ */ React.createElement("div", { className: "left", onClick: () => jump(-1) }, /* @__PURE__ */ React.createElement(Left, null))), /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-header-title" }, monthTitle(month.year, month.month)), /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-header-right" }, /* @__PURE__ */ React.createElement("div", { className: "right", onClick: () => jump(1) }, /* @__PURE__ */ React.createElement(Right, null)), /* @__PURE__ */ React.createElement("div", { className: "double-right", onClick: () => jump(12) }, /* @__PURE__ */ React.createElement(DoubleRight, null))));
14805
+ };
14806
+ const [weekHeader] = React.useState(() => {
14807
+ const weekdays = locale.calendaritem.weekdays.map((day, index) => {
14808
+ return {
14809
+ name: day,
14810
+ key: index
14811
+ };
14812
+ });
14813
+ return [
14814
+ ...weekdays.slice(firstDayOfWeek, 7),
14815
+ ...weekdays.slice(0, firstDayOfWeek)
14816
+ ];
14817
+ });
14818
+ const renderContent = () => {
14819
+ return /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-content" }, /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-days" }, weekHeader.map((day) => {
14820
+ return /* @__PURE__ */ React.createElement(
14821
+ "div",
14822
+ {
14823
+ className: classNames("nut-calendarcard-day", "header", {
14824
+ weekend: day.key === 0 || day.key === 6
14825
+ }),
14826
+ key: day.key
14827
+ },
14828
+ day.name
14829
+ );
14830
+ })), /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-days" }, days.map((day) => /* @__PURE__ */ React.createElement(
14831
+ "div",
14832
+ {
14833
+ className: classNames(
14834
+ "nut-calendarcard-day",
14835
+ day.type,
14836
+ getClasses(day)
14837
+ ),
14838
+ key: `${day.year}-${day.month}-${day.date}`,
14839
+ onClick: () => handleDayClick(day)
14840
+ },
14841
+ /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-day-top" }, renderDayTop ? renderDayTop(day) : ""),
14842
+ /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-day-inner" }, renderDay ? renderDay(day) : day.date),
14843
+ /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard-day-bottom" }, renderDayBottom ? renderDayBottom(day) : "")
14844
+ ))));
14845
+ };
14846
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "nut-calendarcard", style }, renderHeader(), renderContent()));
14847
+ });
14848
+ CalendarCard.defaultProps = defaultProps$$;
14849
+ CalendarCard.displayName = "NutCalendarCard";
14291
14850
  const CheckboxGroupContext = React.createContext(null);
14292
14851
  const Context$1 = CheckboxGroupContext;
14293
14852
  const defaultProps$_ = {
@@ -14511,71 +15070,6 @@ Please add \`${key}Action\` when creating your handler.`);
14511
15070
  Checkbox.defaultProps = defaultProps$Z;
14512
15071
  Checkbox.displayName = "NutCheckBox";
14513
15072
  Checkbox.Group = CheckboxGroup;
14514
- const MIN_DISTANCE = 10;
14515
- function getDirection(x2, y2) {
14516
- if (x2 > y2 && x2 > MIN_DISTANCE) {
14517
- return "horizontal";
14518
- }
14519
- if (y2 > x2 && y2 > MIN_DISTANCE) {
14520
- return "vertical";
14521
- }
14522
- return "";
14523
- }
14524
- function useTouch() {
14525
- const [startX, SetStartX] = React.useState(0);
14526
- const [startY, SetStartY] = React.useState(0);
14527
- const [moveX, SetMoveX] = React.useState(0);
14528
- const [moveY, SetMoveY] = React.useState(0);
14529
- const [deltaX, SetDeltaX] = React.useState(0);
14530
- const [deltaY, SetDeltaY] = React.useState(0);
14531
- const [offsetX, SetOffsetX] = React.useState(0);
14532
- const [offsetY, SetOffsetY] = React.useState(0);
14533
- const [direction, SetDirection] = React.useState("");
14534
- const isVertical = () => direction === "vertical";
14535
- const isHorizontal = () => direction === "horizontal";
14536
- const reset = () => {
14537
- SetDeltaX(0);
14538
- SetDeltaY(0);
14539
- SetOffsetX(0);
14540
- SetOffsetY(0);
14541
- SetDirection("");
14542
- };
14543
- const start2 = (event) => {
14544
- reset();
14545
- SetStartX(event.touches[0].clientX);
14546
- SetStartY(event.touches[0].clientY);
14547
- };
14548
- const move = (event) => {
14549
- const touch = event.touches[0];
14550
- const dX = touch.clientX - startX;
14551
- const dY = touch.clientY - startY;
14552
- SetDeltaX(dX);
14553
- SetDeltaY(dY);
14554
- SetMoveX(touch.clientX);
14555
- SetMoveY(touch.clientY);
14556
- SetOffsetX(Math.abs(dX));
14557
- SetOffsetY(Math.abs(dY));
14558
- if (!direction) {
14559
- SetDirection(getDirection(offsetX, offsetY));
14560
- }
14561
- };
14562
- return {
14563
- move,
14564
- start: start2,
14565
- reset,
14566
- startX,
14567
- startY,
14568
- moveX,
14569
- moveY,
14570
- deltaX,
14571
- deltaY,
14572
- offsetX,
14573
- offsetY,
14574
- direction,
14575
- isVertical,
14576
- isHorizontal
14577
- };
14578
- }
14579
15073
  const InternalPickerPanel = (props, ref) => {
14580
15074
  const {
14581
15075
  keyIndex = 0,
@@ -14647,7 +15141,7 @@ Please add \`${key}Action\` when creating your handler.`);
14647
15141
  };
14648
15142
  const touchStart = (event) => {
14649
15143
  touch.start(event);
14650
- setStartY(touch.deltaY);
15144
+ setStartY(touch.deltaY.current);
14651
15145
  setStartTime(Date.now());
14652
15146
  transformY.current = scrollDistance;
14653
15147
  };
@@ -14657,13 +15151,13 @@ Please add \`${key}Action\` when creating your handler.`);
14657
15151
  moving.current = true;
14658
15152
  preventDefault2(event, true);
14659
15153
  }
14660
- const move = touch.deltaY - startY;
15154
+ const move = touch.deltaY.current - startY;
14661
15155
  setMove(move);
14662
15156
  };
14663
15157
  const touchEnd = (event) => {
14664
15158
  if (!moving.current)
14665
15159
  return;
14666
- const move = touch.deltaY - startY;
15160
+ const move = touch.deltaY.current - startY;
14667
15161
  const moveTime = Date.now() - startTime;
14668
15162
  if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
14669
15163
  const distance = momentum(move, moveTime);
@@ -14741,6 +15235,19 @@ Please add \`${key}Action\` when creating your handler.`);
14741
15235
  stopMomentum,
14742
15236
  moving: moving.current
14743
15237
  }));
15238
+ React.useEffect(() => {
15239
+ var _a2, _b, _c;
15240
+ const options22 = passiveSupported ? { passive: false } : false;
15241
+ (_a2 = PickerPanelRef.current) == null ? void 0 : _a2.addEventListener("touchstart", touchStart, options22);
15242
+ (_b = PickerPanelRef.current) == null ? void 0 : _b.addEventListener("touchmove", touchMove, options22);
15243
+ (_c = PickerPanelRef.current) == null ? void 0 : _c.addEventListener("touchend", touchEnd, options22);
15244
+ return () => {
15245
+ var _a3, _b2, _c2;
15246
+ (_a3 = PickerPanelRef.current) == null ? void 0 : _a3.removeEventListener("touchstart", touchStart);
15247
+ (_b2 = PickerPanelRef.current) == null ? void 0 : _b2.removeEventListener("touchmove", touchMove);
15248
+ (_c2 = PickerPanelRef.current) == null ? void 0 : _c2.removeEventListener("touchend", touchEnd);
15249
+ };
15250
+ });
14744
15251
  return /* @__PURE__ */ React.createElement(
14745
15252
  "div",
14746
15253
  {
@@ -14818,6 +15325,7 @@ Please add \`${key}Action\` when creating your handler.`);
14818
15325
  visible,
14819
15326
  title,
14820
15327
  options: options2 = [],
15328
+ popupProps = {},
14821
15329
  defaultValue = [],
14822
15330
  className,
14823
15331
  style,
@@ -14989,7 +15497,7 @@ Please add \`${key}Action\` when creating your handler.`);
14989
15497
  if (moving) {
14990
15498
  isConfirmEvent.current = true;
14991
15499
  } else {
14992
- setSelectedValue(innerValue);
15500
+ setSelectedValue(innerValue, true);
14993
15501
  closePicker();
14994
15502
  }
14995
15503
  setTimeout(() => {
@@ -15027,6 +15535,7 @@ Please add \`${key}Action\` when creating your handler.`);
15027
15535
  return /* @__PURE__ */ React.createElement(React.Fragment, null, typeof children === "function" && children(selectedValue), /* @__PURE__ */ React.createElement(
15028
15536
  Popup,
15029
15537
  {
15538
+ ...popupProps,
15030
15539
  visible: innerVisible,
15031
15540
  position: "bottom",
15032
15541
  afterClose: () => {
@@ -15074,6 +15583,7 @@ Please add \`${key}Action\` when creating your handler.`);
15074
15583
  visible,
15075
15584
  title,
15076
15585
  defaultValue,
15586
+ pickerProps = {},
15077
15587
  formatter,
15078
15588
  onClose,
15079
15589
  onConfirm,
@@ -15346,6 +15856,7 @@ Please add \`${key}Action\` when creating your handler.`);
15346
15856
  return /* @__PURE__ */ React.createElement("div", { className: `nut-datepicker ${className}`, style, ...rest }, options2.length && /* @__PURE__ */ React.createElement(
15347
15857
  Picker$1,
15348
15858
  {
15859
+ ...pickerProps,
15349
15860
  title,
15350
15861
  visible,
15351
15862
  options: options2,
@@ -16950,7 +17461,7 @@ Please add \`${key}Action\` when creating your handler.`);
16950
17461
  }
16951
17462
  setValue(val);
16952
17463
  const eventHandler = props[trigger];
16953
- if (eventHandler && typeof eventHandler === "function") {
17464
+ if (eventHandler && typeof eventHandler === "function" && trigger !== "onChange") {
16954
17465
  eventHandler(val);
16955
17466
  }
16956
17467
  };
@@ -18243,11 +18754,11 @@ Please add \`${key}Action\` when creating your handler.`);
18243
18754
  touch.move(event);
18244
18755
  setDragStatus("draging");
18245
18756
  const rect = getRect(root2.current);
18246
- let delta = touch.deltaX;
18757
+ let delta = touch.deltaX.current;
18247
18758
  let total = rect.width;
18248
18759
  let diff = delta / total * scope();
18249
18760
  if (vertical) {
18250
- delta = touch.deltaY;
18761
+ delta = touch.deltaY.current;
18251
18762
  total = rect.height;
18252
18763
  diff = delta / total * scope();
18253
18764
  }
@@ -20375,7 +20886,7 @@ Please add \`${key}Action\` when creating your handler.`);
20375
20886
  content: "",
20376
20887
  closeable: false,
20377
20888
  wrap: false,
20378
- leftIcon: null,
20889
+ leftIcon: /* @__PURE__ */ React.createElement(k$1, { width: 16, height: 16 }),
20379
20890
  rightIcon: null,
20380
20891
  delay: 1,
20381
20892
  scrollable: null,
@@ -20640,6 +21151,9 @@ Please add \`${key}Action\` when creating your handler.`);
20640
21151
  };
20641
21152
  const getStyle = (moveOffset = offset) => {
20642
21153
  const target = innerRef.current;
21154
+ if (!target) {
21155
+ return;
21156
+ }
20643
21157
  let _offset = 0;
20644
21158
  const val = rect.height - height;
20645
21159
  _offset = moveOffset + Number(active === childCount - 1 && val / 2);
@@ -20697,7 +21211,7 @@ Please add \`${key}Action\` when creating your handler.`);
20697
21211
  stopAutoPlay();
20698
21212
  };
20699
21213
  }, []);
20700
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick2 }, /* @__PURE__ */ React.createElement("div", { className: "left-icon" }, leftIcon || /* @__PURE__ */ React.createElement(k$1, { width: 16, height: 16 })), /* @__PURE__ */ React.createElement("div", { ref: wrapRef, className: "wrap" }, /* @__PURE__ */ React.createElement(
21214
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick2 }, leftIcon ? /* @__PURE__ */ React.createElement("div", { className: "left-icon" }, leftIcon) : null, /* @__PURE__ */ React.createElement("div", { ref: wrapRef, className: "wrap" }, /* @__PURE__ */ React.createElement(
20701
21215
  "div",
20702
21216
  {
20703
21217
  ref: contentRef,
@@ -21199,19 +21713,6 @@ Please add \`${key}Action\` when creating your handler.`);
21199
21713
  return position;
21200
21714
  }
21201
21715
  const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
21202
- let passiveSupported = false;
21203
- if (canUseDom) {
21204
- try {
21205
- const opts = Object.defineProperty({}, "passive", {
21206
- get() {
21207
- passiveSupported = true;
21208
- }
21209
- });
21210
- window.addEventListener("test-passive-supported", null, opts);
21211
- } catch (e) {
21212
- console.log(e);
21213
- }
21214
- }
21215
21716
  const defaultProps$w = {
21216
21717
  ...ComponentDefaults,
21217
21718
  pullingText: "",
@@ -21608,27 +22109,29 @@ Please add \`${key}Action\` when creating your handler.`);
21608
22109
  const leftWidth = actionWidth.left;
21609
22110
  const rightWidth = actionWidth.right;
21610
22111
  const onTouchStart = (event) => {
22112
+ var _a2;
21611
22113
  if (!props.disabled) {
21612
22114
  startOffset.current = state.offset;
21613
22115
  touch.start(event);
21614
- props.onTouchStart && props.onTouchStart(event);
22116
+ (_a2 = props.onTouchStart) == null ? void 0 : _a2.call(props, event);
21615
22117
  }
21616
22118
  };
21617
22119
  const onTouchMove = (event) => {
22120
+ var _a2;
21618
22121
  if (props.disabled) {
21619
22122
  return;
21620
22123
  }
21621
22124
  touch.move(event);
21622
- props.onTouchMove && props.onTouchMove(event);
22125
+ (_a2 = props.onTouchMove) == null ? void 0 : _a2.call(props, event);
21623
22126
  if (touch.isHorizontal()) {
21624
22127
  lockClick.current = true;
21625
22128
  const newState = { ...state, dragging: true };
21626
- const isEdge = !opened || touch.deltaX * startOffset.current < 0;
22129
+ const isEdge = !opened || touch.deltaX.current * startOffset.current < 0;
21627
22130
  if (isEdge) {
21628
22131
  preventDefault(event, true);
21629
22132
  }
21630
22133
  newState.offset = rangeCalculation(
21631
- touch.deltaX + startOffset.current,
22134
+ touch.deltaX.current + startOffset.current,
21632
22135
  -rightWidth,
21633
22136
  leftWidth
21634
22137
  );
@@ -21636,13 +22139,14 @@ Please add \`${key}Action\` when creating your handler.`);
21636
22139
  }
21637
22140
  };
21638
22141
  const onTouchEnd = (event) => {
22142
+ var _a2;
21639
22143
  if (state.dragging) {
21640
22144
  setState((v) => ({ ...v, dragging: false }));
21641
22145
  toggle(state.offset > 0 ? "left" : "right");
21642
22146
  setTimeout(() => {
21643
22147
  lockClick.current = false;
21644
22148
  }, 0);
21645
- props.onTouchEnd && props.onTouchEnd(event);
22149
+ (_a2 = props.onTouchEnd) == null ? void 0 : _a2.call(props, event);
21646
22150
  }
21647
22151
  };
21648
22152
  const toggle = (side) => {
@@ -25362,6 +25866,7 @@ Please add \`${key}Action\` when creating your handler.`);
25362
25866
  exports2.Barrage = Barrage;
25363
25867
  exports2.Button = Button;
25364
25868
  exports2.Calendar = Calendar;
25869
+ exports2.CalendarCard = CalendarCard;
25365
25870
  exports2.CalendarItem = CalendarItem;
25366
25871
  exports2.Card = Card;
25367
25872
  exports2.Cascader = Cascader;