@snack-uikit/carousel 0.4.6-preview-53bd8747.0 → 0.4.6-preview-042f5ed6.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.
|
@@ -118,40 +118,24 @@ function ItemProvider(_ref) {
|
|
|
118
118
|
pointers: true
|
|
119
119
|
});
|
|
120
120
|
const handleSwipeStart = eventData => {
|
|
121
|
-
if (!swipe) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
121
|
if (eventData.dir !== 'Right' && eventData.dir !== 'Left') {
|
|
125
122
|
canSwipe.current = false;
|
|
126
|
-
} else {
|
|
127
|
-
eventData.event.preventDefault();
|
|
128
|
-
eventData.event.stopPropagation();
|
|
129
123
|
}
|
|
130
124
|
};
|
|
131
125
|
const handleSwiping = eventData => {
|
|
132
|
-
if (!swipe) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
126
|
if (!canSwipe.current) {
|
|
136
127
|
return;
|
|
137
128
|
}
|
|
138
|
-
eventData.event.preventDefault();
|
|
139
|
-
eventData.event.stopPropagation();
|
|
140
129
|
setDrag({
|
|
141
130
|
drag: eventData.deltaX,
|
|
142
131
|
pointers: Math.abs(eventData.deltaX) < Number.MIN_SAFE_INTEGER
|
|
143
132
|
});
|
|
144
133
|
};
|
|
145
134
|
const handleSwiped = eventData => {
|
|
146
|
-
if (!swipe) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
135
|
if (!canSwipe.current) {
|
|
150
136
|
canSwipe.current = true;
|
|
151
137
|
return;
|
|
152
138
|
}
|
|
153
|
-
eventData.event.preventDefault();
|
|
154
|
-
eventData.event.stopPropagation();
|
|
155
139
|
if (Math.abs(drag.drag) < swipeActivateLength) {
|
|
156
140
|
return setDrag({
|
|
157
141
|
drag: 0,
|
|
@@ -169,7 +153,9 @@ function ItemProvider(_ref) {
|
|
|
169
153
|
onSwipeStart: handleSwipeStart,
|
|
170
154
|
onSwiping: handleSwiping,
|
|
171
155
|
onSwiped: handleSwiped,
|
|
172
|
-
trackMouse: true
|
|
156
|
+
trackMouse: true,
|
|
157
|
+
enabled: swipe,
|
|
158
|
+
availableDirections: ['Left', 'Right']
|
|
173
159
|
}),
|
|
174
160
|
{
|
|
175
161
|
ref
|
|
@@ -97,38 +97,21 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transi
|
|
|
97
97
|
const canSwipe = useRef(true);
|
|
98
98
|
const [drag, setDrag] = useState({ drag: 0, pointers: true });
|
|
99
99
|
const handleSwipeStart = eventData => {
|
|
100
|
-
if (!swipe) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
100
|
if (eventData.dir !== 'Right' && eventData.dir !== 'Left') {
|
|
104
101
|
canSwipe.current = false;
|
|
105
102
|
}
|
|
106
|
-
else {
|
|
107
|
-
eventData.event.preventDefault();
|
|
108
|
-
eventData.event.stopPropagation();
|
|
109
|
-
}
|
|
110
103
|
};
|
|
111
104
|
const handleSwiping = eventData => {
|
|
112
|
-
if (!swipe) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
105
|
if (!canSwipe.current) {
|
|
116
106
|
return;
|
|
117
107
|
}
|
|
118
|
-
eventData.event.preventDefault();
|
|
119
|
-
eventData.event.stopPropagation();
|
|
120
108
|
setDrag({ drag: eventData.deltaX, pointers: Math.abs(eventData.deltaX) < Number.MIN_SAFE_INTEGER });
|
|
121
109
|
};
|
|
122
110
|
const handleSwiped = eventData => {
|
|
123
|
-
if (!swipe) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
111
|
if (!canSwipe.current) {
|
|
127
112
|
canSwipe.current = true;
|
|
128
113
|
return;
|
|
129
114
|
}
|
|
130
|
-
eventData.event.preventDefault();
|
|
131
|
-
eventData.event.stopPropagation();
|
|
132
115
|
if (Math.abs(drag.drag) < swipeActivateLength) {
|
|
133
116
|
return setDrag({ drag: 0, pointers: true });
|
|
134
117
|
}
|
|
@@ -141,6 +124,8 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transi
|
|
|
141
124
|
onSwiping: handleSwiping,
|
|
142
125
|
onSwiped: handleSwiped,
|
|
143
126
|
trackMouse: true,
|
|
127
|
+
enabled: swipe,
|
|
128
|
+
availableDirections: ['Left', 'Right'],
|
|
144
129
|
}), { ref } = _a, swipeProps = __rest(_a, ["ref"]);
|
|
145
130
|
return (_jsx("div", { ref: containerRef, className: styles.itemProvider, "data-pointers": !drag.pointers || undefined, "data-swipe": swipe || undefined, "data-gap": gap, style: Object.assign({}, (Boolean(gap) ? { '--gap': gap } : {})), children: _jsx("div", Object.assign({}, swipeProps, { className: styles.itemTracker, "data-test-id": TEST_IDS.trackLine, style: {
|
|
146
131
|
transform: `translateX(${transform + drag.drag}px)`,
|
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-042f5ed6.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-042f5ed6.0",
|
|
40
|
+
"@snack-uikit/pagination": "0.9.4-preview-042f5ed6.0",
|
|
41
|
+
"@snack-uikit/utils": "3.5.1-preview-042f5ed6.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": "ea1e2e87efd62c4df12a1ed22f6623cc19b423e3"
|
|
48
48
|
}
|
|
@@ -136,45 +136,25 @@ export function ItemProvider({
|
|
|
136
136
|
const [drag, setDrag] = useState({ drag: 0, pointers: true });
|
|
137
137
|
|
|
138
138
|
const handleSwipeStart: SwipeCallback = eventData => {
|
|
139
|
-
if (!swipe) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
139
|
if (eventData.dir !== 'Right' && eventData.dir !== 'Left') {
|
|
144
140
|
canSwipe.current = false;
|
|
145
|
-
} else {
|
|
146
|
-
eventData.event.preventDefault();
|
|
147
|
-
eventData.event.stopPropagation();
|
|
148
141
|
}
|
|
149
142
|
};
|
|
150
143
|
|
|
151
144
|
const handleSwiping: SwipeCallback = eventData => {
|
|
152
|
-
if (!swipe) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
145
|
if (!canSwipe.current) {
|
|
157
146
|
return;
|
|
158
147
|
}
|
|
159
148
|
|
|
160
|
-
eventData.event.preventDefault();
|
|
161
|
-
eventData.event.stopPropagation();
|
|
162
149
|
setDrag({ drag: eventData.deltaX, pointers: Math.abs(eventData.deltaX) < Number.MIN_SAFE_INTEGER });
|
|
163
150
|
};
|
|
164
151
|
|
|
165
152
|
const handleSwiped: SwipeCallback = eventData => {
|
|
166
|
-
if (!swipe) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
153
|
if (!canSwipe.current) {
|
|
171
154
|
canSwipe.current = true;
|
|
172
155
|
return;
|
|
173
156
|
}
|
|
174
157
|
|
|
175
|
-
eventData.event.preventDefault();
|
|
176
|
-
eventData.event.stopPropagation();
|
|
177
|
-
|
|
178
158
|
if (Math.abs(drag.drag) < swipeActivateLength) {
|
|
179
159
|
return setDrag({ drag: 0, pointers: true });
|
|
180
160
|
}
|
|
@@ -189,6 +169,8 @@ export function ItemProvider({
|
|
|
189
169
|
onSwiping: handleSwiping,
|
|
190
170
|
onSwiped: handleSwiped,
|
|
191
171
|
trackMouse: true,
|
|
172
|
+
enabled: swipe,
|
|
173
|
+
availableDirections: ['Left', 'Right'],
|
|
192
174
|
});
|
|
193
175
|
|
|
194
176
|
return (
|