@secretstache/wordpress-gutenberg 0.4.7 → 0.4.9
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/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useAccordionItem.js +8 -2
- package/src/utils/attributes.js +38 -1
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { useEffect, useRef } from '@wordpress/element';
|
|
2
2
|
|
|
3
|
-
export const useAccordionItem = (
|
|
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,
|
package/src/utils/attributes.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated since 0.4.9
|
|
3
|
+
* @type {{linkLabel: {default: string, type: string}, linkIsOpenInNewTab: {default: boolean, type: string}, linkSource: {default: string, type: string}}}
|
|
4
|
+
*/
|
|
1
5
|
export const linkControlAttribute = {
|
|
2
6
|
linkLabel: {
|
|
3
7
|
type: 'string',
|
|
@@ -13,6 +17,11 @@ export const linkControlAttribute = {
|
|
|
13
17
|
},
|
|
14
18
|
};
|
|
15
19
|
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param name
|
|
23
|
+
* @returns {{[p: string]: {default: {filename: null, mime: null, alt: null, name: null, id: null, url: null}, type: string}}}
|
|
24
|
+
*/
|
|
16
25
|
export const getMediaAttribute = (name = 'media') => ({
|
|
17
26
|
[`${name}`]: {
|
|
18
27
|
type: 'object',
|
|
@@ -27,6 +36,10 @@ export const getMediaAttribute = (name = 'media') => ({
|
|
|
27
36
|
},
|
|
28
37
|
});
|
|
29
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated since 0.4.9
|
|
41
|
+
* @type {{description: {default: string, type: string}, title: {default: string, type: string}}}
|
|
42
|
+
*/
|
|
30
43
|
export const contentAttribute = {
|
|
31
44
|
title: {
|
|
32
45
|
type: 'string',
|
|
@@ -38,6 +51,10 @@ export const contentAttribute = {
|
|
|
38
51
|
},
|
|
39
52
|
};
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @param name
|
|
56
|
+
* @returns {{[p: string]: {default: {filename: null, mime: null, alt: null, name: null, id: null, url: null}, type: string}, isAnimationLooped: {default: boolean, type: string}}}
|
|
57
|
+
*/
|
|
41
58
|
export const getAnimationAttribute = (name = 'animationFile') => ({
|
|
42
59
|
...getMediaAttribute(name),
|
|
43
60
|
isAnimationLooped: {
|
|
@@ -134,7 +151,7 @@ export const getDataQueryAttributes = (
|
|
|
134
151
|
* @param {string} [options.mediaAttributeName='media'] - Background media attribute name.
|
|
135
152
|
* @param {boolean} [options.hasOverlay=false] - Flag to determine if overlay attributes should be included.
|
|
136
153
|
*
|
|
137
|
-
* @returns {
|
|
154
|
+
* @returns {{[p: string]: {default: {filename: null, mime: null, alt: null, name: null, id: null, url: null}, type: string}, backgroundMediaType?: {type: string}, backgroundColor: {type: string}, isIncludeBackgroundMedia?: {type: string}, isIncludeOverlay?: {type: string}, overlayColor?: {type: string}}}
|
|
138
155
|
*/
|
|
139
156
|
export const getBaseBackgroundAttributes = ({
|
|
140
157
|
hasBackgroundMedia = false,
|
|
@@ -214,3 +231,23 @@ export const responsiveSpacingAttribute = {
|
|
|
214
231
|
}
|
|
215
232
|
}
|
|
216
233
|
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @since 0.4.9
|
|
237
|
+
* @param prefix
|
|
238
|
+
* @returns {{[p: string]: {default: string, type: string}|{default: string, type: string}|{default: boolean, type: string}}}
|
|
239
|
+
*/
|
|
240
|
+
export const getLinkAttributes = (prefix = 'link') => ({
|
|
241
|
+
[`${prefix}Label`]: {
|
|
242
|
+
type: 'string',
|
|
243
|
+
default: '',
|
|
244
|
+
},
|
|
245
|
+
[`${prefix}Source`]: {
|
|
246
|
+
type: 'string',
|
|
247
|
+
default: '',
|
|
248
|
+
},
|
|
249
|
+
[`${prefix}IsOpenInNewTab`]: {
|
|
250
|
+
type: 'boolean',
|
|
251
|
+
default: false,
|
|
252
|
+
},
|
|
253
|
+
});
|