@nutui/nutui-react-taro 1.4.4 → 1.4.5

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 (219) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/esm/Address.js +5 -5
  3. package/dist/esm/Audio.js +5 -5
  4. package/dist/esm/AvatarContext-7153ad2b.js +3 -1
  5. package/dist/esm/AvatarGroup.js +4 -4
  6. package/dist/esm/Calendar.js +5 -5
  7. package/dist/esm/CalendarItem.js +4 -4
  8. package/dist/esm/Card.js +4 -3
  9. package/dist/esm/Cell.js +2 -2
  10. package/dist/esm/ConfigProvider.js +3 -3
  11. package/dist/esm/CountDown.js +4 -4
  12. package/dist/esm/DatePicker.js +5 -5
  13. package/dist/esm/Dialog.js +4 -4
  14. package/dist/esm/Ellipsis.js +4 -4
  15. package/dist/esm/Empty.js +4 -4
  16. package/dist/esm/FixedNav.js +4 -4
  17. package/dist/esm/Form.js +4 -4
  18. package/dist/esm/FormItem.js +3 -3
  19. package/dist/esm/Grid.js +4 -4
  20. package/dist/esm/GridItem.js +4 -4
  21. package/dist/esm/Image.js +4 -4
  22. package/dist/esm/Infiniteloading.js +4 -4
  23. package/dist/esm/Input.js +4 -4
  24. package/dist/esm/MenuItem.js +4 -4
  25. package/dist/esm/NoticeBar.js +2 -2
  26. package/dist/esm/NumberKeyboard.js +4 -4
  27. package/dist/esm/Pagination.js +4 -4
  28. package/dist/esm/Picker.js +4 -4
  29. package/dist/esm/PullToRefresh.js +4 -4
  30. package/dist/esm/Range.js +4 -4
  31. package/dist/esm/SearchBar.js +4 -4
  32. package/dist/esm/ShortPassword.js +4 -4
  33. package/dist/esm/SideNavBar.js +4 -4
  34. package/dist/esm/Signature.js +4 -4
  35. package/dist/esm/Sticky.js +4 -4
  36. package/dist/esm/Table.js +4 -4
  37. package/dist/esm/Tag.js +3 -2
  38. package/dist/esm/TextArea.js +4 -4
  39. package/dist/esm/TimeDetail.js +4 -4
  40. package/dist/esm/TimePannel.js +4 -4
  41. package/dist/esm/TimeSelect.js +6 -6
  42. package/dist/esm/Uploader.js +4 -4
  43. package/dist/esm/UserContext-68f62e66.js +3 -1
  44. package/dist/esm/UserContext-b4181162.js +3 -1
  45. package/dist/esm/UserContext-be8097d2.js +3 -1
  46. package/dist/esm/VirtualList.js +6 -4
  47. package/dist/esm/WaterMark.js +4 -4
  48. package/dist/esm/actionsheet.taro-a58d3d12.js +45 -83
  49. package/dist/esm/address.taro-79cc7c96.js +461 -0
  50. package/dist/esm/animate.taro-b0e83dd5.js +32 -46
  51. package/dist/esm/animatingnumbers.taro-6f40a2e9.js +93 -134
  52. package/dist/esm/audio.taro-4fadc583.js +161 -0
  53. package/dist/esm/avatar.taro-85ced995.js +93 -119
  54. package/dist/esm/avatargroup-1d900174.js +34 -0
  55. package/dist/esm/backtop.taro-99107c30.js +39 -62
  56. package/dist/esm/badge.taro-fe9171ec.js +40 -58
  57. package/dist/esm/barrage.taro-0e157b5e.js +61 -91
  58. package/dist/esm/bem-893ad28d.js +3 -6
  59. package/dist/esm/button.taro-4ce133b9.js +87 -98
  60. package/dist/esm/calendar.taro-4ed72058.js +38 -0
  61. package/dist/esm/calendaritem.taro-1ebe428d.js +571 -0
  62. package/dist/esm/card.taro-39055e82.js +32 -0
  63. package/dist/esm/cascader.taro-d8cb1c3e.js +397 -636
  64. package/dist/esm/cell.taro-9a04a92e.js +64 -0
  65. package/dist/esm/cellgroup.taro-e094471c.js +18 -27
  66. package/dist/esm/checkbox.taro-0bda9796.js +160 -232
  67. package/dist/esm/circleprogress.taro-47db537c.js +99 -120
  68. package/dist/esm/col.taro-b61c7cba.js +33 -50
  69. package/dist/esm/collapse.taro-af58206c.js +73 -86
  70. package/dist/esm/collapseitem-ce1849d2.js +75 -139
  71. package/dist/esm/configprovider-5eea4f5d.js +19 -0
  72. package/dist/esm/configprovider.taro-26882dd2.js +42 -0
  73. package/dist/esm/countdown.taro-9e40de9c.js +225 -0
  74. package/dist/esm/datepicker.taro-7220e495.js +270 -0
  75. package/dist/esm/dialog.taro-1c03960e.js +123 -0
  76. package/dist/esm/divider.taro-5236fe6a.js +27 -27
  77. package/dist/esm/drag.taro-82b6b27a.js +99 -138
  78. package/dist/esm/elevator.taro-d7d65470.js +185 -259
  79. package/dist/esm/ellipsis.taro-49b6db0c.js +232 -0
  80. package/dist/esm/empty.taro-7bd813f9.js +62 -0
  81. package/dist/esm/fixednav.taro-5ad15202.js +53 -0
  82. package/dist/esm/form.taro-71d32671.js +179 -0
  83. package/dist/esm/formitem.taro-3089489b.js +89 -0
  84. package/dist/esm/grid.taro-e6decfce.js +58 -0
  85. package/dist/esm/grid.taro.context-39636af9.js +4 -2
  86. package/dist/esm/griditem.taro-4cade72e.js +90 -0
  87. package/dist/esm/icon-8dc4de10.js +43 -51
  88. package/dist/esm/icon.taro-1d0d4fb7.js +43 -51
  89. package/dist/esm/image.taro-e6dc5867.js +64 -0
  90. package/dist/esm/imagepreview.taro-3400ea03.js +158 -205
  91. package/dist/esm/index.taro-a36f96fb.js +149 -210
  92. package/dist/esm/indicator.taro-183ea169.js +29 -43
  93. package/dist/esm/infiniteloading.taro-6c2a2e95.js +142 -0
  94. package/dist/esm/input.taro-fd566407.js +243 -0
  95. package/dist/esm/inputnumber.taro-dc39b853.js +129 -177
  96. package/dist/esm/layout.taro-358f014f.js +6 -9
  97. package/dist/esm/menu.taro-4abed328.js +89 -132
  98. package/dist/esm/menuitem.taro-6e8b27c3.js +130 -0
  99. package/dist/esm/navbar.taro-c931c078.js +69 -105
  100. package/dist/esm/noticebar.taro-69ea7673.js +450 -0
  101. package/dist/esm/notify.taro-308e5892.js +66 -97
  102. package/dist/esm/numberkeyboard.taro-194519e4.js +158 -0
  103. package/dist/esm/nutui-react.es.js +44 -44
  104. package/dist/esm/offsetContext-bfb02c25.js +3 -1
  105. package/dist/esm/overlay.taro-98367bc1.js +59 -74
  106. package/dist/esm/pagination.taro-bb490de9.js +124 -0
  107. package/dist/esm/picker.taro-2a8ded7c.js +420 -0
  108. package/dist/esm/popover.taro-46d813e8.js +132 -222
  109. package/dist/esm/popup.taro-cb777e09.js +125 -178
  110. package/dist/esm/price.taro-8801462e.js +75 -86
  111. package/dist/esm/progress.taro-623bc807.js +84 -118
  112. package/dist/esm/pulltorefresh.taro-cab7b51c.js +221 -0
  113. package/dist/esm/range.taro-5d6ff217.js +332 -0
  114. package/dist/esm/rate.taro-10197384.js +64 -111
  115. package/dist/esm/row.taro-37a895de.js +38 -42
  116. package/dist/esm/searchbar.taro-839dd622.js +148 -0
  117. package/dist/esm/shortpassword.taro-182d46f7.js +111 -0
  118. package/dist/esm/sidenavbar.taro-006cf38b.js +35 -0
  119. package/dist/esm/sidenavbaritem.taro-fee11d26.js +9 -22
  120. package/dist/esm/signature.taro-33632585.js +143 -0
  121. package/dist/esm/skeleton.taro-853ce460.js +51 -88
  122. package/dist/esm/step.taro-1c94e067.js +49 -78
  123. package/dist/esm/steps.taro-acf205a0.js +21 -30
  124. package/dist/esm/sticky.taro-d0553f48.js +13 -0
  125. package/dist/esm/subsidenavbar.taro-f46b4c73.js +58 -75
  126. package/dist/esm/swipe.taro-83bc248f.js +164 -254
  127. package/dist/esm/swiper.taro-852f6615.js +424 -505
  128. package/dist/esm/swiperitem-86a3578a.js +20 -28
  129. package/dist/esm/switch.taro-bae2dca0.js +43 -64
  130. package/dist/esm/tabbar.taro-86cece39.js +47 -57
  131. package/dist/esm/tabbaritem.taro-8dfb8055.js +51 -79
  132. package/dist/esm/table.taro-cb4dd2c3.js +92 -0
  133. package/dist/esm/tabpane.taro-91cd6cf4.js +17 -22
  134. package/dist/esm/tabs.taro-e71875fa.js +121 -165
  135. package/dist/esm/tag.taro-00fe554d.js +89 -0
  136. package/dist/esm/textarea.taro-42600f8c.js +74 -0
  137. package/dist/esm/timedetail.taro-c5f564fd.js +44 -0
  138. package/dist/esm/timepannel.taro-29f9dd86.js +22 -0
  139. package/dist/esm/timeselect.taro-3ecce65d.js +133 -0
  140. package/dist/esm/toast.taro-0804b6b4.js +99 -137
  141. package/dist/esm/trendarrow.taro-5a7153e4.js +63 -90
  142. package/dist/esm/types/src/packages/cell/cell.taro.d.ts +0 -1
  143. package/dist/esm/types/src/packages/noticebar/noticebar.d.ts +5 -4
  144. package/dist/esm/types/src/packages/noticebar/noticebar.taro.d.ts +5 -4
  145. package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -1
  146. package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +13 -2
  147. package/dist/esm/typings-1c5f2628.js +7 -6
  148. package/dist/esm/uploader.taro-f80d76d9.js +392 -0
  149. package/dist/esm/useClientRect-bf69d7b3.js +5 -25
  150. package/dist/esm/useTouch-a2ea68c6.js +63 -93
  151. package/dist/esm/video-8a3518c5.js +59 -83
  152. package/dist/esm/virtuallist.taro-e3345ced.js +215 -0
  153. package/dist/esm/watermark.taro-cd9db98a.js +114 -0
  154. package/dist/esm/zh-CN-dfc384d0.js +128 -133
  155. package/dist/locales/base.js +1 -1
  156. package/dist/locales/en-US.js +1 -1
  157. package/dist/locales/id-ID.js +1 -1
  158. package/dist/locales/zh-CN.js +1 -1
  159. package/dist/locales/zh-TW.js +1 -1
  160. package/dist/locales/zh-UG.js +1 -1
  161. package/dist/nutui.react.es.js +634 -5664
  162. package/dist/nutui.react.umd.js +634 -5664
  163. package/dist/packages/noticebar/noticebar.scss +17 -0
  164. package/dist/packages/radio/radio.scss +3 -1
  165. package/dist/packages/row/row.scss +2 -0
  166. package/dist/packages/searchbar/searchbar.scss +1 -1
  167. package/dist/packages/tag/tag.scss +13 -5
  168. package/dist/packages/virtuallist/virtuallist.scss +24 -0
  169. package/dist/style.css +1 -1
  170. package/dist/style.es.js +1 -1
  171. package/dist/styles/temp.scss +2340 -0
  172. package/dist/styles/theme-dark.scss +7 -0
  173. package/dist/styles/theme-default.scss +11 -0
  174. package/dist/styles/variables.scss +1945 -710
  175. package/dist/types/index.d.ts +16 -23
  176. package/package.json +9 -4
  177. package/dist/esm/address.taro-1e2aea24.js +0 -615
  178. package/dist/esm/audio.taro-fddcdfc0.js +0 -228
  179. package/dist/esm/avatargroup-f7f600ff.js +0 -42
  180. package/dist/esm/calendar.taro-72974415.js +0 -83
  181. package/dist/esm/calendaritem.taro-84e889eb.js +0 -580
  182. package/dist/esm/card.taro-a530dfb3.js +0 -61
  183. package/dist/esm/cell.taro-cf50c4f2.js +0 -109
  184. package/dist/esm/configprovider-c7d60e20.js +0 -18
  185. package/dist/esm/configprovider.taro-8bdb3a28.js +0 -50
  186. package/dist/esm/countdown.taro-d7dc8681.js +0 -246
  187. package/dist/esm/datepicker.taro-7199f521.js +0 -304
  188. package/dist/esm/dialog.taro-f54cfbf0.js +0 -187
  189. package/dist/esm/ellipsis.taro-c0de6ff4.js +0 -309
  190. package/dist/esm/empty.taro-dbc66496.js +0 -81
  191. package/dist/esm/fixednav.taro-9e759320.js +0 -97
  192. package/dist/esm/form.taro-880014b1.js +0 -181
  193. package/dist/esm/formitem.taro-3695f4a7.js +0 -136
  194. package/dist/esm/grid.taro-c2cc12d6.js +0 -81
  195. package/dist/esm/griditem.taro-892153cd.js +0 -122
  196. package/dist/esm/image.taro-c30973d5.js +0 -105
  197. package/dist/esm/infiniteloading.taro-b5ddf3cc.js +0 -188
  198. package/dist/esm/input.taro-104130c1.js +0 -361
  199. package/dist/esm/menuitem.taro-216e9f7d.js +0 -193
  200. package/dist/esm/noticebar.taro-94002898.js +0 -368
  201. package/dist/esm/numberkeyboard.taro-5e8f0ddf.js +0 -245
  202. package/dist/esm/pagination.taro-9925ffab.js +0 -169
  203. package/dist/esm/picker.taro-3b5cc054.js +0 -540
  204. package/dist/esm/pulltorefresh.taro-f26a20dd.js +0 -302
  205. package/dist/esm/range.taro-c41e9b90.js +0 -469
  206. package/dist/esm/searchbar.taro-01ed4ea4.js +0 -236
  207. package/dist/esm/shortpassword.taro-3a3bf412.js +0 -190
  208. package/dist/esm/sidenavbar.taro-06026f31.js +0 -66
  209. package/dist/esm/signature.taro-17648cac.js +0 -192
  210. package/dist/esm/sticky.taro-36013e97.js +0 -16
  211. package/dist/esm/table.taro-adda6622.js +0 -139
  212. package/dist/esm/tag.taro-bd900990.js +0 -104
  213. package/dist/esm/textarea.taro-83d5fe73.js +0 -102
  214. package/dist/esm/timedetail.taro-105f5380.js +0 -68
  215. package/dist/esm/timepannel.taro-c66c63dd.js +0 -30
  216. package/dist/esm/timeselect.taro-fc7ec6ee.js +0 -172
  217. package/dist/esm/uploader.taro-a1edf38f.js +0 -529
  218. package/dist/esm/virtuallist.taro-4add61c3.js +0 -315
  219. package/dist/esm/watermark.taro-323d1cf3.js +0 -132
@@ -1,149 +1,110 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["attract", "direction", "boundary", "children", "className", "style"];
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
1
  import React__default, { useState, useRef, useEffect } from 'react';
8
2
  import Taro from '@tarojs/taro';
9
3
  import { c as cn } from './bem-893ad28d.js';
10
- var defaultProps = {
11
- attract: false,
12
- direction: undefined,
13
- boundary: {
14
- top: 0,
15
- left: 0,
16
- right: 0,
17
- bottom: 0
18
- },
19
- className: 'myDrag'
4
+
5
+ const defaultProps = {
6
+ attract: false,
7
+ direction: undefined,
8
+ boundary: {
9
+ top: 0,
10
+ left: 0,
11
+ right: 0,
12
+ bottom: 0,
13
+ },
14
+ className: 'myDrag',
20
15
  };
21
- var Drag = function Drag(props) {
22
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
23
- attract = _defaultProps$props.attract,
24
- direction = _defaultProps$props.direction,
25
- boundary = _defaultProps$props.boundary,
26
- children = _defaultProps$props.children,
27
- className = _defaultProps$props.className,
28
- style = _defaultProps$props.style,
29
- reset = _objectWithoutProperties(_defaultProps$props, _excluded);
30
- var b = cn('drag');
31
- var _useState = useState(boundary),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- boundaryState = _useState2[0],
34
- setBoundaryState = _useState2[1];
35
- var myDrag = useRef(null);
36
- var dragRef = useRef(null);
37
- var _useState3 = useState({}),
38
- _useState4 = _slicedToArray(_useState3, 2),
39
- currstyle = _useState4[0],
40
- setCurrStyle = _useState4[1];
41
- var timer = useRef(0);
42
- var axisCache = useRef({
43
- x: 0,
44
- y: 0
45
- });
46
- var transformCache = useRef({
47
- x: 0,
48
- y: 0
49
- });
50
- var translateX = useRef(0);
51
- var translateY = useRef(0);
52
- var middleLine = useRef(0);
53
- var getInfo = function getInfo() {
54
- var el = myDrag.current;
55
- if (el) {
56
- var top = boundary.top,
57
- left = boundary.left,
58
- bottom = boundary.bottom,
59
- right = boundary.right;
60
- var _Taro$getSystemInfoSy = Taro.getSystemInfoSync(),
61
- screenWidth = _Taro$getSystemInfoSy.screenWidth,
62
- windowHeight = _Taro$getSystemInfoSy.windowHeight;
63
- Taro.createSelectorQuery().select(".".concat(className)).boundingClientRect(function (rec) {
64
- setBoundaryState({
65
- top: -rec.top + top,
66
- left: -rec.left + left,
67
- bottom: windowHeight - rec.height - rec.top - bottom,
68
- right: screenWidth - rec.width - rec.left - right
69
- });
70
- middleLine.current = screenWidth - rec.width - rec.left - (screenWidth - rec.width) / 2;
71
- }).exec();
72
- }
73
- };
74
- var touchStart = function touchStart(e) {
75
- e.currentTarget;
76
- var touches = e.touches[0];
77
- axisCache.current = {
78
- x: touches.clientX,
79
- y: touches.clientY
16
+ const Drag = (props) => {
17
+ const { attract, direction, boundary, children, className, style, ...reset } = {
18
+ ...defaultProps,
19
+ ...props,
80
20
  };
81
- transformCache.current = {
82
- x: translateX.current,
83
- y: translateY.current
21
+ const b = cn('drag');
22
+ const [boundaryState, setBoundaryState] = useState(boundary);
23
+ const myDrag = useRef(null);
24
+ const dragRef = useRef(null);
25
+ const [currstyle, setCurrStyle] = useState({});
26
+ const timer = useRef(0);
27
+ const axisCache = useRef({ x: 0, y: 0 });
28
+ const transformCache = useRef({ x: 0, y: 0 });
29
+ const translateX = useRef(0);
30
+ const translateY = useRef(0);
31
+ const middleLine = useRef(0);
32
+ const getInfo = () => {
33
+ const el = myDrag.current;
34
+ if (el) {
35
+ const { top, left, bottom, right } = boundary;
36
+ const { screenWidth, windowHeight } = Taro.getSystemInfoSync();
37
+ Taro.createSelectorQuery()
38
+ .select(`.${className}`)
39
+ .boundingClientRect((rec) => {
40
+ setBoundaryState({
41
+ top: -rec.top + top,
42
+ left: -rec.left + left,
43
+ bottom: windowHeight - rec.height - rec.top - bottom,
44
+ right: screenWidth - rec.width - rec.left - right,
45
+ });
46
+ middleLine.current =
47
+ screenWidth - rec.width - rec.left - (screenWidth - rec.width) / 2;
48
+ })
49
+ .exec();
50
+ }
84
51
  };
85
- };
86
- var touchMove = function touchMove(e) {
87
- if (e.touches.length === 1 && dragRef.current) {
88
- var touch = e.touches[0];
89
- var x = touch.clientX - axisCache.current.x;
90
- var y = touch.clientY - axisCache.current.y;
91
- translateX.current = x + transformCache.current.x;
92
- translateY.current = y + transformCache.current.y;
93
- // 边界判断
94
- if (translateX.current < boundaryState.left) {
95
- translateX.current = boundaryState.left;
96
- } else if (translateX.current > boundaryState.right) {
97
- translateX.current = boundaryState.right;
98
- }
99
- if (translateY.current < boundaryState.top) {
100
- translateY.current = boundaryState.top;
101
- } else if (translateY.current > boundaryState.bottom) {
102
- translateY.current = boundaryState.bottom;
103
- }
104
- var transform = "translate3d(".concat(props.direction !== 'y' ? translateX.current : 0, "px, ").concat(props.direction !== 'x' ? translateY.current : 0, "px, 0px)");
105
- setCurrStyle({
106
- transform: transform
107
- });
108
- }
109
- };
110
- var touchEnd = function touchEnd(e) {
111
- if (props.direction !== 'y' && props.attract && dragRef.current) {
112
- if (translateX.current < middleLine.current) {
113
- translateX.current = boundaryState.left;
114
- } else {
115
- translateX.current = boundaryState.right;
116
- }
117
- var transform = "translate3d(".concat(translateX.current, "px, ").concat(props.direction !== 'x' ? translateY.current : 0, "px, 0px)");
118
- setCurrStyle({
119
- transform: transform
120
- });
121
- }
122
- };
123
- useEffect(function () {
124
- timer.current = window.setTimeout(function () {
125
- getInfo();
126
- }, 300);
127
- return function () {
128
- clearTimeout(timer.current);
52
+ const touchStart = (e) => {
53
+ e.currentTarget;
54
+ const touches = e.touches[0];
55
+ axisCache.current = { x: touches.clientX, y: touches.clientY };
56
+ transformCache.current = { x: translateX.current, y: translateY.current };
129
57
  };
130
- }, []);
131
- return React__default.createElement("div", _objectSpread(_objectSpread({
132
- style: style,
133
- className: "".concat(b(), " ").concat(className)
134
- }, reset), {}, {
135
- ref: myDrag
136
- }), React__default.createElement("div", {
137
- onTouchStart: function onTouchStart(event) {
138
- return touchStart(event);
139
- },
140
- ref: dragRef,
141
- onTouchMove: touchMove,
142
- onTouchEnd: touchEnd,
143
- // eslint-disable-next-line react/no-unknown-property
144
- style: currstyle
145
- }, children));
58
+ const touchMove = (e) => {
59
+ if (e.touches.length === 1 && dragRef.current) {
60
+ const touch = e.touches[0];
61
+ const x = touch.clientX - axisCache.current.x;
62
+ const y = touch.clientY - axisCache.current.y;
63
+ translateX.current = x + transformCache.current.x;
64
+ translateY.current = y + transformCache.current.y;
65
+ // 边界判断
66
+ if (translateX.current < boundaryState.left) {
67
+ translateX.current = boundaryState.left;
68
+ }
69
+ else if (translateX.current > boundaryState.right) {
70
+ translateX.current = boundaryState.right;
71
+ }
72
+ if (translateY.current < boundaryState.top) {
73
+ translateY.current = boundaryState.top;
74
+ }
75
+ else if (translateY.current > boundaryState.bottom) {
76
+ translateY.current = boundaryState.bottom;
77
+ }
78
+ const transform = `translate3d(${props.direction !== 'y' ? translateX.current : 0}px, ${props.direction !== 'x' ? translateY.current : 0}px, 0px)`;
79
+ setCurrStyle({ transform });
80
+ }
81
+ };
82
+ const touchEnd = (e) => {
83
+ if (props.direction !== 'y' && props.attract && dragRef.current) {
84
+ if (translateX.current < middleLine.current) {
85
+ translateX.current = boundaryState.left;
86
+ }
87
+ else {
88
+ translateX.current = boundaryState.right;
89
+ }
90
+ const transform = `translate3d(${translateX.current}px, ${props.direction !== 'x' ? translateY.current : 0}px, 0px)`;
91
+ setCurrStyle({ transform });
92
+ }
93
+ };
94
+ useEffect(() => {
95
+ timer.current = window.setTimeout(() => {
96
+ getInfo();
97
+ }, 300);
98
+ return () => {
99
+ clearTimeout(timer.current);
100
+ };
101
+ }, []);
102
+ return (React__default.createElement("div", { style: style, className: `${b()} ${className}`, ...reset, ref: myDrag },
103
+ React__default.createElement("div", { onTouchStart: (event) => touchStart(event), ref: dragRef, onTouchMove: touchMove, onTouchEnd: touchEnd,
104
+ // eslint-disable-next-line react/no-unknown-property
105
+ style: currstyle }, children)));
146
106
  };
147
107
  Drag.defaultProps = defaultProps;
148
108
  Drag.displayName = 'NutDrag';
109
+
149
110
  export { Drag as D };