@snack-uikit/carousel 0.5.0 → 0.5.1

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.5.1 (2025-04-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-6220:** carousel swipe behavior fixed when only single item is present per slide ([f9ac546](https://github.com/cloud-ru-tech/snack-uikit/commit/f9ac5467746f259c594aab56e9c74057b474dfd0))
12
+
13
+
14
+
15
+
16
+
6
17
  # 0.5.0 (2025-03-29)
7
18
 
8
19
 
@@ -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",
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": "614c4dc0de37ef72d1b1c66f2b393933321d73db"
47
+ "gitHead": "ae704c5f0e7e2abbcfa46ca182cdd24851405037"
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(() => {