@nutui/nutui-react 2.5.2 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -5
  2. package/dist/esm/Form/style/style.css +1 -1
  3. package/dist/esm/Image.js +1 -1
  4. package/dist/esm/ImagePreview/style/style.css +1 -1
  5. package/dist/esm/ImagePreview.js +16 -20
  6. package/dist/esm/Indicator.js +25 -1
  7. package/dist/esm/SideNavBar.js +1 -1
  8. package/dist/esm/SubSideNavBar.js +1 -1
  9. package/dist/esm/Swiper/style/index.js +0 -1
  10. package/dist/esm/Swiper/style/style.css +1 -1
  11. package/dist/esm/Swiper.js +273 -306
  12. package/dist/esm/SwiperItem.js +6 -18
  13. package/dist/esm/context4.js +16 -2
  14. package/dist/esm/use-touch.js +13 -3
  15. package/dist/locales/base.js +1 -1
  16. package/dist/locales/en-US.js +1 -1
  17. package/dist/locales/id-ID.js +1 -1
  18. package/dist/locales/tr-TR.js +1 -1
  19. package/dist/locales/zh-CN.js +1 -1
  20. package/dist/locales/zh-TW.js +1 -1
  21. package/dist/locales/zh-UG.js +1 -1
  22. package/dist/nutui.react.es.js +404 -396
  23. package/dist/nutui.react.umd.js +404 -396
  24. package/dist/packages/form/form.scss +0 -3
  25. package/dist/packages/swiper/swiper.scss +30 -16
  26. package/dist/style.css +1 -1
  27. package/dist/style.mjs +1 -1
  28. package/dist/types/packages/input/input.taro.d.ts +1 -1
  29. package/dist/types/packages/swiper/effects/default.d.ts +11 -0
  30. package/dist/types/packages/swiper/effects/focus.d.ts +21 -0
  31. package/dist/types/packages/swiper/index.d.ts +4 -2
  32. package/dist/types/packages/swiper/swiper.d.ts +24 -43
  33. package/dist/types/packages/swiper/types.d.ts +6 -0
  34. package/dist/types/packages/swiperitem/swiperitem.d.ts +8 -4
  35. package/dist/types/utils/use-ref-state.d.ts +3 -0
  36. package/dist/types/utils/use-touch.d.ts +3 -1
  37. package/package.json +1 -1
  38. package/dist/esm/context5.js +0 -19
  39. package/dist/esm/indicator2.js +0 -28
  40. package/dist/types/packages/picker/doc.en.d.ts +0 -145
@@ -18,16 +18,20 @@ function useTouch() {
18
18
  const offsetX = useRef(0);
19
19
  const offsetY = useRef(0);
20
20
  const direction = useRef("");
21
- const touchTime = useRef(null);
21
+ const last = useRef(false);
22
+ const velocity = useRef(0);
23
+ const touchTime = useRef(Date.now());
22
24
  const isVertical = () => direction.current === "vertical";
23
25
  const isHorizontal = () => direction.current === "horizontal";
24
26
  const reset = () => {
25
- touchTime.current = null;
27
+ touchTime.current = Date.now();
26
28
  deltaX.current = 0;
27
29
  deltaY.current = 0;
28
30
  offsetX.current = 0;
29
31
  offsetY.current = 0;
32
+ delta.current = 0;
30
33
  direction.current = "";
34
+ last.current = false;
31
35
  };
32
36
  const start = (event) => {
33
37
  reset();
@@ -46,7 +50,12 @@ function useTouch() {
46
50
  direction.current = getDirection(offsetX.current, offsetY.current);
47
51
  }
48
52
  };
53
+ const end = (event) => {
54
+ last.current = true;
55
+ velocity.current = Math.sqrt(Math.pow(deltaX.current, 2) + Math.pow(deltaY.current, 2)) / (Date.now() - touchTime.current);
56
+ };
49
57
  return {
58
+ end,
50
59
  move,
51
60
  start,
52
61
  reset,
@@ -60,7 +69,8 @@ function useTouch() {
60
69
  offsetY,
61
70
  direction,
62
71
  isVertical,
63
- isHorizontal
72
+ isHorizontal,
73
+ last
64
74
  };
65
75
  }
66
76
  export {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:20:10 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.0 Fri Apr 12 2024 16:17:12 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:20:10 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.0 Fri Apr 12 2024 16:17:12 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:20:10 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.0 Fri Apr 12 2024 16:17:12 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:20:10 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.0 Fri Apr 12 2024 16:17:12 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:20:10 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.0 Fri Apr 12 2024 16:17:12 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:20:10 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.0 Fri Apr 12 2024 16:17:12 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.5.2 Wed Apr 03 2024 18:20:10 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.0 Fri Apr 12 2024 16:17:12 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */