@elementor/editor-editing-panel 1.47.0 → 1.50.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 +85 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +486 -378
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +503 -398
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -14
- package/src/components/css-classes/css-class-item.tsx +3 -2
- package/src/components/css-classes/css-class-menu.tsx +2 -2
- package/src/components/css-classes/css-class-selector.tsx +10 -2
- package/src/components/popover-body.tsx +12 -0
- package/src/components/style-sections/border-section/border-field.tsx +14 -7
- package/src/components/style-sections/effects-section/effects-section.tsx +18 -4
- package/src/components/style-sections/layout-section/flex-order-field.tsx +30 -19
- package/src/components/style-sections/layout-section/flex-size-field.tsx +14 -16
- package/src/components/style-sections/layout-section/layout-section.tsx +9 -2
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +6 -1
- package/src/components/style-sections/position-section/position-section.tsx +19 -8
- package/src/components/style-sections/size-section/size-section.tsx +4 -1
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +3 -1
- package/src/components/style-sections/typography-section/typography-section.tsx +6 -1
- package/src/components/style-tab.tsx +1 -1
- package/src/controls-registry/settings-field.tsx +21 -5
- package/src/controls-registry/styles-field.tsx +5 -3
- package/src/dynamics/components/dynamic-selection-control.tsx +22 -14
- package/src/dynamics/components/dynamic-selection.tsx +32 -36
- package/src/hooks/use-styles-field.ts +3 -4
- package/src/hooks/use-styles-fields.ts +141 -73
- package/src/index.ts +1 -1
- package/src/init.ts +0 -6
- package/src/reset-style-props.tsx +1 -1
- package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +1 -1
- package/src/utils/get-styles-provider-color.ts +8 -0
- package/src/components/popover-scrollable-content.tsx +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,25 +39,24 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "0.
|
|
43
|
-
"@elementor/editor-canvas": "0.
|
|
44
|
-
"@elementor/editor-controls": "1.
|
|
45
|
-
"@elementor/editor-
|
|
46
|
-
"@elementor/editor-
|
|
47
|
-
"@elementor/editor-
|
|
48
|
-
"@elementor/editor-
|
|
49
|
-
"@elementor/editor-props": "0.15.0",
|
|
42
|
+
"@elementor/editor": "0.21.1",
|
|
43
|
+
"@elementor/editor-canvas": "0.28.0",
|
|
44
|
+
"@elementor/editor-controls": "1.5.0",
|
|
45
|
+
"@elementor/editor-documents": "0.13.10",
|
|
46
|
+
"@elementor/editor-elements": "0.9.2",
|
|
47
|
+
"@elementor/editor-panels": "0.17.1",
|
|
48
|
+
"@elementor/editor-props": "0.18.0",
|
|
50
49
|
"@elementor/editor-responsive": "0.13.6",
|
|
51
|
-
"@elementor/editor-styles": "0.6.
|
|
52
|
-
"@elementor/editor-styles-repository": "0.10.
|
|
53
|
-
"@elementor/editor-ui": "0.
|
|
50
|
+
"@elementor/editor-styles": "0.6.14",
|
|
51
|
+
"@elementor/editor-styles-repository": "0.10.7",
|
|
52
|
+
"@elementor/editor-ui": "0.14.2",
|
|
54
53
|
"@elementor/editor-v1-adapters": "0.12.1",
|
|
55
|
-
"@elementor/icons": "1.
|
|
54
|
+
"@elementor/icons": "1.46.0",
|
|
56
55
|
"@elementor/locations": "0.8.0",
|
|
57
56
|
"@elementor/menus": "0.1.5",
|
|
58
57
|
"@elementor/schema": "0.1.2",
|
|
59
58
|
"@elementor/session": "0.1.0",
|
|
60
|
-
"@elementor/ui": "1.
|
|
59
|
+
"@elementor/ui": "1.36.0",
|
|
61
60
|
"@elementor/utils": "0.5.0",
|
|
62
61
|
"@elementor/wp-media": "0.6.1",
|
|
63
62
|
"@wordpress/i18n": "^5.13.0"
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type ChipOwnProps,
|
|
11
11
|
Stack,
|
|
12
12
|
type Theme,
|
|
13
|
+
ThemeProvider,
|
|
13
14
|
Typography,
|
|
14
15
|
UnstableChipGroup,
|
|
15
16
|
usePopupState,
|
|
@@ -69,7 +70,7 @@ export function CssClassItem( props: CssClassItemProps ) {
|
|
|
69
70
|
const isShowingState = isActive && meta.state;
|
|
70
71
|
|
|
71
72
|
return (
|
|
72
|
-
|
|
73
|
+
<ThemeProvider palette="default">
|
|
73
74
|
<UnstableChipGroup
|
|
74
75
|
ref={ setChipRef }
|
|
75
76
|
{ ...chipGroupProps }
|
|
@@ -144,7 +145,7 @@ export function CssClassItem( props: CssClassItemProps ) {
|
|
|
144
145
|
<CssClassProvider { ...classProps } handleRename={ openEditMode }>
|
|
145
146
|
<CssClassMenu popupState={ popupState } anchorEl={ chipRef } fixed={ fixed } />
|
|
146
147
|
</CssClassProvider>
|
|
147
|
-
|
|
148
|
+
</ThemeProvider>
|
|
148
149
|
);
|
|
149
150
|
}
|
|
150
151
|
|
|
@@ -7,7 +7,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
7
|
|
|
8
8
|
import { useStyle } from '../../contexts/style-context';
|
|
9
9
|
import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/types';
|
|
10
|
-
import {
|
|
10
|
+
import { getTempStylesProviderThemeColor } from '../../utils/get-styles-provider-color';
|
|
11
11
|
import { StyleIndicator } from '../style-indicator';
|
|
12
12
|
import { useCssClass } from './css-class-context';
|
|
13
13
|
import { useUnapplyClass } from './use-apply-and-unapply-class';
|
|
@@ -161,7 +161,7 @@ function StateMenuItem( { state, closeMenu, ...props }: StateMenuItemProps ) {
|
|
|
161
161
|
{ isStyled && (
|
|
162
162
|
<StyleIndicator
|
|
163
163
|
aria-label={ __( 'Has style', 'elementor' ) }
|
|
164
|
-
getColor={
|
|
164
|
+
getColor={ getTempStylesProviderThemeColor( provider ?? '' ) }
|
|
165
165
|
/>
|
|
166
166
|
) }
|
|
167
167
|
{ state ?? 'normal' }
|
|
@@ -53,7 +53,7 @@ const EMPTY_OPTION = {
|
|
|
53
53
|
label: __( 'local', 'elementor' ),
|
|
54
54
|
value: null,
|
|
55
55
|
fixed: true,
|
|
56
|
-
color: 'accent',
|
|
56
|
+
color: getTempStylesProviderColorName( 'accent' ),
|
|
57
57
|
icon: <MapPinIcon />,
|
|
58
58
|
provider: null,
|
|
59
59
|
} satisfies StyleDefOption;
|
|
@@ -221,7 +221,7 @@ function useOptions() {
|
|
|
221
221
|
label: styleDef.label,
|
|
222
222
|
value: styleDef.id,
|
|
223
223
|
fixed: isElements,
|
|
224
|
-
color: getStylesProviderColorName( provider.getKey() ),
|
|
224
|
+
color: getTempStylesProviderColorName( getStylesProviderColorName( provider.getKey() ) ),
|
|
225
225
|
icon: isElements ? <MapPinIcon /> : null,
|
|
226
226
|
provider: provider.getKey(),
|
|
227
227
|
};
|
|
@@ -229,6 +229,14 @@ function useOptions() {
|
|
|
229
229
|
} );
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
function getTempStylesProviderColorName( color: ChipOwnProps[ 'color' ] ): ChipOwnProps[ 'color' ] {
|
|
233
|
+
if ( color === 'accent' ) {
|
|
234
|
+
return 'primary';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return color;
|
|
238
|
+
}
|
|
239
|
+
|
|
232
240
|
function useCreateAction() {
|
|
233
241
|
const [ provider, createAction ] = useCreateAndApplyClass();
|
|
234
242
|
if ( ! provider || ! createAction ) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PopoverBody as BasePopoverBody } from '@elementor/editor-ui';
|
|
3
|
+
|
|
4
|
+
import { useSectionWidth } from '../contexts/section-context';
|
|
5
|
+
|
|
6
|
+
type Props = React.ComponentProps< typeof BasePopoverBody >;
|
|
7
|
+
|
|
8
|
+
export const PopoverBody = ( props: Props ) => {
|
|
9
|
+
const sectionWidth = useSectionWidth();
|
|
10
|
+
|
|
11
|
+
return <BasePopoverBody { ...props } width={ sectionWidth } />;
|
|
12
|
+
};
|
|
@@ -8,6 +8,8 @@ import { BorderColorField } from './border-color-field';
|
|
|
8
8
|
import { BorderStyleField } from './border-style-field';
|
|
9
9
|
import { BorderWidthField } from './border-width-field';
|
|
10
10
|
|
|
11
|
+
const BORDER_LABEL = __( 'Border', 'elementor' );
|
|
12
|
+
|
|
11
13
|
const initialBorder = {
|
|
12
14
|
'border-width': { $$type: 'size', value: { size: 1, unit: 'px' } },
|
|
13
15
|
'border-color': { $$type: 'color', value: '#000000' },
|
|
@@ -17,16 +19,21 @@ const initialBorder = {
|
|
|
17
19
|
export const BorderField = () => {
|
|
18
20
|
const { values, setValues, canEdit } = useStylesFields( Object.keys( initialBorder ) );
|
|
19
21
|
|
|
22
|
+
const meta = { history: { propDisplayName: BORDER_LABEL } };
|
|
23
|
+
|
|
20
24
|
const addBorder = () => {
|
|
21
|
-
setValues( initialBorder );
|
|
25
|
+
setValues( initialBorder, meta );
|
|
22
26
|
};
|
|
23
27
|
|
|
24
28
|
const removeBorder = () => {
|
|
25
|
-
setValues(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
setValues(
|
|
30
|
+
{
|
|
31
|
+
'border-width': null,
|
|
32
|
+
'border-color': null,
|
|
33
|
+
'border-style': null,
|
|
34
|
+
},
|
|
35
|
+
meta
|
|
36
|
+
);
|
|
30
37
|
};
|
|
31
38
|
|
|
32
39
|
const hasBorder = Object.values( values ?? {} ).some( Boolean );
|
|
@@ -37,7 +44,7 @@ export const BorderField = () => {
|
|
|
37
44
|
onAdd={ addBorder }
|
|
38
45
|
onRemove={ removeBorder }
|
|
39
46
|
disabled={ ! canEdit }
|
|
40
|
-
renderLabel={ () => <ControlFormLabel>{
|
|
47
|
+
renderLabel={ () => <ControlFormLabel>{ BORDER_LABEL }</ControlFormLabel> }
|
|
41
48
|
>
|
|
42
49
|
<BorderWidthField />
|
|
43
50
|
<BorderColorField />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BoxShadowRepeaterControl, FilterRepeaterControl } from '@elementor/editor-controls';
|
|
2
|
+
import { BoxShadowRepeaterControl, FilterRepeaterControl, TransformRepeaterControl } from '@elementor/editor-controls';
|
|
3
3
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
@@ -10,24 +10,38 @@ import { SectionContent } from '../../section-content';
|
|
|
10
10
|
import { OpacityControlField } from '../layout-section/opacity-control-field';
|
|
11
11
|
|
|
12
12
|
const BOX_SHADOW_LABEL = __( 'Box shadow', 'elementor' );
|
|
13
|
-
const FILTER_LABEL = __( '
|
|
13
|
+
const FILTER_LABEL = __( 'Filters', 'elementor' );
|
|
14
|
+
const TRANSFORM_LABEL = __( 'Transform', 'elementor' );
|
|
15
|
+
const BACKDROP_FILTER_LABEL = __( 'Backdrop filters', 'elementor' );
|
|
14
16
|
|
|
15
17
|
export const EffectsSection = () => {
|
|
16
18
|
const isVersion331Active = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_31 );
|
|
17
19
|
|
|
18
20
|
return (
|
|
19
21
|
<SectionContent>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
{ isVersion331Active && (
|
|
23
|
+
<>
|
|
24
|
+
<OpacityControlField />
|
|
25
|
+
<PanelDivider />
|
|
26
|
+
</>
|
|
27
|
+
) }
|
|
22
28
|
<StylesField bind="box-shadow" propDisplayName={ BOX_SHADOW_LABEL }>
|
|
23
29
|
<BoxShadowRepeaterControl />
|
|
24
30
|
</StylesField>
|
|
25
31
|
{ isVersion331Active && (
|
|
26
32
|
<>
|
|
33
|
+
<PanelDivider />
|
|
34
|
+
<StylesField bind="transform" propDisplayName={ TRANSFORM_LABEL }>
|
|
35
|
+
<TransformRepeaterControl />
|
|
36
|
+
</StylesField>
|
|
27
37
|
<PanelDivider />
|
|
28
38
|
<StylesField bind="filter" propDisplayName={ FILTER_LABEL }>
|
|
29
39
|
<FilterRepeaterControl />
|
|
30
40
|
</StylesField>
|
|
41
|
+
<PanelDivider />
|
|
42
|
+
<StylesField bind="backdrop-filter" propDisplayName={ BACKDROP_FILTER_LABEL }>
|
|
43
|
+
<FilterRepeaterControl filterPropName="backdrop-filter" />
|
|
44
|
+
</StylesField>
|
|
31
45
|
</>
|
|
32
46
|
) }
|
|
33
47
|
</SectionContent>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { ControlToggleButtonGroup, NumberControl, type ToggleButtonGroupItem } from '@elementor/editor-controls';
|
|
4
4
|
import { type NumberPropValue } from '@elementor/editor-props';
|
|
5
5
|
import { ArrowDownSmallIcon, ArrowUpSmallIcon, PencilIcon } from '@elementor/icons';
|
|
@@ -50,10 +50,21 @@ const items: ToggleButtonGroupItem< GroupControlItemOption >[] = [
|
|
|
50
50
|
];
|
|
51
51
|
|
|
52
52
|
export const FlexOrderField = () => {
|
|
53
|
-
const {
|
|
53
|
+
const {
|
|
54
|
+
value: order,
|
|
55
|
+
setValue: setOrder,
|
|
56
|
+
canEdit,
|
|
57
|
+
} = useStylesField< NumberPropValue | null >( 'order', {
|
|
58
|
+
history: { propDisplayName: ORDER_LABEL },
|
|
59
|
+
} );
|
|
54
60
|
|
|
55
61
|
const [ groupControlValue, setGroupControlValue ] = useState( getGroupControlValue( order?.value || null ) );
|
|
56
62
|
|
|
63
|
+
useEffect( () => {
|
|
64
|
+
const newGroupControlValue = getGroupControlValue( order?.value || null );
|
|
65
|
+
setGroupControlValue( newGroupControlValue );
|
|
66
|
+
}, [ order?.value ] );
|
|
67
|
+
|
|
57
68
|
const handleToggleButtonChange = ( group: GroupControlItemOption | null ) => {
|
|
58
69
|
setGroupControlValue( group );
|
|
59
70
|
|
|
@@ -69,8 +80,8 @@ export const FlexOrderField = () => {
|
|
|
69
80
|
return (
|
|
70
81
|
<StylesField bind="order" propDisplayName={ ORDER_LABEL }>
|
|
71
82
|
<UiProviders>
|
|
72
|
-
<
|
|
73
|
-
<
|
|
83
|
+
<SectionContent>
|
|
84
|
+
<StylesFieldLayout label={ ORDER_LABEL }>
|
|
74
85
|
<ControlToggleButtonGroup
|
|
75
86
|
items={ items }
|
|
76
87
|
value={ groupControlValue }
|
|
@@ -78,22 +89,22 @@ export const FlexOrderField = () => {
|
|
|
78
89
|
exclusive={ true }
|
|
79
90
|
disabled={ ! canEdit }
|
|
80
91
|
/>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
</StylesFieldLayout>
|
|
93
|
+
{ CUSTOM === groupControlValue && (
|
|
94
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
95
|
+
<Grid item xs={ 6 }>
|
|
96
|
+
<ControlLabel>{ __( 'Custom order', 'elementor' ) }</ControlLabel>
|
|
97
|
+
</Grid>
|
|
98
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
99
|
+
<NumberControl
|
|
100
|
+
min={ FIRST_DEFAULT_VALUE + 1 }
|
|
101
|
+
max={ LAST_DEFAULT_VALUE - 1 }
|
|
102
|
+
shouldForceInt={ true }
|
|
103
|
+
/>
|
|
93
104
|
</Grid>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</
|
|
105
|
+
</Grid>
|
|
106
|
+
) }
|
|
107
|
+
</SectionContent>
|
|
97
108
|
</UiProviders>
|
|
98
109
|
</StylesField>
|
|
99
110
|
);
|
|
@@ -60,31 +60,29 @@ export const FlexSizeField = () => {
|
|
|
60
60
|
const onChangeGroup = ( group: GroupItem | null = null ) => {
|
|
61
61
|
setActiveGroup( group );
|
|
62
62
|
|
|
63
|
+
let props;
|
|
64
|
+
|
|
63
65
|
if ( ! group || group === 'custom' ) {
|
|
64
|
-
|
|
66
|
+
props = {
|
|
65
67
|
'flex-basis': null,
|
|
66
68
|
'flex-grow': null,
|
|
67
69
|
'flex-shrink': null,
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if ( group === 'flex-grow' ) {
|
|
74
|
-
setValues( {
|
|
70
|
+
};
|
|
71
|
+
} else if ( group === 'flex-grow' ) {
|
|
72
|
+
props = {
|
|
75
73
|
'flex-basis': null,
|
|
76
74
|
'flex-grow': numberPropTypeUtil.create( DEFAULT ),
|
|
77
75
|
'flex-shrink': null,
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
};
|
|
77
|
+
} else {
|
|
78
|
+
props = {
|
|
79
|
+
'flex-basis': null,
|
|
80
|
+
'flex-grow': null,
|
|
81
|
+
'flex-shrink': numberPropTypeUtil.create( DEFAULT ),
|
|
82
|
+
};
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
setValues( {
|
|
84
|
-
'flex-basis': null,
|
|
85
|
-
'flex-grow': null,
|
|
86
|
-
'flex-shrink': numberPropTypeUtil.create( DEFAULT ),
|
|
87
|
-
} );
|
|
85
|
+
setValues( props, { history: { propDisplayName: FLEX_SIZE_LABEL } } );
|
|
88
86
|
};
|
|
89
87
|
|
|
90
88
|
return (
|
|
@@ -20,8 +20,13 @@ import { GapControlField } from './gap-control-field';
|
|
|
20
20
|
import { JustifyContentField } from './justify-content-field';
|
|
21
21
|
import { WrapField } from './wrap-field';
|
|
22
22
|
|
|
23
|
+
const DISPLAY_LABEL = __( 'Display', 'elementor' );
|
|
24
|
+
const FLEX_WRAP_LABEL = __( 'Flex wrap', 'elementor' );
|
|
25
|
+
|
|
23
26
|
export const LayoutSection = () => {
|
|
24
|
-
const { value: display } = useStylesField< StringPropValue >( 'display'
|
|
27
|
+
const { value: display } = useStylesField< StringPropValue >( 'display', {
|
|
28
|
+
history: { propDisplayName: DISPLAY_LABEL },
|
|
29
|
+
} );
|
|
25
30
|
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
26
31
|
const isDisplayFlex = shouldDisplayFlexFields( display, displayPlaceholder as StringPropValue );
|
|
27
32
|
const { element } = useElement();
|
|
@@ -39,7 +44,9 @@ export const LayoutSection = () => {
|
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
const FlexFields = () => {
|
|
42
|
-
const { value: flexWrap } = useStylesField< StringPropValue >( 'flex-wrap'
|
|
47
|
+
const { value: flexWrap } = useStylesField< StringPropValue >( 'flex-wrap', {
|
|
48
|
+
history: { propDisplayName: FLEX_WRAP_LABEL },
|
|
49
|
+
} );
|
|
43
50
|
|
|
44
51
|
return (
|
|
45
52
|
<>
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
4
4
|
import { type ToggleButtonProps, useTheme } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
5
6
|
|
|
6
7
|
import { useStylesField } from '../../../../hooks/use-styles-field';
|
|
7
8
|
import type { FlexDirection } from '../flex-direction-field';
|
|
@@ -14,6 +15,8 @@ type Props = {
|
|
|
14
15
|
disableRotationForReversed?: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
18
|
+
const FLEX_DIRECTION_LABEL = __( 'Flex direction', 'elementor' );
|
|
19
|
+
|
|
17
20
|
const CLOCKWISE_ANGLES: Record< FlexDirection, number > = {
|
|
18
21
|
row: 0,
|
|
19
22
|
column: 90,
|
|
@@ -48,7 +51,9 @@ const useGetTargetAngle = (
|
|
|
48
51
|
disableRotationForReversed: boolean,
|
|
49
52
|
existingRef?: React.MutableRefObject< number >
|
|
50
53
|
) => {
|
|
51
|
-
const { value: direction } = useStylesField< StringPropValue >( 'flex-direction'
|
|
54
|
+
const { value: direction } = useStylesField< StringPropValue >( 'flex-direction', {
|
|
55
|
+
history: { propDisplayName: FLEX_DIRECTION_LABEL },
|
|
56
|
+
} );
|
|
52
57
|
const isRtl = 'rtl' === useTheme().direction;
|
|
53
58
|
const rotationMultiplier = isRtl ? -1 : 1;
|
|
54
59
|
const angleMap = isClockwise ? CLOCKWISE_ANGLES : COUNTER_CLOCKWISE_ANGLES;
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
3
3
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
4
|
import { useSessionStorage } from '@elementor/session';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
5
6
|
|
|
6
7
|
import { useStyle } from '../../../contexts/style-context';
|
|
7
8
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
@@ -28,8 +29,13 @@ type DimensionsValues = {
|
|
|
28
29
|
'inset-inline-end': DimensionValue;
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
const POSITION_LABEL = __( 'Position', 'elementor' );
|
|
33
|
+
const DIMENSIONS_LABEL = __( 'Dimensions', 'elementor' );
|
|
34
|
+
|
|
31
35
|
export const PositionSection = () => {
|
|
32
|
-
const { value: positionValue } = useStylesField< StringPropValue >( 'position'
|
|
36
|
+
const { value: positionValue } = useStylesField< StringPropValue >( 'position', {
|
|
37
|
+
history: { propDisplayName: POSITION_LABEL },
|
|
38
|
+
} );
|
|
33
39
|
const { values: dimensions, setValues: setDimensions } = useStylesFields< DimensionsValues >( [
|
|
34
40
|
'inset-block-start',
|
|
35
41
|
'inset-block-end',
|
|
@@ -41,19 +47,24 @@ export const PositionSection = () => {
|
|
|
41
47
|
const isCssIdFeatureActive = isExperimentActive( 'e_v_3_30' );
|
|
42
48
|
|
|
43
49
|
const onPositionChange = ( newPosition: string | null, previousPosition: string | null | undefined ) => {
|
|
50
|
+
const meta = { history: { propDisplayName: DIMENSIONS_LABEL } };
|
|
51
|
+
|
|
44
52
|
if ( newPosition === 'static' ) {
|
|
45
53
|
if ( dimensions ) {
|
|
46
54
|
updateDimensionsHistory( dimensions );
|
|
47
|
-
setDimensions(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
setDimensions(
|
|
56
|
+
{
|
|
57
|
+
'inset-block-start': undefined,
|
|
58
|
+
'inset-block-end': undefined,
|
|
59
|
+
'inset-inline-start': undefined,
|
|
60
|
+
'inset-inline-end': undefined,
|
|
61
|
+
},
|
|
62
|
+
meta
|
|
63
|
+
);
|
|
53
64
|
}
|
|
54
65
|
} else if ( previousPosition === 'static' ) {
|
|
55
66
|
if ( dimensionsValuesFromHistory ) {
|
|
56
|
-
setDimensions( dimensionsValuesFromHistory );
|
|
67
|
+
setDimensions( dimensionsValuesFromHistory, meta );
|
|
57
68
|
clearDimensionsHistory();
|
|
58
69
|
}
|
|
59
70
|
}
|
|
@@ -52,9 +52,12 @@ const CssSizeProps = [
|
|
|
52
52
|
];
|
|
53
53
|
|
|
54
54
|
const ASPECT_RATIO_LABEL = __( 'Aspect Ratio', 'elementor' );
|
|
55
|
+
const OBJECT_FIT_LABEL = __( 'Object fit', 'elementor' );
|
|
55
56
|
|
|
56
57
|
export const SizeSection = () => {
|
|
57
|
-
const { value: fitValue } = useStylesField< StringPropValue >( 'object-fit'
|
|
58
|
+
const { value: fitValue } = useStylesField< StringPropValue >( 'object-fit', {
|
|
59
|
+
history: { propDisplayName: OBJECT_FIT_LABEL },
|
|
60
|
+
} );
|
|
58
61
|
|
|
59
62
|
const isNotFill = fitValue && fitValue?.value !== 'fill';
|
|
60
63
|
|
|
@@ -27,7 +27,9 @@ const initTextStroke = {
|
|
|
27
27
|
const TEXT_STROKE_LABEL = __( 'Text stroke', 'elementor' );
|
|
28
28
|
|
|
29
29
|
export const TextStrokeField = () => {
|
|
30
|
-
const { value, setValue, canEdit } = useStylesField( 'stroke'
|
|
30
|
+
const { value, setValue, canEdit } = useStylesField( 'stroke', {
|
|
31
|
+
history: { propDisplayName: TEXT_STROKE_LABEL },
|
|
32
|
+
} );
|
|
31
33
|
|
|
32
34
|
const addTextStroke = () => {
|
|
33
35
|
setValue( initTextStroke );
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { NumberPropValue } from '@elementor/editor-props';
|
|
3
3
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
4
5
|
|
|
5
6
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
6
7
|
import { PanelDivider } from '../../panel-divider';
|
|
@@ -22,8 +23,12 @@ import { TextStrokeField } from './text-stroke-field';
|
|
|
22
23
|
import { TransformField } from './transform-field';
|
|
23
24
|
import { WordSpacingField } from './word-spacing-field';
|
|
24
25
|
|
|
26
|
+
const COLUMN_COUNT_LABEL = __( 'Column count', 'elementor' );
|
|
27
|
+
|
|
25
28
|
export const TypographySection = () => {
|
|
26
|
-
const { value: columnCount } = useStylesField< NumberPropValue >( 'column-count'
|
|
29
|
+
const { value: columnCount } = useStylesField< NumberPropValue >( 'column-count', {
|
|
30
|
+
history: { propDisplayName: COLUMN_COUNT_LABEL },
|
|
31
|
+
} );
|
|
27
32
|
const hasMultiColumns = !! ( columnCount?.value && columnCount?.value > 1 );
|
|
28
33
|
|
|
29
34
|
const isVersion330Active = isExperimentActive( 'e_v_3_30' );
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
getElementLabel,
|
|
8
8
|
getElementSetting,
|
|
9
9
|
updateElementSettings,
|
|
10
|
-
|
|
10
|
+
useElementSettings,
|
|
11
11
|
} from '@elementor/editor-elements';
|
|
12
|
-
import { type PropKey, type PropValue } from '@elementor/editor-props';
|
|
12
|
+
import { type PropKey, type PropType, type PropValue, shouldApplyEffect } from '@elementor/editor-props';
|
|
13
13
|
import { isExperimentActive, undoable } from '@elementor/editor-v1-adapters';
|
|
14
14
|
import { __ } from '@wordpress/i18n';
|
|
15
15
|
|
|
@@ -26,9 +26,9 @@ type Props = {
|
|
|
26
26
|
export const SettingsField = ( { bind, children, propDisplayName }: Props ) => {
|
|
27
27
|
const { element, elementType } = useElement();
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const elementSettingValues = useElementSettings< PropValue >( element.id, Object.keys( elementType.propsSchema ) );
|
|
30
30
|
|
|
31
|
-
const value = { [ bind ]:
|
|
31
|
+
const value = { [ bind ]: elementSettingValues?.[ bind ] };
|
|
32
32
|
|
|
33
33
|
const propType = createTopLevelOjectType( { schema: elementType.propsSchema } );
|
|
34
34
|
|
|
@@ -48,13 +48,29 @@ export const SettingsField = ( { bind, children, propDisplayName }: Props ) => {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
const isDisabled = ( prop: PropType ) => getDisableState( prop, elementSettingValues );
|
|
52
|
+
|
|
51
53
|
return (
|
|
52
|
-
<PropProvider propType={ propType } value={ value } setValue={ setValue }>
|
|
54
|
+
<PropProvider propType={ propType } value={ value } setValue={ setValue } isDisabled={ isDisabled }>
|
|
53
55
|
<PropKeyProvider bind={ bind }>{ children }</PropKeyProvider>
|
|
54
56
|
</PropProvider>
|
|
55
57
|
);
|
|
56
58
|
};
|
|
57
59
|
|
|
60
|
+
function getDisableState( propType: PropType, elementValues: PropValue ): boolean | undefined {
|
|
61
|
+
const disablingDependencies = propType.dependencies?.filter( ( { effect } ) => effect === 'disable' ) || [];
|
|
62
|
+
|
|
63
|
+
if ( ! disablingDependencies.length ) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if ( disablingDependencies.length > 1 ) {
|
|
68
|
+
throw new Error( 'Multiple disabling dependencies are not supported.' );
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return shouldApplyEffect( disablingDependencies[ 0 ], elementValues );
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
type UndoableUpdateElementSettingsArgs = {
|
|
59
75
|
newValue: Record< string, PropValue >;
|
|
60
76
|
};
|
|
@@ -16,8 +16,10 @@ export type StylesFieldProps = {
|
|
|
16
16
|
propDisplayName: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const StylesField = ( { bind, placeholder, children }: StylesFieldProps ) => {
|
|
20
|
-
const { value, setValue, canEdit } = useStylesField( bind
|
|
19
|
+
export const StylesField = ( { bind, placeholder, propDisplayName, children }: StylesFieldProps ) => {
|
|
20
|
+
const { value, setValue, canEdit } = useStylesField( bind, {
|
|
21
|
+
history: { propDisplayName },
|
|
22
|
+
} );
|
|
21
23
|
|
|
22
24
|
const isVersion331Active = isExperimentActive( 'e_v_3_31' );
|
|
23
25
|
const stylesInheritanceChain = useStylesInheritanceChain( [ bind ] );
|
|
@@ -49,7 +51,7 @@ export const StylesField = ( { bind, placeholder, children }: StylesFieldProps )
|
|
|
49
51
|
value={ values }
|
|
50
52
|
setValue={ setValues }
|
|
51
53
|
placeholder={ placeholderValues }
|
|
52
|
-
|
|
54
|
+
isDisabled={ () => ! canEdit }
|
|
53
55
|
>
|
|
54
56
|
<PropKeyProvider bind={ bind }>{ children }</PropKeyProvider>
|
|
55
57
|
</PropProvider>
|