@elementor/editor-controls 3.32.0-43 → 3.32.0-45

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-43",
4
+ "version": "3.32.0-45",
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-43",
44
- "@elementor/editor-elements": "3.32.0-43",
45
- "@elementor/editor-props": "3.32.0-43",
46
- "@elementor/editor-responsive": "3.32.0-43",
47
- "@elementor/editor-ui": "3.32.0-43",
48
- "@elementor/editor-v1-adapters": "3.32.0-43",
49
- "@elementor/env": "3.32.0-43",
50
- "@elementor/http-client": "3.32.0-43",
43
+ "@elementor/editor-current-user": "3.32.0-45",
44
+ "@elementor/editor-elements": "3.32.0-45",
45
+ "@elementor/editor-props": "3.32.0-45",
46
+ "@elementor/editor-responsive": "3.32.0-45",
47
+ "@elementor/editor-ui": "3.32.0-45",
48
+ "@elementor/editor-v1-adapters": "3.32.0-45",
49
+ "@elementor/env": "3.32.0-45",
50
+ "@elementor/http-client": "3.32.0-45",
51
51
  "@elementor/icons": "^1.51.1",
52
- "@elementor/locations": "3.32.0-43",
53
- "@elementor/query": "3.32.0-43",
54
- "@elementor/session": "3.32.0-43",
52
+ "@elementor/locations": "3.32.0-45",
53
+ "@elementor/query": "3.32.0-45",
54
+ "@elementor/session": "3.32.0-45",
55
55
  "@elementor/ui": "1.36.8",
56
- "@elementor/utils": "3.32.0-43",
57
- "@elementor/wp-media": "3.32.0-43",
56
+ "@elementor/utils": "3.32.0-45",
57
+ "@elementor/wp-media": "3.32.0-45",
58
58
  "@wordpress/i18n": "^5.13.0",
59
59
  "@monaco-editor/react": "^4.7.0"
60
60
  },
@@ -42,7 +42,7 @@ const StyledToggleButtonGroup = styled( ToggleButtonGroup )`
42
42
  }
43
43
  `;
44
44
 
45
- const StyledToggleButton = styled( ToggleButton, {
45
+ export const StyledToggleButton = styled( ToggleButton, {
46
46
  shouldForwardProp: ( prop ) => prop !== 'isPlaceholder',
47
47
  } )< { isPlaceholder: boolean } >`
48
48
  ${ ( { theme, isPlaceholder } ) =>
@@ -50,7 +50,7 @@ const StyledToggleButton = styled( ToggleButton, {
50
50
  `
51
51
  color: ${ theme.palette.text.tertiary };
52
52
  background-color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.02)' };
53
-
53
+
54
54
  &:hover {
55
55
  background-color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.08)' : 'rgba(0,0,0,0.04)' };
56
56
  }
@@ -2,12 +2,13 @@ import * as React from 'react';
2
2
  import { type RefObject, useRef } from 'react';
3
3
  import { dimensionsPropTypeUtil, type PropKey, sizePropTypeUtil } from '@elementor/editor-props';
4
4
  import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
5
- import { Grid, Stack, ToggleButton, Tooltip } from '@elementor/ui';
5
+ import { Grid, Stack, Tooltip } from '@elementor/ui';
6
6
  import { __ } from '@wordpress/i18n';
7
7
 
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 { StyledToggleButton } from '../components/control-toggle-button-group';
11
12
  import { createControl } from '../create-control';
12
13
  import { type ExtendedOption } from '../utils/size-control';
13
14
  import { SizeControl } from './size-control';
@@ -22,18 +23,27 @@ export const LinkedDimensionsControl = createControl(
22
23
  isSiteRtl?: boolean;
23
24
  extendedOptions?: ExtendedOption[];
24
25
  } ) => {
25
- const { value: sizeValue, setValue: setSizeValue, disabled: sizeDisabled } = useBoundProp( sizePropTypeUtil );
26
+ const {
27
+ value: sizeValue,
28
+ setValue: setSizeValue,
29
+ disabled: sizeDisabled,
30
+ placeholder: sizePlaceholder,
31
+ } = useBoundProp( sizePropTypeUtil );
26
32
  const gridRowRefs: RefObject< HTMLDivElement >[] = [ useRef( null ), useRef( null ) ];
27
33
 
28
34
  const {
29
35
  value: dimensionsValue,
30
36
  setValue: setDimensionsValue,
31
37
  propType,
38
+ placeholder: dimensionsPlaceholder,
32
39
  disabled: dimensionsDisabled,
33
40
  } = useBoundProp( dimensionsPropTypeUtil );
34
41
 
35
- const isLinked = ! dimensionsValue && ! sizeValue ? true : !! sizeValue;
42
+ const hasUserValues = !! ( dimensionsValue || sizeValue );
43
+ const hasPlaceholders = !! ( sizePlaceholder || dimensionsPlaceholder );
36
44
 
45
+ const isLinked =
46
+ ( ! hasUserValues && ! hasPlaceholders ) || ( hasPlaceholders ? !! sizePlaceholder : !! sizeValue );
37
47
  const onLinkToggle = () => {
38
48
  if ( ! isLinked ) {
39
49
  setSizeValue( dimensionsValue[ 'block-start' ]?.value ?? null );
@@ -65,12 +75,13 @@ export const LinkedDimensionsControl = createControl(
65
75
  propType={ propType }
66
76
  value={ dimensionsValue }
67
77
  setValue={ setDimensionsValue }
78
+ placeholder={ dimensionsPlaceholder }
68
79
  isDisabled={ () => disabled }
69
80
  >
70
81
  <Stack direction="row" gap={ 2 } flexWrap="nowrap">
71
82
  <ControlFormLabel>{ label }</ControlFormLabel>
72
83
  <Tooltip title={ isLinked ? unlinkedLabel : linkedLabel } placement="top">
73
- <ToggleButton
84
+ <StyledToggleButton
74
85
  aria-label={ isLinked ? unlinkedLabel : linkedLabel }
75
86
  size={ 'tiny' }
76
87
  value={ 'check' }
@@ -78,9 +89,10 @@ export const LinkedDimensionsControl = createControl(
78
89
  sx={ { marginLeft: 'auto' } }
79
90
  onChange={ onLinkToggle }
80
91
  disabled={ disabled }
92
+ isPlaceholder={ hasPlaceholders }
81
93
  >
82
94
  <LinkedIcon fontSize={ 'tiny' } />
83
- </ToggleButton>
95
+ </StyledToggleButton>
84
96
  </Tooltip>
85
97
  </Stack>
86
98