@elementor/editor-controls 4.1.0-724 → 4.1.0-726

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": "4.1.0-724",
4
+ "version": "4.1.0-726",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,22 +40,22 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor-current-user": "4.1.0-724",
44
- "@elementor/editor-elements": "4.1.0-724",
45
- "@elementor/editor-props": "4.1.0-724",
46
- "@elementor/editor-responsive": "4.1.0-724",
47
- "@elementor/editor-ui": "4.1.0-724",
48
- "@elementor/editor-v1-adapters": "4.1.0-724",
49
- "@elementor/env": "4.1.0-724",
50
- "@elementor/http-client": "4.1.0-724",
43
+ "@elementor/editor-current-user": "4.1.0-726",
44
+ "@elementor/editor-elements": "4.1.0-726",
45
+ "@elementor/editor-props": "4.1.0-726",
46
+ "@elementor/editor-responsive": "4.1.0-726",
47
+ "@elementor/editor-ui": "4.1.0-726",
48
+ "@elementor/editor-v1-adapters": "4.1.0-726",
49
+ "@elementor/env": "4.1.0-726",
50
+ "@elementor/http-client": "4.1.0-726",
51
51
  "@elementor/icons": "^1.68.0",
52
- "@elementor/locations": "4.1.0-724",
53
- "@elementor/events": "4.1.0-724",
54
- "@elementor/query": "4.1.0-724",
55
- "@elementor/session": "4.1.0-724",
52
+ "@elementor/locations": "4.1.0-726",
53
+ "@elementor/events": "4.1.0-726",
54
+ "@elementor/query": "4.1.0-726",
55
+ "@elementor/session": "4.1.0-726",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "4.1.0-724",
58
- "@elementor/wp-media": "4.1.0-724",
57
+ "@elementor/utils": "4.1.0-726",
58
+ "@elementor/wp-media": "4.1.0-726",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -14,16 +14,10 @@ type SizeUnit = SizePropValue[ 'value' ][ 'unit' ];
14
14
 
15
15
  type Props = SizeFieldProps< SizeValue, SizeUnit > & {
16
16
  anchorRef?: RefObject< HTMLDivElement | null >;
17
- isUnitActive?: boolean;
18
17
  SizeFieldWrapper?: React.ComponentType< { children: React.ReactNode } >;
19
18
  };
20
19
 
21
- export const SizeComponent = ( {
22
- anchorRef,
23
- isUnitActive,
24
- SizeFieldWrapper = React.Fragment,
25
- ...sizeFieldProps
26
- }: Props ) => {
20
+ export const SizeComponent = ( { anchorRef, SizeFieldWrapper = React.Fragment, ...sizeFieldProps }: Props ) => {
27
21
  const popupState = usePopupState( { variant: 'popover' } );
28
22
  const activeBreakpoint = useActiveBreakpoint();
29
23
 
@@ -74,7 +68,6 @@ export const SizeComponent = ( {
74
68
  } }
75
69
  unitSelectorProps={ {
76
70
  menuItemsAttributes: hasCustomUnitOption ? { custom: popupAttributes } : undefined,
77
- isActive: isUnitActive,
78
71
  } }
79
72
  { ...sizeFieldProps }
80
73
  />
@@ -8,8 +8,8 @@ import { useSizeValue } from './hooks/use-size-value';
8
8
  import { type SetSizeValue, type SizeUnit } from './types';
9
9
  import { SizeInput } from './ui/size-input';
10
10
  import { UnitSelector, type UnitSelectorProps } from './ui/unit-selector';
11
- import { hasSizeValue } from './utils/has-size-value';
12
11
  import { isExtendedUnit } from './utils/is-extended-unit';
12
+ import { EXTENDED_UNITS } from './utils/resolve-size-value';
13
13
 
14
14
  export type SizeFieldProps< TValue extends SizePropValue[ 'value' ], TUnit extends SizeUnit > = {
15
15
  units: TUnit[];
@@ -100,7 +100,7 @@ export const SizeField = < T extends SizePropValue[ 'value' ], U extends SizeUni
100
100
  options={ units }
101
101
  value={ unit as U }
102
102
  onSelect={ handleUnitChange }
103
- isActive={ unitSelectorProps?.isActive ?? hasSizeValue( size ) }
103
+ isUnitHighlighted={ shouldHighlightUnit( { size, unit } as SizePropValue[ 'value' ] ) }
104
104
  { ...unitSelectorProps }
105
105
  optionLabelOverrides={ UNIT_DISPLAY_LABELS_OVERRIDES }
106
106
  />
@@ -111,3 +111,15 @@ export const SizeField = < T extends SizePropValue[ 'value' ], U extends SizeUni
111
111
  />
112
112
  );
113
113
  };
114
+
115
+ export const shouldHighlightUnit = ( value?: SizePropValue[ 'value' ] | null ) => {
116
+ if ( ! value ) {
117
+ return false;
118
+ }
119
+
120
+ if ( value.unit === EXTENDED_UNITS.auto ) {
121
+ return true;
122
+ }
123
+
124
+ return Boolean( value.size ) || value.size === 0;
125
+ };
@@ -7,7 +7,7 @@ export type UnitSelectorProps< T extends string > = {
7
7
  options: T[];
8
8
  value: T;
9
9
  onSelect: ( value: T ) => void;
10
- isActive: boolean;
10
+ isUnitHighlighted: boolean;
11
11
  menuItemsAttributes?: { [ key in T ]?: Record< string, unknown > };
12
12
  optionLabelOverrides?: { [ key in T ]?: React.ReactNode };
13
13
  disabled?: boolean;
@@ -21,7 +21,7 @@ const menuItemContentStyles = {
21
21
 
22
22
  export const UnitSelector = < T extends string >( {
23
23
  value,
24
- isActive,
24
+ isUnitHighlighted,
25
25
  onSelect,
26
26
  options,
27
27
  disabled,
@@ -41,7 +41,12 @@ export const UnitSelector = < T extends string >( {
41
41
 
42
42
  return (
43
43
  <>
44
- <StyledButton isActive={ isActive } disabled={ disabled } size="small" { ...bindTrigger( popupState ) }>
44
+ <StyledButton
45
+ isHighlighted={ isUnitHighlighted }
46
+ disabled={ disabled }
47
+ size="small"
48
+ { ...bindTrigger( popupState ) }
49
+ >
45
50
  { optionLabelOverrides[ value ] ?? value }
46
51
  </StyledButton>
47
52
 
@@ -71,9 +76,9 @@ export const UnitSelector = < T extends string >( {
71
76
  };
72
77
 
73
78
  const StyledButton = styled( Button, {
74
- shouldForwardProp: ( prop ) => prop !== 'isActive',
75
- } )( ( { isActive, theme } ) => ( {
76
- color: isActive ? theme.palette.text.primary : theme.palette.text.tertiary,
79
+ shouldForwardProp: ( prop ) => prop !== 'isHighlighted',
80
+ } )( ( { isHighlighted, theme } ) => ( {
81
+ color: isHighlighted ? theme.palette.text.primary : theme.palette.text.tertiary,
77
82
  font: 'inherit',
78
83
  minWidth: 'initial',
79
84
  textTransform: 'uppercase',
@@ -32,11 +32,7 @@ export const UnstableSizeControl = createControl(
32
32
  restoreValue,
33
33
  } = useBoundProp( sizePropTypeUtil );
34
34
 
35
- const { sizeValue, isUnitHighlighted, placeholder } = resolveBoundPropValue(
36
- value,
37
- boundPropPlaceholder,
38
- propPlaceholder
39
- );
35
+ const { sizeValue, placeholder } = resolveBoundPropValue( value, boundPropPlaceholder, propPlaceholder );
40
36
 
41
37
  const units = getSizeUnits( propType, variant );
42
38
  const defaultUnit = getDefaultUnit( propType );
@@ -73,7 +69,6 @@ export const UnstableSizeControl = createControl(
73
69
  anchorRef={ anchorRef }
74
70
  placeholder={ placeholder }
75
71
  defaultUnit={ defaultUnit }
76
- isUnitActive={ isUnitHighlighted }
77
72
  onBlur={ handleBlur }
78
73
  setValue={ handleChange }
79
74
  SizeFieldWrapper={ ControlActions }
@@ -1,13 +1,9 @@
1
1
  import { sizePropTypeUtil, type SizePropValue } from '@elementor/editor-props';
2
2
 
3
- import { hasSizeValue } from './has-size-value';
4
- import { EXTENDED_UNITS } from './resolve-size-value';
5
-
6
3
  type SizeValue = SizePropValue[ 'value' ] | null;
7
4
 
8
5
  export type ResolvedBoundProp = {
9
6
  sizeValue: SizeValue;
10
- isUnitHighlighted: boolean;
11
7
  placeholder: string | undefined;
12
8
  };
13
9
 
@@ -26,7 +22,6 @@ export const resolveBoundPropValue = < T extends SizeValue >(
26
22
 
27
23
  return {
28
24
  sizeValue,
29
- isUnitHighlighted: shouldHighlightUnit( value ),
30
25
  placeholder: resolvePlaceholder( propPlaceholder, boundPropPlaceholder ),
31
26
  };
32
27
  };
@@ -58,15 +53,3 @@ const resolvePlaceholder = ( propPlaceholder?: string, boundPropPlaceholder?: Si
58
53
 
59
54
  return size;
60
55
  };
61
-
62
- const shouldHighlightUnit = ( value?: SizePropValue[ 'value' ] | null ) => {
63
- if ( ! value ) {
64
- return false;
65
- }
66
-
67
- if ( value.unit === EXTENDED_UNITS.auto ) {
68
- return true;
69
- }
70
-
71
- return hasSizeValue( value.size );
72
- };
@@ -46,9 +46,9 @@ const getIsSiteRtl = () => {
46
46
  };
47
47
 
48
48
  // TODO: Remove this after version 4.01 is released
49
- const shouldExtendTransitionProperties = (): boolean => {
49
+ const shouldShowAllTransitionProperties = (): boolean => {
50
50
  if ( ! hasProInstalled() ) {
51
- return false;
51
+ return true;
52
52
  }
53
53
 
54
54
  const proVersion = window.elementorPro?.config?.version;
@@ -191,7 +191,7 @@ const createTransitionPropertiesList = (): TransitionCategory[] => {
191
191
  },
192
192
  ];
193
193
 
194
- return shouldExtendTransitionProperties() ? baseProperties : [ baseProperties[ 0 ] ];
194
+ return shouldShowAllTransitionProperties() ? baseProperties : [ baseProperties[ 0 ] ];
195
195
  };
196
196
 
197
197
  export const transitionProperties: TransitionCategory[] = createTransitionPropertiesList();
@@ -9,6 +9,7 @@ import {
9
9
  import { type StyleDefinitionState } from '@elementor/editor-styles';
10
10
  import { InfoCircleFilledIcon } from '@elementor/icons';
11
11
  import { Alert, AlertTitle, Box, Typography } from '@elementor/ui';
12
+ import { hasProInstalled } from '@elementor/utils';
12
13
  import { __ } from '@wordpress/i18n';
13
14
 
14
15
  import { useBoundProp } from '../../bound-prop-context';
@@ -181,6 +182,7 @@ export const TransitionRepeaterControl = createControl(
181
182
  } ) => {
182
183
  const currentStyleIsNormal = currentStyleState === null;
183
184
  const [ recentlyUsedList, setRecentlyUsedList ] = useState< string[] >( [] );
185
+ const proInstalled = hasProInstalled();
184
186
 
185
187
  const { value, setValue } = useBoundProp( childArrayPropTypeUtil );
186
188
  const { allDisabled: disabledItems, proDisabled: proDisabledItems } = useMemo(
@@ -191,10 +193,14 @@ export const TransitionRepeaterControl = createControl(
191
193
  const allowedTransitionSet = useMemo( () => {
192
194
  const set = new Set< string >();
193
195
  transitionProperties.forEach( ( category ) => {
194
- category.properties.forEach( ( prop ) => set.add( prop.value ) );
196
+ category.properties.forEach( ( prop ) => {
197
+ if ( ! prop.isDisabled || proInstalled ) {
198
+ set.add( prop.value );
199
+ }
200
+ } );
195
201
  } );
196
202
  return set;
197
- }, [] );
203
+ }, [ proInstalled ] );
198
204
 
199
205
  useEffect( () => {
200
206
  if ( ! value || value.length === 0 ) {
@@ -1,5 +0,0 @@
1
- import { type SizePropValue } from '@elementor/editor-props';
2
-
3
- export const hasSizeValue = ( size: SizePropValue[ 'value' ][ 'size' ] ): boolean => {
4
- return Boolean( size ) || size === 0;
5
- };