@elementor/editor-controls 3.35.0-364 → 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.mjs CHANGED
@@ -2699,7 +2699,7 @@ import { Grid as Grid9, Stack as Stack8, Tooltip as Tooltip6 } from "@elementor/
2699
2699
  import { __ as __18 } from "@wordpress/i18n";
2700
2700
  var LinkedDimensionsControl = ({ label, isSiteRtl = false, extendedOptions, min }) => {
2701
2701
  const gridRowRefs = [useRef9(null), useRef9(null)];
2702
- const { disabled: sizeDisabled, placeholder: sizePlaceholder } = useBoundProp(sizePropTypeUtil4);
2702
+ const { disabled: sizeDisabled } = useBoundProp(sizePropTypeUtil4);
2703
2703
  const {
2704
2704
  value: dimensionsValue,
2705
2705
  setValue: setDimensionsValue,
@@ -2708,12 +2708,11 @@ var LinkedDimensionsControl = ({ label, isSiteRtl = false, extendedOptions, min
2708
2708
  disabled: dimensionsDisabled
2709
2709
  } = useBoundProp(dimensionsPropTypeUtil);
2710
2710
  const { value: masterValue, placeholder: masterPlaceholder, setValue: setMasterValue } = useBoundProp();
2711
- const hasPlaceholders = !!(sizePlaceholder || dimensionsPlaceholder);
2712
2711
  const inferIsLinked = () => {
2713
2712
  if (dimensionsPropTypeUtil.isValid(masterValue)) {
2714
2713
  return false;
2715
2714
  }
2716
- if (dimensionsPropTypeUtil.isValid(masterPlaceholder)) {
2715
+ if (!masterValue && dimensionsPropTypeUtil.isValid(masterPlaceholder)) {
2717
2716
  return false;
2718
2717
  }
2719
2718
  return true;
@@ -2760,6 +2759,7 @@ var LinkedDimensionsControl = ({ label, isSiteRtl = false, extendedOptions, min
2760
2759
  setValue: setDimensionsValue,
2761
2760
  isDisabled: () => dimensionsDisabled
2762
2761
  };
2762
+ const hasPlaceholders = !masterValue && (dimensionsPlaceholder || masterPlaceholder);
2763
2763
  return /* @__PURE__ */ React57.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ React57.createElement(Stack8, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(ControlFormLabel, null, label), /* @__PURE__ */ React57.createElement(Tooltip6, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React57.createElement(
2764
2764
  StyledToggleButton,
2765
2765
  {
@@ -3620,39 +3620,70 @@ var HtmlTagControl = createControl(({ options, onChange, fallbackLabels = {} })
3620
3620
 
3621
3621
  // src/controls/gap-control.tsx
3622
3622
  import * as React68 from "react";
3623
- import { useRef as useRef10 } from "react";
3623
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef10, useState as useState12 } from "react";
3624
3624
  import { layoutDirectionPropTypeUtil, sizePropTypeUtil as sizePropTypeUtil5 } from "@elementor/editor-props";
3625
+ import { useActiveBreakpoint as useActiveBreakpoint3 } from "@elementor/editor-responsive";
3625
3626
  import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/icons";
3626
- import { Grid as Grid11, Stack as Stack11, ToggleButton as ToggleButton3, Tooltip as Tooltip7 } from "@elementor/ui";
3627
+ import { Grid as Grid11, Stack as Stack11, Tooltip as Tooltip7 } from "@elementor/ui";
3627
3628
  import { __ as __25 } from "@wordpress/i18n";
3628
3629
  var GapControl = ({ label }) => {
3630
+ const stackRef = useRef10(null);
3631
+ const { disabled: sizeDisabled } = useBoundProp(sizePropTypeUtil5);
3629
3632
  const {
3630
3633
  value: directionValue,
3631
3634
  setValue: setDirectionValue,
3632
3635
  propType,
3636
+ placeholder: directionPlaceholder,
3633
3637
  disabled: directionDisabled
3634
3638
  } = useBoundProp(layoutDirectionPropTypeUtil);
3635
- const stackRef = useRef10(null);
3636
- const { value: sizeValue, setValue: setSizeValue, disabled: sizeDisabled } = useBoundProp(sizePropTypeUtil5);
3637
- const isLinked = !directionValue && !sizeValue ? true : !!sizeValue;
3639
+ const { value: masterValue, setValue: setMasterValue, placeholder: masterPlaceholder } = useBoundProp();
3640
+ const inferIsLinked = () => {
3641
+ if (layoutDirectionPropTypeUtil.isValid(masterValue)) {
3642
+ return false;
3643
+ }
3644
+ if (!masterValue && layoutDirectionPropTypeUtil.isValid(masterPlaceholder)) {
3645
+ return false;
3646
+ }
3647
+ return true;
3648
+ };
3649
+ const [isLinked, setIsLinked] = useState12(() => inferIsLinked());
3650
+ const activeBreakpoint = useActiveBreakpoint3();
3651
+ useLayoutEffect2(() => {
3652
+ setIsLinked(inferIsLinked());
3653
+ }, [activeBreakpoint]);
3638
3654
  const onLinkToggle = () => {
3639
- if (!isLinked) {
3640
- setSizeValue(directionValue?.column?.value ?? null);
3655
+ setIsLinked((prev) => !prev);
3656
+ if (!layoutDirectionPropTypeUtil.isValid(masterValue)) {
3657
+ const currentValue2 = masterValue ? masterValue : null;
3658
+ if (!currentValue2) {
3659
+ setMasterValue(null);
3660
+ return;
3661
+ }
3662
+ setMasterValue(
3663
+ layoutDirectionPropTypeUtil.create({
3664
+ row: currentValue2,
3665
+ column: currentValue2
3666
+ })
3667
+ );
3641
3668
  return;
3642
3669
  }
3643
- const value = sizeValue ? sizePropTypeUtil5.create(sizeValue) : null;
3644
- setDirectionValue({
3645
- row: value,
3646
- column: value
3647
- });
3670
+ const currentValue = directionValue?.column ?? directionValue?.row ?? null;
3671
+ setMasterValue(currentValue);
3648
3672
  };
3649
3673
  const tooltipLabel = label.toLowerCase();
3650
3674
  const LinkedIcon = isLinked ? LinkIcon2 : DetachIcon2;
3651
3675
  const linkedLabel = __25("Link %s", "elementor").replace("%s", tooltipLabel);
3652
3676
  const unlinkedLabel = __25("Unlink %s", "elementor").replace("%s", tooltipLabel);
3653
3677
  const disabled = sizeDisabled || directionDisabled;
3654
- return /* @__PURE__ */ React68.createElement(PropProvider, { propType, value: directionValue, setValue: setDirectionValue }, /* @__PURE__ */ React68.createElement(Stack11, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React68.createElement(ControlLabel, null, label), /* @__PURE__ */ React68.createElement(Tooltip7, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React68.createElement(
3655
- ToggleButton3,
3678
+ const propProviderProps = {
3679
+ propType,
3680
+ value: directionValue,
3681
+ setValue: setDirectionValue,
3682
+ placeholder: directionPlaceholder
3683
+ };
3684
+ const hasPlaceholders = !masterValue && (directionPlaceholder || masterPlaceholder);
3685
+ return /* @__PURE__ */ React68.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ React68.createElement(Stack11, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React68.createElement(ControlLabel, null, label), /* @__PURE__ */ React68.createElement(Tooltip7, { title: isLinked ? unlinkedLabel : linkedLabel, placement: "top" }, /* @__PURE__ */ React68.createElement(
3686
+ StyledToggleButton,
3656
3687
  {
3657
3688
  "aria-label": isLinked ? unlinkedLabel : linkedLabel,
3658
3689
  size: "tiny",
@@ -3660,7 +3691,8 @@ var GapControl = ({ label }) => {
3660
3691
  selected: isLinked,
3661
3692
  sx: { marginLeft: "auto" },
3662
3693
  onChange: onLinkToggle,
3663
- disabled
3694
+ disabled,
3695
+ isPlaceholder: hasPlaceholders
3664
3696
  },
3665
3697
  /* @__PURE__ */ React68.createElement(LinkedIcon, { fontSize: "tiny" })
3666
3698
  ))), /* @__PURE__ */ React68.createElement(Stack11, { direction: "row", gap: 2, flexWrap: "nowrap", ref: stackRef }, /* @__PURE__ */ React68.createElement(Grid11, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React68.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(ControlFormLabel, null, __25("Column", "elementor"))), /* @__PURE__ */ React68.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(Control4, { bind: "column", isLinked, anchorRef: stackRef }))), /* @__PURE__ */ React68.createElement(Grid11, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React68.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(ControlFormLabel, null, __25("Row", "elementor"))), /* @__PURE__ */ React68.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React68.createElement(Control4, { bind: "row", isLinked, anchorRef: stackRef })))));
@@ -3678,7 +3710,7 @@ var Control4 = ({
3678
3710
 
3679
3711
  // src/controls/aspect-ratio-control.tsx
3680
3712
  import * as React69 from "react";
3681
- import { useEffect as useEffect7, useState as useState12 } from "react";
3713
+ import { useEffect as useEffect7, useState as useState13 } from "react";
3682
3714
  import { stringPropTypeUtil as stringPropTypeUtil8 } from "@elementor/editor-props";
3683
3715
  import { MenuListItem as MenuListItem4 } from "@elementor/editor-ui";
3684
3716
  import { ArrowsMoveHorizontalIcon, ArrowsMoveVerticalIcon } from "@elementor/icons";
@@ -3699,10 +3731,10 @@ var AspectRatioControl = createControl(({ label }) => {
3699
3731
  const { value: aspectRatioValue, setValue: setAspectRatioValue, disabled } = useBoundProp(stringPropTypeUtil8);
3700
3732
  const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
3701
3733
  const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split("/") : ["", ""];
3702
- const [isCustom, setIsCustom] = useState12(isCustomSelected);
3703
- const [customWidth, setCustomWidth] = useState12(initialWidth);
3704
- const [customHeight, setCustomHeight] = useState12(initialHeight);
3705
- const [selectedValue, setSelectedValue] = useState12(
3734
+ const [isCustom, setIsCustom] = useState13(isCustomSelected);
3735
+ const [customWidth, setCustomWidth] = useState13(initialWidth);
3736
+ const [customHeight, setCustomHeight] = useState13(initialHeight);
3737
+ const [selectedValue, setSelectedValue] = useState13(
3706
3738
  isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
3707
3739
  );
3708
3740
  useEffect7(() => {
@@ -3789,7 +3821,7 @@ var AspectRatioControl = createControl(({ label }) => {
3789
3821
 
3790
3822
  // src/controls/svg-media-control.tsx
3791
3823
  import * as React71 from "react";
3792
- import { useState as useState14 } from "react";
3824
+ import { useState as useState15 } from "react";
3793
3825
  import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
3794
3826
  import { imageSrcPropTypeUtil as imageSrcPropTypeUtil2 } from "@elementor/editor-props";
3795
3827
  import { UploadIcon as UploadIcon2 } from "@elementor/icons";
@@ -3799,7 +3831,7 @@ import { __ as __28 } from "@wordpress/i18n";
3799
3831
 
3800
3832
  // src/components/enable-unfiltered-modal.tsx
3801
3833
  import * as React70 from "react";
3802
- import { useState as useState13 } from "react";
3834
+ import { useState as useState14 } from "react";
3803
3835
  import {
3804
3836
  Button as Button3,
3805
3837
  CircularProgress as CircularProgress2,
@@ -3825,7 +3857,7 @@ var ADMIN_FAILED_CONTENT_TEXT_PT2 = __27(
3825
3857
  var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
3826
3858
  var EnableUnfilteredModal = (props) => {
3827
3859
  const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
3828
- const [isError, setIsError] = useState13(false);
3860
+ const [isError, setIsError] = useState14(false);
3829
3861
  const onClose = (enabled) => {
3830
3862
  props.onClose(enabled);
3831
3863
  setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
@@ -3888,7 +3920,7 @@ var SvgMediaControl = createControl(() => {
3888
3920
  const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
3889
3921
  const src = attachment?.url ?? url?.value ?? null;
3890
3922
  const { data: allowSvgUpload } = useUnfilteredFilesUpload();
3891
- const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState14(false);
3923
+ const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState15(false);
3892
3924
  const { canUser } = useCurrentUserCapabilities();
3893
3925
  const canManageOptions = canUser("manage_options");
3894
3926
  const { open } = useWpMediaFrame2({
@@ -4680,7 +4712,7 @@ var getAllProperties = (pattern) => {
4680
4712
 
4681
4713
  // src/controls/key-value-control.tsx
4682
4714
  import * as React80 from "react";
4683
- import { useMemo as useMemo9, useState as useState15 } from "react";
4715
+ import { useMemo as useMemo9, useState as useState16 } from "react";
4684
4716
  import {
4685
4717
  isTransformable,
4686
4718
  keyValuePropTypeUtil,
@@ -4711,9 +4743,9 @@ var getInitialFieldValue = (fieldValue) => {
4711
4743
  };
4712
4744
  var KeyValueControl = createControl((props = {}) => {
4713
4745
  const { value, setValue, ...propContext } = useBoundProp(keyValuePropTypeUtil);
4714
- const [keyError, setKeyError] = useState15("");
4715
- const [valueError, setValueError] = useState15("");
4716
- const [sessionState, setSessionState] = useState15({
4746
+ const [keyError, setKeyError] = useState16("");
4747
+ const [valueError, setValueError] = useState16("");
4748
+ const [sessionState, setSessionState] = useState16({
4717
4749
  key: getInitialFieldValue(value?.key),
4718
4750
  value: getInitialFieldValue(value?.value)
4719
4751
  });
@@ -5445,7 +5477,7 @@ var TransformBasePopoverTrigger = ({
5445
5477
 
5446
5478
  // src/controls/transition-control/transition-repeater-control.tsx
5447
5479
  import * as React97 from "react";
5448
- import { useEffect as useEffect8, useMemo as useMemo11, useState as useState16 } from "react";
5480
+ import { useEffect as useEffect8, useMemo as useMemo11, useState as useState17 } from "react";
5449
5481
  import {
5450
5482
  createArrayPropUtils as createArrayPropUtils2,
5451
5483
  selectionSizePropTypeUtil as selectionSizePropTypeUtil2
@@ -5771,7 +5803,7 @@ var TransitionRepeaterControl = createControl(
5771
5803
  currentStyleState
5772
5804
  }) => {
5773
5805
  const currentStyleIsNormal = currentStyleState === null;
5774
- const [recentlyUsedList, setRecentlyUsedList] = useState16([]);
5806
+ const [recentlyUsedList, setRecentlyUsedList] = useState17([]);
5775
5807
  const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
5776
5808
  const disabledItems = useMemo11(() => getDisabledItemLabels(value), [value]);
5777
5809
  const allowedTransitionSet = useMemo11(() => {
@@ -5931,7 +5963,7 @@ function isEmpty(value = "") {
5931
5963
 
5932
5964
  // src/components/inline-editor-toolbar.tsx
5933
5965
  import * as React100 from "react";
5934
- import { useMemo as useMemo12, useRef as useRef25, useState as useState17 } from "react";
5966
+ import { useMemo as useMemo12, useRef as useRef25, useState as useState18 } from "react";
5935
5967
  import {
5936
5968
  BoldIcon,
5937
5969
  ItalicIcon,
@@ -5945,7 +5977,7 @@ import {
5945
5977
  import {
5946
5978
  Box as Box21,
5947
5979
  IconButton as IconButton8,
5948
- ToggleButton as ToggleButton5,
5980
+ ToggleButton as ToggleButton4,
5949
5981
  ToggleButtonGroup as ToggleButtonGroup2,
5950
5982
  toggleButtonGroupClasses,
5951
5983
  Tooltip as Tooltip9,
@@ -5958,7 +5990,7 @@ import { __ as __51 } from "@wordpress/i18n";
5958
5990
  import * as React99 from "react";
5959
5991
  import { useEffect as useEffect9, useRef as useRef24 } from "react";
5960
5992
  import { ExternalLinkIcon } from "@elementor/icons";
5961
- import { bindPopover as bindPopover7, Popover as Popover7, Stack as Stack16, TextField as TextField8, ToggleButton as ToggleButton4 } from "@elementor/ui";
5993
+ import { bindPopover as bindPopover7, Popover as Popover7, Stack as Stack16, TextField as TextField8, ToggleButton as ToggleButton3 } from "@elementor/ui";
5962
5994
  import { __ as __50 } from "@wordpress/i18n";
5963
5995
  var UrlPopover = ({
5964
5996
  popupState,
@@ -6003,7 +6035,7 @@ var UrlPopover = ({
6003
6035
  InputProps: { sx: { borderRadius: "8px" } }
6004
6036
  }
6005
6037
  ), /* @__PURE__ */ React99.createElement(
6006
- ToggleButton4,
6038
+ ToggleButton3,
6007
6039
  {
6008
6040
  size: "tiny",
6009
6041
  value: "newTab",
@@ -6085,8 +6117,8 @@ var toolbarButtons = {
6085
6117
  var { clear: clearButton, ...formatButtons } = toolbarButtons;
6086
6118
  var possibleFormats = Object.keys(formatButtons);
6087
6119
  var InlineEditorToolbar = ({ editor }) => {
6088
- const [urlValue, setUrlValue] = useState17("");
6089
- const [openInNewTab, setOpenInNewTab] = useState17(false);
6120
+ const [urlValue, setUrlValue] = useState18("");
6121
+ const [openInNewTab, setOpenInNewTab] = useState18(false);
6090
6122
  const toolbarRef = useRef25(null);
6091
6123
  const linkPopupState = usePopupState8({ variant: "popover" });
6092
6124
  const editorState = useEditorState({
@@ -6160,7 +6192,7 @@ var InlineEditorToolbar = ({ editor }) => {
6160
6192
  }
6161
6193
  },
6162
6194
  formatButtonsList.map((button) => /* @__PURE__ */ React100.createElement(Tooltip9, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React100.createElement(
6163
- ToggleButton5,
6195
+ ToggleButton4,
6164
6196
  {
6165
6197
  value: button.action,
6166
6198
  "aria-label": button.label,
@@ -6403,7 +6435,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
6403
6435
 
6404
6436
  // src/components/repeater/repeater.tsx
6405
6437
  import * as React104 from "react";
6406
- import { useEffect as useEffect12, useState as useState19 } from "react";
6438
+ import { useEffect as useEffect12, useState as useState20 } from "react";
6407
6439
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
6408
6440
  import {
6409
6441
  bindPopover as bindPopover9,
@@ -6432,7 +6464,7 @@ var Repeater3 = ({
6432
6464
  openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
6433
6465
  isSortable = true
6434
6466
  }) => {
6435
- const [openItem, setOpenItem] = useState19(initialOpenItem);
6467
+ const [openItem, setOpenItem] = useState20(initialOpenItem);
6436
6468
  const uniqueKeys = items2.map(
6437
6469
  (item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
6438
6470
  );
@@ -6588,7 +6620,7 @@ var RepeaterItem = ({
6588
6620
  ), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(Box24, null, children({ anchorEl: ref }))));
6589
6621
  };
6590
6622
  var usePopover = (openOnMount, onOpen) => {
6591
- const [ref, setRef] = useState19(null);
6623
+ const [ref, setRef] = useState20(null);
6592
6624
  const popoverState = usePopupState10({ variant: "popover" });
6593
6625
  const popoverProps = bindPopover9(popoverState);
6594
6626
  useEffect12(() => {