@elementor/editor-variables 3.33.0-174 → 3.33.0-176
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 +418 -289
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +391 -252
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/ui/menu-item-content.tsx +14 -11
- package/src/components/ui/tags/assigned-tag.tsx +6 -3
- package/src/components/variable-edit.tsx +7 -9
- package/src/components/variables-manager/hooks/use-error-navigation.ts +49 -0
- package/src/components/variables-manager/hooks/use-variables-manager-state.ts +16 -24
- package/src/components/variables-manager/variables-manager-panel.tsx +169 -102
- package/src/components/variables-selection.tsx +23 -7
- package/src/utils/validations.ts +54 -2
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { isTransformable as isTransformable2 } from "@elementor/editor-props";
|
|
|
6
6
|
|
|
7
7
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
8
8
|
import * as React12 from "react";
|
|
9
|
-
import { useCallback as
|
|
9
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState5 } from "react";
|
|
10
10
|
import {
|
|
11
11
|
__createPanel as createPanel,
|
|
12
12
|
Panel,
|
|
@@ -17,9 +17,107 @@ import {
|
|
|
17
17
|
} from "@elementor/editor-panels";
|
|
18
18
|
import { SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
19
19
|
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
20
|
-
import { ColorFilterIcon, TrashIcon } from "@elementor/icons";
|
|
21
|
-
import {
|
|
22
|
-
|
|
20
|
+
import { AlertTriangleFilledIcon, ColorFilterIcon, TrashIcon } from "@elementor/icons";
|
|
21
|
+
import {
|
|
22
|
+
Alert,
|
|
23
|
+
AlertAction,
|
|
24
|
+
AlertTitle,
|
|
25
|
+
Button as Button3,
|
|
26
|
+
CloseButton,
|
|
27
|
+
Divider,
|
|
28
|
+
Infotip,
|
|
29
|
+
Stack as Stack6,
|
|
30
|
+
usePopupState as usePopupState2
|
|
31
|
+
} from "@elementor/ui";
|
|
32
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
33
|
+
|
|
34
|
+
// src/utils/validations.ts
|
|
35
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
36
|
+
var ERROR_MESSAGES = {
|
|
37
|
+
MISSING_VARIABLE_NAME: __("Give your variable a name.", "elementor"),
|
|
38
|
+
MISSING_VARIABLE_VALUE: __("Add a value to complete your variable.", "elementor"),
|
|
39
|
+
INVALID_CHARACTERS: __("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
40
|
+
NO_NON_SPECIAL_CHARACTER: __("Names have to include at least one non-special character.", "elementor"),
|
|
41
|
+
VARIABLE_LABEL_MAX_LENGTH: __("Keep names up to 50 characters.", "elementor"),
|
|
42
|
+
DUPLICATED_LABEL: __("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
43
|
+
UNEXPECTED_ERROR: __("There was a glitch. Try saving your variable again.", "elementor"),
|
|
44
|
+
BATCH: {
|
|
45
|
+
DUPLICATED_LABELS: (count, name) => (
|
|
46
|
+
// eslint-disable-next-line @wordpress/i18n-translator-comments
|
|
47
|
+
sprintf(__("We found %1$d duplicated %2$s.", "elementor"), count, name)
|
|
48
|
+
),
|
|
49
|
+
UNEXPECTED_ERROR: __("The save didn\u2019t go through.", "elementor"),
|
|
50
|
+
DUPLICATED_LABEL_ACTION: __("Take me there", "elementor"),
|
|
51
|
+
DUPLICATED_LABEL_ACTION_MESSAGE: __("Please rename the variables.", "elementor"),
|
|
52
|
+
UNEXPECTED_ERROR_ACTION_MESSAGE: __("Try saving your variables again.", "elementor")
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
56
|
+
var mapServerError = (error) => {
|
|
57
|
+
if (error?.response?.data?.code === "duplicated_label") {
|
|
58
|
+
return {
|
|
59
|
+
field: "label",
|
|
60
|
+
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (error?.response?.data?.code === "batch_duplicated_label") {
|
|
64
|
+
const errorData = error?.response?.data?.data ?? {};
|
|
65
|
+
const count = Object.keys(errorData).length;
|
|
66
|
+
const name = count === 1 ? "name" : "names";
|
|
67
|
+
const duplicatedIds = Object.keys(errorData);
|
|
68
|
+
return {
|
|
69
|
+
field: "label",
|
|
70
|
+
message: ERROR_MESSAGES.BATCH.DUPLICATED_LABELS(count, name),
|
|
71
|
+
action: {
|
|
72
|
+
label: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION,
|
|
73
|
+
message: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION_MESSAGE,
|
|
74
|
+
data: {
|
|
75
|
+
duplicatedIds
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (error?.response?.data?.code === "batch_operation_failed") {
|
|
81
|
+
return {
|
|
82
|
+
field: "label",
|
|
83
|
+
message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return void 0;
|
|
87
|
+
};
|
|
88
|
+
var validateLabel = (name, variables) => {
|
|
89
|
+
if (!name.trim()) {
|
|
90
|
+
return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
|
|
91
|
+
}
|
|
92
|
+
const allowedChars = /^[a-zA-Z0-9_-]+$/;
|
|
93
|
+
if (!allowedChars.test(name)) {
|
|
94
|
+
return ERROR_MESSAGES.INVALID_CHARACTERS;
|
|
95
|
+
}
|
|
96
|
+
const hasAlphanumeric = /[a-zA-Z0-9]/;
|
|
97
|
+
if (!hasAlphanumeric.test(name)) {
|
|
98
|
+
return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
|
|
99
|
+
}
|
|
100
|
+
if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
|
|
101
|
+
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
102
|
+
}
|
|
103
|
+
if (Object.values(variables ?? {}).some((variable) => variable.label === name)) {
|
|
104
|
+
return ERROR_MESSAGES.DUPLICATED_LABEL;
|
|
105
|
+
}
|
|
106
|
+
return "";
|
|
107
|
+
};
|
|
108
|
+
var labelHint = (name) => {
|
|
109
|
+
const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
|
|
110
|
+
if (hintThreshold < name.length) {
|
|
111
|
+
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
112
|
+
}
|
|
113
|
+
return "";
|
|
114
|
+
};
|
|
115
|
+
var validateValue = (value) => {
|
|
116
|
+
if (!value.trim()) {
|
|
117
|
+
return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
|
|
118
|
+
}
|
|
119
|
+
return "";
|
|
120
|
+
};
|
|
23
121
|
|
|
24
122
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
25
123
|
import * as React from "react";
|
|
@@ -33,7 +131,7 @@ import {
|
|
|
33
131
|
DialogTitle,
|
|
34
132
|
Typography
|
|
35
133
|
} from "@elementor/ui";
|
|
36
|
-
import { __ } from "@wordpress/i18n";
|
|
134
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
37
135
|
var TITLE_ID = "delete-variable-dialog";
|
|
38
136
|
var DeleteConfirmationDialog = ({
|
|
39
137
|
open,
|
|
@@ -41,13 +139,13 @@ var DeleteConfirmationDialog = ({
|
|
|
41
139
|
closeDialog,
|
|
42
140
|
onConfirm
|
|
43
141
|
}) => {
|
|
44
|
-
return /* @__PURE__ */ React.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React.createElement(AlertOctagonFilledIcon, { color: "error" }),
|
|
142
|
+
return /* @__PURE__ */ React.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React.createElement(AlertOctagonFilledIcon, { color: "error" }), __2("Delete this variable?", "elementor")), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __2("All elements using", "elementor"), "\xA0", /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2", component: "span", sx: { lineBreak: "anywhere" } }, label), "\xA0", __2("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { color: "secondary", onClick: closeDialog }, __2("Not now", "elementor")), /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "error", onClick: onConfirm }, __2("Delete", "elementor"))));
|
|
45
143
|
};
|
|
46
144
|
|
|
47
145
|
// src/components/ui/empty-state.tsx
|
|
48
146
|
import * as React2 from "react";
|
|
49
147
|
import { Button as Button2, Stack, Typography as Typography2 } from "@elementor/ui";
|
|
50
|
-
import { __ as
|
|
148
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
51
149
|
|
|
52
150
|
// src/hooks/use-permissions.ts
|
|
53
151
|
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
@@ -78,11 +176,11 @@ var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
|
78
176
|
sx: { p: 2.5, pt: 8, pb: 5.5 }
|
|
79
177
|
},
|
|
80
178
|
icon,
|
|
81
|
-
canAdd ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React2.createElement(Button2, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd },
|
|
179
|
+
canAdd ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React2.createElement(Button2, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __3("Create a variable", "elementor"))) : /* @__PURE__ */ React2.createElement(
|
|
82
180
|
Content,
|
|
83
181
|
{
|
|
84
|
-
title:
|
|
85
|
-
message:
|
|
182
|
+
title: __3("There are no variables", "elementor"),
|
|
183
|
+
message: __3("With your current role, you can only connect and detach variables.", "elementor")
|
|
86
184
|
}
|
|
87
185
|
)
|
|
88
186
|
);
|
|
@@ -94,7 +192,7 @@ function Content({ title, message }) {
|
|
|
94
192
|
// src/components/ui/no-search-results.tsx
|
|
95
193
|
import * as React3 from "react";
|
|
96
194
|
import { Link, Stack as Stack2, Typography as Typography3 } from "@elementor/ui";
|
|
97
|
-
import { __ as
|
|
195
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
98
196
|
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
99
197
|
return /* @__PURE__ */ React3.createElement(
|
|
100
198
|
Stack2,
|
|
@@ -107,8 +205,8 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
107
205
|
sx: { pb: 3.5, pt: 8 }
|
|
108
206
|
},
|
|
109
207
|
icon,
|
|
110
|
-
/* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "subtitle2" },
|
|
111
|
-
/* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } },
|
|
208
|
+
/* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "subtitle2" }, __4("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React3.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
209
|
+
/* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __4("Try something else.", "elementor"), /* @__PURE__ */ React3.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __4("Clear & try again", "elementor")))
|
|
112
210
|
);
|
|
113
211
|
};
|
|
114
212
|
|
|
@@ -131,9 +229,43 @@ var useAutoEdit = () => {
|
|
|
131
229
|
};
|
|
132
230
|
};
|
|
133
231
|
|
|
232
|
+
// src/components/variables-manager/hooks/use-error-navigation.ts
|
|
233
|
+
import { useCallback as useCallback2, useRef } from "react";
|
|
234
|
+
var useErrorNavigation = () => {
|
|
235
|
+
const currentIndexRef = useRef(0);
|
|
236
|
+
const createNavigationCallback = useCallback2(
|
|
237
|
+
(ids, onNavigate, onComplete) => {
|
|
238
|
+
return () => {
|
|
239
|
+
if (!ids?.length) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const currentIndex = currentIndexRef.current;
|
|
243
|
+
const currentId = ids[currentIndex];
|
|
244
|
+
if (currentId) {
|
|
245
|
+
onNavigate(currentId);
|
|
246
|
+
const nextIndex = currentIndex + 1;
|
|
247
|
+
if (nextIndex >= ids.length) {
|
|
248
|
+
onComplete();
|
|
249
|
+
currentIndexRef.current = 0;
|
|
250
|
+
} else {
|
|
251
|
+
currentIndexRef.current = nextIndex;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
},
|
|
256
|
+
[]
|
|
257
|
+
);
|
|
258
|
+
const resetNavigation = useCallback2(() => {
|
|
259
|
+
currentIndexRef.current = 0;
|
|
260
|
+
}, []);
|
|
261
|
+
return {
|
|
262
|
+
createNavigationCallback,
|
|
263
|
+
resetNavigation
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
|
|
134
267
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
135
|
-
import { useCallback as
|
|
136
|
-
import { __ as __7 } from "@wordpress/i18n";
|
|
268
|
+
import { useCallback as useCallback3, useState as useState2 } from "react";
|
|
137
269
|
|
|
138
270
|
// src/batch-operations.ts
|
|
139
271
|
var generateTempId = () => {
|
|
@@ -211,7 +343,7 @@ import { stylesInheritanceTransformersRegistry } from "@elementor/editor-editing
|
|
|
211
343
|
import * as React4 from "react";
|
|
212
344
|
import { createTransformer } from "@elementor/editor-canvas";
|
|
213
345
|
import { Stack as Stack3, Typography as Typography4 } from "@elementor/ui";
|
|
214
|
-
import { __ as
|
|
346
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
215
347
|
|
|
216
348
|
// src/components/ui/color-indicator.tsx
|
|
217
349
|
import { styled, UnstableColorIndicator } from "@elementor/ui";
|
|
@@ -226,7 +358,7 @@ import { z } from "@elementor/schema";
|
|
|
226
358
|
var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
|
|
227
359
|
|
|
228
360
|
// src/service.ts
|
|
229
|
-
import { __ as
|
|
361
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
230
362
|
|
|
231
363
|
// src/api.ts
|
|
232
364
|
import { httpService } from "@elementor/http-client";
|
|
@@ -431,7 +563,7 @@ var service = {
|
|
|
431
563
|
return apiClient.create(type, label, value).then((response) => {
|
|
432
564
|
const { success, data: payload } = response.data;
|
|
433
565
|
if (!success) {
|
|
434
|
-
const errorMessage = payload?.message ||
|
|
566
|
+
const errorMessage = payload?.message || __5("Unexpected response from server", "elementor");
|
|
435
567
|
throw new Error(errorMessage);
|
|
436
568
|
}
|
|
437
569
|
return payload;
|
|
@@ -453,7 +585,7 @@ var service = {
|
|
|
453
585
|
return apiClient.update(id2, label, value).then((response) => {
|
|
454
586
|
const { success, data: payload } = response.data;
|
|
455
587
|
if (!success) {
|
|
456
|
-
const errorMessage = payload?.message ||
|
|
588
|
+
const errorMessage = payload?.message || __5("Unexpected response from server", "elementor");
|
|
457
589
|
throw new Error(errorMessage);
|
|
458
590
|
}
|
|
459
591
|
return payload;
|
|
@@ -586,7 +718,7 @@ var inheritanceTransformer = createTransformer((id2) => {
|
|
|
586
718
|
const variables = service.variables();
|
|
587
719
|
const variable = variables[id2];
|
|
588
720
|
if (!variable) {
|
|
589
|
-
return /* @__PURE__ */ React4.createElement("span", null,
|
|
721
|
+
return /* @__PURE__ */ React4.createElement("span", null, __6("Missing variable", "elementor"));
|
|
590
722
|
}
|
|
591
723
|
const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
|
|
592
724
|
const css = resolveCssVariable(id2, variable);
|
|
@@ -756,77 +888,22 @@ var restoreVariable = (restoreId, label, value) => {
|
|
|
756
888
|
return service.restore(restoreId, label, value).then(extractId);
|
|
757
889
|
};
|
|
758
890
|
|
|
759
|
-
// src/utils/validations.ts
|
|
760
|
-
import { __ as __6 } from "@wordpress/i18n";
|
|
761
|
-
var ERROR_MESSAGES = {
|
|
762
|
-
MISSING_VARIABLE_NAME: __6("Give your variable a name.", "elementor"),
|
|
763
|
-
MISSING_VARIABLE_VALUE: __6("Add a value to complete your variable.", "elementor"),
|
|
764
|
-
INVALID_CHARACTERS: __6("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
765
|
-
NO_NON_SPECIAL_CHARACTER: __6("Names have to include at least one non-special character.", "elementor"),
|
|
766
|
-
VARIABLE_LABEL_MAX_LENGTH: __6("Keep names up to 50 characters.", "elementor"),
|
|
767
|
-
DUPLICATED_LABEL: __6("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
768
|
-
UNEXPECTED_ERROR: __6("There was a glitch. Try saving your variable again.", "elementor")
|
|
769
|
-
};
|
|
770
|
-
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
771
|
-
var mapServerError = (error) => {
|
|
772
|
-
if (error?.response?.data?.code === "duplicated_label") {
|
|
773
|
-
return {
|
|
774
|
-
field: "label",
|
|
775
|
-
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
return void 0;
|
|
779
|
-
};
|
|
780
|
-
var validateLabel = (name, variables) => {
|
|
781
|
-
if (!name.trim()) {
|
|
782
|
-
return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
|
|
783
|
-
}
|
|
784
|
-
const allowedChars = /^[a-zA-Z0-9_-]+$/;
|
|
785
|
-
if (!allowedChars.test(name)) {
|
|
786
|
-
return ERROR_MESSAGES.INVALID_CHARACTERS;
|
|
787
|
-
}
|
|
788
|
-
const hasAlphanumeric = /[a-zA-Z0-9]/;
|
|
789
|
-
if (!hasAlphanumeric.test(name)) {
|
|
790
|
-
return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
|
|
791
|
-
}
|
|
792
|
-
if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
|
|
793
|
-
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
794
|
-
}
|
|
795
|
-
if (Object.values(variables ?? {}).some((variable) => variable.label === name)) {
|
|
796
|
-
return ERROR_MESSAGES.DUPLICATED_LABEL;
|
|
797
|
-
}
|
|
798
|
-
return "";
|
|
799
|
-
};
|
|
800
|
-
var labelHint = (name) => {
|
|
801
|
-
const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
|
|
802
|
-
if (hintThreshold < name.length) {
|
|
803
|
-
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
804
|
-
}
|
|
805
|
-
return "";
|
|
806
|
-
};
|
|
807
|
-
var validateValue = (value) => {
|
|
808
|
-
if (!value.trim()) {
|
|
809
|
-
return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
|
|
810
|
-
}
|
|
811
|
-
return "";
|
|
812
|
-
};
|
|
813
|
-
|
|
814
891
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
815
892
|
var useVariablesManagerState = () => {
|
|
816
893
|
const [variables, setVariables] = useState2(() => getVariables(false));
|
|
817
894
|
const [deletedVariables, setDeletedVariables] = useState2([]);
|
|
895
|
+
const [isSaveDisabled, setIsSaveDisabled] = useState2(false);
|
|
818
896
|
const [isDirty, setIsDirty] = useState2(false);
|
|
819
|
-
const [hasValidationErrors, setHasValidationErrors] = useState2(false);
|
|
820
897
|
const [isSaving, setIsSaving] = useState2(false);
|
|
821
898
|
const [searchValue, setSearchValue] = useState2("");
|
|
822
|
-
const handleOnChange =
|
|
899
|
+
const handleOnChange = useCallback3(
|
|
823
900
|
(newVariables) => {
|
|
824
901
|
setVariables({ ...variables, ...newVariables });
|
|
825
902
|
setIsDirty(true);
|
|
826
903
|
},
|
|
827
904
|
[variables]
|
|
828
905
|
);
|
|
829
|
-
const createVariable2 =
|
|
906
|
+
const createVariable2 = useCallback3((type, defaultName, defaultValue) => {
|
|
830
907
|
const newId = generateTempId();
|
|
831
908
|
const newVariable = {
|
|
832
909
|
id: newId,
|
|
@@ -838,7 +915,7 @@ var useVariablesManagerState = () => {
|
|
|
838
915
|
setIsDirty(true);
|
|
839
916
|
return newId;
|
|
840
917
|
}, []);
|
|
841
|
-
const handleDeleteVariable =
|
|
918
|
+
const handleDeleteVariable = useCallback3((itemId) => {
|
|
842
919
|
setDeletedVariables((prev) => [...prev, itemId]);
|
|
843
920
|
setVariables((prev) => ({ ...prev, [itemId]: { ...prev[itemId], deleted: true } }));
|
|
844
921
|
setIsDirty(true);
|
|
@@ -846,26 +923,18 @@ var useVariablesManagerState = () => {
|
|
|
846
923
|
const handleSearch = (searchTerm) => {
|
|
847
924
|
setSearchValue(searchTerm);
|
|
848
925
|
};
|
|
849
|
-
const handleSave =
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
return { success: true };
|
|
862
|
-
}
|
|
863
|
-
throw new Error(__7("Failed to save variables. Please try again.", "elementor"));
|
|
864
|
-
} catch (error) {
|
|
865
|
-
const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNEXPECTED_ERROR;
|
|
866
|
-
setIsSaving(false);
|
|
867
|
-
return { success: false, error: errorMessage };
|
|
868
|
-
}
|
|
926
|
+
const handleSave = useCallback3(async () => {
|
|
927
|
+
const originalVariables = getVariables(false);
|
|
928
|
+
setIsSaving(true);
|
|
929
|
+
const result = await service.batchSave(originalVariables, variables);
|
|
930
|
+
if (result.success) {
|
|
931
|
+
await service.load();
|
|
932
|
+
const updatedVariables = service.variables();
|
|
933
|
+
setVariables(updatedVariables);
|
|
934
|
+
setDeletedVariables([]);
|
|
935
|
+
setIsDirty(false);
|
|
936
|
+
}
|
|
937
|
+
return { success: result.success };
|
|
869
938
|
}, [variables]);
|
|
870
939
|
const filteredVariables = () => {
|
|
871
940
|
const list = Object.entries(variables).map(([id2, value]) => ({ ...value, id: id2 }));
|
|
@@ -876,7 +945,7 @@ var useVariablesManagerState = () => {
|
|
|
876
945
|
variables: filteredVariables(),
|
|
877
946
|
deletedVariables,
|
|
878
947
|
isDirty,
|
|
879
|
-
|
|
948
|
+
isSaveDisabled,
|
|
880
949
|
handleOnChange,
|
|
881
950
|
createVariable: createVariable2,
|
|
882
951
|
handleDeleteVariable,
|
|
@@ -884,16 +953,17 @@ var useVariablesManagerState = () => {
|
|
|
884
953
|
isSaving,
|
|
885
954
|
handleSearch,
|
|
886
955
|
searchValue,
|
|
887
|
-
|
|
956
|
+
setIsSaving,
|
|
957
|
+
setIsSaveDisabled
|
|
888
958
|
};
|
|
889
959
|
};
|
|
890
960
|
|
|
891
961
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
892
962
|
import * as React6 from "react";
|
|
893
|
-
import { createElement as createElement7, useRef } from "react";
|
|
963
|
+
import { createElement as createElement7, useRef as useRef2 } from "react";
|
|
894
964
|
import { PlusIcon } from "@elementor/icons";
|
|
895
965
|
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography5 } from "@elementor/ui";
|
|
896
|
-
import { __ as
|
|
966
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
897
967
|
var SIZE = "tiny";
|
|
898
968
|
var VariableManagerCreateMenu = ({
|
|
899
969
|
variables,
|
|
@@ -901,7 +971,7 @@ var VariableManagerCreateMenu = ({
|
|
|
901
971
|
disabled,
|
|
902
972
|
menuState
|
|
903
973
|
}) => {
|
|
904
|
-
const buttonRef =
|
|
974
|
+
const buttonRef = useRef2(null);
|
|
905
975
|
const variableTypes = getVariableTypes();
|
|
906
976
|
const menuOptions = Object.entries(variableTypes).map(([key, variable]) => {
|
|
907
977
|
const displayName = variable.variableType.charAt(0).toUpperCase() + variable.variableType.slice(1);
|
|
@@ -922,7 +992,7 @@ var VariableManagerCreateMenu = ({
|
|
|
922
992
|
ref: buttonRef,
|
|
923
993
|
disabled,
|
|
924
994
|
size: SIZE,
|
|
925
|
-
"aria-label":
|
|
995
|
+
"aria-label": __7("Add variable", "elementor")
|
|
926
996
|
},
|
|
927
997
|
/* @__PURE__ */ React6.createElement(PlusIcon, { fontSize: SIZE })
|
|
928
998
|
), /* @__PURE__ */ React6.createElement(
|
|
@@ -980,7 +1050,7 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
980
1050
|
|
|
981
1051
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
982
1052
|
import * as React11 from "react";
|
|
983
|
-
import { createElement as createElement14, useEffect as useEffect2, useRef as
|
|
1053
|
+
import { createElement as createElement14, useEffect as useEffect2, useRef as useRef5 } from "react";
|
|
984
1054
|
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
985
1055
|
import { GripVerticalIcon } from "@elementor/icons";
|
|
986
1056
|
import {
|
|
@@ -994,11 +1064,11 @@ import {
|
|
|
994
1064
|
UnstableSortableItem,
|
|
995
1065
|
UnstableSortableProvider
|
|
996
1066
|
} from "@elementor/ui";
|
|
997
|
-
import { __ as
|
|
1067
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
998
1068
|
|
|
999
1069
|
// src/components/fields/label-field.tsx
|
|
1000
1070
|
import * as React7 from "react";
|
|
1001
|
-
import { useRef as
|
|
1071
|
+
import { useRef as useRef3, useState as useState3 } from "react";
|
|
1002
1072
|
import { WarningInfotip } from "@elementor/editor-ui";
|
|
1003
1073
|
import { TextField } from "@elementor/ui";
|
|
1004
1074
|
function isLabelEqual(a, b) {
|
|
@@ -1025,7 +1095,7 @@ var LabelField = ({
|
|
|
1025
1095
|
}) => {
|
|
1026
1096
|
const [label, setLabel] = useState3(value);
|
|
1027
1097
|
const [errorMessage, setErrorMessage] = useState3("");
|
|
1028
|
-
const fieldRef =
|
|
1098
|
+
const fieldRef = useRef3(null);
|
|
1029
1099
|
const handleChange = (newValue) => {
|
|
1030
1100
|
setLabel(newValue);
|
|
1031
1101
|
const errorMsg2 = validateLabel(newValue, variables);
|
|
@@ -1154,7 +1224,7 @@ var VariableTableCell = ({
|
|
|
1154
1224
|
|
|
1155
1225
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1156
1226
|
import * as React10 from "react";
|
|
1157
|
-
import { useCallback as
|
|
1227
|
+
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as useState4 } from "react";
|
|
1158
1228
|
import { ClickAwayListener, Stack as Stack4 } from "@elementor/ui";
|
|
1159
1229
|
var VariableEditableCell = React10.memo(
|
|
1160
1230
|
({
|
|
@@ -1173,8 +1243,8 @@ var VariableEditableCell = React10.memo(
|
|
|
1173
1243
|
const [isEditing, setIsEditing] = useState4(false);
|
|
1174
1244
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1175
1245
|
const [valueFieldError, setValueFieldError] = useState4("");
|
|
1176
|
-
const rowRef =
|
|
1177
|
-
const handleSave =
|
|
1246
|
+
const rowRef = useRef4(null);
|
|
1247
|
+
const handleSave = useCallback4(() => {
|
|
1178
1248
|
const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
|
|
1179
1249
|
if (!hasError) {
|
|
1180
1250
|
onChange(value);
|
|
@@ -1204,10 +1274,10 @@ var VariableEditableCell = React10.memo(
|
|
|
1204
1274
|
setIsEditing(true);
|
|
1205
1275
|
}
|
|
1206
1276
|
};
|
|
1207
|
-
const handleChange =
|
|
1277
|
+
const handleChange = useCallback4((newValue) => {
|
|
1208
1278
|
setValue(newValue);
|
|
1209
1279
|
}, []);
|
|
1210
|
-
const handleValidationChange =
|
|
1280
|
+
const handleValidationChange = useCallback4(
|
|
1211
1281
|
(errorMsg) => {
|
|
1212
1282
|
if (fieldType === "label") {
|
|
1213
1283
|
setLabelFieldError({
|
|
@@ -1278,8 +1348,8 @@ var VariablesManagerTable = ({
|
|
|
1278
1348
|
onAutoEditComplete,
|
|
1279
1349
|
onFieldError
|
|
1280
1350
|
}) => {
|
|
1281
|
-
const tableContainerRef =
|
|
1282
|
-
const variableRowRefs =
|
|
1351
|
+
const tableContainerRef = useRef5(null);
|
|
1352
|
+
const variableRowRefs = useRef5(/* @__PURE__ */ new Map());
|
|
1283
1353
|
useEffect2(() => {
|
|
1284
1354
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1285
1355
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
@@ -1328,7 +1398,7 @@ var VariablesManagerTable = ({
|
|
|
1328
1398
|
});
|
|
1329
1399
|
handleOnChange(updatedVariables);
|
|
1330
1400
|
};
|
|
1331
|
-
return /* @__PURE__ */ React11.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React11.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React11.createElement(TableHead, null, /* @__PURE__ */ React11.createElement(TableRow, null, /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true },
|
|
1401
|
+
return /* @__PURE__ */ React11.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React11.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React11.createElement(TableHead, null, /* @__PURE__ */ React11.createElement(TableRow, null, /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true }, __8("Name", "elementor")), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true }, __8("Value", "elementor")), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React11.createElement(TableBody, null, /* @__PURE__ */ React11.createElement(
|
|
1332
1402
|
UnstableSortableProvider,
|
|
1333
1403
|
{
|
|
1334
1404
|
value: ids,
|
|
@@ -1544,18 +1614,21 @@ function VariablesManagerPanel() {
|
|
|
1544
1614
|
const {
|
|
1545
1615
|
variables,
|
|
1546
1616
|
isDirty,
|
|
1547
|
-
hasValidationErrors,
|
|
1548
1617
|
searchValue,
|
|
1618
|
+
isSaveDisabled,
|
|
1549
1619
|
handleOnChange,
|
|
1550
1620
|
createVariable: createVariable2,
|
|
1551
1621
|
handleDeleteVariable,
|
|
1552
1622
|
handleSave,
|
|
1553
1623
|
isSaving,
|
|
1554
1624
|
handleSearch,
|
|
1555
|
-
|
|
1625
|
+
setIsSaving,
|
|
1626
|
+
setIsSaveDisabled
|
|
1556
1627
|
} = useVariablesManagerState();
|
|
1557
1628
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1629
|
+
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1558
1630
|
const [deleteConfirmation, setDeleteConfirmation] = useState5(null);
|
|
1631
|
+
const [serverError, setServerError] = useState5(null);
|
|
1559
1632
|
usePreventUnload(isDirty);
|
|
1560
1633
|
const handleClosePanel = () => {
|
|
1561
1634
|
if (isDirty) {
|
|
@@ -1564,7 +1637,7 @@ function VariablesManagerPanel() {
|
|
|
1564
1637
|
}
|
|
1565
1638
|
closePanel();
|
|
1566
1639
|
};
|
|
1567
|
-
const handleCreateVariable =
|
|
1640
|
+
const handleCreateVariable = useCallback5(
|
|
1568
1641
|
(type, defaultName, defaultValue) => {
|
|
1569
1642
|
const newId = createVariable2(type, defaultName, defaultValue);
|
|
1570
1643
|
if (newId) {
|
|
@@ -1573,7 +1646,30 @@ function VariablesManagerPanel() {
|
|
|
1573
1646
|
},
|
|
1574
1647
|
[createVariable2, startAutoEdit]
|
|
1575
1648
|
);
|
|
1576
|
-
const
|
|
1649
|
+
const handleSaveClick = async () => {
|
|
1650
|
+
try {
|
|
1651
|
+
setServerError(null);
|
|
1652
|
+
resetNavigation();
|
|
1653
|
+
return await handleSave();
|
|
1654
|
+
} catch (error) {
|
|
1655
|
+
const mappedError = mapServerError(error);
|
|
1656
|
+
const duplicatedIds = mappedError?.action?.data?.duplicatedIds;
|
|
1657
|
+
if (mappedError && "label" === mappedError.field) {
|
|
1658
|
+
if (duplicatedIds && mappedError.action) {
|
|
1659
|
+
mappedError.action.callback = createNavigationCallback(duplicatedIds, startAutoEdit, () => {
|
|
1660
|
+
setIsSaveDisabled(false);
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
setServerError(mappedError);
|
|
1664
|
+
setIsSaveDisabled(true);
|
|
1665
|
+
resetNavigation();
|
|
1666
|
+
}
|
|
1667
|
+
return { success: false, error: mappedError };
|
|
1668
|
+
} finally {
|
|
1669
|
+
setIsSaving(false);
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
const handleDeleteVariableWithConfirmation = useCallback5(
|
|
1577
1673
|
(itemId) => {
|
|
1578
1674
|
handleDeleteVariable(itemId);
|
|
1579
1675
|
setDeleteConfirmation(null);
|
|
@@ -1582,7 +1678,7 @@ function VariablesManagerPanel() {
|
|
|
1582
1678
|
);
|
|
1583
1679
|
const menuActions = [
|
|
1584
1680
|
{
|
|
1585
|
-
name:
|
|
1681
|
+
name: __9("Delete", "elementor"),
|
|
1586
1682
|
icon: TrashIcon,
|
|
1587
1683
|
color: "error.main",
|
|
1588
1684
|
onClick: (itemId) => {
|
|
@@ -1593,14 +1689,14 @@ function VariablesManagerPanel() {
|
|
|
1593
1689
|
}
|
|
1594
1690
|
];
|
|
1595
1691
|
const hasVariables = Object.values(variables).some((variable) => !variable.deleted);
|
|
1596
|
-
return /* @__PURE__ */ React12.createElement(ThemeProvider, null, /* @__PURE__ */ React12.createElement(
|
|
1692
|
+
return /* @__PURE__ */ React12.createElement(ThemeProvider, null, /* @__PURE__ */ React12.createElement(Panel, null, /* @__PURE__ */ React12.createElement(
|
|
1597
1693
|
PanelHeader,
|
|
1598
1694
|
{
|
|
1599
1695
|
sx: {
|
|
1600
1696
|
height: "unset"
|
|
1601
1697
|
}
|
|
1602
1698
|
},
|
|
1603
|
-
/* @__PURE__ */ React12.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React12.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React12.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React12.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React12.createElement(ColorFilterIcon, { fontSize: "inherit" }),
|
|
1699
|
+
/* @__PURE__ */ React12.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React12.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React12.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React12.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React12.createElement(ColorFilterIcon, { fontSize: "inherit" }), __9("Variable Manager", "elementor"))), /* @__PURE__ */ React12.createElement(Stack6, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React12.createElement(
|
|
1604
1700
|
VariableManagerCreateMenu,
|
|
1605
1701
|
{
|
|
1606
1702
|
onCreate: handleCreateVariable,
|
|
@@ -1623,7 +1719,7 @@ function VariablesManagerPanel() {
|
|
|
1623
1719
|
display: "flex",
|
|
1624
1720
|
flex: 1
|
|
1625
1721
|
},
|
|
1626
|
-
placeholder:
|
|
1722
|
+
placeholder: __9("Search", "elementor"),
|
|
1627
1723
|
value: searchValue,
|
|
1628
1724
|
onSearch: handleSearch
|
|
1629
1725
|
}
|
|
@@ -1645,7 +1741,7 @@ function VariablesManagerPanel() {
|
|
|
1645
1741
|
onChange: handleOnChange,
|
|
1646
1742
|
autoEditVariableId,
|
|
1647
1743
|
onAutoEditComplete: handleAutoEditComplete,
|
|
1648
|
-
onFieldError:
|
|
1744
|
+
onFieldError: setIsSaveDisabled
|
|
1649
1745
|
}
|
|
1650
1746
|
),
|
|
1651
1747
|
!hasVariables && searchValue && /* @__PURE__ */ React12.createElement(
|
|
@@ -1659,8 +1755,8 @@ function VariablesManagerPanel() {
|
|
|
1659
1755
|
!hasVariables && !searchValue && /* @__PURE__ */ React12.createElement(
|
|
1660
1756
|
EmptyState,
|
|
1661
1757
|
{
|
|
1662
|
-
title:
|
|
1663
|
-
message:
|
|
1758
|
+
title: __9("Create your first variable", "elementor"),
|
|
1759
|
+
message: __9(
|
|
1664
1760
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1665
1761
|
"elementor"
|
|
1666
1762
|
),
|
|
@@ -1669,17 +1765,45 @@ function VariablesManagerPanel() {
|
|
|
1669
1765
|
}
|
|
1670
1766
|
)
|
|
1671
1767
|
), /* @__PURE__ */ React12.createElement(PanelFooter, null, /* @__PURE__ */ React12.createElement(
|
|
1672
|
-
|
|
1768
|
+
Infotip,
|
|
1673
1769
|
{
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1770
|
+
placement: "right",
|
|
1771
|
+
open: !!serverError,
|
|
1772
|
+
content: serverError ? /* @__PURE__ */ React12.createElement(
|
|
1773
|
+
Alert,
|
|
1774
|
+
{
|
|
1775
|
+
severity: "error",
|
|
1776
|
+
action: serverError.action ? /* @__PURE__ */ React12.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
1777
|
+
icon: /* @__PURE__ */ React12.createElement(AlertTriangleFilledIcon, null)
|
|
1778
|
+
},
|
|
1779
|
+
/* @__PURE__ */ React12.createElement(AlertTitle, null, serverError.message),
|
|
1780
|
+
serverError.action?.message
|
|
1781
|
+
) : null,
|
|
1782
|
+
arrow: false,
|
|
1783
|
+
slotProps: {
|
|
1784
|
+
popper: {
|
|
1785
|
+
modifiers: [
|
|
1786
|
+
{
|
|
1787
|
+
name: "offset",
|
|
1788
|
+
options: { offset: [-10, 10] }
|
|
1789
|
+
}
|
|
1790
|
+
]
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1681
1793
|
},
|
|
1682
|
-
|
|
1794
|
+
/* @__PURE__ */ React12.createElement(
|
|
1795
|
+
Button3,
|
|
1796
|
+
{
|
|
1797
|
+
fullWidth: true,
|
|
1798
|
+
size: "small",
|
|
1799
|
+
color: "global",
|
|
1800
|
+
variant: "contained",
|
|
1801
|
+
disabled: isSaveDisabled || !isDirty || isSaving,
|
|
1802
|
+
onClick: handleSaveClick,
|
|
1803
|
+
loading: isSaving
|
|
1804
|
+
},
|
|
1805
|
+
__9("Save changes", "elementor")
|
|
1806
|
+
)
|
|
1683
1807
|
))), deleteConfirmation && /* @__PURE__ */ React12.createElement(
|
|
1684
1808
|
DeleteConfirmationDialog,
|
|
1685
1809
|
{
|
|
@@ -1688,30 +1812,31 @@ function VariablesManagerPanel() {
|
|
|
1688
1812
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1689
1813
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1690
1814
|
}
|
|
1691
|
-
)
|
|
1815
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React12.createElement(SaveChangesDialog, null, /* @__PURE__ */ React12.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __9("You have unsaved changes", "elementor")), /* @__PURE__ */ React12.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React12.createElement(SaveChangesDialog.ContentText, null, __9("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React12.createElement(
|
|
1692
1816
|
SaveChangesDialog.Actions,
|
|
1693
1817
|
{
|
|
1694
1818
|
actions: {
|
|
1695
1819
|
discard: {
|
|
1696
|
-
label:
|
|
1820
|
+
label: __9("Discard", "elementor"),
|
|
1697
1821
|
action: () => {
|
|
1698
1822
|
closeSaveChangesDialog();
|
|
1699
1823
|
closePanel();
|
|
1700
1824
|
}
|
|
1701
1825
|
},
|
|
1702
1826
|
confirm: {
|
|
1703
|
-
label:
|
|
1827
|
+
label: __9("Save", "elementor"),
|
|
1704
1828
|
action: async () => {
|
|
1705
|
-
await
|
|
1829
|
+
const result = await handleSaveClick();
|
|
1706
1830
|
closeSaveChangesDialog();
|
|
1707
|
-
|
|
1831
|
+
if (result?.success) {
|
|
1832
|
+
closePanel();
|
|
1833
|
+
}
|
|
1708
1834
|
}
|
|
1709
1835
|
}
|
|
1710
1836
|
}
|
|
1711
1837
|
}
|
|
1712
1838
|
)));
|
|
1713
1839
|
}
|
|
1714
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */ React12.createElement(Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React12.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React12.createElement("strong", null, __10("Something went wrong", "elementor"))));
|
|
1715
1840
|
var usePreventUnload = (isDirty) => {
|
|
1716
1841
|
useEffect3(() => {
|
|
1717
1842
|
const handleBeforeUnload = (event) => {
|
|
@@ -1731,11 +1856,11 @@ import * as React31 from "react";
|
|
|
1731
1856
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
|
|
1732
1857
|
|
|
1733
1858
|
// src/components/ui/variable/assigned-variable.tsx
|
|
1734
|
-
import { useId, useRef as
|
|
1859
|
+
import { useId, useRef as useRef6 } from "react";
|
|
1735
1860
|
import * as React22 from "react";
|
|
1736
1861
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
1737
1862
|
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
1738
|
-
import { bindPopover, bindTrigger as bindTrigger3, Box as
|
|
1863
|
+
import { bindPopover, bindTrigger as bindTrigger3, Box as Box4, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1739
1864
|
|
|
1740
1865
|
// src/utils/unlink-variable.ts
|
|
1741
1866
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -1761,11 +1886,11 @@ import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
|
1761
1886
|
// src/context/variable-selection-popover.context.tsx
|
|
1762
1887
|
import * as React13 from "react";
|
|
1763
1888
|
import { createContext as createContext2, useContext as useContext2, useState as useState6 } from "react";
|
|
1764
|
-
import { Box
|
|
1889
|
+
import { Box } from "@elementor/ui";
|
|
1765
1890
|
var PopoverContentRefContext = createContext2(null);
|
|
1766
1891
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
1767
1892
|
const [anchorRef, setAnchorRef] = useState6(null);
|
|
1768
|
-
return /* @__PURE__ */ React13.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React13.createElement(
|
|
1893
|
+
return /* @__PURE__ */ React13.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React13.createElement(Box, { ref: setAnchorRef }, children));
|
|
1769
1894
|
};
|
|
1770
1895
|
var usePopoverContentRef = () => {
|
|
1771
1896
|
return useContext2(PopoverContentRefContext);
|
|
@@ -1779,7 +1904,7 @@ import { PopoverBody } from "@elementor/editor-editing-panel";
|
|
|
1779
1904
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
1780
1905
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
1781
1906
|
import { Button as Button4, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography6 } from "@elementor/ui";
|
|
1782
|
-
import { __ as
|
|
1907
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1783
1908
|
|
|
1784
1909
|
// src/hooks/use-initial-value.ts
|
|
1785
1910
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
@@ -1910,15 +2035,15 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1910
2035
|
return /* @__PURE__ */ React15.createElement(PopoverBody, { height: "auto" }, /* @__PURE__ */ React15.createElement(
|
|
1911
2036
|
PopoverHeader,
|
|
1912
2037
|
{
|
|
1913
|
-
icon: /* @__PURE__ */ React15.createElement(React15.Fragment, null, onGoBack && /* @__PURE__ */ React15.createElement(IconButton4, { size: SIZE2, "aria-label":
|
|
1914
|
-
title:
|
|
2038
|
+
icon: /* @__PURE__ */ React15.createElement(React15.Fragment, null, onGoBack && /* @__PURE__ */ React15.createElement(IconButton4, { size: SIZE2, "aria-label": __10("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React15.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React15.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2039
|
+
title: __10("Create variable", "elementor"),
|
|
1915
2040
|
onClose: closePopover
|
|
1916
2041
|
}
|
|
1917
2042
|
), /* @__PURE__ */ React15.createElement(Divider2, null), /* @__PURE__ */ React15.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React15.createElement(
|
|
1918
2043
|
FormField,
|
|
1919
2044
|
{
|
|
1920
2045
|
id: "variable-label",
|
|
1921
|
-
label:
|
|
2046
|
+
label: __10("Name", "elementor"),
|
|
1922
2047
|
errorMsg: labelFieldError?.message,
|
|
1923
2048
|
noticeMsg: labelHint(label)
|
|
1924
2049
|
},
|
|
@@ -1940,7 +2065,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1940
2065
|
}
|
|
1941
2066
|
}
|
|
1942
2067
|
)
|
|
1943
|
-
), /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
2068
|
+
), /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label: __10("Value", "elementor") }, /* @__PURE__ */ React15.createElement(Typography6, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React15.createElement(
|
|
1944
2069
|
ValueField,
|
|
1945
2070
|
{
|
|
1946
2071
|
value,
|
|
@@ -1961,7 +2086,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1961
2086
|
disabled: isSubmitDisabled,
|
|
1962
2087
|
onClick: handleCreateAndTrack
|
|
1963
2088
|
},
|
|
1964
|
-
|
|
2089
|
+
__10("Create", "elementor")
|
|
1965
2090
|
)));
|
|
1966
2091
|
};
|
|
1967
2092
|
|
|
@@ -1973,13 +2098,13 @@ import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
|
1973
2098
|
import { PopoverBody as PopoverBody2 } from "@elementor/editor-editing-panel";
|
|
1974
2099
|
import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
1975
2100
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
1976
|
-
import { Button as Button6, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Typography as Typography8 } from "@elementor/ui";
|
|
1977
|
-
import { __ as
|
|
2101
|
+
import { Button as Button6, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Tooltip, Typography as Typography8 } from "@elementor/ui";
|
|
2102
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1978
2103
|
|
|
1979
2104
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
1980
2105
|
import * as React16 from "react";
|
|
1981
2106
|
import { useState as useState8 } from "react";
|
|
1982
|
-
import { AlertTriangleFilledIcon } from "@elementor/icons";
|
|
2107
|
+
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2 } from "@elementor/icons";
|
|
1983
2108
|
import {
|
|
1984
2109
|
Button as Button5,
|
|
1985
2110
|
Checkbox,
|
|
@@ -1991,7 +2116,7 @@ import {
|
|
|
1991
2116
|
FormControlLabel,
|
|
1992
2117
|
Typography as Typography7
|
|
1993
2118
|
} from "@elementor/ui";
|
|
1994
|
-
import { __ as
|
|
2119
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
1995
2120
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
1996
2121
|
var EditConfirmationDialog = ({
|
|
1997
2122
|
closeDialog,
|
|
@@ -2005,7 +2130,7 @@ var EditConfirmationDialog = ({
|
|
|
2005
2130
|
}
|
|
2006
2131
|
onConfirm?.();
|
|
2007
2132
|
};
|
|
2008
|
-
return /* @__PURE__ */ React16.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React16.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(
|
|
2133
|
+
return /* @__PURE__ */ React16.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React16.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(AlertTriangleFilledIcon2, { color: "secondary" }), __11("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React16.createElement(DialogContent2, null, /* @__PURE__ */ React16.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __11(
|
|
2009
2134
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2010
2135
|
"elementor"
|
|
2011
2136
|
))), /* @__PURE__ */ React16.createElement(DialogActions2, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React16.createElement(
|
|
@@ -2019,13 +2144,14 @@ var EditConfirmationDialog = ({
|
|
|
2019
2144
|
size: "small"
|
|
2020
2145
|
}
|
|
2021
2146
|
),
|
|
2022
|
-
label: /* @__PURE__ */ React16.createElement(Typography7, { variant: "body2" },
|
|
2147
|
+
label: /* @__PURE__ */ React16.createElement(Typography7, { variant: "body2" }, __11("Don't show me again", "elementor"))
|
|
2023
2148
|
}
|
|
2024
|
-
), /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement(Button5, { color: "secondary", onClick: closeDialog },
|
|
2149
|
+
), /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement(Button5, { color: "secondary", onClick: closeDialog }, __11("Keep editing", "elementor")), /* @__PURE__ */ React16.createElement(Button5, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __11("Save", "elementor")))));
|
|
2025
2150
|
};
|
|
2026
2151
|
|
|
2027
2152
|
// src/components/variable-edit.tsx
|
|
2028
2153
|
var SIZE3 = "tiny";
|
|
2154
|
+
var DELETE_LABEL = __12("Delete variable", "elementor");
|
|
2029
2155
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2030
2156
|
const { icon: VariableIcon, valueField: ValueField, variableType } = useVariableType();
|
|
2031
2157
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
@@ -2106,16 +2232,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2106
2232
|
const actions = [];
|
|
2107
2233
|
if (userPermissions.canDelete()) {
|
|
2108
2234
|
actions.push(
|
|
2109
|
-
/* @__PURE__ */ React17.createElement(
|
|
2110
|
-
IconButton5,
|
|
2111
|
-
{
|
|
2112
|
-
key: "delete",
|
|
2113
|
-
size: SIZE3,
|
|
2114
|
-
"aria-label": __13("Delete", "elementor"),
|
|
2115
|
-
onClick: handleDeleteConfirmation
|
|
2116
|
-
},
|
|
2117
|
-
/* @__PURE__ */ React17.createElement(TrashIcon2, { fontSize: SIZE3 })
|
|
2118
|
-
)
|
|
2235
|
+
/* @__PURE__ */ React17.createElement(Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React17.createElement(IconButton5, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React17.createElement(TrashIcon2, { fontSize: SIZE3 })))
|
|
2119
2236
|
);
|
|
2120
2237
|
}
|
|
2121
2238
|
const hasEmptyFields = () => {
|
|
@@ -2137,13 +2254,13 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2137
2254
|
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(PopoverBody2, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2138
2255
|
PopoverHeader2,
|
|
2139
2256
|
{
|
|
2140
|
-
title:
|
|
2257
|
+
title: __12("Edit variable", "elementor"),
|
|
2141
2258
|
onClose,
|
|
2142
2259
|
icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(
|
|
2143
2260
|
IconButton5,
|
|
2144
2261
|
{
|
|
2145
2262
|
size: SIZE3,
|
|
2146
|
-
"aria-label":
|
|
2263
|
+
"aria-label": __12("Go Back", "elementor"),
|
|
2147
2264
|
onClick: onGoBack
|
|
2148
2265
|
},
|
|
2149
2266
|
/* @__PURE__ */ React17.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
@@ -2154,7 +2271,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2154
2271
|
FormField,
|
|
2155
2272
|
{
|
|
2156
2273
|
id: "variable-label",
|
|
2157
|
-
label:
|
|
2274
|
+
label: __12("Name", "elementor"),
|
|
2158
2275
|
errorMsg: labelFieldError?.message,
|
|
2159
2276
|
noticeMsg: labelHint(label)
|
|
2160
2277
|
},
|
|
@@ -2176,7 +2293,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2176
2293
|
}
|
|
2177
2294
|
}
|
|
2178
2295
|
)
|
|
2179
|
-
), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
2296
|
+
), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: __12("Value", "elementor") }, /* @__PURE__ */ React17.createElement(Typography8, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
|
|
2180
2297
|
ValueField,
|
|
2181
2298
|
{
|
|
2182
2299
|
value,
|
|
@@ -2188,7 +2305,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2188
2305
|
onValidationChange: setValueFieldError,
|
|
2189
2306
|
propType
|
|
2190
2307
|
}
|
|
2191
|
-
))), errorMessage && /* @__PURE__ */ React17.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React17.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React17.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate },
|
|
2308
|
+
))), errorMessage && /* @__PURE__ */ React17.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React17.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React17.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __12("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React17.createElement(
|
|
2192
2309
|
DeleteConfirmationDialog,
|
|
2193
2310
|
{
|
|
2194
2311
|
open: true,
|
|
@@ -2212,20 +2329,21 @@ import { useState as useState10 } from "react";
|
|
|
2212
2329
|
import { PopoverBody as PopoverBody3 } from "@elementor/editor-editing-panel";
|
|
2213
2330
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, SearchField as SearchField2 } from "@elementor/editor-ui";
|
|
2214
2331
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2215
|
-
import { Divider as Divider4, IconButton as IconButton7 } from "@elementor/ui";
|
|
2216
|
-
import { __ as
|
|
2332
|
+
import { Divider as Divider4, IconButton as IconButton7, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
2333
|
+
import { __ as __14, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
2217
2334
|
|
|
2218
2335
|
// src/components/ui/menu-item-content.tsx
|
|
2219
2336
|
import * as React18 from "react";
|
|
2220
2337
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2221
2338
|
import { EditIcon } from "@elementor/icons";
|
|
2222
|
-
import { Box as
|
|
2223
|
-
import { __ as
|
|
2339
|
+
import { Box as Box2, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography9 } from "@elementor/ui";
|
|
2340
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2224
2341
|
var SIZE4 = "tiny";
|
|
2342
|
+
var EDIT_LABEL = __13("Edit variable", "elementor");
|
|
2225
2343
|
var MenuItemContent = ({ item }) => {
|
|
2226
2344
|
const onEdit = item.onEdit;
|
|
2227
2345
|
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React18.createElement(
|
|
2228
|
-
|
|
2346
|
+
Box2,
|
|
2229
2347
|
{
|
|
2230
2348
|
sx: {
|
|
2231
2349
|
flex: 1,
|
|
@@ -2257,7 +2375,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
2257
2375
|
maxWidth: "50%"
|
|
2258
2376
|
}
|
|
2259
2377
|
)
|
|
2260
|
-
), !!onEdit && /* @__PURE__ */ React18.createElement(
|
|
2378
|
+
), !!onEdit && /* @__PURE__ */ React18.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React18.createElement(
|
|
2261
2379
|
IconButton6,
|
|
2262
2380
|
{
|
|
2263
2381
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2265,10 +2383,10 @@ var MenuItemContent = ({ item }) => {
|
|
|
2265
2383
|
e.stopPropagation();
|
|
2266
2384
|
onEdit(item.value);
|
|
2267
2385
|
},
|
|
2268
|
-
"aria-label":
|
|
2386
|
+
"aria-label": EDIT_LABEL
|
|
2269
2387
|
},
|
|
2270
2388
|
/* @__PURE__ */ React18.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2271
|
-
));
|
|
2389
|
+
)));
|
|
2272
2390
|
};
|
|
2273
2391
|
|
|
2274
2392
|
// src/components/ui/styled-menu-list.tsx
|
|
@@ -2305,6 +2423,8 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
2305
2423
|
|
|
2306
2424
|
// src/components/variables-selection.tsx
|
|
2307
2425
|
var SIZE5 = "tiny";
|
|
2426
|
+
var CREATE_LABEL = __14("Create variable", "elementor");
|
|
2427
|
+
var MANAGER_LABEL = __14("Variable Manager", "elementor");
|
|
2308
2428
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
2309
2429
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil } = useVariableType();
|
|
2310
2430
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
@@ -2335,12 +2455,30 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2335
2455
|
const actions = [];
|
|
2336
2456
|
if (onAdd) {
|
|
2337
2457
|
actions.push(
|
|
2338
|
-
/* @__PURE__ */ React19.createElement(
|
|
2458
|
+
/* @__PURE__ */ React19.createElement(Tooltip3, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2459
|
+
IconButton7,
|
|
2460
|
+
{
|
|
2461
|
+
id: "add-variable-button",
|
|
2462
|
+
size: SIZE5,
|
|
2463
|
+
onClick: onAddAndTrack,
|
|
2464
|
+
"aria-label": CREATE_LABEL
|
|
2465
|
+
},
|
|
2466
|
+
/* @__PURE__ */ React19.createElement(PlusIcon2, { fontSize: SIZE5 })
|
|
2467
|
+
))
|
|
2339
2468
|
);
|
|
2340
2469
|
}
|
|
2341
2470
|
if (onSettings) {
|
|
2342
2471
|
actions.push(
|
|
2343
|
-
/* @__PURE__ */ React19.createElement(
|
|
2472
|
+
/* @__PURE__ */ React19.createElement(Tooltip3, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2473
|
+
IconButton7,
|
|
2474
|
+
{
|
|
2475
|
+
id: "variables-manager-button",
|
|
2476
|
+
size: SIZE5,
|
|
2477
|
+
onClick: onSettings,
|
|
2478
|
+
"aria-label": MANAGER_LABEL
|
|
2479
|
+
},
|
|
2480
|
+
/* @__PURE__ */ React19.createElement(SettingsIcon, { fontSize: SIZE5 })
|
|
2481
|
+
))
|
|
2344
2482
|
);
|
|
2345
2483
|
}
|
|
2346
2484
|
const StartIcon = startIcon || (() => /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
@@ -2358,15 +2496,15 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2358
2496
|
const handleClearSearch = () => {
|
|
2359
2497
|
setSearchValue("");
|
|
2360
2498
|
};
|
|
2361
|
-
const noVariableTitle =
|
|
2499
|
+
const noVariableTitle = sprintf2(
|
|
2362
2500
|
/* translators: %s: Variable Type. */
|
|
2363
|
-
|
|
2501
|
+
__14("Create your first %s variable", "elementor"),
|
|
2364
2502
|
variableType
|
|
2365
2503
|
);
|
|
2366
2504
|
return /* @__PURE__ */ React19.createElement(PopoverBody3, null, /* @__PURE__ */ React19.createElement(
|
|
2367
2505
|
PopoverHeader3,
|
|
2368
2506
|
{
|
|
2369
|
-
title:
|
|
2507
|
+
title: __14("Variables", "elementor"),
|
|
2370
2508
|
icon: /* @__PURE__ */ React19.createElement(ColorFilterIcon2, { fontSize: SIZE5 }),
|
|
2371
2509
|
onClose: closePopover,
|
|
2372
2510
|
actions
|
|
@@ -2376,7 +2514,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2376
2514
|
{
|
|
2377
2515
|
value: searchValue,
|
|
2378
2516
|
onSearch: handleSearch,
|
|
2379
|
-
placeholder:
|
|
2517
|
+
placeholder: __14("Search", "elementor")
|
|
2380
2518
|
}
|
|
2381
2519
|
), /* @__PURE__ */ React19.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React19.createElement(
|
|
2382
2520
|
PopoverMenuList,
|
|
@@ -2401,7 +2539,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2401
2539
|
EmptyState,
|
|
2402
2540
|
{
|
|
2403
2541
|
title: noVariableTitle,
|
|
2404
|
-
message:
|
|
2542
|
+
message: __14(
|
|
2405
2543
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2406
2544
|
"elementor"
|
|
2407
2545
|
),
|
|
@@ -2411,8 +2549,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2411
2549
|
), hasNoCompatibleVariables && /* @__PURE__ */ React19.createElement(
|
|
2412
2550
|
EmptyState,
|
|
2413
2551
|
{
|
|
2414
|
-
title:
|
|
2415
|
-
message:
|
|
2552
|
+
title: __14("No compatible variables", "elementor"),
|
|
2553
|
+
message: __14(
|
|
2416
2554
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2417
2555
|
"elementor"
|
|
2418
2556
|
),
|
|
@@ -2509,23 +2647,24 @@ function RenderView(props) {
|
|
|
2509
2647
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2510
2648
|
import * as React21 from "react";
|
|
2511
2649
|
import { DetachIcon } from "@elementor/icons";
|
|
2512
|
-
import { Box as
|
|
2513
|
-
import { __ as
|
|
2650
|
+
import { Box as Box3, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography10, UnstableTag as Tag } from "@elementor/ui";
|
|
2651
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2514
2652
|
var SIZE6 = "tiny";
|
|
2653
|
+
var UNLINK_LABEL = __15("Unlink variable", "elementor");
|
|
2515
2654
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2516
2655
|
const actions = [];
|
|
2517
2656
|
if (onUnlink) {
|
|
2518
2657
|
actions.push(
|
|
2519
|
-
/* @__PURE__ */ React21.createElement(
|
|
2658
|
+
/* @__PURE__ */ React21.createElement(Tooltip4, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React21.createElement(IconButton8, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React21.createElement(DetachIcon, { fontSize: SIZE6 })))
|
|
2520
2659
|
);
|
|
2521
2660
|
}
|
|
2522
|
-
return /* @__PURE__ */ React21.createElement(
|
|
2661
|
+
return /* @__PURE__ */ React21.createElement(Tooltip4, { title: label, placement: "top" }, /* @__PURE__ */ React21.createElement(
|
|
2523
2662
|
Tag,
|
|
2524
2663
|
{
|
|
2525
2664
|
fullWidth: true,
|
|
2526
2665
|
showActionsOnHover: true,
|
|
2527
2666
|
startIcon: /* @__PURE__ */ React21.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
2528
|
-
label: /* @__PURE__ */ React21.createElement(
|
|
2667
|
+
label: /* @__PURE__ */ React21.createElement(Box3, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React21.createElement(Typography10, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
2529
2668
|
actions,
|
|
2530
2669
|
...props
|
|
2531
2670
|
}
|
|
@@ -2536,7 +2675,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2536
2675
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
2537
2676
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
2538
2677
|
const { setValue } = useBoundProp6();
|
|
2539
|
-
const anchorRef =
|
|
2678
|
+
const anchorRef = useRef6(null);
|
|
2540
2679
|
const popupId = useId();
|
|
2541
2680
|
const popupState = usePopupState3({
|
|
2542
2681
|
variant: "popover",
|
|
@@ -2544,7 +2683,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2544
2683
|
});
|
|
2545
2684
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
2546
2685
|
const StartIcon = startIcon || (() => null);
|
|
2547
|
-
return /* @__PURE__ */ React22.createElement(
|
|
2686
|
+
return /* @__PURE__ */ React22.createElement(Box4, { ref: anchorRef }, /* @__PURE__ */ React22.createElement(
|
|
2548
2687
|
AssignedTag,
|
|
2549
2688
|
{
|
|
2550
2689
|
label: variable.label,
|
|
@@ -2577,10 +2716,10 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2577
2716
|
|
|
2578
2717
|
// src/components/ui/variable/deleted-variable.tsx
|
|
2579
2718
|
import * as React26 from "react";
|
|
2580
|
-
import { useId as useId2, useRef as
|
|
2719
|
+
import { useId as useId2, useRef as useRef7, useState as useState13 } from "react";
|
|
2581
2720
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
2582
|
-
import { Backdrop, bindPopover as bindPopover2, Box as
|
|
2583
|
-
import { __ as
|
|
2721
|
+
import { Backdrop, bindPopover as bindPopover2, Box as Box6, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2722
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
2584
2723
|
|
|
2585
2724
|
// src/components/variable-restore.tsx
|
|
2586
2725
|
import * as React23 from "react";
|
|
@@ -2589,7 +2728,7 @@ import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from
|
|
|
2589
2728
|
import { PopoverBody as PopoverBody4 } from "@elementor/editor-editing-panel";
|
|
2590
2729
|
import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
|
|
2591
2730
|
import { Button as Button7, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
|
|
2592
|
-
import { __ as
|
|
2731
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2593
2732
|
var SIZE7 = "tiny";
|
|
2594
2733
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
2595
2734
|
const { icon: VariableIcon, valueField: ValueField, variableType } = useVariableType();
|
|
@@ -2644,14 +2783,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2644
2783
|
PopoverHeader4,
|
|
2645
2784
|
{
|
|
2646
2785
|
icon: /* @__PURE__ */ React23.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
2647
|
-
title:
|
|
2786
|
+
title: __16("Restore variable", "elementor"),
|
|
2648
2787
|
onClose
|
|
2649
2788
|
}
|
|
2650
2789
|
), /* @__PURE__ */ React23.createElement(Divider5, null), /* @__PURE__ */ React23.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React23.createElement(
|
|
2651
2790
|
FormField,
|
|
2652
2791
|
{
|
|
2653
2792
|
id: "variable-label",
|
|
2654
|
-
label:
|
|
2793
|
+
label: __16("Name", "elementor"),
|
|
2655
2794
|
errorMsg: labelFieldError?.message,
|
|
2656
2795
|
noticeMsg: labelHint(label)
|
|
2657
2796
|
},
|
|
@@ -2673,7 +2812,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2673
2812
|
}
|
|
2674
2813
|
}
|
|
2675
2814
|
)
|
|
2676
|
-
), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
2815
|
+
), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: __16("Value", "elementor") }, /* @__PURE__ */ React23.createElement(Typography11, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
|
|
2677
2816
|
ValueField,
|
|
2678
2817
|
{
|
|
2679
2818
|
value,
|
|
@@ -2685,13 +2824,13 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2685
2824
|
onValidationChange: setValueFieldError,
|
|
2686
2825
|
propType
|
|
2687
2826
|
}
|
|
2688
|
-
))), errorMessage && /* @__PURE__ */ React23.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React23.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React23.createElement(Button7, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore },
|
|
2827
|
+
))), errorMessage && /* @__PURE__ */ React23.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React23.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React23.createElement(Button7, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __16("Restore", "elementor")))));
|
|
2689
2828
|
};
|
|
2690
2829
|
|
|
2691
2830
|
// src/components/ui/deleted-variable-alert.tsx
|
|
2692
2831
|
import * as React24 from "react";
|
|
2693
|
-
import { Alert as Alert2, AlertAction, AlertTitle, ClickAwayListener as ClickAwayListener2, Typography as Typography12 } from "@elementor/ui";
|
|
2694
|
-
import { __ as
|
|
2832
|
+
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as Typography12 } from "@elementor/ui";
|
|
2833
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
2695
2834
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
2696
2835
|
return /* @__PURE__ */ React24.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React24.createElement(
|
|
2697
2836
|
Alert2,
|
|
@@ -2699,11 +2838,11 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
2699
2838
|
variant: "standard",
|
|
2700
2839
|
severity: "warning",
|
|
2701
2840
|
onClose,
|
|
2702
|
-
action: /* @__PURE__ */ React24.createElement(React24.Fragment, null, onUnlink && /* @__PURE__ */ React24.createElement(
|
|
2841
|
+
action: /* @__PURE__ */ React24.createElement(React24.Fragment, null, onUnlink && /* @__PURE__ */ React24.createElement(AlertAction2, { variant: "contained", onClick: onUnlink }, __17("Unlink", "elementor")), onRestore && /* @__PURE__ */ React24.createElement(AlertAction2, { variant: "outlined", onClick: onRestore }, __17("Restore", "elementor"))),
|
|
2703
2842
|
sx: { maxWidth: 300 }
|
|
2704
2843
|
},
|
|
2705
|
-
/* @__PURE__ */ React24.createElement(
|
|
2706
|
-
/* @__PURE__ */ React24.createElement(Typography12, { variant: "body2", color: "textPrimary" },
|
|
2844
|
+
/* @__PURE__ */ React24.createElement(AlertTitle2, null, __17("Deleted variable", "elementor")),
|
|
2845
|
+
/* @__PURE__ */ React24.createElement(Typography12, { variant: "body2", color: "textPrimary" }, __17("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React24.createElement(Typography12, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", __17(
|
|
2707
2846
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
2708
2847
|
"elementor"
|
|
2709
2848
|
))
|
|
@@ -2712,8 +2851,8 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
2712
2851
|
|
|
2713
2852
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
2714
2853
|
import * as React25 from "react";
|
|
2715
|
-
import { AlertTriangleFilledIcon as
|
|
2716
|
-
import { Box as
|
|
2854
|
+
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2855
|
+
import { Box as Box5, Chip, Tooltip as Tooltip5, Typography as Typography13 } from "@elementor/ui";
|
|
2717
2856
|
var WarningVariableTag = React25.forwardRef(
|
|
2718
2857
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
2719
2858
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
@@ -2726,8 +2865,8 @@ var WarningVariableTag = React25.forwardRef(
|
|
|
2726
2865
|
shape: "rounded",
|
|
2727
2866
|
variant: "standard",
|
|
2728
2867
|
onClick,
|
|
2729
|
-
icon: /* @__PURE__ */ React25.createElement(
|
|
2730
|
-
label: /* @__PURE__ */ React25.createElement(
|
|
2868
|
+
icon: /* @__PURE__ */ React25.createElement(AlertTriangleFilledIcon3, null),
|
|
2869
|
+
label: /* @__PURE__ */ React25.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React25.createElement(Box5, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React25.createElement(Typography13, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
2731
2870
|
sx: {
|
|
2732
2871
|
height: (theme) => theme.spacing(3.5),
|
|
2733
2872
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -2749,7 +2888,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2749
2888
|
const [showInfotip, setShowInfotip] = useState13(false);
|
|
2750
2889
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
2751
2890
|
const closeInfotip = () => setShowInfotip(false);
|
|
2752
|
-
const deletedChipAnchorRef =
|
|
2891
|
+
const deletedChipAnchorRef = useRef7(null);
|
|
2753
2892
|
const popupId = useId2();
|
|
2754
2893
|
const popupState = usePopupState4({
|
|
2755
2894
|
variant: "popover",
|
|
@@ -2777,8 +2916,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2777
2916
|
const handleRestoreWithOverrides = () => {
|
|
2778
2917
|
popupState.close();
|
|
2779
2918
|
};
|
|
2780
|
-
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(
|
|
2781
|
-
|
|
2919
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Box6, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React26.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React26.createElement(
|
|
2920
|
+
Infotip2,
|
|
2782
2921
|
{
|
|
2783
2922
|
color: "warning",
|
|
2784
2923
|
placement: "right-start",
|
|
@@ -2810,7 +2949,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2810
2949
|
{
|
|
2811
2950
|
label: variable.label,
|
|
2812
2951
|
onClick: toggleInfotip,
|
|
2813
|
-
suffix:
|
|
2952
|
+
suffix: __18("deleted", "elementor")
|
|
2814
2953
|
}
|
|
2815
2954
|
)
|
|
2816
2955
|
), /* @__PURE__ */ React26.createElement(
|
|
@@ -2837,24 +2976,24 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2837
2976
|
|
|
2838
2977
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2839
2978
|
import * as React28 from "react";
|
|
2840
|
-
import { useId as useId3, useRef as
|
|
2979
|
+
import { useId as useId3, useRef as useRef8, useState as useState14 } from "react";
|
|
2841
2980
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
2842
|
-
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as
|
|
2843
|
-
import { __ as
|
|
2981
|
+
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box7, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
2982
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2844
2983
|
|
|
2845
2984
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
2846
2985
|
import * as React27 from "react";
|
|
2847
|
-
import { Alert as Alert3, AlertAction as
|
|
2848
|
-
import { __ as
|
|
2986
|
+
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as Typography14 } from "@elementor/ui";
|
|
2987
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2849
2988
|
var i18n = {
|
|
2850
|
-
title:
|
|
2851
|
-
message:
|
|
2989
|
+
title: __19("Variable has changed", "elementor"),
|
|
2990
|
+
message: __19(
|
|
2852
2991
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
2853
2992
|
"elementor"
|
|
2854
2993
|
),
|
|
2855
2994
|
buttons: {
|
|
2856
|
-
clear:
|
|
2857
|
-
select:
|
|
2995
|
+
clear: __19("Clear", "elementor"),
|
|
2996
|
+
select: __19("Select variable", "elementor")
|
|
2858
2997
|
}
|
|
2859
2998
|
};
|
|
2860
2999
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
@@ -2864,10 +3003,10 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
2864
3003
|
variant: "standard",
|
|
2865
3004
|
severity: "warning",
|
|
2866
3005
|
onClose,
|
|
2867
|
-
action: /* @__PURE__ */ React27.createElement(React27.Fragment, null, onClear && /* @__PURE__ */ React27.createElement(
|
|
3006
|
+
action: /* @__PURE__ */ React27.createElement(React27.Fragment, null, onClear && /* @__PURE__ */ React27.createElement(AlertAction3, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React27.createElement(AlertAction3, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
2868
3007
|
sx: { maxWidth: 300 }
|
|
2869
3008
|
},
|
|
2870
|
-
/* @__PURE__ */ React27.createElement(
|
|
3009
|
+
/* @__PURE__ */ React27.createElement(AlertTitle3, null, i18n.title),
|
|
2871
3010
|
/* @__PURE__ */ React27.createElement(Typography14, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
2872
3011
|
));
|
|
2873
3012
|
};
|
|
@@ -2875,7 +3014,7 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
2875
3014
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2876
3015
|
var MismatchVariable = ({ variable }) => {
|
|
2877
3016
|
const { setValue, value } = useBoundProp9();
|
|
2878
|
-
const anchorRef =
|
|
3017
|
+
const anchorRef = useRef8(null);
|
|
2879
3018
|
const popupId = useId3();
|
|
2880
3019
|
const popupState = usePopupState5({
|
|
2881
3020
|
variant: "popover",
|
|
@@ -2894,8 +3033,8 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2894
3033
|
setValue(null);
|
|
2895
3034
|
};
|
|
2896
3035
|
const showClearButton = !!value;
|
|
2897
|
-
return /* @__PURE__ */ React28.createElement(
|
|
2898
|
-
|
|
3036
|
+
return /* @__PURE__ */ React28.createElement(Box7, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React28.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
|
|
3037
|
+
Infotip3,
|
|
2899
3038
|
{
|
|
2900
3039
|
color: "warning",
|
|
2901
3040
|
placement: "right-start",
|
|
@@ -2926,7 +3065,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2926
3065
|
{
|
|
2927
3066
|
label: variable.label,
|
|
2928
3067
|
onClick: toggleInfotip,
|
|
2929
|
-
suffix:
|
|
3068
|
+
suffix: __20("changed", "elementor")
|
|
2930
3069
|
}
|
|
2931
3070
|
)
|
|
2932
3071
|
), /* @__PURE__ */ React28.createElement(
|
|
@@ -2956,13 +3095,13 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2956
3095
|
import * as React30 from "react";
|
|
2957
3096
|
import { useState as useState15 } from "react";
|
|
2958
3097
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
2959
|
-
import { Backdrop as Backdrop3, Infotip as
|
|
2960
|
-
import { __ as
|
|
3098
|
+
import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
|
|
3099
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2961
3100
|
|
|
2962
3101
|
// src/components/ui/missing-variable-alert.tsx
|
|
2963
3102
|
import * as React29 from "react";
|
|
2964
|
-
import { Alert as Alert4, AlertAction as
|
|
2965
|
-
import { __ as
|
|
3103
|
+
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as Typography15 } from "@elementor/ui";
|
|
3104
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
2966
3105
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
2967
3106
|
return /* @__PURE__ */ React29.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
2968
3107
|
Alert4,
|
|
@@ -2970,11 +3109,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
2970
3109
|
variant: "standard",
|
|
2971
3110
|
severity: "warning",
|
|
2972
3111
|
onClose,
|
|
2973
|
-
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(
|
|
3112
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(AlertAction4, { variant: "contained", onClick: onClear }, __21("Clear", "elementor"))),
|
|
2974
3113
|
sx: { maxWidth: 300 }
|
|
2975
3114
|
},
|
|
2976
|
-
/* @__PURE__ */ React29.createElement(
|
|
2977
|
-
/* @__PURE__ */ React29.createElement(Typography15, { variant: "body2", color: "textPrimary" },
|
|
3115
|
+
/* @__PURE__ */ React29.createElement(AlertTitle4, null, __21("This variable is missing", "elementor")),
|
|
3116
|
+
/* @__PURE__ */ React29.createElement(Typography15, { variant: "body2", color: "textPrimary" }, __21(
|
|
2978
3117
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
2979
3118
|
"elementor"
|
|
2980
3119
|
))
|
|
@@ -2989,7 +3128,7 @@ var MissingVariable = () => {
|
|
|
2989
3128
|
const closeInfotip = () => setInfotipVisible(false);
|
|
2990
3129
|
const clearValue = () => setValue(null);
|
|
2991
3130
|
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, infotipVisible && /* @__PURE__ */ React30.createElement(Backdrop3, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React30.createElement(
|
|
2992
|
-
|
|
3131
|
+
Infotip4,
|
|
2993
3132
|
{
|
|
2994
3133
|
color: "warning",
|
|
2995
3134
|
placement: "right-start",
|
|
@@ -3008,7 +3147,7 @@ var MissingVariable = () => {
|
|
|
3008
3147
|
}
|
|
3009
3148
|
}
|
|
3010
3149
|
},
|
|
3011
|
-
/* @__PURE__ */ React30.createElement(WarningVariableTag, { label:
|
|
3150
|
+
/* @__PURE__ */ React30.createElement(WarningVariableTag, { label: __22("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3012
3151
|
));
|
|
3013
3152
|
};
|
|
3014
3153
|
|
|
@@ -3035,14 +3174,14 @@ var VariableControl = () => {
|
|
|
3035
3174
|
import * as React32 from "react";
|
|
3036
3175
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-editing-panel";
|
|
3037
3176
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
3038
|
-
import { __ as
|
|
3177
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3039
3178
|
var usePropVariableAction = () => {
|
|
3040
3179
|
const { propType, path } = useBoundProp12();
|
|
3041
3180
|
const variable = resolveVariableFromPropType(propType);
|
|
3042
3181
|
return {
|
|
3043
3182
|
visible: Boolean(variable),
|
|
3044
3183
|
icon: ColorFilterIcon4,
|
|
3045
|
-
title:
|
|
3184
|
+
title: __23("Variables", "elementor"),
|
|
3046
3185
|
content: ({ close: closePopover }) => {
|
|
3047
3186
|
if (!variable) {
|
|
3048
3187
|
return null;
|
|
@@ -3331,12 +3470,12 @@ import { BrushIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
|
3331
3470
|
|
|
3332
3471
|
// src/components/fields/color-field.tsx
|
|
3333
3472
|
import * as React33 from "react";
|
|
3334
|
-
import { useRef as
|
|
3473
|
+
import { useRef as useRef9, useState as useState16 } from "react";
|
|
3335
3474
|
import { UnstableColorField } from "@elementor/ui";
|
|
3336
3475
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3337
3476
|
const [color, setColor] = useState16(value);
|
|
3338
3477
|
const [errorMessage, setErrorMessage] = useState16("");
|
|
3339
|
-
const defaultRef =
|
|
3478
|
+
const defaultRef = useRef9(null);
|
|
3340
3479
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3341
3480
|
const handleChange = (newValue) => {
|
|
3342
3481
|
setColor(newValue);
|
|
@@ -3375,15 +3514,15 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3375
3514
|
|
|
3376
3515
|
// src/components/fields/font-field.tsx
|
|
3377
3516
|
import * as React34 from "react";
|
|
3378
|
-
import { useId as useId4, useRef as
|
|
3517
|
+
import { useId as useId4, useRef as useRef10, useState as useState17 } from "react";
|
|
3379
3518
|
import { enqueueFont as enqueueFont2, ItemSelector } from "@elementor/editor-controls";
|
|
3380
3519
|
import { useFontFamilies, useSectionWidth } from "@elementor/editor-editing-panel";
|
|
3381
3520
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
3382
3521
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
3383
|
-
import { __ as
|
|
3522
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3384
3523
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3385
3524
|
const [fontFamily, setFontFamily] = useState17(value);
|
|
3386
|
-
const defaultRef =
|
|
3525
|
+
const defaultRef = useRef10(null);
|
|
3387
3526
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3388
3527
|
const fontPopoverState = usePopupState6({ variant: "popover" });
|
|
3389
3528
|
const fontFamilies = useFontFamilies();
|
|
@@ -3434,7 +3573,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3434
3573
|
onItemChange: handleFontFamilyChange,
|
|
3435
3574
|
onClose: fontPopoverState.close,
|
|
3436
3575
|
sectionWidth,
|
|
3437
|
-
title:
|
|
3576
|
+
title: __24("Font Family", "elementor"),
|
|
3438
3577
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3439
3578
|
onDebounce: enqueueFont2,
|
|
3440
3579
|
icon: TextIcon
|