@elementor/editor-editing-panel 1.21.0 → 1.23.0
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 +40 -0
- package/dist/index.js +26 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/src/components/css-classes/css-class-menu.tsx +12 -15
- package/src/components/css-classes/css-class-selector.tsx +15 -4
- package/src/components/multi-combobox.tsx +1 -1
- package/src/components/section.tsx +1 -1
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +2 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +1 -1
- package/src/dynamics/components/dynamic-selection.tsx +3 -3
- package/src/dynamics/hooks/use-prop-dynamic-tags.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,23 +39,23 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "0.18.
|
|
43
|
-
"@elementor/editor-controls": "0.
|
|
42
|
+
"@elementor/editor": "0.18.4",
|
|
43
|
+
"@elementor/editor-controls": "0.20.0",
|
|
44
44
|
"@elementor/editor-current-user": "0.3.0",
|
|
45
|
-
"@elementor/editor-elements": "0.
|
|
46
|
-
"@elementor/editor-panels": "0.13.
|
|
45
|
+
"@elementor/editor-elements": "0.7.0",
|
|
46
|
+
"@elementor/editor-panels": "0.13.1",
|
|
47
47
|
"@elementor/editor-props": "0.11.1",
|
|
48
48
|
"@elementor/editor-responsive": "0.13.3",
|
|
49
49
|
"@elementor/editor-styles": "0.6.4",
|
|
50
|
-
"@elementor/editor-styles-repository": "0.
|
|
51
|
-
"@elementor/editor-ui": "0.
|
|
50
|
+
"@elementor/editor-styles-repository": "0.8.1",
|
|
51
|
+
"@elementor/editor-ui": "0.5.0",
|
|
52
52
|
"@elementor/editor-v1-adapters": "0.11.0",
|
|
53
53
|
"@elementor/icons": "1.37.0",
|
|
54
|
-
"@elementor/locations": "0.7.
|
|
55
|
-
"@elementor/menus": "0.1.
|
|
54
|
+
"@elementor/locations": "0.7.7",
|
|
55
|
+
"@elementor/menus": "0.1.4",
|
|
56
56
|
"@elementor/schema": "0.1.2",
|
|
57
57
|
"@elementor/session": "0.1.0",
|
|
58
|
-
"@elementor/ui": "1.
|
|
58
|
+
"@elementor/ui": "1.32.1",
|
|
59
59
|
"@elementor/utils": "0.4.0",
|
|
60
60
|
"@wordpress/i18n": "^5.13.0"
|
|
61
61
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
3
3
|
import { stylesRepository } from '@elementor/editor-styles-repository';
|
|
4
|
-
import {
|
|
4
|
+
import { MenuListItem } from '@elementor/editor-ui';
|
|
5
|
+
import { bindMenu, Divider, Menu, MenuSubheader, type PopupState } from '@elementor/ui';
|
|
5
6
|
import { __ } from '@wordpress/i18n';
|
|
6
7
|
|
|
7
8
|
import { useStyle } from '../../contexts/style-context';
|
|
@@ -39,9 +40,9 @@ export function CssClassMenu( { styleId, provider, popupState, handleRename, anc
|
|
|
39
40
|
>
|
|
40
41
|
{ /* It has to be an array since MUI menu doesn't accept a Fragment as a child, and wrapping the items with an HTML element disrupts keyboard navigation */ }
|
|
41
42
|
{ getMenuItemsByProvider( { provider, styleId, handleRename, closeMenu: popupState.close } ) }
|
|
42
|
-
<
|
|
43
|
+
<MenuSubheader sx={ { typography: 'caption', color: 'text.secondary', pb: 0.5, pt: 1 } }>
|
|
43
44
|
{ __( 'Pseudo classes', 'elementor' ) }
|
|
44
|
-
</
|
|
45
|
+
</MenuSubheader>
|
|
45
46
|
<StateMenuItem key="normal" state={ null } styleId={ styleId } closeMenu={ popupState.close } />
|
|
46
47
|
{ STATES.map( ( state ) => {
|
|
47
48
|
return (
|
|
@@ -79,12 +80,12 @@ function getMenuItemsByProvider( {
|
|
|
79
80
|
|
|
80
81
|
if ( actions.length ) {
|
|
81
82
|
actions.unshift(
|
|
82
|
-
<
|
|
83
|
+
<MenuSubheader
|
|
83
84
|
key="provider-label"
|
|
84
85
|
sx={ { typography: 'caption', color: 'text.secondary', pb: 0.5, pt: 1 } }
|
|
85
86
|
>
|
|
86
87
|
{ providerInstance?.labels?.singular }
|
|
87
|
-
</
|
|
88
|
+
</MenuSubheader>
|
|
88
89
|
);
|
|
89
90
|
actions.push( <Divider key="provider-actions-divider" /> );
|
|
90
91
|
}
|
|
@@ -106,7 +107,7 @@ function StateMenuItem( { state, styleId, closeMenu, ...props }: StateMenuItemPr
|
|
|
106
107
|
const isSelected = state === activeState && isActive;
|
|
107
108
|
|
|
108
109
|
return (
|
|
109
|
-
<
|
|
110
|
+
<MenuListItem
|
|
110
111
|
{ ...props }
|
|
111
112
|
selected={ isSelected }
|
|
112
113
|
sx={ { textTransform: 'capitalize' } }
|
|
@@ -121,7 +122,7 @@ function StateMenuItem( { state, styleId, closeMenu, ...props }: StateMenuItemPr
|
|
|
121
122
|
} }
|
|
122
123
|
>
|
|
123
124
|
{ state ? state : 'Normal' }
|
|
124
|
-
</
|
|
125
|
+
</MenuListItem>
|
|
125
126
|
);
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -129,7 +130,7 @@ function UnapplyClassMenuItem( { styleId, closeMenu, ...props }: { styleId: stri
|
|
|
129
130
|
const unapplyClass = useUnapplyClass( styleId );
|
|
130
131
|
|
|
131
132
|
return (
|
|
132
|
-
<
|
|
133
|
+
<MenuListItem
|
|
133
134
|
{ ...props }
|
|
134
135
|
onClick={ () => {
|
|
135
136
|
unapplyClass();
|
|
@@ -137,7 +138,7 @@ function UnapplyClassMenuItem( { styleId, closeMenu, ...props }: { styleId: stri
|
|
|
137
138
|
} }
|
|
138
139
|
>
|
|
139
140
|
{ __( 'Remove', 'elementor' ) }
|
|
140
|
-
</
|
|
141
|
+
</MenuListItem>
|
|
141
142
|
);
|
|
142
143
|
}
|
|
143
144
|
|
|
@@ -150,7 +151,7 @@ function RenameClassMenuItem( {
|
|
|
150
151
|
closeMenu: () => void;
|
|
151
152
|
} ) {
|
|
152
153
|
return (
|
|
153
|
-
<
|
|
154
|
+
<MenuListItem
|
|
154
155
|
{ ...props }
|
|
155
156
|
onClick={ () => {
|
|
156
157
|
closeMenu();
|
|
@@ -158,10 +159,6 @@ function RenameClassMenuItem( {
|
|
|
158
159
|
} }
|
|
159
160
|
>
|
|
160
161
|
{ __( 'Rename', 'elementor' ) }
|
|
161
|
-
</
|
|
162
|
+
</MenuListItem>
|
|
162
163
|
);
|
|
163
164
|
}
|
|
164
|
-
|
|
165
|
-
const StyledMenuItem = ( { ...props } ) => (
|
|
166
|
-
<MenuItem { ...props } sx={ { ...( props.sx ?? {} ), typography: 'caption', color: 'text.primary' } } />
|
|
167
|
-
);
|
|
@@ -165,6 +165,9 @@ function useCreateActions( {
|
|
|
165
165
|
return {
|
|
166
166
|
// translators: %s is the label of the new class.
|
|
167
167
|
label: ( value ) => __( 'Create new "%s"', 'elementor' ).replace( '%s', value ),
|
|
168
|
+
// translators: %s is the singular label of css class provider (e.g "Global CSS Class").
|
|
169
|
+
group: __( 'Create New %s', 'elementor' ).replace( '%s', provider.labels?.singular ?? '' ),
|
|
170
|
+
condition: ( _, inputValue ) => isLabelValid( inputValue ) && ! hasReachedLimit( provider ),
|
|
168
171
|
apply: ( label ) => {
|
|
169
172
|
const createdId = create( label );
|
|
170
173
|
|
|
@@ -175,14 +178,22 @@ function useCreateActions( {
|
|
|
175
178
|
pushAppliedId( createdId );
|
|
176
179
|
setActiveId( createdId );
|
|
177
180
|
},
|
|
178
|
-
condition: ( _, inputValue ) =>
|
|
179
|
-
stylesRepository.isLabelValid( inputValue ) && ! stylesRepository.isLabelExist( inputValue ),
|
|
180
|
-
// translators: %s is the singular label of css class provider (e.g "Global CSS Class").
|
|
181
|
-
group: __( 'Create New %s', 'elementor' ).replace( '%s', provider.labels?.singular ?? '' ),
|
|
182
181
|
};
|
|
183
182
|
} );
|
|
184
183
|
}
|
|
185
184
|
|
|
185
|
+
function hasReachedLimit( provider: StylesProvider ) {
|
|
186
|
+
if ( provider.limit === undefined ) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return provider.actions.get().length >= provider.limit;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function isLabelValid( newLabel: string ) {
|
|
194
|
+
return stylesRepository.isLabelValid( newLabel ) && ! stylesRepository.isLabelExist( newLabel );
|
|
195
|
+
}
|
|
196
|
+
|
|
186
197
|
function useAppliedOptions( options: StyleDefOption[], appliedIds: StyleDefinitionID[] ) {
|
|
187
198
|
const applied = options.filter( ( option ) => option.value && appliedIds.includes( option.value ) );
|
|
188
199
|
|
|
@@ -72,7 +72,7 @@ export function MultiCombobox< TOption extends Option >( {
|
|
|
72
72
|
if ( reason === 'createOption' ) {
|
|
73
73
|
const [ firstAction ] = filterActions( actions, { options, inputValue: inputValue ?? '' } );
|
|
74
74
|
|
|
75
|
-
if ( firstAction
|
|
75
|
+
if ( firstAction?.value ) {
|
|
76
76
|
return run( firstAction.apply, firstAction.value );
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -26,7 +26,7 @@ export function Section( { title, children, defaultExpanded = false }: Props ) {
|
|
|
26
26
|
>
|
|
27
27
|
<ListItemText
|
|
28
28
|
secondary={ title }
|
|
29
|
-
secondaryTypographyProps={ {
|
|
29
|
+
secondaryTypographyProps={ { color: 'text.primary', variant: 'caption', fontWeight: 'bold' } }
|
|
30
30
|
/>
|
|
31
31
|
<CollapseIcon open={ isOpen } color="secondary" fontSize="tiny" />
|
|
32
32
|
</ListItemButton>
|
|
@@ -36,8 +36,10 @@ export const RotatedIcon = ( {
|
|
|
36
36
|
disableRotationForReversed = false,
|
|
37
37
|
}: Props ) => {
|
|
38
38
|
const rotate = useRef( useGetTargetAngle( isClockwise, offset, disableRotationForReversed ) );
|
|
39
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
39
40
|
rotate.current = useGetTargetAngle( isClockwise, offset, disableRotationForReversed, rotate );
|
|
40
41
|
|
|
42
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
41
43
|
return <Icon fontSize={ size } sx={ { transition: '.3s', rotate: `${ rotate.current }deg` } } />;
|
|
42
44
|
};
|
|
43
45
|
|
|
@@ -156,7 +156,7 @@ const DynamicSettings = ( { controls }: { controls: DynamicTag[ 'atomic_controls
|
|
|
156
156
|
{ tabs.map( ( { value }, index ) => {
|
|
157
157
|
return (
|
|
158
158
|
<TabPanel key={ index } sx={ { flexGrow: 1, py: 0 } } { ...getTabPanelProps( index ) }>
|
|
159
|
-
<PopoverContent p={
|
|
159
|
+
<PopoverContent p={ 2 } gap={ 2 }>
|
|
160
160
|
{ value.items.map( ( item ) => {
|
|
161
161
|
if ( item.type === 'control' ) {
|
|
162
162
|
return <Control key={ item.value.bind } control={ item.value } />;
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
Divider,
|
|
8
8
|
InputAdornment,
|
|
9
9
|
Link,
|
|
10
|
-
ListSubheader,
|
|
11
10
|
MenuItem,
|
|
12
11
|
MenuList,
|
|
12
|
+
MenuSubheader,
|
|
13
13
|
Stack,
|
|
14
14
|
TextField,
|
|
15
15
|
Typography,
|
|
@@ -96,11 +96,11 @@ export const DynamicSelection = ( { onSelect }: DynamicSelectionProps ) => {
|
|
|
96
96
|
<MenuList role="listbox" tabIndex={ 0 }>
|
|
97
97
|
{ options.map( ( [ category, items ], index ) => (
|
|
98
98
|
<Fragment key={ index }>
|
|
99
|
-
<
|
|
99
|
+
<MenuSubheader
|
|
100
100
|
sx={ { px: 1.5, typography: 'caption', color: 'text.tertiary' } }
|
|
101
101
|
>
|
|
102
102
|
{ dynamicGroups?.[ category ]?.title || category }
|
|
103
|
-
</
|
|
103
|
+
</MenuSubheader>
|
|
104
104
|
{ items.map( ( { value, label: tagLabel } ) => {
|
|
105
105
|
const isSelected = isCurrentValueDynamic && value === dynamicValue?.name;
|
|
106
106
|
|
|
@@ -15,6 +15,7 @@ export const usePropDynamicTags = () => {
|
|
|
15
15
|
categories = propDynamicType?.settings.categories || [];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
18
19
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
20
|
return useMemo( () => getDynamicTagsByCategories( categories ), [ categories.join() ] );
|
|
20
21
|
};
|