@elementor/editor-interactions 3.33.0-255 → 3.33.0-257
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 +95 -142
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -6
- package/src/components/interaction-details.tsx +3 -3
- package/src/components/interactions-list.tsx +51 -96
- package/src/components/interactions-tab.tsx +17 -11
- package/src/contexts/interactions-context.tsx +3 -3
package/dist/index.js
CHANGED
|
@@ -67,10 +67,11 @@ var EmptyState = ({ onCreateInteraction }) => {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
// src/components/interactions-tab.tsx
|
|
70
|
-
var
|
|
70
|
+
var React11 = __toESM(require("react"));
|
|
71
71
|
var import_react5 = require("react");
|
|
72
72
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
73
73
|
var import_session = require("@elementor/session");
|
|
74
|
+
var import_ui9 = require("@elementor/ui");
|
|
74
75
|
|
|
75
76
|
// src/contexts/interactions-context.tsx
|
|
76
77
|
var React2 = __toESM(require("react"));
|
|
@@ -82,7 +83,7 @@ var InteractionsProvider = ({ children, elementId }) => {
|
|
|
82
83
|
const setInteractions = (value) => {
|
|
83
84
|
(0, import_editor_elements.updateElementInteractions)({
|
|
84
85
|
elementId,
|
|
85
|
-
interactions: value
|
|
86
|
+
interactions: value || void 0
|
|
86
87
|
});
|
|
87
88
|
};
|
|
88
89
|
const playInteractions = () => {
|
|
@@ -117,19 +118,13 @@ var PopupStateProvider = ({ children }) => {
|
|
|
117
118
|
}, []);
|
|
118
119
|
return /* @__PURE__ */ React3.createElement(PopupStateContext.Provider, { value: { openByDefault, triggerDefaultOpen, resetDefaultOpen } }, children);
|
|
119
120
|
};
|
|
120
|
-
var usePopupStateContext = () => {
|
|
121
|
-
const context = (0, import_react2.useContext)(PopupStateContext);
|
|
122
|
-
if (!context) {
|
|
123
|
-
throw new Error("usePopupStateContext must be used within PopupStateProvider");
|
|
124
|
-
}
|
|
125
|
-
return context;
|
|
126
|
-
};
|
|
127
121
|
|
|
128
122
|
// src/components/interactions-list.tsx
|
|
129
|
-
var
|
|
123
|
+
var React10 = __toESM(require("react"));
|
|
130
124
|
var import_react4 = require("react");
|
|
131
|
-
var
|
|
132
|
-
var
|
|
125
|
+
var import_editor_controls = require("@elementor/editor-controls");
|
|
126
|
+
var import_icons3 = require("@elementor/icons");
|
|
127
|
+
var import_ui8 = require("@elementor/ui");
|
|
133
128
|
var import_i18n8 = require("@wordpress/i18n");
|
|
134
129
|
|
|
135
130
|
// src/utils/get-interactions-config.ts
|
|
@@ -147,45 +142,26 @@ function getInteractionsConfig() {
|
|
|
147
142
|
return window.ElementorInteractionsConfig || DEFAULT_CONFIG;
|
|
148
143
|
}
|
|
149
144
|
|
|
150
|
-
// src/components/header.tsx
|
|
151
|
-
var React4 = __toESM(require("react"));
|
|
152
|
-
var import_icons2 = require("@elementor/icons");
|
|
153
|
-
var import_ui2 = require("@elementor/ui");
|
|
154
|
-
var Header = ({ label }) => {
|
|
155
|
-
return /* @__PURE__ */ React4.createElement(
|
|
156
|
-
import_ui2.Stack,
|
|
157
|
-
{
|
|
158
|
-
direction: "row",
|
|
159
|
-
alignItems: "center",
|
|
160
|
-
justifyContent: "space-between",
|
|
161
|
-
gap: 1,
|
|
162
|
-
sx: { marginInlineEnd: -0.75, py: 0.25 }
|
|
163
|
-
},
|
|
164
|
-
/* @__PURE__ */ React4.createElement(import_ui2.Typography, { component: "label", variant: "caption", color: "text.secondary", sx: { lineHeight: 1 } }, label),
|
|
165
|
-
/* @__PURE__ */ React4.createElement(import_ui2.IconButton, { size: "tiny", disabled: true }, /* @__PURE__ */ React4.createElement(import_icons2.PlusIcon, { fontSize: "tiny" }))
|
|
166
|
-
);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
145
|
// src/components/interaction-details.tsx
|
|
170
|
-
var
|
|
146
|
+
var React9 = __toESM(require("react"));
|
|
171
147
|
var import_react3 = require("react");
|
|
172
|
-
var
|
|
148
|
+
var import_ui7 = require("@elementor/ui");
|
|
173
149
|
var import_i18n7 = require("@wordpress/i18n");
|
|
174
150
|
|
|
175
151
|
// src/components/controls/direction.tsx
|
|
176
|
-
var
|
|
177
|
-
var
|
|
178
|
-
var
|
|
152
|
+
var React4 = __toESM(require("react"));
|
|
153
|
+
var import_icons2 = require("@elementor/icons");
|
|
154
|
+
var import_ui2 = require("@elementor/ui");
|
|
179
155
|
var import_i18n2 = require("@wordpress/i18n");
|
|
180
156
|
function Direction({ value, onChange }) {
|
|
181
157
|
const availableDirections = [
|
|
182
|
-
{ key: "top", label: (0, import_i18n2.__)("From bottom", "elementor"), icon: /* @__PURE__ */
|
|
183
|
-
{ key: "bottom", label: (0, import_i18n2.__)("From top", "elementor"), icon: /* @__PURE__ */
|
|
184
|
-
{ key: "left", label: (0, import_i18n2.__)("From right", "elementor"), icon: /* @__PURE__ */
|
|
185
|
-
{ key: "right", label: (0, import_i18n2.__)("From left", "elementor"), icon: /* @__PURE__ */
|
|
158
|
+
{ key: "top", label: (0, import_i18n2.__)("From bottom", "elementor"), icon: /* @__PURE__ */ React4.createElement(import_icons2.ArrowUpSmallIcon, { fontSize: "tiny" }) },
|
|
159
|
+
{ key: "bottom", label: (0, import_i18n2.__)("From top", "elementor"), icon: /* @__PURE__ */ React4.createElement(import_icons2.ArrowDownSmallIcon, { fontSize: "tiny" }) },
|
|
160
|
+
{ key: "left", label: (0, import_i18n2.__)("From right", "elementor"), icon: /* @__PURE__ */ React4.createElement(import_icons2.ArrowLeftIcon, { fontSize: "tiny" }) },
|
|
161
|
+
{ key: "right", label: (0, import_i18n2.__)("From left", "elementor"), icon: /* @__PURE__ */ React4.createElement(import_icons2.ArrowRightIcon, { fontSize: "tiny" }) }
|
|
186
162
|
];
|
|
187
|
-
return /* @__PURE__ */
|
|
188
|
-
|
|
163
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(import_ui2.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React4.createElement(import_ui2.Typography, { variant: "caption", color: "text.secondary" }, (0, import_i18n2.__)("Direction", "elementor"))), /* @__PURE__ */ React4.createElement(import_ui2.Grid, { item: true, xs: 12, md: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React4.createElement(
|
|
164
|
+
import_ui2.ToggleButtonGroup,
|
|
189
165
|
{
|
|
190
166
|
size: "tiny",
|
|
191
167
|
exclusive: true,
|
|
@@ -193,15 +169,15 @@ function Direction({ value, onChange }) {
|
|
|
193
169
|
value
|
|
194
170
|
},
|
|
195
171
|
availableDirections.map((direction) => {
|
|
196
|
-
return /* @__PURE__ */
|
|
172
|
+
return /* @__PURE__ */ React4.createElement(import_ui2.Tooltip, { key: direction.key, title: direction.label, placement: "top" }, /* @__PURE__ */ React4.createElement(import_ui2.ToggleButton, { key: direction.key, value: direction.key }, direction.icon));
|
|
197
173
|
})
|
|
198
174
|
)));
|
|
199
175
|
}
|
|
200
176
|
|
|
201
177
|
// src/components/controls/effect.tsx
|
|
202
|
-
var
|
|
178
|
+
var React5 = __toESM(require("react"));
|
|
203
179
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
204
|
-
var
|
|
180
|
+
var import_ui3 = require("@elementor/ui");
|
|
205
181
|
var import_i18n3 = require("@wordpress/i18n");
|
|
206
182
|
function Effect({ value, onChange }) {
|
|
207
183
|
const availableEffects = [
|
|
@@ -209,8 +185,8 @@ function Effect({ value, onChange }) {
|
|
|
209
185
|
{ key: "slide", label: (0, import_i18n3.__)("Slide", "elementor") },
|
|
210
186
|
{ key: "scale", label: (0, import_i18n3.__)("Scale", "elementor") }
|
|
211
187
|
];
|
|
212
|
-
return /* @__PURE__ */
|
|
213
|
-
|
|
188
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(import_ui3.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React5.createElement(import_ui3.Typography, { variant: "caption", color: "text.secondary" }, (0, import_i18n3.__)("Effect", "elementor"))), /* @__PURE__ */ React5.createElement(import_ui3.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React5.createElement(
|
|
189
|
+
import_ui3.Select,
|
|
214
190
|
{
|
|
215
191
|
fullWidth: true,
|
|
216
192
|
displayEmpty: true,
|
|
@@ -219,22 +195,22 @@ function Effect({ value, onChange }) {
|
|
|
219
195
|
onChange: (event) => onChange(event.target.value)
|
|
220
196
|
},
|
|
221
197
|
availableEffects.map((effect) => {
|
|
222
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ React5.createElement(import_editor_ui.MenuListItem, { key: effect.key, value: effect.key }, effect.label);
|
|
223
199
|
})
|
|
224
200
|
)));
|
|
225
201
|
}
|
|
226
202
|
|
|
227
203
|
// src/components/controls/effect-type.tsx
|
|
228
|
-
var
|
|
229
|
-
var
|
|
204
|
+
var React6 = __toESM(require("react"));
|
|
205
|
+
var import_ui4 = require("@elementor/ui");
|
|
230
206
|
var import_i18n4 = require("@wordpress/i18n");
|
|
231
207
|
function EffectType({ value, onChange }) {
|
|
232
208
|
const availableEffectTypes = [
|
|
233
209
|
{ key: "in", label: (0, import_i18n4.__)("In", "elementor") },
|
|
234
210
|
{ key: "out", label: (0, import_i18n4.__)("Out", "elementor") }
|
|
235
211
|
];
|
|
236
|
-
return /* @__PURE__ */
|
|
237
|
-
|
|
212
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(import_ui4.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React6.createElement(import_ui4.Typography, { variant: "caption", color: "text.secondary" }, (0, import_i18n4.__)("Type", "elementor"))), /* @__PURE__ */ React6.createElement(import_ui4.Grid, { item: true, xs: 12, md: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React6.createElement(
|
|
213
|
+
import_ui4.ToggleButtonGroup,
|
|
238
214
|
{
|
|
239
215
|
size: "tiny",
|
|
240
216
|
exclusive: true,
|
|
@@ -242,15 +218,15 @@ function EffectType({ value, onChange }) {
|
|
|
242
218
|
value
|
|
243
219
|
},
|
|
244
220
|
availableEffectTypes.map((effectType) => {
|
|
245
|
-
return /* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ React6.createElement(import_ui4.Tooltip, { key: effectType.key, title: effectType.label, placement: "top" }, /* @__PURE__ */ React6.createElement(import_ui4.ToggleButton, { key: effectType.key, value: effectType.key }, effectType.label));
|
|
246
222
|
})
|
|
247
223
|
)));
|
|
248
224
|
}
|
|
249
225
|
|
|
250
226
|
// src/components/controls/time-frame-indicator.tsx
|
|
251
|
-
var
|
|
227
|
+
var React7 = __toESM(require("react"));
|
|
252
228
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
253
|
-
var
|
|
229
|
+
var import_ui5 = require("@elementor/ui");
|
|
254
230
|
var import_i18n5 = require("@wordpress/i18n");
|
|
255
231
|
function TimeFrameIndicator({ value, onChange, label }) {
|
|
256
232
|
const availableTimeFrames = ["0", "100", "200", "300", "400", "500", "750", "1000", "1250", "1500"].map(
|
|
@@ -260,8 +236,8 @@ function TimeFrameIndicator({ value, onChange, label }) {
|
|
|
260
236
|
label: (0, import_i18n5.__)("%s MS", "elementor").replace("%s", key)
|
|
261
237
|
})
|
|
262
238
|
);
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
|
|
239
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui5.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React7.createElement(import_ui5.Typography, { variant: "caption", color: "text.secondary" }, label)), /* @__PURE__ */ React7.createElement(import_ui5.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React7.createElement(
|
|
240
|
+
import_ui5.Select,
|
|
265
241
|
{
|
|
266
242
|
fullWidth: true,
|
|
267
243
|
displayEmpty: true,
|
|
@@ -270,15 +246,15 @@ function TimeFrameIndicator({ value, onChange, label }) {
|
|
|
270
246
|
onChange: (event) => onChange(event.target.value)
|
|
271
247
|
},
|
|
272
248
|
availableTimeFrames.map((timeFrame) => {
|
|
273
|
-
return /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ React7.createElement(import_editor_ui2.MenuListItem, { key: timeFrame.key, value: timeFrame.key }, timeFrame.label);
|
|
274
250
|
})
|
|
275
251
|
)));
|
|
276
252
|
}
|
|
277
253
|
|
|
278
254
|
// src/components/controls/trigger.tsx
|
|
279
|
-
var
|
|
255
|
+
var React8 = __toESM(require("react"));
|
|
280
256
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
281
|
-
var
|
|
257
|
+
var import_ui6 = require("@elementor/ui");
|
|
282
258
|
var import_i18n6 = require("@wordpress/i18n");
|
|
283
259
|
function Trigger({ value, onChange }) {
|
|
284
260
|
const availableTriggers = Object.entries({
|
|
@@ -289,8 +265,8 @@ function Trigger({ value, onChange }) {
|
|
|
289
265
|
key,
|
|
290
266
|
label
|
|
291
267
|
}));
|
|
292
|
-
return /* @__PURE__ */
|
|
293
|
-
|
|
268
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(import_ui6.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React8.createElement(import_ui6.Typography, { variant: "caption", color: "text.secondary" }, (0, import_i18n6.__)("Trigger", "elementor"))), /* @__PURE__ */ React8.createElement(import_ui6.Grid, { item: true, xs: 12, md: 6 }, /* @__PURE__ */ React8.createElement(
|
|
269
|
+
import_ui6.Select,
|
|
294
270
|
{
|
|
295
271
|
fullWidth: true,
|
|
296
272
|
displayEmpty: true,
|
|
@@ -299,7 +275,7 @@ function Trigger({ value, onChange }) {
|
|
|
299
275
|
value
|
|
300
276
|
},
|
|
301
277
|
availableTriggers.map((trigger) => {
|
|
302
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ React8.createElement(import_editor_ui3.MenuListItem, { key: trigger.key, value: trigger.key }, trigger.label);
|
|
303
279
|
})
|
|
304
280
|
)));
|
|
305
281
|
}
|
|
@@ -325,20 +301,20 @@ var InteractionDetails = ({ interaction, onChange }) => {
|
|
|
325
301
|
const handleChange = (key, value) => {
|
|
326
302
|
setInteractionDetails((prev) => ({ ...prev, [key]: value }));
|
|
327
303
|
};
|
|
328
|
-
return /* @__PURE__ */
|
|
304
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(import_ui7.Grid, { container: true, spacing: 2, sx: { p: 1.5 } }, /* @__PURE__ */ React9.createElement(Trigger, { value: interactionDetails.trigger, onChange: (v) => handleChange("trigger", v) })), /* @__PURE__ */ React9.createElement(import_ui7.Divider, { sx: { mx: 1.5 } }), /* @__PURE__ */ React9.createElement(import_ui7.Grid, { container: true, spacing: 2, sx: { p: 1.5 } }, /* @__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(
|
|
329
305
|
Direction,
|
|
330
306
|
{
|
|
331
307
|
value: interactionDetails.direction ?? "",
|
|
332
308
|
onChange: (v) => handleChange("direction", v)
|
|
333
309
|
}
|
|
334
|
-
), /* @__PURE__ */
|
|
310
|
+
), /* @__PURE__ */ React9.createElement(
|
|
335
311
|
TimeFrameIndicator,
|
|
336
312
|
{
|
|
337
313
|
value: interactionDetails.duration,
|
|
338
314
|
onChange: (v) => handleChange("duration", v),
|
|
339
315
|
label: (0, import_i18n7.__)("Duration", "elementor")
|
|
340
316
|
}
|
|
341
|
-
), /* @__PURE__ */
|
|
317
|
+
), /* @__PURE__ */ React9.createElement(
|
|
342
318
|
TimeFrameIndicator,
|
|
343
319
|
{
|
|
344
320
|
value: interactionDetails.delay,
|
|
@@ -349,96 +325,68 @@ var InteractionDetails = ({ interaction, onChange }) => {
|
|
|
349
325
|
};
|
|
350
326
|
|
|
351
327
|
// src/components/interactions-list.tsx
|
|
352
|
-
var PredefinedInteractionsList = ({
|
|
353
|
-
onSelectInteraction,
|
|
354
|
-
selectedInteraction,
|
|
355
|
-
onDelete,
|
|
356
|
-
onPlayInteraction
|
|
357
|
-
}) => {
|
|
358
|
-
return /* @__PURE__ */ React11.createElement(import_ui9.Stack, { sx: { m: 1, p: 1.5 }, gap: 2 }, /* @__PURE__ */ React11.createElement(Header, { label: (0, import_i18n8.__)("Interactions", "elementor") }), /* @__PURE__ */ React11.createElement(
|
|
359
|
-
InteractionsList,
|
|
360
|
-
{
|
|
361
|
-
onDelete,
|
|
362
|
-
selectedInteraction,
|
|
363
|
-
onSelectInteraction,
|
|
364
|
-
onPlayInteraction
|
|
365
|
-
}
|
|
366
|
-
));
|
|
367
|
-
};
|
|
368
328
|
function InteractionsList(props) {
|
|
369
|
-
const { onSelectInteraction, selectedInteraction,
|
|
329
|
+
const { onSelectInteraction, selectedInteraction, onPlayInteraction, triggerCreateOnShowEmpty } = props;
|
|
370
330
|
const [interactionId, setInteractionId] = (0, import_react4.useState)(selectedInteraction);
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
variant: "popover",
|
|
375
|
-
popupId: `elementor-interactions-list-${popupId}`
|
|
376
|
-
});
|
|
377
|
-
const { openByDefault, resetDefaultOpen } = usePopupStateContext();
|
|
331
|
+
if (triggerCreateOnShowEmpty && !interactionId) {
|
|
332
|
+
setInteractionId("load-fade-in-left-100-0");
|
|
333
|
+
}
|
|
378
334
|
(0, import_react4.useEffect)(() => {
|
|
379
|
-
if (interactionId
|
|
335
|
+
if (interactionId !== selectedInteraction) {
|
|
380
336
|
onSelectInteraction(interactionId);
|
|
381
337
|
}
|
|
382
338
|
}, [interactionId, selectedInteraction, onSelectInteraction]);
|
|
383
|
-
|
|
384
|
-
if (
|
|
385
|
-
popupState.setAnchorEl(anchorEl.current);
|
|
386
|
-
popupState.open();
|
|
387
|
-
resetDefaultOpen();
|
|
388
|
-
}
|
|
389
|
-
}, [defaultStateRef, popupState, anchorEl, openByDefault, resetDefaultOpen]);
|
|
390
|
-
const displayLabel = (0, import_react4.useMemo)(() => {
|
|
391
|
-
if (!interactionId) {
|
|
339
|
+
const displayLabel = (interactionForDisplay) => {
|
|
340
|
+
if (!interactionForDisplay) {
|
|
392
341
|
return "";
|
|
393
342
|
}
|
|
394
343
|
const animationOptions = getInteractionsConfig()?.animationOptions;
|
|
395
|
-
const option = animationOptions.find((opt) => opt.value ===
|
|
396
|
-
return option?.label ||
|
|
397
|
-
}
|
|
398
|
-
return /* @__PURE__ */
|
|
399
|
-
|
|
400
|
-
{
|
|
401
|
-
...(0, import_ui9.bindTrigger)(popupState),
|
|
402
|
-
fullWidth: true,
|
|
403
|
-
variant: "outlined",
|
|
404
|
-
label: displayLabel,
|
|
405
|
-
showActionsOnHover: true,
|
|
406
|
-
actions: /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(import_ui9.IconButton, { size: "tiny", onClick: onPlayInteraction }, /* @__PURE__ */ React11.createElement(import_icons4.PlayerPlayIcon, { fontSize: "tiny" })), /* @__PURE__ */ React11.createElement(import_ui9.IconButton, { size: "tiny", onClick: () => onDelete?.() }, /* @__PURE__ */ React11.createElement(import_icons4.XIcon, { fontSize: "tiny" })))
|
|
407
|
-
}
|
|
408
|
-
), /* @__PURE__ */ React11.createElement(
|
|
409
|
-
import_ui9.Popover,
|
|
344
|
+
const option = animationOptions.find((opt) => opt.value === interactionForDisplay);
|
|
345
|
+
return option?.label || interactionForDisplay;
|
|
346
|
+
};
|
|
347
|
+
return /* @__PURE__ */ React10.createElement(
|
|
348
|
+
import_editor_controls.Repeater,
|
|
410
349
|
{
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
350
|
+
addToBottom: true,
|
|
351
|
+
openOnAdd: true,
|
|
352
|
+
openItem: triggerCreateOnShowEmpty ? 0 : void 0,
|
|
353
|
+
label: (0, import_i18n8.__)("Interactions", "elementor"),
|
|
354
|
+
values: interactionId ? [interactionId] : [],
|
|
355
|
+
setValues: (newValue) => {
|
|
356
|
+
setInteractionId(newValue.length > 0 ? newValue[0] : null);
|
|
418
357
|
},
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
358
|
+
showDuplicate: false,
|
|
359
|
+
showToggle: false,
|
|
360
|
+
isSortable: false,
|
|
361
|
+
disableAddItemButton: !!interactionId,
|
|
362
|
+
itemSettings: {
|
|
363
|
+
initialValues: interactionId ?? "load-fade-in-left-100-0",
|
|
364
|
+
Label: ({ value }) => displayLabel(value),
|
|
365
|
+
Icon: () => null,
|
|
366
|
+
Content: ({ value }) => /* @__PURE__ */ React10.createElement(
|
|
367
|
+
InteractionDetails,
|
|
368
|
+
{
|
|
369
|
+
interaction: value,
|
|
370
|
+
onChange: (newValue) => {
|
|
371
|
+
if (value !== newValue) {
|
|
372
|
+
setInteractionId(newValue);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
actions: /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(import_ui8.IconButton, { size: "tiny", onClick: onPlayInteraction }, /* @__PURE__ */ React10.createElement(import_icons3.PlayerPlayIcon, { fontSize: "tiny" })))
|
|
430
378
|
}
|
|
431
|
-
|
|
432
|
-
)
|
|
379
|
+
}
|
|
380
|
+
);
|
|
433
381
|
}
|
|
434
382
|
|
|
435
383
|
// src/components/interactions-tab.tsx
|
|
436
384
|
var InteractionsTab = ({ elementId }) => {
|
|
437
|
-
return /* @__PURE__ */
|
|
385
|
+
return /* @__PURE__ */ React11.createElement(PopupStateProvider, null, /* @__PURE__ */ React11.createElement(InteractionsTabContent, { elementId }));
|
|
438
386
|
};
|
|
439
387
|
function InteractionsTabContent({ elementId }) {
|
|
440
388
|
const existingInteractions = (0, import_editor_elements2.useElementInteractions)(elementId);
|
|
441
|
-
const
|
|
389
|
+
const [firstInteraction, setFirstInteraction] = (0, import_react5.useState)(false);
|
|
442
390
|
const [showInteractions, setShowInteractions] = (0, import_react5.useState)(() => {
|
|
443
391
|
const parsed = JSON.parse(existingInteractions || "{}");
|
|
444
392
|
if (parsed && parsed?.items?.length > 0) {
|
|
@@ -446,20 +394,24 @@ function InteractionsTabContent({ elementId }) {
|
|
|
446
394
|
}
|
|
447
395
|
return false;
|
|
448
396
|
});
|
|
449
|
-
return /* @__PURE__ */
|
|
397
|
+
return /* @__PURE__ */ React11.createElement(import_session.SessionStorageProvider, { prefix: elementId }, showInteractions ? /* @__PURE__ */ React11.createElement(InteractionsProvider, { elementId }, /* @__PURE__ */ React11.createElement(InteractionsContent, { firstInteraction })) : /* @__PURE__ */ React11.createElement(
|
|
450
398
|
EmptyState,
|
|
451
399
|
{
|
|
452
400
|
onCreateInteraction: () => {
|
|
401
|
+
setFirstInteraction(true);
|
|
453
402
|
setShowInteractions(true);
|
|
454
|
-
triggerDefaultOpen();
|
|
455
403
|
}
|
|
456
404
|
}
|
|
457
405
|
));
|
|
458
406
|
}
|
|
459
|
-
function InteractionsContent() {
|
|
407
|
+
function InteractionsContent({ firstInteraction }) {
|
|
460
408
|
const { interactions, setInteractions, playInteractions } = useInteractionsContext();
|
|
461
409
|
const applyInteraction = (0, import_react5.useCallback)(
|
|
462
410
|
(interaction) => {
|
|
411
|
+
if (!interaction) {
|
|
412
|
+
setInteractions(void 0);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
463
415
|
const newInteractions = {
|
|
464
416
|
version: 1,
|
|
465
417
|
items: [
|
|
@@ -486,9 +438,10 @@ function InteractionsContent() {
|
|
|
486
438
|
return "";
|
|
487
439
|
}
|
|
488
440
|
}, [interactions]);
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
|
|
441
|
+
return /* @__PURE__ */ React11.createElement(import_ui9.Stack, { sx: { m: 1, p: 1.5 }, gap: 2 }, /* @__PURE__ */ React11.createElement(
|
|
442
|
+
InteractionsList,
|
|
491
443
|
{
|
|
444
|
+
triggerCreateOnShowEmpty: firstInteraction,
|
|
492
445
|
selectedInteraction,
|
|
493
446
|
onSelectInteraction: applyInteraction,
|
|
494
447
|
onPlayInteraction: playInteractions
|