@nutui/nutui-react 2.5.1 → 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 (46) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/esm/CalendarCard.js +1 -1
  3. package/dist/esm/Form/style/style.css +1 -1
  4. package/dist/esm/Image.js +1 -1
  5. package/dist/esm/ImagePreview/style/style.css +1 -1
  6. package/dist/esm/ImagePreview.js +16 -20
  7. package/dist/esm/Indicator.js +25 -1
  8. package/dist/esm/Radio/style/style.css +1 -1
  9. package/dist/esm/RadioGroup/style/style.css +1 -1
  10. package/dist/esm/SideNavBar.js +1 -1
  11. package/dist/esm/SubSideNavBar.js +1 -1
  12. package/dist/esm/Swiper/style/index.js +0 -1
  13. package/dist/esm/Swiper/style/style.css +1 -1
  14. package/dist/esm/Swiper.js +273 -306
  15. package/dist/esm/SwiperItem.js +6 -18
  16. package/dist/esm/context4.js +16 -2
  17. package/dist/esm/use-touch.js +13 -3
  18. package/dist/locales/base.js +1 -1
  19. package/dist/locales/en-US.js +1 -1
  20. package/dist/locales/id-ID.js +1 -1
  21. package/dist/locales/tr-TR.js +1 -1
  22. package/dist/locales/zh-CN.js +1 -1
  23. package/dist/locales/zh-TW.js +1 -1
  24. package/dist/locales/zh-UG.js +1 -1
  25. package/dist/nutui.react.es.js +952 -939
  26. package/dist/nutui.react.umd.js +956 -943
  27. package/dist/packages/form/form.scss +0 -3
  28. package/dist/packages/radiogroup/radiogroup.scss +1 -2
  29. package/dist/packages/swiper/swiper.scss +30 -16
  30. package/dist/style.css +1 -1
  31. package/dist/style.mjs +1 -1
  32. package/dist/styles/variables.scss +1 -1
  33. package/dist/types/packages/configprovider/types.d.ts +1 -1
  34. package/dist/types/packages/input/input.taro.d.ts +1 -1
  35. package/dist/types/packages/swiper/effects/default.d.ts +11 -0
  36. package/dist/types/packages/swiper/effects/focus.d.ts +21 -0
  37. package/dist/types/packages/swiper/index.d.ts +4 -2
  38. package/dist/types/packages/swiper/swiper.d.ts +24 -43
  39. package/dist/types/packages/swiper/types.d.ts +6 -0
  40. package/dist/types/packages/swiperitem/swiperitem.d.ts +8 -4
  41. package/dist/types/utils/use-ref-state.d.ts +3 -0
  42. package/dist/types/utils/use-touch.d.ts +3 -1
  43. package/package.json +1 -1
  44. package/dist/esm/context5.js +0 -19
  45. package/dist/esm/indicator2.js +0 -28
  46. 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.1 Fri Mar 29 2024 15:53:08 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.1 Fri Mar 29 2024 15:53:08 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.1 Fri Mar 29 2024 15:53:08 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.1 Fri Mar 29 2024 15:53:08 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.1 Fri Mar 29 2024 15:53:08 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.1 Fri Mar 29 2024 15:53:08 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.1 Fri Mar 29 2024 15:53:08 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
  */