@elementor/editor-editing-panel 1.29.1 → 1.30.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 +27 -0
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +101 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/components/css-classes/css-class-item.tsx +1 -0
- package/src/components/editing-panel.tsx +5 -5
- package/src/components/style-sections/layout-section/align-self-child-field.tsx +44 -11
- package/src/components/style-sections/layout-section/layout-section.tsx +5 -4
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +1 -2
- package/src/control-replacement.tsx +2 -2
- package/src/dynamics/components/dynamic-selection-control.tsx +8 -13
- package/src/dynamics/init.ts +2 -2
- package/src/index.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,24 +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": "0.
|
|
42
|
+
"@elementor/editor": "0.19.0",
|
|
43
|
+
"@elementor/editor-canvas": "0.19.0",
|
|
44
|
+
"@elementor/editor-controls": "0.27.0",
|
|
45
45
|
"@elementor/editor-current-user": "0.3.0",
|
|
46
46
|
"@elementor/editor-elements": "0.8.1",
|
|
47
|
-
"@elementor/editor-panels": "0.
|
|
47
|
+
"@elementor/editor-panels": "0.15.0",
|
|
48
48
|
"@elementor/editor-props": "0.12.0",
|
|
49
49
|
"@elementor/editor-responsive": "0.13.4",
|
|
50
50
|
"@elementor/editor-styles": "0.6.6",
|
|
51
51
|
"@elementor/editor-styles-repository": "0.8.4",
|
|
52
|
-
"@elementor/editor-ui": "0.
|
|
52
|
+
"@elementor/editor-ui": "0.8.0",
|
|
53
53
|
"@elementor/editor-v1-adapters": "0.11.0",
|
|
54
54
|
"@elementor/icons": "1.37.0",
|
|
55
55
|
"@elementor/locations": "0.7.7",
|
|
56
56
|
"@elementor/menus": "0.1.4",
|
|
57
57
|
"@elementor/schema": "0.1.2",
|
|
58
58
|
"@elementor/session": "0.1.0",
|
|
59
|
-
"@elementor/ui": "1.
|
|
59
|
+
"@elementor/ui": "1.33.2",
|
|
60
60
|
"@elementor/utils": "0.4.0",
|
|
61
61
|
"@wordpress/i18n": "^5.13.0"
|
|
62
62
|
},
|
|
@@ -108,6 +108,7 @@ export function CssClassItem( {
|
|
|
108
108
|
} }
|
|
109
109
|
aria-pressed={ isActive }
|
|
110
110
|
sx={ ( theme: Theme ) => ( {
|
|
111
|
+
lineHeight: 1,
|
|
111
112
|
cursor: isActive && allowRename && ! isShowingState ? 'text' : 'pointer',
|
|
112
113
|
borderRadius: `${ theme.shape.borderRadius * 0.75 }px`,
|
|
113
114
|
'&.Mui-focusVisible': {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ControlActionsProvider,
|
|
2
|
+
import { ControlActionsProvider, ControlReplacementsProvider } from '@elementor/editor-controls';
|
|
3
3
|
import { useSelectedElement } from '@elementor/editor-elements';
|
|
4
4
|
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from '@elementor/editor-panels';
|
|
5
5
|
import { ThemeProvider } from '@elementor/editor-ui';
|
|
@@ -9,7 +9,7 @@ import { ErrorBoundary } from '@elementor/ui';
|
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
|
|
11
11
|
import { ElementProvider } from '../contexts/element-context';
|
|
12
|
-
import {
|
|
12
|
+
import { getControlReplacements } from '../control-replacement';
|
|
13
13
|
import { controlActionsMenu } from '../controls-actions';
|
|
14
14
|
import { EditorPanelErrorFallback } from './editing-panel-error-fallback';
|
|
15
15
|
import { EditingPanelTabs } from './editing-panel-tabs';
|
|
@@ -18,7 +18,7 @@ const { useMenuItems } = controlActionsMenu;
|
|
|
18
18
|
|
|
19
19
|
export const EditingPanel = () => {
|
|
20
20
|
const { element, elementType } = useSelectedElement();
|
|
21
|
-
const
|
|
21
|
+
const controlReplacements = getControlReplacements();
|
|
22
22
|
const menuItems = useMenuItems().default;
|
|
23
23
|
|
|
24
24
|
if ( ! element || ! elementType ) {
|
|
@@ -39,11 +39,11 @@ export const EditingPanel = () => {
|
|
|
39
39
|
</PanelHeader>
|
|
40
40
|
<PanelBody>
|
|
41
41
|
<ControlActionsProvider items={ menuItems }>
|
|
42
|
-
<
|
|
42
|
+
<ControlReplacementsProvider replacements={ controlReplacements }>
|
|
43
43
|
<ElementProvider element={ element } elementType={ elementType }>
|
|
44
44
|
<EditingPanelTabs />
|
|
45
45
|
</ElementProvider>
|
|
46
|
-
</
|
|
46
|
+
</ControlReplacementsProvider>
|
|
47
47
|
</ControlActionsProvider>
|
|
48
48
|
</PanelBody>
|
|
49
49
|
</Panel>
|
|
@@ -1,57 +1,90 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import {
|
|
4
4
|
LayoutAlignCenterIcon as CenterIcon,
|
|
5
5
|
LayoutAlignLeftIcon,
|
|
6
6
|
LayoutAlignRightIcon,
|
|
7
7
|
LayoutDistributeVerticalIcon as JustifyIcon,
|
|
8
8
|
} from '@elementor/icons';
|
|
9
|
-
import { DirectionProvider, Grid, ThemeProvider, withDirection } from '@elementor/ui';
|
|
9
|
+
import { DirectionProvider, Grid, ThemeProvider, type ToggleButtonProps, withDirection } from '@elementor/ui';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
13
13
|
import { useDirection } from '../../../hooks/use-direction';
|
|
14
14
|
import { ControlLabel } from '../../control-label';
|
|
15
|
+
import { type FlexDirection } from './flex-direction-field';
|
|
15
16
|
import { RotatedIcon } from './utils/rotated-icon';
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
const ALIGN_SELF_CHILD_OFFSET_MAP: Record< FlexDirection, number > = {
|
|
19
|
+
row: 90,
|
|
20
|
+
'row-reverse': 90,
|
|
21
|
+
column: 0,
|
|
22
|
+
'column-reverse': 0,
|
|
23
|
+
};
|
|
18
24
|
|
|
19
25
|
const StartIcon = withDirection( LayoutAlignLeftIcon );
|
|
20
26
|
const EndIcon = withDirection( LayoutAlignRightIcon );
|
|
21
27
|
|
|
22
28
|
const iconProps = {
|
|
23
29
|
isClockwise: false,
|
|
24
|
-
offset: 90,
|
|
25
30
|
};
|
|
26
31
|
|
|
27
|
-
const
|
|
32
|
+
const getOptions = ( parentStyleDirection: FlexDirection ) => [
|
|
28
33
|
{
|
|
29
34
|
value: 'start',
|
|
30
35
|
label: __( 'Start', 'elementor' ),
|
|
31
|
-
renderContent: ( { size }
|
|
36
|
+
renderContent: ( { size }: { size: ToggleButtonProps[ 'size' ] } ) => (
|
|
37
|
+
<RotatedIcon
|
|
38
|
+
icon={ StartIcon }
|
|
39
|
+
size={ size }
|
|
40
|
+
offset={ ALIGN_SELF_CHILD_OFFSET_MAP[ parentStyleDirection ] }
|
|
41
|
+
{ ...iconProps }
|
|
42
|
+
/>
|
|
43
|
+
),
|
|
32
44
|
showTooltip: true,
|
|
33
45
|
},
|
|
34
46
|
{
|
|
35
47
|
value: 'center',
|
|
36
48
|
label: __( 'Center', 'elementor' ),
|
|
37
|
-
renderContent: ( { size }
|
|
49
|
+
renderContent: ( { size }: { size: ToggleButtonProps[ 'size' ] } ) => (
|
|
50
|
+
<RotatedIcon
|
|
51
|
+
icon={ CenterIcon }
|
|
52
|
+
size={ size }
|
|
53
|
+
offset={ ALIGN_SELF_CHILD_OFFSET_MAP[ parentStyleDirection ] }
|
|
54
|
+
{ ...iconProps }
|
|
55
|
+
/>
|
|
56
|
+
),
|
|
38
57
|
showTooltip: true,
|
|
39
58
|
},
|
|
40
59
|
{
|
|
41
60
|
value: 'end',
|
|
42
61
|
label: __( 'End', 'elementor' ),
|
|
43
|
-
renderContent: ( { size }
|
|
62
|
+
renderContent: ( { size }: { size: ToggleButtonProps[ 'size' ] } ) => (
|
|
63
|
+
<RotatedIcon
|
|
64
|
+
icon={ EndIcon }
|
|
65
|
+
size={ size }
|
|
66
|
+
offset={ ALIGN_SELF_CHILD_OFFSET_MAP[ parentStyleDirection ] }
|
|
67
|
+
{ ...iconProps }
|
|
68
|
+
/>
|
|
69
|
+
),
|
|
44
70
|
showTooltip: true,
|
|
45
71
|
},
|
|
46
72
|
{
|
|
47
73
|
value: 'stretch',
|
|
48
74
|
label: __( 'Stretch', 'elementor' ),
|
|
49
|
-
renderContent: ( { size }
|
|
75
|
+
renderContent: ( { size }: { size: ToggleButtonProps[ 'size' ] } ) => (
|
|
76
|
+
<RotatedIcon
|
|
77
|
+
icon={ JustifyIcon }
|
|
78
|
+
size={ size }
|
|
79
|
+
offset={ ALIGN_SELF_CHILD_OFFSET_MAP[ parentStyleDirection ] }
|
|
80
|
+
{ ...iconProps }
|
|
81
|
+
/>
|
|
82
|
+
),
|
|
50
83
|
showTooltip: true,
|
|
51
84
|
},
|
|
52
85
|
];
|
|
53
86
|
|
|
54
|
-
export const AlignSelfChild = () => {
|
|
87
|
+
export const AlignSelfChild = ( { parentStyleDirection }: { parentStyleDirection: FlexDirection } ) => {
|
|
55
88
|
const { isSiteRtl } = useDirection();
|
|
56
89
|
|
|
57
90
|
return (
|
|
@@ -63,7 +96,7 @@ export const AlignSelfChild = () => {
|
|
|
63
96
|
<ControlLabel>{ __( 'Align self', 'elementor' ) }</ControlLabel>
|
|
64
97
|
</Grid>
|
|
65
98
|
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
66
|
-
<ToggleControl options={
|
|
99
|
+
<ToggleControl options={ getOptions( parentStyleDirection as FlexDirection ) } />
|
|
67
100
|
</Grid>
|
|
68
101
|
</Grid>
|
|
69
102
|
</StylesField>
|
|
@@ -13,7 +13,7 @@ import { AlignContentField } from './align-content-field';
|
|
|
13
13
|
import { AlignItemsField } from './align-items-field';
|
|
14
14
|
import { AlignSelfChild } from './align-self-child-field';
|
|
15
15
|
import { DisplayField, useDisplayPlaceholderValue } from './display-field';
|
|
16
|
-
import { FlexDirectionField } from './flex-direction-field';
|
|
16
|
+
import { type FlexDirection, FlexDirectionField } from './flex-direction-field';
|
|
17
17
|
import { FlexOrderField } from './flex-order-field';
|
|
18
18
|
import { FlexSizeField } from './flex-size-field';
|
|
19
19
|
import { GapControlField } from './gap-control-field';
|
|
@@ -27,12 +27,13 @@ export const LayoutSection = () => {
|
|
|
27
27
|
const { element } = useElement();
|
|
28
28
|
const parent = useParentElement( element.id );
|
|
29
29
|
const parentStyle = useComputedStyle( parent?.id || null );
|
|
30
|
+
const parentStyleDirection = parentStyle?.flexDirection ?? 'row';
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
33
|
<SectionContent>
|
|
33
34
|
<DisplayField />
|
|
34
35
|
{ isDisplayFlex && <FlexFields /> }
|
|
35
|
-
{ 'flex' === parentStyle?.display && <FlexChildFields /> }
|
|
36
|
+
{ 'flex' === parentStyle?.display && <FlexChildFields parentStyleDirection={ parentStyleDirection } /> }
|
|
36
37
|
</SectionContent>
|
|
37
38
|
);
|
|
38
39
|
};
|
|
@@ -53,11 +54,11 @@ const FlexFields = () => {
|
|
|
53
54
|
);
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
const FlexChildFields = () => (
|
|
57
|
+
const FlexChildFields = ( { parentStyleDirection }: { parentStyleDirection: string } ) => (
|
|
57
58
|
<>
|
|
58
59
|
<PanelDivider />
|
|
59
60
|
<ControlFormLabel>{ __( 'Flex child', 'elementor' ) }</ControlFormLabel>
|
|
60
|
-
<AlignSelfChild />
|
|
61
|
+
<AlignSelfChild parentStyleDirection={ parentStyleDirection as FlexDirection } />
|
|
61
62
|
<FlexOrderField />
|
|
62
63
|
<FlexSizeField />
|
|
63
64
|
</>
|
|
@@ -36,10 +36,9 @@ export const RotatedIcon = ( {
|
|
|
36
36
|
disableRotationForReversed = false,
|
|
37
37
|
}: Props ) => {
|
|
38
38
|
const rotate = useRef( useGetTargetAngle( isClockwise, offset, disableRotationForReversed ) );
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
rotate.current = useGetTargetAngle( isClockwise, offset, disableRotationForReversed, rotate );
|
|
41
41
|
|
|
42
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
43
42
|
return <Icon fontSize={ size } sx={ { transition: '.3s', rotate: `${ rotate.current }deg` } } />;
|
|
44
43
|
};
|
|
45
44
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createControlReplacementsRegistry } from '@elementor/editor-controls';
|
|
2
2
|
|
|
3
|
-
export const {
|
|
3
|
+
export const { registerControlReplacement, getControlReplacements } = createControlReplacementsRegistry();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useId } from 'react';
|
|
3
2
|
import { ControlFormLabel, useBoundProp } from '@elementor/editor-controls';
|
|
4
3
|
import type { Control, ControlsSection } from '@elementor/editor-elements';
|
|
5
4
|
import { DatabaseIcon, SettingsIcon, XIcon } from '@elementor/icons';
|
|
@@ -38,11 +37,11 @@ const SIZE = 'tiny';
|
|
|
38
37
|
export const DynamicSelectionControl = () => {
|
|
39
38
|
const { setValue: setAnyValue } = useBoundProp();
|
|
40
39
|
const { bind, value } = useBoundProp( dynamicPropTypeUtil );
|
|
40
|
+
|
|
41
41
|
const [ propValueFromHistory ] = usePersistDynamicValue( bind );
|
|
42
|
-
const {
|
|
42
|
+
const selectionPopoverState = usePopupState( { variant: 'popover' } );
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
const selectionPopoverState = usePopupState( { variant: 'popover', popupId: selectionPopoverId } );
|
|
44
|
+
const { name: tagName = '' } = value;
|
|
46
45
|
|
|
47
46
|
const dynamicTag = useDynamicTag( tagName );
|
|
48
47
|
|
|
@@ -97,8 +96,7 @@ export const DynamicSelectionControl = () => {
|
|
|
97
96
|
};
|
|
98
97
|
|
|
99
98
|
export const DynamicSettingsPopover = ( { dynamicTag }: { dynamicTag: DynamicTag } ) => {
|
|
100
|
-
const
|
|
101
|
-
const settingsPopupState = usePopupState( { variant: 'popover', popupId } );
|
|
99
|
+
const popupState = usePopupState( { variant: 'popover' } );
|
|
102
100
|
|
|
103
101
|
const hasDynamicSettings = !! dynamicTag.atomic_controls.length;
|
|
104
102
|
|
|
@@ -108,23 +106,20 @@ export const DynamicSettingsPopover = ( { dynamicTag }: { dynamicTag: DynamicTag
|
|
|
108
106
|
|
|
109
107
|
return (
|
|
110
108
|
<>
|
|
111
|
-
<IconButton
|
|
112
|
-
size={ SIZE }
|
|
113
|
-
{ ...bindTrigger( settingsPopupState ) }
|
|
114
|
-
aria-label={ __( 'Settings', 'elementor' ) }
|
|
115
|
-
>
|
|
109
|
+
<IconButton size={ SIZE } { ...bindTrigger( popupState ) } aria-label={ __( 'Settings', 'elementor' ) }>
|
|
116
110
|
<SettingsIcon fontSize={ SIZE } />
|
|
117
111
|
</IconButton>
|
|
118
112
|
<Popover
|
|
113
|
+
disablePortal
|
|
119
114
|
disableScrollLock
|
|
120
115
|
anchorOrigin={ { vertical: 'bottom', horizontal: 'center' } }
|
|
121
|
-
{ ...bindPopover(
|
|
116
|
+
{ ...bindPopover( popupState ) }
|
|
122
117
|
>
|
|
123
118
|
<Paper component={ Stack } sx={ { minHeight: '300px', width: '220px' } }>
|
|
124
119
|
<Stack direction="row" alignItems="center" px={ 1.5 } pt={ 2 } pb={ 1 }>
|
|
125
120
|
<DatabaseIcon fontSize={ SIZE } sx={ { mr: 0.5 } } />
|
|
126
121
|
<Typography variant="subtitle2">{ dynamicTag.label }</Typography>
|
|
127
|
-
<IconButton sx={ { ml: 'auto' } } size={ SIZE } onClick={
|
|
122
|
+
<IconButton sx={ { ml: 'auto' } } size={ SIZE } onClick={ popupState.close }>
|
|
128
123
|
<XIcon fontSize={ SIZE } />
|
|
129
124
|
</IconButton>
|
|
130
125
|
</Stack>
|
package/src/dynamics/init.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { settingsTransformersRegistry, styleTransformersRegistry } from '@elementor/editor-canvas';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { registerControlReplacement } from '../control-replacement';
|
|
4
4
|
import { controlActionsMenu } from '../controls-actions';
|
|
5
5
|
import { DynamicSelectionControl } from './components/dynamic-selection-control';
|
|
6
6
|
import { dynamicTransformer } from './dynamic-transformer';
|
|
@@ -10,7 +10,7 @@ import { isDynamicPropValue } from './utils';
|
|
|
10
10
|
const { registerPopoverAction } = controlActionsMenu;
|
|
11
11
|
|
|
12
12
|
export const init = () => {
|
|
13
|
-
|
|
13
|
+
registerControlReplacement( {
|
|
14
14
|
component: DynamicSelectionControl,
|
|
15
15
|
condition: ( { value } ) => isDynamicPropValue( value ),
|
|
16
16
|
} );
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { useBoundProp } from '@elementor/editor-controls';
|
|
2
2
|
export type { PopoverActionProps } from './popover-action';
|
|
3
|
-
export {
|
|
3
|
+
export { registerControlReplacement } from './control-replacement';
|
|
4
4
|
export { injectIntoClassSelectorActions } from './components/css-classes/css-class-selector';
|
|
5
5
|
export { usePanelActions, usePanelStatus } from './panel';
|
|
6
|
+
export { controlActionsMenu } from './controls-actions';
|
|
6
7
|
|
|
7
8
|
export { init } from './init';
|