@elementor/editor-interactions 4.1.0-713 → 4.1.0-715

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
@@ -565,10 +565,10 @@ var trackInteractionCreated = (elementId, item) => {
565
565
 
566
566
  // src/components/interactions-list.tsx
567
567
  import * as React10 from "react";
568
- import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef3 } from "react";
568
+ import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2 } from "react";
569
569
  import { Repeater } from "@elementor/editor-controls";
570
570
  import { InfoCircleFilledIcon, PlayerPlayIcon } from "@elementor/icons";
571
- import { Alert, AlertTitle, Box as Box2, IconButton, Tooltip } from "@elementor/ui";
571
+ import { Alert, AlertTitle, Box, IconButton, Tooltip } from "@elementor/ui";
572
572
  import { __ as __5 } from "@wordpress/i18n";
573
573
 
574
574
  // src/contexts/interactions-item-context.tsx
@@ -597,9 +597,9 @@ import { __ as __4 } from "@wordpress/i18n";
597
597
 
598
598
  // src/components/interaction-details.tsx
599
599
  import * as React7 from "react";
600
- import { useMemo, useRef as useRef2 } from "react";
600
+ import { useMemo } from "react";
601
601
  import { PopoverContent } from "@elementor/editor-controls";
602
- import { Box, Divider, Grid as Grid2 } from "@elementor/ui";
602
+ import { Divider, Grid as Grid2 } from "@elementor/ui";
603
603
  import { __ as __2 } from "@wordpress/i18n";
604
604
 
605
605
  // src/utils/resolve-direction.ts
@@ -793,7 +793,6 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
793
793
  controlVisibilityConfig.times(interactionValues)
794
794
  );
795
795
  const EasingControl = useControlComponent("easing");
796
- const containerRef = useRef2(null);
797
796
  const updateInteraction = (updates) => {
798
797
  const resolvedDirectionValue = resolveDirection(
799
798
  "direction" in updates,
@@ -828,19 +827,12 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
828
827
  onPlayInteraction(interactionId);
829
828
  }, 0);
830
829
  };
831
- return /* @__PURE__ */ React7.createElement(Box, { ref: containerRef }, /* @__PURE__ */ React7.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Trigger", "elementor") }, /* @__PURE__ */ React7.createElement(
832
- TriggerControl,
833
- {
834
- value: trigger,
835
- onChange: (v) => updateInteraction({ trigger: v })
836
- }
837
- )), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
830
+ return /* @__PURE__ */ React7.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Trigger", "elementor") }, /* @__PURE__ */ React7.createElement(TriggerControl, { value: trigger, onChange: (v) => updateInteraction({ trigger: v }) })), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
838
831
  ReplayControl,
839
832
  {
840
833
  value: replay,
841
834
  onChange: (v) => updateInteraction({ replay: v }),
842
- disabled: true,
843
- anchorRef: containerRef
835
+ disabled: true
844
836
  }
845
837
  ))), /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(Grid2, { container: true, spacing: 1.5 }, EffectControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Effect", "elementor") }, /* @__PURE__ */ React7.createElement(EffectControl, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), CustomEffectControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Custom Effect", "elementor") }, /* @__PURE__ */ React7.createElement(
846
838
  CustomEffectControl,
@@ -903,7 +895,7 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
903
895
  updateInteraction({ easing: v });
904
896
  }
905
897
  }
906
- )))));
898
+ ))));
907
899
  };
908
900
 
909
901
  // src/components/interaction-settings.tsx
@@ -1018,7 +1010,7 @@ var MAX_NUMBER_OF_INTERACTIONS = 5;
1018
1010
  function InteractionsList(props) {
1019
1011
  const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props;
1020
1012
  const { elementId } = useInteractionsContext();
1021
- const hasInitializedRef = useRef3(false);
1013
+ const hasInitializedRef = useRef2(false);
1022
1014
  const handleUpdateInteractions = useCallback5(
1023
1015
  (newInteractions) => {
1024
1016
  onSelectInteractions(newInteractions);
@@ -1038,7 +1030,7 @@ function InteractionsList(props) {
1038
1030
  const isMaxNumberOfInteractionsReached = useMemo3(() => {
1039
1031
  return interactions.items?.length >= MAX_NUMBER_OF_INTERACTIONS;
1040
1032
  }, [interactions.items?.length]);
1041
- const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ React10.createElement(Alert, { color: "secondary", icon: /* @__PURE__ */ React10.createElement(InfoCircleFilledIcon, null), size: "small" }, /* @__PURE__ */ React10.createElement(AlertTitle, null, __5("Interactions", "elementor")), /* @__PURE__ */ React10.createElement(Box2, { component: "span" }, __5(
1033
+ const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ React10.createElement(Alert, { color: "secondary", icon: /* @__PURE__ */ React10.createElement(InfoCircleFilledIcon, null), size: "small" }, /* @__PURE__ */ React10.createElement(AlertTitle, null, __5("Interactions", "elementor")), /* @__PURE__ */ React10.createElement(Box, { component: "span" }, __5(
1042
1034
  "You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.",
1043
1035
  "elementor"
1044
1036
  ))) : void 0;
@@ -1455,7 +1447,7 @@ import { __ as __10 } from "@wordpress/i18n";
1455
1447
 
1456
1448
  // src/ui/promotion-select.tsx
1457
1449
  import * as React14 from "react";
1458
- import { useRef as useRef4 } from "react";
1450
+ import { useRef as useRef3 } from "react";
1459
1451
  import { MenuListItem } from "@elementor/editor-ui";
1460
1452
  import { MenuSubheader, Select } from "@elementor/ui";
1461
1453
  import { __ as __9 } from "@wordpress/i18n";
@@ -1465,7 +1457,7 @@ import * as React13 from "react";
1465
1457
  import { forwardRef, useCallback as useCallback7, useImperativeHandle, useState as useState5 } from "react";
1466
1458
  import { trackUpgradePromotionClick, trackViewPromotion } from "@elementor/editor-controls";
1467
1459
  import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
1468
- import { Box as Box3 } from "@elementor/ui";
1460
+ import { Box as Box2 } from "@elementor/ui";
1469
1461
  import { __ as __8 } from "@wordpress/i18n";
1470
1462
  var InteractionsPromotionChip = forwardRef(
1471
1463
  ({ content, upgradeUrl, anchorRef, trackingData }, ref) => {
@@ -1501,7 +1493,7 @@ var InteractionsPromotionChip = forwardRef(
1501
1493
  onCtaClick: () => trackUpgradePromotionClick(trackingData)
1502
1494
  },
1503
1495
  /* @__PURE__ */ React13.createElement(
1504
- Box3,
1496
+ Box2,
1505
1497
  {
1506
1498
  onMouseDown: (e) => e.stopPropagation(),
1507
1499
  onClick: handleToggle,
@@ -1512,7 +1504,6 @@ var InteractionsPromotionChip = forwardRef(
1512
1504
  );
1513
1505
  }
1514
1506
  );
1515
- InteractionsPromotionChip.displayName = "InteractionsPromotionChip";
1516
1507
 
1517
1508
  // src/ui/promotion-select.tsx
1518
1509
  function PromotionSelect({
@@ -1525,8 +1516,8 @@ function PromotionSelect({
1525
1516
  upgradeUrl,
1526
1517
  trackingData
1527
1518
  }) {
1528
- const promotionRef = useRef4(null);
1529
- const anchorRef = useRef4(null);
1519
+ const promotionRef = useRef3(null);
1520
+ const anchorRef = useRef3(null);
1530
1521
  return /* @__PURE__ */ React14.createElement(
1531
1522
  Select,
1532
1523
  {
@@ -1660,58 +1651,128 @@ function EffectType({ value, onChange }) {
1660
1651
  return /* @__PURE__ */ React17.createElement(ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
1661
1652
  }
1662
1653
 
1663
- // src/components/controls/replay.tsx
1664
- import * as React18 from "react";
1654
+ // src/components/controls/repeat.tsx
1655
+ import * as React19 from "react";
1656
+ import { useRef as useRef4 } from "react";
1665
1657
  import { ToggleButtonGroupUi as ToggleButtonGroupUi2 } from "@elementor/editor-controls";
1666
- import { CheckIcon, MinusIcon } from "@elementor/icons";
1667
- import { Box as Box4 } from "@elementor/ui";
1658
+ import { Number123Icon, RepeatIcon } from "@elementor/icons";
1668
1659
  import { __ as __13 } from "@wordpress/i18n";
1669
- var TRACKING_DATA3 = { target_name: "interactions_replay", location_l2: "interactions" };
1660
+
1661
+ // src/ui/promotion-overlay-layout.tsx
1662
+ import * as React18 from "react";
1663
+ import { forwardRef as forwardRef2 } from "react";
1664
+ import { Box as Box3 } from "@elementor/ui";
1665
+ var OVERLAY_GRID = "1 / 1";
1666
+ var CHIP_OFFSET = "50%";
1667
+ var PromotionOverlayLayout = forwardRef2(
1668
+ ({ children, promotionChip }, ref) => /* @__PURE__ */ React18.createElement(Box3, { ref, sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(Box3, { sx: { gridArea: OVERLAY_GRID } }, children), /* @__PURE__ */ React18.createElement(Box3, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, promotionChip))
1669
+ );
1670
+
1671
+ // src/components/controls/repeat.tsx
1672
+ var TRACKING_DATA3 = { target_name: "interactions_repeat", location_l2: "interactions" };
1673
+ var REPEAT_OPTIONS = {
1674
+ times: __13("times", "elementor"),
1675
+ loop: __13("loop", "elementor")
1676
+ };
1677
+ var REPEAT_TOOLTIPS = {
1678
+ times: __13("Enable number", "elementor"),
1679
+ loop: __13("Infinite repeat", "elementor")
1680
+ };
1681
+ function Repeat() {
1682
+ const repeatContainerRef = useRef4(null);
1683
+ const options = [
1684
+ {
1685
+ value: REPEAT_OPTIONS.times,
1686
+ disabled: true,
1687
+ label: REPEAT_TOOLTIPS.times,
1688
+ renderContent: ({ size }) => /* @__PURE__ */ React19.createElement(Number123Icon, { fontSize: size }),
1689
+ showTooltip: true
1690
+ },
1691
+ {
1692
+ value: REPEAT_OPTIONS.loop,
1693
+ disabled: true,
1694
+ label: REPEAT_TOOLTIPS.loop,
1695
+ renderContent: ({ size }) => /* @__PURE__ */ React19.createElement(RepeatIcon, { fontSize: size }),
1696
+ showTooltip: true
1697
+ }
1698
+ ];
1699
+ return /* @__PURE__ */ React19.createElement(
1700
+ PromotionOverlayLayout,
1701
+ {
1702
+ ref: repeatContainerRef,
1703
+ promotionChip: /* @__PURE__ */ React19.createElement(
1704
+ InteractionsPromotionChip,
1705
+ {
1706
+ content: __13("Upgrade to control how many times the animation repeats.", "elementor"),
1707
+ upgradeUrl: "https://go.elementor.com/go-pro-interactions-repeat-modal/",
1708
+ anchorRef: repeatContainerRef,
1709
+ trackingData: TRACKING_DATA3
1710
+ }
1711
+ )
1712
+ },
1713
+ /* @__PURE__ */ React19.createElement(ToggleButtonGroupUi2, { items: options, exclusive: true, onChange: () => {
1714
+ }, value: "" })
1715
+ );
1716
+ }
1717
+
1718
+ // src/components/controls/replay.tsx
1719
+ import * as React20 from "react";
1720
+ import { useRef as useRef5 } from "react";
1721
+ import { ToggleButtonGroupUi as ToggleButtonGroupUi3 } from "@elementor/editor-controls";
1722
+ import { CheckIcon, MinusIcon } from "@elementor/icons";
1723
+ import { __ as __14 } from "@wordpress/i18n";
1724
+ var TRACKING_DATA4 = { target_name: "interactions_replay", location_l2: "interactions" };
1670
1725
  var REPLAY_OPTIONS = {
1671
- no: __13("No", "elementor"),
1672
- yes: __13("Yes", "elementor")
1726
+ no: __14("No", "elementor"),
1727
+ yes: __14("Yes", "elementor")
1673
1728
  };
1674
1729
  var BASE_REPLAY = ["no"];
1675
- var OVERLAY_GRID = "1 / 1";
1676
- var CHIP_OFFSET = "50%";
1677
- function Replay({ onChange, anchorRef }) {
1730
+ function Replay({ onChange }) {
1731
+ const replayContainerRef = useRef5(null);
1678
1732
  const options = [
1679
1733
  {
1680
1734
  value: false,
1681
1735
  disabled: false,
1682
1736
  label: REPLAY_OPTIONS.no,
1683
- renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(MinusIcon, { fontSize: size }),
1737
+ renderContent: ({ size }) => /* @__PURE__ */ React20.createElement(MinusIcon, { fontSize: size }),
1684
1738
  showTooltip: true
1685
1739
  },
1686
1740
  {
1687
1741
  value: true,
1688
1742
  disabled: true,
1689
1743
  label: REPLAY_OPTIONS.yes,
1690
- renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(CheckIcon, { fontSize: size }),
1744
+ renderContent: ({ size }) => /* @__PURE__ */ React20.createElement(CheckIcon, { fontSize: size }),
1691
1745
  showTooltip: true
1692
1746
  }
1693
1747
  ];
1694
- return /* @__PURE__ */ React18.createElement(Box4, { sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(Box4, { sx: { gridArea: OVERLAY_GRID } }, /* @__PURE__ */ React18.createElement(ToggleButtonGroupUi2, { items: options, exclusive: true, onChange, value: false })), /* @__PURE__ */ React18.createElement(Box4, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, /* @__PURE__ */ React18.createElement(
1695
- InteractionsPromotionChip,
1748
+ return /* @__PURE__ */ React20.createElement(
1749
+ PromotionOverlayLayout,
1696
1750
  {
1697
- content: __13("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1698
- upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1699
- anchorRef,
1700
- trackingData: TRACKING_DATA3
1701
- }
1702
- )));
1751
+ ref: replayContainerRef,
1752
+ promotionChip: /* @__PURE__ */ React20.createElement(
1753
+ InteractionsPromotionChip,
1754
+ {
1755
+ content: __14("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1756
+ upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1757
+ anchorRef: replayContainerRef,
1758
+ trackingData: TRACKING_DATA4
1759
+ }
1760
+ )
1761
+ },
1762
+ /* @__PURE__ */ React20.createElement(ToggleButtonGroupUi3, { items: options, exclusive: true, onChange, value: false })
1763
+ );
1703
1764
  }
1704
1765
 
1705
1766
  // src/components/controls/trigger.tsx
1706
- import * as React19 from "react";
1707
- import { __ as __14 } from "@wordpress/i18n";
1708
- var TRACKING_DATA4 = { target_name: "interactions_trigger", location_l2: "interactions" };
1767
+ import * as React21 from "react";
1768
+ import { __ as __15 } from "@wordpress/i18n";
1769
+ var TRACKING_DATA5 = { target_name: "interactions_trigger", location_l2: "interactions" };
1709
1770
  var TRIGGER_OPTIONS = {
1710
- load: __14("Page load", "elementor"),
1711
- scrollIn: __14("Scroll into view", "elementor"),
1712
- scrollOn: __14("While scrolling", "elementor"),
1713
- hover: __14("On hover", "elementor"),
1714
- click: __14("On click", "elementor")
1771
+ load: __15("Page load", "elementor"),
1772
+ scrollIn: __15("Scroll into view", "elementor"),
1773
+ scrollOn: __15("While scrolling", "elementor"),
1774
+ hover: __15("On hover", "elementor"),
1775
+ click: __15("On click", "elementor")
1715
1776
  };
1716
1777
  var BASE_TRIGGERS = ["load", "scrollIn"];
1717
1778
  function Trigger({ value, onChange }) {
@@ -1721,17 +1782,17 @@ function Trigger({ value, onChange }) {
1721
1782
  const disabledOptions = Object.fromEntries(
1722
1783
  Object.entries(TRIGGER_OPTIONS).filter(([key]) => !BASE_TRIGGERS.includes(key))
1723
1784
  );
1724
- return /* @__PURE__ */ React19.createElement(
1785
+ return /* @__PURE__ */ React21.createElement(
1725
1786
  PromotionSelect,
1726
1787
  {
1727
1788
  value: value in baseOptions ? value : DEFAULT_VALUES.trigger,
1728
1789
  onChange,
1729
1790
  baseOptions,
1730
1791
  disabledOptions,
1731
- promotionLabel: __14("PRO triggers", "elementor"),
1732
- promotionContent: __14("Upgrade to unlock more interactions triggers.", "elementor"),
1792
+ promotionLabel: __15("PRO triggers", "elementor"),
1793
+ promotionContent: __15("Upgrade to unlock more interactions triggers.", "elementor"),
1733
1794
  upgradeUrl: "https://go.elementor.com/go-pro-interactions-triggers-modal/",
1734
- trackingData: TRACKING_DATA4
1795
+ trackingData: TRACKING_DATA5
1735
1796
  }
1736
1797
  );
1737
1798
  }
@@ -2111,6 +2172,10 @@ function init() {
2111
2172
  component: Effect,
2112
2173
  options: ["fade", "slide", "scale"]
2113
2174
  });
2175
+ registerInteractionsControl({
2176
+ type: "repeat",
2177
+ component: Repeat
2178
+ });
2114
2179
  initMcpInteractions();
2115
2180
  } catch (error) {
2116
2181
  throw error;
@@ -2126,6 +2191,8 @@ export {
2126
2191
  ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX,
2127
2192
  EmptyState,
2128
2193
  InteractionsTab,
2194
+ REPEAT_OPTIONS,
2195
+ REPEAT_TOOLTIPS,
2129
2196
  REPLAY_OPTIONS,
2130
2197
  TRIGGER_OPTIONS,
2131
2198
  buildDisplayLabel,