@nutui/nutui-react 2.0.0-alpha.7 → 2.0.0-alpha.9

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 (43) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/esm/Audio.js +12 -8
  3. package/dist/esm/Cascader.js +20 -12
  4. package/dist/esm/Elevator.js +6 -5
  5. package/dist/esm/Image.js +2 -5
  6. package/dist/esm/ImagePreview.js +9 -9
  7. package/dist/esm/Indicator.js +4 -4
  8. package/dist/esm/Notify.js +35 -46
  9. package/dist/esm/NumberKeyboard.js +137 -195
  10. package/dist/esm/Price.js +22 -23
  11. package/dist/esm/PullToRefresh.js +8 -8
  12. package/dist/esm/Radio.js +2 -0
  13. package/dist/esm/RadioGroup.js +31 -51
  14. package/dist/esm/Range/style/index.js +1 -1
  15. package/dist/esm/Range.js +119 -174
  16. package/dist/esm/Swiper.js +100 -111
  17. package/dist/esm/SwiperItem.js +1 -1
  18. package/dist/esm/radio2.js +52 -54
  19. package/dist/esm/tabs2.js +19 -8
  20. package/dist/locales/base.js +1 -1
  21. package/dist/locales/en-US.js +1 -1
  22. package/dist/locales/id-ID.js +1 -1
  23. package/dist/locales/zh-CN.js +1 -1
  24. package/dist/locales/zh-TW.js +1 -1
  25. package/dist/locales/zh-UG.js +1 -1
  26. package/dist/nutui.react.mjs +1306 -1386
  27. package/dist/nutui.react.umd.js +1305 -1385
  28. package/dist/packages/imagepreview/imagepreview.scss +5 -0
  29. package/dist/packages/notify/notify.scss +1 -1
  30. package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
  31. package/dist/packages/price/price.scss +8 -0
  32. package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -8
  33. package/dist/packages/radio/radio.scss +13 -32
  34. package/dist/packages/radiogroup/radiogroup.scss +17 -51
  35. package/dist/packages/range/range.scss +24 -49
  36. package/dist/packages/swiper/swiper.scss +0 -15
  37. package/dist/style.css +1 -1
  38. package/dist/style.mjs +1 -1
  39. package/dist/styles/variables-jmapp.scss +61 -61
  40. package/dist/styles/variables.scss +61 -60
  41. package/dist/types/index.d.ts +84 -106
  42. package/package.json +1 -1
  43. /package/dist/esm/{UserContext3.js → context2.js} +0 -0
@@ -6,12 +6,12 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  var _a;
8
8
  /*!
9
- * @nutui/nutui-react v2.0.0-alpha.7 Fri May 12 2023 15:35:24 GMT+0800 (China Standard Time)
9
+ * @nutui/nutui-react v2.0.0-alpha.9 Wed May 17 2023 18:23:02 GMT+0800 (China Standard Time)
10
10
  * (c) 2023 @jdf2e.
11
11
  * Released under the MIT License.
12
12
  */
13
13
  import * as React from "react";
14
- import React__default, { useCallback, createContext, useMemo, useContext, useState, useRef, useEffect, useLayoutEffect, forwardRef, isValidElement, useImperativeHandle, Component, memo } from "react";
14
+ import React__default, { useCallback, createContext, useMemo, useContext, useState, useRef, useEffect, useLayoutEffect, forwardRef, isValidElement, useImperativeHandle, createElement, Component, memo } from "react";
15
15
  import * as ReactDOM from "react-dom";
16
16
  import ReactDOM__default, { unstable_batchedUpdates, createPortal } from "react-dom";
17
17
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -1643,7 +1643,7 @@ Check the top-level render call using <` + t + ">.");
1643
1643
  process.env.NODE_ENV === "production" ? h.exports = ur() : h.exports = sr();
1644
1644
  })(ir);
1645
1645
  const lr = D.Fragment, cr = D.jsx, vr = D.jsxs;
1646
- const a$v = {
1646
+ const a$w = {
1647
1647
  className: "",
1648
1648
  style: void 0,
1649
1649
  name: "ArrowDown2",
@@ -1651,8 +1651,8 @@ const a$v = {
1651
1651
  height: "",
1652
1652
  onClick: () => {
1653
1653
  }
1654
- }, y$8 = (h) => {
1655
- const { className: r, style: d, name: e, color: p, width: m, height: w, onClick: n } = { ...a$v, ...h }, f = (t) => {
1654
+ }, y$9 = (h) => {
1655
+ const { className: r, style: d, name: e, color: p, width: m, height: w, onClick: n } = { ...a$w, ...h }, f = (t) => {
1656
1656
  n && n(t);
1657
1657
  }, c = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
1658
1658
  const t = "nut-icon";
@@ -1689,8 +1689,8 @@ const a$v = {
1689
1689
  }
1690
1690
  ) });
1691
1691
  };
1692
- y$8.defaultProps = a$v;
1693
- const a$u = {
1692
+ y$9.defaultProps = a$w;
1693
+ const a$v = {
1694
1694
  className: "",
1695
1695
  style: void 0,
1696
1696
  name: "ArrowUp2",
@@ -1699,7 +1699,7 @@ const a$u = {
1699
1699
  onClick: () => {
1700
1700
  }
1701
1701
  }, x$g = (h) => {
1702
- const { className: o, style: p, name: e, color: d, width: m, height: f, onClick: n } = { ...a$u, ...h }, g = (t) => {
1702
+ const { className: o, style: p, name: e, color: d, width: m, height: f, onClick: n } = { ...a$v, ...h }, g = (t) => {
1703
1703
  n && n(t);
1704
1704
  }, i = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", w = () => {
1705
1705
  const t = "nut-icon";
@@ -1736,8 +1736,8 @@ const a$u = {
1736
1736
  }
1737
1737
  ) });
1738
1738
  };
1739
- x$g.defaultProps = a$u;
1740
- const a$t = {
1739
+ x$g.defaultProps = a$v;
1740
+ const a$u = {
1741
1741
  className: "",
1742
1742
  style: void 0,
1743
1743
  name: "CheckChecked",
@@ -1745,8 +1745,8 @@ const a$t = {
1745
1745
  height: "",
1746
1746
  onClick: () => {
1747
1747
  }
1748
- }, y$7 = (h) => {
1749
- const { className: r, style: d, name: e, color: p, width: m, height: f, onClick: o } = { ...a$t, ...h }, C = (t) => {
1748
+ }, y$8 = (h) => {
1749
+ const { className: r, style: d, name: e, color: p, width: m, height: f, onClick: o } = { ...a$u, ...h }, C = (t) => {
1750
1750
  o && o(t);
1751
1751
  }, i = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", k2 = () => {
1752
1752
  const t = "nut-icon";
@@ -1794,8 +1794,8 @@ const a$t = {
1794
1794
  }
1795
1795
  ) });
1796
1796
  };
1797
- y$7.defaultProps = a$t;
1798
- const a$s = {
1797
+ y$8.defaultProps = a$u;
1798
+ const a$t = {
1799
1799
  className: "",
1800
1800
  style: void 0,
1801
1801
  name: "CheckDisabled",
@@ -1804,7 +1804,7 @@ const a$s = {
1804
1804
  onClick: () => {
1805
1805
  }
1806
1806
  }, x$f = (h) => {
1807
- const { className: i, style: d, name: e, color: m, width: p, height: f, onClick: o } = { ...a$s, ...h }, g = (t) => {
1807
+ const { className: i, style: d, name: e, color: m, width: p, height: f, onClick: o } = { ...a$t, ...h }, g = (t) => {
1808
1808
  o && o(t);
1809
1809
  }, r = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", C = () => {
1810
1810
  const t = "nut-icon";
@@ -1841,8 +1841,8 @@ const a$s = {
1841
1841
  }
1842
1842
  ) });
1843
1843
  };
1844
- x$f.defaultProps = a$s;
1845
- const a$r = {
1844
+ x$f.defaultProps = a$t;
1845
+ const a$s = {
1846
1846
  className: "",
1847
1847
  style: void 0,
1848
1848
  name: "CheckNormal",
@@ -1851,7 +1851,7 @@ const a$r = {
1851
1851
  onClick: () => {
1852
1852
  }
1853
1853
  }, N = (h) => {
1854
- const { className: o, style: m, name: e, color: d, width: p, height: C, onClick: r } = { ...a$r, ...h }, f = (t) => {
1854
+ const { className: o, style: m, name: e, color: d, width: p, height: C, onClick: r } = { ...a$s, ...h }, f = (t) => {
1855
1855
  r && r(t);
1856
1856
  }, n = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
1857
1857
  const t = "nut-icon";
@@ -1888,8 +1888,8 @@ const a$r = {
1888
1888
  }
1889
1889
  ) });
1890
1890
  };
1891
- N.defaultProps = a$r;
1892
- const a$q = {
1891
+ N.defaultProps = a$s;
1892
+ const a$r = {
1893
1893
  className: "",
1894
1894
  style: void 0,
1895
1895
  name: "Check",
@@ -1898,7 +1898,7 @@ const a$q = {
1898
1898
  onClick: () => {
1899
1899
  }
1900
1900
  }, x$e = (h) => {
1901
- const { className: o, style: d, name: e, color: p, width: m, height: f, onClick: r } = { ...a$q, ...h }, g = (t) => {
1901
+ const { className: o, style: d, name: e, color: p, width: m, height: f, onClick: r } = { ...a$r, ...h }, g = (t) => {
1902
1902
  r && r(t);
1903
1903
  }, n = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", C = () => {
1904
1904
  const t = "nut-icon";
@@ -1935,8 +1935,8 @@ const a$q = {
1935
1935
  }
1936
1936
  ) });
1937
1937
  };
1938
- x$e.defaultProps = a$q;
1939
- const a$p = {
1938
+ x$e.defaultProps = a$r;
1939
+ const a$q = {
1940
1940
  className: "",
1941
1941
  style: void 0,
1942
1942
  name: "Checked",
@@ -1945,7 +1945,7 @@ const a$p = {
1945
1945
  onClick: () => {
1946
1946
  }
1947
1947
  }, x$d = (h) => {
1948
- const { className: o, style: d, name: e, color: m, width: p, height: C, onClick: r } = { ...a$p, ...h }, f = (t) => {
1948
+ const { className: o, style: d, name: e, color: m, width: p, height: C, onClick: r } = { ...a$q, ...h }, f = (t) => {
1949
1949
  r && r(t);
1950
1950
  }, n = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
1951
1951
  const t = "nut-icon";
@@ -1982,8 +1982,8 @@ const a$p = {
1982
1982
  }
1983
1983
  ) });
1984
1984
  };
1985
- x$d.defaultProps = a$p;
1986
- const a$o = {
1985
+ x$d.defaultProps = a$q;
1986
+ const a$p = {
1987
1987
  className: "",
1988
1988
  style: void 0,
1989
1989
  name: "Checklist",
@@ -1992,7 +1992,7 @@ const a$o = {
1992
1992
  onClick: () => {
1993
1993
  }
1994
1994
  }, x$c = (h) => {
1995
- const { className: i, style: d, name: e, color: p, width: m, height: f, onClick: o } = { ...a$o, ...h }, g = (t) => {
1995
+ const { className: i, style: d, name: e, color: p, width: m, height: f, onClick: o } = { ...a$p, ...h }, g = (t) => {
1996
1996
  o && o(t);
1997
1997
  }, r = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", k2 = () => {
1998
1998
  const t = "nut-icon";
@@ -2029,8 +2029,8 @@ const a$o = {
2029
2029
  }
2030
2030
  ) });
2031
2031
  };
2032
- x$c.defaultProps = a$o;
2033
- const a$n = {
2032
+ x$c.defaultProps = a$p;
2033
+ const a$o = {
2034
2034
  className: "",
2035
2035
  style: void 0,
2036
2036
  name: "CircleClose",
@@ -2039,7 +2039,7 @@ const a$n = {
2039
2039
  onClick: () => {
2040
2040
  }
2041
2041
  }, x$b = (h) => {
2042
- const { className: l2, style: m, name: e, color: d, width: p, height: C, onClick: o } = { ...a$n, ...h }, f = (t) => {
2042
+ const { className: l2, style: m, name: e, color: d, width: p, height: C, onClick: o } = { ...a$o, ...h }, f = (t) => {
2043
2043
  o && o(t);
2044
2044
  }, r = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
2045
2045
  const t = "nut-icon";
@@ -2076,8 +2076,8 @@ const a$n = {
2076
2076
  }
2077
2077
  ) });
2078
2078
  };
2079
- x$b.defaultProps = a$n;
2080
- const a$m = {
2079
+ x$b.defaultProps = a$o;
2080
+ const a$n = {
2081
2081
  className: "",
2082
2082
  style: void 0,
2083
2083
  name: "Close",
@@ -2086,7 +2086,7 @@ const a$m = {
2086
2086
  onClick: () => {
2087
2087
  }
2088
2088
  }, x$a = (h) => {
2089
- const { className: o, style: d, name: e, color: m, width: p, height: f, onClick: r } = { ...a$m, ...h }, g = (t) => {
2089
+ const { className: o, style: d, name: e, color: m, width: p, height: f, onClick: r } = { ...a$n, ...h }, g = (t) => {
2090
2090
  r && r(t);
2091
2091
  }, n = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", C = () => {
2092
2092
  const t = "nut-icon";
@@ -2123,8 +2123,8 @@ const a$m = {
2123
2123
  }
2124
2124
  ) });
2125
2125
  };
2126
- x$a.defaultProps = a$m;
2127
- const a$l = {
2126
+ x$a.defaultProps = a$n;
2127
+ const a$m = {
2128
2128
  className: "",
2129
2129
  style: void 0,
2130
2130
  name: "Del",
@@ -2132,8 +2132,8 @@ const a$l = {
2132
2132
  height: "",
2133
2133
  onClick: () => {
2134
2134
  }
2135
- }, y$6 = (h) => {
2136
- const { className: o, style: d, name: e, color: m, width: p, height: f, onClick: r } = { ...a$l, ...h }, g = (t) => {
2135
+ }, y$7 = (h) => {
2136
+ const { className: o, style: d, name: e, color: m, width: p, height: f, onClick: r } = { ...a$m, ...h }, g = (t) => {
2137
2137
  r && r(t);
2138
2138
  }, n = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", u = () => {
2139
2139
  const t = "nut-icon";
@@ -2170,8 +2170,8 @@ const a$l = {
2170
2170
  }
2171
2171
  ) });
2172
2172
  };
2173
- y$6.defaultProps = a$l;
2174
- const a$k = {
2173
+ y$7.defaultProps = a$m;
2174
+ const a$l = {
2175
2175
  className: "",
2176
2176
  style: void 0,
2177
2177
  name: "DownArrow",
@@ -2180,7 +2180,7 @@ const a$k = {
2180
2180
  onClick: () => {
2181
2181
  }
2182
2182
  }, x$9 = (h) => {
2183
- const { className: r, style: d, name: e, color: p, width: m, height: w, onClick: n } = { ...a$k, ...h }, f = (t) => {
2183
+ const { className: r, style: d, name: e, color: p, width: m, height: w, onClick: n } = { ...a$l, ...h }, f = (t) => {
2184
2184
  n && n(t);
2185
2185
  }, c = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
2186
2186
  const t = "nut-icon";
@@ -2217,8 +2217,8 @@ const a$k = {
2217
2217
  }
2218
2218
  ) });
2219
2219
  };
2220
- x$9.defaultProps = a$k;
2221
- const a$j = {
2220
+ x$9.defaultProps = a$l;
2221
+ const a$k = {
2222
2222
  className: "",
2223
2223
  style: void 0,
2224
2224
  name: "Failure",
@@ -2227,7 +2227,7 @@ const a$j = {
2227
2227
  onClick: () => {
2228
2228
  }
2229
2229
  }, x$8 = (h) => {
2230
- const { className: r, style: d, name: e, color: m, width: p, height: f, onClick: l2 } = { ...a$j, ...h }, u = (t) => {
2230
+ const { className: r, style: d, name: e, color: m, width: p, height: f, onClick: l2 } = { ...a$k, ...h }, u = (t) => {
2231
2231
  l2 && l2(t);
2232
2232
  }, i = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
2233
2233
  const t = "nut-icon";
@@ -2264,8 +2264,8 @@ const a$j = {
2264
2264
  }
2265
2265
  ) });
2266
2266
  };
2267
- x$8.defaultProps = a$j;
2268
- const a$i = {
2267
+ x$8.defaultProps = a$k;
2268
+ const a$j = {
2269
2269
  className: "",
2270
2270
  style: void 0,
2271
2271
  name: "ImageError",
@@ -2274,7 +2274,7 @@ const a$i = {
2274
2274
  onClick: () => {
2275
2275
  }
2276
2276
  }, k$5 = (h) => {
2277
- const { className: s, style: d, name: e, color: m, width: p, height: f, onClick: o } = { ...a$i, ...h }, g = (t) => {
2277
+ const { className: s, style: d, name: e, color: m, width: p, height: f, onClick: o } = { ...a$j, ...h }, g = (t) => {
2278
2278
  o && o(t);
2279
2279
  }, c = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", u = () => {
2280
2280
  const t = "nut-icon";
@@ -2322,8 +2322,8 @@ const a$i = {
2322
2322
  }
2323
2323
  ) });
2324
2324
  };
2325
- k$5.defaultProps = a$i;
2326
- const a$h = {
2325
+ k$5.defaultProps = a$j;
2326
+ const a$i = {
2327
2327
  className: "",
2328
2328
  style: void 0,
2329
2329
  name: "Image",
@@ -2332,7 +2332,7 @@ const a$h = {
2332
2332
  onClick: () => {
2333
2333
  }
2334
2334
  }, k$4 = (h) => {
2335
- const { className: l2, style: d, name: c, color: m, width: p, height: f, onClick: r } = { ...a$h, ...h }, g = (t) => {
2335
+ const { className: l2, style: d, name: c, color: m, width: p, height: f, onClick: r } = { ...a$i, ...h }, g = (t) => {
2336
2336
  r && r(t);
2337
2337
  }, o = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", u = () => {
2338
2338
  const t = "nut-icon";
@@ -2380,8 +2380,8 @@ const a$h = {
2380
2380
  }
2381
2381
  ) });
2382
2382
  };
2383
- k$4.defaultProps = a$h;
2384
- const a$g = {
2383
+ k$4.defaultProps = a$i;
2384
+ const a$h = {
2385
2385
  className: "",
2386
2386
  style: void 0,
2387
2387
  name: "JoySmile",
@@ -2390,7 +2390,7 @@ const a$g = {
2390
2390
  onClick: () => {
2391
2391
  }
2392
2392
  }, x$7 = (h) => {
2393
- const { className: i, style: d, name: e, color: m, width: p, height: f, onClick: r } = { ...a$g, ...h }, g = (t) => {
2393
+ const { className: i, style: d, name: e, color: m, width: p, height: f, onClick: r } = { ...a$h, ...h }, g = (t) => {
2394
2394
  r && r(t);
2395
2395
  }, c = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", u = () => {
2396
2396
  const t = "nut-icon";
@@ -2427,8 +2427,8 @@ const a$g = {
2427
2427
  }
2428
2428
  ) });
2429
2429
  };
2430
- x$7.defaultProps = a$g;
2431
- const a$f = {
2430
+ x$7.defaultProps = a$h;
2431
+ const a$g = {
2432
2432
  className: "",
2433
2433
  style: void 0,
2434
2434
  name: "Left",
@@ -2436,8 +2436,8 @@ const a$f = {
2436
2436
  height: "",
2437
2437
  onClick: () => {
2438
2438
  }
2439
- }, y$5 = (h) => {
2440
- const { className: r, style: d, name: e, color: p, width: m, height: f, onClick: n } = { ...a$f, ...h }, g = (t) => {
2439
+ }, y$6 = (h) => {
2440
+ const { className: r, style: d, name: e, color: p, width: m, height: f, onClick: n } = { ...a$g, ...h }, g = (t) => {
2441
2441
  n && n(t);
2442
2442
  }, i = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", u = () => {
2443
2443
  const t = "nut-icon";
@@ -2474,8 +2474,8 @@ const a$f = {
2474
2474
  }
2475
2475
  ) });
2476
2476
  };
2477
- y$5.defaultProps = a$f;
2478
- const a$e = {
2477
+ y$6.defaultProps = a$g;
2478
+ const a$f = {
2479
2479
  className: "",
2480
2480
  style: void 0,
2481
2481
  name: "Link",
@@ -2484,7 +2484,7 @@ const a$e = {
2484
2484
  onClick: () => {
2485
2485
  }
2486
2486
  }, x$6 = (h) => {
2487
- const { className: s, style: d, name: c, color: m, width: p, height: f, onClick: n } = { ...a$e, ...h }, g = (t) => {
2487
+ const { className: s, style: d, name: c, color: m, width: p, height: f, onClick: n } = { ...a$f, ...h }, g = (t) => {
2488
2488
  n && n(t);
2489
2489
  }, i = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", k2 = () => {
2490
2490
  const t = "nut-icon";
@@ -2521,8 +2521,8 @@ const a$e = {
2521
2521
  }
2522
2522
  ) });
2523
2523
  };
2524
- x$6.defaultProps = a$e;
2525
- const a$d = {
2524
+ x$6.defaultProps = a$f;
2525
+ const a$e = {
2526
2526
  className: "",
2527
2527
  style: void 0,
2528
2528
  name: "Loading",
@@ -2531,7 +2531,7 @@ const a$d = {
2531
2531
  onClick: () => {
2532
2532
  }
2533
2533
  }, k$3 = (h) => {
2534
- const { className: l2, style: m, name: t, color: d, width: p, height: g, onClick: o } = { ...a$d, ...h }, f = (c) => {
2534
+ const { className: l2, style: m, name: t, color: d, width: p, height: g, onClick: o } = { ...a$e, ...h }, f = (c) => {
2535
2535
  o && o(c);
2536
2536
  }, n = (c) => c === "" ? "" : isNaN(Number(c)) ? String(c) : c + "px", z = () => {
2537
2537
  const c = "nut-icon";
@@ -2568,8 +2568,8 @@ const a$d = {
2568
2568
  }
2569
2569
  ) });
2570
2570
  };
2571
- k$3.defaultProps = a$d;
2572
- const a$c = {
2571
+ k$3.defaultProps = a$e;
2572
+ const a$d = {
2573
2573
  className: "",
2574
2574
  style: void 0,
2575
2575
  name: "Location2",
@@ -2578,7 +2578,7 @@ const a$c = {
2578
2578
  onClick: () => {
2579
2579
  }
2580
2580
  }, x$5 = (h) => {
2581
- const { className: o, style: m, name: s, color: d, width: p, height: f, onClick: n } = { ...a$c, ...h }, g = (t) => {
2581
+ const { className: o, style: m, name: s, color: d, width: p, height: f, onClick: n } = { ...a$d, ...h }, g = (t) => {
2582
2582
  n && n(t);
2583
2583
  }, i = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", C = () => {
2584
2584
  const t = "nut-icon";
@@ -2615,8 +2615,8 @@ const a$c = {
2615
2615
  }
2616
2616
  ) });
2617
2617
  };
2618
- x$5.defaultProps = a$c;
2619
- const a$b = {
2618
+ x$5.defaultProps = a$d;
2619
+ const a$c = {
2620
2620
  className: "",
2621
2621
  style: void 0,
2622
2622
  name: "MaskClose",
@@ -2625,7 +2625,7 @@ const a$b = {
2625
2625
  onClick: () => {
2626
2626
  }
2627
2627
  }, x$4 = (h) => {
2628
- const { className: c, style: d, name: s, color: m, width: p, height: f, onClick: l2 } = { ...a$b, ...h }, g = (t) => {
2628
+ const { className: c, style: d, name: s, color: m, width: p, height: f, onClick: l2 } = { ...a$c, ...h }, g = (t) => {
2629
2629
  l2 && l2(t);
2630
2630
  }, r = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", C = () => {
2631
2631
  const t = "nut-icon";
@@ -2662,8 +2662,8 @@ const a$b = {
2662
2662
  }
2663
2663
  ) });
2664
2664
  };
2665
- x$4.defaultProps = a$b;
2666
- const a$a = {
2665
+ x$4.defaultProps = a$c;
2666
+ const a$b = {
2667
2667
  className: "",
2668
2668
  style: void 0,
2669
2669
  name: "Minus",
@@ -2671,8 +2671,8 @@ const a$a = {
2671
2671
  height: "",
2672
2672
  onClick: () => {
2673
2673
  }
2674
- }, y$4 = (h) => {
2675
- const { className: i, style: d, name: s, color: p, width: m, height: f, onClick: o } = { ...a$a, ...h }, u = (t) => {
2674
+ }, y$5 = (h) => {
2675
+ const { className: i, style: d, name: s, color: p, width: m, height: f, onClick: o } = { ...a$b, ...h }, u = (t) => {
2676
2676
  o && o(t);
2677
2677
  }, r = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
2678
2678
  const t = "nut-icon";
@@ -2709,8 +2709,8 @@ const a$a = {
2709
2709
  }
2710
2710
  ) });
2711
2711
  };
2712
- y$4.defaultProps = a$a;
2713
- const a$9 = {
2712
+ y$5.defaultProps = a$b;
2713
+ const a$a = {
2714
2714
  className: "",
2715
2715
  style: void 0,
2716
2716
  name: "My",
@@ -2719,7 +2719,7 @@ const a$9 = {
2719
2719
  onClick: () => {
2720
2720
  }
2721
2721
  }, k$2 = (h) => {
2722
- const { className: o, style: d, name: s, color: m, width: p, height: f, onClick: r } = { ...a$9, ...h }, g = (t) => {
2722
+ const { className: o, style: d, name: s, color: m, width: p, height: f, onClick: r } = { ...a$a, ...h }, g = (t) => {
2723
2723
  r && r(t);
2724
2724
  }, n = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", u = () => {
2725
2725
  const t = "nut-icon";
@@ -2756,8 +2756,8 @@ const a$9 = {
2756
2756
  }
2757
2757
  ) });
2758
2758
  };
2759
- k$2.defaultProps = a$9;
2760
- const a$8 = {
2759
+ k$2.defaultProps = a$a;
2760
+ const a$9 = {
2761
2761
  className: "",
2762
2762
  style: void 0,
2763
2763
  name: "Notice",
@@ -2766,7 +2766,7 @@ const a$8 = {
2766
2766
  onClick: () => {
2767
2767
  }
2768
2768
  }, k$1 = (h) => {
2769
- const { className: o, style: d, name: e, color: m, width: p, height: f, onClick: i } = { ...a$8, ...h }, g = (t) => {
2769
+ const { className: o, style: d, name: e, color: m, width: p, height: f, onClick: i } = { ...a$9, ...h }, g = (t) => {
2770
2770
  i && i(t);
2771
2771
  }, r = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", u = () => {
2772
2772
  const t = "nut-icon";
@@ -2803,7 +2803,7 @@ const a$8 = {
2803
2803
  }
2804
2804
  ) });
2805
2805
  };
2806
- k$1.defaultProps = a$8;
2806
+ k$1.defaultProps = a$9;
2807
2807
  const l = {
2808
2808
  className: "",
2809
2809
  style: void 0,
@@ -2851,7 +2851,7 @@ const l = {
2851
2851
  ) });
2852
2852
  };
2853
2853
  x$3.defaultProps = l;
2854
- const a$7 = {
2854
+ const a$8 = {
2855
2855
  className: "",
2856
2856
  style: void 0,
2857
2857
  name: "Plus",
@@ -2859,8 +2859,8 @@ const a$7 = {
2859
2859
  height: "",
2860
2860
  onClick: () => {
2861
2861
  }
2862
- }, y$3 = (h) => {
2863
- const { className: r, style: d, name: e, color: p, width: m, height: f, onClick: n } = { ...a$7, ...h }, u = (t) => {
2862
+ }, y$4 = (h) => {
2863
+ const { className: r, style: d, name: e, color: p, width: m, height: f, onClick: n } = { ...a$8, ...h }, u = (t) => {
2864
2864
  n && n(t);
2865
2865
  }, i = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", g = () => {
2866
2866
  const t = "nut-icon";
@@ -2897,6 +2897,53 @@ const a$7 = {
2897
2897
  }
2898
2898
  ) });
2899
2899
  };
2900
+ y$4.defaultProps = a$8;
2901
+ const a$7 = {
2902
+ className: "",
2903
+ style: void 0,
2904
+ name: "RectDown",
2905
+ width: "",
2906
+ height: "",
2907
+ onClick: () => {
2908
+ }
2909
+ }, y$3 = (h) => {
2910
+ const { className: o, style: d, name: e, color: p, width: m, height: f, onClick: n } = { ...a$7, ...h }, g = (t) => {
2911
+ n && n(t);
2912
+ }, r = (t) => t === "" ? "" : isNaN(Number(t)) ? String(t) : t + "px", w = () => {
2913
+ const t = "nut-icon";
2914
+ return classNames({
2915
+ [`${o}`]: o,
2916
+ [t]: true,
2917
+ [t + "-" + e]: e
2918
+ });
2919
+ }, s = {}, i = r(m || ""), l2 = r(f || "");
2920
+ i && (s.width = i), l2 && (s.height = l2);
2921
+ const u = () => ({
2922
+ ...d,
2923
+ ...s
2924
+ });
2925
+ return /* @__PURE__ */ cr(lr, { children: /* @__PURE__ */ cr(
2926
+ "svg",
2927
+ {
2928
+ className: w(),
2929
+ style: u(),
2930
+ onClick: g,
2931
+ xmlns: "http://www.w3.org/2000/svg",
2932
+ color: p,
2933
+ viewBox: "0 0 1024 1024",
2934
+ "aria-labelledby": e,
2935
+ role: "presentation",
2936
+ children: /* @__PURE__ */ cr(
2937
+ "path",
2938
+ {
2939
+ d: "M515.072 778.24c-14.336 0-28.672-5.632-39.936-16.384L69.12 356.864c-22.016-22.016-22.016-57.856 0-79.872s57.856-22.016 79.872 0L515.584 642.56 880.64 275.968c22.016-22.016 57.856-22.016 79.872 0s22.016 57.856 0 79.872L555.008 762.368c-10.752 10.752-25.6 15.872-39.936 15.872z",
2940
+ fill: "currentColor",
2941
+ fillOpacity: "0.9"
2942
+ }
2943
+ )
2944
+ }
2945
+ ) });
2946
+ };
2900
2947
  y$3.defaultProps = a$7;
2901
2948
  const a$6 = {
2902
2949
  className: "",
@@ -3332,7 +3379,7 @@ const defaultProps$1r = {
3332
3379
  onClick: (event) => {
3333
3380
  }
3334
3381
  };
3335
- const classPrefix$g = "nut-cell";
3382
+ const classPrefix$i = "nut-cell";
3336
3383
  const Cell = (props) => {
3337
3384
  const {
3338
3385
  children,
@@ -3363,24 +3410,24 @@ const Cell = (props) => {
3363
3410
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3364
3411
  "div",
3365
3412
  {
3366
- className: classNames(classPrefix$g, className),
3413
+ className: classNames(classPrefix$i, className),
3367
3414
  onClick: (event) => handleClick2(event),
3368
3415
  style: baseStyle,
3369
3416
  ...rest,
3370
3417
  children: children || /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
3371
- title || description ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix$g}__left`, children: [
3372
- title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$g}__title`, children: title }) : null,
3373
- description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$g}__description`, children: description }) : null
3418
+ title || description ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix$i}__left`, children: [
3419
+ title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$i}__title`, children: title }) : null,
3420
+ description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$i}__description`, children: description }) : null
3374
3421
  ] }) : null,
3375
3422
  extra ? /* @__PURE__ */ jsxRuntimeExports.jsx(
3376
3423
  "div",
3377
3424
  {
3378
- className: `${classPrefix$g}__extra`,
3425
+ className: `${classPrefix$i}__extra`,
3379
3426
  style: styles,
3380
3427
  children: extra
3381
3428
  }
3382
3429
  ) : null,
3383
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$g}__divider` })
3430
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$i}__divider` })
3384
3431
  ] })
3385
3432
  }
3386
3433
  );
@@ -3393,19 +3440,19 @@ const defaultProps$1q = {
3393
3440
  description: "",
3394
3441
  divider: true
3395
3442
  };
3396
- const classPrefix$f = "nut-cell-group";
3443
+ const classPrefix$h = "nut-cell-group";
3397
3444
  const CellGroup = (props) => {
3398
3445
  const { children, className, style, title, description, divider, ...rest } = {
3399
3446
  ...defaultProps$1q,
3400
3447
  ...props
3401
3448
  };
3402
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classNames(classPrefix$f, className), ...rest, children: [
3403
- title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$f}__title`, children: title }) : null,
3404
- description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$f}__description`, children: description }) : null,
3449
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classNames(classPrefix$h, className), ...rest, children: [
3450
+ title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$h}__title`, children: title }) : null,
3451
+ description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$h}__description`, children: description }) : null,
3405
3452
  /* @__PURE__ */ jsxRuntimeExports.jsx(
3406
3453
  "div",
3407
3454
  {
3408
- className: `${classPrefix$f}__wrap ${divider ? `${classPrefix$f}__wrap--divider` : ""}`,
3455
+ className: `${classPrefix$h}__wrap ${divider ? `${classPrefix$h}__wrap--divider` : ""}`,
3409
3456
  children
3410
3457
  }
3411
3458
  )
@@ -3883,7 +3930,7 @@ const defaultProps$1o = {
3883
3930
  loading: true,
3884
3931
  lazy: false
3885
3932
  };
3886
- const classPrefix$e = "nut-image";
3933
+ const classPrefix$g = "nut-image";
3887
3934
  const Image$1 = (props) => {
3888
3935
  const {
3889
3936
  className,
@@ -3935,7 +3982,6 @@ const Image$1 = (props) => {
3935
3982
  };
3936
3983
  const observer = useRef(null);
3937
3984
  const initObserver = () => {
3938
- const images = document.querySelectorAll(".nut-img.lazyload");
3939
3985
  const options2 = {
3940
3986
  threshold: [0],
3941
3987
  // 交会处
@@ -3951,14 +3997,12 @@ const Image$1 = (props) => {
3951
3997
  img.src = img.dataset.src;
3952
3998
  img.removeAttribute("data-src");
3953
3999
  }
3954
- observer.current.unobserve(item.target);
4000
+ resetObserver();
3955
4001
  }, 300);
3956
4002
  }
3957
4003
  });
3958
4004
  }, options2);
3959
- images.forEach((item) => {
3960
- observer.current.observe(item);
3961
- });
4005
+ observer.current.observe(imgRef.current);
3962
4006
  };
3963
4007
  const resetObserver = () => {
3964
4008
  observer.current.disconnect && observer.current.disconnect();
@@ -3997,7 +4041,7 @@ const Image$1 = (props) => {
3997
4041
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
3998
4042
  "div",
3999
4043
  {
4000
- className: classNames(classPrefix$e, className),
4044
+ className: classNames(classPrefix$g, className),
4001
4045
  style: containerStyle,
4002
4046
  onClick: (e) => {
4003
4047
  imageClick(e);
@@ -4165,21 +4209,21 @@ const defaultProps$1m = {
4165
4209
  contentPosition: "center",
4166
4210
  direction: "horizontal"
4167
4211
  };
4168
- const classPrefix$d = `nut-divider`;
4212
+ const classPrefix$f = `nut-divider`;
4169
4213
  const Divider = (props) => {
4170
4214
  const { children, contentPosition, style, className, direction, ...rest } = {
4171
4215
  ...defaultProps$1m,
4172
4216
  ...props
4173
4217
  };
4174
4218
  const classes = direction === "horizontal" ? classNames({
4175
- [`${classPrefix$d}`]: true,
4176
- [`${classPrefix$d}__center`]: children,
4177
- [`${classPrefix$d}__left`]: contentPosition === "left",
4178
- [`${classPrefix$d}__right`]: contentPosition === "right",
4179
- [`${classPrefix$d}__hairline`]: true
4219
+ [`${classPrefix$f}`]: true,
4220
+ [`${classPrefix$f}__center`]: children,
4221
+ [`${classPrefix$f}__left`]: contentPosition === "left",
4222
+ [`${classPrefix$f}__right`]: contentPosition === "right",
4223
+ [`${classPrefix$f}__hairline`]: true
4180
4224
  }) : classNames({
4181
- [`${classPrefix$d}`]: true,
4182
- [`${classPrefix$d}__vertical`]: direction === "vertical"
4225
+ [`${classPrefix$f}`]: true,
4226
+ [`${classPrefix$f}__vertical`]: direction === "vertical"
4183
4227
  });
4184
4228
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classes} ${className || ""}`, style, ...rest, children });
4185
4229
  };
@@ -4340,7 +4384,7 @@ const Layout = (props) => {
4340
4384
  };
4341
4385
  Layout.defaultProps = defaultProps$1j;
4342
4386
  Layout.displayName = "NutLayout";
4343
- const classPrefix$c = "nut-row";
4387
+ const classPrefix$e = "nut-row";
4344
4388
  const defaultProps$1i = {
4345
4389
  ...ComponentDefaults,
4346
4390
  type: "",
@@ -4375,7 +4419,7 @@ const Row = (props) => {
4375
4419
  ${getClass("justify", justify)}
4376
4420
  ${getClass("align", align)}
4377
4421
  ${getClass("flex", wrap)}
4378
- ${classPrefix$c}
4422
+ ${classPrefix$e}
4379
4423
  `;
4380
4424
  };
4381
4425
  const parentRow = {
@@ -4474,7 +4518,7 @@ const defaultProps$1h = {
4474
4518
  threshold: 0,
4475
4519
  zIndex: 2e3
4476
4520
  };
4477
- const classPrefix$b = "nut-sticky";
4521
+ const classPrefix$d = "nut-sticky";
4478
4522
  const Sticky = (props) => {
4479
4523
  const {
4480
4524
  position,
@@ -4596,7 +4640,7 @@ const Sticky = (props) => {
4596
4640
  {
4597
4641
  ref: rootRef,
4598
4642
  style: { ...style, ...rootStyle },
4599
- className: classNames(classPrefix$b, className),
4643
+ className: classNames(classPrefix$d, className),
4600
4644
  ...rest,
4601
4645
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-sticky--box", ref: stickyRef, style: stickyStyle, children })
4602
4646
  }
@@ -7525,7 +7569,7 @@ const useIsMounted = () => {
7525
7569
  }, []);
7526
7570
  return isMounted;
7527
7571
  };
7528
- function useForceUpdate() {
7572
+ function useForceUpdate$1() {
7529
7573
  const update2 = useState()[1];
7530
7574
  const isMounted = useIsMounted();
7531
7575
  return () => {
@@ -7786,7 +7830,7 @@ const withAnimated = (Component2, host2) => {
7786
7830
  instanceRef.current = updateRef(givenRef, value);
7787
7831
  }, [givenRef]);
7788
7832
  const [props, deps] = getAnimatedState(givenProps, host2);
7789
- const forceUpdate = useForceUpdate();
7833
+ const forceUpdate = useForceUpdate$1();
7790
7834
  const callback = () => {
7791
7835
  const instance = instanceRef.current;
7792
7836
  if (hasInstance && !instance) {
@@ -9441,7 +9485,7 @@ function useSprings(length, props, deps) {
9441
9485
  deps = [];
9442
9486
  const ref = useMemo(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []);
9443
9487
  const layoutId = useRef(0);
9444
- const forceUpdate = useForceUpdate();
9488
+ const forceUpdate = useForceUpdate$1();
9445
9489
  const state = useMemo(() => ({
9446
9490
  ctrls: [],
9447
9491
  queue: [],
@@ -9845,7 +9889,8 @@ const defaultProps$1f = {
9845
9889
  list: [],
9846
9890
  sticky: false,
9847
9891
  spaceHeight: 23,
9848
- titleHeight: 35
9892
+ titleHeight: 35,
9893
+ showKeys: true
9849
9894
  };
9850
9895
  const Elevator = (props) => {
9851
9896
  const {
@@ -9855,6 +9900,7 @@ const Elevator = (props) => {
9855
9900
  sticky,
9856
9901
  spaceHeight,
9857
9902
  titleHeight,
9903
+ showKeys,
9858
9904
  className,
9859
9905
  style,
9860
9906
  onClickItem,
@@ -10010,39 +10056,41 @@ const Elevator = (props) => {
10010
10056
  }) })
10011
10057
  }
10012
10058
  ),
10013
- list.length && scrollStart ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10014
- "div",
10015
- {
10016
- className: classNames({
10017
- [`${classPrefix2}__code--current`]: true,
10018
- [`${classPrefix2}__code--current--current`]: true
10019
- }),
10020
- children: list[codeIndex][floorKey]
10021
- }
10022
- ) : null,
10023
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__bars`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10024
- animated.div,
10025
- {
10026
- className: `${classPrefix2}__bars__inner`,
10027
- ...bind(),
10028
- style: { touchAction: "pan-y" },
10029
- children: list.map((item, index) => {
10030
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
10031
- "div",
10032
- {
10033
- className: classNames({
10034
- [`${classPrefix2}__bars__inner__item`]: true,
10035
- [`${classPrefix2}__bars__inner__item--active`]: item[floorKey] === list[currentIndex][floorKey]
10036
- }),
10037
- "data-index": index,
10038
- onClick: () => handleClickIndex(item[floorKey]),
10039
- children: item[floorKey]
10040
- },
10041
- index
10042
- );
10043
- })
10044
- }
10045
- ) })
10059
+ showKeys ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10060
+ list.length && scrollStart ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10061
+ "div",
10062
+ {
10063
+ className: classNames({
10064
+ [`${classPrefix2}__code--current`]: true,
10065
+ [`${classPrefix2}__code--current--current`]: true
10066
+ }),
10067
+ children: list[codeIndex][floorKey]
10068
+ }
10069
+ ) : null,
10070
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__bars`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10071
+ animated.div,
10072
+ {
10073
+ className: `${classPrefix2}__bars__inner`,
10074
+ ...bind(),
10075
+ style: { touchAction: "pan-y" },
10076
+ children: list.map((item, index) => {
10077
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10078
+ "div",
10079
+ {
10080
+ className: classNames({
10081
+ [`${classPrefix2}__bars__inner__item`]: true,
10082
+ [`${classPrefix2}__bars__inner__item--active`]: item[floorKey] === list[currentIndex][floorKey]
10083
+ }),
10084
+ "data-index": index,
10085
+ onClick: () => handleClickIndex(item[floorKey]),
10086
+ children: item[floorKey]
10087
+ },
10088
+ index
10089
+ );
10090
+ })
10091
+ }
10092
+ ) })
10093
+ ] }) : null
10046
10094
  ] });
10047
10095
  };
10048
10096
  Elevator.defaultProps = defaultProps$1f;
@@ -10128,7 +10176,7 @@ const FixedNav = (props) => {
10128
10176
  );
10129
10177
  }) }) }),
10130
10178
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__btn`, onClick: () => onUpdateValue(), children: content || /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10131
- /* @__PURE__ */ jsxRuntimeExports.jsx(y$5, { color: "#fff" }),
10179
+ /* @__PURE__ */ jsxRuntimeExports.jsx(y$6, { color: "#fff" }),
10132
10180
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text", children: visible ? activeText || locale.fixednav.activeText : inactiveText || locale.fixednav.inactiveText })
10133
10181
  ] }) })
10134
10182
  ]
@@ -12482,6 +12530,10 @@ function requestAniFrame() {
12482
12530
  }
12483
12531
  }
12484
12532
  const requestAniFrame$1 = requestAniFrame();
12533
+ function useForceUpdate() {
12534
+ const [, updateState] = React__default.useState();
12535
+ return React__default.useCallback(() => updateState({}), []);
12536
+ }
12485
12537
  const defaultProps$15 = {
12486
12538
  ...ComponentDefaults,
12487
12539
  tabStyle: {},
@@ -12491,7 +12543,7 @@ const defaultProps$15 = {
12491
12543
  duration: 300,
12492
12544
  autoHeight: false
12493
12545
  };
12494
- const classPrefix$a = "nut-tabs";
12546
+ const classPrefix$c = "nut-tabs";
12495
12547
  const Tabs = (props) => {
12496
12548
  const {
12497
12549
  activeColor,
@@ -12569,41 +12621,46 @@ const Tabs = (props) => {
12569
12621
  return titles2;
12570
12622
  };
12571
12623
  const titles = useRef(getTitles());
12624
+ const forceUpdate = useForceUpdate();
12572
12625
  useEffect(() => {
12573
12626
  titles.current = getTitles();
12574
12627
  let current = "";
12575
12628
  titles.current.forEach((title2) => {
12576
- if (title2.value === value) {
12629
+ if (title2.value == value) {
12577
12630
  current = value;
12578
12631
  }
12579
12632
  });
12580
- if (current !== "") {
12633
+ if (current !== "" && current !== value) {
12581
12634
  setValue(current);
12635
+ } else {
12636
+ forceUpdate();
12582
12637
  }
12583
12638
  }, [children]);
12584
12639
  const classes = classNames(
12585
- classPrefix$a,
12586
- `${classPrefix$a}--${direction}`,
12640
+ classPrefix$c,
12641
+ `${classPrefix$c}--${direction}`,
12587
12642
  className
12588
12643
  );
12589
- const classesTitle = classNames(`${classPrefix$a}__titles`, {
12590
- [`${classPrefix$a}__titles--${activeType}`]: activeType,
12591
- [`${classPrefix$a}__titles--scrollable`]: true,
12592
- [`${classPrefix$a}__titles--${align}`]: align
12644
+ const classesTitle = classNames(`${classPrefix$c}__titles`, {
12645
+ [`${classPrefix$c}__titles--${activeType}`]: activeType,
12646
+ [`${classPrefix$c}__titles--scrollable`]: true,
12647
+ [`${classPrefix$c}__titles--${align}`]: align
12593
12648
  });
12594
12649
  const tabsActiveStyle = {
12595
12650
  color: activeType === "smile" ? activeColor : "",
12596
12651
  background: activeType === "line" ? activeColor : ""
12597
12652
  };
12598
12653
  useEffect(() => {
12599
- const index = titles.current.findIndex((t) => t.value === value);
12654
+ const index = titles.current.findIndex((t) => t.value == value);
12600
12655
  setContentStyle({
12601
12656
  transform: direction === "horizontal" ? `translate3d(-${index * 100}%, 0, 0)` : `translate3d( 0,-${index * 100}%, 0)`,
12602
12657
  transitionDuration: `${duration}ms`
12603
12658
  });
12604
- scrollIntoView(index);
12659
+ setTimeout(() => {
12660
+ scrollIntoView(index);
12661
+ });
12605
12662
  }, [value]);
12606
- const tabChange = (item, index) => {
12663
+ const tabChange = (item) => {
12607
12664
  onClick && onClick(item.value);
12608
12665
  if (item.disabled) {
12609
12666
  return;
@@ -12611,14 +12668,14 @@ const Tabs = (props) => {
12611
12668
  setValue(item.value);
12612
12669
  };
12613
12670
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes, ...rest, children: [
12614
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesTitle, style: { ...tabStyle }, ref: navRef, children: !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
12671
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesTitle, style: { ...tabStyle }, ref: navRef, children: !!title && typeof title === "function" ? title() : titles.current.map((item) => {
12615
12672
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
12616
12673
  "div",
12617
12674
  {
12618
- onClick: (e) => {
12675
+ onClick: () => {
12619
12676
  tabChange(item);
12620
12677
  },
12621
- className: classNames(`${classPrefix$a}__titles-item`, {
12678
+ className: classNames(`${classPrefix$c}__titles-item`, {
12622
12679
  [`nut-tabs__titles-item--active`]: !item.disabled && String(item.value) === String(value),
12623
12680
  [`nut-tabs__titles-item--disabled`]: item.disabled,
12624
12681
  [`nut-tabs__titles-item--${align}`]: align
@@ -12628,14 +12685,14 @@ const Tabs = (props) => {
12628
12685
  activeType === "line" && /* @__PURE__ */ jsxRuntimeExports.jsx(
12629
12686
  "div",
12630
12687
  {
12631
- className: `${classPrefix$a}__titles-item__line`,
12688
+ className: `${classPrefix$c}__titles-item__line`,
12632
12689
  style: tabsActiveStyle
12633
12690
  }
12634
12691
  ),
12635
12692
  activeType === "smile" && /* @__PURE__ */ jsxRuntimeExports.jsx(
12636
12693
  "div",
12637
12694
  {
12638
- className: `${classPrefix$a}__titles-item__smile`,
12695
+ className: `${classPrefix$c}__titles-item__smile`,
12639
12696
  style: tabsActiveStyle,
12640
12697
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(x$7, { color: activeColor, width: 40, height: 20 })
12641
12698
  }
@@ -12647,7 +12704,7 @@ const Tabs = (props) => {
12647
12704
  {
12648
12705
  ellipsis: true
12649
12706
  },
12650
- `${classPrefix$a}__titles-item__text`
12707
+ `${classPrefix$c}__titles-item__text`
12651
12708
  ),
12652
12709
  children: item.title
12653
12710
  }
@@ -12657,7 +12714,7 @@ const Tabs = (props) => {
12657
12714
  item.value
12658
12715
  );
12659
12716
  }) }),
12660
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$a}__content__wrap`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$a}__content`, style: contentStyle, children: React__default.Children.map(children, (child, idx) => {
12717
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$c}__content__wrap`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$c}__content`, style: contentStyle, children: React__default.Children.map(children, (child, idx) => {
12661
12718
  if (!React__default.isValidElement(child)) {
12662
12719
  return null;
12663
12720
  }
@@ -13293,7 +13350,7 @@ const Address = (props) => {
13293
13350
  };
13294
13351
  const headerRender = () => {
13295
13352
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: b("header"), children: [
13296
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "arrow-back", onClick: onSwitchModule, children: privateType === "custom" && (React__default.isValidElement(backBtnIcon) ? backBtnIcon : /* @__PURE__ */ jsxRuntimeExports.jsx(y$5, { color: "#cccccc" })) }),
13353
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "arrow-back", onClick: onSwitchModule, children: privateType === "custom" && (React__default.isValidElement(backBtnIcon) ? backBtnIcon : /* @__PURE__ */ jsxRuntimeExports.jsx(y$6, { color: "#cccccc" })) }),
13297
13354
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("header__title"), children: privateType === "custom" ? customAddressTitle || locale.address.selectRegion : existAddressTitle || locale.address.deliveryTo }),
13298
13355
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { onClick: () => handClose(), children: React__default.isValidElement(closeBtnIcon) ? closeBtnIcon : /* @__PURE__ */ jsxRuntimeExports.jsx(x$b, { width: 18, height: 18, color: "#ccc" }) })
13299
13356
  ] });
@@ -14464,7 +14521,6 @@ const defaultProps$_ = {
14464
14521
  popup: true,
14465
14522
  visible: false,
14466
14523
  options: [],
14467
- value: [],
14468
14524
  title: "",
14469
14525
  optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
14470
14526
  format: {},
@@ -14479,8 +14535,7 @@ const defaultProps$_ = {
14479
14535
  onChange: () => {
14480
14536
  },
14481
14537
  onPathChange: () => {
14482
- },
14483
- ...Popup.defaultProps
14538
+ }
14484
14539
  };
14485
14540
  const InternalCascader = (props, ref) => {
14486
14541
  const {
@@ -14490,6 +14545,7 @@ const InternalCascader = (props, ref) => {
14490
14545
  visible,
14491
14546
  options: options2,
14492
14547
  value,
14548
+ defaultValue,
14493
14549
  title,
14494
14550
  optionKey: optionKey2,
14495
14551
  format: format2,
@@ -14505,6 +14561,15 @@ const InternalCascader = (props, ref) => {
14505
14561
  const [tabvalue, setTabvalue] = useState("c1");
14506
14562
  const [optionsData, setOptionsData] = useState([]);
14507
14563
  const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
14564
+ const [innerValue, setInnerValue] = usePropsValue({
14565
+ value,
14566
+ defaultValue,
14567
+ finalValue: defaultValue,
14568
+ onChange: (val) => {
14569
+ var _a2;
14570
+ (_a2 = props.onChange) == null ? void 0 : _a2.call(props, val);
14571
+ }
14572
+ });
14508
14573
  const [state] = useState({
14509
14574
  optionsData: [],
14510
14575
  panes: [
@@ -14514,7 +14579,6 @@ const InternalCascader = (props, ref) => {
14514
14579
  paneKey: ""
14515
14580
  }
14516
14581
  ],
14517
- innerValue: value,
14518
14582
  tree: new Tree$1([], {}),
14519
14583
  tabsCursor: 0,
14520
14584
  // 选中的tab项
@@ -14534,12 +14598,12 @@ const InternalCascader = (props, ref) => {
14534
14598
  });
14535
14599
  useEffect(() => {
14536
14600
  initData();
14537
- }, [options2]);
14601
+ }, [options2, format2]);
14538
14602
  useEffect(() => {
14539
- if (value !== state.innerValue) {
14540
- state.innerValue = value;
14603
+ if (defaultValue && defaultValue !== innerValue) {
14604
+ setInnerValue(defaultValue);
14541
14605
  }
14542
- }, [value]);
14606
+ }, [defaultValue]);
14543
14607
  const initData = async () => {
14544
14608
  state.lazyLoadMap.clear();
14545
14609
  if (format2 && Object.keys(format2).length > 0) {
@@ -14574,24 +14638,24 @@ const InternalCascader = (props, ref) => {
14574
14638
  setOptionsData(state.panes);
14575
14639
  };
14576
14640
  const syncValue = async () => {
14577
- const currentValue2 = state.innerValue;
14578
- if (currentValue2 === void 0 || !state.tree.nodes.length) {
14641
+ const currentValue = innerValue;
14642
+ if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
14579
14643
  return;
14580
14644
  }
14581
- if (currentValue2.length === 0) {
14645
+ if (currentValue.length === 0) {
14582
14646
  state.tabsCursor = 0;
14583
14647
  return;
14584
14648
  }
14585
- let needToSync = currentValue2;
14586
- if (isLazy() && Array.isArray(currentValue2) && currentValue2.length) {
14649
+ let needToSync = currentValue;
14650
+ if (isLazy() && Array.isArray(currentValue) && currentValue.length) {
14587
14651
  needToSync = [];
14588
14652
  const parent = state.tree.nodes.find(
14589
- (node) => node.value === currentValue2[0]
14653
+ (node) => node.value === currentValue[0]
14590
14654
  );
14591
14655
  if (parent) {
14592
14656
  needToSync = [parent.value];
14593
14657
  state.initLoading = true;
14594
- const last = await currentValue2.slice(1).reduce(async (p, value2) => {
14658
+ const last = await currentValue.slice(1).reduce(async (p, value2) => {
14595
14659
  var _a2;
14596
14660
  const parent2 = await p;
14597
14661
  await invokeLazyLoad(parent2);
@@ -14607,7 +14671,7 @@ const InternalCascader = (props, ref) => {
14607
14671
  state.initLoading = false;
14608
14672
  }
14609
14673
  }
14610
- if (needToSync.length && currentValue2 === value) {
14674
+ if (needToSync.length && currentValue === defaultValue) {
14611
14675
  const pathNodes = state.tree.getPathNodesByValue(needToSync);
14612
14676
  pathNodes.forEach((node, index) => {
14613
14677
  state.tabsCursor = index;
@@ -14664,6 +14728,7 @@ const InternalCascader = (props, ref) => {
14664
14728
  const optionParams = pathNodes.map((item) => item.value);
14665
14729
  onChange(optionParams, pathNodes);
14666
14730
  onPathChange(optionParams, pathNodes);
14731
+ setInnerValue(optionParams);
14667
14732
  }
14668
14733
  setOptionsData(state.panes);
14669
14734
  close();
@@ -14775,7 +14840,7 @@ const defaultProps$Z = {
14775
14840
  },
14776
14841
  options: []
14777
14842
  };
14778
- const classPrefix$9 = "nut-checkboxgroup";
14843
+ const classPrefix$b = "nut-checkboxgroup";
14779
14844
  const CheckboxGroup = React__default.forwardRef(
14780
14845
  (props, ref) => {
14781
14846
  const { children } = { ...defaultProps$Z, ...props };
@@ -14856,7 +14921,7 @@ const CheckboxGroup = React__default.forwardRef(
14856
14921
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
14857
14922
  "div",
14858
14923
  {
14859
- className: classNames(classPrefix$9, {
14924
+ className: classNames(classPrefix$b, {
14860
14925
  [`nut-checkboxgroup--${props.direction}`]: props.direction,
14861
14926
  className
14862
14927
  }),
@@ -14880,7 +14945,7 @@ const defaultProps$Y = {
14880
14945
  onChange: (value) => {
14881
14946
  }
14882
14947
  };
14883
- const classPrefix$8 = "nut-checkbox";
14948
+ const classPrefix$a = "nut-checkbox";
14884
14949
  const Checkbox = (props) => {
14885
14950
  const { children } = {
14886
14951
  ...defaultProps$Y,
@@ -14942,22 +15007,22 @@ const Checkbox = (props) => {
14942
15007
  };
14943
15008
  const color = () => {
14944
15009
  if (innerDisabled) {
14945
- return `${classPrefix$8}__icon--disable`;
15010
+ return `${classPrefix$a}__icon--disable`;
14946
15011
  }
14947
15012
  if (innerChecked) {
14948
15013
  if (innerIndeterminate) {
14949
- return `${classPrefix$8}__icon--indeterminate`;
15014
+ return `${classPrefix$a}__icon--indeterminate`;
14950
15015
  }
14951
- return `${classPrefix$8}__icon`;
15016
+ return `${classPrefix$a}__icon`;
14952
15017
  }
14953
- return `${classPrefix$8}__icon--unchecked`;
15018
+ return `${classPrefix$a}__icon--unchecked`;
14954
15019
  };
14955
15020
  const renderLabel = () => {
14956
15021
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14957
15022
  "span",
14958
15023
  {
14959
- className: classNames(`${classPrefix$8}__label `, {
14960
- [`${classPrefix$8}__label--disabled`]: innerDisabled
15024
+ className: classNames(`${classPrefix$a}__label `, {
15025
+ [`${classPrefix$a}__label--disabled`]: innerDisabled
14961
15026
  }),
14962
15027
  children: children || label
14963
15028
  }
@@ -14976,8 +15041,8 @@ const Checkbox = (props) => {
14976
15041
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
14977
15042
  "div",
14978
15043
  {
14979
- className: classNames(classPrefix$8, className, {
14980
- [`${classPrefix$8}--reverse`]: labelPosition === "left"
15044
+ className: classNames(classPrefix$a, className, {
15045
+ [`${classPrefix$a}--reverse`]: labelPosition === "left"
14981
15046
  }),
14982
15047
  ...rest,
14983
15048
  onClick: handleClick2,
@@ -17428,7 +17493,7 @@ const defaultProps$S = {
17428
17493
  digits: 0,
17429
17494
  async: false
17430
17495
  };
17431
- const classPrefix$7 = `nut-inputnumber`;
17496
+ const classPrefix$9 = `nut-inputnumber`;
17432
17497
  const InputNumber = (props) => {
17433
17498
  const {
17434
17499
  children,
@@ -17457,7 +17522,7 @@ const InputNumber = (props) => {
17457
17522
  ...props
17458
17523
  };
17459
17524
  const inputRef = useRef("");
17460
- let [_checked, setChecked] = usePropsValue({
17525
+ const [_checked, setChecked] = usePropsValue({
17461
17526
  value,
17462
17527
  defaultValue
17463
17528
  });
@@ -17471,8 +17536,8 @@ const InputNumber = (props) => {
17471
17536
  }, []);
17472
17537
  const classes = classNames(
17473
17538
  {
17474
- [`${classPrefix$7}`]: true,
17475
- [`${classPrefix$7}--disabled`]: disabled
17539
+ [`${classPrefix$9}`]: true,
17540
+ [`${classPrefix$9}--disabled`]: disabled
17476
17541
  },
17477
17542
  className
17478
17543
  );
@@ -17618,7 +17683,7 @@ const InputNumber = (props) => {
17618
17683
  };
17619
17684
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes, style: styles, ...restProps, children: [
17620
17685
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-input-minus", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
17621
- y$4,
17686
+ y$5,
17622
17687
  {
17623
17688
  className: iconMinusClasses,
17624
17689
  onClick: (e) => reduceNumber(e)
@@ -17651,7 +17716,7 @@ const InputNumber = (props) => {
17651
17716
  onFocus: focusValue
17652
17717
  }
17653
17718
  ) }),
17654
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-input-add", children: /* @__PURE__ */ jsxRuntimeExports.jsx(y$3, { className: iconAddClasses, onClick: (e) => addNumber(e) }) })
17719
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-input-add", children: /* @__PURE__ */ jsxRuntimeExports.jsx(y$4, { className: iconAddClasses, onClick: (e) => addNumber(e) }) })
17655
17720
  ] });
17656
17721
  };
17657
17722
  InputNumber.defaultProps = defaultProps$S;
@@ -17765,7 +17830,7 @@ const Menu = (props) => {
17765
17830
  }),
17766
17831
  children: [
17767
17832
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-menu__title-text", children: finallyTitle() }),
17768
- icon || (direction === "up" ? /* @__PURE__ */ jsxRuntimeExports.jsx(x$g, { className: "nut-menu__title-icon" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(y$8, { className: "nut-menu__title-icon" }))
17833
+ icon || (direction === "up" ? /* @__PURE__ */ jsxRuntimeExports.jsx(x$g, { className: "nut-menu__title-icon" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(y$9, { className: "nut-menu__title-icon" }))
17769
17834
  ]
17770
17835
  }
17771
17836
  )
@@ -17988,15 +18053,11 @@ const MenuItem = forwardRef((props, ref) => {
17988
18053
  MenuItem.defaultProps = defaultProps$Q;
17989
18054
  MenuItem.displayName = "NutMenuItem";
17990
18055
  const defaultProps$P = {
17991
- confirmText: "",
17992
- title: "",
18056
+ ...ComponentDefaults,
17993
18057
  visible: false,
17994
- overlay: true,
17995
18058
  type: "default",
17996
- customKey: [],
17997
- className: "",
17998
- randomKeys: false,
17999
- popClass: "",
18059
+ custom: [],
18060
+ random: false,
18000
18061
  onClose: () => {
18001
18062
  }
18002
18063
  };
@@ -18006,307 +18067,229 @@ const NumberKeyboard = (props) => {
18006
18067
  title,
18007
18068
  confirmText,
18008
18069
  visible,
18009
- overlay,
18010
18070
  type: type4,
18011
- customKey,
18012
- randomKeys,
18013
- popClass,
18071
+ custom,
18072
+ random,
18014
18073
  style,
18015
18074
  className,
18016
18075
  onChange,
18017
18076
  onDelete,
18018
- onClose
18077
+ onClose,
18078
+ onConfirm,
18079
+ ...rest
18019
18080
  } = props;
18020
- const b = cn("numberkeyboard");
18021
- const [show, setShow] = useState(visible);
18022
- const [clickKeyIndex, setClickKeyIndex] = useState(void 0);
18023
- const [keysList, setKeysList] = useState([]);
18024
- useEffect(() => {
18025
- setShow(visible);
18026
- }, [visible]);
18027
- const defaultKey = () => {
18028
- let leftBottomKey = {
18029
- id: "lock",
18030
- type: "lock"
18031
- };
18032
- if (customKey) {
18033
- const customKeys = Array.isArray(customKey) ? customKey : [customKey];
18034
- if (customKeys.length > 0) {
18035
- const newCustomKey = customKeys[0];
18036
- leftBottomKey = {
18037
- id: newCustomKey,
18038
- type: "custom"
18039
- };
18040
- }
18041
- }
18042
- return [
18043
- ...getBasicKeys(),
18044
- leftBottomKey,
18045
- { id: 0, type: "number" },
18046
- { id: "delete", type: "delete" }
18047
- ];
18048
- };
18081
+ const classPrefix2 = "nut-numberkeyboard";
18049
18082
  const getBasicKeys = () => {
18050
- const keys = [];
18051
- for (let i = 1; i <= 9; i++) {
18052
- keys.push({ id: i, type: "number" });
18053
- }
18054
- if (randomKeys) {
18055
- return keys.sort(() => Math.random() > 0.5 ? 1 : -1);
18056
- }
18057
- return keys;
18058
- };
18059
- const genCustomKeys = () => {
18060
- const keys = getBasicKeys();
18061
- if (!customKey)
18062
- return [];
18063
- let customKeys = Array.isArray(customKey) ? customKey : [customKey];
18064
- if (customKeys.length > 2) {
18065
- customKeys = [customKeys[0], customKeys[1]];
18066
- }
18067
- if (customKeys.length === 2 && props.title && props.type !== "rightColumn") {
18068
- customKeys = [customKeys[0]];
18069
- }
18070
- if (customKeys.length === 1) {
18071
- if (props.title && props.type !== "rightColumn") {
18072
- keys.push(
18073
- { id: customKeys[0], type: "custom" },
18074
- { id: 0, type: "number" },
18075
- { id: "delete", type: "delete" }
18076
- );
18077
- } else {
18078
- keys.push(
18079
- { id: 0, type: "number" },
18080
- { id: customKeys[0], type: "custom" }
18081
- );
18082
- }
18083
- } else if (customKeys.length === 2) {
18084
- keys.push(
18085
- { id: customKeys[0], type: "custom" },
18086
- { id: 0, type: "number" },
18087
- { id: customKeys[1], type: "custom" }
18088
- );
18089
- }
18090
- return keys;
18083
+ const keys = new Array(9).fill(0).map((_, index) => {
18084
+ return {
18085
+ id: String(index + 1),
18086
+ type: "num"
18087
+ };
18088
+ });
18089
+ return random ? keys.sort(() => Math.random() > 0.5 ? 1 : -1) : keys;
18091
18090
  };
18092
- useEffect(() => {
18093
- if (props.type === "rightColumn" || props.title !== "") {
18094
- setKeysList(genCustomKeys());
18095
- } else {
18096
- setKeysList(defaultKey());
18097
- }
18098
- }, []);
18099
- const onTouchstart = (item, event) => {
18100
- event.stopPropagation();
18101
- setClickKeyIndex(item.id);
18102
- if (item.type === "number" || item.type === "custom") {
18103
- onChange && onChange(item.id);
18104
- }
18105
- if (item.type === "lock") {
18106
- onClose && onClose();
18091
+ const getCustomKeys = () => {
18092
+ const customKeys = [
18093
+ { id: "close", type: "close" },
18094
+ { id: "0", type: "num" },
18095
+ { id: "delete", type: "delete" }
18096
+ ];
18097
+ if (!custom)
18098
+ return customKeys;
18099
+ if (custom.length > 0) {
18100
+ customKeys[0] = { id: custom[0], type: "custom" };
18107
18101
  }
18108
- if (item.type === "delete") {
18109
- onDelete && onDelete();
18102
+ if (custom.length > 1) {
18103
+ customKeys[2] = { id: custom[1], type: "custom" };
18110
18104
  }
18105
+ return customKeys;
18111
18106
  };
18112
- const onTouchMove = (event) => {
18113
- event.stopPropagation();
18107
+ const keysList = useMemo(() => {
18108
+ return [...getBasicKeys(), ...getCustomKeys()];
18109
+ }, [type4, random, custom]);
18110
+ const DeleteIcon = () => {
18111
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { viewBox: "0 0 1024 1024", width: "36", height: "36", children: [
18112
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18113
+ "path",
18114
+ {
18115
+ d: "M875.594 186.122H390.803a51.162 51.162 0 0 0-36.18 14.986L79.91 475.821a51.166 51.166 0 0 0 0 72.358l274.714 274.712a51.164 51.164 0 0 0 36.179 14.986h484.791c46.033 0 83.484-37.45 83.484-83.483V269.606c.001-46.033-37.45-83.484-83.483-83.484zm32.32 568.274c0 17.85-14.473 32.318-32.32 32.318H390.803L116.089 512l274.714-274.714h484.791c17.849 0 32.32 14.47 32.32 32.32v484.789z",
18116
+ fill: "currentColor"
18117
+ }
18118
+ ),
18119
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18120
+ "path",
18121
+ {
18122
+ d: "M753.945 360.214l-121.43 121.429-121.43-121.429s-16.062-8.224-30.356 6.072c-14.295 14.295-6.073 30.357-6.073 30.357l121.43 121.428L486.8 627.357s-8.222 16.062 6.072 30.357c14.297 14.296 30.358 6.072 30.358 6.072l109.286-109.285 109.286 109.285s16.062 8.224 30.357-6.072c14.295-14.295 6.07-30.357 6.07-30.357L668.944 518.072l121.431-121.43s8.22-16.061-6.074-30.356c-14.294-14.296-30.356-6.072-30.356-6.072z",
18123
+ fill: "currentColor"
18124
+ }
18125
+ )
18126
+ ] });
18114
18127
  };
18115
- const onTouchEnd = (event) => {
18116
- event.preventDefault();
18117
- setClickKeyIndex(void 0);
18128
+ const NumberKeyboardKey = (props2) => {
18129
+ const { item } = props2;
18130
+ const [active, setActive] = useState(false);
18131
+ const onTouchStart = () => {
18132
+ setActive(true);
18133
+ };
18134
+ const onTouchEnd = (item2) => {
18135
+ setActive(false);
18136
+ if (item2.type === "num" || item2.type === "custom") {
18137
+ onChange && onChange(item2.id);
18138
+ }
18139
+ if (item2.type === "close") {
18140
+ onClose && onClose();
18141
+ }
18142
+ if (item2.type === "delete") {
18143
+ onDelete && onDelete();
18144
+ }
18145
+ if (item2.type === "confirm") {
18146
+ onConfirm && onConfirm();
18147
+ }
18148
+ };
18149
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__body__wrapper`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
18150
+ "div",
18151
+ {
18152
+ className: classNames({
18153
+ key: true,
18154
+ active,
18155
+ close: item.type === "close",
18156
+ delete: item.type === "delete",
18157
+ confirm: item.type === "confirm"
18158
+ }),
18159
+ onTouchStart: () => onTouchStart(),
18160
+ onTouchEnd: () => onTouchEnd(item),
18161
+ onTouchCancel: () => onTouchEnd(item),
18162
+ children: [
18163
+ (item.type === "num" || item.type === "custom") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: item.id }),
18164
+ item.type === "delete" && /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteIcon, {}),
18165
+ item.type === "close" && /* @__PURE__ */ jsxRuntimeExports.jsx(y$3, { width: 25, height: 25 }),
18166
+ item.type === "confirm" && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: confirmText || locale.done })
18167
+ ]
18168
+ }
18169
+ ) }, item.id);
18118
18170
  };
18119
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18171
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18120
18172
  Popup,
18121
18173
  {
18122
- visible: show,
18174
+ visible,
18123
18175
  position: "bottom",
18124
- className: popClass,
18125
18176
  onClickOverlay: onClose,
18126
- overlay,
18127
18177
  onClickCloseIcon: onClose,
18128
18178
  overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
18129
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${b()} ${className}`, style: { ...style }, children: [
18130
- title ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: b("header"), children: [
18131
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: b("header__tit"), children: title }),
18132
- type4 === "default" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: b("header__close"), onClick: onClose, children: locale.done }) : null
18133
- ] }) : null,
18134
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: b("body"), children: [
18135
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("body__keys"), children: keysList == null ? void 0 : keysList.map((item, index) => {
18136
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
18137
- "div",
18179
+ ...rest,
18180
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classNames(classPrefix2, className), style, children: [
18181
+ title && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__header`, children: [
18182
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `${classPrefix2}__header__title`, children: title }),
18183
+ type4 === "default" && /* @__PURE__ */ jsxRuntimeExports.jsx(
18184
+ "span",
18185
+ {
18186
+ className: `${classPrefix2}__header__close`,
18187
+ onClick: onClose,
18188
+ children: locale.done
18189
+ }
18190
+ )
18191
+ ] }),
18192
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__body`, children: [
18193
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__body__keys`, children: keysList == null ? void 0 : keysList.map((item) => {
18194
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NumberKeyboardKey, { item }, item.id);
18195
+ }) }),
18196
+ type4 === "rightColumn" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__sidebar`, children: [
18197
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18198
+ NumberKeyboardKey,
18138
18199
  {
18139
- className: classNames({
18140
- "key-board-wrapper": true,
18141
- "key-board-wrapper-large": item.id === 0 && type4 === "rightColumn" && Array.isArray(customKey) && customKey.length === 1
18142
- }),
18143
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
18144
- "div",
18145
- {
18146
- className: classNames({
18147
- key: true,
18148
- active: item.id === clickKeyIndex,
18149
- lock: item.type === "lock",
18150
- delete: item.type === "delete"
18151
- }),
18152
- onTouchStart: (event) => onTouchstart(item, event),
18153
- onTouchMove,
18154
- onTouchEnd,
18155
- children: [
18156
- item.type === "number" || item.type === "custom" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: item.id }) : null,
18157
- item.type === "lock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18158
- "img",
18159
- {
18160
- src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png",
18161
- alt: ""
18162
- }
18163
- ) : null,
18164
- item.type === "delete" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18165
- "img",
18166
- {
18167
- src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
18168
- alt: ""
18169
- }
18170
- ) : null
18171
- ]
18172
- }
18173
- )
18200
+ item: {
18201
+ id: "delete",
18202
+ type: "delete"
18203
+ }
18174
18204
  },
18175
- index
18176
- );
18177
- }) }),
18178
- type4 === "rightColumn" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: b("sidebar"), children: [
18179
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "key-board-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18180
- "div",
18181
- {
18182
- className: classNames({
18183
- key: true,
18184
- active: clickKeyIndex === "delete"
18185
- }),
18186
- onTouchStart: (event) => onTouchstart({ id: "delete", type: "delete" }, event),
18187
- onTouchMove,
18188
- onTouchEnd,
18189
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18190
- "img",
18191
- {
18192
- src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
18193
- alt: ""
18194
- }
18195
- )
18196
- }
18197
- ) }),
18205
+ "delete"
18206
+ ),
18198
18207
  /* @__PURE__ */ jsxRuntimeExports.jsx(
18199
- "div",
18208
+ NumberKeyboardKey,
18200
18209
  {
18201
- className: "key-board-wrapper key-board-finish",
18202
- onClick: onClose,
18203
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18204
- "div",
18205
- {
18206
- className: classNames({
18207
- key: true,
18208
- finish: true,
18209
- activeFinsh: clickKeyIndex === "finish"
18210
- }),
18211
- children: confirmText || locale.done
18212
- }
18213
- )
18214
- }
18210
+ item: {
18211
+ id: "confirm",
18212
+ type: "confirm"
18213
+ }
18214
+ },
18215
+ "confirm"
18215
18216
  )
18216
- ] }) : null
18217
+ ] })
18217
18218
  ] })
18218
18219
  ] })
18219
18220
  }
18220
- ) });
18221
+ );
18221
18222
  };
18222
18223
  NumberKeyboard.defaultProps = defaultProps$P;
18223
18224
  NumberKeyboard.displayName = "NutNumberKeyboard";
18224
- const radioContext = {
18225
- onChange: (val) => {
18226
- }
18227
- };
18228
- const RadioContext = React__default.createContext(radioContext);
18225
+ const RadioContext = React__default.createContext(null);
18229
18226
  const defaultProps$O = {
18230
- value: null,
18231
- textPosition: "right",
18227
+ labelPosition: "right",
18232
18228
  onChange: (value) => {
18233
18229
  },
18234
18230
  direction: "vertical",
18235
18231
  options: []
18236
18232
  };
18233
+ const classPrefix$8 = "nut-radiogroup";
18237
18234
  const RadioGroup = React__default.forwardRef(
18238
18235
  (props, ref) => {
18239
- const { children } = { ...defaultProps$O, ...props };
18240
- cn("RadioGroup");
18241
18236
  const {
18237
+ children,
18242
18238
  className,
18243
18239
  value,
18240
+ defaultValue,
18244
18241
  onChange,
18245
- textPosition,
18242
+ labelPosition,
18246
18243
  direction,
18247
18244
  options: options2,
18245
+ disabled,
18248
18246
  ...rest
18249
- } = props;
18250
- const [val2State, setVal2State] = useState(value);
18251
- useEffect(() => {
18252
- setVal2State(value);
18253
- }, [value]);
18254
- function validateChildChecked(child) {
18255
- if (val2State === null)
18256
- return false;
18257
- return val2State === child.props.value;
18258
- }
18259
- function validateChecked(value2) {
18260
- if (val2State === null)
18261
- return false;
18262
- return val2State === value2;
18263
- }
18264
- function cloneChildren() {
18265
- return React__default.Children.map(children, (child, index) => {
18266
- const childChecked = validateChildChecked(child);
18267
- if (child.type.displayName !== "NutRadio") {
18268
- return React__default.cloneElement(child);
18269
- }
18270
- return React__default.cloneElement(child, {
18271
- textPosition,
18272
- checked: childChecked
18273
- // onChange: handleChildChange,
18274
- });
18275
- });
18276
- }
18247
+ } = { ...defaultProps$O, ...props };
18248
+ const [val2State, setVal2State] = usePropsValue({
18249
+ defaultValue: props.defaultValue,
18250
+ value: props.value,
18251
+ finalValue: "",
18252
+ onChange
18253
+ });
18277
18254
  const renderOptionsChildren = useCallback(() => {
18278
- return options2 == null ? void 0 : options2.map(({ label, value: value2, disabled, onChange: onChange2, ...rest2 }) => {
18279
- const childChecked = validateChecked(value2);
18280
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
18255
+ return options2 == null ? void 0 : options2.map(({ label, value: value2, disabled: disabled2, onChange: onChange2, ...rest2 }) => {
18256
+ return /* @__PURE__ */ createElement(
18281
18257
  Radio,
18282
18258
  {
18259
+ ...rest2,
18260
+ key: value2 == null ? void 0 : value2.toString(),
18283
18261
  children: label,
18284
18262
  value: value2,
18285
- disabled,
18263
+ disabled: disabled2,
18286
18264
  onChange: onChange2,
18287
- ...rest2,
18288
- textPosition,
18289
- checked: childChecked
18290
- },
18291
- value2 == null ? void 0 : value2.toString()
18265
+ labelPosition,
18266
+ checked: value2 === val2State
18267
+ }
18292
18268
  );
18293
18269
  });
18294
- }, [val2State, options2]);
18270
+ }, [options2]);
18295
18271
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
18296
18272
  RadioContext.Provider,
18297
18273
  {
18298
18274
  value: {
18299
- onChange: (val) => {
18300
- setVal2State(val);
18301
- onChange && onChange(val);
18275
+ labelPosition: labelPosition || "right",
18276
+ disabled,
18277
+ value: val2State,
18278
+ check: (value2) => {
18279
+ setVal2State(value2);
18280
+ },
18281
+ uncheck: () => {
18282
+ setVal2State("");
18302
18283
  }
18303
18284
  },
18304
18285
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18305
18286
  "div",
18306
18287
  {
18307
- className: `nut-radiogroup nut-radiogroup--${props.direction} ${className || ""}`,
18288
+ className: classNames(classPrefix$8, className, {
18289
+ [`${classPrefix$8}--${props.direction}`]: props.direction
18290
+ }),
18308
18291
  ...rest,
18309
- children: (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : cloneChildren()
18292
+ children: (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : children
18310
18293
  }
18311
18294
  )
18312
18295
  }
@@ -18317,517 +18300,233 @@ RadioGroup.defaultProps = defaultProps$O;
18317
18300
  RadioGroup.displayName = "NutRadioGroup";
18318
18301
  const defaultProps$N = {
18319
18302
  ...ComponentDefaults,
18320
- className: "",
18321
- style: {},
18322
18303
  disabled: false,
18323
- checked: false,
18324
18304
  shape: "round",
18325
18305
  value: "",
18326
- textPosition: "right",
18327
- icon: "check-normal",
18328
- checkedIcon: "check-checked",
18329
- iconSize: 18,
18330
- onChange: (e) => {
18331
- }
18332
- };
18333
- const Radio = (props) => {
18334
- const { children } = {
18335
- ...defaultProps$N,
18336
- ...props
18337
- };
18338
- const {
18339
- className,
18340
- disabled,
18341
- checked,
18342
- shape,
18343
- textPosition,
18344
- value,
18345
- icon,
18346
- checkedIcon,
18347
- iconSize,
18348
- onChange,
18349
- ...rest
18350
- } = props;
18351
- const componentName = "nut-radio";
18352
- const [checkedStatement, setCheckedStatement] = useState(checked);
18353
- const [valueStatement, setValueStatement] = useState(value);
18354
- const [disabledStatement, setDisabledStatement] = useState(disabled);
18355
- const context = useContext(RadioContext);
18356
- useEffect(() => {
18357
- setDisabledStatement(disabled);
18358
- setValueStatement(value);
18359
- setCheckedStatement(checked);
18360
- }, [disabled, value, checked]);
18361
- const renderLabel = () => {
18362
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
18363
- "div",
18364
- {
18365
- className: `${componentName}__label ${disabledStatement ? `${componentName}__label--disabled` : ""}`,
18366
- children
18367
- }
18368
- );
18369
- };
18370
- const renderButton = () => {
18371
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
18372
- "div",
18373
- {
18374
- className: `${componentName}__button ${!disabledStatement && checkedStatement && `${componentName}__button--active`} ${disabledStatement ? `${componentName}__button--disabled` : ""}`,
18375
- children
18376
- }
18377
- );
18378
- };
18379
- const color = () => {
18380
- if (disabledStatement) {
18381
- return "nut-radio__icon--disable";
18382
- }
18383
- if (checkedStatement) {
18384
- return "nut-radio__icon";
18385
- }
18386
- return "nut-radio__icon--unchecked";
18387
- };
18388
- const renderIcon = () => {
18389
- const { icon: icon2, iconSize: iconSize2, checkedIcon: checkedIcon2 } = props;
18390
- if (!disabledStatement && checkedStatement) {
18391
- return React__default.isValidElement(checkedIcon2) ? React__default.cloneElement(checkedIcon2, {
18392
- ...checkedIcon2.props,
18393
- className: color()
18394
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(y$7, { width: iconSize2, height: iconSize2, className: color() });
18395
- }
18396
- return React__default.isValidElement(icon2) ? React__default.cloneElement(icon2, {
18397
- ...icon2.props,
18398
- size: iconSize2,
18399
- className: color()
18400
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(N, { width: iconSize2, height: iconSize2, className: color() });
18401
- };
18402
- const reverseState = textPosition === "left";
18403
- const renderRadioItem = () => {
18404
- if (shape === "button") {
18405
- return renderButton();
18406
- }
18407
- if (reverseState) {
18408
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18409
- renderLabel(),
18410
- renderIcon()
18411
- ] });
18412
- }
18413
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18414
- renderIcon(),
18415
- renderLabel()
18416
- ] });
18417
- };
18418
- const handleClick2 = (e) => {
18419
- if (disabledStatement || checkedStatement)
18420
- return;
18421
- setCheckedStatement(!checkedStatement);
18422
- onChange && onChange(e);
18423
- context && context.onChange(valueStatement);
18424
- };
18425
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
18426
- "div",
18427
- {
18428
- className: `nut-radio ${className} ${reverseState ? `${componentName}--reverse` : ""}`,
18429
- onClick: handleClick2,
18430
- ...rest,
18431
- children: renderRadioItem()
18432
- }
18433
- );
18434
- };
18435
- Radio.defaultProps = defaultProps$N;
18436
- Radio.displayName = "NutRadio";
18437
- Radio.RadioGroup = RadioGroup;
18438
- const fullClone = {
18439
- ...ReactDOM
18440
- };
18441
- const { version, render: reactRender, unmountComponentAtNode } = fullClone;
18442
- let createRoot;
18443
- try {
18444
- const mainVersion = Number((version || "").split(".")[0]);
18445
- if (mainVersion >= 18 && fullClone.createRoot) {
18446
- createRoot = fullClone.createRoot;
18447
- }
18448
- } catch (e) {
18449
- }
18450
- function toggleWarning(skip) {
18451
- const { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } = fullClone;
18452
- if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && typeof __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === "object") {
18453
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
18454
- }
18455
- }
18456
- const MARK = "__nutui_react_root__";
18457
- function legacyRender(node, container) {
18458
- reactRender(node, container);
18459
- }
18460
- function concurrentRender(node, container) {
18461
- toggleWarning(true);
18462
- const root2 = container[MARK] || createRoot(container);
18463
- toggleWarning(false);
18464
- root2.render(node);
18465
- container[MARK] = root2;
18466
- }
18467
- function render(node, container) {
18468
- if (createRoot) {
18469
- concurrentRender(node, container);
18470
- return;
18471
- }
18472
- legacyRender(node, container);
18473
- }
18474
- function legacyUnmount(container) {
18475
- return unmountComponentAtNode(container);
18476
- }
18477
- async function concurrentUnmount(container) {
18478
- return Promise.resolve().then(() => {
18479
- var _a2;
18480
- (_a2 = container[MARK]) == null ? void 0 : _a2.unmount();
18481
- delete container[MARK];
18482
- });
18483
- }
18484
- function unmount(container) {
18485
- if (createRoot) {
18486
- return concurrentUnmount(container);
18487
- }
18488
- return legacyUnmount(container);
18489
- }
18490
- let Notification$1 = (_a = class extends React.PureComponent {
18491
- constructor(props) {
18492
- super(props);
18493
- __publicField(this, "closeTimer");
18494
- this.close = this.close.bind(this);
18495
- this.startCloseTimer = this.startCloseTimer.bind(this);
18496
- this.clearCloseTimer = this.clearCloseTimer.bind(this);
18497
- this.close = this.close.bind(this);
18498
- this.clickCover = this.clickCover.bind(this);
18499
- }
18500
- close() {
18501
- this.clearCloseTimer();
18502
- this.props.onClose();
18503
- }
18504
- startCloseTimer() {
18505
- const { duration } = this.props;
18506
- if (duration) {
18507
- this.closeTimer = window.setTimeout(() => {
18508
- this.close();
18509
- }, duration * 1e3);
18510
- }
18511
- }
18512
- clearCloseTimer() {
18513
- if (this.closeTimer) {
18514
- clearTimeout(this.closeTimer);
18515
- this.closeTimer = -1;
18516
- }
18517
- }
18518
- clickCover() {
18519
- const { closeOnClickOverlay } = this.props;
18520
- if (closeOnClickOverlay) {
18521
- this.close();
18522
- }
18523
- }
18524
- componentDidMount() {
18525
- this.startCloseTimer();
18526
- }
18527
- componentWillUnmount() {
18528
- this.clearCloseTimer();
18529
- }
18530
- render() {
18531
- const {
18532
- id,
18533
- style,
18534
- icon,
18535
- title,
18536
- msg,
18537
- bottom,
18538
- center,
18539
- bgColor,
18540
- coverColor,
18541
- textAlignCenter,
18542
- size,
18543
- customClass,
18544
- cover,
18545
- type: type4
18546
- } = this.props;
18547
- const toastBem = cn("toast");
18548
- const classes = classNames({
18549
- "nut-toast-center": center,
18550
- "nut-toast-has-icon": icon,
18551
- "nut-toast-cover": cover,
18552
- "nut-toast-loading": type4 === "loading",
18553
- [`${customClass}`]: true,
18554
- [`nut-toast-${size}`]: true
18555
- });
18556
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18557
- "div",
18558
- {
18559
- className: `${toastBem()} ${classes}`,
18560
- id: `toast-${id}`,
18561
- style: {
18562
- bottom: center ? "auto" : `${bottom}`,
18563
- backgroundColor: cover ? coverColor : "",
18564
- ...style
18565
- },
18566
- onClick: () => {
18567
- this.clickCover();
18568
- },
18569
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
18570
- "div",
18571
- {
18572
- className: toastBem("inner"),
18573
- style: {
18574
- textAlign: textAlignCenter ? "center" : "left",
18575
- backgroundColor: bgColor
18576
- },
18577
- children: [
18578
- icon ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: toastBem("icon-wrapper"), children: icon }) : null,
18579
- title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-toast-title", children: title }) : null,
18580
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: toastBem("text"), children: msg })
18581
- ]
18582
- }
18583
- )
18584
- }
18585
- ) });
18586
- }
18587
- }, __publicField(_a, "newInstance"), _a);
18588
- Notification$1.newInstance = (properties, callback) => {
18589
- const element = document.createElement("div");
18590
- if (properties.id) {
18591
- element.setAttribute("id", `${properties.id}`);
18592
- }
18593
- document.body.appendChild(element);
18594
- let called = false;
18595
- function ref(instance) {
18596
- if (called) {
18597
- return;
18598
- }
18599
- called = true;
18600
- callback({
18601
- component: instance,
18602
- destroy() {
18603
- unmount(element);
18604
- element && element.parentNode && element.parentNode.removeChild(element);
18605
- }
18606
- });
18607
- }
18608
- render(/* @__PURE__ */ jsxRuntimeExports.jsx(Notification$1, { ...properties, ref }), element);
18609
- };
18610
- let messageInstance$1 = null;
18611
- const options$1 = {
18612
- msg: "",
18613
- id: "",
18614
- style: {},
18615
- duration: 1.5,
18616
- // 时长,duration为0则一直展示
18617
- center: true,
18618
- // toast是否居中展示
18619
- type: "text",
18620
- title: "",
18621
- customClass: "",
18622
- // 自定义样式名
18623
- bottom: "30px",
18624
- // center为false时生效,距离底部位置
18625
- size: "base",
18626
- // 设置字体大小,默认base,可选large\small\base
18306
+ labelPosition: "right",
18627
18307
  icon: null,
18628
- iconSize: "20",
18629
- textAlignCenter: true,
18630
- // 文字是否居中显示,true为居中,false为left
18631
- loadingRotate: true,
18632
- // 未实现
18633
- bgColor: "rgba(0, 0, 0, .8)",
18634
- onClose: () => {
18635
- },
18636
- cover: false,
18637
- // 是否展示透明遮罩层
18638
- coverColor: "rgba(0, 0, 0, 0)",
18639
- // 遮罩颜色设定
18640
- closeOnClickOverlay: false
18641
- // 是否点击遮罩可关闭
18642
- };
18643
- function getInstance$1(props, callback) {
18644
- if (messageInstance$1) {
18645
- messageInstance$1.destroy();
18646
- messageInstance$1 = null;
18647
- }
18648
- Notification$1.newInstance(props, (notification) => {
18649
- return callback && callback(notification);
18650
- });
18651
- }
18652
- function notice$1(opts) {
18653
- function close() {
18654
- if (messageInstance$1) {
18655
- messageInstance$1.destroy();
18656
- messageInstance$1 = null;
18657
- }
18658
- }
18659
- const opts2 = { ...options$1, ...opts, onClose: close };
18660
- getInstance$1(opts2, (notification) => {
18661
- messageInstance$1 = notification;
18662
- });
18663
- }
18664
- const errorMsg$1 = (msg) => {
18665
- if (!msg) {
18666
- console.warn("[NutUI Toast]: msg cannot be null");
18308
+ activeIcon: null,
18309
+ onChange: (checked) => {
18667
18310
  }
18668
18311
  };
18669
- const Toast = {
18670
- text(msg, option = {}) {
18671
- errorMsg$1(msg);
18672
- return notice$1({ msg, type: "text", ...option });
18673
- },
18674
- success(msg, option = {}) {
18675
- errorMsg$1(msg);
18676
- return notice$1({ msg, icon: "success", type: "success", ...option });
18677
- },
18678
- fail(msg, option = {}) {
18679
- errorMsg$1(msg);
18680
- return notice$1({ msg, icon: "failure", type: "fail", ...option });
18681
- },
18682
- loading(msg, option = {}) {
18683
- errorMsg$1(msg);
18684
- return notice$1({ msg, icon: /* @__PURE__ */ jsxRuntimeExports.jsx(k$3, {}), type: "loading", ...option });
18685
- },
18686
- warn(msg, option = {}) {
18687
- errorMsg$1(msg);
18688
- return notice$1({ msg, icon: "tips", type: "warn", ...option });
18689
- },
18690
- customIcon(msg, option = {}) {
18691
- errorMsg$1(msg);
18692
- return notice$1({ msg, ...option });
18693
- },
18694
- hide() {
18695
- if (messageInstance$1) {
18696
- messageInstance$1.destroy();
18697
- messageInstance$1 = null;
18312
+ const Radio = (props) => {
18313
+ const classPrefix2 = "nut-radio";
18314
+ const {
18315
+ children,
18316
+ className,
18317
+ style,
18318
+ checked,
18319
+ defaultChecked,
18320
+ shape,
18321
+ value,
18322
+ icon,
18323
+ activeIcon,
18324
+ onChange,
18325
+ ...others
18326
+ } = {
18327
+ ...defaultProps$N,
18328
+ ...props
18329
+ };
18330
+ let { labelPosition, disabled, ...rest } = others;
18331
+ let [checkedStatement, setCheckedStatement] = usePropsValue({
18332
+ value: checked,
18333
+ defaultValue: defaultChecked,
18334
+ finalValue: false,
18335
+ onChange
18336
+ });
18337
+ const context = useContext(RadioContext);
18338
+ if (context) {
18339
+ checkedStatement = context.value === value;
18340
+ if (context.labelPosition !== void 0) {
18341
+ labelPosition = context.labelPosition;
18698
18342
  }
18343
+ if (context.disabled !== void 0) {
18344
+ disabled = context.disabled;
18345
+ }
18346
+ setCheckedStatement = (value2) => {
18347
+ if (value2) {
18348
+ context.check(props.value === void 0 ? "" : props.value);
18349
+ } else {
18350
+ context.uncheck();
18351
+ }
18352
+ };
18699
18353
  }
18354
+ const renderLabel = () => {
18355
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18356
+ "div",
18357
+ {
18358
+ className: classNames(`${classPrefix2}__label`, {
18359
+ [`${classPrefix2}__label--disabled`]: disabled
18360
+ }),
18361
+ children
18362
+ }
18363
+ );
18364
+ };
18365
+ const renderButton = () => {
18366
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18367
+ "div",
18368
+ {
18369
+ className: classNames(`${classPrefix2}__button`, {
18370
+ [`${classPrefix2}__button--active`]: checkedStatement,
18371
+ [`${classPrefix2}__button--disabled`]: disabled
18372
+ }),
18373
+ children
18374
+ }
18375
+ );
18376
+ };
18377
+ const color = () => {
18378
+ return {
18379
+ [`${classPrefix2}__icon--disable`]: disabled,
18380
+ [`${classPrefix2}__icon`]: checkedStatement,
18381
+ [`${classPrefix2}__icon--unchecked`]: !checkedStatement
18382
+ };
18383
+ };
18384
+ const renderIcon = () => {
18385
+ const { icon: icon2, activeIcon: activeIcon2 } = props;
18386
+ if (checkedStatement) {
18387
+ return React__default.isValidElement(activeIcon2) ? React__default.cloneElement(activeIcon2, {
18388
+ ...activeIcon2.props,
18389
+ className: classNames(color())
18390
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(y$8, { className: classNames(color()) });
18391
+ }
18392
+ return React__default.isValidElement(icon2) ? React__default.cloneElement(icon2, {
18393
+ ...icon2.props,
18394
+ className: classNames(color())
18395
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(N, { className: classNames(color()) });
18396
+ };
18397
+ const reverse = labelPosition === "left";
18398
+ const renderRadioItem = () => {
18399
+ if (shape === "button") {
18400
+ return renderButton();
18401
+ }
18402
+ if (reverse) {
18403
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18404
+ renderLabel(),
18405
+ renderIcon()
18406
+ ] });
18407
+ }
18408
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18409
+ renderIcon(),
18410
+ renderLabel()
18411
+ ] });
18412
+ };
18413
+ const handleClick2 = (e) => {
18414
+ if (disabled || checkedStatement)
18415
+ return;
18416
+ setCheckedStatement(!checkedStatement);
18417
+ };
18418
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18419
+ "div",
18420
+ {
18421
+ className: `${classPrefix2} ${className} ${reverse ? `${classPrefix2}--reverse` : ""}`,
18422
+ style,
18423
+ onClick: handleClick2,
18424
+ ...rest,
18425
+ children: renderRadioItem()
18426
+ }
18427
+ );
18700
18428
  };
18429
+ Radio.defaultProps = defaultProps$N;
18430
+ Radio.displayName = "NutRadio";
18431
+ Radio.Group = RadioGroup;
18701
18432
  const defaultProps$M = {
18433
+ ...ComponentDefaults,
18702
18434
  range: false,
18703
- hiddenRange: false,
18704
- hiddenTag: false,
18705
18435
  min: 0,
18706
18436
  max: 100,
18707
18437
  step: 1,
18708
- modelValue: 0,
18709
18438
  vertical: false,
18710
18439
  marks: {}
18711
18440
  };
18712
- let startValue;
18713
- let currentValue;
18714
18441
  const Range = (props) => {
18715
- const { locale } = useConfig();
18716
18442
  const {
18717
18443
  className,
18718
18444
  range: range3,
18719
18445
  disabled,
18720
- activeColor,
18721
- inactiveColor,
18722
- buttonColor,
18723
- hiddenRange,
18724
- hiddenTag,
18725
- modelValue,
18726
18446
  button,
18727
18447
  vertical,
18728
18448
  marks,
18729
- dragStart,
18730
- dragEnd,
18731
18449
  onChange,
18732
- onDragStart,
18733
- onDragEnd,
18734
- minDesc,
18735
- maxDesc,
18736
- curValueDesc
18450
+ onStart,
18451
+ onEnd,
18452
+ minDescription,
18453
+ maxDescription,
18454
+ currentDescription,
18455
+ min,
18456
+ max,
18457
+ step,
18458
+ value,
18459
+ defaultValue
18737
18460
  } = { ...defaultProps$M, ...props };
18738
- let { min, max, step } = { ...defaultProps$M, ...props };
18739
- min = Number(min);
18740
- max = Number(max);
18741
- step = Number(step);
18742
- const [buttonIndex, SetButtonIndex] = useState(0);
18743
- const [initValue, SetInitValue] = useState();
18744
- const [dragStatus, SetDragStatus] = useState("start");
18461
+ const classPrefix2 = "nut-range";
18462
+ const [buttonIndex, setButtonIndex] = useState(0);
18463
+ const [dragStatus, setDragStatus] = useState("start");
18745
18464
  const touch = useTouch();
18746
18465
  const root2 = useRef(null);
18747
- const [marksList, SetMarksList] = useState([]);
18748
- useEffect(() => {
18749
- if (typeof modelValue === "number") {
18750
- if (!range3 && (modelValue < min || modelValue > max)) {
18751
- SetInitValue(0);
18752
- Toast.text(`${modelValue} ${locale.range.rangeText}`);
18753
- return;
18754
- }
18755
- SetInitValue(modelValue);
18756
- }
18757
- }, [modelValue]);
18466
+ const [marksList, setMarksList] = useState([]);
18467
+ const [startValue, setStartValue] = useState(0);
18468
+ const handleChange = (value2) => {
18469
+ onChange && onChange(value2);
18470
+ };
18471
+ const [current, setCurrent] = usePropsValue({
18472
+ value,
18473
+ defaultValue,
18474
+ finalValue: 0,
18475
+ onChange: handleChange
18476
+ });
18477
+ const [exactValue, setEaxctValue] = useState(
18478
+ () => value || defaultValue || 0
18479
+ );
18758
18480
  useEffect(() => {
18759
18481
  if (marks) {
18760
18482
  const marksKeys = Object.keys(marks);
18761
18483
  const list = marksKeys.map(parseFloat).sort((a2, b) => a2 - b).filter((point) => point >= min && point <= max);
18762
- SetMarksList(list);
18484
+ setMarksList(list);
18763
18485
  }
18764
18486
  }, [marks]);
18765
18487
  const scope = () => {
18766
- return Number(max) - Number(min);
18488
+ return max - min;
18767
18489
  };
18768
- const classes = useCallback(() => {
18769
- const prefixCls2 = "nut-range";
18770
- return [
18771
- prefixCls2,
18772
- `${disabled ? `${prefixCls2}-disabled` : ""}`,
18773
- `${vertical ? `${prefixCls2}-vertical` : ""}`,
18774
- `${!hiddenRange ? `${prefixCls2}-show-number` : ""}`
18775
- ].filter(Boolean).join(" ");
18776
- }, [disabled, vertical, hiddenRange]);
18777
- const containerClasses = useCallback(() => {
18778
- const prefixCls2 = "nut-range-container";
18779
- return [prefixCls2, `${vertical ? `${prefixCls2}-vertical` : ""}`, className].filter(Boolean).join(" ");
18780
- }, [vertical, className]);
18490
+ const classes = classNames(classPrefix2, {
18491
+ [`${classPrefix2}-disabled`]: disabled,
18492
+ [`${classPrefix2}-vertical`]: vertical
18493
+ });
18494
+ const containerClasses = classNames(`${classPrefix2}-container`, className, {
18495
+ [`${classPrefix2}-container-vertical`]: vertical
18496
+ });
18781
18497
  const markClassName = useCallback(
18782
18498
  (mark) => {
18783
- const classPrefix2 = "nut-range-mark";
18784
- let lowerBound = Number(min);
18785
- let upperBound = Number(max);
18786
- if (range3) {
18787
- const [left, right] = modelValue;
18788
- lowerBound = left;
18789
- upperBound = right;
18499
+ const classPrefix22 = "nut-range-mark";
18500
+ let lowerBound = min;
18501
+ let upperBound = max;
18502
+ if (range3 && Array.isArray(current)) {
18503
+ lowerBound = current[0];
18504
+ upperBound = current[1];
18790
18505
  } else {
18791
- upperBound = modelValue;
18506
+ upperBound = current;
18792
18507
  }
18793
18508
  const isActive = mark <= upperBound && mark >= lowerBound;
18794
18509
  return [
18795
- `${classPrefix2}-text`,
18796
- `${isActive ? `${classPrefix2}-text-active` : ""}`
18797
- ].filter(Boolean).join(" ");
18510
+ `${classPrefix22}-text`,
18511
+ `${isActive ? `${classPrefix22}-text-active` : ""}`
18512
+ ].join(" ");
18798
18513
  },
18799
- [range3, modelValue, min, max]
18514
+ [range3, current, min, max]
18800
18515
  );
18801
- const [rangeName, setRangeName] = useState(classes());
18802
- const [containerName, setContainerName] = useState(containerClasses());
18803
- useEffect(() => {
18804
- setRangeName(classes());
18805
- setContainerName(containerClasses());
18806
- }, [classes, containerClasses]);
18807
- const wrapperStyle = () => {
18808
- return {
18809
- background: inactiveColor
18810
- };
18811
- };
18812
- const buttonStyle = () => {
18813
- return {
18814
- borderColor: buttonColor
18815
- };
18816
- };
18817
18516
  const isRange = (val) => {
18818
18517
  return !!range3 && Array.isArray(val);
18819
18518
  };
18820
18519
  const calcMainAxis = () => {
18821
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
18520
+ const modelVal = current;
18822
18521
  if (isRange(modelVal)) {
18823
18522
  return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
18824
18523
  }
18825
- return `${(modelVal - Number(min)) * 100 / scope()}%`;
18524
+ return `${(modelVal - min) * 100 / scope()}%`;
18826
18525
  };
18827
18526
  const calcOffset = () => {
18828
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
18527
+ const modelVal = current;
18829
18528
  if (isRange(modelVal)) {
18830
- return `${(modelVal[0] - Number(min)) * 100 / scope()}%`;
18529
+ return `${(modelVal[0] - min) * 100 / scope()}%`;
18831
18530
  }
18832
18531
  return `0%`;
18833
18532
  };
@@ -18836,74 +18535,61 @@ const Range = (props) => {
18836
18535
  return {
18837
18536
  height: calcMainAxis(),
18838
18537
  top: calcOffset(),
18839
- background: activeColor,
18840
18538
  transition: dragStatus ? "none" : void 0
18841
18539
  };
18842
18540
  }
18843
18541
  return {
18844
18542
  width: calcMainAxis(),
18845
18543
  left: calcOffset(),
18846
- background: activeColor,
18847
18544
  transition: dragStatus ? "none" : void 0
18848
18545
  };
18849
18546
  };
18850
18547
  const marksStyle = (mark) => {
18851
18548
  let style = {
18852
- left: `${(mark - Number(min)) / scope() * 100}%`
18549
+ left: `${(mark - min) / scope() * 100}%`
18853
18550
  };
18854
18551
  if (vertical) {
18855
18552
  style = {
18856
- top: `${(mark - Number(min)) / scope() * 100}%`
18553
+ top: `${(mark - min) / scope() * 100}%`
18857
18554
  };
18858
18555
  }
18859
18556
  return style;
18860
18557
  };
18861
- const tickStyle = (mark) => {
18862
- let lowerBound = Number(min);
18863
- let upperBound = Number(max);
18864
- if (range3) {
18865
- const [left, right] = modelValue;
18866
- lowerBound = left;
18867
- upperBound = right;
18558
+ const tickClass = (mark) => {
18559
+ if (range3 && Array.isArray(current)) {
18560
+ return mark <= current[1] && mark >= current[0];
18868
18561
  }
18869
- const isActive = mark <= upperBound && mark >= lowerBound;
18870
- const style = {
18871
- background: !isActive ? inactiveColor : activeColor
18872
- };
18873
- return style;
18562
+ return mark <= current;
18874
18563
  };
18875
- const format2 = (value) => {
18876
- value = Math.max(+min, Math.min(value, +max));
18877
- return Math.round(value / +step) * +step;
18564
+ const format2 = (value2) => {
18565
+ value2 = Math.max(+min, Math.min(value2, +max));
18566
+ return Math.round(value2 / +step) * +step;
18878
18567
  };
18879
18568
  const isSameValue = (newValue, oldValue) => {
18880
18569
  return JSON.stringify(newValue) === JSON.stringify(oldValue);
18881
18570
  };
18882
- const handleOverlap = (value) => {
18883
- if (value[0] > value[1]) {
18884
- return value.slice(0).reverse();
18571
+ const handleOverlap = (value2) => {
18572
+ if (value2[0] > value2[1]) {
18573
+ return value2.slice(0).reverse();
18885
18574
  }
18886
- return value;
18575
+ return value2;
18887
18576
  };
18888
- const updateValue = (value, end) => {
18889
- if (isRange(value)) {
18890
- value = handleOverlap(value).map(format2);
18577
+ const updateValue = (value2, end) => {
18578
+ if (isRange(value2)) {
18579
+ value2 = handleOverlap(value2).map(format2);
18891
18580
  } else {
18892
- value = format2(value);
18581
+ value2 = format2(value2);
18893
18582
  }
18894
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
18895
- if (!isSameValue(value, modelVal)) {
18896
- SetInitValue(value);
18897
- }
18898
- if ((marks || end) && !isSameValue(value, startValue)) {
18899
- onChange && onChange(value);
18583
+ if (!isSameValue(value2, current)) {
18584
+ setCurrent(value2);
18900
18585
  }
18586
+ end && onEnd && onEnd(value2);
18901
18587
  };
18902
18588
  const click = (event) => {
18903
18589
  if (disabled || !root2.current) {
18904
18590
  return;
18905
18591
  }
18906
- SetDragStatus("");
18592
+ setDragStatus("");
18907
18593
  const rect = getRect(root2.current);
18908
18594
  let delta = event.clientX - rect.left;
18909
18595
  let total = rect.width;
@@ -18911,18 +18597,18 @@ const Range = (props) => {
18911
18597
  delta = event.clientY - rect.top;
18912
18598
  total = rect.height;
18913
18599
  }
18914
- const value = Number(min) + delta / total * scope();
18915
- currentValue = initValue || initValue === 0 ? initValue : modelValue;
18916
- if (isRange(currentValue)) {
18917
- const [left, right] = currentValue;
18600
+ const value2 = min + delta / total * scope();
18601
+ setEaxctValue(current);
18602
+ if (isRange(current)) {
18603
+ const [left, right] = current;
18918
18604
  const middle = (left + right) / 2;
18919
- if (value <= middle) {
18920
- updateValue([value, right], true);
18605
+ if (value2 <= middle) {
18606
+ updateValue([value2, right], true);
18921
18607
  } else {
18922
- updateValue([left, value], true);
18608
+ updateValue([left, value2], true);
18923
18609
  }
18924
18610
  } else {
18925
- updateValue(value, true);
18611
+ updateValue(value2, true);
18926
18612
  }
18927
18613
  };
18928
18614
  const onTouchStart = (event) => {
@@ -18930,24 +18616,24 @@ const Range = (props) => {
18930
18616
  return;
18931
18617
  }
18932
18618
  touch.start(event);
18933
- currentValue = initValue || initValue === 0 ? initValue : modelValue;
18934
- if (isRange(currentValue)) {
18935
- startValue = currentValue.map(format2);
18619
+ setEaxctValue(current);
18620
+ if (isRange(current)) {
18621
+ setStartValue(current.map(format2));
18936
18622
  } else {
18937
- startValue = format2(currentValue);
18623
+ setStartValue(format2(current));
18938
18624
  }
18939
- SetDragStatus("start");
18625
+ setDragStatus("start");
18940
18626
  };
18941
18627
  const onTouchMove = (event) => {
18628
+ event.stopPropagation();
18942
18629
  if (disabled || !root2.current) {
18943
18630
  return;
18944
18631
  }
18945
18632
  if (dragStatus === "start") {
18946
- dragStart && dragStart();
18947
- onDragStart && onDragStart();
18633
+ onStart && onStart();
18948
18634
  }
18949
18635
  touch.move(event);
18950
- SetDragStatus("draging");
18636
+ setDragStatus("draging");
18951
18637
  const rect = getRect(root2.current);
18952
18638
  let delta = touch.deltaX;
18953
18639
  let total = rect.width;
@@ -18957,121 +18643,91 @@ const Range = (props) => {
18957
18643
  total = rect.height;
18958
18644
  diff = delta / total * scope();
18959
18645
  }
18646
+ let newValue;
18960
18647
  if (isRange(startValue)) {
18961
- currentValue[buttonIndex] = startValue[buttonIndex] + diff;
18648
+ newValue = exactValue.slice();
18649
+ newValue[buttonIndex] = startValue[buttonIndex] + diff;
18962
18650
  } else {
18963
- currentValue = startValue + diff;
18651
+ newValue = startValue + diff;
18964
18652
  }
18965
- updateValue(currentValue);
18653
+ setEaxctValue(newValue);
18654
+ updateValue(newValue);
18966
18655
  };
18967
18656
  const onTouchEnd = (event) => {
18968
18657
  if (disabled) {
18969
18658
  return;
18970
18659
  }
18971
18660
  if (dragStatus === "draging") {
18972
- updateValue(currentValue, true);
18973
- dragEnd && dragEnd();
18974
- onDragEnd && onDragEnd();
18661
+ updateValue(current, true);
18975
18662
  }
18976
- SetDragStatus("");
18663
+ setDragStatus("");
18977
18664
  };
18978
18665
  const curValue = (idx) => {
18979
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
18980
- const value = typeof idx === "number" ? modelVal[idx] : modelVal;
18981
- return value;
18666
+ const modelVal = current;
18667
+ const value2 = typeof idx === "number" ? modelVal[idx] : modelVal;
18668
+ return value2;
18982
18669
  };
18983
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${containerName}`, children: [
18984
- !hiddenRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min", children: minDesc || +min }) : null,
18985
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
18986
- "div",
18987
- {
18988
- ref: root2,
18989
- style: wrapperStyle(),
18990
- className: `${rangeName}`,
18991
- onClick: (e) => {
18992
- click(e);
18993
- },
18994
- children: [
18995
- marksList.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-mark", children: marksList.map((marks2) => {
18996
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
18997
- "span",
18998
- {
18999
- className: markClassName(marks2),
19000
- style: marksStyle(marks2),
19001
- children: [
19002
- marks2,
19003
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-range-tick", style: tickStyle(marks2) })
19004
- ]
19005
- },
19006
- marks2
19007
- );
19008
- }) }) : null,
19009
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-bar", style: barStyle(), children: range3 ? [0, 1].map((item, index) => {
19010
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
19011
- "div",
19012
- {
19013
- role: "slider",
19014
- className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
18670
+ const renderButton = (index) => {
18671
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", children: currentDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: currentDescription ? currentDescription(curValue(index)) : curValue(index) }) }) });
18672
+ };
18673
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: containerClasses, children: [
18674
+ minDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min", children: minDescription || min }),
18675
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: root2, className: classes, onClick: (e) => click(e), children: [
18676
+ marksList.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-mark", children: marksList.map((marks2) => {
18677
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
18678
+ "span",
18679
+ {
18680
+ className: markClassName(marks2),
18681
+ style: marksStyle(marks2),
18682
+ children: [
18683
+ marks2,
18684
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18685
+ "span",
18686
+ {
18687
+ className: classNames("nut-range-tick", {
18688
+ active: tickClass(marks2)
18689
+ })
18690
+ }
18691
+ )
18692
+ ]
18693
+ },
18694
+ marks2
18695
+ );
18696
+ }) }),
18697
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-bar", style: barStyle(), children: range3 ? [0, 1].map((item, index) => {
18698
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18699
+ "div",
18700
+ {
18701
+ className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
19015
18702
  ${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
19016
- tabIndex: disabled ? -1 : 0,
19017
- "aria-valuemin": +min,
19018
- "aria-valuenow": curValue(index),
19019
- "aria-valuemax": +max,
19020
- "aria-orientation": vertical ? "vertical" : "horizontal",
19021
- onTouchStart: (e) => {
19022
- if (typeof index === "number") {
19023
- SetButtonIndex(index);
19024
- }
19025
- onTouchStart(e);
19026
- },
19027
- onTouchMove: (e) => {
19028
- onTouchMove(e);
19029
- },
19030
- onTouchEnd: (e) => {
19031
- onTouchEnd();
19032
- },
19033
- onTouchCancel: (e) => {
19034
- onTouchEnd();
19035
- },
19036
- onClick: (e) => {
19037
- e.stopPropagation();
19038
- },
19039
- children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", style: buttonStyle(), children: !hiddenTag ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: curValueDesc || curValue(index) }) : null })
19040
- },
19041
- index
19042
- );
19043
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
19044
- "div",
19045
- {
19046
- role: "slider",
19047
- className: "nut-range-button-wrapper",
19048
- tabIndex: disabled ? -1 : 0,
19049
- "aria-valuemin": +min,
19050
- "aria-valuenow": curValue(),
19051
- "aria-valuemax": +max,
19052
- "aria-orientation": vertical ? "vertical" : "horizontal",
19053
- onTouchStart: (e) => {
19054
- onTouchStart(e);
19055
- },
19056
- onTouchMove: (e) => {
19057
- onTouchMove(e);
19058
- },
19059
- onTouchEnd: (e) => {
19060
- onTouchEnd();
19061
- },
19062
- onTouchCancel: (e) => {
19063
- onTouchEnd();
19064
- },
19065
- onClick: (e) => {
19066
- e.stopPropagation();
19067
- },
19068
- children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", style: buttonStyle(), children: !hiddenTag ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: curValueDesc || curValue() }) : null })
19069
- }
19070
- ) })
19071
- ]
19072
- }
19073
- ),
19074
- !hiddenRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDesc || +max }) : null
18703
+ onTouchStart: (e) => {
18704
+ if (typeof index === "number") {
18705
+ setButtonIndex(index);
18706
+ }
18707
+ onTouchStart(e);
18708
+ },
18709
+ onTouchMove: (e) => onTouchMove(e),
18710
+ onTouchEnd: (e) => onTouchEnd(),
18711
+ onTouchCancel: (e) => onTouchEnd(),
18712
+ onClick: (e) => e.stopPropagation(),
18713
+ children: renderButton(index)
18714
+ },
18715
+ index
18716
+ );
18717
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
18718
+ "div",
18719
+ {
18720
+ className: "nut-range-button-wrapper",
18721
+ onTouchStart: (e) => onTouchStart(e),
18722
+ onTouchMove: (e) => onTouchMove(e),
18723
+ onTouchEnd: (e) => onTouchEnd(),
18724
+ onTouchCancel: (e) => onTouchEnd(),
18725
+ onClick: (e) => e.stopPropagation(),
18726
+ children: renderButton()
18727
+ }
18728
+ ) })
18729
+ ] }),
18730
+ maxDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDescription || max })
19075
18731
  ] });
19076
18732
  };
19077
18733
  Range.defaultProps = defaultProps$M;
@@ -20432,7 +20088,7 @@ const InternalUploader = (props, ref) => {
20432
20088
  }
20433
20089
  ),
20434
20090
  deletable && /* @__PURE__ */ jsxRuntimeExports.jsx(
20435
- y$6,
20091
+ y$7,
20436
20092
  {
20437
20093
  color: "#808080",
20438
20094
  className: "nut-uploader__preview-img__file__del",
@@ -20575,6 +20231,58 @@ const ActionSheet = (props) => {
20575
20231
  };
20576
20232
  ActionSheet.defaultProps = defaultProps$D;
20577
20233
  ActionSheet.displayName = "NutActionSheet";
20234
+ const fullClone = {
20235
+ ...ReactDOM
20236
+ };
20237
+ const { version, render: reactRender, unmountComponentAtNode } = fullClone;
20238
+ let createRoot;
20239
+ try {
20240
+ const mainVersion = Number((version || "").split(".")[0]);
20241
+ if (mainVersion >= 18 && fullClone.createRoot) {
20242
+ createRoot = fullClone.createRoot;
20243
+ }
20244
+ } catch (e) {
20245
+ }
20246
+ function toggleWarning(skip) {
20247
+ const { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } = fullClone;
20248
+ if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && typeof __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === "object") {
20249
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
20250
+ }
20251
+ }
20252
+ const MARK = "__nutui_react_root__";
20253
+ function legacyRender(node, container) {
20254
+ reactRender(node, container);
20255
+ }
20256
+ function concurrentRender(node, container) {
20257
+ toggleWarning(true);
20258
+ const root2 = container[MARK] || createRoot(container);
20259
+ toggleWarning(false);
20260
+ root2.render(node);
20261
+ container[MARK] = root2;
20262
+ }
20263
+ function render(node, container) {
20264
+ if (createRoot) {
20265
+ concurrentRender(node, container);
20266
+ return;
20267
+ }
20268
+ legacyRender(node, container);
20269
+ }
20270
+ function legacyUnmount(container) {
20271
+ return unmountComponentAtNode(container);
20272
+ }
20273
+ async function concurrentUnmount(container) {
20274
+ return Promise.resolve().then(() => {
20275
+ var _a2;
20276
+ (_a2 = container[MARK]) == null ? void 0 : _a2.unmount();
20277
+ delete container[MARK];
20278
+ });
20279
+ }
20280
+ function unmount(container) {
20281
+ if (createRoot) {
20282
+ return concurrentUnmount(container);
20283
+ }
20284
+ return legacyUnmount(container);
20285
+ }
20578
20286
  function ConfirmDialog(props) {
20579
20287
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Dialog, { ...props, children: props.content });
20580
20288
  }
@@ -20952,7 +20660,7 @@ const defaultProps$A = {
20952
20660
  imageSize: "",
20953
20661
  status: "empty"
20954
20662
  };
20955
- const classPrefix$6 = `nut-empty`;
20663
+ const classPrefix$7 = `nut-empty`;
20956
20664
  const Empty = (props) => {
20957
20665
  const { locale } = useConfig();
20958
20666
  const {
@@ -20987,9 +20695,9 @@ const Empty = (props) => {
20987
20695
  };
20988
20696
  });
20989
20697
  }, [imageSize]);
20990
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$6} ${className}`, ...rest, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
20991
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$6}__image`, style: imgStyle, children: imageNode }),
20992
- typeof description === "string" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$6}__description`, children: description || locale.noData }) : description,
20698
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$7} ${className}`, ...rest, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
20699
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$7}__image`, style: imgStyle, children: imageNode }),
20700
+ typeof description === "string" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix$7}__description`, children: description || locale.noData }) : description,
20993
20701
  children
20994
20702
  ] }) });
20995
20703
  };
@@ -21621,7 +21329,8 @@ const NoticeBar = (props) => {
21621
21329
  };
21622
21330
  NoticeBar.defaultProps = defaultProps$y;
21623
21331
  NoticeBar.displayName = "NutNoticeBar";
21624
- class Notification extends React.PureComponent {
21332
+ const classPrefix$6 = "nut-notify";
21333
+ let Notification$1 = (_a = class extends React.PureComponent {
21625
21334
  constructor(props) {
21626
21335
  super(props);
21627
21336
  __publicField(this, "closeTimer");
@@ -21642,7 +21351,7 @@ class Notification extends React.PureComponent {
21642
21351
  const element = document.getElementById(this.props.id);
21643
21352
  element && element.parentNode && element.parentNode.removeChild(element);
21644
21353
  }
21645
- this.props.onClosed();
21354
+ this.props.onClose();
21646
21355
  }
21647
21356
  startCloseTimer() {
21648
21357
  const { duration } = this.props;
@@ -21668,53 +21377,37 @@ class Notification extends React.PureComponent {
21668
21377
  this.clearCloseTimer();
21669
21378
  }
21670
21379
  render() {
21671
- const {
21672
- children,
21673
- style,
21674
- msg,
21675
- color,
21676
- background,
21677
- type: type4,
21678
- className,
21679
- position,
21680
- isWrapTeleport
21681
- } = this.props;
21682
- this.state;
21683
- cn("notify");
21380
+ const { style, message, type: type4, className, position } = this.props;
21381
+ const { show } = this.state;
21684
21382
  const classes = classNames({
21685
- "nut-notify--popup-top": position === "top",
21686
- "nut-notify--popup-bottom": position === "bottom",
21687
- "nut-notify": true,
21688
- [`nut-notify--${type4}`]: true
21383
+ [`${classPrefix$6}--popup-top`]: position === "top",
21384
+ [`${classPrefix$6}--popup-bottom`]: position === "bottom",
21385
+ [`${classPrefix$6}`]: true,
21386
+ [`${classPrefix$6}--${type4}`]: true
21689
21387
  });
21690
21388
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
21691
21389
  CSSTransition$1,
21692
21390
  {
21693
- in: this.state.show,
21391
+ in: show,
21694
21392
  timeout: 300,
21695
21393
  classNames: "fade",
21696
21394
  unmountOnExit: true,
21697
21395
  appear: true,
21698
21396
  position,
21699
- isWrapTeleport,
21700
21397
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
21701
21398
  "div",
21702
21399
  {
21703
21400
  className: `${classes} ${className}`,
21704
- style: {
21705
- color: `${color || ""}`,
21706
- background: `${background || ""}`
21707
- },
21401
+ style,
21708
21402
  onClick: this.clickCover,
21709
- children: children || msg
21403
+ children: message
21710
21404
  }
21711
21405
  )
21712
21406
  }
21713
- ) });
21714
- }
21715
- }
21716
- __publicField(Notification, "newInstance");
21717
- Notification.newInstance = (properties, callback) => {
21407
+ ) });
21408
+ }
21409
+ }, __publicField(_a, "newInstance"), _a);
21410
+ Notification$1.newInstance = (properties, callback) => {
21718
21411
  const element = document.createElement("div");
21719
21412
  const id = properties.id ? properties.id : `${(/* @__PURE__ */ new Date()).getTime()}`;
21720
21413
  element.id = id;
@@ -21730,74 +21423,72 @@ Notification.newInstance = (properties, callback) => {
21730
21423
  component: instance,
21731
21424
  destroy() {
21732
21425
  setTimeout(() => {
21733
- ReactDOM.unmountComponentAtNode(element);
21426
+ unmount(element);
21734
21427
  element && element.parentNode && element.parentNode.removeChild(element);
21735
21428
  }, 300);
21736
21429
  }
21737
21430
  });
21738
21431
  }
21739
- render(/* @__PURE__ */ jsxRuntimeExports.jsx(Notification, { ...properties, ref }), element);
21432
+ render(/* @__PURE__ */ jsxRuntimeExports.jsx(Notification$1, { ...properties, ref }), element);
21740
21433
  };
21741
- let messageInstance = null;
21742
- const options = {
21743
- msg: "",
21434
+ let messageInstance$1 = null;
21435
+ const options$1 = {
21436
+ ...ComponentDefaults,
21744
21437
  id: "",
21745
21438
  duration: 3e3,
21746
21439
  // 时长
21747
- color: "",
21748
21440
  type: "danger",
21749
- className: "",
21750
21441
  position: "top",
21751
- onClosed: () => {
21442
+ onClose: () => {
21752
21443
  },
21753
21444
  onClick: () => {
21754
21445
  }
21755
21446
  };
21756
- function getInstance(props, callback) {
21757
- if (messageInstance) {
21758
- messageInstance.destroy();
21759
- messageInstance = null;
21447
+ function getInstance$1(props, callback) {
21448
+ if (messageInstance$1) {
21449
+ messageInstance$1.destroy();
21450
+ messageInstance$1 = null;
21760
21451
  }
21761
- Notification.newInstance(props, (notification) => {
21452
+ Notification$1.newInstance(props, (notification) => {
21762
21453
  return callback && callback(notification);
21763
21454
  });
21764
21455
  }
21765
- function notice(opts) {
21766
- opts = { ...options, ...opts };
21767
- getInstance(opts, (notification) => {
21768
- messageInstance = notification;
21456
+ function notice$1(opts) {
21457
+ opts = { ...options$1, ...opts };
21458
+ getInstance$1(opts, (notification) => {
21459
+ messageInstance$1 = notification;
21769
21460
  });
21770
21461
  }
21771
- const errorMsg = (msg) => {
21772
- if (!msg) {
21773
- console.warn("[NutUI Notify]: msg不能为空");
21462
+ const errorMsg$1 = (message) => {
21463
+ if (!message) {
21464
+ console.warn("[NutUI Notify]: message不能为空");
21774
21465
  }
21775
21466
  };
21776
21467
  const Notify = {
21777
- text(msg, option = {}) {
21778
- errorMsg(msg);
21779
- return notice({ msg, type: "base", ...option });
21468
+ text(message, option = {}) {
21469
+ errorMsg$1(message);
21470
+ return notice$1({ message, type: "base", ...option });
21780
21471
  },
21781
- success(msg, option = {}) {
21782
- errorMsg(msg);
21783
- return notice({ msg, type: "success", ...option });
21472
+ success(message, option = {}) {
21473
+ errorMsg$1(message);
21474
+ return notice$1({ message, type: "success", ...option });
21784
21475
  },
21785
- primary(msg, option = {}) {
21786
- errorMsg(msg);
21787
- return notice({ msg, type: "primary", ...option });
21476
+ primary(message, option = {}) {
21477
+ errorMsg$1(message);
21478
+ return notice$1({ message, type: "primary", ...option });
21788
21479
  },
21789
- danger(msg, option = {}) {
21790
- errorMsg(msg);
21791
- return notice({ msg, type: "danger", ...option });
21480
+ danger(message, option = {}) {
21481
+ errorMsg$1(message);
21482
+ return notice$1({ message, type: "danger", ...option });
21792
21483
  },
21793
- warn(msg, option = {}) {
21794
- errorMsg(msg);
21795
- return notice({ msg, type: "warning", ...option });
21484
+ warn(message, option = {}) {
21485
+ errorMsg$1(message);
21486
+ return notice$1({ message, type: "warning", ...option });
21796
21487
  },
21797
21488
  hide() {
21798
- if (messageInstance) {
21799
- messageInstance.destroy();
21800
- messageInstance = null;
21489
+ if (messageInstance$1) {
21490
+ messageInstance$1.destroy();
21491
+ messageInstance$1 = null;
21801
21492
  }
21802
21493
  }
21803
21494
  };
@@ -22011,8 +21702,7 @@ if (canUseDom) {
22011
21702
  }
22012
21703
  }
22013
21704
  const defaultProps$w = {
22014
- className: "",
22015
- style: {},
21705
+ ...ComponentDefaults,
22016
21706
  pullingText: "",
22017
21707
  canReleaseText: "",
22018
21708
  refreshingText: "",
@@ -22025,6 +21715,7 @@ const defaultProps$w = {
22025
21715
  }
22026
21716
  };
22027
21717
  const PullToRefresh = (p) => {
21718
+ const classPrefix2 = "nut-pulltorefresh";
22028
21719
  const { locale } = useConfig();
22029
21720
  const props = {
22030
21721
  ...defaultProps$w,
@@ -22156,18 +21847,18 @@ const PullToRefresh = (p) => {
22156
21847
  animated.div,
22157
21848
  {
22158
21849
  ref: elementRef,
22159
- className: `nut-pulltorefresh ${props.className}`,
21850
+ className: `${classPrefix2} ${props.className}`,
22160
21851
  style: props.style,
22161
21852
  children: [
22162
- /* @__PURE__ */ jsxRuntimeExports.jsx(animated.div, { style: springStyles, className: "nut-pulltorefresh-head", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
21853
+ /* @__PURE__ */ jsxRuntimeExports.jsx(animated.div, { style: springStyles, className: `${classPrefix2}-head`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
22163
21854
  "div",
22164
21855
  {
22165
- className: "nut-pulltorefresh-head-content",
21856
+ className: `${classPrefix2}-head-content`,
22166
21857
  style: { height: headHeight },
22167
21858
  children: renderStatusText()
22168
21859
  }
22169
21860
  ) }),
22170
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-pulltorefresh-content", children: props.children })
21861
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}-content`, children: props.children })
22171
21862
  ]
22172
21863
  }
22173
21864
  );
@@ -22531,46 +22222,258 @@ const Swipe = forwardRef((props, instanceRef) => {
22531
22222
  } else {
22532
22223
  props.onActionClick && props.onActionClick(event, position);
22533
22224
  }
22534
- };
22535
- useImperativeHandle(instanceRef, () => ({
22536
- open,
22537
- close: () => close()
22538
- }));
22539
- useEffect(() => {
22540
- const handler = (event) => {
22541
- const targets = [root2];
22542
- if (targets.some((targetItem) => {
22543
- const targetElement = targetItem.current || targetItem;
22544
- return !targetElement || (targetElement == null ? void 0 : targetElement.contains(event.target));
22545
- })) {
22546
- return;
22547
- }
22548
- close();
22549
- };
22550
- document.addEventListener("touchstart", handler);
22551
- return () => {
22552
- document.removeEventListener("touchstart", handler);
22553
- };
22554
- }, []);
22555
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
22556
- "div",
22557
- {
22558
- ref: root2,
22559
- className: classNames(swipeBem(), className),
22560
- onTouchStart: (e) => onTouchStart(e),
22561
- onTouchMove: (e) => onTouchMove(e),
22562
- onTouchEnd: (e) => onTouchEnd(e),
22563
- style,
22564
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${swipeBem("wrapper")}`, style: wrapperStyle, children: [
22565
- renderActionContent("left", leftRef),
22566
- children,
22567
- renderActionContent("right", rightRef)
22568
- ] })
22225
+ };
22226
+ useImperativeHandle(instanceRef, () => ({
22227
+ open,
22228
+ close: () => close()
22229
+ }));
22230
+ useEffect(() => {
22231
+ const handler = (event) => {
22232
+ const targets = [root2];
22233
+ if (targets.some((targetItem) => {
22234
+ const targetElement = targetItem.current || targetItem;
22235
+ return !targetElement || (targetElement == null ? void 0 : targetElement.contains(event.target));
22236
+ })) {
22237
+ return;
22238
+ }
22239
+ close();
22240
+ };
22241
+ document.addEventListener("touchstart", handler);
22242
+ return () => {
22243
+ document.removeEventListener("touchstart", handler);
22244
+ };
22245
+ }, []);
22246
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
22247
+ "div",
22248
+ {
22249
+ ref: root2,
22250
+ className: classNames(swipeBem(), className),
22251
+ onTouchStart: (e) => onTouchStart(e),
22252
+ onTouchMove: (e) => onTouchMove(e),
22253
+ onTouchEnd: (e) => onTouchEnd(e),
22254
+ style,
22255
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${swipeBem("wrapper")}`, style: wrapperStyle, children: [
22256
+ renderActionContent("left", leftRef),
22257
+ children,
22258
+ renderActionContent("right", rightRef)
22259
+ ] })
22260
+ }
22261
+ );
22262
+ });
22263
+ Swipe.defaultProps = defaultProps$t;
22264
+ Swipe.displayName = "NutSwipe";
22265
+ class Notification extends React.PureComponent {
22266
+ constructor(props) {
22267
+ super(props);
22268
+ __publicField(this, "closeTimer");
22269
+ this.close = this.close.bind(this);
22270
+ this.startCloseTimer = this.startCloseTimer.bind(this);
22271
+ this.clearCloseTimer = this.clearCloseTimer.bind(this);
22272
+ this.close = this.close.bind(this);
22273
+ this.clickCover = this.clickCover.bind(this);
22274
+ }
22275
+ close() {
22276
+ this.clearCloseTimer();
22277
+ this.props.onClose();
22278
+ }
22279
+ startCloseTimer() {
22280
+ const { duration } = this.props;
22281
+ if (duration) {
22282
+ this.closeTimer = window.setTimeout(() => {
22283
+ this.close();
22284
+ }, duration * 1e3);
22285
+ }
22286
+ }
22287
+ clearCloseTimer() {
22288
+ if (this.closeTimer) {
22289
+ clearTimeout(this.closeTimer);
22290
+ this.closeTimer = -1;
22291
+ }
22292
+ }
22293
+ clickCover() {
22294
+ const { closeOnClickOverlay } = this.props;
22295
+ if (closeOnClickOverlay) {
22296
+ this.close();
22297
+ }
22298
+ }
22299
+ componentDidMount() {
22300
+ this.startCloseTimer();
22301
+ }
22302
+ componentWillUnmount() {
22303
+ this.clearCloseTimer();
22304
+ }
22305
+ render() {
22306
+ const {
22307
+ id,
22308
+ style,
22309
+ icon,
22310
+ title,
22311
+ msg,
22312
+ bottom,
22313
+ center,
22314
+ bgColor,
22315
+ coverColor,
22316
+ textAlignCenter,
22317
+ size,
22318
+ customClass,
22319
+ cover,
22320
+ type: type4
22321
+ } = this.props;
22322
+ const toastBem = cn("toast");
22323
+ const classes = classNames({
22324
+ "nut-toast-center": center,
22325
+ "nut-toast-has-icon": icon,
22326
+ "nut-toast-cover": cover,
22327
+ "nut-toast-loading": type4 === "loading",
22328
+ [`${customClass}`]: true,
22329
+ [`nut-toast-${size}`]: true
22330
+ });
22331
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
22332
+ "div",
22333
+ {
22334
+ className: `${toastBem()} ${classes}`,
22335
+ id: `toast-${id}`,
22336
+ style: {
22337
+ bottom: center ? "auto" : `${bottom}`,
22338
+ backgroundColor: cover ? coverColor : "",
22339
+ ...style
22340
+ },
22341
+ onClick: () => {
22342
+ this.clickCover();
22343
+ },
22344
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
22345
+ "div",
22346
+ {
22347
+ className: toastBem("inner"),
22348
+ style: {
22349
+ textAlign: textAlignCenter ? "center" : "left",
22350
+ backgroundColor: bgColor
22351
+ },
22352
+ children: [
22353
+ icon ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: toastBem("icon-wrapper"), children: icon }) : null,
22354
+ title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-toast-title", children: title }) : null,
22355
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: toastBem("text"), children: msg })
22356
+ ]
22357
+ }
22358
+ )
22359
+ }
22360
+ ) });
22361
+ }
22362
+ }
22363
+ __publicField(Notification, "newInstance");
22364
+ Notification.newInstance = (properties, callback) => {
22365
+ const element = document.createElement("div");
22366
+ if (properties.id) {
22367
+ element.setAttribute("id", `${properties.id}`);
22368
+ }
22369
+ document.body.appendChild(element);
22370
+ let called = false;
22371
+ function ref(instance) {
22372
+ if (called) {
22373
+ return;
22374
+ }
22375
+ called = true;
22376
+ callback({
22377
+ component: instance,
22378
+ destroy() {
22379
+ unmount(element);
22380
+ element && element.parentNode && element.parentNode.removeChild(element);
22381
+ }
22382
+ });
22383
+ }
22384
+ render(/* @__PURE__ */ jsxRuntimeExports.jsx(Notification, { ...properties, ref }), element);
22385
+ };
22386
+ let messageInstance = null;
22387
+ const options = {
22388
+ msg: "",
22389
+ id: "",
22390
+ style: {},
22391
+ duration: 1.5,
22392
+ // 时长,duration为0则一直展示
22393
+ center: true,
22394
+ // toast是否居中展示
22395
+ type: "text",
22396
+ title: "",
22397
+ customClass: "",
22398
+ // 自定义样式名
22399
+ bottom: "30px",
22400
+ // center为false时生效,距离底部位置
22401
+ size: "base",
22402
+ // 设置字体大小,默认base,可选large\small\base
22403
+ icon: null,
22404
+ iconSize: "20",
22405
+ textAlignCenter: true,
22406
+ // 文字是否居中显示,true为居中,false为left
22407
+ loadingRotate: true,
22408
+ // 未实现
22409
+ bgColor: "rgba(0, 0, 0, .8)",
22410
+ onClose: () => {
22411
+ },
22412
+ cover: false,
22413
+ // 是否展示透明遮罩层
22414
+ coverColor: "rgba(0, 0, 0, 0)",
22415
+ // 遮罩颜色设定
22416
+ closeOnClickOverlay: false
22417
+ // 是否点击遮罩可关闭
22418
+ };
22419
+ function getInstance(props, callback) {
22420
+ if (messageInstance) {
22421
+ messageInstance.destroy();
22422
+ messageInstance = null;
22423
+ }
22424
+ Notification.newInstance(props, (notification) => {
22425
+ return callback && callback(notification);
22426
+ });
22427
+ }
22428
+ function notice(opts) {
22429
+ function close() {
22430
+ if (messageInstance) {
22431
+ messageInstance.destroy();
22432
+ messageInstance = null;
22433
+ }
22434
+ }
22435
+ const opts2 = { ...options, ...opts, onClose: close };
22436
+ getInstance(opts2, (notification) => {
22437
+ messageInstance = notification;
22438
+ });
22439
+ }
22440
+ const errorMsg = (msg) => {
22441
+ if (!msg) {
22442
+ console.warn("[NutUI Toast]: msg cannot be null");
22443
+ }
22444
+ };
22445
+ const Toast = {
22446
+ text(msg, option = {}) {
22447
+ errorMsg(msg);
22448
+ return notice({ msg, type: "text", ...option });
22449
+ },
22450
+ success(msg, option = {}) {
22451
+ errorMsg(msg);
22452
+ return notice({ msg, icon: "success", type: "success", ...option });
22453
+ },
22454
+ fail(msg, option = {}) {
22455
+ errorMsg(msg);
22456
+ return notice({ msg, icon: "failure", type: "fail", ...option });
22457
+ },
22458
+ loading(msg, option = {}) {
22459
+ errorMsg(msg);
22460
+ return notice({ msg, icon: /* @__PURE__ */ jsxRuntimeExports.jsx(k$3, {}), type: "loading", ...option });
22461
+ },
22462
+ warn(msg, option = {}) {
22463
+ errorMsg(msg);
22464
+ return notice({ msg, icon: "tips", type: "warn", ...option });
22465
+ },
22466
+ customIcon(msg, option = {}) {
22467
+ errorMsg(msg);
22468
+ return notice({ msg, ...option });
22469
+ },
22470
+ hide() {
22471
+ if (messageInstance) {
22472
+ messageInstance.destroy();
22473
+ messageInstance = null;
22569
22474
  }
22570
- );
22571
- });
22572
- Swipe.defaultProps = defaultProps$t;
22573
- Swipe.displayName = "NutSwipe";
22475
+ }
22476
+ };
22574
22477
  const defaultProps$s = {
22575
22478
  ...ComponentDefaults,
22576
22479
  type: "shake",
@@ -22702,7 +22605,7 @@ const defaultProps$p = {
22702
22605
  ...ComponentDefaults,
22703
22606
  src: "",
22704
22607
  muted: false,
22705
- autoplay: false,
22608
+ autoPlay: false,
22706
22609
  loop: false,
22707
22610
  preload: "auto",
22708
22611
  type: "progress",
@@ -22728,7 +22631,7 @@ const Audio = (props) => {
22728
22631
  src,
22729
22632
  style,
22730
22633
  muted,
22731
- autoplay,
22634
+ autoPlay,
22732
22635
  loop: loop2,
22733
22636
  preload,
22734
22637
  type: type4,
@@ -22756,7 +22659,7 @@ const Audio = (props) => {
22756
22659
  duration: "00:00:00",
22757
22660
  second: 0,
22758
22661
  hanMuted: props.muted,
22759
- playing: props.autoplay,
22662
+ playing: props.autoPlay,
22760
22663
  handPlaying: false
22761
22664
  });
22762
22665
  const classPrefix2 = "nut-audio";
@@ -22847,9 +22750,11 @@ const Audio = (props) => {
22847
22750
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__progress-bar-wrapper`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
22848
22751
  Range,
22849
22752
  {
22850
- modelValue: percent,
22851
- hiddenTag: true,
22852
- hiddenRange: true,
22753
+ value: percent,
22754
+ onChange: (val) => setPercent(val),
22755
+ currentDescription: null,
22756
+ maxDescription: null,
22757
+ minDescription: null,
22853
22758
  "inactive-color": "#cccccc",
22854
22759
  "active-color": "#fa2c19"
22855
22760
  }
@@ -22920,7 +22825,7 @@ const Audio = (props) => {
22920
22825
  };
22921
22826
  const handleCanplay = (e) => {
22922
22827
  setIsCanPlay(true);
22923
- if (props.autoplay && !playing) {
22828
+ if (props.autoPlay && !playing) {
22924
22829
  AudioRef && AudioRef.current && AudioRef.current.play();
22925
22830
  }
22926
22831
  if (AudioRef.current) {
@@ -23756,45 +23661,73 @@ Video.defaultProps = defaultProps$i;
23756
23661
  Video.displayName = "NutVideo";
23757
23662
  const DataContext$1 = createContext({});
23758
23663
  const defaultProps$h = {
23664
+ total: 3,
23665
+ current: 0,
23666
+ direction: "horizontal"
23667
+ };
23668
+ const classPrefix = `nut-indicator`;
23669
+ const Indicator = (props) => {
23670
+ const { total, current, children, className, direction, ...rest } = {
23671
+ ...defaultProps$h,
23672
+ ...props
23673
+ };
23674
+ const classes = classNames({
23675
+ [`${classPrefix}__vertical`]: direction === "vertical"
23676
+ });
23677
+ const renderElement = () => {
23678
+ const childs = [];
23679
+ for (let item = 0; item < total; item++) {
23680
+ childs.push(
23681
+ item === current ? children || /* @__PURE__ */ jsxRuntimeExports.jsx(
23682
+ "div",
23683
+ {
23684
+ className: `${classPrefix}__dot ${classPrefix}__active`
23685
+ },
23686
+ item
23687
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix}__dot` }, item)
23688
+ );
23689
+ }
23690
+ return childs;
23691
+ };
23692
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames(classes, className), ...rest, children: renderElement() });
23693
+ };
23694
+ Indicator.defaultProps = defaultProps$h;
23695
+ Indicator.displayName = "NutIndicator";
23696
+ const defaultProps$g = {
23759
23697
  width: typeof window === "object" ? window.innerWidth : 375,
23760
23698
  height: 0,
23761
23699
  duration: 500,
23762
- initPage: 0,
23700
+ defaultValue: 0,
23763
23701
  autoPlay: 0,
23764
23702
  direction: "horizontal",
23765
- paginationColor: "#fff",
23766
- paginationBgColor: "#ddd",
23767
- paginationVisible: false,
23703
+ indicator: false,
23768
23704
  loop: true,
23769
23705
  touchable: true,
23770
- isPreventDefault: true,
23771
- isStopPropagation: true,
23772
- isCenter: false,
23706
+ preventDefault: true,
23707
+ stopPropagation: true,
23708
+ center: false,
23773
23709
  className: ""
23774
23710
  };
23775
23711
  const DISTANCE = 5;
23776
23712
  const Swiper = React__default.forwardRef((props, ref) => {
23777
- const propSwiper = { ...defaultProps$h, ...props };
23713
+ const propSwiper = { ...defaultProps$g, ...props };
23778
23714
  const {
23779
23715
  children,
23780
23716
  direction,
23781
23717
  className,
23782
- pageContent,
23783
23718
  onChange,
23784
- initPage,
23785
- paginationColor,
23786
- paginationVisible,
23719
+ defaultValue,
23720
+ indicator,
23787
23721
  touchable,
23788
- isPreventDefault,
23789
- isStopPropagation,
23722
+ preventDefault: preventDefault2,
23723
+ stopPropagation,
23790
23724
  autoPlay,
23791
- isCenter,
23792
- paginationBgColor,
23725
+ center,
23793
23726
  ...rest
23794
23727
  } = propSwiper;
23795
23728
  const container = useRef(null);
23796
23729
  const innerRef = useRef(null);
23797
- const _swiper = useRef({
23730
+ const swiperRef = useRef({
23798
23731
  moving: false,
23799
23732
  autoplayTimer: null,
23800
23733
  width: 0,
@@ -23811,7 +23744,7 @@ const Swiper = React__default.forwardRef((props, ref) => {
23811
23744
  const [childOffset, setChildOffset] = useState([]);
23812
23745
  const [ready, setReady] = useState(false);
23813
23746
  let size = isVertical ? height : width;
23814
- const [touch, setTouch] = useState({
23747
+ const [touch] = useState({
23815
23748
  startX: 0,
23816
23749
  startY: 0,
23817
23750
  deltaX: 0,
@@ -23848,20 +23781,20 @@ const Swiper = React__default.forwardRef((props, ref) => {
23848
23781
  return 0;
23849
23782
  })();
23850
23783
  const stopAutoPlay = () => {
23851
- clearTimeout(_swiper.current.autoplayTimer);
23852
- _swiper.current.autoplayTimer = null;
23784
+ clearTimeout(swiperRef.current.autoplayTimer);
23785
+ swiperRef.current.autoplayTimer = null;
23853
23786
  };
23854
- const autoplay = () => {
23787
+ const startPlay = () => {
23855
23788
  if (propSwiper.autoPlay <= 0 || childCount <= 1)
23856
23789
  return;
23857
23790
  stopAutoPlay();
23858
- _swiper.current.autoplayTimer = setTimeout(() => {
23791
+ swiperRef.current.autoplayTimer = setTimeout(() => {
23859
23792
  next();
23860
- autoplay();
23793
+ startPlay();
23861
23794
  }, Number(propSwiper.autoPlay));
23862
23795
  };
23863
- const resettPosition = () => {
23864
- _swiper.current.moving = true;
23796
+ const resetPosition = () => {
23797
+ swiperRef.current.moving = true;
23865
23798
  if (active <= -1) {
23866
23799
  move({ pace: childCount });
23867
23800
  }
@@ -23870,47 +23803,41 @@ const Swiper = React__default.forwardRef((props, ref) => {
23870
23803
  }
23871
23804
  };
23872
23805
  const prev = () => {
23873
- resettPosition();
23874
- touchReset();
23806
+ resetPosition();
23807
+ resetTouchDetails();
23875
23808
  requestFrame(() => {
23876
- requestFrame(() => {
23877
- _swiper.current.moving = false;
23878
- move({
23879
- pace: -1,
23880
- isEmit: true
23881
- });
23809
+ swiperRef.current.moving = false;
23810
+ move({
23811
+ pace: -1,
23812
+ isEmit: true
23882
23813
  });
23883
23814
  });
23884
23815
  };
23885
23816
  const next = () => {
23886
- resettPosition();
23887
- touchReset();
23817
+ resetPosition();
23818
+ resetTouchDetails();
23888
23819
  requestFrame(() => {
23889
- requestFrame(() => {
23890
- _swiper.current.moving = false;
23891
- move({
23892
- pace: 1,
23893
- isEmit: true
23894
- });
23820
+ swiperRef.current.moving = false;
23821
+ move({
23822
+ pace: 1,
23823
+ isEmit: true
23895
23824
  });
23896
23825
  });
23897
23826
  };
23898
23827
  const to2 = (index) => {
23899
- resettPosition();
23900
- touchReset();
23828
+ resetPosition();
23829
+ resetTouchDetails();
23901
23830
  requestFrame(() => {
23902
- requestFrame(() => {
23903
- _swiper.current.moving = false;
23904
- let targetIndex;
23905
- if (props.loop && childCount === index) {
23906
- targetIndex = active === 0 ? 0 : index;
23907
- } else {
23908
- targetIndex = index % childCount;
23909
- }
23910
- move({
23911
- pace: targetIndex - active,
23912
- isEmit: true
23913
- });
23831
+ swiperRef.current.moving = false;
23832
+ let targetIndex;
23833
+ if (props.loop && childCount === index) {
23834
+ targetIndex = active === 0 ? 0 : index;
23835
+ } else {
23836
+ targetIndex = index % childCount;
23837
+ }
23838
+ move({
23839
+ pace: targetIndex - active,
23840
+ isEmit: true
23914
23841
  });
23915
23842
  });
23916
23843
  };
@@ -23980,7 +23907,7 @@ const Swiper = React__default.forwardRef((props, ref) => {
23980
23907
  return "vertical";
23981
23908
  return "";
23982
23909
  };
23983
- const touchReset = () => {
23910
+ const resetTouchDetails = () => {
23984
23911
  touch.startX = 0;
23985
23912
  touch.startY = 0;
23986
23913
  touch.deltaX = 0;
@@ -23992,11 +23919,11 @@ const Swiper = React__default.forwardRef((props, ref) => {
23992
23919
  touch.touchTime = 0;
23993
23920
  };
23994
23921
  const touchStart = (e) => {
23995
- touchReset();
23922
+ resetTouchDetails();
23996
23923
  touch.startX = e.touches[0].clientX;
23997
23924
  touch.startY = e.touches[0].clientY;
23998
23925
  };
23999
- const touchMove = (e) => {
23926
+ const handleTouchMove = (e) => {
24000
23927
  touch.deltaX = e.touches[0].clientX - touch.startX;
24001
23928
  touch.deltaY = e.touches[0].clientY - touch.startY;
24002
23929
  touch.offsetX = Math.abs(touch.deltaX);
@@ -24006,42 +23933,41 @@ const Swiper = React__default.forwardRef((props, ref) => {
24006
23933
  touch.stateDirection = getDirection2(touch.offsetX, touch.offsetY);
24007
23934
  }
24008
23935
  };
24009
- const b = cn("swiper");
24010
- const classes = classNames(b(""));
23936
+ const classPrefix2 = "nut-swiper";
24011
23937
  const contentClass = classNames({
24012
- [`${b("inner")}`]: true,
24013
- [`${b("vertical")}`]: isVertical
23938
+ [`${classPrefix2}__inner`]: true,
23939
+ [`${classPrefix2}__vertical`]: isVertical
24014
23940
  });
24015
23941
  const getStyle = (moveOffset = offset) => {
24016
23942
  const target = innerRef.current;
24017
23943
  let _offset = 0;
24018
- if (!isCenter) {
23944
+ if (!center) {
24019
23945
  _offset = moveOffset;
24020
23946
  } else {
24021
23947
  const _size = isVertical ? height : width;
24022
23948
  const val = isVertical ? rect.height - _size : rect.width - _size;
24023
23949
  _offset = moveOffset + (active === childCount - 1 && !props.loop ? -val / 2 : val / 2);
24024
23950
  }
24025
- target.style.transitionDuration = `${_swiper.current.moving ? 0 : props.duration}ms`;
23951
+ target.style.transitionDuration = `${swiperRef.current.moving ? 0 : props.duration}ms`;
24026
23952
  target.style[isVertical ? "height" : "width"] = `${Number(size) * childCount}px`;
24027
23953
  target.style[isVertical ? "width" : "height"] = `${isVertical ? width : height}px`;
24028
23954
  target.style.transform = `translate3D${!isVertical ? `(${_offset}px,0,0)` : `(0,${_offset}px,0)`}`;
24029
23955
  };
24030
23956
  const onTouchStart = (e) => {
24031
- if (props.isPreventDefault)
23957
+ if (props.preventDefault)
24032
23958
  e.preventDefault();
24033
- if (props.isStopPropagation)
23959
+ if (props.stopPropagation)
24034
23960
  e.stopPropagation();
24035
23961
  if (!props.touchable)
24036
23962
  return;
24037
23963
  touchStart(e);
24038
23964
  touch.touchTime = Date.now();
24039
23965
  stopAutoPlay();
24040
- resettPosition();
23966
+ resetPosition();
24041
23967
  };
24042
23968
  const onTouchMove = (e) => {
24043
- if (props.touchable && _swiper.current.moving) {
24044
- touchMove(e);
23969
+ if (props.touchable && swiperRef.current.moving) {
23970
+ handleTouchMove(e);
24045
23971
  if (touch.stateDirection === props.direction) {
24046
23972
  move({
24047
23973
  offset: touch.delta
@@ -24050,12 +23976,12 @@ const Swiper = React__default.forwardRef((props, ref) => {
24050
23976
  }
24051
23977
  };
24052
23978
  const onTouchEnd = (e) => {
24053
- if (!props.touchable || !_swiper.current.moving)
23979
+ if (!props.touchable || !swiperRef.current.moving)
24054
23980
  return;
24055
23981
  const speed = touch.delta / (Date.now() - touch.touchTime);
24056
- const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > +(size / 2).toFixed(2);
23982
+ const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > Number((size / 2).toFixed(2));
24057
23983
  let pace = 0;
24058
- _swiper.current.moving = false;
23984
+ swiperRef.current.moving = false;
24059
23985
  if (isShouldMove && touch.stateDirection === props.direction) {
24060
23986
  const offset2 = isVertical ? touch.offsetY : touch.offsetX;
24061
23987
  if (props.loop) {
@@ -24076,27 +24002,27 @@ const Swiper = React__default.forwardRef((props, ref) => {
24076
24002
  } else {
24077
24003
  getStyle();
24078
24004
  }
24079
- autoplay();
24005
+ startPlay();
24080
24006
  };
24081
24007
  useEffect(() => {
24082
- _swiper.current.activePagination = (active + childCount) % childCount;
24008
+ swiperRef.current.activePagination = (active + childCount) % childCount;
24083
24009
  }, [active]);
24084
- const init = (active2 = +propSwiper.initPage) => {
24010
+ const init = (active2 = +propSwiper.defaultValue) => {
24085
24011
  const rect2 = getRect(container == null ? void 0 : container.current);
24086
- const _active = Math.max(Math.min(childCount - 1, active2), 0);
24087
- const _width = propSwiper.width ? +propSwiper.width : rect2.width;
24088
- const _height = propSwiper.height ? +propSwiper.height : rect2.height;
24089
- size = isVertical ? _height : _width;
24012
+ const currentIndex = Math.max(Math.min(childCount - 1, active2), 0);
24013
+ const width2 = +propSwiper.width || rect2.width;
24014
+ const height2 = +propSwiper.height || rect2.height;
24015
+ size = isVertical ? height2 : width2;
24090
24016
  trackSize = childCount * Number(size);
24091
- const targetOffset = getOffset(_active);
24092
- _swiper.current.moving = true;
24017
+ const targetOffset = getOffset(currentIndex);
24018
+ swiperRef.current.moving = true;
24093
24019
  if (ready) {
24094
- _swiper.current.moving = false;
24020
+ swiperRef.current.moving = false;
24095
24021
  }
24096
24022
  setRect(rect2);
24097
- setActive(_active);
24098
- setWidth(_width);
24099
- setHeight(_height);
24023
+ setActive(currentIndex);
24024
+ setWidth(width2);
24025
+ setHeight(height2);
24100
24026
  setOffset(targetOffset);
24101
24027
  setReady(true);
24102
24028
  };
@@ -24108,19 +24034,15 @@ const Swiper = React__default.forwardRef((props, ref) => {
24108
24034
  useEffect(() => {
24109
24035
  if (ready) {
24110
24036
  stopAutoPlay();
24111
- autoplay();
24037
+ startPlay();
24112
24038
  }
24113
- return () => {
24114
- setReady(false);
24115
- };
24039
+ return () => setReady(false);
24116
24040
  }, [ready]);
24117
24041
  useEffect(() => {
24118
24042
  stopAutoPlay();
24119
- autoplay();
24043
+ startPlay();
24120
24044
  }, [children]);
24121
- useEffect(() => {
24122
- init();
24123
- }, [propSwiper.initPage]);
24045
+ useEffect(() => init(), [propSwiper.defaultValue]);
24124
24046
  useEffect(() => {
24125
24047
  const target = container.current;
24126
24048
  target.addEventListener("touchstart", onTouchStart, false);
@@ -24133,20 +24055,16 @@ const Swiper = React__default.forwardRef((props, ref) => {
24133
24055
  };
24134
24056
  });
24135
24057
  useEffect(() => {
24136
- return () => {
24137
- stopAutoPlay();
24138
- };
24058
+ return () => stopAutoPlay();
24139
24059
  }, []);
24140
- const itemStyle = (index) => {
24060
+ const getItemStyle = (index) => {
24141
24061
  const style = {};
24142
- const _direction = propSwiper.direction || direction;
24143
- const _size = size;
24144
- if (_size) {
24145
- style[_direction === "horizontal" ? "width" : "height"] = `${_size}px`;
24062
+ if (size) {
24063
+ style[direction === "horizontal" ? "width" : "height"] = `${size}px`;
24146
24064
  }
24147
24065
  const offset2 = childOffset[index];
24148
24066
  if (offset2) {
24149
- style.transform = `translate3D${_direction === "horizontal" ? `(${offset2}px,0,0)` : `(0,${offset2}px,0)`}`;
24067
+ style.transform = `translate3D${direction === "horizontal" ? `(${offset2}px,0,0)` : `(0,${offset2}px,0)`}`;
24150
24068
  }
24151
24069
  return style;
24152
24070
  };
@@ -24156,52 +24074,58 @@ const Swiper = React__default.forwardRef((props, ref) => {
24156
24074
  prev,
24157
24075
  resize
24158
24076
  }));
24159
- return /* @__PURE__ */ jsxRuntimeExports.jsx(DataContext$1.Provider, { value: parent, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classes} ${className}`, ref: container, ...rest, children: [
24160
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: contentClass, ref: innerRef, children: React__default.Children.map(childs, (child, index) => {
24077
+ const renderIndicator = () => {
24078
+ if (React__default.isValidElement(indicator))
24079
+ return indicator;
24080
+ if (indicator === true) {
24161
24081
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
24162
24082
  "div",
24163
24083
  {
24164
- className: b("item-wrapper"),
24165
- style: itemStyle(index),
24166
- children: child
24167
- },
24168
- index
24169
- );
24170
- }) }),
24171
- propSwiper.paginationVisible && !("pageContent" in propSwiper) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
24172
- "div",
24173
- {
24174
- className: classNames({
24175
- [`${b("pagination")}`]: true,
24176
- [`${b("pagination-vertical")}`]: isVertical
24177
- }),
24178
- children: React__default.Children.map(childs, (item, index) => {
24179
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
24180
- "i",
24084
+ className: classNames({
24085
+ [`${classPrefix2}__pagination`]: true,
24086
+ [`${classPrefix2}__pagination-vertical`]: isVertical
24087
+ }),
24088
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
24089
+ Indicator,
24181
24090
  {
24182
- style: (active + childCount) % childCount === index ? {
24183
- backgroundColor: propSwiper.paginationColor
24184
- } : {
24185
- backgroundColor: propSwiper.paginationBgColor
24186
- },
24187
- className: classNames({
24188
- active: (active + childCount) % childCount === index
24189
- })
24190
- },
24191
- index
24192
- );
24193
- })
24194
- }
24195
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: pageContent })
24196
- ] }) });
24091
+ current: (active + childCount) % childCount,
24092
+ total: childs == null ? void 0 : childs.length,
24093
+ direction
24094
+ }
24095
+ )
24096
+ }
24097
+ );
24098
+ }
24099
+ return null;
24100
+ };
24101
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(DataContext$1.Provider, { value: parent, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
24102
+ "div",
24103
+ {
24104
+ className: classNames(classPrefix2, className),
24105
+ ref: container,
24106
+ ...rest,
24107
+ children: [
24108
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: contentClass, ref: innerRef, children: React__default.Children.map(childs, (child, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(
24109
+ "div",
24110
+ {
24111
+ className: `${classPrefix2}__item-wrapper`,
24112
+ style: getItemStyle(index),
24113
+ children: child
24114
+ },
24115
+ index
24116
+ )) }),
24117
+ renderIndicator()
24118
+ ]
24119
+ }
24120
+ ) });
24197
24121
  });
24198
- Swiper.defaultProps = defaultProps$h;
24122
+ Swiper.defaultProps = defaultProps$g;
24199
24123
  Swiper.displayName = "NutSwiper";
24200
- const defaultProps$g = {
24124
+ const defaultProps$f = {
24201
24125
  direction: "horizontal"
24202
24126
  };
24203
24127
  const SwiperItem = React__default.forwardRef((props, ref) => {
24204
- const _props = { ...defaultProps$g, ...props };
24128
+ const _props = { ...defaultProps$f, ...props };
24205
24129
  const { className, style, children, direction, size } = _props;
24206
24130
  const parent = useContext(DataContext$1);
24207
24131
  const b = cn("swiper-item");
@@ -24217,16 +24141,16 @@ const SwiperItem = React__default.forwardRef((props, ref) => {
24217
24141
  };
24218
24142
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes, style: { ...style, ...getStyle() }, children });
24219
24143
  });
24220
- SwiperItem.defaultProps = defaultProps$g;
24144
+ SwiperItem.defaultProps = defaultProps$f;
24221
24145
  SwiperItem.displayName = "NutSwiperItem";
24222
- const defaultProps$f = {
24146
+ const defaultProps$e = {
24223
24147
  images: [],
24224
24148
  videos: [],
24225
24149
  show: false,
24226
- autoplay: 3e3,
24150
+ autoPlay: 3e3,
24227
24151
  initNo: 1,
24228
24152
  contentClose: false,
24229
- paginationVisible: false,
24153
+ indicator: false,
24230
24154
  paginationColor: "#fff",
24231
24155
  onClose: () => {
24232
24156
  }
@@ -24238,8 +24162,8 @@ const ImagePreview = (props) => {
24238
24162
  show,
24239
24163
  initNo,
24240
24164
  paginationColor,
24241
- paginationVisible,
24242
- autoplay,
24165
+ indicator,
24166
+ autoPlay,
24243
24167
  contentClose,
24244
24168
  onClose
24245
24169
  } = props;
@@ -24388,16 +24312,18 @@ const ImagePreview = (props) => {
24388
24312
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
24389
24313
  Swiper,
24390
24314
  {
24391
- autoPlay: autoplay,
24315
+ autoPlay,
24392
24316
  className: "nut-imagepreview-swiper",
24393
24317
  loop: true,
24394
- isPreventDefault: false,
24395
- style: { display: showPop ? "block" : "none" },
24318
+ preventDefault: false,
24319
+ style: {
24320
+ display: showPop ? "block" : "none",
24321
+ "--nutui-indicator-color": paginationColor
24322
+ },
24396
24323
  direction: "horizontal",
24397
24324
  onChange: slideChangeEnd,
24398
- initPage: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
24399
- paginationColor,
24400
- paginationVisible,
24325
+ defaultValue: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
24326
+ indicator,
24401
24327
  children: (videos && videos.length > 0 ? videos.map((item, index) => {
24402
24328
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SwiperItem, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Video, { source: item.source, options: item.options }) }, index);
24403
24329
  }) : []).concat(
@@ -24425,41 +24351,8 @@ const ImagePreview = (props) => {
24425
24351
  }
24426
24352
  );
24427
24353
  };
24428
- ImagePreview.defaultProps = defaultProps$f;
24354
+ ImagePreview.defaultProps = defaultProps$e;
24429
24355
  ImagePreview.displayName = "NutImagePreview";
24430
- const defaultProps$e = {
24431
- total: 3,
24432
- current: 1,
24433
- direction: "horizontal"
24434
- };
24435
- const classPrefix = `nut-indicator`;
24436
- const Indicator = (props) => {
24437
- const { total, current, children, className, direction, ...rest } = {
24438
- ...defaultProps$e,
24439
- ...props
24440
- };
24441
- const classes = classNames({
24442
- [`${classPrefix}__vertical`]: direction === "vertical"
24443
- });
24444
- const renderElement = () => {
24445
- const childs = [];
24446
- for (let item = 1; item <= total; item++) {
24447
- childs.push(
24448
- item === current ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children || /* @__PURE__ */ jsxRuntimeExports.jsx(
24449
- "div",
24450
- {
24451
- className: `${classPrefix}__dot ${classPrefix}__active`
24452
- },
24453
- item
24454
- ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix}__dot` }, item)
24455
- );
24456
- }
24457
- return childs;
24458
- };
24459
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames(classes, className), ...rest, children: renderElement() });
24460
- };
24461
- Indicator.defaultProps = defaultProps$e;
24462
- Indicator.displayName = "NutIndicator";
24463
24356
  const initPositinoCache = (reaItemSize, length = 0) => {
24464
24357
  let index = 0;
24465
24358
  const positions = Array(length);
@@ -24875,33 +24768,34 @@ const Pagination = (props) => {
24875
24768
  Pagination.defaultProps = defaultProps$c;
24876
24769
  Pagination.displayName = "NutPagination";
24877
24770
  const defaultProps$b = {
24771
+ ...ComponentDefaults,
24878
24772
  price: 0,
24879
- needSymbol: true,
24880
24773
  symbol: "&yen;",
24881
- decimalDigits: 2,
24774
+ digits: 2,
24882
24775
  thousands: false,
24883
24776
  position: "before",
24884
24777
  size: "large",
24885
- className: ""
24778
+ line: false
24886
24779
  };
24887
24780
  const Price = (props) => {
24888
24781
  const {
24889
24782
  price,
24890
- needSymbol,
24891
24783
  symbol,
24892
- decimalDigits,
24784
+ digits,
24893
24785
  thousands,
24894
24786
  position,
24895
24787
  size,
24788
+ line,
24896
24789
  className,
24790
+ style,
24897
24791
  ...rest
24898
24792
  } = {
24899
24793
  ...defaultProps$b,
24900
24794
  ...props
24901
24795
  };
24902
- const b = cn("price");
24796
+ const classPrefix2 = "nut-price";
24903
24797
  const showSymbol = () => {
24904
- return { __html: needSymbol ? symbol : "" };
24798
+ return { __html: symbol || "" };
24905
24799
  };
24906
24800
  const checkPoint = (price2) => {
24907
24801
  return String(price2).indexOf(".") > 0;
@@ -24911,7 +24805,7 @@ const Price = (props) => {
24911
24805
  num = 0;
24912
24806
  }
24913
24807
  if (checkPoint(num)) {
24914
- num = Number(num).toFixed(decimalDigits);
24808
+ num = Number(num).toFixed(digits);
24915
24809
  num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
24916
24810
  } else {
24917
24811
  num = num.toString();
@@ -24926,31 +24820,57 @@ const Price = (props) => {
24926
24820
  decimalNum = 0;
24927
24821
  }
24928
24822
  if (checkPoint(decimalNum)) {
24929
- decimalNum = Number(decimalNum).toFixed(decimalDigits);
24823
+ decimalNum = Number(decimalNum).toFixed(digits);
24930
24824
  decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] || 0;
24931
24825
  } else {
24932
24826
  decimalNum = 0;
24933
24827
  }
24934
24828
  const result = `0.${decimalNum}`;
24935
- const resultFixed = Number(result).toFixed(decimalDigits);
24829
+ const resultFixed = Number(result).toFixed(digits);
24936
24830
  return String(resultFixed).substring(2, resultFixed.length);
24937
24831
  };
24938
24832
  const renderSymbol = () => {
24939
24833
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
24940
24834
  "div",
24941
24835
  {
24942
- className: `${b("symbol")} ${b(`symbol-${size}`)}`,
24836
+ className: `${classPrefix2}__symbol ${classPrefix2}__symbol-${size}`,
24943
24837
  dangerouslySetInnerHTML: showSymbol()
24944
24838
  }
24945
24839
  );
24946
24840
  };
24947
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${b()} ${className}`, ...rest, children: [
24948
- needSymbol && position === "before" ? renderSymbol() : null,
24949
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${b("integer")} ${b(`integer-${size}`)}`, children: formatThousands(price) }),
24950
- decimalDigits !== 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${b("decimal")} ${b(`decimal-${size}`)}`, children: "." }) : null,
24951
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${b("decimal")} ${b(`decimal-${size}`)}`, children: formatDecimal(price) }),
24952
- needSymbol && position === "after" ? renderSymbol() : null
24953
- ] });
24841
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
24842
+ "div",
24843
+ {
24844
+ className: `${classPrefix2} ${className} ${line ? `${classPrefix2}--line` : ""}`,
24845
+ style,
24846
+ ...rest,
24847
+ children: [
24848
+ symbol && position === "before" ? renderSymbol() : null,
24849
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
24850
+ "div",
24851
+ {
24852
+ className: `${classPrefix2}__integer ${classPrefix2}__integer-${size}`,
24853
+ children: formatThousands(price)
24854
+ }
24855
+ ),
24856
+ digits !== 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
24857
+ "div",
24858
+ {
24859
+ className: `${classPrefix2}__decimal ${classPrefix2}__decimal-${size}`,
24860
+ children: "."
24861
+ }
24862
+ ) : null,
24863
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
24864
+ "div",
24865
+ {
24866
+ className: `${classPrefix2}__decimal ${classPrefix2}__decimal-${size}`,
24867
+ children: formatDecimal(price)
24868
+ }
24869
+ ),
24870
+ symbol && position === "after" ? renderSymbol() : null
24871
+ ]
24872
+ }
24873
+ );
24954
24874
  };
24955
24875
  Price.defaultProps = defaultProps$b;
24956
24876
  Price.displayName = "NutPrice";