@elementor/editor-controls 4.4.0-1081 → 4.4.0-1082

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 CHANGED
@@ -193,8 +193,9 @@ type ToggleControlProps<T extends PropValue> = {
193
193
  exclusive?: boolean;
194
194
  maxItems?: number;
195
195
  convertOptions?: boolean;
196
+ allowEmpty?: boolean;
196
197
  };
197
- declare const ToggleControl: ControlComponent$1<({ options, fullWidth, size, exclusive, maxItems, convertOptions, }: ToggleControlProps<StringPropValue["value"]>) => React$1.JSX.Element>;
198
+ declare const ToggleControl: ControlComponent$1<({ options, fullWidth, size, exclusive, maxItems, convertOptions, allowEmpty, }: ToggleControlProps<StringPropValue["value"]>) => React$1.JSX.Element>;
198
199
 
199
200
  declare const NumberControl: ControlComponent$1<({ placeholder: labelPlaceholder, max, min, step, shouldForceInt, startIcon, disabled: inputDisabled, }: {
200
201
  placeholder?: string;
package/dist/index.d.ts CHANGED
@@ -193,8 +193,9 @@ type ToggleControlProps<T extends PropValue> = {
193
193
  exclusive?: boolean;
194
194
  maxItems?: number;
195
195
  convertOptions?: boolean;
196
+ allowEmpty?: boolean;
196
197
  };
197
- declare const ToggleControl: ControlComponent$1<({ options, fullWidth, size, exclusive, maxItems, convertOptions, }: ToggleControlProps<StringPropValue["value"]>) => React$1.JSX.Element>;
198
+ declare const ToggleControl: ControlComponent$1<({ options, fullWidth, size, exclusive, maxItems, convertOptions, allowEmpty, }: ToggleControlProps<StringPropValue["value"]>) => React$1.JSX.Element>;
198
199
 
199
200
  declare const NumberControl: ControlComponent$1<({ placeholder: labelPlaceholder, max, min, step, shouldForceInt, startIcon, disabled: inputDisabled, }: {
200
201
  placeholder?: string;
package/dist/index.js CHANGED
@@ -2971,7 +2971,8 @@ var ToggleControl = createControl(
2971
2971
  size = "tiny",
2972
2972
  exclusive = true,
2973
2973
  maxItems,
2974
- convertOptions = false
2974
+ convertOptions = false,
2975
+ allowEmpty = false
2975
2976
  }) => {
2976
2977
  const { value, setValue, placeholder, disabled } = useBoundProp(import_editor_props18.stringPropTypeUtil);
2977
2978
  const processedOptions = convertOptions ? convertToggleOptionsToAtomic(options) : options;
@@ -2989,12 +2990,19 @@ var ToggleControl = createControl(
2989
2990
  size,
2990
2991
  placeholder
2991
2992
  };
2993
+ const handleExclusiveToggle = (selectedValue) => {
2994
+ if (allowEmpty && !selectedValue) {
2995
+ setValue("");
2996
+ return;
2997
+ }
2998
+ setValue(selectedValue);
2999
+ };
2992
3000
  return exclusive ? /* @__PURE__ */ React56.createElement(
2993
3001
  ControlToggleButtonGroup,
2994
3002
  {
2995
3003
  ...toggleButtonGroupProps,
2996
- value: value ?? null,
2997
- onChange: setValue,
3004
+ value: allowEmpty ? value || null : value ?? null,
3005
+ onChange: handleExclusiveToggle,
2998
3006
  disabled,
2999
3007
  exclusive: true
3000
3008
  }