@elementor/editor-controls 4.1.0-782 → 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/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/controls/size-control.tsx +10 -2
package/dist/index.js
CHANGED
|
@@ -1279,7 +1279,7 @@ var SizeControl = createControl(
|
|
|
1279
1279
|
const actualUnits = resolveUnits(propType, enablePropTypeUnits, variant, units2, actualExtendedOptions);
|
|
1280
1280
|
const popupState = (0, import_ui14.usePopupState)({ variant: "popover" });
|
|
1281
1281
|
const memorizedExternalState = (0, import_react14.useMemo)(
|
|
1282
|
-
() => createStateFromSizeProp(sizeValue, actualDefaultUnit),
|
|
1282
|
+
() => sizeValue ? createStateFromSizeProp(sizeValue, actualDefaultUnit) : null,
|
|
1283
1283
|
[sizeValue, actualDefaultUnit]
|
|
1284
1284
|
);
|
|
1285
1285
|
const [state, setState] = useSyncExternalState({
|
|
@@ -1293,6 +1293,12 @@ var SizeControl = createControl(
|
|
|
1293
1293
|
})
|
|
1294
1294
|
});
|
|
1295
1295
|
const { size: controlSize = DEFAULT_SIZE, unit: controlUnit = actualDefaultUnit } = extractValueFromState(state, true) || {};
|
|
1296
|
+
const handleBlur = () => {
|
|
1297
|
+
if (!extractValueFromState(state)) {
|
|
1298
|
+
setState((prev) => ({ ...prev, unit: actualDefaultUnit }));
|
|
1299
|
+
}
|
|
1300
|
+
restoreValue();
|
|
1301
|
+
};
|
|
1296
1302
|
const handleUnitChange = (newUnit) => {
|
|
1297
1303
|
if (newUnit === "custom") {
|
|
1298
1304
|
popupState.open(anchorRef?.current);
|
|
@@ -1340,7 +1346,7 @@ var SizeControl = createControl(
|
|
|
1340
1346
|
startIcon,
|
|
1341
1347
|
handleSizeChange,
|
|
1342
1348
|
handleUnitChange,
|
|
1343
|
-
onBlur:
|
|
1349
|
+
onBlur: handleBlur,
|
|
1344
1350
|
onClick: onInputClick,
|
|
1345
1351
|
popupState,
|
|
1346
1352
|
min,
|