@elementor/editor-interactions 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
@@ -561,7 +561,7 @@ var PopupStateProvider = ({ children }) => {
561
561
 
562
562
  // src/components/interactions-list.tsx
563
563
  import * as React10 from "react";
564
- import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2 } from "react";
564
+ import { useCallback as useCallback5, useEffect as useEffect2, useMemo as useMemo4, useRef } from "react";
565
565
  import { Repeater } from "@elementor/editor-controls";
566
566
  import { InfoCircleFilledIcon, PlayerPlayIcon } from "@elementor/icons";
567
567
  import { Alert, AlertTitle, Box, IconButton, Tooltip } from "@elementor/ui";
@@ -664,45 +664,23 @@ var resolveDirection = (hasDirection, newEffect, newDirection, currentDirection,
664
664
 
665
665
  // src/components/controls/time-frame-indicator.tsx
666
666
  import * as React5 from "react";
667
- import { useCallback as useCallback2, useRef } from "react";
667
+ import { useCallback as useCallback2 } from "react";
668
668
  import { SizeComponent } from "@elementor/editor-controls";
669
-
670
- // src/utils/time-conversion.ts
671
- var UNIT_TO_MS = {
672
- ms: 1,
673
- s: 1e3
674
- };
675
- var convertTimeUnit = (value, from, to) => {
676
- return value * UNIT_TO_MS[from] / UNIT_TO_MS[to];
677
- };
678
-
679
- // src/components/controls/time-frame-indicator.tsx
680
669
  function TimeFrameIndicator({
681
670
  value,
682
671
  onChange,
683
672
  defaultValue
684
673
  }) {
685
674
  const sizeValue = parseSizeValue(value, TIME_UNITS, defaultValue, DEFAULT_TIME_UNIT);
686
- const prevUnitRef = useRef(sizeValue.unit);
687
- const setValue = useCallback2(
675
+ const handleChange = useCallback2(
688
676
  (size) => {
689
- const unitChanged = prevUnitRef.current !== size.unit;
690
- if (unitChanged) {
691
- const fromUnit = prevUnitRef.current;
692
- const toUnit = size.unit;
693
- size.size = convertTimeUnit(Number(size.size), fromUnit, toUnit);
694
- prevUnitRef.current = toUnit;
695
- }
696
677
  onChange(formatSizeValue(size));
697
678
  },
698
679
  [onChange]
699
680
  );
700
- const handleChange = (newValue) => {
701
- setValue(newValue);
702
- };
703
- const handleBlur = () => {
704
- if (!sizeValue.size) {
705
- setValue(parseSizeValue(defaultValue, TIME_UNITS, void 0, DEFAULT_TIME_UNIT));
681
+ const handleBlur = (event) => {
682
+ if (!event.target.value) {
683
+ handleChange(parseSizeValue(defaultValue, TIME_UNITS, void 0, DEFAULT_TIME_UNIT));
706
684
  }
707
685
  };
708
686
  return /* @__PURE__ */ React5.createElement(
@@ -1068,8 +1046,8 @@ var MAX_NUMBER_OF_INTERACTIONS = 5;
1068
1046
  function InteractionsList(props) {
1069
1047
  const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props;
1070
1048
  const { elementId } = useInteractionsContext();
1071
- const hasInitializedRef = useRef2(false);
1072
- const newlyCreatedIdsRef = useRef2(/* @__PURE__ */ new Set());
1049
+ const hasInitializedRef = useRef(false);
1050
+ const newlyCreatedIdsRef = useRef(/* @__PURE__ */ new Set());
1073
1051
  const handleUpdateInteractions = useCallback5(
1074
1052
  (newInteractions) => {
1075
1053
  onSelectInteractions(newInteractions);
@@ -1529,7 +1507,7 @@ import { __ as __11 } from "@wordpress/i18n";
1529
1507
 
1530
1508
  // src/ui/promotion-select.tsx
1531
1509
  import * as React14 from "react";
1532
- import { useRef as useRef3 } from "react";
1510
+ import { useRef as useRef2 } from "react";
1533
1511
  import { MenuListItem } from "@elementor/editor-ui";
1534
1512
  import { MenuSubheader, Select } from "@elementor/ui";
1535
1513
  import { __ as __10 } from "@wordpress/i18n";
@@ -1598,8 +1576,8 @@ function PromotionSelect({
1598
1576
  upgradeUrl,
1599
1577
  trackingData
1600
1578
  }) {
1601
- const promotionRef = useRef3(null);
1602
- const anchorRef = useRef3(null);
1579
+ const promotionRef = useRef2(null);
1580
+ const anchorRef = useRef2(null);
1603
1581
  return /* @__PURE__ */ React14.createElement(
1604
1582
  Select,
1605
1583
  {
@@ -1735,7 +1713,7 @@ function EffectType({ value, onChange }) {
1735
1713
 
1736
1714
  // src/components/controls/repeat.tsx
1737
1715
  import * as React19 from "react";
1738
- import { useRef as useRef4 } from "react";
1716
+ import { useRef as useRef3 } from "react";
1739
1717
  import { ToggleButtonGroupUi as ToggleButtonGroupUi2 } from "@elementor/editor-controls";
1740
1718
  import { Number123Icon, RepeatIcon } from "@elementor/icons";
1741
1719
  import { __ as __14 } from "@wordpress/i18n";
@@ -1761,7 +1739,7 @@ var REPEAT_TOOLTIPS = {
1761
1739
  loop: __14("Infinite repeat", "elementor")
1762
1740
  };
1763
1741
  function Repeat() {
1764
- const repeatContainerRef = useRef4(null);
1742
+ const repeatContainerRef = useRef3(null);
1765
1743
  const options = [
1766
1744
  {
1767
1745
  value: REPEAT_OPTIONS.times,
@@ -1799,7 +1777,7 @@ function Repeat() {
1799
1777
 
1800
1778
  // src/components/controls/replay.tsx
1801
1779
  import * as React20 from "react";
1802
- import { useRef as useRef5 } from "react";
1780
+ import { useRef as useRef4 } from "react";
1803
1781
  import { ToggleButtonGroupUi as ToggleButtonGroupUi3 } from "@elementor/editor-controls";
1804
1782
  import { CheckIcon, MinusIcon } from "@elementor/icons";
1805
1783
  import { __ as __15 } from "@wordpress/i18n";
@@ -1810,7 +1788,7 @@ var REPLAY_OPTIONS = {
1810
1788
  };
1811
1789
  var BASE_REPLAY = ["no"];
1812
1790
  function Replay({ onChange }) {
1813
- const replayContainerRef = useRef5(null);
1791
+ const replayContainerRef = useRef4(null);
1814
1792
  const options = [
1815
1793
  {
1816
1794
  value: false,
@@ -2282,7 +2260,6 @@ export {
2282
2260
  SCROLL_INTERACTION_EVENT,
2283
2261
  TRIGGER_OPTIONS,
2284
2262
  buildDisplayLabel,
2285
- convertTimeUnit,
2286
2263
  createAnimationPreset,
2287
2264
  createBoolean,
2288
2265
  createConfig,