@elementor/editor-controls 3.32.0-73 → 3.32.0-75
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 +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +485 -499
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +417 -431
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/unstable-repeater/actions/tooltip-add-item-action.tsx +1 -1
- package/src/components/unstable-repeater/header/header.tsx +12 -19
- package/src/controls/gap-control.tsx +2 -3
- package/src/controls/linked-dimensions-control.tsx +106 -109
- package/src/controls/transform-control/transform-base-control.tsx +38 -34
- package/src/controls/transform-control/transform-base-controls/children-perspective-control.tsx +58 -48
- package/src/controls/transform-control/transform-base-controls/transform-origin-control.tsx +26 -34
- package/src/controls/transform-control/transform-repeater-control.tsx +38 -6
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-75",
|
|
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-75",
|
|
44
|
+
"@elementor/editor-elements": "3.32.0-75",
|
|
45
|
+
"@elementor/editor-props": "3.32.0-75",
|
|
46
|
+
"@elementor/editor-responsive": "3.32.0-75",
|
|
47
|
+
"@elementor/editor-ui": "3.32.0-75",
|
|
48
|
+
"@elementor/editor-v1-adapters": "3.32.0-75",
|
|
49
|
+
"@elementor/env": "3.32.0-75",
|
|
50
|
+
"@elementor/http-client": "3.32.0-75",
|
|
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-75",
|
|
53
|
+
"@elementor/query": "3.32.0-75",
|
|
54
|
+
"@elementor/session": "3.32.0-75",
|
|
55
55
|
"@elementor/ui": "1.36.8",
|
|
56
|
-
"@elementor/utils": "3.32.0-
|
|
57
|
-
"@elementor/wp-media": "3.32.0-
|
|
56
|
+
"@elementor/utils": "3.32.0-75",
|
|
57
|
+
"@elementor/wp-media": "3.32.0-75",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0",
|
|
59
59
|
"@monaco-editor/react": "^4.7.0"
|
|
60
60
|
},
|
|
@@ -26,7 +26,7 @@ export const TooltipAddItemAction = ( {
|
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<ConditionalToolTip content={ tooltipContent } enable={ enableTooltip }>
|
|
29
|
-
<Box sx={ {
|
|
29
|
+
<Box component="span" sx={ { cursor: disabled ? 'not-allowed' : 'pointer' } }>
|
|
30
30
|
<IconButton
|
|
31
31
|
size={ SIZE }
|
|
32
32
|
disabled={ disabled }
|
|
@@ -4,31 +4,24 @@ import { Box, Stack, Typography } from '@elementor/ui';
|
|
|
4
4
|
import { useBoundProp } from '../../../bound-prop-context/use-bound-prop';
|
|
5
5
|
import { ControlAdornments } from '../../../control-adornments/control-adornments';
|
|
6
6
|
import { SlotChildren } from '../../../control-replacements';
|
|
7
|
-
import { TransformBaseControl } from '../../../controls/transform-control/transform-base-control';
|
|
8
7
|
import { TooltipAddItemAction } from '../actions/tooltip-add-item-action';
|
|
9
8
|
import { RepeaterHeaderActionsSlot } from '../locations';
|
|
10
9
|
|
|
11
|
-
export const Header = ( { label, children }: React.PropsWithChildren< { label: string }
|
|
10
|
+
export const Header = React.forwardRef( ( { label, children }: React.PropsWithChildren< { label: string } >, ref ) => {
|
|
12
11
|
const { value } = useBoundProp();
|
|
13
12
|
|
|
14
13
|
return (
|
|
15
|
-
<Stack
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
<Typography component="label" variant="caption" color="text.secondary" sx={ { lineHeight: 1 } }>
|
|
23
|
-
{ label }
|
|
24
|
-
</Typography>
|
|
25
|
-
<ControlAdornments />
|
|
26
|
-
<RepeaterHeaderActionsSlot value={ value } />
|
|
27
|
-
<Box sx={ { ml: 'auto' } }>
|
|
28
|
-
<SlotChildren whitelist={ [ TransformBaseControl, TooltipAddItemAction ] as React.FC[] } sorted>
|
|
29
|
-
{ children }
|
|
30
|
-
</SlotChildren>
|
|
14
|
+
<Stack direction="row" alignItems="center" gap={ 1 } sx={ { marginInlineEnd: -0.75, py: 0.25 } } ref={ ref }>
|
|
15
|
+
<Box display="flex" alignItems="center" gap={ 1 } sx={ { flexGrow: 1 } }>
|
|
16
|
+
<Typography component="label" variant="caption" color="text.secondary" sx={ { lineHeight: 1 } }>
|
|
17
|
+
{ label }
|
|
18
|
+
</Typography>
|
|
19
|
+
<ControlAdornments />
|
|
31
20
|
</Box>
|
|
21
|
+
<RepeaterHeaderActionsSlot value={ value } />
|
|
22
|
+
<SlotChildren whitelist={ [ TooltipAddItemAction ] as React.FC[] } sorted>
|
|
23
|
+
{ children }
|
|
24
|
+
</SlotChildren>
|
|
32
25
|
</Stack>
|
|
33
26
|
);
|
|
34
|
-
};
|
|
27
|
+
} );
|
|
@@ -8,10 +8,9 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
|
|
9
9
|
import { ControlFormLabel } from '../components/control-form-label';
|
|
10
10
|
import { ControlLabel } from '../components/control-label';
|
|
11
|
-
import { createControl } from '../create-control';
|
|
12
11
|
import { SizeControl } from './size-control';
|
|
13
12
|
|
|
14
|
-
export const GapControl =
|
|
13
|
+
export const GapControl = ( { label }: { label: string } ) => {
|
|
15
14
|
const {
|
|
16
15
|
value: directionValue,
|
|
17
16
|
setValue: setDirectionValue,
|
|
@@ -87,7 +86,7 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
87
86
|
</Stack>
|
|
88
87
|
</PropProvider>
|
|
89
88
|
);
|
|
90
|
-
}
|
|
89
|
+
};
|
|
91
90
|
|
|
92
91
|
const Control = ( {
|
|
93
92
|
bind,
|
|
@@ -9,120 +9,117 @@ import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-conte
|
|
|
9
9
|
import { ControlFormLabel } from '../components/control-form-label';
|
|
10
10
|
import { ControlLabel } from '../components/control-label';
|
|
11
11
|
import { StyledToggleButton } from '../components/control-toggle-button-group';
|
|
12
|
-
import { createControl } from '../create-control';
|
|
13
12
|
import { type ExtendedOption } from '../utils/size-control';
|
|
14
13
|
import { SizeControl } from './size-control';
|
|
15
14
|
|
|
16
|
-
export const LinkedDimensionsControl =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const disabled = sizeDisabled || dimensionsDisabled;
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<PropProvider
|
|
77
|
-
propType={ propType }
|
|
78
|
-
value={ dimensionsValue }
|
|
79
|
-
setValue={ setDimensionsValue }
|
|
80
|
-
placeholder={ dimensionsPlaceholder }
|
|
81
|
-
isDisabled={ () => disabled }
|
|
82
|
-
>
|
|
83
|
-
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
84
|
-
<ControlFormLabel>{ label }</ControlFormLabel>
|
|
85
|
-
<Tooltip title={ isLinked ? unlinkedLabel : linkedLabel } placement="top">
|
|
86
|
-
<StyledToggleButton
|
|
87
|
-
aria-label={ isLinked ? unlinkedLabel : linkedLabel }
|
|
88
|
-
size={ 'tiny' }
|
|
89
|
-
value={ 'check' }
|
|
90
|
-
selected={ isLinked }
|
|
91
|
-
sx={ { marginLeft: 'auto' } }
|
|
92
|
-
onChange={ onLinkToggle }
|
|
93
|
-
disabled={ disabled }
|
|
94
|
-
isPlaceholder={ hasPlaceholders }
|
|
95
|
-
>
|
|
96
|
-
<LinkedIcon fontSize={ 'tiny' } />
|
|
97
|
-
</StyledToggleButton>
|
|
98
|
-
</Tooltip>
|
|
99
|
-
</Stack>
|
|
15
|
+
export const LinkedDimensionsControl = ( {
|
|
16
|
+
label,
|
|
17
|
+
isSiteRtl = false,
|
|
18
|
+
extendedOptions,
|
|
19
|
+
min,
|
|
20
|
+
}: {
|
|
21
|
+
label: string;
|
|
22
|
+
isSiteRtl?: boolean;
|
|
23
|
+
extendedOptions?: ExtendedOption[];
|
|
24
|
+
min?: number;
|
|
25
|
+
} ) => {
|
|
26
|
+
const {
|
|
27
|
+
value: sizeValue,
|
|
28
|
+
setValue: setSizeValue,
|
|
29
|
+
disabled: sizeDisabled,
|
|
30
|
+
placeholder: sizePlaceholder,
|
|
31
|
+
} = useBoundProp( sizePropTypeUtil );
|
|
32
|
+
const gridRowRefs: RefObject< HTMLDivElement >[] = [ useRef( null ), useRef( null ) ];
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
value: dimensionsValue,
|
|
36
|
+
setValue: setDimensionsValue,
|
|
37
|
+
propType,
|
|
38
|
+
placeholder: dimensionsPlaceholder,
|
|
39
|
+
disabled: dimensionsDisabled,
|
|
40
|
+
} = useBoundProp( dimensionsPropTypeUtil );
|
|
41
|
+
|
|
42
|
+
const hasUserValues = !! ( dimensionsValue || sizeValue );
|
|
43
|
+
const hasPlaceholders = !! ( sizePlaceholder || dimensionsPlaceholder );
|
|
44
|
+
|
|
45
|
+
const isLinked =
|
|
46
|
+
( ! hasUserValues && ! hasPlaceholders ) || ( hasPlaceholders ? !! sizePlaceholder : !! sizeValue );
|
|
47
|
+
const onLinkToggle = () => {
|
|
48
|
+
if ( ! isLinked ) {
|
|
49
|
+
setSizeValue( dimensionsValue[ 'block-start' ]?.value ?? null );
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const value = sizeValue ? sizePropTypeUtil.create( sizeValue ) : null;
|
|
54
|
+
|
|
55
|
+
setDimensionsValue( {
|
|
56
|
+
'block-start': value,
|
|
57
|
+
'block-end': value,
|
|
58
|
+
'inline-start': value,
|
|
59
|
+
'inline-end': value,
|
|
60
|
+
} );
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const tooltipLabel = label.toLowerCase();
|
|
64
|
+
|
|
65
|
+
const LinkedIcon = isLinked ? LinkIcon : DetachIcon;
|
|
66
|
+
// translators: %s: Tooltip title.
|
|
67
|
+
const linkedLabel = __( 'Link %s', 'elementor' ).replace( '%s', tooltipLabel );
|
|
68
|
+
// translators: %s: Tooltip title.
|
|
69
|
+
const unlinkedLabel = __( 'Unlink %s', 'elementor' ).replace( '%s', tooltipLabel );
|
|
70
|
+
|
|
71
|
+
const disabled = sizeDisabled || dimensionsDisabled;
|
|
100
72
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
73
|
+
return (
|
|
74
|
+
<PropProvider
|
|
75
|
+
propType={ propType }
|
|
76
|
+
value={ dimensionsValue }
|
|
77
|
+
setValue={ setDimensionsValue }
|
|
78
|
+
placeholder={ dimensionsPlaceholder }
|
|
79
|
+
isDisabled={ () => disabled }
|
|
80
|
+
>
|
|
81
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
82
|
+
<ControlFormLabel>{ label }</ControlFormLabel>
|
|
83
|
+
<Tooltip title={ isLinked ? unlinkedLabel : linkedLabel } placement="top">
|
|
84
|
+
<StyledToggleButton
|
|
85
|
+
aria-label={ isLinked ? unlinkedLabel : linkedLabel }
|
|
86
|
+
size={ 'tiny' }
|
|
87
|
+
value={ 'check' }
|
|
88
|
+
selected={ isLinked }
|
|
89
|
+
sx={ { marginLeft: 'auto' } }
|
|
90
|
+
onChange={ onLinkToggle }
|
|
91
|
+
disabled={ disabled }
|
|
92
|
+
isPlaceholder={ hasPlaceholders }
|
|
93
|
+
>
|
|
94
|
+
<LinkedIcon fontSize={ 'tiny' } />
|
|
95
|
+
</StyledToggleButton>
|
|
96
|
+
</Tooltip>
|
|
97
|
+
</Stack>
|
|
98
|
+
|
|
99
|
+
{ getCssDimensionProps( isSiteRtl ).map( ( row, index ) => (
|
|
100
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap" key={ index } ref={ gridRowRefs[ index ] }>
|
|
101
|
+
{ row.map( ( { icon, ...props } ) => (
|
|
102
|
+
<Grid container gap={ 0.75 } alignItems="center" key={ props.bind }>
|
|
103
|
+
<Grid item xs={ 12 }>
|
|
104
|
+
<Label { ...props } />
|
|
118
105
|
</Grid>
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
106
|
+
<Grid item xs={ 12 }>
|
|
107
|
+
<Control
|
|
108
|
+
bind={ props.bind }
|
|
109
|
+
startIcon={ icon }
|
|
110
|
+
isLinked={ isLinked }
|
|
111
|
+
extendedOptions={ extendedOptions }
|
|
112
|
+
anchorRef={ gridRowRefs[ index ] }
|
|
113
|
+
min={ min }
|
|
114
|
+
/>
|
|
115
|
+
</Grid>
|
|
116
|
+
</Grid>
|
|
117
|
+
) ) }
|
|
118
|
+
</Stack>
|
|
119
|
+
) ) }
|
|
120
|
+
</PropProvider>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
126
123
|
|
|
127
124
|
const Control = ( {
|
|
128
125
|
bind,
|
|
@@ -1,53 +1,57 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useRef } from 'react';
|
|
3
2
|
import { PopoverHeader } from '@elementor/editor-ui';
|
|
4
3
|
import { AdjustmentsIcon } from '@elementor/icons';
|
|
5
|
-
import { bindPopover,
|
|
4
|
+
import { bindPopover, Box, Divider, Popover, type PopupState } from '@elementor/ui';
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
|
|
7
|
+
import { PropKeyProvider } from '../../bound-prop-context';
|
|
8
|
+
import { PopoverContent } from '../../components/popover-content';
|
|
8
9
|
import { ChildrenPerspectiveControl } from './transform-base-controls/children-perspective-control';
|
|
9
10
|
import { TransformOriginControl } from './transform-base-controls/transform-origin-control';
|
|
10
11
|
|
|
11
12
|
const SIZE = 'tiny';
|
|
12
13
|
|
|
13
|
-
export const TransformBaseControl = ( {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export const TransformBaseControl = ( {
|
|
15
|
+
popupState,
|
|
16
|
+
anchorRef,
|
|
17
|
+
}: {
|
|
18
|
+
popupState: PopupState;
|
|
19
|
+
anchorRef: React.RefObject< HTMLDivElement | null >;
|
|
20
|
+
} ) => {
|
|
16
21
|
const popupProps = bindPopover( {
|
|
17
22
|
...popupState,
|
|
18
23
|
anchorEl: anchorRef.current ?? undefined,
|
|
19
24
|
} );
|
|
20
25
|
|
|
21
26
|
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Popover
|
|
31
|
-
disablePortal
|
|
32
|
-
slotProps={ {
|
|
33
|
-
paper: {
|
|
34
|
-
sx: {
|
|
35
|
-
width: anchorRef.current?.offsetWidth + 'px',
|
|
36
|
-
},
|
|
27
|
+
<Popover
|
|
28
|
+
disablePortal
|
|
29
|
+
anchorOrigin={ { vertical: 'bottom', horizontal: 'left' } }
|
|
30
|
+
slotProps={ {
|
|
31
|
+
paper: {
|
|
32
|
+
sx: {
|
|
33
|
+
width: ( anchorRef.current?.offsetWidth || 0 ) - 6 + 'px',
|
|
34
|
+
mt: 0.5,
|
|
37
35
|
},
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
},
|
|
37
|
+
} }
|
|
38
|
+
{ ...popupProps }
|
|
39
|
+
>
|
|
40
|
+
<PopoverHeader
|
|
41
|
+
title={ __( 'Base Transform', 'elementor' ) }
|
|
42
|
+
onClose={ popupState.close }
|
|
43
|
+
icon={ <AdjustmentsIcon fontSize={ SIZE } /> }
|
|
44
|
+
/>
|
|
45
|
+
<Divider />
|
|
46
|
+
<PopoverContent sx={ { px: 2, py: 1.5 } }>
|
|
47
|
+
<PropKeyProvider bind={ 'transform-origin' }>
|
|
48
|
+
<TransformOriginControl />
|
|
49
|
+
</PropKeyProvider>
|
|
50
|
+
<Box sx={ { my: 0.5 } }>
|
|
51
|
+
<Divider />
|
|
52
|
+
</Box>
|
|
53
|
+
<ChildrenPerspectiveControl />
|
|
54
|
+
</PopoverContent>
|
|
55
|
+
</Popover>
|
|
52
56
|
);
|
|
53
57
|
};
|
package/src/controls/transform-control/transform-base-controls/children-perspective-control.tsx
CHANGED
|
@@ -1,78 +1,88 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { perspectiveOriginPropTypeUtil } from '@elementor/editor-props';
|
|
3
|
+
import { Grid, Stack } from '@elementor/ui';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
6
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../../../bound-prop-context';
|
|
7
7
|
import { ControlFormLabel } from '../../../components/control-form-label';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { PopoverGridContainer } from '../../../components/popover-grid-container';
|
|
9
|
+
import { type LengthUnit } from '../../../utils/size-control';
|
|
10
10
|
import { SizeControl } from '../../size-control';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type FieldProps = {
|
|
13
|
+
label: string;
|
|
14
|
+
bind: string;
|
|
15
|
+
units: LengthUnit[];
|
|
16
|
+
};
|
|
13
17
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const ORIGIN_UNITS: LengthUnit[] = [ 'px', '%', 'em', 'rem' ];
|
|
19
|
+
|
|
20
|
+
const PERSPECTIVE_CONTROL_FIELD: FieldProps = {
|
|
21
|
+
label: __( 'Perspective', 'elementor' ),
|
|
22
|
+
bind: 'perspective',
|
|
23
|
+
units: [ 'px', 'em', 'rem', 'vw', 'vh' ],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const CHILDREN_PERSPECTIVE_FIELDS: FieldProps[] = [
|
|
20
27
|
{
|
|
21
28
|
label: __( 'Origin X', 'elementor' ),
|
|
22
|
-
|
|
29
|
+
bind: 'x',
|
|
23
30
|
units: ORIGIN_UNITS,
|
|
24
31
|
},
|
|
25
32
|
{
|
|
26
33
|
label: __( 'Origin Y', 'elementor' ),
|
|
27
|
-
|
|
34
|
+
bind: 'y',
|
|
28
35
|
units: ORIGIN_UNITS,
|
|
29
36
|
},
|
|
30
37
|
] as const;
|
|
31
38
|
|
|
32
|
-
export const ChildrenPerspectiveControl = (
|
|
39
|
+
export const ChildrenPerspectiveControl = () => {
|
|
33
40
|
return (
|
|
34
41
|
<Stack direction="column" spacing={ 1.5 }>
|
|
35
|
-
<ControlFormLabel
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<Grid container spacing={ 1.5 } ref={ rowRef }>
|
|
39
|
-
{ CHILDREN_PERSPECTIVE_FIELDS.map( ( control ) => (
|
|
40
|
-
<ControlFields control={ control } rowRef={ rowRef } key={ control.bindValue } />
|
|
41
|
-
) ) }
|
|
42
|
-
<Divider sx={ { py: 3 } } />
|
|
43
|
-
</Grid>
|
|
42
|
+
<ControlFormLabel>{ __( 'Children perspective', 'elementor' ) }</ControlFormLabel>
|
|
43
|
+
<PerspectiveControl />
|
|
44
|
+
<PerspectiveOriginControl />
|
|
44
45
|
</Stack>
|
|
45
46
|
);
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
const PerspectiveControl = () => (
|
|
50
|
+
<PropKeyProvider bind={ 'perspective' }>
|
|
51
|
+
<ControlFields control={ PERSPECTIVE_CONTROL_FIELD } key={ PERSPECTIVE_CONTROL_FIELD.bind } />
|
|
52
|
+
</PropKeyProvider>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const PerspectiveOriginControl = () => (
|
|
56
|
+
<PropKeyProvider bind={ 'perspective-origin' }>
|
|
57
|
+
<PerspectiveOriginControlProvider />
|
|
58
|
+
</PropKeyProvider>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const PerspectiveOriginControlProvider = () => {
|
|
62
|
+
const context = useBoundProp( perspectiveOriginPropTypeUtil );
|
|
56
63
|
|
|
57
64
|
return (
|
|
58
65
|
<PropProvider { ...context }>
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</Grid>
|
|
65
|
-
<Grid item xs={ 6 } sx={ { pr: 3 } }>
|
|
66
|
-
<SizeControl
|
|
67
|
-
variant="length"
|
|
68
|
-
units={ [ ...control.units ] }
|
|
69
|
-
anchorRef={ rowRef }
|
|
70
|
-
disableCustom
|
|
71
|
-
/>
|
|
72
|
-
</Grid>
|
|
73
|
-
</Grid>
|
|
74
|
-
</Grid>
|
|
75
|
-
</PropKeyProvider>
|
|
66
|
+
{ CHILDREN_PERSPECTIVE_FIELDS.map( ( control ) => (
|
|
67
|
+
<PropKeyProvider bind={ control.bind } key={ control.bind }>
|
|
68
|
+
<ControlFields control={ control } />
|
|
69
|
+
</PropKeyProvider>
|
|
70
|
+
) ) }
|
|
76
71
|
</PropProvider>
|
|
77
72
|
);
|
|
78
73
|
};
|
|
74
|
+
|
|
75
|
+
const ControlFields = ( { control }: { control: FieldProps } ) => {
|
|
76
|
+
const rowRef = React.useRef< HTMLDivElement >( null );
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<PopoverGridContainer ref={ rowRef }>
|
|
80
|
+
<Grid item xs={ 6 }>
|
|
81
|
+
<ControlFormLabel>{ control.label }</ControlFormLabel>
|
|
82
|
+
</Grid>
|
|
83
|
+
<Grid item xs={ 6 }>
|
|
84
|
+
<SizeControl variant="length" units={ control.units } anchorRef={ rowRef } disableCustom />
|
|
85
|
+
</Grid>
|
|
86
|
+
</PopoverGridContainer>
|
|
87
|
+
);
|
|
88
|
+
};
|