@elementor/editor-controls 4.0.0-683 → 4.0.0

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.
@@ -0,0 +1,15 @@
1
+ import { type SizePropValue } from '@elementor/editor-props';
2
+
3
+ import { EXTENDED_UNITS } from './resolve-size-value';
4
+
5
+ type SizeValue = SizePropValue[ 'value' ] | null;
6
+
7
+ const conditions: Array< ( value: SizeValue ) => boolean > = [
8
+ ( value ) => value?.size === null || value?.size === undefined || value?.size === '',
9
+ ( value ) => value?.unit !== EXTENDED_UNITS.auto,
10
+ ( value ) => value?.unit !== EXTENDED_UNITS.custom,
11
+ ];
12
+
13
+ export const shouldNullifyValue = ( value: SizeValue ): boolean => {
14
+ return conditions.every( ( condition ) => condition( value ) );
15
+ };
@@ -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 ) {
package/src/index.ts CHANGED
@@ -38,6 +38,7 @@ export { transitionProperties, transitionsItemsList } from './controls/transitio
38
38
  export { DateTimeControl } from './controls/date-time-control';
39
39
  export { InlineEditingControl } from './controls/inline-editing-control';
40
40
  export { EmailFormActionControl } from './controls/email-form-action-control';
41
+ export { UnstableSizeControl } from './controls/size-control/unstable-size-control';
41
42
 
42
43
  // components
43
44
  export { ControlFormLabel } from './components/control-form-label';
@@ -58,6 +59,7 @@ export { InlineEditor } from './components/inline-editor';
58
59
  export { InlineEditorToolbar } from './components/inline-editor-toolbar';
59
60
  export { UnstableSizeField } from './components/size/unstable-size-field';
60
61
  export { NumberInput } from './components/number-input';
62
+ export { SizeComponent } from './controls/size-control/size-component';
61
63
 
62
64
  // types
63
65
  export type { ControlComponent } from './create-control';
@@ -1,11 +0,0 @@
1
- export const isNumericValue = ( value: unknown ): boolean => {
2
- if ( typeof value === 'number' ) {
3
- return ! isNaN( value );
4
- }
5
-
6
- if ( typeof value === 'string' ) {
7
- return value.trim() !== '' && ! isNaN( Number( value ) );
8
- }
9
-
10
- return false;
11
- };