@elementor/editor-controls 3.33.0-205 → 3.33.0-206

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
@@ -416,10 +416,14 @@ type UseBoundProp<TValue extends PropValue> = {
416
416
  placeholder?: TValue;
417
417
  path: PropKey[];
418
418
  restoreValue: () => void;
419
+ resetValue: () => void;
419
420
  isDisabled?: (propType: PropType) => boolean | undefined;
420
421
  disabled?: boolean;
421
422
  };
422
- declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): PropKeyContextValue<T, P>;
423
+ type EnhancedPropKeyContextValue<T, P> = PropKeyContextValue<T, P> & {
424
+ resetValue: () => void;
425
+ };
426
+ declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): EnhancedPropKeyContextValue<T, P>;
423
427
  declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
424
428
 
425
429
  type AnchorEl = HTMLElement | null;
package/dist/index.d.ts CHANGED
@@ -416,10 +416,14 @@ type UseBoundProp<TValue extends PropValue> = {
416
416
  placeholder?: TValue;
417
417
  path: PropKey[];
418
418
  restoreValue: () => void;
419
+ resetValue: () => void;
419
420
  isDisabled?: (propType: PropType) => boolean | undefined;
420
421
  disabled?: boolean;
421
422
  };
422
- declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): PropKeyContextValue<T, P>;
423
+ type EnhancedPropKeyContextValue<T, P> = PropKeyContextValue<T, P> & {
424
+ resetValue: () => void;
425
+ };
426
+ declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): EnhancedPropKeyContextValue<T, P>;
423
427
  declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
424
428
 
425
429
  type AnchorEl = HTMLElement | null;
package/dist/index.js CHANGED
@@ -222,8 +222,15 @@ function useBoundProp(propTypeUtil) {
222
222
  const propKeyContext = usePropKeyContext();
223
223
  const { isValid, validate, restoreValue } = useValidation(propKeyContext.propType);
224
224
  const disabled = propKeyContext.isDisabled?.(propKeyContext.propType);
225
+ const resetValue = () => {
226
+ propKeyContext.setValue(null);
227
+ };
225
228
  if (!propTypeUtil) {
226
- return { ...propKeyContext, disabled };
229
+ return {
230
+ ...propKeyContext,
231
+ disabled,
232
+ resetValue
233
+ };
227
234
  }
228
235
  function setValue(value2, options, meta) {
229
236
  if (!validate(value2, meta?.validation)) {
@@ -244,7 +251,8 @@ function useBoundProp(propTypeUtil) {
244
251
  value: isValid ? value : null,
245
252
  restoreValue,
246
253
  placeholder,
247
- disabled
254
+ disabled,
255
+ resetValue
248
256
  };
249
257
  }
250
258
  var useValidation = (propType) => {
@@ -3978,14 +3986,14 @@ var BackgroundGradientColorControl = createControl(() => {
3978
3986
  positions: positions?.value.split(" ")
3979
3987
  };
3980
3988
  };
3981
- return /* @__PURE__ */ React70.createElement(ControlActions, null, /* @__PURE__ */ React70.createElement(
3989
+ return /* @__PURE__ */ React70.createElement(
3982
3990
  import_ui55.UnstableGradientBox,
3983
3991
  {
3984
3992
  sx: { width: "auto", padding: 1.5 },
3985
3993
  value: normalizeValue(),
3986
3994
  onChange: handleChange
3987
3995
  }
3988
- ));
3996
+ );
3989
3997
  });
3990
3998
  var initialBackgroundGradientOverlay = import_editor_props29.backgroundGradientOverlayPropTypeUtil.create({
3991
3999
  type: import_editor_props29.stringPropTypeUtil.create("linear"),
@@ -4058,7 +4066,7 @@ var BackgroundImageOverlayPosition = () => {
4058
4066
  stringPropContext.setValue(value);
4059
4067
  }
4060
4068
  };
4061
- return /* @__PURE__ */ React72.createElement(import_ui57.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React72.createElement(PopoverGridContainer, null, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React72.createElement(ControlFormLabel, null, (0, import_i18n30.__)("Position", "elementor"))), /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React72.createElement(
4069
+ return /* @__PURE__ */ React72.createElement(import_ui57.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React72.createElement(PopoverGridContainer, null, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React72.createElement(ControlFormLabel, null, (0, import_i18n30.__)("Position", "elementor"))), /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React72.createElement(ControlActions, null, /* @__PURE__ */ React72.createElement(
4062
4070
  import_ui57.Select,
4063
4071
  {
4064
4072
  fullWidth: true,
@@ -4068,7 +4076,7 @@ var BackgroundImageOverlayPosition = () => {
4068
4076
  value: (backgroundImageOffsetContext.value ? "custom" : stringPropContext.value) ?? ""
4069
4077
  },
4070
4078
  backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React72.createElement(import_editor_ui8.MenuListItem, { key: value, value: value ?? "" }, label))
4071
- )))), isCustom ? /* @__PURE__ */ React72.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { container: true, spacing: 1.5, ref: rowRef }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React72.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React72.createElement(
4079
+ ))))), isCustom ? /* @__PURE__ */ React72.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { container: true, spacing: 1.5, ref: rowRef }, /* @__PURE__ */ React72.createElement(import_ui57.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React72.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React72.createElement(
4072
4080
  SizeControl,
4073
4081
  {
4074
4082
  startIcon: /* @__PURE__ */ React72.createElement(import_icons20.LetterXIcon, { fontSize: "tiny" }),