@elementor/editor-controls 4.1.0-775 → 4.1.0-777

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
@@ -4627,7 +4627,10 @@ var HtmlTagControl = createControl((props) => {
4627
4627
  // src/controls/gap-control.tsx
4628
4628
  import * as React75 from "react";
4629
4629
  import { useLayoutEffect as useLayoutEffect2, useRef as useRef12, useState as useState13 } from "react";
4630
- import { layoutDirectionPropTypeUtil, sizePropTypeUtil as sizePropTypeUtil6 } from "@elementor/editor-props";
4630
+ import {
4631
+ layoutDirectionPropTypeUtil,
4632
+ sizePropTypeUtil as sizePropTypeUtil6
4633
+ } from "@elementor/editor-props";
4631
4634
  import { useActiveBreakpoint as useActiveBreakpoint4 } from "@elementor/editor-responsive";
4632
4635
  import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/icons";
4633
4636
  import { Grid as Grid11, Stack as Stack11, Tooltip as Tooltip7 } from "@elementor/ui";
@@ -4653,10 +4656,11 @@ var GapControl = ({ label }) => {
4653
4656
  return true;
4654
4657
  };
4655
4658
  const [isLinked, setIsLinked] = useState13(() => inferIsLinked());
4659
+ const isCurrentlyDirection = layoutDirectionPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
4656
4660
  const activeBreakpoint = useActiveBreakpoint4();
4657
4661
  useLayoutEffect2(() => {
4658
4662
  setIsLinked(inferIsLinked());
4659
- }, [activeBreakpoint]);
4663
+ }, [activeBreakpoint, isCurrentlyDirection]);
4660
4664
  const onLinkToggle = () => {
4661
4665
  setIsLinked((prev) => !prev);
4662
4666
  if (!layoutDirectionPropTypeUtil.isValid(masterValue)) {
@@ -4684,10 +4688,21 @@ var GapControl = ({ label }) => {
4684
4688
  const propProviderProps = {
4685
4689
  propType,
4686
4690
  value: directionValue,
4687
- setValue: setDirectionValue,
4691
+ setValue: (directions) => {
4692
+ const entries = Object.entries(directions);
4693
+ const filtered = entries.filter(([, value]) => Boolean(value));
4694
+ setDirectionValue(filtered.length === 0 ? null : Object.fromEntries(filtered));
4695
+ },
4688
4696
  placeholder: directionPlaceholder
4689
4697
  };
4690
4698
  const hasPlaceholders = !masterValue && (directionPlaceholder || masterPlaceholder);
4699
+ const getEffectivePlaceholder = (bind) => {
4700
+ if (isLinked) {
4701
+ const linkedPlaceholder = directionPlaceholder?.column ?? directionPlaceholder?.row;
4702
+ return sizePropTypeUtil6.extract(linkedPlaceholder);
4703
+ }
4704
+ return sizePropTypeUtil6.extract(directionPlaceholder?.[bind]);
4705
+ };
4691
4706
  return /* @__PURE__ */ React75.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ React75.createElement(Stack11, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React75.createElement(ControlLabel, null, label), /* @__PURE__ */ React75.createElement(Tooltip7, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React75.createElement(
4692
4707
  StyledToggleButton,
4693
4708
  {
@@ -4707,7 +4722,8 @@ var GapControl = ({ label }) => {
4707
4722
  bind: "column",
4708
4723
  ariaLabel: __26("Column gap", "elementor"),
4709
4724
  isLinked,
4710
- anchorRef: stackRef
4725
+ anchorRef: stackRef,
4726
+ placeholder: getEffectivePlaceholder("column") ?? void 0
4711
4727
  }
4712
4728
  ))), /* @__PURE__ */ React75.createElement(Grid11, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React75.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React75.createElement(ControlFormLabel, null, __26("Row", "elementor"))), /* @__PURE__ */ React75.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React75.createElement(
4713
4729
  Control4,
@@ -4715,7 +4731,8 @@ var GapControl = ({ label }) => {
4715
4731
  bind: "row",
4716
4732
  ariaLabel: __26("Row gap", "elementor"),
4717
4733
  isLinked,
4718
- anchorRef: stackRef
4734
+ anchorRef: stackRef,
4735
+ placeholder: getEffectivePlaceholder("row") ?? void 0
4719
4736
  }
4720
4737
  )))));
4721
4738
  };
@@ -4723,12 +4740,13 @@ var Control4 = ({
4723
4740
  bind,
4724
4741
  ariaLabel,
4725
4742
  isLinked,
4726
- anchorRef
4743
+ anchorRef,
4744
+ placeholder
4727
4745
  }) => {
4728
4746
  if (isLinked) {
4729
- return /* @__PURE__ */ React75.createElement(SizeControl, { anchorRef, ariaLabel });
4747
+ return /* @__PURE__ */ React75.createElement(UnstableSizeControl, { anchorRef, placeholder, ariaLabel });
4730
4748
  }
4731
- return /* @__PURE__ */ React75.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React75.createElement(SizeControl, { anchorRef, ariaLabel }));
4749
+ return /* @__PURE__ */ React75.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React75.createElement(UnstableSizeControl, { anchorRef, placeholder, ariaLabel }));
4732
4750
  };
4733
4751
 
4734
4752
  // src/controls/aspect-ratio-control.tsx