@snack-uikit/carousel 0.5.0 → 0.5.1-preview-9917f1e7.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.
|
@@ -96,6 +96,9 @@ function ItemProvider(_ref) {
|
|
|
96
96
|
}, [page, scrollBy, showItems]);
|
|
97
97
|
const handleSlideClick = (0, react_1.useCallback)(e => {
|
|
98
98
|
var _a, _b;
|
|
99
|
+
if (showItems === 1) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
99
102
|
const slideRect = e.currentTarget.getBoundingClientRect();
|
|
100
103
|
const containerRect = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
101
104
|
const containerViewport = (_b = containerRect === null || containerRect === void 0 ? void 0 : containerRect.right) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -104,7 +107,7 @@ function ItemProvider(_ref) {
|
|
|
104
107
|
if (minPos < 0) {
|
|
105
108
|
slideCallback(slidePositionDelta);
|
|
106
109
|
}
|
|
107
|
-
}, [slideCallback]);
|
|
110
|
+
}, [showItems, slideCallback]);
|
|
108
111
|
const itemWidth = (0, react_1.useMemo)(() => {
|
|
109
112
|
if (computedValues.itemWidth > 0) {
|
|
110
113
|
return computedValues.itemWidth;
|
|
@@ -78,6 +78,9 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transi
|
|
|
78
78
|
}, [page, scrollBy, showItems]);
|
|
79
79
|
const handleSlideClick = useCallback(e => {
|
|
80
80
|
var _a, _b;
|
|
81
|
+
if (showItems === 1) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
81
84
|
const slideRect = e.currentTarget.getBoundingClientRect();
|
|
82
85
|
const containerRect = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
83
86
|
const containerViewport = (_b = containerRect === null || containerRect === void 0 ? void 0 : containerRect.right) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -86,7 +89,7 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transi
|
|
|
86
89
|
if (minPos < 0) {
|
|
87
90
|
slideCallback(slidePositionDelta);
|
|
88
91
|
}
|
|
89
|
-
}, [slideCallback]);
|
|
92
|
+
}, [showItems, slideCallback]);
|
|
90
93
|
const itemWidth = useMemo(() => {
|
|
91
94
|
if (computedValues.itemWidth > 0) {
|
|
92
95
|
return computedValues.itemWidth;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.5.0",
|
|
7
|
+
"version": "0.5.1-preview-9917f1e7.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"merge-refs": "1.3.0",
|
|
45
45
|
"uncontrollable": "8.0.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "70c9a8daac46a4a93689ec8471a674f7a84df430"
|
|
48
48
|
}
|
|
@@ -110,6 +110,10 @@ export function ItemProvider({
|
|
|
110
110
|
|
|
111
111
|
const handleSlideClick: MouseEventHandler = useCallback(
|
|
112
112
|
e => {
|
|
113
|
+
if (showItems === 1) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
113
117
|
const slideRect = e.currentTarget.getBoundingClientRect();
|
|
114
118
|
const containerRect = containerRef.current?.getBoundingClientRect();
|
|
115
119
|
const containerViewport = containerRect?.right ?? 0;
|
|
@@ -120,7 +124,7 @@ export function ItemProvider({
|
|
|
120
124
|
slideCallback(slidePositionDelta);
|
|
121
125
|
}
|
|
122
126
|
},
|
|
123
|
-
[slideCallback],
|
|
127
|
+
[showItems, slideCallback],
|
|
124
128
|
);
|
|
125
129
|
|
|
126
130
|
const itemWidth = useMemo(() => {
|