@elementor/editor-variables 4.0.0-551 → 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.mjs
CHANGED
|
@@ -6,11 +6,11 @@ import { isTransformable as isTransformable2 } from "@elementor/editor-props";
|
|
|
6
6
|
import { controlActionsMenu } from "@elementor/menus";
|
|
7
7
|
|
|
8
8
|
// src/components/open-panel-from-url.tsx
|
|
9
|
-
import { useEffect as useEffect4, useRef as
|
|
9
|
+
import { useEffect as useEffect4, useRef as useRef7 } from "react";
|
|
10
10
|
import { __privateListenTo as listenTo, routeOpenEvent } from "@elementor/editor-v1-adapters";
|
|
11
11
|
|
|
12
12
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
13
|
-
import * as
|
|
13
|
+
import * as React15 from "react";
|
|
14
14
|
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState7 } from "react";
|
|
15
15
|
import {
|
|
16
16
|
__createPanel as createPanel,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
Stack as Stack6,
|
|
35
35
|
usePopupState as usePopupState2
|
|
36
36
|
} from "@elementor/ui";
|
|
37
|
-
import { __ as
|
|
37
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
38
38
|
|
|
39
39
|
// src/utils/tracking.ts
|
|
40
40
|
import { getMixpanel } from "@elementor/events";
|
|
@@ -1125,19 +1125,18 @@ var useVariablesManagerState = () => {
|
|
|
1125
1125
|
};
|
|
1126
1126
|
|
|
1127
1127
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1128
|
-
import * as
|
|
1129
|
-
import { createElement as
|
|
1130
|
-
import { PromotionChip, PromotionPopover } from "@elementor/editor-ui";
|
|
1128
|
+
import * as React8 from "react";
|
|
1129
|
+
import { createElement as createElement9, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
1131
1130
|
import { PlusIcon } from "@elementor/icons";
|
|
1132
1131
|
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography6 } from "@elementor/ui";
|
|
1133
|
-
import { capitalize } from "@elementor/utils";
|
|
1134
|
-
import { __ as
|
|
1132
|
+
import { capitalize as capitalize2 } from "@elementor/utils";
|
|
1133
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
1135
1134
|
|
|
1136
1135
|
// src/hooks/use-quota-permissions.ts
|
|
1137
1136
|
var useQuotaPermissions = (variableType) => {
|
|
1138
1137
|
const quotaConfig = {
|
|
1139
|
-
...window.ElementorVariablesQuotaConfig
|
|
1140
|
-
...window.ElementorVariablesQuotaConfigExtended
|
|
1138
|
+
...window.ElementorVariablesQuotaConfig ?? {},
|
|
1139
|
+
...window.ElementorVariablesQuotaConfigExtended ?? {}
|
|
1141
1140
|
};
|
|
1142
1141
|
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1143
1142
|
const limit = quotaConfig[variableType] || 0;
|
|
@@ -1148,14 +1147,60 @@ var useQuotaPermissions = (variableType) => {
|
|
|
1148
1147
|
};
|
|
1149
1148
|
};
|
|
1150
1149
|
|
|
1150
|
+
// src/components/ui/variable-promotion-chip.tsx
|
|
1151
|
+
import * as React7 from "react";
|
|
1152
|
+
import { forwardRef, useImperativeHandle, useState as useState4 } from "react";
|
|
1153
|
+
import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
|
|
1154
|
+
import { Box } from "@elementor/ui";
|
|
1155
|
+
import { capitalize } from "@elementor/utils";
|
|
1156
|
+
import { __ as __8, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
1157
|
+
var VariablePromotionChip = forwardRef(
|
|
1158
|
+
({ variableType, upgradeUrl }, ref) => {
|
|
1159
|
+
const [isOpen, setIsOpen] = useState4(false);
|
|
1160
|
+
useCanvasClickHandler(isOpen, () => setIsOpen(false));
|
|
1161
|
+
const toggle = () => setIsOpen((prev) => !prev);
|
|
1162
|
+
useImperativeHandle(ref, () => ({ toggle }), []);
|
|
1163
|
+
const title = sprintf2(
|
|
1164
|
+
/* translators: %s: Variable Type. */
|
|
1165
|
+
__8("%s variables", "elementor"),
|
|
1166
|
+
capitalize(variableType)
|
|
1167
|
+
);
|
|
1168
|
+
const content = sprintf2(
|
|
1169
|
+
/* translators: %s: Variable Type. */
|
|
1170
|
+
__8("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1171
|
+
variableType
|
|
1172
|
+
);
|
|
1173
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1174
|
+
PromotionPopover,
|
|
1175
|
+
{
|
|
1176
|
+
open: isOpen,
|
|
1177
|
+
title,
|
|
1178
|
+
content,
|
|
1179
|
+
ctaText: __8("Upgrade now", "elementor"),
|
|
1180
|
+
ctaUrl: upgradeUrl,
|
|
1181
|
+
onClose: (e) => {
|
|
1182
|
+
e.stopPropagation();
|
|
1183
|
+
setIsOpen(false);
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
/* @__PURE__ */ React7.createElement(
|
|
1187
|
+
Box,
|
|
1188
|
+
{
|
|
1189
|
+
onClick: (e) => {
|
|
1190
|
+
e.stopPropagation();
|
|
1191
|
+
toggle();
|
|
1192
|
+
},
|
|
1193
|
+
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1194
|
+
},
|
|
1195
|
+
/* @__PURE__ */ React7.createElement(PromotionChip, null)
|
|
1196
|
+
)
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
);
|
|
1200
|
+
|
|
1151
1201
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1152
1202
|
var SIZE = "tiny";
|
|
1153
|
-
var VariableManagerCreateMenu = ({
|
|
1154
|
-
variables,
|
|
1155
|
-
onCreate,
|
|
1156
|
-
disabled,
|
|
1157
|
-
menuState
|
|
1158
|
-
}) => {
|
|
1203
|
+
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1159
1204
|
const buttonRef = useRef2(null);
|
|
1160
1205
|
const variableTypes = getVariableTypes();
|
|
1161
1206
|
const menuOptionConfigs = useMemo2(
|
|
@@ -1168,17 +1213,16 @@ var VariableManagerCreateMenu = ({
|
|
|
1168
1213
|
})),
|
|
1169
1214
|
[variableTypes]
|
|
1170
1215
|
);
|
|
1171
|
-
return /* @__PURE__ */
|
|
1216
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
|
|
1172
1217
|
IconButton,
|
|
1173
1218
|
{
|
|
1174
1219
|
...bindTrigger(menuState),
|
|
1175
1220
|
ref: buttonRef,
|
|
1176
|
-
disabled,
|
|
1177
1221
|
size: SIZE,
|
|
1178
|
-
"aria-label":
|
|
1222
|
+
"aria-label": __9("Add variable", "elementor")
|
|
1179
1223
|
},
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
), /* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ React8.createElement(PlusIcon, { fontSize: SIZE })
|
|
1225
|
+
), /* @__PURE__ */ React8.createElement(
|
|
1182
1226
|
Menu,
|
|
1183
1227
|
{
|
|
1184
1228
|
disablePortal: true,
|
|
@@ -1200,7 +1244,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1200
1244
|
},
|
|
1201
1245
|
"data-testid": "variable-manager-create-menu"
|
|
1202
1246
|
},
|
|
1203
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1247
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React8.createElement(
|
|
1204
1248
|
MenuOption,
|
|
1205
1249
|
{
|
|
1206
1250
|
key: config.key,
|
|
@@ -1218,15 +1262,13 @@ var MenuOption = ({
|
|
|
1218
1262
|
onCreate,
|
|
1219
1263
|
onClose
|
|
1220
1264
|
}) => {
|
|
1221
|
-
const
|
|
1265
|
+
const promotionRef = useRef2(null);
|
|
1222
1266
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1223
|
-
const displayName =
|
|
1267
|
+
const displayName = capitalize2(config.variableType);
|
|
1224
1268
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
1225
1269
|
const handleClick = () => {
|
|
1226
1270
|
if (isDisabled) {
|
|
1227
|
-
|
|
1228
|
-
setIsPopoverOpen(true);
|
|
1229
|
-
}
|
|
1271
|
+
promotionRef.current?.toggle();
|
|
1230
1272
|
return;
|
|
1231
1273
|
}
|
|
1232
1274
|
const defaultName = getDefaultName(variables, config.key, config.variableType);
|
|
@@ -1234,29 +1276,13 @@ var MenuOption = ({
|
|
|
1234
1276
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1235
1277
|
onClose();
|
|
1236
1278
|
};
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
__8("%s variables", "elementor"),
|
|
1240
|
-
capitalize(config.variableType)
|
|
1241
|
-
);
|
|
1242
|
-
const content = sprintf2(
|
|
1243
|
-
/* translators: %s: Variable Type. */
|
|
1244
|
-
__8("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1245
|
-
config.variableType
|
|
1246
|
-
);
|
|
1247
|
-
return /* @__PURE__ */ React7.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, createElement8(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React7.createElement(Typography6, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React7.createElement(
|
|
1248
|
-
PromotionPopover,
|
|
1279
|
+
return /* @__PURE__ */ React8.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, createElement9(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React8.createElement(Typography6, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React8.createElement(
|
|
1280
|
+
VariablePromotionChip,
|
|
1249
1281
|
{
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1255
|
-
onClose: () => {
|
|
1256
|
-
setIsPopoverOpen(false);
|
|
1257
|
-
}
|
|
1258
|
-
},
|
|
1259
|
-
/* @__PURE__ */ React7.createElement(PromotionChip, null)
|
|
1282
|
+
variableType: config.variableType,
|
|
1283
|
+
upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1284
|
+
ref: promotionRef
|
|
1285
|
+
}
|
|
1260
1286
|
));
|
|
1261
1287
|
};
|
|
1262
1288
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1271,25 +1297,52 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1271
1297
|
};
|
|
1272
1298
|
|
|
1273
1299
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1274
|
-
import * as
|
|
1275
|
-
import {
|
|
1276
|
-
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1277
|
-
import { GripVerticalIcon } from "@elementor/icons";
|
|
1300
|
+
import * as React14 from "react";
|
|
1301
|
+
import { useEffect as useEffect2, useRef as useRef6 } from "react";
|
|
1278
1302
|
import {
|
|
1279
|
-
IconButton as IconButton3,
|
|
1280
|
-
Stack as Stack5,
|
|
1281
1303
|
Table,
|
|
1282
1304
|
TableBody,
|
|
1283
1305
|
TableContainer,
|
|
1284
1306
|
TableHead,
|
|
1285
|
-
TableRow,
|
|
1307
|
+
TableRow as TableRow2,
|
|
1286
1308
|
UnstableSortableItem,
|
|
1287
1309
|
UnstableSortableProvider
|
|
1288
1310
|
} from "@elementor/ui";
|
|
1289
|
-
import { __ as
|
|
1311
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1312
|
+
|
|
1313
|
+
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1314
|
+
import * as React9 from "react";
|
|
1315
|
+
import { TableCell } from "@elementor/ui";
|
|
1316
|
+
var VariableTableCell = ({
|
|
1317
|
+
children,
|
|
1318
|
+
isHeader,
|
|
1319
|
+
width,
|
|
1320
|
+
maxWidth,
|
|
1321
|
+
align,
|
|
1322
|
+
noPadding,
|
|
1323
|
+
sx
|
|
1324
|
+
}) => {
|
|
1325
|
+
const baseSx = {
|
|
1326
|
+
maxWidth: maxWidth ?? 150,
|
|
1327
|
+
cursor: "initial",
|
|
1328
|
+
typography: "caption",
|
|
1329
|
+
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1330
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1331
|
+
...width && { width },
|
|
1332
|
+
...sx
|
|
1333
|
+
};
|
|
1334
|
+
return /* @__PURE__ */ React9.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1338
|
+
import * as React13 from "react";
|
|
1339
|
+
import { createElement as createElement16, useRef as useRef5 } from "react";
|
|
1340
|
+
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1341
|
+
import { GripVerticalIcon } from "@elementor/icons";
|
|
1342
|
+
import { IconButton as IconButton3, Stack as Stack5, TableRow } from "@elementor/ui";
|
|
1290
1343
|
|
|
1291
1344
|
// src/components/fields/label-field.tsx
|
|
1292
|
-
import * as
|
|
1345
|
+
import * as React10 from "react";
|
|
1293
1346
|
import { useRef as useRef3, useState as useState5 } from "react";
|
|
1294
1347
|
import { WarningInfotip } from "@elementor/editor-ui";
|
|
1295
1348
|
import { TextField } from "@elementor/ui";
|
|
@@ -1331,7 +1384,7 @@ var LabelField = ({
|
|
|
1331
1384
|
errorMsg = error.message;
|
|
1332
1385
|
}
|
|
1333
1386
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1334
|
-
const textField = /* @__PURE__ */
|
|
1387
|
+
const textField = /* @__PURE__ */ React10.createElement(
|
|
1335
1388
|
TextField,
|
|
1336
1389
|
{
|
|
1337
1390
|
ref: fieldRef,
|
|
@@ -1352,7 +1405,7 @@ var LabelField = ({
|
|
|
1352
1405
|
);
|
|
1353
1406
|
if (showWarningInfotip) {
|
|
1354
1407
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1355
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1356
1409
|
WarningInfotip,
|
|
1357
1410
|
{
|
|
1358
1411
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1368,84 +1421,6 @@ var LabelField = ({
|
|
|
1368
1421
|
return textField;
|
|
1369
1422
|
};
|
|
1370
1423
|
|
|
1371
|
-
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1372
|
-
import * as React9 from "react";
|
|
1373
|
-
import { createElement as createElement11 } from "react";
|
|
1374
|
-
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1375
|
-
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1376
|
-
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1377
|
-
const menuState = usePopupState({
|
|
1378
|
-
variant: "popover"
|
|
1379
|
-
});
|
|
1380
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(IconButton2, { ...bindTrigger2(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React9.createElement(DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React9.createElement(
|
|
1381
|
-
Menu2,
|
|
1382
|
-
{
|
|
1383
|
-
disablePortal: true,
|
|
1384
|
-
MenuListProps: {
|
|
1385
|
-
dense: true
|
|
1386
|
-
},
|
|
1387
|
-
PaperProps: {
|
|
1388
|
-
elevation: 6
|
|
1389
|
-
},
|
|
1390
|
-
...bindMenu2(menuState),
|
|
1391
|
-
anchorEl: menuState.anchorEl,
|
|
1392
|
-
anchorOrigin: {
|
|
1393
|
-
vertical: "bottom",
|
|
1394
|
-
horizontal: "right"
|
|
1395
|
-
},
|
|
1396
|
-
transformOrigin: {
|
|
1397
|
-
vertical: "top",
|
|
1398
|
-
horizontal: "right"
|
|
1399
|
-
},
|
|
1400
|
-
open: menuState.isOpen,
|
|
1401
|
-
onClose: menuState.close
|
|
1402
|
-
},
|
|
1403
|
-
menuActions.map((action) => /* @__PURE__ */ React9.createElement(
|
|
1404
|
-
MenuItem2,
|
|
1405
|
-
{
|
|
1406
|
-
key: action.name,
|
|
1407
|
-
onClick: () => {
|
|
1408
|
-
action.onClick?.(itemId);
|
|
1409
|
-
menuState.close();
|
|
1410
|
-
},
|
|
1411
|
-
sx: {
|
|
1412
|
-
color: action.color,
|
|
1413
|
-
gap: 1
|
|
1414
|
-
}
|
|
1415
|
-
},
|
|
1416
|
-
action.icon && createElement11(action.icon, {
|
|
1417
|
-
fontSize: "inherit"
|
|
1418
|
-
}),
|
|
1419
|
-
" ",
|
|
1420
|
-
action.name
|
|
1421
|
-
))
|
|
1422
|
-
));
|
|
1423
|
-
};
|
|
1424
|
-
|
|
1425
|
-
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1426
|
-
import * as React10 from "react";
|
|
1427
|
-
import { TableCell } from "@elementor/ui";
|
|
1428
|
-
var VariableTableCell = ({
|
|
1429
|
-
children,
|
|
1430
|
-
isHeader,
|
|
1431
|
-
width,
|
|
1432
|
-
maxWidth,
|
|
1433
|
-
align,
|
|
1434
|
-
noPadding,
|
|
1435
|
-
sx
|
|
1436
|
-
}) => {
|
|
1437
|
-
const baseSx = {
|
|
1438
|
-
maxWidth: maxWidth ?? 150,
|
|
1439
|
-
cursor: "initial",
|
|
1440
|
-
typography: "caption",
|
|
1441
|
-
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1442
|
-
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1443
|
-
...width && { width },
|
|
1444
|
-
...sx
|
|
1445
|
-
};
|
|
1446
|
-
return /* @__PURE__ */ React10.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1447
|
-
};
|
|
1448
|
-
|
|
1449
1424
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1450
1425
|
import * as React11 from "react";
|
|
1451
1426
|
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as useState6 } from "react";
|
|
@@ -1461,7 +1436,8 @@ var VariableEditableCell = React11.memo(
|
|
|
1461
1436
|
onRowRef,
|
|
1462
1437
|
onAutoEditComplete,
|
|
1463
1438
|
gap = 1,
|
|
1464
|
-
fieldType
|
|
1439
|
+
fieldType,
|
|
1440
|
+
disabled = false
|
|
1465
1441
|
}) => {
|
|
1466
1442
|
const [value, setValue] = useState6(initialValue);
|
|
1467
1443
|
const [isEditing, setIsEditing] = useState6(false);
|
|
@@ -1479,15 +1455,21 @@ var VariableEditableCell = React11.memo(
|
|
|
1479
1455
|
onRowRef?.(rowRef?.current);
|
|
1480
1456
|
}, [onRowRef]);
|
|
1481
1457
|
useEffect(() => {
|
|
1482
|
-
if (autoEdit && !isEditing) {
|
|
1458
|
+
if (autoEdit && !isEditing && !disabled) {
|
|
1483
1459
|
setIsEditing(true);
|
|
1484
1460
|
onAutoEditComplete?.();
|
|
1485
1461
|
}
|
|
1486
|
-
}, [autoEdit, isEditing, onAutoEditComplete]);
|
|
1462
|
+
}, [autoEdit, isEditing, onAutoEditComplete, disabled]);
|
|
1487
1463
|
const handleDoubleClick = () => {
|
|
1464
|
+
if (disabled) {
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1488
1467
|
setIsEditing(true);
|
|
1489
1468
|
};
|
|
1490
1469
|
const handleKeyDown = (event) => {
|
|
1470
|
+
if (disabled) {
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1491
1473
|
if (event.key === "Enter") {
|
|
1492
1474
|
handleSave();
|
|
1493
1475
|
} else if (event.key === "Escape") {
|
|
@@ -1553,9 +1535,9 @@ var VariableEditableCell = React11.memo(
|
|
|
1553
1535
|
gap,
|
|
1554
1536
|
onDoubleClick: handleDoubleClick,
|
|
1555
1537
|
onKeyDown: handleKeyDown,
|
|
1556
|
-
tabIndex: 0,
|
|
1538
|
+
tabIndex: disabled ? -1 : 0,
|
|
1557
1539
|
role: "button",
|
|
1558
|
-
"aria-label": "Double click or press Space to edit"
|
|
1540
|
+
"aria-label": disabled ? "" : "Double click or press Space to edit"
|
|
1559
1541
|
},
|
|
1560
1542
|
prefixElement,
|
|
1561
1543
|
children
|
|
@@ -1563,6 +1545,243 @@ var VariableEditableCell = React11.memo(
|
|
|
1563
1545
|
}
|
|
1564
1546
|
);
|
|
1565
1547
|
|
|
1548
|
+
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1549
|
+
import * as React12 from "react";
|
|
1550
|
+
import { createElement as createElement14 } from "react";
|
|
1551
|
+
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1552
|
+
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1553
|
+
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1554
|
+
const menuState = usePopupState({
|
|
1555
|
+
variant: "popover"
|
|
1556
|
+
});
|
|
1557
|
+
const triggerProps = bindTrigger2(menuState);
|
|
1558
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
|
|
1559
|
+
IconButton2,
|
|
1560
|
+
{
|
|
1561
|
+
...triggerProps,
|
|
1562
|
+
disabled,
|
|
1563
|
+
size: "tiny",
|
|
1564
|
+
onClick: (e) => {
|
|
1565
|
+
e.stopPropagation();
|
|
1566
|
+
triggerProps.onClick?.(e);
|
|
1567
|
+
}
|
|
1568
|
+
},
|
|
1569
|
+
/* @__PURE__ */ React12.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
1570
|
+
), /* @__PURE__ */ React12.createElement(
|
|
1571
|
+
Menu2,
|
|
1572
|
+
{
|
|
1573
|
+
disablePortal: true,
|
|
1574
|
+
MenuListProps: {
|
|
1575
|
+
dense: true
|
|
1576
|
+
},
|
|
1577
|
+
PaperProps: {
|
|
1578
|
+
elevation: 6
|
|
1579
|
+
},
|
|
1580
|
+
...bindMenu2(menuState),
|
|
1581
|
+
anchorEl: menuState.anchorEl,
|
|
1582
|
+
anchorOrigin: {
|
|
1583
|
+
vertical: "bottom",
|
|
1584
|
+
horizontal: "right"
|
|
1585
|
+
},
|
|
1586
|
+
transformOrigin: {
|
|
1587
|
+
vertical: "top",
|
|
1588
|
+
horizontal: "right"
|
|
1589
|
+
},
|
|
1590
|
+
open: menuState.isOpen,
|
|
1591
|
+
onClose: menuState.close
|
|
1592
|
+
},
|
|
1593
|
+
menuActions.map((action) => /* @__PURE__ */ React12.createElement(
|
|
1594
|
+
MenuItem2,
|
|
1595
|
+
{
|
|
1596
|
+
key: action.name,
|
|
1597
|
+
onClick: (e) => {
|
|
1598
|
+
e.stopPropagation();
|
|
1599
|
+
action.onClick?.(itemId);
|
|
1600
|
+
menuState.close();
|
|
1601
|
+
},
|
|
1602
|
+
sx: {
|
|
1603
|
+
color: action.color,
|
|
1604
|
+
gap: 1
|
|
1605
|
+
}
|
|
1606
|
+
},
|
|
1607
|
+
action.icon && createElement14(action.icon, {
|
|
1608
|
+
fontSize: "inherit"
|
|
1609
|
+
}),
|
|
1610
|
+
" ",
|
|
1611
|
+
action.name
|
|
1612
|
+
))
|
|
1613
|
+
));
|
|
1614
|
+
};
|
|
1615
|
+
|
|
1616
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1617
|
+
var VariableRow = (props) => {
|
|
1618
|
+
const {
|
|
1619
|
+
row,
|
|
1620
|
+
variables,
|
|
1621
|
+
handleOnChange,
|
|
1622
|
+
autoEditVariableId,
|
|
1623
|
+
onAutoEditComplete,
|
|
1624
|
+
onFieldError,
|
|
1625
|
+
menuActions,
|
|
1626
|
+
handleRowRef,
|
|
1627
|
+
itemProps,
|
|
1628
|
+
showDropIndication,
|
|
1629
|
+
triggerProps,
|
|
1630
|
+
itemStyle,
|
|
1631
|
+
triggerStyle,
|
|
1632
|
+
isDragged,
|
|
1633
|
+
dropPosition,
|
|
1634
|
+
setTriggerRef,
|
|
1635
|
+
isSorting
|
|
1636
|
+
} = props;
|
|
1637
|
+
const promotionRef = useRef5(null);
|
|
1638
|
+
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1639
|
+
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1640
|
+
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1641
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1642
|
+
TableRow,
|
|
1643
|
+
{
|
|
1644
|
+
...itemProps,
|
|
1645
|
+
ref: itemProps.ref,
|
|
1646
|
+
selected: isDragged,
|
|
1647
|
+
sx: {
|
|
1648
|
+
...isDisabled && {
|
|
1649
|
+
"& td, & th": {
|
|
1650
|
+
color: "text.disabled"
|
|
1651
|
+
}
|
|
1652
|
+
},
|
|
1653
|
+
...showIndicationBefore && {
|
|
1654
|
+
"& td, & th": {
|
|
1655
|
+
borderTop: "2px solid",
|
|
1656
|
+
borderTopColor: "primary.main"
|
|
1657
|
+
}
|
|
1658
|
+
},
|
|
1659
|
+
...showIndicationAfter && {
|
|
1660
|
+
"& td, & th": {
|
|
1661
|
+
borderBottom: "2px solid",
|
|
1662
|
+
borderBottomColor: "primary.main"
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
"&:hover, &:focus-within": {
|
|
1666
|
+
backgroundColor: "action.hover",
|
|
1667
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1668
|
+
opacity: 1
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1671
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1672
|
+
opacity: 0
|
|
1673
|
+
}
|
|
1674
|
+
},
|
|
1675
|
+
style: { ...itemStyle, ...triggerStyle },
|
|
1676
|
+
onClick: () => {
|
|
1677
|
+
if (isDisabled) {
|
|
1678
|
+
promotionRef.current?.toggle();
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React13.createElement(IconButton3, { size: "small", ref: setTriggerRef, ...triggerProps, disabled: isSorting, draggable: true }, /* @__PURE__ */ React13.createElement(GripVerticalIcon, { fontSize: "inherit" }))),
|
|
1683
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, null, /* @__PURE__ */ React13.createElement(
|
|
1684
|
+
VariableEditableCell,
|
|
1685
|
+
{
|
|
1686
|
+
initialValue: row.name,
|
|
1687
|
+
onChange: (value) => {
|
|
1688
|
+
if (value !== row.name && !isDisabled) {
|
|
1689
|
+
handleOnChange({
|
|
1690
|
+
...variables,
|
|
1691
|
+
[row.id]: { ...variables[row.id], label: value }
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
},
|
|
1695
|
+
prefixElement: createElement16(row.icon, {
|
|
1696
|
+
fontSize: "inherit",
|
|
1697
|
+
color: isDisabled ? "disabled" : "inherit"
|
|
1698
|
+
}),
|
|
1699
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React13.createElement(
|
|
1700
|
+
LabelField,
|
|
1701
|
+
{
|
|
1702
|
+
id: "variable-label-" + row.id,
|
|
1703
|
+
size: "tiny",
|
|
1704
|
+
value,
|
|
1705
|
+
onChange,
|
|
1706
|
+
onErrorChange: (errorMsg) => {
|
|
1707
|
+
onValidationChange?.(errorMsg);
|
|
1708
|
+
onFieldError?.(!!errorMsg);
|
|
1709
|
+
},
|
|
1710
|
+
error,
|
|
1711
|
+
focusOnShow: true,
|
|
1712
|
+
selectOnShow: autoEditVariableId === row.id,
|
|
1713
|
+
showWarningInfotip: true,
|
|
1714
|
+
variables
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
autoEdit: autoEditVariableId === row.id && !isDisabled,
|
|
1718
|
+
onRowRef: handleRowRef(row.id),
|
|
1719
|
+
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1720
|
+
fieldType: "label",
|
|
1721
|
+
disabled: isDisabled
|
|
1722
|
+
},
|
|
1723
|
+
/* @__PURE__ */ React13.createElement(EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1724
|
+
)),
|
|
1725
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, null, /* @__PURE__ */ React13.createElement(
|
|
1726
|
+
VariableEditableCell,
|
|
1727
|
+
{
|
|
1728
|
+
initialValue: row.value,
|
|
1729
|
+
onChange: (value) => {
|
|
1730
|
+
if (value !== row.value && !isDisabled) {
|
|
1731
|
+
handleOnChange({
|
|
1732
|
+
...variables,
|
|
1733
|
+
[row.id]: { ...variables[row.id], value }
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1737
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => row.valueField?.({
|
|
1738
|
+
value,
|
|
1739
|
+
onChange,
|
|
1740
|
+
onPropTypeKeyChange: (type) => {
|
|
1741
|
+
if (!isDisabled) {
|
|
1742
|
+
handleOnChange({
|
|
1743
|
+
...variables,
|
|
1744
|
+
[row.id]: { ...variables[row.id], type }
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
},
|
|
1748
|
+
propTypeKey: row.type,
|
|
1749
|
+
onValidationChange: (errorMsg) => {
|
|
1750
|
+
onValidationChange?.(errorMsg);
|
|
1751
|
+
onFieldError?.(!!errorMsg);
|
|
1752
|
+
},
|
|
1753
|
+
error
|
|
1754
|
+
}) ?? /* @__PURE__ */ React13.createElement(React13.Fragment, null),
|
|
1755
|
+
onRowRef: handleRowRef(row.id),
|
|
1756
|
+
gap: 0.25,
|
|
1757
|
+
fieldType: "value",
|
|
1758
|
+
disabled: isDisabled
|
|
1759
|
+
},
|
|
1760
|
+
row.startIcon && row.startIcon({ value: row.value }),
|
|
1761
|
+
/* @__PURE__ */ React13.createElement(
|
|
1762
|
+
EllipsisWithTooltip,
|
|
1763
|
+
{
|
|
1764
|
+
title: row.value,
|
|
1765
|
+
sx: {
|
|
1766
|
+
border: "4px solid transparent",
|
|
1767
|
+
lineHeight: "1",
|
|
1768
|
+
pt: 0.25
|
|
1769
|
+
}
|
|
1770
|
+
},
|
|
1771
|
+
row.value
|
|
1772
|
+
)
|
|
1773
|
+
)),
|
|
1774
|
+
/* @__PURE__ */ React13.createElement(VariableTableCell, { align: "right", noPadding: true, width: 16, maxWidth: 16, sx: { paddingInlineEnd: 1 } }, /* @__PURE__ */ React13.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end", alignItems: "center" }, isDisabled && /* @__PURE__ */ React13.createElement(
|
|
1775
|
+
VariablePromotionChip,
|
|
1776
|
+
{
|
|
1777
|
+
variableType: row.variableType,
|
|
1778
|
+
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1779
|
+
ref: promotionRef
|
|
1780
|
+
}
|
|
1781
|
+
), /* @__PURE__ */ React13.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1782
|
+
);
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1566
1785
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1567
1786
|
var VariablesManagerTable = ({
|
|
1568
1787
|
menuActions,
|
|
@@ -1572,8 +1791,8 @@ var VariablesManagerTable = ({
|
|
|
1572
1791
|
onAutoEditComplete,
|
|
1573
1792
|
onFieldError
|
|
1574
1793
|
}) => {
|
|
1575
|
-
const tableContainerRef =
|
|
1576
|
-
const variableRowRefs =
|
|
1794
|
+
const tableContainerRef = useRef6(null);
|
|
1795
|
+
const variableRowRefs = useRef6(/* @__PURE__ */ new Map());
|
|
1577
1796
|
useEffect2(() => {
|
|
1578
1797
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1579
1798
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
@@ -1625,196 +1844,34 @@ var VariablesManagerTable = ({
|
|
|
1625
1844
|
});
|
|
1626
1845
|
handleOnChange(updatedVariables);
|
|
1627
1846
|
};
|
|
1628
|
-
return /* @__PURE__ */
|
|
1847
|
+
return /* @__PURE__ */ React14.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React14.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React14.createElement(TableHead, null, /* @__PURE__ */ React14.createElement(TableRow2, null, /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true }, __10("Name", "elementor")), /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true }, __10("Value", "elementor")), /* @__PURE__ */ React14.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React14.createElement(TableBody, null, /* @__PURE__ */ React14.createElement(
|
|
1629
1848
|
UnstableSortableProvider,
|
|
1630
1849
|
{
|
|
1631
1850
|
value: ids,
|
|
1632
1851
|
onChange: handleReorder,
|
|
1633
1852
|
variant: "static",
|
|
1634
1853
|
restrictAxis: true,
|
|
1635
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1854
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React14.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React14.createElement(TableBody, null, dragOverlayChildren))
|
|
1636
1855
|
},
|
|
1637
|
-
rows.map((row) => /* @__PURE__ */
|
|
1856
|
+
rows.map((row) => /* @__PURE__ */ React14.createElement(
|
|
1638
1857
|
UnstableSortableItem,
|
|
1639
1858
|
{
|
|
1640
1859
|
key: row.id,
|
|
1641
1860
|
id: row.id,
|
|
1642
|
-
render: (
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
TableRow,
|
|
1657
|
-
{
|
|
1658
|
-
...itemProps,
|
|
1659
|
-
ref: itemProps.ref,
|
|
1660
|
-
selected: isDragged,
|
|
1661
|
-
sx: {
|
|
1662
|
-
...showIndicationBefore && {
|
|
1663
|
-
"& td, & th": {
|
|
1664
|
-
borderTop: "2px solid",
|
|
1665
|
-
borderTopColor: "primary.main"
|
|
1666
|
-
}
|
|
1667
|
-
},
|
|
1668
|
-
...showIndicationAfter && {
|
|
1669
|
-
"& td, & th": {
|
|
1670
|
-
borderBottom: "2px solid",
|
|
1671
|
-
borderBottomColor: "primary.main"
|
|
1672
|
-
}
|
|
1673
|
-
},
|
|
1674
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1675
|
-
opacity: 0
|
|
1676
|
-
},
|
|
1677
|
-
"&:hover, &:focus-within": {
|
|
1678
|
-
backgroundColor: "action.hover",
|
|
1679
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1680
|
-
opacity: 1
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
},
|
|
1684
|
-
style: { ...itemStyle, ...triggerStyle }
|
|
1685
|
-
},
|
|
1686
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(
|
|
1687
|
-
IconButton3,
|
|
1688
|
-
{
|
|
1689
|
-
size: "small",
|
|
1690
|
-
ref: setTriggerRef,
|
|
1691
|
-
...triggerProps,
|
|
1692
|
-
disabled: isSorting,
|
|
1693
|
-
draggable: true
|
|
1694
|
-
},
|
|
1695
|
-
/* @__PURE__ */ React12.createElement(GripVerticalIcon, { fontSize: "inherit" })
|
|
1696
|
-
)),
|
|
1697
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1698
|
-
VariableEditableCell,
|
|
1699
|
-
{
|
|
1700
|
-
initialValue: row.name,
|
|
1701
|
-
onChange: (value) => {
|
|
1702
|
-
if (value !== row.name) {
|
|
1703
|
-
handleOnChange({
|
|
1704
|
-
...variables,
|
|
1705
|
-
[row.id]: { ...variables[row.id], label: value }
|
|
1706
|
-
});
|
|
1707
|
-
}
|
|
1708
|
-
},
|
|
1709
|
-
prefixElement: createElement15(row.icon, { fontSize: "inherit" }),
|
|
1710
|
-
editableElement: ({
|
|
1711
|
-
value,
|
|
1712
|
-
onChange,
|
|
1713
|
-
onValidationChange,
|
|
1714
|
-
error
|
|
1715
|
-
}) => /* @__PURE__ */ React12.createElement(
|
|
1716
|
-
LabelField,
|
|
1717
|
-
{
|
|
1718
|
-
id: "variable-label-" + row.id,
|
|
1719
|
-
size: "tiny",
|
|
1720
|
-
value,
|
|
1721
|
-
onChange,
|
|
1722
|
-
onErrorChange: (errorMsg) => {
|
|
1723
|
-
onValidationChange?.(errorMsg);
|
|
1724
|
-
onFieldError?.(!!errorMsg);
|
|
1725
|
-
},
|
|
1726
|
-
error,
|
|
1727
|
-
focusOnShow: true,
|
|
1728
|
-
selectOnShow: autoEditVariableId === row.id,
|
|
1729
|
-
showWarningInfotip: true,
|
|
1730
|
-
variables
|
|
1731
|
-
}
|
|
1732
|
-
),
|
|
1733
|
-
autoEdit: autoEditVariableId === row.id,
|
|
1734
|
-
onRowRef: handleRowRef(row.id),
|
|
1735
|
-
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1736
|
-
fieldType: "label"
|
|
1737
|
-
},
|
|
1738
|
-
/* @__PURE__ */ React12.createElement(
|
|
1739
|
-
EllipsisWithTooltip,
|
|
1740
|
-
{
|
|
1741
|
-
title: row.name,
|
|
1742
|
-
sx: { border: "4px solid transparent" }
|
|
1743
|
-
},
|
|
1744
|
-
row.name
|
|
1745
|
-
)
|
|
1746
|
-
)),
|
|
1747
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1748
|
-
VariableEditableCell,
|
|
1749
|
-
{
|
|
1750
|
-
initialValue: row.value,
|
|
1751
|
-
onChange: (value) => {
|
|
1752
|
-
if (value !== row.value) {
|
|
1753
|
-
handleOnChange({
|
|
1754
|
-
...variables,
|
|
1755
|
-
[row.id]: { ...variables[row.id], value }
|
|
1756
|
-
});
|
|
1757
|
-
}
|
|
1758
|
-
},
|
|
1759
|
-
editableElement: ({
|
|
1760
|
-
value,
|
|
1761
|
-
onChange,
|
|
1762
|
-
onValidationChange,
|
|
1763
|
-
error
|
|
1764
|
-
}) => row.valueField?.({
|
|
1765
|
-
value,
|
|
1766
|
-
onChange,
|
|
1767
|
-
onPropTypeKeyChange: (type) => {
|
|
1768
|
-
handleOnChange({
|
|
1769
|
-
...variables,
|
|
1770
|
-
[row.id]: { ...variables[row.id], type }
|
|
1771
|
-
});
|
|
1772
|
-
},
|
|
1773
|
-
propTypeKey: row.type,
|
|
1774
|
-
onValidationChange: (errorMsg) => {
|
|
1775
|
-
onValidationChange?.(errorMsg);
|
|
1776
|
-
onFieldError?.(!!errorMsg);
|
|
1777
|
-
},
|
|
1778
|
-
error
|
|
1779
|
-
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1780
|
-
onRowRef: handleRowRef(row.id),
|
|
1781
|
-
gap: 0.25,
|
|
1782
|
-
fieldType: "value"
|
|
1783
|
-
},
|
|
1784
|
-
row.startIcon && row.startIcon({ value: row.value }),
|
|
1785
|
-
/* @__PURE__ */ React12.createElement(
|
|
1786
|
-
EllipsisWithTooltip,
|
|
1787
|
-
{
|
|
1788
|
-
title: row.value,
|
|
1789
|
-
sx: {
|
|
1790
|
-
border: "4px solid transparent",
|
|
1791
|
-
lineHeight: "1",
|
|
1792
|
-
pt: 0.25
|
|
1793
|
-
}
|
|
1794
|
-
},
|
|
1795
|
-
row.value
|
|
1796
|
-
)
|
|
1797
|
-
)),
|
|
1798
|
-
/* @__PURE__ */ React12.createElement(
|
|
1799
|
-
VariableTableCell,
|
|
1800
|
-
{
|
|
1801
|
-
align: "right",
|
|
1802
|
-
noPadding: true,
|
|
1803
|
-
width: 16,
|
|
1804
|
-
maxWidth: 16,
|
|
1805
|
-
sx: { paddingInlineEnd: 1 }
|
|
1806
|
-
},
|
|
1807
|
-
/* @__PURE__ */ React12.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React12.createElement(
|
|
1808
|
-
VariableEditMenu,
|
|
1809
|
-
{
|
|
1810
|
-
menuActions: menuActions(row.id),
|
|
1811
|
-
disabled: isSorting,
|
|
1812
|
-
itemId: row.id
|
|
1813
|
-
}
|
|
1814
|
-
))
|
|
1815
|
-
)
|
|
1816
|
-
);
|
|
1817
|
-
}
|
|
1861
|
+
render: (props) => /* @__PURE__ */ React14.createElement(
|
|
1862
|
+
VariableRow,
|
|
1863
|
+
{
|
|
1864
|
+
...props,
|
|
1865
|
+
row,
|
|
1866
|
+
variables,
|
|
1867
|
+
handleOnChange,
|
|
1868
|
+
autoEditVariableId,
|
|
1869
|
+
onAutoEditComplete,
|
|
1870
|
+
onFieldError,
|
|
1871
|
+
menuActions,
|
|
1872
|
+
handleRowRef
|
|
1873
|
+
}
|
|
1874
|
+
)
|
|
1818
1875
|
}
|
|
1819
1876
|
))
|
|
1820
1877
|
))));
|
|
@@ -1939,7 +1996,7 @@ function VariablesManagerPanel() {
|
|
|
1939
1996
|
}
|
|
1940
1997
|
});
|
|
1941
1998
|
const deleteAction = {
|
|
1942
|
-
name:
|
|
1999
|
+
name: __11("Delete", "elementor"),
|
|
1943
2000
|
icon: TrashIcon,
|
|
1944
2001
|
color: "error.main",
|
|
1945
2002
|
onClick: (itemId) => {
|
|
@@ -1956,21 +2013,21 @@ function VariablesManagerPanel() {
|
|
|
1956
2013
|
[variables, handleStartSync]
|
|
1957
2014
|
);
|
|
1958
2015
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1959
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ React15.createElement(ThemeProvider, null, /* @__PURE__ */ React15.createElement(Panel, null, /* @__PURE__ */ React15.createElement(
|
|
1960
2017
|
PanelHeader,
|
|
1961
2018
|
{
|
|
1962
2019
|
sx: {
|
|
1963
2020
|
height: "unset"
|
|
1964
2021
|
}
|
|
1965
2022
|
},
|
|
1966
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ React15.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React15.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React15.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React15.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React15.createElement(ColorFilterIcon, { fontSize: "inherit" }), __11("Variables Manager", "elementor"))), /* @__PURE__ */ React15.createElement(Stack6, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React15.createElement(
|
|
1967
2024
|
VariableManagerCreateMenu,
|
|
1968
2025
|
{
|
|
1969
2026
|
onCreate: handleCreateVariable,
|
|
1970
2027
|
variables,
|
|
1971
2028
|
menuState: createMenuState
|
|
1972
2029
|
}
|
|
1973
|
-
), /* @__PURE__ */
|
|
2030
|
+
), /* @__PURE__ */ React15.createElement(
|
|
1974
2031
|
CloseButton,
|
|
1975
2032
|
{
|
|
1976
2033
|
"aria-label": "Close",
|
|
@@ -1979,19 +2036,19 @@ function VariablesManagerPanel() {
|
|
|
1979
2036
|
handleClosePanel();
|
|
1980
2037
|
}
|
|
1981
2038
|
}
|
|
1982
|
-
))), /* @__PURE__ */
|
|
2039
|
+
))), /* @__PURE__ */ React15.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React15.createElement(
|
|
1983
2040
|
SearchField,
|
|
1984
2041
|
{
|
|
1985
2042
|
sx: {
|
|
1986
2043
|
display: "flex",
|
|
1987
2044
|
flex: 1
|
|
1988
2045
|
},
|
|
1989
|
-
placeholder:
|
|
2046
|
+
placeholder: __11("Search", "elementor"),
|
|
1990
2047
|
value: searchValue,
|
|
1991
2048
|
onSearch: handleSearch
|
|
1992
2049
|
}
|
|
1993
|
-
)), /* @__PURE__ */
|
|
1994
|
-
), /* @__PURE__ */
|
|
2050
|
+
)), /* @__PURE__ */ React15.createElement(Divider, { sx: { width: "100%" } }))
|
|
2051
|
+
), /* @__PURE__ */ React15.createElement(
|
|
1995
2052
|
PanelBody,
|
|
1996
2053
|
{
|
|
1997
2054
|
sx: {
|
|
@@ -2000,7 +2057,7 @@ function VariablesManagerPanel() {
|
|
|
2000
2057
|
height: "100%"
|
|
2001
2058
|
}
|
|
2002
2059
|
},
|
|
2003
|
-
hasVariables && /* @__PURE__ */
|
|
2060
|
+
hasVariables && /* @__PURE__ */ React15.createElement(
|
|
2004
2061
|
VariablesManagerTable,
|
|
2005
2062
|
{
|
|
2006
2063
|
menuActions: buildMenuActions,
|
|
@@ -2011,43 +2068,43 @@ function VariablesManagerPanel() {
|
|
|
2011
2068
|
onFieldError: setIsSaveDisabled
|
|
2012
2069
|
}
|
|
2013
2070
|
),
|
|
2014
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2071
|
+
!hasVariables && searchValue && /* @__PURE__ */ React15.createElement(
|
|
2015
2072
|
NoSearchResults,
|
|
2016
2073
|
{
|
|
2017
2074
|
searchValue,
|
|
2018
2075
|
onClear: () => handleSearch(""),
|
|
2019
|
-
icon: /* @__PURE__ */
|
|
2076
|
+
icon: /* @__PURE__ */ React15.createElement(ColorFilterIcon, { fontSize: "large" })
|
|
2020
2077
|
}
|
|
2021
2078
|
),
|
|
2022
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2079
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React15.createElement(
|
|
2023
2080
|
EmptyState,
|
|
2024
2081
|
{
|
|
2025
|
-
title:
|
|
2026
|
-
message:
|
|
2082
|
+
title: __11("Create your first variable", "elementor"),
|
|
2083
|
+
message: __11(
|
|
2027
2084
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2028
2085
|
"elementor"
|
|
2029
2086
|
),
|
|
2030
|
-
icon: /* @__PURE__ */
|
|
2087
|
+
icon: /* @__PURE__ */ React15.createElement(ColorFilterIcon, { fontSize: "large" }),
|
|
2031
2088
|
onAdd: createMenuState.open
|
|
2032
2089
|
}
|
|
2033
2090
|
)
|
|
2034
|
-
), /* @__PURE__ */
|
|
2091
|
+
), /* @__PURE__ */ React15.createElement(PanelFooter, null, /* @__PURE__ */ React15.createElement(
|
|
2035
2092
|
Infotip,
|
|
2036
2093
|
{
|
|
2037
2094
|
placement: "right",
|
|
2038
2095
|
open: !!serverError,
|
|
2039
|
-
content: serverError ? /* @__PURE__ */
|
|
2096
|
+
content: serverError ? /* @__PURE__ */ React15.createElement(
|
|
2040
2097
|
Alert,
|
|
2041
2098
|
{
|
|
2042
2099
|
severity: serverError.severity ?? "error",
|
|
2043
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2100
|
+
action: serverError.action?.label ? /* @__PURE__ */ React15.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
2044
2101
|
onClose: !serverError.action?.label ? () => {
|
|
2045
2102
|
setServerError(null);
|
|
2046
2103
|
setIsSaveDisabled(false);
|
|
2047
2104
|
} : void 0,
|
|
2048
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2105
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React15.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React15.createElement(AlertTriangleFilledIcon2, null)
|
|
2049
2106
|
},
|
|
2050
|
-
/* @__PURE__ */
|
|
2107
|
+
/* @__PURE__ */ React15.createElement(AlertTitle, null, serverError.message),
|
|
2051
2108
|
serverError.action?.message
|
|
2052
2109
|
) : null,
|
|
2053
2110
|
arrow: false,
|
|
@@ -2062,7 +2119,7 @@ function VariablesManagerPanel() {
|
|
|
2062
2119
|
}
|
|
2063
2120
|
}
|
|
2064
2121
|
},
|
|
2065
|
-
/* @__PURE__ */
|
|
2122
|
+
/* @__PURE__ */ React15.createElement(
|
|
2066
2123
|
Button3,
|
|
2067
2124
|
{
|
|
2068
2125
|
fullWidth: true,
|
|
@@ -2073,9 +2130,9 @@ function VariablesManagerPanel() {
|
|
|
2073
2130
|
onClick: handleSaveClick,
|
|
2074
2131
|
loading: isSaving
|
|
2075
2132
|
},
|
|
2076
|
-
|
|
2133
|
+
__11("Save changes", "elementor")
|
|
2077
2134
|
)
|
|
2078
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2135
|
+
))), deleteConfirmation && /* @__PURE__ */ React15.createElement(
|
|
2079
2136
|
DeleteConfirmationDialog,
|
|
2080
2137
|
{
|
|
2081
2138
|
open: true,
|
|
@@ -2083,26 +2140,26 @@ function VariablesManagerPanel() {
|
|
|
2083
2140
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2084
2141
|
closeDialog: () => setDeleteConfirmation(null)
|
|
2085
2142
|
}
|
|
2086
|
-
), stopSyncConfirmation && /* @__PURE__ */
|
|
2143
|
+
), stopSyncConfirmation && /* @__PURE__ */ React15.createElement(
|
|
2087
2144
|
StopSyncConfirmationDialog,
|
|
2088
2145
|
{
|
|
2089
2146
|
open: true,
|
|
2090
2147
|
closeDialog: () => setStopSyncConfirmation(null),
|
|
2091
2148
|
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2092
2149
|
}
|
|
2093
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
2150
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React15.createElement(SaveChangesDialog, null, /* @__PURE__ */ React15.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __11("You have unsaved changes", "elementor")), /* @__PURE__ */ React15.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React15.createElement(SaveChangesDialog.ContentText, null, __11("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React15.createElement(
|
|
2094
2151
|
SaveChangesDialog.Actions,
|
|
2095
2152
|
{
|
|
2096
2153
|
actions: {
|
|
2097
2154
|
discard: {
|
|
2098
|
-
label:
|
|
2155
|
+
label: __11("Discard", "elementor"),
|
|
2099
2156
|
action: () => {
|
|
2100
2157
|
closeSaveChangesDialog();
|
|
2101
2158
|
closePanel();
|
|
2102
2159
|
}
|
|
2103
2160
|
},
|
|
2104
2161
|
confirm: {
|
|
2105
|
-
label:
|
|
2162
|
+
label: __11("Save", "elementor"),
|
|
2106
2163
|
action: async () => {
|
|
2107
2164
|
const result = await handleSaveClick();
|
|
2108
2165
|
closeSaveChangesDialog();
|
|
@@ -2135,7 +2192,7 @@ var PANEL_ID = "variables-manager";
|
|
|
2135
2192
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2136
2193
|
function OpenPanelFromUrl() {
|
|
2137
2194
|
const { open } = usePanelActions();
|
|
2138
|
-
const hasOpened =
|
|
2195
|
+
const hasOpened = useRef7(false);
|
|
2139
2196
|
useEffect4(() => {
|
|
2140
2197
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2141
2198
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
@@ -2157,15 +2214,15 @@ function OpenPanelFromUrl() {
|
|
|
2157
2214
|
}
|
|
2158
2215
|
|
|
2159
2216
|
// src/controls/variable-control.tsx
|
|
2160
|
-
import * as
|
|
2217
|
+
import * as React34 from "react";
|
|
2161
2218
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
|
|
2162
2219
|
|
|
2163
2220
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2164
|
-
import { useId, useRef as
|
|
2165
|
-
import * as
|
|
2221
|
+
import { useId, useRef as useRef8 } from "react";
|
|
2222
|
+
import * as React25 from "react";
|
|
2166
2223
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
2167
2224
|
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
2168
|
-
import { bindPopover, bindTrigger as bindTrigger3, Box as
|
|
2225
|
+
import { bindPopover, bindTrigger as bindTrigger3, Box as Box5, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
2169
2226
|
|
|
2170
2227
|
// src/utils/unlink-variable.ts
|
|
2171
2228
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2184,31 +2241,31 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2184
2241
|
}
|
|
2185
2242
|
|
|
2186
2243
|
// src/components/variable-selection-popover.tsx
|
|
2187
|
-
import * as
|
|
2244
|
+
import * as React23 from "react";
|
|
2188
2245
|
import { useState as useState13 } from "react";
|
|
2189
2246
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
2190
2247
|
|
|
2191
2248
|
// src/context/variable-selection-popover.context.tsx
|
|
2192
|
-
import * as
|
|
2249
|
+
import * as React16 from "react";
|
|
2193
2250
|
import { createContext as createContext2, useContext as useContext2, useState as useState8 } from "react";
|
|
2194
|
-
import { Box } from "@elementor/ui";
|
|
2251
|
+
import { Box as Box2 } from "@elementor/ui";
|
|
2195
2252
|
var PopoverContentRefContext = createContext2(null);
|
|
2196
2253
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2197
2254
|
const [anchorRef, setAnchorRef] = useState8(null);
|
|
2198
|
-
return /* @__PURE__ */
|
|
2255
|
+
return /* @__PURE__ */ React16.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React16.createElement(Box2, { ref: setAnchorRef }, children));
|
|
2199
2256
|
};
|
|
2200
2257
|
var usePopoverContentRef = () => {
|
|
2201
2258
|
return useContext2(PopoverContentRefContext);
|
|
2202
2259
|
};
|
|
2203
2260
|
|
|
2204
2261
|
// src/components/variable-creation.tsx
|
|
2205
|
-
import * as
|
|
2262
|
+
import * as React18 from "react";
|
|
2206
2263
|
import { useState as useState9 } from "react";
|
|
2207
2264
|
import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
2208
2265
|
import { PopoverHeader, SectionPopoverBody } from "@elementor/editor-ui";
|
|
2209
2266
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
2210
2267
|
import { Button as Button4, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography7 } from "@elementor/ui";
|
|
2211
|
-
import { __ as
|
|
2268
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
2212
2269
|
|
|
2213
2270
|
// src/hooks/use-initial-value.ts
|
|
2214
2271
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
@@ -2251,10 +2308,10 @@ var unwrapValue = (input) => {
|
|
|
2251
2308
|
};
|
|
2252
2309
|
|
|
2253
2310
|
// src/components/ui/form-field.tsx
|
|
2254
|
-
import * as
|
|
2311
|
+
import * as React17 from "react";
|
|
2255
2312
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
2256
2313
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2257
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ React17.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React17.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React17.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React17.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React17.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React17.createElement(FormHelperText, null, noticeMsg)));
|
|
2258
2315
|
};
|
|
2259
2316
|
|
|
2260
2317
|
// src/components/variable-creation.tsx
|
|
@@ -2325,22 +2382,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2325
2382
|
handleCreateAndTrack();
|
|
2326
2383
|
}
|
|
2327
2384
|
};
|
|
2328
|
-
return /* @__PURE__ */
|
|
2385
|
+
return /* @__PURE__ */ React18.createElement(SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React18.createElement(
|
|
2329
2386
|
PopoverHeader,
|
|
2330
2387
|
{
|
|
2331
|
-
icon: /* @__PURE__ */
|
|
2332
|
-
title:
|
|
2388
|
+
icon: /* @__PURE__ */ React18.createElement(React18.Fragment, null, onGoBack && /* @__PURE__ */ React18.createElement(IconButton4, { size: SIZE2, "aria-label": __12("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React18.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2389
|
+
title: __12("Create variable", "elementor"),
|
|
2333
2390
|
onClose: closePopover
|
|
2334
2391
|
}
|
|
2335
|
-
), /* @__PURE__ */
|
|
2392
|
+
), /* @__PURE__ */ React18.createElement(Divider2, null), /* @__PURE__ */ React18.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React18.createElement(
|
|
2336
2393
|
FormField,
|
|
2337
2394
|
{
|
|
2338
2395
|
id: "variable-label",
|
|
2339
|
-
label:
|
|
2396
|
+
label: __12("Name", "elementor"),
|
|
2340
2397
|
errorMsg: labelFieldError?.message,
|
|
2341
2398
|
noticeMsg: labelHint(label)
|
|
2342
2399
|
},
|
|
2343
|
-
/* @__PURE__ */
|
|
2400
|
+
/* @__PURE__ */ React18.createElement(
|
|
2344
2401
|
LabelField,
|
|
2345
2402
|
{
|
|
2346
2403
|
id: "variable-label",
|
|
@@ -2359,7 +2416,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2359
2416
|
onKeyDown: handleKeyDown
|
|
2360
2417
|
}
|
|
2361
2418
|
)
|
|
2362
|
-
), ValueField && /* @__PURE__ */
|
|
2419
|
+
), ValueField && /* @__PURE__ */ React18.createElement(FormField, { errorMsg: valueFieldError, label: __12("Value", "elementor") }, /* @__PURE__ */ React18.createElement(Typography7, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React18.createElement(
|
|
2363
2420
|
ValueField,
|
|
2364
2421
|
{
|
|
2365
2422
|
value,
|
|
@@ -2373,7 +2430,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2373
2430
|
propType,
|
|
2374
2431
|
onKeyDown: handleKeyDown
|
|
2375
2432
|
}
|
|
2376
|
-
))), errorMessage && /* @__PURE__ */
|
|
2433
|
+
))), errorMessage && /* @__PURE__ */ React18.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React18.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React18.createElement(
|
|
2377
2434
|
Button4,
|
|
2378
2435
|
{
|
|
2379
2436
|
id: "create-variable-button",
|
|
@@ -2382,22 +2439,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2382
2439
|
disabled: isSubmitDisabled,
|
|
2383
2440
|
onClick: handleCreateAndTrack
|
|
2384
2441
|
},
|
|
2385
|
-
|
|
2442
|
+
__12("Create", "elementor")
|
|
2386
2443
|
)));
|
|
2387
2444
|
};
|
|
2388
2445
|
|
|
2389
2446
|
// src/components/variable-edit.tsx
|
|
2390
|
-
import * as
|
|
2447
|
+
import * as React20 from "react";
|
|
2391
2448
|
import { useEffect as useEffect5, useState as useState11 } from "react";
|
|
2392
2449
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
2393
2450
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
2394
2451
|
import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
|
|
2395
2452
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
2396
2453
|
import { Button as Button6, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Tooltip, Typography as Typography9 } from "@elementor/ui";
|
|
2397
|
-
import { __ as
|
|
2454
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2398
2455
|
|
|
2399
2456
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2400
|
-
import * as
|
|
2457
|
+
import * as React19 from "react";
|
|
2401
2458
|
import { useState as useState10 } from "react";
|
|
2402
2459
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2403
2460
|
import {
|
|
@@ -2411,7 +2468,7 @@ import {
|
|
|
2411
2468
|
FormControlLabel as FormControlLabel2,
|
|
2412
2469
|
Typography as Typography8
|
|
2413
2470
|
} from "@elementor/ui";
|
|
2414
|
-
import { __ as
|
|
2471
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2415
2472
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2416
2473
|
var EditConfirmationDialog = ({
|
|
2417
2474
|
closeDialog,
|
|
@@ -2425,13 +2482,13 @@ var EditConfirmationDialog = ({
|
|
|
2425
2482
|
}
|
|
2426
2483
|
onConfirm?.();
|
|
2427
2484
|
};
|
|
2428
|
-
return /* @__PURE__ */
|
|
2485
|
+
return /* @__PURE__ */ React19.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React19.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React19.createElement(AlertTriangleFilledIcon3, { color: "secondary" }), __13("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React19.createElement(DialogContent2, null, /* @__PURE__ */ React19.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __13(
|
|
2429
2486
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2430
2487
|
"elementor"
|
|
2431
|
-
))), /* @__PURE__ */
|
|
2488
|
+
))), /* @__PURE__ */ React19.createElement(DialogActions2, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React19.createElement(
|
|
2432
2489
|
FormControlLabel2,
|
|
2433
2490
|
{
|
|
2434
|
-
control: /* @__PURE__ */
|
|
2491
|
+
control: /* @__PURE__ */ React19.createElement(
|
|
2435
2492
|
Checkbox2,
|
|
2436
2493
|
{
|
|
2437
2494
|
checked: dontShowAgain,
|
|
@@ -2439,14 +2496,14 @@ var EditConfirmationDialog = ({
|
|
|
2439
2496
|
size: "small"
|
|
2440
2497
|
}
|
|
2441
2498
|
),
|
|
2442
|
-
label: /* @__PURE__ */
|
|
2499
|
+
label: /* @__PURE__ */ React19.createElement(Typography8, { variant: "body2" }, __13("Don't show me again", "elementor"))
|
|
2443
2500
|
}
|
|
2444
|
-
), /* @__PURE__ */
|
|
2501
|
+
), /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement(Button5, { color: "secondary", onClick: closeDialog }, __13("Keep editing", "elementor")), /* @__PURE__ */ React19.createElement(Button5, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __13("Save", "elementor")))));
|
|
2445
2502
|
};
|
|
2446
2503
|
|
|
2447
2504
|
// src/components/variable-edit.tsx
|
|
2448
2505
|
var SIZE3 = "tiny";
|
|
2449
|
-
var DELETE_LABEL =
|
|
2506
|
+
var DELETE_LABEL = __14("Delete variable", "elementor");
|
|
2450
2507
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2451
2508
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2452
2509
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
@@ -2527,7 +2584,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2527
2584
|
const actions = [];
|
|
2528
2585
|
if (userPermissions.canDelete()) {
|
|
2529
2586
|
actions.push(
|
|
2530
|
-
/* @__PURE__ */
|
|
2587
|
+
/* @__PURE__ */ React20.createElement(Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React20.createElement(IconButton5, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React20.createElement(TrashIcon2, { fontSize: SIZE3 })))
|
|
2531
2588
|
);
|
|
2532
2589
|
}
|
|
2533
2590
|
const hasEmptyFields = () => {
|
|
@@ -2552,31 +2609,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2552
2609
|
handleUpdate();
|
|
2553
2610
|
}
|
|
2554
2611
|
};
|
|
2555
|
-
return /* @__PURE__ */
|
|
2612
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(SectionPopoverBody2, { height: "auto" }, /* @__PURE__ */ React20.createElement(
|
|
2556
2613
|
PopoverHeader2,
|
|
2557
2614
|
{
|
|
2558
|
-
title:
|
|
2615
|
+
title: __14("Edit variable", "elementor"),
|
|
2559
2616
|
onClose,
|
|
2560
|
-
icon: /* @__PURE__ */
|
|
2617
|
+
icon: /* @__PURE__ */ React20.createElement(React20.Fragment, null, onGoBack && /* @__PURE__ */ React20.createElement(
|
|
2561
2618
|
IconButton5,
|
|
2562
2619
|
{
|
|
2563
2620
|
size: SIZE3,
|
|
2564
|
-
"aria-label":
|
|
2621
|
+
"aria-label": __14("Go Back", "elementor"),
|
|
2565
2622
|
onClick: onGoBack
|
|
2566
2623
|
},
|
|
2567
|
-
/* @__PURE__ */
|
|
2568
|
-
), /* @__PURE__ */
|
|
2624
|
+
/* @__PURE__ */ React20.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
2625
|
+
), /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2569
2626
|
actions
|
|
2570
2627
|
}
|
|
2571
|
-
), /* @__PURE__ */
|
|
2628
|
+
), /* @__PURE__ */ React20.createElement(Divider3, null), /* @__PURE__ */ React20.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React20.createElement(
|
|
2572
2629
|
FormField,
|
|
2573
2630
|
{
|
|
2574
2631
|
id: "variable-label",
|
|
2575
|
-
label:
|
|
2632
|
+
label: __14("Name", "elementor"),
|
|
2576
2633
|
errorMsg: labelFieldError?.message,
|
|
2577
2634
|
noticeMsg: labelHint(label)
|
|
2578
2635
|
},
|
|
2579
|
-
/* @__PURE__ */
|
|
2636
|
+
/* @__PURE__ */ React20.createElement(
|
|
2580
2637
|
LabelField,
|
|
2581
2638
|
{
|
|
2582
2639
|
id: "variable-label",
|
|
@@ -2595,7 +2652,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2595
2652
|
onKeyDown: handleKeyDown
|
|
2596
2653
|
}
|
|
2597
2654
|
)
|
|
2598
|
-
), ValueField && /* @__PURE__ */
|
|
2655
|
+
), ValueField && /* @__PURE__ */ React20.createElement(FormField, { errorMsg: valueFieldError, label: __14("Value", "elementor") }, /* @__PURE__ */ React20.createElement(Typography9, { variant: "h5" }, /* @__PURE__ */ React20.createElement(
|
|
2599
2656
|
ValueField,
|
|
2600
2657
|
{
|
|
2601
2658
|
propTypeKey: variable.type,
|
|
@@ -2610,7 +2667,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2610
2667
|
onValidationChange: setValueFieldError,
|
|
2611
2668
|
propType
|
|
2612
2669
|
}
|
|
2613
|
-
))), errorMessage && /* @__PURE__ */
|
|
2670
|
+
))), errorMessage && /* @__PURE__ */ React20.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React20.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React20.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __14("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React20.createElement(
|
|
2614
2671
|
DeleteConfirmationDialog,
|
|
2615
2672
|
{
|
|
2616
2673
|
open: true,
|
|
@@ -2618,7 +2675,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2618
2675
|
onConfirm: handleDelete,
|
|
2619
2676
|
closeDialog: closeDeleteDialog()
|
|
2620
2677
|
}
|
|
2621
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2678
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React20.createElement(
|
|
2622
2679
|
EditConfirmationDialog,
|
|
2623
2680
|
{
|
|
2624
2681
|
closeDialog: closeEditDialog(),
|
|
@@ -2630,7 +2687,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2630
2687
|
|
|
2631
2688
|
// src/components/variables-selection.tsx
|
|
2632
2689
|
import { useState as useState12 } from "react";
|
|
2633
|
-
import * as
|
|
2690
|
+
import * as React22 from "react";
|
|
2634
2691
|
import {
|
|
2635
2692
|
PopoverHeader as PopoverHeader3,
|
|
2636
2693
|
PopoverMenuList,
|
|
@@ -2640,20 +2697,20 @@ import {
|
|
|
2640
2697
|
import { PromotionAlert } from "@elementor/editor-ui";
|
|
2641
2698
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2642
2699
|
import { Divider as Divider4, IconButton as IconButton7, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
2643
|
-
import { __ as
|
|
2700
|
+
import { __ as __16, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
2644
2701
|
|
|
2645
2702
|
// src/components/ui/menu-item-content.tsx
|
|
2646
|
-
import * as
|
|
2703
|
+
import * as React21 from "react";
|
|
2647
2704
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2648
2705
|
import { EditIcon } from "@elementor/icons";
|
|
2649
|
-
import { Box as
|
|
2650
|
-
import { __ as
|
|
2706
|
+
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography10 } from "@elementor/ui";
|
|
2707
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2651
2708
|
var SIZE4 = "tiny";
|
|
2652
|
-
var EDIT_LABEL =
|
|
2709
|
+
var EDIT_LABEL = __15("Edit variable", "elementor");
|
|
2653
2710
|
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2654
2711
|
const onEdit = item.onEdit;
|
|
2655
|
-
return /* @__PURE__ */
|
|
2656
|
-
|
|
2712
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React21.createElement(
|
|
2713
|
+
Box3,
|
|
2657
2714
|
{
|
|
2658
2715
|
sx: {
|
|
2659
2716
|
flex: 1,
|
|
@@ -2663,7 +2720,7 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2663
2720
|
gap: 1
|
|
2664
2721
|
}
|
|
2665
2722
|
},
|
|
2666
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ React21.createElement(
|
|
2667
2724
|
EllipsisWithTooltip2,
|
|
2668
2725
|
{
|
|
2669
2726
|
title: item.label || item.value,
|
|
@@ -2674,7 +2731,7 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2674
2731
|
maxWidth: "50%"
|
|
2675
2732
|
}
|
|
2676
2733
|
),
|
|
2677
|
-
item.secondaryText && /* @__PURE__ */
|
|
2734
|
+
item.secondaryText && /* @__PURE__ */ React21.createElement(
|
|
2678
2735
|
EllipsisWithTooltip2,
|
|
2679
2736
|
{
|
|
2680
2737
|
title: item.secondaryText,
|
|
@@ -2685,7 +2742,7 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2685
2742
|
maxWidth: "50%"
|
|
2686
2743
|
}
|
|
2687
2744
|
)
|
|
2688
|
-
), !!onEdit && !disabled && /* @__PURE__ */
|
|
2745
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React21.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2689
2746
|
IconButton6,
|
|
2690
2747
|
{
|
|
2691
2748
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2695,7 +2752,7 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2695
2752
|
},
|
|
2696
2753
|
"aria-label": EDIT_LABEL
|
|
2697
2754
|
},
|
|
2698
|
-
/* @__PURE__ */
|
|
2755
|
+
/* @__PURE__ */ React21.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2699
2756
|
)));
|
|
2700
2757
|
};
|
|
2701
2758
|
|
|
@@ -2735,8 +2792,8 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme, disabled }) => ({
|
|
|
2735
2792
|
|
|
2736
2793
|
// src/components/variables-selection.tsx
|
|
2737
2794
|
var SIZE5 = "tiny";
|
|
2738
|
-
var CREATE_LABEL =
|
|
2739
|
-
var MANAGER_LABEL =
|
|
2795
|
+
var CREATE_LABEL = __16("Create variable", "elementor");
|
|
2796
|
+
var MANAGER_LABEL = __16("Variables Manager", "elementor");
|
|
2740
2797
|
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license-panel-${variableType}-variable`;
|
|
2741
2798
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2742
2799
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
@@ -2768,7 +2825,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2768
2825
|
const actions = [];
|
|
2769
2826
|
if (onAdd) {
|
|
2770
2827
|
actions.push(
|
|
2771
|
-
/* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ React22.createElement(Tooltip3, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
|
|
2772
2829
|
IconButton7,
|
|
2773
2830
|
{
|
|
2774
2831
|
id: "add-variable-button",
|
|
@@ -2777,7 +2834,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2777
2834
|
"aria-label": CREATE_LABEL,
|
|
2778
2835
|
disabled
|
|
2779
2836
|
},
|
|
2780
|
-
/* @__PURE__ */
|
|
2837
|
+
/* @__PURE__ */ React22.createElement(PlusIcon2, { fontSize: SIZE5 })
|
|
2781
2838
|
)))
|
|
2782
2839
|
);
|
|
2783
2840
|
}
|
|
@@ -2791,7 +2848,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2791
2848
|
});
|
|
2792
2849
|
};
|
|
2793
2850
|
actions.push(
|
|
2794
|
-
/* @__PURE__ */
|
|
2851
|
+
/* @__PURE__ */ React22.createElement(Tooltip3, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React22.createElement(
|
|
2795
2852
|
IconButton7,
|
|
2796
2853
|
{
|
|
2797
2854
|
id: "variables-manager-button",
|
|
@@ -2799,16 +2856,16 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2799
2856
|
onClick: handleOpenManager,
|
|
2800
2857
|
"aria-label": MANAGER_LABEL
|
|
2801
2858
|
},
|
|
2802
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ React22.createElement(SettingsIcon, { fontSize: SIZE5 })
|
|
2803
2860
|
))
|
|
2804
2861
|
);
|
|
2805
2862
|
}
|
|
2806
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2863
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2807
2864
|
const items = variables.map(({ value, label, key }) => ({
|
|
2808
2865
|
type: "item",
|
|
2809
2866
|
value: key,
|
|
2810
2867
|
label,
|
|
2811
|
-
icon: /* @__PURE__ */
|
|
2868
|
+
icon: /* @__PURE__ */ React22.createElement(StartIcon, { value }),
|
|
2812
2869
|
secondaryText: value,
|
|
2813
2870
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2814
2871
|
}));
|
|
@@ -2818,22 +2875,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2818
2875
|
const handleClearSearch = () => {
|
|
2819
2876
|
setSearchValue("");
|
|
2820
2877
|
};
|
|
2821
|
-
return /* @__PURE__ */
|
|
2878
|
+
return /* @__PURE__ */ React22.createElement(SectionPopoverBody3, null, /* @__PURE__ */ React22.createElement(
|
|
2822
2879
|
PopoverHeader3,
|
|
2823
2880
|
{
|
|
2824
|
-
title:
|
|
2825
|
-
icon: /* @__PURE__ */
|
|
2881
|
+
title: __16("Variables", "elementor"),
|
|
2882
|
+
icon: /* @__PURE__ */ React22.createElement(ColorFilterIcon2, { fontSize: SIZE5 }),
|
|
2826
2883
|
onClose: closePopover,
|
|
2827
2884
|
actions
|
|
2828
2885
|
}
|
|
2829
|
-
), hasVariables && /* @__PURE__ */
|
|
2886
|
+
), hasVariables && /* @__PURE__ */ React22.createElement(
|
|
2830
2887
|
SearchField2,
|
|
2831
2888
|
{
|
|
2832
2889
|
value: searchValue,
|
|
2833
2890
|
onSearch: handleSearch,
|
|
2834
|
-
placeholder:
|
|
2891
|
+
placeholder: __16("Search", "elementor")
|
|
2835
2892
|
}
|
|
2836
|
-
), /* @__PURE__ */
|
|
2893
|
+
), /* @__PURE__ */ React22.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(
|
|
2837
2894
|
PopoverMenuList,
|
|
2838
2895
|
{
|
|
2839
2896
|
items,
|
|
@@ -2843,66 +2900,66 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2843
2900
|
},
|
|
2844
2901
|
selectedValue: variable,
|
|
2845
2902
|
"data-testid": `${variableType}-variables-list`,
|
|
2846
|
-
menuListTemplate: (props) => /* @__PURE__ */
|
|
2847
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2903
|
+
menuListTemplate: (props) => /* @__PURE__ */ React22.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2904
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React22.createElement(MenuItemContent, { item, disabled })
|
|
2848
2905
|
}
|
|
2849
|
-
), disabled && /* @__PURE__ */
|
|
2906
|
+
), disabled && /* @__PURE__ */ React22.createElement(
|
|
2850
2907
|
PromotionAlert,
|
|
2851
2908
|
{
|
|
2852
2909
|
message: sprintf3(
|
|
2853
2910
|
/* translators: %s: Variable Type. */
|
|
2854
|
-
|
|
2911
|
+
__16("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2855
2912
|
variableType
|
|
2856
2913
|
),
|
|
2857
2914
|
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2858
2915
|
}
|
|
2859
|
-
)), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2916
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React22.createElement(
|
|
2860
2917
|
NoSearchResults,
|
|
2861
2918
|
{
|
|
2862
2919
|
searchValue,
|
|
2863
2920
|
onClear: handleClearSearch,
|
|
2864
|
-
icon: /* @__PURE__ */
|
|
2921
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" })
|
|
2865
2922
|
}
|
|
2866
|
-
), disabled && !hasVariables && /* @__PURE__ */
|
|
2923
|
+
), disabled && !hasVariables && /* @__PURE__ */ React22.createElement(
|
|
2867
2924
|
EmptyState,
|
|
2868
2925
|
{
|
|
2869
2926
|
title: sprintf3(
|
|
2870
2927
|
/* translators: %s: Variable Type. */
|
|
2871
|
-
|
|
2928
|
+
__16("No %s variables yet", "elementor"),
|
|
2872
2929
|
variableType
|
|
2873
2930
|
),
|
|
2874
2931
|
message: sprintf3(
|
|
2875
2932
|
/* translators: %s: Variable Type. */
|
|
2876
|
-
|
|
2933
|
+
__16("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2877
2934
|
variableType
|
|
2878
2935
|
),
|
|
2879
|
-
icon: /* @__PURE__ */
|
|
2936
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" })
|
|
2880
2937
|
},
|
|
2881
2938
|
emptyState
|
|
2882
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2939
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React22.createElement(
|
|
2883
2940
|
EmptyState,
|
|
2884
2941
|
{
|
|
2885
2942
|
title: sprintf3(
|
|
2886
2943
|
/* translators: %s: Variable Type. */
|
|
2887
|
-
|
|
2944
|
+
__16("Create your first %s variable", "elementor"),
|
|
2888
2945
|
variableType
|
|
2889
2946
|
),
|
|
2890
|
-
message:
|
|
2947
|
+
message: __16(
|
|
2891
2948
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2892
2949
|
"elementor"
|
|
2893
2950
|
),
|
|
2894
|
-
icon: /* @__PURE__ */
|
|
2951
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" }),
|
|
2895
2952
|
onAdd
|
|
2896
2953
|
}
|
|
2897
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2954
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React22.createElement(
|
|
2898
2955
|
EmptyState,
|
|
2899
2956
|
{
|
|
2900
|
-
title:
|
|
2901
|
-
message:
|
|
2957
|
+
title: __16("No compatible variables", "elementor"),
|
|
2958
|
+
message: __16(
|
|
2902
2959
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2903
2960
|
"elementor"
|
|
2904
2961
|
),
|
|
2905
|
-
icon: /* @__PURE__ */
|
|
2962
|
+
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: "large" }),
|
|
2906
2963
|
onAdd
|
|
2907
2964
|
}
|
|
2908
2965
|
));
|
|
@@ -2919,7 +2976,7 @@ var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable })
|
|
|
2919
2976
|
const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
|
|
2920
2977
|
open();
|
|
2921
2978
|
} : void 0;
|
|
2922
|
-
return /* @__PURE__ */
|
|
2979
|
+
return /* @__PURE__ */ React23.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React23.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2923
2980
|
propTypeKey,
|
|
2924
2981
|
currentView,
|
|
2925
2982
|
selectedVariable,
|
|
@@ -2966,7 +3023,7 @@ function RenderView(props) {
|
|
|
2966
3023
|
}
|
|
2967
3024
|
};
|
|
2968
3025
|
if (VIEW_LIST === props.currentView) {
|
|
2969
|
-
return /* @__PURE__ */
|
|
3026
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2970
3027
|
VariablesSelection,
|
|
2971
3028
|
{
|
|
2972
3029
|
closePopover: handlers.onClose,
|
|
@@ -2978,10 +3035,10 @@ function RenderView(props) {
|
|
|
2978
3035
|
);
|
|
2979
3036
|
}
|
|
2980
3037
|
if (VIEW_ADD === props.currentView) {
|
|
2981
|
-
return /* @__PURE__ */
|
|
3038
|
+
return /* @__PURE__ */ React23.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2982
3039
|
}
|
|
2983
3040
|
if (VIEW_EDIT === props.currentView) {
|
|
2984
|
-
return /* @__PURE__ */
|
|
3041
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2985
3042
|
VariableEdit,
|
|
2986
3043
|
{
|
|
2987
3044
|
editId: props.editId,
|
|
@@ -2995,26 +3052,26 @@ function RenderView(props) {
|
|
|
2995
3052
|
}
|
|
2996
3053
|
|
|
2997
3054
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2998
|
-
import * as
|
|
3055
|
+
import * as React24 from "react";
|
|
2999
3056
|
import { DetachIcon } from "@elementor/icons";
|
|
3000
|
-
import { Box as
|
|
3001
|
-
import { __ as
|
|
3057
|
+
import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography11, UnstableTag as Tag } from "@elementor/ui";
|
|
3058
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
3002
3059
|
var SIZE6 = "tiny";
|
|
3003
|
-
var UNLINK_LABEL =
|
|
3060
|
+
var UNLINK_LABEL = __17("Unlink variable", "elementor");
|
|
3004
3061
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
3005
3062
|
const actions = [];
|
|
3006
3063
|
if (onUnlink) {
|
|
3007
3064
|
actions.push(
|
|
3008
|
-
/* @__PURE__ */
|
|
3065
|
+
/* @__PURE__ */ React24.createElement(Tooltip4, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React24.createElement(IconButton8, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React24.createElement(DetachIcon, { fontSize: SIZE6 })))
|
|
3009
3066
|
);
|
|
3010
3067
|
}
|
|
3011
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ React24.createElement(Tooltip4, { title: label, placement: "top" }, /* @__PURE__ */ React24.createElement(
|
|
3012
3069
|
Tag,
|
|
3013
3070
|
{
|
|
3014
3071
|
fullWidth: true,
|
|
3015
3072
|
showActionsOnHover: true,
|
|
3016
|
-
startIcon: /* @__PURE__ */
|
|
3017
|
-
label: /* @__PURE__ */
|
|
3073
|
+
startIcon: /* @__PURE__ */ React24.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
3074
|
+
label: /* @__PURE__ */ React24.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React24.createElement(Typography11, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
3018
3075
|
actions,
|
|
3019
3076
|
...props
|
|
3020
3077
|
}
|
|
@@ -3025,7 +3082,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3025
3082
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3026
3083
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3027
3084
|
const { setValue } = useBoundProp6();
|
|
3028
|
-
const anchorRef =
|
|
3085
|
+
const anchorRef = useRef8(null);
|
|
3029
3086
|
const popupId = useId();
|
|
3030
3087
|
const popupState = usePopupState3({
|
|
3031
3088
|
variant: "popover",
|
|
@@ -3033,15 +3090,15 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3033
3090
|
});
|
|
3034
3091
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
3035
3092
|
const StartIcon = startIcon || (() => null);
|
|
3036
|
-
return /* @__PURE__ */
|
|
3093
|
+
return /* @__PURE__ */ React25.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React25.createElement(
|
|
3037
3094
|
AssignedTag,
|
|
3038
3095
|
{
|
|
3039
3096
|
label: variable.label,
|
|
3040
|
-
startIcon: /* @__PURE__ */
|
|
3097
|
+
startIcon: /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(ColorFilterIcon3, { fontSize: SIZE6 }), /* @__PURE__ */ React25.createElement(StartIcon, { value: variable.value })),
|
|
3041
3098
|
onUnlink: unlinkVariable,
|
|
3042
3099
|
...bindTrigger3(popupState)
|
|
3043
3100
|
}
|
|
3044
|
-
), /* @__PURE__ */
|
|
3101
|
+
), /* @__PURE__ */ React25.createElement(
|
|
3045
3102
|
Popover,
|
|
3046
3103
|
{
|
|
3047
3104
|
disableScrollLock: true,
|
|
@@ -3053,7 +3110,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3053
3110
|
},
|
|
3054
3111
|
...bindPopover(popupState)
|
|
3055
3112
|
},
|
|
3056
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ React25.createElement(
|
|
3057
3114
|
VariableSelectionPopover,
|
|
3058
3115
|
{
|
|
3059
3116
|
selectedVariable: variable,
|
|
@@ -3065,19 +3122,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3065
3122
|
};
|
|
3066
3123
|
|
|
3067
3124
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3068
|
-
import * as
|
|
3069
|
-
import { useId as useId2, useRef as
|
|
3125
|
+
import * as React29 from "react";
|
|
3126
|
+
import { useId as useId2, useRef as useRef9, useState as useState15 } from "react";
|
|
3070
3127
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
3071
|
-
import { Backdrop, bindPopover as bindPopover2, Box as
|
|
3072
|
-
import { __ as
|
|
3128
|
+
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
3129
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
3073
3130
|
|
|
3074
3131
|
// src/components/variable-restore.tsx
|
|
3075
|
-
import * as
|
|
3132
|
+
import * as React26 from "react";
|
|
3076
3133
|
import { useState as useState14 } from "react";
|
|
3077
3134
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
3078
3135
|
import { PopoverHeader as PopoverHeader4, SectionPopoverBody as SectionPopoverBody4 } from "@elementor/editor-ui";
|
|
3079
3136
|
import { Button as Button7, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography12 } from "@elementor/ui";
|
|
3080
|
-
import { __ as
|
|
3137
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
3081
3138
|
var SIZE7 = "tiny";
|
|
3082
3139
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
3083
3140
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -3137,22 +3194,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3137
3194
|
handleRestore();
|
|
3138
3195
|
}
|
|
3139
3196
|
};
|
|
3140
|
-
return /* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ React26.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React26.createElement(SectionPopoverBody4, { height: "auto" }, /* @__PURE__ */ React26.createElement(
|
|
3141
3198
|
PopoverHeader4,
|
|
3142
3199
|
{
|
|
3143
|
-
icon: /* @__PURE__ */
|
|
3144
|
-
title:
|
|
3200
|
+
icon: /* @__PURE__ */ React26.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3201
|
+
title: __18("Restore variable", "elementor"),
|
|
3145
3202
|
onClose
|
|
3146
3203
|
}
|
|
3147
|
-
), /* @__PURE__ */
|
|
3204
|
+
), /* @__PURE__ */ React26.createElement(Divider5, null), /* @__PURE__ */ React26.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React26.createElement(
|
|
3148
3205
|
FormField,
|
|
3149
3206
|
{
|
|
3150
3207
|
id: "variable-label",
|
|
3151
|
-
label:
|
|
3208
|
+
label: __18("Name", "elementor"),
|
|
3152
3209
|
errorMsg: labelFieldError?.message,
|
|
3153
3210
|
noticeMsg: labelHint(label)
|
|
3154
3211
|
},
|
|
3155
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ React26.createElement(
|
|
3156
3213
|
LabelField,
|
|
3157
3214
|
{
|
|
3158
3215
|
id: "variable-label",
|
|
@@ -3171,7 +3228,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3171
3228
|
onKeyDown: handleKeyDown
|
|
3172
3229
|
}
|
|
3173
3230
|
)
|
|
3174
|
-
), ValueField && /* @__PURE__ */
|
|
3231
|
+
), ValueField && /* @__PURE__ */ React26.createElement(FormField, { errorMsg: valueFieldError, label: __18("Value", "elementor") }, /* @__PURE__ */ React26.createElement(Typography12, { variant: "h5" }, /* @__PURE__ */ React26.createElement(
|
|
3175
3232
|
ValueField,
|
|
3176
3233
|
{
|
|
3177
3234
|
propTypeKey,
|
|
@@ -3186,25 +3243,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3186
3243
|
propType,
|
|
3187
3244
|
onKeyDown: handleKeyDown
|
|
3188
3245
|
}
|
|
3189
|
-
))), errorMessage && /* @__PURE__ */
|
|
3246
|
+
))), errorMessage && /* @__PURE__ */ React26.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React26.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React26.createElement(Button7, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __18("Restore", "elementor")))));
|
|
3190
3247
|
};
|
|
3191
3248
|
|
|
3192
3249
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3193
|
-
import * as
|
|
3250
|
+
import * as React27 from "react";
|
|
3194
3251
|
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as Typography13 } from "@elementor/ui";
|
|
3195
|
-
import { __ as
|
|
3252
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
3196
3253
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3197
|
-
return /* @__PURE__ */
|
|
3254
|
+
return /* @__PURE__ */ React27.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React27.createElement(
|
|
3198
3255
|
Alert2,
|
|
3199
3256
|
{
|
|
3200
3257
|
variant: "standard",
|
|
3201
3258
|
severity: "warning",
|
|
3202
3259
|
onClose,
|
|
3203
|
-
action: /* @__PURE__ */
|
|
3260
|
+
action: /* @__PURE__ */ React27.createElement(React27.Fragment, null, onUnlink && /* @__PURE__ */ React27.createElement(AlertAction2, { variant: "contained", onClick: onUnlink }, __19("Unlink", "elementor")), onRestore && /* @__PURE__ */ React27.createElement(AlertAction2, { variant: "outlined", onClick: onRestore }, __19("Restore", "elementor"))),
|
|
3204
3261
|
sx: { maxWidth: 300 }
|
|
3205
3262
|
},
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ React27.createElement(AlertTitle2, null, __19("Deleted variable", "elementor")),
|
|
3264
|
+
/* @__PURE__ */ React27.createElement(Typography13, { variant: "body2", color: "textPrimary" }, __19("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React27.createElement(Typography13, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", __19(
|
|
3208
3265
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3209
3266
|
"elementor"
|
|
3210
3267
|
))
|
|
@@ -3212,13 +3269,13 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3212
3269
|
};
|
|
3213
3270
|
|
|
3214
3271
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3215
|
-
import * as
|
|
3272
|
+
import * as React28 from "react";
|
|
3216
3273
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon4 } from "@elementor/icons";
|
|
3217
|
-
import { Box as
|
|
3218
|
-
var WarningVariableTag =
|
|
3274
|
+
import { Box as Box6, Chip, Tooltip as Tooltip5, Typography as Typography14 } from "@elementor/ui";
|
|
3275
|
+
var WarningVariableTag = React28.forwardRef(
|
|
3219
3276
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3220
3277
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3221
|
-
return /* @__PURE__ */
|
|
3278
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3222
3279
|
Chip,
|
|
3223
3280
|
{
|
|
3224
3281
|
ref,
|
|
@@ -3227,8 +3284,8 @@ var WarningVariableTag = React26.forwardRef(
|
|
|
3227
3284
|
shape: "rounded",
|
|
3228
3285
|
variant: "standard",
|
|
3229
3286
|
onClick,
|
|
3230
|
-
icon: /* @__PURE__ */
|
|
3231
|
-
label: /* @__PURE__ */
|
|
3287
|
+
icon: /* @__PURE__ */ React28.createElement(AlertTriangleFilledIcon4, null),
|
|
3288
|
+
label: /* @__PURE__ */ React28.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React28.createElement(Box6, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React28.createElement(Typography14, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3232
3289
|
sx: {
|
|
3233
3290
|
height: (theme) => theme.spacing(3.5),
|
|
3234
3291
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3250,7 +3307,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3250
3307
|
const [showInfotip, setShowInfotip] = useState15(false);
|
|
3251
3308
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3252
3309
|
const closeInfotip = () => setShowInfotip(false);
|
|
3253
|
-
const deletedChipAnchorRef =
|
|
3310
|
+
const deletedChipAnchorRef = useRef9(null);
|
|
3254
3311
|
const popupId = useId2();
|
|
3255
3312
|
const popupState = usePopupState4({
|
|
3256
3313
|
variant: "popover",
|
|
@@ -3278,7 +3335,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3278
3335
|
const handleRestoreWithOverrides = () => {
|
|
3279
3336
|
popupState.close();
|
|
3280
3337
|
};
|
|
3281
|
-
return /* @__PURE__ */
|
|
3338
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Box7, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React29.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React29.createElement(
|
|
3282
3339
|
Infotip2,
|
|
3283
3340
|
{
|
|
3284
3341
|
color: "warning",
|
|
@@ -3286,7 +3343,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3286
3343
|
open: showInfotip,
|
|
3287
3344
|
disableHoverListener: true,
|
|
3288
3345
|
onClose: closeInfotip,
|
|
3289
|
-
content: /* @__PURE__ */
|
|
3346
|
+
content: /* @__PURE__ */ React29.createElement(
|
|
3290
3347
|
DeletedVariableAlert,
|
|
3291
3348
|
{
|
|
3292
3349
|
onClose: closeInfotip,
|
|
@@ -3306,15 +3363,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3306
3363
|
}
|
|
3307
3364
|
}
|
|
3308
3365
|
},
|
|
3309
|
-
/* @__PURE__ */
|
|
3366
|
+
/* @__PURE__ */ React29.createElement(
|
|
3310
3367
|
WarningVariableTag,
|
|
3311
3368
|
{
|
|
3312
3369
|
label: variable.label,
|
|
3313
3370
|
onClick: toggleInfotip,
|
|
3314
|
-
suffix:
|
|
3371
|
+
suffix: __20("deleted", "elementor")
|
|
3315
3372
|
}
|
|
3316
3373
|
)
|
|
3317
|
-
), /* @__PURE__ */
|
|
3374
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3318
3375
|
Popover2,
|
|
3319
3376
|
{
|
|
3320
3377
|
disableScrollLock: true,
|
|
@@ -3325,7 +3382,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3325
3382
|
},
|
|
3326
3383
|
...bindPopover2(popupState)
|
|
3327
3384
|
},
|
|
3328
|
-
/* @__PURE__ */
|
|
3385
|
+
/* @__PURE__ */ React29.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React29.createElement(
|
|
3329
3386
|
VariableRestore,
|
|
3330
3387
|
{
|
|
3331
3388
|
variableId: variable.key ?? "",
|
|
@@ -3337,46 +3394,46 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3337
3394
|
};
|
|
3338
3395
|
|
|
3339
3396
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3340
|
-
import * as
|
|
3341
|
-
import { useId as useId3, useRef as
|
|
3397
|
+
import * as React31 from "react";
|
|
3398
|
+
import { useId as useId3, useRef as useRef10, useState as useState16 } from "react";
|
|
3342
3399
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
3343
|
-
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as
|
|
3344
|
-
import { __ as
|
|
3400
|
+
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box8, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
3401
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
3345
3402
|
|
|
3346
3403
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3347
|
-
import * as
|
|
3404
|
+
import * as React30 from "react";
|
|
3348
3405
|
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as Typography15 } from "@elementor/ui";
|
|
3349
|
-
import { __ as
|
|
3406
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3350
3407
|
var i18n = {
|
|
3351
|
-
title:
|
|
3352
|
-
message:
|
|
3408
|
+
title: __21("Variable has changed", "elementor"),
|
|
3409
|
+
message: __21(
|
|
3353
3410
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3354
3411
|
"elementor"
|
|
3355
3412
|
),
|
|
3356
3413
|
buttons: {
|
|
3357
|
-
clear:
|
|
3358
|
-
select:
|
|
3414
|
+
clear: __21("Clear", "elementor"),
|
|
3415
|
+
select: __21("Select variable", "elementor")
|
|
3359
3416
|
}
|
|
3360
3417
|
};
|
|
3361
3418
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3362
|
-
return /* @__PURE__ */
|
|
3419
|
+
return /* @__PURE__ */ React30.createElement(ClickAwayListener3, { onClickAway: onClose }, /* @__PURE__ */ React30.createElement(
|
|
3363
3420
|
Alert3,
|
|
3364
3421
|
{
|
|
3365
3422
|
variant: "standard",
|
|
3366
3423
|
severity: "warning",
|
|
3367
3424
|
onClose,
|
|
3368
|
-
action: /* @__PURE__ */
|
|
3425
|
+
action: /* @__PURE__ */ React30.createElement(React30.Fragment, null, onClear && /* @__PURE__ */ React30.createElement(AlertAction3, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React30.createElement(AlertAction3, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3369
3426
|
sx: { maxWidth: 300 }
|
|
3370
3427
|
},
|
|
3371
|
-
/* @__PURE__ */
|
|
3372
|
-
/* @__PURE__ */
|
|
3428
|
+
/* @__PURE__ */ React30.createElement(AlertTitle3, null, i18n.title),
|
|
3429
|
+
/* @__PURE__ */ React30.createElement(Typography15, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3373
3430
|
));
|
|
3374
3431
|
};
|
|
3375
3432
|
|
|
3376
3433
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3377
3434
|
var MismatchVariable = ({ variable }) => {
|
|
3378
3435
|
const { setValue, value } = useBoundProp9();
|
|
3379
|
-
const anchorRef =
|
|
3436
|
+
const anchorRef = useRef10(null);
|
|
3380
3437
|
const popupId = useId3();
|
|
3381
3438
|
const popupState = usePopupState5({
|
|
3382
3439
|
variant: "popover",
|
|
@@ -3395,7 +3452,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3395
3452
|
setValue(null);
|
|
3396
3453
|
};
|
|
3397
3454
|
const showClearButton = !!value;
|
|
3398
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ React31.createElement(Box8, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React31.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React31.createElement(
|
|
3399
3456
|
Infotip3,
|
|
3400
3457
|
{
|
|
3401
3458
|
color: "warning",
|
|
@@ -3403,7 +3460,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3403
3460
|
open: infotipVisible,
|
|
3404
3461
|
disableHoverListener: true,
|
|
3405
3462
|
onClose: closeInfotip,
|
|
3406
|
-
content: /* @__PURE__ */
|
|
3463
|
+
content: /* @__PURE__ */ React31.createElement(
|
|
3407
3464
|
MismatchVariableAlert,
|
|
3408
3465
|
{
|
|
3409
3466
|
onClose: closeInfotip,
|
|
@@ -3422,15 +3479,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3422
3479
|
}
|
|
3423
3480
|
}
|
|
3424
3481
|
},
|
|
3425
|
-
/* @__PURE__ */
|
|
3482
|
+
/* @__PURE__ */ React31.createElement(
|
|
3426
3483
|
WarningVariableTag,
|
|
3427
3484
|
{
|
|
3428
3485
|
label: variable.label,
|
|
3429
3486
|
onClick: toggleInfotip,
|
|
3430
|
-
suffix:
|
|
3487
|
+
suffix: __22("changed", "elementor")
|
|
3431
3488
|
}
|
|
3432
3489
|
)
|
|
3433
|
-
), /* @__PURE__ */
|
|
3490
|
+
), /* @__PURE__ */ React31.createElement(
|
|
3434
3491
|
Popover3,
|
|
3435
3492
|
{
|
|
3436
3493
|
disableScrollLock: true,
|
|
@@ -3442,7 +3499,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3442
3499
|
},
|
|
3443
3500
|
...bindPopover3(popupState)
|
|
3444
3501
|
},
|
|
3445
|
-
/* @__PURE__ */
|
|
3502
|
+
/* @__PURE__ */ React31.createElement(
|
|
3446
3503
|
VariableSelectionPopover,
|
|
3447
3504
|
{
|
|
3448
3505
|
selectedVariable: variable,
|
|
@@ -3454,28 +3511,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3454
3511
|
};
|
|
3455
3512
|
|
|
3456
3513
|
// src/components/ui/variable/missing-variable.tsx
|
|
3457
|
-
import * as
|
|
3514
|
+
import * as React33 from "react";
|
|
3458
3515
|
import { useState as useState17 } from "react";
|
|
3459
3516
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
3460
3517
|
import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
|
|
3461
|
-
import { __ as
|
|
3518
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3462
3519
|
|
|
3463
3520
|
// src/components/ui/missing-variable-alert.tsx
|
|
3464
|
-
import * as
|
|
3521
|
+
import * as React32 from "react";
|
|
3465
3522
|
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as Typography16 } from "@elementor/ui";
|
|
3466
|
-
import { __ as
|
|
3523
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3467
3524
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3468
|
-
return /* @__PURE__ */
|
|
3525
|
+
return /* @__PURE__ */ React32.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React32.createElement(
|
|
3469
3526
|
Alert4,
|
|
3470
3527
|
{
|
|
3471
3528
|
variant: "standard",
|
|
3472
3529
|
severity: "warning",
|
|
3473
3530
|
onClose,
|
|
3474
|
-
action: /* @__PURE__ */
|
|
3531
|
+
action: /* @__PURE__ */ React32.createElement(React32.Fragment, null, onClear && /* @__PURE__ */ React32.createElement(AlertAction4, { variant: "contained", onClick: onClear }, __23("Clear", "elementor"))),
|
|
3475
3532
|
sx: { maxWidth: 300 }
|
|
3476
3533
|
},
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ React32.createElement(AlertTitle4, null, __23("This variable is missing", "elementor")),
|
|
3535
|
+
/* @__PURE__ */ React32.createElement(Typography16, { variant: "body2", color: "textPrimary" }, __23(
|
|
3479
3536
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3480
3537
|
"elementor"
|
|
3481
3538
|
))
|
|
@@ -3489,7 +3546,7 @@ var MissingVariable = () => {
|
|
|
3489
3546
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3490
3547
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3491
3548
|
const clearValue = () => setValue(null);
|
|
3492
|
-
return /* @__PURE__ */
|
|
3549
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, infotipVisible && /* @__PURE__ */ React33.createElement(Backdrop3, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React33.createElement(
|
|
3493
3550
|
Infotip4,
|
|
3494
3551
|
{
|
|
3495
3552
|
color: "warning",
|
|
@@ -3497,7 +3554,7 @@ var MissingVariable = () => {
|
|
|
3497
3554
|
open: infotipVisible,
|
|
3498
3555
|
disableHoverListener: true,
|
|
3499
3556
|
onClose: closeInfotip,
|
|
3500
|
-
content: /* @__PURE__ */
|
|
3557
|
+
content: /* @__PURE__ */ React33.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3501
3558
|
slotProps: {
|
|
3502
3559
|
popper: {
|
|
3503
3560
|
modifiers: [
|
|
@@ -3509,7 +3566,7 @@ var MissingVariable = () => {
|
|
|
3509
3566
|
}
|
|
3510
3567
|
}
|
|
3511
3568
|
},
|
|
3512
|
-
/* @__PURE__ */
|
|
3569
|
+
/* @__PURE__ */ React33.createElement(WarningVariableTag, { label: __24("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3513
3570
|
));
|
|
3514
3571
|
};
|
|
3515
3572
|
|
|
@@ -3519,37 +3576,37 @@ var VariableControl = () => {
|
|
|
3519
3576
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3520
3577
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3521
3578
|
if (!assignedVariable) {
|
|
3522
|
-
return /* @__PURE__ */
|
|
3579
|
+
return /* @__PURE__ */ React34.createElement(MissingVariable, null);
|
|
3523
3580
|
}
|
|
3524
3581
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3525
3582
|
if (assignedVariable?.deleted) {
|
|
3526
|
-
return /* @__PURE__ */
|
|
3583
|
+
return /* @__PURE__ */ React34.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3527
3584
|
}
|
|
3528
3585
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3529
3586
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3530
|
-
return /* @__PURE__ */
|
|
3587
|
+
return /* @__PURE__ */ React34.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3531
3588
|
}
|
|
3532
|
-
return /* @__PURE__ */
|
|
3589
|
+
return /* @__PURE__ */ React34.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3533
3590
|
};
|
|
3534
3591
|
|
|
3535
3592
|
// src/hooks/use-prop-variable-action.tsx
|
|
3536
|
-
import * as
|
|
3593
|
+
import * as React35 from "react";
|
|
3537
3594
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-controls";
|
|
3538
3595
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
3539
|
-
import { __ as
|
|
3596
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3540
3597
|
var usePropVariableAction = () => {
|
|
3541
3598
|
const { propType, path } = useBoundProp12();
|
|
3542
3599
|
const variable = resolveVariableFromPropType(propType);
|
|
3543
3600
|
return {
|
|
3544
3601
|
visible: Boolean(variable),
|
|
3545
3602
|
icon: ColorFilterIcon4,
|
|
3546
|
-
title:
|
|
3603
|
+
title: __25("Variables", "elementor"),
|
|
3547
3604
|
content: ({ close: closePopover }) => {
|
|
3548
3605
|
if (!variable) {
|
|
3549
3606
|
return null;
|
|
3550
3607
|
}
|
|
3551
3608
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3552
|
-
return /* @__PURE__ */
|
|
3609
|
+
return /* @__PURE__ */ React35.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3553
3610
|
}
|
|
3554
3611
|
};
|
|
3555
3612
|
};
|
|
@@ -3696,21 +3753,21 @@ function initMcp() {
|
|
|
3696
3753
|
}
|
|
3697
3754
|
|
|
3698
3755
|
// src/register-variable-types.tsx
|
|
3699
|
-
import * as
|
|
3756
|
+
import * as React38 from "react";
|
|
3700
3757
|
import { colorPropTypeUtil, sizePropTypeUtil, stringPropTypeUtil } from "@elementor/editor-props";
|
|
3701
3758
|
import { CtaButton } from "@elementor/editor-ui";
|
|
3702
3759
|
import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
|
|
3703
3760
|
import { BrushIcon as BrushIcon2, ExpandDiagonalIcon, ResetIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
3704
|
-
import { __ as
|
|
3761
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
3705
3762
|
|
|
3706
3763
|
// src/components/fields/color-field.tsx
|
|
3707
|
-
import * as
|
|
3708
|
-
import { useRef as
|
|
3764
|
+
import * as React36 from "react";
|
|
3765
|
+
import { useRef as useRef11, useState as useState18 } from "react";
|
|
3709
3766
|
import { UnstableColorField } from "@elementor/ui";
|
|
3710
3767
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3711
3768
|
const [color, setColor] = useState18(value);
|
|
3712
3769
|
const [errorMessage, setErrorMessage] = useState18("");
|
|
3713
|
-
const defaultRef =
|
|
3770
|
+
const defaultRef = useRef11(null);
|
|
3714
3771
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3715
3772
|
const handleChange = (newValue) => {
|
|
3716
3773
|
setColor(newValue);
|
|
@@ -3719,7 +3776,7 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3719
3776
|
onValidationChange?.(errorMsg);
|
|
3720
3777
|
onChange(errorMsg ? "" : newValue);
|
|
3721
3778
|
};
|
|
3722
|
-
return /* @__PURE__ */
|
|
3779
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3723
3780
|
UnstableColorField,
|
|
3724
3781
|
{
|
|
3725
3782
|
id: "color-variable-field",
|
|
@@ -3748,21 +3805,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3748
3805
|
};
|
|
3749
3806
|
|
|
3750
3807
|
// src/components/fields/font-field.tsx
|
|
3751
|
-
import * as
|
|
3752
|
-
import { useId as useId4, useRef as
|
|
3808
|
+
import * as React37 from "react";
|
|
3809
|
+
import { useId as useId4, useRef as useRef12, useState as useState19 } from "react";
|
|
3753
3810
|
import { enqueueFont as enqueueFont2, ItemSelector, useFontFamilies } from "@elementor/editor-controls";
|
|
3754
3811
|
import { useSectionWidth } from "@elementor/editor-ui";
|
|
3755
3812
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
3756
3813
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
3757
|
-
import { __ as
|
|
3814
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
3758
3815
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3759
3816
|
const [fontFamily, setFontFamily] = useState19(value);
|
|
3760
|
-
const defaultRef =
|
|
3817
|
+
const defaultRef = useRef12(null);
|
|
3761
3818
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3762
3819
|
const fontPopoverState = usePopupState6({ variant: "popover" });
|
|
3763
3820
|
const fontFamilies = useFontFamilies();
|
|
3764
3821
|
const sectionWidth = useSectionWidth();
|
|
3765
|
-
const mapFontSubs =
|
|
3822
|
+
const mapFontSubs = React37.useMemo(() => {
|
|
3766
3823
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3767
3824
|
label,
|
|
3768
3825
|
items: fonts
|
|
@@ -3779,17 +3836,17 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3779
3836
|
fontPopoverState.close();
|
|
3780
3837
|
};
|
|
3781
3838
|
const id2 = useId4();
|
|
3782
|
-
return /* @__PURE__ */
|
|
3839
|
+
return /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(
|
|
3783
3840
|
UnstableTag,
|
|
3784
3841
|
{
|
|
3785
3842
|
id: id2,
|
|
3786
3843
|
variant: "outlined",
|
|
3787
3844
|
label: fontFamily,
|
|
3788
|
-
endIcon: /* @__PURE__ */
|
|
3845
|
+
endIcon: /* @__PURE__ */ React37.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
3789
3846
|
...bindTrigger4(fontPopoverState),
|
|
3790
3847
|
fullWidth: true
|
|
3791
3848
|
}
|
|
3792
|
-
), /* @__PURE__ */
|
|
3849
|
+
), /* @__PURE__ */ React37.createElement(
|
|
3793
3850
|
Popover4,
|
|
3794
3851
|
{
|
|
3795
3852
|
disablePortal: true,
|
|
@@ -3799,7 +3856,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3799
3856
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3800
3857
|
...bindPopover4(fontPopoverState)
|
|
3801
3858
|
},
|
|
3802
|
-
/* @__PURE__ */
|
|
3859
|
+
/* @__PURE__ */ React37.createElement(
|
|
3803
3860
|
ItemSelector,
|
|
3804
3861
|
{
|
|
3805
3862
|
id: "font-family-variables-selector",
|
|
@@ -3808,7 +3865,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3808
3865
|
onItemChange: handleFontFamilyChange,
|
|
3809
3866
|
onClose: fontPopoverState.close,
|
|
3810
3867
|
sectionWidth,
|
|
3811
|
-
title:
|
|
3868
|
+
title: __26("Font family", "elementor"),
|
|
3812
3869
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3813
3870
|
onDebounce: enqueueFont2,
|
|
3814
3871
|
icon: TextIcon
|
|
@@ -3837,7 +3894,7 @@ function registerVariableTypes() {
|
|
|
3837
3894
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3838
3895
|
fallbackPropTypeUtil: colorPropTypeUtil,
|
|
3839
3896
|
variableType: "color",
|
|
3840
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3897
|
+
startIcon: ({ value }) => /* @__PURE__ */ React38.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3841
3898
|
defaultValue: "#ffffff",
|
|
3842
3899
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3843
3900
|
const actions = [];
|
|
@@ -3846,14 +3903,14 @@ function registerVariableTypes() {
|
|
|
3846
3903
|
}
|
|
3847
3904
|
if (variable.sync_to_v3) {
|
|
3848
3905
|
actions.push({
|
|
3849
|
-
name:
|
|
3906
|
+
name: __27("Stop syncing to Version 3", "elementor"),
|
|
3850
3907
|
icon: ResetIcon,
|
|
3851
3908
|
color: "text.primary",
|
|
3852
3909
|
onClick: () => handlers.onStopSync(variableId)
|
|
3853
3910
|
});
|
|
3854
3911
|
} else {
|
|
3855
3912
|
actions.push({
|
|
3856
|
-
name:
|
|
3913
|
+
name: __27("Sync to Version 3", "elementor"),
|
|
3857
3914
|
icon: ResetIcon,
|
|
3858
3915
|
color: "text.primary",
|
|
3859
3916
|
onClick: () => handlers.onStartSync(variableId)
|
|
@@ -3879,7 +3936,7 @@ function registerVariableTypes() {
|
|
|
3879
3936
|
styleTransformer: EmptyTransformer,
|
|
3880
3937
|
variableType: "size",
|
|
3881
3938
|
selectionFilter: () => [],
|
|
3882
|
-
emptyState: /* @__PURE__ */
|
|
3939
|
+
emptyState: /* @__PURE__ */ React38.createElement(CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3883
3940
|
};
|
|
3884
3941
|
registerVariableType({
|
|
3885
3942
|
...sizePromotions,
|
|
@@ -3893,7 +3950,7 @@ function registerVariableTypes() {
|
|
|
3893
3950
|
}
|
|
3894
3951
|
|
|
3895
3952
|
// src/renderers/style-variables-renderer.tsx
|
|
3896
|
-
import * as
|
|
3953
|
+
import * as React39 from "react";
|
|
3897
3954
|
import { useEffect as useEffect6, useState as useState20 } from "react";
|
|
3898
3955
|
import {
|
|
3899
3956
|
__privateUseListenTo as useListenTo,
|
|
@@ -3911,7 +3968,7 @@ function StyleVariablesRenderer() {
|
|
|
3911
3968
|
}
|
|
3912
3969
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3913
3970
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3914
|
-
return /* @__PURE__ */
|
|
3971
|
+
return /* @__PURE__ */ React39.createElement(Portal, { container }, /* @__PURE__ */ React39.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3915
3972
|
}
|
|
3916
3973
|
function usePortalContainer() {
|
|
3917
3974
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
@@ -3941,22 +3998,22 @@ import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elemen
|
|
|
3941
3998
|
import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
3942
3999
|
|
|
3943
4000
|
// src/components/variables-repeater-item-slot.tsx
|
|
3944
|
-
import * as
|
|
4001
|
+
import * as React40 from "react";
|
|
3945
4002
|
var useColorVariable = (value) => {
|
|
3946
4003
|
const variableId = value?.value?.color?.value;
|
|
3947
4004
|
return useVariable(variableId || "");
|
|
3948
4005
|
};
|
|
3949
4006
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3950
4007
|
const colorVariable = useColorVariable(value);
|
|
3951
|
-
return /* @__PURE__ */
|
|
4008
|
+
return /* @__PURE__ */ React40.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3952
4009
|
};
|
|
3953
4010
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3954
4011
|
const colorVariable = useColorVariable(value);
|
|
3955
|
-
return /* @__PURE__ */
|
|
4012
|
+
return /* @__PURE__ */ React40.createElement("span", null, colorVariable?.label);
|
|
3956
4013
|
};
|
|
3957
4014
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3958
4015
|
const colorVariable = useColorVariable(value);
|
|
3959
|
-
return /* @__PURE__ */
|
|
4016
|
+
return /* @__PURE__ */ React40.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3960
4017
|
};
|
|
3961
4018
|
|
|
3962
4019
|
// src/repeater-injections.ts
|