@elementor/editor-variables 3.33.0-174 → 3.33.0-175
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 +391 -276
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +361 -236
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- 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/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
|
|
|
@@ -1974,12 +2099,12 @@ 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
2101
|
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
|
|
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,9 +2144,9 @@ 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
|
|
@@ -2111,7 +2236,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2111
2236
|
{
|
|
2112
2237
|
key: "delete",
|
|
2113
2238
|
size: SIZE3,
|
|
2114
|
-
"aria-label":
|
|
2239
|
+
"aria-label": __12("Delete", "elementor"),
|
|
2115
2240
|
onClick: handleDeleteConfirmation
|
|
2116
2241
|
},
|
|
2117
2242
|
/* @__PURE__ */ React17.createElement(TrashIcon2, { fontSize: SIZE3 })
|
|
@@ -2137,13 +2262,13 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2137
2262
|
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(PopoverBody2, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2138
2263
|
PopoverHeader2,
|
|
2139
2264
|
{
|
|
2140
|
-
title:
|
|
2265
|
+
title: __12("Edit variable", "elementor"),
|
|
2141
2266
|
onClose,
|
|
2142
2267
|
icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(
|
|
2143
2268
|
IconButton5,
|
|
2144
2269
|
{
|
|
2145
2270
|
size: SIZE3,
|
|
2146
|
-
"aria-label":
|
|
2271
|
+
"aria-label": __12("Go Back", "elementor"),
|
|
2147
2272
|
onClick: onGoBack
|
|
2148
2273
|
},
|
|
2149
2274
|
/* @__PURE__ */ React17.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
@@ -2154,7 +2279,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2154
2279
|
FormField,
|
|
2155
2280
|
{
|
|
2156
2281
|
id: "variable-label",
|
|
2157
|
-
label:
|
|
2282
|
+
label: __12("Name", "elementor"),
|
|
2158
2283
|
errorMsg: labelFieldError?.message,
|
|
2159
2284
|
noticeMsg: labelHint(label)
|
|
2160
2285
|
},
|
|
@@ -2176,7 +2301,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2176
2301
|
}
|
|
2177
2302
|
}
|
|
2178
2303
|
)
|
|
2179
|
-
), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
2304
|
+
), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: __12("Value", "elementor") }, /* @__PURE__ */ React17.createElement(Typography8, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
|
|
2180
2305
|
ValueField,
|
|
2181
2306
|
{
|
|
2182
2307
|
value,
|
|
@@ -2188,7 +2313,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2188
2313
|
onValidationChange: setValueFieldError,
|
|
2189
2314
|
propType
|
|
2190
2315
|
}
|
|
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 },
|
|
2316
|
+
))), 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
2317
|
DeleteConfirmationDialog,
|
|
2193
2318
|
{
|
|
2194
2319
|
open: true,
|
|
@@ -2213,19 +2338,19 @@ import { PopoverBody as PopoverBody3 } from "@elementor/editor-editing-panel";
|
|
|
2213
2338
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, SearchField as SearchField2 } from "@elementor/editor-ui";
|
|
2214
2339
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2215
2340
|
import { Divider as Divider4, IconButton as IconButton7 } from "@elementor/ui";
|
|
2216
|
-
import { __ as
|
|
2341
|
+
import { __ as __14, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
2217
2342
|
|
|
2218
2343
|
// src/components/ui/menu-item-content.tsx
|
|
2219
2344
|
import * as React18 from "react";
|
|
2220
2345
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2221
2346
|
import { EditIcon } from "@elementor/icons";
|
|
2222
|
-
import { Box as
|
|
2223
|
-
import { __ as
|
|
2347
|
+
import { Box as Box2, IconButton as IconButton6, ListItemIcon, Typography as Typography9 } from "@elementor/ui";
|
|
2348
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2224
2349
|
var SIZE4 = "tiny";
|
|
2225
2350
|
var MenuItemContent = ({ item }) => {
|
|
2226
2351
|
const onEdit = item.onEdit;
|
|
2227
2352
|
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React18.createElement(
|
|
2228
|
-
|
|
2353
|
+
Box2,
|
|
2229
2354
|
{
|
|
2230
2355
|
sx: {
|
|
2231
2356
|
flex: 1,
|
|
@@ -2265,7 +2390,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
2265
2390
|
e.stopPropagation();
|
|
2266
2391
|
onEdit(item.value);
|
|
2267
2392
|
},
|
|
2268
|
-
"aria-label":
|
|
2393
|
+
"aria-label": __13("Edit", "elementor")
|
|
2269
2394
|
},
|
|
2270
2395
|
/* @__PURE__ */ React18.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2271
2396
|
));
|
|
@@ -2358,15 +2483,15 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2358
2483
|
const handleClearSearch = () => {
|
|
2359
2484
|
setSearchValue("");
|
|
2360
2485
|
};
|
|
2361
|
-
const noVariableTitle =
|
|
2486
|
+
const noVariableTitle = sprintf2(
|
|
2362
2487
|
/* translators: %s: Variable Type. */
|
|
2363
|
-
|
|
2488
|
+
__14("Create your first %s variable", "elementor"),
|
|
2364
2489
|
variableType
|
|
2365
2490
|
);
|
|
2366
2491
|
return /* @__PURE__ */ React19.createElement(PopoverBody3, null, /* @__PURE__ */ React19.createElement(
|
|
2367
2492
|
PopoverHeader3,
|
|
2368
2493
|
{
|
|
2369
|
-
title:
|
|
2494
|
+
title: __14("Variables", "elementor"),
|
|
2370
2495
|
icon: /* @__PURE__ */ React19.createElement(ColorFilterIcon2, { fontSize: SIZE5 }),
|
|
2371
2496
|
onClose: closePopover,
|
|
2372
2497
|
actions
|
|
@@ -2376,7 +2501,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2376
2501
|
{
|
|
2377
2502
|
value: searchValue,
|
|
2378
2503
|
onSearch: handleSearch,
|
|
2379
|
-
placeholder:
|
|
2504
|
+
placeholder: __14("Search", "elementor")
|
|
2380
2505
|
}
|
|
2381
2506
|
), /* @__PURE__ */ React19.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React19.createElement(
|
|
2382
2507
|
PopoverMenuList,
|
|
@@ -2401,7 +2526,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2401
2526
|
EmptyState,
|
|
2402
2527
|
{
|
|
2403
2528
|
title: noVariableTitle,
|
|
2404
|
-
message:
|
|
2529
|
+
message: __14(
|
|
2405
2530
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2406
2531
|
"elementor"
|
|
2407
2532
|
),
|
|
@@ -2411,8 +2536,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2411
2536
|
), hasNoCompatibleVariables && /* @__PURE__ */ React19.createElement(
|
|
2412
2537
|
EmptyState,
|
|
2413
2538
|
{
|
|
2414
|
-
title:
|
|
2415
|
-
message:
|
|
2539
|
+
title: __14("No compatible variables", "elementor"),
|
|
2540
|
+
message: __14(
|
|
2416
2541
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2417
2542
|
"elementor"
|
|
2418
2543
|
),
|
|
@@ -2509,14 +2634,14 @@ function RenderView(props) {
|
|
|
2509
2634
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2510
2635
|
import * as React21 from "react";
|
|
2511
2636
|
import { DetachIcon } from "@elementor/icons";
|
|
2512
|
-
import { Box as
|
|
2513
|
-
import { __ as
|
|
2637
|
+
import { Box as Box3, IconButton as IconButton8, Stack as Stack7, Tooltip, Typography as Typography10, UnstableTag as Tag } from "@elementor/ui";
|
|
2638
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2514
2639
|
var SIZE6 = "tiny";
|
|
2515
2640
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2516
2641
|
const actions = [];
|
|
2517
2642
|
if (onUnlink) {
|
|
2518
2643
|
actions.push(
|
|
2519
|
-
/* @__PURE__ */ React21.createElement(IconButton8, { key: "unlink", size: SIZE6, onClick: onUnlink, "aria-label":
|
|
2644
|
+
/* @__PURE__ */ React21.createElement(IconButton8, { key: "unlink", size: SIZE6, onClick: onUnlink, "aria-label": __15("Unlink", "elementor") }, /* @__PURE__ */ React21.createElement(DetachIcon, { fontSize: SIZE6 }))
|
|
2520
2645
|
);
|
|
2521
2646
|
}
|
|
2522
2647
|
return /* @__PURE__ */ React21.createElement(Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React21.createElement(
|
|
@@ -2525,7 +2650,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2525
2650
|
fullWidth: true,
|
|
2526
2651
|
showActionsOnHover: true,
|
|
2527
2652
|
startIcon: /* @__PURE__ */ React21.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
2528
|
-
label: /* @__PURE__ */ React21.createElement(
|
|
2653
|
+
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
2654
|
actions,
|
|
2530
2655
|
...props
|
|
2531
2656
|
}
|
|
@@ -2536,7 +2661,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2536
2661
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
2537
2662
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
2538
2663
|
const { setValue } = useBoundProp6();
|
|
2539
|
-
const anchorRef =
|
|
2664
|
+
const anchorRef = useRef6(null);
|
|
2540
2665
|
const popupId = useId();
|
|
2541
2666
|
const popupState = usePopupState3({
|
|
2542
2667
|
variant: "popover",
|
|
@@ -2544,7 +2669,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2544
2669
|
});
|
|
2545
2670
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
2546
2671
|
const StartIcon = startIcon || (() => null);
|
|
2547
|
-
return /* @__PURE__ */ React22.createElement(
|
|
2672
|
+
return /* @__PURE__ */ React22.createElement(Box4, { ref: anchorRef }, /* @__PURE__ */ React22.createElement(
|
|
2548
2673
|
AssignedTag,
|
|
2549
2674
|
{
|
|
2550
2675
|
label: variable.label,
|
|
@@ -2577,10 +2702,10 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2577
2702
|
|
|
2578
2703
|
// src/components/ui/variable/deleted-variable.tsx
|
|
2579
2704
|
import * as React26 from "react";
|
|
2580
|
-
import { useId as useId2, useRef as
|
|
2705
|
+
import { useId as useId2, useRef as useRef7, useState as useState13 } from "react";
|
|
2581
2706
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
2582
|
-
import { Backdrop, bindPopover as bindPopover2, Box as
|
|
2583
|
-
import { __ as
|
|
2707
|
+
import { Backdrop, bindPopover as bindPopover2, Box as Box6, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2708
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
2584
2709
|
|
|
2585
2710
|
// src/components/variable-restore.tsx
|
|
2586
2711
|
import * as React23 from "react";
|
|
@@ -2589,7 +2714,7 @@ import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from
|
|
|
2589
2714
|
import { PopoverBody as PopoverBody4 } from "@elementor/editor-editing-panel";
|
|
2590
2715
|
import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
|
|
2591
2716
|
import { Button as Button7, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
|
|
2592
|
-
import { __ as
|
|
2717
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2593
2718
|
var SIZE7 = "tiny";
|
|
2594
2719
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
2595
2720
|
const { icon: VariableIcon, valueField: ValueField, variableType } = useVariableType();
|
|
@@ -2644,14 +2769,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2644
2769
|
PopoverHeader4,
|
|
2645
2770
|
{
|
|
2646
2771
|
icon: /* @__PURE__ */ React23.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
2647
|
-
title:
|
|
2772
|
+
title: __16("Restore variable", "elementor"),
|
|
2648
2773
|
onClose
|
|
2649
2774
|
}
|
|
2650
2775
|
), /* @__PURE__ */ React23.createElement(Divider5, null), /* @__PURE__ */ React23.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React23.createElement(
|
|
2651
2776
|
FormField,
|
|
2652
2777
|
{
|
|
2653
2778
|
id: "variable-label",
|
|
2654
|
-
label:
|
|
2779
|
+
label: __16("Name", "elementor"),
|
|
2655
2780
|
errorMsg: labelFieldError?.message,
|
|
2656
2781
|
noticeMsg: labelHint(label)
|
|
2657
2782
|
},
|
|
@@ -2673,7 +2798,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2673
2798
|
}
|
|
2674
2799
|
}
|
|
2675
2800
|
)
|
|
2676
|
-
), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
2801
|
+
), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: __16("Value", "elementor") }, /* @__PURE__ */ React23.createElement(Typography11, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
|
|
2677
2802
|
ValueField,
|
|
2678
2803
|
{
|
|
2679
2804
|
value,
|
|
@@ -2685,13 +2810,13 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2685
2810
|
onValidationChange: setValueFieldError,
|
|
2686
2811
|
propType
|
|
2687
2812
|
}
|
|
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 },
|
|
2813
|
+
))), 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
2814
|
};
|
|
2690
2815
|
|
|
2691
2816
|
// src/components/ui/deleted-variable-alert.tsx
|
|
2692
2817
|
import * as React24 from "react";
|
|
2693
|
-
import { Alert as Alert2, AlertAction, AlertTitle, ClickAwayListener as ClickAwayListener2, Typography as Typography12 } from "@elementor/ui";
|
|
2694
|
-
import { __ as
|
|
2818
|
+
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as Typography12 } from "@elementor/ui";
|
|
2819
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
2695
2820
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
2696
2821
|
return /* @__PURE__ */ React24.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React24.createElement(
|
|
2697
2822
|
Alert2,
|
|
@@ -2699,11 +2824,11 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
2699
2824
|
variant: "standard",
|
|
2700
2825
|
severity: "warning",
|
|
2701
2826
|
onClose,
|
|
2702
|
-
action: /* @__PURE__ */ React24.createElement(React24.Fragment, null, onUnlink && /* @__PURE__ */ React24.createElement(
|
|
2827
|
+
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
2828
|
sx: { maxWidth: 300 }
|
|
2704
2829
|
},
|
|
2705
|
-
/* @__PURE__ */ React24.createElement(
|
|
2706
|
-
/* @__PURE__ */ React24.createElement(Typography12, { variant: "body2", color: "textPrimary" },
|
|
2830
|
+
/* @__PURE__ */ React24.createElement(AlertTitle2, null, __17("Deleted variable", "elementor")),
|
|
2831
|
+
/* @__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
2832
|
"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
2833
|
"elementor"
|
|
2709
2834
|
))
|
|
@@ -2712,8 +2837,8 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
2712
2837
|
|
|
2713
2838
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
2714
2839
|
import * as React25 from "react";
|
|
2715
|
-
import { AlertTriangleFilledIcon as
|
|
2716
|
-
import { Box as
|
|
2840
|
+
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2841
|
+
import { Box as Box5, Chip, Tooltip as Tooltip2, Typography as Typography13 } from "@elementor/ui";
|
|
2717
2842
|
var WarningVariableTag = React25.forwardRef(
|
|
2718
2843
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
2719
2844
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
@@ -2726,8 +2851,8 @@ var WarningVariableTag = React25.forwardRef(
|
|
|
2726
2851
|
shape: "rounded",
|
|
2727
2852
|
variant: "standard",
|
|
2728
2853
|
onClick,
|
|
2729
|
-
icon: /* @__PURE__ */ React25.createElement(
|
|
2730
|
-
label: /* @__PURE__ */ React25.createElement(Tooltip2, { title: displayText, placement: "top" }, /* @__PURE__ */ React25.createElement(
|
|
2854
|
+
icon: /* @__PURE__ */ React25.createElement(AlertTriangleFilledIcon3, null),
|
|
2855
|
+
label: /* @__PURE__ */ React25.createElement(Tooltip2, { 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
2856
|
sx: {
|
|
2732
2857
|
height: (theme) => theme.spacing(3.5),
|
|
2733
2858
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -2749,7 +2874,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2749
2874
|
const [showInfotip, setShowInfotip] = useState13(false);
|
|
2750
2875
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
2751
2876
|
const closeInfotip = () => setShowInfotip(false);
|
|
2752
|
-
const deletedChipAnchorRef =
|
|
2877
|
+
const deletedChipAnchorRef = useRef7(null);
|
|
2753
2878
|
const popupId = useId2();
|
|
2754
2879
|
const popupState = usePopupState4({
|
|
2755
2880
|
variant: "popover",
|
|
@@ -2777,8 +2902,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2777
2902
|
const handleRestoreWithOverrides = () => {
|
|
2778
2903
|
popupState.close();
|
|
2779
2904
|
};
|
|
2780
|
-
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(
|
|
2781
|
-
|
|
2905
|
+
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(
|
|
2906
|
+
Infotip2,
|
|
2782
2907
|
{
|
|
2783
2908
|
color: "warning",
|
|
2784
2909
|
placement: "right-start",
|
|
@@ -2810,7 +2935,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2810
2935
|
{
|
|
2811
2936
|
label: variable.label,
|
|
2812
2937
|
onClick: toggleInfotip,
|
|
2813
|
-
suffix:
|
|
2938
|
+
suffix: __18("deleted", "elementor")
|
|
2814
2939
|
}
|
|
2815
2940
|
)
|
|
2816
2941
|
), /* @__PURE__ */ React26.createElement(
|
|
@@ -2837,24 +2962,24 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2837
2962
|
|
|
2838
2963
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2839
2964
|
import * as React28 from "react";
|
|
2840
|
-
import { useId as useId3, useRef as
|
|
2965
|
+
import { useId as useId3, useRef as useRef8, useState as useState14 } from "react";
|
|
2841
2966
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
2842
|
-
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as
|
|
2843
|
-
import { __ as
|
|
2967
|
+
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box7, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
2968
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2844
2969
|
|
|
2845
2970
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
2846
2971
|
import * as React27 from "react";
|
|
2847
|
-
import { Alert as Alert3, AlertAction as
|
|
2848
|
-
import { __ as
|
|
2972
|
+
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as Typography14 } from "@elementor/ui";
|
|
2973
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2849
2974
|
var i18n = {
|
|
2850
|
-
title:
|
|
2851
|
-
message:
|
|
2975
|
+
title: __19("Variable has changed", "elementor"),
|
|
2976
|
+
message: __19(
|
|
2852
2977
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
2853
2978
|
"elementor"
|
|
2854
2979
|
),
|
|
2855
2980
|
buttons: {
|
|
2856
|
-
clear:
|
|
2857
|
-
select:
|
|
2981
|
+
clear: __19("Clear", "elementor"),
|
|
2982
|
+
select: __19("Select variable", "elementor")
|
|
2858
2983
|
}
|
|
2859
2984
|
};
|
|
2860
2985
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
@@ -2864,10 +2989,10 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
2864
2989
|
variant: "standard",
|
|
2865
2990
|
severity: "warning",
|
|
2866
2991
|
onClose,
|
|
2867
|
-
action: /* @__PURE__ */ React27.createElement(React27.Fragment, null, onClear && /* @__PURE__ */ React27.createElement(
|
|
2992
|
+
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
2993
|
sx: { maxWidth: 300 }
|
|
2869
2994
|
},
|
|
2870
|
-
/* @__PURE__ */ React27.createElement(
|
|
2995
|
+
/* @__PURE__ */ React27.createElement(AlertTitle3, null, i18n.title),
|
|
2871
2996
|
/* @__PURE__ */ React27.createElement(Typography14, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
2872
2997
|
));
|
|
2873
2998
|
};
|
|
@@ -2875,7 +3000,7 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
2875
3000
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2876
3001
|
var MismatchVariable = ({ variable }) => {
|
|
2877
3002
|
const { setValue, value } = useBoundProp9();
|
|
2878
|
-
const anchorRef =
|
|
3003
|
+
const anchorRef = useRef8(null);
|
|
2879
3004
|
const popupId = useId3();
|
|
2880
3005
|
const popupState = usePopupState5({
|
|
2881
3006
|
variant: "popover",
|
|
@@ -2894,8 +3019,8 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2894
3019
|
setValue(null);
|
|
2895
3020
|
};
|
|
2896
3021
|
const showClearButton = !!value;
|
|
2897
|
-
return /* @__PURE__ */ React28.createElement(
|
|
2898
|
-
|
|
3022
|
+
return /* @__PURE__ */ React28.createElement(Box7, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React28.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
|
|
3023
|
+
Infotip3,
|
|
2899
3024
|
{
|
|
2900
3025
|
color: "warning",
|
|
2901
3026
|
placement: "right-start",
|
|
@@ -2926,7 +3051,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2926
3051
|
{
|
|
2927
3052
|
label: variable.label,
|
|
2928
3053
|
onClick: toggleInfotip,
|
|
2929
|
-
suffix:
|
|
3054
|
+
suffix: __20("changed", "elementor")
|
|
2930
3055
|
}
|
|
2931
3056
|
)
|
|
2932
3057
|
), /* @__PURE__ */ React28.createElement(
|
|
@@ -2956,13 +3081,13 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2956
3081
|
import * as React30 from "react";
|
|
2957
3082
|
import { useState as useState15 } from "react";
|
|
2958
3083
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
2959
|
-
import { Backdrop as Backdrop3, Infotip as
|
|
2960
|
-
import { __ as
|
|
3084
|
+
import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
|
|
3085
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2961
3086
|
|
|
2962
3087
|
// src/components/ui/missing-variable-alert.tsx
|
|
2963
3088
|
import * as React29 from "react";
|
|
2964
|
-
import { Alert as Alert4, AlertAction as
|
|
2965
|
-
import { __ as
|
|
3089
|
+
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as Typography15 } from "@elementor/ui";
|
|
3090
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
2966
3091
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
2967
3092
|
return /* @__PURE__ */ React29.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
2968
3093
|
Alert4,
|
|
@@ -2970,11 +3095,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
2970
3095
|
variant: "standard",
|
|
2971
3096
|
severity: "warning",
|
|
2972
3097
|
onClose,
|
|
2973
|
-
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(
|
|
3098
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(AlertAction4, { variant: "contained", onClick: onClear }, __21("Clear", "elementor"))),
|
|
2974
3099
|
sx: { maxWidth: 300 }
|
|
2975
3100
|
},
|
|
2976
|
-
/* @__PURE__ */ React29.createElement(
|
|
2977
|
-
/* @__PURE__ */ React29.createElement(Typography15, { variant: "body2", color: "textPrimary" },
|
|
3101
|
+
/* @__PURE__ */ React29.createElement(AlertTitle4, null, __21("This variable is missing", "elementor")),
|
|
3102
|
+
/* @__PURE__ */ React29.createElement(Typography15, { variant: "body2", color: "textPrimary" }, __21(
|
|
2978
3103
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
2979
3104
|
"elementor"
|
|
2980
3105
|
))
|
|
@@ -2989,7 +3114,7 @@ var MissingVariable = () => {
|
|
|
2989
3114
|
const closeInfotip = () => setInfotipVisible(false);
|
|
2990
3115
|
const clearValue = () => setValue(null);
|
|
2991
3116
|
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, infotipVisible && /* @__PURE__ */ React30.createElement(Backdrop3, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React30.createElement(
|
|
2992
|
-
|
|
3117
|
+
Infotip4,
|
|
2993
3118
|
{
|
|
2994
3119
|
color: "warning",
|
|
2995
3120
|
placement: "right-start",
|
|
@@ -3008,7 +3133,7 @@ var MissingVariable = () => {
|
|
|
3008
3133
|
}
|
|
3009
3134
|
}
|
|
3010
3135
|
},
|
|
3011
|
-
/* @__PURE__ */ React30.createElement(WarningVariableTag, { label:
|
|
3136
|
+
/* @__PURE__ */ React30.createElement(WarningVariableTag, { label: __22("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3012
3137
|
));
|
|
3013
3138
|
};
|
|
3014
3139
|
|
|
@@ -3035,14 +3160,14 @@ var VariableControl = () => {
|
|
|
3035
3160
|
import * as React32 from "react";
|
|
3036
3161
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-editing-panel";
|
|
3037
3162
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
3038
|
-
import { __ as
|
|
3163
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3039
3164
|
var usePropVariableAction = () => {
|
|
3040
3165
|
const { propType, path } = useBoundProp12();
|
|
3041
3166
|
const variable = resolveVariableFromPropType(propType);
|
|
3042
3167
|
return {
|
|
3043
3168
|
visible: Boolean(variable),
|
|
3044
3169
|
icon: ColorFilterIcon4,
|
|
3045
|
-
title:
|
|
3170
|
+
title: __23("Variables", "elementor"),
|
|
3046
3171
|
content: ({ close: closePopover }) => {
|
|
3047
3172
|
if (!variable) {
|
|
3048
3173
|
return null;
|
|
@@ -3331,12 +3456,12 @@ import { BrushIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
|
3331
3456
|
|
|
3332
3457
|
// src/components/fields/color-field.tsx
|
|
3333
3458
|
import * as React33 from "react";
|
|
3334
|
-
import { useRef as
|
|
3459
|
+
import { useRef as useRef9, useState as useState16 } from "react";
|
|
3335
3460
|
import { UnstableColorField } from "@elementor/ui";
|
|
3336
3461
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3337
3462
|
const [color, setColor] = useState16(value);
|
|
3338
3463
|
const [errorMessage, setErrorMessage] = useState16("");
|
|
3339
|
-
const defaultRef =
|
|
3464
|
+
const defaultRef = useRef9(null);
|
|
3340
3465
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3341
3466
|
const handleChange = (newValue) => {
|
|
3342
3467
|
setColor(newValue);
|
|
@@ -3375,15 +3500,15 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3375
3500
|
|
|
3376
3501
|
// src/components/fields/font-field.tsx
|
|
3377
3502
|
import * as React34 from "react";
|
|
3378
|
-
import { useId as useId4, useRef as
|
|
3503
|
+
import { useId as useId4, useRef as useRef10, useState as useState17 } from "react";
|
|
3379
3504
|
import { enqueueFont as enqueueFont2, ItemSelector } from "@elementor/editor-controls";
|
|
3380
3505
|
import { useFontFamilies, useSectionWidth } from "@elementor/editor-editing-panel";
|
|
3381
3506
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
3382
3507
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
3383
|
-
import { __ as
|
|
3508
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3384
3509
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3385
3510
|
const [fontFamily, setFontFamily] = useState17(value);
|
|
3386
|
-
const defaultRef =
|
|
3511
|
+
const defaultRef = useRef10(null);
|
|
3387
3512
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3388
3513
|
const fontPopoverState = usePopupState6({ variant: "popover" });
|
|
3389
3514
|
const fontFamilies = useFontFamilies();
|
|
@@ -3434,7 +3559,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3434
3559
|
onItemChange: handleFontFamilyChange,
|
|
3435
3560
|
onClose: fontPopoverState.close,
|
|
3436
3561
|
sectionWidth,
|
|
3437
|
-
title:
|
|
3562
|
+
title: __24("Font Family", "elementor"),
|
|
3438
3563
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3439
3564
|
onDebounce: enqueueFont2,
|
|
3440
3565
|
icon: TextIcon
|