@elementor/editor-controls 3.32.0-33 → 3.32.0-35
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +524 -435
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +392 -304
- 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 +4 -1
- package/src/controls/transform-control/transform-base-control.tsx +50 -0
- package/src/controls/transform-control/transform-base-controls/transform-origin-control.tsx +70 -0
- package/src/index.ts +1 -0
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-35",
|
|
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-35",
|
|
44
|
+
"@elementor/editor-elements": "3.32.0-35",
|
|
45
|
+
"@elementor/editor-props": "3.32.0-35",
|
|
46
|
+
"@elementor/editor-responsive": "3.32.0-35",
|
|
47
|
+
"@elementor/editor-ui": "3.32.0-35",
|
|
48
|
+
"@elementor/editor-v1-adapters": "3.32.0-35",
|
|
49
|
+
"@elementor/env": "3.32.0-35",
|
|
50
|
+
"@elementor/http-client": "3.32.0-35",
|
|
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-35",
|
|
53
|
+
"@elementor/query": "3.32.0-35",
|
|
54
|
+
"@elementor/session": "3.32.0-35",
|
|
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-35",
|
|
57
|
+
"@elementor/wp-media": "3.32.0-35",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0",
|
|
59
59
|
"@monaco-editor/react": "^4.7.0"
|
|
60
60
|
},
|
|
@@ -4,6 +4,7 @@ import { 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';
|
|
7
8
|
import { TooltipAddItemAction } from '../actions/tooltip-add-item-action';
|
|
8
9
|
import { RepeaterHeaderActionsSlot } from '../locations';
|
|
9
10
|
|
|
@@ -16,7 +17,9 @@ export const Header = ( { label, children }: React.PropsWithChildren< { label: s
|
|
|
16
17
|
{ label }
|
|
17
18
|
</Typography>
|
|
18
19
|
<RepeaterHeaderActionsSlot value={ value } />
|
|
19
|
-
<SlotChildren whitelist={ [ TooltipAddItemAction ] as React.FC[] }
|
|
20
|
+
<SlotChildren whitelist={ [ TransformBaseControl, TooltipAddItemAction ] as React.FC[] } sorted>
|
|
21
|
+
{ children }
|
|
22
|
+
</SlotChildren>
|
|
20
23
|
<ControlAdornments />
|
|
21
24
|
</Stack>
|
|
22
25
|
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { PopoverHeader } from '@elementor/editor-ui';
|
|
4
|
+
import { AdjustmentsIcon } from '@elementor/icons';
|
|
5
|
+
import { bindPopover, bindTrigger, Divider, IconButton, Popover, usePopupState } from '@elementor/ui';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
import { TransformOriginControl } from './transform-base-controls/transform-origin-control';
|
|
9
|
+
|
|
10
|
+
const SIZE = 'tiny';
|
|
11
|
+
|
|
12
|
+
export const TransformBaseControl = ( { anchorRef }: { anchorRef: React.RefObject< HTMLDivElement | null > } ) => {
|
|
13
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
14
|
+
const popupState = usePopupState( { variant: 'popover' } );
|
|
15
|
+
const popupProps = bindPopover( {
|
|
16
|
+
...popupState,
|
|
17
|
+
anchorEl: anchorRef.current ?? undefined,
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<IconButton
|
|
23
|
+
size={ SIZE }
|
|
24
|
+
aria-label={ __( 'Base Transform', 'elementor' ) }
|
|
25
|
+
{ ...bindTrigger( popupState ) }
|
|
26
|
+
>
|
|
27
|
+
<AdjustmentsIcon fontSize={ SIZE } />
|
|
28
|
+
</IconButton>
|
|
29
|
+
<Popover
|
|
30
|
+
disablePortal
|
|
31
|
+
slotProps={ {
|
|
32
|
+
paper: {
|
|
33
|
+
sx: {
|
|
34
|
+
width: anchorRef.current?.offsetWidth + 'px',
|
|
35
|
+
},
|
|
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
|
+
<TransformOriginControl rowRef={ rowRef } />
|
|
47
|
+
</Popover>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { sizePropTypeUtil } from '@elementor/editor-props';
|
|
3
|
+
import { Divider, Grid, Stack } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { PropKeyProvider, PropProvider, useBoundProp } from '../../../bound-prop-context';
|
|
7
|
+
import { ControlFormLabel } from '../../../components/control-form-label';
|
|
8
|
+
import { ControlLabel } from '../../../components/control-label';
|
|
9
|
+
import { SizeControl } from '../../size-control';
|
|
10
|
+
|
|
11
|
+
const TRANSFORM_ORIGIN_UNITS = [ 'px', '%', 'em', 'rem' ] as ( 'px' | '%' | 'em' | 'rem' )[];
|
|
12
|
+
|
|
13
|
+
const TRANSFORM_ORIGIN_FIELDS = [
|
|
14
|
+
{
|
|
15
|
+
label: __( 'Origin X', 'elementor' ),
|
|
16
|
+
bindValue: 'x',
|
|
17
|
+
units: TRANSFORM_ORIGIN_UNITS,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: __( 'Origin Y', 'elementor' ),
|
|
21
|
+
bindValue: 'y',
|
|
22
|
+
units: TRANSFORM_ORIGIN_UNITS,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: __( 'Origin Z', 'elementor' ),
|
|
26
|
+
bindValue: 'z',
|
|
27
|
+
units: TRANSFORM_ORIGIN_UNITS.filter( ( unit ) => unit !== '%' ),
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const TransformOriginControl = ( { rowRef }: { rowRef: React.RefObject< HTMLDivElement > } ) => {
|
|
32
|
+
return (
|
|
33
|
+
<Stack direction="column" spacing={ 1.5 }>
|
|
34
|
+
<ControlFormLabel sx={ { pt: 1.5, pl: 1.5 } }>{ __( 'Transform', 'elementor' ) }</ControlFormLabel>
|
|
35
|
+
<Grid container spacing={ 1.5 } ref={ rowRef }>
|
|
36
|
+
{ TRANSFORM_ORIGIN_FIELDS.map( ( control ) => (
|
|
37
|
+
<ControlFields control={ control } rowRef={ rowRef } key={ control.bindValue } />
|
|
38
|
+
) ) }
|
|
39
|
+
<Divider sx={ { py: 3 } } />
|
|
40
|
+
</Grid>
|
|
41
|
+
</Stack>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const ControlFields = ( {
|
|
46
|
+
control,
|
|
47
|
+
rowRef,
|
|
48
|
+
}: {
|
|
49
|
+
control: ( typeof TRANSFORM_ORIGIN_FIELDS )[ number ];
|
|
50
|
+
rowRef: React.RefObject< HTMLDivElement >;
|
|
51
|
+
} ) => {
|
|
52
|
+
const context = useBoundProp( sizePropTypeUtil );
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<PropProvider { ...context }>
|
|
56
|
+
<PropKeyProvider bind={ control.bindValue }>
|
|
57
|
+
<Grid item xs={ 12 }>
|
|
58
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
59
|
+
<Grid item xs={ 6 }>
|
|
60
|
+
<ControlLabel>{ control.label }</ControlLabel>
|
|
61
|
+
</Grid>
|
|
62
|
+
<Grid item xs={ 6 } sx={ { pr: 3 } }>
|
|
63
|
+
<SizeControl variant="length" units={ control.units } anchorRef={ rowRef } disableCustom />
|
|
64
|
+
</Grid>
|
|
65
|
+
</Grid>
|
|
66
|
+
</Grid>
|
|
67
|
+
</PropKeyProvider>
|
|
68
|
+
</PropProvider>
|
|
69
|
+
);
|
|
70
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { RepeatableControl } from './controls/repeatable-control';
|
|
|
25
25
|
export { KeyValueControl } from './controls/key-value-control';
|
|
26
26
|
export { PositionControl } from './controls/position-control';
|
|
27
27
|
export { TransformRepeaterControl } from './controls/transform-control/transform-repeater-control';
|
|
28
|
+
export { TransformBaseControl } from './controls/transform-control/transform-base-control';
|
|
28
29
|
export { TransitionRepeaterControl } from './controls/transition-control/transition-repeater-control';
|
|
29
30
|
export { PopoverContent } from './components/popover-content';
|
|
30
31
|
export { enqueueFont } from './controls/font-family-control/enqueue-font';
|