@secretstache/wordpress-gutenberg 0.4.6 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretstache/wordpress-gutenberg",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "",
5
5
  "author": "Secret Stache",
6
6
  "license": "GPL-2.0-or-later",
@@ -1,6 +1,12 @@
1
1
  import { useEffect, useRef } from '@wordpress/element';
2
2
 
3
- export const useAccordionItem = (itemId, activeItemId, setActiveItemId, contentSelector) => {
3
+ export const useAccordionItem = ({
4
+ itemId,
5
+ activeItemId,
6
+ setActiveItemId,
7
+ contentSelector,
8
+ heightObserverDeps = []
9
+ }) => {
4
10
  const isActive = itemId === activeItemId;
5
11
  const blockRef = useRef(null);
6
12
 
@@ -44,7 +50,7 @@ export const useAccordionItem = (itemId, activeItemId, setActiveItemId, contentS
44
50
  resizeObserver.observe(blockRef.current);
45
51
 
46
52
  return () => resizeObserver.disconnect();
47
- }, [ isActive ]);
53
+ }, [ isActive, ...heightObserverDeps ]);
48
54
 
49
55
  return {
50
56
  blockRef,
@@ -7,6 +7,9 @@ export const useColorChange = (colors, setAttributes) => (colorValue, property)
7
7
  value: colorValue,
8
8
  slug: selectedColor.slug,
9
9
  }
10
- : null,
10
+ : {
11
+ value: '',
12
+ slug: '',
13
+ },
11
14
  });
12
15
  };