@elementor/editor-variables 4.0.0-564 → 4.0.0-573
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 +520 -545
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -412
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-manager/variables-manager-panel.tsx +31 -3
- package/src/components/ui/stop-sync-confirmation-dialog.tsx +0 -77
package/dist/index.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import { useEffect as useEffect4, useRef as useRef7 } from "react";
|
|
|
10
10
|
import { __privateListenTo as listenTo, routeOpenEvent } from "@elementor/editor-v1-adapters";
|
|
11
11
|
|
|
12
12
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
13
|
-
import * as
|
|
14
|
-
import { useCallback as useCallback5, useEffect as useEffect3, useState as
|
|
13
|
+
import * as React14 from "react";
|
|
14
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState6 } from "react";
|
|
15
15
|
import {
|
|
16
16
|
__createPanel as createPanel,
|
|
17
17
|
Panel,
|
|
@@ -20,21 +20,21 @@ import {
|
|
|
20
20
|
PanelHeader,
|
|
21
21
|
PanelHeaderTitle
|
|
22
22
|
} from "@elementor/editor-panels";
|
|
23
|
-
import { SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
23
|
+
import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
24
24
|
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
25
25
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2, ColorFilterIcon, TrashIcon } from "@elementor/icons";
|
|
26
26
|
import {
|
|
27
27
|
Alert,
|
|
28
28
|
AlertAction,
|
|
29
29
|
AlertTitle,
|
|
30
|
-
Button as
|
|
30
|
+
Button as Button2,
|
|
31
31
|
CloseButton,
|
|
32
32
|
Divider,
|
|
33
33
|
Infotip,
|
|
34
34
|
Stack as Stack6,
|
|
35
35
|
usePopupState as usePopupState2
|
|
36
36
|
} from "@elementor/ui";
|
|
37
|
-
import { __ as
|
|
37
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
38
38
|
|
|
39
39
|
// src/utils/tracking.ts
|
|
40
40
|
import { getMixpanel } from "@elementor/events";
|
|
@@ -805,58 +805,10 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
805
805
|
);
|
|
806
806
|
};
|
|
807
807
|
|
|
808
|
-
// src/components/ui/stop-sync-confirmation-dialog.tsx
|
|
809
|
-
import * as React5 from "react";
|
|
810
|
-
import { useState } from "react";
|
|
811
|
-
import { BrushIcon } from "@elementor/icons";
|
|
812
|
-
import {
|
|
813
|
-
Button as Button2,
|
|
814
|
-
Checkbox,
|
|
815
|
-
Dialog,
|
|
816
|
-
DialogActions,
|
|
817
|
-
DialogContent,
|
|
818
|
-
DialogContentText,
|
|
819
|
-
DialogTitle,
|
|
820
|
-
FormControlLabel,
|
|
821
|
-
Typography as Typography5
|
|
822
|
-
} from "@elementor/ui";
|
|
823
|
-
import { __ as __7 } from "@wordpress/i18n";
|
|
824
|
-
var StopSyncConfirmationDialog = ({
|
|
825
|
-
open,
|
|
826
|
-
closeDialog,
|
|
827
|
-
onConfirm,
|
|
828
|
-
onSuppressMessage
|
|
829
|
-
}) => {
|
|
830
|
-
const [dontShowAgain, setDontShowAgain] = useState(false);
|
|
831
|
-
const handleConfirm = () => {
|
|
832
|
-
if (dontShowAgain) {
|
|
833
|
-
onSuppressMessage?.();
|
|
834
|
-
}
|
|
835
|
-
onConfirm();
|
|
836
|
-
};
|
|
837
|
-
return /* @__PURE__ */ React5.createElement(Dialog, { open, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React5.createElement(DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React5.createElement(BrushIcon, { color: "secondary" }), __7("Stop syncing variable color", "elementor")), /* @__PURE__ */ React5.createElement(DialogContent, null, /* @__PURE__ */ React5.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __7(
|
|
838
|
-
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
839
|
-
"elementor"
|
|
840
|
-
))), /* @__PURE__ */ React5.createElement(DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React5.createElement(
|
|
841
|
-
FormControlLabel,
|
|
842
|
-
{
|
|
843
|
-
control: /* @__PURE__ */ React5.createElement(
|
|
844
|
-
Checkbox,
|
|
845
|
-
{
|
|
846
|
-
checked: dontShowAgain,
|
|
847
|
-
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
848
|
-
size: "small"
|
|
849
|
-
}
|
|
850
|
-
),
|
|
851
|
-
label: /* @__PURE__ */ React5.createElement(Typography5, { variant: "body2" }, __7("Don't show this again", "elementor"))
|
|
852
|
-
}
|
|
853
|
-
), /* @__PURE__ */ React5.createElement("div", null, /* @__PURE__ */ React5.createElement(Button2, { color: "secondary", onClick: closeDialog }, __7("Cancel", "elementor")), /* @__PURE__ */ React5.createElement(Button2, { variant: "contained", color: "secondary", onClick: handleConfirm, sx: { ml: 1 } }, __7("Got it", "elementor")))));
|
|
854
|
-
};
|
|
855
|
-
|
|
856
808
|
// src/components/variables-manager/hooks/use-auto-edit.ts
|
|
857
|
-
import { useCallback, useState
|
|
809
|
+
import { useCallback, useState } from "react";
|
|
858
810
|
var useAutoEdit = () => {
|
|
859
|
-
const [autoEditVariableId, setAutoEditVariableId] =
|
|
811
|
+
const [autoEditVariableId, setAutoEditVariableId] = useState(void 0);
|
|
860
812
|
const startAutoEdit = useCallback((variableId) => {
|
|
861
813
|
setAutoEditVariableId(variableId);
|
|
862
814
|
}, []);
|
|
@@ -908,18 +860,18 @@ var useErrorNavigation = () => {
|
|
|
908
860
|
};
|
|
909
861
|
|
|
910
862
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
911
|
-
import { useCallback as useCallback3, useState as
|
|
863
|
+
import { useCallback as useCallback3, useState as useState2 } from "react";
|
|
912
864
|
|
|
913
865
|
// src/hooks/use-prop-variables.ts
|
|
914
866
|
import { useMemo } from "react";
|
|
915
867
|
import { useBoundProp } from "@elementor/editor-controls";
|
|
916
868
|
|
|
917
869
|
// src/context/variable-type-context.tsx
|
|
918
|
-
import * as
|
|
870
|
+
import * as React5 from "react";
|
|
919
871
|
import { createContext, useContext } from "react";
|
|
920
872
|
var VariableTypeContext = createContext(null);
|
|
921
873
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
922
|
-
return /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ React5.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
923
875
|
}
|
|
924
876
|
function useVariableType() {
|
|
925
877
|
const context = useContext(VariableTypeContext);
|
|
@@ -1039,12 +991,12 @@ var restoreVariable = (restoreId, label, value, type) => {
|
|
|
1039
991
|
|
|
1040
992
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
1041
993
|
var useVariablesManagerState = () => {
|
|
1042
|
-
const [variables, setVariables] =
|
|
1043
|
-
const [deletedVariables, setDeletedVariables] =
|
|
1044
|
-
const [isSaveDisabled, setIsSaveDisabled] =
|
|
1045
|
-
const [isDirty, setIsDirty] =
|
|
1046
|
-
const [isSaving, setIsSaving] =
|
|
1047
|
-
const [searchValue, setSearchValue] =
|
|
994
|
+
const [variables, setVariables] = useState2(() => getVariables(false));
|
|
995
|
+
const [deletedVariables, setDeletedVariables] = useState2([]);
|
|
996
|
+
const [isSaveDisabled, setIsSaveDisabled] = useState2(false);
|
|
997
|
+
const [isDirty, setIsDirty] = useState2(false);
|
|
998
|
+
const [isSaving, setIsSaving] = useState2(false);
|
|
999
|
+
const [searchValue, setSearchValue] = useState2("");
|
|
1048
1000
|
const handleOnChange = useCallback3(
|
|
1049
1001
|
(newVariables) => {
|
|
1050
1002
|
setVariables({ ...variables, ...newVariables });
|
|
@@ -1125,12 +1077,12 @@ var useVariablesManagerState = () => {
|
|
|
1125
1077
|
};
|
|
1126
1078
|
|
|
1127
1079
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1128
|
-
import * as
|
|
1129
|
-
import { createElement as
|
|
1080
|
+
import * as React7 from "react";
|
|
1081
|
+
import { createElement as createElement8, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
1130
1082
|
import { PlusIcon } from "@elementor/icons";
|
|
1131
|
-
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as
|
|
1083
|
+
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography5 } from "@elementor/ui";
|
|
1132
1084
|
import { capitalize as capitalize2 } from "@elementor/utils";
|
|
1133
|
-
import { __ as
|
|
1085
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
1134
1086
|
|
|
1135
1087
|
// src/hooks/use-quota-permissions.ts
|
|
1136
1088
|
var useQuotaPermissions = (variableType) => {
|
|
@@ -1148,42 +1100,42 @@ var useQuotaPermissions = (variableType) => {
|
|
|
1148
1100
|
};
|
|
1149
1101
|
|
|
1150
1102
|
// src/components/ui/variable-promotion-chip.tsx
|
|
1151
|
-
import * as
|
|
1152
|
-
import { forwardRef, useImperativeHandle, useState as
|
|
1103
|
+
import * as React6 from "react";
|
|
1104
|
+
import { forwardRef, useImperativeHandle, useState as useState3 } from "react";
|
|
1153
1105
|
import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
|
|
1154
1106
|
import { Box } from "@elementor/ui";
|
|
1155
1107
|
import { capitalize } from "@elementor/utils";
|
|
1156
|
-
import { __ as
|
|
1108
|
+
import { __ as __7, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
1157
1109
|
var VariablePromotionChip = forwardRef(
|
|
1158
1110
|
({ variableType, upgradeUrl }, ref) => {
|
|
1159
|
-
const [isOpen, setIsOpen] =
|
|
1111
|
+
const [isOpen, setIsOpen] = useState3(false);
|
|
1160
1112
|
useCanvasClickHandler(isOpen, () => setIsOpen(false));
|
|
1161
1113
|
const toggle = () => setIsOpen((prev) => !prev);
|
|
1162
1114
|
useImperativeHandle(ref, () => ({ toggle }), []);
|
|
1163
1115
|
const title = sprintf2(
|
|
1164
1116
|
/* translators: %s: Variable Type. */
|
|
1165
|
-
|
|
1117
|
+
__7("%s variables", "elementor"),
|
|
1166
1118
|
capitalize(variableType)
|
|
1167
1119
|
);
|
|
1168
1120
|
const content = sprintf2(
|
|
1169
1121
|
/* translators: %s: Variable Type. */
|
|
1170
|
-
|
|
1122
|
+
__7("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1171
1123
|
variableType
|
|
1172
1124
|
);
|
|
1173
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React6.createElement(
|
|
1174
1126
|
PromotionPopover,
|
|
1175
1127
|
{
|
|
1176
1128
|
open: isOpen,
|
|
1177
1129
|
title,
|
|
1178
1130
|
content,
|
|
1179
|
-
ctaText:
|
|
1131
|
+
ctaText: __7("Upgrade now", "elementor"),
|
|
1180
1132
|
ctaUrl: upgradeUrl,
|
|
1181
1133
|
onClose: (e) => {
|
|
1182
1134
|
e.stopPropagation();
|
|
1183
1135
|
setIsOpen(false);
|
|
1184
1136
|
}
|
|
1185
1137
|
},
|
|
1186
|
-
/* @__PURE__ */
|
|
1138
|
+
/* @__PURE__ */ React6.createElement(
|
|
1187
1139
|
Box,
|
|
1188
1140
|
{
|
|
1189
1141
|
onClick: (e) => {
|
|
@@ -1192,7 +1144,7 @@ var VariablePromotionChip = forwardRef(
|
|
|
1192
1144
|
},
|
|
1193
1145
|
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1194
1146
|
},
|
|
1195
|
-
/* @__PURE__ */
|
|
1147
|
+
/* @__PURE__ */ React6.createElement(PromotionChip, null)
|
|
1196
1148
|
)
|
|
1197
1149
|
);
|
|
1198
1150
|
}
|
|
@@ -1213,16 +1165,16 @@ var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
|
1213
1165
|
})),
|
|
1214
1166
|
[variableTypes]
|
|
1215
1167
|
);
|
|
1216
|
-
return /* @__PURE__ */
|
|
1168
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
1217
1169
|
IconButton,
|
|
1218
1170
|
{
|
|
1219
1171
|
...bindTrigger(menuState),
|
|
1220
1172
|
ref: buttonRef,
|
|
1221
1173
|
size: SIZE,
|
|
1222
|
-
"aria-label":
|
|
1174
|
+
"aria-label": __8("Add variable", "elementor")
|
|
1223
1175
|
},
|
|
1224
|
-
/* @__PURE__ */
|
|
1225
|
-
), /* @__PURE__ */
|
|
1176
|
+
/* @__PURE__ */ React7.createElement(PlusIcon, { fontSize: SIZE })
|
|
1177
|
+
), /* @__PURE__ */ React7.createElement(
|
|
1226
1178
|
Menu,
|
|
1227
1179
|
{
|
|
1228
1180
|
disablePortal: true,
|
|
@@ -1244,7 +1196,7 @@ var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
|
1244
1196
|
},
|
|
1245
1197
|
"data-testid": "variable-manager-create-menu"
|
|
1246
1198
|
},
|
|
1247
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1199
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React7.createElement(
|
|
1248
1200
|
MenuOption,
|
|
1249
1201
|
{
|
|
1250
1202
|
key: config.key,
|
|
@@ -1276,7 +1228,7 @@ var MenuOption = ({
|
|
|
1276
1228
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1277
1229
|
onClose();
|
|
1278
1230
|
};
|
|
1279
|
-
return /* @__PURE__ */
|
|
1231
|
+
return /* @__PURE__ */ React7.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, createElement8(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React7.createElement(Typography5, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React7.createElement(
|
|
1280
1232
|
VariablePromotionChip,
|
|
1281
1233
|
{
|
|
1282
1234
|
variableType: config.variableType,
|
|
@@ -1297,7 +1249,7 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1297
1249
|
};
|
|
1298
1250
|
|
|
1299
1251
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1300
|
-
import * as
|
|
1252
|
+
import * as React13 from "react";
|
|
1301
1253
|
import { useEffect as useEffect2, useRef as useRef6 } from "react";
|
|
1302
1254
|
import {
|
|
1303
1255
|
Table,
|
|
@@ -1308,10 +1260,10 @@ import {
|
|
|
1308
1260
|
UnstableSortableItem,
|
|
1309
1261
|
UnstableSortableProvider
|
|
1310
1262
|
} from "@elementor/ui";
|
|
1311
|
-
import { __ as
|
|
1263
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
1312
1264
|
|
|
1313
1265
|
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1314
|
-
import * as
|
|
1266
|
+
import * as React8 from "react";
|
|
1315
1267
|
import { TableCell } from "@elementor/ui";
|
|
1316
1268
|
var VariableTableCell = ({
|
|
1317
1269
|
children,
|
|
@@ -1331,26 +1283,26 @@ var VariableTableCell = ({
|
|
|
1331
1283
|
...width && { width },
|
|
1332
1284
|
...sx
|
|
1333
1285
|
};
|
|
1334
|
-
return /* @__PURE__ */
|
|
1286
|
+
return /* @__PURE__ */ React8.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1335
1287
|
};
|
|
1336
1288
|
|
|
1337
1289
|
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1338
|
-
import * as
|
|
1339
|
-
import { createElement as
|
|
1290
|
+
import * as React12 from "react";
|
|
1291
|
+
import { createElement as createElement15, useRef as useRef5 } from "react";
|
|
1340
1292
|
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1341
1293
|
import { GripVerticalIcon } from "@elementor/icons";
|
|
1342
1294
|
import { IconButton as IconButton3, Stack as Stack5, TableRow } from "@elementor/ui";
|
|
1343
1295
|
|
|
1344
1296
|
// src/components/fields/label-field.tsx
|
|
1345
|
-
import * as
|
|
1346
|
-
import { useRef as useRef3, useState as
|
|
1297
|
+
import * as React9 from "react";
|
|
1298
|
+
import { useRef as useRef3, useState as useState4 } from "react";
|
|
1347
1299
|
import { WarningInfotip } from "@elementor/editor-ui";
|
|
1348
1300
|
import { TextField } from "@elementor/ui";
|
|
1349
1301
|
function isLabelEqual(a, b) {
|
|
1350
1302
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1351
1303
|
}
|
|
1352
1304
|
var useLabelError = (initialError) => {
|
|
1353
|
-
const [error, setError] =
|
|
1305
|
+
const [error, setError] = useState4(initialError ?? { value: "", message: "" });
|
|
1354
1306
|
return {
|
|
1355
1307
|
labelFieldError: error,
|
|
1356
1308
|
setLabelFieldError: setError
|
|
@@ -1369,8 +1321,8 @@ var LabelField = ({
|
|
|
1369
1321
|
variables,
|
|
1370
1322
|
onKeyDown
|
|
1371
1323
|
}) => {
|
|
1372
|
-
const [label, setLabel] =
|
|
1373
|
-
const [errorMessage, setErrorMessage] =
|
|
1324
|
+
const [label, setLabel] = useState4(value);
|
|
1325
|
+
const [errorMessage, setErrorMessage] = useState4("");
|
|
1374
1326
|
const fieldRef = useRef3(null);
|
|
1375
1327
|
const handleChange = (newValue) => {
|
|
1376
1328
|
setLabel(newValue);
|
|
@@ -1384,7 +1336,7 @@ var LabelField = ({
|
|
|
1384
1336
|
errorMsg = error.message;
|
|
1385
1337
|
}
|
|
1386
1338
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1387
|
-
const textField = /* @__PURE__ */
|
|
1339
|
+
const textField = /* @__PURE__ */ React9.createElement(
|
|
1388
1340
|
TextField,
|
|
1389
1341
|
{
|
|
1390
1342
|
ref: fieldRef,
|
|
@@ -1405,7 +1357,7 @@ var LabelField = ({
|
|
|
1405
1357
|
);
|
|
1406
1358
|
if (showWarningInfotip) {
|
|
1407
1359
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1408
|
-
return /* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1409
1361
|
WarningInfotip,
|
|
1410
1362
|
{
|
|
1411
1363
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1422,10 +1374,10 @@ var LabelField = ({
|
|
|
1422
1374
|
};
|
|
1423
1375
|
|
|
1424
1376
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1425
|
-
import * as
|
|
1426
|
-
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as
|
|
1377
|
+
import * as React10 from "react";
|
|
1378
|
+
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as useState5 } from "react";
|
|
1427
1379
|
import { ClickAwayListener, Stack as Stack4 } from "@elementor/ui";
|
|
1428
|
-
var VariableEditableCell =
|
|
1380
|
+
var VariableEditableCell = React10.memo(
|
|
1429
1381
|
({
|
|
1430
1382
|
initialValue,
|
|
1431
1383
|
children,
|
|
@@ -1439,10 +1391,10 @@ var VariableEditableCell = React11.memo(
|
|
|
1439
1391
|
fieldType,
|
|
1440
1392
|
disabled = false
|
|
1441
1393
|
}) => {
|
|
1442
|
-
const [value, setValue] =
|
|
1443
|
-
const [isEditing, setIsEditing] =
|
|
1394
|
+
const [value, setValue] = useState5(initialValue);
|
|
1395
|
+
const [isEditing, setIsEditing] = useState5(false);
|
|
1444
1396
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1445
|
-
const [valueFieldError, setValueFieldError] =
|
|
1397
|
+
const [valueFieldError, setValueFieldError] = useState5("");
|
|
1446
1398
|
const rowRef = useRef4(null);
|
|
1447
1399
|
const handleSave = useCallback4(() => {
|
|
1448
1400
|
const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
|
|
@@ -1509,7 +1461,7 @@ var VariableEditableCell = React11.memo(
|
|
|
1509
1461
|
error: currentError
|
|
1510
1462
|
});
|
|
1511
1463
|
if (isEditing) {
|
|
1512
|
-
return /* @__PURE__ */
|
|
1464
|
+
return /* @__PURE__ */ React10.createElement(ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React10.createElement(
|
|
1513
1465
|
Stack4,
|
|
1514
1466
|
{
|
|
1515
1467
|
ref: rowRef,
|
|
@@ -1526,7 +1478,7 @@ var VariableEditableCell = React11.memo(
|
|
|
1526
1478
|
editableContent
|
|
1527
1479
|
));
|
|
1528
1480
|
}
|
|
1529
|
-
return /* @__PURE__ */
|
|
1481
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1530
1482
|
Stack4,
|
|
1531
1483
|
{
|
|
1532
1484
|
ref: rowRef,
|
|
@@ -1546,8 +1498,8 @@ var VariableEditableCell = React11.memo(
|
|
|
1546
1498
|
);
|
|
1547
1499
|
|
|
1548
1500
|
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1549
|
-
import * as
|
|
1550
|
-
import { createElement as
|
|
1501
|
+
import * as React11 from "react";
|
|
1502
|
+
import { createElement as createElement13 } from "react";
|
|
1551
1503
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1552
1504
|
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1553
1505
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
@@ -1555,7 +1507,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1555
1507
|
variant: "popover"
|
|
1556
1508
|
});
|
|
1557
1509
|
const triggerProps = bindTrigger2(menuState);
|
|
1558
|
-
return /* @__PURE__ */
|
|
1510
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1559
1511
|
IconButton2,
|
|
1560
1512
|
{
|
|
1561
1513
|
...triggerProps,
|
|
@@ -1566,8 +1518,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1566
1518
|
triggerProps.onClick?.(e);
|
|
1567
1519
|
}
|
|
1568
1520
|
},
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
), /* @__PURE__ */
|
|
1521
|
+
/* @__PURE__ */ React11.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
1522
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1571
1523
|
Menu2,
|
|
1572
1524
|
{
|
|
1573
1525
|
disablePortal: true,
|
|
@@ -1590,7 +1542,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1590
1542
|
open: menuState.isOpen,
|
|
1591
1543
|
onClose: menuState.close
|
|
1592
1544
|
},
|
|
1593
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
1545
|
+
menuActions.map((action) => /* @__PURE__ */ React11.createElement(
|
|
1594
1546
|
MenuItem2,
|
|
1595
1547
|
{
|
|
1596
1548
|
key: action.name,
|
|
@@ -1604,7 +1556,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1604
1556
|
gap: 1
|
|
1605
1557
|
}
|
|
1606
1558
|
},
|
|
1607
|
-
action.icon &&
|
|
1559
|
+
action.icon && createElement13(action.icon, {
|
|
1608
1560
|
fontSize: "inherit"
|
|
1609
1561
|
}),
|
|
1610
1562
|
" ",
|
|
@@ -1638,7 +1590,7 @@ var VariableRow = (props) => {
|
|
|
1638
1590
|
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1639
1591
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1640
1592
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1641
|
-
return /* @__PURE__ */
|
|
1593
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1642
1594
|
TableRow,
|
|
1643
1595
|
{
|
|
1644
1596
|
...itemProps,
|
|
@@ -1679,8 +1631,8 @@ var VariableRow = (props) => {
|
|
|
1679
1631
|
}
|
|
1680
1632
|
}
|
|
1681
1633
|
},
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(IconButton3, { size: "small", ref: setTriggerRef, ...triggerProps, disabled: isSorting, draggable: true }, /* @__PURE__ */ React12.createElement(GripVerticalIcon, { fontSize: "inherit" }))),
|
|
1635
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1684
1636
|
VariableEditableCell,
|
|
1685
1637
|
{
|
|
1686
1638
|
initialValue: row.name,
|
|
@@ -1692,11 +1644,11 @@ var VariableRow = (props) => {
|
|
|
1692
1644
|
});
|
|
1693
1645
|
}
|
|
1694
1646
|
},
|
|
1695
|
-
prefixElement:
|
|
1647
|
+
prefixElement: createElement15(row.icon, {
|
|
1696
1648
|
fontSize: "inherit",
|
|
1697
1649
|
color: isDisabled ? "disabled" : "inherit"
|
|
1698
1650
|
}),
|
|
1699
|
-
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */
|
|
1651
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React12.createElement(
|
|
1700
1652
|
LabelField,
|
|
1701
1653
|
{
|
|
1702
1654
|
id: "variable-label-" + row.id,
|
|
@@ -1720,9 +1672,9 @@ var VariableRow = (props) => {
|
|
|
1720
1672
|
fieldType: "label",
|
|
1721
1673
|
disabled: isDisabled
|
|
1722
1674
|
},
|
|
1723
|
-
/* @__PURE__ */
|
|
1675
|
+
/* @__PURE__ */ React12.createElement(EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1724
1676
|
)),
|
|
1725
|
-
/* @__PURE__ */
|
|
1677
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1726
1678
|
VariableEditableCell,
|
|
1727
1679
|
{
|
|
1728
1680
|
initialValue: row.value,
|
|
@@ -1751,14 +1703,14 @@ var VariableRow = (props) => {
|
|
|
1751
1703
|
onFieldError?.(!!errorMsg);
|
|
1752
1704
|
},
|
|
1753
1705
|
error
|
|
1754
|
-
}) ?? /* @__PURE__ */
|
|
1706
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1755
1707
|
onRowRef: handleRowRef(row.id),
|
|
1756
1708
|
gap: 0.25,
|
|
1757
1709
|
fieldType: "value",
|
|
1758
1710
|
disabled: isDisabled
|
|
1759
1711
|
},
|
|
1760
1712
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1761
|
-
/* @__PURE__ */
|
|
1713
|
+
/* @__PURE__ */ React12.createElement(
|
|
1762
1714
|
EllipsisWithTooltip,
|
|
1763
1715
|
{
|
|
1764
1716
|
title: row.value,
|
|
@@ -1771,14 +1723,14 @@ var VariableRow = (props) => {
|
|
|
1771
1723
|
row.value
|
|
1772
1724
|
)
|
|
1773
1725
|
)),
|
|
1774
|
-
/* @__PURE__ */
|
|
1726
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { align: "right", noPadding: true, width: 16, maxWidth: 16, sx: { paddingInlineEnd: 1 } }, /* @__PURE__ */ React12.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end", alignItems: "center" }, isDisabled && /* @__PURE__ */ React12.createElement(
|
|
1775
1727
|
VariablePromotionChip,
|
|
1776
1728
|
{
|
|
1777
1729
|
variableType: row.variableType,
|
|
1778
1730
|
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1779
1731
|
ref: promotionRef
|
|
1780
1732
|
}
|
|
1781
|
-
), /* @__PURE__ */
|
|
1733
|
+
), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1782
1734
|
);
|
|
1783
1735
|
};
|
|
1784
1736
|
|
|
@@ -1844,21 +1796,21 @@ var VariablesManagerTable = ({
|
|
|
1844
1796
|
});
|
|
1845
1797
|
handleOnChange(updatedVariables);
|
|
1846
1798
|
};
|
|
1847
|
-
return /* @__PURE__ */
|
|
1799
|
+
return /* @__PURE__ */ React13.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React13.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React13.createElement(TableHead, null, /* @__PURE__ */ React13.createElement(TableRow2, null, /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, __9("Name", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, __9("Value", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React13.createElement(TableBody, null, /* @__PURE__ */ React13.createElement(
|
|
1848
1800
|
UnstableSortableProvider,
|
|
1849
1801
|
{
|
|
1850
1802
|
value: ids,
|
|
1851
1803
|
onChange: handleReorder,
|
|
1852
1804
|
variant: "static",
|
|
1853
1805
|
restrictAxis: true,
|
|
1854
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1806
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React13.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React13.createElement(TableBody, null, dragOverlayChildren))
|
|
1855
1807
|
},
|
|
1856
|
-
rows.map((row) => /* @__PURE__ */
|
|
1808
|
+
rows.map((row) => /* @__PURE__ */ React13.createElement(
|
|
1857
1809
|
UnstableSortableItem,
|
|
1858
1810
|
{
|
|
1859
1811
|
key: row.id,
|
|
1860
1812
|
id: row.id,
|
|
1861
|
-
render: (props) => /* @__PURE__ */
|
|
1813
|
+
render: (props) => /* @__PURE__ */ React13.createElement(
|
|
1862
1814
|
VariableRow,
|
|
1863
1815
|
{
|
|
1864
1816
|
...props,
|
|
@@ -1922,9 +1874,9 @@ function VariablesManagerPanel() {
|
|
|
1922
1874
|
} = useVariablesManagerState();
|
|
1923
1875
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1924
1876
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1925
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
1926
|
-
const [stopSyncConfirmation, setStopSyncConfirmation] =
|
|
1927
|
-
const [serverError, setServerError] =
|
|
1877
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState6(null);
|
|
1878
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = useState6(null);
|
|
1879
|
+
const [serverError, setServerError] = useState6(null);
|
|
1928
1880
|
usePreventUnload(isDirty);
|
|
1929
1881
|
const handleClosePanel = () => {
|
|
1930
1882
|
if (isDirty) {
|
|
@@ -1996,7 +1948,7 @@ function VariablesManagerPanel() {
|
|
|
1996
1948
|
}
|
|
1997
1949
|
});
|
|
1998
1950
|
const deleteAction = {
|
|
1999
|
-
name:
|
|
1951
|
+
name: __10("Delete", "elementor"),
|
|
2000
1952
|
icon: TrashIcon,
|
|
2001
1953
|
color: "error.main",
|
|
2002
1954
|
onClick: (itemId) => {
|
|
@@ -2013,21 +1965,21 @@ function VariablesManagerPanel() {
|
|
|
2013
1965
|
[variables, handleStartSync]
|
|
2014
1966
|
);
|
|
2015
1967
|
const hasVariables = Object.keys(variables).length > 0;
|
|
2016
|
-
return /* @__PURE__ */
|
|
1968
|
+
return /* @__PURE__ */ React14.createElement(ThemeProvider, null, /* @__PURE__ */ React14.createElement(Panel, null, /* @__PURE__ */ React14.createElement(
|
|
2017
1969
|
PanelHeader,
|
|
2018
1970
|
{
|
|
2019
1971
|
sx: {
|
|
2020
1972
|
height: "unset"
|
|
2021
1973
|
}
|
|
2022
1974
|
},
|
|
2023
|
-
/* @__PURE__ */
|
|
1975
|
+
/* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "inherit" }), __10("Variables Manager", "elementor"))), /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React14.createElement(
|
|
2024
1976
|
VariableManagerCreateMenu,
|
|
2025
1977
|
{
|
|
2026
1978
|
onCreate: handleCreateVariable,
|
|
2027
1979
|
variables,
|
|
2028
1980
|
menuState: createMenuState
|
|
2029
1981
|
}
|
|
2030
|
-
), /* @__PURE__ */
|
|
1982
|
+
), /* @__PURE__ */ React14.createElement(
|
|
2031
1983
|
CloseButton,
|
|
2032
1984
|
{
|
|
2033
1985
|
"aria-label": "Close",
|
|
@@ -2036,19 +1988,19 @@ function VariablesManagerPanel() {
|
|
|
2036
1988
|
handleClosePanel();
|
|
2037
1989
|
}
|
|
2038
1990
|
}
|
|
2039
|
-
))), /* @__PURE__ */
|
|
1991
|
+
))), /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(
|
|
2040
1992
|
SearchField,
|
|
2041
1993
|
{
|
|
2042
1994
|
sx: {
|
|
2043
1995
|
display: "flex",
|
|
2044
1996
|
flex: 1
|
|
2045
1997
|
},
|
|
2046
|
-
placeholder:
|
|
1998
|
+
placeholder: __10("Search", "elementor"),
|
|
2047
1999
|
value: searchValue,
|
|
2048
2000
|
onSearch: handleSearch
|
|
2049
2001
|
}
|
|
2050
|
-
)), /* @__PURE__ */
|
|
2051
|
-
), /* @__PURE__ */
|
|
2002
|
+
)), /* @__PURE__ */ React14.createElement(Divider, { sx: { width: "100%" } }))
|
|
2003
|
+
), /* @__PURE__ */ React14.createElement(
|
|
2052
2004
|
PanelBody,
|
|
2053
2005
|
{
|
|
2054
2006
|
sx: {
|
|
@@ -2057,7 +2009,7 @@ function VariablesManagerPanel() {
|
|
|
2057
2009
|
height: "100%"
|
|
2058
2010
|
}
|
|
2059
2011
|
},
|
|
2060
|
-
hasVariables && /* @__PURE__ */
|
|
2012
|
+
hasVariables && /* @__PURE__ */ React14.createElement(
|
|
2061
2013
|
VariablesManagerTable,
|
|
2062
2014
|
{
|
|
2063
2015
|
menuActions: buildMenuActions,
|
|
@@ -2068,43 +2020,43 @@ function VariablesManagerPanel() {
|
|
|
2068
2020
|
onFieldError: setIsSaveDisabled
|
|
2069
2021
|
}
|
|
2070
2022
|
),
|
|
2071
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2023
|
+
!hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
2072
2024
|
NoSearchResults,
|
|
2073
2025
|
{
|
|
2074
2026
|
searchValue,
|
|
2075
2027
|
onClear: () => handleSearch(""),
|
|
2076
|
-
icon: /* @__PURE__ */
|
|
2028
|
+
icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" })
|
|
2077
2029
|
}
|
|
2078
2030
|
),
|
|
2079
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2031
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
2080
2032
|
EmptyState,
|
|
2081
2033
|
{
|
|
2082
|
-
title:
|
|
2083
|
-
message:
|
|
2034
|
+
title: __10("Create your first variable", "elementor"),
|
|
2035
|
+
message: __10(
|
|
2084
2036
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2085
2037
|
"elementor"
|
|
2086
2038
|
),
|
|
2087
|
-
icon: /* @__PURE__ */
|
|
2039
|
+
icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" }),
|
|
2088
2040
|
onAdd: createMenuState.open
|
|
2089
2041
|
}
|
|
2090
2042
|
)
|
|
2091
|
-
), /* @__PURE__ */
|
|
2043
|
+
), /* @__PURE__ */ React14.createElement(PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
2092
2044
|
Infotip,
|
|
2093
2045
|
{
|
|
2094
2046
|
placement: "right",
|
|
2095
2047
|
open: !!serverError,
|
|
2096
|
-
content: serverError ? /* @__PURE__ */
|
|
2048
|
+
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
2097
2049
|
Alert,
|
|
2098
2050
|
{
|
|
2099
2051
|
severity: serverError.severity ?? "error",
|
|
2100
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2052
|
+
action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
2101
2053
|
onClose: !serverError.action?.label ? () => {
|
|
2102
2054
|
setServerError(null);
|
|
2103
2055
|
setIsSaveDisabled(false);
|
|
2104
2056
|
} : void 0,
|
|
2105
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2057
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(AlertTriangleFilledIcon2, null)
|
|
2106
2058
|
},
|
|
2107
|
-
/* @__PURE__ */
|
|
2059
|
+
/* @__PURE__ */ React14.createElement(AlertTitle, null, serverError.message),
|
|
2108
2060
|
serverError.action?.message
|
|
2109
2061
|
) : null,
|
|
2110
2062
|
arrow: false,
|
|
@@ -2119,8 +2071,8 @@ function VariablesManagerPanel() {
|
|
|
2119
2071
|
}
|
|
2120
2072
|
}
|
|
2121
2073
|
},
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
|
|
2074
|
+
/* @__PURE__ */ React14.createElement(
|
|
2075
|
+
Button2,
|
|
2124
2076
|
{
|
|
2125
2077
|
fullWidth: true,
|
|
2126
2078
|
size: "small",
|
|
@@ -2130,9 +2082,9 @@ function VariablesManagerPanel() {
|
|
|
2130
2082
|
onClick: handleSaveClick,
|
|
2131
2083
|
loading: isSaving
|
|
2132
2084
|
},
|
|
2133
|
-
|
|
2085
|
+
__10("Save changes", "elementor")
|
|
2134
2086
|
)
|
|
2135
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2087
|
+
))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2136
2088
|
DeleteConfirmationDialog,
|
|
2137
2089
|
{
|
|
2138
2090
|
open: true,
|
|
@@ -2140,26 +2092,26 @@ function VariablesManagerPanel() {
|
|
|
2140
2092
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2141
2093
|
closeDialog: () => setDeleteConfirmation(null)
|
|
2142
2094
|
}
|
|
2143
|
-
), stopSyncConfirmation && /* @__PURE__ */
|
|
2095
|
+
), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2144
2096
|
StopSyncConfirmationDialog,
|
|
2145
2097
|
{
|
|
2146
2098
|
open: true,
|
|
2147
|
-
|
|
2099
|
+
onClose: () => setStopSyncConfirmation(null),
|
|
2148
2100
|
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2149
2101
|
}
|
|
2150
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
2102
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __10("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.ContentText, null, __10("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
|
|
2151
2103
|
SaveChangesDialog.Actions,
|
|
2152
2104
|
{
|
|
2153
2105
|
actions: {
|
|
2154
2106
|
discard: {
|
|
2155
|
-
label:
|
|
2107
|
+
label: __10("Discard", "elementor"),
|
|
2156
2108
|
action: () => {
|
|
2157
2109
|
closeSaveChangesDialog();
|
|
2158
2110
|
closePanel();
|
|
2159
2111
|
}
|
|
2160
2112
|
},
|
|
2161
2113
|
confirm: {
|
|
2162
|
-
label:
|
|
2114
|
+
label: __10("Save", "elementor"),
|
|
2163
2115
|
action: async () => {
|
|
2164
2116
|
const result = await handleSaveClick();
|
|
2165
2117
|
closeSaveChangesDialog();
|
|
@@ -2185,6 +2137,19 @@ var usePreventUnload = (isDirty) => {
|
|
|
2185
2137
|
};
|
|
2186
2138
|
}, [isDirty]);
|
|
2187
2139
|
};
|
|
2140
|
+
var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => /* @__PURE__ */ React14.createElement(ConfirmationDialog2, { open, onClose }, /* @__PURE__ */ React14.createElement(ConfirmationDialog2.Title, { icon: ColorFilterIcon, iconColor: "secondary" }, __10("Stop syncing variable color", "elementor")), /* @__PURE__ */ React14.createElement(ConfirmationDialog2.Content, null, /* @__PURE__ */ React14.createElement(ConfirmationDialog2.ContentText, null, __10(
|
|
2141
|
+
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
2142
|
+
"elementor"
|
|
2143
|
+
))), /* @__PURE__ */ React14.createElement(
|
|
2144
|
+
ConfirmationDialog2.Actions,
|
|
2145
|
+
{
|
|
2146
|
+
onClose,
|
|
2147
|
+
onConfirm,
|
|
2148
|
+
cancelLabel: __10("Cancel", "elementor"),
|
|
2149
|
+
confirmLabel: __10("Got it", "elementor"),
|
|
2150
|
+
color: "secondary"
|
|
2151
|
+
}
|
|
2152
|
+
));
|
|
2188
2153
|
|
|
2189
2154
|
// src/components/open-panel-from-url.tsx
|
|
2190
2155
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
@@ -2214,12 +2179,12 @@ function OpenPanelFromUrl() {
|
|
|
2214
2179
|
}
|
|
2215
2180
|
|
|
2216
2181
|
// src/controls/variable-control.tsx
|
|
2217
|
-
import * as
|
|
2182
|
+
import * as React33 from "react";
|
|
2218
2183
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
|
|
2219
2184
|
|
|
2220
2185
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2221
2186
|
import { useId, useRef as useRef8 } from "react";
|
|
2222
|
-
import * as
|
|
2187
|
+
import * as React24 from "react";
|
|
2223
2188
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
2224
2189
|
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
2225
2190
|
import { bindPopover, bindTrigger as bindTrigger3, Box as Box5, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
@@ -2241,31 +2206,31 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2241
2206
|
}
|
|
2242
2207
|
|
|
2243
2208
|
// src/components/variable-selection-popover.tsx
|
|
2244
|
-
import * as
|
|
2245
|
-
import { useState as
|
|
2209
|
+
import * as React22 from "react";
|
|
2210
|
+
import { useState as useState12 } from "react";
|
|
2246
2211
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
2247
2212
|
|
|
2248
2213
|
// src/context/variable-selection-popover.context.tsx
|
|
2249
|
-
import * as
|
|
2250
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
2214
|
+
import * as React15 from "react";
|
|
2215
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState7 } from "react";
|
|
2251
2216
|
import { Box as Box2 } from "@elementor/ui";
|
|
2252
2217
|
var PopoverContentRefContext = createContext2(null);
|
|
2253
2218
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2254
|
-
const [anchorRef, setAnchorRef] =
|
|
2255
|
-
return /* @__PURE__ */
|
|
2219
|
+
const [anchorRef, setAnchorRef] = useState7(null);
|
|
2220
|
+
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(Box2, { ref: setAnchorRef }, children));
|
|
2256
2221
|
};
|
|
2257
2222
|
var usePopoverContentRef = () => {
|
|
2258
2223
|
return useContext2(PopoverContentRefContext);
|
|
2259
2224
|
};
|
|
2260
2225
|
|
|
2261
2226
|
// src/components/variable-creation.tsx
|
|
2262
|
-
import * as
|
|
2263
|
-
import { useState as
|
|
2227
|
+
import * as React17 from "react";
|
|
2228
|
+
import { useState as useState8 } from "react";
|
|
2264
2229
|
import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
2265
2230
|
import { PopoverHeader, SectionPopoverBody } from "@elementor/editor-ui";
|
|
2266
2231
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
2267
|
-
import { Button as
|
|
2268
|
-
import { __ as
|
|
2232
|
+
import { Button as Button3, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography6 } from "@elementor/ui";
|
|
2233
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
2269
2234
|
|
|
2270
2235
|
// src/hooks/use-initial-value.ts
|
|
2271
2236
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
@@ -2308,10 +2273,10 @@ var unwrapValue = (input) => {
|
|
|
2308
2273
|
};
|
|
2309
2274
|
|
|
2310
2275
|
// src/components/ui/form-field.tsx
|
|
2311
|
-
import * as
|
|
2276
|
+
import * as React16 from "react";
|
|
2312
2277
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
2313
2278
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2314
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ React16.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(FormHelperText, null, noticeMsg)));
|
|
2315
2280
|
};
|
|
2316
2281
|
|
|
2317
2282
|
// src/components/variable-creation.tsx
|
|
@@ -2321,11 +2286,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2321
2286
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2322
2287
|
const { propType } = useBoundProp4();
|
|
2323
2288
|
const initialValue = useInitialValue();
|
|
2324
|
-
const [value, setValue] =
|
|
2325
|
-
const [label, setLabel] =
|
|
2326
|
-
const [errorMessage, setErrorMessage] =
|
|
2327
|
-
const [valueFieldError, setValueFieldError] =
|
|
2328
|
-
const [propTypeKey, setPropTypeKey] =
|
|
2289
|
+
const [value, setValue] = useState8(initialValue);
|
|
2290
|
+
const [label, setLabel] = useState8("");
|
|
2291
|
+
const [errorMessage, setErrorMessage] = useState8("");
|
|
2292
|
+
const [valueFieldError, setValueFieldError] = useState8("");
|
|
2293
|
+
const [propTypeKey, setPropTypeKey] = useState8(propTypeUtil.key);
|
|
2329
2294
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2330
2295
|
const resetFields = () => {
|
|
2331
2296
|
setValue("");
|
|
@@ -2382,22 +2347,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2382
2347
|
handleCreateAndTrack();
|
|
2383
2348
|
}
|
|
2384
2349
|
};
|
|
2385
|
-
return /* @__PURE__ */
|
|
2350
|
+
return /* @__PURE__ */ React17.createElement(SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2386
2351
|
PopoverHeader,
|
|
2387
2352
|
{
|
|
2388
|
-
icon: /* @__PURE__ */
|
|
2389
|
-
title:
|
|
2353
|
+
icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(IconButton4, { size: SIZE2, "aria-label": __11("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React17.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2354
|
+
title: __11("Create variable", "elementor"),
|
|
2390
2355
|
onClose: closePopover
|
|
2391
2356
|
}
|
|
2392
|
-
), /* @__PURE__ */
|
|
2357
|
+
), /* @__PURE__ */ React17.createElement(Divider2, null), /* @__PURE__ */ React17.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2393
2358
|
FormField,
|
|
2394
2359
|
{
|
|
2395
2360
|
id: "variable-label",
|
|
2396
|
-
label:
|
|
2361
|
+
label: __11("Name", "elementor"),
|
|
2397
2362
|
errorMsg: labelFieldError?.message,
|
|
2398
2363
|
noticeMsg: labelHint(label)
|
|
2399
2364
|
},
|
|
2400
|
-
/* @__PURE__ */
|
|
2365
|
+
/* @__PURE__ */ React17.createElement(
|
|
2401
2366
|
LabelField,
|
|
2402
2367
|
{
|
|
2403
2368
|
id: "variable-label",
|
|
@@ -2416,7 +2381,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2416
2381
|
onKeyDown: handleKeyDown
|
|
2417
2382
|
}
|
|
2418
2383
|
)
|
|
2419
|
-
), ValueField && /* @__PURE__ */
|
|
2384
|
+
), ValueField && /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: __11("Value", "elementor") }, /* @__PURE__ */ React17.createElement(Typography6, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React17.createElement(
|
|
2420
2385
|
ValueField,
|
|
2421
2386
|
{
|
|
2422
2387
|
value,
|
|
@@ -2430,8 +2395,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2430
2395
|
propType,
|
|
2431
2396
|
onKeyDown: handleKeyDown
|
|
2432
2397
|
}
|
|
2433
|
-
))), errorMessage && /* @__PURE__ */
|
|
2434
|
-
|
|
2398
|
+
))), errorMessage && /* @__PURE__ */ React17.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React17.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React17.createElement(
|
|
2399
|
+
Button3,
|
|
2435
2400
|
{
|
|
2436
2401
|
id: "create-variable-button",
|
|
2437
2402
|
size: "small",
|
|
@@ -2439,89 +2404,89 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2439
2404
|
disabled: isSubmitDisabled,
|
|
2440
2405
|
onClick: handleCreateAndTrack
|
|
2441
2406
|
},
|
|
2442
|
-
|
|
2407
|
+
__11("Create", "elementor")
|
|
2443
2408
|
)));
|
|
2444
2409
|
};
|
|
2445
2410
|
|
|
2446
2411
|
// src/components/variable-edit.tsx
|
|
2447
|
-
import * as
|
|
2448
|
-
import { useEffect as useEffect5, useState as
|
|
2412
|
+
import * as React19 from "react";
|
|
2413
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
2449
2414
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
2450
2415
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
2451
2416
|
import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
|
|
2452
2417
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
2453
|
-
import { Button as
|
|
2454
|
-
import { __ as
|
|
2418
|
+
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Tooltip, Typography as Typography8 } from "@elementor/ui";
|
|
2419
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2455
2420
|
|
|
2456
2421
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2457
|
-
import * as
|
|
2458
|
-
import { useState as
|
|
2422
|
+
import * as React18 from "react";
|
|
2423
|
+
import { useState as useState9 } from "react";
|
|
2459
2424
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2460
2425
|
import {
|
|
2461
|
-
Button as
|
|
2462
|
-
Checkbox
|
|
2463
|
-
Dialog
|
|
2464
|
-
DialogActions
|
|
2465
|
-
DialogContent
|
|
2466
|
-
DialogContentText
|
|
2467
|
-
DialogTitle
|
|
2468
|
-
FormControlLabel
|
|
2469
|
-
Typography as
|
|
2426
|
+
Button as Button4,
|
|
2427
|
+
Checkbox,
|
|
2428
|
+
Dialog,
|
|
2429
|
+
DialogActions,
|
|
2430
|
+
DialogContent,
|
|
2431
|
+
DialogContentText,
|
|
2432
|
+
DialogTitle,
|
|
2433
|
+
FormControlLabel,
|
|
2434
|
+
Typography as Typography7
|
|
2470
2435
|
} from "@elementor/ui";
|
|
2471
|
-
import { __ as
|
|
2436
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
2472
2437
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2473
2438
|
var EditConfirmationDialog = ({
|
|
2474
2439
|
closeDialog,
|
|
2475
2440
|
onConfirm,
|
|
2476
2441
|
onSuppressMessage
|
|
2477
2442
|
}) => {
|
|
2478
|
-
const [dontShowAgain, setDontShowAgain] =
|
|
2443
|
+
const [dontShowAgain, setDontShowAgain] = useState9(false);
|
|
2479
2444
|
const handleSave = () => {
|
|
2480
2445
|
if (dontShowAgain) {
|
|
2481
2446
|
onSuppressMessage?.();
|
|
2482
2447
|
}
|
|
2483
2448
|
onConfirm?.();
|
|
2484
2449
|
};
|
|
2485
|
-
return /* @__PURE__ */
|
|
2450
|
+
return /* @__PURE__ */ React18.createElement(Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React18.createElement(DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React18.createElement(AlertTriangleFilledIcon3, { color: "secondary" }), __12("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React18.createElement(DialogContent, null, /* @__PURE__ */ React18.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __12(
|
|
2486
2451
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2487
2452
|
"elementor"
|
|
2488
|
-
))), /* @__PURE__ */
|
|
2489
|
-
|
|
2453
|
+
))), /* @__PURE__ */ React18.createElement(DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(
|
|
2454
|
+
FormControlLabel,
|
|
2490
2455
|
{
|
|
2491
|
-
control: /* @__PURE__ */
|
|
2492
|
-
|
|
2456
|
+
control: /* @__PURE__ */ React18.createElement(
|
|
2457
|
+
Checkbox,
|
|
2493
2458
|
{
|
|
2494
2459
|
checked: dontShowAgain,
|
|
2495
2460
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2496
2461
|
size: "small"
|
|
2497
2462
|
}
|
|
2498
2463
|
),
|
|
2499
|
-
label: /* @__PURE__ */
|
|
2464
|
+
label: /* @__PURE__ */ React18.createElement(Typography7, { variant: "body2" }, __12("Don't show me again", "elementor"))
|
|
2500
2465
|
}
|
|
2501
|
-
), /* @__PURE__ */
|
|
2466
|
+
), /* @__PURE__ */ React18.createElement("div", null, /* @__PURE__ */ React18.createElement(Button4, { color: "secondary", onClick: closeDialog }, __12("Keep editing", "elementor")), /* @__PURE__ */ React18.createElement(Button4, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __12("Save", "elementor")))));
|
|
2502
2467
|
};
|
|
2503
2468
|
|
|
2504
2469
|
// src/components/variable-edit.tsx
|
|
2505
2470
|
var SIZE3 = "tiny";
|
|
2506
|
-
var DELETE_LABEL =
|
|
2471
|
+
var DELETE_LABEL = __13("Delete variable", "elementor");
|
|
2507
2472
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2508
2473
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2509
2474
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2510
2475
|
const { propType } = useBoundProp5();
|
|
2511
2476
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2512
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
2513
|
-
const [editConfirmation, setEditConfirmation] =
|
|
2514
|
-
const [errorMessage, setErrorMessage] =
|
|
2515
|
-
const [valueFieldError, setValueFieldError] =
|
|
2477
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState10(false);
|
|
2478
|
+
const [editConfirmation, setEditConfirmation] = useState10(false);
|
|
2479
|
+
const [errorMessage, setErrorMessage] = useState10("");
|
|
2480
|
+
const [valueFieldError, setValueFieldError] = useState10("");
|
|
2516
2481
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2517
2482
|
const variable = useVariable(editId);
|
|
2518
|
-
const [propTypeKey, setPropTypeKey] =
|
|
2483
|
+
const [propTypeKey, setPropTypeKey] = useState10(variable?.type ?? propTypeUtil.key);
|
|
2519
2484
|
if (!variable) {
|
|
2520
2485
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2521
2486
|
}
|
|
2522
2487
|
const userPermissions = usePermissions();
|
|
2523
|
-
const [value, setValue] =
|
|
2524
|
-
const [label, setLabel] =
|
|
2488
|
+
const [value, setValue] = useState10(() => variable.value);
|
|
2489
|
+
const [label, setLabel] = useState10(() => variable.label);
|
|
2525
2490
|
useEffect5(() => {
|
|
2526
2491
|
styleVariablesRepository.update({
|
|
2527
2492
|
[editId]: {
|
|
@@ -2584,7 +2549,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2584
2549
|
const actions = [];
|
|
2585
2550
|
if (userPermissions.canDelete()) {
|
|
2586
2551
|
actions.push(
|
|
2587
|
-
/* @__PURE__ */
|
|
2552
|
+
/* @__PURE__ */ React19.createElement(Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React19.createElement(IconButton5, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React19.createElement(TrashIcon2, { fontSize: SIZE3 })))
|
|
2588
2553
|
);
|
|
2589
2554
|
}
|
|
2590
2555
|
const hasEmptyFields = () => {
|
|
@@ -2609,31 +2574,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2609
2574
|
handleUpdate();
|
|
2610
2575
|
}
|
|
2611
2576
|
};
|
|
2612
|
-
return /* @__PURE__ */
|
|
2577
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(SectionPopoverBody2, { height: "auto" }, /* @__PURE__ */ React19.createElement(
|
|
2613
2578
|
PopoverHeader2,
|
|
2614
2579
|
{
|
|
2615
|
-
title:
|
|
2580
|
+
title: __13("Edit variable", "elementor"),
|
|
2616
2581
|
onClose,
|
|
2617
|
-
icon: /* @__PURE__ */
|
|
2582
|
+
icon: /* @__PURE__ */ React19.createElement(React19.Fragment, null, onGoBack && /* @__PURE__ */ React19.createElement(
|
|
2618
2583
|
IconButton5,
|
|
2619
2584
|
{
|
|
2620
2585
|
size: SIZE3,
|
|
2621
|
-
"aria-label":
|
|
2586
|
+
"aria-label": __13("Go Back", "elementor"),
|
|
2622
2587
|
onClick: onGoBack
|
|
2623
2588
|
},
|
|
2624
|
-
/* @__PURE__ */
|
|
2625
|
-
), /* @__PURE__ */
|
|
2589
|
+
/* @__PURE__ */ React19.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
2590
|
+
), /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2626
2591
|
actions
|
|
2627
2592
|
}
|
|
2628
|
-
), /* @__PURE__ */
|
|
2593
|
+
), /* @__PURE__ */ React19.createElement(Divider3, null), /* @__PURE__ */ React19.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React19.createElement(
|
|
2629
2594
|
FormField,
|
|
2630
2595
|
{
|
|
2631
2596
|
id: "variable-label",
|
|
2632
|
-
label:
|
|
2597
|
+
label: __13("Name", "elementor"),
|
|
2633
2598
|
errorMsg: labelFieldError?.message,
|
|
2634
2599
|
noticeMsg: labelHint(label)
|
|
2635
2600
|
},
|
|
2636
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ React19.createElement(
|
|
2637
2602
|
LabelField,
|
|
2638
2603
|
{
|
|
2639
2604
|
id: "variable-label",
|
|
@@ -2652,7 +2617,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2652
2617
|
onKeyDown: handleKeyDown
|
|
2653
2618
|
}
|
|
2654
2619
|
)
|
|
2655
|
-
), ValueField && /* @__PURE__ */
|
|
2620
|
+
), ValueField && /* @__PURE__ */ React19.createElement(FormField, { errorMsg: valueFieldError, label: __13("Value", "elementor") }, /* @__PURE__ */ React19.createElement(Typography8, { variant: "h5" }, /* @__PURE__ */ React19.createElement(
|
|
2656
2621
|
ValueField,
|
|
2657
2622
|
{
|
|
2658
2623
|
propTypeKey: variable.type,
|
|
@@ -2667,7 +2632,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2667
2632
|
onValidationChange: setValueFieldError,
|
|
2668
2633
|
propType
|
|
2669
2634
|
}
|
|
2670
|
-
))), errorMessage && /* @__PURE__ */
|
|
2635
|
+
))), errorMessage && /* @__PURE__ */ React19.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React19.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React19.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __13("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2671
2636
|
DeleteConfirmationDialog,
|
|
2672
2637
|
{
|
|
2673
2638
|
open: true,
|
|
@@ -2675,7 +2640,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2675
2640
|
onConfirm: handleDelete,
|
|
2676
2641
|
closeDialog: closeDeleteDialog()
|
|
2677
2642
|
}
|
|
2678
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2643
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React19.createElement(
|
|
2679
2644
|
EditConfirmationDialog,
|
|
2680
2645
|
{
|
|
2681
2646
|
closeDialog: closeEditDialog(),
|
|
@@ -2686,8 +2651,8 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2686
2651
|
};
|
|
2687
2652
|
|
|
2688
2653
|
// src/components/variables-selection.tsx
|
|
2689
|
-
import { useState as
|
|
2690
|
-
import * as
|
|
2654
|
+
import { useState as useState11 } from "react";
|
|
2655
|
+
import * as React21 from "react";
|
|
2691
2656
|
import {
|
|
2692
2657
|
PopoverHeader as PopoverHeader3,
|
|
2693
2658
|
PopoverMenuList,
|
|
@@ -2697,19 +2662,19 @@ import {
|
|
|
2697
2662
|
import { PromotionAlert } from "@elementor/editor-ui";
|
|
2698
2663
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2699
2664
|
import { Divider as Divider4, IconButton as IconButton7, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
2700
|
-
import { __ as
|
|
2665
|
+
import { __ as __15, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
2701
2666
|
|
|
2702
2667
|
// src/components/ui/menu-item-content.tsx
|
|
2703
|
-
import * as
|
|
2668
|
+
import * as React20 from "react";
|
|
2704
2669
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2705
2670
|
import { EditIcon } from "@elementor/icons";
|
|
2706
|
-
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as
|
|
2707
|
-
import { __ as
|
|
2671
|
+
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography9 } from "@elementor/ui";
|
|
2672
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2708
2673
|
var SIZE4 = "tiny";
|
|
2709
|
-
var EDIT_LABEL =
|
|
2674
|
+
var EDIT_LABEL = __14("Edit variable", "elementor");
|
|
2710
2675
|
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2711
2676
|
const onEdit = item.onEdit;
|
|
2712
|
-
return /* @__PURE__ */
|
|
2677
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React20.createElement(
|
|
2713
2678
|
Box3,
|
|
2714
2679
|
{
|
|
2715
2680
|
sx: {
|
|
@@ -2720,29 +2685,29 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2720
2685
|
gap: 1
|
|
2721
2686
|
}
|
|
2722
2687
|
},
|
|
2723
|
-
/* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ React20.createElement(
|
|
2724
2689
|
EllipsisWithTooltip2,
|
|
2725
2690
|
{
|
|
2726
2691
|
title: item.label || item.value,
|
|
2727
|
-
as:
|
|
2692
|
+
as: Typography9,
|
|
2728
2693
|
variant: "caption",
|
|
2729
2694
|
color: disabled ? "text.disabled" : "text.primary",
|
|
2730
2695
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2731
2696
|
maxWidth: "50%"
|
|
2732
2697
|
}
|
|
2733
2698
|
),
|
|
2734
|
-
item.secondaryText && /* @__PURE__ */
|
|
2699
|
+
item.secondaryText && /* @__PURE__ */ React20.createElement(
|
|
2735
2700
|
EllipsisWithTooltip2,
|
|
2736
2701
|
{
|
|
2737
2702
|
title: item.secondaryText,
|
|
2738
|
-
as:
|
|
2703
|
+
as: Typography9,
|
|
2739
2704
|
variant: "caption",
|
|
2740
2705
|
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2741
2706
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2742
2707
|
maxWidth: "50%"
|
|
2743
2708
|
}
|
|
2744
2709
|
)
|
|
2745
|
-
), !!onEdit && !disabled && /* @__PURE__ */
|
|
2710
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React20.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2746
2711
|
IconButton6,
|
|
2747
2712
|
{
|
|
2748
2713
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2752,7 +2717,7 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2752
2717
|
},
|
|
2753
2718
|
"aria-label": EDIT_LABEL
|
|
2754
2719
|
},
|
|
2755
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ React20.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2756
2721
|
)));
|
|
2757
2722
|
};
|
|
2758
2723
|
|
|
@@ -2792,13 +2757,13 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme, disabled }) => ({
|
|
|
2792
2757
|
|
|
2793
2758
|
// src/components/variables-selection.tsx
|
|
2794
2759
|
var SIZE5 = "tiny";
|
|
2795
|
-
var CREATE_LABEL =
|
|
2796
|
-
var MANAGER_LABEL =
|
|
2760
|
+
var CREATE_LABEL = __15("Create variable", "elementor");
|
|
2761
|
+
var MANAGER_LABEL = __15("Variables Manager", "elementor");
|
|
2797
2762
|
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license-panel-${variableType}-variable`;
|
|
2798
2763
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2799
2764
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2800
2765
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2801
|
-
const [searchValue, setSearchValue] =
|
|
2766
|
+
const [searchValue, setSearchValue] = useState11("");
|
|
2802
2767
|
const {
|
|
2803
2768
|
list: variables,
|
|
2804
2769
|
hasMatches: hasSearchResults,
|
|
@@ -2825,7 +2790,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2825
2790
|
const actions = [];
|
|
2826
2791
|
if (onAdd) {
|
|
2827
2792
|
actions.push(
|
|
2828
|
-
/* @__PURE__ */
|
|
2793
|
+
/* @__PURE__ */ React21.createElement(Tooltip3, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React21.createElement("span", null, /* @__PURE__ */ React21.createElement(
|
|
2829
2794
|
IconButton7,
|
|
2830
2795
|
{
|
|
2831
2796
|
id: "add-variable-button",
|
|
@@ -2834,7 +2799,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2834
2799
|
"aria-label": CREATE_LABEL,
|
|
2835
2800
|
disabled
|
|
2836
2801
|
},
|
|
2837
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ React21.createElement(PlusIcon2, { fontSize: SIZE5 })
|
|
2838
2803
|
)))
|
|
2839
2804
|
);
|
|
2840
2805
|
}
|
|
@@ -2848,7 +2813,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2848
2813
|
});
|
|
2849
2814
|
};
|
|
2850
2815
|
actions.push(
|
|
2851
|
-
/* @__PURE__ */
|
|
2816
|
+
/* @__PURE__ */ React21.createElement(Tooltip3, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2852
2817
|
IconButton7,
|
|
2853
2818
|
{
|
|
2854
2819
|
id: "variables-manager-button",
|
|
@@ -2856,16 +2821,16 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2856
2821
|
onClick: handleOpenManager,
|
|
2857
2822
|
"aria-label": MANAGER_LABEL
|
|
2858
2823
|
},
|
|
2859
|
-
/* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ React21.createElement(SettingsIcon, { fontSize: SIZE5 })
|
|
2860
2825
|
))
|
|
2861
2826
|
);
|
|
2862
2827
|
}
|
|
2863
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2828
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2864
2829
|
const items = variables.map(({ value, label, key }) => ({
|
|
2865
2830
|
type: "item",
|
|
2866
2831
|
value: key,
|
|
2867
2832
|
label,
|
|
2868
|
-
icon: /* @__PURE__ */
|
|
2833
|
+
icon: /* @__PURE__ */ React21.createElement(StartIcon, { value }),
|
|
2869
2834
|
secondaryText: value,
|
|
2870
2835
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2871
2836
|
}));
|
|
@@ -2875,22 +2840,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2875
2840
|
const handleClearSearch = () => {
|
|
2876
2841
|
setSearchValue("");
|
|
2877
2842
|
};
|
|
2878
|
-
return /* @__PURE__ */
|
|
2843
|
+
return /* @__PURE__ */ React21.createElement(SectionPopoverBody3, null, /* @__PURE__ */ React21.createElement(
|
|
2879
2844
|
PopoverHeader3,
|
|
2880
2845
|
{
|
|
2881
|
-
title:
|
|
2882
|
-
icon: /* @__PURE__ */
|
|
2846
|
+
title: __15("Variables", "elementor"),
|
|
2847
|
+
icon: /* @__PURE__ */ React21.createElement(ColorFilterIcon2, { fontSize: SIZE5 }),
|
|
2883
2848
|
onClose: closePopover,
|
|
2884
2849
|
actions
|
|
2885
2850
|
}
|
|
2886
|
-
), hasVariables && /* @__PURE__ */
|
|
2851
|
+
), hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2887
2852
|
SearchField2,
|
|
2888
2853
|
{
|
|
2889
2854
|
value: searchValue,
|
|
2890
2855
|
onSearch: handleSearch,
|
|
2891
|
-
placeholder:
|
|
2856
|
+
placeholder: __15("Search", "elementor")
|
|
2892
2857
|
}
|
|
2893
|
-
), /* @__PURE__ */
|
|
2858
|
+
), /* @__PURE__ */ React21.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2894
2859
|
PopoverMenuList,
|
|
2895
2860
|
{
|
|
2896
2861
|
items,
|
|
@@ -2900,66 +2865,66 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2900
2865
|
},
|
|
2901
2866
|
selectedValue: variable,
|
|
2902
2867
|
"data-testid": `${variableType}-variables-list`,
|
|
2903
|
-
menuListTemplate: (props) => /* @__PURE__ */
|
|
2904
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2868
|
+
menuListTemplate: (props) => /* @__PURE__ */ React21.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2869
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React21.createElement(MenuItemContent, { item, disabled })
|
|
2905
2870
|
}
|
|
2906
|
-
), disabled && /* @__PURE__ */
|
|
2871
|
+
), disabled && /* @__PURE__ */ React21.createElement(
|
|
2907
2872
|
PromotionAlert,
|
|
2908
2873
|
{
|
|
2909
2874
|
message: sprintf3(
|
|
2910
2875
|
/* translators: %s: Variable Type. */
|
|
2911
|
-
|
|
2876
|
+
__15("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2912
2877
|
variableType
|
|
2913
2878
|
),
|
|
2914
2879
|
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2915
2880
|
}
|
|
2916
|
-
)), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2881
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2917
2882
|
NoSearchResults,
|
|
2918
2883
|
{
|
|
2919
2884
|
searchValue,
|
|
2920
2885
|
onClear: handleClearSearch,
|
|
2921
|
-
icon: /* @__PURE__ */
|
|
2886
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2922
2887
|
}
|
|
2923
|
-
), disabled && !hasVariables && /* @__PURE__ */
|
|
2888
|
+
), disabled && !hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2924
2889
|
EmptyState,
|
|
2925
2890
|
{
|
|
2926
2891
|
title: sprintf3(
|
|
2927
2892
|
/* translators: %s: Variable Type. */
|
|
2928
|
-
|
|
2893
|
+
__15("No %s variables yet", "elementor"),
|
|
2929
2894
|
variableType
|
|
2930
2895
|
),
|
|
2931
2896
|
message: sprintf3(
|
|
2932
2897
|
/* translators: %s: Variable Type. */
|
|
2933
|
-
|
|
2898
|
+
__15("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2934
2899
|
variableType
|
|
2935
2900
|
),
|
|
2936
|
-
icon: /* @__PURE__ */
|
|
2901
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2937
2902
|
},
|
|
2938
2903
|
emptyState
|
|
2939
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2904
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2940
2905
|
EmptyState,
|
|
2941
2906
|
{
|
|
2942
2907
|
title: sprintf3(
|
|
2943
2908
|
/* translators: %s: Variable Type. */
|
|
2944
|
-
|
|
2909
|
+
__15("Create your first %s variable", "elementor"),
|
|
2945
2910
|
variableType
|
|
2946
2911
|
),
|
|
2947
|
-
message:
|
|
2912
|
+
message: __15(
|
|
2948
2913
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2949
2914
|
"elementor"
|
|
2950
2915
|
),
|
|
2951
|
-
icon: /* @__PURE__ */
|
|
2916
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2952
2917
|
onAdd
|
|
2953
2918
|
}
|
|
2954
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2919
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2955
2920
|
EmptyState,
|
|
2956
2921
|
{
|
|
2957
|
-
title:
|
|
2958
|
-
message:
|
|
2922
|
+
title: __15("No compatible variables", "elementor"),
|
|
2923
|
+
message: __15(
|
|
2959
2924
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2960
2925
|
"elementor"
|
|
2961
2926
|
),
|
|
2962
|
-
icon: /* @__PURE__ */
|
|
2927
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2963
2928
|
onAdd
|
|
2964
2929
|
}
|
|
2965
2930
|
));
|
|
@@ -2970,13 +2935,13 @@ var VIEW_LIST = "list";
|
|
|
2970
2935
|
var VIEW_ADD = "add";
|
|
2971
2936
|
var VIEW_EDIT = "edit";
|
|
2972
2937
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2973
|
-
const [currentView, setCurrentView] =
|
|
2974
|
-
const [editId, setEditId] =
|
|
2938
|
+
const [currentView, setCurrentView] = useState12(VIEW_LIST);
|
|
2939
|
+
const [editId, setEditId] = useState12("");
|
|
2975
2940
|
const { open } = usePanelActions();
|
|
2976
2941
|
const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
|
|
2977
2942
|
open();
|
|
2978
2943
|
} : void 0;
|
|
2979
|
-
return /* @__PURE__ */
|
|
2944
|
+
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2980
2945
|
propTypeKey,
|
|
2981
2946
|
currentView,
|
|
2982
2947
|
selectedVariable,
|
|
@@ -3023,7 +2988,7 @@ function RenderView(props) {
|
|
|
3023
2988
|
}
|
|
3024
2989
|
};
|
|
3025
2990
|
if (VIEW_LIST === props.currentView) {
|
|
3026
|
-
return /* @__PURE__ */
|
|
2991
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3027
2992
|
VariablesSelection,
|
|
3028
2993
|
{
|
|
3029
2994
|
closePopover: handlers.onClose,
|
|
@@ -3035,10 +3000,10 @@ function RenderView(props) {
|
|
|
3035
3000
|
);
|
|
3036
3001
|
}
|
|
3037
3002
|
if (VIEW_ADD === props.currentView) {
|
|
3038
|
-
return /* @__PURE__ */
|
|
3003
|
+
return /* @__PURE__ */ React22.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
3039
3004
|
}
|
|
3040
3005
|
if (VIEW_EDIT === props.currentView) {
|
|
3041
|
-
return /* @__PURE__ */
|
|
3006
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3042
3007
|
VariableEdit,
|
|
3043
3008
|
{
|
|
3044
3009
|
editId: props.editId,
|
|
@@ -3052,26 +3017,26 @@ function RenderView(props) {
|
|
|
3052
3017
|
}
|
|
3053
3018
|
|
|
3054
3019
|
// src/components/ui/tags/assigned-tag.tsx
|
|
3055
|
-
import * as
|
|
3020
|
+
import * as React23 from "react";
|
|
3056
3021
|
import { DetachIcon } from "@elementor/icons";
|
|
3057
|
-
import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as
|
|
3058
|
-
import { __ as
|
|
3022
|
+
import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography10, UnstableTag as Tag } from "@elementor/ui";
|
|
3023
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
3059
3024
|
var SIZE6 = "tiny";
|
|
3060
|
-
var UNLINK_LABEL =
|
|
3025
|
+
var UNLINK_LABEL = __16("Unlink variable", "elementor");
|
|
3061
3026
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
3062
3027
|
const actions = [];
|
|
3063
3028
|
if (onUnlink) {
|
|
3064
3029
|
actions.push(
|
|
3065
|
-
/* @__PURE__ */
|
|
3030
|
+
/* @__PURE__ */ React23.createElement(Tooltip4, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React23.createElement(IconButton8, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React23.createElement(DetachIcon, { fontSize: SIZE6 })))
|
|
3066
3031
|
);
|
|
3067
3032
|
}
|
|
3068
|
-
return /* @__PURE__ */
|
|
3033
|
+
return /* @__PURE__ */ React23.createElement(Tooltip4, { title: label, placement: "top" }, /* @__PURE__ */ React23.createElement(
|
|
3069
3034
|
Tag,
|
|
3070
3035
|
{
|
|
3071
3036
|
fullWidth: true,
|
|
3072
3037
|
showActionsOnHover: true,
|
|
3073
|
-
startIcon: /* @__PURE__ */
|
|
3074
|
-
label: /* @__PURE__ */
|
|
3038
|
+
startIcon: /* @__PURE__ */ React23.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
3039
|
+
label: /* @__PURE__ */ React23.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React23.createElement(Typography10, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
3075
3040
|
actions,
|
|
3076
3041
|
...props
|
|
3077
3042
|
}
|
|
@@ -3090,15 +3055,15 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3090
3055
|
});
|
|
3091
3056
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
3092
3057
|
const StartIcon = startIcon || (() => null);
|
|
3093
|
-
return /* @__PURE__ */
|
|
3058
|
+
return /* @__PURE__ */ React24.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React24.createElement(
|
|
3094
3059
|
AssignedTag,
|
|
3095
3060
|
{
|
|
3096
3061
|
label: variable.label,
|
|
3097
|
-
startIcon: /* @__PURE__ */
|
|
3062
|
+
startIcon: /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(ColorFilterIcon3, { fontSize: SIZE6 }), /* @__PURE__ */ React24.createElement(StartIcon, { value: variable.value })),
|
|
3098
3063
|
onUnlink: unlinkVariable,
|
|
3099
3064
|
...bindTrigger3(popupState)
|
|
3100
3065
|
}
|
|
3101
|
-
), /* @__PURE__ */
|
|
3066
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3102
3067
|
Popover,
|
|
3103
3068
|
{
|
|
3104
3069
|
disableScrollLock: true,
|
|
@@ -3110,7 +3075,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3110
3075
|
},
|
|
3111
3076
|
...bindPopover(popupState)
|
|
3112
3077
|
},
|
|
3113
|
-
/* @__PURE__ */
|
|
3078
|
+
/* @__PURE__ */ React24.createElement(
|
|
3114
3079
|
VariableSelectionPopover,
|
|
3115
3080
|
{
|
|
3116
3081
|
selectedVariable: variable,
|
|
@@ -3122,19 +3087,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3122
3087
|
};
|
|
3123
3088
|
|
|
3124
3089
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3125
|
-
import * as
|
|
3126
|
-
import { useId as useId2, useRef as useRef9, useState as
|
|
3090
|
+
import * as React28 from "react";
|
|
3091
|
+
import { useId as useId2, useRef as useRef9, useState as useState14 } from "react";
|
|
3127
3092
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
3128
3093
|
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
3129
|
-
import { __ as
|
|
3094
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
3130
3095
|
|
|
3131
3096
|
// src/components/variable-restore.tsx
|
|
3132
|
-
import * as
|
|
3133
|
-
import { useState as
|
|
3097
|
+
import * as React25 from "react";
|
|
3098
|
+
import { useState as useState13 } from "react";
|
|
3134
3099
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
3135
3100
|
import { PopoverHeader as PopoverHeader4, SectionPopoverBody as SectionPopoverBody4 } from "@elementor/editor-ui";
|
|
3136
|
-
import { Button as
|
|
3137
|
-
import { __ as
|
|
3101
|
+
import { Button as Button6, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
|
|
3102
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
3138
3103
|
var SIZE7 = "tiny";
|
|
3139
3104
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
3140
3105
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -3144,11 +3109,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3144
3109
|
if (!variable) {
|
|
3145
3110
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3146
3111
|
}
|
|
3147
|
-
const [errorMessage, setErrorMessage] =
|
|
3148
|
-
const [valueFieldError, setValueFieldError] =
|
|
3149
|
-
const [label, setLabel] =
|
|
3150
|
-
const [value, setValue] =
|
|
3151
|
-
const [propTypeKey, setPropTypeKey] =
|
|
3112
|
+
const [errorMessage, setErrorMessage] = useState13("");
|
|
3113
|
+
const [valueFieldError, setValueFieldError] = useState13("");
|
|
3114
|
+
const [label, setLabel] = useState13(variable.label);
|
|
3115
|
+
const [value, setValue] = useState13(variable.value);
|
|
3116
|
+
const [propTypeKey, setPropTypeKey] = useState13(variable?.type ?? propTypeUtil.key);
|
|
3152
3117
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3153
3118
|
value: variable.label,
|
|
3154
3119
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3194,22 +3159,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3194
3159
|
handleRestore();
|
|
3195
3160
|
}
|
|
3196
3161
|
};
|
|
3197
|
-
return /* @__PURE__ */
|
|
3162
|
+
return /* @__PURE__ */ React25.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React25.createElement(SectionPopoverBody4, { height: "auto" }, /* @__PURE__ */ React25.createElement(
|
|
3198
3163
|
PopoverHeader4,
|
|
3199
3164
|
{
|
|
3200
|
-
icon: /* @__PURE__ */
|
|
3201
|
-
title:
|
|
3165
|
+
icon: /* @__PURE__ */ React25.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3166
|
+
title: __17("Restore variable", "elementor"),
|
|
3202
3167
|
onClose
|
|
3203
3168
|
}
|
|
3204
|
-
), /* @__PURE__ */
|
|
3169
|
+
), /* @__PURE__ */ React25.createElement(Divider5, null), /* @__PURE__ */ React25.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React25.createElement(
|
|
3205
3170
|
FormField,
|
|
3206
3171
|
{
|
|
3207
3172
|
id: "variable-label",
|
|
3208
|
-
label:
|
|
3173
|
+
label: __17("Name", "elementor"),
|
|
3209
3174
|
errorMsg: labelFieldError?.message,
|
|
3210
3175
|
noticeMsg: labelHint(label)
|
|
3211
3176
|
},
|
|
3212
|
-
/* @__PURE__ */
|
|
3177
|
+
/* @__PURE__ */ React25.createElement(
|
|
3213
3178
|
LabelField,
|
|
3214
3179
|
{
|
|
3215
3180
|
id: "variable-label",
|
|
@@ -3228,7 +3193,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3228
3193
|
onKeyDown: handleKeyDown
|
|
3229
3194
|
}
|
|
3230
3195
|
)
|
|
3231
|
-
), ValueField && /* @__PURE__ */
|
|
3196
|
+
), ValueField && /* @__PURE__ */ React25.createElement(FormField, { errorMsg: valueFieldError, label: __17("Value", "elementor") }, /* @__PURE__ */ React25.createElement(Typography11, { variant: "h5" }, /* @__PURE__ */ React25.createElement(
|
|
3232
3197
|
ValueField,
|
|
3233
3198
|
{
|
|
3234
3199
|
propTypeKey,
|
|
@@ -3243,25 +3208,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3243
3208
|
propType,
|
|
3244
3209
|
onKeyDown: handleKeyDown
|
|
3245
3210
|
}
|
|
3246
|
-
))), errorMessage && /* @__PURE__ */
|
|
3211
|
+
))), errorMessage && /* @__PURE__ */ React25.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React25.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React25.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __17("Restore", "elementor")))));
|
|
3247
3212
|
};
|
|
3248
3213
|
|
|
3249
3214
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3250
|
-
import * as
|
|
3251
|
-
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as
|
|
3252
|
-
import { __ as
|
|
3215
|
+
import * as React26 from "react";
|
|
3216
|
+
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as Typography12 } from "@elementor/ui";
|
|
3217
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
3253
3218
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3254
|
-
return /* @__PURE__ */
|
|
3219
|
+
return /* @__PURE__ */ React26.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React26.createElement(
|
|
3255
3220
|
Alert2,
|
|
3256
3221
|
{
|
|
3257
3222
|
variant: "standard",
|
|
3258
3223
|
severity: "warning",
|
|
3259
3224
|
onClose,
|
|
3260
|
-
action: /* @__PURE__ */
|
|
3225
|
+
action: /* @__PURE__ */ React26.createElement(React26.Fragment, null, onUnlink && /* @__PURE__ */ React26.createElement(AlertAction2, { variant: "contained", onClick: onUnlink }, __18("Unlink", "elementor")), onRestore && /* @__PURE__ */ React26.createElement(AlertAction2, { variant: "outlined", onClick: onRestore }, __18("Restore", "elementor"))),
|
|
3261
3226
|
sx: { maxWidth: 300 }
|
|
3262
3227
|
},
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ React26.createElement(AlertTitle2, null, __18("Deleted variable", "elementor")),
|
|
3229
|
+
/* @__PURE__ */ React26.createElement(Typography12, { variant: "body2", color: "textPrimary" }, __18("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React26.createElement(Typography12, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", __18(
|
|
3265
3230
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3266
3231
|
"elementor"
|
|
3267
3232
|
))
|
|
@@ -3269,13 +3234,13 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3269
3234
|
};
|
|
3270
3235
|
|
|
3271
3236
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3272
|
-
import * as
|
|
3237
|
+
import * as React27 from "react";
|
|
3273
3238
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon4 } from "@elementor/icons";
|
|
3274
|
-
import { Box as Box6, Chip, Tooltip as Tooltip5, Typography as
|
|
3275
|
-
var WarningVariableTag =
|
|
3239
|
+
import { Box as Box6, Chip, Tooltip as Tooltip5, Typography as Typography13 } from "@elementor/ui";
|
|
3240
|
+
var WarningVariableTag = React27.forwardRef(
|
|
3276
3241
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3277
3242
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3278
|
-
return /* @__PURE__ */
|
|
3243
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3279
3244
|
Chip,
|
|
3280
3245
|
{
|
|
3281
3246
|
ref,
|
|
@@ -3284,8 +3249,8 @@ var WarningVariableTag = React28.forwardRef(
|
|
|
3284
3249
|
shape: "rounded",
|
|
3285
3250
|
variant: "standard",
|
|
3286
3251
|
onClick,
|
|
3287
|
-
icon: /* @__PURE__ */
|
|
3288
|
-
label: /* @__PURE__ */
|
|
3252
|
+
icon: /* @__PURE__ */ React27.createElement(AlertTriangleFilledIcon4, null),
|
|
3253
|
+
label: /* @__PURE__ */ React27.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React27.createElement(Box6, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React27.createElement(Typography13, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3289
3254
|
sx: {
|
|
3290
3255
|
height: (theme) => theme.spacing(3.5),
|
|
3291
3256
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3304,7 +3269,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3304
3269
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3305
3270
|
const boundProp = useBoundProp8();
|
|
3306
3271
|
const userPermissions = usePermissions();
|
|
3307
|
-
const [showInfotip, setShowInfotip] =
|
|
3272
|
+
const [showInfotip, setShowInfotip] = useState14(false);
|
|
3308
3273
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3309
3274
|
const closeInfotip = () => setShowInfotip(false);
|
|
3310
3275
|
const deletedChipAnchorRef = useRef9(null);
|
|
@@ -3335,7 +3300,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3335
3300
|
const handleRestoreWithOverrides = () => {
|
|
3336
3301
|
popupState.close();
|
|
3337
3302
|
};
|
|
3338
|
-
return /* @__PURE__ */
|
|
3303
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Box7, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React28.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
|
|
3339
3304
|
Infotip2,
|
|
3340
3305
|
{
|
|
3341
3306
|
color: "warning",
|
|
@@ -3343,7 +3308,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3343
3308
|
open: showInfotip,
|
|
3344
3309
|
disableHoverListener: true,
|
|
3345
3310
|
onClose: closeInfotip,
|
|
3346
|
-
content: /* @__PURE__ */
|
|
3311
|
+
content: /* @__PURE__ */ React28.createElement(
|
|
3347
3312
|
DeletedVariableAlert,
|
|
3348
3313
|
{
|
|
3349
3314
|
onClose: closeInfotip,
|
|
@@ -3363,15 +3328,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3363
3328
|
}
|
|
3364
3329
|
}
|
|
3365
3330
|
},
|
|
3366
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ React28.createElement(
|
|
3367
3332
|
WarningVariableTag,
|
|
3368
3333
|
{
|
|
3369
3334
|
label: variable.label,
|
|
3370
3335
|
onClick: toggleInfotip,
|
|
3371
|
-
suffix:
|
|
3336
|
+
suffix: __19("deleted", "elementor")
|
|
3372
3337
|
}
|
|
3373
3338
|
)
|
|
3374
|
-
), /* @__PURE__ */
|
|
3339
|
+
), /* @__PURE__ */ React28.createElement(
|
|
3375
3340
|
Popover2,
|
|
3376
3341
|
{
|
|
3377
3342
|
disableScrollLock: true,
|
|
@@ -3382,7 +3347,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3382
3347
|
},
|
|
3383
3348
|
...bindPopover2(popupState)
|
|
3384
3349
|
},
|
|
3385
|
-
/* @__PURE__ */
|
|
3350
|
+
/* @__PURE__ */ React28.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React28.createElement(
|
|
3386
3351
|
VariableRestore,
|
|
3387
3352
|
{
|
|
3388
3353
|
variableId: variable.key ?? "",
|
|
@@ -3394,39 +3359,39 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3394
3359
|
};
|
|
3395
3360
|
|
|
3396
3361
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3397
|
-
import * as
|
|
3398
|
-
import { useId as useId3, useRef as useRef10, useState as
|
|
3362
|
+
import * as React30 from "react";
|
|
3363
|
+
import { useId as useId3, useRef as useRef10, useState as useState15 } from "react";
|
|
3399
3364
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
3400
3365
|
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box8, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
3401
|
-
import { __ as
|
|
3366
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3402
3367
|
|
|
3403
3368
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3404
|
-
import * as
|
|
3405
|
-
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as
|
|
3406
|
-
import { __ as
|
|
3369
|
+
import * as React29 from "react";
|
|
3370
|
+
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as Typography14 } from "@elementor/ui";
|
|
3371
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
3407
3372
|
var i18n = {
|
|
3408
|
-
title:
|
|
3409
|
-
message:
|
|
3373
|
+
title: __20("Variable has changed", "elementor"),
|
|
3374
|
+
message: __20(
|
|
3410
3375
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3411
3376
|
"elementor"
|
|
3412
3377
|
),
|
|
3413
3378
|
buttons: {
|
|
3414
|
-
clear:
|
|
3415
|
-
select:
|
|
3379
|
+
clear: __20("Clear", "elementor"),
|
|
3380
|
+
select: __20("Select variable", "elementor")
|
|
3416
3381
|
}
|
|
3417
3382
|
};
|
|
3418
3383
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3419
|
-
return /* @__PURE__ */
|
|
3384
|
+
return /* @__PURE__ */ React29.createElement(ClickAwayListener3, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
3420
3385
|
Alert3,
|
|
3421
3386
|
{
|
|
3422
3387
|
variant: "standard",
|
|
3423
3388
|
severity: "warning",
|
|
3424
3389
|
onClose,
|
|
3425
|
-
action: /* @__PURE__ */
|
|
3390
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3426
3391
|
sx: { maxWidth: 300 }
|
|
3427
3392
|
},
|
|
3428
|
-
/* @__PURE__ */
|
|
3429
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ React29.createElement(AlertTitle3, null, i18n.title),
|
|
3394
|
+
/* @__PURE__ */ React29.createElement(Typography14, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3430
3395
|
));
|
|
3431
3396
|
};
|
|
3432
3397
|
|
|
@@ -3439,7 +3404,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3439
3404
|
variant: "popover",
|
|
3440
3405
|
popupId: `elementor-variables-list-${popupId}`
|
|
3441
3406
|
});
|
|
3442
|
-
const [infotipVisible, setInfotipVisible] =
|
|
3407
|
+
const [infotipVisible, setInfotipVisible] = useState15(false);
|
|
3443
3408
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3444
3409
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3445
3410
|
const triggerSelect = () => {
|
|
@@ -3452,7 +3417,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3452
3417
|
setValue(null);
|
|
3453
3418
|
};
|
|
3454
3419
|
const showClearButton = !!value;
|
|
3455
|
-
return /* @__PURE__ */
|
|
3420
|
+
return /* @__PURE__ */ React30.createElement(Box8, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React30.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React30.createElement(
|
|
3456
3421
|
Infotip3,
|
|
3457
3422
|
{
|
|
3458
3423
|
color: "warning",
|
|
@@ -3460,7 +3425,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3460
3425
|
open: infotipVisible,
|
|
3461
3426
|
disableHoverListener: true,
|
|
3462
3427
|
onClose: closeInfotip,
|
|
3463
|
-
content: /* @__PURE__ */
|
|
3428
|
+
content: /* @__PURE__ */ React30.createElement(
|
|
3464
3429
|
MismatchVariableAlert,
|
|
3465
3430
|
{
|
|
3466
3431
|
onClose: closeInfotip,
|
|
@@ -3479,15 +3444,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3479
3444
|
}
|
|
3480
3445
|
}
|
|
3481
3446
|
},
|
|
3482
|
-
/* @__PURE__ */
|
|
3447
|
+
/* @__PURE__ */ React30.createElement(
|
|
3483
3448
|
WarningVariableTag,
|
|
3484
3449
|
{
|
|
3485
3450
|
label: variable.label,
|
|
3486
3451
|
onClick: toggleInfotip,
|
|
3487
|
-
suffix:
|
|
3452
|
+
suffix: __21("changed", "elementor")
|
|
3488
3453
|
}
|
|
3489
3454
|
)
|
|
3490
|
-
), /* @__PURE__ */
|
|
3455
|
+
), /* @__PURE__ */ React30.createElement(
|
|
3491
3456
|
Popover3,
|
|
3492
3457
|
{
|
|
3493
3458
|
disableScrollLock: true,
|
|
@@ -3499,7 +3464,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3499
3464
|
},
|
|
3500
3465
|
...bindPopover3(popupState)
|
|
3501
3466
|
},
|
|
3502
|
-
/* @__PURE__ */
|
|
3467
|
+
/* @__PURE__ */ React30.createElement(
|
|
3503
3468
|
VariableSelectionPopover,
|
|
3504
3469
|
{
|
|
3505
3470
|
selectedVariable: variable,
|
|
@@ -3511,28 +3476,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3511
3476
|
};
|
|
3512
3477
|
|
|
3513
3478
|
// src/components/ui/variable/missing-variable.tsx
|
|
3514
|
-
import * as
|
|
3515
|
-
import { useState as
|
|
3479
|
+
import * as React32 from "react";
|
|
3480
|
+
import { useState as useState16 } from "react";
|
|
3516
3481
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
3517
3482
|
import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
|
|
3518
|
-
import { __ as
|
|
3483
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3519
3484
|
|
|
3520
3485
|
// src/components/ui/missing-variable-alert.tsx
|
|
3521
|
-
import * as
|
|
3522
|
-
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as
|
|
3523
|
-
import { __ as
|
|
3486
|
+
import * as React31 from "react";
|
|
3487
|
+
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as Typography15 } from "@elementor/ui";
|
|
3488
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
3524
3489
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3525
|
-
return /* @__PURE__ */
|
|
3490
|
+
return /* @__PURE__ */ React31.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React31.createElement(
|
|
3526
3491
|
Alert4,
|
|
3527
3492
|
{
|
|
3528
3493
|
variant: "standard",
|
|
3529
3494
|
severity: "warning",
|
|
3530
3495
|
onClose,
|
|
3531
|
-
action: /* @__PURE__ */
|
|
3496
|
+
action: /* @__PURE__ */ React31.createElement(React31.Fragment, null, onClear && /* @__PURE__ */ React31.createElement(AlertAction4, { variant: "contained", onClick: onClear }, __22("Clear", "elementor"))),
|
|
3532
3497
|
sx: { maxWidth: 300 }
|
|
3533
3498
|
},
|
|
3534
|
-
/* @__PURE__ */
|
|
3535
|
-
/* @__PURE__ */
|
|
3499
|
+
/* @__PURE__ */ React31.createElement(AlertTitle4, null, __22("This variable is missing", "elementor")),
|
|
3500
|
+
/* @__PURE__ */ React31.createElement(Typography15, { variant: "body2", color: "textPrimary" }, __22(
|
|
3536
3501
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3537
3502
|
"elementor"
|
|
3538
3503
|
))
|
|
@@ -3542,11 +3507,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3542
3507
|
// src/components/ui/variable/missing-variable.tsx
|
|
3543
3508
|
var MissingVariable = () => {
|
|
3544
3509
|
const { setValue } = useBoundProp10();
|
|
3545
|
-
const [infotipVisible, setInfotipVisible] =
|
|
3510
|
+
const [infotipVisible, setInfotipVisible] = useState16(false);
|
|
3546
3511
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3547
3512
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3548
3513
|
const clearValue = () => setValue(null);
|
|
3549
|
-
return /* @__PURE__ */
|
|
3514
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, infotipVisible && /* @__PURE__ */ React32.createElement(Backdrop3, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React32.createElement(
|
|
3550
3515
|
Infotip4,
|
|
3551
3516
|
{
|
|
3552
3517
|
color: "warning",
|
|
@@ -3554,7 +3519,7 @@ var MissingVariable = () => {
|
|
|
3554
3519
|
open: infotipVisible,
|
|
3555
3520
|
disableHoverListener: true,
|
|
3556
3521
|
onClose: closeInfotip,
|
|
3557
|
-
content: /* @__PURE__ */
|
|
3522
|
+
content: /* @__PURE__ */ React32.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3558
3523
|
slotProps: {
|
|
3559
3524
|
popper: {
|
|
3560
3525
|
modifiers: [
|
|
@@ -3566,7 +3531,7 @@ var MissingVariable = () => {
|
|
|
3566
3531
|
}
|
|
3567
3532
|
}
|
|
3568
3533
|
},
|
|
3569
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ React32.createElement(WarningVariableTag, { label: __23("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3570
3535
|
));
|
|
3571
3536
|
};
|
|
3572
3537
|
|
|
@@ -3576,37 +3541,37 @@ var VariableControl = () => {
|
|
|
3576
3541
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3577
3542
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3578
3543
|
if (!assignedVariable) {
|
|
3579
|
-
return /* @__PURE__ */
|
|
3544
|
+
return /* @__PURE__ */ React33.createElement(MissingVariable, null);
|
|
3580
3545
|
}
|
|
3581
3546
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3582
3547
|
if (assignedVariable?.deleted) {
|
|
3583
|
-
return /* @__PURE__ */
|
|
3548
|
+
return /* @__PURE__ */ React33.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3584
3549
|
}
|
|
3585
3550
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3586
3551
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3587
|
-
return /* @__PURE__ */
|
|
3552
|
+
return /* @__PURE__ */ React33.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3588
3553
|
}
|
|
3589
|
-
return /* @__PURE__ */
|
|
3554
|
+
return /* @__PURE__ */ React33.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3590
3555
|
};
|
|
3591
3556
|
|
|
3592
3557
|
// src/hooks/use-prop-variable-action.tsx
|
|
3593
|
-
import * as
|
|
3558
|
+
import * as React34 from "react";
|
|
3594
3559
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-controls";
|
|
3595
3560
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
3596
|
-
import { __ as
|
|
3561
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3597
3562
|
var usePropVariableAction = () => {
|
|
3598
3563
|
const { propType, path } = useBoundProp12();
|
|
3599
3564
|
const variable = resolveVariableFromPropType(propType);
|
|
3600
3565
|
return {
|
|
3601
3566
|
visible: Boolean(variable),
|
|
3602
3567
|
icon: ColorFilterIcon4,
|
|
3603
|
-
title:
|
|
3568
|
+
title: __24("Variables", "elementor"),
|
|
3604
3569
|
content: ({ close: closePopover }) => {
|
|
3605
3570
|
if (!variable) {
|
|
3606
3571
|
return null;
|
|
3607
3572
|
}
|
|
3608
3573
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3609
|
-
return /* @__PURE__ */
|
|
3574
|
+
return /* @__PURE__ */ React34.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3610
3575
|
}
|
|
3611
3576
|
};
|
|
3612
3577
|
};
|
|
@@ -3753,20 +3718,20 @@ function initMcp() {
|
|
|
3753
3718
|
}
|
|
3754
3719
|
|
|
3755
3720
|
// src/register-variable-types.tsx
|
|
3756
|
-
import * as
|
|
3721
|
+
import * as React37 from "react";
|
|
3757
3722
|
import { colorPropTypeUtil, sizePropTypeUtil, stringPropTypeUtil } from "@elementor/editor-props";
|
|
3758
3723
|
import { CtaButton } from "@elementor/editor-ui";
|
|
3759
3724
|
import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
|
|
3760
|
-
import { BrushIcon
|
|
3761
|
-
import { __ as
|
|
3725
|
+
import { BrushIcon, ExpandDiagonalIcon, ResetIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
3726
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
3762
3727
|
|
|
3763
3728
|
// src/components/fields/color-field.tsx
|
|
3764
|
-
import * as
|
|
3765
|
-
import { useRef as useRef11, useState as
|
|
3729
|
+
import * as React35 from "react";
|
|
3730
|
+
import { useRef as useRef11, useState as useState17 } from "react";
|
|
3766
3731
|
import { UnstableColorField } from "@elementor/ui";
|
|
3767
3732
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3768
|
-
const [color, setColor] =
|
|
3769
|
-
const [errorMessage, setErrorMessage] =
|
|
3733
|
+
const [color, setColor] = useState17(value);
|
|
3734
|
+
const [errorMessage, setErrorMessage] = useState17("");
|
|
3770
3735
|
const defaultRef = useRef11(null);
|
|
3771
3736
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3772
3737
|
const handleChange = (newValue) => {
|
|
@@ -3776,7 +3741,7 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3776
3741
|
onValidationChange?.(errorMsg);
|
|
3777
3742
|
onChange(errorMsg ? "" : newValue);
|
|
3778
3743
|
};
|
|
3779
|
-
return /* @__PURE__ */
|
|
3744
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3780
3745
|
UnstableColorField,
|
|
3781
3746
|
{
|
|
3782
3747
|
id: "color-variable-field",
|
|
@@ -3805,21 +3770,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3805
3770
|
};
|
|
3806
3771
|
|
|
3807
3772
|
// src/components/fields/font-field.tsx
|
|
3808
|
-
import * as
|
|
3809
|
-
import { useId as useId4, useRef as useRef12, useState as
|
|
3773
|
+
import * as React36 from "react";
|
|
3774
|
+
import { useId as useId4, useRef as useRef12, useState as useState18 } from "react";
|
|
3810
3775
|
import { enqueueFont as enqueueFont2, ItemSelector, useFontFamilies } from "@elementor/editor-controls";
|
|
3811
3776
|
import { useSectionWidth } from "@elementor/editor-ui";
|
|
3812
3777
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
3813
3778
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
3814
|
-
import { __ as
|
|
3779
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3815
3780
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3816
|
-
const [fontFamily, setFontFamily] =
|
|
3781
|
+
const [fontFamily, setFontFamily] = useState18(value);
|
|
3817
3782
|
const defaultRef = useRef12(null);
|
|
3818
3783
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3819
3784
|
const fontPopoverState = usePopupState6({ variant: "popover" });
|
|
3820
3785
|
const fontFamilies = useFontFamilies();
|
|
3821
3786
|
const sectionWidth = useSectionWidth();
|
|
3822
|
-
const mapFontSubs =
|
|
3787
|
+
const mapFontSubs = React36.useMemo(() => {
|
|
3823
3788
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3824
3789
|
label,
|
|
3825
3790
|
items: fonts
|
|
@@ -3836,17 +3801,17 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3836
3801
|
fontPopoverState.close();
|
|
3837
3802
|
};
|
|
3838
3803
|
const id2 = useId4();
|
|
3839
|
-
return /* @__PURE__ */
|
|
3804
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3840
3805
|
UnstableTag,
|
|
3841
3806
|
{
|
|
3842
3807
|
id: id2,
|
|
3843
3808
|
variant: "outlined",
|
|
3844
3809
|
label: fontFamily,
|
|
3845
|
-
endIcon: /* @__PURE__ */
|
|
3810
|
+
endIcon: /* @__PURE__ */ React36.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
3846
3811
|
...bindTrigger4(fontPopoverState),
|
|
3847
3812
|
fullWidth: true
|
|
3848
3813
|
}
|
|
3849
|
-
), /* @__PURE__ */
|
|
3814
|
+
), /* @__PURE__ */ React36.createElement(
|
|
3850
3815
|
Popover4,
|
|
3851
3816
|
{
|
|
3852
3817
|
disablePortal: true,
|
|
@@ -3856,7 +3821,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3856
3821
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3857
3822
|
...bindPopover4(fontPopoverState)
|
|
3858
3823
|
},
|
|
3859
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ React36.createElement(
|
|
3860
3825
|
ItemSelector,
|
|
3861
3826
|
{
|
|
3862
3827
|
id: "font-family-variables-selector",
|
|
@@ -3865,7 +3830,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3865
3830
|
onItemChange: handleFontFamilyChange,
|
|
3866
3831
|
onClose: fontPopoverState.close,
|
|
3867
3832
|
sectionWidth,
|
|
3868
|
-
title:
|
|
3833
|
+
title: __25("Font family", "elementor"),
|
|
3869
3834
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3870
3835
|
onDebounce: enqueueFont2,
|
|
3871
3836
|
icon: TextIcon
|
|
@@ -3890,11 +3855,11 @@ function registerVariableTypes() {
|
|
|
3890
3855
|
registerVariableType({
|
|
3891
3856
|
key: colorVariablePropTypeUtil.key,
|
|
3892
3857
|
valueField: ColorField,
|
|
3893
|
-
icon:
|
|
3858
|
+
icon: BrushIcon,
|
|
3894
3859
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3895
3860
|
fallbackPropTypeUtil: colorPropTypeUtil,
|
|
3896
3861
|
variableType: "color",
|
|
3897
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3862
|
+
startIcon: ({ value }) => /* @__PURE__ */ React37.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3898
3863
|
defaultValue: "#ffffff",
|
|
3899
3864
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3900
3865
|
const actions = [];
|
|
@@ -3903,14 +3868,14 @@ function registerVariableTypes() {
|
|
|
3903
3868
|
}
|
|
3904
3869
|
if (variable.sync_to_v3) {
|
|
3905
3870
|
actions.push({
|
|
3906
|
-
name:
|
|
3871
|
+
name: __26("Stop syncing to Version 3", "elementor"),
|
|
3907
3872
|
icon: ResetIcon,
|
|
3908
3873
|
color: "text.primary",
|
|
3909
3874
|
onClick: () => handlers.onStopSync(variableId)
|
|
3910
3875
|
});
|
|
3911
3876
|
} else {
|
|
3912
3877
|
actions.push({
|
|
3913
|
-
name:
|
|
3878
|
+
name: __26("Sync to Version 3", "elementor"),
|
|
3914
3879
|
icon: ResetIcon,
|
|
3915
3880
|
color: "text.primary",
|
|
3916
3881
|
onClick: () => handlers.onStartSync(variableId)
|
|
@@ -3936,7 +3901,7 @@ function registerVariableTypes() {
|
|
|
3936
3901
|
styleTransformer: EmptyTransformer,
|
|
3937
3902
|
variableType: "size",
|
|
3938
3903
|
selectionFilter: () => [],
|
|
3939
|
-
emptyState: /* @__PURE__ */
|
|
3904
|
+
emptyState: /* @__PURE__ */ React37.createElement(CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3940
3905
|
};
|
|
3941
3906
|
registerVariableType({
|
|
3942
3907
|
...sizePromotions,
|
|
@@ -3950,8 +3915,8 @@ function registerVariableTypes() {
|
|
|
3950
3915
|
}
|
|
3951
3916
|
|
|
3952
3917
|
// src/renderers/style-variables-renderer.tsx
|
|
3953
|
-
import * as
|
|
3954
|
-
import { useEffect as useEffect6, useState as
|
|
3918
|
+
import * as React38 from "react";
|
|
3919
|
+
import { useEffect as useEffect6, useState as useState19 } from "react";
|
|
3955
3920
|
import {
|
|
3956
3921
|
__privateUseListenTo as useListenTo,
|
|
3957
3922
|
commandEndEvent,
|
|
@@ -3968,13 +3933,13 @@ function StyleVariablesRenderer() {
|
|
|
3968
3933
|
}
|
|
3969
3934
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3970
3935
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3971
|
-
return /* @__PURE__ */
|
|
3936
|
+
return /* @__PURE__ */ React38.createElement(Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3972
3937
|
}
|
|
3973
3938
|
function usePortalContainer() {
|
|
3974
3939
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
3975
3940
|
}
|
|
3976
3941
|
function useStyleVariables() {
|
|
3977
|
-
const [variables, setVariables] =
|
|
3942
|
+
const [variables, setVariables] = useState19({});
|
|
3978
3943
|
useEffect6(() => {
|
|
3979
3944
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3980
3945
|
return () => {
|
|
@@ -3998,22 +3963,22 @@ import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elemen
|
|
|
3998
3963
|
import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
3999
3964
|
|
|
4000
3965
|
// src/components/variables-repeater-item-slot.tsx
|
|
4001
|
-
import * as
|
|
3966
|
+
import * as React39 from "react";
|
|
4002
3967
|
var useColorVariable = (value) => {
|
|
4003
3968
|
const variableId = value?.value?.color?.value;
|
|
4004
3969
|
return useVariable(variableId || "");
|
|
4005
3970
|
};
|
|
4006
3971
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
4007
3972
|
const colorVariable = useColorVariable(value);
|
|
4008
|
-
return /* @__PURE__ */
|
|
3973
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
4009
3974
|
};
|
|
4010
3975
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
4011
3976
|
const colorVariable = useColorVariable(value);
|
|
4012
|
-
return /* @__PURE__ */
|
|
3977
|
+
return /* @__PURE__ */ React39.createElement("span", null, colorVariable?.label);
|
|
4013
3978
|
};
|
|
4014
3979
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
4015
3980
|
const colorVariable = useColorVariable(value);
|
|
4016
|
-
return /* @__PURE__ */
|
|
3981
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
4017
3982
|
};
|
|
4018
3983
|
|
|
4019
3984
|
// src/repeater-injections.ts
|