@elementor/editor-variables 4.0.0-552 → 4.0.0-564
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 +742 -683
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +613 -556
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/ui/variable-promotion-chip.tsx +63 -0
- package/src/components/variables-manager/ui/variable-edit-menu.tsx +14 -3
- package/src/components/variables-manager/ui/variable-table-row.tsx +210 -0
- package/src/components/variables-manager/variable-editable-cell.tsx +12 -4
- package/src/components/variables-manager/variables-manager-create-menu.tsx +11 -38
- package/src/components/variables-manager/variables-manager-table.tsx +17 -188
- package/src/hooks/use-quota-permissions.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -50,18 +50,18 @@ var import_editor_props7 = require("@elementor/editor-props");
|
|
|
50
50
|
var import_menus = require("@elementor/menus");
|
|
51
51
|
|
|
52
52
|
// src/components/open-panel-from-url.tsx
|
|
53
|
-
var
|
|
53
|
+
var import_react15 = require("react");
|
|
54
54
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
55
55
|
|
|
56
56
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
57
|
-
var
|
|
58
|
-
var
|
|
57
|
+
var React15 = __toESM(require("react"));
|
|
58
|
+
var import_react14 = require("react");
|
|
59
59
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
60
60
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
61
61
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
62
62
|
var import_icons6 = require("@elementor/icons");
|
|
63
|
-
var
|
|
64
|
-
var
|
|
63
|
+
var import_ui15 = require("@elementor/ui");
|
|
64
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
65
65
|
|
|
66
66
|
// src/utils/tracking.ts
|
|
67
67
|
var import_events = require("@elementor/events");
|
|
@@ -1139,19 +1139,18 @@ var useVariablesManagerState = () => {
|
|
|
1139
1139
|
};
|
|
1140
1140
|
|
|
1141
1141
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1142
|
-
var
|
|
1143
|
-
var
|
|
1144
|
-
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1142
|
+
var React8 = __toESM(require("react"));
|
|
1143
|
+
var import_react8 = require("react");
|
|
1145
1144
|
var import_icons3 = require("@elementor/icons");
|
|
1146
|
-
var
|
|
1147
|
-
var
|
|
1148
|
-
var
|
|
1145
|
+
var import_ui8 = require("@elementor/ui");
|
|
1146
|
+
var import_utils2 = require("@elementor/utils");
|
|
1147
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1149
1148
|
|
|
1150
1149
|
// src/hooks/use-quota-permissions.ts
|
|
1151
1150
|
var useQuotaPermissions = (variableType) => {
|
|
1152
1151
|
const quotaConfig = {
|
|
1153
|
-
...window.ElementorVariablesQuotaConfig
|
|
1154
|
-
...window.ElementorVariablesQuotaConfigExtended
|
|
1152
|
+
...window.ElementorVariablesQuotaConfig ?? {},
|
|
1153
|
+
...window.ElementorVariablesQuotaConfigExtended ?? {}
|
|
1155
1154
|
};
|
|
1156
1155
|
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1157
1156
|
const limit = quotaConfig[variableType] || 0;
|
|
@@ -1162,17 +1161,63 @@ var useQuotaPermissions = (variableType) => {
|
|
|
1162
1161
|
};
|
|
1163
1162
|
};
|
|
1164
1163
|
|
|
1164
|
+
// src/components/ui/variable-promotion-chip.tsx
|
|
1165
|
+
var React7 = __toESM(require("react"));
|
|
1166
|
+
var import_react7 = require("react");
|
|
1167
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1168
|
+
var import_ui7 = require("@elementor/ui");
|
|
1169
|
+
var import_utils = require("@elementor/utils");
|
|
1170
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1171
|
+
var VariablePromotionChip = (0, import_react7.forwardRef)(
|
|
1172
|
+
({ variableType, upgradeUrl }, ref) => {
|
|
1173
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
1174
|
+
(0, import_editor_ui2.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
|
|
1175
|
+
const toggle = () => setIsOpen((prev) => !prev);
|
|
1176
|
+
(0, import_react7.useImperativeHandle)(ref, () => ({ toggle }), []);
|
|
1177
|
+
const title = (0, import_i18n8.sprintf)(
|
|
1178
|
+
/* translators: %s: Variable Type. */
|
|
1179
|
+
(0, import_i18n8.__)("%s variables", "elementor"),
|
|
1180
|
+
(0, import_utils.capitalize)(variableType)
|
|
1181
|
+
);
|
|
1182
|
+
const content = (0, import_i18n8.sprintf)(
|
|
1183
|
+
/* translators: %s: Variable Type. */
|
|
1184
|
+
(0, import_i18n8.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1185
|
+
variableType
|
|
1186
|
+
);
|
|
1187
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1188
|
+
import_editor_ui2.PromotionPopover,
|
|
1189
|
+
{
|
|
1190
|
+
open: isOpen,
|
|
1191
|
+
title,
|
|
1192
|
+
content,
|
|
1193
|
+
ctaText: (0, import_i18n8.__)("Upgrade now", "elementor"),
|
|
1194
|
+
ctaUrl: upgradeUrl,
|
|
1195
|
+
onClose: (e) => {
|
|
1196
|
+
e.stopPropagation();
|
|
1197
|
+
setIsOpen(false);
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
/* @__PURE__ */ React7.createElement(
|
|
1201
|
+
import_ui7.Box,
|
|
1202
|
+
{
|
|
1203
|
+
onClick: (e) => {
|
|
1204
|
+
e.stopPropagation();
|
|
1205
|
+
toggle();
|
|
1206
|
+
},
|
|
1207
|
+
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1208
|
+
},
|
|
1209
|
+
/* @__PURE__ */ React7.createElement(import_editor_ui2.PromotionChip, null)
|
|
1210
|
+
)
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
|
|
1165
1215
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1166
1216
|
var SIZE = "tiny";
|
|
1167
|
-
var VariableManagerCreateMenu = ({
|
|
1168
|
-
|
|
1169
|
-
onCreate,
|
|
1170
|
-
disabled,
|
|
1171
|
-
menuState
|
|
1172
|
-
}) => {
|
|
1173
|
-
const buttonRef = (0, import_react7.useRef)(null);
|
|
1217
|
+
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1218
|
+
const buttonRef = (0, import_react8.useRef)(null);
|
|
1174
1219
|
const variableTypes = getVariableTypes();
|
|
1175
|
-
const menuOptionConfigs = (0,
|
|
1220
|
+
const menuOptionConfigs = (0, import_react8.useMemo)(
|
|
1176
1221
|
() => Object.entries(variableTypes).filter(([, variable]) => !!variable.defaultValue).map(([key, variable]) => ({
|
|
1177
1222
|
key,
|
|
1178
1223
|
propTypeKey: variable.propTypeUtil.key,
|
|
@@ -1182,18 +1227,17 @@ var VariableManagerCreateMenu = ({
|
|
|
1182
1227
|
})),
|
|
1183
1228
|
[variableTypes]
|
|
1184
1229
|
);
|
|
1185
|
-
return /* @__PURE__ */
|
|
1186
|
-
|
|
1230
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
|
|
1231
|
+
import_ui8.IconButton,
|
|
1187
1232
|
{
|
|
1188
|
-
...(0,
|
|
1233
|
+
...(0, import_ui8.bindTrigger)(menuState),
|
|
1189
1234
|
ref: buttonRef,
|
|
1190
|
-
disabled,
|
|
1191
1235
|
size: SIZE,
|
|
1192
|
-
"aria-label": (0,
|
|
1236
|
+
"aria-label": (0, import_i18n9.__)("Add variable", "elementor")
|
|
1193
1237
|
},
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
), /* @__PURE__ */
|
|
1196
|
-
|
|
1238
|
+
/* @__PURE__ */ React8.createElement(import_icons3.PlusIcon, { fontSize: SIZE })
|
|
1239
|
+
), /* @__PURE__ */ React8.createElement(
|
|
1240
|
+
import_ui8.Menu,
|
|
1197
1241
|
{
|
|
1198
1242
|
disablePortal: true,
|
|
1199
1243
|
MenuListProps: {
|
|
@@ -1202,7 +1246,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1202
1246
|
PaperProps: {
|
|
1203
1247
|
elevation: 6
|
|
1204
1248
|
},
|
|
1205
|
-
...(0,
|
|
1249
|
+
...(0, import_ui8.bindMenu)(menuState),
|
|
1206
1250
|
anchorEl: buttonRef.current,
|
|
1207
1251
|
anchorOrigin: {
|
|
1208
1252
|
vertical: "bottom",
|
|
@@ -1214,7 +1258,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1214
1258
|
},
|
|
1215
1259
|
"data-testid": "variable-manager-create-menu"
|
|
1216
1260
|
},
|
|
1217
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1261
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React8.createElement(
|
|
1218
1262
|
MenuOption,
|
|
1219
1263
|
{
|
|
1220
1264
|
key: config.key,
|
|
@@ -1232,15 +1276,13 @@ var MenuOption = ({
|
|
|
1232
1276
|
onCreate,
|
|
1233
1277
|
onClose
|
|
1234
1278
|
}) => {
|
|
1235
|
-
const
|
|
1279
|
+
const promotionRef = (0, import_react8.useRef)(null);
|
|
1236
1280
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1237
|
-
const displayName = (0,
|
|
1281
|
+
const displayName = (0, import_utils2.capitalize)(config.variableType);
|
|
1238
1282
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
1239
1283
|
const handleClick = () => {
|
|
1240
1284
|
if (isDisabled) {
|
|
1241
|
-
|
|
1242
|
-
setIsPopoverOpen(true);
|
|
1243
|
-
}
|
|
1285
|
+
promotionRef.current?.toggle();
|
|
1244
1286
|
return;
|
|
1245
1287
|
}
|
|
1246
1288
|
const defaultName = getDefaultName(variables, config.key, config.variableType);
|
|
@@ -1248,29 +1290,13 @@ var MenuOption = ({
|
|
|
1248
1290
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1249
1291
|
onClose();
|
|
1250
1292
|
};
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
(0, import_i18n8.__)("%s variables", "elementor"),
|
|
1254
|
-
(0, import_utils.capitalize)(config.variableType)
|
|
1255
|
-
);
|
|
1256
|
-
const content = (0, import_i18n8.sprintf)(
|
|
1257
|
-
/* translators: %s: Variable Type. */
|
|
1258
|
-
(0, import_i18n8.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1259
|
-
config.variableType
|
|
1260
|
-
);
|
|
1261
|
-
return /* @__PURE__ */ React7.createElement(import_ui7.MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, (0, import_react7.createElement)(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React7.createElement(import_ui7.Typography, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React7.createElement(
|
|
1262
|
-
import_editor_ui2.PromotionPopover,
|
|
1293
|
+
return /* @__PURE__ */ React8.createElement(import_ui8.MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, (0, import_react8.createElement)(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React8.createElement(import_ui8.Typography, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React8.createElement(
|
|
1294
|
+
VariablePromotionChip,
|
|
1263
1295
|
{
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1269
|
-
onClose: () => {
|
|
1270
|
-
setIsPopoverOpen(false);
|
|
1271
|
-
}
|
|
1272
|
-
},
|
|
1273
|
-
/* @__PURE__ */ React7.createElement(import_editor_ui2.PromotionChip, null)
|
|
1296
|
+
variableType: config.variableType,
|
|
1297
|
+
upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1298
|
+
ref: promotionRef
|
|
1299
|
+
}
|
|
1274
1300
|
));
|
|
1275
1301
|
};
|
|
1276
1302
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1285,23 +1311,52 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1285
1311
|
};
|
|
1286
1312
|
|
|
1287
1313
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1288
|
-
var
|
|
1289
|
-
var
|
|
1314
|
+
var React14 = __toESM(require("react"));
|
|
1315
|
+
var import_react13 = require("react");
|
|
1316
|
+
var import_ui14 = require("@elementor/ui");
|
|
1317
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1318
|
+
|
|
1319
|
+
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1320
|
+
var React9 = __toESM(require("react"));
|
|
1321
|
+
var import_ui9 = require("@elementor/ui");
|
|
1322
|
+
var VariableTableCell = ({
|
|
1323
|
+
children,
|
|
1324
|
+
isHeader,
|
|
1325
|
+
width,
|
|
1326
|
+
maxWidth,
|
|
1327
|
+
align,
|
|
1328
|
+
noPadding,
|
|
1329
|
+
sx
|
|
1330
|
+
}) => {
|
|
1331
|
+
const baseSx = {
|
|
1332
|
+
maxWidth: maxWidth ?? 150,
|
|
1333
|
+
cursor: "initial",
|
|
1334
|
+
typography: "caption",
|
|
1335
|
+
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1336
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1337
|
+
...width && { width },
|
|
1338
|
+
...sx
|
|
1339
|
+
};
|
|
1340
|
+
return /* @__PURE__ */ React9.createElement(import_ui9.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1344
|
+
var React13 = __toESM(require("react"));
|
|
1345
|
+
var import_react12 = require("react");
|
|
1290
1346
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1291
1347
|
var import_icons5 = require("@elementor/icons");
|
|
1292
|
-
var
|
|
1293
|
-
var import_i18n9 = require("@wordpress/i18n");
|
|
1348
|
+
var import_ui13 = require("@elementor/ui");
|
|
1294
1349
|
|
|
1295
1350
|
// src/components/fields/label-field.tsx
|
|
1296
|
-
var
|
|
1297
|
-
var
|
|
1351
|
+
var React10 = __toESM(require("react"));
|
|
1352
|
+
var import_react9 = require("react");
|
|
1298
1353
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1299
|
-
var
|
|
1354
|
+
var import_ui10 = require("@elementor/ui");
|
|
1300
1355
|
function isLabelEqual(a, b) {
|
|
1301
1356
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1302
1357
|
}
|
|
1303
1358
|
var useLabelError = (initialError) => {
|
|
1304
|
-
const [error, setError] = (0,
|
|
1359
|
+
const [error, setError] = (0, import_react9.useState)(initialError ?? { value: "", message: "" });
|
|
1305
1360
|
return {
|
|
1306
1361
|
labelFieldError: error,
|
|
1307
1362
|
setLabelFieldError: setError
|
|
@@ -1320,9 +1375,9 @@ var LabelField = ({
|
|
|
1320
1375
|
variables,
|
|
1321
1376
|
onKeyDown
|
|
1322
1377
|
}) => {
|
|
1323
|
-
const [label, setLabel] = (0,
|
|
1324
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
1325
|
-
const fieldRef = (0,
|
|
1378
|
+
const [label, setLabel] = (0, import_react9.useState)(value);
|
|
1379
|
+
const [errorMessage, setErrorMessage] = (0, import_react9.useState)("");
|
|
1380
|
+
const fieldRef = (0, import_react9.useRef)(null);
|
|
1326
1381
|
const handleChange = (newValue) => {
|
|
1327
1382
|
setLabel(newValue);
|
|
1328
1383
|
const errorMsg2 = validateLabel(newValue, variables);
|
|
@@ -1335,8 +1390,8 @@ var LabelField = ({
|
|
|
1335
1390
|
errorMsg = error.message;
|
|
1336
1391
|
}
|
|
1337
1392
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1338
|
-
const textField = /* @__PURE__ */
|
|
1339
|
-
|
|
1393
|
+
const textField = /* @__PURE__ */ React10.createElement(
|
|
1394
|
+
import_ui10.TextField,
|
|
1340
1395
|
{
|
|
1341
1396
|
ref: fieldRef,
|
|
1342
1397
|
id: id2,
|
|
@@ -1356,7 +1411,7 @@ var LabelField = ({
|
|
|
1356
1411
|
);
|
|
1357
1412
|
if (showWarningInfotip) {
|
|
1358
1413
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1359
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1360
1415
|
import_editor_ui3.WarningInfotip,
|
|
1361
1416
|
{
|
|
1362
1417
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1372,84 +1427,6 @@ var LabelField = ({
|
|
|
1372
1427
|
return textField;
|
|
1373
1428
|
};
|
|
1374
1429
|
|
|
1375
|
-
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1376
|
-
var React9 = __toESM(require("react"));
|
|
1377
|
-
var import_react9 = require("react");
|
|
1378
|
-
var import_icons4 = require("@elementor/icons");
|
|
1379
|
-
var import_ui9 = require("@elementor/ui");
|
|
1380
|
-
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1381
|
-
const menuState = (0, import_ui9.usePopupState)({
|
|
1382
|
-
variant: "popover"
|
|
1383
|
-
});
|
|
1384
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(import_ui9.IconButton, { ...(0, import_ui9.bindTrigger)(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React9.createElement(import_icons4.DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React9.createElement(
|
|
1385
|
-
import_ui9.Menu,
|
|
1386
|
-
{
|
|
1387
|
-
disablePortal: true,
|
|
1388
|
-
MenuListProps: {
|
|
1389
|
-
dense: true
|
|
1390
|
-
},
|
|
1391
|
-
PaperProps: {
|
|
1392
|
-
elevation: 6
|
|
1393
|
-
},
|
|
1394
|
-
...(0, import_ui9.bindMenu)(menuState),
|
|
1395
|
-
anchorEl: menuState.anchorEl,
|
|
1396
|
-
anchorOrigin: {
|
|
1397
|
-
vertical: "bottom",
|
|
1398
|
-
horizontal: "right"
|
|
1399
|
-
},
|
|
1400
|
-
transformOrigin: {
|
|
1401
|
-
vertical: "top",
|
|
1402
|
-
horizontal: "right"
|
|
1403
|
-
},
|
|
1404
|
-
open: menuState.isOpen,
|
|
1405
|
-
onClose: menuState.close
|
|
1406
|
-
},
|
|
1407
|
-
menuActions.map((action) => /* @__PURE__ */ React9.createElement(
|
|
1408
|
-
import_ui9.MenuItem,
|
|
1409
|
-
{
|
|
1410
|
-
key: action.name,
|
|
1411
|
-
onClick: () => {
|
|
1412
|
-
action.onClick?.(itemId);
|
|
1413
|
-
menuState.close();
|
|
1414
|
-
},
|
|
1415
|
-
sx: {
|
|
1416
|
-
color: action.color,
|
|
1417
|
-
gap: 1
|
|
1418
|
-
}
|
|
1419
|
-
},
|
|
1420
|
-
action.icon && (0, import_react9.createElement)(action.icon, {
|
|
1421
|
-
fontSize: "inherit"
|
|
1422
|
-
}),
|
|
1423
|
-
" ",
|
|
1424
|
-
action.name
|
|
1425
|
-
))
|
|
1426
|
-
));
|
|
1427
|
-
};
|
|
1428
|
-
|
|
1429
|
-
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1430
|
-
var React10 = __toESM(require("react"));
|
|
1431
|
-
var import_ui10 = require("@elementor/ui");
|
|
1432
|
-
var VariableTableCell = ({
|
|
1433
|
-
children,
|
|
1434
|
-
isHeader,
|
|
1435
|
-
width,
|
|
1436
|
-
maxWidth,
|
|
1437
|
-
align,
|
|
1438
|
-
noPadding,
|
|
1439
|
-
sx
|
|
1440
|
-
}) => {
|
|
1441
|
-
const baseSx = {
|
|
1442
|
-
maxWidth: maxWidth ?? 150,
|
|
1443
|
-
cursor: "initial",
|
|
1444
|
-
typography: "caption",
|
|
1445
|
-
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1446
|
-
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1447
|
-
...width && { width },
|
|
1448
|
-
...sx
|
|
1449
|
-
};
|
|
1450
|
-
return /* @__PURE__ */ React10.createElement(import_ui10.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1451
|
-
};
|
|
1452
|
-
|
|
1453
1430
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1454
1431
|
var React11 = __toESM(require("react"));
|
|
1455
1432
|
var import_react10 = require("react");
|
|
@@ -1465,7 +1442,8 @@ var VariableEditableCell = React11.memo(
|
|
|
1465
1442
|
onRowRef,
|
|
1466
1443
|
onAutoEditComplete,
|
|
1467
1444
|
gap = 1,
|
|
1468
|
-
fieldType
|
|
1445
|
+
fieldType,
|
|
1446
|
+
disabled = false
|
|
1469
1447
|
}) => {
|
|
1470
1448
|
const [value, setValue] = (0, import_react10.useState)(initialValue);
|
|
1471
1449
|
const [isEditing, setIsEditing] = (0, import_react10.useState)(false);
|
|
@@ -1483,15 +1461,21 @@ var VariableEditableCell = React11.memo(
|
|
|
1483
1461
|
onRowRef?.(rowRef?.current);
|
|
1484
1462
|
}, [onRowRef]);
|
|
1485
1463
|
(0, import_react10.useEffect)(() => {
|
|
1486
|
-
if (autoEdit && !isEditing) {
|
|
1464
|
+
if (autoEdit && !isEditing && !disabled) {
|
|
1487
1465
|
setIsEditing(true);
|
|
1488
1466
|
onAutoEditComplete?.();
|
|
1489
1467
|
}
|
|
1490
|
-
}, [autoEdit, isEditing, onAutoEditComplete]);
|
|
1468
|
+
}, [autoEdit, isEditing, onAutoEditComplete, disabled]);
|
|
1491
1469
|
const handleDoubleClick = () => {
|
|
1470
|
+
if (disabled) {
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1492
1473
|
setIsEditing(true);
|
|
1493
1474
|
};
|
|
1494
1475
|
const handleKeyDown = (event) => {
|
|
1476
|
+
if (disabled) {
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1495
1479
|
if (event.key === "Enter") {
|
|
1496
1480
|
handleSave();
|
|
1497
1481
|
} else if (event.key === "Escape") {
|
|
@@ -1557,9 +1541,9 @@ var VariableEditableCell = React11.memo(
|
|
|
1557
1541
|
gap,
|
|
1558
1542
|
onDoubleClick: handleDoubleClick,
|
|
1559
1543
|
onKeyDown: handleKeyDown,
|
|
1560
|
-
tabIndex: 0,
|
|
1544
|
+
tabIndex: disabled ? -1 : 0,
|
|
1561
1545
|
role: "button",
|
|
1562
|
-
"aria-label": "Double click or press Space to edit"
|
|
1546
|
+
"aria-label": disabled ? "" : "Double click or press Space to edit"
|
|
1563
1547
|
},
|
|
1564
1548
|
prefixElement,
|
|
1565
1549
|
children
|
|
@@ -1567,6 +1551,243 @@ var VariableEditableCell = React11.memo(
|
|
|
1567
1551
|
}
|
|
1568
1552
|
);
|
|
1569
1553
|
|
|
1554
|
+
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1555
|
+
var React12 = __toESM(require("react"));
|
|
1556
|
+
var import_react11 = require("react");
|
|
1557
|
+
var import_icons4 = require("@elementor/icons");
|
|
1558
|
+
var import_ui12 = require("@elementor/ui");
|
|
1559
|
+
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1560
|
+
const menuState = (0, import_ui12.usePopupState)({
|
|
1561
|
+
variant: "popover"
|
|
1562
|
+
});
|
|
1563
|
+
const triggerProps = (0, import_ui12.bindTrigger)(menuState);
|
|
1564
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
|
|
1565
|
+
import_ui12.IconButton,
|
|
1566
|
+
{
|
|
1567
|
+
...triggerProps,
|
|
1568
|
+
disabled,
|
|
1569
|
+
size: "tiny",
|
|
1570
|
+
onClick: (e) => {
|
|
1571
|
+
e.stopPropagation();
|
|
1572
|
+
triggerProps.onClick?.(e);
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
/* @__PURE__ */ React12.createElement(import_icons4.DotsVerticalIcon, { fontSize: "tiny" })
|
|
1576
|
+
), /* @__PURE__ */ React12.createElement(
|
|
1577
|
+
import_ui12.Menu,
|
|
1578
|
+
{
|
|
1579
|
+
disablePortal: true,
|
|
1580
|
+
MenuListProps: {
|
|
1581
|
+
dense: true
|
|
1582
|
+
},
|
|
1583
|
+
PaperProps: {
|
|
1584
|
+
elevation: 6
|
|
1585
|
+
},
|
|
1586
|
+
...(0, import_ui12.bindMenu)(menuState),
|
|
1587
|
+
anchorEl: menuState.anchorEl,
|
|
1588
|
+
anchorOrigin: {
|
|
1589
|
+
vertical: "bottom",
|
|
1590
|
+
horizontal: "right"
|
|
1591
|
+
},
|
|
1592
|
+
transformOrigin: {
|
|
1593
|
+
vertical: "top",
|
|
1594
|
+
horizontal: "right"
|
|
1595
|
+
},
|
|
1596
|
+
open: menuState.isOpen,
|
|
1597
|
+
onClose: menuState.close
|
|
1598
|
+
},
|
|
1599
|
+
menuActions.map((action) => /* @__PURE__ */ React12.createElement(
|
|
1600
|
+
import_ui12.MenuItem,
|
|
1601
|
+
{
|
|
1602
|
+
key: action.name,
|
|
1603
|
+
onClick: (e) => {
|
|
1604
|
+
e.stopPropagation();
|
|
1605
|
+
action.onClick?.(itemId);
|
|
1606
|
+
menuState.close();
|
|
1607
|
+
},
|
|
1608
|
+
sx: {
|
|
1609
|
+
color: action.color,
|
|
1610
|
+
gap: 1
|
|
1611
|
+
}
|
|
1612
|
+
},
|
|
1613
|
+
action.icon && (0, import_react11.createElement)(action.icon, {
|
|
1614
|
+
fontSize: "inherit"
|
|
1615
|
+
}),
|
|
1616
|
+
" ",
|
|
1617
|
+
action.name
|
|
1618
|
+
))
|
|
1619
|
+
));
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1623
|
+
var VariableRow = (props) => {
|
|
1624
|
+
const {
|
|
1625
|
+
row,
|
|
1626
|
+
variables,
|
|
1627
|
+
handleOnChange,
|
|
1628
|
+
autoEditVariableId,
|
|
1629
|
+
onAutoEditComplete,
|
|
1630
|
+
onFieldError,
|
|
1631
|
+
menuActions,
|
|
1632
|
+
handleRowRef,
|
|
1633
|
+
itemProps,
|
|
1634
|
+
showDropIndication,
|
|
1635
|
+
triggerProps,
|
|
1636
|
+
itemStyle,
|
|
1637
|
+
triggerStyle,
|
|
1638
|
+
isDragged,
|
|
1639
|
+
dropPosition,
|
|
1640
|
+
setTriggerRef,
|
|
1641
|
+
isSorting
|
|
1642
|
+
} = props;
|
|
1643
|
+
const promotionRef = (0, import_react12.useRef)(null);
|
|
1644
|
+
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1645
|
+
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1646
|
+
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1647
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1648
|
+
import_ui13.TableRow,
|
|
1649
|
+
{
|
|
1650
|
+
...itemProps,
|
|
1651
|
+
ref: itemProps.ref,
|
|
1652
|
+
selected: isDragged,
|
|
1653
|
+
sx: {
|
|
1654
|
+
...isDisabled && {
|
|
1655
|
+
"& td, & th": {
|
|
1656
|
+
color: "text.disabled"
|
|
1657
|
+
}
|
|
1658
|
+
},
|
|
1659
|
+
...showIndicationBefore && {
|
|
1660
|
+
"& td, & th": {
|
|
1661
|
+
borderTop: "2px solid",
|
|
1662
|
+
borderTopColor: "primary.main"
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
...showIndicationAfter && {
|
|
1666
|
+
"& td, & th": {
|
|
1667
|
+
borderBottom: "2px solid",
|
|
1668
|
+
borderBottomColor: "primary.main"
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1671
|
+
"&:hover, &:focus-within": {
|
|
1672
|
+
backgroundColor: "action.hover",
|
|
1673
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1674
|
+
opacity: 1
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1677
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1678
|
+
opacity: 0
|
|
1679
|
+
}
|
|
1680
|
+
},
|
|
1681
|
+
style: { ...itemStyle, ...triggerStyle },
|
|
1682
|
+
onClick: () => {
|
|
1683
|
+
if (isDisabled) {
|
|
1684
|
+
promotionRef.current?.toggle();
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React13.createElement(import_ui13.IconButton, { size: "small", ref: setTriggerRef, ...triggerProps, disabled: isSorting, draggable: true }, /* @__PURE__ */ React13.createElement(import_icons5.GripVerticalIcon, { fontSize: "inherit" }))),
|
|
1689
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, null, /* @__PURE__ */ React13.createElement(
|
|
1690
|
+
VariableEditableCell,
|
|
1691
|
+
{
|
|
1692
|
+
initialValue: row.name,
|
|
1693
|
+
onChange: (value) => {
|
|
1694
|
+
if (value !== row.name && !isDisabled) {
|
|
1695
|
+
handleOnChange({
|
|
1696
|
+
...variables,
|
|
1697
|
+
[row.id]: { ...variables[row.id], label: value }
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
prefixElement: (0, import_react12.createElement)(row.icon, {
|
|
1702
|
+
fontSize: "inherit",
|
|
1703
|
+
color: isDisabled ? "disabled" : "inherit"
|
|
1704
|
+
}),
|
|
1705
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React13.createElement(
|
|
1706
|
+
LabelField,
|
|
1707
|
+
{
|
|
1708
|
+
id: "variable-label-" + row.id,
|
|
1709
|
+
size: "tiny",
|
|
1710
|
+
value,
|
|
1711
|
+
onChange,
|
|
1712
|
+
onErrorChange: (errorMsg) => {
|
|
1713
|
+
onValidationChange?.(errorMsg);
|
|
1714
|
+
onFieldError?.(!!errorMsg);
|
|
1715
|
+
},
|
|
1716
|
+
error,
|
|
1717
|
+
focusOnShow: true,
|
|
1718
|
+
selectOnShow: autoEditVariableId === row.id,
|
|
1719
|
+
showWarningInfotip: true,
|
|
1720
|
+
variables
|
|
1721
|
+
}
|
|
1722
|
+
),
|
|
1723
|
+
autoEdit: autoEditVariableId === row.id && !isDisabled,
|
|
1724
|
+
onRowRef: handleRowRef(row.id),
|
|
1725
|
+
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1726
|
+
fieldType: "label",
|
|
1727
|
+
disabled: isDisabled
|
|
1728
|
+
},
|
|
1729
|
+
/* @__PURE__ */ React13.createElement(import_editor_ui4.EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1730
|
+
)),
|
|
1731
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, null, /* @__PURE__ */ React13.createElement(
|
|
1732
|
+
VariableEditableCell,
|
|
1733
|
+
{
|
|
1734
|
+
initialValue: row.value,
|
|
1735
|
+
onChange: (value) => {
|
|
1736
|
+
if (value !== row.value && !isDisabled) {
|
|
1737
|
+
handleOnChange({
|
|
1738
|
+
...variables,
|
|
1739
|
+
[row.id]: { ...variables[row.id], value }
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
},
|
|
1743
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => row.valueField?.({
|
|
1744
|
+
value,
|
|
1745
|
+
onChange,
|
|
1746
|
+
onPropTypeKeyChange: (type) => {
|
|
1747
|
+
if (!isDisabled) {
|
|
1748
|
+
handleOnChange({
|
|
1749
|
+
...variables,
|
|
1750
|
+
[row.id]: { ...variables[row.id], type }
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
propTypeKey: row.type,
|
|
1755
|
+
onValidationChange: (errorMsg) => {
|
|
1756
|
+
onValidationChange?.(errorMsg);
|
|
1757
|
+
onFieldError?.(!!errorMsg);
|
|
1758
|
+
},
|
|
1759
|
+
error
|
|
1760
|
+
}) ?? /* @__PURE__ */ React13.createElement(React13.Fragment, null),
|
|
1761
|
+
onRowRef: handleRowRef(row.id),
|
|
1762
|
+
gap: 0.25,
|
|
1763
|
+
fieldType: "value",
|
|
1764
|
+
disabled: isDisabled
|
|
1765
|
+
},
|
|
1766
|
+
row.startIcon && row.startIcon({ value: row.value }),
|
|
1767
|
+
/* @__PURE__ */ React13.createElement(
|
|
1768
|
+
import_editor_ui4.EllipsisWithTooltip,
|
|
1769
|
+
{
|
|
1770
|
+
title: row.value,
|
|
1771
|
+
sx: {
|
|
1772
|
+
border: "4px solid transparent",
|
|
1773
|
+
lineHeight: "1",
|
|
1774
|
+
pt: 0.25
|
|
1775
|
+
}
|
|
1776
|
+
},
|
|
1777
|
+
row.value
|
|
1778
|
+
)
|
|
1779
|
+
)),
|
|
1780
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, { align: "right", noPadding: true, width: 16, maxWidth: 16, sx: { paddingInlineEnd: 1 } }, /* @__PURE__ */ React13.createElement(import_ui13.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end", alignItems: "center" }, isDisabled && /* @__PURE__ */ React13.createElement(
|
|
1781
|
+
VariablePromotionChip,
|
|
1782
|
+
{
|
|
1783
|
+
variableType: row.variableType,
|
|
1784
|
+
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1785
|
+
ref: promotionRef
|
|
1786
|
+
}
|
|
1787
|
+
), /* @__PURE__ */ React13.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1788
|
+
);
|
|
1789
|
+
};
|
|
1790
|
+
|
|
1570
1791
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1571
1792
|
var VariablesManagerTable = ({
|
|
1572
1793
|
menuActions,
|
|
@@ -1576,9 +1797,9 @@ var VariablesManagerTable = ({
|
|
|
1576
1797
|
onAutoEditComplete,
|
|
1577
1798
|
onFieldError
|
|
1578
1799
|
}) => {
|
|
1579
|
-
const tableContainerRef = (0,
|
|
1580
|
-
const variableRowRefs = (0,
|
|
1581
|
-
(0,
|
|
1800
|
+
const tableContainerRef = (0, import_react13.useRef)(null);
|
|
1801
|
+
const variableRowRefs = (0, import_react13.useRef)(/* @__PURE__ */ new Map());
|
|
1802
|
+
(0, import_react13.useEffect)(() => {
|
|
1582
1803
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1583
1804
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
1584
1805
|
if (rowElement) {
|
|
@@ -1629,196 +1850,34 @@ var VariablesManagerTable = ({
|
|
|
1629
1850
|
});
|
|
1630
1851
|
handleOnChange(updatedVariables);
|
|
1631
1852
|
};
|
|
1632
|
-
return /* @__PURE__ */
|
|
1633
|
-
|
|
1853
|
+
return /* @__PURE__ */ React14.createElement(import_ui14.TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React14.createElement(import_ui14.Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React14.createElement(import_ui14.TableHead, null, /* @__PURE__ */ React14.createElement(import_ui14.TableRow, null, /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n10.__)("Name", "elementor")), /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n10.__)("Value", "elementor")), /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React14.createElement(import_ui14.TableBody, null, /* @__PURE__ */ React14.createElement(
|
|
1854
|
+
import_ui14.UnstableSortableProvider,
|
|
1634
1855
|
{
|
|
1635
1856
|
value: ids,
|
|
1636
1857
|
onChange: handleReorder,
|
|
1637
1858
|
variant: "static",
|
|
1638
1859
|
restrictAxis: true,
|
|
1639
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1860
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React14.createElement(import_ui14.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React14.createElement(import_ui14.TableBody, null, dragOverlayChildren))
|
|
1640
1861
|
},
|
|
1641
|
-
rows.map((row) => /* @__PURE__ */
|
|
1642
|
-
|
|
1862
|
+
rows.map((row) => /* @__PURE__ */ React14.createElement(
|
|
1863
|
+
import_ui14.UnstableSortableItem,
|
|
1643
1864
|
{
|
|
1644
1865
|
key: row.id,
|
|
1645
1866
|
id: row.id,
|
|
1646
|
-
render: (
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
import_ui12.TableRow,
|
|
1661
|
-
{
|
|
1662
|
-
...itemProps,
|
|
1663
|
-
ref: itemProps.ref,
|
|
1664
|
-
selected: isDragged,
|
|
1665
|
-
sx: {
|
|
1666
|
-
...showIndicationBefore && {
|
|
1667
|
-
"& td, & th": {
|
|
1668
|
-
borderTop: "2px solid",
|
|
1669
|
-
borderTopColor: "primary.main"
|
|
1670
|
-
}
|
|
1671
|
-
},
|
|
1672
|
-
...showIndicationAfter && {
|
|
1673
|
-
"& td, & th": {
|
|
1674
|
-
borderBottom: "2px solid",
|
|
1675
|
-
borderBottomColor: "primary.main"
|
|
1676
|
-
}
|
|
1677
|
-
},
|
|
1678
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1679
|
-
opacity: 0
|
|
1680
|
-
},
|
|
1681
|
-
"&:hover, &:focus-within": {
|
|
1682
|
-
backgroundColor: "action.hover",
|
|
1683
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1684
|
-
opacity: 1
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
},
|
|
1688
|
-
style: { ...itemStyle, ...triggerStyle }
|
|
1689
|
-
},
|
|
1690
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(
|
|
1691
|
-
import_ui12.IconButton,
|
|
1692
|
-
{
|
|
1693
|
-
size: "small",
|
|
1694
|
-
ref: setTriggerRef,
|
|
1695
|
-
...triggerProps,
|
|
1696
|
-
disabled: isSorting,
|
|
1697
|
-
draggable: true
|
|
1698
|
-
},
|
|
1699
|
-
/* @__PURE__ */ React12.createElement(import_icons5.GripVerticalIcon, { fontSize: "inherit" })
|
|
1700
|
-
)),
|
|
1701
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1702
|
-
VariableEditableCell,
|
|
1703
|
-
{
|
|
1704
|
-
initialValue: row.name,
|
|
1705
|
-
onChange: (value) => {
|
|
1706
|
-
if (value !== row.name) {
|
|
1707
|
-
handleOnChange({
|
|
1708
|
-
...variables,
|
|
1709
|
-
[row.id]: { ...variables[row.id], label: value }
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
},
|
|
1713
|
-
prefixElement: (0, import_react11.createElement)(row.icon, { fontSize: "inherit" }),
|
|
1714
|
-
editableElement: ({
|
|
1715
|
-
value,
|
|
1716
|
-
onChange,
|
|
1717
|
-
onValidationChange,
|
|
1718
|
-
error
|
|
1719
|
-
}) => /* @__PURE__ */ React12.createElement(
|
|
1720
|
-
LabelField,
|
|
1721
|
-
{
|
|
1722
|
-
id: "variable-label-" + row.id,
|
|
1723
|
-
size: "tiny",
|
|
1724
|
-
value,
|
|
1725
|
-
onChange,
|
|
1726
|
-
onErrorChange: (errorMsg) => {
|
|
1727
|
-
onValidationChange?.(errorMsg);
|
|
1728
|
-
onFieldError?.(!!errorMsg);
|
|
1729
|
-
},
|
|
1730
|
-
error,
|
|
1731
|
-
focusOnShow: true,
|
|
1732
|
-
selectOnShow: autoEditVariableId === row.id,
|
|
1733
|
-
showWarningInfotip: true,
|
|
1734
|
-
variables
|
|
1735
|
-
}
|
|
1736
|
-
),
|
|
1737
|
-
autoEdit: autoEditVariableId === row.id,
|
|
1738
|
-
onRowRef: handleRowRef(row.id),
|
|
1739
|
-
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1740
|
-
fieldType: "label"
|
|
1741
|
-
},
|
|
1742
|
-
/* @__PURE__ */ React12.createElement(
|
|
1743
|
-
import_editor_ui4.EllipsisWithTooltip,
|
|
1744
|
-
{
|
|
1745
|
-
title: row.name,
|
|
1746
|
-
sx: { border: "4px solid transparent" }
|
|
1747
|
-
},
|
|
1748
|
-
row.name
|
|
1749
|
-
)
|
|
1750
|
-
)),
|
|
1751
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1752
|
-
VariableEditableCell,
|
|
1753
|
-
{
|
|
1754
|
-
initialValue: row.value,
|
|
1755
|
-
onChange: (value) => {
|
|
1756
|
-
if (value !== row.value) {
|
|
1757
|
-
handleOnChange({
|
|
1758
|
-
...variables,
|
|
1759
|
-
[row.id]: { ...variables[row.id], value }
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
},
|
|
1763
|
-
editableElement: ({
|
|
1764
|
-
value,
|
|
1765
|
-
onChange,
|
|
1766
|
-
onValidationChange,
|
|
1767
|
-
error
|
|
1768
|
-
}) => row.valueField?.({
|
|
1769
|
-
value,
|
|
1770
|
-
onChange,
|
|
1771
|
-
onPropTypeKeyChange: (type) => {
|
|
1772
|
-
handleOnChange({
|
|
1773
|
-
...variables,
|
|
1774
|
-
[row.id]: { ...variables[row.id], type }
|
|
1775
|
-
});
|
|
1776
|
-
},
|
|
1777
|
-
propTypeKey: row.type,
|
|
1778
|
-
onValidationChange: (errorMsg) => {
|
|
1779
|
-
onValidationChange?.(errorMsg);
|
|
1780
|
-
onFieldError?.(!!errorMsg);
|
|
1781
|
-
},
|
|
1782
|
-
error
|
|
1783
|
-
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1784
|
-
onRowRef: handleRowRef(row.id),
|
|
1785
|
-
gap: 0.25,
|
|
1786
|
-
fieldType: "value"
|
|
1787
|
-
},
|
|
1788
|
-
row.startIcon && row.startIcon({ value: row.value }),
|
|
1789
|
-
/* @__PURE__ */ React12.createElement(
|
|
1790
|
-
import_editor_ui4.EllipsisWithTooltip,
|
|
1791
|
-
{
|
|
1792
|
-
title: row.value,
|
|
1793
|
-
sx: {
|
|
1794
|
-
border: "4px solid transparent",
|
|
1795
|
-
lineHeight: "1",
|
|
1796
|
-
pt: 0.25
|
|
1797
|
-
}
|
|
1798
|
-
},
|
|
1799
|
-
row.value
|
|
1800
|
-
)
|
|
1801
|
-
)),
|
|
1802
|
-
/* @__PURE__ */ React12.createElement(
|
|
1803
|
-
VariableTableCell,
|
|
1804
|
-
{
|
|
1805
|
-
align: "right",
|
|
1806
|
-
noPadding: true,
|
|
1807
|
-
width: 16,
|
|
1808
|
-
maxWidth: 16,
|
|
1809
|
-
sx: { paddingInlineEnd: 1 }
|
|
1810
|
-
},
|
|
1811
|
-
/* @__PURE__ */ React12.createElement(import_ui12.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React12.createElement(
|
|
1812
|
-
VariableEditMenu,
|
|
1813
|
-
{
|
|
1814
|
-
menuActions: menuActions(row.id),
|
|
1815
|
-
disabled: isSorting,
|
|
1816
|
-
itemId: row.id
|
|
1817
|
-
}
|
|
1818
|
-
))
|
|
1819
|
-
)
|
|
1820
|
-
);
|
|
1821
|
-
}
|
|
1867
|
+
render: (props) => /* @__PURE__ */ React14.createElement(
|
|
1868
|
+
VariableRow,
|
|
1869
|
+
{
|
|
1870
|
+
...props,
|
|
1871
|
+
row,
|
|
1872
|
+
variables,
|
|
1873
|
+
handleOnChange,
|
|
1874
|
+
autoEditVariableId,
|
|
1875
|
+
onAutoEditComplete,
|
|
1876
|
+
onFieldError,
|
|
1877
|
+
menuActions,
|
|
1878
|
+
handleRowRef
|
|
1879
|
+
}
|
|
1880
|
+
)
|
|
1822
1881
|
}
|
|
1823
1882
|
))
|
|
1824
1883
|
))));
|
|
@@ -1848,7 +1907,7 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1848
1907
|
function VariablesManagerPanel() {
|
|
1849
1908
|
const { close: closePanel } = usePanelActions();
|
|
1850
1909
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui5.useDialog)();
|
|
1851
|
-
const createMenuState = (0,
|
|
1910
|
+
const createMenuState = (0, import_ui15.usePopupState)({
|
|
1852
1911
|
variant: "popover"
|
|
1853
1912
|
});
|
|
1854
1913
|
const {
|
|
@@ -1869,9 +1928,9 @@ function VariablesManagerPanel() {
|
|
|
1869
1928
|
} = useVariablesManagerState();
|
|
1870
1929
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1871
1930
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1872
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
1873
|
-
const [stopSyncConfirmation, setStopSyncConfirmation] = (0,
|
|
1874
|
-
const [serverError, setServerError] = (0,
|
|
1931
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react14.useState)(null);
|
|
1932
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = (0, import_react14.useState)(null);
|
|
1933
|
+
const [serverError, setServerError] = (0, import_react14.useState)(null);
|
|
1875
1934
|
usePreventUnload(isDirty);
|
|
1876
1935
|
const handleClosePanel = () => {
|
|
1877
1936
|
if (isDirty) {
|
|
@@ -1880,7 +1939,7 @@ function VariablesManagerPanel() {
|
|
|
1880
1939
|
}
|
|
1881
1940
|
closePanel();
|
|
1882
1941
|
};
|
|
1883
|
-
const handleCreateVariable = (0,
|
|
1942
|
+
const handleCreateVariable = (0, import_react14.useCallback)(
|
|
1884
1943
|
(type, defaultName, defaultValue) => {
|
|
1885
1944
|
const newId = createVariable2(type, defaultName, defaultValue);
|
|
1886
1945
|
if (newId) {
|
|
@@ -1914,21 +1973,21 @@ function VariablesManagerPanel() {
|
|
|
1914
1973
|
setIsSaving(false);
|
|
1915
1974
|
}
|
|
1916
1975
|
};
|
|
1917
|
-
const handleDeleteVariableWithConfirmation = (0,
|
|
1976
|
+
const handleDeleteVariableWithConfirmation = (0, import_react14.useCallback)(
|
|
1918
1977
|
(itemId) => {
|
|
1919
1978
|
handleDeleteVariable(itemId);
|
|
1920
1979
|
setDeleteConfirmation(null);
|
|
1921
1980
|
},
|
|
1922
1981
|
[handleDeleteVariable]
|
|
1923
1982
|
);
|
|
1924
|
-
const handleStopSyncWithConfirmation = (0,
|
|
1983
|
+
const handleStopSyncWithConfirmation = (0, import_react14.useCallback)(
|
|
1925
1984
|
(itemId) => {
|
|
1926
1985
|
handleStopSync(itemId);
|
|
1927
1986
|
setStopSyncConfirmation(null);
|
|
1928
1987
|
},
|
|
1929
1988
|
[handleStopSync]
|
|
1930
1989
|
);
|
|
1931
|
-
const buildMenuActions = (0,
|
|
1990
|
+
const buildMenuActions = (0, import_react14.useCallback)(
|
|
1932
1991
|
(variableId) => {
|
|
1933
1992
|
const variable = variables[variableId];
|
|
1934
1993
|
if (!variable) {
|
|
@@ -1943,7 +2002,7 @@ function VariablesManagerPanel() {
|
|
|
1943
2002
|
}
|
|
1944
2003
|
});
|
|
1945
2004
|
const deleteAction = {
|
|
1946
|
-
name: (0,
|
|
2005
|
+
name: (0, import_i18n11.__)("Delete", "elementor"),
|
|
1947
2006
|
icon: import_icons6.TrashIcon,
|
|
1948
2007
|
color: "error.main",
|
|
1949
2008
|
onClick: (itemId) => {
|
|
@@ -1960,22 +2019,22 @@ function VariablesManagerPanel() {
|
|
|
1960
2019
|
[variables, handleStartSync]
|
|
1961
2020
|
);
|
|
1962
2021
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1963
|
-
return /* @__PURE__ */
|
|
2022
|
+
return /* @__PURE__ */ React15.createElement(import_editor_ui5.ThemeProvider, null, /* @__PURE__ */ React15.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React15.createElement(
|
|
1964
2023
|
import_editor_panels.PanelHeader,
|
|
1965
2024
|
{
|
|
1966
2025
|
sx: {
|
|
1967
2026
|
height: "unset"
|
|
1968
2027
|
}
|
|
1969
2028
|
},
|
|
1970
|
-
/* @__PURE__ */
|
|
2029
|
+
/* @__PURE__ */ React15.createElement(import_ui15.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React15.createElement(import_ui15.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React15.createElement(import_ui15.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React15.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React15.createElement(import_icons6.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n11.__)("Variables Manager", "elementor"))), /* @__PURE__ */ React15.createElement(import_ui15.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React15.createElement(
|
|
1971
2030
|
VariableManagerCreateMenu,
|
|
1972
2031
|
{
|
|
1973
2032
|
onCreate: handleCreateVariable,
|
|
1974
2033
|
variables,
|
|
1975
2034
|
menuState: createMenuState
|
|
1976
2035
|
}
|
|
1977
|
-
), /* @__PURE__ */
|
|
1978
|
-
|
|
2036
|
+
), /* @__PURE__ */ React15.createElement(
|
|
2037
|
+
import_ui15.CloseButton,
|
|
1979
2038
|
{
|
|
1980
2039
|
"aria-label": "Close",
|
|
1981
2040
|
slotProps: { icon: { fontSize: SIZE } },
|
|
@@ -1983,19 +2042,19 @@ function VariablesManagerPanel() {
|
|
|
1983
2042
|
handleClosePanel();
|
|
1984
2043
|
}
|
|
1985
2044
|
}
|
|
1986
|
-
))), /* @__PURE__ */
|
|
2045
|
+
))), /* @__PURE__ */ React15.createElement(import_ui15.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React15.createElement(
|
|
1987
2046
|
import_editor_ui5.SearchField,
|
|
1988
2047
|
{
|
|
1989
2048
|
sx: {
|
|
1990
2049
|
display: "flex",
|
|
1991
2050
|
flex: 1
|
|
1992
2051
|
},
|
|
1993
|
-
placeholder: (0,
|
|
2052
|
+
placeholder: (0, import_i18n11.__)("Search", "elementor"),
|
|
1994
2053
|
value: searchValue,
|
|
1995
2054
|
onSearch: handleSearch
|
|
1996
2055
|
}
|
|
1997
|
-
)), /* @__PURE__ */
|
|
1998
|
-
), /* @__PURE__ */
|
|
2056
|
+
)), /* @__PURE__ */ React15.createElement(import_ui15.Divider, { sx: { width: "100%" } }))
|
|
2057
|
+
), /* @__PURE__ */ React15.createElement(
|
|
1999
2058
|
import_editor_panels.PanelBody,
|
|
2000
2059
|
{
|
|
2001
2060
|
sx: {
|
|
@@ -2004,7 +2063,7 @@ function VariablesManagerPanel() {
|
|
|
2004
2063
|
height: "100%"
|
|
2005
2064
|
}
|
|
2006
2065
|
},
|
|
2007
|
-
hasVariables && /* @__PURE__ */
|
|
2066
|
+
hasVariables && /* @__PURE__ */ React15.createElement(
|
|
2008
2067
|
VariablesManagerTable,
|
|
2009
2068
|
{
|
|
2010
2069
|
menuActions: buildMenuActions,
|
|
@@ -2015,43 +2074,43 @@ function VariablesManagerPanel() {
|
|
|
2015
2074
|
onFieldError: setIsSaveDisabled
|
|
2016
2075
|
}
|
|
2017
2076
|
),
|
|
2018
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2077
|
+
!hasVariables && searchValue && /* @__PURE__ */ React15.createElement(
|
|
2019
2078
|
NoSearchResults,
|
|
2020
2079
|
{
|
|
2021
2080
|
searchValue,
|
|
2022
2081
|
onClear: () => handleSearch(""),
|
|
2023
|
-
icon: /* @__PURE__ */
|
|
2082
|
+
icon: /* @__PURE__ */ React15.createElement(import_icons6.ColorFilterIcon, { fontSize: "large" })
|
|
2024
2083
|
}
|
|
2025
2084
|
),
|
|
2026
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2085
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React15.createElement(
|
|
2027
2086
|
EmptyState,
|
|
2028
2087
|
{
|
|
2029
|
-
title: (0,
|
|
2030
|
-
message: (0,
|
|
2088
|
+
title: (0, import_i18n11.__)("Create your first variable", "elementor"),
|
|
2089
|
+
message: (0, import_i18n11.__)(
|
|
2031
2090
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2032
2091
|
"elementor"
|
|
2033
2092
|
),
|
|
2034
|
-
icon: /* @__PURE__ */
|
|
2093
|
+
icon: /* @__PURE__ */ React15.createElement(import_icons6.ColorFilterIcon, { fontSize: "large" }),
|
|
2035
2094
|
onAdd: createMenuState.open
|
|
2036
2095
|
}
|
|
2037
2096
|
)
|
|
2038
|
-
), /* @__PURE__ */
|
|
2039
|
-
|
|
2097
|
+
), /* @__PURE__ */ React15.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React15.createElement(
|
|
2098
|
+
import_ui15.Infotip,
|
|
2040
2099
|
{
|
|
2041
2100
|
placement: "right",
|
|
2042
2101
|
open: !!serverError,
|
|
2043
|
-
content: serverError ? /* @__PURE__ */
|
|
2044
|
-
|
|
2102
|
+
content: serverError ? /* @__PURE__ */ React15.createElement(
|
|
2103
|
+
import_ui15.Alert,
|
|
2045
2104
|
{
|
|
2046
2105
|
severity: serverError.severity ?? "error",
|
|
2047
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2106
|
+
action: serverError.action?.label ? /* @__PURE__ */ React15.createElement(import_ui15.AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
2048
2107
|
onClose: !serverError.action?.label ? () => {
|
|
2049
2108
|
setServerError(null);
|
|
2050
2109
|
setIsSaveDisabled(false);
|
|
2051
2110
|
} : void 0,
|
|
2052
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2111
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React15.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React15.createElement(import_icons6.AlertTriangleFilledIcon, null)
|
|
2053
2112
|
},
|
|
2054
|
-
/* @__PURE__ */
|
|
2113
|
+
/* @__PURE__ */ React15.createElement(import_ui15.AlertTitle, null, serverError.message),
|
|
2055
2114
|
serverError.action?.message
|
|
2056
2115
|
) : null,
|
|
2057
2116
|
arrow: false,
|
|
@@ -2066,8 +2125,8 @@ function VariablesManagerPanel() {
|
|
|
2066
2125
|
}
|
|
2067
2126
|
}
|
|
2068
2127
|
},
|
|
2069
|
-
/* @__PURE__ */
|
|
2070
|
-
|
|
2128
|
+
/* @__PURE__ */ React15.createElement(
|
|
2129
|
+
import_ui15.Button,
|
|
2071
2130
|
{
|
|
2072
2131
|
fullWidth: true,
|
|
2073
2132
|
size: "small",
|
|
@@ -2077,9 +2136,9 @@ function VariablesManagerPanel() {
|
|
|
2077
2136
|
onClick: handleSaveClick,
|
|
2078
2137
|
loading: isSaving
|
|
2079
2138
|
},
|
|
2080
|
-
(0,
|
|
2139
|
+
(0, import_i18n11.__)("Save changes", "elementor")
|
|
2081
2140
|
)
|
|
2082
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2141
|
+
))), deleteConfirmation && /* @__PURE__ */ React15.createElement(
|
|
2083
2142
|
DeleteConfirmationDialog,
|
|
2084
2143
|
{
|
|
2085
2144
|
open: true,
|
|
@@ -2087,26 +2146,26 @@ function VariablesManagerPanel() {
|
|
|
2087
2146
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2088
2147
|
closeDialog: () => setDeleteConfirmation(null)
|
|
2089
2148
|
}
|
|
2090
|
-
), stopSyncConfirmation && /* @__PURE__ */
|
|
2149
|
+
), stopSyncConfirmation && /* @__PURE__ */ React15.createElement(
|
|
2091
2150
|
StopSyncConfirmationDialog,
|
|
2092
2151
|
{
|
|
2093
2152
|
open: true,
|
|
2094
2153
|
closeDialog: () => setStopSyncConfirmation(null),
|
|
2095
2154
|
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2096
2155
|
}
|
|
2097
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
2156
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React15.createElement(import_editor_ui5.SaveChangesDialog, null, /* @__PURE__ */ React15.createElement(import_editor_ui5.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n11.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React15.createElement(import_editor_ui5.SaveChangesDialog.Content, null, /* @__PURE__ */ React15.createElement(import_editor_ui5.SaveChangesDialog.ContentText, null, (0, import_i18n11.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React15.createElement(
|
|
2098
2157
|
import_editor_ui5.SaveChangesDialog.Actions,
|
|
2099
2158
|
{
|
|
2100
2159
|
actions: {
|
|
2101
2160
|
discard: {
|
|
2102
|
-
label: (0,
|
|
2161
|
+
label: (0, import_i18n11.__)("Discard", "elementor"),
|
|
2103
2162
|
action: () => {
|
|
2104
2163
|
closeSaveChangesDialog();
|
|
2105
2164
|
closePanel();
|
|
2106
2165
|
}
|
|
2107
2166
|
},
|
|
2108
2167
|
confirm: {
|
|
2109
|
-
label: (0,
|
|
2168
|
+
label: (0, import_i18n11.__)("Save", "elementor"),
|
|
2110
2169
|
action: async () => {
|
|
2111
2170
|
const result = await handleSaveClick();
|
|
2112
2171
|
closeSaveChangesDialog();
|
|
@@ -2120,7 +2179,7 @@ function VariablesManagerPanel() {
|
|
|
2120
2179
|
)));
|
|
2121
2180
|
}
|
|
2122
2181
|
var usePreventUnload = (isDirty) => {
|
|
2123
|
-
(0,
|
|
2182
|
+
(0, import_react14.useEffect)(() => {
|
|
2124
2183
|
const handleBeforeUnload = (event) => {
|
|
2125
2184
|
if (isDirty) {
|
|
2126
2185
|
event.preventDefault();
|
|
@@ -2139,8 +2198,8 @@ var PANEL_ID = "variables-manager";
|
|
|
2139
2198
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2140
2199
|
function OpenPanelFromUrl() {
|
|
2141
2200
|
const { open } = usePanelActions();
|
|
2142
|
-
const hasOpened = (0,
|
|
2143
|
-
(0,
|
|
2201
|
+
const hasOpened = (0, import_react15.useRef)(false);
|
|
2202
|
+
(0, import_react15.useEffect)(() => {
|
|
2144
2203
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2145
2204
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2146
2205
|
if (activePanel !== PANEL_ID) {
|
|
@@ -2161,15 +2220,15 @@ function OpenPanelFromUrl() {
|
|
|
2161
2220
|
}
|
|
2162
2221
|
|
|
2163
2222
|
// src/controls/variable-control.tsx
|
|
2164
|
-
var
|
|
2223
|
+
var React34 = __toESM(require("react"));
|
|
2165
2224
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
2166
2225
|
|
|
2167
2226
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2168
|
-
var
|
|
2169
|
-
var
|
|
2227
|
+
var import_react22 = require("react");
|
|
2228
|
+
var React25 = __toESM(require("react"));
|
|
2170
2229
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2171
2230
|
var import_icons13 = require("@elementor/icons");
|
|
2172
|
-
var
|
|
2231
|
+
var import_ui25 = require("@elementor/ui");
|
|
2173
2232
|
|
|
2174
2233
|
// src/utils/unlink-variable.ts
|
|
2175
2234
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2188,31 +2247,31 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2188
2247
|
}
|
|
2189
2248
|
|
|
2190
2249
|
// src/components/variable-selection-popover.tsx
|
|
2191
|
-
var
|
|
2192
|
-
var
|
|
2250
|
+
var React23 = __toESM(require("react"));
|
|
2251
|
+
var import_react21 = require("react");
|
|
2193
2252
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2194
2253
|
|
|
2195
2254
|
// src/context/variable-selection-popover.context.tsx
|
|
2196
|
-
var
|
|
2197
|
-
var
|
|
2198
|
-
var
|
|
2199
|
-
var PopoverContentRefContext = (0,
|
|
2255
|
+
var React16 = __toESM(require("react"));
|
|
2256
|
+
var import_react16 = require("react");
|
|
2257
|
+
var import_ui16 = require("@elementor/ui");
|
|
2258
|
+
var PopoverContentRefContext = (0, import_react16.createContext)(null);
|
|
2200
2259
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2201
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2202
|
-
return /* @__PURE__ */
|
|
2260
|
+
const [anchorRef, setAnchorRef] = (0, import_react16.useState)(null);
|
|
2261
|
+
return /* @__PURE__ */ React16.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React16.createElement(import_ui16.Box, { ref: setAnchorRef }, children));
|
|
2203
2262
|
};
|
|
2204
2263
|
var usePopoverContentRef = () => {
|
|
2205
|
-
return (0,
|
|
2264
|
+
return (0, import_react16.useContext)(PopoverContentRefContext);
|
|
2206
2265
|
};
|
|
2207
2266
|
|
|
2208
2267
|
// src/components/variable-creation.tsx
|
|
2209
|
-
var
|
|
2210
|
-
var
|
|
2268
|
+
var React18 = __toESM(require("react"));
|
|
2269
|
+
var import_react17 = require("react");
|
|
2211
2270
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2212
2271
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2213
2272
|
var import_icons7 = require("@elementor/icons");
|
|
2214
|
-
var
|
|
2215
|
-
var
|
|
2273
|
+
var import_ui18 = require("@elementor/ui");
|
|
2274
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
2216
2275
|
|
|
2217
2276
|
// src/hooks/use-initial-value.ts
|
|
2218
2277
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -2255,10 +2314,10 @@ var unwrapValue = (input) => {
|
|
|
2255
2314
|
};
|
|
2256
2315
|
|
|
2257
2316
|
// src/components/ui/form-field.tsx
|
|
2258
|
-
var
|
|
2259
|
-
var
|
|
2317
|
+
var React17 = __toESM(require("react"));
|
|
2318
|
+
var import_ui17 = require("@elementor/ui");
|
|
2260
2319
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2261
|
-
return /* @__PURE__ */
|
|
2320
|
+
return /* @__PURE__ */ React17.createElement(import_ui17.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React17.createElement(import_ui17.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React17.createElement(import_ui17.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React17.createElement(import_ui17.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React17.createElement(import_ui17.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React17.createElement(import_ui17.FormHelperText, null, noticeMsg)));
|
|
2262
2321
|
};
|
|
2263
2322
|
|
|
2264
2323
|
// src/components/variable-creation.tsx
|
|
@@ -2268,11 +2327,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2268
2327
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2269
2328
|
const { propType } = (0, import_editor_controls4.useBoundProp)();
|
|
2270
2329
|
const initialValue = useInitialValue();
|
|
2271
|
-
const [value, setValue] = (0,
|
|
2272
|
-
const [label, setLabel] = (0,
|
|
2273
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2274
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2275
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2330
|
+
const [value, setValue] = (0, import_react17.useState)(initialValue);
|
|
2331
|
+
const [label, setLabel] = (0, import_react17.useState)("");
|
|
2332
|
+
const [errorMessage, setErrorMessage] = (0, import_react17.useState)("");
|
|
2333
|
+
const [valueFieldError, setValueFieldError] = (0, import_react17.useState)("");
|
|
2334
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react17.useState)(propTypeUtil.key);
|
|
2276
2335
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2277
2336
|
const resetFields = () => {
|
|
2278
2337
|
setValue("");
|
|
@@ -2329,22 +2388,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2329
2388
|
handleCreateAndTrack();
|
|
2330
2389
|
}
|
|
2331
2390
|
};
|
|
2332
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ React18.createElement(import_editor_ui6.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React18.createElement(
|
|
2333
2392
|
import_editor_ui6.PopoverHeader,
|
|
2334
2393
|
{
|
|
2335
|
-
icon: /* @__PURE__ */
|
|
2336
|
-
title: (0,
|
|
2394
|
+
icon: /* @__PURE__ */ React18.createElement(React18.Fragment, null, onGoBack && /* @__PURE__ */ React18.createElement(import_ui18.IconButton, { size: SIZE2, "aria-label": (0, import_i18n12.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React18.createElement(import_icons7.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2395
|
+
title: (0, import_i18n12.__)("Create variable", "elementor"),
|
|
2337
2396
|
onClose: closePopover
|
|
2338
2397
|
}
|
|
2339
|
-
), /* @__PURE__ */
|
|
2398
|
+
), /* @__PURE__ */ React18.createElement(import_ui18.Divider, null), /* @__PURE__ */ React18.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React18.createElement(
|
|
2340
2399
|
FormField,
|
|
2341
2400
|
{
|
|
2342
2401
|
id: "variable-label",
|
|
2343
|
-
label: (0,
|
|
2402
|
+
label: (0, import_i18n12.__)("Name", "elementor"),
|
|
2344
2403
|
errorMsg: labelFieldError?.message,
|
|
2345
2404
|
noticeMsg: labelHint(label)
|
|
2346
2405
|
},
|
|
2347
|
-
/* @__PURE__ */
|
|
2406
|
+
/* @__PURE__ */ React18.createElement(
|
|
2348
2407
|
LabelField,
|
|
2349
2408
|
{
|
|
2350
2409
|
id: "variable-label",
|
|
@@ -2363,7 +2422,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2363
2422
|
onKeyDown: handleKeyDown
|
|
2364
2423
|
}
|
|
2365
2424
|
)
|
|
2366
|
-
), ValueField && /* @__PURE__ */
|
|
2425
|
+
), ValueField && /* @__PURE__ */ React18.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n12.__)("Value", "elementor") }, /* @__PURE__ */ React18.createElement(import_ui18.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React18.createElement(
|
|
2367
2426
|
ValueField,
|
|
2368
2427
|
{
|
|
2369
2428
|
value,
|
|
@@ -2377,8 +2436,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2377
2436
|
propType,
|
|
2378
2437
|
onKeyDown: handleKeyDown
|
|
2379
2438
|
}
|
|
2380
|
-
))), errorMessage && /* @__PURE__ */
|
|
2381
|
-
|
|
2439
|
+
))), errorMessage && /* @__PURE__ */ React18.createElement(import_ui18.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React18.createElement(import_ui18.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React18.createElement(
|
|
2440
|
+
import_ui18.Button,
|
|
2382
2441
|
{
|
|
2383
2442
|
id: "create-variable-button",
|
|
2384
2443
|
size: "small",
|
|
@@ -2386,80 +2445,80 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2386
2445
|
disabled: isSubmitDisabled,
|
|
2387
2446
|
onClick: handleCreateAndTrack
|
|
2388
2447
|
},
|
|
2389
|
-
(0,
|
|
2448
|
+
(0, import_i18n12.__)("Create", "elementor")
|
|
2390
2449
|
)));
|
|
2391
2450
|
};
|
|
2392
2451
|
|
|
2393
2452
|
// src/components/variable-edit.tsx
|
|
2394
|
-
var
|
|
2395
|
-
var
|
|
2453
|
+
var React20 = __toESM(require("react"));
|
|
2454
|
+
var import_react19 = require("react");
|
|
2396
2455
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2397
2456
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2398
2457
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2399
2458
|
var import_icons9 = require("@elementor/icons");
|
|
2400
|
-
var
|
|
2401
|
-
var
|
|
2459
|
+
var import_ui20 = require("@elementor/ui");
|
|
2460
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2402
2461
|
|
|
2403
2462
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2404
|
-
var
|
|
2405
|
-
var
|
|
2463
|
+
var React19 = __toESM(require("react"));
|
|
2464
|
+
var import_react18 = require("react");
|
|
2406
2465
|
var import_icons8 = require("@elementor/icons");
|
|
2407
|
-
var
|
|
2408
|
-
var
|
|
2466
|
+
var import_ui19 = require("@elementor/ui");
|
|
2467
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2409
2468
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2410
2469
|
var EditConfirmationDialog = ({
|
|
2411
2470
|
closeDialog,
|
|
2412
2471
|
onConfirm,
|
|
2413
2472
|
onSuppressMessage
|
|
2414
2473
|
}) => {
|
|
2415
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2474
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react18.useState)(false);
|
|
2416
2475
|
const handleSave = () => {
|
|
2417
2476
|
if (dontShowAgain) {
|
|
2418
2477
|
onSuppressMessage?.();
|
|
2419
2478
|
}
|
|
2420
2479
|
onConfirm?.();
|
|
2421
2480
|
};
|
|
2422
|
-
return /* @__PURE__ */
|
|
2481
|
+
return /* @__PURE__ */ React19.createElement(import_ui19.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React19.createElement(import_ui19.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React19.createElement(import_icons8.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n13.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React19.createElement(import_ui19.DialogContent, null, /* @__PURE__ */ React19.createElement(import_ui19.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n13.__)(
|
|
2423
2482
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2424
2483
|
"elementor"
|
|
2425
|
-
))), /* @__PURE__ */
|
|
2426
|
-
|
|
2484
|
+
))), /* @__PURE__ */ React19.createElement(import_ui19.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React19.createElement(
|
|
2485
|
+
import_ui19.FormControlLabel,
|
|
2427
2486
|
{
|
|
2428
|
-
control: /* @__PURE__ */
|
|
2429
|
-
|
|
2487
|
+
control: /* @__PURE__ */ React19.createElement(
|
|
2488
|
+
import_ui19.Checkbox,
|
|
2430
2489
|
{
|
|
2431
2490
|
checked: dontShowAgain,
|
|
2432
2491
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2433
2492
|
size: "small"
|
|
2434
2493
|
}
|
|
2435
2494
|
),
|
|
2436
|
-
label: /* @__PURE__ */
|
|
2495
|
+
label: /* @__PURE__ */ React19.createElement(import_ui19.Typography, { variant: "body2" }, (0, import_i18n13.__)("Don't show me again", "elementor"))
|
|
2437
2496
|
}
|
|
2438
|
-
), /* @__PURE__ */
|
|
2497
|
+
), /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement(import_ui19.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n13.__)("Keep editing", "elementor")), /* @__PURE__ */ React19.createElement(import_ui19.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n13.__)("Save", "elementor")))));
|
|
2439
2498
|
};
|
|
2440
2499
|
|
|
2441
2500
|
// src/components/variable-edit.tsx
|
|
2442
2501
|
var SIZE3 = "tiny";
|
|
2443
|
-
var DELETE_LABEL = (0,
|
|
2502
|
+
var DELETE_LABEL = (0, import_i18n14.__)("Delete variable", "elementor");
|
|
2444
2503
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2445
2504
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2446
2505
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2447
2506
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2448
2507
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2449
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2450
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2451
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2452
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2508
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react19.useState)(false);
|
|
2509
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react19.useState)(false);
|
|
2510
|
+
const [errorMessage, setErrorMessage] = (0, import_react19.useState)("");
|
|
2511
|
+
const [valueFieldError, setValueFieldError] = (0, import_react19.useState)("");
|
|
2453
2512
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2454
2513
|
const variable = useVariable(editId);
|
|
2455
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2514
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react19.useState)(variable?.type ?? propTypeUtil.key);
|
|
2456
2515
|
if (!variable) {
|
|
2457
2516
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2458
2517
|
}
|
|
2459
2518
|
const userPermissions = usePermissions();
|
|
2460
|
-
const [value, setValue] = (0,
|
|
2461
|
-
const [label, setLabel] = (0,
|
|
2462
|
-
(0,
|
|
2519
|
+
const [value, setValue] = (0, import_react19.useState)(() => variable.value);
|
|
2520
|
+
const [label, setLabel] = (0, import_react19.useState)(() => variable.label);
|
|
2521
|
+
(0, import_react19.useEffect)(() => {
|
|
2463
2522
|
styleVariablesRepository.update({
|
|
2464
2523
|
[editId]: {
|
|
2465
2524
|
...variable,
|
|
@@ -2521,7 +2580,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2521
2580
|
const actions = [];
|
|
2522
2581
|
if (userPermissions.canDelete()) {
|
|
2523
2582
|
actions.push(
|
|
2524
|
-
/* @__PURE__ */
|
|
2583
|
+
/* @__PURE__ */ React20.createElement(import_ui20.Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React20.createElement(import_ui20.IconButton, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React20.createElement(import_icons9.TrashIcon, { fontSize: SIZE3 })))
|
|
2525
2584
|
);
|
|
2526
2585
|
}
|
|
2527
2586
|
const hasEmptyFields = () => {
|
|
@@ -2546,31 +2605,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2546
2605
|
handleUpdate();
|
|
2547
2606
|
}
|
|
2548
2607
|
};
|
|
2549
|
-
return /* @__PURE__ */
|
|
2608
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(import_editor_ui7.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React20.createElement(
|
|
2550
2609
|
import_editor_ui7.PopoverHeader,
|
|
2551
2610
|
{
|
|
2552
|
-
title: (0,
|
|
2611
|
+
title: (0, import_i18n14.__)("Edit variable", "elementor"),
|
|
2553
2612
|
onClose,
|
|
2554
|
-
icon: /* @__PURE__ */
|
|
2555
|
-
|
|
2613
|
+
icon: /* @__PURE__ */ React20.createElement(React20.Fragment, null, onGoBack && /* @__PURE__ */ React20.createElement(
|
|
2614
|
+
import_ui20.IconButton,
|
|
2556
2615
|
{
|
|
2557
2616
|
size: SIZE3,
|
|
2558
|
-
"aria-label": (0,
|
|
2617
|
+
"aria-label": (0, import_i18n14.__)("Go Back", "elementor"),
|
|
2559
2618
|
onClick: onGoBack
|
|
2560
2619
|
},
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
), /* @__PURE__ */
|
|
2620
|
+
/* @__PURE__ */ React20.createElement(import_icons9.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
2621
|
+
), /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2563
2622
|
actions
|
|
2564
2623
|
}
|
|
2565
|
-
), /* @__PURE__ */
|
|
2624
|
+
), /* @__PURE__ */ React20.createElement(import_ui20.Divider, null), /* @__PURE__ */ React20.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React20.createElement(
|
|
2566
2625
|
FormField,
|
|
2567
2626
|
{
|
|
2568
2627
|
id: "variable-label",
|
|
2569
|
-
label: (0,
|
|
2628
|
+
label: (0, import_i18n14.__)("Name", "elementor"),
|
|
2570
2629
|
errorMsg: labelFieldError?.message,
|
|
2571
2630
|
noticeMsg: labelHint(label)
|
|
2572
2631
|
},
|
|
2573
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ React20.createElement(
|
|
2574
2633
|
LabelField,
|
|
2575
2634
|
{
|
|
2576
2635
|
id: "variable-label",
|
|
@@ -2589,7 +2648,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2589
2648
|
onKeyDown: handleKeyDown
|
|
2590
2649
|
}
|
|
2591
2650
|
)
|
|
2592
|
-
), ValueField && /* @__PURE__ */
|
|
2651
|
+
), ValueField && /* @__PURE__ */ React20.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n14.__)("Value", "elementor") }, /* @__PURE__ */ React20.createElement(import_ui20.Typography, { variant: "h5" }, /* @__PURE__ */ React20.createElement(
|
|
2593
2652
|
ValueField,
|
|
2594
2653
|
{
|
|
2595
2654
|
propTypeKey: variable.type,
|
|
@@ -2604,7 +2663,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2604
2663
|
onValidationChange: setValueFieldError,
|
|
2605
2664
|
propType
|
|
2606
2665
|
}
|
|
2607
|
-
))), errorMessage && /* @__PURE__ */
|
|
2666
|
+
))), errorMessage && /* @__PURE__ */ React20.createElement(import_ui20.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React20.createElement(import_ui20.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React20.createElement(import_ui20.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n14.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React20.createElement(
|
|
2608
2667
|
DeleteConfirmationDialog,
|
|
2609
2668
|
{
|
|
2610
2669
|
open: true,
|
|
@@ -2612,7 +2671,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2612
2671
|
onConfirm: handleDelete,
|
|
2613
2672
|
closeDialog: closeDeleteDialog()
|
|
2614
2673
|
}
|
|
2615
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2674
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React20.createElement(
|
|
2616
2675
|
EditConfirmationDialog,
|
|
2617
2676
|
{
|
|
2618
2677
|
closeDialog: closeEditDialog(),
|
|
@@ -2623,26 +2682,26 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2623
2682
|
};
|
|
2624
2683
|
|
|
2625
2684
|
// src/components/variables-selection.tsx
|
|
2626
|
-
var
|
|
2627
|
-
var
|
|
2685
|
+
var import_react20 = require("react");
|
|
2686
|
+
var React22 = __toESM(require("react"));
|
|
2628
2687
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2629
2688
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2630
2689
|
var import_icons11 = require("@elementor/icons");
|
|
2631
|
-
var
|
|
2632
|
-
var
|
|
2690
|
+
var import_ui23 = require("@elementor/ui");
|
|
2691
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2633
2692
|
|
|
2634
2693
|
// src/components/ui/menu-item-content.tsx
|
|
2635
|
-
var
|
|
2694
|
+
var React21 = __toESM(require("react"));
|
|
2636
2695
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2637
2696
|
var import_icons10 = require("@elementor/icons");
|
|
2638
|
-
var
|
|
2639
|
-
var
|
|
2697
|
+
var import_ui21 = require("@elementor/ui");
|
|
2698
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2640
2699
|
var SIZE4 = "tiny";
|
|
2641
|
-
var EDIT_LABEL = (0,
|
|
2700
|
+
var EDIT_LABEL = (0, import_i18n15.__)("Edit variable", "elementor");
|
|
2642
2701
|
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2643
2702
|
const onEdit = item.onEdit;
|
|
2644
|
-
return /* @__PURE__ */
|
|
2645
|
-
|
|
2703
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(import_ui21.ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React21.createElement(
|
|
2704
|
+
import_ui21.Box,
|
|
2646
2705
|
{
|
|
2647
2706
|
sx: {
|
|
2648
2707
|
flex: 1,
|
|
@@ -2652,30 +2711,30 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2652
2711
|
gap: 1
|
|
2653
2712
|
}
|
|
2654
2713
|
},
|
|
2655
|
-
/* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ React21.createElement(
|
|
2656
2715
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2657
2716
|
{
|
|
2658
2717
|
title: item.label || item.value,
|
|
2659
|
-
as:
|
|
2718
|
+
as: import_ui21.Typography,
|
|
2660
2719
|
variant: "caption",
|
|
2661
2720
|
color: disabled ? "text.disabled" : "text.primary",
|
|
2662
2721
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2663
2722
|
maxWidth: "50%"
|
|
2664
2723
|
}
|
|
2665
2724
|
),
|
|
2666
|
-
item.secondaryText && /* @__PURE__ */
|
|
2725
|
+
item.secondaryText && /* @__PURE__ */ React21.createElement(
|
|
2667
2726
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2668
2727
|
{
|
|
2669
2728
|
title: item.secondaryText,
|
|
2670
|
-
as:
|
|
2729
|
+
as: import_ui21.Typography,
|
|
2671
2730
|
variant: "caption",
|
|
2672
2731
|
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2673
2732
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2674
2733
|
maxWidth: "50%"
|
|
2675
2734
|
}
|
|
2676
2735
|
)
|
|
2677
|
-
), !!onEdit && !disabled && /* @__PURE__ */
|
|
2678
|
-
|
|
2736
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React21.createElement(import_ui21.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2737
|
+
import_ui21.IconButton,
|
|
2679
2738
|
{
|
|
2680
2739
|
sx: { mx: 1, opacity: "0" },
|
|
2681
2740
|
onClick: (e) => {
|
|
@@ -2684,13 +2743,13 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2684
2743
|
},
|
|
2685
2744
|
"aria-label": EDIT_LABEL
|
|
2686
2745
|
},
|
|
2687
|
-
/* @__PURE__ */
|
|
2746
|
+
/* @__PURE__ */ React21.createElement(import_icons10.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2688
2747
|
)));
|
|
2689
2748
|
};
|
|
2690
2749
|
|
|
2691
2750
|
// src/components/ui/styled-menu-list.tsx
|
|
2692
|
-
var
|
|
2693
|
-
var VariablesStyledMenuList = (0,
|
|
2751
|
+
var import_ui22 = require("@elementor/ui");
|
|
2752
|
+
var VariablesStyledMenuList = (0, import_ui22.styled)(import_ui22.MenuList)(({ theme, disabled }) => ({
|
|
2694
2753
|
"& > li": {
|
|
2695
2754
|
height: 32,
|
|
2696
2755
|
width: "100%",
|
|
@@ -2724,13 +2783,13 @@ var VariablesStyledMenuList = (0, import_ui20.styled)(import_ui20.MenuList)(({ t
|
|
|
2724
2783
|
|
|
2725
2784
|
// src/components/variables-selection.tsx
|
|
2726
2785
|
var SIZE5 = "tiny";
|
|
2727
|
-
var CREATE_LABEL = (0,
|
|
2728
|
-
var MANAGER_LABEL = (0,
|
|
2786
|
+
var CREATE_LABEL = (0, import_i18n16.__)("Create variable", "elementor");
|
|
2787
|
+
var MANAGER_LABEL = (0, import_i18n16.__)("Variables Manager", "elementor");
|
|
2729
2788
|
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license-panel-${variableType}-variable`;
|
|
2730
2789
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2731
2790
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2732
2791
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2733
|
-
const [searchValue, setSearchValue] = (0,
|
|
2792
|
+
const [searchValue, setSearchValue] = (0, import_react20.useState)("");
|
|
2734
2793
|
const {
|
|
2735
2794
|
list: variables,
|
|
2736
2795
|
hasMatches: hasSearchResults,
|
|
@@ -2757,8 +2816,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2757
2816
|
const actions = [];
|
|
2758
2817
|
if (onAdd) {
|
|
2759
2818
|
actions.push(
|
|
2760
|
-
/* @__PURE__ */
|
|
2761
|
-
|
|
2819
|
+
/* @__PURE__ */ React22.createElement(import_ui23.Tooltip, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
|
|
2820
|
+
import_ui23.IconButton,
|
|
2762
2821
|
{
|
|
2763
2822
|
id: "add-variable-button",
|
|
2764
2823
|
size: SIZE5,
|
|
@@ -2766,7 +2825,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2766
2825
|
"aria-label": CREATE_LABEL,
|
|
2767
2826
|
disabled
|
|
2768
2827
|
},
|
|
2769
|
-
/* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ React22.createElement(import_icons11.PlusIcon, { fontSize: SIZE5 })
|
|
2770
2829
|
)))
|
|
2771
2830
|
);
|
|
2772
2831
|
}
|
|
@@ -2780,24 +2839,24 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2780
2839
|
});
|
|
2781
2840
|
};
|
|
2782
2841
|
actions.push(
|
|
2783
|
-
/* @__PURE__ */
|
|
2784
|
-
|
|
2842
|
+
/* @__PURE__ */ React22.createElement(import_ui23.Tooltip, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React22.createElement(
|
|
2843
|
+
import_ui23.IconButton,
|
|
2785
2844
|
{
|
|
2786
2845
|
id: "variables-manager-button",
|
|
2787
2846
|
size: SIZE5,
|
|
2788
2847
|
onClick: handleOpenManager,
|
|
2789
2848
|
"aria-label": MANAGER_LABEL
|
|
2790
2849
|
},
|
|
2791
|
-
/* @__PURE__ */
|
|
2850
|
+
/* @__PURE__ */ React22.createElement(import_icons11.SettingsIcon, { fontSize: SIZE5 })
|
|
2792
2851
|
))
|
|
2793
2852
|
);
|
|
2794
2853
|
}
|
|
2795
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2854
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2796
2855
|
const items = variables.map(({ value, label, key }) => ({
|
|
2797
2856
|
type: "item",
|
|
2798
2857
|
value: key,
|
|
2799
2858
|
label,
|
|
2800
|
-
icon: /* @__PURE__ */
|
|
2859
|
+
icon: /* @__PURE__ */ React22.createElement(StartIcon, { value }),
|
|
2801
2860
|
secondaryText: value,
|
|
2802
2861
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2803
2862
|
}));
|
|
@@ -2807,22 +2866,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2807
2866
|
const handleClearSearch = () => {
|
|
2808
2867
|
setSearchValue("");
|
|
2809
2868
|
};
|
|
2810
|
-
return /* @__PURE__ */
|
|
2869
|
+
return /* @__PURE__ */ React22.createElement(import_editor_ui9.SectionPopoverBody, null, /* @__PURE__ */ React22.createElement(
|
|
2811
2870
|
import_editor_ui9.PopoverHeader,
|
|
2812
2871
|
{
|
|
2813
|
-
title: (0,
|
|
2814
|
-
icon: /* @__PURE__ */
|
|
2872
|
+
title: (0, import_i18n16.__)("Variables", "elementor"),
|
|
2873
|
+
icon: /* @__PURE__ */ React22.createElement(import_icons11.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
2815
2874
|
onClose: closePopover,
|
|
2816
2875
|
actions
|
|
2817
2876
|
}
|
|
2818
|
-
), hasVariables && /* @__PURE__ */
|
|
2877
|
+
), hasVariables && /* @__PURE__ */ React22.createElement(
|
|
2819
2878
|
import_editor_ui9.SearchField,
|
|
2820
2879
|
{
|
|
2821
2880
|
value: searchValue,
|
|
2822
2881
|
onSearch: handleSearch,
|
|
2823
|
-
placeholder: (0,
|
|
2882
|
+
placeholder: (0, import_i18n16.__)("Search", "elementor")
|
|
2824
2883
|
}
|
|
2825
|
-
), /* @__PURE__ */
|
|
2884
|
+
), /* @__PURE__ */ React22.createElement(import_ui23.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(
|
|
2826
2885
|
import_editor_ui9.PopoverMenuList,
|
|
2827
2886
|
{
|
|
2828
2887
|
items,
|
|
@@ -2832,66 +2891,66 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2832
2891
|
},
|
|
2833
2892
|
selectedValue: variable,
|
|
2834
2893
|
"data-testid": `${variableType}-variables-list`,
|
|
2835
|
-
menuListTemplate: (props) => /* @__PURE__ */
|
|
2836
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2894
|
+
menuListTemplate: (props) => /* @__PURE__ */ React22.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2895
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React22.createElement(MenuItemContent, { item, disabled })
|
|
2837
2896
|
}
|
|
2838
|
-
), disabled && /* @__PURE__ */
|
|
2897
|
+
), disabled && /* @__PURE__ */ React22.createElement(
|
|
2839
2898
|
import_editor_ui10.PromotionAlert,
|
|
2840
2899
|
{
|
|
2841
|
-
message: (0,
|
|
2900
|
+
message: (0, import_i18n16.sprintf)(
|
|
2842
2901
|
/* translators: %s: Variable Type. */
|
|
2843
|
-
(0,
|
|
2902
|
+
(0, import_i18n16.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2844
2903
|
variableType
|
|
2845
2904
|
),
|
|
2846
2905
|
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2847
2906
|
}
|
|
2848
|
-
)), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2907
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React22.createElement(
|
|
2849
2908
|
NoSearchResults,
|
|
2850
2909
|
{
|
|
2851
2910
|
searchValue,
|
|
2852
2911
|
onClear: handleClearSearch,
|
|
2853
|
-
icon: /* @__PURE__ */
|
|
2912
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" })
|
|
2854
2913
|
}
|
|
2855
|
-
), disabled && !hasVariables && /* @__PURE__ */
|
|
2914
|
+
), disabled && !hasVariables && /* @__PURE__ */ React22.createElement(
|
|
2856
2915
|
EmptyState,
|
|
2857
2916
|
{
|
|
2858
|
-
title: (0,
|
|
2917
|
+
title: (0, import_i18n16.sprintf)(
|
|
2859
2918
|
/* translators: %s: Variable Type. */
|
|
2860
|
-
(0,
|
|
2919
|
+
(0, import_i18n16.__)("No %s variables yet", "elementor"),
|
|
2861
2920
|
variableType
|
|
2862
2921
|
),
|
|
2863
|
-
message: (0,
|
|
2922
|
+
message: (0, import_i18n16.sprintf)(
|
|
2864
2923
|
/* translators: %s: Variable Type. */
|
|
2865
|
-
(0,
|
|
2924
|
+
(0, import_i18n16.__)("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2866
2925
|
variableType
|
|
2867
2926
|
),
|
|
2868
|
-
icon: /* @__PURE__ */
|
|
2927
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" })
|
|
2869
2928
|
},
|
|
2870
2929
|
emptyState
|
|
2871
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2930
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React22.createElement(
|
|
2872
2931
|
EmptyState,
|
|
2873
2932
|
{
|
|
2874
|
-
title: (0,
|
|
2933
|
+
title: (0, import_i18n16.sprintf)(
|
|
2875
2934
|
/* translators: %s: Variable Type. */
|
|
2876
|
-
(0,
|
|
2935
|
+
(0, import_i18n16.__)("Create your first %s variable", "elementor"),
|
|
2877
2936
|
variableType
|
|
2878
2937
|
),
|
|
2879
|
-
message: (0,
|
|
2938
|
+
message: (0, import_i18n16.__)(
|
|
2880
2939
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2881
2940
|
"elementor"
|
|
2882
2941
|
),
|
|
2883
|
-
icon: /* @__PURE__ */
|
|
2942
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" }),
|
|
2884
2943
|
onAdd
|
|
2885
2944
|
}
|
|
2886
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2945
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React22.createElement(
|
|
2887
2946
|
EmptyState,
|
|
2888
2947
|
{
|
|
2889
|
-
title: (0,
|
|
2890
|
-
message: (0,
|
|
2948
|
+
title: (0, import_i18n16.__)("No compatible variables", "elementor"),
|
|
2949
|
+
message: (0, import_i18n16.__)(
|
|
2891
2950
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2892
2951
|
"elementor"
|
|
2893
2952
|
),
|
|
2894
|
-
icon: /* @__PURE__ */
|
|
2953
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" }),
|
|
2895
2954
|
onAdd
|
|
2896
2955
|
}
|
|
2897
2956
|
));
|
|
@@ -2902,13 +2961,13 @@ var VIEW_LIST = "list";
|
|
|
2902
2961
|
var VIEW_ADD = "add";
|
|
2903
2962
|
var VIEW_EDIT = "edit";
|
|
2904
2963
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2905
|
-
const [currentView, setCurrentView] = (0,
|
|
2906
|
-
const [editId, setEditId] = (0,
|
|
2964
|
+
const [currentView, setCurrentView] = (0, import_react21.useState)(VIEW_LIST);
|
|
2965
|
+
const [editId, setEditId] = (0, import_react21.useState)("");
|
|
2907
2966
|
const { open } = usePanelActions();
|
|
2908
2967
|
const onSettingsAvailable = (0, import_editor_v1_adapters4.isExperimentActive)("e_variables_manager") ? () => {
|
|
2909
2968
|
open();
|
|
2910
2969
|
} : void 0;
|
|
2911
|
-
return /* @__PURE__ */
|
|
2970
|
+
return /* @__PURE__ */ React23.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React23.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2912
2971
|
propTypeKey,
|
|
2913
2972
|
currentView,
|
|
2914
2973
|
selectedVariable,
|
|
@@ -2955,7 +3014,7 @@ function RenderView(props) {
|
|
|
2955
3014
|
}
|
|
2956
3015
|
};
|
|
2957
3016
|
if (VIEW_LIST === props.currentView) {
|
|
2958
|
-
return /* @__PURE__ */
|
|
3017
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2959
3018
|
VariablesSelection,
|
|
2960
3019
|
{
|
|
2961
3020
|
closePopover: handlers.onClose,
|
|
@@ -2967,10 +3026,10 @@ function RenderView(props) {
|
|
|
2967
3026
|
);
|
|
2968
3027
|
}
|
|
2969
3028
|
if (VIEW_ADD === props.currentView) {
|
|
2970
|
-
return /* @__PURE__ */
|
|
3029
|
+
return /* @__PURE__ */ React23.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2971
3030
|
}
|
|
2972
3031
|
if (VIEW_EDIT === props.currentView) {
|
|
2973
|
-
return /* @__PURE__ */
|
|
3032
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2974
3033
|
VariableEdit,
|
|
2975
3034
|
{
|
|
2976
3035
|
editId: props.editId,
|
|
@@ -2984,26 +3043,26 @@ function RenderView(props) {
|
|
|
2984
3043
|
}
|
|
2985
3044
|
|
|
2986
3045
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2987
|
-
var
|
|
3046
|
+
var React24 = __toESM(require("react"));
|
|
2988
3047
|
var import_icons12 = require("@elementor/icons");
|
|
2989
|
-
var
|
|
2990
|
-
var
|
|
3048
|
+
var import_ui24 = require("@elementor/ui");
|
|
3049
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2991
3050
|
var SIZE6 = "tiny";
|
|
2992
|
-
var UNLINK_LABEL = (0,
|
|
3051
|
+
var UNLINK_LABEL = (0, import_i18n17.__)("Unlink variable", "elementor");
|
|
2993
3052
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2994
3053
|
const actions = [];
|
|
2995
3054
|
if (onUnlink) {
|
|
2996
3055
|
actions.push(
|
|
2997
|
-
/* @__PURE__ */
|
|
3056
|
+
/* @__PURE__ */ React24.createElement(import_ui24.Tooltip, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React24.createElement(import_ui24.IconButton, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React24.createElement(import_icons12.DetachIcon, { fontSize: SIZE6 })))
|
|
2998
3057
|
);
|
|
2999
3058
|
}
|
|
3000
|
-
return /* @__PURE__ */
|
|
3001
|
-
|
|
3059
|
+
return /* @__PURE__ */ React24.createElement(import_ui24.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React24.createElement(
|
|
3060
|
+
import_ui24.UnstableTag,
|
|
3002
3061
|
{
|
|
3003
3062
|
fullWidth: true,
|
|
3004
3063
|
showActionsOnHover: true,
|
|
3005
|
-
startIcon: /* @__PURE__ */
|
|
3006
|
-
label: /* @__PURE__ */
|
|
3064
|
+
startIcon: /* @__PURE__ */ React24.createElement(import_ui24.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
3065
|
+
label: /* @__PURE__ */ React24.createElement(import_ui24.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React24.createElement(import_ui24.Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
3007
3066
|
actions,
|
|
3008
3067
|
...props
|
|
3009
3068
|
}
|
|
@@ -3014,24 +3073,24 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3014
3073
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3015
3074
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3016
3075
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
3017
|
-
const anchorRef = (0,
|
|
3018
|
-
const popupId = (0,
|
|
3019
|
-
const popupState = (0,
|
|
3076
|
+
const anchorRef = (0, import_react22.useRef)(null);
|
|
3077
|
+
const popupId = (0, import_react22.useId)();
|
|
3078
|
+
const popupState = (0, import_ui25.usePopupState)({
|
|
3020
3079
|
variant: "popover",
|
|
3021
3080
|
popupId: `elementor-variables-list-${popupId}`
|
|
3022
3081
|
});
|
|
3023
3082
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
3024
3083
|
const StartIcon = startIcon || (() => null);
|
|
3025
|
-
return /* @__PURE__ */
|
|
3084
|
+
return /* @__PURE__ */ React25.createElement(import_ui25.Box, { ref: anchorRef }, /* @__PURE__ */ React25.createElement(
|
|
3026
3085
|
AssignedTag,
|
|
3027
3086
|
{
|
|
3028
3087
|
label: variable.label,
|
|
3029
|
-
startIcon: /* @__PURE__ */
|
|
3088
|
+
startIcon: /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(import_icons13.ColorFilterIcon, { fontSize: SIZE6 }), /* @__PURE__ */ React25.createElement(StartIcon, { value: variable.value })),
|
|
3030
3089
|
onUnlink: unlinkVariable,
|
|
3031
|
-
...(0,
|
|
3090
|
+
...(0, import_ui25.bindTrigger)(popupState)
|
|
3032
3091
|
}
|
|
3033
|
-
), /* @__PURE__ */
|
|
3034
|
-
|
|
3092
|
+
), /* @__PURE__ */ React25.createElement(
|
|
3093
|
+
import_ui25.Popover,
|
|
3035
3094
|
{
|
|
3036
3095
|
disableScrollLock: true,
|
|
3037
3096
|
anchorEl: anchorRef.current,
|
|
@@ -3040,9 +3099,9 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3040
3099
|
PaperProps: {
|
|
3041
3100
|
sx: { my: 1 }
|
|
3042
3101
|
},
|
|
3043
|
-
...(0,
|
|
3102
|
+
...(0, import_ui25.bindPopover)(popupState)
|
|
3044
3103
|
},
|
|
3045
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ React25.createElement(
|
|
3046
3105
|
VariableSelectionPopover,
|
|
3047
3106
|
{
|
|
3048
3107
|
selectedVariable: variable,
|
|
@@ -3054,19 +3113,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3054
3113
|
};
|
|
3055
3114
|
|
|
3056
3115
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3057
|
-
var
|
|
3058
|
-
var
|
|
3116
|
+
var React29 = __toESM(require("react"));
|
|
3117
|
+
var import_react24 = require("react");
|
|
3059
3118
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
3060
|
-
var
|
|
3061
|
-
var
|
|
3119
|
+
var import_ui29 = require("@elementor/ui");
|
|
3120
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
3062
3121
|
|
|
3063
3122
|
// src/components/variable-restore.tsx
|
|
3064
|
-
var
|
|
3065
|
-
var
|
|
3123
|
+
var React26 = __toESM(require("react"));
|
|
3124
|
+
var import_react23 = require("react");
|
|
3066
3125
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
3067
3126
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3068
|
-
var
|
|
3069
|
-
var
|
|
3127
|
+
var import_ui26 = require("@elementor/ui");
|
|
3128
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
3070
3129
|
var SIZE7 = "tiny";
|
|
3071
3130
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
3072
3131
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -3076,11 +3135,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3076
3135
|
if (!variable) {
|
|
3077
3136
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3078
3137
|
}
|
|
3079
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3080
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
3081
|
-
const [label, setLabel] = (0,
|
|
3082
|
-
const [value, setValue] = (0,
|
|
3083
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
3138
|
+
const [errorMessage, setErrorMessage] = (0, import_react23.useState)("");
|
|
3139
|
+
const [valueFieldError, setValueFieldError] = (0, import_react23.useState)("");
|
|
3140
|
+
const [label, setLabel] = (0, import_react23.useState)(variable.label);
|
|
3141
|
+
const [value, setValue] = (0, import_react23.useState)(variable.value);
|
|
3142
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react23.useState)(variable?.type ?? propTypeUtil.key);
|
|
3084
3143
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3085
3144
|
value: variable.label,
|
|
3086
3145
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3126,22 +3185,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3126
3185
|
handleRestore();
|
|
3127
3186
|
}
|
|
3128
3187
|
};
|
|
3129
|
-
return /* @__PURE__ */
|
|
3188
|
+
return /* @__PURE__ */ React26.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React26.createElement(import_editor_ui11.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React26.createElement(
|
|
3130
3189
|
import_editor_ui11.PopoverHeader,
|
|
3131
3190
|
{
|
|
3132
|
-
icon: /* @__PURE__ */
|
|
3133
|
-
title: (0,
|
|
3191
|
+
icon: /* @__PURE__ */ React26.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3192
|
+
title: (0, import_i18n18.__)("Restore variable", "elementor"),
|
|
3134
3193
|
onClose
|
|
3135
3194
|
}
|
|
3136
|
-
), /* @__PURE__ */
|
|
3195
|
+
), /* @__PURE__ */ React26.createElement(import_ui26.Divider, null), /* @__PURE__ */ React26.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React26.createElement(
|
|
3137
3196
|
FormField,
|
|
3138
3197
|
{
|
|
3139
3198
|
id: "variable-label",
|
|
3140
|
-
label: (0,
|
|
3199
|
+
label: (0, import_i18n18.__)("Name", "elementor"),
|
|
3141
3200
|
errorMsg: labelFieldError?.message,
|
|
3142
3201
|
noticeMsg: labelHint(label)
|
|
3143
3202
|
},
|
|
3144
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ React26.createElement(
|
|
3145
3204
|
LabelField,
|
|
3146
3205
|
{
|
|
3147
3206
|
id: "variable-label",
|
|
@@ -3160,7 +3219,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3160
3219
|
onKeyDown: handleKeyDown
|
|
3161
3220
|
}
|
|
3162
3221
|
)
|
|
3163
|
-
), ValueField && /* @__PURE__ */
|
|
3222
|
+
), ValueField && /* @__PURE__ */ React26.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n18.__)("Value", "elementor") }, /* @__PURE__ */ React26.createElement(import_ui26.Typography, { variant: "h5" }, /* @__PURE__ */ React26.createElement(
|
|
3164
3223
|
ValueField,
|
|
3165
3224
|
{
|
|
3166
3225
|
propTypeKey,
|
|
@@ -3175,25 +3234,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3175
3234
|
propType,
|
|
3176
3235
|
onKeyDown: handleKeyDown
|
|
3177
3236
|
}
|
|
3178
|
-
))), errorMessage && /* @__PURE__ */
|
|
3237
|
+
))), errorMessage && /* @__PURE__ */ React26.createElement(import_ui26.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React26.createElement(import_ui26.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React26.createElement(import_ui26.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n18.__)("Restore", "elementor")))));
|
|
3179
3238
|
};
|
|
3180
3239
|
|
|
3181
3240
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3182
|
-
var
|
|
3183
|
-
var
|
|
3184
|
-
var
|
|
3241
|
+
var React27 = __toESM(require("react"));
|
|
3242
|
+
var import_ui27 = require("@elementor/ui");
|
|
3243
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
3185
3244
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3186
|
-
return /* @__PURE__ */
|
|
3187
|
-
|
|
3245
|
+
return /* @__PURE__ */ React27.createElement(import_ui27.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React27.createElement(
|
|
3246
|
+
import_ui27.Alert,
|
|
3188
3247
|
{
|
|
3189
3248
|
variant: "standard",
|
|
3190
3249
|
severity: "warning",
|
|
3191
3250
|
onClose,
|
|
3192
|
-
action: /* @__PURE__ */
|
|
3251
|
+
action: /* @__PURE__ */ React27.createElement(React27.Fragment, null, onUnlink && /* @__PURE__ */ React27.createElement(import_ui27.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n19.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React27.createElement(import_ui27.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n19.__)("Restore", "elementor"))),
|
|
3193
3252
|
sx: { maxWidth: 300 }
|
|
3194
3253
|
},
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
3254
|
+
/* @__PURE__ */ React27.createElement(import_ui27.AlertTitle, null, (0, import_i18n19.__)("Deleted variable", "elementor")),
|
|
3255
|
+
/* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n19.__)("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", (0, import_i18n19.__)(
|
|
3197
3256
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3198
3257
|
"elementor"
|
|
3199
3258
|
))
|
|
@@ -3201,14 +3260,14 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3201
3260
|
};
|
|
3202
3261
|
|
|
3203
3262
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3204
|
-
var
|
|
3263
|
+
var React28 = __toESM(require("react"));
|
|
3205
3264
|
var import_icons14 = require("@elementor/icons");
|
|
3206
|
-
var
|
|
3207
|
-
var WarningVariableTag =
|
|
3265
|
+
var import_ui28 = require("@elementor/ui");
|
|
3266
|
+
var WarningVariableTag = React28.forwardRef(
|
|
3208
3267
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3209
3268
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3210
|
-
return /* @__PURE__ */
|
|
3211
|
-
|
|
3269
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3270
|
+
import_ui28.Chip,
|
|
3212
3271
|
{
|
|
3213
3272
|
ref,
|
|
3214
3273
|
size: "tiny",
|
|
@@ -3216,8 +3275,8 @@ var WarningVariableTag = React26.forwardRef(
|
|
|
3216
3275
|
shape: "rounded",
|
|
3217
3276
|
variant: "standard",
|
|
3218
3277
|
onClick,
|
|
3219
|
-
icon: /* @__PURE__ */
|
|
3220
|
-
label: /* @__PURE__ */
|
|
3278
|
+
icon: /* @__PURE__ */ React28.createElement(import_icons14.AlertTriangleFilledIcon, null),
|
|
3279
|
+
label: /* @__PURE__ */ React28.createElement(import_ui28.Tooltip, { title: displayText, placement: "top" }, /* @__PURE__ */ React28.createElement(import_ui28.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React28.createElement(import_ui28.Typography, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3221
3280
|
sx: {
|
|
3222
3281
|
height: (theme) => theme.spacing(3.5),
|
|
3223
3282
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3236,12 +3295,12 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3236
3295
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3237
3296
|
const boundProp = (0, import_editor_controls8.useBoundProp)();
|
|
3238
3297
|
const userPermissions = usePermissions();
|
|
3239
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3298
|
+
const [showInfotip, setShowInfotip] = (0, import_react24.useState)(false);
|
|
3240
3299
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3241
3300
|
const closeInfotip = () => setShowInfotip(false);
|
|
3242
|
-
const deletedChipAnchorRef = (0,
|
|
3243
|
-
const popupId = (0,
|
|
3244
|
-
const popupState = (0,
|
|
3301
|
+
const deletedChipAnchorRef = (0, import_react24.useRef)(null);
|
|
3302
|
+
const popupId = (0, import_react24.useId)();
|
|
3303
|
+
const popupState = (0, import_ui29.usePopupState)({
|
|
3245
3304
|
variant: "popover",
|
|
3246
3305
|
popupId: `elementor-variables-restore-${popupId}`
|
|
3247
3306
|
});
|
|
@@ -3267,15 +3326,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3267
3326
|
const handleRestoreWithOverrides = () => {
|
|
3268
3327
|
popupState.close();
|
|
3269
3328
|
};
|
|
3270
|
-
return /* @__PURE__ */
|
|
3271
|
-
|
|
3329
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(import_ui29.Box, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React29.createElement(import_ui29.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React29.createElement(
|
|
3330
|
+
import_ui29.Infotip,
|
|
3272
3331
|
{
|
|
3273
3332
|
color: "warning",
|
|
3274
3333
|
placement: "right-start",
|
|
3275
3334
|
open: showInfotip,
|
|
3276
3335
|
disableHoverListener: true,
|
|
3277
3336
|
onClose: closeInfotip,
|
|
3278
|
-
content: /* @__PURE__ */
|
|
3337
|
+
content: /* @__PURE__ */ React29.createElement(
|
|
3279
3338
|
DeletedVariableAlert,
|
|
3280
3339
|
{
|
|
3281
3340
|
onClose: closeInfotip,
|
|
@@ -3295,16 +3354,16 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3295
3354
|
}
|
|
3296
3355
|
}
|
|
3297
3356
|
},
|
|
3298
|
-
/* @__PURE__ */
|
|
3357
|
+
/* @__PURE__ */ React29.createElement(
|
|
3299
3358
|
WarningVariableTag,
|
|
3300
3359
|
{
|
|
3301
3360
|
label: variable.label,
|
|
3302
3361
|
onClick: toggleInfotip,
|
|
3303
|
-
suffix: (0,
|
|
3362
|
+
suffix: (0, import_i18n20.__)("deleted", "elementor")
|
|
3304
3363
|
}
|
|
3305
3364
|
)
|
|
3306
|
-
), /* @__PURE__ */
|
|
3307
|
-
|
|
3365
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3366
|
+
import_ui29.Popover,
|
|
3308
3367
|
{
|
|
3309
3368
|
disableScrollLock: true,
|
|
3310
3369
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -3312,9 +3371,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3312
3371
|
PaperProps: {
|
|
3313
3372
|
sx: { my: 1 }
|
|
3314
3373
|
},
|
|
3315
|
-
...(0,
|
|
3374
|
+
...(0, import_ui29.bindPopover)(popupState)
|
|
3316
3375
|
},
|
|
3317
|
-
/* @__PURE__ */
|
|
3376
|
+
/* @__PURE__ */ React29.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React29.createElement(
|
|
3318
3377
|
VariableRestore,
|
|
3319
3378
|
{
|
|
3320
3379
|
variableId: variable.key ?? "",
|
|
@@ -3326,52 +3385,52 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3326
3385
|
};
|
|
3327
3386
|
|
|
3328
3387
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3329
|
-
var
|
|
3330
|
-
var
|
|
3388
|
+
var React31 = __toESM(require("react"));
|
|
3389
|
+
var import_react25 = require("react");
|
|
3331
3390
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3332
|
-
var
|
|
3333
|
-
var
|
|
3391
|
+
var import_ui31 = require("@elementor/ui");
|
|
3392
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
3334
3393
|
|
|
3335
3394
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3336
|
-
var
|
|
3337
|
-
var
|
|
3338
|
-
var
|
|
3395
|
+
var React30 = __toESM(require("react"));
|
|
3396
|
+
var import_ui30 = require("@elementor/ui");
|
|
3397
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
3339
3398
|
var i18n = {
|
|
3340
|
-
title: (0,
|
|
3341
|
-
message: (0,
|
|
3399
|
+
title: (0, import_i18n21.__)("Variable has changed", "elementor"),
|
|
3400
|
+
message: (0, import_i18n21.__)(
|
|
3342
3401
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3343
3402
|
"elementor"
|
|
3344
3403
|
),
|
|
3345
3404
|
buttons: {
|
|
3346
|
-
clear: (0,
|
|
3347
|
-
select: (0,
|
|
3405
|
+
clear: (0, import_i18n21.__)("Clear", "elementor"),
|
|
3406
|
+
select: (0, import_i18n21.__)("Select variable", "elementor")
|
|
3348
3407
|
}
|
|
3349
3408
|
};
|
|
3350
3409
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3351
|
-
return /* @__PURE__ */
|
|
3352
|
-
|
|
3410
|
+
return /* @__PURE__ */ React30.createElement(import_ui30.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React30.createElement(
|
|
3411
|
+
import_ui30.Alert,
|
|
3353
3412
|
{
|
|
3354
3413
|
variant: "standard",
|
|
3355
3414
|
severity: "warning",
|
|
3356
3415
|
onClose,
|
|
3357
|
-
action: /* @__PURE__ */
|
|
3416
|
+
action: /* @__PURE__ */ React30.createElement(React30.Fragment, null, onClear && /* @__PURE__ */ React30.createElement(import_ui30.AlertAction, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React30.createElement(import_ui30.AlertAction, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3358
3417
|
sx: { maxWidth: 300 }
|
|
3359
3418
|
},
|
|
3360
|
-
/* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ React30.createElement(import_ui30.AlertTitle, null, i18n.title),
|
|
3420
|
+
/* @__PURE__ */ React30.createElement(import_ui30.Typography, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3362
3421
|
));
|
|
3363
3422
|
};
|
|
3364
3423
|
|
|
3365
3424
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3366
3425
|
var MismatchVariable = ({ variable }) => {
|
|
3367
3426
|
const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
|
|
3368
|
-
const anchorRef = (0,
|
|
3369
|
-
const popupId = (0,
|
|
3370
|
-
const popupState = (0,
|
|
3427
|
+
const anchorRef = (0, import_react25.useRef)(null);
|
|
3428
|
+
const popupId = (0, import_react25.useId)();
|
|
3429
|
+
const popupState = (0, import_ui31.usePopupState)({
|
|
3371
3430
|
variant: "popover",
|
|
3372
3431
|
popupId: `elementor-variables-list-${popupId}`
|
|
3373
3432
|
});
|
|
3374
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3433
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react25.useState)(false);
|
|
3375
3434
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3376
3435
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3377
3436
|
const triggerSelect = () => {
|
|
@@ -3384,15 +3443,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3384
3443
|
setValue(null);
|
|
3385
3444
|
};
|
|
3386
3445
|
const showClearButton = !!value;
|
|
3387
|
-
return /* @__PURE__ */
|
|
3388
|
-
|
|
3446
|
+
return /* @__PURE__ */ React31.createElement(import_ui31.Box, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React31.createElement(import_ui31.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React31.createElement(
|
|
3447
|
+
import_ui31.Infotip,
|
|
3389
3448
|
{
|
|
3390
3449
|
color: "warning",
|
|
3391
3450
|
placement: "right-start",
|
|
3392
3451
|
open: infotipVisible,
|
|
3393
3452
|
disableHoverListener: true,
|
|
3394
3453
|
onClose: closeInfotip,
|
|
3395
|
-
content: /* @__PURE__ */
|
|
3454
|
+
content: /* @__PURE__ */ React31.createElement(
|
|
3396
3455
|
MismatchVariableAlert,
|
|
3397
3456
|
{
|
|
3398
3457
|
onClose: closeInfotip,
|
|
@@ -3411,16 +3470,16 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3411
3470
|
}
|
|
3412
3471
|
}
|
|
3413
3472
|
},
|
|
3414
|
-
/* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ React31.createElement(
|
|
3415
3474
|
WarningVariableTag,
|
|
3416
3475
|
{
|
|
3417
3476
|
label: variable.label,
|
|
3418
3477
|
onClick: toggleInfotip,
|
|
3419
|
-
suffix: (0,
|
|
3478
|
+
suffix: (0, import_i18n22.__)("changed", "elementor")
|
|
3420
3479
|
}
|
|
3421
3480
|
)
|
|
3422
|
-
), /* @__PURE__ */
|
|
3423
|
-
|
|
3481
|
+
), /* @__PURE__ */ React31.createElement(
|
|
3482
|
+
import_ui31.Popover,
|
|
3424
3483
|
{
|
|
3425
3484
|
disableScrollLock: true,
|
|
3426
3485
|
anchorEl: anchorRef.current,
|
|
@@ -3429,9 +3488,9 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3429
3488
|
PaperProps: {
|
|
3430
3489
|
sx: { my: 1 }
|
|
3431
3490
|
},
|
|
3432
|
-
...(0,
|
|
3491
|
+
...(0, import_ui31.bindPopover)(popupState)
|
|
3433
3492
|
},
|
|
3434
|
-
/* @__PURE__ */
|
|
3493
|
+
/* @__PURE__ */ React31.createElement(
|
|
3435
3494
|
VariableSelectionPopover,
|
|
3436
3495
|
{
|
|
3437
3496
|
selectedVariable: variable,
|
|
@@ -3443,28 +3502,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3443
3502
|
};
|
|
3444
3503
|
|
|
3445
3504
|
// src/components/ui/variable/missing-variable.tsx
|
|
3446
|
-
var
|
|
3447
|
-
var
|
|
3505
|
+
var React33 = __toESM(require("react"));
|
|
3506
|
+
var import_react26 = require("react");
|
|
3448
3507
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3449
|
-
var
|
|
3450
|
-
var
|
|
3508
|
+
var import_ui33 = require("@elementor/ui");
|
|
3509
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3451
3510
|
|
|
3452
3511
|
// src/components/ui/missing-variable-alert.tsx
|
|
3453
|
-
var
|
|
3454
|
-
var
|
|
3455
|
-
var
|
|
3512
|
+
var React32 = __toESM(require("react"));
|
|
3513
|
+
var import_ui32 = require("@elementor/ui");
|
|
3514
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
3456
3515
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3457
|
-
return /* @__PURE__ */
|
|
3458
|
-
|
|
3516
|
+
return /* @__PURE__ */ React32.createElement(import_ui32.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React32.createElement(
|
|
3517
|
+
import_ui32.Alert,
|
|
3459
3518
|
{
|
|
3460
3519
|
variant: "standard",
|
|
3461
3520
|
severity: "warning",
|
|
3462
3521
|
onClose,
|
|
3463
|
-
action: /* @__PURE__ */
|
|
3522
|
+
action: /* @__PURE__ */ React32.createElement(React32.Fragment, null, onClear && /* @__PURE__ */ React32.createElement(import_ui32.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n23.__)("Clear", "elementor"))),
|
|
3464
3523
|
sx: { maxWidth: 300 }
|
|
3465
3524
|
},
|
|
3466
|
-
/* @__PURE__ */
|
|
3467
|
-
/* @__PURE__ */
|
|
3525
|
+
/* @__PURE__ */ React32.createElement(import_ui32.AlertTitle, null, (0, import_i18n23.__)("This variable is missing", "elementor")),
|
|
3526
|
+
/* @__PURE__ */ React32.createElement(import_ui32.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n23.__)(
|
|
3468
3527
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3469
3528
|
"elementor"
|
|
3470
3529
|
))
|
|
@@ -3474,19 +3533,19 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3474
3533
|
// src/components/ui/variable/missing-variable.tsx
|
|
3475
3534
|
var MissingVariable = () => {
|
|
3476
3535
|
const { setValue } = (0, import_editor_controls10.useBoundProp)();
|
|
3477
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3536
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react26.useState)(false);
|
|
3478
3537
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3479
3538
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3480
3539
|
const clearValue = () => setValue(null);
|
|
3481
|
-
return /* @__PURE__ */
|
|
3482
|
-
|
|
3540
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, infotipVisible && /* @__PURE__ */ React33.createElement(import_ui33.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React33.createElement(
|
|
3541
|
+
import_ui33.Infotip,
|
|
3483
3542
|
{
|
|
3484
3543
|
color: "warning",
|
|
3485
3544
|
placement: "right-start",
|
|
3486
3545
|
open: infotipVisible,
|
|
3487
3546
|
disableHoverListener: true,
|
|
3488
3547
|
onClose: closeInfotip,
|
|
3489
|
-
content: /* @__PURE__ */
|
|
3548
|
+
content: /* @__PURE__ */ React33.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3490
3549
|
slotProps: {
|
|
3491
3550
|
popper: {
|
|
3492
3551
|
modifiers: [
|
|
@@ -3498,7 +3557,7 @@ var MissingVariable = () => {
|
|
|
3498
3557
|
}
|
|
3499
3558
|
}
|
|
3500
3559
|
},
|
|
3501
|
-
/* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ React33.createElement(WarningVariableTag, { label: (0, import_i18n24.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3502
3561
|
));
|
|
3503
3562
|
};
|
|
3504
3563
|
|
|
@@ -3508,37 +3567,37 @@ var VariableControl = () => {
|
|
|
3508
3567
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3509
3568
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3510
3569
|
if (!assignedVariable) {
|
|
3511
|
-
return /* @__PURE__ */
|
|
3570
|
+
return /* @__PURE__ */ React34.createElement(MissingVariable, null);
|
|
3512
3571
|
}
|
|
3513
3572
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3514
3573
|
if (assignedVariable?.deleted) {
|
|
3515
|
-
return /* @__PURE__ */
|
|
3574
|
+
return /* @__PURE__ */ React34.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3516
3575
|
}
|
|
3517
3576
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3518
3577
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3519
|
-
return /* @__PURE__ */
|
|
3578
|
+
return /* @__PURE__ */ React34.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3520
3579
|
}
|
|
3521
|
-
return /* @__PURE__ */
|
|
3580
|
+
return /* @__PURE__ */ React34.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3522
3581
|
};
|
|
3523
3582
|
|
|
3524
3583
|
// src/hooks/use-prop-variable-action.tsx
|
|
3525
|
-
var
|
|
3584
|
+
var React35 = __toESM(require("react"));
|
|
3526
3585
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
3527
3586
|
var import_icons15 = require("@elementor/icons");
|
|
3528
|
-
var
|
|
3587
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3529
3588
|
var usePropVariableAction = () => {
|
|
3530
3589
|
const { propType, path } = (0, import_editor_controls12.useBoundProp)();
|
|
3531
3590
|
const variable = resolveVariableFromPropType(propType);
|
|
3532
3591
|
return {
|
|
3533
3592
|
visible: Boolean(variable),
|
|
3534
3593
|
icon: import_icons15.ColorFilterIcon,
|
|
3535
|
-
title: (0,
|
|
3594
|
+
title: (0, import_i18n25.__)("Variables", "elementor"),
|
|
3536
3595
|
content: ({ close: closePopover }) => {
|
|
3537
3596
|
if (!variable) {
|
|
3538
3597
|
return null;
|
|
3539
3598
|
}
|
|
3540
3599
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3541
|
-
return /* @__PURE__ */
|
|
3600
|
+
return /* @__PURE__ */ React35.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3542
3601
|
}
|
|
3543
3602
|
};
|
|
3544
3603
|
};
|
|
@@ -3685,21 +3744,21 @@ function initMcp() {
|
|
|
3685
3744
|
}
|
|
3686
3745
|
|
|
3687
3746
|
// src/register-variable-types.tsx
|
|
3688
|
-
var
|
|
3747
|
+
var React38 = __toESM(require("react"));
|
|
3689
3748
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3690
3749
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
3691
3750
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3692
3751
|
var import_icons17 = require("@elementor/icons");
|
|
3693
|
-
var
|
|
3752
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
3694
3753
|
|
|
3695
3754
|
// src/components/fields/color-field.tsx
|
|
3696
|
-
var
|
|
3697
|
-
var
|
|
3698
|
-
var
|
|
3755
|
+
var React36 = __toESM(require("react"));
|
|
3756
|
+
var import_react27 = require("react");
|
|
3757
|
+
var import_ui34 = require("@elementor/ui");
|
|
3699
3758
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3700
|
-
const [color, setColor] = (0,
|
|
3701
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3702
|
-
const defaultRef = (0,
|
|
3759
|
+
const [color, setColor] = (0, import_react27.useState)(value);
|
|
3760
|
+
const [errorMessage, setErrorMessage] = (0, import_react27.useState)("");
|
|
3761
|
+
const defaultRef = (0, import_react27.useRef)(null);
|
|
3703
3762
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3704
3763
|
const handleChange = (newValue) => {
|
|
3705
3764
|
setColor(newValue);
|
|
@@ -3708,8 +3767,8 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3708
3767
|
onValidationChange?.(errorMsg);
|
|
3709
3768
|
onChange(errorMsg ? "" : newValue);
|
|
3710
3769
|
};
|
|
3711
|
-
return /* @__PURE__ */
|
|
3712
|
-
|
|
3770
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3771
|
+
import_ui34.UnstableColorField,
|
|
3713
3772
|
{
|
|
3714
3773
|
id: "color-variable-field",
|
|
3715
3774
|
size: "tiny",
|
|
@@ -3737,21 +3796,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3737
3796
|
};
|
|
3738
3797
|
|
|
3739
3798
|
// src/components/fields/font-field.tsx
|
|
3740
|
-
var
|
|
3741
|
-
var
|
|
3799
|
+
var React37 = __toESM(require("react"));
|
|
3800
|
+
var import_react28 = require("react");
|
|
3742
3801
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
3743
3802
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3744
3803
|
var import_icons16 = require("@elementor/icons");
|
|
3745
|
-
var
|
|
3746
|
-
var
|
|
3804
|
+
var import_ui35 = require("@elementor/ui");
|
|
3805
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
3747
3806
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3748
|
-
const [fontFamily, setFontFamily] = (0,
|
|
3749
|
-
const defaultRef = (0,
|
|
3807
|
+
const [fontFamily, setFontFamily] = (0, import_react28.useState)(value);
|
|
3808
|
+
const defaultRef = (0, import_react28.useRef)(null);
|
|
3750
3809
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3751
|
-
const fontPopoverState = (0,
|
|
3810
|
+
const fontPopoverState = (0, import_ui35.usePopupState)({ variant: "popover" });
|
|
3752
3811
|
const fontFamilies = (0, import_editor_controls13.useFontFamilies)();
|
|
3753
3812
|
const sectionWidth = (0, import_editor_ui12.useSectionWidth)();
|
|
3754
|
-
const mapFontSubs =
|
|
3813
|
+
const mapFontSubs = React37.useMemo(() => {
|
|
3755
3814
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3756
3815
|
label,
|
|
3757
3816
|
items: fonts
|
|
@@ -3767,28 +3826,28 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3767
3826
|
handleChange(newFontFamily);
|
|
3768
3827
|
fontPopoverState.close();
|
|
3769
3828
|
};
|
|
3770
|
-
const id2 = (0,
|
|
3771
|
-
return /* @__PURE__ */
|
|
3772
|
-
|
|
3829
|
+
const id2 = (0, import_react28.useId)();
|
|
3830
|
+
return /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(
|
|
3831
|
+
import_ui35.UnstableTag,
|
|
3773
3832
|
{
|
|
3774
3833
|
id: id2,
|
|
3775
3834
|
variant: "outlined",
|
|
3776
3835
|
label: fontFamily,
|
|
3777
|
-
endIcon: /* @__PURE__ */
|
|
3778
|
-
...(0,
|
|
3836
|
+
endIcon: /* @__PURE__ */ React37.createElement(import_icons16.ChevronDownIcon, { fontSize: "tiny" }),
|
|
3837
|
+
...(0, import_ui35.bindTrigger)(fontPopoverState),
|
|
3779
3838
|
fullWidth: true
|
|
3780
3839
|
}
|
|
3781
|
-
), /* @__PURE__ */
|
|
3782
|
-
|
|
3840
|
+
), /* @__PURE__ */ React37.createElement(
|
|
3841
|
+
import_ui35.Popover,
|
|
3783
3842
|
{
|
|
3784
3843
|
disablePortal: true,
|
|
3785
3844
|
disableScrollLock: true,
|
|
3786
3845
|
anchorEl: anchorRef,
|
|
3787
3846
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3788
3847
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3789
|
-
...(0,
|
|
3848
|
+
...(0, import_ui35.bindPopover)(fontPopoverState)
|
|
3790
3849
|
},
|
|
3791
|
-
/* @__PURE__ */
|
|
3850
|
+
/* @__PURE__ */ React37.createElement(
|
|
3792
3851
|
import_editor_controls13.ItemSelector,
|
|
3793
3852
|
{
|
|
3794
3853
|
id: "font-family-variables-selector",
|
|
@@ -3797,7 +3856,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3797
3856
|
onItemChange: handleFontFamilyChange,
|
|
3798
3857
|
onClose: fontPopoverState.close,
|
|
3799
3858
|
sectionWidth,
|
|
3800
|
-
title: (0,
|
|
3859
|
+
title: (0, import_i18n26.__)("Font family", "elementor"),
|
|
3801
3860
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3802
3861
|
onDebounce: import_editor_controls13.enqueueFont,
|
|
3803
3862
|
icon: import_icons16.TextIcon
|
|
@@ -3826,7 +3885,7 @@ function registerVariableTypes() {
|
|
|
3826
3885
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3827
3886
|
fallbackPropTypeUtil: import_editor_props5.colorPropTypeUtil,
|
|
3828
3887
|
variableType: "color",
|
|
3829
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3888
|
+
startIcon: ({ value }) => /* @__PURE__ */ React38.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3830
3889
|
defaultValue: "#ffffff",
|
|
3831
3890
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3832
3891
|
const actions = [];
|
|
@@ -3835,14 +3894,14 @@ function registerVariableTypes() {
|
|
|
3835
3894
|
}
|
|
3836
3895
|
if (variable.sync_to_v3) {
|
|
3837
3896
|
actions.push({
|
|
3838
|
-
name: (0,
|
|
3897
|
+
name: (0, import_i18n27.__)("Stop syncing to Version 3", "elementor"),
|
|
3839
3898
|
icon: import_icons17.ResetIcon,
|
|
3840
3899
|
color: "text.primary",
|
|
3841
3900
|
onClick: () => handlers.onStopSync(variableId)
|
|
3842
3901
|
});
|
|
3843
3902
|
} else {
|
|
3844
3903
|
actions.push({
|
|
3845
|
-
name: (0,
|
|
3904
|
+
name: (0, import_i18n27.__)("Sync to Version 3", "elementor"),
|
|
3846
3905
|
icon: import_icons17.ResetIcon,
|
|
3847
3906
|
color: "text.primary",
|
|
3848
3907
|
onClick: () => handlers.onStartSync(variableId)
|
|
@@ -3868,7 +3927,7 @@ function registerVariableTypes() {
|
|
|
3868
3927
|
styleTransformer: EmptyTransformer,
|
|
3869
3928
|
variableType: "size",
|
|
3870
3929
|
selectionFilter: () => [],
|
|
3871
|
-
emptyState: /* @__PURE__ */
|
|
3930
|
+
emptyState: /* @__PURE__ */ React38.createElement(import_editor_ui13.CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3872
3931
|
};
|
|
3873
3932
|
registerVariableType({
|
|
3874
3933
|
...sizePromotions,
|
|
@@ -3882,10 +3941,10 @@ function registerVariableTypes() {
|
|
|
3882
3941
|
}
|
|
3883
3942
|
|
|
3884
3943
|
// src/renderers/style-variables-renderer.tsx
|
|
3885
|
-
var
|
|
3886
|
-
var
|
|
3944
|
+
var React39 = __toESM(require("react"));
|
|
3945
|
+
var import_react29 = require("react");
|
|
3887
3946
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3888
|
-
var
|
|
3947
|
+
var import_ui36 = require("@elementor/ui");
|
|
3889
3948
|
var VARIABLES_WRAPPER = "body";
|
|
3890
3949
|
function StyleVariablesRenderer() {
|
|
3891
3950
|
const container = usePortalContainer();
|
|
@@ -3896,14 +3955,14 @@ function StyleVariablesRenderer() {
|
|
|
3896
3955
|
}
|
|
3897
3956
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3898
3957
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3899
|
-
return /* @__PURE__ */
|
|
3958
|
+
return /* @__PURE__ */ React39.createElement(import_ui36.Portal, { container }, /* @__PURE__ */ React39.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3900
3959
|
}
|
|
3901
3960
|
function usePortalContainer() {
|
|
3902
3961
|
return (0, import_editor_v1_adapters6.__privateUseListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters6.getCanvasIframeDocument)()?.head);
|
|
3903
3962
|
}
|
|
3904
3963
|
function useStyleVariables() {
|
|
3905
|
-
const [variables, setVariables] = (0,
|
|
3906
|
-
(0,
|
|
3964
|
+
const [variables, setVariables] = (0, import_react29.useState)({});
|
|
3965
|
+
(0, import_react29.useEffect)(() => {
|
|
3907
3966
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3908
3967
|
return () => {
|
|
3909
3968
|
unsubscribe();
|
|
@@ -3926,22 +3985,22 @@ var import_editor_controls14 = require("@elementor/editor-controls");
|
|
|
3926
3985
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
3927
3986
|
|
|
3928
3987
|
// src/components/variables-repeater-item-slot.tsx
|
|
3929
|
-
var
|
|
3988
|
+
var React40 = __toESM(require("react"));
|
|
3930
3989
|
var useColorVariable = (value) => {
|
|
3931
3990
|
const variableId = value?.value?.color?.value;
|
|
3932
3991
|
return useVariable(variableId || "");
|
|
3933
3992
|
};
|
|
3934
3993
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3935
3994
|
const colorVariable = useColorVariable(value);
|
|
3936
|
-
return /* @__PURE__ */
|
|
3995
|
+
return /* @__PURE__ */ React40.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3937
3996
|
};
|
|
3938
3997
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3939
3998
|
const colorVariable = useColorVariable(value);
|
|
3940
|
-
return /* @__PURE__ */
|
|
3999
|
+
return /* @__PURE__ */ React40.createElement("span", null, colorVariable?.label);
|
|
3941
4000
|
};
|
|
3942
4001
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3943
4002
|
const colorVariable = useColorVariable(value);
|
|
3944
|
-
return /* @__PURE__ */
|
|
4003
|
+
return /* @__PURE__ */ React40.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3945
4004
|
};
|
|
3946
4005
|
|
|
3947
4006
|
// src/repeater-injections.ts
|