@elementor/editor-interactions 3.33.0-224
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 +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +417 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +376 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +54 -0
- package/src/components/controls/direction.tsx +43 -0
- package/src/components/controls/effect-type.tsx +40 -0
- package/src/components/controls/effect.tsx +40 -0
- package/src/components/controls/time-frame-indicator.tsx +43 -0
- package/src/components/controls/trigger.tsx +44 -0
- package/src/components/empty-state.tsx +34 -0
- package/src/components/header.tsx +22 -0
- package/src/components/interaction-details.tsx +71 -0
- package/src/components/interactions-list.tsx +113 -0
- package/src/contexts/popup-state-contex.tsx +36 -0
- package/src/index.ts +5 -0
- package/src/types.ts +23 -0
- package/src/utils/format-interaction-label.ts +32 -0
- package/src/utils/get-interactions-config.ts +16 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
// src/components/empty-state.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { SwipeIcon } from "@elementor/icons";
|
|
4
|
+
import { Button, Stack, Typography } from "@elementor/ui";
|
|
5
|
+
import { __ } from "@wordpress/i18n";
|
|
6
|
+
var EmptyState = ({ onCreateInteraction }) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
Stack,
|
|
9
|
+
{
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
height: "100%",
|
|
13
|
+
color: "text.secondary",
|
|
14
|
+
sx: { p: 2.5, pt: 8, pb: 5.5 },
|
|
15
|
+
gap: 1.5
|
|
16
|
+
},
|
|
17
|
+
/* @__PURE__ */ React.createElement(SwipeIcon, { fontSize: "large" }),
|
|
18
|
+
/* @__PURE__ */ React.createElement(Typography, { align: "center", variant: "subtitle2" }, __("Animate elements with Interactions", "elementor")),
|
|
19
|
+
/* @__PURE__ */ React.createElement(Typography, { align: "center", variant: "caption", maxWidth: "170px" }, __(
|
|
20
|
+
"Add entrance animations and effects triggered by user interactions such as click, hover, or scroll.",
|
|
21
|
+
"elementor"
|
|
22
|
+
)),
|
|
23
|
+
/* @__PURE__ */ React.createElement(Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onCreateInteraction }, __("Create an interaction", "elementor"))
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/components/interactions-list.tsx
|
|
28
|
+
import * as React10 from "react";
|
|
29
|
+
import { useEffect as useEffect2, useId, useMemo, useRef, useState as useState3 } from "react";
|
|
30
|
+
import { EyeIcon, XIcon } from "@elementor/icons";
|
|
31
|
+
import { bindPopover, bindTrigger, IconButton as IconButton2, Popover, Stack as Stack3, UnstableTag, usePopupState } from "@elementor/ui";
|
|
32
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
33
|
+
|
|
34
|
+
// src/contexts/popup-state-contex.tsx
|
|
35
|
+
import * as React2 from "react";
|
|
36
|
+
import { createContext, useCallback, useContext, useState } from "react";
|
|
37
|
+
var PopupStateContext = createContext(void 0);
|
|
38
|
+
var PopupStateProvider = ({ children }) => {
|
|
39
|
+
const [openByDefault, setOpenByDefault] = useState(false);
|
|
40
|
+
const triggerDefaultOpen = useCallback(() => {
|
|
41
|
+
setOpenByDefault(true);
|
|
42
|
+
}, []);
|
|
43
|
+
const resetDefaultOpen = useCallback(() => {
|
|
44
|
+
setOpenByDefault(false);
|
|
45
|
+
}, []);
|
|
46
|
+
return /* @__PURE__ */ React2.createElement(PopupStateContext.Provider, { value: { openByDefault, triggerDefaultOpen, resetDefaultOpen } }, children);
|
|
47
|
+
};
|
|
48
|
+
var usePopupStateContext = () => {
|
|
49
|
+
const context = useContext(PopupStateContext);
|
|
50
|
+
if (!context) {
|
|
51
|
+
throw new Error("usePopupStateContext must be used within PopupStateProvider");
|
|
52
|
+
}
|
|
53
|
+
return context;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/utils/get-interactions-config.ts
|
|
57
|
+
var DEFAULT_CONFIG = {
|
|
58
|
+
constants: {
|
|
59
|
+
defaultDuration: 300,
|
|
60
|
+
defaultDelay: 0,
|
|
61
|
+
slideDistance: 100,
|
|
62
|
+
scaleStart: 0.5,
|
|
63
|
+
easing: "linear"
|
|
64
|
+
},
|
|
65
|
+
animationOptions: []
|
|
66
|
+
};
|
|
67
|
+
function getInteractionsConfig() {
|
|
68
|
+
return window.ElementorInteractionsConfig || DEFAULT_CONFIG;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/utils/format-interaction-label.ts
|
|
72
|
+
function formatInteractionLabel(animationId) {
|
|
73
|
+
if (!animationId) {
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
const [trigger, effect, type, direction, duration, delay] = animationId.split("-");
|
|
77
|
+
const baseValue = `${trigger}-${effect}-${type}-${direction || ""}`;
|
|
78
|
+
const animationOptions = getInteractionsConfig()?.animationOptions;
|
|
79
|
+
const option = animationOptions.find((opt) => opt.value === baseValue);
|
|
80
|
+
let label = option?.label || animationId;
|
|
81
|
+
if (duration || delay) {
|
|
82
|
+
const constants = getInteractionsConfig()?.constants;
|
|
83
|
+
const durationValue = duration || String(constants.defaultDuration);
|
|
84
|
+
const delayValue = delay || String(constants.defaultDelay);
|
|
85
|
+
label += ` (${durationValue}ms`;
|
|
86
|
+
if (delayValue !== "0") {
|
|
87
|
+
label += `, ${delayValue}ms delay`;
|
|
88
|
+
}
|
|
89
|
+
label += ")";
|
|
90
|
+
}
|
|
91
|
+
return label;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/components/header.tsx
|
|
95
|
+
import * as React3 from "react";
|
|
96
|
+
import { PlusIcon } from "@elementor/icons";
|
|
97
|
+
import { IconButton, Stack as Stack2, Typography as Typography2 } from "@elementor/ui";
|
|
98
|
+
var Header = ({ label }) => {
|
|
99
|
+
return /* @__PURE__ */ React3.createElement(
|
|
100
|
+
Stack2,
|
|
101
|
+
{
|
|
102
|
+
direction: "row",
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
justifyContent: "space-between",
|
|
105
|
+
gap: 1,
|
|
106
|
+
sx: { marginInlineEnd: -0.75, py: 0.25 }
|
|
107
|
+
},
|
|
108
|
+
/* @__PURE__ */ React3.createElement(Typography2, { component: "label", variant: "caption", color: "text.secondary", sx: { lineHeight: 1 } }, label),
|
|
109
|
+
/* @__PURE__ */ React3.createElement(IconButton, { size: "tiny", disabled: true }, /* @__PURE__ */ React3.createElement(PlusIcon, { fontSize: "tiny" }))
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// src/components/interaction-details.tsx
|
|
114
|
+
import * as React9 from "react";
|
|
115
|
+
import { useEffect, useState as useState2 } from "react";
|
|
116
|
+
import { Divider, Grid as Grid6 } from "@elementor/ui";
|
|
117
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
118
|
+
|
|
119
|
+
// src/components/controls/direction.tsx
|
|
120
|
+
import * as React4 from "react";
|
|
121
|
+
import { ArrowDownSmallIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpSmallIcon } from "@elementor/icons";
|
|
122
|
+
import { Grid, ToggleButton, ToggleButtonGroup, Tooltip, Typography as Typography3 } from "@elementor/ui";
|
|
123
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
124
|
+
function Direction({ value, onChange }) {
|
|
125
|
+
const availableDirections = [
|
|
126
|
+
{ key: "top", label: __2("Up", "elementor"), icon: /* @__PURE__ */ React4.createElement(ArrowUpSmallIcon, { fontSize: "tiny" }) },
|
|
127
|
+
{ key: "bottom", label: __2("Down", "elementor"), icon: /* @__PURE__ */ React4.createElement(ArrowDownSmallIcon, { fontSize: "tiny" }) },
|
|
128
|
+
{ key: "left", label: __2("Left", "elementor"), icon: /* @__PURE__ */ React4.createElement(ArrowLeftIcon, { fontSize: "tiny" }) },
|
|
129
|
+
{ key: "right", label: __2("Right", "elementor"), icon: /* @__PURE__ */ React4.createElement(ArrowRightIcon, { fontSize: "tiny" }) }
|
|
130
|
+
];
|
|
131
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React4.createElement(Typography3, { variant: "caption", color: "text.secondary" }, __2("Direction", "elementor"))), /* @__PURE__ */ React4.createElement(Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React4.createElement(
|
|
132
|
+
ToggleButtonGroup,
|
|
133
|
+
{
|
|
134
|
+
size: "tiny",
|
|
135
|
+
exclusive: true,
|
|
136
|
+
onChange: (event, newValue) => onChange(newValue),
|
|
137
|
+
value
|
|
138
|
+
},
|
|
139
|
+
availableDirections.map((direction) => {
|
|
140
|
+
return /* @__PURE__ */ React4.createElement(Tooltip, { key: direction.key, title: direction.label, placement: "top" }, /* @__PURE__ */ React4.createElement(ToggleButton, { key: direction.key, value: direction.key }, direction.icon));
|
|
141
|
+
})
|
|
142
|
+
)));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/components/controls/effect.tsx
|
|
146
|
+
import * as React5 from "react";
|
|
147
|
+
import { MenuListItem } from "@elementor/editor-ui";
|
|
148
|
+
import { Grid as Grid2, Select, Typography as Typography4 } from "@elementor/ui";
|
|
149
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
150
|
+
function Effect({ value, onChange }) {
|
|
151
|
+
const availableEffects = [
|
|
152
|
+
{ key: "fade", label: __3("Fade", "elementor") },
|
|
153
|
+
{ key: "slide", label: __3("Slide", "elementor") },
|
|
154
|
+
{ key: "scale", label: __3("Scale", "elementor") }
|
|
155
|
+
];
|
|
156
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Grid2, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React5.createElement(Typography4, { variant: "caption", color: "text.secondary" }, __3("Effect", "elementor"))), /* @__PURE__ */ React5.createElement(Grid2, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React5.createElement(
|
|
157
|
+
Select,
|
|
158
|
+
{
|
|
159
|
+
fullWidth: true,
|
|
160
|
+
displayEmpty: true,
|
|
161
|
+
size: "tiny",
|
|
162
|
+
value,
|
|
163
|
+
onChange: (event) => onChange(event.target.value)
|
|
164
|
+
},
|
|
165
|
+
availableEffects.map((effect) => {
|
|
166
|
+
return /* @__PURE__ */ React5.createElement(MenuListItem, { key: effect.key, value: effect.key }, effect.label);
|
|
167
|
+
})
|
|
168
|
+
)));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/components/controls/effect-type.tsx
|
|
172
|
+
import * as React6 from "react";
|
|
173
|
+
import { Grid as Grid3, ToggleButton as ToggleButton2, ToggleButtonGroup as ToggleButtonGroup2, Tooltip as Tooltip2, Typography as Typography5 } from "@elementor/ui";
|
|
174
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
175
|
+
function EffectType({ value, onChange }) {
|
|
176
|
+
const availableEffectTypes = [
|
|
177
|
+
{ key: "in", label: __4("In", "elementor") },
|
|
178
|
+
{ key: "out", label: __4("Out", "elementor") }
|
|
179
|
+
];
|
|
180
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(Grid3, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React6.createElement(Typography5, { variant: "caption", color: "text.secondary" }, __4("Type", "elementor"))), /* @__PURE__ */ React6.createElement(Grid3, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React6.createElement(
|
|
181
|
+
ToggleButtonGroup2,
|
|
182
|
+
{
|
|
183
|
+
size: "tiny",
|
|
184
|
+
exclusive: true,
|
|
185
|
+
onChange: (event, newValue) => onChange(newValue),
|
|
186
|
+
value
|
|
187
|
+
},
|
|
188
|
+
availableEffectTypes.map((effectType) => {
|
|
189
|
+
return /* @__PURE__ */ React6.createElement(Tooltip2, { key: effectType.key, title: effectType.label, placement: "top" }, /* @__PURE__ */ React6.createElement(ToggleButton2, { key: effectType.key, value: effectType.key }, effectType.label));
|
|
190
|
+
})
|
|
191
|
+
)));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/components/controls/time-frame-indicator.tsx
|
|
195
|
+
import * as React7 from "react";
|
|
196
|
+
import { MenuListItem as MenuListItem2 } from "@elementor/editor-ui";
|
|
197
|
+
import { Grid as Grid4, Select as Select2, Typography as Typography6 } from "@elementor/ui";
|
|
198
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
199
|
+
function TimeFrameIndicator({ value, onChange, label }) {
|
|
200
|
+
const availableTimeFrames = ["0", "100", "200", "300", "400", "500", "750", "1000", "1250", "1500"].map(
|
|
201
|
+
(key) => ({
|
|
202
|
+
key,
|
|
203
|
+
// translators: %s: time in milliseconds
|
|
204
|
+
label: __5("%s MS", "elementor").replace("%s", key)
|
|
205
|
+
})
|
|
206
|
+
);
|
|
207
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Grid4, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React7.createElement(Typography6, { variant: "caption", color: "text.secondary" }, label)), /* @__PURE__ */ React7.createElement(Grid4, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React7.createElement(
|
|
208
|
+
Select2,
|
|
209
|
+
{
|
|
210
|
+
fullWidth: true,
|
|
211
|
+
displayEmpty: true,
|
|
212
|
+
size: "tiny",
|
|
213
|
+
value,
|
|
214
|
+
onChange: (event) => onChange(event.target.value)
|
|
215
|
+
},
|
|
216
|
+
availableTimeFrames.map((timeFrame) => {
|
|
217
|
+
return /* @__PURE__ */ React7.createElement(MenuListItem2, { key: timeFrame.key, value: timeFrame.key }, timeFrame.label);
|
|
218
|
+
})
|
|
219
|
+
)));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// src/components/controls/trigger.tsx
|
|
223
|
+
import * as React8 from "react";
|
|
224
|
+
import { MenuListItem as MenuListItem3 } from "@elementor/editor-ui";
|
|
225
|
+
import { Grid as Grid5, Select as Select3, Typography as Typography7 } from "@elementor/ui";
|
|
226
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
227
|
+
function Trigger({ value, onChange }) {
|
|
228
|
+
const availableTriggers = Object.entries({
|
|
229
|
+
load: __6("Page load", "elementor"),
|
|
230
|
+
scrollIn: __6("Scroll into view", "elementor"),
|
|
231
|
+
scrollOut: __6("Scroll out of view", "elementor")
|
|
232
|
+
}).map(([key, label]) => ({
|
|
233
|
+
key,
|
|
234
|
+
label
|
|
235
|
+
}));
|
|
236
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(Grid5, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React8.createElement(Typography7, { variant: "caption", color: "text.secondary" }, __6("Trigger", "elementor"))), /* @__PURE__ */ React8.createElement(Grid5, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React8.createElement(
|
|
237
|
+
Select3,
|
|
238
|
+
{
|
|
239
|
+
fullWidth: true,
|
|
240
|
+
displayEmpty: true,
|
|
241
|
+
size: "tiny",
|
|
242
|
+
onChange: (event) => onChange(event.target.value),
|
|
243
|
+
value
|
|
244
|
+
},
|
|
245
|
+
availableTriggers.map((trigger) => {
|
|
246
|
+
return /* @__PURE__ */ React8.createElement(MenuListItem3, { key: trigger.key, value: trigger.key }, trigger.label);
|
|
247
|
+
})
|
|
248
|
+
)));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/components/interaction-details.tsx
|
|
252
|
+
var DELIMITER = "-";
|
|
253
|
+
var InteractionDetails = ({ interaction, onChange }) => {
|
|
254
|
+
const [interactionDetails, setInteractionDetails] = useState2(() => {
|
|
255
|
+
const [trigger, effect, type, direction, duration, delay] = interaction.split(DELIMITER);
|
|
256
|
+
return {
|
|
257
|
+
trigger: trigger || "load",
|
|
258
|
+
effect: effect || "fade",
|
|
259
|
+
type: type || "in",
|
|
260
|
+
direction: direction || "",
|
|
261
|
+
duration: duration || "300",
|
|
262
|
+
delay: delay || "0"
|
|
263
|
+
};
|
|
264
|
+
});
|
|
265
|
+
useEffect(() => {
|
|
266
|
+
const newValue = Object.values(interactionDetails).join(DELIMITER);
|
|
267
|
+
onChange(newValue);
|
|
268
|
+
}, [interactionDetails, onChange]);
|
|
269
|
+
const handleChange = (key, value) => {
|
|
270
|
+
setInteractionDetails((prev) => ({ ...prev, [key]: value }));
|
|
271
|
+
};
|
|
272
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(Grid6, { container: true, spacing: 2, sx: { width: "300px", p: 1 } }, /* @__PURE__ */ React9.createElement(Trigger, { value: interactionDetails.trigger, onChange: (v) => handleChange("trigger", v) })), /* @__PURE__ */ React9.createElement(Divider, null), /* @__PURE__ */ React9.createElement(Grid6, { container: true, spacing: 2, sx: { width: "300px", p: 1 } }, /* @__PURE__ */ React9.createElement(Effect, { value: interactionDetails.effect, onChange: (v) => handleChange("effect", v) }), /* @__PURE__ */ React9.createElement(EffectType, { value: interactionDetails.type, onChange: (v) => handleChange("type", v) }), /* @__PURE__ */ React9.createElement(
|
|
273
|
+
Direction,
|
|
274
|
+
{
|
|
275
|
+
value: interactionDetails.direction ?? "",
|
|
276
|
+
onChange: (v) => handleChange("direction", v)
|
|
277
|
+
}
|
|
278
|
+
), /* @__PURE__ */ React9.createElement(
|
|
279
|
+
TimeFrameIndicator,
|
|
280
|
+
{
|
|
281
|
+
value: interactionDetails.duration,
|
|
282
|
+
onChange: (v) => handleChange("duration", v),
|
|
283
|
+
label: __7("Duration", "elementor")
|
|
284
|
+
}
|
|
285
|
+
), /* @__PURE__ */ React9.createElement(
|
|
286
|
+
TimeFrameIndicator,
|
|
287
|
+
{
|
|
288
|
+
value: interactionDetails.delay,
|
|
289
|
+
onChange: (v) => handleChange("delay", v),
|
|
290
|
+
label: __7("Delay", "elementor")
|
|
291
|
+
}
|
|
292
|
+
)));
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// src/components/interactions-list.tsx
|
|
296
|
+
var PredefinedInteractionsList = ({
|
|
297
|
+
onSelectInteraction,
|
|
298
|
+
selectedInteraction,
|
|
299
|
+
onDelete
|
|
300
|
+
}) => {
|
|
301
|
+
return /* @__PURE__ */ React10.createElement(Stack3, { sx: { m: 1, p: 1.5 }, gap: 2 }, /* @__PURE__ */ React10.createElement(Header, { label: __8("Interactions", "elementor") }), /* @__PURE__ */ React10.createElement(
|
|
302
|
+
InteractionsList,
|
|
303
|
+
{
|
|
304
|
+
onDelete: () => onDelete?.(),
|
|
305
|
+
selectedInteraction,
|
|
306
|
+
onSelectInteraction
|
|
307
|
+
}
|
|
308
|
+
));
|
|
309
|
+
};
|
|
310
|
+
function InteractionsList({ onSelectInteraction, selectedInteraction, defaultStateRef }) {
|
|
311
|
+
const [interactionId, setInteractionId] = useState3(selectedInteraction);
|
|
312
|
+
const anchorEl = useRef(null);
|
|
313
|
+
const popupId = useId();
|
|
314
|
+
const popupState = usePopupState({
|
|
315
|
+
variant: "popover",
|
|
316
|
+
popupId: `elementor-interactions-list-${popupId}`
|
|
317
|
+
});
|
|
318
|
+
const { openByDefault, resetDefaultOpen } = usePopupStateContext();
|
|
319
|
+
useEffect2(() => {
|
|
320
|
+
if (interactionId) {
|
|
321
|
+
onSelectInteraction(interactionId);
|
|
322
|
+
}
|
|
323
|
+
}, [interactionId, onSelectInteraction]);
|
|
324
|
+
useEffect2(() => {
|
|
325
|
+
if (openByDefault && anchorEl.current) {
|
|
326
|
+
popupState.open();
|
|
327
|
+
resetDefaultOpen();
|
|
328
|
+
}
|
|
329
|
+
}, [defaultStateRef, openByDefault, popupState, resetDefaultOpen]);
|
|
330
|
+
const displayLabel = useMemo(() => {
|
|
331
|
+
return formatInteractionLabel(interactionId);
|
|
332
|
+
}, [interactionId]);
|
|
333
|
+
return /* @__PURE__ */ React10.createElement(Stack3, { gap: 1.5, ref: anchorEl }, /* @__PURE__ */ React10.createElement(
|
|
334
|
+
UnstableTag,
|
|
335
|
+
{
|
|
336
|
+
...bindTrigger(popupState),
|
|
337
|
+
fullWidth: true,
|
|
338
|
+
variant: "outlined",
|
|
339
|
+
label: displayLabel,
|
|
340
|
+
showActionsOnHover: true,
|
|
341
|
+
actions: /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(IconButton2, { size: "tiny", disabled: true }, /* @__PURE__ */ React10.createElement(EyeIcon, { fontSize: "tiny" })), /* @__PURE__ */ React10.createElement(IconButton2, { size: "tiny" }, /* @__PURE__ */ React10.createElement(XIcon, { fontSize: "tiny" })))
|
|
342
|
+
}
|
|
343
|
+
), /* @__PURE__ */ React10.createElement(
|
|
344
|
+
Popover,
|
|
345
|
+
{
|
|
346
|
+
...bindPopover(popupState),
|
|
347
|
+
disableScrollLock: true,
|
|
348
|
+
anchorEl: anchorEl.current,
|
|
349
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
350
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
351
|
+
PaperProps: {
|
|
352
|
+
sx: { my: 1 }
|
|
353
|
+
},
|
|
354
|
+
onClose: () => {
|
|
355
|
+
popupState.close();
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
/* @__PURE__ */ React10.createElement(
|
|
359
|
+
InteractionDetails,
|
|
360
|
+
{
|
|
361
|
+
interaction: selectedInteraction,
|
|
362
|
+
onChange: (newValue) => {
|
|
363
|
+
setInteractionId(newValue);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
));
|
|
368
|
+
}
|
|
369
|
+
export {
|
|
370
|
+
EmptyState,
|
|
371
|
+
PopupStateProvider,
|
|
372
|
+
PredefinedInteractionsList,
|
|
373
|
+
getInteractionsConfig,
|
|
374
|
+
usePopupStateContext
|
|
375
|
+
};
|
|
376
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/empty-state.tsx","../src/components/interactions-list.tsx","../src/contexts/popup-state-contex.tsx","../src/utils/get-interactions-config.ts","../src/utils/format-interaction-label.ts","../src/components/header.tsx","../src/components/interaction-details.tsx","../src/components/controls/direction.tsx","../src/components/controls/effect.tsx","../src/components/controls/effect-type.tsx","../src/components/controls/time-frame-indicator.tsx","../src/components/controls/trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { SwipeIcon } from '@elementor/icons';\nimport { Button, Stack, Typography } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nexport const EmptyState = ( { onCreateInteraction }: { onCreateInteraction: () => void } ) => {\n\treturn (\n\t\t<Stack\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"center\"\n\t\t\theight=\"100%\"\n\t\t\tcolor=\"text.secondary\"\n\t\t\tsx={ { p: 2.5, pt: 8, pb: 5.5 } }\n\t\t\tgap={ 1.5 }\n\t\t>\n\t\t\t<SwipeIcon fontSize=\"large\" />\n\n\t\t\t<Typography align=\"center\" variant=\"subtitle2\">\n\t\t\t\t{ __( 'Animate elements with Interactions', 'elementor' ) }\n\t\t\t</Typography>\n\n\t\t\t<Typography align=\"center\" variant=\"caption\" maxWidth=\"170px\">\n\t\t\t\t{ __(\n\t\t\t\t\t'Add entrance animations and effects triggered by user interactions such as click, hover, or scroll.',\n\t\t\t\t\t'elementor'\n\t\t\t\t) }\n\t\t\t</Typography>\n\n\t\t\t<Button variant=\"outlined\" color=\"secondary\" size=\"small\" sx={ { mt: 1 } } onClick={ onCreateInteraction }>\n\t\t\t\t{ __( 'Create an interaction', 'elementor' ) }\n\t\t\t</Button>\n\t\t</Stack>\n\t);\n};\n","import * as React from 'react';\nimport { useEffect, useId, useMemo, useRef, useState } from 'react';\nimport { EyeIcon, XIcon } from '@elementor/icons';\nimport { bindPopover, bindTrigger, IconButton, Popover, Stack, UnstableTag, usePopupState } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nimport { usePopupStateContext } from '../contexts/popup-state-contex';\nimport { formatInteractionLabel } from '../utils/format-interaction-label';\nimport { Header } from './header';\nimport { InteractionDetails } from './interaction-details';\n\ntype PredefinedInteractionsListProps = {\n\tonSelectInteraction: ( interaction: string ) => void;\n\tselectedInteraction: string;\n\tonDelete?: () => void;\n};\n\nexport const PredefinedInteractionsList = ( {\n\tonSelectInteraction,\n\tselectedInteraction,\n\tonDelete,\n}: PredefinedInteractionsListProps ) => {\n\treturn (\n\t\t<Stack sx={ { m: 1, p: 1.5 } } gap={ 2 }>\n\t\t\t<Header label={ __( 'Interactions', 'elementor' ) } />\n\t\t\t<InteractionsList\n\t\t\t\tonDelete={ () => onDelete?.() }\n\t\t\t\tselectedInteraction={ selectedInteraction }\n\t\t\t\tonSelectInteraction={ onSelectInteraction }\n\t\t\t/>\n\t\t</Stack>\n\t);\n};\n\ntype InteractionListProps = {\n\tonDelete: () => void;\n\tonSelectInteraction: ( interaction: string ) => void;\n\tselectedInteraction: string;\n\tdefaultStateRef?: React.MutableRefObject< boolean | undefined >;\n};\n\nfunction InteractionsList( { onSelectInteraction, selectedInteraction, defaultStateRef }: InteractionListProps ) {\n\tconst [ interactionId, setInteractionId ] = useState( selectedInteraction );\n\n\tconst anchorEl = useRef< HTMLDivElement | null >( null );\n\n\tconst popupId = useId();\n\tconst popupState = usePopupState( {\n\t\tvariant: 'popover',\n\t\tpopupId: `elementor-interactions-list-${ popupId }`,\n\t} );\n\n\tconst { openByDefault, resetDefaultOpen } = usePopupStateContext();\n\n\tuseEffect( () => {\n\t\tif ( interactionId ) {\n\t\t\tonSelectInteraction( interactionId );\n\t\t}\n\t}, [ interactionId, onSelectInteraction ] );\n\n\tuseEffect( () => {\n\t\tif ( openByDefault && anchorEl.current ) {\n\t\t\tpopupState.open();\n\t\t\tresetDefaultOpen();\n\t\t}\n\t}, [ defaultStateRef, openByDefault, popupState, resetDefaultOpen ] );\n\n\tconst displayLabel = useMemo( () => {\n\t\treturn formatInteractionLabel( interactionId );\n\t}, [ interactionId ] );\n\n\treturn (\n\t\t<Stack gap={ 1.5 } ref={ anchorEl }>\n\t\t\t<UnstableTag\n\t\t\t\t{ ...bindTrigger( popupState ) }\n\t\t\t\tfullWidth\n\t\t\t\tvariant=\"outlined\"\n\t\t\t\tlabel={ displayLabel }\n\t\t\t\tshowActionsOnHover\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<IconButton size=\"tiny\" disabled>\n\t\t\t\t\t\t\t<EyeIcon fontSize=\"tiny\" />\n\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t<IconButton size=\"tiny\">\n\t\t\t\t\t\t\t<XIcon fontSize=\"tiny\" />\n\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Popover\n\t\t\t\t{ ...bindPopover( popupState ) }\n\t\t\t\tdisableScrollLock\n\t\t\t\tanchorEl={ anchorEl.current }\n\t\t\t\tanchorOrigin={ { vertical: 'bottom', horizontal: 'left' } }\n\t\t\t\ttransformOrigin={ { vertical: 'top', horizontal: 'left' } }\n\t\t\t\tPaperProps={ {\n\t\t\t\t\tsx: { my: 1 },\n\t\t\t\t} }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tpopupState.close();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<InteractionDetails\n\t\t\t\t\tinteraction={ selectedInteraction }\n\t\t\t\t\tonChange={ ( newValue: string ) => {\n\t\t\t\t\t\tsetInteractionId( newValue );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</Popover>\n\t\t</Stack>\n\t);\n}\n","import * as React from 'react';\nimport { createContext, useCallback, useContext, useState } from 'react';\n\ntype PopupStateContextType = {\n\topenByDefault: boolean;\n\ttriggerDefaultOpen: () => void;\n\tresetDefaultOpen: () => void;\n};\n\nconst PopupStateContext = createContext< PopupStateContextType | undefined >( undefined );\n\nexport const PopupStateProvider = ( { children }: { children: React.ReactNode } ) => {\n\tconst [ openByDefault, setOpenByDefault ] = useState( false );\n\n\tconst triggerDefaultOpen = useCallback( () => {\n\t\tsetOpenByDefault( true );\n\t}, [] );\n\n\tconst resetDefaultOpen = useCallback( () => {\n\t\tsetOpenByDefault( false );\n\t}, [] );\n\n\treturn (\n\t\t<PopupStateContext.Provider value={ { openByDefault, triggerDefaultOpen, resetDefaultOpen } }>\n\t\t\t{ children }\n\t\t</PopupStateContext.Provider>\n\t);\n};\n\nexport const usePopupStateContext = () => {\n\tconst context = useContext( PopupStateContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'usePopupStateContext must be used within PopupStateProvider' );\n\t}\n\treturn context;\n};\n","import { type InteractionsConfig } from '../types';\n\nconst DEFAULT_CONFIG: InteractionsConfig = {\n\tconstants: {\n\t\tdefaultDuration: 300,\n\t\tdefaultDelay: 0,\n\t\tslideDistance: 100,\n\t\tscaleStart: 0.5,\n\t\teasing: 'linear',\n\t},\n\tanimationOptions: [],\n};\n\nexport function getInteractionsConfig(): InteractionsConfig {\n\treturn window.ElementorInteractionsConfig || DEFAULT_CONFIG;\n}\n","import { getInteractionsConfig } from './get-interactions-config';\n\nexport function formatInteractionLabel( animationId: string ): string {\n\tif ( ! animationId ) {\n\t\treturn '';\n\t}\n\n\tconst [ trigger, effect, type, direction, duration, delay ] = animationId.split( '-' );\n\n\tconst baseValue = `${ trigger }-${ effect }-${ type }-${ direction || '' }`;\n\n\tconst animationOptions = getInteractionsConfig()?.animationOptions;\n\tconst option = animationOptions.find( ( opt ) => opt.value === baseValue );\n\n\tlet label = option?.label || animationId;\n\n\tif ( duration || delay ) {\n\t\tconst constants = getInteractionsConfig()?.constants;\n\t\tconst durationValue = duration || String( constants.defaultDuration );\n\t\tconst delayValue = delay || String( constants.defaultDelay );\n\n\t\tlabel += ` (${ durationValue }ms`;\n\n\t\tif ( delayValue !== '0' ) {\n\t\t\tlabel += `, ${ delayValue }ms delay`;\n\t\t}\n\n\t\tlabel += ')';\n\t}\n\n\treturn label;\n}\n","import * as React from 'react';\nimport { PlusIcon } from '@elementor/icons';\nimport { IconButton, Stack, Typography } from '@elementor/ui';\n\nexport const Header = ( { label }: { label: string } ) => {\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t\tgap={ 1 }\n\t\t\tsx={ { marginInlineEnd: -0.75, py: 0.25 } }\n\t\t>\n\t\t\t<Typography component=\"label\" variant=\"caption\" color=\"text.secondary\" sx={ { lineHeight: 1 } }>\n\t\t\t\t{ label }\n\t\t\t</Typography>\n\t\t\t<IconButton size=\"tiny\" disabled>\n\t\t\t\t<PlusIcon fontSize=\"tiny\" />\n\t\t\t</IconButton>\n\t\t</Stack>\n\t);\n};\n","import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { Divider, Grid } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nimport { Direction } from './controls/direction';\nimport { Effect } from './controls/effect';\nimport { EffectType } from './controls/effect-type';\nimport { TimeFrameIndicator } from './controls/time-frame-indicator';\nimport { Trigger } from './controls/trigger';\n\nconst DELIMITER = '-';\n\ntype InteractionDetailsProps = {\n\tinteraction: string;\n\tonChange: ( interaction: string ) => void;\n};\n\nexport const InteractionDetails = ( { interaction, onChange }: InteractionDetailsProps ) => {\n\tconst [ interactionDetails, setInteractionDetails ] = useState( () => {\n\t\tconst [ trigger, effect, type, direction, duration, delay ] = interaction.split( DELIMITER );\n\n\t\treturn {\n\t\t\ttrigger: trigger || 'load',\n\t\t\teffect: effect || 'fade',\n\t\t\ttype: type || 'in',\n\t\t\tdirection: direction || '',\n\t\t\tduration: duration || '300',\n\t\t\tdelay: delay || '0',\n\t\t};\n\t} );\n\n\tuseEffect( () => {\n\t\tconst newValue = Object.values( interactionDetails ).join( DELIMITER );\n\t\tonChange( newValue );\n\t}, [ interactionDetails, onChange ] );\n\n\tconst handleChange = < K extends keyof typeof interactionDetails >(\n\t\tkey: K,\n\t\tvalue: ( typeof interactionDetails )[ K ]\n\t) => {\n\t\tsetInteractionDetails( ( prev ) => ( { ...prev, [ key ]: value } ) );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Grid container spacing={ 2 } sx={ { width: '300px', p: 1 } }>\n\t\t\t\t<Trigger value={ interactionDetails.trigger } onChange={ ( v ) => handleChange( 'trigger', v ) } />\n\t\t\t</Grid>\n\t\t\t<Divider />\n\t\t\t<Grid container spacing={ 2 } sx={ { width: '300px', p: 1 } }>\n\t\t\t\t<Effect value={ interactionDetails.effect } onChange={ ( v ) => handleChange( 'effect', v ) } />\n\t\t\t\t<EffectType value={ interactionDetails.type } onChange={ ( v ) => handleChange( 'type', v ) } />\n\t\t\t\t<Direction\n\t\t\t\t\tvalue={ interactionDetails.direction ?? '' }\n\t\t\t\t\tonChange={ ( v ) => handleChange( 'direction', v ) }\n\t\t\t\t/>\n\t\t\t\t<TimeFrameIndicator\n\t\t\t\t\tvalue={ interactionDetails.duration }\n\t\t\t\t\tonChange={ ( v ) => handleChange( 'duration', v ) }\n\t\t\t\t\tlabel={ __( 'Duration', 'elementor' ) }\n\t\t\t\t/>\n\t\t\t\t<TimeFrameIndicator\n\t\t\t\t\tvalue={ interactionDetails.delay }\n\t\t\t\t\tonChange={ ( v ) => handleChange( 'delay', v ) }\n\t\t\t\t\tlabel={ __( 'Delay', 'elementor' ) }\n\t\t\t\t/>\n\t\t\t</Grid>\n\t\t</>\n\t);\n};\n","import * as React from 'react';\nimport { ArrowDownSmallIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpSmallIcon } from '@elementor/icons';\nimport { Grid, ToggleButton, ToggleButtonGroup, Tooltip, Typography } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nimport { type FieldProps } from '../../types';\n\nexport function Direction( { value, onChange }: FieldProps ) {\n\tconst availableDirections = [\n\t\t{ key: 'top', label: __( 'Up', 'elementor' ), icon: <ArrowUpSmallIcon fontSize=\"tiny\" /> },\n\t\t{ key: 'bottom', label: __( 'Down', 'elementor' ), icon: <ArrowDownSmallIcon fontSize=\"tiny\" /> },\n\t\t{ key: 'left', label: __( 'Left', 'elementor' ), icon: <ArrowLeftIcon fontSize=\"tiny\" /> },\n\t\t{ key: 'right', label: __( 'Right', 'elementor' ), icon: <ArrowRightIcon fontSize=\"tiny\" /> },\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Typography variant=\"caption\" color=\"text.secondary\">\n\t\t\t\t\t{ __( 'Direction', 'elementor' ) }\n\t\t\t\t</Typography>\n\t\t\t</Grid>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<ToggleButtonGroup\n\t\t\t\t\tsize=\"tiny\"\n\t\t\t\t\texclusive\n\t\t\t\t\tonChange={ ( event: React.MouseEvent< HTMLElement >, newValue: string ) => onChange( newValue ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t>\n\t\t\t\t\t{ availableDirections.map( ( direction ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Tooltip key={ direction.key } title={ direction.label } placement=\"top\">\n\t\t\t\t\t\t\t\t<ToggleButton key={ direction.key } value={ direction.key }>\n\t\t\t\t\t\t\t\t\t{ direction.icon }\n\t\t\t\t\t\t\t\t</ToggleButton>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</ToggleButtonGroup>\n\t\t\t</Grid>\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { MenuListItem } from '@elementor/editor-ui';\nimport { Grid, Select, type SelectChangeEvent, Typography } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nimport { type FieldProps } from '../../types';\nexport function Effect( { value, onChange }: FieldProps ) {\n\tconst availableEffects = [\n\t\t{ key: 'fade', label: __( 'Fade', 'elementor' ) },\n\t\t{ key: 'slide', label: __( 'Slide', 'elementor' ) },\n\t\t{ key: 'scale', label: __( 'Scale', 'elementor' ) },\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Typography variant=\"caption\" color=\"text.secondary\">\n\t\t\t\t\t{ __( 'Effect', 'elementor' ) }\n\t\t\t\t</Typography>\n\t\t\t</Grid>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Select\n\t\t\t\t\tfullWidth\n\t\t\t\t\tdisplayEmpty\n\t\t\t\t\tsize=\"tiny\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ ( event: SelectChangeEvent< string > ) => onChange( event.target.value ) }\n\t\t\t\t>\n\t\t\t\t\t{ availableEffects.map( ( effect ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<MenuListItem key={ effect.key } value={ effect.key }>\n\t\t\t\t\t\t\t\t{ effect.label }\n\t\t\t\t\t\t\t</MenuListItem>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</Select>\n\t\t\t</Grid>\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { Grid, ToggleButton, ToggleButtonGroup, Tooltip, Typography } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nimport { type FieldProps } from '../../types';\n\nexport function EffectType( { value, onChange }: FieldProps ) {\n\tconst availableEffectTypes = [\n\t\t{ key: 'in', label: __( 'In', 'elementor' ) },\n\t\t{ key: 'out', label: __( 'Out', 'elementor' ) },\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Typography variant=\"caption\" color=\"text.secondary\">\n\t\t\t\t\t{ __( 'Type', 'elementor' ) }\n\t\t\t\t</Typography>\n\t\t\t</Grid>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<ToggleButtonGroup\n\t\t\t\t\tsize=\"tiny\"\n\t\t\t\t\texclusive\n\t\t\t\t\tonChange={ ( event: React.MouseEvent< HTMLElement >, newValue: string ) => onChange( newValue ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t>\n\t\t\t\t\t{ availableEffectTypes.map( ( effectType ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Tooltip key={ effectType.key } title={ effectType.label } placement=\"top\">\n\t\t\t\t\t\t\t\t<ToggleButton key={ effectType.key } value={ effectType.key }>\n\t\t\t\t\t\t\t\t\t{ effectType.label }\n\t\t\t\t\t\t\t\t</ToggleButton>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</ToggleButtonGroup>\n\t\t\t</Grid>\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { MenuListItem } from '@elementor/editor-ui';\nimport { Grid, Select, type SelectChangeEvent, Typography } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nimport { type FieldProps } from '../../types';\n\nexport function TimeFrameIndicator( { value, onChange, label }: FieldProps ) {\n\tconst availableTimeFrames = [ '0', '100', '200', '300', '400', '500', '750', '1000', '1250', '1500' ].map(\n\t\t( key ) => ( {\n\t\t\tkey,\n\t\t\t// translators: %s: time in milliseconds\n\t\t\tlabel: __( '%s MS', 'elementor' ).replace( '%s', key ),\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Typography variant=\"caption\" color=\"text.secondary\">\n\t\t\t\t\t{ label }\n\t\t\t\t</Typography>\n\t\t\t</Grid>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Select\n\t\t\t\t\tfullWidth\n\t\t\t\t\tdisplayEmpty\n\t\t\t\t\tsize=\"tiny\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ ( event: SelectChangeEvent< string > ) => onChange( event.target.value ) }\n\t\t\t\t>\n\t\t\t\t\t{ availableTimeFrames.map( ( timeFrame ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<MenuListItem key={ timeFrame.key } value={ timeFrame.key }>\n\t\t\t\t\t\t\t\t{ timeFrame.label }\n\t\t\t\t\t\t\t</MenuListItem>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</Select>\n\t\t\t</Grid>\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { MenuListItem } from '@elementor/editor-ui';\nimport { Grid, Select, type SelectChangeEvent, Typography } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\nimport { type FieldProps } from '../../types';\n\nexport function Trigger( { value, onChange }: FieldProps ) {\n\tconst availableTriggers = Object.entries( {\n\t\tload: __( 'Page load', 'elementor' ),\n\t\tscrollIn: __( 'Scroll into view', 'elementor' ),\n\t\tscrollOut: __( 'Scroll out of view', 'elementor' ),\n\t} ).map( ( [ key, label ] ) => ( {\n\t\tkey,\n\t\tlabel,\n\t} ) );\n\n\treturn (\n\t\t<>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Typography variant=\"caption\" color=\"text.secondary\">\n\t\t\t\t\t{ __( 'Trigger', 'elementor' ) }\n\t\t\t\t</Typography>\n\t\t\t</Grid>\n\t\t\t<Grid item xs={ 12 } md={ 6 }>\n\t\t\t\t<Select\n\t\t\t\t\tfullWidth\n\t\t\t\t\tdisplayEmpty\n\t\t\t\t\tsize=\"tiny\"\n\t\t\t\t\tonChange={ ( event: SelectChangeEvent< string > ) => onChange( event.target.value ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t>\n\t\t\t\t\t{ availableTriggers.map( ( trigger ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<MenuListItem key={ trigger.key } value={ trigger.key }>\n\t\t\t\t\t\t\t\t{ trigger.label }\n\t\t\t\t\t\t\t</MenuListItem>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</Select>\n\t\t\t</Grid>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,OAA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AAsB;AAClC,2BAAkB,QAAS;AAAA,QAC5B;AAAA;AAAA,IACD;AAAA,EACD,CACD;AAEF;","names":["React","useEffect","useState","IconButton","Stack","__","React","React","Stack","Typography","React","useState","Grid","__","React","Typography","__","React","Grid","Typography","__","React","Grid","ToggleButton","ToggleButtonGroup","Tooltip","Typography","__","React","MenuListItem","Grid","Select","Typography","__","React","MenuListItem","Grid","Select","Typography","__","useState","Grid","__","Stack","__","useState","useEffect","IconButton"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elementor/editor-interactions",
|
|
3
|
+
"version": "3.33.0-224",
|
|
4
|
+
"private": false,
|
|
5
|
+
"author": "Elementor Team",
|
|
6
|
+
"homepage": "https://elementor.com/",
|
|
7
|
+
"license": "GPL-3.0-or-later",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"module": "dist/index.mjs",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/elementor/elementor.git",
|
|
22
|
+
"directory": "packages/core/editor-interactions"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/elementor/elementor/issues"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"README.md",
|
|
32
|
+
"CHANGELOG.md",
|
|
33
|
+
"/dist",
|
|
34
|
+
"/src",
|
|
35
|
+
"!**/__tests__"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup --config=../../tsup.build.ts",
|
|
39
|
+
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@elementor/editor-ui": "3.33.0-224",
|
|
43
|
+
"@elementor/ui": "1.36.15",
|
|
44
|
+
"@elementor/icons": "1.56.0",
|
|
45
|
+
"@wordpress/i18n": "^5.13.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": "^18.3.1",
|
|
49
|
+
"react-dom": "^18.3.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"tsup": "^8.3.5"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ArrowDownSmallIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpSmallIcon } from '@elementor/icons';
|
|
3
|
+
import { Grid, ToggleButton, ToggleButtonGroup, Tooltip, Typography } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { type FieldProps } from '../../types';
|
|
7
|
+
|
|
8
|
+
export function Direction( { value, onChange }: FieldProps ) {
|
|
9
|
+
const availableDirections = [
|
|
10
|
+
{ key: 'top', label: __( 'Up', 'elementor' ), icon: <ArrowUpSmallIcon fontSize="tiny" /> },
|
|
11
|
+
{ key: 'bottom', label: __( 'Down', 'elementor' ), icon: <ArrowDownSmallIcon fontSize="tiny" /> },
|
|
12
|
+
{ key: 'left', label: __( 'Left', 'elementor' ), icon: <ArrowLeftIcon fontSize="tiny" /> },
|
|
13
|
+
{ key: 'right', label: __( 'Right', 'elementor' ), icon: <ArrowRightIcon fontSize="tiny" /> },
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<Grid item xs={ 12 } md={ 6 }>
|
|
19
|
+
<Typography variant="caption" color="text.secondary">
|
|
20
|
+
{ __( 'Direction', 'elementor' ) }
|
|
21
|
+
</Typography>
|
|
22
|
+
</Grid>
|
|
23
|
+
<Grid item xs={ 12 } md={ 6 }>
|
|
24
|
+
<ToggleButtonGroup
|
|
25
|
+
size="tiny"
|
|
26
|
+
exclusive
|
|
27
|
+
onChange={ ( event: React.MouseEvent< HTMLElement >, newValue: string ) => onChange( newValue ) }
|
|
28
|
+
value={ value }
|
|
29
|
+
>
|
|
30
|
+
{ availableDirections.map( ( direction ) => {
|
|
31
|
+
return (
|
|
32
|
+
<Tooltip key={ direction.key } title={ direction.label } placement="top">
|
|
33
|
+
<ToggleButton key={ direction.key } value={ direction.key }>
|
|
34
|
+
{ direction.icon }
|
|
35
|
+
</ToggleButton>
|
|
36
|
+
</Tooltip>
|
|
37
|
+
);
|
|
38
|
+
} ) }
|
|
39
|
+
</ToggleButtonGroup>
|
|
40
|
+
</Grid>
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Grid, ToggleButton, ToggleButtonGroup, Tooltip, Typography } from '@elementor/ui';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
|
|
5
|
+
import { type FieldProps } from '../../types';
|
|
6
|
+
|
|
7
|
+
export function EffectType( { value, onChange }: FieldProps ) {
|
|
8
|
+
const availableEffectTypes = [
|
|
9
|
+
{ key: 'in', label: __( 'In', 'elementor' ) },
|
|
10
|
+
{ key: 'out', label: __( 'Out', 'elementor' ) },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<Grid item xs={ 12 } md={ 6 }>
|
|
16
|
+
<Typography variant="caption" color="text.secondary">
|
|
17
|
+
{ __( 'Type', 'elementor' ) }
|
|
18
|
+
</Typography>
|
|
19
|
+
</Grid>
|
|
20
|
+
<Grid item xs={ 12 } md={ 6 }>
|
|
21
|
+
<ToggleButtonGroup
|
|
22
|
+
size="tiny"
|
|
23
|
+
exclusive
|
|
24
|
+
onChange={ ( event: React.MouseEvent< HTMLElement >, newValue: string ) => onChange( newValue ) }
|
|
25
|
+
value={ value }
|
|
26
|
+
>
|
|
27
|
+
{ availableEffectTypes.map( ( effectType ) => {
|
|
28
|
+
return (
|
|
29
|
+
<Tooltip key={ effectType.key } title={ effectType.label } placement="top">
|
|
30
|
+
<ToggleButton key={ effectType.key } value={ effectType.key }>
|
|
31
|
+
{ effectType.label }
|
|
32
|
+
</ToggleButton>
|
|
33
|
+
</Tooltip>
|
|
34
|
+
);
|
|
35
|
+
} ) }
|
|
36
|
+
</ToggleButtonGroup>
|
|
37
|
+
</Grid>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MenuListItem } from '@elementor/editor-ui';
|
|
3
|
+
import { Grid, Select, type SelectChangeEvent, Typography } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { type FieldProps } from '../../types';
|
|
7
|
+
export function Effect( { value, onChange }: FieldProps ) {
|
|
8
|
+
const availableEffects = [
|
|
9
|
+
{ key: 'fade', label: __( 'Fade', 'elementor' ) },
|
|
10
|
+
{ key: 'slide', label: __( 'Slide', 'elementor' ) },
|
|
11
|
+
{ key: 'scale', label: __( 'Scale', 'elementor' ) },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<Grid item xs={ 12 } md={ 6 }>
|
|
17
|
+
<Typography variant="caption" color="text.secondary">
|
|
18
|
+
{ __( 'Effect', 'elementor' ) }
|
|
19
|
+
</Typography>
|
|
20
|
+
</Grid>
|
|
21
|
+
<Grid item xs={ 12 } md={ 6 }>
|
|
22
|
+
<Select
|
|
23
|
+
fullWidth
|
|
24
|
+
displayEmpty
|
|
25
|
+
size="tiny"
|
|
26
|
+
value={ value }
|
|
27
|
+
onChange={ ( event: SelectChangeEvent< string > ) => onChange( event.target.value ) }
|
|
28
|
+
>
|
|
29
|
+
{ availableEffects.map( ( effect ) => {
|
|
30
|
+
return (
|
|
31
|
+
<MenuListItem key={ effect.key } value={ effect.key }>
|
|
32
|
+
{ effect.label }
|
|
33
|
+
</MenuListItem>
|
|
34
|
+
);
|
|
35
|
+
} ) }
|
|
36
|
+
</Select>
|
|
37
|
+
</Grid>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|