@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.js +26 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/repeater/repeater.tsx +24 -16
- package/src/controls/size-control/hooks/use-unit-sync.ts +9 -1
- package/src/controls/size-control/utils/resolve-bound-prop-value.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -6980,9 +6980,12 @@ var useUnitSync = ({ unit, setUnit, persistWhen }) => {
|
|
|
6980
6980
|
setState(unit);
|
|
6981
6981
|
}
|
|
6982
6982
|
}, [unit]);
|
|
6983
|
+
const isExtendedUnit2 = (value) => {
|
|
6984
|
+
return Object.values(EXTENDED_UNITS).includes(value);
|
|
6985
|
+
};
|
|
6983
6986
|
const setInternalValue = (newUnit) => {
|
|
6984
6987
|
setState(newUnit);
|
|
6985
|
-
if (persistWhen()) {
|
|
6988
|
+
if (isExtendedUnit2(newUnit) || persistWhen()) {
|
|
6986
6989
|
setUnit(newUnit);
|
|
6987
6990
|
}
|
|
6988
6991
|
};
|
|
@@ -7373,9 +7376,10 @@ var resolveBoundPropValue = (value, boundPropPlaceholder, propPlaceholder) => {
|
|
|
7373
7376
|
{ candidate: boundPropPlaceholder, resolve: toUnitPlaceholder }
|
|
7374
7377
|
]);
|
|
7375
7378
|
const placeholderSource = propPlaceholder ?? boundPropPlaceholder;
|
|
7379
|
+
const hasValue2 = Boolean(value);
|
|
7376
7380
|
return {
|
|
7377
7381
|
sizeValue,
|
|
7378
|
-
placeholder: resolvePlaceholder(placeholderSource)
|
|
7382
|
+
placeholder: hasValue2 ? void 0 : resolvePlaceholder(placeholderSource)
|
|
7379
7383
|
};
|
|
7380
7384
|
};
|
|
7381
7385
|
var toUnitPlaceholder = (v) => ({ ...v, size: "" });
|
|
@@ -7789,10 +7793,14 @@ var RepeaterItem = ({
|
|
|
7789
7793
|
actions,
|
|
7790
7794
|
value
|
|
7791
7795
|
}) => {
|
|
7792
|
-
const { popoverState, popoverProps, ref, setRef } = usePopover(
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
+
const { popoverState, popoverProps, ref, setRef } = usePopover(
|
|
7797
|
+
openOnMount,
|
|
7798
|
+
() => {
|
|
7799
|
+
onOpen();
|
|
7800
|
+
onPopoverOpen?.(value);
|
|
7801
|
+
},
|
|
7802
|
+
onPopoverClose
|
|
7803
|
+
);
|
|
7796
7804
|
const triggerProps = (0, import_ui97.bindTrigger)(popoverState);
|
|
7797
7805
|
const duplicateLabel = (0, import_i18n55.__)("Duplicate", "elementor");
|
|
7798
7806
|
const toggleLabel = propDisabled ? (0, import_i18n55.__)("Show", "elementor") : (0, import_i18n55.__)("Hide", "elementor");
|
|
@@ -7814,21 +7822,17 @@ var RepeaterItem = ({
|
|
|
7814
7822
|
startIcon,
|
|
7815
7823
|
actions: /* @__PURE__ */ React113.createElement(React113.Fragment, null, showDuplicate && /* @__PURE__ */ React113.createElement(import_ui97.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(import_ui97.IconButton, { size: SIZE11, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React113.createElement(import_icons39.CopyIcon, { fontSize: SIZE11 }))), showToggle && /* @__PURE__ */ React113.createElement(import_ui97.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(import_ui97.IconButton, { size: SIZE11, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React113.createElement(import_icons39.EyeOffIcon, { fontSize: SIZE11 }) : /* @__PURE__ */ React113.createElement(import_icons39.EyeIcon, { fontSize: SIZE11 }))), actions?.(value), showRemove && /* @__PURE__ */ React113.createElement(import_ui97.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(import_ui97.IconButton, { size: SIZE11, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React113.createElement(import_icons39.XIcon, { fontSize: SIZE11 }))))
|
|
7816
7824
|
}
|
|
7817
|
-
), /* @__PURE__ */ React113.createElement(
|
|
7818
|
-
|
|
7825
|
+
), /* @__PURE__ */ React113.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React113.createElement(
|
|
7826
|
+
import_ui97.ClickAwayListener,
|
|
7819
7827
|
{
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
popoverProps.onClose?.();
|
|
7824
|
-
onPopoverClose?.();
|
|
7825
|
-
},
|
|
7826
|
-
anchorEl: ref
|
|
7828
|
+
mouseEvent: "onMouseDown",
|
|
7829
|
+
touchEvent: "onTouchStart",
|
|
7830
|
+
onClickAway: popoverProps.onClose
|
|
7827
7831
|
},
|
|
7828
7832
|
/* @__PURE__ */ React113.createElement(import_ui97.Box, null, children({ anchorEl: ref }))
|
|
7829
|
-
));
|
|
7833
|
+
)));
|
|
7830
7834
|
};
|
|
7831
|
-
var usePopover = (openOnMount, onOpen) => {
|
|
7835
|
+
var usePopover = (openOnMount, onOpen, onPopoverClose) => {
|
|
7832
7836
|
const [ref, setRef] = (0, import_react67.useState)(null);
|
|
7833
7837
|
const popoverState = (0, import_ui97.usePopupState)({ variant: "popover" });
|
|
7834
7838
|
const popoverProps = (0, import_ui97.bindPopover)(popoverState);
|
|
@@ -7838,11 +7842,15 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
7838
7842
|
onOpen?.();
|
|
7839
7843
|
}
|
|
7840
7844
|
}, [ref]);
|
|
7845
|
+
const onClose = () => {
|
|
7846
|
+
popoverProps.onClose?.();
|
|
7847
|
+
onPopoverClose?.();
|
|
7848
|
+
};
|
|
7841
7849
|
return {
|
|
7842
7850
|
popoverState,
|
|
7843
7851
|
ref,
|
|
7844
7852
|
setRef,
|
|
7845
|
-
popoverProps
|
|
7853
|
+
popoverProps: { ...popoverProps, onClose }
|
|
7846
7854
|
};
|
|
7847
7855
|
};
|
|
7848
7856
|
|