@elementor/editor-interactions 4.0.0-573 → 4.0.0-591
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 +37 -16
- package/dist/index.d.ts +37 -16
- package/dist/index.js +352 -213
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +321 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/components/controls/easing.tsx +19 -18
- package/src/components/controls/effect.tsx +3 -1
- package/src/components/controls/replay.tsx +9 -2
- package/src/components/controls/trigger.tsx +28 -25
- package/src/components/field.tsx +1 -1
- package/src/components/interaction-details.tsx +48 -19
- package/src/index.ts +4 -2
- package/src/init.ts +15 -0
- package/src/interactions-controls-registry.ts +4 -1
- package/src/types.ts +6 -9
- package/src/ui/interactions-promotion-chip.tsx +47 -28
- package/src/ui/promotion-select.tsx +75 -0
- package/src/utils/prop-value-utils.ts +7 -1
package/dist/index.js
CHANGED
|
@@ -30,9 +30,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
BASE_EASINGS: () => BASE_EASINGS,
|
|
34
|
+
BASE_REPLAY: () => BASE_REPLAY,
|
|
35
|
+
BASE_TRIGGERS: () => BASE_TRIGGERS,
|
|
36
|
+
EASING_OPTIONS: () => EASING_OPTIONS,
|
|
33
37
|
ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX: () => ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX,
|
|
34
38
|
EmptyState: () => EmptyState,
|
|
35
39
|
InteractionsTab: () => InteractionsTab,
|
|
40
|
+
REPLAY_OPTIONS: () => REPLAY_OPTIONS,
|
|
41
|
+
TRIGGER_OPTIONS: () => TRIGGER_OPTIONS,
|
|
36
42
|
createInteractionsProvider: () => createInteractionsProvider,
|
|
37
43
|
getInteractionsConfig: () => getInteractionsConfig,
|
|
38
44
|
init: () => init,
|
|
@@ -68,8 +74,8 @@ var EmptyState = ({ onCreateInteraction }) => {
|
|
|
68
74
|
};
|
|
69
75
|
|
|
70
76
|
// src/components/interactions-tab.tsx
|
|
71
|
-
var
|
|
72
|
-
var
|
|
77
|
+
var React11 = __toESM(require("react"));
|
|
78
|
+
var import_react9 = require("react");
|
|
73
79
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
74
80
|
var import_session = require("@elementor/session");
|
|
75
81
|
var import_ui7 = require("@elementor/ui");
|
|
@@ -130,12 +136,12 @@ var PopupStateProvider = ({ children }) => {
|
|
|
130
136
|
};
|
|
131
137
|
|
|
132
138
|
// src/components/interactions-list.tsx
|
|
133
|
-
var
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
var
|
|
139
|
+
var React10 = __toESM(require("react"));
|
|
140
|
+
var import_react8 = require("react");
|
|
141
|
+
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
142
|
+
var import_icons2 = require("@elementor/icons");
|
|
137
143
|
var import_ui6 = require("@elementor/ui");
|
|
138
|
-
var
|
|
144
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
139
145
|
|
|
140
146
|
// src/contexts/interactions-item-context.tsx
|
|
141
147
|
var React4 = __toESM(require("react"));
|
|
@@ -281,11 +287,13 @@ var createAnimationPreset = ({
|
|
|
281
287
|
easing = "easeIn",
|
|
282
288
|
relativeTo,
|
|
283
289
|
offsetTop,
|
|
284
|
-
offsetBottom
|
|
290
|
+
offsetBottom,
|
|
291
|
+
customEffects
|
|
285
292
|
}) => ({
|
|
286
293
|
$$type: "animation-preset-props",
|
|
287
294
|
value: {
|
|
288
295
|
effect: createString(effect),
|
|
296
|
+
custom_effect: customEffects,
|
|
289
297
|
type: createString(type),
|
|
290
298
|
direction: createString(direction ?? ""),
|
|
291
299
|
timing_config: createTimingConfig(duration, delay),
|
|
@@ -311,7 +319,8 @@ var createInteractionItem = ({
|
|
|
311
319
|
relativeTo,
|
|
312
320
|
offsetTop,
|
|
313
321
|
offsetBottom,
|
|
314
|
-
excludedBreakpoints
|
|
322
|
+
excludedBreakpoints,
|
|
323
|
+
customEffects
|
|
315
324
|
}) => ({
|
|
316
325
|
$$type: "interaction-item",
|
|
317
326
|
value: {
|
|
@@ -327,7 +336,8 @@ var createInteractionItem = ({
|
|
|
327
336
|
easing,
|
|
328
337
|
relativeTo,
|
|
329
338
|
offsetTop,
|
|
330
|
-
offsetBottom
|
|
339
|
+
offsetBottom,
|
|
340
|
+
customEffects
|
|
331
341
|
}),
|
|
332
342
|
...excludedBreakpoints && excludedBreakpoints.length > 0 && {
|
|
333
343
|
breakpoints: createInteractionBreakpoints(excludedBreakpoints)
|
|
@@ -375,17 +385,17 @@ var buildDisplayLabel = (item) => {
|
|
|
375
385
|
};
|
|
376
386
|
|
|
377
387
|
// src/components/interactions-list-item.tsx
|
|
378
|
-
var
|
|
379
|
-
var
|
|
388
|
+
var React9 = __toESM(require("react"));
|
|
389
|
+
var import_react7 = require("react");
|
|
380
390
|
var import_ui5 = require("@elementor/ui");
|
|
381
|
-
var
|
|
391
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
382
392
|
|
|
383
393
|
// src/components/interaction-details.tsx
|
|
384
|
-
var
|
|
385
|
-
var
|
|
386
|
-
var
|
|
394
|
+
var React7 = __toESM(require("react"));
|
|
395
|
+
var import_react5 = require("react");
|
|
396
|
+
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
387
397
|
var import_ui3 = require("@elementor/ui");
|
|
388
|
-
var
|
|
398
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
389
399
|
|
|
390
400
|
// src/interactions-controls-registry.ts
|
|
391
401
|
var controlsRegistry = /* @__PURE__ */ new Map();
|
|
@@ -414,71 +424,10 @@ var resolveDirection = (hasDirection, newEffect, newDirection, currentDirection,
|
|
|
414
424
|
return currentDirection;
|
|
415
425
|
};
|
|
416
426
|
|
|
417
|
-
// src/components/controls/
|
|
427
|
+
// src/components/controls/time-frame-indicator.tsx
|
|
418
428
|
var React5 = __toESM(require("react"));
|
|
419
429
|
var import_react4 = require("react");
|
|
420
430
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
421
|
-
var import_icons2 = require("@elementor/icons");
|
|
422
|
-
var import_i18n2 = require("@wordpress/i18n");
|
|
423
|
-
function Direction({ value, onChange, interactionType }) {
|
|
424
|
-
const options = (0, import_react4.useMemo)(() => {
|
|
425
|
-
const isIn = interactionType === "in";
|
|
426
|
-
return [
|
|
427
|
-
{
|
|
428
|
-
value: "top",
|
|
429
|
-
label: isIn ? (0, import_i18n2.__)("From top", "elementor") : (0, import_i18n2.__)("To top", "elementor"),
|
|
430
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowDownSmallIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowUpSmallIcon, { fontSize: size }),
|
|
431
|
-
showTooltip: true
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
value: "bottom",
|
|
435
|
-
label: interactionType === "in" ? (0, import_i18n2.__)("From bottom", "elementor") : (0, import_i18n2.__)("To bottom", "elementor"),
|
|
436
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowUpSmallIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowDownSmallIcon, { fontSize: size }),
|
|
437
|
-
showTooltip: true
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
value: "left",
|
|
441
|
-
label: interactionType === "in" ? (0, import_i18n2.__)("From left", "elementor") : (0, import_i18n2.__)("To left", "elementor"),
|
|
442
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowRightIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowLeftIcon, { fontSize: size }),
|
|
443
|
-
showTooltip: true
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
value: "right",
|
|
447
|
-
label: interactionType === "in" ? (0, import_i18n2.__)("From right", "elementor") : (0, import_i18n2.__)("To right", "elementor"),
|
|
448
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowLeftIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowRightIcon, { fontSize: size }),
|
|
449
|
-
showTooltip: true
|
|
450
|
-
}
|
|
451
|
-
];
|
|
452
|
-
}, [interactionType]);
|
|
453
|
-
return /* @__PURE__ */ React5.createElement(import_editor_controls.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// src/components/controls/effect-type.tsx
|
|
457
|
-
var React6 = __toESM(require("react"));
|
|
458
|
-
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
459
|
-
var import_i18n3 = require("@wordpress/i18n");
|
|
460
|
-
function EffectType({ value, onChange }) {
|
|
461
|
-
const options = [
|
|
462
|
-
{
|
|
463
|
-
value: "in",
|
|
464
|
-
label: (0, import_i18n3.__)("In", "elementor"),
|
|
465
|
-
renderContent: () => (0, import_i18n3.__)("In", "elementor"),
|
|
466
|
-
showTooltip: true
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
value: "out",
|
|
470
|
-
label: (0, import_i18n3.__)("Out", "elementor"),
|
|
471
|
-
renderContent: () => (0, import_i18n3.__)("Out", "elementor"),
|
|
472
|
-
showTooltip: true
|
|
473
|
-
}
|
|
474
|
-
];
|
|
475
|
-
return /* @__PURE__ */ React6.createElement(import_editor_controls2.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// src/components/controls/time-frame-indicator.tsx
|
|
479
|
-
var React7 = __toESM(require("react"));
|
|
480
|
-
var import_react5 = require("react");
|
|
481
|
-
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
482
431
|
|
|
483
432
|
// src/utils/time-conversion.ts
|
|
484
433
|
var UNIT_TO_MS = {
|
|
@@ -496,8 +445,8 @@ function TimeFrameIndicator({
|
|
|
496
445
|
defaultValue
|
|
497
446
|
}) {
|
|
498
447
|
const sizeValue = parseSizeValue(value, TIME_UNITS, defaultValue, DEFAULT_TIME_UNIT);
|
|
499
|
-
const prevUnitRef = (0,
|
|
500
|
-
const setValue = (0,
|
|
448
|
+
const prevUnitRef = (0, import_react4.useRef)(sizeValue.unit);
|
|
449
|
+
const setValue = (0, import_react4.useCallback)(
|
|
501
450
|
(size) => {
|
|
502
451
|
const unitChanged = prevUnitRef.current !== size.unit;
|
|
503
452
|
if (unitChanged) {
|
|
@@ -518,8 +467,8 @@ function TimeFrameIndicator({
|
|
|
518
467
|
setValue(parseSizeValue(defaultValue, TIME_UNITS, void 0, DEFAULT_TIME_UNIT));
|
|
519
468
|
}
|
|
520
469
|
};
|
|
521
|
-
return /* @__PURE__ */
|
|
522
|
-
|
|
470
|
+
return /* @__PURE__ */ React5.createElement(
|
|
471
|
+
import_editor_controls.UnstableSizeField,
|
|
523
472
|
{
|
|
524
473
|
units: TIME_UNITS,
|
|
525
474
|
value: sizeValue,
|
|
@@ -535,11 +484,11 @@ function TimeFrameIndicator({
|
|
|
535
484
|
}
|
|
536
485
|
|
|
537
486
|
// src/components/field.tsx
|
|
538
|
-
var
|
|
539
|
-
var
|
|
487
|
+
var React6 = __toESM(require("react"));
|
|
488
|
+
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
540
489
|
var import_ui2 = require("@elementor/ui");
|
|
541
490
|
var Field = ({ label, children }) => {
|
|
542
|
-
return /* @__PURE__ */
|
|
491
|
+
return /* @__PURE__ */ React6.createElement(import_ui2.Grid, { item: true, xs: 12, "aria-label": `${label} control` }, /* @__PURE__ */ React6.createElement(import_editor_controls2.PopoverGridContainer, null, /* @__PURE__ */ React6.createElement(import_ui2.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React6.createElement(import_editor_controls2.ControlFormLabel, null, label)), /* @__PURE__ */ React6.createElement(import_ui2.Grid, { item: true, xs: 6 }, children)));
|
|
543
492
|
};
|
|
544
493
|
|
|
545
494
|
// src/components/interaction-details.tsx
|
|
@@ -559,6 +508,9 @@ var DEFAULT_VALUES = {
|
|
|
559
508
|
var TRIGGERS_WITHOUT_REPLAY = ["load", "scrollOn", "hover", "click"];
|
|
560
509
|
var controlVisibilityConfig = {
|
|
561
510
|
replay: (values) => !TRIGGERS_WITHOUT_REPLAY.includes(values.trigger),
|
|
511
|
+
custom: (values) => values.effect === "custom",
|
|
512
|
+
effectType: (values) => values.effect !== "custom",
|
|
513
|
+
direction: (values) => values.effect !== "custom",
|
|
562
514
|
relativeTo: (values) => values.trigger === "scrollOn",
|
|
563
515
|
offsetTop: (values) => values.trigger === "scrollOn",
|
|
564
516
|
offsetBottom: (values) => values.trigger === "scrollOn",
|
|
@@ -572,7 +524,7 @@ var controlVisibilityConfig = {
|
|
|
572
524
|
}
|
|
573
525
|
};
|
|
574
526
|
function useControlComponent(controlName, isVisible = true) {
|
|
575
|
-
return (0,
|
|
527
|
+
return (0, import_react5.useMemo)(() => {
|
|
576
528
|
if (!isVisible) {
|
|
577
529
|
return null;
|
|
578
530
|
}
|
|
@@ -582,6 +534,7 @@ function useControlComponent(controlName, isVisible = true) {
|
|
|
582
534
|
var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
583
535
|
const trigger = extractString(interaction.trigger, DEFAULT_VALUES.trigger);
|
|
584
536
|
const effect = extractString(interaction.animation.value.effect, DEFAULT_VALUES.effect);
|
|
537
|
+
const customEffects = interaction.animation.value.custom_effect;
|
|
585
538
|
const type = extractString(interaction.animation.value.type, DEFAULT_VALUES.type);
|
|
586
539
|
const direction = extractString(interaction.animation.value.direction, DEFAULT_VALUES.direction);
|
|
587
540
|
const duration = extractSize(interaction.animation.value.timing_config.value.duration);
|
|
@@ -605,7 +558,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
605
558
|
replay,
|
|
606
559
|
relativeTo,
|
|
607
560
|
offsetTop,
|
|
608
|
-
offsetBottom
|
|
561
|
+
offsetBottom,
|
|
562
|
+
customEffects
|
|
609
563
|
};
|
|
610
564
|
const TriggerControl = useControlComponent("trigger", true);
|
|
611
565
|
const EffectControl = useControlComponent("effect");
|
|
@@ -619,8 +573,17 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
619
573
|
"offsetBottom",
|
|
620
574
|
controlVisibilityConfig.offsetBottom(interactionValues)
|
|
621
575
|
);
|
|
576
|
+
const CustomEffectControl = useControlComponent(
|
|
577
|
+
"customEffects",
|
|
578
|
+
controlVisibilityConfig.custom(interactionValues)
|
|
579
|
+
);
|
|
580
|
+
const EffectTypeControl = useControlComponent(
|
|
581
|
+
"effectType",
|
|
582
|
+
controlVisibilityConfig.effectType(interactionValues)
|
|
583
|
+
);
|
|
584
|
+
const DirectionControl = useControlComponent("direction", controlVisibilityConfig.direction(interactionValues));
|
|
622
585
|
const EasingControl = useControlComponent("easing");
|
|
623
|
-
const containerRef = (0,
|
|
586
|
+
const containerRef = (0, import_react5.useRef)(null);
|
|
624
587
|
const updateInteraction = (updates) => {
|
|
625
588
|
const resolvedDirectionValue = resolveDirection(
|
|
626
589
|
"direction" in updates,
|
|
@@ -643,7 +606,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
643
606
|
easing: updates.easing ?? easing,
|
|
644
607
|
relativeTo: updates.relativeTo ?? relativeTo,
|
|
645
608
|
offsetTop: updates.offsetTop ?? offsetTop,
|
|
646
|
-
offsetBottom: updates.offsetBottom ?? offsetBottom
|
|
609
|
+
offsetBottom: updates.offsetBottom ?? offsetBottom,
|
|
610
|
+
customEffects: updates.customEffects ?? customEffects
|
|
647
611
|
})
|
|
648
612
|
};
|
|
649
613
|
onChange(updatedInteraction);
|
|
@@ -652,13 +616,13 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
652
616
|
onPlayInteraction(interactionId);
|
|
653
617
|
}, 0);
|
|
654
618
|
};
|
|
655
|
-
return /* @__PURE__ */
|
|
619
|
+
return /* @__PURE__ */ React7.createElement(import_ui3.Box, { ref: containerRef }, /* @__PURE__ */ React7.createElement(import_editor_controls3.PopoverContent, { p: 1.5 }, /* @__PURE__ */ React7.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Trigger", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
656
620
|
TriggerControl,
|
|
657
621
|
{
|
|
658
622
|
value: trigger,
|
|
659
623
|
onChange: (v) => updateInteraction({ trigger: v })
|
|
660
624
|
}
|
|
661
|
-
)), ReplayControl && /* @__PURE__ */
|
|
625
|
+
)), ReplayControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Replay", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
662
626
|
ReplayControl,
|
|
663
627
|
{
|
|
664
628
|
value: replay,
|
|
@@ -666,46 +630,52 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
666
630
|
disabled: true,
|
|
667
631
|
anchorRef: containerRef
|
|
668
632
|
}
|
|
669
|
-
))), /* @__PURE__ */
|
|
670
|
-
|
|
633
|
+
))), /* @__PURE__ */ React7.createElement(import_ui3.Divider, null), /* @__PURE__ */ React7.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, EffectControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Effect", "elementor") }, /* @__PURE__ */ React7.createElement(EffectControl, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), CustomEffectControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Custom Effect", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
634
|
+
CustomEffectControl,
|
|
635
|
+
{
|
|
636
|
+
value: customEffects,
|
|
637
|
+
onChange: (v) => updateInteraction({ customEffects: v })
|
|
638
|
+
}
|
|
639
|
+
)), EffectTypeControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Type", "elementor") }, /* @__PURE__ */ React7.createElement(EffectTypeControl, { value: type, onChange: (v) => updateInteraction({ type: v }) })), DirectionControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Direction", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
640
|
+
DirectionControl,
|
|
671
641
|
{
|
|
672
642
|
value: direction,
|
|
673
643
|
onChange: (v) => updateInteraction({ direction: v }),
|
|
674
644
|
interactionType: type
|
|
675
645
|
}
|
|
676
|
-
)), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */
|
|
646
|
+
)), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Duration", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
677
647
|
TimeFrameIndicator,
|
|
678
648
|
{
|
|
679
649
|
value: String(duration),
|
|
680
650
|
onChange: (v) => updateInteraction({ duration: v }),
|
|
681
651
|
defaultValue: DEFAULT_VALUES.duration
|
|
682
652
|
}
|
|
683
|
-
)), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */
|
|
653
|
+
)), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Delay", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
684
654
|
TimeFrameIndicator,
|
|
685
655
|
{
|
|
686
656
|
value: String(delay),
|
|
687
657
|
onChange: (v) => updateInteraction({ delay: v }),
|
|
688
658
|
defaultValue: DEFAULT_VALUES.delay
|
|
689
659
|
}
|
|
690
|
-
))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */
|
|
660
|
+
))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui3.Divider, null), /* @__PURE__ */ React7.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Relative To", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
691
661
|
RelativeToControl,
|
|
692
662
|
{
|
|
693
663
|
value: relativeTo,
|
|
694
664
|
onChange: (v) => updateInteraction({ relativeTo: v })
|
|
695
665
|
}
|
|
696
|
-
)), OffsetTopControl && /* @__PURE__ */
|
|
666
|
+
)), OffsetTopControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Offset Top", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
697
667
|
OffsetTopControl,
|
|
698
668
|
{
|
|
699
669
|
value: String(parseSizeValue(offsetTop, ["%"]).size),
|
|
700
670
|
onChange: (v) => updateInteraction({ offsetTop: v })
|
|
701
671
|
}
|
|
702
|
-
)), OffsetBottomControl && /* @__PURE__ */
|
|
672
|
+
)), OffsetBottomControl && /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Offset Bottom", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
703
673
|
OffsetBottomControl,
|
|
704
674
|
{
|
|
705
675
|
value: String(parseSizeValue(offsetBottom, ["%"]).size),
|
|
706
676
|
onChange: (v) => updateInteraction({ offsetBottom: v })
|
|
707
677
|
}
|
|
708
|
-
))), /* @__PURE__ */
|
|
678
|
+
))), /* @__PURE__ */ React7.createElement(import_ui3.Divider, null)), EasingControl && /* @__PURE__ */ React7.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React7.createElement(Field, { label: (0, import_i18n2.__)("Easing", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
709
679
|
EasingControl,
|
|
710
680
|
{
|
|
711
681
|
value: easing,
|
|
@@ -717,20 +687,20 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
717
687
|
};
|
|
718
688
|
|
|
719
689
|
// src/components/interaction-settings.tsx
|
|
720
|
-
var
|
|
721
|
-
var
|
|
722
|
-
var
|
|
690
|
+
var React8 = __toESM(require("react"));
|
|
691
|
+
var import_react6 = require("react");
|
|
692
|
+
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
723
693
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
724
694
|
var import_ui4 = require("@elementor/ui");
|
|
725
|
-
var
|
|
695
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
726
696
|
var SIZE = "tiny";
|
|
727
697
|
var InteractionSettings = ({ interaction, onChange }) => {
|
|
728
698
|
const breakpoints = (0, import_editor_responsive.useBreakpoints)();
|
|
729
|
-
const availableBreakpoints = (0,
|
|
699
|
+
const availableBreakpoints = (0, import_react6.useMemo)(
|
|
730
700
|
() => breakpoints.map((breakpoint) => ({ label: breakpoint.label, value: String(breakpoint.id) })),
|
|
731
701
|
[breakpoints]
|
|
732
702
|
);
|
|
733
|
-
const [selectedBreakpoints, setSelectedBreakpoints] = (0,
|
|
703
|
+
const [selectedBreakpoints, setSelectedBreakpoints] = (0, import_react6.useState)(() => {
|
|
734
704
|
const excluded = extractExcludedBreakpoints(interaction.breakpoints).filter((excludedBreakpoint) => {
|
|
735
705
|
return availableBreakpoints.some(({ value }) => value === excludedBreakpoint);
|
|
736
706
|
});
|
|
@@ -738,7 +708,7 @@ var InteractionSettings = ({ interaction, onChange }) => {
|
|
|
738
708
|
return !excluded.includes(value);
|
|
739
709
|
});
|
|
740
710
|
});
|
|
741
|
-
const handleBreakpointChange = (0,
|
|
711
|
+
const handleBreakpointChange = (0, import_react6.useCallback)(
|
|
742
712
|
(_, newValue) => {
|
|
743
713
|
setSelectedBreakpoints(newValue);
|
|
744
714
|
const selectedValues = newValue.map((option) => option.value);
|
|
@@ -756,7 +726,7 @@ var InteractionSettings = ({ interaction, onChange }) => {
|
|
|
756
726
|
},
|
|
757
727
|
[interaction, availableBreakpoints, onChange]
|
|
758
728
|
);
|
|
759
|
-
return /* @__PURE__ */
|
|
729
|
+
return /* @__PURE__ */ React8.createElement(import_editor_controls4.PopoverContent, { p: 1.5 }, /* @__PURE__ */ React8.createElement(import_ui4.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React8.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React8.createElement(import_ui4.Stack, { direction: "column", gap: 1 }, /* @__PURE__ */ React8.createElement(import_editor_controls4.ControlFormLabel, { sx: { width: "100%" } }, (0, import_i18n3.__)("Trigger on", "elementor")), /* @__PURE__ */ React8.createElement(
|
|
760
730
|
import_ui4.Autocomplete,
|
|
761
731
|
{
|
|
762
732
|
fullWidth: true,
|
|
@@ -766,10 +736,10 @@ var InteractionSettings = ({ interaction, onChange }) => {
|
|
|
766
736
|
size: SIZE,
|
|
767
737
|
options: availableBreakpoints,
|
|
768
738
|
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
769
|
-
renderInput: (params) => /* @__PURE__ */
|
|
739
|
+
renderInput: (params) => /* @__PURE__ */ React8.createElement(import_ui4.TextField, { ...params }),
|
|
770
740
|
renderTags: (values, getTagProps) => values.map((option, index) => {
|
|
771
741
|
const { key, ...chipProps } = getTagProps({ index });
|
|
772
|
-
return /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ React8.createElement(import_ui4.Chip, { key, size: SIZE, label: option.label, ...chipProps });
|
|
773
743
|
})
|
|
774
744
|
}
|
|
775
745
|
)))));
|
|
@@ -782,30 +752,30 @@ var InteractionsListItem = ({
|
|
|
782
752
|
}) => {
|
|
783
753
|
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui5.useTabs)("details");
|
|
784
754
|
const context = useInteractionItemContext();
|
|
785
|
-
const handleChange = (0,
|
|
755
|
+
const handleChange = (0, import_react7.useCallback)(
|
|
786
756
|
(newInteractionValue) => {
|
|
787
757
|
context?.onInteractionChange(index, newInteractionValue);
|
|
788
758
|
},
|
|
789
759
|
[context, index]
|
|
790
760
|
);
|
|
791
|
-
const handlePlayInteraction = (0,
|
|
761
|
+
const handlePlayInteraction = (0, import_react7.useCallback)(
|
|
792
762
|
(interactionId2) => {
|
|
793
763
|
context?.onPlayInteraction(interactionId2);
|
|
794
764
|
},
|
|
795
765
|
[context]
|
|
796
766
|
);
|
|
797
767
|
const interactionId = extractString(interaction.value.interaction_id);
|
|
798
|
-
return /* @__PURE__ */
|
|
768
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
|
|
799
769
|
import_ui5.Tabs,
|
|
800
770
|
{
|
|
801
771
|
size: "small",
|
|
802
772
|
variant: "fullWidth",
|
|
803
|
-
"aria-label": (0,
|
|
773
|
+
"aria-label": (0, import_i18n4.__)("Interaction", "elementor"),
|
|
804
774
|
...getTabsProps()
|
|
805
775
|
},
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */
|
|
808
|
-
), /* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ React9.createElement(import_ui5.Tab, { label: (0, import_i18n4.__)("Details", "elementor"), ...getTabProps("details") }),
|
|
777
|
+
/* @__PURE__ */ React9.createElement(import_ui5.Tab, { label: (0, import_i18n4.__)("Settings", "elementor"), ...getTabProps("settings") })
|
|
778
|
+
), /* @__PURE__ */ React9.createElement(import_ui5.Divider, null), /* @__PURE__ */ React9.createElement(import_ui5.TabPanel, { sx: { p: 0 }, ...getTabPanelProps("details") }, /* @__PURE__ */ React9.createElement(
|
|
809
779
|
InteractionDetails,
|
|
810
780
|
{
|
|
811
781
|
key: interactionId,
|
|
@@ -813,7 +783,7 @@ var InteractionsListItem = ({
|
|
|
813
783
|
onChange: handleChange,
|
|
814
784
|
onPlayInteraction: handlePlayInteraction
|
|
815
785
|
}
|
|
816
|
-
)), /* @__PURE__ */
|
|
786
|
+
)), /* @__PURE__ */ React9.createElement(import_ui5.TabPanel, { sx: { p: 0 }, ...getTabPanelProps("settings") }, /* @__PURE__ */ React9.createElement(
|
|
817
787
|
InteractionSettings,
|
|
818
788
|
{
|
|
819
789
|
key: interactionId,
|
|
@@ -827,14 +797,14 @@ var InteractionsListItem = ({
|
|
|
827
797
|
var MAX_NUMBER_OF_INTERACTIONS = 5;
|
|
828
798
|
function InteractionsList(props) {
|
|
829
799
|
const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props;
|
|
830
|
-
const hasInitializedRef = (0,
|
|
831
|
-
const handleUpdateInteractions = (0,
|
|
800
|
+
const hasInitializedRef = (0, import_react8.useRef)(false);
|
|
801
|
+
const handleUpdateInteractions = (0, import_react8.useCallback)(
|
|
832
802
|
(newInteractions) => {
|
|
833
803
|
onSelectInteractions(newInteractions);
|
|
834
804
|
},
|
|
835
805
|
[onSelectInteractions]
|
|
836
806
|
);
|
|
837
|
-
(0,
|
|
807
|
+
(0, import_react8.useEffect)(() => {
|
|
838
808
|
if (triggerCreateOnShowEmpty && !hasInitializedRef.current && (!interactions.items || interactions.items?.length === 0)) {
|
|
839
809
|
hasInitializedRef.current = true;
|
|
840
810
|
const newState = {
|
|
@@ -844,14 +814,14 @@ function InteractionsList(props) {
|
|
|
844
814
|
handleUpdateInteractions(newState);
|
|
845
815
|
}
|
|
846
816
|
}, [triggerCreateOnShowEmpty, interactions.items, handleUpdateInteractions]);
|
|
847
|
-
const isMaxNumberOfInteractionsReached = (0,
|
|
817
|
+
const isMaxNumberOfInteractionsReached = (0, import_react8.useMemo)(() => {
|
|
848
818
|
return interactions.items?.length >= MAX_NUMBER_OF_INTERACTIONS;
|
|
849
819
|
}, [interactions.items?.length]);
|
|
850
|
-
const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */
|
|
820
|
+
const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ React10.createElement(import_ui6.Alert, { color: "secondary", icon: /* @__PURE__ */ React10.createElement(import_icons2.InfoCircleFilledIcon, null), size: "small" }, /* @__PURE__ */ React10.createElement(import_ui6.AlertTitle, null, (0, import_i18n5.__)("Interactions", "elementor")), /* @__PURE__ */ React10.createElement(import_ui6.Box, { component: "span" }, (0, import_i18n5.__)(
|
|
851
821
|
"You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.",
|
|
852
822
|
"elementor"
|
|
853
823
|
))) : void 0;
|
|
854
|
-
const handleRepeaterChange = (0,
|
|
824
|
+
const handleRepeaterChange = (0, import_react8.useCallback)(
|
|
855
825
|
(newItems) => {
|
|
856
826
|
handleUpdateInteractions({
|
|
857
827
|
...interactions,
|
|
@@ -860,7 +830,7 @@ function InteractionsList(props) {
|
|
|
860
830
|
},
|
|
861
831
|
[interactions, handleUpdateInteractions]
|
|
862
832
|
);
|
|
863
|
-
const handleInteractionChange = (0,
|
|
833
|
+
const handleInteractionChange = (0, import_react8.useCallback)(
|
|
864
834
|
(index, newInteractionValue) => {
|
|
865
835
|
const newItems = structuredClone(interactions.items);
|
|
866
836
|
newItems[index] = {
|
|
@@ -874,19 +844,19 @@ function InteractionsList(props) {
|
|
|
874
844
|
},
|
|
875
845
|
[interactions, handleUpdateInteractions]
|
|
876
846
|
);
|
|
877
|
-
const contextValue = (0,
|
|
847
|
+
const contextValue = (0, import_react8.useMemo)(
|
|
878
848
|
() => ({
|
|
879
849
|
onInteractionChange: handleInteractionChange,
|
|
880
850
|
onPlayInteraction
|
|
881
851
|
}),
|
|
882
852
|
[handleInteractionChange, onPlayInteraction]
|
|
883
853
|
);
|
|
884
|
-
return /* @__PURE__ */
|
|
885
|
-
|
|
854
|
+
return /* @__PURE__ */ React10.createElement(InteractionItemContextProvider, { value: contextValue }, /* @__PURE__ */ React10.createElement(
|
|
855
|
+
import_editor_controls5.Repeater,
|
|
886
856
|
{
|
|
887
857
|
openOnAdd: true,
|
|
888
858
|
openItem: triggerCreateOnShowEmpty ? 0 : void 0,
|
|
889
|
-
label: (0,
|
|
859
|
+
label: (0, import_i18n5.__)("Interactions", "elementor"),
|
|
890
860
|
values: interactions.items,
|
|
891
861
|
setValues: handleRepeaterChange,
|
|
892
862
|
showDuplicate: false,
|
|
@@ -899,14 +869,14 @@ function InteractionsList(props) {
|
|
|
899
869
|
Label: ({ value }) => buildDisplayLabel(value.value),
|
|
900
870
|
Icon: () => null,
|
|
901
871
|
Content: InteractionsListItem,
|
|
902
|
-
actions: (value) => /* @__PURE__ */
|
|
872
|
+
actions: (value) => /* @__PURE__ */ React10.createElement(import_ui6.Tooltip, { key: "preview", placement: "top", title: (0, import_i18n5.__)("Preview", "elementor") }, /* @__PURE__ */ React10.createElement(
|
|
903
873
|
import_ui6.IconButton,
|
|
904
874
|
{
|
|
905
|
-
"aria-label": (0,
|
|
875
|
+
"aria-label": (0, import_i18n5.__)("Play interaction", "elementor"),
|
|
906
876
|
size: "tiny",
|
|
907
877
|
onClick: () => onPlayInteraction(extractString(value.value.interaction_id))
|
|
908
878
|
},
|
|
909
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ React10.createElement(import_icons2.PlayerPlayIcon, { fontSize: "tiny" })
|
|
910
880
|
))
|
|
911
881
|
}
|
|
912
882
|
}
|
|
@@ -915,13 +885,13 @@ function InteractionsList(props) {
|
|
|
915
885
|
|
|
916
886
|
// src/components/interactions-tab.tsx
|
|
917
887
|
var InteractionsTab = ({ elementId }) => {
|
|
918
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ React11.createElement(PopupStateProvider, null, /* @__PURE__ */ React11.createElement(InteractionsTabContent, { elementId }));
|
|
919
889
|
};
|
|
920
890
|
function InteractionsTabContent({ elementId }) {
|
|
921
891
|
const existingInteractions = (0, import_editor_elements2.useElementInteractions)(elementId);
|
|
922
|
-
const firstInteractionState = (0,
|
|
892
|
+
const firstInteractionState = (0, import_react9.useState)(false);
|
|
923
893
|
const hasInteractions = existingInteractions?.items?.length || firstInteractionState[0];
|
|
924
|
-
return /* @__PURE__ */
|
|
894
|
+
return /* @__PURE__ */ React11.createElement(import_session.SessionStorageProvider, { prefix: elementId }, hasInteractions ? /* @__PURE__ */ React11.createElement(InteractionsProvider, { elementId }, /* @__PURE__ */ React11.createElement(InteractionsContent, { firstInteractionState })) : /* @__PURE__ */ React11.createElement(
|
|
925
895
|
EmptyState,
|
|
926
896
|
{
|
|
927
897
|
onCreateInteraction: () => {
|
|
@@ -934,7 +904,7 @@ function InteractionsContent({
|
|
|
934
904
|
firstInteractionState
|
|
935
905
|
}) {
|
|
936
906
|
const { interactions, setInteractions, playInteractions } = useInteractionsContext();
|
|
937
|
-
const applyInteraction = (0,
|
|
907
|
+
const applyInteraction = (0, import_react9.useCallback)(
|
|
938
908
|
(newInteractions) => {
|
|
939
909
|
firstInteractionState[1](false);
|
|
940
910
|
if (!newInteractions) {
|
|
@@ -945,7 +915,7 @@ function InteractionsContent({
|
|
|
945
915
|
},
|
|
946
916
|
[setInteractions, firstInteractionState]
|
|
947
917
|
);
|
|
948
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ React11.createElement(import_ui7.Stack, { sx: { m: 1, p: 1.5 }, gap: 2 }, /* @__PURE__ */ React11.createElement(
|
|
949
919
|
InteractionsList,
|
|
950
920
|
{
|
|
951
921
|
triggerCreateOnShowEmpty: firstInteractionState[0],
|
|
@@ -1116,11 +1086,155 @@ var documentElementsInteractionsProvider = createInteractionsProvider({
|
|
|
1116
1086
|
}
|
|
1117
1087
|
});
|
|
1118
1088
|
|
|
1089
|
+
// src/components/controls/direction.tsx
|
|
1090
|
+
var React12 = __toESM(require("react"));
|
|
1091
|
+
var import_react10 = require("react");
|
|
1092
|
+
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
1093
|
+
var import_icons3 = require("@elementor/icons");
|
|
1094
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
1095
|
+
function Direction({ value, onChange, interactionType }) {
|
|
1096
|
+
const options = (0, import_react10.useMemo)(() => {
|
|
1097
|
+
const isIn = interactionType === "in";
|
|
1098
|
+
return [
|
|
1099
|
+
{
|
|
1100
|
+
value: "top",
|
|
1101
|
+
label: isIn ? (0, import_i18n6.__)("From top", "elementor") : (0, import_i18n6.__)("To top", "elementor"),
|
|
1102
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React12.createElement(import_icons3.ArrowDownSmallIcon, { fontSize: size }) : /* @__PURE__ */ React12.createElement(import_icons3.ArrowUpSmallIcon, { fontSize: size }),
|
|
1103
|
+
showTooltip: true
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
value: "bottom",
|
|
1107
|
+
label: interactionType === "in" ? (0, import_i18n6.__)("From bottom", "elementor") : (0, import_i18n6.__)("To bottom", "elementor"),
|
|
1108
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React12.createElement(import_icons3.ArrowUpSmallIcon, { fontSize: size }) : /* @__PURE__ */ React12.createElement(import_icons3.ArrowDownSmallIcon, { fontSize: size }),
|
|
1109
|
+
showTooltip: true
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
value: "left",
|
|
1113
|
+
label: interactionType === "in" ? (0, import_i18n6.__)("From left", "elementor") : (0, import_i18n6.__)("To left", "elementor"),
|
|
1114
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React12.createElement(import_icons3.ArrowRightIcon, { fontSize: size }) : /* @__PURE__ */ React12.createElement(import_icons3.ArrowLeftIcon, { fontSize: size }),
|
|
1115
|
+
showTooltip: true
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
value: "right",
|
|
1119
|
+
label: interactionType === "in" ? (0, import_i18n6.__)("From right", "elementor") : (0, import_i18n6.__)("To right", "elementor"),
|
|
1120
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React12.createElement(import_icons3.ArrowLeftIcon, { fontSize: size }) : /* @__PURE__ */ React12.createElement(import_icons3.ArrowRightIcon, { fontSize: size }),
|
|
1121
|
+
showTooltip: true
|
|
1122
|
+
}
|
|
1123
|
+
];
|
|
1124
|
+
}, [interactionType]);
|
|
1125
|
+
return /* @__PURE__ */ React12.createElement(import_editor_controls6.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1119
1128
|
// src/components/controls/easing.tsx
|
|
1129
|
+
var React15 = __toESM(require("react"));
|
|
1130
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1131
|
+
|
|
1132
|
+
// src/ui/promotion-select.tsx
|
|
1120
1133
|
var React14 = __toESM(require("react"));
|
|
1134
|
+
var import_react12 = require("react");
|
|
1135
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1136
|
+
var import_ui9 = require("@elementor/ui");
|
|
1137
|
+
|
|
1138
|
+
// src/ui/interactions-promotion-chip.tsx
|
|
1139
|
+
var React13 = __toESM(require("react"));
|
|
1140
|
+
var import_react11 = require("react");
|
|
1121
1141
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
1122
1142
|
var import_ui8 = require("@elementor/ui");
|
|
1123
|
-
var
|
|
1143
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
1144
|
+
var InteractionsPromotionChip = (0, import_react11.forwardRef)(
|
|
1145
|
+
({ content, upgradeUrl, anchorRef }, ref) => {
|
|
1146
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
1147
|
+
(0, import_editor_ui.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
|
|
1148
|
+
const toggle = () => setIsOpen((prev) => !prev);
|
|
1149
|
+
(0, import_react11.useImperativeHandle)(ref, () => ({ toggle }), []);
|
|
1150
|
+
const handleToggle = (e) => {
|
|
1151
|
+
e.stopPropagation();
|
|
1152
|
+
toggle();
|
|
1153
|
+
};
|
|
1154
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1155
|
+
import_editor_ui.PromotionPopover,
|
|
1156
|
+
{
|
|
1157
|
+
open: isOpen,
|
|
1158
|
+
title: (0, import_i18n7.__)("Interactions", "elementor"),
|
|
1159
|
+
content,
|
|
1160
|
+
ctaText: (0, import_i18n7.__)("Upgrade now", "elementor"),
|
|
1161
|
+
ctaUrl: upgradeUrl,
|
|
1162
|
+
anchorRef,
|
|
1163
|
+
placement: anchorRef ? "right-start" : void 0,
|
|
1164
|
+
onClose: (e) => {
|
|
1165
|
+
e.stopPropagation();
|
|
1166
|
+
setIsOpen(false);
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
/* @__PURE__ */ React13.createElement(
|
|
1170
|
+
import_ui8.Box,
|
|
1171
|
+
{
|
|
1172
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1173
|
+
onClick: handleToggle,
|
|
1174
|
+
sx: { cursor: "pointer", display: "inline-flex", mr: 1 }
|
|
1175
|
+
},
|
|
1176
|
+
/* @__PURE__ */ React13.createElement(import_editor_ui.PromotionChip, null)
|
|
1177
|
+
)
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
);
|
|
1181
|
+
InteractionsPromotionChip.displayName = "InteractionsPromotionChip";
|
|
1182
|
+
|
|
1183
|
+
// src/ui/promotion-select.tsx
|
|
1184
|
+
function PromotionSelect({
|
|
1185
|
+
value,
|
|
1186
|
+
onChange,
|
|
1187
|
+
baseOptions,
|
|
1188
|
+
disabledOptions,
|
|
1189
|
+
promotionLabel,
|
|
1190
|
+
promotionContent,
|
|
1191
|
+
upgradeUrl
|
|
1192
|
+
}) {
|
|
1193
|
+
const promotionRef = (0, import_react12.useRef)(null);
|
|
1194
|
+
const anchorRef = (0, import_react12.useRef)(null);
|
|
1195
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1196
|
+
import_ui9.Select,
|
|
1197
|
+
{
|
|
1198
|
+
value,
|
|
1199
|
+
onChange: (e) => onChange?.(e.target.value),
|
|
1200
|
+
fullWidth: true,
|
|
1201
|
+
displayEmpty: true,
|
|
1202
|
+
size: "tiny",
|
|
1203
|
+
MenuProps: { disablePortal: true }
|
|
1204
|
+
},
|
|
1205
|
+
Object.entries(baseOptions).map(([key, label]) => /* @__PURE__ */ React14.createElement(import_editor_ui2.MenuListItem, { key, value: key }, label)),
|
|
1206
|
+
/* @__PURE__ */ React14.createElement(
|
|
1207
|
+
import_ui9.MenuSubheader,
|
|
1208
|
+
{
|
|
1209
|
+
ref: anchorRef,
|
|
1210
|
+
sx: {
|
|
1211
|
+
cursor: "pointer",
|
|
1212
|
+
color: "text.tertiary",
|
|
1213
|
+
fontWeight: "400",
|
|
1214
|
+
display: "flex",
|
|
1215
|
+
alignItems: "center"
|
|
1216
|
+
},
|
|
1217
|
+
onMouseDown: (e) => {
|
|
1218
|
+
e.stopPropagation();
|
|
1219
|
+
promotionRef.current?.toggle();
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
promotionLabel,
|
|
1223
|
+
/* @__PURE__ */ React14.createElement(
|
|
1224
|
+
InteractionsPromotionChip,
|
|
1225
|
+
{
|
|
1226
|
+
content: promotionContent,
|
|
1227
|
+
upgradeUrl,
|
|
1228
|
+
ref: promotionRef,
|
|
1229
|
+
anchorRef
|
|
1230
|
+
}
|
|
1231
|
+
)
|
|
1232
|
+
),
|
|
1233
|
+
Object.entries(disabledOptions).map(([key, label]) => /* @__PURE__ */ React14.createElement(import_editor_ui2.MenuListItem, { key, value: key, disabled: true, sx: { pl: 3 } }, label))
|
|
1234
|
+
);
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
// src/components/controls/easing.tsx
|
|
1124
1238
|
var EASING_OPTIONS = {
|
|
1125
1239
|
easeIn: (0, import_i18n8.__)("Ease In", "elementor"),
|
|
1126
1240
|
easeInOut: (0, import_i18n8.__)("Ease In Out", "elementor"),
|
|
@@ -1130,82 +1244,88 @@ var EASING_OPTIONS = {
|
|
|
1130
1244
|
backOut: (0, import_i18n8.__)("Back Out", "elementor"),
|
|
1131
1245
|
linear: (0, import_i18n8.__)("Linear", "elementor")
|
|
1132
1246
|
};
|
|
1133
|
-
var
|
|
1247
|
+
var BASE_EASINGS = ["easeIn"];
|
|
1134
1248
|
function Easing({}) {
|
|
1135
|
-
const
|
|
1136
|
-
key
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1249
|
+
const baseOptions = Object.fromEntries(
|
|
1250
|
+
Object.entries(EASING_OPTIONS).filter(([key]) => BASE_EASINGS.includes(key))
|
|
1251
|
+
);
|
|
1252
|
+
const disabledOptions = Object.fromEntries(
|
|
1253
|
+
Object.entries(EASING_OPTIONS).filter(([key]) => !BASE_EASINGS.includes(key))
|
|
1254
|
+
);
|
|
1255
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1256
|
+
PromotionSelect,
|
|
1257
|
+
{
|
|
1258
|
+
value: DEFAULT_VALUES.easing,
|
|
1259
|
+
baseOptions,
|
|
1260
|
+
disabledOptions,
|
|
1261
|
+
promotionLabel: (0, import_i18n8.__)("PRO features", "elementor"),
|
|
1262
|
+
promotionContent: (0, import_i18n8.__)("Upgrade to control the smoothness of the interaction.", "elementor"),
|
|
1263
|
+
upgradeUrl: "https://go.elementor.com/go-pro-interactions-easing-modal/"
|
|
1264
|
+
}
|
|
1265
|
+
);
|
|
1144
1266
|
}
|
|
1145
1267
|
|
|
1146
1268
|
// src/components/controls/effect.tsx
|
|
1147
|
-
var
|
|
1148
|
-
var
|
|
1149
|
-
var
|
|
1269
|
+
var React16 = __toESM(require("react"));
|
|
1270
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1271
|
+
var import_ui10 = require("@elementor/ui");
|
|
1150
1272
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1151
1273
|
function Effect({ value, onChange }) {
|
|
1152
1274
|
const availableEffects = [
|
|
1153
1275
|
{ key: "fade", label: (0, import_i18n9.__)("Fade", "elementor") },
|
|
1154
1276
|
{ key: "slide", label: (0, import_i18n9.__)("Slide", "elementor") },
|
|
1155
|
-
{ key: "scale", label: (0, import_i18n9.__)("Scale", "elementor") }
|
|
1277
|
+
{ key: "scale", label: (0, import_i18n9.__)("Scale", "elementor") },
|
|
1278
|
+
{ key: "custom", label: (0, import_i18n9.__)("Custom", "elementor"), disabled: true }
|
|
1156
1279
|
];
|
|
1157
|
-
return /* @__PURE__ */
|
|
1158
|
-
|
|
1280
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1281
|
+
import_ui10.Select,
|
|
1159
1282
|
{
|
|
1160
1283
|
fullWidth: true,
|
|
1161
1284
|
displayEmpty: true,
|
|
1162
1285
|
size: "tiny",
|
|
1163
1286
|
value,
|
|
1164
|
-
onChange: (event) => onChange(event.target.value)
|
|
1287
|
+
onChange: (event) => onChange(event.target.value),
|
|
1288
|
+
MenuProps: { disablePortal: true }
|
|
1165
1289
|
},
|
|
1166
1290
|
availableEffects.map((effect) => {
|
|
1167
|
-
return /* @__PURE__ */
|
|
1291
|
+
return /* @__PURE__ */ React16.createElement(import_editor_ui3.MenuListItem, { key: effect.key, value: effect.key, disabled: effect.disabled }, effect.label);
|
|
1168
1292
|
})
|
|
1169
1293
|
);
|
|
1170
1294
|
}
|
|
1171
1295
|
|
|
1172
|
-
// src/components/controls/
|
|
1296
|
+
// src/components/controls/effect-type.tsx
|
|
1173
1297
|
var React17 = __toESM(require("react"));
|
|
1174
|
-
var
|
|
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");
|
|
1298
|
+
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
1184
1299
|
var import_i18n10 = require("@wordpress/i18n");
|
|
1185
|
-
function
|
|
1186
|
-
const
|
|
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,
|
|
1300
|
+
function EffectType({ value, onChange }) {
|
|
1301
|
+
const options = [
|
|
1194
1302
|
{
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
ctaUrl: upgradeUrl,
|
|
1200
|
-
anchorRef,
|
|
1201
|
-
placement: anchorRef ? "right-start" : void 0,
|
|
1202
|
-
onClose: handleToggle
|
|
1303
|
+
value: "in",
|
|
1304
|
+
label: (0, import_i18n10.__)("In", "elementor"),
|
|
1305
|
+
renderContent: () => (0, import_i18n10.__)("In", "elementor"),
|
|
1306
|
+
showTooltip: true
|
|
1203
1307
|
},
|
|
1204
|
-
|
|
1205
|
-
|
|
1308
|
+
{
|
|
1309
|
+
value: "out",
|
|
1310
|
+
label: (0, import_i18n10.__)("Out", "elementor"),
|
|
1311
|
+
renderContent: () => (0, import_i18n10.__)("Out", "elementor"),
|
|
1312
|
+
showTooltip: true
|
|
1313
|
+
}
|
|
1314
|
+
];
|
|
1315
|
+
return /* @__PURE__ */ React17.createElement(import_editor_controls7.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
|
|
1206
1316
|
}
|
|
1207
1317
|
|
|
1208
1318
|
// src/components/controls/replay.tsx
|
|
1319
|
+
var React18 = __toESM(require("react"));
|
|
1320
|
+
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
1321
|
+
var import_icons4 = require("@elementor/icons");
|
|
1322
|
+
var import_ui11 = require("@elementor/ui");
|
|
1323
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1324
|
+
var REPLAY_OPTIONS = {
|
|
1325
|
+
no: (0, import_i18n11.__)("No", "elementor"),
|
|
1326
|
+
yes: (0, import_i18n11.__)("Yes", "elementor")
|
|
1327
|
+
};
|
|
1328
|
+
var BASE_REPLAY = ["no"];
|
|
1209
1329
|
var OVERLAY_GRID = "1 / 1";
|
|
1210
1330
|
var CHIP_OFFSET = "50%";
|
|
1211
1331
|
function Replay({ onChange, anchorRef }) {
|
|
@@ -1213,19 +1333,19 @@ function Replay({ onChange, anchorRef }) {
|
|
|
1213
1333
|
{
|
|
1214
1334
|
value: false,
|
|
1215
1335
|
disabled: false,
|
|
1216
|
-
label:
|
|
1217
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1336
|
+
label: REPLAY_OPTIONS.no,
|
|
1337
|
+
renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(import_icons4.MinusIcon, { fontSize: size }),
|
|
1218
1338
|
showTooltip: true
|
|
1219
1339
|
},
|
|
1220
1340
|
{
|
|
1221
1341
|
value: true,
|
|
1222
1342
|
disabled: true,
|
|
1223
|
-
label:
|
|
1224
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1343
|
+
label: REPLAY_OPTIONS.yes,
|
|
1344
|
+
renderContent: ({ size }) => /* @__PURE__ */ React18.createElement(import_icons4.CheckIcon, { fontSize: size }),
|
|
1225
1345
|
showTooltip: true
|
|
1226
1346
|
}
|
|
1227
1347
|
];
|
|
1228
|
-
return /* @__PURE__ */
|
|
1348
|
+
return /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { display: "grid", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID } }, /* @__PURE__ */ React18.createElement(import_editor_controls8.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value: false })), /* @__PURE__ */ React18.createElement(import_ui11.Box, { sx: { gridArea: OVERLAY_GRID, marginInlineEnd: CHIP_OFFSET, justifySelf: "end" } }, /* @__PURE__ */ React18.createElement(
|
|
1229
1349
|
InteractionsPromotionChip,
|
|
1230
1350
|
{
|
|
1231
1351
|
content: (0, import_i18n11.__)("Upgrade to run the animation every time its trigger occurs.", "elementor"),
|
|
@@ -1236,31 +1356,34 @@ function Replay({ onChange, anchorRef }) {
|
|
|
1236
1356
|
}
|
|
1237
1357
|
|
|
1238
1358
|
// src/components/controls/trigger.tsx
|
|
1239
|
-
var
|
|
1240
|
-
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1241
|
-
var import_ui12 = require("@elementor/ui");
|
|
1359
|
+
var React19 = __toESM(require("react"));
|
|
1242
1360
|
var import_i18n12 = require("@wordpress/i18n");
|
|
1361
|
+
var TRIGGER_OPTIONS = {
|
|
1362
|
+
load: (0, import_i18n12.__)("Page load", "elementor"),
|
|
1363
|
+
scrollIn: (0, import_i18n12.__)("Scroll into view", "elementor"),
|
|
1364
|
+
scrollOn: (0, import_i18n12.__)("While scrolling", "elementor"),
|
|
1365
|
+
hover: (0, import_i18n12.__)("On hover", "elementor"),
|
|
1366
|
+
click: (0, import_i18n12.__)("On click", "elementor")
|
|
1367
|
+
};
|
|
1368
|
+
var BASE_TRIGGERS = ["load", "scrollIn"];
|
|
1243
1369
|
function Trigger({ value, onChange }) {
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
return /* @__PURE__ */ React18.createElement(
|
|
1253
|
-
import_ui12.Select,
|
|
1370
|
+
const baseOptions = Object.fromEntries(
|
|
1371
|
+
Object.entries(TRIGGER_OPTIONS).filter(([key]) => BASE_TRIGGERS.includes(key))
|
|
1372
|
+
);
|
|
1373
|
+
const disabledOptions = Object.fromEntries(
|
|
1374
|
+
Object.entries(TRIGGER_OPTIONS).filter(([key]) => !BASE_TRIGGERS.includes(key))
|
|
1375
|
+
);
|
|
1376
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1377
|
+
PromotionSelect,
|
|
1254
1378
|
{
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
})
|
|
1379
|
+
value: value in baseOptions ? value : DEFAULT_VALUES.trigger,
|
|
1380
|
+
onChange,
|
|
1381
|
+
baseOptions,
|
|
1382
|
+
disabledOptions,
|
|
1383
|
+
promotionLabel: (0, import_i18n12.__)("PRO triggers", "elementor"),
|
|
1384
|
+
promotionContent: (0, import_i18n12.__)("Upgrade to unlock more interactions triggers.", "elementor"),
|
|
1385
|
+
upgradeUrl: "https://go.elementor.com/go-pro-interactions-triggers-modal/"
|
|
1386
|
+
}
|
|
1264
1387
|
);
|
|
1265
1388
|
}
|
|
1266
1389
|
|
|
@@ -1322,6 +1445,16 @@ function init() {
|
|
|
1322
1445
|
component: Replay,
|
|
1323
1446
|
options: ["true", "false"]
|
|
1324
1447
|
});
|
|
1448
|
+
registerInteractionsControl({
|
|
1449
|
+
type: "effectType",
|
|
1450
|
+
component: EffectType,
|
|
1451
|
+
options: ["in", "out"]
|
|
1452
|
+
});
|
|
1453
|
+
registerInteractionsControl({
|
|
1454
|
+
type: "direction",
|
|
1455
|
+
component: Direction,
|
|
1456
|
+
options: ["top", "bottom", "left", "right"]
|
|
1457
|
+
});
|
|
1325
1458
|
registerInteractionsControl({
|
|
1326
1459
|
type: "effect",
|
|
1327
1460
|
component: Effect,
|
|
@@ -1333,9 +1466,15 @@ function init() {
|
|
|
1333
1466
|
}
|
|
1334
1467
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1335
1468
|
0 && (module.exports = {
|
|
1469
|
+
BASE_EASINGS,
|
|
1470
|
+
BASE_REPLAY,
|
|
1471
|
+
BASE_TRIGGERS,
|
|
1472
|
+
EASING_OPTIONS,
|
|
1336
1473
|
ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX,
|
|
1337
1474
|
EmptyState,
|
|
1338
1475
|
InteractionsTab,
|
|
1476
|
+
REPLAY_OPTIONS,
|
|
1477
|
+
TRIGGER_OPTIONS,
|
|
1339
1478
|
createInteractionsProvider,
|
|
1340
1479
|
getInteractionsConfig,
|
|
1341
1480
|
init,
|