@elementor/editor-controls 3.32.0-26 → 3.32.0-28
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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +37 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/controls/transition-control/transition-repeater-control.tsx +8 -6
- package/src/controls/transition-control/transition-selector.tsx +33 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-controls",
|
|
3
3
|
"description": "This package contains the controls model and utils for the Elementor editor",
|
|
4
|
-
"version": "3.32.0-
|
|
4
|
+
"version": "3.32.0-28",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,21 +40,21 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor-current-user": "3.32.0-
|
|
44
|
-
"@elementor/editor-elements": "3.32.0-
|
|
45
|
-
"@elementor/editor-props": "3.32.0-
|
|
46
|
-
"@elementor/editor-responsive": "3.32.0-
|
|
47
|
-
"@elementor/editor-ui": "3.32.0-
|
|
48
|
-
"@elementor/editor-v1-adapters": "3.32.0-
|
|
49
|
-
"@elementor/env": "3.32.0-
|
|
50
|
-
"@elementor/http-client": "3.32.0-
|
|
43
|
+
"@elementor/editor-current-user": "3.32.0-28",
|
|
44
|
+
"@elementor/editor-elements": "3.32.0-28",
|
|
45
|
+
"@elementor/editor-props": "3.32.0-28",
|
|
46
|
+
"@elementor/editor-responsive": "3.32.0-28",
|
|
47
|
+
"@elementor/editor-ui": "3.32.0-28",
|
|
48
|
+
"@elementor/editor-v1-adapters": "3.32.0-28",
|
|
49
|
+
"@elementor/env": "3.32.0-28",
|
|
50
|
+
"@elementor/http-client": "3.32.0-28",
|
|
51
51
|
"@elementor/icons": "^1.51.1",
|
|
52
|
-
"@elementor/locations": "3.32.0-
|
|
53
|
-
"@elementor/query": "3.32.0-
|
|
54
|
-
"@elementor/session": "3.32.0-
|
|
52
|
+
"@elementor/locations": "3.32.0-28",
|
|
53
|
+
"@elementor/query": "3.32.0-28",
|
|
54
|
+
"@elementor/session": "3.32.0-28",
|
|
55
55
|
"@elementor/ui": "1.36.2",
|
|
56
|
-
"@elementor/utils": "3.32.0-
|
|
57
|
-
"@elementor/wp-media": "3.32.0-
|
|
56
|
+
"@elementor/utils": "3.32.0-28",
|
|
57
|
+
"@elementor/wp-media": "3.32.0-28",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0",
|
|
59
59
|
"@monaco-editor/react": "^4.7.0"
|
|
60
60
|
},
|
|
@@ -16,13 +16,15 @@ const DURATION_CONFIG = {
|
|
|
16
16
|
|
|
17
17
|
// this config needs to be loaded at runtime/render since it's the transitionProperties object will be mutated by the pro plugin.
|
|
18
18
|
// See: https://elementor.atlassian.net/browse/ED-20285
|
|
19
|
-
const getSelectionSizeProps = () => {
|
|
19
|
+
const getSelectionSizeProps = ( recentlyUsedList: string[] ) => {
|
|
20
20
|
return {
|
|
21
21
|
selectionLabel: __( 'Type', 'elementor' ),
|
|
22
22
|
sizeLabel: __( 'Duration', 'elementor' ),
|
|
23
23
|
selectionConfig: {
|
|
24
24
|
component: TransitionSelector,
|
|
25
|
-
props: {
|
|
25
|
+
props: {
|
|
26
|
+
recentlyUsedList,
|
|
27
|
+
},
|
|
26
28
|
},
|
|
27
29
|
sizeConfigMap: {
|
|
28
30
|
...transitionProperties.reduce(
|
|
@@ -38,15 +40,15 @@ const getSelectionSizeProps = () => {
|
|
|
38
40
|
};
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
function getChildControlConfig() {
|
|
43
|
+
function getChildControlConfig( recentlyUsedList: string[] ) {
|
|
42
44
|
return {
|
|
43
45
|
propTypeUtil: selectionSizePropTypeUtil,
|
|
44
46
|
component: SelectionSizeControl as unknown as React.ComponentType< Record< string, unknown > >,
|
|
45
|
-
props: getSelectionSizeProps(),
|
|
47
|
+
props: getSelectionSizeProps( recentlyUsedList ),
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
export const TransitionRepeaterControl = createControl( () => {
|
|
51
|
+
export const TransitionRepeaterControl = createControl( ( props: { recentlyUsedList: string[] } ) => {
|
|
50
52
|
return (
|
|
51
53
|
<RepeatableControl
|
|
52
54
|
label={ __( 'Transitions', 'elementor' ) }
|
|
@@ -56,7 +58,7 @@ export const TransitionRepeaterControl = createControl( () => {
|
|
|
56
58
|
showDuplicate={ false }
|
|
57
59
|
showToggle={ true }
|
|
58
60
|
initialValues={ initialTransitionValue }
|
|
59
|
-
childControlConfig={ getChildControlConfig() }
|
|
61
|
+
childControlConfig={ getChildControlConfig( props.recentlyUsedList ) }
|
|
60
62
|
propKey="transition"
|
|
61
63
|
/>
|
|
62
64
|
);
|
|
@@ -23,7 +23,16 @@ const toTransitionSelectorValue = ( label: string ) => {
|
|
|
23
23
|
return null;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
const findByValue = ( value: string ) => {
|
|
27
|
+
for ( const category of transitionProperties ) {
|
|
28
|
+
const property = category.properties.find( ( prop ) => prop.value === value );
|
|
29
|
+
if ( property ) {
|
|
30
|
+
return property.label;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const TransitionSelector = ( { recentlyUsedList }: { recentlyUsedList: string[] } ) => {
|
|
27
36
|
const { value, setValue } = useBoundProp( keyValuePropTypeUtil );
|
|
28
37
|
const {
|
|
29
38
|
value: { value: transitionValue },
|
|
@@ -32,6 +41,28 @@ export const TransitionSelector = () => {
|
|
|
32
41
|
const defaultRef = useRef< HTMLDivElement >( null );
|
|
33
42
|
const popoverState = usePopupState( { variant: 'popover' } );
|
|
34
43
|
|
|
44
|
+
const getItemList = () => {
|
|
45
|
+
const recentItems = recentlyUsedList
|
|
46
|
+
.map( ( item ) => findByValue( item ) )
|
|
47
|
+
.filter( ( item ) => !! item ) as string[];
|
|
48
|
+
const filteredItems = transitionsItemsList.map( ( category ) => {
|
|
49
|
+
return {
|
|
50
|
+
...category,
|
|
51
|
+
items: category.items.filter( ( item ) => ! recentItems.includes( item ) ),
|
|
52
|
+
};
|
|
53
|
+
} );
|
|
54
|
+
if ( recentItems.length === 0 ) {
|
|
55
|
+
return filteredItems;
|
|
56
|
+
}
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
label: __( 'Recent', 'elementor' ),
|
|
60
|
+
items: recentItems,
|
|
61
|
+
},
|
|
62
|
+
...filteredItems,
|
|
63
|
+
];
|
|
64
|
+
};
|
|
65
|
+
|
|
35
66
|
const handleTransitionPropertyChange = ( newLabel: string ) => {
|
|
36
67
|
const newValue = toTransitionSelectorValue( newLabel );
|
|
37
68
|
|
|
@@ -74,7 +105,7 @@ export const TransitionSelector = () => {
|
|
|
74
105
|
transformOrigin={ { vertical: 'top', horizontal: 'left' } }
|
|
75
106
|
>
|
|
76
107
|
<ItemSelector
|
|
77
|
-
itemsList={
|
|
108
|
+
itemsList={ getItemList() }
|
|
78
109
|
selectedItem={ transitionValue }
|
|
79
110
|
onItemChange={ handleTransitionPropertyChange }
|
|
80
111
|
onClose={ popoverState.close }
|