@elementor/editor-interactions 4.0.0-564 → 4.0.0-573

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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { ComponentType } from 'react';
2
+ import { RefObject, ComponentType } from 'react';
3
3
  import { Unit } from '@elementor/editor-controls';
4
4
  import { ElementInteractions, InteractionItemPropValue } from '@elementor/editor-elements';
5
5
  export { AnimationPresetPropValue, BooleanPropValue, ConfigPropValue, ElementInteractions, ExcludedBreakpointsPropValue, InteractionBreakpointsPropValue, InteractionItemPropValue, NumberPropValue, StringPropValue, TimingConfigPropValue } from '@elementor/editor-elements';
@@ -36,6 +36,7 @@ type ReplayFieldProps = {
36
36
  value: boolean;
37
37
  onChange: (value: boolean) => void;
38
38
  disabled?: boolean;
39
+ anchorRef?: RefObject<HTMLElement | null>;
39
40
  };
40
41
  type DirectionFieldProps = FieldProps & {
41
42
  interactionType: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { ComponentType } from 'react';
2
+ import { RefObject, ComponentType } from 'react';
3
3
  import { Unit } from '@elementor/editor-controls';
4
4
  import { ElementInteractions, InteractionItemPropValue } from '@elementor/editor-elements';
5
5
  export { AnimationPresetPropValue, BooleanPropValue, ConfigPropValue, ElementInteractions, ExcludedBreakpointsPropValue, InteractionBreakpointsPropValue, InteractionItemPropValue, NumberPropValue, StringPropValue, TimingConfigPropValue } from '@elementor/editor-elements';
@@ -36,6 +36,7 @@ type ReplayFieldProps = {
36
36
  value: boolean;
37
37
  onChange: (value: boolean) => void;
38
38
  disabled?: boolean;
39
+ anchorRef?: RefObject<HTMLElement | null>;
39
40
  };
40
41
  type DirectionFieldProps = FieldProps & {
41
42
  interactionType: string;
package/dist/index.js CHANGED
@@ -620,6 +620,7 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
620
620
  controlVisibilityConfig.offsetBottom(interactionValues)
621
621
  );
622
622
  const EasingControl = useControlComponent("easing");
623
+ const containerRef = (0, import_react6.useRef)(null);
623
624
  const updateInteraction = (updates) => {
624
625
  const resolvedDirectionValue = resolveDirection(
625
626
  "direction" in updates,
@@ -651,12 +652,19 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
651
652
  onPlayInteraction(interactionId);
652
653
  }, 0);
653
654
  };
654
- return /* @__PURE__ */ React9.createElement(import_editor_controls5.PopoverContent, { p: 1.5 }, /* @__PURE__ */ React9.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n4.__)("Trigger", "elementor") }, /* @__PURE__ */ React9.createElement(TriggerControl, { value: trigger, onChange: (v) => updateInteraction({ trigger: v }) })), ReplayControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n4.__)("Replay", "elementor") }, /* @__PURE__ */ React9.createElement(
655
+ return /* @__PURE__ */ React9.createElement(import_ui3.Box, { ref: containerRef }, /* @__PURE__ */ React9.createElement(import_editor_controls5.PopoverContent, { p: 1.5 }, /* @__PURE__ */ React9.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n4.__)("Trigger", "elementor") }, /* @__PURE__ */ React9.createElement(
656
+ TriggerControl,
657
+ {
658
+ value: trigger,
659
+ onChange: (v) => updateInteraction({ trigger: v })
660
+ }
661
+ )), ReplayControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n4.__)("Replay", "elementor") }, /* @__PURE__ */ React9.createElement(
655
662
  ReplayControl,
656
663
  {
657
664
  value: replay,
658
665
  onChange: (v) => updateInteraction({ replay: v }),
659
- disabled: true
666
+ disabled: true,
667
+ anchorRef: containerRef
660
668
  }
661
669
  ))), /* @__PURE__ */ React9.createElement(import_ui3.Divider, null), /* @__PURE__ */ React9.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, EffectControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n4.__)("Effect", "elementor") }, /* @__PURE__ */ React9.createElement(EffectControl, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n4.__)("Type", "elementor") }, /* @__PURE__ */ React9.createElement(EffectType, { value: type, onChange: (v) => updateInteraction({ type: v }) })), /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n4.__)("Direction", "elementor") }, /* @__PURE__ */ React9.createElement(
662
670
  Direction,
@@ -705,7 +713,7 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
705
713
  updateInteraction({ easing: v });
706
714
  }
707
715
  }
708
- ))));
716
+ )))));
709
717
  };
710
718
 
711
719
  // src/components/interaction-settings.tsx
@@ -1162,44 +1170,87 @@ function Effect({ value, onChange }) {
1162
1170
  }
1163
1171
 
1164
1172
  // src/components/controls/replay.tsx
1165
- var React16 = __toESM(require("react"));
1173
+ var React17 = __toESM(require("react"));
1166
1174
  var import_editor_controls8 = require("@elementor/editor-controls");
1167
1175
  var import_icons4 = require("@elementor/icons");
1176
+ var import_ui11 = require("@elementor/ui");
1177
+ var import_i18n11 = require("@wordpress/i18n");
1178
+
1179
+ // src/ui/interactions-promotion-chip.tsx
1180
+ var React16 = __toESM(require("react"));
1181
+ var import_react11 = require("react");
1182
+ var import_editor_ui3 = require("@elementor/editor-ui");
1183
+ var import_ui10 = require("@elementor/ui");
1168
1184
  var import_i18n10 = require("@wordpress/i18n");
1169
- function Replay({ onChange }) {
1185
+ function InteractionsPromotionChip({ content, upgradeUrl, anchorRef }) {
1186
+ const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
1187
+ (0, import_editor_ui3.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
1188
+ const handleToggle = (e) => {
1189
+ e.stopPropagation();
1190
+ setIsOpen((prev) => !prev);
1191
+ };
1192
+ return /* @__PURE__ */ React16.createElement(
1193
+ import_editor_ui3.PromotionPopover,
1194
+ {
1195
+ open: isOpen,
1196
+ title: (0, import_i18n10.__)("Interactions", "elementor"),
1197
+ content,
1198
+ ctaText: (0, import_i18n10.__)("Upgrade now", "elementor"),
1199
+ ctaUrl: upgradeUrl,
1200
+ anchorRef,
1201
+ placement: anchorRef ? "right-start" : void 0,
1202
+ onClose: handleToggle
1203
+ },
1204
+ /* @__PURE__ */ React16.createElement(import_ui10.Box, { onClick: handleToggle, sx: { cursor: "pointer", display: "inline-flex", mr: 1 } }, /* @__PURE__ */ React16.createElement(import_editor_ui3.PromotionChip, null))
1205
+ );
1206
+ }
1207
+
1208
+ // src/components/controls/replay.tsx
1209
+ var OVERLAY_GRID = "1 / 1";
1210
+ var CHIP_OFFSET = "50%";
1211
+ function Replay({ onChange, anchorRef }) {
1170
1212
  const options = [
1171
1213
  {
1172
1214
  value: false,
1173
1215
  disabled: false,
1174
- label: (0, import_i18n10.__)("No", "elementor"),
1175
- renderContent: ({ size }) => /* @__PURE__ */ React16.createElement(import_icons4.MinusIcon, { fontSize: size })
1216
+ label: (0, import_i18n11.__)("No", "elementor"),
1217
+ renderContent: ({ size }) => /* @__PURE__ */ React17.createElement(import_icons4.MinusIcon, { fontSize: size }),
1218
+ showTooltip: true
1176
1219
  },
1177
1220
  {
1178
1221
  value: true,
1179
1222
  disabled: true,
1180
- label: (0, import_i18n10.__)("Yes", "elementor"),
1181
- renderContent: ({ size }) => /* @__PURE__ */ React16.createElement(import_icons4.CheckIcon, { fontSize: size })
1223
+ label: (0, import_i18n11.__)("Yes", "elementor"),
1224
+ renderContent: ({ size }) => /* @__PURE__ */ React17.createElement(import_icons4.CheckIcon, { fontSize: size }),
1225
+ showTooltip: true
1182
1226
  }
1183
1227
  ];
1184
- return /* @__PURE__ */ React16.createElement(import_editor_controls8.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value: false });
1228
+ return /* @__PURE__ */ React17.createElement(import_ui11.Box, { sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React17.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID } }, /* @__PURE__ */ React17.createElement(import_editor_controls8.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value: false })), /* @__PURE__ */ React17.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, /* @__PURE__ */ React17.createElement(
1229
+ InteractionsPromotionChip,
1230
+ {
1231
+ content: (0, import_i18n11.__)("Upgrade to run the animation every time its trigger occurs.", "elementor"),
1232
+ upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/",
1233
+ anchorRef
1234
+ }
1235
+ )));
1185
1236
  }
1186
1237
 
1187
1238
  // src/components/controls/trigger.tsx
1188
- var React17 = __toESM(require("react"));
1189
- var import_editor_ui3 = require("@elementor/editor-ui");
1190
- var import_ui10 = require("@elementor/ui");
1191
- var import_i18n11 = require("@wordpress/i18n");
1239
+ var React18 = __toESM(require("react"));
1240
+ var import_editor_ui4 = require("@elementor/editor-ui");
1241
+ var import_ui12 = require("@elementor/ui");
1242
+ var import_i18n12 = require("@wordpress/i18n");
1192
1243
  function Trigger({ value, onChange }) {
1193
1244
  const availableTriggers = Object.entries({
1194
- load: (0, import_i18n11.__)("Page load", "elementor"),
1195
- scrollIn: (0, import_i18n11.__)("Scroll into view", "elementor"),
1196
- scrollOn: (0, import_i18n11.__)("While Scrolling", "elementor")
1245
+ load: (0, import_i18n12.__)("Page load", "elementor"),
1246
+ scrollIn: (0, import_i18n12.__)("Scroll into view", "elementor"),
1247
+ scrollOn: (0, import_i18n12.__)("While Scrolling", "elementor")
1197
1248
  }).map(([key, label]) => ({
1198
1249
  key,
1199
1250
  label
1200
1251
  }));
1201
- return /* @__PURE__ */ React17.createElement(
1202
- import_ui10.Select,
1252
+ return /* @__PURE__ */ React18.createElement(
1253
+ import_ui12.Select,
1203
1254
  {
1204
1255
  fullWidth: true,
1205
1256
  displayEmpty: true,
@@ -1208,7 +1259,7 @@ function Trigger({ value, onChange }) {
1208
1259
  value
1209
1260
  },
1210
1261
  availableTriggers.map((trigger) => {
1211
- return /* @__PURE__ */ React17.createElement(import_editor_ui3.MenuListItem, { key: trigger.key, value: trigger.key }, trigger.label);
1262
+ return /* @__PURE__ */ React18.createElement(import_editor_ui4.MenuListItem, { key: trigger.key, value: trigger.key }, trigger.label);
1212
1263
  })
1213
1264
  );
1214
1265
  }