@elementor/editor-controls 4.1.0-759 → 4.1.0-761

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.mjs CHANGED
@@ -6961,9 +6961,12 @@ var useUnitSync = ({ unit, setUnit, persistWhen }) => {
6961
6961
  setState(unit);
6962
6962
  }
6963
6963
  }, [unit]);
6964
+ const isExtendedUnit2 = (value) => {
6965
+ return Object.values(EXTENDED_UNITS).includes(value);
6966
+ };
6964
6967
  const setInternalValue = (newUnit) => {
6965
6968
  setState(newUnit);
6966
- if (persistWhen()) {
6969
+ if (isExtendedUnit2(newUnit) || persistWhen()) {
6967
6970
  setUnit(newUnit);
6968
6971
  }
6969
6972
  };
@@ -7354,9 +7357,10 @@ var resolveBoundPropValue = (value, boundPropPlaceholder, propPlaceholder) => {
7354
7357
  { candidate: boundPropPlaceholder, resolve: toUnitPlaceholder }
7355
7358
  ]);
7356
7359
  const placeholderSource = propPlaceholder ?? boundPropPlaceholder;
7360
+ const hasValue2 = Boolean(value);
7357
7361
  return {
7358
7362
  sizeValue,
7359
- placeholder: resolvePlaceholder(placeholderSource)
7363
+ placeholder: hasValue2 ? void 0 : resolvePlaceholder(placeholderSource)
7360
7364
  };
7361
7365
  };
7362
7366
  var toUnitPlaceholder = (v) => ({ ...v, size: "" });
@@ -7613,6 +7617,7 @@ import {
7613
7617
  bindPopover as bindPopover8,
7614
7618
  bindTrigger as bindTrigger7,
7615
7619
  Box as Box27,
7620
+ ClickAwayListener,
7616
7621
  IconButton as IconButton10,
7617
7622
  Infotip as Infotip4,
7618
7623
  Tooltip as Tooltip12,
@@ -7778,10 +7783,14 @@ var RepeaterItem = ({
7778
7783
  actions,
7779
7784
  value
7780
7785
  }) => {
7781
- const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, () => {
7782
- onOpen();
7783
- onPopoverOpen?.(value);
7784
- });
7786
+ const { popoverState, popoverProps, ref, setRef } = usePopover(
7787
+ openOnMount,
7788
+ () => {
7789
+ onOpen();
7790
+ onPopoverOpen?.(value);
7791
+ },
7792
+ onPopoverClose
7793
+ );
7785
7794
  const triggerProps = bindTrigger7(popoverState);
7786
7795
  const duplicateLabel = __55("Duplicate", "elementor");
7787
7796
  const toggleLabel = propDisabled ? __55("Show", "elementor") : __55("Hide", "elementor");
@@ -7803,21 +7812,17 @@ var RepeaterItem = ({
7803
7812
  startIcon,
7804
7813
  actions: /* @__PURE__ */ React113.createElement(React113.Fragment, null, showDuplicate && /* @__PURE__ */ React113.createElement(Tooltip12, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(IconButton10, { size: SIZE11, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React113.createElement(CopyIcon2, { fontSize: SIZE11 }))), showToggle && /* @__PURE__ */ React113.createElement(Tooltip12, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(IconButton10, { size: SIZE11, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React113.createElement(EyeOffIcon2, { fontSize: SIZE11 }) : /* @__PURE__ */ React113.createElement(EyeIcon2, { fontSize: SIZE11 }))), actions?.(value), showRemove && /* @__PURE__ */ React113.createElement(Tooltip12, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(IconButton10, { size: SIZE11, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React113.createElement(XIcon4, { fontSize: SIZE11 }))))
7805
7814
  }
7806
- ), /* @__PURE__ */ React113.createElement(
7807
- RepeaterPopover,
7815
+ ), /* @__PURE__ */ React113.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React113.createElement(
7816
+ ClickAwayListener,
7808
7817
  {
7809
- width: ref?.getBoundingClientRect().width,
7810
- ...popoverProps,
7811
- onClose: () => {
7812
- popoverProps.onClose?.();
7813
- onPopoverClose?.();
7814
- },
7815
- anchorEl: ref
7818
+ mouseEvent: "onMouseDown",
7819
+ touchEvent: "onTouchStart",
7820
+ onClickAway: popoverProps.onClose
7816
7821
  },
7817
7822
  /* @__PURE__ */ React113.createElement(Box27, null, children({ anchorEl: ref }))
7818
- ));
7823
+ )));
7819
7824
  };
7820
- var usePopover = (openOnMount, onOpen) => {
7825
+ var usePopover = (openOnMount, onOpen, onPopoverClose) => {
7821
7826
  const [ref, setRef] = useState19(null);
7822
7827
  const popoverState = usePopupState10({ variant: "popover" });
7823
7828
  const popoverProps = bindPopover8(popoverState);
@@ -7827,11 +7832,15 @@ var usePopover = (openOnMount, onOpen) => {
7827
7832
  onOpen?.();
7828
7833
  }
7829
7834
  }, [ref]);
7835
+ const onClose = () => {
7836
+ popoverProps.onClose?.();
7837
+ onPopoverClose?.();
7838
+ };
7830
7839
  return {
7831
7840
  popoverState,
7832
7841
  ref,
7833
7842
  setRef,
7834
- popoverProps
7843
+ popoverProps: { ...popoverProps, onClose }
7835
7844
  };
7836
7845
  };
7837
7846