@elementor/editor-controls 4.4.0-1081 → 4.4.0-1083
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/controls/toggle-control.tsx +13 -2
package/dist/index.mjs
CHANGED
|
@@ -2879,7 +2879,8 @@ var ToggleControl = createControl(
|
|
|
2879
2879
|
size = "tiny",
|
|
2880
2880
|
exclusive = true,
|
|
2881
2881
|
maxItems,
|
|
2882
|
-
convertOptions = false
|
|
2882
|
+
convertOptions = false,
|
|
2883
|
+
allowEmpty = false
|
|
2883
2884
|
}) => {
|
|
2884
2885
|
const { value, setValue, placeholder, disabled } = useBoundProp(stringPropTypeUtil7);
|
|
2885
2886
|
const processedOptions = convertOptions ? convertToggleOptionsToAtomic(options) : options;
|
|
@@ -2897,12 +2898,19 @@ var ToggleControl = createControl(
|
|
|
2897
2898
|
size,
|
|
2898
2899
|
placeholder
|
|
2899
2900
|
};
|
|
2901
|
+
const handleExclusiveToggle = (selectedValue) => {
|
|
2902
|
+
if (allowEmpty && !selectedValue) {
|
|
2903
|
+
setValue("");
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
setValue(selectedValue);
|
|
2907
|
+
};
|
|
2900
2908
|
return exclusive ? /* @__PURE__ */ React56.createElement(
|
|
2901
2909
|
ControlToggleButtonGroup,
|
|
2902
2910
|
{
|
|
2903
2911
|
...toggleButtonGroupProps,
|
|
2904
|
-
value: value ?? null,
|
|
2905
|
-
onChange:
|
|
2912
|
+
value: allowEmpty ? value || null : value ?? null,
|
|
2913
|
+
onChange: handleExclusiveToggle,
|
|
2906
2914
|
disabled,
|
|
2907
2915
|
exclusive: true
|
|
2908
2916
|
}
|