@elementor/editor-controls 4.1.0-781 → 4.1.0-783

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-781",
4
+ "version": "4.1.0-783",
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-781",
44
- "@elementor/editor-elements": "4.1.0-781",
45
- "@elementor/editor-props": "4.1.0-781",
46
- "@elementor/editor-responsive": "4.1.0-781",
47
- "@elementor/editor-ui": "4.1.0-781",
48
- "@elementor/editor-v1-adapters": "4.1.0-781",
49
- "@elementor/env": "4.1.0-781",
50
- "@elementor/events": "4.1.0-781",
51
- "@elementor/http-client": "4.1.0-781",
43
+ "@elementor/editor-current-user": "4.1.0-783",
44
+ "@elementor/editor-elements": "4.1.0-783",
45
+ "@elementor/editor-props": "4.1.0-783",
46
+ "@elementor/editor-responsive": "4.1.0-783",
47
+ "@elementor/editor-ui": "4.1.0-783",
48
+ "@elementor/editor-v1-adapters": "4.1.0-783",
49
+ "@elementor/env": "4.1.0-783",
50
+ "@elementor/events": "4.1.0-783",
51
+ "@elementor/http-client": "4.1.0-783",
52
52
  "@elementor/icons": "^1.68.0",
53
- "@elementor/locations": "4.1.0-781",
54
- "@elementor/query": "4.1.0-781",
55
- "@elementor/session": "4.1.0-781",
53
+ "@elementor/locations": "4.1.0-783",
54
+ "@elementor/query": "4.1.0-783",
55
+ "@elementor/session": "4.1.0-783",
56
56
  "@elementor/ui": "1.37.5",
57
- "@elementor/utils": "4.1.0-781",
58
- "@elementor/wp-media": "4.1.0-781",
57
+ "@elementor/utils": "4.1.0-783",
58
+ "@elementor/wp-media": "4.1.0-783",
59
59
  "@monaco-editor/react": "^4.7.0",
60
60
  "@tiptap/extension-bold": "^3.11.1",
61
61
  "@tiptap/extension-document": "^3.11.1",
@@ -33,6 +33,7 @@ type RepeatableControlProps = {
33
33
  patternLabel?: string;
34
34
  placeholder?: string;
35
35
  propKey?: string;
36
+ isSortable?: boolean;
36
37
  addItemTooltipProps?: TooltipAddItemActionProps;
37
38
  };
38
39
 
@@ -48,6 +49,7 @@ export const RepeatableControl = createControl(
48
49
  patternLabel,
49
50
  placeholder,
50
51
  propKey,
52
+ isSortable,
51
53
  addItemTooltipProps,
52
54
  }: RepeatableControlProps ) => {
53
55
  const { propTypeUtil: childPropTypeUtil, isItemDisabled } = childControlConfig;
@@ -71,6 +73,7 @@ export const RepeatableControl = createControl(
71
73
  );
72
74
 
73
75
  const { propType, value, setValue } = useBoundProp( childArrayPropTypeUtil );
76
+ const newItemIndex = addItemTooltipProps?.newItemIndex === null ? undefined : 0;
74
77
 
75
78
  return (
76
79
  <PropProvider propType={ propType } value={ value } setValue={ setValue }>
@@ -83,11 +86,11 @@ export const RepeatableControl = createControl(
83
86
  <RepeaterHeader label={ repeaterLabel }>
84
87
  <TooltipAddItemAction
85
88
  { ...addItemTooltipProps }
86
- newItemIndex={ 0 }
89
+ newItemIndex={ newItemIndex }
87
90
  ariaLabel={ repeaterLabel }
88
91
  />
89
92
  </RepeaterHeader>
90
- <ItemsContainer isSortable={ false }>
93
+ <ItemsContainer isSortable={ isSortable }>
91
94
  <Item
92
95
  Icon={ ItemIcon }
93
96
  Label={ ItemLabel }
@@ -114,7 +114,7 @@ export const SizeControl = createControl(
114
114
  const popupState = usePopupState( { variant: 'popover' } );
115
115
 
116
116
  const memorizedExternalState = useMemo(
117
- () => createStateFromSizeProp( sizeValue, actualDefaultUnit ),
117
+ () => ( sizeValue ? createStateFromSizeProp( sizeValue, actualDefaultUnit ) : null ),
118
118
  [ sizeValue, actualDefaultUnit ]
119
119
  );
120
120
 
@@ -133,6 +133,14 @@ export const SizeControl = createControl(
133
133
  const { size: controlSize = DEFAULT_SIZE, unit: controlUnit = actualDefaultUnit } =
134
134
  extractValueFromState( state, true ) || {};
135
135
 
136
+ const handleBlur = () => {
137
+ if ( ! extractValueFromState( state ) ) {
138
+ setState( ( prev ) => ( { ...prev, unit: actualDefaultUnit } ) );
139
+ }
140
+
141
+ restoreValue();
142
+ };
143
+
136
144
  const handleUnitChange = ( newUnit: Unit | ExtendedOption ) => {
137
145
  if ( newUnit === 'custom' ) {
138
146
  popupState.open( anchorRef?.current );
@@ -190,7 +198,7 @@ export const SizeControl = createControl(
190
198
  startIcon={ startIcon }
191
199
  handleSizeChange={ handleSizeChange }
192
200
  handleUnitChange={ handleUnitChange }
193
- onBlur={ restoreValue }
201
+ onBlur={ handleBlur }
194
202
  onClick={ onInputClick }
195
203
  popupState={ popupState }
196
204
  min={ min }