@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.js
CHANGED
|
@@ -68,8 +68,8 @@ var EmptyState = ({ onCreateInteraction }) => {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// src/components/interactions-tab.tsx
|
|
71
|
-
var
|
|
72
|
-
var
|
|
71
|
+
var React12 = __toESM(require("react"));
|
|
72
|
+
var import_react9 = require("react");
|
|
73
73
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
74
74
|
var import_session = require("@elementor/session");
|
|
75
75
|
var import_ui5 = require("@elementor/ui");
|
|
@@ -130,13 +130,31 @@ var PopupStateProvider = ({ children }) => {
|
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
// src/components/interactions-list.tsx
|
|
133
|
-
var
|
|
134
|
-
var
|
|
133
|
+
var React11 = __toESM(require("react"));
|
|
134
|
+
var import_react8 = require("react");
|
|
135
135
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
136
136
|
var import_icons3 = require("@elementor/icons");
|
|
137
137
|
var import_ui4 = require("@elementor/ui");
|
|
138
138
|
var import_i18n6 = require("@wordpress/i18n");
|
|
139
139
|
|
|
140
|
+
// src/contexts/interactions-item-context.tsx
|
|
141
|
+
var React4 = __toESM(require("react"));
|
|
142
|
+
var import_react3 = require("react");
|
|
143
|
+
var InteractionItemContext = (0, import_react3.createContext)(null);
|
|
144
|
+
function InteractionItemContextProvider({
|
|
145
|
+
value,
|
|
146
|
+
children
|
|
147
|
+
}) {
|
|
148
|
+
return /* @__PURE__ */ React4.createElement(InteractionItemContext.Provider, { value }, children);
|
|
149
|
+
}
|
|
150
|
+
function useInteractionItemContext() {
|
|
151
|
+
const context = (0, import_react3.useContext)(InteractionItemContext);
|
|
152
|
+
if (!context) {
|
|
153
|
+
throw new Error("useInteractionItemContext must be used within InteractionItemContextProvider");
|
|
154
|
+
}
|
|
155
|
+
return context;
|
|
156
|
+
}
|
|
157
|
+
|
|
140
158
|
// src/utils/temp-id-utils.ts
|
|
141
159
|
var TEMP_ID_PREFIX = "temp-";
|
|
142
160
|
function generateTempInteractionId() {
|
|
@@ -278,9 +296,13 @@ var buildDisplayLabel = (item) => {
|
|
|
278
296
|
return `${triggerLabel}: ${effectLabel} ${typeLabel}`;
|
|
279
297
|
};
|
|
280
298
|
|
|
299
|
+
// src/components/interactions-list-item.tsx
|
|
300
|
+
var React10 = __toESM(require("react"));
|
|
301
|
+
var import_react7 = require("react");
|
|
302
|
+
|
|
281
303
|
// src/components/interaction-details.tsx
|
|
282
|
-
var
|
|
283
|
-
var
|
|
304
|
+
var React9 = __toESM(require("react"));
|
|
305
|
+
var import_react6 = require("react");
|
|
284
306
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
285
307
|
var import_ui3 = require("@elementor/ui");
|
|
286
308
|
var import_i18n5 = require("@wordpress/i18n");
|
|
@@ -299,46 +321,46 @@ function getInteractionsControl(type) {
|
|
|
299
321
|
}
|
|
300
322
|
|
|
301
323
|
// src/components/controls/direction.tsx
|
|
302
|
-
var
|
|
303
|
-
var
|
|
324
|
+
var React5 = __toESM(require("react"));
|
|
325
|
+
var import_react4 = require("react");
|
|
304
326
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
305
327
|
var import_icons2 = require("@elementor/icons");
|
|
306
328
|
var import_i18n2 = require("@wordpress/i18n");
|
|
307
329
|
function Direction({ value, onChange, interactionType }) {
|
|
308
|
-
const options = (0,
|
|
330
|
+
const options = (0, import_react4.useMemo)(() => {
|
|
309
331
|
const isIn = interactionType === "in";
|
|
310
332
|
return [
|
|
311
333
|
{
|
|
312
334
|
value: "top",
|
|
313
335
|
label: isIn ? (0, import_i18n2.__)("From top", "elementor") : (0, import_i18n2.__)("To top", "elementor"),
|
|
314
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
336
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowDownSmallIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowUpSmallIcon, { fontSize: size }),
|
|
315
337
|
showTooltip: true
|
|
316
338
|
},
|
|
317
339
|
{
|
|
318
340
|
value: "bottom",
|
|
319
341
|
label: interactionType === "in" ? (0, import_i18n2.__)("From bottom", "elementor") : (0, import_i18n2.__)("To bottom", "elementor"),
|
|
320
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
342
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowUpSmallIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowDownSmallIcon, { fontSize: size }),
|
|
321
343
|
showTooltip: true
|
|
322
344
|
},
|
|
323
345
|
{
|
|
324
346
|
value: "left",
|
|
325
347
|
label: interactionType === "in" ? (0, import_i18n2.__)("From left", "elementor") : (0, import_i18n2.__)("To left", "elementor"),
|
|
326
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
348
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowRightIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowLeftIcon, { fontSize: size }),
|
|
327
349
|
showTooltip: true
|
|
328
350
|
},
|
|
329
351
|
{
|
|
330
352
|
value: "right",
|
|
331
353
|
label: interactionType === "in" ? (0, import_i18n2.__)("From right", "elementor") : (0, import_i18n2.__)("To right", "elementor"),
|
|
332
|
-
renderContent: ({ size }) => isIn ? /* @__PURE__ */
|
|
354
|
+
renderContent: ({ size }) => isIn ? /* @__PURE__ */ React5.createElement(import_icons2.ArrowLeftIcon, { fontSize: size }) : /* @__PURE__ */ React5.createElement(import_icons2.ArrowRightIcon, { fontSize: size }),
|
|
333
355
|
showTooltip: true
|
|
334
356
|
}
|
|
335
357
|
];
|
|
336
358
|
}, [interactionType]);
|
|
337
|
-
return /* @__PURE__ */
|
|
359
|
+
return /* @__PURE__ */ React5.createElement(import_editor_controls.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
|
|
338
360
|
}
|
|
339
361
|
|
|
340
362
|
// src/components/controls/effect.tsx
|
|
341
|
-
var
|
|
363
|
+
var React6 = __toESM(require("react"));
|
|
342
364
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
343
365
|
var import_ui2 = require("@elementor/ui");
|
|
344
366
|
var import_i18n3 = require("@wordpress/i18n");
|
|
@@ -348,7 +370,7 @@ function Effect({ value, onChange }) {
|
|
|
348
370
|
{ key: "slide", label: (0, import_i18n3.__)("Slide", "elementor") },
|
|
349
371
|
{ key: "scale", label: (0, import_i18n3.__)("Scale", "elementor") }
|
|
350
372
|
];
|
|
351
|
-
return /* @__PURE__ */
|
|
373
|
+
return /* @__PURE__ */ React6.createElement(
|
|
352
374
|
import_ui2.Select,
|
|
353
375
|
{
|
|
354
376
|
fullWidth: true,
|
|
@@ -358,13 +380,13 @@ function Effect({ value, onChange }) {
|
|
|
358
380
|
onChange: (event) => onChange(event.target.value)
|
|
359
381
|
},
|
|
360
382
|
availableEffects.map((effect) => {
|
|
361
|
-
return /* @__PURE__ */
|
|
383
|
+
return /* @__PURE__ */ React6.createElement(import_editor_ui.MenuListItem, { key: effect.key, value: effect.key }, effect.label);
|
|
362
384
|
})
|
|
363
385
|
);
|
|
364
386
|
}
|
|
365
387
|
|
|
366
388
|
// src/components/controls/effect-type.tsx
|
|
367
|
-
var
|
|
389
|
+
var React7 = __toESM(require("react"));
|
|
368
390
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
369
391
|
var import_i18n4 = require("@wordpress/i18n");
|
|
370
392
|
function EffectType({ value, onChange }) {
|
|
@@ -382,18 +404,18 @@ function EffectType({ value, onChange }) {
|
|
|
382
404
|
showTooltip: true
|
|
383
405
|
}
|
|
384
406
|
];
|
|
385
|
-
return /* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ React7.createElement(import_editor_controls2.ToggleButtonGroupUi, { items: options, exclusive: true, onChange, value });
|
|
386
408
|
}
|
|
387
409
|
|
|
388
410
|
// src/components/controls/time-frame-indicator.tsx
|
|
389
|
-
var
|
|
390
|
-
var
|
|
411
|
+
var React8 = __toESM(require("react"));
|
|
412
|
+
var import_react5 = require("react");
|
|
391
413
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
392
414
|
var import_editor_props = require("@elementor/editor-props");
|
|
393
415
|
var DEFAULT_UNIT = "ms";
|
|
394
416
|
function TimeFrameIndicator({ value, onChange, defaultValue }) {
|
|
395
417
|
const sizeValue = toSizeValue(value ?? defaultValue);
|
|
396
|
-
const setValue = (0,
|
|
418
|
+
const setValue = (0, import_react5.useCallback)(
|
|
397
419
|
(size) => {
|
|
398
420
|
onChange(String(size));
|
|
399
421
|
},
|
|
@@ -407,7 +429,7 @@ function TimeFrameIndicator({ value, onChange, defaultValue }) {
|
|
|
407
429
|
setValue(defaultValue);
|
|
408
430
|
}
|
|
409
431
|
};
|
|
410
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ React8.createElement(
|
|
411
433
|
import_editor_controls3.UnstableSizeField,
|
|
412
434
|
{
|
|
413
435
|
units: [DEFAULT_UNIT],
|
|
@@ -459,7 +481,7 @@ var controlVisibilityConfig = {
|
|
|
459
481
|
}
|
|
460
482
|
};
|
|
461
483
|
function useControlComponent(controlName, isVisible = true) {
|
|
462
|
-
return (0,
|
|
484
|
+
return (0, import_react6.useMemo)(() => {
|
|
463
485
|
if (!isVisible) {
|
|
464
486
|
return null;
|
|
465
487
|
}
|
|
@@ -540,53 +562,53 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
540
562
|
onPlayInteraction(interactionId);
|
|
541
563
|
}, 0);
|
|
542
564
|
};
|
|
543
|
-
return /* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ React9.createElement(import_editor_controls4.PopoverContent, { p: 1.5 }, /* @__PURE__ */ React9.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, TriggerControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Trigger", "elementor") }, /* @__PURE__ */ React9.createElement(TriggerControl, { value: trigger, onChange: (v) => updateInteraction({ trigger: v }) })), ReplayControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Replay", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
544
566
|
ReplayControl,
|
|
545
567
|
{
|
|
546
568
|
value: replay,
|
|
547
569
|
onChange: (v) => updateInteraction({ replay: v }),
|
|
548
570
|
disabled: true
|
|
549
571
|
}
|
|
550
|
-
))), /* @__PURE__ */
|
|
572
|
+
))), /* @__PURE__ */ React9.createElement(import_ui3.Divider, null), /* @__PURE__ */ React9.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Effect", "elementor") }, /* @__PURE__ */ React9.createElement(Effect, { value: effect, onChange: (v) => updateInteraction({ effect: v }) })), /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Type", "elementor") }, /* @__PURE__ */ React9.createElement(EffectType, { value: type, onChange: (v) => updateInteraction({ type: v }) })), /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Direction", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
551
573
|
Direction,
|
|
552
574
|
{
|
|
553
575
|
value: direction,
|
|
554
576
|
onChange: (v) => updateInteraction({ direction: v }),
|
|
555
577
|
interactionType: type
|
|
556
578
|
}
|
|
557
|
-
)), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */
|
|
579
|
+
)), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Duration", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
558
580
|
TimeFrameIndicator,
|
|
559
581
|
{
|
|
560
582
|
value: String(duration),
|
|
561
583
|
onChange: (v) => updateInteraction({ duration: parseInt(v, 10) }),
|
|
562
584
|
defaultValue: DEFAULT_VALUES.duration
|
|
563
585
|
}
|
|
564
|
-
)), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */
|
|
586
|
+
)), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Delay", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
565
587
|
TimeFrameIndicator,
|
|
566
588
|
{
|
|
567
589
|
value: String(delay),
|
|
568
590
|
onChange: (v) => updateInteraction({ delay: parseInt(v, 10) }),
|
|
569
591
|
defaultValue: DEFAULT_VALUES.delay
|
|
570
592
|
}
|
|
571
|
-
))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */
|
|
593
|
+
))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(import_ui3.Divider, null), /* @__PURE__ */ React9.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Relative To", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
572
594
|
RelativeToControl,
|
|
573
595
|
{
|
|
574
596
|
value: relativeTo,
|
|
575
597
|
onChange: (v) => updateInteraction({ relativeTo: v })
|
|
576
598
|
}
|
|
577
|
-
)), OffsetTopControl && /* @__PURE__ */
|
|
599
|
+
)), OffsetTopControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Offset Top", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
578
600
|
OffsetTopControl,
|
|
579
601
|
{
|
|
580
602
|
value: String(offsetTop),
|
|
581
603
|
onChange: (v) => updateInteraction({ offsetTop: parseInt(v, 10) })
|
|
582
604
|
}
|
|
583
|
-
)), OffsetBottomControl && /* @__PURE__ */
|
|
605
|
+
)), OffsetBottomControl && /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Offset Bottom", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
584
606
|
OffsetBottomControl,
|
|
585
607
|
{
|
|
586
608
|
value: String(offsetBottom),
|
|
587
609
|
onChange: (v) => updateInteraction({ offsetBottom: parseInt(v, 10) })
|
|
588
610
|
}
|
|
589
|
-
))), /* @__PURE__ */
|
|
611
|
+
))), /* @__PURE__ */ React9.createElement(import_ui3.Divider, null)), EasingControl && /* @__PURE__ */ React9.createElement(import_ui3.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React9.createElement(Field, { label: (0, import_i18n5.__)("Easing", "elementor") }, /* @__PURE__ */ React9.createElement(
|
|
590
612
|
EasingControl,
|
|
591
613
|
{
|
|
592
614
|
value: easing,
|
|
@@ -597,22 +619,47 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
597
619
|
))));
|
|
598
620
|
};
|
|
599
621
|
function Field({ label, children }) {
|
|
600
|
-
return /* @__PURE__ */
|
|
622
|
+
return /* @__PURE__ */ React9.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(import_editor_controls4.PopoverGridContainer, null, /* @__PURE__ */ React9.createElement(import_ui3.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React9.createElement(import_editor_controls4.ControlFormLabel, null, label)), /* @__PURE__ */ React9.createElement(import_ui3.Grid, { item: true, xs: 6 }, children)));
|
|
601
623
|
}
|
|
602
624
|
|
|
625
|
+
// src/components/interactions-list-item.tsx
|
|
626
|
+
var InteractionsListItem = ({ index, value }) => {
|
|
627
|
+
const context = useInteractionItemContext();
|
|
628
|
+
const handleChange = (0, import_react7.useCallback)(
|
|
629
|
+
(newInteractionValue) => {
|
|
630
|
+
context?.onInteractionChange(index, newInteractionValue);
|
|
631
|
+
},
|
|
632
|
+
[context, index]
|
|
633
|
+
);
|
|
634
|
+
const handlePlayInteraction = (0, import_react7.useCallback)(
|
|
635
|
+
(interactionId) => {
|
|
636
|
+
context?.onPlayInteraction(interactionId);
|
|
637
|
+
},
|
|
638
|
+
[context]
|
|
639
|
+
);
|
|
640
|
+
return /* @__PURE__ */ React10.createElement(
|
|
641
|
+
InteractionDetails,
|
|
642
|
+
{
|
|
643
|
+
key: index,
|
|
644
|
+
interaction: value.value,
|
|
645
|
+
onChange: handleChange,
|
|
646
|
+
onPlayInteraction: handlePlayInteraction
|
|
647
|
+
}
|
|
648
|
+
);
|
|
649
|
+
};
|
|
650
|
+
|
|
603
651
|
// src/components/interactions-list.tsx
|
|
604
652
|
var MAX_NUMBER_OF_INTERACTIONS = 5;
|
|
605
|
-
var InteractionItemContext = (0, import_react6.createContext)(null);
|
|
606
653
|
function InteractionsList(props) {
|
|
607
654
|
const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props;
|
|
608
|
-
const hasInitializedRef = (0,
|
|
609
|
-
const handleUpdateInteractions = (0,
|
|
655
|
+
const hasInitializedRef = (0, import_react8.useRef)(false);
|
|
656
|
+
const handleUpdateInteractions = (0, import_react8.useCallback)(
|
|
610
657
|
(newInteractions) => {
|
|
611
658
|
onSelectInteractions(newInteractions);
|
|
612
659
|
},
|
|
613
660
|
[onSelectInteractions]
|
|
614
661
|
);
|
|
615
|
-
(0,
|
|
662
|
+
(0, import_react8.useEffect)(() => {
|
|
616
663
|
if (triggerCreateOnShowEmpty && !hasInitializedRef.current && (!interactions.items || interactions.items?.length === 0)) {
|
|
617
664
|
hasInitializedRef.current = true;
|
|
618
665
|
const newState = {
|
|
@@ -622,14 +669,14 @@ function InteractionsList(props) {
|
|
|
622
669
|
handleUpdateInteractions(newState);
|
|
623
670
|
}
|
|
624
671
|
}, [triggerCreateOnShowEmpty, interactions.items, handleUpdateInteractions]);
|
|
625
|
-
const isMaxNumberOfInteractionsReached = (0,
|
|
672
|
+
const isMaxNumberOfInteractionsReached = (0, import_react8.useMemo)(() => {
|
|
626
673
|
return interactions.items?.length >= MAX_NUMBER_OF_INTERACTIONS;
|
|
627
674
|
}, [interactions.items?.length]);
|
|
628
|
-
const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */
|
|
675
|
+
const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ React11.createElement(import_ui4.Alert, { color: "secondary", icon: /* @__PURE__ */ React11.createElement(import_icons3.InfoCircleFilledIcon, null), size: "small" }, /* @__PURE__ */ React11.createElement(import_ui4.AlertTitle, null, (0, import_i18n6.__)("Interactions", "elementor")), /* @__PURE__ */ React11.createElement(import_ui4.Box, { component: "span" }, (0, import_i18n6.__)(
|
|
629
676
|
"You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.",
|
|
630
677
|
"elementor"
|
|
631
678
|
))) : void 0;
|
|
632
|
-
const handleRepeaterChange = (0,
|
|
679
|
+
const handleRepeaterChange = (0, import_react8.useCallback)(
|
|
633
680
|
(newItems) => {
|
|
634
681
|
handleUpdateInteractions({
|
|
635
682
|
...interactions,
|
|
@@ -638,7 +685,7 @@ function InteractionsList(props) {
|
|
|
638
685
|
},
|
|
639
686
|
[interactions, handleUpdateInteractions]
|
|
640
687
|
);
|
|
641
|
-
const handleInteractionChange = (0,
|
|
688
|
+
const handleInteractionChange = (0, import_react8.useCallback)(
|
|
642
689
|
(index, newInteractionValue) => {
|
|
643
690
|
const newItems = structuredClone(interactions.items);
|
|
644
691
|
newItems[index] = {
|
|
@@ -652,14 +699,14 @@ function InteractionsList(props) {
|
|
|
652
699
|
},
|
|
653
700
|
[interactions, handleUpdateInteractions]
|
|
654
701
|
);
|
|
655
|
-
const contextValue = (0,
|
|
702
|
+
const contextValue = (0, import_react8.useMemo)(
|
|
656
703
|
() => ({
|
|
657
704
|
onInteractionChange: handleInteractionChange,
|
|
658
705
|
onPlayInteraction
|
|
659
706
|
}),
|
|
660
707
|
[handleInteractionChange, onPlayInteraction]
|
|
661
708
|
);
|
|
662
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ React11.createElement(InteractionItemContextProvider, { value: contextValue }, /* @__PURE__ */ React11.createElement(
|
|
663
710
|
import_editor_controls5.Repeater,
|
|
664
711
|
{
|
|
665
712
|
openOnAdd: true,
|
|
@@ -676,54 +723,30 @@ function InteractionsList(props) {
|
|
|
676
723
|
initialValues: createDefaultInteractionItem(),
|
|
677
724
|
Label: ({ value }) => buildDisplayLabel(value.value),
|
|
678
725
|
Icon: () => null,
|
|
679
|
-
Content,
|
|
680
|
-
actions: (value) => /* @__PURE__ */
|
|
726
|
+
Content: InteractionsListItem,
|
|
727
|
+
actions: (value) => /* @__PURE__ */ React11.createElement(import_ui4.Tooltip, { key: "preview", placement: "top", title: (0, import_i18n6.__)("Preview", "elementor") }, /* @__PURE__ */ React11.createElement(
|
|
681
728
|
import_ui4.IconButton,
|
|
682
729
|
{
|
|
683
730
|
"aria-label": (0, import_i18n6.__)("Play interaction", "elementor"),
|
|
684
731
|
size: "tiny",
|
|
685
732
|
onClick: () => onPlayInteraction(extractString(value.value.interaction_id))
|
|
686
733
|
},
|
|
687
|
-
/* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ React11.createElement(import_icons3.PlayerPlayIcon, { fontSize: "tiny" })
|
|
688
735
|
))
|
|
689
736
|
}
|
|
690
737
|
}
|
|
691
738
|
));
|
|
692
739
|
}
|
|
693
|
-
var Content = ({ index, value }) => {
|
|
694
|
-
const context = (0, import_react6.useContext)(InteractionItemContext);
|
|
695
|
-
const handleChange = (0, import_react6.useCallback)(
|
|
696
|
-
(newInteractionValue) => {
|
|
697
|
-
context?.onInteractionChange(index, newInteractionValue);
|
|
698
|
-
},
|
|
699
|
-
[context, index]
|
|
700
|
-
);
|
|
701
|
-
const handlePlayInteraction = (0, import_react6.useCallback)(
|
|
702
|
-
(interactionId) => {
|
|
703
|
-
context?.onPlayInteraction(interactionId);
|
|
704
|
-
},
|
|
705
|
-
[context]
|
|
706
|
-
);
|
|
707
|
-
return /* @__PURE__ */ React9.createElement(
|
|
708
|
-
InteractionDetails,
|
|
709
|
-
{
|
|
710
|
-
key: index,
|
|
711
|
-
interaction: value.value,
|
|
712
|
-
onChange: handleChange,
|
|
713
|
-
onPlayInteraction: handlePlayInteraction
|
|
714
|
-
}
|
|
715
|
-
);
|
|
716
|
-
};
|
|
717
740
|
|
|
718
741
|
// src/components/interactions-tab.tsx
|
|
719
742
|
var InteractionsTab = ({ elementId }) => {
|
|
720
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ React12.createElement(PopupStateProvider, null, /* @__PURE__ */ React12.createElement(InteractionsTabContent, { elementId }));
|
|
721
744
|
};
|
|
722
745
|
function InteractionsTabContent({ elementId }) {
|
|
723
746
|
const existingInteractions = (0, import_editor_elements2.useElementInteractions)(elementId);
|
|
724
|
-
const firstInteractionState = (0,
|
|
747
|
+
const firstInteractionState = (0, import_react9.useState)(false);
|
|
725
748
|
const hasInteractions = existingInteractions?.items?.length || firstInteractionState[0];
|
|
726
|
-
return /* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ React12.createElement(import_session.SessionStorageProvider, { prefix: elementId }, hasInteractions ? /* @__PURE__ */ React12.createElement(InteractionsProvider, { elementId }, /* @__PURE__ */ React12.createElement(InteractionsContent, { firstInteractionState })) : /* @__PURE__ */ React12.createElement(
|
|
727
750
|
EmptyState,
|
|
728
751
|
{
|
|
729
752
|
onCreateInteraction: () => {
|
|
@@ -736,7 +759,7 @@ function InteractionsContent({
|
|
|
736
759
|
firstInteractionState
|
|
737
760
|
}) {
|
|
738
761
|
const { interactions, setInteractions, playInteractions } = useInteractionsContext();
|
|
739
|
-
const applyInteraction = (0,
|
|
762
|
+
const applyInteraction = (0, import_react9.useCallback)(
|
|
740
763
|
(newInteractions) => {
|
|
741
764
|
firstInteractionState[1](false);
|
|
742
765
|
if (!newInteractions) {
|
|
@@ -747,7 +770,7 @@ function InteractionsContent({
|
|
|
747
770
|
},
|
|
748
771
|
[setInteractions, firstInteractionState]
|
|
749
772
|
);
|
|
750
|
-
return /* @__PURE__ */
|
|
773
|
+
return /* @__PURE__ */ React12.createElement(import_ui5.Stack, { sx: { m: 1, p: 1.5 }, gap: 2 }, /* @__PURE__ */ React12.createElement(
|
|
751
774
|
InteractionsList,
|
|
752
775
|
{
|
|
753
776
|
triggerCreateOnShowEmpty: firstInteractionState[0],
|
|
@@ -873,7 +896,7 @@ var documentElementsInteractionsProvider = createInteractionsProvider({
|
|
|
873
896
|
});
|
|
874
897
|
|
|
875
898
|
// src/components/controls/easing.tsx
|
|
876
|
-
var
|
|
899
|
+
var React13 = __toESM(require("react"));
|
|
877
900
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
878
901
|
var import_ui6 = require("@elementor/ui");
|
|
879
902
|
var import_i18n7 = require("@wordpress/i18n");
|
|
@@ -892,15 +915,15 @@ function Easing({}) {
|
|
|
892
915
|
key,
|
|
893
916
|
label
|
|
894
917
|
}));
|
|
895
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ React13.createElement(import_ui6.Select, { value: DEFAULT_EASING, onChange: () => {
|
|
896
919
|
}, fullWidth: true, displayEmpty: true, size: "tiny" }, availableOptions.map((option) => {
|
|
897
920
|
const isDisabled = DEFAULT_EASING !== option.key;
|
|
898
|
-
return /* @__PURE__ */
|
|
921
|
+
return /* @__PURE__ */ React13.createElement(import_editor_ui2.MenuListItem, { key: option.key, value: option.key, disabled: isDisabled }, option.label);
|
|
899
922
|
}));
|
|
900
923
|
}
|
|
901
924
|
|
|
902
925
|
// src/components/controls/trigger.tsx
|
|
903
|
-
var
|
|
926
|
+
var React14 = __toESM(require("react"));
|
|
904
927
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
905
928
|
var import_ui7 = require("@elementor/ui");
|
|
906
929
|
var import_i18n8 = require("@wordpress/i18n");
|
|
@@ -912,7 +935,7 @@ function Trigger({ value, onChange }) {
|
|
|
912
935
|
key,
|
|
913
936
|
label
|
|
914
937
|
}));
|
|
915
|
-
return /* @__PURE__ */
|
|
938
|
+
return /* @__PURE__ */ React14.createElement(
|
|
916
939
|
import_ui7.Select,
|
|
917
940
|
{
|
|
918
941
|
fullWidth: true,
|
|
@@ -922,7 +945,7 @@ function Trigger({ value, onChange }) {
|
|
|
922
945
|
value
|
|
923
946
|
},
|
|
924
947
|
availableTriggers.map((trigger) => {
|
|
925
|
-
return /* @__PURE__ */
|
|
948
|
+
return /* @__PURE__ */ React14.createElement(import_editor_ui3.MenuListItem, { key: trigger.key, value: trigger.key }, trigger.label);
|
|
926
949
|
})
|
|
927
950
|
);
|
|
928
951
|
}
|