@elementor/editor-interactions 4.0.0-521 → 4.0.0-523
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.js +104 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/components/interactions-list-item.tsx +33 -0
- package/src/components/interactions-list.tsx +6 -39
- package/src/contexts/interactions-item-context.tsx +26 -0
package/dist/index.mjs
CHANGED
|
@@ -25,8 +25,8 @@ var EmptyState = ({ onCreateInteraction }) => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// src/components/interactions-tab.tsx
|
|
28
|
-
import * as
|
|
29
|
-
import { useCallback as
|
|
28
|
+
import * as React12 from "react";
|
|
29
|
+
import { useCallback as useCallback5, useState as useState2 } from "react";
|
|
30
30
|
import { useElementInteractions as useElementInteractions2 } from "@elementor/editor-elements";
|
|
31
31
|
import { SessionStorageProvider } from "@elementor/session";
|
|
32
32
|
import { Stack as Stack2 } from "@elementor/ui";
|
|
@@ -91,13 +91,31 @@ var PopupStateProvider = ({ children }) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// src/components/interactions-list.tsx
|
|
94
|
-
import * as
|
|
95
|
-
import {
|
|
94
|
+
import * as React11 from "react";
|
|
95
|
+
import { useCallback as useCallback4, useEffect as useEffect2, useMemo as useMemo3, useRef } from "react";
|
|
96
96
|
import { Repeater } from "@elementor/editor-controls";
|
|
97
97
|
import { InfoCircleFilledIcon, PlayerPlayIcon } from "@elementor/icons";
|
|
98
98
|
import { Alert, AlertTitle, Box, IconButton, Tooltip } from "@elementor/ui";
|
|
99
99
|
import { __ as __6 } from "@wordpress/i18n";
|
|
100
100
|
|
|
101
|
+
// src/contexts/interactions-item-context.tsx
|
|
102
|
+
import * as React4 from "react";
|
|
103
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
104
|
+
var InteractionItemContext = createContext3(null);
|
|
105
|
+
function InteractionItemContextProvider({
|
|
106
|
+
value,
|
|
107
|
+
children
|
|
108
|
+
}) {
|
|
109
|
+
return /* @__PURE__ */ React4.createElement(InteractionItemContext.Provider, { value }, children);
|
|
110
|
+
}
|
|
111
|
+
function useInteractionItemContext() {
|
|
112
|
+
const context = useContext3(InteractionItemContext);
|
|
113
|
+
if (!context) {
|
|
114
|
+
throw new Error("useInteractionItemContext must be used within InteractionItemContextProvider");
|
|
115
|
+
}
|
|
116
|
+
return context;
|
|
117
|
+
}
|
|
118
|
+
|
|
101
119
|
// src/utils/temp-id-utils.ts
|
|
102
120
|
var TEMP_ID_PREFIX = "temp-";
|
|
103
121
|
function generateTempInteractionId() {
|
|
@@ -239,8 +257,12 @@ var buildDisplayLabel = (item) => {
|
|
|
239
257
|
return `${triggerLabel}: ${effectLabel} ${typeLabel}`;
|
|
240
258
|
};
|
|
241
259
|
|
|
260
|
+
// src/components/interactions-list-item.tsx
|
|
261
|
+
import * as React10 from "react";
|
|
262
|
+
import { useCallback as useCallback3 } from "react";
|
|
263
|
+
|
|
242
264
|
// src/components/interaction-details.tsx
|
|
243
|
-
import * as
|
|
265
|
+
import * as React9 from "react";
|
|
244
266
|
import { useMemo as useMemo2 } from "react";
|
|
245
267
|
import { ControlFormLabel, PopoverContent, PopoverGridContainer } from "@elementor/editor-controls";
|
|
246
268
|
import { Divider, Grid } from "@elementor/ui";
|
|
@@ -260,7 +282,7 @@ function getInteractionsControl(type) {
|
|
|
260
282
|
}
|
|
261
283
|
|
|
262
284
|
// src/components/controls/direction.tsx
|
|
263
|
-
import * as
|
|
285
|
+
import * as React5 from "react";
|
|
264
286
|
import { useMemo } from "react";
|
|
265
287
|
import { ToggleButtonGroupUi } from "@elementor/editor-controls";
|
|
266
288
|
import { ArrowDownSmallIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpSmallIcon } from "@elementor/icons";
|
|
@@ -272,34 +294,34 @@ function Direction({ value, onChange, interactionType }) {
|
|
|
272
294
|
{
|
|
273
295
|
value: "top",
|
|
274
296
|
label: isIn ? __2("From top", "elementor") : __2("To top", "elementor"),
|
|
275
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
297
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(ArrowDownSmallIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(ArrowUpSmallIcon, { fontSize: size }),
|
|
276
298
|
showTooltip: true
|
|
277
299
|
},
|
|
278
300
|
{
|
|
279
301
|
value: "bottom",
|
|
280
302
|
label: interactionType === "in" ? __2("From bottom", "elementor") : __2("To bottom", "elementor"),
|
|
281
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
303
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(ArrowUpSmallIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(ArrowDownSmallIcon, { fontSize: size }),
|
|
282
304
|
showTooltip: true
|
|
283
305
|
},
|
|
284
306
|
{
|
|
285
307
|
value: "left",
|
|
286
308
|
label: interactionType === "in" ? __2("From left", "elementor") : __2("To left", "elementor"),
|
|
287
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
309
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(ArrowRightIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(ArrowLeftIcon, { fontSize: size }),
|
|
288
310
|
showTooltip: true
|
|
289
311
|
},
|
|
290
312
|
{
|
|
291
313
|
value: "right",
|
|
292
314
|
label: interactionType === "in" ? __2("From right", "elementor") : __2("To right", "elementor"),
|
|
293
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
315
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(ArrowLeftIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(ArrowRightIcon, { fontSize: size }),
|
|
294
316
|
showTooltip: true
|
|
295
317
|
}
|
|
296
318
|
];
|
|
297
319
|
}, [interactionType]);
|
|
298
|
-
return /* @__PURE__ */
|
|
320
|
+
return /* @__PURE__ */ React5.createElement(ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
|
|
299
321
|
}
|
|
300
322
|
|
|
301
323
|
// src/components/controls/effect.tsx
|
|
302
|
-
import * as
|
|
324
|
+
import * as React6 from "react";
|
|
303
325
|
import { MenuListItem } from "@elementor/editor-ui";
|
|
304
326
|
import { Select } from "@elementor/ui";
|
|
305
327
|
import { __ as __3 } from "@wordpress/i18n";
|
|
@@ -309,7 +331,7 @@ function Effect({ value, onChange }) {
|
|
|
309
331
|
{ key: "slide", label: __3("Slide", "elementor") },
|
|
310
332
|
{ key: "scale", label: __3("Scale", "elementor") }
|
|
311
333
|
];
|
|
312
|
-
return /* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ React6.createElement(
|
|
313
335
|
Select,
|
|
314
336
|
{
|
|
315
337
|
fullWidth: true,
|
|
@@ -319,13 +341,13 @@ function Effect({ value, onChange }) {
|
|
|
319
341
|
onChange: (event) => onChange(event.target.value)
|
|
320
342
|
},
|
|
321
343
|
availableEffects.map((effect) => {
|
|
322
|
-
return /* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ React6.createElement(MenuListItem, { key: effect.key, value: effect.key }, effect.label);
|
|
323
345
|
})
|
|
324
346
|
);
|
|
325
347
|
}
|
|
326
348
|
|
|
327
349
|
// src/components/controls/effect-type.tsx
|
|
328
|
-
import * as
|
|
350
|
+
import * as React7 from "react";
|
|
329
351
|
import { ToggleButtonGroupUi as ToggleButtonGroupUi2 } from "@elementor/editor-controls";
|
|
330
352
|
import { __ as __4 } from "@wordpress/i18n";
|
|
331
353
|
function EffectType({ value, onChange }) {
|
|
@@ -343,11 +365,11 @@ function EffectType({ value, onChange }) {
|
|
|
343
365
|
showTooltip: true
|
|
344
366
|
}
|
|
345
367
|
];
|
|
346
|
-
return /* @__PURE__ */
|
|
368
|
+
return /* @__PURE__ */ React7.createElement(ToggleButtonGroupUi2, { items: options, exclusive: true, onChange, value });
|
|
347
369
|
}
|
|
348
370
|
|
|
349
371
|
// src/components/controls/time-frame-indicator.tsx
|
|
350
|
-
import * as
|
|
372
|
+
import * as React8 from "react";
|
|
351
373
|
import { useCallback as useCallback2 } from "react";
|
|
352
374
|
import { UnstableSizeField } from "@elementor/editor-controls";
|
|
353
375
|
import { sizePropTypeUtil } from "@elementor/editor-props";
|
|
@@ -368,7 +390,7 @@ function TimeFrameIndicator({ value, onChange, defaultValue }) {
|
|
|
368
390
|
setValue(defaultValue);
|
|
369
391
|
}
|
|
370
392
|
};
|
|
371
|
-
return /* @__PURE__ */
|
|
393
|
+
return /* @__PURE__ */ React8.createElement(
|
|
372
394
|
UnstableSizeField,
|
|
373
395
|
{
|
|
374
396
|
units: [DEFAULT_UNIT],
|
|
@@ -501,53 +523,53 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
501
523
|
onPlayInteraction(interactionId);
|
|
502
524
|
}, 0);
|
|
503
525
|
};
|
|
504
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ React9.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React9.createElement(Grid, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React9.createElement(Field, { label: __5("Trigger", "elementor") }, /* @__PURE__ */ React9.createElement(TriggerControl, { value: trigger, onChange: (v) => updateInteraction({ trigger: v }) })), ReplayControl && /* @__PURE__ */ React9.createElement(Field, { label: __5("Replay", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
505
527
|
ReplayControl,
|
|
506
528
|
{
|
|
507
529
|
value: replay,
|
|
508
530
|
onChange: (v) => updateInteraction({ replay: v }),
|
|
509
531
|
disabled: true
|
|
510
532
|
}
|
|
511
|
-
))), /* @__PURE__ */
|
|
533
|
+
))), /* @__PURE__ */ React9.createElement(Divider, null), /* @__PURE__ */ React9.createElement(Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React9.createElement(Field, { label: __5("Effect", "elementor") }, /* @__PURE__ */ React9.createElement(Effect, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), /* @__PURE__ */ React9.createElement(Field, { label: __5("Type", "elementor") }, /* @__PURE__ */ React9.createElement(EffectType, { value: type, onChange: (v) => updateInteraction({ type: v }) })), /* @__PURE__ */ React9.createElement(Field, { label: __5("Direction", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
512
534
|
Direction,
|
|
513
535
|
{
|
|
514
536
|
value: direction,
|
|
515
537
|
onChange: (v) => updateInteraction({ direction: v }),
|
|
516
538
|
interactionType: type
|
|
517
539
|
}
|
|
518
|
-
)), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */
|
|
540
|
+
)), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */ React9.createElement(Field, { label: __5("Duration", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
519
541
|
TimeFrameIndicator,
|
|
520
542
|
{
|
|
521
543
|
value: String(duration),
|
|
522
544
|
onChange: (v) => updateInteraction({ duration: parseInt(v, 10) }),
|
|
523
545
|
defaultValue: DEFAULT_VALUES.duration
|
|
524
546
|
}
|
|
525
|
-
)), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */
|
|
547
|
+
)), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */ React9.createElement(Field, { label: __5("Delay", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
526
548
|
TimeFrameIndicator,
|
|
527
549
|
{
|
|
528
550
|
value: String(delay),
|
|
529
551
|
onChange: (v) => updateInteraction({ delay: parseInt(v, 10) }),
|
|
530
552
|
defaultValue: DEFAULT_VALUES.delay
|
|
531
553
|
}
|
|
532
|
-
))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */
|
|
554
|
+
))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(Divider, null), /* @__PURE__ */ React9.createElement(Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React9.createElement(Field, { label: __5("Relative To", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
533
555
|
RelativeToControl,
|
|
534
556
|
{
|
|
535
557
|
value: relativeTo,
|
|
536
558
|
onChange: (v) => updateInteraction({ relativeTo: v })
|
|
537
559
|
}
|
|
538
|
-
)), OffsetTopControl && /* @__PURE__ */
|
|
560
|
+
)), OffsetTopControl && /* @__PURE__ */ React9.createElement(Field, { label: __5("Offset Top", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
539
561
|
OffsetTopControl,
|
|
540
562
|
{
|
|
541
563
|
value: String(offsetTop),
|
|
542
564
|
onChange: (v) => updateInteraction({ offsetTop: parseInt(v, 10) })
|
|
543
565
|
}
|
|
544
|
-
)), OffsetBottomControl && /* @__PURE__ */
|
|
566
|
+
)), OffsetBottomControl && /* @__PURE__ */ React9.createElement(Field, { label: __5("Offset Bottom", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
545
567
|
OffsetBottomControl,
|
|
546
568
|
{
|
|
547
569
|
value: String(offsetBottom),
|
|
548
570
|
onChange: (v) => updateInteraction({ offsetBottom: parseInt(v, 10) })
|
|
549
571
|
}
|
|
550
|
-
))), /* @__PURE__ */
|
|
572
|
+
))), /* @__PURE__ */ React9.createElement(Divider, null)), EasingControl && /* @__PURE__ */ React9.createElement(Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React9.createElement(Field, { label: __5("Easing", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
551
573
|
EasingControl,
|
|
552
574
|
{
|
|
553
575
|
value: easing,
|
|
@@ -558,16 +580,41 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
558
580
|
))));
|
|
559
581
|
};
|
|
560
582
|
function Field({ label, children }) {
|
|
561
|
-
return /* @__PURE__ */
|
|
583
|
+
return /* @__PURE__ */ React9.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(PopoverGridContainer, null, /* @__PURE__ */ React9.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React9.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React9.createElement(Grid, { item: true, xs: 6 }, children)));
|
|
562
584
|
}
|
|
563
585
|
|
|
586
|
+
// src/components/interactions-list-item.tsx
|
|
587
|
+
var InteractionsListItem = ({ index, value }) => {
|
|
588
|
+
const context = useInteractionItemContext();
|
|
589
|
+
const handleChange = useCallback3(
|
|
590
|
+
(newInteractionValue) => {
|
|
591
|
+
context?.onInteractionChange(index, newInteractionValue);
|
|
592
|
+
},
|
|
593
|
+
[context, index]
|
|
594
|
+
);
|
|
595
|
+
const handlePlayInteraction = useCallback3(
|
|
596
|
+
(interactionId) => {
|
|
597
|
+
context?.onPlayInteraction(interactionId);
|
|
598
|
+
},
|
|
599
|
+
[context]
|
|
600
|
+
);
|
|
601
|
+
return /* @__PURE__ */ React10.createElement(
|
|
602
|
+
InteractionDetails,
|
|
603
|
+
{
|
|
604
|
+
key: index,
|
|
605
|
+
interaction: value.value,
|
|
606
|
+
onChange: handleChange,
|
|
607
|
+
onPlayInteraction: handlePlayInteraction
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
};
|
|
611
|
+
|
|
564
612
|
// src/components/interactions-list.tsx
|
|
565
613
|
var MAX_NUMBER_OF_INTERACTIONS = 5;
|
|
566
|
-
var InteractionItemContext = createContext3(null);
|
|
567
614
|
function InteractionsList(props) {
|
|
568
615
|
const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props;
|
|
569
616
|
const hasInitializedRef = useRef(false);
|
|
570
|
-
const handleUpdateInteractions =
|
|
617
|
+
const handleUpdateInteractions = useCallback4(
|
|
571
618
|
(newInteractions) => {
|
|
572
619
|
onSelectInteractions(newInteractions);
|
|
573
620
|
},
|
|
@@ -586,11 +633,11 @@ function InteractionsList(props) {
|
|
|
586
633
|
const isMaxNumberOfInteractionsReached = useMemo3(() => {
|
|
587
634
|
return interactions.items?.length >= MAX_NUMBER_OF_INTERACTIONS;
|
|
588
635
|
}, [interactions.items?.length]);
|
|
589
|
-
const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */
|
|
636
|
+
const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ React11.createElement(Alert, { color: "secondary", icon: /* @__PURE__ */ React11.createElement(InfoCircleFilledIcon, null), size: "small" }, /* @__PURE__ */ React11.createElement(AlertTitle, null, __6("Interactions", "elementor")), /* @__PURE__ */ React11.createElement(Box, { component: "span" }, __6(
|
|
590
637
|
"You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.",
|
|
591
638
|
"elementor"
|
|
592
639
|
))) : void 0;
|
|
593
|
-
const handleRepeaterChange =
|
|
640
|
+
const handleRepeaterChange = useCallback4(
|
|
594
641
|
(newItems) => {
|
|
595
642
|
handleUpdateInteractions({
|
|
596
643
|
...interactions,
|
|
@@ -599,7 +646,7 @@ function InteractionsList(props) {
|
|
|
599
646
|
},
|
|
600
647
|
[interactions, handleUpdateInteractions]
|
|
601
648
|
);
|
|
602
|
-
const handleInteractionChange =
|
|
649
|
+
const handleInteractionChange = useCallback4(
|
|
603
650
|
(index, newInteractionValue) => {
|
|
604
651
|
const newItems = structuredClone(interactions.items);
|
|
605
652
|
newItems[index] = {
|
|
@@ -620,7 +667,7 @@ function InteractionsList(props) {
|
|
|
620
667
|
}),
|
|
621
668
|
[handleInteractionChange, onPlayInteraction]
|
|
622
669
|
);
|
|
623
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ React11.createElement(InteractionItemContextProvider, { value: contextValue }, /* @__PURE__ */ React11.createElement(
|
|
624
671
|
Repeater,
|
|
625
672
|
{
|
|
626
673
|
openOnAdd: true,
|
|
@@ -637,54 +684,30 @@ function InteractionsList(props) {
|
|
|
637
684
|
initialValues: createDefaultInteractionItem(),
|
|
638
685
|
Label: ({ value }) => buildDisplayLabel(value.value),
|
|
639
686
|
Icon: () => null,
|
|
640
|
-
Content,
|
|
641
|
-
actions: (value) => /* @__PURE__ */
|
|
687
|
+
Content: InteractionsListItem,
|
|
688
|
+
actions: (value) => /* @__PURE__ */ React11.createElement(Tooltip, { key: "preview", placement: "top", title: __6("Preview", "elementor") }, /* @__PURE__ */ React11.createElement(
|
|
642
689
|
IconButton,
|
|
643
690
|
{
|
|
644
691
|
"aria-label": __6("Play interaction", "elementor"),
|
|
645
692
|
size: "tiny",
|
|
646
693
|
onClick: () => onPlayInteraction(extractString(value.value.interaction_id))
|
|
647
694
|
},
|
|
648
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ React11.createElement(PlayerPlayIcon, { fontSize: "tiny" })
|
|
649
696
|
))
|
|
650
697
|
}
|
|
651
698
|
}
|
|
652
699
|
));
|
|
653
700
|
}
|
|
654
|
-
var Content = ({ index, value }) => {
|
|
655
|
-
const context = useContext3(InteractionItemContext);
|
|
656
|
-
const handleChange = useCallback3(
|
|
657
|
-
(newInteractionValue) => {
|
|
658
|
-
context?.onInteractionChange(index, newInteractionValue);
|
|
659
|
-
},
|
|
660
|
-
[context, index]
|
|
661
|
-
);
|
|
662
|
-
const handlePlayInteraction = useCallback3(
|
|
663
|
-
(interactionId) => {
|
|
664
|
-
context?.onPlayInteraction(interactionId);
|
|
665
|
-
},
|
|
666
|
-
[context]
|
|
667
|
-
);
|
|
668
|
-
return /* @__PURE__ */ React9.createElement(
|
|
669
|
-
InteractionDetails,
|
|
670
|
-
{
|
|
671
|
-
key: index,
|
|
672
|
-
interaction: value.value,
|
|
673
|
-
onChange: handleChange,
|
|
674
|
-
onPlayInteraction: handlePlayInteraction
|
|
675
|
-
}
|
|
676
|
-
);
|
|
677
|
-
};
|
|
678
701
|
|
|
679
702
|
// src/components/interactions-tab.tsx
|
|
680
703
|
var InteractionsTab = ({ elementId }) => {
|
|
681
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ React12.createElement(PopupStateProvider, null, /* @__PURE__ */ React12.createElement(InteractionsTabContent, { elementId }));
|
|
682
705
|
};
|
|
683
706
|
function InteractionsTabContent({ elementId }) {
|
|
684
707
|
const existingInteractions = useElementInteractions2(elementId);
|
|
685
708
|
const firstInteractionState = useState2(false);
|
|
686
709
|
const hasInteractions = existingInteractions?.items?.length || firstInteractionState[0];
|
|
687
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ React12.createElement(SessionStorageProvider, { prefix: elementId }, hasInteractions ? /* @__PURE__ */ React12.createElement(InteractionsProvider, { elementId }, /* @__PURE__ */ React12.createElement(InteractionsContent, { firstInteractionState })) : /* @__PURE__ */ React12.createElement(
|
|
688
711
|
EmptyState,
|
|
689
712
|
{
|
|
690
713
|
onCreateInteraction: () => {
|
|
@@ -697,7 +720,7 @@ function InteractionsContent({
|
|
|
697
720
|
firstInteractionState
|
|
698
721
|
}) {
|
|
699
722
|
const { interactions, setInteractions, playInteractions } = useInteractionsContext();
|
|
700
|
-
const applyInteraction =
|
|
723
|
+
const applyInteraction = useCallback5(
|
|
701
724
|
(newInteractions) => {
|
|
702
725
|
firstInteractionState[1](false);
|
|
703
726
|
if (!newInteractions) {
|
|
@@ -708,7 +731,7 @@ function InteractionsContent({
|
|
|
708
731
|
},
|
|
709
732
|
[setInteractions, firstInteractionState]
|
|
710
733
|
);
|
|
711
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ React12.createElement(Stack2, { sx: { m: 1, p: 1.5 }, gap: 2 }, /* @__PURE__ */ React12.createElement(
|
|
712
735
|
InteractionsList,
|
|
713
736
|
{
|
|
714
737
|
triggerCreateOnShowEmpty: firstInteractionState[0],
|
|
@@ -834,7 +857,7 @@ var documentElementsInteractionsProvider = createInteractionsProvider({
|
|
|
834
857
|
});
|
|
835
858
|
|
|
836
859
|
// src/components/controls/easing.tsx
|
|
837
|
-
import * as
|
|
860
|
+
import * as React13 from "react";
|
|
838
861
|
import { MenuListItem as MenuListItem2 } from "@elementor/editor-ui";
|
|
839
862
|
import { Select as Select2 } from "@elementor/ui";
|
|
840
863
|
import { __ as __7 } from "@wordpress/i18n";
|
|
@@ -853,15 +876,15 @@ function Easing({}) {
|
|
|
853
876
|
key,
|
|
854
877
|
label
|
|
855
878
|
}));
|
|
856
|
-
return /* @__PURE__ */
|
|
879
|
+
return /* @__PURE__ */ React13.createElement(Select2, { value: DEFAULT_EASING, onChange: () => {
|
|
857
880
|
}, fullWidth: true, displayEmpty: true, size: "tiny" }, availableOptions.map((option) => {
|
|
858
881
|
const isDisabled = DEFAULT_EASING !== option.key;
|
|
859
|
-
return /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ React13.createElement(MenuListItem2, { key: option.key, value: option.key, disabled: isDisabled }, option.label);
|
|
860
883
|
}));
|
|
861
884
|
}
|
|
862
885
|
|
|
863
886
|
// src/components/controls/trigger.tsx
|
|
864
|
-
import * as
|
|
887
|
+
import * as React14 from "react";
|
|
865
888
|
import { MenuListItem as MenuListItem3 } from "@elementor/editor-ui";
|
|
866
889
|
import { Select as Select3 } from "@elementor/ui";
|
|
867
890
|
import { __ as __8 } from "@wordpress/i18n";
|
|
@@ -873,7 +896,7 @@ function Trigger({ value, onChange }) {
|
|
|
873
896
|
key,
|
|
874
897
|
label
|
|
875
898
|
}));
|
|
876
|
-
return /* @__PURE__ */
|
|
899
|
+
return /* @__PURE__ */ React14.createElement(
|
|
877
900
|
Select3,
|
|
878
901
|
{
|
|
879
902
|
fullWidth: true,
|
|
@@ -883,7 +906,7 @@ function Trigger({ value, onChange }) {
|
|
|
883
906
|
value
|
|
884
907
|
},
|
|
885
908
|
availableTriggers.map((trigger) => {
|
|
886
|
-
return /* @__PURE__ */
|
|
909
|
+
return /* @__PURE__ */ React14.createElement(MenuListItem3, { key: trigger.key, value: trigger.key }, trigger.label);
|
|
887
910
|
})
|
|
888
911
|
);
|
|
889
912
|
}
|