@elementor/editor-controls 3.35.0-365 → 3.35.0-366

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 CHANGED
@@ -2761,7 +2761,7 @@ var import_ui42 = require("@elementor/ui");
2761
2761
  var import_i18n18 = require("@wordpress/i18n");
2762
2762
  var LinkedDimensionsControl = ({ label, isSiteRtl = false, extendedOptions, min }) => {
2763
2763
  const gridRowRefs = [(0, import_react29.useRef)(null), (0, import_react29.useRef)(null)];
2764
- const { disabled: sizeDisabled, placeholder: sizePlaceholder } = useBoundProp(import_editor_props19.sizePropTypeUtil);
2764
+ const { disabled: sizeDisabled } = useBoundProp(import_editor_props19.sizePropTypeUtil);
2765
2765
  const {
2766
2766
  value: dimensionsValue,
2767
2767
  setValue: setDimensionsValue,
@@ -2770,12 +2770,11 @@ var LinkedDimensionsControl = ({ label, isSiteRtl = false, extendedOptions, min
2770
2770
  disabled: dimensionsDisabled
2771
2771
  } = useBoundProp(import_editor_props19.dimensionsPropTypeUtil);
2772
2772
  const { value: masterValue, placeholder: masterPlaceholder, setValue: setMasterValue } = useBoundProp();
2773
- const hasPlaceholders = !!(sizePlaceholder || dimensionsPlaceholder);
2774
2773
  const inferIsLinked = () => {
2775
2774
  if (import_editor_props19.dimensionsPropTypeUtil.isValid(masterValue)) {
2776
2775
  return false;
2777
2776
  }
2778
- if (import_editor_props19.dimensionsPropTypeUtil.isValid(masterPlaceholder)) {
2777
+ if (!masterValue && import_editor_props19.dimensionsPropTypeUtil.isValid(masterPlaceholder)) {
2779
2778
  return false;
2780
2779
  }
2781
2780
  return true;
@@ -2822,6 +2821,7 @@ var LinkedDimensionsControl = ({ label, isSiteRtl = false, extendedOptions, min
2822
2821
  setValue: setDimensionsValue,
2823
2822
  isDisabled: () => dimensionsDisabled
2824
2823
  };
2824
+ const hasPlaceholders = !masterValue && (dimensionsPlaceholder || masterPlaceholder);
2825
2825
  return /* @__PURE__ */ React57.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ React57.createElement(import_ui42.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(ControlFormLabel, null, label), /* @__PURE__ */ React57.createElement(import_ui42.Tooltip, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React57.createElement(
2826
2826
  StyledToggleButton,
2827
2827
  {
@@ -3678,37 +3678,68 @@ var HtmlTagControl = createControl(({ options, onChange, fallbackLabels = {} })
3678
3678
  var React68 = __toESM(require("react"));
3679
3679
  var import_react34 = require("react");
3680
3680
  var import_editor_props26 = require("@elementor/editor-props");
3681
+ var import_editor_responsive3 = require("@elementor/editor-responsive");
3681
3682
  var import_icons16 = require("@elementor/icons");
3682
3683
  var import_ui53 = require("@elementor/ui");
3683
3684
  var import_i18n25 = require("@wordpress/i18n");
3684
3685
  var GapControl = ({ label }) => {
3686
+ const stackRef = (0, import_react34.useRef)(null);
3687
+ const { disabled: sizeDisabled } = useBoundProp(import_editor_props26.sizePropTypeUtil);
3685
3688
  const {
3686
3689
  value: directionValue,
3687
3690
  setValue: setDirectionValue,
3688
3691
  propType,
3692
+ placeholder: directionPlaceholder,
3689
3693
  disabled: directionDisabled
3690
3694
  } = useBoundProp(import_editor_props26.layoutDirectionPropTypeUtil);
3691
- const stackRef = (0, import_react34.useRef)(null);
3692
- const { value: sizeValue, setValue: setSizeValue, disabled: sizeDisabled } = useBoundProp(import_editor_props26.sizePropTypeUtil);
3693
- const isLinked = !directionValue && !sizeValue ? true : !!sizeValue;
3695
+ const { value: masterValue, setValue: setMasterValue, placeholder: masterPlaceholder } = useBoundProp();
3696
+ const inferIsLinked = () => {
3697
+ if (import_editor_props26.layoutDirectionPropTypeUtil.isValid(masterValue)) {
3698
+ return false;
3699
+ }
3700
+ if (!masterValue && import_editor_props26.layoutDirectionPropTypeUtil.isValid(masterPlaceholder)) {
3701
+ return false;
3702
+ }
3703
+ return true;
3704
+ };
3705
+ const [isLinked, setIsLinked] = (0, import_react34.useState)(() => inferIsLinked());
3706
+ const activeBreakpoint = (0, import_editor_responsive3.useActiveBreakpoint)();
3707
+ (0, import_react34.useLayoutEffect)(() => {
3708
+ setIsLinked(inferIsLinked());
3709
+ }, [activeBreakpoint]);
3694
3710
  const onLinkToggle = () => {
3695
- if (!isLinked) {
3696
- setSizeValue(directionValue?.column?.value ?? null);
3711
+ setIsLinked((prev) => !prev);
3712
+ if (!import_editor_props26.layoutDirectionPropTypeUtil.isValid(masterValue)) {
3713
+ const currentValue2 = masterValue ? masterValue : null;
3714
+ if (!currentValue2) {
3715
+ setMasterValue(null);
3716
+ return;
3717
+ }
3718
+ setMasterValue(
3719
+ import_editor_props26.layoutDirectionPropTypeUtil.create({
3720
+ row: currentValue2,
3721
+ column: currentValue2
3722
+ })
3723
+ );
3697
3724
  return;
3698
3725
  }
3699
- const value = sizeValue ? import_editor_props26.sizePropTypeUtil.create(sizeValue) : null;
3700
- setDirectionValue({
3701
- row: value,
3702
- column: value
3703
- });
3726
+ const currentValue = directionValue?.column ?? directionValue?.row ?? null;
3727
+ setMasterValue(currentValue);
3704
3728
  };
3705
3729
  const tooltipLabel = label.toLowerCase();
3706
3730
  const LinkedIcon = isLinked ? import_icons16.LinkIcon : import_icons16.DetachIcon;
3707
3731
  const linkedLabel = (0, import_i18n25.__)("Link %s", "elementor").replace("%s", tooltipLabel);
3708
3732
  const unlinkedLabel = (0, import_i18n25.__)("Unlink %s", "elementor").replace("%s", tooltipLabel);
3709
3733
  const disabled = sizeDisabled || directionDisabled;
3710
- return /* @__PURE__ */ React68.createElement(PropProvider, { propType, value: directionValue, setValue: setDirectionValue }, /* @__PURE__ */ React68.createElement(import_ui53.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React68.createElement(ControlLabel, null, label), /* @__PURE__ */ React68.createElement(import_ui53.Tooltip, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React68.createElement(
3711
- import_ui53.ToggleButton,
3734
+ const propProviderProps = {
3735
+ propType,
3736
+ value: directionValue,
3737
+ setValue: setDirectionValue,
3738
+ placeholder: directionPlaceholder
3739
+ };
3740
+ const hasPlaceholders = !masterValue && (directionPlaceholder || masterPlaceholder);
3741
+ return /* @__PURE__ */ React68.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ React68.createElement(import_ui53.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React68.createElement(ControlLabel, null, label), /* @__PURE__ */ React68.createElement(import_ui53.Tooltip, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React68.createElement(
3742
+ StyledToggleButton,
3712
3743
  {
3713
3744
  "aria-label": isLinked ? unlinkedLabel : linkedLabel,
3714
3745
  size: "tiny",
@@ -3716,7 +3747,8 @@ var GapControl = ({ label }) => {
3716
3747
  selected: isLinked,
3717
3748
  sx: { marginLeft: "auto" },
3718
3749
  onChange: onLinkToggle,
3719
- disabled
3750
+ disabled,
3751
+ isPlaceholder: hasPlaceholders
3720
3752
  },
3721
3753
  /* @__PURE__ */ React68.createElement(LinkedIcon, { fontSize: "tiny" })
3722
3754
  ))), /* @__PURE__ */ React68.createElement(import_ui53.Stack, { direction: "row", gap: 2, flexWrap: "nowrap", ref: stackRef }, /* @__PURE__ */ React68.createElement(import_ui53.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React68.createElement(import_ui53.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(ControlFormLabel, null, (0, import_i18n25.__)("Column", "elementor"))), /* @__PURE__ */ React68.createElement(import_ui53.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(Control4, { bind: "column", isLinked, anchorRef: stackRef }))), /* @__PURE__ */ React68.createElement(import_ui53.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React68.createElement(import_ui53.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(ControlFormLabel, null, (0, import_i18n25.__)("Row", "elementor"))), /* @__PURE__ */ React68.createElement(import_ui53.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(Control4, { bind: "row", isLinked, anchorRef: stackRef })))));