@elementor/editor-controls 3.32.0-86 → 3.32.0-89

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/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-86",
4
+ "version": "3.32.0-89",
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-86",
44
- "@elementor/editor-elements": "3.32.0-86",
45
- "@elementor/editor-props": "3.32.0-86",
46
- "@elementor/editor-responsive": "3.32.0-86",
47
- "@elementor/editor-ui": "3.32.0-86",
48
- "@elementor/editor-v1-adapters": "3.32.0-86",
49
- "@elementor/env": "3.32.0-86",
50
- "@elementor/http-client": "3.32.0-86",
43
+ "@elementor/editor-current-user": "3.32.0-89",
44
+ "@elementor/editor-elements": "3.32.0-89",
45
+ "@elementor/editor-props": "3.32.0-89",
46
+ "@elementor/editor-responsive": "3.32.0-89",
47
+ "@elementor/editor-ui": "3.32.0-89",
48
+ "@elementor/editor-v1-adapters": "3.32.0-89",
49
+ "@elementor/env": "3.32.0-89",
50
+ "@elementor/http-client": "3.32.0-89",
51
51
  "@elementor/icons": "^1.51.1",
52
- "@elementor/locations": "3.32.0-86",
53
- "@elementor/query": "3.32.0-86",
54
- "@elementor/session": "3.32.0-86",
52
+ "@elementor/locations": "3.32.0-89",
53
+ "@elementor/query": "3.32.0-89",
54
+ "@elementor/session": "3.32.0-89",
55
55
  "@elementor/ui": "1.36.8",
56
- "@elementor/utils": "3.32.0-86",
57
- "@elementor/wp-media": "3.32.0-86",
56
+ "@elementor/utils": "3.32.0-89",
57
+ "@elementor/wp-media": "3.32.0-89",
58
58
  "@wordpress/i18n": "^5.13.0",
59
59
  "@monaco-editor/react": "^4.7.0"
60
60
  },
@@ -7,21 +7,39 @@ import { SlotChildren } from '../../../control-replacements';
7
7
  import { TooltipAddItemAction } from '../actions/tooltip-add-item-action';
8
8
  import { RepeaterHeaderActionsSlot } from '../locations';
9
9
 
10
- export const Header = React.forwardRef( ( { label, children }: React.PropsWithChildren< { label: string } >, ref ) => {
11
- const { value } = useBoundProp();
10
+ export const Header = React.forwardRef(
11
+ (
12
+ {
13
+ label,
14
+ children,
15
+ adornment: Adornment = ControlAdornments,
16
+ }: React.PropsWithChildren< {
17
+ label: string;
18
+ adornment?: React.FC;
19
+ } >,
20
+ ref
21
+ ) => {
22
+ const { value } = useBoundProp();
12
23
 
13
- return (
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 />
20
- </Box>
21
- <RepeaterHeaderActionsSlot value={ value } />
22
- <SlotChildren whitelist={ [ TooltipAddItemAction ] as React.FC[] } sorted>
23
- { children }
24
- </SlotChildren>
25
- </Stack>
26
- );
27
- } );
24
+ return (
25
+ <Stack
26
+ direction="row"
27
+ alignItems="center"
28
+ gap={ 1 }
29
+ sx={ { marginInlineEnd: -0.75, py: 0.25 } }
30
+ ref={ ref }
31
+ >
32
+ <Box display="flex" alignItems="center" gap={ 1 } sx={ { flexGrow: 1 } }>
33
+ <Typography component="label" variant="caption" color="text.secondary" sx={ { lineHeight: 1 } }>
34
+ { label }
35
+ </Typography>
36
+ <Adornment />
37
+ </Box>
38
+ <RepeaterHeaderActionsSlot value={ value } />
39
+ <SlotChildren whitelist={ [ TooltipAddItemAction ] as React.FC[] } sorted>
40
+ { children }
41
+ </SlotChildren>
42
+ </Stack>
43
+ );
44
+ }
45
+ );
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { type ComponentType, createContext, type PropsWithChildren, useContext } from 'react';
3
+ import { type PropType } from '@elementor/editor-props';
3
4
 
4
5
  type ControlAdornmentsItems = Array< {
5
6
  id: string;
6
- Adornment: ComponentType;
7
+ Adornment: ComponentType< { customContext?: { path: string[]; propType: PropType } } >;
7
8
  } >;
8
9
 
9
10
  type ControlAdornmentsContext = {
@@ -1,8 +1,16 @@
1
1
  import * as React from 'react';
2
+ import { type PropType } from '@elementor/editor-props';
2
3
 
3
4
  import { useControlAdornments } from './control-adornments-context';
4
5
 
5
- export function ControlAdornments() {
6
+ export function ControlAdornments( {
7
+ customContext,
8
+ }: {
9
+ customContext?: {
10
+ path: string[];
11
+ propType: PropType;
12
+ };
13
+ } ) {
6
14
  const items = useControlAdornments();
7
15
 
8
16
  if ( items?.length === 0 ) {
@@ -12,7 +20,7 @@ export function ControlAdornments() {
12
20
  return (
13
21
  <>
14
22
  { items.map( ( { Adornment, id } ) => (
15
- <Adornment key={ id } />
23
+ <Adornment key={ id } customContext={ customContext } />
16
24
  ) ) }
17
25
  </>
18
26
  );
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useRef } from 'react';
3
- import { transformFunctionsPropTypeUtil, transformPropTypeUtil } from '@elementor/editor-props';
3
+ import { type PropType, transformFunctionsPropTypeUtil, transformPropTypeUtil } from '@elementor/editor-props';
4
4
  import { AdjustmentsIcon, InfoCircleFilledIcon } from '@elementor/icons';
5
5
  import { bindTrigger, Box, IconButton, type PopupState, Typography, usePopupState } from '@elementor/ui';
6
6
  import { __ } from '@wordpress/i18n';
@@ -17,6 +17,7 @@ import { DisableItemAction } from '../../components/unstable-repeater/actions/di
17
17
  import { RemoveItemAction } from '../../components/unstable-repeater/actions/remove-item-action';
18
18
  import { EditItemPopover } from '../../components/unstable-repeater/items/edit-item-popover';
19
19
  import { injectIntoRepeaterHeaderActions } from '../../components/unstable-repeater/locations';
20
+ import { ControlAdornments } from '../../control-adornments/control-adornments';
20
21
  import { createControl } from '../../create-control';
21
22
  import { initialRotateValue, initialScaleValue, initialSkewValue, initialTransformValue } from './initial-values';
22
23
  import { TransformBaseControl } from './transform-base-control';
@@ -43,7 +44,7 @@ export const TransformRepeaterControl = createControl( () => {
43
44
  <PropProvider { ...context }>
44
45
  <TransformBaseControl popupState={ popupState } anchorRef={ headerRef } />
45
46
  <PropKeyProvider bind={ repeaterBindKey }>
46
- <Repeater headerRef={ headerRef } />
47
+ <Repeater headerRef={ headerRef } propType={ context.propType } />
47
48
  </PropKeyProvider>
48
49
  </PropProvider>
49
50
  );
@@ -62,7 +63,7 @@ const ToolTip = (
62
63
  </Box>
63
64
  );
64
65
 
65
- const Repeater = ( { headerRef }: { headerRef: React.RefObject< HTMLDivElement > } ) => {
66
+ const Repeater = ( { headerRef, propType }: { headerRef: React.RefObject< HTMLDivElement >; propType: PropType } ) => {
66
67
  const transformFunctionsContext = useBoundProp( transformFunctionsPropTypeUtil );
67
68
  const availableValues = [ initialTransformValue, initialScaleValue, initialRotateValue, initialSkewValue ];
68
69
  const { value: transformValues } = transformFunctionsContext;
@@ -79,7 +80,11 @@ const Repeater = ( { headerRef }: { headerRef: React.RefObject< HTMLDivElement >
79
80
  initial={ getInitialValue() ?? initialTransformValue }
80
81
  propTypeUtil={ transformFunctionsPropTypeUtil }
81
82
  >
82
- <Header label={ __( 'Transform', 'elementor' ) } ref={ headerRef }>
83
+ <Header
84
+ label={ __( 'Transform', 'elementor' ) }
85
+ adornment={ () => <ControlAdornments customContext={ { path: [ 'transform' ], propType } } /> }
86
+ ref={ headerRef }
87
+ >
83
88
  <TooltipAddItemAction
84
89
  disabled={ shouldDisableAddItem }
85
90
  tooltipContent={ ToolTip }