@snack-uikit/carousel 0.4.6-preview-042f5ed6.0 → 0.4.6-preview-379c4ff3.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.
|
@@ -112,30 +112,17 @@ function ItemProvider(_ref) {
|
|
|
112
112
|
const fallbackWidth = Math.floor(100 / showItems);
|
|
113
113
|
return `${fallbackWidth}%`;
|
|
114
114
|
}, [computedValues.itemWidth, showItems]);
|
|
115
|
-
const canSwipe = (0, react_1.useRef)(true);
|
|
116
115
|
const [drag, setDrag] = (0, react_1.useState)({
|
|
117
116
|
drag: 0,
|
|
118
117
|
pointers: true
|
|
119
118
|
});
|
|
120
|
-
const handleSwipeStart = eventData => {
|
|
121
|
-
if (eventData.dir !== 'Right' && eventData.dir !== 'Left') {
|
|
122
|
-
canSwipe.current = false;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
119
|
const handleSwiping = eventData => {
|
|
126
|
-
if (!canSwipe.current) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
120
|
setDrag({
|
|
130
121
|
drag: eventData.deltaX,
|
|
131
122
|
pointers: Math.abs(eventData.deltaX) < Number.MIN_SAFE_INTEGER
|
|
132
123
|
});
|
|
133
124
|
};
|
|
134
125
|
const handleSwiped = eventData => {
|
|
135
|
-
if (!canSwipe.current) {
|
|
136
|
-
canSwipe.current = true;
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
126
|
if (Math.abs(drag.drag) < swipeActivateLength) {
|
|
140
127
|
return setDrag({
|
|
141
128
|
drag: 0,
|
|
@@ -150,7 +137,6 @@ function ItemProvider(_ref) {
|
|
|
150
137
|
return;
|
|
151
138
|
};
|
|
152
139
|
const _a = (0, utils_1.useSwipeable)({
|
|
153
|
-
onSwipeStart: handleSwipeStart,
|
|
154
140
|
onSwiping: handleSwiping,
|
|
155
141
|
onSwiped: handleSwiped,
|
|
156
142
|
trackMouse: true,
|
|
@@ -94,24 +94,11 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transi
|
|
|
94
94
|
const fallbackWidth = Math.floor(100 / showItems);
|
|
95
95
|
return `${fallbackWidth}%`;
|
|
96
96
|
}, [computedValues.itemWidth, showItems]);
|
|
97
|
-
const canSwipe = useRef(true);
|
|
98
97
|
const [drag, setDrag] = useState({ drag: 0, pointers: true });
|
|
99
|
-
const handleSwipeStart = eventData => {
|
|
100
|
-
if (eventData.dir !== 'Right' && eventData.dir !== 'Left') {
|
|
101
|
-
canSwipe.current = false;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
98
|
const handleSwiping = eventData => {
|
|
105
|
-
if (!canSwipe.current) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
99
|
setDrag({ drag: eventData.deltaX, pointers: Math.abs(eventData.deltaX) < Number.MIN_SAFE_INTEGER });
|
|
109
100
|
};
|
|
110
101
|
const handleSwiped = eventData => {
|
|
111
|
-
if (!canSwipe.current) {
|
|
112
|
-
canSwipe.current = true;
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
102
|
if (Math.abs(drag.drag) < swipeActivateLength) {
|
|
116
103
|
return setDrag({ drag: 0, pointers: true });
|
|
117
104
|
}
|
|
@@ -120,7 +107,6 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transi
|
|
|
120
107
|
return;
|
|
121
108
|
};
|
|
122
109
|
const _a = useSwipeable({
|
|
123
|
-
onSwipeStart: handleSwipeStart,
|
|
124
110
|
onSwiping: handleSwiping,
|
|
125
111
|
onSwiped: handleSwiped,
|
|
126
112
|
trackMouse: true,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.4.6-preview-
|
|
7
|
+
"version": "0.4.6-preview-379c4ff3.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@snack-uikit/icons": "0.24.1-preview-
|
|
40
|
-
"@snack-uikit/pagination": "0.9.4-preview-
|
|
41
|
-
"@snack-uikit/utils": "3.5.1-preview-
|
|
39
|
+
"@snack-uikit/icons": "0.24.1-preview-379c4ff3.0",
|
|
40
|
+
"@snack-uikit/pagination": "0.9.4-preview-379c4ff3.0",
|
|
41
|
+
"@snack-uikit/utils": "3.5.1-preview-379c4ff3.0",
|
|
42
42
|
"classnames": "2.5.1",
|
|
43
43
|
"lodash.debounce": "4.0.8",
|
|
44
44
|
"merge-refs": "1.3.0",
|
|
45
45
|
"uncontrollable": "8.0.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e0e768ac8f2e20d41a94b304b67c8541f304786f"
|
|
48
48
|
}
|
|
@@ -132,29 +132,13 @@ export function ItemProvider({
|
|
|
132
132
|
return `${fallbackWidth}%`;
|
|
133
133
|
}, [computedValues.itemWidth, showItems]);
|
|
134
134
|
|
|
135
|
-
const canSwipe = useRef(true);
|
|
136
135
|
const [drag, setDrag] = useState({ drag: 0, pointers: true });
|
|
137
136
|
|
|
138
|
-
const handleSwipeStart: SwipeCallback = eventData => {
|
|
139
|
-
if (eventData.dir !== 'Right' && eventData.dir !== 'Left') {
|
|
140
|
-
canSwipe.current = false;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
137
|
const handleSwiping: SwipeCallback = eventData => {
|
|
145
|
-
if (!canSwipe.current) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
138
|
setDrag({ drag: eventData.deltaX, pointers: Math.abs(eventData.deltaX) < Number.MIN_SAFE_INTEGER });
|
|
150
139
|
};
|
|
151
140
|
|
|
152
141
|
const handleSwiped: SwipeCallback = eventData => {
|
|
153
|
-
if (!canSwipe.current) {
|
|
154
|
-
canSwipe.current = true;
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
142
|
if (Math.abs(drag.drag) < swipeActivateLength) {
|
|
159
143
|
return setDrag({ drag: 0, pointers: true });
|
|
160
144
|
}
|
|
@@ -165,7 +149,6 @@ export function ItemProvider({
|
|
|
165
149
|
};
|
|
166
150
|
|
|
167
151
|
const { ref, ...swipeProps } = useSwipeable({
|
|
168
|
-
onSwipeStart: handleSwipeStart,
|
|
169
152
|
onSwiping: handleSwiping,
|
|
170
153
|
onSwiped: handleSwiped,
|
|
171
154
|
trackMouse: true,
|