@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.js CHANGED
@@ -4720,10 +4720,11 @@ var GapControl = ({ label }) => {
4720
4720
  return true;
4721
4721
  };
4722
4722
  const [isLinked, setIsLinked] = (0, import_react43.useState)(() => inferIsLinked());
4723
+ const isCurrentlyDirection = import_editor_props29.layoutDirectionPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
4723
4724
  const activeBreakpoint = (0, import_editor_responsive4.useActiveBreakpoint)();
4724
4725
  (0, import_react43.useLayoutEffect)(() => {
4725
4726
  setIsLinked(inferIsLinked());
4726
- }, [activeBreakpoint]);
4727
+ }, [activeBreakpoint, isCurrentlyDirection]);
4727
4728
  const onLinkToggle = () => {
4728
4729
  setIsLinked((prev) => !prev);
4729
4730
  if (!import_editor_props29.layoutDirectionPropTypeUtil.isValid(masterValue)) {
@@ -4751,10 +4752,21 @@ var GapControl = ({ label }) => {
4751
4752
  const propProviderProps = {
4752
4753
  propType,
4753
4754
  value: directionValue,
4754
- setValue: setDirectionValue,
4755
+ setValue: (directions) => {
4756
+ const entries = Object.entries(directions);
4757
+ const filtered = entries.filter(([, value]) => Boolean(value));
4758
+ setDirectionValue(filtered.length === 0 ? null : Object.fromEntries(filtered));
4759
+ },
4755
4760
  placeholder: directionPlaceholder
4756
4761
  };
4757
4762
  const hasPlaceholders = !masterValue && (directionPlaceholder || masterPlaceholder);
4763
+ const getEffectivePlaceholder = (bind) => {
4764
+ if (isLinked) {
4765
+ const linkedPlaceholder = directionPlaceholder?.column ?? directionPlaceholder?.row;
4766
+ return import_editor_props29.sizePropTypeUtil.extract(linkedPlaceholder);
4767
+ }
4768
+ return import_editor_props29.sizePropTypeUtil.extract(directionPlaceholder?.[bind]);
4769
+ };
4758
4770
  return /* @__PURE__ */ React75.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ React75.createElement(import_ui58.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React75.createElement(ControlLabel, null, label), /* @__PURE__ */ React75.createElement(import_ui58.Tooltip, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React75.createElement(
4759
4771
  StyledToggleButton,
4760
4772
  {
@@ -4774,7 +4786,8 @@ var GapControl = ({ label }) => {
4774
4786
  bind: "column",
4775
4787
  ariaLabel: (0, import_i18n26.__)("Column gap", "elementor"),
4776
4788
  isLinked,
4777
- anchorRef: stackRef
4789
+ anchorRef: stackRef,
4790
+ placeholder: getEffectivePlaceholder("column") ?? void 0
4778
4791
  }
4779
4792
  ))), /* @__PURE__ */ React75.createElement(import_ui58.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React75.createElement(import_ui58.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React75.createElement(ControlFormLabel, null, (0, import_i18n26.__)("Row", "elementor"))), /* @__PURE__ */ React75.createElement(import_ui58.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React75.createElement(
4780
4793
  Control4,
@@ -4782,7 +4795,8 @@ var GapControl = ({ label }) => {
4782
4795
  bind: "row",
4783
4796
  ariaLabel: (0, import_i18n26.__)("Row gap", "elementor"),
4784
4797
  isLinked,
4785
- anchorRef: stackRef
4798
+ anchorRef: stackRef,
4799
+ placeholder: getEffectivePlaceholder("row") ?? void 0
4786
4800
  }
4787
4801
  )))));
4788
4802
  };
@@ -4790,12 +4804,13 @@ var Control4 = ({
4790
4804
  bind,
4791
4805
  ariaLabel,
4792
4806
  isLinked,
4793
- anchorRef
4807
+ anchorRef,
4808
+ placeholder
4794
4809
  }) => {
4795
4810
  if (isLinked) {
4796
- return /* @__PURE__ */ React75.createElement(SizeControl, { anchorRef, ariaLabel });
4811
+ return /* @__PURE__ */ React75.createElement(UnstableSizeControl, { anchorRef, placeholder, ariaLabel });
4797
4812
  }
4798
- return /* @__PURE__ */ React75.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React75.createElement(SizeControl, { anchorRef, ariaLabel }));
4813
+ return /* @__PURE__ */ React75.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React75.createElement(UnstableSizeControl, { anchorRef, placeholder, ariaLabel }));
4799
4814
  };
4800
4815
 
4801
4816
  // src/controls/aspect-ratio-control.tsx