@snack-uikit/carousel 0.2.14-preview-ff8280b4.0 → 0.2.14

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.2.14 (2024-07-03)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-5100:** width calculation ([f8de802](https://github.com/cloud-ru-tech/snack-uikit/commit/f8de8023b23530a37d0437161619945b2f6ca958))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.2.13 (2024-06-11)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -27,9 +27,14 @@ export function ItemProvider({ items, showItems, scrollBy, slideCallback, transi
27
27
  setComputedValues({ itemWidth, gap });
28
28
  }, [showItems]);
29
29
  useEffect(() => {
30
+ const node = containerRef.current;
31
+ if (!node) {
32
+ return;
33
+ }
30
34
  recalculateItemsSize();
31
- window.addEventListener('resize', debounce(recalculateItemsSize, 100));
32
- return () => window.removeEventListener('resize', recalculateItemsSize);
35
+ const observer = new ResizeObserver(debounce(recalculateItemsSize, 100));
36
+ observer.observe(node);
37
+ return () => observer.disconnect();
33
38
  }, [recalculateItemsSize]);
34
39
  const itemsTrackerRef = useRef(null);
35
40
  function hideNonVisibleItems() {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.2.14-preview-ff8280b4.0",
7
+ "version": "0.2.14",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -39,5 +39,5 @@
39
39
  "lodash.debounce": "4.0.8",
40
40
  "uncontrollable": "8.0.4"
41
41
  },
42
- "gitHead": "ce078dfe9d48a2e6d36d34b1eff4fdb5db996d83"
42
+ "gitHead": "4fc32e03b6d2707f88f5720a57fb90c37bd76dac"
43
43
  }
@@ -56,9 +56,17 @@ export function ItemProvider({
56
56
  }, [showItems]);
57
57
 
58
58
  useEffect(() => {
59
+ const node = containerRef.current;
60
+
61
+ if (!node) {
62
+ return;
63
+ }
64
+
59
65
  recalculateItemsSize();
60
- window.addEventListener('resize', debounce(recalculateItemsSize, 100));
61
- return () => window.removeEventListener('resize', recalculateItemsSize);
66
+
67
+ const observer = new ResizeObserver(debounce(recalculateItemsSize, 100));
68
+ observer.observe(node);
69
+ return () => observer.disconnect();
62
70
  }, [recalculateItemsSize]);
63
71
 
64
72
  const itemsTrackerRef = useRef<HTMLDivElement>(null);